コード例 #1
0
ファイル: admin_tools.php プロジェクト: Bomberus/gpEasy-CMS
 /**
  * Check a title against existing titles and special pages
  *
  */
 static function CheckPostedNewPage($title, &$message)
 {
     global $langmessage, $gp_index, $config;
     $title = admin_tools::LabelToSlug($title);
     if (!admin_tools::CheckTitle($title, $message)) {
         return false;
     }
     if (admin_tools::CheckTitleCase($title)) {
         $message = $langmessage['TITLE_EXISTS'];
         return false;
     }
     return $title;
 }
コード例 #2
0
ファイル: admin_trash.php プロジェクト: rizub4u/gpEasy-CMS
 /**
  * Get the $info array for $title for use with $gp_titles
  * @static
  */
 function GetInfo($title)
 {
     global $dataDir;
     static $trash_titles = false;
     if ($trash_titles === false) {
         $trash_titles = admin_trash::TrashFiles();
     }
     if (!isset($trash_titles[$title])) {
         return false;
     }
     $title_info = $trash_titles[$title];
     //make sure we have a label
     if (empty($title_info['label'])) {
         $title_info['label'] = admin_tools::LabelToSlug($title);
     }
     //make sure we have a file_type
     if (empty($title_info['type'])) {
         $trash_file = $dataDir . '/data/_trash/' . $title . '.php';
         $title_info['type'] = admin_trash::GetTypes($trash_file);
     }
     //make sure we have a file name
     if (empty($title_info['file'])) {
         $title_info['file'] = $dataDir . '/data/_trash/' . $title . '.php';
     }
     return $title_info;
 }
コード例 #3
0
ファイル: Page_Rename.php プロジェクト: Knuzen/gpEasy-CMS
 static function RenameFileWorker($title)
 {
     global $langmessage, $dataDir, $gp_index;
     //use new_label or new_title
     if (isset($_POST['new_title'])) {
         $new_title = admin_tools::PostedSlug($_POST['new_title']);
     } else {
         $new_title = admin_tools::LabelToSlug($_POST['new_label']);
     }
     //title unchanged
     if ($new_title == $title) {
         return $title;
     }
     $special_file = false;
     if (common::SpecialOrAdmin($title)) {
         $special_file = true;
     }
     if (!admin_tools::CheckTitle($new_title, $message)) {
         msg($message);
         return false;
     }
     $old_gp_index = $gp_index;
     //re-index: make the new title point to the same data index
     $old_file = gpFiles::PageFile($title);
     $file_index = $gp_index[$title];
     unset($gp_index[$title]);
     $gp_index[$new_title] = $file_index;
     //rename the php file
     if (!$special_file) {
         $new_file = gpFiles::PageFile($new_title);
         //we don't have to rename files if we're using the index naming convention. See gpFiles::PageFile() for more info
         if ($new_file == $old_file) {
             //if the file being renamed doesn't use the index naming convention, then we'll still need to rename it
         } elseif (!rename($old_file, $new_file)) {
             msg($langmessage['OOPS'] . ' (N3)');
             $gp_index = $old_gp_index;
             return false;
         }
         //gallery rename
         includeFile('special/special_galleries.php');
         special_galleries::RenamedGallery($title, $new_title);
     }
     //create a 301 redirect
     if (isset($_POST['add_redirect']) && $_POST['add_redirect'] == 'add') {
         includeFile('admin/admin_missing.php');
         admin_missing::AddRedirect($title, $new_title);
     }
     gpPlugin::Action('RenameFileDone', array($file_index, $title, $new_title));
     return $new_title;
 }
コード例 #4
0
ファイル: admin_trash.php プロジェクト: VTAMAGNO/gpEasy-CMS
 /**
  * Get the $info array for $title for use with $gp_titles
  * @static
  */
 static function GetInfo($trash_index)
 {
     global $dataDir;
     static $trash_titles = false;
     if ($trash_titles === false) {
         $trash_titles = admin_trash::TrashFiles();
     }
     if (!array_key_exists($trash_index, $trash_titles)) {
         return false;
     }
     $title_info = $trash_titles[$trash_index];
     $trash_dir = $dataDir . '/data/_trash/' . $trash_index;
     //make sure we have a file or dir
     if (empty($title_info['rm_path'])) {
         if (empty($title_info['file'])) {
             $title_info['file'] = $trash_index . '.php';
         }
         $title_info['rm_path'] = $dataDir . '/data/_trash/' . $title_info['file'];
         $title_info['page_file'] = $dataDir . '/data/_trash/' . $title_info['file'];
     }
     //make sure we have a label
     if (empty($title_info['label'])) {
         $title_info['label'] = admin_tools::LabelToSlug($trash_index);
     }
     //make sure we have a file_type
     if (empty($title_info['type'])) {
         $title_info['type'] = admin_trash::GetTypes($title_info['page_file']);
     }
     return $title_info;
 }