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
This commit is contained in:
Paul S. Owen 2003-01-21 14:37:56 +00:00
parent 5bea3ea3b4
commit fce3c5ef0b

View file

@ -56,9 +56,9 @@ class session
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) 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]); $this->ip = preg_replace($private_ip, $this->ip, $ip_list[1]);
} }
} }
@ -307,9 +307,11 @@ class session
$del_user_id = ''; $del_user_id = '';
$del_sessions = 0; $del_sessions = 0;
while ($row = $db->sql_fetchrow($result)) if ($row = $db->sql_fetchrow($result))
{ {
if ($row['session_user_id']) do
{
if (intval($row['session_user_id']) != ANONYMOUS)
{ {
$sql = "UPDATE " . USERS_TABLE . " $sql = "UPDATE " . USERS_TABLE . "
SET user_lastvisit = " . $row['recent_time'] . " SET user_lastvisit = " . $row['recent_time'] . "
@ -320,6 +322,8 @@ class session
$del_user_id .= (($del_user_id != '') ? ', ' : '') . " '" . $row['session_user_id'] . "'"; $del_user_id .= (($del_user_id != '') ? ', ' : '') . " '" . $row['session_user_id'] . "'";
$del_sessions++; $del_sessions++;
} }
while ($row = $db->sql_fetchrow($result));
}
if ($del_user_id != '') if ($del_user_id != '')
{ {
@ -701,6 +705,21 @@ class auth
return; 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. // Authentication plug-ins is largely down to Sergey Kanareykin, our thanks to him.
function login($username, $password, $autologin = false) function login($username, $password, $autologin = false)
{ {