本文整理汇总了PHP中cmsUser::sessionUnset方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsUser::sessionUnset方法的具体用法?PHP cmsUser::sessionUnset怎么用?PHP cmsUser::sessionUnset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cmsUser
的用法示例。
在下文中一共展示了cmsUser::sessionUnset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
if (cmsUser::isLogged()) {
$this->redirectToHome();
}
$email = $this->request->get('login_email');
$password = $this->request->get('login_password');
$remember = (bool) $this->request->get('remember');
$back_url = $this->request->has('back') ? $this->request->get('back') : false;
$is_site_offline = !cmsConfig::get('is_site_on');
if ($this->request->has('submit')) {
$is_captcha_valid = true;
if (cmsUser::sessionGet('is_auth_captcha') && $this->options['auth_captcha']) {
$is_captcha_valid = cmsEventsManager::hook('captcha_validate', $this->request);
}
if ($is_captcha_valid) {
cmsUser::sessionUnset('is_auth_captcha');
$logged_id = cmsUser::login($email, $password, $remember);
if ($logged_id) {
if ($is_site_offline) {
$userSession = cmsUser::sessionGet('user');
if (!$userSession['is_admin']) {
cmsUser::addSessionMessage(LANG_LOGIN_ADMIN_ONLY, 'error');
cmsUser::logout();
$this->redirectBack();
}
}
cmsEventsManager::hook('auth_login', $logged_id);
$is_back = $this->request->get('is_back');
if ($is_back) {
$this->redirectBack();
}
if ($back_url) {
$this->redirect($back_url);
} else {
$this->redirectToHome();
}
}
}
if ($this->options['auth_captcha'] && !$is_site_offline) {
cmsUser::sessionSet('is_auth_captcha', true);
}
if ($is_captcha_valid) {
cmsUser::addSessionMessage(LANG_LOGIN_ERROR, 'error');
if ($is_site_offline) {
$this->redirectBack();
}
} else {
cmsUser::addSessionMessage(LANG_CAPTCHA_ERROR, 'error');
}
}
if ($back_url) {
cmsUser::addSessionMessage(LANG_LOGIN_REQUIRED, 'error');
}
if (cmsUser::sessionGet('is_auth_captcha')) {
$captcha_html = cmsEventsManager::hook('captcha_html');
}
return cmsTemplate::getInstance()->render('login', array('back_url' => $back_url, 'captcha_html' => isset($captcha_html) ? $captcha_html : false));
}
示例2: run
public function run()
{
if (cmsUser::isLogged()) {
$this->redirectToHome();
}
$email = $this->request->get('login_email', '');
$password = $this->request->get('login_password', '');
$remember = (bool) $this->request->get('remember');
$back_url = $this->request->get('back', '');
$is_site_offline = !cmsConfig::get('is_site_on');
$is_submit = $this->request->has('submit');
if ($is_submit) {
$is_captcha_valid = true;
if (cmsUser::sessionGet('is_auth_captcha') && $this->options['auth_captcha']) {
$is_captcha_valid = cmsEventsManager::hook('captcha_validate', $this->request);
}
if ($is_captcha_valid) {
cmsUser::sessionUnset('is_auth_captcha');
$logged_id = cmsUser::login($email, $password, $remember);
if ($logged_id) {
if ($is_site_offline) {
$userSession = cmsUser::sessionGet('user');
if (!$userSession['is_admin']) {
cmsUser::addSessionMessage(LANG_LOGIN_ADMIN_ONLY, 'error');
cmsUser::logout();
$this->redirectBack();
}
}
cmsEventsManager::hook('auth_login', $logged_id);
$auth_redirect = $this->options['auth_redirect'];
$is_first_auth = cmsUser::getUPS('first_auth', $logged_id);
if ($is_first_auth) {
$auth_redirect = $this->options['first_auth_redirect'];
cmsUser::deleteUPS('first_auth', $logged_id);
}
if ($back_url) {
$this->redirect($back_url);
} else {
$this->redirect($this->getAuthRedirectUrl($auth_redirect));
}
}
}
if ($this->options['auth_captcha'] && !$is_site_offline) {
cmsUser::sessionSet('is_auth_captcha', true);
}
if ($is_captcha_valid) {
cmsUser::addSessionMessage(LANG_LOGIN_ERROR, 'error');
if ($is_site_offline) {
$this->redirectBack();
}
} else {
cmsUser::addSessionMessage(LANG_CAPTCHA_ERROR, 'error');
}
if ($this->options['auth_redirect'] == 'none' || !empty($is_first_auth) && $this->options['first_auth_redirect'] == 'none') {
if (!$back_url) {
$back_url = $this->getBackURL();
}
}
}
if ($back_url && !$is_submit) {
cmsUser::addSessionMessage(LANG_LOGIN_REQUIRED, 'error');
}
if (cmsUser::sessionGet('is_auth_captcha')) {
$captcha_html = cmsEventsManager::hook('captcha_html');
}
return $this->cms_template->render('login', array('back_url' => $back_url, 'captcha_html' => isset($captcha_html) ? $captcha_html : false));
}