diff options
author | Marc Alexander <admin@m-a-styles.de> | 2015-07-17 13:35:34 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2015-07-17 13:35:34 +0200 |
commit | 12f85a6a89fc15011a17060b1bc0aa1098a246c6 (patch) | |
tree | 6e32d4ba10da0a0740bc8885d194e8afad7cdb5e /phpBB/phpbb/session.php | |
parent | 29a15710d602ebe34b85037471da6efe4700ae56 (diff) | |
parent | 100fd39c5eb8dd0ad1c1218c423b13ef6a519857 (diff) | |
download | forums-12f85a6a89fc15011a17060b1bc0aa1098a246c6.tar forums-12f85a6a89fc15011a17060b1bc0aa1098a246c6.tar.gz forums-12f85a6a89fc15011a17060b1bc0aa1098a246c6.tar.bz2 forums-12f85a6a89fc15011a17060b1bc0aa1098a246c6.tar.xz forums-12f85a6a89fc15011a17060b1bc0aa1098a246c6.zip |
Merge branch '3.1.x'
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 6154f384f3..e06df191f5 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -527,7 +527,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(); @@ -902,6 +902,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; } @@ -915,13 +928,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 /* @var $provider_collection \phpbb\auth\provider_collection */ $provider_collection = $phpbb_container->get('auth.provider_collection'); @@ -990,7 +1020,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; @@ -1059,6 +1089,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; } @@ -1552,12 +1590,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))); } } |