mirror of
https://github.com/phpbb/phpbb.git
synced 2025-03-13 20:28:44 +01:00
Added online users output to page header and from that, index
git-svn-id: file:///svn/phpbb/trunk@209 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
ec21217a2a
commit
0e2d4c9903
@ -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");
|
||||
|
||||
|
@ -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);
|
||||
?>
|
||||
?>
|
@ -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";
|
||||
|
@ -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>
|
Loading…
x
Reference in New Issue
Block a user