diff options
Diffstat (limited to 'phpBB/phpbb/session.php')
| -rw-r--r-- | phpBB/phpbb/session.php | 58 | 
1 files changed, 54 insertions, 4 deletions
diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index bedd581725..a5c8f264e0 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -519,7 +519,7 @@ class session  	*/  	function session_create($user_id = false, $set_admin = false, $persist_login = false, $viewonline = true)  	{ -		global $SID, $_SID, $db, $config, $cache, $phpbb_root_path, $phpEx, $phpbb_container; +		global $SID, $_SID, $db, $config, $cache, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_dispatcher;  		$this->data = array(); @@ -893,6 +893,19 @@ class session  			$_SID = '';  		} +		$session_data = $sql_ary; +		/** +		* Event to send new session data to extension +		* Read-only event +		* +		* @event core.session_create_after +		* @var	array		session_data				Associative array of session keys to be updated +		* @since 3.1.6-RC1 +		*/ +		$vars = array('session_data'); +		extract($phpbb_dispatcher->trigger_event('core.session_create_after', compact($vars))); +		unset($session_data); +  		return true;  	} @@ -906,13 +919,30 @@ class session  	*/  	function session_kill($new_session = true)  	{ -		global $SID, $_SID, $db, $config, $phpbb_root_path, $phpEx, $phpbb_container; +		global $SID, $_SID, $db, $config, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_dispatcher;  		$sql = 'DELETE FROM ' . SESSIONS_TABLE . "  			WHERE session_id = '" . $db->sql_escape($this->session_id) . "'  				AND session_user_id = " . (int) $this->data['user_id'];  		$db->sql_query($sql); +		$user_id = (int) $this->data['user_id']; +		$session_id = $this->session_id; +		/** +		* Event to send session kill information to extension +		* Read-only event +		* +		* @event core.session_kill_after +		* @var	int		user_id				user_id of the session user. +		* @var	string		session_id				current user's session_id +		* @var	bool	new_session 	should we create new session for user +		* @since 3.1.6-RC1 +		*/ +		$vars = array('user_id', 'session_id', 'new_session'); +		extract($phpbb_dispatcher->trigger_event('core.session_kill_after', compact($vars))); +		unset($user_id); +		unset($session_id); +  		// Allow connecting logout with external auth method logout  		$provider_collection = $phpbb_container->get('auth.provider_collection');  		$provider = $provider_collection->get_provider(); @@ -980,7 +1010,7 @@ class session  	*/  	function session_gc()  	{ -		global $db, $config, $phpbb_root_path, $phpEx, $phpbb_container; +		global $db, $config, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_dispatcher;  		$batch_size = 10; @@ -1048,6 +1078,14 @@ class session  			$db->sql_query($sql);  		} +		/** +		* Event to trigger extension on session_gc +		* +		* @event core.session_gc_after +		* @since 3.1.6-RC1 +		*/ +		$phpbb_dispatcher->dispatch('core.session_gc_after'); +  		return;  	} @@ -1541,12 +1579,24 @@ class session  	*/  	public function update_session($session_data, $session_id = null)  	{ -		global $db; +		global $db, $phpbb_dispatcher;  		$session_id = ($session_id) ? $session_id : $this->session_id;  		$sql = 'UPDATE ' . SESSIONS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $session_data) . "  			WHERE session_id = '" . $db->sql_escape($session_id) . "'";  		$db->sql_query($sql); + +		/** +		* Event to send update session information to extension +		* Read-only event +		* +		* @event core.update_session_after +		* @var	array		session_data				Associative array of session keys to be updated +		* @var	string		session_id				current user's session_id +		* @since 3.1.6-RC1 +		*/ +		$vars = array('session_data', 'session_id'); +		extract($phpbb_dispatcher->trigger_event('core.update_session_after', compact($vars)));  	}  }  | 
