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); }
/** * Edit layout properties * Layout Identification * Content Arrangement * Gadget Visibility * */ function EditLayout($layout, $cmd) { global $page, $gpLayouts, $langmessage, $config; $GLOBALS['GP_ARRANGE_CONTENT'] = true; $page->head_js[] = '/include/js/inline_edit/inline_editing.js'; $this->curr_layout = $layout; $this->SetLayoutArray(); $page->SetTheme($layout); $this->LoremIpsum(); gpOutput::TemplateSettings(); gpPlugin::Action('edit_layout_cmd', array($layout)); switch ($cmd) { /** * Inline image editing * */ case 'inlineedit': $this->InlineEdit(); return; case 'gallery_folder': case 'gallery_images': $this->GalleryImages(); return; case 'image_editor': includeFile('tool/editing.php'); gp_edit::ImageEditor($this->curr_layout); return; case 'save_inline': $this->SaveHeaderImage(); return; case 'theme_images': $this->ShowThemeImages(); return; case 'drag_area': $this->Drag(); break; //insert //insert case 'insert': $this->SelectContent(); return; case 'addcontent': $this->AddContent(); break; //remove //remove case 'rm_area': $this->RemoveArea(); break; } if ($this->LayoutCommands($cmd)) { return; } //control what is displayed switch ($cmd) { //show the layout (displayed within an iframe) case 'save_css': case 'preview_css': case 'addcontent': case 'rm_area': case 'drag_area': case 'in_iframe': $this->ShowInIframe($cmd); return; } $layout_info = common::LayoutInfo($layout, false); $handlers_count = 0; if (isset($layout_info['handlers']) && is_array($layout_info['handlers'])) { foreach ($layout_info['handlers'] as $val) { $int = count($val); if ($int === 0) { $handlers_count++; } $handlers_count += $int; } } $page->label = $langmessage['layouts'] . ' » ' . $layout_info['label']; $_REQUEST += array('gpreq' => 'body'); //force showing only the body as a complete html document $page->get_theme_css = false; ob_start(); $this->LayoutEditor($layout, $layout_info); $page->admin_html = ob_get_clean(); }
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(); }
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(); }