示例#1
0
 /**
  * Constructor
  *
  * @param   array  $options  Optional parameters.
  * @return  void
  */
 public function __construct($options = array())
 {
     if (!isset($options['database']) || !$options['database'] instanceof \JDatabase) {
         $options['database'] = \App::get('db');
     }
     $this->connection = $options['database'];
     parent::__construct($options);
 }
示例#2
0
 /**
  * Constructor
  *
  * @param   array  $options  Optional parameters
  * @return  void
  */
 public function __construct($options = array())
 {
     if (!self::isAvailable()) {
         throw new Exception(\Lang::txt('JLIB_SESSION_APC_EXTENSION_NOT_AVAILABLE'));
     }
     if (isset($options['prefix'])) {
         $this->prefix = $options['prefix'];
     }
     parent::__construct($options);
 }
示例#3
0
 /**
  * Constructor
  *
  * @param   array  $options  Optional parameters.
  * @return  void
  */
 public function __construct($options = array())
 {
     if (!isset($options['database']) || !$options['database'] instanceof \JDatabase) {
         $options['database'] = \App::get('db');
     }
     $this->connection = $options['database'];
     if (isset($options['profiler'])) {
         $this->profiler = $options['profiler'];
     }
     if (isset($options['skipWrites'])) {
         $this->skipWrites = (bool) $options['skipWrites'];
     }
     parent::__construct($options);
 }
示例#4
0
 /**
  * Constructor
  *
  * @param   array  $options  Optional parameters.
  * @return  void
  */
 public function __construct($options = array())
 {
     if (!isset($options['session_path'])) {
         $options['session_path'] = PATH_APP . DS . 'sessions';
     }
     if (!isset($options['filesystem']) || !$options['filesystem'] instanceof Filesystem) {
         $options['filesystem'] = new Filesystem();
     }
     $this->path = $this->cleanPath($options['session_path']);
     $this->files = $options['filesystem'];
     if (!is_dir($this->path) || !is_readable($this->path) || !is_writable($this->path)) {
         throw new Exception('Storage path should be directory with available read/write access.');
     }
     parent::__construct($options);
 }
示例#5
0
 /**
  * Constructor
  *
  * @param   array  $options  Optional parameters.
  * @return  void
  */
 public function __construct($options = array())
 {
     if (!self::isAvailable()) {
         throw new Exception(\Lang::txt('JLIB_SESSION_MEMCACHE_EXTENSION_NOT_AVAILABLE'));
     }
     if (isset($options['prefix'])) {
         $this->prefix = $options['prefix'];
     }
     parent::__construct($options);
     if (isset($options['compress']) && $options['compress']) {
         $this->compress = \Memcached::OPT_COMPRESSION;
     }
     if (!isset($options['servers']) || empty($options['servers'])) {
         $conf = new \Hubzero\Config\Repository('site');
         $options['servers'] = array(array('host' => $config->get('memcache_server_host', 'localhost'), 'port' => $config->get('memcache_server_port', 11211), 'weight' => $config->get('memcache_persist', true)));
     }
     $this->servers = $options['servers'];
 }
示例#6
0
 /**
  * Constructor
  *
  * @param   string  $store    The type of storage for the session.
  * @param   array   $options  Optional parameters
  */
 public function __construct($store = 'none', $options = array())
 {
     // Need to destroy any existing sessions started with session.auto_start
     if (session_id()) {
         session_unset();
         session_destroy();
     }
     // Set default sessios save handler
     ini_set('session.save_handler', 'files');
     // Disable transparent sid support
     ini_set('session.use_trans_sid', '0');
     if ($store == 'database') {
         if (ini_get('session.gc_probability') < 1) {
             ini_set('session.gc_probability', 1);
         }
         if (ini_get('session.gc_divisor') < 1) {
             ini_set('session.gc_divisor', 100);
         }
     }
     // Create handler
     $this->store = Store::getInstance($store, $options);
     // Set options
     $this->setOptions($options);
     // Pass session id in query string when cookie not available.
     // This is used, in particular, to allow QuickTime plugin in Safari on the Mac
     // to view private mp4. QuickTime does not pass the browser's cookies to the site
     if (!isset($_COOKIE[session_name()]) && isset($_GET['PHPSESSID'])) {
         if (strlen($_GET['PHPSESSID']) == 32 && ctype_alnum($_GET['PHPSESSID'])) {
             if ($this->store->read($_GET['PHPSESSID']) != '') {
                 session_id($_GET['PHPSESSID']);
             }
         }
     }
     $this->setCookieParams();
     // Load the session
     $this->start();
     // Initialise the session
     $this->setCounter();
     $this->setTimers();
     $this->state = 'active';
     // Perform security checks
     $this->validate();
 }