当前位置: 首页>>代码示例>>PHP>>正文


PHP common::SpecialOrAdmin方法代码示例

本文整理汇总了PHP中common::SpecialOrAdmin方法的典型用法代码示例。如果您正苦于以下问题:PHP common::SpecialOrAdmin方法的具体用法?PHP common::SpecialOrAdmin怎么用?PHP common::SpecialOrAdmin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在common的用法示例。


在下文中一共展示了common::SpecialOrAdmin方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: TrashFiles

 /**
  * Return a sorted array of files in the trash
  * @static
  *
  */
 static function TrashFiles()
 {
     global $dataDir, $gp_index, $config;
     $trash_titles = array();
     // pre 4.6, deleted page info was stored
     $trash_file = $dataDir . '/data/_site/trash.php';
     if (gpFiles::Exists($trash_file)) {
         $trash_titles = gpFiles::Get($trash_file, 'trash_titles');
     }
     // get files associated existing titles
     $pages_dir = $dataDir . '/data/_pages/';
     $pages_dir_len = strlen($pages_dir);
     $existing = array();
     foreach ($gp_index as $title => $index) {
         if (common::SpecialOrAdmin($title) !== false) {
             continue;
         }
         $file = gpFiles::PageFile($title);
         $file = substr($file, $pages_dir_len);
         if (strpos($file, '/')) {
             $existing[] = dirname($file);
         } else {
             $existing[] = $file;
         }
     }
     // post 4.6, deleted pages are left in the data/_pages folder
     $files = scandir($pages_dir);
     $files = array_diff($files, array('.', '..', 'index.html'));
     // add the new files to the list of $trash_titles
     $new_trash_files = array_diff($files, $existing);
     $page_prefix = substr($config['gpuniq'], 0, 7) . '_';
     foreach ($new_trash_files as $file) {
         $info = array();
         $info_file = $dataDir . '/data/_pages/' . $file . '/deleted.php';
         if (gpFiles::Exists($info_file)) {
             $info = gpFiles::Get($info_file, 'deleted');
             $info['page_file'] = $dataDir . '/data/_pages/' . $file . '/page.php';
         } else {
             $info['page_file'] = $dataDir . '/data/_pages/' . $file;
             $info['time'] = filemtime($info['page_file']);
             $info['orphaned'] = true;
         }
         //get index
         if (strpos($file, $page_prefix) === 0) {
             $info['index'] = substr($file, 8);
             // remove page_prefix
         }
         $info['rm_path'] = $dataDir . '/data/_pages/' . $file;
         $trash_titles[$file] = $info;
     }
     //make sure we have a title
     foreach ($trash_titles as $trash_index => &$info) {
         if (!isset($info['title'])) {
             $info['title'] = str_replace('_', ' ', $trash_index);
         }
     }
     uasort($trash_titles, array('self', 'TitleSort'));
     return $trash_titles;
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:64,代码来源:admin_trash.php

示例2: Upgrade_234

 /**
  * Update the gp_index, gp_titles and menus so that special pages can be renamed
  *
  */
 function Upgrade_234()
 {
     global $gp_index, $gp_titles, $gp_menu, $config, $dataDir;
     includeFile('tool/gpOutput.php');
     $special_indexes = array();
     $new_index = array();
     $new_titles = array();
     foreach ($gp_index as $title => $index) {
         $info = $gp_titles[$index];
         $type = common::SpecialOrAdmin($title);
         if ($type === 'special') {
             $special_indexes[$index] = strtolower($title);
             $index = strtolower($title);
             $info['type'] = 'special';
             //some older versions didn't maintain this value well
         }
         $new_index[$title] = $index;
         $new_titles[$index] = $info;
     }
     $gp_titles = $new_titles;
     $gp_index = $new_index;
     //update gp_menu
     $gp_menu = $this->FixMenu($gp_menu, $special_indexes);
     //save pages
     if (!admin_tools::SavePagesPHP()) {
         return;
     }
     $config['gpversion'] = '2.3.4';
     admin_tools::SaveConfig();
     //update alt menus
     if (isset($config['menus']) && is_array($config['menus'])) {
         foreach ($config['menus'] as $key => $value) {
             $menu_file = $dataDir . '/data/_menus/' . $key . '.php';
             if (gpFiles::Exists($menu_file)) {
                 $menu = gpOutput::GetMenuArray($key);
                 $menu = $this->FixMenu($menu, $special_indexes);
                 gpFiles::SaveData($menu_file, 'menu', $menu);
             }
         }
     }
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:45,代码来源:upgrade.php

示例3: CheckTitle

 /**
  * Check a title against existing titles, special pages and reserved unique string
  *
  * @param string $title The title to be checked
  * @return mixed false if the title doesn't exist, string if a conflict is found
  * @since 2.4b5
  */
 static function CheckTitle($title, &$message)
 {
     global $gp_index, $config, $langmessage;
     if (empty($title)) {
         $message = $langmessage['TITLE_REQUIRED'];
         return false;
     }
     if (isset($gp_index[$title])) {
         $message = $langmessage['TITLE_EXISTS'];
         return false;
     }
     $type = common::SpecialOrAdmin($title);
     if ($type !== false) {
         $message = $langmessage['TITLE_RESERVED'];
         return false;
     }
     $prefix = substr($config['gpuniq'], 0, 7) . '_';
     if (strpos($title, $prefix) !== false) {
         $message = $langmessage['TITLE_RESERVED'] . ' (2)';
         return false;
     }
     if (strlen($title) > 100) {
         $message = $langmessage['LONG_TITLE'];
         return false;
     }
     return true;
 }
开发者ID:Bomberus,项目名称:gpEasy-CMS,代码行数:34,代码来源:admin_tools.php

示例4: SearchDisplay

 function SearchDisplay()
 {
     global $langmessage, $gpLayouts, $gp_index, $gp_menu;
     $Inherit_Info = admin_menu_tools::Inheritance_Info();
     switch ($this->curr_menu_id) {
         case 'search':
             $show_list = $this->GetSearchList();
             break;
         case 'all':
             $show_list = array_keys($gp_index);
             break;
         case 'hidden':
             $show_list = $this->GetAvailable();
             break;
         case 'nomenus':
             $show_list = $this->GetNoMenus();
             break;
     }
     $show_list = array_values($show_list);
     //to reset the keys
     $show_list = array_reverse($show_list);
     //show newest first
     $max = count($show_list);
     while ($this->search_page * $this->search_max_per_page > $max) {
         $this->search_page--;
     }
     $start = $this->search_page * $this->search_max_per_page;
     $stop = min(($this->search_page + 1) * $this->search_max_per_page, $max);
     ob_start();
     echo '<div class="gp_search_links">';
     echo '<span class="showing">';
     echo sprintf($langmessage['SHOWING'], $start + 1, $stop, $max);
     echo '</span>';
     if ($start !== 0 || $stop < $max) {
         for ($i = 0; $i * $this->search_max_per_page < $max; $i++) {
             $class = '';
             if ($i == $this->search_page) {
                 $class = ' class="current"';
             }
             echo $this->Link('Admin_Menu', $i + 1, 'page=' . $i, 'name="gpajax"' . $class);
         }
     }
     echo $this->Link('Admin_Menu', $langmessage['create_new_file'], 'cmd=add_hidden', ' title="' . $langmessage['create_new_file'] . '" name="gpajax"');
     echo '</div>';
     $links = ob_get_clean();
     echo $links;
     echo '<table class="bordered">';
     echo '<thead>';
     echo '<tr><th>';
     echo $langmessage['file_name'];
     echo '</th><th>';
     echo $langmessage['Child Pages'];
     echo '</th>';
     echo '</tr>';
     echo '</thead>';
     echo '<tbody>';
     if (count($show_list) > 0) {
         for ($i = $start; $i < $stop; $i++) {
             $title = $show_list[$i];
             $title_index = $gp_index[$title];
             echo '<tr><td>';
             $label = common::GetLabel($title);
             echo common::Link($title, common::LabelSpecialChars($label));
             //area only display on mouseover
             echo '<div>';
             echo '<b>Options:</b>';
             $img = '<span class="menu_icon page_edit_icon"></span>';
             echo $this->Link('Admin_Menu', $img . $langmessage['rename/details'], 'cmd=renameform&title=' . urlencode($title), ' title="' . $langmessage['rename/details'] . '" name="gpajax" ');
             $img = '<span class="menu_icon copy_icon"></span>';
             echo $this->Link('Admin_Menu', $img . $langmessage['Copy'], 'cmd=copypage&title=' . urlencode($title), ' title="' . $langmessage['Copy'] . '" name="gpabox"');
             $layout = admin_menu_tools::CurrentLayout($title_index);
             $layout_info = $gpLayouts[$layout];
             $img = '<span style="background-color:' . $layout_info['color'] . ';" class="layout_icon"></span>';
             echo $this->Link('Admin_Menu', $img . $layout_info['label'], 'cmd=layout&index=' . urlencode($title_index), ' title="' . $langmessage['layout'] . '" name="gpabox"');
             $is_special = common::SpecialOrAdmin($title);
             if (!$is_special) {
                 $img = '<span class="menu_icon bin_icon"></span>';
                 echo $this->Link('Admin_Menu', $img . $langmessage['delete'], 'cmd=trash&index=' . urlencode($title_index), ' title="' . $langmessage['delete_page'] . '" name="menupost" class="gpconfirm" ');
             }
             gpPlugin::Action('MenuPageOptions', array($title, $title_index, false, $layout_info));
             //stats
             echo '<br/>';
             echo '<b>' . $langmessage['Page Info'] . ':</b>';
             $this->FileStats($title_index, $title, $is_special);
             echo '</div>';
             echo '</td><td>';
             if (isset($Inherit_Info[$title_index]) && isset($Inherit_Info[$title_index]['children'])) {
                 echo $Inherit_Info[$title_index]['children'];
             } elseif (isset($gp_menu[$title_index])) {
                 echo '0';
             } else {
                 echo $langmessage['Not In Main Menu'];
             }
             echo '</td></tr>';
         }
     }
     echo '</tbody>';
     echo '</table>';
     if (count($show_list) == 0) {
         echo '<p>';
//.........这里部分代码省略.........
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:101,代码来源:admin_menu_new.php

示例5: SearchPages

 function SearchPages()
 {
     global $gp_index;
     includeFile('tool/SectionContent.php');
     ob_start();
     foreach ($gp_index as $title => $index) {
         if (common::SpecialOrAdmin($title) === false) {
             $this->SearchPage($title, $index);
         }
     }
     ob_get_clean();
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:12,代码来源:special_search.php

示例6: NewFileIndex

 /**
  * Generate a new file index
  * skip indexes that are just numeric
  */
 static function NewFileIndex()
 {
     global $gp_index, $gp_titles;
     $num_index = 0;
     /*prevent reusing old indexes */
     if (count($gp_index) > 0) {
         $max = count($gp_index);
         $title = end($gp_index);
         for ($i = $max; $i > 0; $i--) {
             $last_index = current($gp_index);
             $type = common::SpecialOrAdmin($title);
             if ($type == 'special') {
                 $title = prev($gp_index);
                 continue;
             }
             $i = 0;
         }
         reset($gp_index);
         $num_index = base_convert($last_index, 36, 10);
         $num_index++;
     }
     do {
         $index = base_convert($num_index, 10, 36);
         $num_index++;
     } while (is_numeric($index) || isset($gp_titles[$index]));
     return $index;
 }
开发者ID:Knuzen,项目名称:gpEasy-CMS,代码行数:31,代码来源:common.php

示例7: IncludeContent

 /**
  * Include the content of a page or gadget as specified in $data
  * @param array $data
  * @param string The included content
  */
 static function IncludeContent($data)
 {
     global $langmessage, $gp_index;
     if (isset($data['index'])) {
         $requested = common::IndexToTitle($data['index']);
     } else {
         $requested = $data['content'];
     }
     if (empty($requested)) {
         return '<p>' . $langmessage['File Include'] . '</p>';
     }
     if (self::$title == $requested) {
         if (common::LoggedIn()) {
             msg('Infinite loop detected: ' . htmlspecialchars($requested));
         }
         return;
     }
     if (isset($data['include_type'])) {
         $type = $data['include_type'];
     } else {
         $type = common::SpecialOrAdmin($requested);
     }
     switch ($type) {
         case 'gadget':
             return self::IncludeGadget($requested);
         case 'special':
             return self::IncludeSpecial($requested);
         default:
             return self::IncludePage($requested);
     }
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:36,代码来源:SectionContent.php

示例8: RenameFileWorker

 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;
 }
开发者ID:Knuzen,项目名称:gpEasy-CMS,代码行数:50,代码来源:Page_Rename.php

示例9: define

<?php

define('gp_start_time', microtime(true));
defined('is_running') or define('is_running', true);
require_once 'common.php';
common::EntryPoint(0);
/*
 *	Flow Control
 */
if (!empty($GLOBALS['config']['updating_message'])) {
    die($GLOBALS['config']['updating_message']);
}
$title = common::WhichPage();
$type = common::SpecialOrAdmin($title);
switch ($type) {
    case 'special':
        includeFile('special.php');
        $page = new special_display($title, $type);
        break;
    case 'admin':
        if (common::LoggedIn()) {
            includeFile('admin/admin_display.php');
            $page = new admin_display($title, $type);
        } else {
            includeFile('admin/admin_login.php');
            $page = new admin_login($title, $type);
        }
        break;
    default:
        if (common::LoggedIn()) {
            includeFile('tool/editing_page.php');
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:31,代码来源:main.php

示例10: SectionFromPost_Include

 /**
  *
  *
  */
 static function SectionFromPost_Include(&$existing_section, $section_num, $title, $file_stats)
 {
     global $page, $langmessage, $gp_index, $config;
     unset($existing_section['index']);
     if (!empty($_POST['gadget_include'])) {
         $gadget = $_POST['gadget_include'];
         if (!isset($config['gadgets'][$gadget])) {
             message($langmessage['OOPS_TITLE']);
             return false;
         }
         $existing_section['include_type'] = 'gadget';
         $existing_section['content'] = $gadget;
     } else {
         $include_title = $_POST['file_include'];
         if (!isset($gp_index[$include_title])) {
             message($langmessage['OOPS_TITLE']);
             return false;
         }
         $existing_section['include_type'] = common::SpecialOrAdmin($include_title);
         $existing_section['index'] = $gp_index[$include_title];
         $existing_section['content'] = $include_title;
     }
     //send replacement content
     $content = section_content::RenderSection($existing_section, $section_num, $title, $file_stats);
     $page->ajaxReplace[] = array('gp_include_content', '', $content);
     return true;
 }
开发者ID:GedionChang,项目名称:gpEasy-CMS,代码行数:31,代码来源:editing.php

示例11: SearchDisplayRow

 /**
  * Display row
  *
  */
 function SearchDisplayRow($title)
 {
     global $langmessage, $gpLayouts, $gp_index, $gp_menu;
     $title_index = $gp_index[$title];
     $is_special = common::SpecialOrAdmin($title);
     $file = gpFiles::PageFile($title);
     $stats = @stat($file);
     $mtime = false;
     $size = false;
     $layout = admin_menu_tools::CurrentLayout($title_index);
     $layout_info = $gpLayouts[$layout];
     if ($stats) {
         $mtime = $stats['mtime'];
         $size = $stats['size'];
     }
     echo '<tr><td>';
     $label = common::GetLabel($title);
     echo common::Link($title, common::LabelSpecialChars($label));
     //area only display on mouseover
     echo '<div><div>';
     //style="position:absolute;bottom:0;left:10px;right:10px;"
     echo $this->Link('Admin_Menu', $langmessage['rename/details'], 'cmd=renameform&index=' . urlencode($title_index), array('title' => $langmessage['rename/details'], 'data-cmd' => 'gpajax'));
     echo $this->Link('Admin_Menu', $langmessage['Copy'], 'cmd=copypage&index=' . urlencode($title_index), array('title' => $langmessage['Copy'], 'data-cmd' => 'gpabox'));
     echo '<span>';
     echo $langmessage['layout'] . ': ';
     echo $this->Link('Admin_Menu', $layout_info['label'], 'cmd=layout&index=' . urlencode($title_index), array('title' => $langmessage['layout'], 'data-cmd' => 'gpabox'));
     echo '</span>';
     if (!$is_special) {
         echo $this->Link('Admin_Menu', $langmessage['delete'], 'cmd=trash&index=' . urlencode($title_index), array('title' => $langmessage['delete_page'], 'data-cmd' => 'postlink', 'class' => 'gpconfirm'));
     }
     gpPlugin::Action('MenuPageOptions', array($title, $title_index, false, $layout_info));
     //stats
     if (gpdebug) {
         echo '<span>Data Index: ' . $title_index . '</span>';
     }
     echo '</div>&nbsp;</div>';
     //types
     echo '</td><td>';
     $this->TitleTypes($title_index);
     //children
     echo '</td><td>';
     if (isset($Inherit_Info[$title_index]) && isset($Inherit_Info[$title_index]['children'])) {
         echo $Inherit_Info[$title_index]['children'];
     } elseif (isset($gp_menu[$title_index])) {
         echo '0';
     } else {
         echo $langmessage['Not In Main Menu'];
     }
     //size
     echo '</td><td>';
     if ($size) {
         echo admin_tools::FormatBytes($size);
     }
     //modified
     echo '</td><td>';
     if ($mtime) {
         echo common::date($langmessage['strftime_datetime'], $mtime);
     }
     echo '</td></tr>';
 }
开发者ID:Knuzen,项目名称:gpEasy-CMS,代码行数:64,代码来源:admin_menu_new.php

示例12: SaveSection_Include

 function SaveSection_Include($section)
 {
     global $page, $langmessage, $gp_index, $config;
     $section_data = $this->file_sections[$section];
     unset($section_data['index']);
     if (!empty($_POST['gadget_include'])) {
         $gadget = $_POST['gadget_include'];
         if (!isset($config['gadgets'][$gadget])) {
             message($langmessage['OOPS_TITLE']);
             return false;
         }
         $section_data['include_type'] = 'gadget';
         $section_data['content'] = $gadget;
     } else {
         $title = $_POST['file_include'];
         if (!isset($gp_index[$title])) {
             message($langmessage['OOPS_TITLE']);
             return false;
         }
         $section_data['include_type'] = common::SpecialOrAdmin($title);
         $section_data['index'] = $gp_index[$title];
         $section_data['content'] = $title;
     }
     $this->file_sections[$section] = $section_data;
     //send replacement content
     $content = $this->IncludeContent($section_data);
     $page->ajaxReplace[] = array('gp_include_content', '', $content);
     return true;
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:29,代码来源:editing_page.php

示例13: Get404

 function Get404()
 {
     global $langmessage, $page;
     gpOutput::AddHeader('Not Found', true, 404);
     $page->head .= '<meta name="robots" content="noindex,nofollow" />';
     //this isn't getting to the template because $page isn't available yet
     //message for admins
     if (common::LoggedIn()) {
         if ($this->requested && !common::SpecialOrAdmin($this->requested)) {
             $with_spaces = htmlspecialchars($this->requested);
             $link = common::GetUrl('Admin_Menu', 'cmd=add_hidden&redir=redir&title=' . rawurlencode($this->requested)) . '" title="' . $langmessage['create_new_file'] . '" data-cmd="gpabox';
             $message = sprintf($langmessage['DOESNT_EXIST'], $with_spaces, $link);
             msg($message);
         }
     }
     //Contents of 404 page
     $wrap = gpOutput::ShowEditLink('Admin_Missing');
     if ($wrap) {
         echo gpOutput::EditAreaLink($edit_index, 'Admin_Missing', $langmessage['edit'], 'cmd=edit404', ' title="' . $langmessage['404_Page'] . '" ');
         echo '<div class="editable_area" id="ExtraEditArea' . $edit_index . '">';
         // class="edit_area" added by javascript
     }
     echo special_missing::Get404Output();
     if ($wrap) {
         echo '</div>';
     }
 }
开发者ID:barbrick,项目名称:gpEasy-CMS,代码行数:27,代码来源:special_missing.php

示例14: NewFileIndex

 /**
  * Generate a new file index
  * skip indexes that are just numeric
  */
 static function NewFileIndex()
 {
     global $gp_index, $gp_titles, $dataDir, $config;
     $num_index = 0;
     /*prevent reusing old indexes */
     if (count($gp_index) > 0) {
         $max = count($gp_index);
         $title = end($gp_index);
         for ($i = $max; $i > 0; $i--) {
             $last_index = current($gp_index);
             $type = common::SpecialOrAdmin($title);
             if ($type == 'special') {
                 $title = prev($gp_index);
                 continue;
             }
             $i = 0;
         }
         reset($gp_index);
         $num_index = base_convert($last_index, 36, 10);
         $num_index++;
     }
     do {
         $index = base_convert($num_index, 10, 36);
         $num_index++;
         //check backup dir
         $backup_dir = $dataDir . '/data/_backup/pages/' . $index;
         if (file_exists($backup_dir)) {
             $index = false;
             continue;
         }
         //check for page directory
         $draft_file = $dataDir . '/data/_pages/' . substr($config['gpuniq'], 0, 7) . '_' . $index;
         if (file_exists($draft_file)) {
             $index = false;
             continue;
         }
     } while (!$index || is_numeric($index) || isset($gp_titles[$index]));
     return $index;
 }
开发者ID:barbrick,项目名称:gpEasy-CMS,代码行数:43,代码来源:common.php


注:本文中的common::SpecialOrAdmin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。