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


PHP PageModel::find403ByPid方法代码示例

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


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

示例1: generate

 /**
  * Generate an error 403 page
  * @param integer
  * @param object
  */
 public function generate($pageId, $objRootPage = null)
 {
     // Add a log entry
     $this->log('Access to page ID "' . $pageId . '" denied', 'PageError403 generate()', TL_ERROR);
     // Use the given root page object if available (thanks to Andreas Schempp)
     if ($objRootPage === null) {
         $objRootPage = $this->getRootPageFromUrl();
     } else {
         $objRootPage = \PageModel::findPublishedById(is_integer($objRootPage) ? $objRootPage : $objRootPage->id);
     }
     // Look for an error_403 page
     $obj403 = \PageModel::find403ByPid($objRootPage->id);
     // Die if there is no page at all
     if ($obj403 === null) {
         header('HTTP/1.1 403 Forbidden');
         die('Forbidden');
     }
     // Generate the error page
     if (!$obj403->autoforward || !$obj403->jumpTo) {
         global $objPage;
         $objPage = $this->getPageDetails($obj403);
         $objHandler = new $GLOBALS['TL_PTY']['regular']();
         header('HTTP/1.1 403 Forbidden');
         $objHandler->generate($objPage);
         exit;
     }
     // Forward to another page
     $objNextPage = \PageModel::findPublishedById($obj403->jumpTo);
     if ($objNextPage === null) {
         header('HTTP/1.1 403 Forbidden');
         $this->log('Forward page ID "' . $obj403->jumpTo . '" does not exist', 'PageError403 generate()', TL_ERROR);
         die('Forward page not found');
     }
     $this->redirect($this->generateFrontendUrl($objNextPage->row(), null, $objRootPage->language), $obj403->redirect == 'temporary' ? 302 : 301);
 }
开发者ID:rburch,项目名称:core,代码行数:40,代码来源:PageError403.php

示例2: handle403

    /**
     * {@inheritdoc}
     */
    public function handle403($pageId, \PageModel $rootPage)
    {
        if ($rootPage->browser_auth_basic_realm && !FE_USER_LOGGED_IN) {
            $authenticate = <<<EOF
WWW-Authenticate: Basic realm="{$rootPage->browser_auth_basic_realm}"
EOF;
            header('HTTP/1.1 401 Unauthorized');
            header($authenticate);
            // Look for an error_403 page
            $obj403 = \PageModel::find403ByPid($rootPage->id);
            // Die if there is no page at all
            if ($obj403 === null) {
                echo '403 Forbidden';
                exit;
            }
            // Generate the error page
            if (!$obj403->autoforward || !$obj403->jumpTo) {
                global $objPage;
                $objPage = $obj403->loadDetails();
                $objHandler = new $GLOBALS['TL_PTY']['regular']();
                $objHandler->generate($objPage);
                exit;
            }
            // Forward to another page
            $nextPage = \PageModel::findPublishedById($obj403->jumpTo);
            if ($nextPage === null) {
                $this->log('Forward page ID "' . $obj403->jumpTo . '" does not exist', 'PageError403 generate()', TL_ERROR);
                die('Forward page not found');
            }
            $url = \Environment::get('base') . \Controller::generateFrontendUrl($nextPage->row(), null, $rootPage->language);
            echo <<<EOF
<!DOCTYPE html>
<html lang="de">
<head>
<meta http-equiv="refresh" content="5; URL={$url}">
</head>
<body>
Redirecting to <a href="{$url}">{$url}</a>
</body>
</html>
EOF;
            exit;
        }
    }
开发者ID:bit3,项目名称:contao-browser-auth-basic,代码行数:47,代码来源:Basic.php

示例3: generate

 /**
  * Generate an error 403 page
  *
  * @param integer    $pageId
  * @param \PageModel $objRootPage
  */
 public function generate($pageId, $objRootPage = null)
 {
     // Add a log entry
     $this->log('Access to page ID "' . $pageId . '" denied', __METHOD__, TL_ERROR);
     // Use the given root page object if available (thanks to Andreas Schempp)
     if ($objRootPage === null) {
         $objRootPage = $this->getRootPageFromUrl();
     } else {
         $objRootPage = \PageModel::findPublishedById(is_integer($objRootPage) ? $objRootPage : $objRootPage->id);
     }
     // Look for a 403 page
     $obj403 = \PageModel::find403ByPid($objRootPage->id);
     // Die if there is no page at all
     if (null === $obj403) {
         header('HTTP/1.1 403 Forbidden');
         die_nicely('be_forbidden', 'Forbidden');
     }
     // Generate the error page
     if (!$obj403->autoforward || !$obj403->jumpTo) {
         /** @var \PageModel $objPage */
         global $objPage;
         // Die nicely if the page is a 403 page already (see #8060)
         if ($objPage && $objPage->type == 'error_403') {
             header('HTTP/1.1 403 Forbidden');
             die_nicely('be_forbidden', 'Forbidden');
         }
         $objPage = $obj403->loadDetails();
         /** @var \PageRegular $objHandler */
         $objHandler = new $GLOBALS['TL_PTY']['regular']();
         header('HTTP/1.1 403 Forbidden');
         $objHandler->generate($objPage);
         exit;
     }
     // Forward to another page
     $objNextPage = \PageModel::findPublishedById($obj403->jumpTo);
     if (null === $objNextPage) {
         header('HTTP/1.1 403 Forbidden');
         $this->log('Forward page ID "' . $obj403->jumpTo . '" does not exist', __METHOD__, TL_ERROR);
         die_nicely('be_no_forward', 'Forward page not found');
     }
     $this->redirect($this->generateFrontendUrl($objNextPage->loadDetails()->row(), null, $objRootPage->language, true), $obj403->redirect == 'temporary' ? 302 : 301);
 }
开发者ID:StephenGWills,项目名称:sample-contao-app,代码行数:48,代码来源:PageError403.php

示例4: checkLoginStatus

 public function checkLoginStatus($objPage, $objLayout, \PageRegular $objPageRegular)
 {
     global $objPage;
     $loggedIn = FE_USER_LOGGED_IN;
     if (\Input::get('logout')) {
         if (@$this->User->logout()) {
             $loggedIn = false;
         }
     }
     if (!$loggedIn && $objPage->type != "login" && (Config::get("globalLogin") == 1 || $objPage->type == "error_403")) {
         $loginPage = PageModel::findOneBy("type", "login");
         if (isset($loginPage) && $loginPage->published == 1) {
             $loginPage->loadDetails();
             $objPage = $loginPage;
             $handler = new LoginPage(\Environment::get("request"));
             $handler->generate($loginPage);
             exit;
         } else {
             System::log("Please create a Login-Page urgently!!", "LoginPage\\checkLoginStatus", TL_ERROR);
             if ($objPage->type == "error_403") {
                 return;
             }
             $page403_model = \PageModel::find403ByPid($objPage->rootId);
             if (isset($page403_model) && $page403_model->published == 1) {
                 $page403_model->loadDetails();
                 $objPage = $page403_model;
                 $handler = new PageError403();
                 $handler->generate($page403_model->id, $page403_model->rootId);
                 exit;
             } else {
                 System::log("Please create a 403-Error-Page urgently!!", "LoginPage\\checkLoginStatus", TL_ERROR);
                 $objPage->template = 'fe_login';
                 $objPage->templateGroup = $objLayout->templates;
                 $objPageRegular->createTemplate($objPage, $objLayout);
             }
         }
     }
 }
开发者ID:postyou,项目名称:contao-deep-login,代码行数:38,代码来源:LoginPage.php


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