/** * Constructor * * Sets all the session connection driver options. The available options * are: * - path string session storage path; * - extension string session file extension; * * @param AeArray $options */ public function __construct(AeArray $options = null) { if (isset($options['path']) && file_exists((string) $options['path'])) { $this->_storagePath = (string) $options['path']; } else { $this->_storagePath = getcwd() . SLASH . 'sessions'; } if (isset($options['extension'])) { $this->_extension = (string) $options['extension']; } else { $this->_extension = 'sess'; } parent::__construct($options); }
/** * Constructor * * Database storage driver accepts the following options: * - table string the table name to be used as the storage table for * sessions. The target table should meet several simple * requirements, which are described in the {@link * AeSession_Driver_Database class documentation}; * - connection array connection options array. See below for detailed * description. * * To use this session handler, you must provide sufficient data to * establish a database connection. There are several sets of data, any of * which is sufficient: * - name, settings: parameters to be passed to {@link * AeDatabase::getConnection()} method. See the method * documentation for more details; * - driver, username, password, options: parameters to be passed to {@link * AeDatabase::getInstance()} method. * See the method documentation for * more details; * - callback: an instance of the {@link AeCallback} class, specifying which * method should be called to get the active database connection. * The return value of the method must be an implementation of * the {@link AeInterface_Database} class; * - connection: an instance of the {@link AeInterface_Database} object. * * @param AeArray $options */ public function __construct(AeArray $options = null) { if (isset($options['table'])) { $this->_storageTable = (string) $options['table']; } else { $this->_storageTable = '#__session'; } if (isset($options['connection'])) { if ($options['connection'] instanceof AeInterface_Database) { $this->_connection = $options['connection']; } else { $this->_options = $options['connection']; } } parent::__construct($options); }
/** * Constructor * * Initializes the session. Any sessions, already started, will be * immediately destroyed. * * The following options can be set by the <var>$options</var> parameter: * - name string Session cookie name to use for session identification; * - id string Session cookie contents. You are advised to not set * this manually, as an id is generated by PHP by default; * - lifetime int Session lifetime in secods; * - expire bool Should session cookie expire on browser close; if * false, session cookie will expire in a preset number * of seconds. Note, that session cookie is not renewed, * so a user will have to relogin unless you renew the * cookie manually. Default: false * - validate array Session validation options: * - address bool Validation of user's remote address (IP); * - agent bool Validation of user's user-agen (browser); * - path string Session cookie path. Defaults to /. If the similar * option is set via {@link AeCookie::setPath()}, that * value is used as default instead; * - domain string Session cookie domain. Defaults to current domain. If * the similar option is set via {@link * AeCookie::setDomain()}, that value is used as default * instead; * - secure bool If is true, the session cookie is only set using the * secure connection (https). If the similar option is * set via {@link AeCookie::setPath()}, that value is * used as default instead; * - http bool If is true, the session cookie is set in the httponly * mode. See {@link http://php.net/setcookie setcookie()} * for more details. Requires PHP 5.2.0. If the similar * option is set via {@link AeCookie::setHttp()}, that * value is used as default instead; * * Also, a 'driver' subarray of the options array will be passed as options * to the session storage driver. See storage driver options on the driver's * class documentation page. * * @todo add cookie renewal setting * * @param string $driver session storage driver name * @param AeArray $options session options */ public function __construct($driver = null, AeArray $options = null) { // *** Destroy any existing sessions if (session_id()) { session_unset(); session_destroy(); } // *** Set default sessions save handler ini_set('session.save_handler', 'files'); // *** Disable transparent sid support ini_set('session.use_trans_sid', '0'); if (!isset($options['driver'])) { $options['driver'] = array(); } // *** Create connection $this->_connection = AeSession_Driver::getInstance($driver, $options['driver']); $this->_setOptions($options); }