aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/templates/Default/viewonline_body.tpl21
-rw-r--r--phpBB/templates/Default/viewonline_footer.tpl15
-rw-r--r--phpBB/templates/Default/viewonline_header.tpl18
-rw-r--r--phpBB/viewonline.php166
4 files changed, 220 insertions, 0 deletions
diff --git a/phpBB/templates/Default/viewonline_body.tpl b/phpBB/templates/Default/viewonline_body.tpl
new file mode 100644
index 0000000000..4641c1dfe1
--- /dev/null
+++ b/phpBB/templates/Default/viewonline_body.tpl
@@ -0,0 +1,21 @@
+<tr>
+ <td><table border="0" align="center" width="100%" bgcolor="#000000" cellpadding="0" cellspacing="1">
+ <tr>
+ <td><table border="0" width="100%" cellpadding="3" cellspacing="1">
+ <tr class="tableheader">
+ <td colspan="2" align="center"><b>{L_WHOSONLINE}</b></td>
+ </tr>
+ <tr class="catheader">
+ <td align="center">{L_USERNAME}</td>
+ <td align="center">{L_LOCATION}</td>
+ </tr>
+ <!-- BEGIN userrow -->
+ <tr bgcolor="{userrow.ROW_COLOR}" class="tablebody">
+ <td><a href="profile.{PHPEX}?mode=view&{POST_USER_URL}={userrow.USER_ID}">{userrow.USERNAME}</a></td>
+ <td><a href="{userrow.LOCATION_URL}">{userrow.LOCATION}</a></td>
+ </tr>
+ <!-- END userrow -->
+ </table></td>
+ </tr>
+ </table></td>
+</tr> \ No newline at end of file
diff --git a/phpBB/templates/Default/viewonline_footer.tpl b/phpBB/templates/Default/viewonline_footer.tpl
new file mode 100644
index 0000000000..9744b9c3d1
--- /dev/null
+++ b/phpBB/templates/Default/viewonline_footer.tpl
@@ -0,0 +1,15 @@
+ <tr>
+ <td>
+ <table border="0" bgcolor="#000000" cellpadding="0" cellspacing="1">
+ <tr>
+ <td align="right">
+ <table border="0" width="100%" bgcolor="#CCCCCC" cellpadding="1" cellspacing="1">
+ <tr>
+ <td style="{font-size: 8pt; height: 55px;}">{JUMPBOX}</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
diff --git a/phpBB/templates/Default/viewonline_header.tpl b/phpBB/templates/Default/viewonline_header.tpl
new file mode 100644
index 0000000000..cd23f7b840
--- /dev/null
+++ b/phpBB/templates/Default/viewonline_header.tpl
@@ -0,0 +1,18 @@
+<tr>
+<td>
+ <table border="0" align="right" width="30%" bgcolor="#000000" cellpadding="0" cellspacing="1">
+ <tr>
+ <td>
+ <table border="0" width="100%" bgcolor="#CCCCCC" cellpadding="1" cellspacing="1">
+ <tr>
+ <td align="right" style="{font-size: 8pt;}">{L_POSTEDTOTAL} -<b>{TOTAL_POSTS}</b>- {L_MESSAGES}.<br>
+ {L_WEHAVE} <b>{TOTAL_USERS}</b> {L_REGUSERS}.<br>
+ {L_NEWESTUSER} <b><a href="profile.{PHPEX}?mode=viewprofile&user_id={NEWEST_UID}">{NEWEST_USER}</a></b>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </td>
+</tr> \ No newline at end of file
diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php
new file mode 100644
index 0000000000..11dc8a51c3
--- /dev/null
+++ b/phpBB/viewonline.php
@@ -0,0 +1,166 @@
+<?php
+/***************************************************************************
+ * index.php
+ * -------------------
+ * begin : Saturday, Feb 13, 2001
+ * copyright : (C) 2001 The phpBB Group
+ * email : support@phpbb.com
+ *
+ * $Id$
+ *
+ *
+ ***************************************************************************/
+
+
+/***************************************************************************
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ *
+ ***************************************************************************/
+include('extension.inc');
+include('common.'.$phpEx);
+
+$pagetype = "viewonline";
+$page_title = "Who's Online";
+
+//
+// Start session management
+//
+$userdata = session_pagestart($user_ip, PAGE_VIEWONLINE, $session_length);
+init_userprefs($userdata);
+//
+// End session management
+//
+
+$total_posts = get_db_stat($db, 'postcount');
+$total_users = get_db_stat($db, 'usercount');
+$newest_userdata = get_db_stat($db, 'newestuser');
+$newest_user = $newest_userdata["username"];
+$newest_uid = $newest_userdata["user_id"];
+
+include('includes/page_header.'.$phpEx);
+
+$sql = "SELECT u.username, u.user_id, f.forum_name, f.forum_id, s.session_page, s.session_logged_in
+ FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s
+ LEFT JOIN ".FORUMS_TABLE." f ON f.forum_id = s.session_page
+ WHERE u.user_id = s.session_user_id";
+$result = $db->sql_query($sql);
+if(!$result)
+{
+ error_die($db, QUERY_ERROR);
+}
+$onlinerow = $db->sql_fetchrowset($result);
+if(!$onlinerow)
+{
+ error_die($db, QUERY_ERROR, "Couldn't fetchrow");
+}
+
+$template->assign_vars(array(
+ "PHP_SELF" => $PHP_SELF,
+ "POST_FORUM_URL" => POST_FORUM_URL,
+ "POST_USER_URL" => POST_USER_URL,
+ "L_WHOSONLINE" => $l_whosonline,
+ "L_USERNAME" => $l_username,
+ "L_LOCATION" => $l_location
+ )
+);
+
+$online_count = $db->sql_numrows($result);
+if($online_count)
+{
+ for($i = 0; $i < $db->sql_numrows($result); $i++)
+ {
+
+ if($row_color == "#DDDDDD")
+ {
+ $row_color = "#CCCCCC";
+ }
+ else
+ {
+ $row_color = "#DDDDDD";
+ }
+
+ if(!stristr($onlinerow[$i]['username'], "Anonymous"))
+ {
+ $username = $onlinerow[$i]['username'];
+ if($onlinerow[$i]['session_logged_in'])
+ {
+ $username .= "&nbsp;&nbsp;[ Logged In ]";
+ }
+ else
+ {
+ $username .= "&nbsp;&nbsp;[ Logged Out ]";
+ }
+ }
+ else
+ {
+ $username .= "$l_anonymous";
+ }
+
+ if($onlinerow[$i]['forum_name'] == "")
+ {
+ switch($onlinerow[$i]['session_page'])
+ {
+ case PAGE_INDEX:
+ $location = "Forum Index";
+ break;
+ case PAGE_LOGIN:
+ $location = "Logging On";
+ break;
+ case PAGE_SEARCH:
+ $location = "Topic Search";
+ break;
+ case PAGE_REGISTER:
+ $location = "Registering";
+ break;
+ case PAGE_VIEWPROFILE:
+ $location = "Viewing Profiles";
+ break;
+ case PAGE_ALTERPROFILE:
+ $location = "Altering Profile";
+ break;
+ case PAGE_VIEWONLINE:
+ $location = "Viewing Who's Online";
+ break;
+ case PAGE_VIEWMEMBERS:
+ $location = "Viewing Memberlist";
+ break;
+ case PAGE_FAQ:
+ $location = "Viewing FAQ";
+ break;
+ default:
+ $location = "Forum Index";
+ }
+ $location_url = "index.".$phpEx;
+ }
+ else
+ {
+ $location_url = "viewforum.".$phpEx."?".POST_FORUM_URL."=".$onlinerow[$i]['forum_id'];
+ $location = $onlinerow[$i]['forum_name'];
+ }
+
+ $template->assign_block_vars("userrow",
+ array("ROW_COLOR" => $row_color,
+ "USER_ID" => $onlinerow[$i]['user_id'],
+ "USERNAME" => $username,
+ "LOCATION" => $location,
+ "LOCATION_URL" => $location_url
+ )
+ );
+
+ }
+
+ $template->pparse("body");
+}
+else
+{
+ error_die($db, GENERAL_ERROR, "There are no users currently browsing this forum");
+}
+
+include('includes/page_tail.'.$phpEx);
+
+?>