1.1 --- a/includes/functions.php Sat Mar 10 00:11:31 2012 +0400
1.2 +++ b/includes/functions.php Sat Mar 10 00:18:56 2012 +0400
1.3 @@ -4126,6 +4126,62 @@
1.4 return $online_users;
1.5 }
1.6
1.7 +function obtain_civil_server_users_online_string()
1.8 +{
1.9 + return obtain_game_server_users_online_string('CIVIL', CUBOMETRY_CIVIL_USERS_ONLINE);
1.10 +}
1.11 +
1.12 +function obtain_wild_server_users_online_string()
1.13 +{
1.14 + return obtain_game_server_users_online_string('WILD', CUBOMETRY_WILD_USERS_ONLINE);
1.15 +}
1.16 +
1.17 +function obtain_test_server_users_online_string()
1.18 +{
1.19 + return obtain_game_server_users_online_string('TEST', CUBOMETRY_TEST_USERS_ONLINE);
1.20 +}
1.21 +
1.22 +function obtain_game_server_users_online_string($lang_server_type, $cubometry_users_online_table)
1.23 +{
1.24 + global $db, $user, $auth;
1.25 +
1.26 + $online_game_users = $user->lang['GAME_' . $lang_server_type . '_SERVER'] . ': <strong>';
1.27 + $cnt = 0;
1.28 +
1.29 + $sql = 'select count(*) as cnt from ' . $cubometry_users_online_table;
1.30 + $result = $db->sql_query($sql);
1.31 +
1.32 + while ($row = $db->sql_fetchrow($result))
1.33 + {
1.34 + $cnt = $row['cnt'];
1.35 + }
1.36 +
1.37 + $online_game_users .= $cnt . '</strong>';
1.38 + if($cnt != 0)
1.39 + {
1.40 + $online_game_users .= ' (';
1.41 +
1.42 + $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';
1.43 + $result = $db->sql_query($sql);
1.44 + $isFirst = true;
1.45 +
1.46 + while ($row = $db->sql_fetchrow($result))
1.47 + {
1.48 + if (!isset($online_users['hidden_users'][$row['user_id']]) || $auth->acl_get('u_viewonline'))
1.49 + {
1.50 + if(!$isFirst)
1.51 + $online_game_users .= ', ';
1.52 + $user_online_link = get_username_string(($row['user_type'] <> USER_IGNORE) ? 'full' : 'no_profile', $row['user_id'], $row['username'], $row['user_colour']);
1.53 + $online_game_users .= $user_online_link;
1.54 + $isFirst = false;
1.55 + }
1.56 + }
1.57 + $online_game_users .= ')';
1.58 + }
1.59 +
1.60 + return $online_game_users;
1.61 +}
1.62 +
1.63 /**
1.64 * Uses the result of obtain_users_online to generate a localized, readable representation.
1.65 * @param mixed $online_users result of obtain_users_online - array with user_id lists for total, hidden and visible users, and statistics
1.66 @@ -4431,6 +4487,9 @@
1.67
1.68 // Get users online list ... if required
1.69 $l_online_users = $online_userlist = $l_online_record = $l_online_time = '';
1.70 + $online_civil_server = '';
1.71 + $online_wild_server = '';
1.72 + $online_test_server = '';
1.73
1.74 if ($config['load_online'] && $config['load_online_time'] && $display_online_list)
1.75 {
1.76 @@ -4457,6 +4516,10 @@
1.77
1.78 $l_online_time = ($config['load_online_time'] == 1) ? 'VIEW_ONLINE_TIME' : 'VIEW_ONLINE_TIMES';
1.79 $l_online_time = sprintf($user->lang[$l_online_time], $config['load_online_time']);
1.80 +
1.81 + $online_civil_server = obtain_civil_server_users_online_string();
1.82 + $online_wild_server = obtain_wild_server_users_online_string();
1.83 + $online_test_server = obtain_test_server_users_online_string();
1.84 }
1.85
1.86 $l_privmsgs_text = $l_privmsgs_text_unread = '';
1.87 @@ -4556,6 +4619,9 @@
1.88 'TOTAL_USERS_ONLINE' => $l_online_users,
1.89 'LOGGED_IN_USER_LIST' => $online_userlist,
1.90 'RECORD_USERS' => $l_online_record,
1.91 + 'LOGGED_IN_CIVIL_SERVER' => $online_civil_server,
1.92 + 'LOGGED_IN_WILD_SERVER' => $online_wild_server,
1.93 + 'LOGGED_IN_TEST_SERVER' => $online_test_server,
1.94 'PRIVATE_MESSAGE_INFO' => $l_privmsgs_text,
1.95 'PRIVATE_MESSAGE_INFO_UNREAD' => $l_privmsgs_text_unread,
1.96