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


PHP BackendAuthentication::isLoggedIn方法代码示例

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


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

示例1: setLanguage

 /**
  * Set language
  *
  * @param string $value The language to load.
  */
 private function setLanguage($value)
 {
     // set property
     $this->language = (string) $value;
     // is this a authenticated user?
     if (BackendAuthentication::isLoggedIn()) {
         $language = BackendAuthentication::getUser()->getSetting('interface_language');
     } else {
         $language = BackendModel::getModuleSetting('core', 'default_interface_language');
     }
     // set the locale (we need this for the labels)
     BackendLanguage::setLocale($language);
     // set the working language
     BackendLanguage::setWorkingLanguage($this->language);
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:20,代码来源:javascript.php

示例2: validateLogin

 /**
  * Do authentication stuff
  * This method could end the script by throwing an exception
  *
  * @return	void
  */
 private function validateLogin()
 {
     // check if the user is logged on, if not he shouldn't load any JS-file
     if (!BackendAuthentication::isLoggedIn()) {
         // set the correct header
         SpoonHTTP::setHeadersByCode(403);
         // output
         $fakeAction = new BackendBaseAJAXAction('', '');
         $fakeAction->output(BackendBaseAJAXAction::FORBIDDEN, null, 'Not logged in.');
     }
     // set interface language
     BackendLanguage::setLocale(BackendAuthentication::getUser()->getSetting('interface_language'));
 }
开发者ID:netconstructor,项目名称:forkcms,代码行数:19,代码来源:ajax.php

示例3: processRegularRequest

 /**
  * Process a regular request
  *
  * @param string $module The requested module.
  * @param string $action The requested action.
  * @param strring $language The requested language.
  */
 private function processRegularRequest($module, $action, $language)
 {
     // the person isn't logged in? or the module doesn't require authentication
     if (!BackendAuthentication::isLoggedIn() && !BackendAuthentication::isAllowedModule($module)) {
         // redirect to login
         SpoonHTTP::redirect('/' . NAMED_APPLICATION . '/' . $language . '/authentication/?querystring=' . urlencode('/' . $this->getQueryString()));
     } else {
         // does our user has access to this module?
         if (!BackendAuthentication::isAllowedModule($module)) {
             // if the module is the dashboard redirect to the first allowed module
             if ($module == 'dashboard') {
                 // require navigation-file
                 require_once BACKEND_CACHE_PATH . '/navigation/navigation.php';
                 // loop the navigation to find the first allowed module
                 foreach ($navigation as $key => $value) {
                     // split up chunks
                     list($module, $action) = explode('/', $value['url']);
                     // user allowed?
                     if (BackendAuthentication::isAllowedModule($module)) {
                         // redirect to the page
                         SpoonHTTP::redirect('/' . NAMED_APPLICATION . '/' . $language . '/' . $value['url']);
                     }
                 }
             }
             // the user doesn't have access, redirect to error page
             SpoonHTTP::redirect('/' . NAMED_APPLICATION . '/' . $language . '/error?type=module-not-allowed&querystring=' . urlencode('/' . $this->getQueryString()));
         } else {
             // can our user execute the requested action?
             if (!BackendAuthentication::isAllowedAction($action, $module)) {
                 // the user hasn't access, redirect to error page
                 SpoonHTTP::redirect('/' . NAMED_APPLICATION . '/' . $language . '/error?type=action-not-allowed&querystring=' . urlencode('/' . $this->getQueryString()));
             } else {
                 // set the working language, this is not the interface language
                 BackendLanguage::setWorkingLanguage($language);
                 $this->setLocale();
                 $this->setModule($module);
                 $this->setAction($action);
             }
         }
     }
 }
开发者ID:naujasdizainas,项目名称:forkcms,代码行数:48,代码来源:url.php

示例4: processQueryString

 /**
  * Process the querystring
  *
  * @return	void
  */
 private function processQueryString()
 {
     // store the querystring local, so we don't alter it.
     $queryString = $this->getQueryString();
     // find the position of ? (which seperates real URL and GET-parameters)
     $positionQuestionMark = strpos($queryString, '?');
     // remove the GET-chunk from the parameters
     $processedQueryString = $positionQuestionMark === false ? $queryString : substr($queryString, 0, $positionQuestionMark);
     // split into chunks, a Backend URL will always look like /<lang>/<module>/<action>(?GET)
     $chunks = (array) explode('/', trim($processedQueryString, '/'));
     // check if this is a request for a JS-file
     $isJS = isset($chunks[1]) && $chunks[1] == 'js.php';
     // check if this is a request for a AJAX-file
     $isAJAX = isset($chunks[1]) && $chunks[1] == 'ajax.php';
     // get the language, this will always be in front
     $language = isset($chunks[1]) && $chunks[1] != '' ? SpoonFilter::getValue($chunks[1], array_keys(BackendLanguage::getWorkingLanguages()), '') : '';
     // no language provided?
     if ($language == '' && !$isJS && !$isAJAX) {
         // remove first element
         array_shift($chunks);
         // redirect to login
         SpoonHTTP::redirect('/' . NAMED_APPLICATION . '/' . SITE_DEFAULT_LANGUAGE . '/' . implode('/', $chunks));
     }
     // get the module, null will be the default
     $module = isset($chunks[2]) && $chunks[2] != '' ? $chunks[2] : 'dashboard';
     // get the requested action, if it is passed
     if (isset($chunks[3]) && $chunks[3] != '') {
         $action = $chunks[3];
     } elseif (!$isJS && !$isAJAX) {
         // build path to the module and define it. This is a constant because we can use this in templates.
         if (!defined('BACKEND_MODULE_PATH')) {
             define('BACKEND_MODULE_PATH', BACKEND_MODULES_PATH . '/' . $module);
         }
         // check if the config is present? If it isn't present there is a huge problem, so we will stop our code by throwing an error
         if (!SpoonFile::exists(BACKEND_MODULE_PATH . '/config.php')) {
             throw new BackendException('The configfile for the module (' . $module . ') can\'t be found.');
         }
         // build config-object-name
         $configClassName = 'Backend' . SpoonFilter::toCamelCase($module . '_config');
         // require the config file, we validated before for existence.
         require_once BACKEND_MODULE_PATH . '/config.php';
         // validate if class exists (aka has correct name)
         if (!class_exists($configClassName)) {
             throw new BackendException('The config file is present, but the classname should be: ' . $configClassName . '.');
         }
         // create config-object, the constructor will do some magic
         $config = new $configClassName($module);
         // set action
         $action = $config->getDefaultAction() !== null ? $config->getDefaultAction() : 'index';
     }
     // if it is an request for a JS-file or an AJAX-file we only need the module
     if ($isJS || $isAJAX) {
         // set the working language, this is not the interface language
         BackendLanguage::setWorkingLanguage(SpoonFilter::getGetValue('language', null, SITE_DEFAULT_LANGUAGE));
         // set current module
         $this->setModule(SpoonFilter::getGetValue('module', null, null));
         // set action
         $this->setAction('index');
     } else {
         // the person isn't logged in? or the module doesn't require authentication
         if (!BackendAuthentication::isLoggedIn() && !BackendAuthentication::isAllowedModule($module)) {
             // redirect to login
             SpoonHTTP::redirect('/' . NAMED_APPLICATION . '/' . $language . '/authentication/?querystring=' . urlencode('/' . $this->getQueryString()));
         } else {
             // does our user has access to this module?
             if (!BackendAuthentication::isAllowedModule($module)) {
                 // the user doesn't have access, redirect to error page
                 SpoonHTTP::redirect('/' . NAMED_APPLICATION . '/' . $language . '/error?type=module-not-allowed&querystring=' . urlencode('/' . $this->getQueryString()));
             } else {
                 // can our user execute the requested action?
                 if (!BackendAuthentication::isAllowedAction($action, $module)) {
                     // the user hasn't access, redirect to error page
                     SpoonHTTP::redirect('/' . NAMED_APPLICATION . '/' . $language . '/error?type=action-not-allowed&querystring=' . urlencode('/' . $this->getQueryString()));
                 } else {
                     // set the working language, this is not the interface language
                     BackendLanguage::setWorkingLanguage($language);
                     // is the user authenticated
                     if (BackendAuthentication::getUser()->isAuthenticated()) {
                         // set interface language based on the user preferences
                         BackendLanguage::setLocale(BackendAuthentication::getUser()->getSetting('interface_language', 'nl'));
                     } else {
                         // init var
                         $interfaceLanguage = BackendModel::getModuleSetting('core', 'default_interface_language');
                         // override with cookie value if that exists
                         if (SpoonCookie::exists('interface_language') && in_array(SpoonCookie::get('interface_language'), array_keys(BackendLanguage::getInterfaceLanguages()))) {
                             // set interface language based on the perons' cookies
                             $interfaceLanguage = SpoonCookie::get('interface_language');
                         }
                         // set interface language
                         BackendLanguage::setLocale($interfaceLanguage);
                     }
                     // set current module
                     $this->setModule($module);
                     $this->setAction($action);
                 }
//.........这里部分代码省略.........
开发者ID:netconstructor,项目名称:forkcms,代码行数:101,代码来源:url.php

示例5: CheckAuthentication

/**
 * This function must check the user session to be sure that he/she is
 * authorized to upload and access files in the File Browser.
 *
 * @return boolean
 */
function CheckAuthentication()
{
    return BackendAuthentication::isLoggedIn();
}
开发者ID:nickmancol,项目名称:forkcms-rhcloud,代码行数:10,代码来源:config.php


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