Esempio n. 1
0
 public function __construct(array $config = NULL, $id = NULL)
 {
     if (!isset($config['group'])) {
         // Use the default group
         $config['group'] = 'default';
     }
     // Load the database
     $this->_db = Database::instance($config['group']);
     if (isset($config['table'])) {
         // Set the table name
         $this->_table = (string) $config['table'];
     }
     if (isset($config['gc'])) {
         // Set the gc chance
         $this->_gc = (int) $config['gc'];
     }
     if (isset($config['columns'])) {
         // Overload column names
         $this->_columns = $config['columns'];
     }
     parent::__construct($config, $id);
     if (mt_rand(0, $this->_gc) === $this->_gc) {
         // Run garbage collection
         // This will average out to run once every X requests
         $this->_gc();
     }
 }
Esempio n. 2
0
 /**
  * Construct the parent object and
  * set the authenticated user ID
  * @param \Dropbox\OAuth\Storage\Encrypter $encrypter
  * @param int $userID
  * @throws \Dropbox\Exception
  */
 public function __construct(Encrypter $encrypter = null, $userID)
 {
     // Construct the parent object so we can access the SESSION
     // instead of reading the file on every request
     parent::__construct($encrypter);
     // Set the authenticated user ID
     $this->userID = $userID;
 }
Esempio n. 3
0
 /**
  * @ignore
  */
 protected function __construct()
 {
     parent::__construct();
     session_name($this->config['session']['name']);
     session_set_cookie_params($this->config['session']['timeout'], '/', '', $this->config['session']['secure'], $this->config['session']['http_only']);
     $this->create();
     $this->preventHijack();
 }
 public function __construct($userModel = null)
 {
     if ($userModel === null) {
         $userModel = UserModel::getInstance();
     }
     $this->userModel = $userModel;
     parent::__construct();
 }
Esempio n. 5
0
 /**
  * Construct the parent object and
  * set the authenticated user ID
  * @param \Dropbox\OAuth\Storage\Encrypter $encrypter
  * @param int $userID
  * @throws \Dropbox\Exception
  */
 public function __construct(Encrypter $encrypter = null, $userID)
 {
     // Throw an Exception if PDO is not loaded
     if (!extension_loaded('PDO')) {
         throw new \Dropbox\Exception('This storage handler requires the PDO extension');
     }
     // Construct the parent object so we can access the SESSION
     // instead of querying the database on every request
     parent::__construct($encrypter, $userID);
 }
Esempio n. 6
0
 public function __construct(array $config = NULL, $id = NULL)
 {
     if (!isset($config['group'])) {
         // Use the default group
         $config['group'] = RedisLibrary::$default;
     }
     // Load the database
     $this->_rd = RedisLibrary::instance($config['group']);
     parent::__construct($config, $id);
 }
Esempio n. 7
0
 /**
  *
  * @param array $config
  * @param string $id
  */
 public function __construct(array $config = NULL, $id = NULL)
 {
     // Check for the Rediska module
     if (!class_exists('Rediska')) {
         throw new Kohana_Exception('Rediska module not loaded');
     }
     $instance = Arr::get($config, 'instance', Rediska::DEFAULT_NAME);
     $this->_cookie_name = Arr::get($config, 'cookie_name', $this->_cookie_name);
     $this->_rediska = Rediska_Manager::get($instance);
     parent::__construct($config, $id);
 }
Esempio n. 8
0
 /**
  * Constructor
  */
 public function __construct(array $config = NULL, $id = NULL)
 {
     // Load aditional config
     if (isset($config['gc'])) {
         $this->_gc = (int) $config['gc'];
     }
     parent::__construct($config, $id);
     if (mt_rand(0, $this->_gc) === $this->_gc) {
         // Collect
         $this->_gc();
     }
 }
Esempio n. 9
0
 /**
  * Loads database-specific configuration data.
  *
  * @param   array   configuration
  * @return  void
  */
 public function __construct(array $config = NULL)
 {
     if (!isset($config['group'])) {
         throw new Kohana_Exception('You must define the :name parameter in your session configuration', array(':name' => 'group'));
     }
     // Load the database
     $this->_db = Database::instance($config['group']);
     if (isset($config['table'])) {
         // Set the table name
         $this->_table = (string) $config['table'];
     }
     parent::__construct($config);
 }
Esempio n. 10
0
 public function __construct(array $config = NULL)
 {
     if (!isset($config['group'])) {
         // Use the default group
         $config['group'] = 'default';
     }
     // Load the database
     $this->_db = Database::instance($config['group']);
     if (isset($config['table'])) {
         // Set the table name
         $this->_table = (string) $config['table'];
     }
     parent::__construct($config);
 }
Esempio n. 11
0
 /**
  * Construct the parent object and
  * set the authenticated user ID
  * @param \Dropbox\OAuth\Storage\Encrypter $encrypter
  * @param int $userID
  * @throws \Dropbox\Exception
  */
 public function __construct(Encrypter $encrypter = null, $userID)
 {
     // Create the folder if needed, throw an Exception if not possible
     if (!is_dir($this->sessionsFolder)) {
         if (!mkdir($this->sessionsFolder)) {
             throw new \Dropbox\Exception('Could not create a folder to store sessions.');
         }
     }
     // Construct the parent object so we can access the SESSION
     // instead of reading the file on every request
     parent::__construct($encrypter);
     // Set the authenticated user ID
     $this->userID = $userID;
     $this->userFilename = $this->sessionsFolder . '/' . $this->userID;
 }
 public function __construct($options = array())
 {
     // call parent and apply additional default options
     parent::__construct(array_merge(array('Authenticator' => self::$DefaultAuthenticator, 'RequireAuthentication' => self::$DefaultRequireAuthentication, 'PersonClass' => Person::$StandardClass), $options));
     // initialize authenticator
     $this->_authenticator = new $this->_options['Authenticator']($this);
     // check authentication
     $this->_authenticator->checkAuthentication();
     // require authentication ?
     if ($this->_options['RequireAuthentication']) {
         if (!$this->_authenticator->requireAuthentication($this->_options)) {
             throw new AuthenticationFailedException();
         }
     }
 }
 public function __construct($record = array())
 {
     parent::__construct($record);
     if (!isset($this->authenticator)) {
         $this->authenticator = new static::$defaultAuthenticator($this);
     }
     // check authentication
     $this->authenticator->checkAuthentication();
     // require authentication ?
     if (static::$requireAuthentication) {
         if (!$this->requireAuthentication()) {
             throw new AuthenticationFailedException();
         }
     }
     // export data to _SESSION superglobal
     $_SESSION['User'] = $this->Person ? $this->Person : false;
 }
Esempio n. 14
0
 function __construct()
 {
     parent::__construct();
     $this->_srp = new SRP_SHA1_256();
     if ($this->getState() == (SrpSession::INITIALIZED or SrpSession::READY)) {
         try {
             $this->_shex = $this->getValue('SRP_shex');
             $this->_Ahex = $this->getValue('SRP_Ahex');
             $this->_Bhex = $this->getValue('SRP_Bhex');
             $this->_Khex = $this->getValue('SRP_Khex');
             $this->_username = $this->getValue('SRP_I');
             $this->_userid = $this->getValue('userid');
             $this->_setState(SrpSession::READY);
         } catch (InvalidArgumentException $e) {
             $this->_setState(SrpSession::NOT_INITIALIZED);
         }
     }
 }
Esempio n. 15
0
 /**
  * @ignore
  */
 public function __construct()
 {
     parent::__construct();
     session_name($this->config['session']['name']);
     $this->session = false;
     $this->mem = memcache_connect('localhost', 11211);
     if (isset($_COOKIE['sessid'])) {
         $this->session_id = $_COOKIE['sessid'];
         $this->session = memcache_get($this->mem, 'sess_' . $this->session_id);
     }
     if ($this->session == false) {
         $this->create();
     } else {
         $this->session = unserialize($this->session);
         if (!is_array($this->session)) {
             $this->session = array();
         }
     }
 }
Esempio n. 16
0
 /**
  * @ignore
  */
 protected function __construct()
 {
     parent::__construct();
     session_name($this->config['session']['name']);
     $this->session_model = new SessionModel();
     $this->session_model->clearOld($this->config['session']['timeout']);
     $this->session = false;
     if (isset($_COOKIE[session_name()])) {
         $this->session_id = $_COOKIE[session_name()];
         $this->session = $this->session_model->getSession($this->session_id);
     }
     if (!$this->session) {
         $this->create();
     } else {
         $this->session = unserialize($this->session);
         if (!is_array($this->session)) {
             $this->session = array();
             echo 'bad session';
         }
     }
 }
Esempio n. 17
0
 /**
  * Class constructor
  *
  * @param  array   $config  Configuration [Optional]
  * @param  string  $id      Session id [Optional]
  */
 public function __construct(array $config = NULL, $id = NULL)
 {
     // Check that the PhpRedis extension is loaded.
     if (!extension_loaded('redis')) {
         throw new Gleez_Exception('You must have PhpRedis installed and enabled to use.');
     }
     if (isset($config['host'])) {
         $this->_host = $config['host'];
     }
     if (isset($config['port'])) {
         $this->_port = (int) $config['port'];
     }
     if (isset($config['prefix'])) {
         $this->_prefix = $config['prefix'];
     }
     try {
         // Create a new Redis instance and start a connection using the settings provided.
         $this->_redis = new Redis();
         $this->_redis->connect($this->_host, $this->_port);
     } catch (Exception $e) {
         Log::error('An error occurred connecting Redis Session: [:error]', [':error' => $e->getMessage()]);
     }
     parent::__construct($config, $id);
 }
Esempio n. 18
0
 /**
  * Construct the parent object and
  * set the authenticated user ID
  * @param \Dropbox\OAuth\Storage\Encrypter $encrypter
  * @param int $userID
  * @throws \Dropbox\Exception
  */
 public function __construct(Encrypter $encrypter = null, $userID)
 {
     // Construct the parent object so we can access the SESSION
     // instead of reading the file on every request
     parent::__construct($encrypter, $userID);
 }
Esempio n. 19
0
 /**
  * Class constructor
  *
  * List of available options for `$config` array:
  *
  * * `group`:       Mango config group name
  * * `collection`:  The name of the collection
  * * `gc`:          Number of requests before gc is invoked
  * * `fields`:      Custom field names, array of:
  *   * `session_id`:   Session identifier
  *   * `last_active`:  Timestamp of the last activity
  *   * `contents`:     Serialized session data
  *   * `hostname`:     Host name
  *   * `user_id`:      The used ID
  *
  * [!!] Note: Sessions can only be created using the [Session::instance] method.
  *
  * @param  array   $config  Configuration array [Optional]
  * @param  string  $id      Session id [Optional]
  */
 public function __construct(array $config = NULL, $id = NULL)
 {
     if (!isset($config['group'])) {
         // Use the default group
         $config['group'] = Client::$default;
     }
     // Create Mango instance
     $this->_db = Client::instance($config['group']);
     if (isset($config['collection'])) {
         // Save the collection name for later use
         $this->_collection = (string) $config['collection'];
     }
     if (isset($config['gc'])) {
         // Set the gc chance
         $this->_gc = (int) $config['gc'];
     }
     if (isset($config['columns'])) {
         // Overload column names
         $this->_columns = $config['columns'];
     }
     // Load the collection
     $this->_collection = $this->_db->selectCollection($this->_collection);
     parent::__construct($config, $id);
     if (mt_rand(0, $this->_gc) === $this->_gc) {
         // Run garbage collection
         // This will average out to run once every X requests
         $this->_gc();
     }
 }
Esempio n. 20
0
 public function __construct()
 {
     parent::__construct("user");
 }
Esempio n. 21
0
 /**
  * Constructor.
  *
  * @param object $session     Current session object.
  * @param string $appId       App fb id.
  * @param string $secret      App fb secret.
  * @param bool   $fileUpload  Can files be uplaoded in app.
  * @param string $scope       Extended permissions list.
  * @param string $redirectUri Redirect uri used for autorization.
  */
 public function __construct($session, $appId, $secret, $fileUpload, $scope, $redirectUri)
 {
     $this->setScope($scope);
     $this->setRedirectUri($redirectUri);
     return parent::__construct(array('appId' => $appId, 'secret' => $secret, 'fileUpload' => $fileUpload), $session);
 }
 public function __construct($useCookie)
 {
     parent::__construct($useCookie);
 }
Esempio n. 23
0
 /**
  * Manipulate a namespace.
  * If session has not been previously started, it will be done
  * automatically.
  *
  * @param   string  $namespace      Namespace.
  * @return  void
  */
 public function __construct($namespace = '_defaultFlash')
 {
     parent::__construct($namespace, parent::NO_CACHE);
     return;
 }
Esempio n. 24
0
 public function __construct()
 {
     parent::__construct(FALSE);
     // don't use cookies
 }
Esempio n. 25
0
 /**
  * This constructor initializes the class using the specified config
  * information and/or session id.
  *
  * @access public
  * @override
  * @param mixed $config                     the config information to be used
  * @param string $id                        the session id
  */
 public function __construct(array $config = NULL, $id = NULL)
 {
     // Set the table name
     if (isset($config['table'])) {
         $this->_table = (string) $config['table'];
     }
     // Set the gc chance
     if (isset($config['gc'])) {
         $this->_gc = (int) $config['gc'];
     }
     // Overload column names
     if (isset($config['columns'])) {
         $this->_columns = $config['columns'];
     }
     parent::__construct($config, $id);
     // Run garbage collection
     // This will average out to run once every X requests
     if (mt_rand(0, $this->_gc) === $this->_gc) {
         $this->_gc();
     }
 }
Esempio n. 26
0
 function __construct()
 {
     parent::__construct();
 }
Esempio n. 27
0
 public function __construct()
 {
     parent::__construct(
             FCore::$SESSION_CHECK_FINGERPRINT,
             FCore::$SESSION_CHECK_HIJACK);
 }