/** * Add titles to the current menu from the trash * */ function RestoreFromTrash() { global $langmessage, $gp_index; if ($this->curr_menu_array === false) { message($langmessage['OOPS']); return false; } if (!isset($_POST['titles'])) { message($langmessage['OOPS'] . ' (Nothing Selected)'); return false; } $this->CacheSettings(); includeFile('admin/admin_trash.php'); $titles_lower = array_change_key_case($gp_index, CASE_LOWER); $titles = array(); $exists = array(); foreach ($_POST['titles'] as $title) { $new_title = admin_tools::CheckPostedNewPage($title, $message); if (!$new_title) { $exists[] = $title; continue; } $titles[$title] = array(); } $menu = admin_trash::RestoreTitles($titles); if (count($exists) > 0) { message($langmessage['TITLES_EXIST'] . implode(', ', $exists)); if (count($menu) == 0) { return false; //prevent multiple messages } } if (count($menu) == 0) { message($langmessage['OOPS']); $this->RestoreSettings(); return false; } if (!$this->MenuInsert($menu, $_POST['insert_where'], $_POST['insert_how'])) { message($langmessage['OOPS']); $this->RestoreSettings(); return false; } if (!$this->SaveMenu(true)) { message($langmessage['OOPS']); $this->RestoreSettings(); return false; } admin_trash::ModTrashData(null, $titles); }
/** * Remove files from the trash by restoring them to $gp_titles and $gp_index * */ function RestoreDeleted() { global $langmessage, $gp_titles, $gp_index; if (empty($_POST['titles']) || !is_array($_POST['titles'])) { message($langmessage['OOPS'] . ' (No Titles)'); return; } $titles = $_POST['titles']; admin_trash::RestoreTitles($titles); if (!$titles) { message($langmessage['OOPS'] . ' (R1)'); return false; } if (!admin_tools::SavePagesPHP()) { message($langmessage['OOPS'] . ' (R4)'); return false; } admin_trash::ModTrashData(null, $titles); $show_titles = array(); foreach ($titles as $trash_index => $info) { $show_titles[] = common::Link($info['title'], $info['title']); unset($this->trash_files[$trash_index]); } $title_string = implode(', ', $show_titles); $link = common::GetUrl('Admin_Menu'); $message = sprintf($langmessage['file_restored'], $title_string, $link); message($message); }
/** * Add titles to the current menu from the trash * */ public function RestoreFromTrash() { global $langmessage, $gp_index; if ($this->curr_menu_array === false) { msg($langmessage['OOPS']); return false; } if (!isset($_POST['titles'])) { msg($langmessage['OOPS'] . ' (Nothing Selected)'); return false; } $this->CacheSettings(); includeFile('admin/admin_trash.php'); $titles_lower = array_change_key_case($gp_index, CASE_LOWER); $titles = array(); $menu = admin_trash::RestoreTitles($_POST['titles']); if (!$menu) { msg($langmessage['OOPS']); $this->RestoreSettings(); return false; } if (!$this->SaveNew($menu)) { $this->RestoreSettings(); return false; } admin_trash::ModTrashData(null, $titles); }
/** * Remove files from the trash by restoring them to $gp_titles and $gp_index * */ function RestoreNew() { global $langmessage, $gp_titles, $gp_index; if (empty($_POST['title']) || !is_array($_POST['title'])) { message($langmessage['OOPS'] . ' (No Titles)'); return; } $titles = $_POST['title']; admin_trash::RestoreTitles($titles); if (count($titles) == 0) { message($langmessage['OOPS'] . ' (R1)'); return false; } if (!admin_tools::SavePagesPHP()) { message($langmessage['OOPS'] . ' (R4)'); return false; } admin_trash::ModTrashData(null, $titles); $show_titles = array(); foreach ($titles as $title => $null) { $show_titles[] = htmlspecialchars($title); } $title_string = implode(', ', $show_titles); $link = common::GetUrl('Admin_Menu'); $message = sprintf($langmessage['file_restored'], $title_string, $link); message($message); }