/**
  * Generate FE page
  * Override TL_PTY.regular
  *
  * @param      $objPage
  * @param bool $blnCheckRequest
  */
 function generate($objPage, $blnCheckRequest = false)
 {
     self::fixupCurrentLanguage();
     // Check if default language
     if ($GLOBALS['TL_LANGUAGE'] === $this->domainLanguages['default']) {
         // if default language is not published, give error
         if (empty($objPage->i18nl10n_published)) {
             /** @var  \Contao\PageError404  $objError */
             $objError = new $GLOBALS['TL_PTY']['error_404']();
             $objError->generate($objPage->id);
         }
         self::addAlternativeLanguageLinks($objPage);
         parent::generate($objPage, $blnCheckRequest);
         return;
     }
     // Try to get translated page
     $objPage = I18nl10n::getInstance()->findPublishedL10nPage($objPage);
     // If neither fallback nor localization are published and null
     // was given, give error 404
     if (!$objPage) {
         /** @var  \Contao\PageError404  $objError */
         $objError = new $GLOBALS['TL_PTY']['error_404']();
         $objError->generate($objPage->id);
     }
     self::addAlternativeLanguageLinks($objPage);
     parent::generate($objPage, $blnCheckRequest);
 }
示例#2
0
文件: ajax.php 项目: jens-wetzel/use2
 /**
  * Initialize the object
  */
 public function __construct()
 {
     // Load user object before calling the parent constructor
     $this->import('FrontendUser', 'User');
     parent::__construct();
     // Check whether a user is logged in
     define('BE_USER_LOGGED_IN', $this->getLoginStatus('BE_USER_AUTH'));
     define('FE_USER_LOGGED_IN', $this->getLoginStatus('FE_USER_AUTH'));
 }
示例#3
0
 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);
             }
         }
     }
 }
示例#4
0
 /**
  * load language file
  */
 public function __construct()
 {
     parent::__construct();
     // required for form captcha
     $this->loadLanguageFile('default');
 }