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,