Esempio n. 1
0
function pte_delete_images()
{
    // Require JSON output
    pte_require_json();
    $id = (int) $_GET['id'];
    if (pte_check_id($id) === false) {
        return pte_json_error("ID invalid: {$id}");
    }
    // Check nonce
    if (!check_ajax_referer("pte-delete-{$id}", 'pte-nonce', false)) {
        return pte_json_error("CSRF Check failed");
    }
    // SETS PTE_TMP_DIR and PTE_TMP_URL
    extract(pte_tmp_dir());
    $PTE_TMP_DIR = $PTE_TMP_DIR . $id . DIRECTORY_SEPARATOR;
    // Delete tmpdir
    PteLogger::debug("Deleting [{$PTE_TMP_DIR}]");
    pte_rmdir($PTE_TMP_DIR);
    return pte_json_encode(array("success" => "Yay!"));
}
Esempio n. 2
0
function pte_delete_images()
{
    // Require JSON output
    pte_require_json();
    $id = (int) $_GET['id'];
    if (pte_check_id($id) === false) {
        return pte_json_error("ID invalid: {$id}");
    }
    // Check nonce
    if (!check_ajax_referer("pte-delete-{$id}", 'pte-nonce', false)) {
        return pte_json_error("CSRF Check failed");
    }
    $uploads = wp_upload_dir();
    $PTE_TMP_DIR = $uploads['basedir'] . DIRECTORY_SEPARATOR . "ptetmp" . DIRECTORY_SEPARATOR . $id;
    // Delete tmpdir
    pte_rmdir($PTE_TMP_DIR);
    return pte_json_encode(array("success" => "Yay!"));
}