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


PHP CWebUser::logout方法代码示例

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


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

示例1: logout

 /**
  * Logout Function
  * @param boolean $destroySession destroy the session or not
  */
 public function logout($destroySession = true)
 {
     // I always remove the session variable model.
     Yii::app()->getSession()->remove('current_user');
     Yii::app()->session->clear();
     Yii::app()->session->destroy();
     parent::logout();
 }
开发者ID:nganhtuan63,项目名称:gxc-cms,代码行数:12,代码来源:GxcUser.php

示例2: testLoginLogout

 /**
  * @runInSeparateProcess
  * @outputBuffering enabled
  * @dataProvider booleanProvider
  */
 public function testLoginLogout($destroySession)
 {
     $identity = new CUserIdentity('testUser', 'testPassword');
     $user = new CWebUser();
     $user->init();
     // be guest before login
     $this->assertTrue($user->isGuest);
     // do a login
     $this->assertTrue($user->login($identity));
     // don't be guest after login
     $this->assertFalse($user->isGuest);
     $this->assertEquals('testUser', $user->getId());
     $this->assertEquals('testUser', $user->getName());
     $user->logout($destroySession);
     // be guest after logout
     $this->assertNull($user->getId());
     $this->assertEquals($user->guestName, $user->getName());
 }
开发者ID:super-d2,项目名称:codeigniter_demo,代码行数:23,代码来源:CWebUserTest.php

示例3: logout

 /**
  * This is here since there is a bug with cookies
  * that have been saved to a domain name such as
  * .domain.com so all subdomains can access it as well
  * @see http://code.google.com/p/yii/issues/detail?id=856
  */
 public function logout($destroySession = true)
 {
     if ($this->allowAutoLogin && isset($this->identityCookie['domain'])) {
         $cookies = Yii::app()->getRequest()->getCookies();
         if (null !== ($cookie = $cookies[$this->getStateKeyPrefix()])) {
             $originalCookie = new CHttpCookie($cookie->name, $cookie->value);
             $cookie->domain = $this->identityCookie['domain'];
             $cookies->remove($this->getStateKeyPrefix());
             $cookies->add($originalCookie->name, $originalCookie);
         }
         // Remove Roles
         $assigned_roles = Yii::app()->authManager->getRoles(Yii::app()->user->id);
         if (!empty($assigned_roles)) {
             $auth = Yii::app()->authManager;
             foreach ($assigned_roles as $n => $role) {
                 if ($auth->revoke($n, Yii::app()->user->id)) {
                     Yii::app()->authManager->save();
                 }
             }
         }
     }
     parent::logout($destroySession);
 }
开发者ID:hansenmakangiras,项目名称:yiiframework-cms,代码行数:29,代码来源:CustomWebUser.php

示例4: logout

 public function logout($destroySession = true)
 {
     $result = false;
     $usersession = $this->getICrugeSession();
     if ($usersession != null) {
         $filtro = $this->getum()->getSessionFilter();
         $usersession->logout();
         if ($filtro->onStore($usersession)) {
             $filtro->onLogout($usersession);
             $result = true;
         } else {
             Yii::log(CHtml::errorSummary($usersession, "error al guardar una sesion"), "error");
             $this->_lastError = CrugeTranslator::t("Error al almacenar sesion");
         }
     }
     parent::logout($destroySession);
     return $result;
 }
开发者ID:AndressJose,项目名称:bolsa-proyecto-integrado,代码行数:18,代码来源:CrugeWebUser.php

示例5: logout

 public function logout($destroySession = true)
 {
     $result = false;
     $usersession = $this->getICrugeSession();
     if ($usersession != null) {
         $filtro = $this->getum()->getSessionFilter();
         // para compatibilidad con anteriores versiones del filtro
         if (method_exists($filtro, 'onBeforeLogout')) {
             if ($filtro->onBeforeLogout($usersession) == false) {
                 return false;
             }
         }
         $usersession->logout();
         if ($filtro->onStore($usersession)) {
             $filtro->onLogout($usersession);
             $result = true;
         } else {
             Yii::log(CHtml::errorSummary($usersession, "error al guardar una sesion"), "error");
             $this->_lastError = CrugeTranslator::t("Error al almacenar sesion");
         }
     }
     parent::logout($destroySession);
     return $result;
 }
开发者ID:Telemedellin,项目名称:tm,代码行数:24,代码来源:CrugeWebUser.php

示例6: define

**/
define('ZBX_PAGE_NO_AUTHORIZATION', true);
define('ZBX_NOT_ALLOW_ALL_NODES', true);
define('ZBX_HIDE_NODE_SELECTION', true);
define('ZBX_PAGE_NO_MENU', true);
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/forms.inc.php';
$page['title'] = _('ZABBIX');
$page['file'] = 'index.php';
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = array('name' => array(T_ZBX_STR, O_NO, null, NOT_EMPTY, 'isset({enter})', _('Username')), 'password' => array(T_ZBX_STR, O_OPT, null, null, 'isset({enter})'), 'sessionid' => array(T_ZBX_STR, O_OPT, null, null, null), 'reconnect' => array(T_ZBX_INT, O_OPT, P_SYS, BETWEEN(0, 65535), null), 'enter' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'autologin' => array(T_ZBX_INT, O_OPT, null, null, null), 'request' => array(T_ZBX_STR, O_OPT, null, null, null));
check_fields($fields);
// logout
if (isset($_REQUEST['reconnect'])) {
    add_audit(AUDIT_ACTION_LOGOUT, AUDIT_RESOURCE_USER, _('Manual Logout'));
    CWebUser::logout();
}
$config = select_config();
if ($config['authentication_type'] == ZBX_AUTH_HTTP) {
    if (!empty($_SERVER['PHP_AUTH_USER'])) {
        $_REQUEST['enter'] = _('Sign in');
        $_REQUEST['name'] = $_SERVER['PHP_AUTH_USER'];
    } else {
        access_deny();
    }
}
// login via form
if (isset($_REQUEST['enter']) && $_REQUEST['enter'] == _('Sign in')) {
    // try to login
    if (CWebUser::login(get_request('name', ''), get_request('password', ''))) {
        // save remember login preference
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:index.php

示例7: logout

 /**
  * Logouts user and sends some goodbye messages.
  *
  * @param bool $destroySession Whether to destroy session or not. Please
  *                             note that if set to true, messages will be
  *                             muted and `$mute` flag won't have any effect.
  * @param bool $mute           Controls user flash messages generation.
  *
  * @return void
  * @since 0.1.0
  */
 public function logout($destroySession = false, $mute = false)
 {
     if ($this->getIsGuest()) {
         if (!$destroySession && !$mute) {
             $this->sendErrorMessage('auth.logout.guestAttempt');
         }
         return;
     }
     parent::logout($destroySession);
     if (!$mute) {
         $this->sendNotice('auth.logout.goodbye');
     }
 }
开发者ID:EhteshamMehmood,项目名称:BlogMVC,代码行数:24,代码来源:WebUserLayer.php

示例8: logout

 /**
  * @param boolean
  */
 public function logout($destroySession = true)
 {
     parent::logout($destroySession);
 }
开发者ID:jasonhai,项目名称:onehome,代码行数:7,代码来源:WebUser.php


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