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 @@ + + + + + +
+ + + + + + + + + + + + + +
{L_WHOSONLINE}
{L_USERNAME}{L_LOCATION}
{userrow.USERNAME}{userrow.LOCATION}
+ \ 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 @@ + + + + + + +
+ + + + +
{JUMPBOX}
+
+ + 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 @@ + + + + + + +
+ + + + +
{L_POSTEDTOTAL} -{TOTAL_POSTS}- {L_MESSAGES}.
+ {L_WEHAVE} {TOTAL_USERS} {L_REGUSERS}.
+ {L_NEWESTUSER} {NEWEST_USER} +
+
+ + \ 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 @@ +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 .= "  [ Logged In ]"; + } + else + { + $username .= "  [ 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); + +?>