aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/session.php
diff options
context:
space:
mode:
authorJakub Senko <jakubsenko@gmail.com>2016-09-02 09:42:38 +0200
committerJakub Senko <jakubsenko@gmail.com>2016-09-18 13:32:10 +0200
commitabb01946bd9195648c84c6e6b24854a0214a0caf (patch)
tree781d4328a7800a29fadfb244dea2bee1c2fafe25 /phpBB/phpbb/session.php
parentf008708d5cebfea7ef6efef4c876e99f819bff71 (diff)
downloadforums-abb01946bd9195648c84c6e6b24854a0214a0caf.tar
forums-abb01946bd9195648c84c6e6b24854a0214a0caf.tar.gz
forums-abb01946bd9195648c84c6e6b24854a0214a0caf.tar.bz2
forums-abb01946bd9195648c84c6e6b24854a0214a0caf.tar.xz
forums-abb01946bd9195648c84c6e6b24854a0214a0caf.zip
[ticket/14762] Add core event to session.php
PHPBB3-14762
Diffstat (limited to 'phpBB/phpbb/session.php')
-rw-r--r--phpBB/phpbb/session.php18
1 files changed, 14 insertions, 4 deletions
diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php
index 33d8df9cb8..eb5543b50b 100644
--- a/phpBB/phpbb/session.php
+++ b/phpBB/phpbb/session.php
@@ -219,7 +219,7 @@ class session
function session_begin($update_session_page = true)
{
global $phpEx, $SID, $_SID, $_EXTRA_URL, $db, $config, $phpbb_root_path;
- global $request, $phpbb_container;
+ global $request, $phpbb_container, $phpbb_dispatcher;
// Give us some basic information
$this->time_now = time();
@@ -281,11 +281,21 @@ class session
// Why no forwarded_for et al? Well, too easily spoofed. With the results of my recent requests
// it's pretty clear that in the majority of cases you'll at least be left with a proxy/cache ip.
- $this->ip = htmlspecialchars_decode($request->server('REMOTE_ADDR'));
- $this->ip = preg_replace('# {2,}#', ' ', str_replace(',', ' ', $this->ip));
+ $ip = htmlspecialchars_decode($request->server('REMOTE_ADDR'));
+ $ip = preg_replace('# {2,}#', ' ', str_replace(',', ' ', $ip));
+
+ /**
+ * Event to alter user IP address
+ *
+ * @event core.session_ip_after
+ * @var string ip REMOTE_ADDR
+ * @since 3.1.10-RC1
+ */
+ $vars = array('ip');
+ extract($phpbb_dispatcher->trigger_event('core.session_ip_after', compact($vars)));
// split the list of IPs
- $ips = explode(' ', trim($this->ip));
+ $ips = explode(' ', trim($ip));
// Default IP if REMOTE_ADDR is invalid
$this->ip = '127.0.0.1';