コード例 #1
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;
 }
コード例 #2
0
 /**
  * Handle the renaming of galleries for admin_menu_tools.php
  *
  * @static
  *
  */
 function RenamedGallery($old_title, $new_title)
 {
     $galleries = special_galleries::GetData();
     if (!isset($galleries[$old_title])) {
         return;
     }
     if (gpFiles::ArrayInsert($old_title, $new_title, $galleries[$old_title], $galleries, 0, 1)) {
         special_galleries::SaveIndex($galleries);
     }
 }
コード例 #3
0
ファイル: admin_trash.php プロジェクト: rizub4u/gpEasy-CMS
 /**
  * Get the content of the file in the trash so we can restore file information
  *  - resized images
  *  - special_galleries::UpdateGalleryInfo($title,$content)
  *
  */
 function RestoreFile($title, $file, $title_info)
 {
     //get the file data
     $file_sections = array();
     ob_start();
     include $file;
     ob_get_clean();
     // Restore resized images
     if (count($file_sections)) {
         includeFile('image.php');
         gp_resized::SetIndex();
         foreach ($file_sections as $section => $section_data) {
             if (!isset($section_data['resized_imgs'])) {
                 continue;
             }
             foreach ($section_data['resized_imgs'] as $image_index => $sizes) {
                 if (!isset(gp_resized::$index[$image_index])) {
                     continue;
                 }
                 $img = gp_resized::$index[$image_index];
                 foreach ($sizes as $size) {
                     list($width, $height) = explode('x', $size);
                     gp_edit::CreateImage($img, $width, $height);
                 }
             }
             gp_edit::ResizedImageUse(array(), $section_data['resized_imgs']);
         }
         gp_resized::SaveIndex();
     }
     // Restore Galleries
     if (strpos($title_info['type'], 'gallery') !== false) {
         includeFile('special/special_galleries.php');
         special_galleries::UpdateGalleryInfo($title, $file_sections);
     }
 }
コード例 #4
0
ファイル: editing_page.php プロジェクト: Bomberus/gpEasy-CMS
 /**
  * Extract information about the gallery from it's html: img_count, icon_src
  * Call GalleryEdited when a gallery section is removed, edited
  *
  */
 function GalleryEdited()
 {
     includeFile('special/special_galleries.php');
     special_galleries::UpdateGalleryInfo($this->title, $this->file_sections);
 }
コード例 #5
0
 function NewDrag()
 {
     global $page, $langmessage;
     $page->ajaxReplace = array();
     //get the title of the gallery that was moved
     $dragging = $_POST['title'];
     if (!isset($this->galleries[$dragging])) {
         message($langmessage['OOPS'] . ' (Title not in gallery list)');
         return false;
     }
     $info = $this->galleries[$dragging];
     unset($this->galleries[$dragging]);
     //set visibility
     if (isset($_POST['active'])) {
         $info['visibility'] = 'show';
     } else {
         $info['visibility'] = 'hide';
     }
     //place before the element represented by $_POST['next'] if it's set
     if (isset($_POST['next'])) {
         $next = $_POST['next'];
         if (!isset($this->galleries[$next])) {
             message($langmessage['OOPS'] . ' (Next not found)');
             return false;
         }
         if (!gpFiles::ArrayInsert($next, $dragging, $info, $this->galleries)) {
             message($langmessage['OOPS'] . ' (Insert Failed)');
             return false;
         }
         //place at the end
     } else {
         $this->galleries[$dragging] = $info;
     }
     //save it
     if (!special_galleries::SaveIndex($this->galleries)) {
         message($langmessage['OOPS'] . ' (Not Saved)');
         return false;
     }
 }