Exemplo n.º 1
0
 public function RunScript()
 {
     global $langmessage;
     $cmd = common::GetCommand();
     if (!$this->SetVars()) {
         return;
     }
     $this->GetFile();
     //allow addons to effect page actions and how a page is displayed
     $cmd_after = gpPlugin::Filter('PageRunScript', array($cmd));
     if ($cmd !== $cmd_after) {
         $cmd = $cmd_after;
         if ($cmd === 'return') {
             return;
         }
     }
     //admin actions
     if ($this->permission_menu) {
         switch ($cmd) {
             case 'renameit':
                 if ($this->RenameFile()) {
                     return;
                 }
                 break;
         }
     }
     //file editing actions
     if ($this->permission_edit) {
         switch ($cmd) {
             /* gallery/image editing */
             case 'gallery_folder':
             case 'gallery_images':
                 $this->GalleryImages();
                 return;
             case 'new_dir':
                 $this->contentBuffer = gp_edit::NewDirForm();
                 return;
                 /* inline editing */
             /* inline editing */
             case 'save':
             case 'save_inline':
             case 'preview':
             case 'inlineedit':
             case 'include_dialog':
                 $this->SectionEdit($cmd);
                 return;
             case 'image_editor':
                 gp_edit::ImageEditor();
                 return;
             case 'NewNestedSection':
                 $this->NewNestedSection($_REQUEST);
                 return;
         }
     }
     $this->RunCommands($cmd);
 }
Exemplo n.º 2
0
 function __construct()
 {
     global $langmessage, $dataDir;
     $this->folder = $dataDir . '/data/_extra';
     $this->Getdata();
     $cmd = common::GetCommand();
     $show = true;
     switch ($cmd) {
         case 'delete':
             $this->DeleteArea();
             break;
         case 'new_section':
             $this->NewSection();
             break;
         case 'view':
             $this->PreviewText();
             $show = false;
             break;
         case 'edit':
             if ($this->EditExtra()) {
                 $show = false;
             }
             break;
         case 'rawcontent':
             $this->RawContent();
             break;
             /* gallery editing */
         /* gallery editing */
         case 'gallery_folder':
         case 'gallery_images':
             $this->GalleryImages();
             return;
         case 'new_dir':
             gp_edit::NewDirForm();
             return;
             /* inline editing */
         /* inline editing */
         case 'save':
         case 'save_inline':
         case 'inlineedit':
         case 'include_dialog':
         case 'preview':
             $this->SectionEdit($cmd);
             return;
     }
     if ($show) {
         $this->ShowExtras();
     }
 }
Exemplo n.º 3
0
 function RunScript()
 {
     global $langmessage, $page;
     $cmd = common::GetCommand();
     //prevent overwriting the content to maintain overlay editin links
     //$page->ajaxReplace = array();
     if (!$this->SetVars()) {
         return;
     }
     $this->GetFile();
     //original alpha versions of 1.8 didn't maintain the file_type
     if (!isset($this->meta_data['file_type'])) {
         $this->ResetFileTypes();
     }
     //admin toolbar links
     $menu_permissions = admin_tools::HasPermission('Admin_Menu');
     $can_edit = admin_tools::CanEdit($this->gp_index);
     if ($menu_permissions) {
         $page->admin_links[] = common::Link($this->title, $langmessage['rename/details'], 'cmd=renameform', 'data-cmd="gpajax"');
         // Having the layout link here complicates things.. would need layout link for special pages
         $page->admin_links[] = common::Link('Admin_Menu', $langmessage['current_layout'], 'cmd=layout&from=page&index=' . urlencode($this->gp_index), array('title' => $langmessage['current_layout'], 'data-cmd' => 'gpabox'));
         $page->admin_links[] = common::Link('Admin_Menu', $langmessage['Copy'], 'cmd=copypage&redir=redir&index=' . urlencode($this->gp_index), array('title' => $langmessage['Copy'], 'data-cmd' => 'gpabox'));
     }
     if (admin_tools::HasPermission('Admin_User')) {
         $page->admin_links[] = common::Link('Admin_Users', $langmessage['permissions'], 'cmd=file_permissions&index=' . urlencode($this->gp_index), array('title' => $langmessage['permissions'], 'data-cmd' => 'gpabox'));
     }
     if ($can_edit) {
         $page->admin_links[] = common::Link($this->title, $langmessage['Revision History'], 'cmd=view_history', array('title' => $langmessage['Revision History'], 'data-cmd' => 'gpabox'));
     }
     if ($menu_permissions) {
         $page->admin_links[] = common::Link('Admin_Menu', $langmessage['delete_file'], 'cmd=trash_page&index=' . urlencode($this->gp_index), array('data-cmd' => 'postlink', 'title' => $langmessage['delete_page'], 'class' => 'gpconfirm'));
     }
     //allow addons to effect page actions and how a page is displayed
     $cmd_after = gpPlugin::Filter('PageRunScript', array($cmd));
     if ($cmd !== $cmd_after) {
         $cmd = $cmd_after;
         if ($cmd === 'return') {
             return;
         }
     }
     //admin actions
     if ($menu_permissions) {
         switch ($cmd) {
             // rename & details
             case 'renameform':
                 $this->RenameForm();
                 return;
             case 'renameit':
                 if ($this->RenameFile()) {
                     return;
                 }
                 break;
         }
     }
     //file editing actions
     if ($can_edit) {
         switch ($cmd) {
             case 'rawcontent':
                 $this->RawContent();
                 break;
                 /* gallery/image editing */
             /* gallery/image editing */
             case 'gallery_folder':
             case 'gallery_images':
                 $this->GalleryImages();
                 return;
             case 'new_dir':
                 $this->contentBuffer = gp_edit::NewDirForm();
                 return;
                 /* inline editing */
             /* inline editing */
             case 'save':
             case 'save_inline':
             case 'preview':
             case 'inlineedit':
             case 'include_dialog':
                 $this->SectionEdit($cmd);
                 return;
             case 'image_editor':
                 gp_edit::ImageEditor();
                 return;
                 /* Manage section */
             /* Manage section */
             case 'ManageSections':
                 $this->ManageSections();
                 //dies
             //dies
             case 'NewSectionContent':
                 $this->NewSectionContent();
                 return;
             case 'NewNestedSection':
                 $this->NewNestedSection();
                 return;
             case 'SaveSections':
                 $this->SaveSections();
                 return;
                 /* revision history */
             /* revision history */
             case 'view_revision':
                 $this->ViewRevision();
                 return;
             case 'use_revision':
                 $this->UseRevision();
                 break;
             case 'view_history':
                 $this->ViewHistory();
                 return;
         }
     }
     $this->contentBuffer = $this->GenerateContent_Admin();
 }
Exemplo n.º 4
0
 function RunScript()
 {
     global $langmessage, $page;
     $cmd = common::GetCommand();
     if (!$this->SetVars()) {
         return;
     }
     $this->GetFile();
     $can_edit = admin_tools::CanEdit($this->gp_index);
     $menu_permissions = admin_tools::HasPermission('Admin_Menu');
     //allow addons to effect page actions and how a page is displayed
     $cmd_after = gpPlugin::Filter('PageRunScript', array($cmd));
     if ($cmd !== $cmd_after) {
         $cmd = $cmd_after;
         if ($cmd === 'return') {
             return;
         }
     }
     //admin actions
     if ($menu_permissions) {
         switch ($cmd) {
             // rename & details
             case 'renameform':
                 $this->RenameForm();
                 return;
             case 'ToggleVisibility':
                 $this->ToggleVisibility();
                 break;
             case 'renameit':
                 if ($this->RenameFile()) {
                     return;
                 }
                 break;
         }
     }
     $this->AdminLinks();
     //file editing actions
     if ($can_edit) {
         switch ($cmd) {
             case 'rawcontent':
                 $this->RawContent();
                 break;
                 /* gallery/image editing */
             /* gallery/image editing */
             case 'gallery_folder':
             case 'gallery_images':
                 $this->GalleryImages();
                 return;
             case 'new_dir':
                 $this->contentBuffer = gp_edit::NewDirForm();
                 return;
                 /* inline editing */
             /* inline editing */
             case 'save':
             case 'save_inline':
             case 'preview':
             case 'inlineedit':
             case 'include_dialog':
                 $this->SectionEdit($cmd);
                 return;
             case 'image_editor':
                 gp_edit::ImageEditor();
                 return;
                 /* Manage section */
             /* Manage section */
             case 'ManageSections':
                 $this->ManageSections();
                 //dies
             //dies
             case 'NewSectionContent':
                 $this->NewSectionContent();
                 return;
             case 'NewNestedSection':
                 $this->NewNestedSection();
                 return;
             case 'SaveSections':
                 $this->SaveSections();
                 return;
                 /* revision history */
             /* revision history */
             case 'ViewRevision':
                 $this->ViewRevision();
                 return;
             case 'UseRevision':
                 $this->UseRevision();
                 break;
             case 'ViewHistory':
                 $this->ViewHistory();
                 return;
             case 'ViewCurrent':
                 $this->ViewCurrent();
                 return;
             case 'DeleteRevision':
                 $this->DeleteRevision();
                 $this->ViewHistory();
                 return;
                 //drafts
             //drafts
             case 'PublishDraft':
                 $this->PublishDraft();
                 break;
             case 'DiscardDraft':
                 $this->DiscardDraft();
                 break;
         }
     }
     //notify user we're using a draft
     if ($this->draft_exists) {
         $this->PageMessage();
     }
     $this->contentBuffer = $this->GenerateContent_Admin();
 }