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


PHP JApplicationCms::getClientId方法代码示例

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


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

示例1: onUserLogout

 /**
  * This method should handle any logout logic and report back to the subject
  *
  * @param   array  $user     Holds the user data.
  * @param   array  $options  Array holding options (client, ...).
  *
  * @return  object  True on success
  *
  * @since   1.5
  */
 public function onUserLogout($user, $options = array())
 {
     $my = JFactory::getUser();
     $session = JFactory::getSession();
     // Make sure we're a valid user first
     if ($user['id'] == 0 && !$my->get('tmp_user')) {
         return true;
     }
     // Check to see if we're deleting the current session
     if ($my->get('id') == $user['id'] && $options['clientid'] == $this->app->getClientId()) {
         // Hit the user last visit field
         $my->setLastVisit();
         // Destroy the php session for this user
         $session->destroy();
     }
     // Enable / Disable Forcing logout all users with same userid
     $forceLogout = $this->params->get('forceLogout', 1);
     if ($forceLogout) {
         $query = $this->db->getQuery(true)->delete($this->db->quoteName('#__session'))->where($this->db->quoteName('userid') . ' = ' . (int) $user['id'])->where($this->db->quoteName('client_id') . ' = ' . (int) $options['clientid']);
         try {
             $this->db->setQuery($query)->execute();
         } catch (RuntimeException $e) {
             return false;
         }
     }
     // Delete "user state" cookie used for reverse caching proxies like Varnish, Nginx etc.
     $conf = JFactory::getConfig();
     $cookie_domain = $conf->get('cookie_domain', '');
     $cookie_path = $conf->get('cookie_path', '/');
     if ($this->app->isSite()) {
         $this->app->input->cookie->set("joomla_user_state", "", time() - 86400, $cookie_path, $cookie_domain, 0);
     }
     return true;
 }
开发者ID:ITPrism,项目名称:GamificationDistribution,代码行数:44,代码来源:joomla.php

示例2: onUserLogout

 /**
  * This method should handle any logout logic and report back to the subject
  *
  * @param   array  $user     Holds the user data.
  * @param   array  $options  Array holding options (client, ...).
  *
  * @return  object  True on success
  *
  * @since   1.5
  */
 public function onUserLogout($user, $options = array())
 {
     $my = JFactory::getUser();
     $session = JFactory::getSession();
     // Make sure we're a valid user first
     if ($user['id'] == 0 && !$my->get('tmp_user')) {
         return true;
     }
     // Check to see if we're deleting the current session
     if ($my->get('id') == $user['id'] && $options['clientid'] == $this->app->getClientId()) {
         // Hit the user last visit field
         $my->setLastVisit();
         // Destroy the php session for this user
         $session->destroy();
     }
     // Enable / Disable Forcing logout all users with same userid
     $forceLogout = $this->params->get('forceLogout', 1);
     if ($forceLogout) {
         $query = $this->db->getQuery(true)->delete($this->db->quoteName('#__session'))->where($this->db->quoteName('userid') . ' = ' . (int) $user['id'])->where($this->db->quoteName('client_id') . ' = ' . (int) $options['clientid']);
         try {
             $this->db->setQuery($query)->execute();
         } catch (RuntimeException $e) {
             return false;
         }
     }
     return true;
 }
开发者ID:brenot,项目名称:forumdesenvolvimento,代码行数:37,代码来源:joomla.php

示例3: onUserLogout

 /**
  * This method should handle any logout logic and report back to the subject
  *
  * @param   array  $user     Holds the user data.
  * @param   array  $options  Array holding options (client, ...).
  *
  * @return  object  True on success
  *
  * @since   1.5
  */
 public function onUserLogout($user, $options = array())
 {
     $my = JFactory::getUser();
     $session = JFactory::getSession();
     // Make sure we're a valid user first
     if ($user['id'] == 0 && !$my->get('tmp_user')) {
         return true;
     }
     // Check to see if we're deleting the current session
     if ($my->get('id') == $user['id'] && $options['clientid'] == $this->app->getClientId()) {
         // Hit the user last visit field
         $my->setLastVisit();
         // Destroy the php session for this user
         $session->destroy();
     }
     // Force logout all users with that userid
     $query = $this->db->getQuery(true)->delete($this->db->quoteName('#__session'))->where($this->db->quoteName('userid') . ' = ' . (int) $user['id'])->where($this->db->quoteName('client_id') . ' = ' . (int) $options['clientid']);
     $this->db->setQuery($query)->execute();
     return true;
 }
开发者ID:01J,项目名称:topm,代码行数:30,代码来源:joomla.php


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