src/User.php
public function setCurrent($userid)
	{
		$this->debug->groupCollapsed(__METHOD__, $userid);
		Session::start();
		$user = $this->get($userid);
		// initialize session array
		ArrayUtil::path($_SESSION, $this->cfg['sessionPath'], array());
		// create link to session array
		// $this->user = &ArrayUtil::path($_SESSION, $this->cfg['sessionPath']);
        $path = $this->cfg['sessionPath'];
        if (!\is_array($path)) {
            $path = \array_filter(\preg_split('#[\./]#', $path), 'strlen');
        }
        $this->user =& $_SESSION;
        foreach ($path as $k) {
        	if (!isset($this->user[$k])) {
        		$this->user[$k] = array();
        	}
        	$this->user =& $this->user[$k];
        }
		// load session array
		$this->user = $user;
		$this->user['_ts_cur'] = time();
		$this->userid = $this->user['userid'];
		$this->update(array('lastactivity'=>'NOW()'));
		$this->debug->groupEnd();
		return;
	}
public function setCurrent($userid)
	{
		$this->debug->groupCollapsed(__METHOD__, $userid);
		Session::start();
		$user = $this->get($userid);
		// initialize session array
		ArrayUtil::path($_SESSION, $this->cfg['sessionPath'], array());
		// create link to session array
		// $this->user = &ArrayUtil::path($_SESSION, $this->cfg['sessionPath']);
        $path = $this->cfg['sessionPath'];
        if (!\is_array($path)) {
            $path = \array_filter(\preg_split('#[\./]#', $path), 'strlen');
        }
        $this->user =& $_SESSION;
        foreach ($path as $k) {
        	if (!isset($this->user[$k])) {
        		$this->user[$k] = array();
        	}
        	$this->user =& $this->user[$k];
        }
		// load session array
		$this->user = $user;
		$this->user['_ts_cur'] = time();
		$this->userid = $this->user['userid'];
		$this->update(array('lastactivity'=>'NOW()'));
		$this->debug->groupEnd();
		return;
	}
public function setCurrent ( $ userid ) { $ this -> debug -> groupCollapsed ( __METHOD__ , $ userid ) ; Session :: start ( ) ; $ user = $ this -> get ( $ userid ) ; // initialize session array ArrayUtil :: path ( $ _SESSION , $ this -> cfg [ 'sessionPath' ] , array ( ) ) ; // create link to session array // $this->user = &ArrayUtil::path($_SESSION, $this->cfg['sessionPath']); $ path = $ this -> cfg [ 'sessionPath' ] ; if ( ! \ is_array ( $ path ) ) { $ path = \ array_filter ( \ preg_split ( '#[\./]#' , $ path ) , 'strlen' ) ; } $ this -> user = & $ _SESSION ; foreach ( $ path as $ k ) { if ( ! isset ( $ this -> user [ $ k ] ) ) { $ this -> user [ $ k ] = array ( ) ; } $ this -> user = & $ this -> user [ $ k ] ; } // load session array $ this -> user = $ user ; $ this -> user [ '_ts_cur' ] = time ( ) ; $ this -> userid = $ this -> user [ 'userid' ] ; $ this -> update ( array ( 'lastactivity' => 'NOW()' ) ) ; $ this -> debug -> groupEnd ( ) ; return ; }
Set current user by userid

@param integer $userid userid

@return void
Set current user by userid