コード例 #1
0
 static function SetVars($title, $meta)
 {
     self::$title = $title;
     self::$label = common::GetLabel($title);
     self::$meta = array();
     if (is_array($meta)) {
         self::$meta = $meta;
     }
 }
コード例 #2
0
 /**
  * Get The Image
  *
  */
 function Child($title)
 {
     global $dirPrefix;
     $file = gpFiles::PageFile($title);
     $file_sections = $file_stats = array();
     ob_start();
     require $file;
     ob_get_clean();
     if (!is_array($file_sections)) {
         return;
     }
     //get the image
     $content = section_content::Render($file_sections, $title, $file_stats);
     $img_pos = strpos($content, '<img');
     if ($img_pos === false) {
         return;
     }
     $src_pos = strpos($content, 'src=', $img_pos);
     if ($src_pos === false) {
         return;
     }
     $src = substr($content, $src_pos + 4);
     $quote = $src[0];
     if ($quote != '"' && $quote != "'") {
         return;
     }
     $src_pos = strpos($src, $quote, 1);
     $src = substr($src, 1, $src_pos - 1);
     // check for resized image, get original source if img is resized
     if (strpos($src, 'image.php') !== false && strpos($src, 'img=') !== false) {
         $src = $dirPrefix . '/data/_uploaded/' . urldecode(substr($src, strpos($src, 'img=') + 4));
     }
     $thumb_path = common::ThumbnailPath($src);
     $img_pos2 = strpos($content, '>', $img_pos);
     $img = substr($content, $img_pos, $img_pos2 - $img_pos + 1);
     echo '<li>';
     echo '<img src="' . $thumb_path . '"/>';
     //echo $img;
     $label = common::GetLabel($title);
     echo common::Link($title, $label);
     echo '</li>';
 }
コード例 #3
0
 function SelectContent_Areas($param, $count_gadgets)
 {
     global $dataDir, $langmessage, $config;
     $slug = 'Admin_Theme_Content/' . rawurlencode($this->curr_layout);
     $addQuery = 'cmd=addcontent&where=' . rawurlencode($param);
     echo '<div id="area_lists">';
     //extra content
     echo '<div id="layout_extra_content">';
     echo '<table class="bordered">';
     echo '<tr><th colspan="2">&nbsp;</th></tr>';
     $extrasFolder = $dataDir . '/data/_extra';
     $files = gpFiles::ReadDir($extrasFolder);
     asort($files);
     foreach ($files as $file) {
         $extraName = $file;
         echo '<tr><td>';
         echo str_replace('_', ' ', $extraName);
         echo '</td><td class="add">';
         echo common::Link($slug, $langmessage['add'], $addQuery . '&insert=Extra:' . $extraName, array('data-cmd' => 'creq'));
         echo '</td></tr>';
     }
     //new extra area
     echo '<tr><td>';
     echo '<form action="' . common::GetUrl($slug) . '" method="post">';
     echo '<input type="hidden" name="cmd" value="addcontent" />';
     echo '<input type="hidden" name="addtype" value="new_extra" />';
     echo '<input type="hidden" name="where" value="' . htmlspecialchars($param) . '" />';
     echo '<input type="text" name="extra_area" value="" size="15" class="gpinput"/>';
     includeFile('tool/SectionContent.php');
     $types = section_content::GetTypes();
     echo '<select name="type" class="gpselect">';
     foreach ($types as $type => $info) {
         echo '<option value="' . $type . '">' . $info['label'] . '</option>';
     }
     echo '</select> ';
     echo ' <input type="submit" name="" value="' . $langmessage['Add New Area'] . '" class="gpbutton"/>';
     echo '</form>';
     echo '</td><td colspan="2" class="add">';
     echo '<form action="' . common::GetUrl($slug) . '" method="post">';
     echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
     echo '</form>';
     echo '</td></tr>';
     echo '</table>';
     echo '</div>';
     //gadgets
     if ($count_gadgets > 0) {
         echo '<div id="layout_gadgets" class="nodisplay">';
         echo '<table class="bordered">';
         echo '<tr><th colspan="2">&nbsp;</th></tr>';
         foreach ($config['gadgets'] as $gadget => $info) {
             echo '<tr>';
             echo '<td>';
             echo str_replace('_', ' ', $gadget);
             echo '</td>';
             echo '<td class="add">';
             echo common::Link($slug, $langmessage['add'], $addQuery . '&insert=' . $gadget, array('data-cmd' => 'creq'));
             echo '</td>';
             echo '</tr>';
         }
         echo '<tr><td colspan="2" class="add">';
         echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
         echo '</td></tr>';
         echo '</table>';
         echo '</div>';
     }
     //menus
     echo '<div id="layout_menus" class="nodisplay">';
     echo '<form action="' . common::GetUrl($slug) . '" method="post">';
     echo '<input type="hidden" name="cmd" value="addcontent" />';
     echo '<input type="hidden" name="addtype" value="preset_menu" />';
     echo '<input type="hidden" name="where" value="' . htmlspecialchars($param) . '" />';
     echo '<table class="bordered">';
     $this->PresetMenuForm();
     echo '<tr><td colspan="2" class="add">';
     echo '<input type="submit" name="" value="' . $langmessage['Add New Menu'] . '" class="gpsubmit" />';
     echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
     echo '</td></tr>';
     echo '</table>';
     echo '</form>';
     echo '</div>';
     echo '<div id="layout_custom" class="nodisplay">';
     //custom area
     echo '<form action="' . common::GetUrl($slug) . '" method="post">';
     echo '<input type="hidden" name="cmd" value="addcontent" />';
     echo '<input type="hidden" name="addtype" value="custom_menu" />';
     echo '<input type="hidden" name="where" value="' . htmlspecialchars($param) . '" />';
     $this->CustomMenuForm();
     echo '<tr><td colspan="2" class="add">';
     echo '<input type="submit" name="" value="' . $langmessage['Add New Menu'] . '" class="gpsubmit" />';
     echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
     echo '</td></tr>';
     echo '</table>';
     echo '</form>';
     echo '</div>';
     echo '</div>';
 }
コード例 #4
0
ファイル: Catalog_Easy.php プロジェクト: a2exfr/Catalog-Easy
 function getImageandInfo($title)
 {
     global $dirPrefix;
     $file = gpFiles::PageFile($title);
     //check if page not special!
     if (!file_exists($file)) {
         return;
     }
     $file_sections = $file_stats = array();
     ob_start();
     include $file;
     ob_get_clean();
     if (!is_array($file_sections)) {
         return;
     }
     //avoid error- maximum function nesting level of '250' reached
     foreach ($file_sections as $key => $val) {
         if ($val['type'] == 'include' or $val['type'] == 'Catalog_easy_section') {
             unset($file_sections[$key]);
             //dummy section instead of include
             $file_sections[$key] = array('type' => 'text', 'content' => '<div><p>Lorem ipsum </p></div>', 'attributes' => array());
         }
     }
     if (!$file_sections) {
         return;
     }
     $file_sections = array_values($file_sections);
     //get short info and datafilter
     //new data-filter 1.8.1 from menu settt
     $datafilter = $this->getNewdatafilter($title);
     foreach ($file_sections as $sect) {
         if (isset($sect['attributes'])) {
             if (isset($sect['attributes']['class'])) {
                 //if ($sect['attributes']['class'] == "short_info"){
                 if (strpos($sect['attributes']['class'], 'short_info') !== false) {
                     $short_info = $sect['content'];
                 }
             }
         }
         if (isset($sect['attributes']['data-filter'])) {
             $datafilter = $sect['attributes']['data-filter'];
         }
     }
     //end section foreach
     if (!isset($datafilter)) {
         $datafilter = "";
     }
     if (!isset($short_info)) {
         $short_info = "";
     }
     //get the image + check abrev + check for custom page image
     $custom_image = $this->getCustomPageImage($title);
     $content = section_content::Render($file_sections, $title, $file_stats);
     if ($this->ShortInfo == "abrev") {
         $short_info = $this->GetAbrev($content, $title, $this->AbbrevL);
     } elseif ($this->ShortInfo == "no") {
         $short_info = "";
     }
     $img_flag = true;
     $img_pos = strpos($content, '<img');
     if ($img_pos === false) {
         $img_flag = false;
         //   return array('',$short_info,$datafilter);
     }
     $src_pos = strpos($content, 'src=', $img_pos);
     if ($src_pos === false) {
         $img_flag = false;
         // return array('',$short_info,$datafilter);
     }
     $src = substr($content, $src_pos + 4);
     $quote = $src[0];
     if ($quote != '"' && $quote != "'") {
         $img_flag = false;
         // return array('',$short_info,$datafilter);
     }
     $src_pos = strpos($src, $quote, 1);
     $src = substr($src, 1, $src_pos - 1);
     //$thumb_path = common::ThumbnailPath($src);
     $img_pos2 = strpos($content, '>', $img_pos);
     $img = substr($content, $img_pos, $img_pos2 - $img_pos + 1);
     //no img on page+custom exist
     if (!$img_flag and $custom_image != "") {
         $src = $custom_image;
     } elseif (!$img_flag) {
         return array('', $short_info, $datafilter);
     }
     if ($custom_image != "") {
         $src = $custom_image;
     }
     if ($this->ImageCircle) {
         $a = "img-circle";
     } else {
         $a = "";
     }
     if ($this->catalog_layout == 1 or $this->catalog_layout == 4 or $this->catalog_layout == 2) {
         $style = 'max-height:' . $this->ImagesizeH . 'px!important;';
     } elseif ($this->catalog_layout == 0) {
         $style = 'max-width:' . $this->ImagesizeW . 'px!important; ';
     } elseif ($this->catalog_layout == 3 or $this->catalog_layout == 5) {
         $style = "";
     } else {
         $style = 'width:' . $this->ImagesizeW . 'px!important; height:' . $this->ImagesizeH . 'px!important;';
     }
     if ($this->ECthumb) {
         $style = "";
         $image_real = $this->GetRealImage($src);
         //get source of resized image
         if ($image_real == "resized_img") {
             foreach ($file_sections as $sect) {
                 if ($sect['type'] == 'image') {
                     $image_real = $sect['orig_src'];
                     break;
                 }
             }
         }
         $catalog_thumb = $this->MakeCatalogThumbhail($image_real);
         $src = $catalog_thumb;
     }
     $label = common::GetLabel($title);
     if ($this->ShowImage) {
         if ($this->catalog_layout == 5 and $this->imagelinked == 1) {
             $show = '<img class="img-responsive thumbnail ' . $a . '" style="' . $style . '" alt="' . $label . '" src="' . $src . '"/>';
             if ($this->ECthumb) {
                 $src = $image_real;
             }
             $show = '<a name="gallery" rel="EC_pf" title="' . $label . '" href="' . $src . '">' . $show . '</a>';
         } elseif ($this->catalog_layout > 5) {
             $style = $this->addLayImgStyle();
             $show = '<img  ' . $style . '  alt="' . $label . '" src="' . $src . '"/>';
         } else {
             $show = '<img class="img-responsive ' . $a . '" style="' . $style . '" alt="' . $label . '" src="' . $src . '"/>';
             $show = common::Link($title, $show);
         }
     } else {
         $show = "";
     }
     return array($show, $short_info, $datafilter);
 }
コード例 #5
0
ファイル: display.php プロジェクト: jozefkrz/gpEasy-CMS
 function RunScript()
 {
     if (!$this->SetVars()) {
         return;
     }
     //allow addons to effect page actions and how a page is displayed
     $cmd = common::GetCommand();
     $cmd_after = gpPlugin::Filter('PageRunScript', array($cmd));
     if ($cmd !== $cmd_after) {
         $cmd = $cmd_after;
         if ($cmd === 'return') {
             return;
         }
     }
     $this->GetFile();
     includeFile('tool/SectionContent.php');
     $this->contentBuffer = section_content::Render($this->file_sections, $this->title, $this->file_stats);
 }
コード例 #6
0
ファイル: gpOutput.php プロジェクト: Bomberus/gpEasy-CMS
 static function GetExtra($name = 'Side_Menu', $info = array())
 {
     global $dataDir, $langmessage;
     includeFile('tool/SectionContent.php');
     $name = str_replace(' ', '_', $name);
     $extra_content = self::ExtraContent($name, $file_stats);
     $wrap = gpOutput::ShowEditLink('Admin_Extra');
     if ($wrap) {
         ob_start();
         $edit_link = gpOutput::EditAreaLink($edit_index, 'Admin_Extra', $langmessage['edit'], 'cmd=edit&file=' . $name, array('title' => $name, 'data-cmd' => 'inline_edit_generic'));
         echo '<span class="nodisplay" id="ExtraEditLnks' . $edit_index . '">';
         echo $edit_link;
         echo common::Link('Admin_Extra', $langmessage['theme_content'], '', ' class="nodisplay"');
         echo '</span>';
         gpOutput::$editlinks .= ob_get_clean();
         //echo '<div class="editable_area" id="ExtraEditArea'.$edit_index.'" data-gp-editarea="'.$edit_index.'">'; // class="edit_area" added by javascript
         echo '<div class="editable_area" id="ExtraEditArea' . $edit_index . '">';
         echo section_content::RenderSection($extra_content, 0, '', $file_stats);
         echo '</div>';
     } else {
         echo section_content::RenderSection($extra_content, 0, '', $file_stats);
     }
 }
コード例 #7
0
 function SearchPage($title, $index)
 {
     global $gp_menu, $gp_titles;
     //search hidden?
     if (!$this->search_hidden && !isset($gp_menu[$index])) {
         return;
     }
     //private pages
     if (!common::LoggedIn()) {
         if (isset($gp_titles[$index]['vis'])) {
             return;
         }
     }
     $full_path = gpFiles::PageFile($title);
     $file_sections = gpFiles::Get($full_path, 'file_sections');
     if (!$file_sections) {
         return;
     }
     $content = section_content::Render($file_sections, $title, gpFiles::$last_stats);
     $label = common::GetLabel($title);
     $this->FindString($content, $label, $title);
 }
コード例 #8
0
 function ShowExtras()
 {
     global $langmessage;
     $types = section_content::GetTypes();
     echo '<h2>' . $langmessage['theme_content'] . '</h2>';
     echo '<table class="bordered full_width">';
     echo '<tr><th>';
     echo $langmessage['file_name'];
     echo '</th><th>';
     echo $langmessage['Content Type'];
     echo '</th><th>&nbsp;</th><th>';
     echo $langmessage['options'];
     echo '</th></tr>';
     $i = 0;
     foreach ($this->areas as $file) {
         $extraName = $file;
         $data = gpOutput::ExtraContent($file);
         if ($i % 2 == 0) {
             echo '<tr class="even">';
         } else {
             echo '<tr>';
         }
         echo '<td style="white-space:nowrap">';
         echo str_replace('_', ' ', $extraName);
         echo '</td><td>';
         $type = $data['type'];
         if (isset($types[$type]) && isset($types[$type]['label'])) {
             $type = $types[$type]['label'];
         }
         echo $type;
         echo '</td><td>"<span class="admin_note">';
         $content = strip_tags($data['content']);
         echo substr($content, 0, 50);
         echo '</span>..."</td><td style="white-space:nowrap">';
         if ($data['type'] == 'text') {
             echo common::Link('Admin_Extra', $langmessage['edit'], 'cmd=edit&file=' . $file);
             echo ' &nbsp; ';
         }
         echo common::Link('Admin_Extra', $langmessage['preview'], 'cmd=view&file=' . $file);
         echo ' &nbsp; ';
         $title = sprintf($langmessage['generic_delete_confirm'], htmlspecialchars($file));
         echo common::Link('Admin_Extra', $langmessage['delete'], 'cmd=delete&file=' . $file, array('data-cmd' => 'postlink', 'title' => $title, 'class' => 'gpconfirm'));
         echo '</td></tr>';
         $i++;
     }
     echo '</table>';
     echo '<p>';
     echo '<form action="' . common::GetUrl('Admin_Extra') . '" method="post">';
     echo '<input type="hidden" name="cmd" value="new_section" />';
     echo '<input type="text" name="file" value="" size="15" class="gpinput"/> ';
     echo '<select name="type" class="gpselect">';
     foreach ($types as $type => $info) {
         echo '<option value="' . $type . '">' . $info['label'] . '</option>';
     }
     echo '</select> ';
     echo '<input type="submit" name="" value="' . $langmessage['Add New Area'] . '" class="gppost gpsubmit"/>';
     echo '</form>';
     echo '</p>';
 }
コード例 #9
0
 /**
  * Return the formatted content of the title
  *
  */
 public function TitleContent($title)
 {
     $file = gpFiles::PageFile($title);
     $file_sections = $file_stats = array();
     ob_start();
     require $file;
     ob_get_clean();
     if (!is_array($file_sections)) {
         return '';
     }
     //prevent infinite loops
     foreach ($file_sections as $key => $val) {
         if ($val['type'] == 'include') {
             unset($file_sections[$key]);
         }
     }
     if (!$file_sections) {
         return '';
     }
     $file_sections = array_values($file_sections);
     return section_content::Render($file_sections, $title, $file_stats);
 }
コード例 #10
0
ファイル: editing.php プロジェクト: GedionChang/gpEasy-CMS
 /**
  * Preview an include section
  *
  */
 function PreviewSection($section, $section_num, $title, $file_stats)
 {
     global $page, $langmessage;
     $page->ajaxReplace = array();
     switch ($section['type']) {
         case 'include':
             $data = array();
             $data['type'] = $section['type'];
             if (!empty($_POST['gadget_include'])) {
                 $data['include_type'] = 'gadget';
                 $data['content'] = $_POST['gadget_include'];
             } else {
                 $data['content'] = $_POST['file_include'];
             }
             $content = section_content::RenderSection($data, $section_num, $title, $file_stats);
             $page->ajaxReplace[] = array('gp_include_content', '', $content);
             return;
     }
     message($langmessage['OOPS'] . '(2)');
 }
コード例 #11
0
ファイル: editing_page.php プロジェクト: Bomberus/gpEasy-CMS
 function GetSection(&$section_num)
 {
     global $langmessage, $GP_NESTED_EDIT;
     if (!isset($this->file_sections[$section_num])) {
         trigger_error('invalid section number');
         return;
     }
     $curr_section_num = $section_num;
     $section_num++;
     $content = '';
     $section_data = $this->file_sections[$curr_section_num];
     $section_data += array('attributes' => array(), 'type' => 'text');
     $section_data['attributes'] += array('class' => '');
     $orig_attrs = json_encode($section_data['attributes']);
     $section_data['attributes']['data-gp-section'] = $curr_section_num;
     $section_types = section_content::GetTypes();
     if (gpOutput::ShowEditLink() && admin_tools::CanEdit($this->gp_index)) {
         if (isset($section_types[$section_data['type']])) {
             $title_attr = $section_types[$section_data['type']]['label'];
         } else {
             $title_attr = sprintf($langmessage['Section %s'], $curr_section_num + 1);
         }
         $attrs = array('title' => $title_attr, 'data-cmd' => 'inline_edit_generic', 'data-arg' => $section_data['type'] . '_inline_edit');
         $link = gpOutput::EditAreaLink($edit_index, $this->title, $langmessage['edit'], 'section=' . $curr_section_num . '&amp;revision=' . $this->fileModTime, $attrs);
         //section control links
         if ($section_data['type'] != 'wrapper_section') {
             ob_start();
             echo '<span class="nodisplay" id="ExtraEditLnks' . $edit_index . '">';
             echo $link;
             echo common::Link($this->title, $langmessage['Manage Sections'] . '...', 'cmd=ManageSections', array('class' => 'manage_sections', 'data-cmd' => 'inline_edit_generic', 'data-arg' => 'manage_sections'));
             echo '</span>';
             gpOutput::$editlinks .= ob_get_clean();
         }
         $section_data['attributes']['id'] = 'ExtraEditArea' . $edit_index;
         $section_data['attributes']['class'] .= ' editable_area';
         // class="edit_area" added by javascript
         //$section_data['attributes']['data-gp-editarea']	= $edit_index;
     }
     if (!isset($section_data['nodeName'])) {
         $content .= "\n" . '<div' . section_content::SectionAttributes($section_data['attributes'], $section_data['type']) . ' data-gp-attrs=\'' . htmlspecialchars($orig_attrs, ENT_QUOTES & ~ENT_COMPAT) . '\'>';
     } else {
         $content .= "\n" . '<' . $section_data['nodeName'] . section_content::SectionAttributes($section_data['attributes'], $section_data['type']) . ' data-gp-attrs=\'' . htmlspecialchars($orig_attrs, ENT_QUOTES & ~ENT_COMPAT) . '\'>';
     }
     if ($section_data['type'] == 'wrapper_section') {
         for ($cc = 0; $cc < $section_data['contains_sections']; $cc++) {
             $content .= $this->GetSection($section_num);
         }
     } else {
         $GP_NESTED_EDIT = true;
         $content .= section_content::RenderSection($section_data, $curr_section_num, $this->title, $this->file_stats);
         $GP_NESTED_EDIT = false;
     }
     if (!isset($section_data['nodeName'])) {
         $content .= '<div class="gpclear"></div>';
         $content .= '</div>';
     } else {
         $content .= '</' . $section_data['nodeName'] . '>';
     }
     return $content;
 }
コード例 #12
0
ファイル: admin_menu_new.php プロジェクト: Knuzen/gpEasy-CMS
 function __construct()
 {
     global $langmessage, $page, $config;
     $this->section_types = section_content::GetTypes();
     $page->ajaxReplace = array();
     $page->css_admin[] = '/include/css/admin_menu_new.css';
     $page->head_js[] = '/include/thirdparty/js/nestedSortable.js';
     $page->head_js[] = '/include/thirdparty/js/jquery_cookie.js';
     $page->head_js[] = '/include/js/admin_menu_new.js';
     $this->max_level_index = max(3, gp_max_menu_level - 1);
     $page->head_script .= 'var max_level_index = ' . $this->max_level_index . ';';
     $this->avail_menus['gpmenu'] = $langmessage['Main Menu'] . ' / ' . $langmessage['site_map'];
     $this->avail_menus['all'] = $langmessage['All Pages'];
     $this->avail_menus['hidden'] = $langmessage['Not In Main Menu'];
     $this->avail_menus['nomenus'] = $langmessage['Not In Any Menus'];
     $this->avail_menus['search'] = $langmessage['search pages'];
     if (isset($config['menus'])) {
         foreach ($config['menus'] as $id => $menu_label) {
             $this->avail_menus[$id] = $menu_label;
         }
     }
     //early commands
     $cmd = common::GetCommand();
     switch ($cmd) {
         case 'altmenu_create':
             $this->AltMenu_Create();
             break;
         case 'rm_menu':
             $this->AltMenu_Remove();
             break;
         case 'alt_menu_rename':
             $this->AltMenu_Rename();
             break;
     }
     //read cookie settings
     if (isset($_COOKIE['gp_menu_prefs'])) {
         parse_str($_COOKIE['gp_menu_prefs'], $this->cookie_settings);
     }
     $this->SetMenuID();
     $this->SetMenuArray();
     $this->SetCollapseSettings();
     $this->SetQueryInfo();
     $cmd_after = gpPlugin::Filter('MenuCommand', array($cmd));
     if ($cmd !== $cmd_after) {
         $cmd = $cmd_after;
         if ($cmd === 'return') {
             return;
         }
     }
     switch ($cmd) {
         case 'rename_menu_prompt':
             $this->RenameMenuPrompt();
             return;
             //menu creation
         //menu creation
         case 'newmenu':
             $this->NewMenu();
             return;
         case 'homepage_select':
             $this->HomepageSelect();
             return;
         case 'homepage_save':
             $this->HomepageSave();
             return;
             //rename
         //rename
         case 'renameform':
             $this->RenameForm();
             //will die()
             return;
         case 'renameit':
             $this->RenameFile();
             break;
         case 'hide':
             $this->Hide();
             break;
         case 'drag':
             $this->SaveDrag();
             break;
         case 'trash_page':
         case 'trash':
             $this->MoveToTrash($cmd);
             break;
         case 'add_hidden':
             $this->AddHidden();
             return;
         case 'new_hidden':
             $this->NewHiddenFile();
             break;
         case 'new_redir':
             $this->NewHiddenFile_Redir();
             return;
         case 'copyit':
             $this->CopyPage();
             break;
         case 'copypage':
             $this->CopyForm();
             return;
             // Page Insertion
         // Page Insertion
         case 'insert_before':
         case 'insert_after':
         case 'insert_child':
             $this->InsertDialog($cmd);
             return;
         case 'restore':
             $this->RestoreFromTrash();
             break;
         case 'insert_from_hidden':
             $this->InsertFromHidden();
             break;
         case 'new_file':
             $this->NewFile();
             break;
             //layout
         //layout
         case 'layout':
         case 'uselayout':
         case 'restorelayout':
             includeFile('tool/Page_Layout.php');
             $page_layout = new page_layout($cmd, 'Admin_Menu', $this->query_string);
             if ($page_layout->result()) {
                 return;
             }
             break;
             //external links
         //external links
         case 'new_external':
             $this->NewExternal();
             break;
         case 'edit_external':
             $this->EditExternal();
             return;
         case 'save_external':
             $this->SaveExternal();
             break;
     }
     $this->ShowForm($cmd);
 }
コード例 #13
0
ファイル: editing_page.php プロジェクト: jozefkrz/gpEasy-CMS
 public function GetSection(&$section_num)
 {
     global $langmessage;
     if (!isset($this->file_sections[$section_num])) {
         trigger_error('invalid section number');
         return;
     }
     $curr_section_num = $section_num;
     $section_num++;
     $content = '';
     $section_data = $this->file_sections[$curr_section_num];
     //make sure section_data is an array
     $type = gettype($section_data);
     if ($type !== 'array') {
         trigger_error('$section_data is ' . $type . '. Array expected');
         return;
     }
     $section_data += array('attributes' => array(), 'type' => 'text');
     $section_data['attributes'] += array('class' => '');
     $orig_attrs = $section_data['attributes'];
     $section_data['attributes']['data-gp-section'] = $curr_section_num;
     $section_types = section_content::GetTypes();
     if (gpOutput::ShowEditLink() && admin_tools::CanEdit($this->gp_index)) {
         if (isset($section_types[$section_data['type']])) {
             $title_attr = $section_types[$section_data['type']]['label'];
         } else {
             $title_attr = sprintf($langmessage['Section %s'], $curr_section_num + 1);
         }
         $attrs = array('title' => $title_attr, 'data-cmd' => 'inline_edit_generic', 'data-arg' => $section_data['type'] . '_inline_edit');
         $link = gpOutput::EditAreaLink($edit_index, $this->title, $langmessage['edit'], 'section=' . $curr_section_num . '&amp;revision=' . $this->fileModTime, $attrs);
         //section control links
         if ($section_data['type'] != 'wrapper_section') {
             ob_start();
             echo '<span class="nodisplay" id="ExtraEditLnks' . $edit_index . '">';
             echo $link;
             echo common::Link($this->title, $langmessage['Manage Sections'], 'cmd=ManageSections', array('class' => 'manage_sections', 'data-cmd' => 'inline_edit_generic', 'data-arg' => 'manage_sections'));
             echo '<hr/>';
             echo common::Link($this->title, $langmessage['rename/details'], 'cmd=renameform', 'data-cmd="gpajax"');
             echo common::Link($this->title, $langmessage['Revision History'], 'cmd=ViewHistory', array('data-cmd' => 'gpabox'));
             echo '</span>';
             gpOutput::$editlinks .= ob_get_clean();
         }
         $section_data['attributes']['id'] = 'ExtraEditArea' . $edit_index;
         $section_data['attributes']['class'] .= ' editable_area';
         // class="edit_area" added by javascript
     }
     $content .= $this->SectionNode($section_data, $orig_attrs);
     if ($section_data['type'] == 'wrapper_section') {
         for ($cc = 0; $cc < $section_data['contains_sections']; $cc++) {
             $content .= $this->GetSection($section_num);
         }
     } else {
         gpOutput::$nested_edit = true;
         $content .= section_content::RenderSection($section_data, $curr_section_num, $this->title, $this->file_stats);
         gpOutput::$nested_edit = false;
     }
     if (!isset($section_data['nodeName'])) {
         $content .= '<div class="gpclear"></div>';
         $content .= '</div>';
     } else {
         $content .= section_content::EndTag($section_data['nodeName']);
     }
     return $content;
 }
コード例 #14
0
ファイル: admin_trash.php プロジェクト: VTAMAGNO/gpEasy-CMS
 /**
  * View the contents of a trash file
  *
  */
 function ViewTrashFile($trash_index)
 {
     global $dataDir, $langmessage, $trash_file;
     $title_info = admin_trash::GetInfo($trash_index);
     //delete / restore links
     echo '<div class="pull-right">';
     echo common::Link('Admin_Trash', $langmessage['restore'], 'cmd=RestoreDeleted&titles[]=' . rawurlencode($trash_index), array('data-cmd' => 'cnreq', 'class' => 'gpsubmit'));
     echo ' &nbsp; ';
     echo common::Link('Admin_Trash', $langmessage['delete'], 'cmd=DeleteFromTrash&titles[]=' . rawurlencode($trash_index), array('data-cmd' => 'cnreq', 'class' => 'gpsubmit'));
     echo '</div>';
     echo '<h2 class="hmargin">';
     echo common::Link('Admin_Trash', $langmessage['trash']);
     echo ' &#187; ';
     echo htmlspecialchars($title_info['title']);
     echo '</h2>';
     echo '<hr>';
     //get file sections
     $file_sections = gpFiles::Get($title_info['page_file'], 'file_sections');
     if ($file_sections) {
         echo section_content::Render($file_sections, $title_info['title']);
     } else {
         echo '<p>This page no longer has any content</p>';
     }
 }