/** * Registers session functions * * @param mixed $handler function or an array of class=>method * * @return null */ public static function registerSessionStartHandler($handler) { if (is_callable($handler)) { self::$_sessionStartHandler = $handler; } else { Nexista_Error::init('Session Start Handler is not callable!'); } }
/** * Init sessions * * This method starts up a session * and globalizes it. * * @return null */ function initSession() { // Prefix is needed for Mozilla as its the 0 position. $ua = '_' . $_SERVER['HTTP_USER_AGENT']; if ((strpos($ua, 'Mozilla') || strpos($ua, 'Opera') || strpos($ua, 'Elinks')) && (!strpos($ua, 'Google') && !strpos($ua, 'Yahoo') && !strpos($ua, 'bot'))) { $this->session = Nexista_Session::singleton('Nexista_Session'); $this->session->start(); } }
/** * Constructor - Inits session, config * */ public function __construct() { $this->session = Nexista_Session::singleton('Nexista_Session'); $this->session->start(); //user already identified? if (isset($_SESSION[$this->_sessionName])) { $this->sessionData =& $_SESSION[$this->_sessionName]; } else { //newbie - setup a new session $_SESSION[$this->_sessionName] = array(); $this->sessionData =& $_SESSION[$this->_sessionName]; $this->sessionData['status'] = self::NX_AUTH_STATUS_INACTIVE; } }
* @author Albert Lash <*****@*****.**> * @license http://www.gnu.org LGPL * @version SVN: 123 * @link http://www.nexista.org/ * */ /* Configuration: <nexista_session> <placement>prepend</placement> <source>&includepath;extensions/nexista_session.php</source> <handler>files</handler> </nexista_session> */ $handler = Nexista_Config::get('./extensions/nexista_session/handler'); if (1 == 2) { ini_set('session.save_handler', 'user'); include 'HTTP/Session2.php'; Nexista_Session::registerSessionStartHandler(array('HTTP_Session2', 'start')); } elseif (class_exists('Memcacxhe') && $handler == 'memcached') { ini_set('session.save_handler', 'memcache'); ini_set('session.save_path', 'tcp://192.168.3.3:11211?persistent=1&weight=2,tcp://memcached1.private.savonix.com:11211?persistent=1&weight=2&timeout=2&retry_interval=4,tcp://memcached2.private.savonix.com:11211?persistent=1&weight=2&timeout=2&retry_interval=4'); } else { ini_set('session.save_handler', 'files'); } /* Get this from config HTTP_Session2::setContainer('MDB2', array('dsn' => 'mysql://*****:*****@localhost/database', 'table' => 'sessiondata')); */