diff --git a/phpBB/includes/page_header.php b/phpBB/includes/page_header.php index 433df3a948..9d4233d788 100644 --- a/phpBB/includes/page_header.php +++ b/phpBB/includes/page_header.php @@ -60,6 +60,47 @@ else $s_timezone = "$l_all_times GMT + $sys_timezone $l_hours"; } +// +// Get basic (usernames + totals) online +// situation +// +$sql = "SELECT u.username, u.user_id, s.session_logged_in + FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s + WHERE u.user_id = s.session_user_id + AND s.session_time >= '".(time()-300)."'"; +$result = $db->sql_query($sql); +if(!$result) +{ + error_die(SQL_QUERY, "Couldn't obtain user/online information.", __LINE__, __FILE__); +} + +$total_online = $db->sql_numrows($result); +$logged_online = 0; +$guests_online = 0; +$userlist = ""; +$i = 0; +while($row = $db->sql_fetchrow($result)) +{ + if($row['session_logged_in']) + { + $userlist .= ($i == $total_online && $total_online > 1) ? "and " : ""; + $userlist .= "" . $row['username'] . ""; + $userlist .= ($i < $total_online-1) ? ", " : ""; + + $logged_online++; + } + else + { + $guests_online++; + } + $i++; +} + +$l_r_user_s = ($logged_online == 1) ? $l_user : $l_users; +$l_g_user_s = ($guests_online == 1) ? $l_user : $l_users; +$l_is_are = ($logged_online == 1) ? $l_is : $l_are; +$userlist = ($logged_online > 0) ? "$l_Registered $l_r_user_s: " . $userlist : "$l_Registered $l_r_user_s: $l_None"; + $template->assign_vars(array( "SITENAME" => $sitename, "PHPEX" => $phpEx, @@ -131,7 +172,11 @@ $template->assign_vars(array( "PAGE_TITLE" => $page_title, "LOGIN_STATUS" => $logged_in_status, - "META_INFO" => $meta_tags)); + "META_INFO" => $meta_tags, + + "TOTAL_USERS_ONLINE" => "$l_There $l_is_are $logged_online $l_Registered $l_r_user_s $l_and $guests_online $l_guest $l_g_user_s $l_online", + "LOGGED_IN_USER_LIST" => $userlist + )); $template->pparse("overall_header"); diff --git a/phpBB/index.php b/phpBB/index.php index 171d77eb36..44d128d821 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -105,10 +105,12 @@ if($total_categories) for($i = 0; $i < $total_categories; $i++) { + $template->assign_block_vars("catrow", array( "CAT_ID" => $category_rows[$i]["cat_id"], - "CAT_DESC" => stripslashes($category_rows[$i]["cat_title"]) + "CAT_DESC" => stripslashes($category_rows[$i]["cat_title"]), + "U_VIEWCAT" => "index." . $phpEx . "?viewcat=" . $category_rows[$i]['cat_id'] ) ); @@ -159,16 +161,19 @@ if($total_categories) $moderators_links .= "".$forum_mods["forum_".$forum_rows[$j]["forum_id"]."_name"][$mods].""; } - $template->assign_block_vars("catrow.forumrow", array("FOLDER" => $folder_image, - "FORUM_NAME" => stripslashes($forum_rows[$j]["forum_name"]), - "FORUM_ID" => $forum_rows[$j]["forum_id"], - "FORUM_DESC" => stripslashes($forum_rows[$j]["forum_desc"]), - "ROW_COLOR" => $row_color, - "POSTS" => $forum_rows[$j]["forum_posts"], - "TOPICS" => $forum_rows[$j]["forum_topics"], - "LAST_POST" => $last_post, - "MODERATORS" => $moderators_links)); - + $template->assign_block_vars("catrow.forumrow", + array( + "FOLDER" => $folder_image, + "FORUM_NAME" => stripslashes($forum_rows[$j]["forum_name"]), + "FORUM_DESC" => stripslashes($forum_rows[$j]["forum_desc"]), + "ROW_COLOR" => $row_color, + "POSTS" => $forum_rows[$j]["forum_posts"], + "TOPICS" => $forum_rows[$j]["forum_topics"], + "LAST_POST" => $last_post, + "MODERATORS" => $moderators_links, + + "U_VIEWFORUM" => "viewforum." . $phpEx . "?" . POST_FORUM_URL . "=" . $forum_rows[$j]['forum_id'] . "&" . $forum_rows[$j]['forum_posts']) + ); } } @@ -182,4 +187,4 @@ else $template->pparse("body"); include('includes/page_tail.'.$phpEx); -?> +?> \ No newline at end of file diff --git a/phpBB/language/lang_english.php b/phpBB/language/lang_english.php index 1eeae5a385..729aa99cb5 100755 --- a/phpBB/language/lang_english.php +++ b/phpBB/language/lang_english.php @@ -42,6 +42,16 @@ $l_emailaddress = "Email Address"; $l_preferences = "Preferences"; $l_welcometo = "Welcome to"; +$l_There = "There"; +$l_is = "is"; +$l_are = "are"; +$l_Registered = "Registered"; +$l_online = "online"; +$l_users = "users"; +$l_user = "user"; +$l_and = "and"; +$l_None = "None"; + $l_log_me_in = "Log me in automatically"; $l_all_times = "All times are"; diff --git a/phpBB/templates/Default/index_body.tpl b/phpBB/templates/Default/index_body.tpl index e2fadd0f3c..a3a0def4f4 100644 --- a/phpBB/templates/Default/index_body.tpl +++ b/phpBB/templates/Default/index_body.tpl @@ -1,35 +1,34 @@ - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
 {L_FORUM}{L_TOPICS}{L_POSTS}{L_LASTPOST}{L_MODERATOR}
{catrow.CAT_DESC}
{catrow.forumrow.FOLDER}{catrow.forumrow.FORUM_NAME}
{catrow.forumrow.FORUM_DESC}
{catrow.forumrow.TOPICS}{catrow.forumrow.POSTS}{catrow.forumrow.LAST_POST}{catrow.forumrow.MODERATORS}
-
- - + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
 {L_FORUM}{L_TOPICS}{L_POSTS}{L_LASTPOST}{L_MODERATOR}
{catrow.CAT_DESC}
{catrow.forumrow.FOLDER}{catrow.forumrow.FORUM_NAME}
{catrow.forumrow.FORUM_DESC}
{catrow.forumrow.TOPICS}{catrow.forumrow.POSTS}{catrow.forumrow.LAST_POST}{catrow.forumrow.MODERATORS}
{TOTAL_USERS_ONLINE}
{LOGGED_IN_USER_LIST}
+ \ No newline at end of file