4124 $db->sql_freeresult($result); |
4124 $db->sql_freeresult($result); |
4125 |
4125 |
4126 return $online_users; |
4126 return $online_users; |
4127 } |
4127 } |
4128 |
4128 |
|
4129 function obtain_civil_server_users_online_string() |
|
4130 { |
|
4131 return obtain_game_server_users_online_string('CIVIL', CUBOMETRY_CIVIL_USERS_ONLINE); |
|
4132 } |
|
4133 |
|
4134 function obtain_wild_server_users_online_string() |
|
4135 { |
|
4136 return obtain_game_server_users_online_string('WILD', CUBOMETRY_WILD_USERS_ONLINE); |
|
4137 } |
|
4138 |
|
4139 function obtain_test_server_users_online_string() |
|
4140 { |
|
4141 return obtain_game_server_users_online_string('TEST', CUBOMETRY_TEST_USERS_ONLINE); |
|
4142 } |
|
4143 |
|
4144 function obtain_game_server_users_online_string($lang_server_type, $cubometry_users_online_table) |
|
4145 { |
|
4146 global $db, $user, $auth; |
|
4147 |
|
4148 $online_game_users = $user->lang['GAME_' . $lang_server_type . '_SERVER'] . ': <strong>'; |
|
4149 $cnt = 0; |
|
4150 |
|
4151 $sql = 'select count(*) as cnt from ' . $cubometry_users_online_table; |
|
4152 $result = $db->sql_query($sql); |
|
4153 |
|
4154 while ($row = $db->sql_fetchrow($result)) |
|
4155 { |
|
4156 $cnt = $row['cnt']; |
|
4157 } |
|
4158 |
|
4159 $online_game_users .= $cnt . '</strong>'; |
|
4160 if($cnt != 0) |
|
4161 { |
|
4162 $online_game_users .= ' ('; |
|
4163 |
|
4164 $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'; |
|
4165 $result = $db->sql_query($sql); |
|
4166 $isFirst = true; |
|
4167 |
|
4168 while ($row = $db->sql_fetchrow($result)) |
|
4169 { |
|
4170 if (!isset($online_users['hidden_users'][$row['user_id']]) || $auth->acl_get('u_viewonline')) |
|
4171 { |
|
4172 if(!$isFirst) |
|
4173 $online_game_users .= ', '; |
|
4174 $user_online_link = get_username_string(($row['user_type'] <> USER_IGNORE) ? 'full' : 'no_profile', $row['user_id'], $row['username'], $row['user_colour']); |
|
4175 $online_game_users .= $user_online_link; |
|
4176 $isFirst = false; |
|
4177 } |
|
4178 } |
|
4179 $online_game_users .= ')'; |
|
4180 } |
|
4181 |
|
4182 return $online_game_users; |
|
4183 } |
|
4184 |
4129 /** |
4185 /** |
4130 * Uses the result of obtain_users_online to generate a localized, readable representation. |
4186 * Uses the result of obtain_users_online to generate a localized, readable representation. |
4131 * @param mixed $online_users result of obtain_users_online - array with user_id lists for total, hidden and visible users, and statistics |
4187 * @param mixed $online_users result of obtain_users_online - array with user_id lists for total, hidden and visible users, and statistics |
4132 * @param int $item_id Indicate that the data is limited to one item and not global |
4188 * @param int $item_id Indicate that the data is limited to one item and not global |
4133 * @param string $item The name of the item which is stored in the session table as session_{$item}_id |
4189 * @param string $item The name of the item which is stored in the session table as session_{$item}_id |
4429 // Last visit date/time |
4485 // Last visit date/time |
4430 $s_last_visit = ($user->data['user_id'] != ANONYMOUS) ? $user->format_date($user->data['session_last_visit']) : ''; |
4486 $s_last_visit = ($user->data['user_id'] != ANONYMOUS) ? $user->format_date($user->data['session_last_visit']) : ''; |
4431 |
4487 |
4432 // Get users online list ... if required |
4488 // Get users online list ... if required |
4433 $l_online_users = $online_userlist = $l_online_record = $l_online_time = ''; |
4489 $l_online_users = $online_userlist = $l_online_record = $l_online_time = ''; |
|
4490 $online_civil_server = ''; |
|
4491 $online_wild_server = ''; |
|
4492 $online_test_server = ''; |
4434 |
4493 |
4435 if ($config['load_online'] && $config['load_online_time'] && $display_online_list) |
4494 if ($config['load_online'] && $config['load_online_time'] && $display_online_list) |
4436 { |
4495 { |
4437 /** |
4496 /** |
4438 * Load online data: |
4497 * Load online data: |
4455 |
4514 |
4456 $l_online_record = sprintf($user->lang['RECORD_ONLINE_USERS'], $config['record_online_users'], $user->format_date($config['record_online_date'], false, true)); |
4515 $l_online_record = sprintf($user->lang['RECORD_ONLINE_USERS'], $config['record_online_users'], $user->format_date($config['record_online_date'], false, true)); |
4457 |
4516 |
4458 $l_online_time = ($config['load_online_time'] == 1) ? 'VIEW_ONLINE_TIME' : 'VIEW_ONLINE_TIMES'; |
4517 $l_online_time = ($config['load_online_time'] == 1) ? 'VIEW_ONLINE_TIME' : 'VIEW_ONLINE_TIMES'; |
4459 $l_online_time = sprintf($user->lang[$l_online_time], $config['load_online_time']); |
4518 $l_online_time = sprintf($user->lang[$l_online_time], $config['load_online_time']); |
|
4519 |
|
4520 $online_civil_server = obtain_civil_server_users_online_string(); |
|
4521 $online_wild_server = obtain_wild_server_users_online_string(); |
|
4522 $online_test_server = obtain_test_server_users_online_string(); |
4460 } |
4523 } |
4461 |
4524 |
4462 $l_privmsgs_text = $l_privmsgs_text_unread = ''; |
4525 $l_privmsgs_text = $l_privmsgs_text_unread = ''; |
4463 $s_privmsg_new = false; |
4526 $s_privmsg_new = false; |
4464 |
4527 |
4554 'LAST_VISIT_YOU' => $s_last_visit, |
4617 'LAST_VISIT_YOU' => $s_last_visit, |
4555 'CURRENT_TIME' => sprintf($user->lang['CURRENT_TIME'], $user->format_date(time(), false, true)), |
4618 'CURRENT_TIME' => sprintf($user->lang['CURRENT_TIME'], $user->format_date(time(), false, true)), |
4556 'TOTAL_USERS_ONLINE' => $l_online_users, |
4619 'TOTAL_USERS_ONLINE' => $l_online_users, |
4557 'LOGGED_IN_USER_LIST' => $online_userlist, |
4620 'LOGGED_IN_USER_LIST' => $online_userlist, |
4558 'RECORD_USERS' => $l_online_record, |
4621 'RECORD_USERS' => $l_online_record, |
|
4622 'LOGGED_IN_CIVIL_SERVER' => $online_civil_server, |
|
4623 'LOGGED_IN_WILD_SERVER' => $online_wild_server, |
|
4624 'LOGGED_IN_TEST_SERVER' => $online_test_server, |
4559 'PRIVATE_MESSAGE_INFO' => $l_privmsgs_text, |
4625 'PRIVATE_MESSAGE_INFO' => $l_privmsgs_text, |
4560 'PRIVATE_MESSAGE_INFO_UNREAD' => $l_privmsgs_text_unread, |
4626 'PRIVATE_MESSAGE_INFO_UNREAD' => $l_privmsgs_text_unread, |
4561 |
4627 |
4562 'S_USER_NEW_PRIVMSG' => $user->data['user_new_privmsg'], |
4628 'S_USER_NEW_PRIVMSG' => $user->data['user_new_privmsg'], |
4563 'S_USER_UNREAD_PRIVMSG' => $user->data['user_unread_privmsg'], |
4629 'S_USER_UNREAD_PRIVMSG' => $user->data['user_unread_privmsg'], |