예제 #1
0
파일: Native.php 프로젝트: fuelphp/session
 /**
  * @param array $config
  */
 public function __construct(array $config = [])
 {
     // make sure we've got all config elements for this driver
     $config['native'] = array_merge($this->defaults, isset($config['native']) ? $config['native'] : array());
     // call the parent to process the global config
     parent::__construct($config);
     // get default the cookie params
     $params = session_get_cookie_params();
     // update them with any config passed
     if (isset($config['cookie_domain'])) {
         $params['domain'] = $config['cookie_domain'];
     }
     if (isset($config['cookie_path'])) {
         $params['path'] = $config['cookie_path'];
     }
     if (isset($config['cookie_secure']) and $config['cookie_secure']) {
         $params['secure'] = true;
     }
     if (isset($config['cookie_http_only']) and $config['cookie_http_only']) {
         $params['httponly'] = true;
     }
     if (isset($config['expire_on_close']) and $config['expire_on_close']) {
         $params['lifetime'] = 0;
     }
     session_set_cookie_params($this->expiration, $params['path'], $params['domain'], $params['secure'], $params['httponly']);
     // store the defined name
     if (isset($config['native']['cookie_name'])) {
         $this->name = $config['native']['cookie_name'];
     }
 }
예제 #2
0
파일: Cookie.php 프로젝트: fuelphp/session
 /**
  * @param array $config
  */
 public function __construct(array $config = [])
 {
     // make sure we've got all config elements for this driver
     $config['cookie'] = array_merge($this->defaults, isset($config['cookie']) ? $config['cookie'] : array());
     // call the parent to process the global config
     parent::__construct($config);
     // store the defined name
     if (isset($config['cookie']['cookie_name'])) {
         $this->name = $config['cookie']['cookie_name'];
     }
 }
예제 #3
0
파일: File.php 프로젝트: fuelphp/session
 /**
  * @param array $config
  */
 public function __construct(array $config = [])
 {
     // make sure we've got all config elements for this driver
     $config['file'] = array_merge($this->defaults, isset($config['file']) ? $config['file'] : []);
     // validate the path
     if (!($path = realpath($config['file']['path']))) {
         throw new \Exception('Configured session storage directory\\ "' . $this->config['file']['path'] . " is not accessable.");
     }
     $config['file']['path'] = $path . DIRECTORY_SEPARATOR;
     // call the parent to process the global config
     parent::__construct($config);
     // store the defined name
     if (isset($config['file']['cookie_name'])) {
         $this->name = $config['file']['cookie_name'];
     }
 }