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


PHP RootURLController::should_be_on_root方法代码示例

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


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

示例1: init

 public function init()
 {
     parent::init();
     // If we've accessed the homepage as /home/, then we should redirect to /.
     if ($this->dataRecord && $this->dataRecord instanceof SiteTree && RootURLController::should_be_on_root($this->dataRecord) && (!isset($this->urlParams['Action']) || !$this->urlParams['Action']) && !$_POST && !$_FILES && !$this->redirectedTo()) {
         $getVars = $_GET;
         unset($getVars['url']);
         if ($getVars) {
             $url = "?" . http_build_query($getVars);
         } else {
             $url = "";
         }
         $this->redirect($url, 301);
         return;
     }
     if ($this->dataRecord) {
         $this->dataRecord->extend('contentcontrollerInit', $this);
     } else {
         singleton('SiteTree')->extend('contentcontrollerInit', $this);
     }
     if ($this->redirectedTo()) {
         return;
     }
     // Check page permissions
     if ($this->dataRecord && $this->URLSegment != 'Security' && !$this->dataRecord->canView()) {
         return Security::permissionFailure($this);
     }
     // Use theme from the site config
     if (($config = SiteConfig::current_site_config()) && $config->Theme) {
         Config::inst()->update('SSViewer', 'theme', $config->Theme);
     }
 }
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:32,代码来源:ContentController.php

示例2: init

 public function init()
 {
     parent::init();
     // If we've accessed the homepage as /home/, then we should redirect to /.
     if ($this->dataRecord && $this->dataRecord instanceof SiteTree && RootURLController::should_be_on_root($this->dataRecord) && (!isset($this->urlParams['Action']) || !$this->urlParams['Action']) && !$_POST && !$_FILES && !$this->redirectedTo()) {
         $getVars = $_GET;
         unset($getVars['url']);
         if ($getVars) {
             $url = "?" . http_build_query($getVars);
         } else {
             $url = "";
         }
         $this->redirect($url, 301);
         return;
     }
     if ($this->dataRecord) {
         $this->dataRecord->extend('contentcontrollerInit', $this);
     } else {
         singleton('SiteTree')->extend('contentcontrollerInit', $this);
     }
     if ($this->redirectedTo()) {
         return;
     }
     // Check page permissions
     if ($this->dataRecord && $this->URLSegment != 'Security' && !$this->dataRecord->canView()) {
         return Security::permissionFailure($this);
     }
     // Draft/Archive security check - only CMS users should be able to look at stage/archived content
     if ($this->URLSegment != 'Security' && !Session::get('unsecuredDraftSite') && (Versioned::current_archived_date() || Versioned::current_stage() && Versioned::current_stage() != 'Live')) {
         if (!$this->dataRecord->canViewStage(Versioned::current_archived_date() ? 'Stage' : Versioned::current_stage())) {
             $link = $this->Link();
             $message = _t("ContentController.DRAFT_SITE_ACCESS_RESTRICTION", 'You must log in with your CMS password in order to view the draft or archived content. ' . '<a href="%s">Click here to go back to the published site.</a>');
             Session::clear('currentStage');
             Session::clear('archiveDate');
             $permissionMessage = sprintf(_t("ContentController.DRAFT_SITE_ACCESS_RESTRICTION", 'You must log in with your CMS password in order to view the draft or archived content. ' . '<a href="%s">Click here to go back to the published site.</a>'), Controller::join_links($this->Link(), "?stage=Live"));
             return Security::permissionFailure($this, $permissionMessage);
         }
     }
     // Use theme from the site config
     if (($config = SiteConfig::current_site_config()) && $config->Theme) {
         Config::inst()->update('SSViewer', 'theme', $config->Theme);
     }
 }
开发者ID:prostart,项目名称:erics-homes,代码行数:43,代码来源:ContentController.php

示例3: init

 public function init()
 {
     parent::init();
     //Log page views
     Statistics::collect();
     // If we've accessed the homepage as /home/, then we should redirect to /.
     if ($this->dataRecord && $this->dataRecord instanceof SiteTree && RootURLController::should_be_on_root($this->dataRecord) && !$this->urlParams['Action'] && !$_POST && !$_FILES && !Director::redirected_to()) {
         $getVars = $_GET;
         unset($getVars['url']);
         if ($getVars) {
             $url = "?" . http_build_query($getVars);
         } else {
             $url = "";
         }
         Director::redirect($url);
         return;
     }
     if ($this->dataRecord) {
         $this->dataRecord->extend('contentcontrollerInit', $this);
     } else {
         singleton('SiteTree')->extend('contentcontrollerInit', $this);
     }
     if (Director::redirected_to()) {
         return;
     }
     Director::set_site_mode('site');
     // Check page permissions
     if ($this->dataRecord && $this->URLSegment != 'Security' && !$this->dataRecord->can('View')) {
         Security::permissionFailure($this);
     }
     // Draft/Archive security check - only CMS users should be able to look at stage/archived content
     if ($this->URLSegment != 'Security' && (Versioned::current_archived_date() || Versioned::current_stage() && Versioned::current_stage() != 'Live')) {
         if (!Permission::check('CMS_ACCESS_CMSMain')) {
             $link = $this->Link();
             $message = _t("ContentController.DRAFT_SITE_ACCESS_RESTRICTION", "You must log in with your CMS password in order to view the draft or archived content.  <a href=\"%s\">Click here to go back to the published site.</a>");
             Security::permissionFailure($this, sprintf($message, "{$link}?stage=Live"));
             return;
         }
     }
 }
开发者ID:ramziammar,项目名称:websites,代码行数:40,代码来源:ContentController.php


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