Exemplo n.º 1
0
 /**
  * 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);
 }
Exemplo n.º 2
0
 /**
  * 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);
 }
Exemplo n.º 3
0
 /**
  * Check and remove the requested files from the trash
  *
  */
 function DeleteFromTrash()
 {
     global $dataDir, $langmessage;
     if (empty($_POST['title']) || !is_array($_POST['title'])) {
         message($langmessage['OOPS'] . ' (No Titles)');
         return;
     }
     $titles = array();
     $not_deleted = array();
     foreach ($_POST['title'] as $title => $null) {
         $title_info = admin_trash::GetInfo($title);
         if ($title_info === false) {
             $not_deleted[] = $title;
             continue;
         }
         $titles[$title] = true;
     }
     admin_trash::ModTrashData(null, $titles);
     if (count($not_deleted) > 0) {
         message($langmessage['delete_incomplete'] . ': ' . implode(', ', $not_deleted));
     }
 }
Exemplo n.º 4
0
 /**
  * View the contents of a trash file
  *
  */
 function ViewTrashFile($trash_index)
 {
     global $dataDir, $langmessage, $trash_file;
     $title_info = admin_trash::GetInfo($trash_index);
     //delete / restore links
     echo '<div class="pull-right">';
     echo common::Link('Admin_Trash', $langmessage['restore'], 'cmd=RestoreDeleted&titles[]=' . rawurlencode($trash_index), array('data-cmd' => 'cnreq', 'class' => 'gpsubmit'));
     echo ' &nbsp; ';
     echo common::Link('Admin_Trash', $langmessage['delete'], 'cmd=DeleteFromTrash&titles[]=' . rawurlencode($trash_index), array('data-cmd' => 'cnreq', 'class' => 'gpsubmit'));
     echo '</div>';
     echo '<h2 class="hmargin">';
     echo common::Link('Admin_Trash', $langmessage['trash']);
     echo ' &#187; ';
     echo htmlspecialchars($title_info['title']);
     echo '</h2>';
     echo '<hr>';
     //get file sections
     $file_sections = gpFiles::Get($title_info['page_file'], 'file_sections');
     if ($file_sections) {
         echo section_content::Render($file_sections, $title_info['title']);
     } else {
         echo '<p>This page no longer has any content</p>';
     }
 }