/**
  * Register the service provider.
  *
  * @return  void
  */
 public function register()
 {
     $this->app['session'] = function ($app) {
         $handler = $app['config']->get('session_handler', 'none');
         $options = array('name' => md5($app['config']->get('secret') . 'site'), 'cookie_domain' => $app['config']->get('cookie_domain', ''), 'cookie_path' => $app['config']->get('cookie_path', '/'), 'expire' => $app['config']->get('lifetime') ? $app['config']->get('lifetime') * 60 : 900);
         // If profiling or debugging is turned on...
         /*if ($app['config']->get('profile') || $app['config']->get('debug'))
         		{
         			// If we have a profiler and the client is Admin or Site...
         			if ($app->has('profiler') && in_array($app['client']->id, array(0, 1)))
         			{
         				$options['profiler'] = $app['profiler'];
         			}
         		}*/
         // Skip session writes on the API and command line calls
         if ($app['client']->id == 4 || php_sapi_name() == 'cli') {
             $options['skipWrites'] = true;
         }
         $session = new Manager($handler, $options);
         if ($session->getState() == 'expired') {
             $session->restart();
         }
         return $session;
     };
 }
 /**
  * Register the service provider.
  *
  * @return  void
  */
 public function register()
 {
     $this->app['session'] = function ($app) {
         $handler = $app['config']->get('session_handler', 'none');
         $options = array('skipWrites' => true, 'name' => md5($app['config']->get('secret') . 'site'), 'cookie_domain' => $app['config']->get('cookie_domain', ''), 'cookie_path' => $app['config']->get('cookie_path', '/'), 'expire' => $app['config']->get('lifetime') ? $app['config']->get('lifetime') * 60 : 900);
         $session = new Manager($handler, $options);
         if ($session->getState() == 'expired') {
             $session->restart();
         }
         return $session;
     };
 }
 /**
  * Register the service provider.
  *
  * @return  void
  */
 public function register()
 {
     $this->app['session'] = function ($app) {
         $handler = $app['config']->get('session_handler', 'none');
         $options = array('name' => md5($app['config']->get('secret') . 'site'), 'cookie_domain' => $app['config']->get('cookie_domain', ''), 'cookie_path' => $app['config']->get('cookie_path', '/'), 'expire' => $app['config']->get('lifetime') ? $app['config']->get('lifetime') * 60 : 900);
         if ($app['config']->get('force_ssl') == 2) {
             $options['force_ssl'] = true;
         }
         // If profiling or debugging is turned on...
         if ($app['config']->get('profile') || $app['config']->get('debug')) {
             // If we have a profiler and the client is Admin or Site...
             if ($app->has('profiler')) {
                 $options['profiler'] = $app['profiler'];
             }
         }
         $session = new Manager($handler, $options);
         if ($session->getState() == 'expired') {
             $session->restart();
         }
         return $session;
     };
 }
 /**
  * Register the service provider.
  *
  * @return  void
  */
 public function register()
 {
     $this->app['session'] = function ($app) {
         $handler = $app['config']->get('session_handler', 'none');
         $options = array('name' => md5($app['config']->get('secret') . ($app['client']->name == 'administrator' ? 'administrator' : 'site')), 'cookie_domain' => $app['config']->get('cookie_domain', ''), 'cookie_path' => $app['config']->get('cookie_path', '/'), 'expire' => $app['config']->get('lifetime') ? $app['config']->get('lifetime') * 60 : 900);
         switch ($app['client']->id) {
             case 0:
                 if ($app['config']->get('force_ssl') == 2) {
                     $options['force_ssl'] = true;
                 }
                 break;
             case 1:
                 if ($app['config']->get('force_ssl') >= 1) {
                     $options['force_ssl'] = true;
                 }
                 break;
         }
         $session = new Manager($handler, $options);
         if ($session->getState() == 'expired') {
             $session->restart();
         }
         return $session;
     };
 }