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