aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2005-02-10 20:19:48 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2005-02-10 20:19:48 +0000
commit4269b318a29f3cff9da6bdf2f7cff959dcb0c961 (patch)
treeedd09aa26c4d05d65bec79e31e5e92aa458d4415 /phpBB/includes
parent9841f6145c88a30d1d337a4e250ac379ac9b2700 (diff)
downloadforums-4269b318a29f3cff9da6bdf2f7cff959dcb0c961.tar
forums-4269b318a29f3cff9da6bdf2f7cff959dcb0c961.tar.gz
forums-4269b318a29f3cff9da6bdf2f7cff959dcb0c961.tar.bz2
forums-4269b318a29f3cff9da6bdf2f7cff959dcb0c961.tar.xz
forums-4269b318a29f3cff9da6bdf2f7cff959dcb0c961.zip
change viewonline page slightly.
Mental Note: Step away from using in_array in conjunction with huge arrays (and within a loop), might get slow. ;) git-svn-id: file:///svn/phpbb/trunk@5091 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/functions.php29
1 files changed, 21 insertions, 8 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index a8e7033a18..d887d76655 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -334,7 +334,7 @@ function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list
$sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id
FROM ' . FORUMS_TABLE . '
ORDER BY left_id ASC';
- $result = $db->sql_query($sql);
+ $result = $db->sql_query($sql, 600);
$right = $padding = 0;
$padding_store = array('0' => 0);
@@ -1529,25 +1529,38 @@ function page_header($page_title = '')
{
$userlist_ary = $userlist_visible = array();
$logged_visible_online = $logged_hidden_online = $guests_online = $prev_user_id = 0;
- $prev_user_ip = $prev_session_ip = $reading_sql = '';
+ $prev_session_ip = $reading_sql = '';
if (!empty($_REQUEST['f']))
{
$f = request_var('f', 0);
- $reading_sql = "AND s.session_page LIKE '%f=$f%'";
+ $reading_sql = " AND s.session_page LIKE '%f=$f%'";
+ }
+
+ // Get number of online guests
+ if (!$config['load_online_guests'])
+ {
+ $sql = 'SELECT COUNT(DISTINCT s.session_ip) as num_guests FROM ' . SESSIONS_TABLE . ' s
+ WHERE s.session_user_id = ' . ANONYMOUS . '
+ AND s.session_time >= ' . (time() - ($config['load_online_time'] * 60)) .
+ $reading_sql;
+ $result = $db->sql_query($sql);
+ $guests_online = (int) $db->sql_fetchfield('num_guests', 0, $result);
+ $db->sql_freeresult($result);
}
$sql = 'SELECT u.username, u.user_id, u.user_type, u.user_allow_viewonline, u.user_colour, s.session_ip, s.session_viewonline
FROM ' . USERS_TABLE . ' u, ' . SESSIONS_TABLE . ' s
- WHERE s.session_time >= ' . (time() - (intval($config['load_online_time']) * 60)) . "
- $reading_sql
- AND u.user_id = s.session_user_id
- ORDER BY u.username ASC, s.session_ip ASC";
+ WHERE s.session_time >= ' . (time() - (intval($config['load_online_time']) * 60)) .
+ $reading_sql .
+ ((!$config['load_online_guests']) ? ' AND s.session_user_id <> ' . ANONYMOUS : '') . '
+ AND u.user_id = s.session_user_id
+ ORDER BY u.username ASC, s.session_ip ASC';
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
- // User is logged in and therefor not a guest
+ // User is logged in and therefore not a guest
if ($row['user_id'] != ANONYMOUS)
{
// Skip multiple sessions for one user