mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
Implemented Record of online users
git-svn-id: file:///svn/phpbb/trunk@1954 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
cd354884f6
commit
deacb5ae87
5 changed files with 49 additions and 1 deletions
|
@ -53,6 +53,8 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('privmsg_disable','
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('gzip_compress','0');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('gzip_compress','0');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_fax', '');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_fax', '');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_mail', '');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_mail', '');
|
||||||
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('record_online_users', '0');
|
||||||
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('record_online_date', '0');
|
||||||
|
|
||||||
|
|
||||||
# -- Categories
|
# -- Categories
|
||||||
|
|
|
@ -54,6 +54,8 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('privmsg_disable','
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('gzip_compress','0');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('gzip_compress','0');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_fax', '');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_fax', '');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_mail', '');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('coppa_mail', '');
|
||||||
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('record_online_users', '0');
|
||||||
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('record_online_date', '0');
|
||||||
|
|
||||||
|
|
||||||
-- Categories
|
-- Categories
|
||||||
|
|
|
@ -161,6 +161,48 @@ while( $row = $db->sql_fetchrow($result) )
|
||||||
$prev_user_id = $row['user_id'];
|
$prev_user_id = $row['user_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// This block of INSERTs is only here for people that are running RC1 or RC2 of phpBB2.
|
||||||
|
// Can be removed after most of those users have migrated to a version that has inserted
|
||||||
|
// the needed conifg keys.
|
||||||
|
//
|
||||||
|
if(!isset($board_config['record_online_users']) )
|
||||||
|
{
|
||||||
|
$sql = "INSERT INTO ". CONFIG_TABLE ."
|
||||||
|
(config_name, config_value) VALUES ('record_online_users', '".$total_online_users."')";
|
||||||
|
if( !$result = $db->sql_query($sql) )
|
||||||
|
{
|
||||||
|
message_die(GENERAL_ERROR, "Couldn't insert config key 'record_online_users'", "", __LINE__, __FILE__, $sql);
|
||||||
|
}
|
||||||
|
$sql = "INSERT INTO ". CONFIG_TABLE ."
|
||||||
|
(config_name, config_value) VALUES ('record_online_date', '".time()."')";
|
||||||
|
if( !$result = $db->sql_query($sql) )
|
||||||
|
{
|
||||||
|
message_die(GENERAL_ERROR, "Couldn't insert config key 'record_online_date'", "", __LINE__, __FILE__, $sql);
|
||||||
|
}
|
||||||
|
$board_config['record_online_users'] = $total_online_users;
|
||||||
|
$board_config['record_online_date'] = time();
|
||||||
|
}
|
||||||
|
else if($total_online_users > $board_config['record_online_users'])
|
||||||
|
{
|
||||||
|
$sql = "UPDATE " . CONFIG_TABLE . "
|
||||||
|
SET config_value = '$total_online_users'
|
||||||
|
WHERE config_name = 'record_online_users'";
|
||||||
|
if( !$result = $db->sql_query($sql) )
|
||||||
|
{
|
||||||
|
message_die(GENERAL_ERROR, "Couldn't update online user record (nr of users)", "", __LINE__, __FILE__, $sql);
|
||||||
|
}
|
||||||
|
$sql = "UPDATE " . CONFIG_TABLE . "
|
||||||
|
SET config_value = '" . time() . "'
|
||||||
|
WHERE config_name = 'record_online_date'";
|
||||||
|
if( !$result = $db->sql_query($sql) )
|
||||||
|
{
|
||||||
|
message_die(GENERAL_ERROR, "Couldn't update online user record (date)", "", __LINE__, __FILE__, $sql);
|
||||||
|
}
|
||||||
|
$board_config['record_online_users'] = $total_online_users;
|
||||||
|
$board_config['record_online_date'] = time();
|
||||||
|
}
|
||||||
|
|
||||||
$online_userlist = $lang['Registered_users'] . " " . $online_userlist;
|
$online_userlist = $lang['Registered_users'] . " " . $online_userlist;
|
||||||
|
|
||||||
$total_online_users = $logged_visible_online + $logged_hidden_online + $guests_online;
|
$total_online_users = $logged_visible_online + $logged_hidden_online + $guests_online;
|
||||||
|
@ -359,6 +401,7 @@ $template->assign_vars(array(
|
||||||
"L_SEARCH_SELF" => $lang['Search_your_posts'],
|
"L_SEARCH_SELF" => $lang['Search_your_posts'],
|
||||||
"L_WHOSONLINE_ADMIN" => sprintf($lang['Admin_online_color'], '<span style="color:' . $theme['fontcolor3'] . '">', '</span>'),
|
"L_WHOSONLINE_ADMIN" => sprintf($lang['Admin_online_color'], '<span style="color:' . $theme['fontcolor3'] . '">', '</span>'),
|
||||||
"L_WHOSONLINE_MOD" => sprintf($lang['Mod_online_color'], '<span style="color:' . $theme['fontcolor2'] . '">', '</span>'),
|
"L_WHOSONLINE_MOD" => sprintf($lang['Mod_online_color'], '<span style="color:' . $theme['fontcolor2'] . '">', '</span>'),
|
||||||
|
"L_RECORD_USERS" => sprintf($lang['Record_online_users'], $board_config['record_online_users'], date($lang['DATE_FORMAT'], $board_config['record_online_date']) ),
|
||||||
|
|
||||||
"U_SEARCH_UNANSWERED" => append_sid("search.".$phpEx."?search_id=unanswered"),
|
"U_SEARCH_UNANSWERED" => append_sid("search.".$phpEx."?search_id=unanswered"),
|
||||||
"U_SEARCH_SELF" => append_sid("search.".$phpEx."?search_id=egosearch"),
|
"U_SEARCH_SELF" => append_sid("search.".$phpEx."?search_id=egosearch"),
|
||||||
|
|
|
@ -132,6 +132,7 @@ $lang['Hidden_users_total'] = "%d Hidden and ";
|
||||||
$lang['Guest_users_zero_total'] = "0 Guests";
|
$lang['Guest_users_zero_total'] = "0 Guests";
|
||||||
$lang['Guest_users_total'] = "%d Guests";
|
$lang['Guest_users_total'] = "%d Guests";
|
||||||
$lang['Guest_user_total'] = "%d Guest";
|
$lang['Guest_user_total'] = "%d Guest";
|
||||||
|
$lang['Record_online_users'] = "Most users ever online was <b>%s</b> on %s"; // first %s = number of users, second %s is the date.
|
||||||
|
|
||||||
$lang['Admin_online_color'] = "%sAdministrator%s";
|
$lang['Admin_online_color'] = "%sAdministrator%s";
|
||||||
$lang['Mod_online_color'] = "%sModerator%s";
|
$lang['Mod_online_color'] = "%sModerator%s";
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="row1" align="left"><span class="gensmall">{TOTAL_USERS_ONLINE} [ {L_WHOSONLINE_ADMIN} ] [ {L_WHOSONLINE_MOD} ]<br />{LOGGED_IN_USER_LIST}</span></td>
|
<td class="row1" align="left"><span class="gensmall">{TOTAL_USERS_ONLINE} [ {L_WHOSONLINE_ADMIN} ] [ {L_WHOSONLINE_MOD} ]<br />{L_RECORD_USERS}<br />{LOGGED_IN_USER_LIST}</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue