@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | * @copyright 2008 by ??????? for XNova |
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 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
15 | 15 | |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | $template = gettemplate('admin/settings', true); |
21 | 21 | |
22 | -if(sys_get_param('save')) { |
|
22 | +if (sys_get_param('save')) { |
|
23 | 23 | classSupernova::$config->game_name = sys_get_param_str_unsafe('game_name'); |
24 | 24 | classSupernova::$config->game_mode = sys_get_param_int('game_mode'); |
25 | 25 | classSupernova::$config->game_speed = sys_get_param_float('game_speed', 1); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | classSupernova::$config->url_faq = sys_get_param_str_unsafe('url_faq'); |
30 | 30 | classSupernova::$config->url_forum = sys_get_param_str_unsafe('url_forum'); |
31 | 31 | classSupernova::$config->url_rules = sys_get_param_str_unsafe('url_rules'); |
32 | - classSupernova::$config->url_purchase_metamatter = sys_get_param_str_unsafe('url_purchase_metamatter'); |
|
32 | + classSupernova::$config->url_purchase_metamatter = sys_get_param_str_unsafe('url_purchase_metamatter'); |
|
33 | 33 | classSupernova::$config->game_disable = sys_get_param_int('game_disable'); |
34 | 34 | classSupernova::$config->game_disable_reason = sys_get_param_str_unsafe('game_disable_reason'); |
35 | 35 | classSupernova::$config->server_updater_check_auto = sys_get_param_int('server_updater_check_auto'); |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | classSupernova::$config->stats_schedule = sys_get_param_str('stats_schedule'); |
97 | 97 | |
98 | 98 | classSupernova::$config->empire_mercenary_base_period = sys_get_param_int('empire_mercenary_base_period'); |
99 | - if(classSupernova::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) { |
|
100 | - if(classSupernova::$config->empire_mercenary_temporary) { |
|
99 | + if (classSupernova::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) { |
|
100 | + if (classSupernova::$config->empire_mercenary_temporary) { |
|
101 | 101 | DBStaticUnit::db_unit_list_admin_delete_mercenaries_finished(); |
102 | 102 | } else { |
103 | 103 | DBStaticUnit::db_unit_list_admin_set_mercenaries_expire_time(classSupernova::$config->empire_mercenary_base_period); |
@@ -140,21 +140,21 @@ discard block |
||
140 | 140 | // 'STATS_SCHEDULE' => classSupernova::$config->stats_hide_player_list, |
141 | 141 | )); |
142 | 142 | |
143 | -foreach($lang['sys_game_disable_reason'] as $id => $name) { |
|
143 | +foreach ($lang['sys_game_disable_reason'] as $id => $name) { |
|
144 | 144 | $template->assign_block_vars('sys_game_disable_reason', array( |
145 | 145 | 'ID' => $id, |
146 | 146 | 'NAME' => $name, |
147 | 147 | )); |
148 | 148 | } |
149 | 149 | |
150 | -foreach($lang['sys_game_mode'] as $mode_id => $mode_name) { |
|
150 | +foreach ($lang['sys_game_mode'] as $mode_id => $mode_name) { |
|
151 | 151 | $template->assign_block_vars('game_modes', array( |
152 | 152 | 'ID' => $mode_id, |
153 | 153 | 'NAME' => $mode_name, |
154 | 154 | )); |
155 | 155 | } |
156 | 156 | |
157 | -foreach($lang['adm_opt_ver_response'] as $ver_id => $ver_response) { |
|
157 | +foreach ($lang['adm_opt_ver_response'] as $ver_id => $ver_response) { |
|
158 | 158 | $template->assign_block_vars('ver_response', array( |
159 | 159 | 'ID' => $ver_id, |
160 | 160 | 'NAME' => js_safe_string($ver_response), |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | } |
163 | 163 | |
164 | 164 | $lang_list = lng_get_list(); |
165 | -foreach($lang_list as $lang_id => $lang_data) { |
|
165 | +foreach ($lang_list as $lang_id => $lang_data) { |
|
166 | 166 | $template->assign_block_vars('game_languages', array( |
167 | 167 | 'ID' => $lang_id, |
168 | 168 | 'NAME' => "{$lang_data['LANG_NAME_NATIVE']} ({$lang_data['LANG_NAME_ENGLISH']})", |
@@ -7,9 +7,9 @@ |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -define('INSIDE' , true); |
|
11 | -define('INSTALL' , false); |
|
12 | -define('IN_ADMIN' , true); |
|
10 | +define('INSIDE', true); |
|
11 | +define('INSTALL', false); |
|
12 | +define('IN_ADMIN', true); |
|
13 | 13 | |
14 | 14 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
15 | 15 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | |
18 | 18 | global $config, $lang, $user; |
19 | 19 | |
20 | -if($user['authlevel'] < 3) { |
|
20 | +if ($user['authlevel'] < 3) { |
|
21 | 21 | sys_redirect(SN_ROOT_VIRTUAL . 'admin/banned.php'); |
22 | 22 | } |
23 | 23 | |
@@ -41,9 +41,9 @@ discard block |
||
41 | 41 | $sort = sys_get_param_int('sort', SORT_ID); |
42 | 42 | $sort = $sort_fields[$sort] ? $sort : SORT_ID; |
43 | 43 | |
44 | -if(($action = sys_get_param_int('action')) && ($user_id = sys_get_param_id('uid')) && ($user_selected = db_user_by_id($user_id, false, 'id, username, authlevel'))) { |
|
45 | - if($user_selected['authlevel'] < $user['authlevel'] && $user['authlevel'] >= 3) { |
|
46 | - switch($action) { |
|
44 | +if (($action = sys_get_param_int('action')) && ($user_id = sys_get_param_id('uid')) && ($user_selected = db_user_by_id($user_id, false, 'id, username, authlevel'))) { |
|
45 | + if ($user_selected['authlevel'] < $user['authlevel'] && $user['authlevel'] >= 3) { |
|
46 | + switch ($action) { |
|
47 | 47 | case ACTION_DELETE: |
48 | 48 | DeleteSelectedUser($user_id); |
49 | 49 | sys_redirect("{$_SERVER['SCRIPT_NAME']}?sort={$sort}"); |
@@ -64,20 +64,20 @@ discard block |
||
64 | 64 | |
65 | 65 | $multi_ip = array(); |
66 | 66 | $ip_query = db_user_list_admin_multiaccounts(); |
67 | -while($ip = db_fetch($ip_query)) { |
|
67 | +while ($ip = db_fetch($ip_query)) { |
|
68 | 68 | $multi_ip[$ip['user_lastip']] = $ip['ip_count']; |
69 | 69 | } |
70 | 70 | |
71 | 71 | $geoip = geoip_status(); |
72 | 72 | |
73 | 73 | $query = db_user_list_admin_sorted($sort_fields[$sort], $is_players_online_page); |
74 | -while($user_row = db_fetch($query)) { |
|
75 | - if($user_row['banaday']) { |
|
74 | +while ($user_row = db_fetch($query)) { |
|
75 | + if ($user_row['banaday']) { |
|
76 | 76 | $ban_details = doquery("SELECT * FROM {{banned}} WHERE `ban_user_id` = {$user_row['id']} ORDER BY ban_id DESC LIMIT 1", true); |
77 | 77 | } |
78 | 78 | |
79 | 79 | $geoip_info = $geoip ? geoip_ip_info(ip2longu($user_row['user_lastip'])) : array(); |
80 | - foreach($geoip_info as $key => $value) { |
|
80 | + foreach ($geoip_info as $key => $value) { |
|
81 | 81 | $geoip_info[strtoupper($key)] = $value; |
82 | 82 | unset($geoip_info[$key]); |
83 | 83 | } |
@@ -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'); |
@@ -20,30 +20,30 @@ |
||
20 | 20 | $planet_id = sys_get_param_id('planet_id'); |
21 | 21 | |
22 | 22 | $unit_list = sys_get_param('unit_list'); |
23 | -if(sys_get_param('change_data') && !empty($unit_list)) |
|
23 | +if (sys_get_param('change_data') && !empty($unit_list)) |
|
24 | 24 | { |
25 | 25 | $query_string = array(); |
26 | - foreach($unit_list as $unit_id => $unit_amount) |
|
26 | + foreach ($unit_list as $unit_id => $unit_amount) |
|
27 | 27 | { |
28 | - if($unit_query_string = admin_planet_edit_query_string($unit_id, $unit_amount, $mode)) |
|
28 | + if ($unit_query_string = admin_planet_edit_query_string($unit_id, $unit_amount, $mode)) |
|
29 | 29 | { |
30 | 30 | $query_string[] = $unit_query_string; |
31 | 31 | } |
32 | 32 | } |
33 | 33 | |
34 | - if(!empty($query_string)) |
|
34 | + if (!empty($query_string)) |
|
35 | 35 | { |
36 | 36 | DBStaticPlanet::db_planet_set_by_id($planet_id, implode(', ', $query_string)); |
37 | 37 | } |
38 | 38 | } |
39 | 39 | |
40 | -if($planet_id) |
|
40 | +if ($planet_id) |
|
41 | 41 | { |
42 | 42 | $edit_planet_row = DBStaticPlanet::db_planet_by_id($planet_id); |
43 | 43 | admin_planet_edit_template($template, $edit_planet_row, $mode); |
44 | 44 | } |
45 | 45 | |
46 | -foreach($admin_planet_edit_mode_list as $page_mode => $mode_locale) |
|
46 | +foreach ($admin_planet_edit_mode_list as $page_mode => $mode_locale) |
|
47 | 47 | { |
48 | 48 | $template->assign_block_vars('page_menu', array( |
49 | 49 | 'ID' => $page_mode, |
@@ -19,7 +19,7 @@ |
||
19 | 19 | |
20 | 20 | $template = gettemplate("admin/add_moon", true); |
21 | 21 | |
22 | -if(sys_get_param_str('mode') == 'addit') |
|
22 | +if (sys_get_param_str('mode') == 'addit') |
|
23 | 23 | { |
24 | 24 | $PlanetID = sys_get_param_id('user'); |
25 | 25 | $MoonName = sys_get_param_str('name'); |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | //while($CurrentFleet = db_fetch($FlyingFleets)) |
22 | 22 | |
23 | 23 | $all_flying_fleets = db_fleet_list('', DB_SELECT_PLAIN); |
24 | -foreach($all_flying_fleets as $fleet_id => $CurrentFleet) { |
|
24 | +foreach ($all_flying_fleets as $fleet_id => $CurrentFleet) { |
|
25 | 25 | $FleetOwner = db_user_by_id($CurrentFleet['fleet_owner']); |
26 | 26 | $TargetOwner = db_user_by_id($CurrentFleet['fleet_target_owner']); |
27 | 27 | |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $fleet_data['fleet']['STAY_TIME_INT'] = $CurrentFleet['fleet_end_stay']; |
33 | 33 | |
34 | 34 | $template->assign_block_vars('fleets', $fleet_data['fleet']); |
35 | - foreach($fleet_data['ships'] as $ship_data) { |
|
35 | + foreach ($fleet_data['ships'] as $ship_data) { |
|
36 | 36 | $template->assign_block_vars('fleets.ships', $ship_data); |
37 | 37 | } |
38 | 38 | } |
@@ -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>"); |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | $mip_data = get_unit_param(UNIT_DEF_MISSILE_INTERPLANET); |
15 | 15 | $MIPDamage = floor(mrc_modify_value($attackerTech, false, TECH_WEAPON, $MIPs * $mip_data[P_ATTACK] * mt_rand(80, 120) / 100)); |
16 | - foreach($structures as $key => $structure) |
|
16 | + foreach ($structures as $key => $structure) |
|
17 | 17 | { |
18 | 18 | $unit_info = get_unit_param($key); |
19 | 19 | $amplify = isset($mip_data[P_AMPLIFY][$key]) ? $mip_data[P_AMPLIFY][$key] : 1; |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | { |
32 | 32 | //attacking only selected structure |
33 | 33 | $damageDone = $structures[$targetedStructure][$damageTo]; |
34 | - $structsDestroyed = min( floor($MIPDamage/$damageDone), $structures[$targetedStructure][0] ); |
|
34 | + $structsDestroyed = min(floor($MIPDamage / $damageDone), $structures[$targetedStructure][0]); |
|
35 | 35 | $structures[$targetedStructure][0] -= $structsDestroyed; |
36 | - $MIPDamage -= $structsDestroyed*$damageDone; |
|
36 | + $MIPDamage -= $structsDestroyed * $damageDone; |
|
37 | 37 | } |
38 | 38 | else |
39 | 39 | { |
@@ -44,16 +44,16 @@ discard block |
||
44 | 44 | do |
45 | 45 | { |
46 | 46 | // finding is there any structure that can be damaged with leftovers of $MIPDamage |
47 | - foreach($can_be_damaged as $key => $unit_id) |
|
47 | + foreach ($can_be_damaged as $key => $unit_id) |
|
48 | 48 | { |
49 | 49 | //debug($structures[$unit_id][0]); |
50 | 50 | //debug($structures[$unit_id][$damageTo], $MIPDamage); |
51 | - if($structures[$unit_id][0] <= 0 || $structures[$unit_id][$damageTo] > $MIPDamage) |
|
51 | + if ($structures[$unit_id][0] <= 0 || $structures[$unit_id][$damageTo] > $MIPDamage) |
|
52 | 52 | { |
53 | 53 | unset($can_be_damaged[$key]); |
54 | 54 | } |
55 | 55 | } |
56 | - if(empty($can_be_damaged)) |
|
56 | + if (empty($can_be_damaged)) |
|
57 | 57 | { |
58 | 58 | break; |
59 | 59 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | //debug($destroyed, 'Actually destroyed'); |
73 | 73 | |
74 | 74 | //print('<hr>'); |
75 | - } while($MIPDamage > 0 && !empty($can_be_damaged)); |
|
75 | + } while ($MIPDamage > 0 && !empty($can_be_damaged)); |
|
76 | 76 | //debug($MIPDamage, 'MIPDamage left'); |
77 | 77 | } |
78 | 78 | //debug($structures);//die(); |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | $crystal += $destroyed * $unit_info[P_COST][RES_CRYSTAL] / 4; |
88 | 88 | } |
89 | 89 | |
90 | - $return['structures'] = $structures; // Structures left after attack |
|
91 | - $return['metal'] = floor($metal); // Metal scraps |
|
90 | + $return['structures'] = $structures; // Structures left after attack |
|
91 | + $return['metal'] = floor($metal); // Metal scraps |
|
92 | 92 | $return['crystal'] = floor($crystal); // Crystal scraps |
93 | 93 | |
94 | 94 | return $return; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | $iraks = doquery("SELECT * FROM {{iraks}} WHERE `fleet_end_time` <= " . SN_TIME_NOW . " FOR UPDATE;"); |
114 | 114 | |
115 | - while($fleetRow = db_fetch($iraks)) { |
|
115 | + while ($fleetRow = db_fetch($iraks)) { |
|
116 | 116 | set_time_limit(15); |
117 | 117 | $db_changeset = array(); |
118 | 118 | |
@@ -128,9 +128,9 @@ discard block |
||
128 | 128 | |
129 | 129 | $rowAttacker = db_user_by_id($fleetRow['fleet_owner'], true); |
130 | 130 | |
131 | - if($target_planet_row['id']) { |
|
131 | + if ($target_planet_row['id']) { |
|
132 | 132 | $planetDefense = array(); |
133 | - foreach(sn_get_groups('defense_active') as $unit_id) { |
|
133 | + foreach (sn_get_groups('defense_active') as $unit_id) { |
|
134 | 134 | $planetDefense[$unit_id] = array(mrc_get_level($targetUser, $target_planet_row, $unit_id, true, true)); |
135 | 135 | } |
136 | 136 | |
@@ -141,23 +141,23 @@ discard block |
||
141 | 141 | $message = $lang['mip_all_destroyed']; |
142 | 142 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit(UNIT_DEF_MISSILE_INTERCEPTOR, -$missiles, $targetUser, $target_planet_row['id']); |
143 | 143 | } else { |
144 | - if($interceptors) { |
|
144 | + if ($interceptors) { |
|
145 | 145 | $message = sprintf($lang['mip_destroyed'], $interceptors); |
146 | 146 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit(UNIT_DEF_MISSILE_INTERCEPTOR, -$interceptors, $targetUser, $target_planet_row['id']); |
147 | 147 | } |
148 | 148 | |
149 | 149 | $attackResult = COE_missileAttack($targetUser, $rowAttacker, $missiles - $interceptors, $planetDefense, $fleetRow['primaer']); |
150 | 150 | |
151 | - foreach($attackResult['structures'] as $key => $structure) { |
|
151 | + foreach ($attackResult['structures'] as $key => $structure) { |
|
152 | 152 | $destroyed = $planetDefense[$key][0] - $structure[0]; |
153 | - if($destroyed) { |
|
153 | + if ($destroyed) { |
|
154 | 154 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($key, -$destroyed, $targetUser, $target_planet_row['id']); |
155 | 155 | |
156 | 156 | $message .= " {$lang['tech'][$key]} - {$destroyed} {$lang['quantity']}<br>"; |
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
160 | - if(!empty($message)) { |
|
160 | + if (!empty($message)) { |
|
161 | 161 | $message = $lang['mip_defense_destroyed'] . $message . "{$lang['mip_recycled']}{$lang['Metal']}: {$attackResult['metal']}, {$lang['Crystal']}: {$attackResult['crystal']}<br>"; |
162 | 162 | |
163 | 163 | DBStaticPlanet::db_planet_set_by_id($target_planet_row['id'], "`metal` = `metal` + {$attackResult['metal']}, `crystal` = `crystal` + {$attackResult['crystal']}"); |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | |
175 | 175 | empty($message) ? $message = $lang['mip_no_defense'] : false; |
176 | 176 | |
177 | - msg_send_simple_message ( $fleetRow['fleet_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, $lang['mip_sender_amd'], $lang['mip_subject_amd'], $message_vorlage . $message ); |
|
178 | - msg_send_simple_message ( $fleetRow['fleet_target_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, $lang['mip_sender_amd'], $lang['mip_subject_amd'], $message_vorlage . $message ); |
|
177 | + msg_send_simple_message($fleetRow['fleet_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, $lang['mip_sender_amd'], $lang['mip_subject_amd'], $message_vorlage . $message); |
|
178 | + msg_send_simple_message($fleetRow['fleet_target_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, $lang['mip_sender_amd'], $lang['mip_subject_amd'], $message_vorlage . $message); |
|
179 | 179 | } |
180 | 180 | doquery("DELETE FROM {{iraks}} WHERE id = '{$fleetRow['id']}';"); |
181 | 181 | } |