@@ -39,8 +39,8 @@ |
||
39 | 39 | 0 => $row['visit_time'], // start |
40 | 40 | 1 => $row['visit_time'], // end |
41 | 41 | ) |
42 | - //: false |
|
43 | - ; |
|
42 | + //: false |
|
43 | + ; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | $session_list = array(); |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | // define('SESSION_INTERRUPT', 15*60); // Можно увеличить до 4 часов - никито не может сидеть 2 суток с перерывом менее 4 часов |
20 | 20 | // define('SUSPICIOUS_LONG', 2 * 60*60); // Тогда это увеличиваем до, скажем суток - и там смотрим |
21 | 21 | |
22 | -define('SESSION_INTERRUPT', 1 * 60*60); // Можно увеличить до 4 часов - никито не может сидеть 2 суток с перерывом менее 4 часов |
|
23 | -define('SUSPICIOUS_LONG', 16 * 60*60); // Тогда это увеличиваем до, скажем суток - и там смотрим |
|
22 | +define('SESSION_INTERRUPT', 1 * 60 * 60); // Можно увеличить до 4 часов - никито не может сидеть 2 суток с перерывом менее 4 часов |
|
23 | +define('SUSPICIOUS_LONG', 16 * 60 * 60); // Тогда это увеличиваем до, скажем суток - и там смотрим |
|
24 | 24 | |
25 | 25 | |
26 | 26 | function check_suspicious(&$session, &$session_list_last_id, &$row) { |
27 | 27 | $session[2] = $session[1] - $session[0]; |
28 | - if($session[2] > SUSPICIOUS_LONG) |
|
28 | + if ($session[2] > SUSPICIOUS_LONG) |
|
29 | 29 | { |
30 | 30 | $session[2] = pretty_time($session[2]); |
31 | 31 | $session[0] = date(FMT_DATE_TIME_SQL, $session[0]); |
@@ -46,24 +46,24 @@ discard block |
||
46 | 46 | $session_list = array(); |
47 | 47 | $query = doquery("SELECT `visit_time`, user_id FROM {{counter}} where user_id <> 0 and visit_time > UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 7 DAY)) order by user_id, visit_time;"); |
48 | 48 | $session = array(); |
49 | -if($row = db_fetch($query)) { |
|
49 | +if ($row = db_fetch($query)) { |
|
50 | 50 | $session = array( |
51 | 51 | 0 => strtotime($row['visit_time']), // start |
52 | 52 | 1 => strtotime($row['visit_time']), // end |
53 | 53 | ); |
54 | 54 | $last_id = $row['user_id']; |
55 | 55 | } |
56 | -while($row = db_fetch($query)) { |
|
56 | +while ($row = db_fetch($query)) { |
|
57 | 57 | $row['visit_time'] = strtotime($row['visit_time']); |
58 | - if($last_id == $row['user_id']) { |
|
58 | + if ($last_id == $row['user_id']) { |
|
59 | 59 | // Тот же юзер |
60 | - if($row['visit_time'] - $session[1] <= SESSION_INTERRUPT) { // Та же сессия |
|
60 | + if ($row['visit_time'] - $session[1] <= SESSION_INTERRUPT) { // Та же сессия |
|
61 | 61 | $session[1] = $row['visit_time']; |
62 | 62 | } else { |
63 | 63 | // Новая сессия |
64 | 64 | // check_suspicious($session, $session_list[$last_id], $row); |
65 | 65 | $session[2] = $session[1] - $session[0]; |
66 | - if($session[2] > SUSPICIOUS_LONG) |
|
66 | + if ($session[2] > SUSPICIOUS_LONG) |
|
67 | 67 | { |
68 | 68 | $session[2] = pretty_time($session[2]); |
69 | 69 | $session[0] = date(FMT_DATE_TIME_SQL, $session[0]); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | } else { |
79 | 79 | // check_suspicious($session, $session_list[$last_id], $row); |
80 | 80 | $session[2] = $session[1] - $session[0]; |
81 | - if($session[2] > SUSPICIOUS_LONG) |
|
81 | + if ($session[2] > SUSPICIOUS_LONG) |
|
82 | 82 | { |
83 | 83 | $session[2] = pretty_time($session[2]); |
84 | 84 | $session[0] = date(FMT_DATE_TIME_SQL, $session[0]); |
@@ -93,11 +93,11 @@ discard block |
||
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | -if($last_id) { |
|
96 | +if ($last_id) { |
|
97 | 97 | // check_suspicious($session, $session_list[$last_id], $row = array('time' => 0)); |
98 | 98 | $session[2] = $session[1] - $session[0]; |
99 | 99 | |
100 | - if($session[2] > SUSPICIOUS_LONG) |
|
100 | + if ($session[2] > SUSPICIOUS_LONG) |
|
101 | 101 | { |
102 | 102 | $session[2] = pretty_time($session[2]); |
103 | 103 | $session[0] = date(FMT_DATE_TIME_SQL, $session[0]); |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | print("<td>ID</td><td>Username</td><td>Start</td><td>End</td><td>Length</td>"); |
112 | 112 | print("<td>Last online</td>"); |
113 | 113 | print("</tr>"); |
114 | -foreach($session_list as $user_id => $value) { |
|
114 | +foreach ($session_list as $user_id => $value) { |
|
115 | 115 | $user_record = doquery("SELECT `username`, onlinetime FROM {{users}} WHERE id = {$user_id};", true); |
116 | - foreach($value as $interval_data) { |
|
116 | + foreach ($value as $interval_data) { |
|
117 | 117 | print("<tr>"); |
118 | 118 | print("<td>{$user_id}</td><td>{$user_record['username']}</td><td>{$interval_data[0]}</td><td>{$interval_data[1]}</td><td>{$interval_data[2]}</td>"); |
119 | 119 | print("<td>" . date(FMT_DATE_TIME_SQL, $user_record['onlinetime']) . "</td>"); |
@@ -72,8 +72,7 @@ |
||
72 | 72 | if(sys_get_param('page_prev') && $int_page_current > 1) |
73 | 73 | { |
74 | 74 | $int_page_current--; |
75 | -} |
|
76 | -elseif(sys_get_param('page_next') && $int_page_current < $page_max) |
|
75 | +} elseif(sys_get_param('page_next') && $int_page_current < $page_max) |
|
77 | 76 | { |
78 | 77 | $int_page_current++; |
79 | 78 | } |
@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | * |
9 | 9 | */ |
10 | 10 | |
11 | -define('INSIDE' , true); |
|
12 | -define('INSTALL' , false); |
|
11 | +define('INSIDE', true); |
|
12 | +define('INSTALL', false); |
|
13 | 13 | define('IN_ADMIN', true); |
14 | 14 | |
15 | 15 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | ), |
29 | 29 | ); |
30 | 30 | $template->assign_block_vars('int_type_selected', $allowed_types[-1]); |
31 | -foreach($sn_message_class_list as $key => $value) |
|
31 | +foreach ($sn_message_class_list as $key => $value) |
|
32 | 32 | { |
33 | - if($key == MSG_TYPE_NEW || $key == MSG_TYPE_OUTBOX) |
|
33 | + if ($key == MSG_TYPE_NEW || $key == MSG_TYPE_OUTBOX) |
|
34 | 34 | { |
35 | 35 | continue; |
36 | 36 | } |
@@ -43,19 +43,19 @@ discard block |
||
43 | 43 | |
44 | 44 | |
45 | 45 | $message_delete = sys_get_param_id('msg_del'); |
46 | -if(sys_get_param('str_delete_selected') && is_array($message_delete = sys_get_param('selected')) && !empty($message_delete)) |
|
46 | +if (sys_get_param('str_delete_selected') && is_array($message_delete = sys_get_param('selected')) && !empty($message_delete)) |
|
47 | 47 | { |
48 | 48 | $message_delete = implode(', ', $message_delete); |
49 | 49 | } |
50 | 50 | |
51 | -if($message_delete) |
|
51 | +if ($message_delete) |
|
52 | 52 | { |
53 | 53 | doquery("DELETE FROM {{messages}} WHERE `message_id` in ({$message_delete});"); |
54 | 54 | $template->assign_block_vars('result', array('MESSAGE' => sprintf($lang['mlst_messages_deleted'], $message_delete))); |
55 | 55 | } |
56 | 56 | |
57 | 57 | |
58 | -if(sys_get_param('str_delete_date') && checkdate($month = sys_get_param_id('delete_month'), $day = sys_get_param_id('delete_day'), $year = sys_get_param_id('delete_year'))) |
|
58 | +if (sys_get_param('str_delete_date') && checkdate($month = sys_get_param_id('delete_month'), $day = sys_get_param_id('delete_day'), $year = sys_get_param_id('delete_year'))) |
|
59 | 59 | { |
60 | 60 | $delete_date = "{$year}-{$month}-{$day}"; |
61 | 61 | doquery("DELETE FROM {{messages}} WHERE message_time <= UNIX_TIMESTAMP('{$delete_date}')" . ($int_type_selected >= 0 ? " AND `message_type` = {$int_type_selected}" : '')); |
@@ -68,16 +68,16 @@ discard block |
||
68 | 68 | |
69 | 69 | $int_page_current = min(sys_get_param_id('int_page_current', 1), $page_max); |
70 | 70 | |
71 | -if(sys_get_param('page_prev') && $int_page_current > 1) |
|
71 | +if (sys_get_param('page_prev') && $int_page_current > 1) |
|
72 | 72 | { |
73 | 73 | $int_page_current--; |
74 | 74 | } |
75 | -elseif(sys_get_param('page_next') && $int_page_current < $page_max) |
|
75 | +elseif (sys_get_param('page_next') && $int_page_current < $page_max) |
|
76 | 76 | { |
77 | 77 | $int_page_current++; |
78 | 78 | } |
79 | 79 | |
80 | -for($i = 1; $i <= $page_max; $i++) |
|
80 | +for ($i = 1; $i <= $page_max; $i++) |
|
81 | 81 | { |
82 | 82 | $template->assign_block_vars('page', array('NUMBER' => $i)); |
83 | 83 | } |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $StartRec = ($int_page_current - 1) * 25; |
86 | 86 | |
87 | 87 | $Messages = db_message_list_admin_by_type($int_type_selected, $StartRec); |
88 | -while($row = db_fetch($Messages)) |
|
88 | +while ($row = db_fetch($Messages)) |
|
89 | 89 | { |
90 | 90 | $row['FROM'] = htmlentities($row['FROM'], ENT_COMPAT, 'UTF-8'); |
91 | 91 | $row['OWNER_NAME'] = htmlentities($row['OWNER_NAME'], ENT_COMPAT, 'UTF-8'); |
@@ -50,52 +50,52 @@ |
||
50 | 50 | stat_tpl_assign($template, $who, 'subject', $subject_list, $sn_group_stat_common); |
51 | 51 | |
52 | 52 | $stat_types = array( |
53 | - STAT_TOTAL => array( |
|
54 | - 'type' => 'total', |
|
55 | - ), |
|
53 | + STAT_TOTAL => array( |
|
54 | + 'type' => 'total', |
|
55 | + ), |
|
56 | 56 | |
57 | - STAT_FLEET => array( |
|
58 | - 'type' => 'fleet', |
|
59 | - ), |
|
57 | + STAT_FLEET => array( |
|
58 | + 'type' => 'fleet', |
|
59 | + ), |
|
60 | 60 | |
61 | - STAT_TECH => array( |
|
62 | - 'type' => 'tech', |
|
63 | - ), |
|
61 | + STAT_TECH => array( |
|
62 | + 'type' => 'tech', |
|
63 | + ), |
|
64 | 64 | |
65 | - STAT_BUILDING => array( |
|
66 | - 'type' => 'build', |
|
67 | - ), |
|
65 | + STAT_BUILDING => array( |
|
66 | + 'type' => 'build', |
|
67 | + ), |
|
68 | 68 | |
69 | - STAT_DEFENSE => array( |
|
70 | - 'type' => 'defs', |
|
71 | - ), |
|
69 | + STAT_DEFENSE => array( |
|
70 | + 'type' => 'defs', |
|
71 | + ), |
|
72 | 72 | |
73 | - STAT_RESOURCE => array( |
|
74 | - 'type' => 'res', |
|
75 | - ), |
|
73 | + STAT_RESOURCE => array( |
|
74 | + 'type' => 'res', |
|
75 | + ), |
|
76 | 76 | |
77 | - STAT_RAID_TOTAL => array( |
|
78 | - 'type' => 'raids', |
|
79 | - ), |
|
77 | + STAT_RAID_TOTAL => array( |
|
78 | + 'type' => 'raids', |
|
79 | + ), |
|
80 | 80 | |
81 | - STAT_RAID_WON => array( |
|
82 | - 'type' => 'raidswin', |
|
83 | - ), |
|
81 | + STAT_RAID_WON => array( |
|
82 | + 'type' => 'raidswin', |
|
83 | + ), |
|
84 | 84 | |
85 | - STAT_RAID_LOST => array( |
|
86 | - 'type' => 'raidsloose', |
|
87 | - ), |
|
85 | + STAT_RAID_LOST => array( |
|
86 | + 'type' => 'raidsloose', |
|
87 | + ), |
|
88 | 88 | |
89 | 89 | STAT_LVL_BUILDING => array( |
90 | - 'type' => 'lvl_minier', |
|
90 | + 'type' => 'lvl_minier', |
|
91 | 91 | ), |
92 | 92 | |
93 | 93 | STAT_LVL_TECH => array( |
94 | - 'type' => 'player_rpg_tech_level', |
|
94 | + 'type' => 'player_rpg_tech_level', |
|
95 | 95 | ), |
96 | 96 | |
97 | 97 | STAT_LVL_RAID => array( |
98 | - 'type' => 'lvl_raid', |
|
98 | + 'type' => 'lvl_raid', |
|
99 | 99 | ), |
100 | 100 | ); |
101 | 101 | stat_tpl_assign($template, $type, 'type', $stat_types, $sn_group_stat_common); |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | global $who, $lang; |
16 | 16 | |
17 | 17 | // $sn_group_stat_common = sn_get_groups('STAT_COMMON'); |
18 | - foreach($array as $key => $value) { |
|
19 | - if($array_name == 'type' && $who == 2 && !in_array($key, $sn_group_stat_common)) { |
|
18 | + foreach ($array as $key => $value) { |
|
19 | + if ($array_name == 'type' && $who == 2 && !in_array($key, $sn_group_stat_common)) { |
|
20 | 20 | continue; |
21 | 21 | } |
22 | 22 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $subject_list = array( |
49 | 49 | 1 => array('header' => $lang['stat_player']), |
50 | 50 | ); |
51 | -if(!$source) { |
|
51 | +if (!$source) { |
|
52 | 52 | $subject_list[2] = array('header' => $lang['stat_allys']); |
53 | 53 | } |
54 | 54 | stat_tpl_assign($template, $who, 'subject', $subject_list, $sn_group_stat_common); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | |
116 | 116 | $page_count = floor($record_count / 100); |
117 | 117 | $pages = array(); |
118 | -for($i = 0; $i <= $page_count; $i++) { |
|
118 | +for ($i = 0; $i <= $page_count; $i++) { |
|
119 | 119 | $first_element = $i * 100 + 1; |
120 | 120 | $last_element = $first_element + 99; |
121 | 121 | $pages[$first_element] = array( |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | 'POINTS' => HelperString::numberFloorAndFormat($row['points']), |
135 | 135 | ); |
136 | 136 | |
137 | - if($who == WHO_IS_USER) { |
|
137 | + if ($who == WHO_IS_USER) { |
|
138 | 138 | $row_stat['ALLY_NAME'] = $row['ally_name']; |
139 | 139 | $row_stat['ALLY_ID'] = $row['ally_id']; |
140 | 140 | empty($row['username']) ? $row['username'] = $row['name'] : false; |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
13 | 13 | |
14 | -if(HIDE_BUILDING_RECORDS) |
|
14 | +if (HIDE_BUILDING_RECORDS) |
|
15 | 15 | { |
16 | 16 | return; |
17 | 17 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | $user_name_cache = array(); |
36 | 36 | |
37 | -foreach($show_groups as $unit_group_id => $mode) |
|
37 | +foreach ($show_groups as $unit_group_id => $mode) |
|
38 | 38 | { |
39 | 39 | $template->assign_block_vars('records', array( |
40 | 40 | 'UNIT' => $lang['tech'][$unit_group_id], |
@@ -43,15 +43,15 @@ discard block |
||
43 | 43 | )); |
44 | 44 | $unit_group = get_unit_param('techtree', $unit_group_id); // TODO - REWRITE!!!! |
45 | 45 | |
46 | - foreach($unit_group as $unit_id) |
|
46 | + foreach ($unit_group as $unit_id) |
|
47 | 47 | { |
48 | 48 | $unit_name = &$lang['tech'][$unit_id]; |
49 | - if($unit_name) |
|
49 | + if ($unit_name) |
|
50 | 50 | { |
51 | 51 | // TODO - ISUNITSTACKABLE! |
52 | 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 | 53 | |
54 | - if($data_row) |
|
54 | + if ($data_row) |
|
55 | 55 | { |
56 | 56 | $template->assign_block_vars('records', array( |
57 | 57 | 'UNIT' => $unit_name, |
@@ -26,7 +26,9 @@ |
||
26 | 26 | * DO NOT CHANGE |
27 | 27 | */ |
28 | 28 | |
29 | -if (!defined('INSIDE')) die(); |
|
29 | +if (!defined('INSIDE')) { |
|
30 | + die(); |
|
31 | +} |
|
30 | 32 | |
31 | 33 | |
32 | 34 | $a_lang_array = (array( |
@@ -26,7 +26,9 @@ |
||
26 | 26 | * DO NOT CHANGE |
27 | 27 | */ |
28 | 28 | |
29 | -if (!defined('INSIDE')) die(); |
|
29 | +if (!defined('INSIDE')) { |
|
30 | + die(); |
|
31 | +} |
|
30 | 32 | |
31 | 33 | $a_lang_array = (array( |
32 | 34 | 'tech_storage_max' => 'Max. storage capacity', |
@@ -26,7 +26,9 @@ |
||
26 | 26 | * DO NOT CHANGE |
27 | 27 | */ |
28 | 28 | |
29 | -if (!defined('INSIDE')) die(); |
|
29 | +if (!defined('INSIDE')) { |
|
30 | + die(); |
|
31 | +} |
|
30 | 32 | |
31 | 33 | global $config; |
32 | 34 |
@@ -23,7 +23,9 @@ |
||
23 | 23 | * DO NOT CHANGE |
24 | 24 | */ |
25 | 25 | |
26 | -if (!defined('INSIDE')) die(); |
|
26 | +if (!defined('INSIDE')) { |
|
27 | + die(); |
|
28 | +} |
|
27 | 29 | |
28 | 30 | $a_lang_array = (array( |
29 | 31 | // Metamatter |
@@ -26,7 +26,9 @@ |
||
26 | 26 | * DO NOT CHANGE |
27 | 27 | */ |
28 | 28 | |
29 | -if (!defined('INSIDE')) die(); |
|
29 | +if (!defined('INSIDE')) { |
|
30 | + die(); |
|
31 | +} |
|
30 | 32 | |
31 | 33 | $a_lang_array = (array( |
32 | 34 | 'stat_header' => 'Statistics', |