supernova-ws /
SuperNova
| 1 | <?php |
||
| 2 | |||
| 3 | /** |
||
| 4 | * records.php |
||
| 5 | * |
||
| 6 | * 2.0 - Full rewrite by Gorlum for http://supernova.ws |
||
| 7 | * 1.4st - Security checks & tests by Gorlum for http://supernova.ws |
||
| 8 | * @version 1.4 |
||
| 9 | * @copyright 2008 by Chlorel for XNova |
||
| 10 | */ |
||
| 11 | |||
| 12 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
||
| 13 | |||
| 14 | if(HIDE_BUILDING_RECORDS) |
||
| 15 | { |
||
| 16 | return; |
||
| 17 | } |
||
| 18 | |||
| 19 | $template = SnTemplate::gettemplate('records', true); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 20 | |||
| 21 | $user_skip_list_data = sys_stat_get_user_skip_list(); |
||
| 22 | $user_skip_list = empty($user_skip_list_data) ? '' : (' AND p.id_owner NOT IN (' . implode(',', $user_skip_list_data) . ')'); |
||
| 23 | $user_skip_list_un = empty($user_skip_list_data) ? '' : (' AND un.unit_player_id NOT IN (' . implode(',', $user_skip_list_data) . ')'); |
||
| 24 | |||
| 25 | $user_skip_list_unit = empty($user_skip_list_data) ? '' : (' AND unit_player_id NOT IN (' . implode(',', $user_skip_list_data) . ')'); |
||
| 26 | |||
| 27 | $show_groups = array( |
||
| 28 | UNIT_TECHNOLOGIES => 'tech', |
||
| 29 | UNIT_STRUCTURES => 'structures', |
||
| 30 | UNIT_STRUCTURES_SPECIAL => 'structures', |
||
| 31 | UNIT_SHIPS => 'fleet', |
||
| 32 | UNIT_DEFENCE => 'defense', |
||
| 33 | ); |
||
| 34 | |||
| 35 | $user_name_cache = array(); |
||
| 36 | |||
| 37 | foreach($show_groups as $unit_group_id => $mode) |
||
| 38 | { |
||
| 39 | $template->assign_block_vars('records', array( |
||
| 40 | 'UNIT' => $lang['tech'][$unit_group_id], |
||
| 41 | 'COUNT' => in_array($unit_group_id, array(UNIT_STRUCTURES, UNIT_STRUCTURES_SPECIAL, UNIT_TECHNOLOGIES)) ? $lang['sys_level_max'] : $lang['sys_quantity_total'], |
||
| 42 | 'HEADER' => true, |
||
| 43 | )); |
||
| 44 | $unit_group = get_unit_param('techtree', $unit_group_id); // TODO - REWRITE!!!! |
||
| 45 | |||
| 46 | foreach($unit_group as $unit_id) |
||
| 47 | { |
||
| 48 | $unit_name = &$lang['tech'][$unit_id]; |
||
| 49 | if($unit_name) |
||
| 50 | { |
||
| 51 | // TODO - ISUNITSTACKABLE! |
||
| 52 | $data_row = $unit_group_id == UNIT_SHIPS || $unit_group_id == UNIT_DEFENCE ? db_unit_records_sum($unit_id, $user_skip_list_unit) : db_unit_records_plain($unit_id, $user_skip_list_unit); |
||
| 53 | |||
| 54 | if($data_row) |
||
| 55 | { |
||
| 56 | $template->assign_block_vars('records', array( |
||
| 57 | 'UNIT' => $unit_name, |
||
| 58 | 'USER' => $data_row['username'] ? js_safe_string($data_row['username']) : $lang['rec_rien'], |
||
| 59 | 'COUNT' => $data_row['unit_level'] ? HelperString::numberFloorAndFormat($data_row['unit_level']) : $lang['rec_rien'], |
||
| 60 | )); |
||
| 61 | } |
||
| 62 | } |
||
| 63 | } |
||
| 64 | } |
||
| 65 | |||
| 66 | SnTemplate::display($template, $lang['rec_title']); |
||
| 67 |