diff options
author | Paul S. Owen <psotfx@users.sourceforge.net> | 2003-01-21 14:37:56 +0000 |
---|---|---|
committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2003-01-21 14:37:56 +0000 |
commit | fce3c5ef0be18cc4b1d5ded400448ee815c626fa (patch) | |
tree | 3edde6fa9c75d3f6f72618771ee488aca9f0fc7e /phpBB/includes/session.php | |
parent | 5bea3ea3b430c0e9de46154ecd638092b67dc8eb (diff) | |
download | forums-fce3c5ef0be18cc4b1d5ded400448ee815c626fa.tar forums-fce3c5ef0be18cc4b1d5ded400448ee815c626fa.tar.gz forums-fce3c5ef0be18cc4b1d5ded400448ee815c626fa.tar.bz2 forums-fce3c5ef0be18cc4b1d5ded400448ee815c626fa.tar.xz forums-fce3c5ef0be18cc4b1d5ded400448ee815c626fa.zip |
Re-jiggled where options are cached, moved clear prefetch to main auth class
git-svn-id: file:///svn/phpbb/trunk@3342 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/session.php')
-rw-r--r-- | phpBB/includes/session.php | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index b6390e122b..a96a9fc328 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -56,9 +56,9 @@ class session if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { - if (preg_match('/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/', $_SERVER['HTTP_X_FORWARDED_FOR'], $ip_list)) + if (preg_match('#^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)#', $_SERVER['HTTP_X_FORWARDED_FOR'], $ip_list)) { - $private_ip = array('/^0\./', '/^127\.0\.0\.1/', '/^192\.168\..*/', '/^172\.16\..*/', '/^10\..*/', '/^224\..*/', '/^240\..*/'); + $private_ip = array('#^0\.#', '#^127\.0\.0\.1#', '#^192\.168\.#', '#^172\.16\.#', '#^10\.#', '#^224\.#', '#^240\.#'); $this->ip = preg_replace($private_ip, $this->ip, $ip_list[1]); } } @@ -307,18 +307,22 @@ class session $del_user_id = ''; $del_sessions = 0; - while ($row = $db->sql_fetchrow($result)) + if ($row = $db->sql_fetchrow($result)) { - if ($row['session_user_id']) + do { - $sql = "UPDATE " . USERS_TABLE . " - SET user_lastvisit = " . $row['recent_time'] . " - WHERE user_id = " . $row['session_user_id']; - $db->sql_query($sql); - } + if (intval($row['session_user_id']) != ANONYMOUS) + { + $sql = "UPDATE " . USERS_TABLE . " + SET user_lastvisit = " . $row['recent_time'] . " + WHERE user_id = " . $row['session_user_id']; + $db->sql_query($sql); + } - $del_user_id .= (($del_user_id != '') ? ', ' : '') . " '" . $row['session_user_id'] . "'"; - $del_sessions++; + $del_user_id .= (($del_user_id != '') ? ', ' : '') . " '" . $row['session_user_id'] . "'"; + $del_sessions++; + } + while ($row = $db->sql_fetchrow($result)); } if ($del_user_id != '') @@ -701,6 +705,21 @@ class auth return; } + // Clear one or all users cached permission settings + function acl_clear_prefetch($user_id = false) + { + global $db; + + $where_sql = ($user_id) ? "WHERE user_id = $user_id" : ''; + + $sql = "UPDATE " . USERS_TABLE . " + SET user_permissions = '' + $where_sql"; + $db->sql_query($sql); + + return; + } + // Authentication plug-ins is largely down to Sergey Kanareykin, our thanks to him. function login($username, $password, $autologin = false) { |