Esempio n. 1
0
 // 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);
     // backup and delete live new slug file
     $redirect = "edit.php?id=" . $id . "&nodraft&old=" . $_GET['new'] . "&upd=edit-success&type=restore";
 } else {
     $success = restore_page($id);
     // restore old slug file
     $redirect = "edit.php?id=" . $id . "&nodraft&upd=edit-success&type=restore";
 }
 generate_sitemap();
 // regenerates sitemap
 exec_action('page-restore');
 // @hook page-restore fird when a page is restored
Esempio n. 2
0
 }
 if (isset($_POST['post-metar-noarchive'])) {
     $data['metarNoArchive'] = 1;
 } else {
     $data['metarNoArchive'] = 0;
 }
 // overwrite set for editing pages only, else we autoincrement slug if newpage or slughaschanged
 $xml = createPageXml($title, $postslug, $data, $overwrite);
 $url = (string) $xml->url;
 // legacy global for hooks
 if (!$draft) {
     // if the slug changed update children
     if ($slugHasChanged) {
         exec_action('changedata-updateslug');
         // @hook changedata-updateslug a page slug was changed
         changeChildParents($oldslug, $url);
         // update childrens parent slugs to the new slug
         delete_page($oldslug);
         // backup and delete the page
     }
     exec_action('changedata-save');
     // @hook changedata-save prior to saving a page
     $xml = exec_filter('pagesavexml', $xml);
     // @filter pagesavexml (obj) xml object of a page save
     savePageXml($xml);
     exec_action('changedata-aftersave');
     // @hook changedata-aftersave after a page was saved
     // genen sitemap if published save
     generate_sitemap();
 } else {
     exec_action('changedata-save-draft');
Esempio n. 3
0
function updateSlugs($existingUrl)
{
    global $url;
    changeChildParents($existingUrl, $url);
}
Esempio n. 4
0
 * @package GetSimple
 * @subpackage Delete-Files
 */
// Setup inclusions
$load['plugin'] = true;
// Include common.php
include 'inc/common.php';
login_cookie_check();
check_for_csrf("delete", "deletefile.php");
// are we deleting pages?
if (isset($_GET['id'])) {
    $id = $_GET['id'];
    if ($id == 'index') {
        redirect('pages.php?upd=edit-error&type=' . urlencode(i18n_r('HOMEPAGE_DELETE_ERROR')));
    } else {
        changeChildParents($id);
        $status = delete_page($id) ? 'success' : 'error';
        generate_sitemap();
        exec_action('page-delete');
        // @hook page-delete deleting page
        redirect("pages.php?upd=del-" . $status . "&id=" . $id . "&type=delete");
        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");