} # if the undo command was invoked if (isset($_GET['undo'])) { if ($_GET['userid'] !== $userid) { die(i18n_r('ER_REQ_PROC_FAIL')); } // if not allowedtoedit then userid is $USR now, so stop undo actions check_for_csrf("undo"); // perform undo // undo add new user if (isset($_GET['new'])) { delete_file(GSUSERSPATH . $file); redirect('profile.php?success=' . urlencode(strip_tags(sprintf(i18n_r('ER_HASBEEN_DEL'), $userid)))); } // undo edit user restore_datafile(GSUSERSPATH . $file); redirect('profile.php?upd=profile-restored&userid=' . $userid); } # was the form submitted? if (isset($_POST['submitted']) && isset($_POST['user'])) { check_for_csrf("save_profile"); do { // if editing and post userid not match get userid // @todo perhaps use nonce here instead if ($editing && $userid !== _id($_POST['user'])) { $error = i18n_r('ER_REQ_PROC_FAIL'); break; } $userid = _id($_POST['user']); $file = $userid . '.xml'; if ($adding && path_is_safe(GSUSERSPATH . $file, GSUSERSPATH)) {
/** * @deprecated 3.4 LEGACY */ function undo($file, $filepath, $bakpath) { return restore_datafile($filepath . $file); }
} $componentXML = addComponentItem($xml, $title, $value, $active, $slug); } if (!$error) { exec_action('component-save'); // @hook component-save before saving components data file $status = XMLsave($xml, GSDATAOTHERPATH . GSCOMPONENTSFILE); get_components_xml(true); } } $update = $status ? 'comp-success' : 'error'; } # if undo was invoked if (isset($_GET['undo'])) { # perform the undo restore_datafile(GSDATAOTHERPATH . GSCOMPONENTSFILE); check_for_csrf("undo"); if (!requestIsAjax()) { redirect('components.php?upd=comp-restored'); } // redirect to prevent refresh undos $update = 'comp-restored'; get_components_xml(true); } # create components form html $collectionData = get_components_xml(); $numitems = $collectionData ? count($collectionData) : 0; $pagetitle = i18n_r('COMPONENTS'); get_template('header'); include 'template/include-nav.php'; ?>
$fullpath = suggest_site_path(); $lang_array = getFiles(GSLANGPATH); # initialize these all as null $error = $success = $prettychck = null; # if the flush cache command was invoked if (isset($_GET['flushcache'])) { delete_cache(); exec_action('flushcache'); // @hook flushcache cache was deleted $update = 'flushcache-success'; } # if the undo command was invoked if (isset($_GET['undo'])) { check_for_csrf("undo"); # perform undo restore_datafile(GSDATAOTHERPATH . GSWEBSITEFILE); generate_sitemap(); # redirect back to yourself to show the new restored data redirect('settings.php?upd=settings-restored'); } # was the form submitted? if (isset($_POST['submitted'])) { check_for_csrf("save_settings"); # website-specific fields if (isset($_POST['sitename'])) { $SITENAME = htmlentities($_POST['sitename'], ENT_QUOTES, 'UTF-8'); } if (isset($_POST['siteurl'])) { $SITEURLNEW = tsl($_POST['siteurl']); } if (isset($_POST['permalink'])) {
$title = $component['title']; $active = isset($component['active']) ? 0 : 1; // checkbox $componentXML = addComponentItem($xml, $title, $value, $active, $slug); } exec_action('snippet-save'); // @hook component-save before saving components data file XMLsave($xml, GSDATAOTHERPATH . GSSNIPPETSFILE); get_snippets_xml(true); } $update = 'snippet-success'; } # if undo was invoked if (isset($_GET['undo'])) { # perform the undo restore_datafile(GSDATAOTHERPATH . GSSNIPPETSFILE); check_for_csrf("undo"); if (!requestIsAjax()) { redirect('snippets.php?upd=snippet-restored'); } // redirect to prevent refresh undos // undos are not ajax, what was I thinking // $update = 'snippet-restored'; // get_snippets_xml(true); } # create components form html $collectionData = get_snippets_xml(); $numitems = $collectionData ? count($collectionData) : 0; $pagetitle = i18n_r('SNIPPETS'); get_template('header'); include 'template/include-nav.php';