@@ -2,8 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | use Unit\DBStaticUnit; |
4 | 4 | |
5 | -function eco_lab_sort_effectivness($a, $b) |
|
6 | -{ |
|
5 | +function eco_lab_sort_effectivness($a, $b) { |
|
7 | 6 | return $a['laboratory_effective_level'] > $b['laboratory_effective_level'] ? -1 : ($a['laboratory_effective_level'] < $b['laboratory_effective_level'] ? 1 : 0); |
8 | 7 | } |
9 | 8 | |
@@ -13,8 +12,7 @@ discard block |
||
13 | 12 | * 1.0 - copyright (c) 2010 by Gorlum for http://supernova.ws |
14 | 13 | * @version 1.0 |
15 | 14 | */ |
16 | -function eco_get_lab_max_effective_level(&$user, $lab_require) |
|
17 | -{ |
|
15 | +function eco_get_lab_max_effective_level(&$user, $lab_require) { |
|
18 | 16 | if(!$user['user_as_ally'] && !isset($user['laboratories_active'])) |
19 | 17 | { |
20 | 18 | $user['laboratories_active'] = array(); |
@@ -40,8 +38,7 @@ discard block |
||
40 | 38 | if($user['user_as_ally']) |
41 | 39 | { |
42 | 40 | $lab_level = doquery("SELECT ally_members AS effective_level FROM {{alliance}} WHERE id = {$user['user_as_ally']} LIMIT 1", true); |
43 | - } |
|
44 | - else |
|
41 | + } else |
|
45 | 42 | { |
46 | 43 | $tech_intergalactic = mrc_get_level($user, false, TECH_RESEARCH) + 1; |
47 | 44 | $lab_level['effective_level'] = 0; |
@@ -219,8 +216,7 @@ discard block |
||
219 | 216 | return $result; |
220 | 217 | } |
221 | 218 | |
222 | -function eco_is_builds_in_que($planet_que, $unit_list) |
|
223 | -{ |
|
219 | +function eco_is_builds_in_que($planet_que, $unit_list) { |
|
224 | 220 | $eco_is_builds_in_que = false; |
225 | 221 | |
226 | 222 | $unit_list = is_array($unit_list) ? $unit_list : array($unit_list => $unit_list); |
@@ -242,8 +238,7 @@ discard block |
||
242 | 238 | } |
243 | 239 | |
244 | 240 | function eco_unit_busy(&$user, &$planet, $unit_id){$result = null;return sn_function_call('eco_unit_busy', [&$user, &$planet, $unit_id, &$result]);} |
245 | -function sn_eco_unit_busy(&$user, &$planet, $unit_id, &$result) |
|
246 | -{ |
|
241 | +function sn_eco_unit_busy(&$user, &$planet, $unit_id, &$result) { |
|
247 | 242 | global $config; |
248 | 243 | |
249 | 244 | $result = isset($result) ? $result : false; |
@@ -264,8 +259,7 @@ discard block |
||
264 | 259 | //{ |
265 | 260 | // $result = true; |
266 | 261 | //} |
267 | - } |
|
268 | - elseif(($unit_id == UNIT_TECHNOLOGIES || in_array($unit_id, sn_get_groups('tech'))) && !$config->BuildLabWhileRun && $planet['que']) |
|
262 | + } elseif(($unit_id == UNIT_TECHNOLOGIES || in_array($unit_id, sn_get_groups('tech'))) && !$config->BuildLabWhileRun && $planet['que']) |
|
269 | 263 | { |
270 | 264 | $result = eco_is_builds_in_que($planet['que'], array(STRUC_LABORATORY, STRUC_LABORATORY_NANO)); |
271 | 265 | } |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | use \Core\SnBootstrap; |
4 | 4 | |
5 | 5 | // Защита от двойного инита |
6 | -if(defined('INIT')) { |
|
6 | +if (defined('INIT')) { |
|
7 | 7 | return; |
8 | 8 | } |
9 | 9 | |
@@ -121,47 +121,47 @@ discard block |
||
121 | 121 | // Но нужно, пока у нас есть не MVC-страницы |
122 | 122 | $sn_page_data = $sn_mvc['pages'][$sn_page_name]; |
123 | 123 | $sn_page_name_file = 'includes/pages/' . $sn_page_data['filename'] . DOT_PHP_EX; |
124 | -if($sn_page_name) { |
|
124 | +if ($sn_page_name) { |
|
125 | 125 | // Merging page options to global option pull |
126 | - if(is_array($sn_page_data['options'])) { |
|
126 | + if (is_array($sn_page_data['options'])) { |
|
127 | 127 | SN::$options = array_merge(SN::$options, $sn_page_data['options']); |
128 | 128 | } |
129 | 129 | |
130 | - if(isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
130 | + if (isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
131 | 131 | require_once($sn_page_name_file); |
132 | 132 | } |
133 | 133 | } |
134 | 134 | |
135 | -if((defined('IN_AJAX') && IN_AJAX === true) || (defined('IN_ADMIN') && IN_ADMIN === true) || (!empty(SN::$options[PAGE_OPTION_ADMIN]))) { |
|
135 | +if ((defined('IN_AJAX') && IN_AJAX === true) || (defined('IN_ADMIN') && IN_ADMIN === true) || (!empty(SN::$options[PAGE_OPTION_ADMIN]))) { |
|
136 | 136 | SN::$options[PAGE_OPTION_FLEET_UPDATE_SKIP] = true; |
137 | 137 | } |
138 | 138 | |
139 | 139 | |
140 | 140 | // А теперь проверяем - поддерживают ли у нас загруженный код такую страницу |
141 | 141 | // TODO - костыль, что бы работали старые модули. Убрать! |
142 | -if(is_array($sn_data['pages'])) { |
|
142 | +if (is_array($sn_data['pages'])) { |
|
143 | 143 | $sn_mvc['pages'] = array_merge($sn_mvc['pages'], $sn_data['pages']); |
144 | 144 | } |
145 | -if(!isset($sn_mvc['pages'][$sn_page_name])) { |
|
145 | +if (!isset($sn_mvc['pages'][$sn_page_name])) { |
|
146 | 146 | $sn_page_name = ''; |
147 | 147 | } |
148 | 148 | |
149 | 149 | $lang->lng_switch(sys_get_param_str('lang')); |
150 | 150 | |
151 | 151 | |
152 | -if(SN::$config->server_updater_check_auto && SN::$config->server_updater_check_last + SN::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
152 | +if (SN::$config->server_updater_check_auto && SN::$config->server_updater_check_last + SN::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
153 | 153 | \Tools\VersionCheckerDeprecated::performCheckVersion(); |
154 | 154 | } |
155 | 155 | |
156 | -if(SN::$config->user_birthday_gift && SN_TIME_NOW - SN::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
156 | +if (SN::$config->user_birthday_gift && SN_TIME_NOW - SN::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
157 | 157 | require_once(SN_ROOT_PHYSICAL . 'includes/includes/user_birthday_celebrate.php'); |
158 | 158 | sn_user_birthday_celebrate(); |
159 | 159 | } |
160 | 160 | |
161 | -if(!SN::$config->var_online_user_count || SN::$config->var_online_user_time + 30 < SN_TIME_NOW) { |
|
161 | +if (!SN::$config->var_online_user_count || SN::$config->var_online_user_time + 30 < SN_TIME_NOW) { |
|
162 | 162 | SN::$config->db_saveItem('var_online_user_count', db_user_count(true)); |
163 | 163 | SN::$config->db_saveItem('var_online_user_time', SN_TIME_NOW); |
164 | - if(SN::$config->server_log_online) { |
|
164 | + if (SN::$config->server_log_online) { |
|
165 | 165 | doquery("INSERT IGNORE INTO `{{log_users_online}}` SET online_count = " . SN::$config->var_online_user_count . ";"); |
166 | 166 | } |
167 | 167 | } |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | |
185 | 185 | $template_result[F_ACCOUNT_IS_AUTHORIZED] = $sys_user_logged_in = !empty($user) && isset($user['id']) && $user['id']; |
186 | 186 | |
187 | -if(!empty($user['id'])) { |
|
187 | +if (!empty($user['id'])) { |
|
188 | 188 | SN::$user_options->user_change($user['id']); |
189 | 189 | } |
190 | 190 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | : false |
198 | 198 | ); |
199 | 199 | |
200 | -if($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
200 | +if ($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
201 | 201 | $prohibited_characters = array_map(function($value) { |
202 | 202 | return "'" . htmlentities($value, ENT_QUOTES, 'UTF-8') . "'"; |
203 | 203 | }, str_split(LOGIN_REGISTER_CHARACTERS_PROHIBITED)); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | } |
206 | 206 | |
207 | 207 | |
208 | -if(defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
208 | +if (defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
209 | 209 | pdump('Отключи отладку перед продакшном!'); |
210 | 210 | } |
211 | 211 | |
@@ -219,17 +219,17 @@ discard block |
||
219 | 219 | |
220 | 220 | StatUpdateLauncher::unlock(); |
221 | 221 | |
222 | -if($template_result[F_GAME_DISABLE] = SN::$config->game_disable) { |
|
222 | +if ($template_result[F_GAME_DISABLE] = SN::$config->game_disable) { |
|
223 | 223 | $template_result[F_GAME_DISABLE_REASON] = HelperString::nl2br( |
224 | 224 | SN::$config->game_disable == GAME_DISABLE_REASON |
225 | 225 | ? SN::$config->game_disable_reason |
226 | 226 | : $lang['sys_game_disable_reason'][SN::$config->game_disable] |
227 | 227 | ); |
228 | - if(defined('IN_API')) { |
|
228 | + if (defined('IN_API')) { |
|
229 | 229 | return; |
230 | 230 | } |
231 | 231 | |
232 | - if( |
|
232 | + if ( |
|
233 | 233 | ($user['authlevel'] < 1 || !(defined('IN_ADMIN') && IN_ADMIN)) |
234 | 234 | && |
235 | 235 | !(defined('INSTALL_MODE') && defined('LOGIN_LOGOUT')) |
@@ -244,8 +244,8 @@ discard block |
||
244 | 244 | |
245 | 245 | // TODO ban |
246 | 246 | // TODO $skip_ban_check |
247 | -if($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
248 | - if(defined('IN_API')) { |
|
247 | +if ($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
248 | + if (defined('IN_API')) { |
|
249 | 249 | return; |
250 | 250 | } |
251 | 251 | |
@@ -259,10 +259,10 @@ discard block |
||
259 | 259 | $allow_anonymous = $allow_anonymous || (isset($sn_page_data['allow_anonymous']) && $sn_page_data['allow_anonymous']); |
260 | 260 | |
261 | 261 | |
262 | -if($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
262 | +if ($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
263 | 263 | sys_redirect(SN_ROOT_VIRTUAL . 'overview.php'); |
264 | -} elseif($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
265 | -} elseif(!$allow_anonymous && !$sys_user_logged_in) { |
|
264 | +} elseif ($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
265 | +} elseif (!$allow_anonymous && !$sys_user_logged_in) { |
|
266 | 266 | sys_redirect(SN_ROOT_VIRTUAL . 'login.php'); |
267 | 267 | } |
268 | 268 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | 'fleet_update_last', |
286 | 286 | SN::$config->fleet_update_interval, |
287 | 287 | // Promise |
288 | - function () {SN::$gc->fleetDispatcher->dispatch();}, |
|
288 | + function() {SN::$gc->fleetDispatcher->dispatch(); }, |
|
289 | 289 | WATCHDOG_TIME_SQL, |
290 | 290 | false |
291 | 291 | ); |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | use Alliance\DBStaticAlly; |
4 | 4 | |
5 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
5 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
6 | 6 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
7 | 7 | } |
8 | 8 | |
@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | } |
12 | 12 | |
13 | 13 | $d = sys_get_param_id('d'); |
14 | -if($d) { |
|
14 | +if ($d) { |
|
15 | 15 | doquery("UPDATE {{alliance_requests}} SET `request_denied` = 1, `request_text` = '{$lang['ali_req_deny_reason']}' WHERE `id_user`= {$d} LIMIT 1;"); |
16 | 16 | } |
17 | 17 | |
18 | 18 | $id_user = sys_get_param_id('id_user'); |
19 | -if($id_user) { |
|
19 | +if ($id_user) { |
|
20 | 20 | $ally_name_safe = db_escape($ally['ally_name']); |
21 | 21 | $ally_tag_safe = db_escape($ally['ally_tag']); |
22 | 22 | db_user_set_by_id($id_user, "`ally_id` = '{$ally['id']}', `ally_name` = '{$ally_name_safe}', `ally_tag` = '{$ally_tag_safe}', `ally_register_time` = " . SN_TIME_NOW . ", `ally_rank_id` = 0"); |
@@ -2,26 +2,26 @@ discard block |
||
2 | 2 | |
3 | 3 | use Alliance\DBStaticAlly; |
4 | 4 | |
5 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
5 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
6 | 6 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
7 | 7 | } |
8 | 8 | |
9 | -if(!$user_admin) { |
|
9 | +if (!$user_admin) { |
|
10 | 10 | messageBox($lang['Denied_access'], $lang['ally_admin']); |
11 | 11 | } |
12 | 12 | |
13 | 13 | $template = gettemplate('ali_admin', $template); |
14 | 14 | |
15 | 15 | $text_list = array( |
16 | - 1 => array ('db_field' => 'ally_description', 'text_type' => 'Public_text_of_alliance'), |
|
17 | - 2 => array ('db_field' => 'ally_text', 'text_type' => 'Internal_text'), |
|
18 | - 3 => array ('db_field' => 'ally_request', 'text_type' => 'Show_of_request_text'), |
|
16 | + 1 => array('db_field' => 'ally_description', 'text_type' => 'Public_text_of_alliance'), |
|
17 | + 2 => array('db_field' => 'ally_text', 'text_type' => 'Internal_text'), |
|
18 | + 3 => array('db_field' => 'ally_request', 'text_type' => 'Show_of_request_text'), |
|
19 | 19 | ); |
20 | 20 | |
21 | 21 | $allyTextID = sys_get_param_int('t', 1); |
22 | -$allyTextID = ($allyTextID<1 || $allyTextID>3) ? 1 : $allyTextID; |
|
22 | +$allyTextID = ($allyTextID < 1 || $allyTextID > 3) ? 1 : $allyTextID; |
|
23 | 23 | |
24 | -if(sys_get_param_str('isSaveOptions')) { |
|
24 | +if (sys_get_param_str('isSaveOptions')) { |
|
25 | 25 | require_once('includes/includes/sys_avatar.php'); |
26 | 26 | |
27 | 27 | $new_image = $ally['ally_image']; |
@@ -33,32 +33,32 @@ discard block |
||
33 | 33 | // $template->assign_block_vars('result', $avatar_upload_result); |
34 | 34 | |
35 | 35 | $ally_changeset = array(); |
36 | - if(($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) && $new_tag != $ally['ally_tag']) { |
|
36 | + if (($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) && $new_tag != $ally['ally_tag']) { |
|
37 | 37 | $new_tag_unsafe = $new_tag; |
38 | 38 | $new_tag = db_escape($new_tag); |
39 | 39 | $isTaggedAllyExists = DBStaticAlly::db_ally_get_by_tag($new_tag); |
40 | - if(!empty($isTaggedAllyExists)) { |
|
40 | + if (!empty($isTaggedAllyExists)) { |
|
41 | 41 | messageBox(sprintf($lang['ally_message_tag_exists'], $new_tag_unsafe), '', 'alliance.php?mode=admin&edit=ally'); |
42 | 42 | } |
43 | 43 | $ally_changeset[] = "`ally_tag`='{$new_tag}'"; |
44 | 44 | db_user_set_by_id($ally['ally_user_id'], "`username`='[{$new_tag}]'"); |
45 | 45 | } |
46 | 46 | |
47 | - if(($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) && $new_name != $ally['ally_name']) { |
|
47 | + if (($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) && $new_name != $ally['ally_name']) { |
|
48 | 48 | $new_name_unsafe = $new_name; |
49 | 49 | $new_name = db_escape($new_name); |
50 | 50 | $isTaggedAllyExists = DBStaticAlly::db_ally_get_by_name($new_name); |
51 | - if(!empty($isTaggedAllyExists)) { |
|
51 | + if (!empty($isTaggedAllyExists)) { |
|
52 | 52 | messageBox(sprintf($lang['ally_message_name_exists'], $new_name_unsafe), '', 'alliance.php?mode=admin&edit=ally'); |
53 | 53 | } |
54 | 54 | $ally_changeset[] = "`ally_name`='{$new_name}'"; |
55 | 55 | } |
56 | 56 | |
57 | - if(($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) && $new_owner_rank != $ally['ally_owner_range']) { |
|
57 | + if (($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) && $new_owner_rank != $ally['ally_owner_range']) { |
|
58 | 58 | $new_owner_rank = db_escape($new_owner_rank); |
59 | 59 | $ally_changeset[] = "`ally_owner_range` = '{$new_owner_rank}'"; |
60 | 60 | } |
61 | - if(($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) && $new_web != $ally['ally_web']) { |
|
61 | + if (($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) && $new_web != $ally['ally_web']) { |
|
62 | 62 | $new_web = db_escape($new_web); |
63 | 63 | $ally_changeset[] = "`ally_web` = '{$new_web}'"; |
64 | 64 | } |
@@ -67,31 +67,31 @@ discard block |
||
67 | 67 | // if(($new_request = sys_get_param_int('request_notallow', $ally['ally_request_notallow'])) && $new_request != $ally['ally_request_notallow']) { |
68 | 68 | // $ally_changeset[] = "`ally_request_notallow` = '{$new_request}'"; |
69 | 69 | // } |
70 | - if($new_image != $ally['ally_image']) { |
|
70 | + if ($new_image != $ally['ally_image']) { |
|
71 | 71 | $new_image = intval($new_image); |
72 | 72 | $ally_changeset[] = "`ally_image` = '{$new_image}'"; |
73 | 73 | } |
74 | 74 | |
75 | - if(!empty($ally_changeset)) { |
|
75 | + if (!empty($ally_changeset)) { |
|
76 | 76 | doquery("UPDATE {{alliance}} SET " . implode(',', $ally_changeset) . " WHERE `id`='{$ally['id']}' LIMIT 1;"); |
77 | 77 | sys_redirect('alliance.php?mode=admin&edit=ally'); |
78 | 78 | } |
79 | 79 | } |
80 | -elseif(sys_get_param_str('isSaveText')) |
|
80 | +elseif (sys_get_param_str('isSaveText')) |
|
81 | 81 | { |
82 | 82 | $text = sys_get_param_str_both('text'); |
83 | 83 | doquery("UPDATE {{alliance}} SET `{$text_list[$allyTextID]['db_field']}`='{$text['safe']}' WHERE `id`='{$ally['id']}';"); |
84 | 84 | $ally[$text_list[$allyTextID]['db_field']] = $text['unsafe']; |
85 | 85 | } |
86 | -elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) |
|
86 | +elseif (sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) |
|
87 | 87 | { |
88 | - if(!$isAllyOwner) |
|
88 | + if (!$isAllyOwner) |
|
89 | 89 | { |
90 | 90 | messageBox($lang['Denied_access'], $lang['ally_admin']); |
91 | 91 | } |
92 | 92 | |
93 | 93 | $newLeader = db_user_by_id($idNewLeader, false, `ally_id`); |
94 | - if($newLeader['ally_id'] == $user['ally_id']) |
|
94 | + if ($newLeader['ally_id'] == $user['ally_id']) |
|
95 | 95 | { |
96 | 96 | sn_db_transaction_start(); |
97 | 97 | db_user_set_by_id($user['id'], "`ally_rank_id`='0'"); |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | sys_redirect('alliance.php'); |
102 | 102 | } |
103 | 103 | } |
104 | -elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) |
|
104 | +elseif (sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) |
|
105 | 105 | { |
106 | - if(!$isAllyOwner) |
|
106 | + if (!$isAllyOwner) |
|
107 | 107 | { |
108 | 108 | messageBox($lang['Denied_access'], $lang['ally_admin']); |
109 | 109 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | 'ally_name' => htmlspecialchars($ally['ally_name']), |
127 | 127 | 'ally_tag' => htmlspecialchars($ally['ally_tag']), |
128 | 128 | 'ally_web' => htmlspecialchars($ally['ally_web']), |
129 | - 'ally_request_notallow_0' => (( $ally['ally_request_notallow']) ? ' SELECTED' : ''), |
|
129 | + 'ally_request_notallow_0' => (($ally['ally_request_notallow']) ? ' SELECTED' : ''), |
|
130 | 130 | 'ally_request_notallow_1' => ((!$ally['ally_request_notallow']) ? ' SELECTED' : ''), |
131 | 131 | 'ally_owner_range' => htmlspecialchars($ally['ally_owner_range']), |
132 | 132 | 'hideNotOwner' => $ally['ally_owner'] != $user['id'] ? 'display: hide;' : '', |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | { |
136 | 136 | $userAllyAdmins = db_user_list("`ally_id`= {$ally['id']}", false, '`id`, `username`'); |
137 | 137 | unset($tmp); |
138 | - foreach($userAllyAdmins as $userAllyAdmin) |
|
138 | + foreach ($userAllyAdmins as $userAllyAdmin) |
|
139 | 139 | { |
140 | 140 | $tmp .= "<option value={$userAllyAdmin['id']}>{$userAllyAdmin['username']}</option>"; |
141 | 141 | } |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | $template->assign_var('adminMembers', $tmp); |
144 | 144 | } |
145 | 145 | |
146 | -foreach($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) |
|
146 | +foreach ($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) |
|
147 | 147 | { |
148 | - if(!$sn_ali_admin_action_locale['title']) |
|
148 | + if (!$sn_ali_admin_action_locale['title']) |
|
149 | 149 | { |
150 | 150 | continue; |
151 | 151 | } |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | use Alliance\DBStaticAlly; |
4 | 4 | use \DBAL\DbQuery; |
5 | 5 | |
6 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
6 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
7 | 7 | { |
8 | 8 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
9 | 9 | } |
@@ -18,28 +18,28 @@ discard block |
||
18 | 18 | $ally_name_safe = db_escape($user['ally_name']); |
19 | 19 | |
20 | 20 | $autoAccept = false; |
21 | -if(sys_get_param_str('ali_dip_offer_make')) |
|
21 | +if (sys_get_param_str('ali_dip_offer_make')) |
|
22 | 22 | { |
23 | 23 | $alliance_negotiation_relation = sys_get_param_str('alliance_negotiation_relation'); |
24 | - if(!array_key_exists($alliance_negotiation_relation, $sn_diplomacy_relation_list)) |
|
24 | + if (!array_key_exists($alliance_negotiation_relation, $sn_diplomacy_relation_list)) |
|
25 | 25 | { |
26 | 26 | messageBox($lang['ali_dip_err_wrong_offer'], $page_title); |
27 | 27 | } |
28 | 28 | |
29 | 29 | $alliance_negotiation_contr_ally_id = sys_get_param_id('alliance_negotiation_contr_ally_id'); |
30 | - if($alliance_negotiation_contr_ally_id == $user['ally_id']) |
|
30 | + if ($alliance_negotiation_contr_ally_id == $user['ally_id']) |
|
31 | 31 | { |
32 | 32 | messageBox($lang['ali_dip_err_same_ally'], $page_title); |
33 | 33 | } |
34 | 34 | |
35 | 35 | $contr_ally_row = doquery("SELECT `ally_name` FROM {{alliance}} WHERE `id` = {$alliance_negotiation_contr_ally_id} LIMIT 1;", '', true); |
36 | - if(!$contr_ally_row) |
|
36 | + if (!$contr_ally_row) |
|
37 | 37 | { |
38 | 38 | messageBox($lang['ali_dip_err_no_ally'], $page_title); |
39 | 39 | } |
40 | 40 | |
41 | 41 | $relation_current_id = ali_relation($user['ally_id'], $alliance_negotiation_contr_ally_id); |
42 | - if($alliance_negotiation_relation == $relation_current_id) |
|
42 | + if ($alliance_negotiation_relation == $relation_current_id) |
|
43 | 43 | { |
44 | 44 | messageBox(sprintf($lang['ali_dip_err_offer_same'], $lang['ali_dip_relations'][$alliance_negotiation_relation]), $page_title); |
45 | 45 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | |
52 | 52 | $relation_new = $sn_diplomacy_relation_list[$alliance_negotiation_relation]; |
53 | 53 | $relation_current = $sn_diplomacy_relation_list[$relation_current_id]; |
54 | - if($relation_new['enter_delay'] == -1 || $relation_current['exit_delay'] == -1) |
|
54 | + if ($relation_new['enter_delay'] == -1 || $relation_current['exit_delay'] == -1) |
|
55 | 55 | { |
56 | 56 | DbQuery::build() |
57 | 57 | ->setTable('alliance_negotiation') |
@@ -85,39 +85,39 @@ discard block |
||
85 | 85 | else |
86 | 86 | { |
87 | 87 | $offer_id = sys_get_param_id('offer_id'); |
88 | - if($offer_id) |
|
88 | + if ($offer_id) |
|
89 | 89 | { |
90 | 90 | $offer_answer = sys_get_param_str('answer'); |
91 | 91 | |
92 | 92 | $negotiation = doquery("SELECT * FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;", '', true); |
93 | - if(!$negotiation) |
|
93 | + if (!$negotiation) |
|
94 | 94 | { |
95 | 95 | messageBox($lang['ali_dip_err_offer_none'], $page_title); |
96 | 96 | } |
97 | - elseif($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id']) |
|
97 | + elseif ($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id']) |
|
98 | 98 | { |
99 | 99 | // TODO: Add log of hack attempt |
100 | 100 | messageBox($lang['ali_dip_err_offer_alien'], $page_title); |
101 | 101 | } |
102 | - elseif($negotiation['alliance_negotiation_ally_id'] == $user['ally_id']) |
|
102 | + elseif ($negotiation['alliance_negotiation_ally_id'] == $user['ally_id']) |
|
103 | 103 | { |
104 | - if($offer_answer == 'accept') |
|
104 | + if ($offer_answer == 'accept') |
|
105 | 105 | { |
106 | 106 | // TODO: Add log of hack attempt |
107 | 107 | messageBox($lang['ali_dip_err_offer_accept_own'], $page_title); |
108 | 108 | } |
109 | - elseif($offer_answer == 'deny') |
|
109 | + elseif ($offer_answer == 'deny') |
|
110 | 110 | { |
111 | 111 | doquery("DELETE FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;"); |
112 | 112 | } |
113 | 113 | } |
114 | 114 | else |
115 | 115 | { |
116 | - if($offer_answer == 'accept') |
|
116 | + if ($offer_answer == 'accept') |
|
117 | 117 | { |
118 | 118 | $accept_offer = true; |
119 | 119 | } |
120 | - elseif($offer_answer == 'deny') |
|
120 | + elseif ($offer_answer == 'deny') |
|
121 | 121 | { |
122 | 122 | DBStaticAlly::db_ally_negotiation_update_status_1($offer_id); |
123 | 123 | } |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | } |
126 | 126 | } |
127 | 127 | |
128 | -if($accept_offer) |
|
128 | +if ($accept_offer) |
|
129 | 129 | { |
130 | 130 | sn_db_transaction_start(); |
131 | 131 | |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | sn_db_transaction_commit(); |
186 | 186 | } |
187 | 187 | |
188 | -foreach($sn_diplomacy_relation_list as $diplomacy_relation_id => $diplomacy_relation) |
|
188 | +foreach ($sn_diplomacy_relation_list as $diplomacy_relation_id => $diplomacy_relation) |
|
189 | 189 | { |
190 | 190 | $template->assign_block_vars('relation', array( |
191 | 191 | 'ID' => $diplomacy_relation_id, |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | } |
195 | 195 | |
196 | 196 | $query = doquery("SELECT id, ally_name, ally_tag FROM {{alliance}} WHERE `id` != {$user['ally_id']} ORDER BY ally_name;"); |
197 | -while($alliance = db_fetch($query)) |
|
197 | +while ($alliance = db_fetch($query)) |
|
198 | 198 | { |
199 | 199 | $template->assign_block_vars('alliance', array( |
200 | 200 | 'ID' => $alliance['id'], |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | WHERE |
214 | 214 | alliance_negotiation_ally_id = {$user['ally_id']} OR alliance_negotiation_contr_ally_id = {$user['ally_id']};" |
215 | 215 | ); |
216 | -while($offer = db_fetch($query)) |
|
216 | +while ($offer = db_fetch($query)) |
|
217 | 217 | { |
218 | 218 | $template->assign_block_vars('offer', array( |
219 | 219 | 'ID' => $offer['alliance_negotiation_id'], |
@@ -2,14 +2,14 @@ discard block |
||
2 | 2 | |
3 | 3 | use Alliance\DBStaticAlly; |
4 | 4 | |
5 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
5 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
6 | 6 | { |
7 | 7 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
8 | 8 | } |
9 | 9 | |
10 | 10 | $template = gettemplate('ali_info', true); |
11 | 11 | |
12 | -if($mode == 'exit') |
|
12 | +if ($mode == 'exit') |
|
13 | 13 | { |
14 | 14 | if ($ally['ally_owner'] == $user['id']) |
15 | 15 | { |
@@ -26,25 +26,25 @@ discard block |
||
26 | 26 | messageBox(sprintf($lang['ali_info_leave_success'], $ally['ally_name']), $lang['sys_alliance']); |
27 | 27 | } |
28 | 28 | } |
29 | -elseif($mode == 'ainfo') |
|
29 | +elseif ($mode == 'ainfo') |
|
30 | 30 | { |
31 | 31 | $tag = sys_get_param_str('tag'); |
32 | 32 | $id_ally = sys_get_param_id('a'); |
33 | - if($tag) |
|
33 | + if ($tag) |
|
34 | 34 | { |
35 | 35 | $ally = doquery("SELECT * FROM {{alliance}} WHERE ally_tag='{$tag}' LIMIT 1;", '', true); |
36 | 36 | } |
37 | - elseif($id_ally) |
|
37 | + elseif ($id_ally) |
|
38 | 38 | { |
39 | 39 | $ally = doquery("SELECT * FROM {{alliance}} WHERE id='{$id_ally}' LIMIT 1;", '', true); |
40 | 40 | } |
41 | 41 | |
42 | - if(!$ally) |
|
42 | + if (!$ally) |
|
43 | 43 | { |
44 | 44 | messageBox($lang['ali_sys_notFound'], $lang['Ally_info_1']); |
45 | 45 | } |
46 | 46 | |
47 | - if(!$ally['ally_description']) |
|
47 | + if (!$ally['ally_description']) |
|
48 | 48 | { |
49 | 49 | $ally['ally_description'] = $lang['Ally_nodescription']; |
50 | 50 | } |
@@ -53,17 +53,17 @@ discard block |
||
53 | 53 | 'EXTERNAL' => true, |
54 | 54 | 'USER_ALLY_ID' => $user['ally_id'], |
55 | 55 | )); |
56 | - $page_header = $lang['sys_alliance']; |
|
56 | + $page_header = $lang['sys_alliance']; |
|
57 | 57 | } |
58 | 58 | else |
59 | 59 | { |
60 | 60 | $page_header = $lang['your_alliance']; |
61 | 61 | |
62 | - if($ally['ally_owner'] == $user['id']) |
|
62 | + if ($ally['ally_owner'] == $user['id']) |
|
63 | 63 | { |
64 | 64 | $range = $ally['ally_owner_range'] ? $ally['ally_owner_range'] : $lang['Founder']; |
65 | 65 | } |
66 | - elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) |
|
66 | + elseif ($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) |
|
67 | 67 | { |
68 | 68 | $range = $ranks[$user['ally_rank_id']]['name']; |
69 | 69 | } |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | )); |
108 | 108 | |
109 | 109 | $relations = ali_relations($ally['id']); |
110 | -foreach($relations as $relation) |
|
110 | +foreach ($relations as $relation) |
|
111 | 111 | { |
112 | - if($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id']) |
|
112 | + if ($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id']) |
|
113 | 113 | { |
114 | 114 | $template->assign_block_vars('relation', array( |
115 | 115 | 'NAME' => $relation['alliance_diplomacy_contr_ally_name'], |
@@ -3,8 +3,7 @@ discard block |
||
3 | 3 | use DBAL\OldDbChangeSet; |
4 | 4 | use Planet\DBStaticPlanet; |
5 | 5 | |
6 | -function flt_fleet_speed($user, $fleet) |
|
7 | -{ |
|
6 | +function flt_fleet_speed($user, $fleet) { |
|
8 | 7 | if (!is_array($fleet)) |
9 | 8 | { |
10 | 9 | $fleet = array($fleet => 1); |
@@ -32,16 +31,13 @@ discard block |
||
32 | 31 | if($from['galaxy'] != $to['galaxy']) |
33 | 32 | { |
34 | 33 | $distance = abs($from['galaxy'] - $to['galaxy']) * $config->uni_galaxy_distance; |
35 | - } |
|
36 | - elseif($from['system'] != $to['system']) |
|
34 | + } elseif($from['system'] != $to['system']) |
|
37 | 35 | { |
38 | 36 | $distance = abs($from['system'] - $to['system']) * 5 * 19 + 2700; |
39 | - } |
|
40 | - elseif($from['planet'] != $to['planet']) |
|
37 | + } elseif($from['planet'] != $to['planet']) |
|
41 | 38 | { |
42 | 39 | $distance = abs($from['planet'] - $to['planet']) * 5 + 1000; |
43 | - } |
|
44 | - else |
|
40 | + } else |
|
45 | 41 | { |
46 | 42 | $distance = 5; |
47 | 43 | } |
@@ -58,8 +54,7 @@ discard block |
||
58 | 54 | * |
59 | 55 | * @return array |
60 | 56 | */ |
61 | -function flt_travel_data($user_row, $from, $to, $fleet_array, $speed_percent = 10) |
|
62 | -{ |
|
57 | +function flt_travel_data($user_row, $from, $to, $fleet_array, $speed_percent = 10) { |
|
63 | 58 | $distance = flt_travel_distance($from, $to); |
64 | 59 | |
65 | 60 | $consumption = 0; |
@@ -123,8 +118,7 @@ discard block |
||
123 | 118 | ); |
124 | 119 | } |
125 | 120 | |
126 | -function flt_bashing_check($user, $enemy, $planet_dst, $mission, $flight_duration, $fleet_group = 0) |
|
127 | -{ |
|
121 | +function flt_bashing_check($user, $enemy, $planet_dst, $mission, $flight_duration, $fleet_group = 0) { |
|
128 | 122 | global $config; |
129 | 123 | |
130 | 124 | $config_bashing_attacks = $config->fleet_bashing_attacks; |
@@ -534,8 +528,7 @@ discard block |
||
534 | 528 | $fleet_ship_count += $amount; |
535 | 529 | $fleet_string .= "{$unit_id},{$amount};"; |
536 | 530 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, -$amount, $user, $from['id']); |
537 | - } |
|
538 | - elseif(in_array($unit_id, sn_get_groups('resources_loot'))) |
|
531 | + } elseif(in_array($unit_id, sn_get_groups('resources_loot'))) |
|
539 | 532 | { |
540 | 533 | $planet_fields[pname_resource_name($unit_id)]['delta'] -= $amount; |
541 | 534 | } |
@@ -627,8 +620,7 @@ discard block |
||
627 | 620 | //ini_set('error_reporting', E_ALL ^ E_NOTICE); |
628 | 621 | } |
629 | 622 | |
630 | -function flt_calculate_ship_to_transport_sort($a, $b) |
|
631 | -{ |
|
623 | +function flt_calculate_ship_to_transport_sort($a, $b) { |
|
632 | 624 | return $a['transport_effectivness'] == $b['transport_effectivness'] ? 0 : ($a['transport_effectivness'] > $b['transport_effectivness'] ? -1 : 1); |
633 | 625 | } |
634 | 626 | |
@@ -637,8 +629,7 @@ discard block |
||
637 | 629 | // $resource_amount - how much amount of resources need to be transported |
638 | 630 | // $from - transport from |
639 | 631 | // $to - transport to |
640 | -function flt_calculate_fleet_to_transport($ship_list, $resource_amount, $from, $to) |
|
641 | -{ |
|
632 | +function flt_calculate_fleet_to_transport($ship_list, $resource_amount, $from, $to) { |
|
642 | 633 | global $user; |
643 | 634 | |
644 | 635 | $ship_data = array(); |
@@ -6,18 +6,18 @@ discard block |
||
6 | 6 | |
7 | 7 | use Planet\DBStaticPlanet; |
8 | 8 | |
9 | -if(SN_IN_FLEET !== true) { |
|
9 | +if (SN_IN_FLEET !== true) { |
|
10 | 10 | $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
11 | 11 | } |
12 | 12 | |
13 | 13 | $template = gettemplate('fleet1', true); |
14 | 14 | |
15 | 15 | $ships = sys_get_param('ships', array()); |
16 | -if(!is_array($ships)) { |
|
16 | +if (!is_array($ships)) { |
|
17 | 17 | $ships = array(); |
18 | 18 | } |
19 | 19 | |
20 | -foreach(array(PT_PLANET, PT_DEBRIS, PT_MOON) as $possible_planet_type_id) { |
|
20 | +foreach (array(PT_PLANET, PT_DEBRIS, PT_MOON) as $possible_planet_type_id) { |
|
21 | 21 | $template->assign_block_vars('possible_planet_type_id', array( |
22 | 22 | 'ID' => $possible_planet_type_id, |
23 | 23 | 'NAME' => $lang['sys_planet_type_sh'][$possible_planet_type_id], |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | 'START_NAME' => $planetrow['name'], |
31 | 31 | ); |
32 | 32 | |
33 | -if(!empty($TargetPlanet)) { |
|
33 | +if (!empty($TargetPlanet)) { |
|
34 | 34 | $template_route += array( |
35 | 35 | 'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$TargetPlanet['planet_type']], |
36 | 36 | 'END_COORDS' => uni_render_coordinates($TargetPlanet), |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | $template->assign_block_vars('fleets', $template_route); |
42 | 42 | |
43 | 43 | $sn_groups_fleet = sn_get_groups('fleet'); |
44 | -foreach($ships as $ship_id => $ship_count) { |
|
45 | - if(in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
44 | +foreach ($ships as $ship_id => $ship_count) { |
|
45 | + if (in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
46 | 46 | $ship_info = get_unit_param($ship_id); |
47 | - if($ship_count > mrc_get_level($user, $planetrow, $ship_id, false, true)) { |
|
47 | + if ($ship_count > mrc_get_level($user, $planetrow, $ship_id, false, true)) { |
|
48 | 48 | $page .= $lang['fl_noenought']; |
49 | 49 | } else { |
50 | 50 | $fleet['fleetarray'][$ship_id] = $ship_count; |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
66 | -if(empty($fleet['fleetarray'])) { |
|
66 | +if (empty($fleet['fleetarray'])) { |
|
67 | 67 | messageBox($lang['fl_err_no_ships'], $lang['fl_error'], 'fleet' . DOT_PHP_EX, 5); |
68 | 68 | } |
69 | 69 | |
70 | 70 | // Building list of shortcuts |
71 | 71 | $query = doquery("SELECT * FROM {{notes}} WHERE `owner` = {$user['id']} AND `galaxy` <> 0 AND `system` <> 0 AND `planet` <> 0 ORDER BY `priority` DESC, `galaxy`, `system`, `planet`, `planet_type`;"); |
72 | -while($shortcut = db_fetch($query)) { |
|
72 | +while ($shortcut = db_fetch($query)) { |
|
73 | 73 | $template->assign_block_vars('shortcut', array( |
74 | 74 | 'NAME' => $shortcut['title'], |
75 | 75 | 'GALAXY' => $shortcut['galaxy'], |
@@ -83,10 +83,10 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | // Building list of own planets & moons |
86 | -$colonies = DBStaticPlanet::db_planet_list_sorted ( $user ); |
|
87 | -if(count($colonies) > 1) { |
|
86 | +$colonies = DBStaticPlanet::db_planet_list_sorted($user); |
|
87 | +if (count($colonies) > 1) { |
|
88 | 88 | // while($row = db_fetch($colonies)) |
89 | - foreach($colonies as $row) { |
|
89 | + foreach ($colonies as $row) { |
|
90 | 90 | $template->assign_block_vars('colonies', array( |
91 | 91 | 'NAME' => $row['name'], |
92 | 92 | 'GALAXY' => $row['galaxy'], |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | //ACS Start |
102 | 102 | //Need to look for acs attacks. |
103 | 103 | $aks_madnessred = doquery('SELECT * FROM {{aks}};'); |
104 | -while($row = db_fetch($aks_madnessred)) { |
|
104 | +while ($row = db_fetch($aks_madnessred)) { |
|
105 | 105 | $members = explode(',', $row['eingeladen']); |
106 | - foreach($members as $a => $b) { |
|
106 | + foreach ($members as $a => $b) { |
|
107 | 107 | if ($b == $user['id']) { |
108 | 108 | $template->assign_block_vars('acss', array( |
109 | 109 | 'ID' => $row['id'], |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | use Planet\DBStaticPlanet; |
8 | 8 | use Unit\DBStaticUnit; |
9 | 9 | |
10 | -if(SN_IN_FLEET !== true) { |
|
10 | +if (SN_IN_FLEET !== true) { |
|
11 | 11 | $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
12 | 12 | } |
13 | 13 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $errorlist .= $lang['fl_limit_galaxy']; |
27 | 27 | if (!$system || $system > $config->game_maxSystem || $system < 1) |
28 | 28 | $errorlist .= $lang['fl_limit_system']; |
29 | - if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE )) |
|
29 | + if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE)) |
|
30 | 30 | $errorlist .= $lang['fl_limit_planet']; |
31 | 31 | if ($planetrow['galaxy'] == $galaxy && $planetrow['system'] == $system && $planetrow['planet'] == $planet && $planetrow['planet_type'] == $planet_type) |
32 | 32 | $errorlist .= $lang['fl_ownpl_err']; |
@@ -53,35 +53,35 @@ discard block |
||
53 | 53 | $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true); |
54 | 54 | |
55 | 55 | if ($target_mission == MT_EXPLORE) { |
56 | - if ($MaxExpeditions == 0 ) { |
|
56 | + if ($MaxExpeditions == 0) { |
|
57 | 57 | $errorlist .= $lang['fl_expe_notech']; |
58 | - } elseif ($FlyingExpeditions >= $MaxExpeditions ) { |
|
58 | + } elseif ($FlyingExpeditions >= $MaxExpeditions) { |
|
59 | 59 | $errorlist .= $lang['fl_expe_max']; |
60 | 60 | } |
61 | 61 | } else { |
62 | - if ($TargetPlanet['id_owner']){ |
|
62 | + if ($TargetPlanet['id_owner']) { |
|
63 | 63 | if ($target_mission == MT_COLONIZE) |
64 | 64 | $errorlist .= $lang['fl_colonized']; |
65 | 65 | |
66 | - if ($TargetPlanet['id_owner'] == $planetrow['id_owner']){ |
|
66 | + if ($TargetPlanet['id_owner'] == $planetrow['id_owner']) { |
|
67 | 67 | if ($target_mission == MT_ATTACK) |
68 | 68 | $errorlist .= $lang['fl_no_self_attack']; |
69 | 69 | |
70 | 70 | if ($target_mission == MT_SPY) |
71 | 71 | $errorlist .= $lang['fl_no_self_spy']; |
72 | - }else{ |
|
72 | + } else { |
|
73 | 73 | if ($target_mission == MT_RELOCATE) |
74 | 74 | $errorlist .= $lang['fl_only_stay_at_home']; |
75 | 75 | } |
76 | - }else{ |
|
77 | - if ($target_mission < MT_COLONIZE){ |
|
76 | + } else { |
|
77 | + if ($target_mission < MT_COLONIZE) { |
|
78 | 78 | $errorlist .= $lang['fl_unknow_target']; |
79 | - }else{ |
|
79 | + } else { |
|
80 | 80 | if ($target_mission == MT_DESTROY) |
81 | 81 | $errorlist .= $lang['fl_nomoon']; |
82 | 82 | |
83 | - if ($target_mission == MT_RECYCLE){ |
|
84 | - if($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0) |
|
83 | + if ($target_mission == MT_RECYCLE) { |
|
84 | + if ($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0) |
|
85 | 85 | $errorlist .= $lang['fl_nodebris']; |
86 | 86 | } |
87 | 87 | } |
@@ -89,13 +89,13 @@ discard block |
||
89 | 89 | } |
90 | 90 | |
91 | 91 | |
92 | - if(is_object($captainModule = moduleCaptain()) && $captain_id = sys_get_param_id('captain_id')) { |
|
92 | + if (is_object($captainModule = moduleCaptain()) && $captain_id = sys_get_param_id('captain_id')) { |
|
93 | 93 | $captain = $captainModule->unit_captain_get($planetrow['id']); |
94 | 94 | // mrc_get_level($user, $planetrow, UNIT_CAPTAIN, true); |
95 | - if(!$captain) { |
|
95 | + if (!$captain) { |
|
96 | 96 | $errorlist .= $lang['module_unit_captain_error_no_captain']; |
97 | - } elseif($captain['unit_location_type'] == LOC_PLANET) { |
|
98 | - if($target_mission == MT_RELOCATE && ($arriving_captain = mrc_get_level($user, $TargetPlanet, UNIT_CAPTAIN, true))) { |
|
97 | + } elseif ($captain['unit_location_type'] == LOC_PLANET) { |
|
98 | + if ($target_mission == MT_RELOCATE && ($arriving_captain = mrc_get_level($user, $TargetPlanet, UNIT_CAPTAIN, true))) { |
|
99 | 99 | $errorlist .= $lang['module_unit_captain_error_captain_already_bound']; |
100 | 100 | } |
101 | 101 | } else { |
@@ -105,13 +105,13 @@ discard block |
||
105 | 105 | |
106 | 106 | if ($errorlist) { |
107 | 107 | sn_db_transaction_rollback(); |
108 | - messageBox ("<span class='error'><ul>{$errorlist}</ul></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, false); |
|
108 | + messageBox("<span class='error'><ul>{$errorlist}</ul></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, false); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | // On verifie s'il y a assez de vaisseaux sur la planete ! |
112 | 112 | foreach ($fleetarray as $Ship => $Count) { |
113 | 113 | if ($Count > mrc_get_level($user, $planetrow, $Ship)) { |
114 | - messageBox ("<span class='error'><b>{$lang['fl_fleet_err']}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
114 | + messageBox("<span class='error'><b>{$lang['fl_fleet_err']}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
115 | 115 | } |
116 | 116 | } |
117 | 117 | |
@@ -119,13 +119,13 @@ discard block |
||
119 | 119 | $fleet_group = max(0, intval($_POST['fleet_group'])); |
120 | 120 | //But is it acs?? |
121 | 121 | //Well all acs fleets must have a fleet code. |
122 | - if($fleet_group) { |
|
122 | + if ($fleet_group) { |
|
123 | 123 | //Also it must be mission type 2 |
124 | 124 | $target_mission = MT_AKS; |
125 | 125 | |
126 | 126 | //The co-ords must be the same as where the acs fleet is going. |
127 | 127 | $target = "g{$galaxy}s{$system}p{$planet}t{$planet_type}"; |
128 | - if($_POST['acs_target_mr'] == $target) { |
|
128 | + if ($_POST['acs_target_mr'] == $target) { |
|
129 | 129 | //ACS attack must exist (if acs fleet has arrived this will also return false (2 checks in 1!!!) |
130 | 130 | $aks = doquery("SELECT * FROM {{aks}} WHERE id = '{$fleet_group}' LIMIT 1;", true); |
131 | 131 | if (!$aks) { |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | } |
142 | 142 | } |
143 | 143 | //Check that a failed acs attack isn't being sent, if it is, make it an attack fleet. |
144 | - if(!$fleet_group && $target_mission == MT_AKS) { |
|
144 | + if (!$fleet_group && $target_mission == MT_AKS) { |
|
145 | 145 | $target_mission = MT_ATTACK; |
146 | 146 | } |
147 | 147 | |
@@ -151,22 +151,21 @@ discard block |
||
151 | 151 | $options = array('fleet_speed_percent' => $speed_percent, 'fleet_group' => $fleet_group, 'resources' => $StorageNeeded); |
152 | 152 | $cant_attack = flt_can_attack($planetrow, $TargetPlanet, $fleetarray, $target_mission, $options); |
153 | 153 | |
154 | - if($cant_attack !== ATTACK_ALLOWED) { |
|
154 | + if ($cant_attack !== ATTACK_ALLOWED) { |
|
155 | 155 | messageBox("<span class='error'><b>{$lang['fl_attack_error'][$cant_attack]}</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 99); |
156 | 156 | } |
157 | 157 | |
158 | 158 | $speed_possible = array(10, 9, 8, 7, 6, 5, 4, 3, 2, 1); |
159 | 159 | if (!in_array($speed_percent, $speed_possible)) { |
160 | - messageBox ("<span class='error'><b>". $lang['fl_cheat_speed'] ."</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
160 | + messageBox("<span class='error'><b>" . $lang['fl_cheat_speed'] . "</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | $fleet['start_time'] = $duration + SN_TIME_NOW; |
164 | 164 | |
165 | - $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : |
|
166 | - ($target_mission == MT_HOLD ? 12 : 0); |
|
167 | - if($max_duration) { |
|
165 | + $max_duration = $target_mission == MT_EXPLORE ? get_player_max_expedition_duration($user) : ($target_mission == MT_HOLD ? 12 : 0); |
|
166 | + if ($max_duration) { |
|
168 | 167 | $StayDuration = sys_get_param_id('missiontime'); |
169 | - if($StayDuration > $max_duration || $StayDuration < 1) { |
|
168 | + if ($StayDuration > $max_duration || $StayDuration < 1) { |
|
170 | 169 | $debug->warning('Supplying wrong mission time', 'Hack attempt', 302, array('base_dump' => true)); |
171 | 170 | die(); |
172 | 171 | } |
@@ -176,11 +175,11 @@ discard block |
||
176 | 175 | $StayDuration = 0; |
177 | 176 | $StayTime = 0; |
178 | 177 | } |
179 | - $fleet['end_time'] = $StayDuration + (2 * $duration) + SN_TIME_NOW; |
|
178 | + $fleet['end_time'] = $StayDuration + (2 * $duration) + SN_TIME_NOW; |
|
180 | 179 | |
181 | - if($aks && $target_mission == MT_AKS) { |
|
182 | - if ($fleet['start_time']>$aks['ankunft']) { |
|
183 | - messageBox ($lang['fl_aks_too_slow'] . 'Fleet arrival: ' . date(FMT_DATE_TIME,$fleet['start_time']) . " AKS arrival: " .date(FMT_DATE_TIME,$aks['ankunft']), $lang['fl_error']); |
|
180 | + if ($aks && $target_mission == MT_AKS) { |
|
181 | + if ($fleet['start_time'] > $aks['ankunft']) { |
|
182 | + messageBox($lang['fl_aks_too_slow'] . 'Fleet arrival: ' . date(FMT_DATE_TIME, $fleet['start_time']) . " AKS arrival: " . date(FMT_DATE_TIME, $aks['ankunft']), $lang['fl_error']); |
|
184 | 183 | } |
185 | 184 | $fleet['start_time'] = $aks['ankunft']; |
186 | 185 | $fleet['end_time'] = $aks['ankunft'] + $duration; |
@@ -190,21 +189,21 @@ discard block |
||
190 | 189 | $FleetShipCount = 0; |
191 | 190 | $db_changeset = array(); |
192 | 191 | foreach ($fleetarray as $Ship => $Count) { |
193 | - $FleetStorage += get_unit_param($Ship, P_CAPACITY) * $Count; |
|
192 | + $FleetStorage += get_unit_param($Ship, P_CAPACITY) * $Count; |
|
194 | 193 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($Ship, -$Count, $user, $planetrow['id']); |
195 | 194 | } |
196 | 195 | $fleet_array = sys_unit_arr2str($fleetarray); |
197 | - $FleetShipCount += array_sum($fleetarray); |
|
198 | - $FleetStorage -= $consumption; |
|
196 | + $FleetShipCount += array_sum($fleetarray); |
|
197 | + $FleetStorage -= $consumption; |
|
199 | 198 | |
200 | - if ( $StorageNeeded > $FleetStorage) { |
|
201 | - messageBox ("<span class='error'><b>". $lang['fl_nostoragespa'] . HelperString::numberFloorAndFormat($StorageNeeded - $FleetStorage) ."</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
199 | + if ($StorageNeeded > $FleetStorage) { |
|
200 | + messageBox("<span class='error'><b>" . $lang['fl_nostoragespa'] . HelperString::numberFloorAndFormat($StorageNeeded - $FleetStorage) . "</b></span>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
202 | 201 | } |
203 | 202 | if ($planetrow['deuterium'] < $TransDeuterium + $consumption) { |
204 | - messageBox ("<font color=\"red\"><b>". $lang['fl_no_deuterium'] . HelperString::numberFloorAndFormat($TransDeuterium + $consumption - $planetrow['deuterium']) ."</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
203 | + messageBox("<font color=\"red\"><b>" . $lang['fl_no_deuterium'] . HelperString::numberFloorAndFormat($TransDeuterium + $consumption - $planetrow['deuterium']) . "</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
205 | 204 | } |
206 | 205 | if (($planetrow['metal'] < $TransMetal) || ($planetrow['crystal'] < $TransCrystal)) { |
207 | - messageBox ("<font color=\"red\"><b>". $lang['fl_no_resources'] ."</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
206 | + messageBox("<font color=\"red\"><b>" . $lang['fl_no_resources'] . "</b></font>", $lang['fl_error'], 'fleet' . DOT_PHP_EX, 2); |
|
208 | 207 | } |
209 | 208 | |
210 | 209 | $fleet_set = array( |
@@ -246,7 +245,7 @@ discard block |
||
246 | 245 | // )); |
247 | 246 | // } |
248 | 247 | |
249 | - if(is_array($captain)) { |
|
248 | + if (is_array($captain)) { |
|
250 | 249 | DBStaticUnit::db_unit_set_by_id($captain['unit_id'], "`unit_location_type` = " . LOC_FLEET . ", `unit_location_id` = {$fleet_id}"); |
251 | 250 | } |
252 | 251 | |
@@ -259,7 +258,7 @@ discard block |
||
259 | 258 | 'START_LEFT' => floor($fleet['end_time'] + 1 - SN_TIME_NOW), |
260 | 259 | ); |
261 | 260 | |
262 | - if(!empty($TargetPlanet)) { |
|
261 | + if (!empty($TargetPlanet)) { |
|
263 | 262 | $template_route += array( |
264 | 263 | 'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$TargetPlanet['planet_type']], |
265 | 264 | 'END_COORDS' => uni_render_coordinates($TargetPlanet), |
@@ -272,8 +271,8 @@ discard block |
||
272 | 271 | $template->assign_block_vars('fleets', $template_route); |
273 | 272 | |
274 | 273 | $sn_groups_fleet = sn_get_groups('fleet'); |
275 | - foreach($fleetarray as $ship_id => $ship_count) { |
|
276 | - if(in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
274 | + foreach ($fleetarray as $ship_id => $ship_count) { |
|
275 | + if (in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
277 | 276 | // $ship_base_data = get_ship_data($ship_id, $user); |
278 | 277 | $template->assign_block_vars('fleets.ships', array( |
279 | 278 | 'ID' => $ship_id, |