[ Index ]

PHP Cross Reference of vtigercrm-6.1.0

title

Body

[close]

/includes/http/ -> Session.php (source)

   1  <?php
   2  /*+**********************************************************************************
   3   * The contents of this file are subject to the vtiger CRM Public License Version 1.1
   4   * ("License"); You may not use this file except in compliance with the License
   5   * The Original Code is:  vtiger CRM Open Source
   6   * The Initial Developer of the Original Code is vtiger.
   7   * Portions created by vtiger are Copyright (C) vtiger.
   8   * All Rights Reserved.
   9   ************************************************************************************/
  10  
  11  // Import dependencies
  12  include_once  'libraries/HTTP_Session/Session.php';
  13  
  14  /**
  15   * Session class
  16   */
  17  class Vtiger_Session {
  18  
  19      /**
  20       * Constructor
  21       * Avoid creation of instances.
  22       */
  23  	private function __construct() {
  24      }
  25  
  26      /**
  27       * Destroy session
  28       */
  29  	static function destroy($sessionid = false) {
  30          HTTP_Session::destroy($sessionid);
  31      }
  32  
  33      /**
  34       * Initialize session
  35       */
  36  	static function init($sessionid = false) {
  37          if(empty($sessionid)) {
  38              HTTP_Session::start(null, null);
  39              $sessionid = HTTP_Session::id();
  40          } else {
  41              HTTP_Session::start(null, $sessionid);
  42          }
  43  
  44          if(HTTP_Session::isIdle() || HTTP_Session::isExpired()) {
  45              return false;
  46          }
  47          return $sessionid;
  48      }
  49  
  50      /**
  51       * Is key defined in session?
  52       */
  53  	static function has($key) {
  54          return HTTP_Session::is_set($key);
  55      }
  56  
  57      /**
  58       * Get value for the key.
  59       */
  60  	static function get($key, $defvalue = '') {
  61          return HTTP_Session::get($key, $defvalue);
  62      }
  63  
  64      /**
  65       * Set value for the key.
  66       */
  67  	static function set($key, $value) {
  68          HTTP_Session::set($key, $value);
  69      }
  70  
  71  }


Generated: Fri Nov 28 20:08:37 2014 Cross-referenced by PHPXref 0.7.1