aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/session.php
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2017-06-25 17:27:47 +0200
committerMarc Alexander <admin@m-a-styles.de>2017-06-25 17:27:47 +0200
commit4f81c94a95b0ccaff2886980e4af458d92922a01 (patch)
treec7f0605a41ceb57f9b3b6c899f1ba7eb7232d8b5 /phpBB/phpbb/session.php
parent68346e7dfb279f63493706cf66c83d4e6ce01b99 (diff)
parent71f9c6ebe53648b4d9883e725bde3d836de8303d (diff)
downloadforums-4f81c94a95b0ccaff2886980e4af458d92922a01.tar
forums-4f81c94a95b0ccaff2886980e4af458d92922a01.tar.gz
forums-4f81c94a95b0ccaff2886980e4af458d92922a01.tar.bz2
forums-4f81c94a95b0ccaff2886980e4af458d92922a01.tar.xz
forums-4f81c94a95b0ccaff2886980e4af458d92922a01.zip
Merge branch '3.1.x' into 3.2.x
Diffstat (limited to 'phpBB/phpbb/session.php')
-rw-r--r--phpBB/phpbb/session.php47
1 files changed, 30 insertions, 17 deletions
diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php
index cc200b1adc..c5b50c2b07 100644
--- a/phpBB/phpbb/session.php
+++ b/phpBB/phpbb/session.php
@@ -461,6 +461,9 @@ class session
$this->data['is_bot'] = (!$this->data['is_registered'] && $this->data['user_id'] != ANONYMOUS) ? true : false;
$this->data['user_lang'] = basename($this->data['user_lang']);
+ // Is user banned? Are they excluded? Won't return on ban, exists within method
+ $this->check_ban_for_current_session($config);
+
return true;
}
}
@@ -675,19 +678,7 @@ class session
// session exists in which case session_id will also be set
// Is user banned? Are they excluded? Won't return on ban, exists within method
- if ($this->data['user_type'] != USER_FOUNDER)
- {
- if (!$config['forwarded_for_check'])
- {
- $this->check_ban($this->data['user_id'], $this->ip);
- }
- else
- {
- $ips = explode(' ', $this->forwarded_for);
- $ips[] = $this->ip;
- $this->check_ban($this->data['user_id'], $ips);
- }
- }
+ $this->check_ban_for_current_session($config);
$this->data['is_registered'] = (!$bot && $this->data['user_id'] != ANONYMOUS && ($this->data['user_type'] == USER_NORMAL || $this->data['user_type'] == USER_FOUNDER)) ? true : false;
$this->data['is_bot'] = ($bot) ? true : false;
@@ -1285,9 +1276,6 @@ class session
$message .= ($ban_row['ban_give_reason']) ? '<br /><br />' . sprintf($this->lang['BOARD_BAN_REASON'], $ban_row['ban_give_reason']) : '';
$message .= '<br /><br /><em>' . $this->lang['BAN_TRIGGERED_BY_' . strtoupper($ban_triggered_by)] . '</em>';
- // To circumvent session_begin returning a valid value and the check_ban() not called on second page view, we kill the session again
- $this->session_kill(false);
-
// A very special case... we are within the cron script which is not supposed to print out the ban message... show blank page
if (defined('IN_CRON'))
{
@@ -1296,6 +1284,9 @@ class session
exit;
}
+ // To circumvent session_begin returning a valid value and the check_ban() not called on second page view, we kill the session again
+ $this->session_kill(false);
+
trigger_error($message);
}
@@ -1303,6 +1294,28 @@ class session
}
/**
+ * Check the current session for bans
+ *
+ * @return true if session user is banned.
+ */
+ protected function check_ban_for_current_session($config)
+ {
+ if (!defined('SKIP_CHECK_BAN') && $this->data['user_type'] != USER_FOUNDER)
+ {
+ if (!$config['forwarded_for_check'])
+ {
+ $this->check_ban($this->data['user_id'], $this->ip);
+ }
+ else
+ {
+ $ips = explode(' ', $this->forwarded_for);
+ $ips[] = $this->ip;
+ $this->check_ban($this->data['user_id'], $ips);
+ }
+ }
+ }
+
+ /**
* Check if ip is blacklisted
* This should be called only where absolutely necessary
*
@@ -1593,7 +1606,7 @@ class session
}
// Only update session DB a minute or so after last update or if page changes
- if ($this->time_now - $this->data['session_time'] > 60 || ($this->update_session_page && $this->data['session_page'] != $this->page['page']))
+ if ($this->time_now - ((isset($this->data['session_time'])) ? $this->data['session_time'] : 0) > 60 || ($this->update_session_page && $this->data['session_page'] != $this->page['page']))
{
$sql_ary = array('session_time' => $this->time_now);