Example #1
0
 /**
  * Initializes the session system.
  */
 private static function initialize()
 {
     // Make sure it's not initialized already
     if (self::$initialized) {
         return;
     }
     // See if we were given a session id explicitly
     // If so we also need a matching token to allow it
     $setSid = false;
     if (Input::exists('_sid')) {
         session_id(Input::get('_sid'));
         $setSid = true;
     }
     // Start the default PHP session
     self::$prefix = crc32(APP_SALT) . '_';
     session_name('session');
     session_start();
     // Set the initialized flag
     self::$initialized = true;
     // Make sure the token is good before we allow
     // explicit session id setting
     if ($setSid) {
         Auth::checkToken();
     }
 }
Example #2
0
 public static function setup($domain, $prefix, $host, $port, $ttl)
 {
     self::$domain = $domain;
     self::$prefix = $prefix;
     self::$console = Console::create('session');
     self::$ttl = $ttl;
     self::$mem = new Memcache();
     self::$mem->pconnect($host, $port);
     self::$console->log('Connecting:', $host . ':' . $port, '[ttl:' . $ttl . 's]');
 }
Example #3
0
 public function __construct()
 {
     self::$root = rtrim(dirname($_SERVER['SCRIPT_FILENAME']), DIRECTORY_SEPARATOR);
     self::$base = rtrim(dirname($_SERVER['SCRIPT_NAME']), DIRECTORY_SEPARATOR);
     spl_autoload_register(array('TwCensus', 'loader'));
     Session::init();
     Session::$prefix = 'TwCensus_';
     Db::connect(self::$config['db']);
     Request::init();
     if (Request::hasQuery('kml')) {
         $this->actionKML();
     } else {
         $this->actionWebsite();
     }
 }