Statistics
| Revision:

root / trunk / phpBB / viewonline.php

History | View | Annotate | Download (13.6 KB)

1 146 psotfx
<?php
2 8146 acydburn
/**
3 5114 acydburn
*
4 5114 acydburn
* @package phpBB3
5 5114 acydburn
* @version $Id$
6 8146 acydburn
* @copyright (c) 2005 phpBB Group
7 8146 acydburn
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
8 5114 acydburn
*
9 5114 acydburn
*/
10 146 psotfx
11 5114 acydburn
/**
12 5883 acydburn
* @ignore
13 5114 acydburn
*/
14 2305 psotfx
define('IN_PHPBB', true);
15 7954 acydburn
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
16 4441 psotfx
$phpEx = substr(strrchr(__FILE__, '.'), 1);
17 6015 acydburn
include($phpbb_root_path . 'common.' . $phpEx);
18 146 psotfx
19 146 psotfx
// Start session management
20 5247 acydburn
$user->session_begin();
21 2958 psotfx
$auth->acl($user->data);
22 8033 acydburn
$user->setup('memberlist');
23 3969 psotfx
24 4259 psotfx
// Get and set some variables
25 4742 psotfx
$mode                = request_var('mode', '');
26 4743 psotfx
$session_id        = request_var('s', '');
27 4742 psotfx
$start                = request_var('start', 0);
28 4742 psotfx
$sort_key        = request_var('sk', 'b');
29 4742 psotfx
$sort_dir        = request_var('sd', 'd');
30 5091 acydburn
$show_guests= ($config['load_online_guests']) ? request_var('sg', 0) : 0;
31 4433 psotfx
32 7889 acydburn
// Can this user view profiles/memberlist?
33 7889 acydburn
if (!$auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel'))
34 7889 acydburn
{
35 7889 acydburn
        if ($user->data['user_id'] != ANONYMOUS)
36 7889 acydburn
        {
37 7889 acydburn
                trigger_error('NO_VIEW_USERS');
38 7889 acydburn
        }
39 7889 acydburn
40 7889 acydburn
        login_box('', $user->lang['LOGIN_EXPLAIN_VIEWONLINE']);
41 7889 acydburn
}
42 7889 acydburn
43 7987 acydburn
$sort_key_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_JOINED'], 'c' => $user->lang['SORT_LOCATION']);
44 6650 acydburn
$sort_key_sql = array('a' => 'u.username_clean', 'b' => 's.session_time', 'c' => 's.session_page');
45 4237 psotfx
46 4237 psotfx
// Sorting and order
47 6538 acydburn
if (!isset($sort_key_text[$sort_key]))
48 6538 acydburn
{
49 6538 acydburn
        $sort_key = 'b';
50 6538 acydburn
}
51 6538 acydburn
52 4441 psotfx
$order_by = $sort_key_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC');
53 4237 psotfx
54 4742 psotfx
// Whois requested
55 8095 acydburn
if ($mode == 'whois' && $auth->acl_get('a_') && $session_id)
56 4742 psotfx
{
57 5091 acydburn
        include($phpbb_root_path . 'includes/functions_user.' . $phpEx);
58 4237 psotfx
59 4742 psotfx
        $sql = 'SELECT u.user_id, u.username, u.user_type, s.session_ip
60 5091 acydburn
                FROM ' . USERS_TABLE . ' u, ' . SESSIONS_TABLE . " s
61 5091 acydburn
                WHERE s.session_id = '" . $db->sql_escape($session_id) . "'
62 5091 acydburn
                        AND        u.user_id = s.session_user_id";
63 4742 psotfx
        $result = $db->sql_query($sql);
64 4742 psotfx
65 4742 psotfx
        if ($row = $db->sql_fetchrow($result))
66 4742 psotfx
        {
67 8095 acydburn
                $template->assign_var('WHOIS', user_ipwhois($row['session_ip']));
68 4742 psotfx
        }
69 4742 psotfx
        $db->sql_freeresult($result);
70 4742 psotfx
71 4742 psotfx
        // Output the page
72 4742 psotfx
        page_header($user->lang['WHO_IS_ONLINE']);
73 4742 psotfx
74 4742 psotfx
        $template->set_filenames(array(
75 4742 psotfx
                'body' => 'viewonline_whois.html')
76 4742 psotfx
        );
77 6015 acydburn
        make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
78 4742 psotfx
79 4742 psotfx
        page_footer();
80 4742 psotfx
}
81 4742 psotfx
82 2137 psotfx
// Forum info
83 4441 psotfx
$sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id
84 4441 psotfx
        FROM ' . FORUMS_TABLE . '
85 4441 psotfx
        ORDER BY left_id ASC';
86 4441 psotfx
$result = $db->sql_query($sql, 600);
87 2673 psotfx
88 7987 acydburn
$forum_data = array();
89 3346 psotfx
while ($row = $db->sql_fetchrow($result))
90 146 psotfx
{
91 6829 acydburn
        $forum_data[$row['forum_id']] = $row;
92 290 psotfx
}
93 3969 psotfx
$db->sql_freeresult($result);
94 146 psotfx
95 5091 acydburn
$guest_counter = 0;
96 3969 psotfx
97 5091 acydburn
// Get number of online guests (if we do not display them)
98 5091 acydburn
if (!$show_guests)
99 5091 acydburn
{
100 6497 acydburn
        switch ($db->sql_layer)
101 6090 davidmj
        {
102 6090 davidmj
                case 'sqlite':
103 6090 davidmj
                        $sql = 'SELECT COUNT(session_ip) as num_guests
104 6090 davidmj
                                FROM (
105 6090 davidmj
                                        SELECT DISTINCT session_ip
106 6090 davidmj
                                                FROM ' . SESSIONS_TABLE . '
107 6090 davidmj
                                                WHERE session_user_id = ' . ANONYMOUS . '
108 6090 davidmj
                                                        AND session_time >= ' . (time() - ($config['load_online_time'] * 60)) .
109 8146 acydburn
                                ')';
110 6090 davidmj
                break;
111 6090 davidmj
112 6090 davidmj
                default:
113 6090 davidmj
                        $sql = 'SELECT COUNT(DISTINCT session_ip) as num_guests
114 6090 davidmj
                                FROM ' . SESSIONS_TABLE . '
115 6090 davidmj
                                WHERE session_user_id = ' . ANONYMOUS . '
116 6090 davidmj
                                        AND session_time >= ' . (time() - ($config['load_online_time'] * 60));
117 6497 acydburn
                break;
118 6090 davidmj
        }
119 5091 acydburn
        $result = $db->sql_query($sql);
120 5699 acydburn
        $guest_counter = (int) $db->sql_fetchfield('num_guests');
121 5091 acydburn
        $db->sql_freeresult($result);
122 5091 acydburn
}
123 5091 acydburn
124 2137 psotfx
// Get user list
125 8438 acydburn
$sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_type, u.user_colour, s.session_id, s.session_time, s.session_page, s.session_ip, s.session_browser, s.session_viewonline, s.session_forum_id
126 3969 psotfx
        FROM ' . USERS_TABLE . ' u, ' . SESSIONS_TABLE . ' s
127 2448 psotfx
        WHERE u.user_id = s.session_user_id
128 8146 acydburn
                AND s.session_time >= ' . (time() - ($config['load_online_time'] * 60)) .
129 5091 acydburn
                ((!$show_guests) ? ' AND s.session_user_id <> ' . ANONYMOUS : '') . '
130 4237 psotfx
        ORDER BY ' . $order_by;
131 2673 psotfx
$result = $db->sql_query($sql);
132 1260 psotfx
133 5091 acydburn
$prev_id = $prev_ip = $user_list = array();
134 5091 acydburn
$logged_visible_online = $logged_hidden_online = $counter = 0;
135 5091 acydburn
136 3346 psotfx
while ($row = $db->sql_fetchrow($result))
137 2465 psotfx
{
138 5091 acydburn
        if ($row['user_id'] != ANONYMOUS && !isset($prev_id[$row['user_id']]))
139 146 psotfx
        {
140 7889 acydburn
                $view_online = $s_user_hidden = false;
141 7889 acydburn
                $user_colour = ($row['user_colour']) ? ' style="color:#' . $row['user_colour'] . '" class="username-coloured"' : '';
142 9428 acydburn
143 7889 acydburn
                $username_full = ($row['user_type'] != USER_IGNORE) ? get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) : '<span' . $user_colour . '>' . $row['username'] . '</span>';
144 6015 acydburn
145 7755 kellanved
                if (!$row['session_viewonline'])
146 4441 psotfx
                {
147 4978 acydburn
                        $view_online = ($auth->acl_get('u_viewonline')) ? true : false;
148 4441 psotfx
                        $logged_hidden_online++;
149 2690 psotfx
150 7889 acydburn
                        $username_full = '<em>' . $username_full . '</em>';
151 7889 acydburn
                        $s_user_hidden = true;
152 146 psotfx
                }
153 4441 psotfx
                else
154 2137 psotfx
                {
155 2473 psotfx
                        $view_online = true;
156 4441 psotfx
                        $logged_visible_online++;
157 2137 psotfx
                }
158 4441 psotfx
159 5091 acydburn
                $prev_id[$row['user_id']] = 1;
160 5091 acydburn
161 5091 acydburn
                if ($view_online)
162 5091 acydburn
                {
163 5091 acydburn
                        $counter++;
164 5091 acydburn
                }
165 5091 acydburn
166 5091 acydburn
                if (!$view_online || $counter > $start + $config['topics_per_page'] || $counter <= $start)
167 5091 acydburn
                {
168 5091 acydburn
                        continue;
169 5091 acydburn
                }
170 2465 psotfx
        }
171 5091 acydburn
        else if ($show_guests && $row['user_id'] == ANONYMOUS && !isset($prev_ip[$row['session_ip']]))
172 4441 psotfx
        {
173 5091 acydburn
                $prev_ip[$row['session_ip']] = 1;
174 5091 acydburn
                $guest_counter++;
175 5091 acydburn
                $counter++;
176 1616 psotfx
177 5091 acydburn
                if ($counter > $start + $config['topics_per_page'] || $counter <= $start)
178 5091 acydburn
                {
179 5091 acydburn
                        continue;
180 5091 acydburn
                }
181 5091 acydburn
182 7889 acydburn
                $s_user_hidden = false;
183 7889 acydburn
                $username_full = get_username_string('full', $row['user_id'], $user->lang['GUEST']);
184 4441 psotfx
        }
185 5091 acydburn
        else
186 5091 acydburn
        {
187 5091 acydburn
                continue;
188 5091 acydburn
        }
189 2451 psotfx
190 9566 bantu
        preg_match('#^([a-z0-9/_-]+)#i', $row['session_page'], $on_page);
191 5091 acydburn
        if (!sizeof($on_page))
192 5091 acydburn
        {
193 5091 acydburn
                $on_page[1] = '';
194 5091 acydburn
        }
195 4441 psotfx
196 5091 acydburn
        switch ($on_page[1])
197 2465 psotfx
        {
198 5091 acydburn
                case 'index':
199 5091 acydburn
                        $location = $user->lang['INDEX'];
200 6015 acydburn
                        $location_url = append_sid("{$phpbb_root_path}index.$phpEx");
201 5595 acydburn
                break;
202 4743 psotfx
203 5595 acydburn
                case 'adm/index':
204 5595 acydburn
                        $location = $user->lang['ACP'];
205 6015 acydburn
                        $location_url = append_sid("{$phpbb_root_path}index.$phpEx");
206 5595 acydburn
                break;
207 5595 acydburn
208 5091 acydburn
                case 'posting':
209 5091 acydburn
                case 'viewforum':
210 5091 acydburn
                case 'viewtopic':
211 8438 acydburn
                        $forum_id = $row['session_forum_id'];
212 2673 psotfx
213 5595 acydburn
                        if ($forum_id && $auth->acl_get('f_list', $forum_id))
214 5091 acydburn
                        {
215 5091 acydburn
                                $location = '';
216 6829 acydburn
                                $location_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id);
217 6829 acydburn
218 6829 acydburn
                                if ($forum_data[$forum_id]['forum_type'] == FORUM_LINK)
219 6829 acydburn
                                {
220 6829 acydburn
                                        $location = sprintf($user->lang['READING_LINK'], $forum_data[$forum_id]['forum_name']);
221 6829 acydburn
                                        break;
222 6829 acydburn
                                }
223 6829 acydburn
224 5091 acydburn
                                switch ($on_page[1])
225 2673 psotfx
                                {
226 5091 acydburn
                                        case 'posting':
227 5091 acydburn
                                                preg_match('#mode=([a-z]+)#', $row['session_page'], $on_page);
228 8677 acydburn
                                                $posting_mode = (!empty($on_page[1])) ? $on_page[1] : '';
229 4970 psotfx
230 8677 acydburn
                                                switch ($posting_mode)
231 5091 acydburn
                                                {
232 5091 acydburn
                                                        case 'reply':
233 6838 acydburn
                                                        case 'quote':
234 6838 acydburn
                                                                $location = sprintf($user->lang['REPLYING_MESSAGE'], $forum_data[$forum_id]['forum_name']);
235 5595 acydburn
                                                        break;
236 5595 acydburn
237 5091 acydburn
                                                        default:
238 6838 acydburn
                                                                $location = sprintf($user->lang['POSTING_MESSAGE'], $forum_data[$forum_id]['forum_name']);
239 5595 acydburn
                                                        break;
240 5091 acydburn
                                                }
241 5595 acydburn
                                        break;
242 3551 psotfx
243 5091 acydburn
                                        case 'viewtopic':
244 6838 acydburn
                                                $location = sprintf($user->lang['READING_TOPIC'], $forum_data[$forum_id]['forum_name']);
245 5595 acydburn
                                        break;
246 8120 kellanved
247 5091 acydburn
                                        case 'viewforum':
248 6838 acydburn
                                                $location = sprintf($user->lang['READING_FORUM'], $forum_data[$forum_id]['forum_name']);
249 5595 acydburn
                                        break;
250 2673 psotfx
                                }
251 5091 acydburn
                        }
252 5091 acydburn
                        else
253 5091 acydburn
                        {
254 5091 acydburn
                                $location = $user->lang['INDEX'];
255 6015 acydburn
                                $location_url = append_sid("{$phpbb_root_path}index.$phpEx");
256 5091 acydburn
                        }
257 5595 acydburn
                break;
258 698 psotfx
259 5091 acydburn
                case 'search':
260 5091 acydburn
                        $location = $user->lang['SEARCHING_FORUMS'];
261 6015 acydburn
                        $location_url = append_sid("{$phpbb_root_path}search.$phpEx");
262 5595 acydburn
                break;
263 2673 psotfx
264 5091 acydburn
                case 'faq':
265 5091 acydburn
                        $location = $user->lang['VIEWING_FAQ'];
266 6015 acydburn
                        $location_url = append_sid("{$phpbb_root_path}faq.$phpEx");
267 5595 acydburn
                break;
268 2673 psotfx
269 5091 acydburn
                case 'viewonline':
270 5091 acydburn
                        $location = $user->lang['VIEWING_ONLINE'];
271 6015 acydburn
                        $location_url = append_sid("{$phpbb_root_path}viewonline.$phpEx");
272 5595 acydburn
                break;
273 2673 psotfx
274 5091 acydburn
                case 'memberlist':
275 5904 naderman
                        $location = (strpos($row['session_page'], 'mode=viewprofile') !== false) ? $user->lang['VIEWING_MEMBER_PROFILE'] : $user->lang['VIEWING_MEMBERS'];
276 6015 acydburn
                        $location_url = append_sid("{$phpbb_root_path}memberlist.$phpEx");
277 5595 acydburn
                break;
278 4644 psotfx
279 5595 acydburn
                case 'mcp':
280 6829 acydburn
                        $location = $user->lang['VIEWING_MCP'];
281 6829 acydburn
                        $location_url = append_sid("{$phpbb_root_path}index.$phpEx");
282 6829 acydburn
                break;
283 6829 acydburn
284 5091 acydburn
                case 'ucp':
285 5091 acydburn
                        $location = $user->lang['VIEWING_UCP'];
286 2673 psotfx
287 6829 acydburn
                        // Grab some common modules
288 6829 acydburn
                        $url_params = array(
289 6829 acydburn
                                'mode=register'                => 'VIEWING_REGISTER',
290 6829 acydburn
                                'i=pm&mode=compose'        => 'POSTING_PRIVATE_MESSAGE',
291 6829 acydburn
                                'i=pm&'                                => 'VIEWING_PRIVATE_MESSAGES',
292 6829 acydburn
                                'i=profile&'                => 'CHANGING_PROFILE',
293 6829 acydburn
                                'i=prefs&'                        => 'CHANGING_PREFERENCES',
294 6829 acydburn
                        );
295 6829 acydburn
296 6829 acydburn
                        foreach ($url_params as $param => $lang)
297 5595 acydburn
                        {
298 6829 acydburn
                                if (strpos($row['session_page'], $param) !== false)
299 6829 acydburn
                                {
300 6829 acydburn
                                        $location = $user->lang[$lang];
301 6829 acydburn
                                        break;
302 6829 acydburn
                                }
303 6829 acydburn
                        }
304 5595 acydburn
305 6015 acydburn
                        $location_url = append_sid("{$phpbb_root_path}index.$phpEx");
306 5595 acydburn
                break;
307 5595 acydburn
308 8705 Kellanved
                case 'download/file':
309 5595 acydburn
                        $location = $user->lang['DOWNLOADING_FILE'];
310 6015 acydburn
                        $location_url = append_sid("{$phpbb_root_path}index.$phpEx");
311 5595 acydburn
                break;
312 5595 acydburn
313 5595 acydburn
                case 'report':
314 5595 acydburn
                        $location = $user->lang['REPORTING_POST'];
315 6015 acydburn
                        $location_url = append_sid("{$phpbb_root_path}index.$phpEx");
316 5595 acydburn
                break;
317 5595 acydburn
318 5091 acydburn
                default:
319 5091 acydburn
                        $location = $user->lang['INDEX'];
320 6015 acydburn
                        $location_url = append_sid("{$phpbb_root_path}index.$phpEx");
321 5595 acydburn
                break;
322 5091 acydburn
        }
323 646 psotfx
324 5091 acydburn
        $template->assign_block_vars('user_row', array(
325 5595 acydburn
                'USERNAME'                         => $row['username'],
326 7889 acydburn
                'USERNAME_COLOUR'        => $row['user_colour'],
327 7889 acydburn
                'USERNAME_FULL'                => $username_full,
328 5595 acydburn
                'LASTUPDATE'                => $user->format_date($row['session_time']),
329 5595 acydburn
                'FORUM_LOCATION'        => $location,
330 5595 acydburn
                'USER_IP'                        => ($auth->acl_get('a_')) ? (($mode == 'lookup' && $session_id == $row['session_id']) ? gethostbyaddr($row['session_ip']) : $row['session_ip']) : '',
331 7889 acydburn
                'USER_BROWSER'                => ($auth->acl_get('a_user')) ? $row['session_browser'] : '',
332 2137 psotfx
333 7889 acydburn
                'U_USER_PROFILE'        => ($row['user_type'] != USER_IGNORE) ? get_username_string('profile', $row['user_id'], '') : '',
334 6015 acydburn
                'U_USER_IP'                        => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'mode=lookup' . (($mode != 'lookup' || $row['session_id'] != $session_id) ? '&amp;s=' . $row['session_id'] : '') . "&amp;sg=$show_guests&amp;start=$start&amp;sk=$sort_key&amp;sd=$sort_dir"),
335 6015 acydburn
                'U_WHOIS'                        => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'mode=whois&amp;s=' . $row['session_id']),
336 6015 acydburn
                'U_FORUM_LOCATION'        => $location_url,
337 9428 acydburn
338 7889 acydburn
                'S_USER_HIDDEN'                => $s_user_hidden,
339 5091 acydburn
                'S_GUEST'                        => ($row['user_id'] == ANONYMOUS) ? true : false,
340 7889 acydburn
                'S_USER_TYPE'                => $row['user_type'],
341 7889 acydburn
        ));
342 2465 psotfx
}
343 3969 psotfx
$db->sql_freeresult($result);
344 5091 acydburn
unset($prev_id, $prev_ip);
345 775 psotfx
346 3969 psotfx
// Generate reg/hidden/guest online text
347 3969 psotfx
$vars_online = array(
348 3969 psotfx
        'REG'        => array('logged_visible_online', 'l_r_user_s'),
349 3969 psotfx
        'HIDDEN'=> array('logged_hidden_online', 'l_h_user_s'),
350 5091 acydburn
        'GUEST'        => array('guest_counter', 'l_g_user_s')
351 3969 psotfx
);
352 2137 psotfx
353 3969 psotfx
foreach ($vars_online as $l_prefix => $var_ary)
354 2465 psotfx
{
355 3969 psotfx
        switch ($$var_ary[0])
356 3969 psotfx
        {
357 3969 psotfx
                case 0:
358 3969 psotfx
                        $$var_ary[1] = $user->lang[$l_prefix . '_USERS_ZERO_ONLINE'];
359 6015 acydburn
                break;
360 3969 psotfx
361 3969 psotfx
                case 1:
362 3969 psotfx
                        $$var_ary[1] = $user->lang[$l_prefix . '_USER_ONLINE'];
363 6015 acydburn
                break;
364 3969 psotfx
365 3969 psotfx
                default:
366 3969 psotfx
                        $$var_ary[1] = $user->lang[$l_prefix . '_USERS_ONLINE'];
367 6015 acydburn
                break;
368 3969 psotfx
        }
369 2465 psotfx
}
370 3969 psotfx
unset($vars_online);
371 775 psotfx
372 6015 acydburn
$pagination = generate_pagination(append_sid("{$phpbb_root_path}viewonline.$phpEx", "sg=$show_guests&amp;sk=$sort_key&amp;sd=$sort_dir"), $counter, $config['topics_per_page'], $start);
373 3969 psotfx
374 3651 psotfx
// Grab group details for legend display
375 7433 acydburn
if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel'))
376 7433 acydburn
{
377 7433 acydburn
        $sql = 'SELECT group_id, group_name, group_colour, group_type
378 7433 acydburn
                FROM ' . GROUPS_TABLE . '
379 7433 acydburn
                WHERE group_legend = 1
380 7433 acydburn
                ORDER BY group_name ASC';
381 7433 acydburn
}
382 7433 acydburn
else
383 7433 acydburn
{
384 7433 acydburn
        $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type
385 7433 acydburn
                FROM ' . GROUPS_TABLE . ' g
386 7433 acydburn
                LEFT JOIN ' . USER_GROUP_TABLE . ' ug
387 7433 acydburn
                        ON (
388 7433 acydburn
                                g.group_id = ug.group_id
389 7433 acydburn
                                AND ug.user_id = ' . $user->data['user_id'] . '
390 7433 acydburn
                                AND ug.user_pending = 0
391 7433 acydburn
                        )
392 7433 acydburn
                WHERE g.group_legend = 1
393 7433 acydburn
                        AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')
394 7433 acydburn
                ORDER BY g.group_name ASC';
395 7433 acydburn
}
396 3651 psotfx
$result = $db->sql_query($sql);
397 3651 psotfx
398 3651 psotfx
$legend = '';
399 3651 psotfx
while ($row = $db->sql_fetchrow($result))
400 3651 psotfx
{
401 6398 grahamje
        if ($row['group_name'] == 'BOTS')
402 6398 grahamje
        {
403 6398 grahamje
                $legend .= (($legend != '') ? ', ' : '') . '<span style="color:#' . $row['group_colour'] . '">' . $user->lang['G_BOTS'] . '</span>';
404 6398 grahamje
        }
405 6398 grahamje
        else
406 6398 grahamje
        {
407 6398 grahamje
                $legend .= (($legend != '') ? ', ' : '') . '<a style="color:#' . $row['group_colour'] . '" href="' . append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp;g=' . $row['group_id']) . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</a>';
408 6398 grahamje
        }
409 3651 psotfx
}
410 3969 psotfx
$db->sql_freeresult($result);
411 3651 psotfx
412 5678 acydburn
// Refreshing the page every 60 seconds...
413 6015 acydburn
meta_refresh(60, append_sid("{$phpbb_root_path}viewonline.$phpEx", "sg=$show_guests&amp;sk=$sort_key&amp;sd=$sort_dir&amp;start=$start"));
414 5678 acydburn
415 3969 psotfx
// Send data to template
416 2465 psotfx
$template->assign_vars(array(
417 3969 psotfx
        'TOTAL_REGISTERED_USERS_ONLINE'        => sprintf($l_r_user_s, $logged_visible_online) . sprintf($l_h_user_s, $logged_hidden_online),
418 5091 acydburn
        'TOTAL_GUEST_USERS_ONLINE'                => sprintf($l_g_user_s, $guest_counter),
419 6015 acydburn
        'LEGEND'                                                => $legend,
420 6015 acydburn
        'PAGINATION'                                        => $pagination,
421 6015 acydburn
        'PAGE_NUMBER'                                        => on_page($counter, $config['topics_per_page'], $start),
422 2673 psotfx
423 7038 davidmj
        'U_SORT_USERNAME'                => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sk=a&amp;sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a') . '&amp;sg=' . ((int) $show_guests)),
424 7038 davidmj
        'U_SORT_UPDATED'                => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sk=b&amp;sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a') . '&amp;sg=' . ((int) $show_guests)),
425 7038 davidmj
        'U_SORT_LOCATION'                => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sk=c&amp;sd=' . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a') . '&amp;sg=' . ((int) $show_guests)),
426 5091 acydburn
427 6015 acydburn
        'U_SWITCH_GUEST_DISPLAY'        => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sg=' . ((int) !$show_guests)),
428 5091 acydburn
        'L_SWITCH_GUEST_DISPLAY'        => ($show_guests) ? $user->lang['HIDE_GUESTS'] : $user->lang['DISPLAY_GUESTS'],
429 5091 acydburn
        'S_SWITCH_GUEST_DISPLAY'        => ($config['load_online_guests']) ? true : false)
430 2465 psotfx
);
431 2465 psotfx
432 5091 acydburn
// We do not need to load the who is online box here. ;)
433 5091 acydburn
$config['load_online'] = false;
434 5091 acydburn
435 3969 psotfx
// Output the page
436 3969 psotfx
page_header($user->lang['WHO_IS_ONLINE']);
437 3969 psotfx
438 2673 psotfx
$template->set_filenames(array(
439 2673 psotfx
        'body' => 'viewonline_body.html')
440 2673 psotfx
);
441 6015 acydburn
make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
442 146 psotfx
443 3969 psotfx
page_footer();
444 146 psotfx
445 1277 psotfx
?>