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 if ($redirect) { redirect($redirect); } }
<?php require 'header.php'; $msg = ""; $_id = ""; if (isset($_POST['action']) == 'delete') { $title = $_POST['title']; $query = $db->query("SELECT * FROM page WHERE title = '{$title}'"); foreach ($query->fetchAll() as $row) { $_id = $row['id']; } $query = $db->query("DELETE FROM occurrence WHERE page_id = '{$_id}'"); $msg = delete_page($title); } ?> <link href="../css/typeahead.css" rel="stylesheet"> <div id="page-wrapper"> <div class="row"> <div class="col-lg-12"> <h1 class="page-header">Delete Page</h1> <div class="row"> <form role="form" method="post" action=""> <div class="col-lg-6"> <input type="hidden" class="form-control" name="action" value="delete"> <div class="form-group"> <div id="the-basics">
* */ require '../../config.php'; require_once WB_PATH . '/framework/class.admin.php'; $admin = new admin('Pages', 'pages'); // Include the WB functions file require_once WB_PATH . '/framework/functions.php'; // Get page list from database // $database = new database(); $query = "SELECT * FROM " . TABLE_PREFIX . "pages WHERE visibility = 'deleted' ORDER BY level DESC"; $get_pages = $database->query($query); // Insert values into main page list if ($get_pages->numRows() > 0) { while ($page = $get_pages->fetchRow()) { // Delete page subs $sub_pages = get_subs($page['page_id'], array()); foreach ($sub_pages as $sub_page_id) { delete_page($sub_page_id); } // Delete page delete_page($page['page_id']); } } // Check if there is a db error, otherwise say successful if ($database->is_error()) { $admin->print_error($database->get_error()); } else { $admin->print_success($TEXT['TRASH_EMPTIED']); } // Print admin $admin->print_footer();
not_found(); } $page = $page[0]; render('delete-page', array('title' => 'Delete page - ' . blog_title(), 'description' => blog_description(), 'canonical' => site_url(), 'bodyclass' => 'deletepage', 'breadcrumb' => '<a href="' . site_url() . '">' . config('breadcrumb.home') . '</a> » <a href="' . $post->url . '">' . $post->title . '</a>' . $page->title, 'p' => $page, 'type' => 'subPage')); } else { $login = site_url() . 'login'; header("location: {$login}"); } }); // Submitted data from delete sub static page post('/:static/:sub/delete', function () { $proper = is_csrf_proper(from($_REQUEST, 'csrf_token')); if ($proper && login()) { $file = from($_REQUEST, 'file'); $destination = from($_GET, 'destination'); delete_page($file, $destination); } }); // Show blog post with year-month get('/:year/:month/:name', function ($year, $month, $name) { if (config('permalink.type') == 'post') { $redir = site_url() . 'post/' . $name; header("location: {$redir}", TRUE, 301); } if (config("views.counter") != "true") { if (!login()) { file_cache($_SERVER['REQUEST_URI']); } } $post = find_post($year, $month, $name); $current = $post['current'];
function content() { global $pagenum, $selected, $message, $menu, $set, $langmessage, $LNEversion, $out, $prefix; if ($message != "") { $out .= "<div class=\"LNE_message\">" . $message . "</div>\n"; } if ($_SESSION['adminlevel'] > 3) { $out .= adminmenu(); } switch ($_GET['do']) { case "search": $out .= "<h2 class=\"LNE_title\">{$langmessage['66']}</h2>\n"; $out .= search(); break; case "register": if ($set['gzip']) { $out .= register(); } break; case "addons": $out .= addons(); break; case "create": $out .= create_page(); break; case "database": $out .= query(); break; case "delete": delete_page(); break; case "edit": print $out; $out = ""; editpage(); break; case "editextra": print $out; $out = ""; extras(); break; case "editmenu": $out .= editmenu(); break; case "login": $out .= loginform(); break; case "plugins": $out .= plugins(); break; case "profile": if ($_SESSION[$set['password']] == "1") { $out .= profile(); } break; case "query": $out .= query(); break; case "settings": $out .= settings(); break; case "setup": $out .= setup(); break; case "sitemap": $out .= showsitemap($langmessage, 0); break; case "users": $out .= users(); break; default: $addons = fetch_all(dbquery("SELECT * FROM " . $prefix . "addons WHERE active=1")); $found = false; foreach ($addons as $addon) { if ($_GET['do'] == $addon['name'] && $_SESSION['adminlevel'] >= $addon['adminlevel']) { require_once "addons/" . $addon['name'] . "/admin.php"; $out .= $addon['aname'](); $found = true; break; } } if (!$found) { $result = dbquery("SELECT * FROM " . $prefix . "paginas WHERE page=\"" . $pagenum . "\""); if ($row = fetch_array($result)) { if ($row['restricted'] != 0 && $row['restricted'] > $_SESSION['adminlevel']) { $out .= restrictedpage($row['restricted']); } else { $contnt = html_entity_decode(stripslashes($row['content'])); showcontent($contnt); } } else { $result = dbquery("SELECT * FROM " . $prefix . "paginas WHERE page=\"index\""); if ($row = fetch_array($result)) { $contnt = html_entity_decode(stripslashes($row['content'])); showcontent($contnt); } else { $out .= "<h2>{$langmessage['116']}</h2>\n"; } } foreach ($addons as $addon) { if (strpos($contnt, "%!\$" . $addon['name']) && $addon['header'] == 1) { require_once "addons/" . $addon['name'] . "/header.php"; } } } } }
case "Update Topic": { $topicPublish = ( $topicPublish == "on" ) ? "y" : "n"; update_topic ( $topicTitle, $topicContext, $topicParent, $topicOrder, $topicPublish, $id, $dbLink ); break; } case "deletePage": { $message = delete_page_test ( $page_num, $id, $dbLink ); break; } case "DELETEPage": { delete_page ( $id, $page_num, $dbLink ); mysql_close ($dbLink); header("Location: http://" . $SERVER_NAME . $SCRIPT_NAME . "?context=Edit+Page&id=$id"); exit; } case "addPage": { add_new_page ( $id, $dbLink ); mysql_close ($dbLink); header("Location: http://" . $SERVER_NAME . $SCRIPT_NAME . "?context=Edit+Page&id=$id"); exit; }
} } } } // Update the page visibility to 'deleted' $sql = 'UPDATE `' . TABLE_PREFIX . 'pages` SET ' . '`visibility` = \'deleted\' ' . 'WHERE `page_id` = ' . $page_id . ' ' . ''; $database->query($sql); if ($database->is_error()) { $admin->print_error($database->get_error()); } // // Run trash subs for this page trash_subs($page_id); } else { // Really dump the page // Delete page subs $sub_pages = get_subs($page_id, array()); foreach ($sub_pages as $sub_page_id) { delete_page($sub_page_id); } // Delete page delete_page($page_id); } // Check if there is a db error, otherwise say successful if ($database->is_error()) { $admin->print_error($database->get_error()); } else { $admin->print_success($MESSAGE['PAGES_DELETED']); } // Print admin footer $admin->print_footer();
$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'); // @hook changedata-save-draft saving a draft page $xml = exec_filter('draftsavexml', $xml);
ksort($mc_pages); file_put_contents($index_file2, "<?php\n\$mc_pages=" . var_export($mc_pages, true) . "\n?>"); } load_pages(); if (isset($_GET['delete']) || isset($_GET['apply']) && $_GET['apply'] == 'delete') { if (isset($_GET['apply']) && $_GET['apply'] == 'delete') { $ids = explode(',', $_GET['ids']); foreach ($ids as $id) { if (trim($id) == '') { continue; } delete_page($id); load_pages(); } } else { delete_page($_GET['delete']); } //load_posts(); Header('Location:page.php?done=true&state=' . $state); exit; } if (isset($_GET['revert']) || isset($_GET['apply']) && $_GET['apply'] == 'revert') { if (isset($_GET['apply']) && $_GET['apply'] == 'revert') { $ids = explode(',', $_GET['ids']); foreach ($ids as $id) { if (trim($id) == '') { continue; } revert_page($id); load_pages(); }
/** * revert to a specific revision of a page * * this function makes the revision the page's new head revision by copying it. * @param array $args arguments * key 'page' page to revert to (i.e. page.rev) * @return array response */ function revert($args) { if (empty($args['page'])) { return response('Required argument "page" missing or empty', 400); } if (!page_exists($args['page'])) { return response('Page ' . quot($args['page']) . ' does not exist', 404); } $a = expl('.', $args['page']); if ($a[1] == 'head') { return response('Cannot revert to head revision', 400); } log_msg('info', 'revert: reverting to ' . quot($args['page'])); // delete current head revision // TODO (later): create a snapshot of it before doing so? if (page_exists($a[0] . '.head')) { $ret = delete_page(array('page' => $a[0] . '.head')); if ($ret['#error']) { return $ret; } } // create new head revision $dest = CONTENT_DIR . '/' . $a[0] . '/head'; $m = umask(00); if (!@mkdir($dest, 0777)) { umask($m); return response('Error creating directory ' . quot($dest), 500); } umask($m); // copy files $src = CONTENT_DIR . '/' . $a[0] . '/' . $a[1]; $files = scandir($src); foreach ($files as $f) { if ($f == '.' || $f == '..') { continue; } elseif (is_file($src . '/' . $f)) { // copy file $m = umask(0111); if (!@copy($src . '/' . $f, $dest . '/' . $f)) { log_msg('error', 'revert: error copying ' . quot($src . '/' . $f) . ' to ' . quot($dest . '/' . $f) . ', skipping file'); } umask($m); } } log_msg('info', 'revert: reverted to ' . quot($args['page'])); invoke_hook('revert', array('page' => $args['page'])); return response(true); }
edit_user(); break; case 'delete_user': delete_user(); break; case 'edit_group': edit_group(); break; case 'delete_group': delete_group(); break; case 'edit_page': edit_page(); break; case 'delete_page': delete_page(); break; } ?> </div> <div class="float-clear"></div> <?php } ?> </div> </div> <div class="footer-wrapper"> <div class="footer-content" align="center"> <div class="footer-line"> Copyright © <?php echo date('Y') . ' ' . $config['site_name'];
$username = $_POST['username']; $password = $_POST['password']; if ($username == 'admin' && $password == 'demo#admin') { $_SESSION['admin_logedin'] = true; header("Location: pages.php"); } else { echo "ERROR> Invalid username / password"; } break; case "pages": break; case "uninstall_module": $id = $_GET['id']; uninstall_modules($id); header("Location:modules.php"); break; case "delete_page": $id = $_GET['id']; delete_page($id); header("Location:pages.php"); break; case "uninstall_temp": $id = $_GET['id']; uninstall_temp($id); header("Location:templates.php"); break; case "logout": unset($_SESSION['admin_logedin']); header("Location:index.php"); break; }
* @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"); die;