aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2016-09-24 10:02:41 +0200
committerMarc Alexander <admin@m-a-styles.de>2016-09-24 10:02:41 +0200
commit931582aad9c041ebc9ae51d9a2664b4944a31be8 (patch)
tree88bd304e4390d2ce13ba23eeb64a1b6aafd6cf9e /phpBB/phpbb
parent3910387ee54c81ed0af9518b15d4c0672a7a21ba (diff)
parentabb01946bd9195648c84c6e6b24854a0214a0caf (diff)
downloadforums-931582aad9c041ebc9ae51d9a2664b4944a31be8.tar
forums-931582aad9c041ebc9ae51d9a2664b4944a31be8.tar.gz
forums-931582aad9c041ebc9ae51d9a2664b4944a31be8.tar.bz2
forums-931582aad9c041ebc9ae51d9a2664b4944a31be8.tar.xz
forums-931582aad9c041ebc9ae51d9a2664b4944a31be8.zip
Merge pull request #4432 from Senky/ticket/14762
[ticket/14762] Add core event to session.php
Diffstat (limited to 'phpBB/phpbb')
-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';