diff options
| author | Meik Sievertsen <acydburn@phpbb.com> | 2005-10-19 18:00:10 +0000 |
|---|---|---|
| committer | Meik Sievertsen <acydburn@phpbb.com> | 2005-10-19 18:00:10 +0000 |
| commit | b873b37607762868580bdd21b9c90f05db168921 (patch) | |
| tree | b759644207a9579a9969a36812d6e8417df45485 /phpBB/includes/session.php | |
| parent | 719763dec21c431b41adb8855f6fc4cd007b418b (diff) | |
| download | forums-b873b37607762868580bdd21b9c90f05db168921.tar forums-b873b37607762868580bdd21b9c90f05db168921.tar.gz forums-b873b37607762868580bdd21b9c90f05db168921.tar.bz2 forums-b873b37607762868580bdd21b9c90f05db168921.tar.xz forums-b873b37607762868580bdd21b9c90f05db168921.zip | |
- updated topic tracking code
- additional changes (mostly bugfixes)
- bart, if you update your user table with the user_lastmark field, set it to the user_lastvisit value ;)
- and last but not least, introducing some bugs in ucp main front (regarding topic tracking)
git-svn-id: file:///svn/phpbb/trunk@5272 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/session.php')
| -rw-r--r-- | phpBB/includes/session.php | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 62d100156d..e2141dde59 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -43,8 +43,6 @@ class session $this->time_now = time(); $this->browser = (!empty($_SERVER['HTTP_USER_AGENT'])) ? $_SERVER['HTTP_USER_AGENT'] : ''; -// $this->page = (!empty($_SERVER['REQUEST_URI'])) ? preg_replace('#/?' . preg_quote($config['script_path'], '#') . '/?([a-z]+?\.' . $phpEx . '\?)sid=[a-z0-9]*(.*?)$#i', '\1\2', $_SERVER['REQUEST_URI']) . ((isset($_POST['f'])) ? 'f=' . intval($_POST['f']) : '') : ''; - $this->page = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] . ((isset($_POST['f'])) ? 'f=' . intval($_POST['f']) : '') : ''; $sid = substr($this->page, strpos($this->page, 'sid='), 36); $this->page = str_replace(array('/' . $config['script_path'] . '/', (strlen($sid) == 36 && strpos($sid, '&') === false) ? $sid : 'sid='), '', $this->page); @@ -175,8 +173,7 @@ class session foreach ($active_bots as $row) { -// if ($row['bot_agent'] && preg_match('#' . preg_quote($row['bot_agent'], '#') . '#i', $this->browser)) - if ($row['bot_agent'] && strpos($this->browser, $row['bot_agent']) !== false) + if ($row['bot_agent'] && strpos(strtolower($this->browser), strtolower($row['bot_agent'])) !== false) { $bot = $row['user_id']; } @@ -270,7 +267,7 @@ class session $this->data = array_merge($sdata, $this->data); unset($sdata); $this->session_id = $this->data['session_id']; - } + } $db->sql_freeresult($result); $this->data['session_last_visit'] = (isset($this->data['session_time']) && $this->data['session_time']) ? $this->data['session_time'] : (($this->data['user_lastvisit']) ? $this->data['user_lastvisit'] : time()); @@ -440,11 +437,18 @@ class session * data before those sessions are destroyed. In addition this method * removes autologin key information that is older than an admin defined * limit. + * + * @todo add to cron */ function session_gc() { global $db, $config; + if (!$this->time_now) + { + $this->time_now = time(); + } + switch (SQL_LAYER) { case 'mysql4': @@ -531,6 +535,13 @@ class session break; } + if (!empty($config['max_autologin_time'])) + { + $sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE . ' + WHERE last_login < ' . (time() - (86400 * (int) $config['max_autologin_time'])); + $db->sql_query($sql); + } + return; } @@ -611,7 +622,7 @@ class session if ($this->data['user_id'] != ANONYMOUS) { $this->session_kill(); - } + } // Determine which message to output $till_date = (!empty($ban_row['ban_end'])) ? $this->format_date($ban_row['ban_end']) : ''; $message = (!empty($ban_row['ban_end'])) ? 'BOARD_BAN_TIME' : 'BOARD_BAN_PERM'; @@ -666,25 +677,6 @@ class session return false; } - - /** - * Remove stale login keys - * - * @private - */ - function tidy_login_keys() - { - global $config, $db; - - if (!empty($config['max_autologin_time'])) - { - $sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE . ' - WHERE last_login < ' . (time() - (86400 * (int) $config['max_autologin_time'])); - $db->sql_query($sql); - } - - return false; - } } |
