예제 #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);
 }
예제 #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);
 }
예제 #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));
     }
 }
예제 #4
0
 /**
  * Check and remove the requested files from the trash
  *
  */
 function DeleteFromTrash()
 {
     global $dataDir, $langmessage;
     if (empty($_POST['titles']) || !is_array($_POST['titles'])) {
         message($langmessage['OOPS'] . ' (No Titles)');
         return;
     }
     $titles = array();
     $incomplete = false;
     foreach ($_POST['titles'] as $trash_index) {
         $title_info = admin_trash::GetInfo($trash_index);
         if ($title_info === false) {
             $incomplete = true;
             continue;
         }
         $titles[$trash_index] = $title_info;
     }
     if (!admin_trash::ModTrashData(null, $titles)) {
         return false;
     }
     //remove the data
     foreach ($titles as $trash_index => $info) {
         gpFiles::RmAll($info['rm_path']);
         unset($this->trash_files[$trash_index]);
     }
     if ($incomplete) {
         message($langmessage['delete_incomplete']);
     }
 }