예제 #1
0
}
if ($p == 'delete') {
    // deleting page backup
    check_for_csrf("delete", "backup-edit.php");
    if ($draft) {
        $status = delete_draft_backup($id) ? 'success' : 'err';
    } else {
        $status = delete_page_backup($id) ? 'success' : 'err';
    }
    redirect("backups.php?upd=bak-" . $status . "&id=" . $id);
} elseif ($p == 'restore') {
    // restoring page backup
    check_for_csrf("restore", "backup-edit.php");
    $redirect = "";
    if ($draft) {
        restore_draft($id);
        // restore old slug file
        // generate_sitemap(); // regenerates sitemap, we do not need to do this for drafts.
        $success = exec_action('draft-restore');
        // @hook draft-restore fired when a draft is restored
        redirect("edit.php?id=" . $id . "&upd-draft&upd=edit-success&type=restore");
    }
    if (isset($_GET['new'])) {
        $newid = $_GET['new'];
        // @todo traversal protect $newid
        // restore page by old slug id
        changeChildParents($newid, $id);
        // update parents and children
        $success = restore_page($id);
        // restore old slug file
        delete_page($newid);
예제 #2
0
}
if ($p == 'delete') {
    // deleting page backup
    check_for_csrf("delete", "backup-edit.php");
    if ($draft) {
        $status = delete_draft_backup($id) ? 'success' : 'err';
    } else {
        $status = delete_page_backup($id) ? 'success' : 'err';
    }
    redirect("backups.php?upd=bak-" . $status . "&id=" . $id);
} elseif ($p == 'restore') {
    // restoring page backup
    check_for_csrf("restore", "backup-edit.php");
    $redirect = "";
    if ($draft) {
        $success = restore_draft($id);
        // restore old slug file
        // generate_sitemap(); // regenerates sitemap, we do not need to do this for drafts.
        exec_action('draft-restore');
        // @hook draft-restore fired when a draft is restored
        redirect("edit.php?id=" . $id . "&upd-draft&upd=edit-success&type=restore");
    }
    if (isset($_GET['new'])) {
        $newid = $_GET['new'];
        // @todo traversal protect $newid
        // restore page by old slug id
        changeChildParents($newid, $id);
        // update parents and children
        $success = restore_page($id);
        // restore old slug file
        delete_page($newid);