本文整理汇总了PHP中Backend\Core\Engine\Authentication::isLoggedIn方法的典型用法代码示例。如果您正苦于以下问题:PHP Authentication::isLoggedIn方法的具体用法?PHP Authentication::isLoggedIn怎么用?PHP Authentication::isLoggedIn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Backend\Core\Engine\Authentication
的用法示例。
在下文中一共展示了Authentication::isLoggedIn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateLogin
/**
* Do authentication stuff
* This method could end the script by throwing an exception
*/
private function validateLogin()
{
// check if the user is logged on, if not he shouldn't load any JS-file
if (!Authentication::isLoggedIn()) {
throw new Exception('Not logged in.');
}
// set interface language
BackendLanguage::setLocale(Authentication::getUser()->getSetting('interface_language'));
}
示例2: 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()
{
// WARNING : DO NOT simply return "true". By doing so, you are allowing
// "anyone" to upload and list the files in your server. You must implement
// some kind of session validation here. Even something very simple as...
// return isset($_SESSION['IsAuthorized']) && $_SESSION['IsAuthorized'];
// ... where $_SESSION['IsAuthorized'] is set to "true" as soon as the
// user logs in your system. To be able to use session variables don't
// forget to add session_start() at the top of this file.
return BackendAuthentication::isLoggedIn();
}
示例3: processRegularRequest
/**
* Process a regular request
*
* @param string $module The requested module.
* @param string $action The requested action.
* @param string $language The requested language.
*/
private function processRegularRequest($module, $action, $language)
{
// the person isn't logged in? or the module doesn't require authentication
if (!Authentication::isLoggedIn() && !Authentication::isAllowedModule($module)) {
// redirect to login
$this->redirect('/' . NAMED_APPLICATION . '/' . $language . '/authentication?querystring=' . rawurlencode('/' . $this->getQueryString()));
} elseif (Authentication::isLoggedIn() && !Authentication::isAllowedModule($module)) {
// the person is logged in, but doesn't have access to our action
// if the module is the dashboard redirect to the first allowed module
if ($module == 'Dashboard') {
// require navigation-file
require_once Navigation::getCacheDirectory() . 'navigation.php';
// loop the navigation to find the first allowed module
foreach ($navigation as $value) {
// split up chunks
list($module, $action) = explode('/', $value['url']);
// user allowed?
if (Authentication::isAllowedModule($module)) {
// redirect to the page
$this->redirect('/' . NAMED_APPLICATION . '/' . $language . '/' . $value['url']);
} else {
if (array_key_exists('children', $value)) {
foreach ($value['children'] as $subItem) {
// split up chunks
list($module, $action) = explode('/', $subItem['url']);
// user allowed?
if (Authentication::isAllowedModule($module)) {
$finder = new Finder();
$files = $finder->files()->name('*.php')->in(BACKEND_MODULES_PATH . '/' . \SpoonFilter::toCamelCase($module) . '/Actions');
foreach ($files as $file) {
$moduleAction = mb_substr($file->getFilename(), 0, -4);
if (Authentication::isAllowedAction($moduleAction, $module)) {
$this->redirect('/' . NAMED_APPLICATION . '/' . $language . '/' . $module . '/' . $moduleAction);
}
}
}
}
}
}
}
}
// the user doesn't have access, redirect to error page
$this->redirect('/' . NAMED_APPLICATION . '/' . $language . '/error?type=module-not-allowed&querystring=' . rawurlencode('/' . $this->getQueryString()), 307);
} elseif (!Authentication::isAllowedAction($action, $module)) {
// the user hasn't access, redirect to error page
$this->redirect('/' . NAMED_APPLICATION . '/' . $language . '/error?type=action-not-allowed&querystring=' . rawurlencode('/' . $this->getQueryString()), 307);
} else {
// set the working language, this is not the interface language
BackendLanguage::setWorkingLanguage($language);
$this->setLocale();
$this->setModule($module);
$this->setAction($action);
}
}