diff options
| author | Paul S. Owen <psotfx@users.sourceforge.net> | 2001-04-28 20:14:05 +0000 |
|---|---|---|
| committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2001-04-28 20:14:05 +0000 |
| commit | 0e2d4c99030d61e14d2062a6ee5d3dbba6830065 (patch) | |
| tree | d9ced1af757820e2a970dca92bffa59b267fc8a0 /phpBB | |
| parent | ec21217a2ae82225e3cdfede7d36a414c2cf136e (diff) | |
| download | forums-0e2d4c99030d61e14d2062a6ee5d3dbba6830065.tar forums-0e2d4c99030d61e14d2062a6ee5d3dbba6830065.tar.gz forums-0e2d4c99030d61e14d2062a6ee5d3dbba6830065.tar.bz2 forums-0e2d4c99030d61e14d2062a6ee5d3dbba6830065.tar.xz forums-0e2d4c99030d61e14d2062a6ee5d3dbba6830065.zip | |
Added online users output to page header and from that, index
git-svn-id: file:///svn/phpbb/trunk@209 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB')
| -rw-r--r-- | phpBB/includes/page_header.php | 47 | ||||
| -rw-r--r-- | phpBB/index.php | 29 | ||||
| -rwxr-xr-x | phpBB/language/lang_english.php | 10 | ||||
| -rw-r--r-- | phpBB/templates/Default/index_body.tpl | 67 |
4 files changed, 106 insertions, 47 deletions
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 .= "<a href=\"profile." . $phpEx . "?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id'] . "\">" . $row['username'] . "</a>"; + $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 .= "<a href=\"profile.$phpEx?mode=viewprofile&".POST_USERS_URL."=".$forum_mods["forum_".$forum_rows[$j]["forum_id"]."_id"][$mods]."\">".$forum_mods["forum_".$forum_rows[$j]["forum_id"]."_name"][$mods]."</a>"; } - $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 @@ <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 width="5%"> </td> - <td>{L_FORUM}</td> - <td align="center" width="5%">{L_TOPICS}</td> - <td align="center" width="5%">{L_POSTS}</td> - <td align="center" width="15%">{L_LASTPOST}</td> - <td align="center" width="5%">{L_MODERATOR}</td> - </tr> - <!-- BEGIN catrow --> - <tr class="catheader"> - <td colspan="6"><a href="{catrow.PHP_SELF}?viewcat={catrow.CAT_ID}">{catrow.CAT_DESC}</a></td> - </tr> - <!-- BEGIN forumrow --> - <tr bgcolor="{catrow.forumrow.ROW_COLOR}" class="tablebody"> - <td width="5%" align="center" valign="middle">{catrow.forumrow.FOLDER}</td> - <td><a href="viewforum.{PHPEX}?{S_FORUMS_URL}={catrow.forumrow.FORUM_ID}&{catrow.forumrow.POSTS}">{catrow.forumrow.FORUM_NAME}</a><br>{catrow.forumrow.FORUM_DESC}</td> - <td width="5%" align="center" valign="middle">{catrow.forumrow.TOPICS}</td> - <td width="5%" align="center" valign="middle">{catrow.forumrow.POSTS}</td> - <td width="15%" align="center" valign="middle">{catrow.forumrow.LAST_POST}</td> - <td width="5%" align="center" valign="middle">{catrow.forumrow.MODERATORS}</td> - </tr> - <!-- END forumrow --> - <!-- END catrow --> - </table> - </td> - </tr> - </table> - </td> -</tr> + <td bgcolor="#000000" align="center"><table width="100%" cellpadding="0" cellspacing="1" border="0"> + <tr> + <td><table width="100%" cellpadding="3" cellspacing="1" border="0"> + <tr class="tableheader"> + <td width="5%"> </td> + <td>{L_FORUM}</td> + <td align="center" width="5%">{L_TOPICS}</td> + <td align="center" width="5%">{L_POSTS}</td> + <td align="center" width="15%">{L_LASTPOST}</td> + <td align="center" width="5%">{L_MODERATOR}</td> + </tr> + <!-- BEGIN catrow --> + <tr class="catheader"> + <td colspan="6"><a href="">{catrow.CAT_DESC}</a></td> + </tr> + <!-- BEGIN forumrow --> + <tr bgcolor="{catrow.forumrow.ROW_COLOR}" class="tablebody"> + <td width="5%" align="center" valign="middle">{catrow.forumrow.FOLDER}</td> + <td><a href="{catrow.forumrow.U_VIEWFORUM}">{catrow.forumrow.FORUM_NAME}</a><br>{catrow.forumrow.FORUM_DESC}</td> + <td width="5%" align="center" valign="middle">{catrow.forumrow.TOPICS}</td> + <td width="5%" align="center" valign="middle">{catrow.forumrow.POSTS}</td> + <td width="15%" align="center" valign="middle">{catrow.forumrow.LAST_POST}</td> + <td width="5%" align="center" valign="middle">{catrow.forumrow.MODERATORS}</td> + </tr> + <!-- END forumrow --> + <!-- END catrow --> + <tr class="catheader"> + <td colspan="6">{TOTAL_USERS_ONLINE}<br/>{LOGGED_IN_USER_LIST}</td> + </tr> + </table></td> + </tr> + </table></td> +</tr>
\ No newline at end of file |
