本文整理汇总了PHP中TBGContext::_redirect_login方法的典型用法代码示例。如果您正苦于以下问题:PHP TBGContext::_redirect_login方法的具体用法?PHP TBGContext::_redirect_login怎么用?PHP TBGContext::_redirect_login使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBGContext
的用法示例。
在下文中一共展示了TBGContext::_redirect_login方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initializeUser
protected static function initializeUser()
{
TBGLogging::log('Loading user');
try {
TBGLogging::log('is this logout?');
if (self::getRequest()->getParameter('logout')) {
TBGLogging::log('yes');
self::logout();
} else {
TBGLogging::log('no');
TBGLogging::log('sets up user object');
$event = TBGEvent::createNew('core', 'pre_login');
$event->trigger();
if ($event->isProcessed()) {
self::loadUser($event->getReturnValue());
} else {
self::loadUser();
}
TBGEvent::createNew('core', 'post_login', self::getUser())->trigger();
TBGLogging::log('loaded');
self::cacheAllPermissions();
}
} catch (Exception $e) {
TBGLogging::log("Something happened while setting up user: " . $e->getMessage(), 'main', TBGLogging::LEVEL_WARNING);
if (!self::isCLI() && (self::getRouting()->getCurrentRouteModule() != 'main' || self::getRouting()->getCurrentRouteAction() != 'register1' && self::getRouting()->getCurrentRouteAction() != 'register2' && self::getRouting()->getCurrentRouteAction() != 'activate' && self::getRouting()->getCurrentRouteAction() != 'reset_password' && self::getRouting()->getCurrentRouteAction() != 'captcha' && self::getRouting()->getCurrentRouteAction() != 'login' && self::getRouting()->getCurrentRouteAction() != 'getBackdropPartial' && self::getRouting()->getCurrentRouteAction() != 'serve')) {
self::$_redirect_login = true;
} else {
self::$_user = self::factory()->TBGUser(TBGSettings::getDefaultUserID());
}
}
TBGLogging::log('...done');
}
示例2: initializeUser
protected static function initializeUser()
{
TBGLogging::log('Loading user');
try {
TBGLogging::log('is this logout?');
if (self::getRequest()->getParameter('logout')) {
TBGLogging::log('yes');
self::logout();
} else {
TBGLogging::log('no');
TBGLogging::log('sets up user object');
$event = TBGEvent::createNew('core', 'pre_login');
$event->trigger();
if ($event->isProcessed()) {
self::loadUser($event->getReturnValue());
} elseif (!self::isCLI()) {
self::loadUser();
} else {
self::$_user = new TBGUser();
}
TBGEvent::createNew('core', 'post_login', self::getUser())->trigger();
TBGLogging::log('loaded');
TBGLogging::log('caching permissions');
self::cacheAllPermissions();
TBGLogging::log('done (caching permissions)');
}
} catch (TBGElevatedLoginException $e) {
TBGLogging::log("Could not reauthenticate elevated permissions: " . $e->getMessage(), 'main', TBGLogging::LEVEL_INFO);
TBGContext::setMessage('elevated_login_message_err', $e->getMessage());
self::$_redirect_login = 'elevated_login';
} catch (Exception $e) {
TBGLogging::log("Something happened while setting up user: " . $e->getMessage(), 'main', TBGLogging::LEVEL_WARNING);
$allow_anonymous_routes = array('register', 'register_check_username', 'register1', 'register2', 'activate', 'reset_password', 'captcha', 'login', 'login_page', 'getBackdropPartial', 'serve', 'doLogin');
if (!self::isCLI() && (!in_array(self::getRouting()->getCurrentRouteModule(), array('main', 'remote')) || !in_array(self::getRouting()->getCurrentRouteName(), $allow_anonymous_routes))) {
TBGContext::setMessage('login_message_err', $e->getMessage());
self::$_redirect_login = 'login';
} else {
self::$_user = self::factory()->TBGUser(TBGSettings::getDefaultUserID());
}
}
TBGLogging::log('...done');
}