# HG changeset patch # User indvdum (gotoindvdum[at]gmail[dot]com) # Date 1331324336 -14400 # Node ID 8804e4d3de749f6019ca15ab210b9a6d3427d5d6 # Parent 88d35b740f201c6c5669c76ba4fa50fce9b5093b Added online gamers diff -r 88d35b740f20 -r 8804e4d3de74 config.php --- a/config.php Sat Mar 10 00:11:31 2012 +0400 +++ b/config.php Sat Mar 10 00:18:56 2012 +0400 @@ -8,10 +8,13 @@ $dbuser = 'phpbb3'; $dbpasswd = 'kbyerc4you'; $table_prefix = 'phpbb_'; +$cubometry_civil_database_scheme = 'cubometry_civil'; +$cubometry_wild_database_scheme = 'cubometry_wild'; +$cubometry_test_database_scheme = 'cubometry_test'; $acm_type = 'file'; $load_extensions = ''; @define('PHPBB_INSTALLED', true); // @define('DEBUG', true); // @define('DEBUG_EXTRA', true); -?> \ No newline at end of file +?> diff -r 88d35b740f20 -r 8804e4d3de74 includes/constants.php --- a/includes/constants.php Sat Mar 10 00:11:31 2012 +0400 +++ b/includes/constants.php Sat Mar 10 00:18:56 2012 +0400 @@ -278,5 +278,8 @@ // Additional tables +define('CUBOMETRY_CIVIL_USERS_ONLINE', $cubometry_civil_database_scheme . '.cubometry_users_online'); +define('CUBOMETRY_WILD_USERS_ONLINE', $cubometry_wild_database_scheme . '.cubometry_users_online'); +define('CUBOMETRY_TEST_USERS_ONLINE', $cubometry_test_database_scheme . '.cubometry_users_online'); ?> diff -r 88d35b740f20 -r 8804e4d3de74 includes/functions.php --- a/includes/functions.php Sat Mar 10 00:11:31 2012 +0400 +++ b/includes/functions.php Sat Mar 10 00:18:56 2012 +0400 @@ -4126,6 +4126,62 @@ return $online_users; } +function obtain_civil_server_users_online_string() +{ + return obtain_game_server_users_online_string('CIVIL', CUBOMETRY_CIVIL_USERS_ONLINE); +} + +function obtain_wild_server_users_online_string() +{ + return obtain_game_server_users_online_string('WILD', CUBOMETRY_WILD_USERS_ONLINE); +} + +function obtain_test_server_users_online_string() +{ + return obtain_game_server_users_online_string('TEST', CUBOMETRY_TEST_USERS_ONLINE); +} + +function obtain_game_server_users_online_string($lang_server_type, $cubometry_users_online_table) +{ + global $db, $user, $auth; + + $online_game_users = $user->lang['GAME_' . $lang_server_type . '_SERVER'] . ': '; + $cnt = 0; + + $sql = 'select count(*) as cnt from ' . $cubometry_users_online_table; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $cnt = $row['cnt']; + } + + $online_game_users .= $cnt . ''; + if($cnt != 0) + { + $online_game_users .= ' ('; + + $sql = 'select pu.* from ' . $cubometry_users_online_table . ' uo inner join ' . USERS_TABLE . ' pu on pu.user_id = uo.user_id order by username_clean asc'; + $result = $db->sql_query($sql); + $isFirst = true; + + while ($row = $db->sql_fetchrow($result)) + { + if (!isset($online_users['hidden_users'][$row['user_id']]) || $auth->acl_get('u_viewonline')) + { + if(!$isFirst) + $online_game_users .= ', '; + $user_online_link = get_username_string(($row['user_type'] <> USER_IGNORE) ? 'full' : 'no_profile', $row['user_id'], $row['username'], $row['user_colour']); + $online_game_users .= $user_online_link; + $isFirst = false; + } + } + $online_game_users .= ')'; + } + + return $online_game_users; +} + /** * Uses the result of obtain_users_online to generate a localized, readable representation. * @param mixed $online_users result of obtain_users_online - array with user_id lists for total, hidden and visible users, and statistics @@ -4431,6 +4487,9 @@ // Get users online list ... if required $l_online_users = $online_userlist = $l_online_record = $l_online_time = ''; + $online_civil_server = ''; + $online_wild_server = ''; + $online_test_server = ''; if ($config['load_online'] && $config['load_online_time'] && $display_online_list) { @@ -4457,6 +4516,10 @@ $l_online_time = ($config['load_online_time'] == 1) ? 'VIEW_ONLINE_TIME' : 'VIEW_ONLINE_TIMES'; $l_online_time = sprintf($user->lang[$l_online_time], $config['load_online_time']); + + $online_civil_server = obtain_civil_server_users_online_string(); + $online_wild_server = obtain_wild_server_users_online_string(); + $online_test_server = obtain_test_server_users_online_string(); } $l_privmsgs_text = $l_privmsgs_text_unread = ''; @@ -4556,6 +4619,9 @@ 'TOTAL_USERS_ONLINE' => $l_online_users, 'LOGGED_IN_USER_LIST' => $online_userlist, 'RECORD_USERS' => $l_online_record, + 'LOGGED_IN_CIVIL_SERVER' => $online_civil_server, + 'LOGGED_IN_WILD_SERVER' => $online_wild_server, + 'LOGGED_IN_TEST_SERVER' => $online_test_server, 'PRIVATE_MESSAGE_INFO' => $l_privmsgs_text, 'PRIVATE_MESSAGE_INFO_UNREAD' => $l_privmsgs_text_unread, diff -r 88d35b740f20 -r 8804e4d3de74 language/en/common.php --- a/language/en/common.php Sat Mar 10 00:11:31 2012 +0400 +++ b/language/en/common.php Sat Mar 10 00:18:56 2012 +0400 @@ -229,6 +229,10 @@ 'FTP_USERNAME' => 'FTP username', 'FTP_USERNAME_EXPLAIN' => 'Username used to connect to your server.', + 'GAME_WHO_IS_ONLINE' => 'Who is game online', + 'GAME_CIVIL_SERVER' => 'Standard server', + 'GAME_WILD_SERVER' => 'Wild server', + 'GAME_TEST_SERVER' => 'Test server', 'GENERAL_ERROR' => 'General Error', 'GB' => 'GB', 'GIB' => 'GiB', diff -r 88d35b740f20 -r 8804e4d3de74 language/ru/common.php --- a/language/ru/common.php Sat Mar 10 00:11:31 2012 +0400 +++ b/language/ru/common.php Sat Mar 10 00:18:56 2012 +0400 @@ -229,6 +229,10 @@ 'FTP_USERNAME' => 'Имя пользователя FTP', 'FTP_USERNAME_EXPLAIN' => 'Имя пользователя для соединения с FTP-сервером.', + 'GAME_WHO_IS_ONLINE' => 'Кто сейчас в игре', + 'GAME_CIVIL_SERVER' => 'Стандартный сервер', + 'GAME_WILD_SERVER' => 'Дикий сервер', + 'GAME_TEST_SERVER' => 'Тестовый сервер', 'GENERAL_ERROR' => 'Общая ошибка', 'GB' => 'ГБ', 'GIB' => 'ГБ', diff -r 88d35b740f20 -r 8804e4d3de74 styles/prosilver/template/index_body.html --- a/styles/prosilver/template/index_body.html Sat Mar 10 00:11:31 2012 +0400 +++ b/styles/prosilver/template/index_body.html Sat Mar 10 00:18:56 2012 +0400 @@ -30,6 +30,11 @@ +
{LOGGED_IN_CIVIL_SERVER}
+{LOGGED_IN_WILD_SERVER}
+{LOGGED_IN_TEST_SERVER}
+{TOTAL_USERS_ONLINE} ({L_ONLINE_EXPLAIN})
{RECORD_USERS}
{LOGGED_IN_USER_LIST}
{L_LEGEND}: {LEGEND}