Exemple #1
0
if (isset($_GET['id'])) {
    $id = $_GET['id'];
    if ($id == 'index') {
        redirect('pages.php?upd=edit-error&type=' . urlencode(i18n_r('HOMEPAGE_DELETE_ERROR')));
    } else {
        updateSlugs($id);
        $status = delete_file($id);
        generate_sitemap();
        exec_action('page-delete');
        redirect("pages.php?upd=edit-" . $status . "&id=" . $id . "&type=delete");
    }
}
// are we deleting archives?
if (isset($_GET['zip'])) {
    $zip = $_GET['zip'];
    $status = delete_zip($zip);
    redirect("archive.php?upd=del-" . $status . "&id=" . $zip);
}
// are we deleting uploads?
if (isset($_GET['file'])) {
    $path = isset($_GET['path']) ? $_GET['path'] : "";
    $file = $_GET['file'];
    $status = delete_upload($file, $path);
    redirect("upload.php?upd=del-" . $status . "&id=" . $file . "&path=" . $path);
}
// are we deleting a folder?
if (isset($_GET['folder'])) {
    $path = isset($_GET['path']) ? $_GET['path'] : "";
    $folder = $_GET['folder'];
    $target = GSDATAUPLOADPATH . $path . $folder;
    if (path_is_safe($target, GSDATAUPLOADPATH) && file_exists($target)) {
        die;
    }
}
// are we deleting page draft?
if (isset($_GET['draft'])) {
    $id = $_GET['draft'];
    $status = delete_draft($id) ? 'success' : 'error';
    exec_action('draft-delete');
    // @hook draft-delete deleting a page draft
    redirect("pages.php?upd=edit-" . $status . "&id=" . $id . "&type=delete");
    die;
}
// Delete archive
if (isset($_GET['zip'])) {
    $zip = $_GET['zip'];
    $status = delete_zip($zip) ? 'success' : 'error';
    exec_action('zip-delete');
    // @hook zip-delete deleting archive zip
    redirect("archive.php?upd=del-" . $status . "&id=" . $zip);
    die;
}
// Delete upload file
if (isset($_GET['file']) && getDef('GSALLOWUPLOADDELETE', true)) {
    $path = isset($_GET['path']) ? $_GET['path'] : "";
    $file = $_GET['file'];
    $status = delete_upload($file, $path) ? 'success' : 'error';
    exec_action('upload-delete');
    // @hook upload-delete deleting uploads file
    redirect("upload.php?upd=del-" . $status . "&id=" . $file . "&path=" . $path);
    die;
}