@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -define('INSIDE' , true); |
|
4 | -define('INSTALL' , false); |
|
3 | +define('INSIDE', true); |
|
4 | +define('INSTALL', false); |
|
5 | 5 | define('IN_ADMIN', true); |
6 | 6 | |
7 | 7 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
@@ -9,12 +9,12 @@ discard block |
||
9 | 9 | global $config, $lang, $user; |
10 | 10 | |
11 | 11 | // if($user['authlevel'] < 1) |
12 | -if($user['authlevel'] < 3) { |
|
12 | +if ($user['authlevel'] < 3) { |
|
13 | 13 | AdminMessage(classLocale::$lang['adm_err_denied']); |
14 | 14 | } |
15 | 15 | |
16 | 16 | $planet_active = sys_get_param_int('planet_active'); |
17 | -if(!$planet_active) { |
|
17 | +if (!$planet_active) { |
|
18 | 18 | $planet_type = sys_get_param_int('planet_type', 1); |
19 | 19 | $planet_type = $planet_type == 3 ? 3 : 1; |
20 | 20 | } else { |
@@ -43,8 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | $page_title = |
45 | 45 | classLocale::$lang['adm_planet_list_title'] . ': ' . |
46 | - ($planet_active ? classLocale::$lang['adm_planet_active'] : |
|
47 | - ($planet_type ? ($planet_type == 3 ? classLocale::$lang['sys_moons'] : classLocale::$lang['sys_planets']) : '') |
|
46 | + ($planet_active ? classLocale::$lang['adm_planet_active'] : ($planet_type ? ($planet_type == 3 ? classLocale::$lang['sys_moons'] : classLocale::$lang['sys_planets']) : '') |
|
48 | 47 | ); |
49 | 48 | $template->assign_vars(array( |
50 | 49 | 'PAGE_TITLE' => $page_title, |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | include_once('common.' . substr(strrchr(__FILE__, '.'), 1)); |
10 | 10 | |
11 | -if(!sn_module_get_active_count('payment')) { |
|
11 | +if (!sn_module_get_active_count('payment')) { |
|
12 | 12 | sys_redirect('dark_matter.php'); |
13 | 13 | die(); |
14 | 14 | } |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | |
66 | 66 | // Таблица скидок |
67 | 67 | $prev_discount = 0; |
68 | -if(isset(sn_module_payment::$bonus_table) && is_array(sn_module_payment::$bonus_table)) { |
|
69 | - foreach(sn_module_payment::$bonus_table as $sum => $discount) { |
|
70 | - if($discount && $discount != $prev_discount) { |
|
68 | +if (isset(sn_module_payment::$bonus_table) && is_array(sn_module_payment::$bonus_table)) { |
|
69 | + foreach (sn_module_payment::$bonus_table as $sum => $discount) { |
|
70 | + if ($discount && $discount != $prev_discount) { |
|
71 | 71 | $template->assign_block_vars('discount', array( |
72 | 72 | 'SUM' => $sum, |
73 | 73 | 'DISCOUNT' => $discount * 100, |
@@ -80,19 +80,19 @@ discard block |
||
80 | 80 | } |
81 | 81 | |
82 | 82 | // Результат платежа |
83 | -if($payment_id = sys_get_param_id('payment_id')) { |
|
83 | +if ($payment_id = sys_get_param_id('payment_id')) { |
|
84 | 84 | $payment = db_payment_get($payment_id); |
85 | - if($payment && $payment['payment_user_id'] == $user['id']) { |
|
86 | - if($payment['payment_status'] == PAYMENT_STATUS_COMPLETE) { |
|
85 | + if ($payment && $payment['payment_user_id'] == $user['id']) { |
|
86 | + if ($payment['payment_status'] == PAYMENT_STATUS_COMPLETE) { |
|
87 | 87 | $template->assign_block_vars('result', array('MESSAGE' => sprintf(classLocale::$lang['pay_msg_mm_purchase_complete'], $payment['payment_dark_matter_paid'], $payment['payment_module_name'], $payment['payment_dark_matter_gained']))); |
88 | 88 | } |
89 | - if($payment['payment_status'] == PAYMENT_STATUS_NONE) { |
|
89 | + if ($payment['payment_status'] == PAYMENT_STATUS_NONE) { |
|
90 | 90 | $template->assign_block_vars('result', array( |
91 | 91 | 'MESSAGE' => sprintf(classLocale::$lang['pay_msg_mm_purchase_incomplete'], $payment['payment_dark_matter_paid'], $payment['payment_module_name']), |
92 | 92 | 'STATUS' => 1, |
93 | 93 | )); |
94 | 94 | } |
95 | - if($payment['payment_test']) { |
|
95 | + if ($payment['payment_test']) { |
|
96 | 96 | $template->assign_block_vars('result', array( |
97 | 97 | 'MESSAGE' => sprintf(classLocale::$lang['pay_msg_mm_purchase_test']), |
98 | 98 | 'STATUS' => -1, |
@@ -107,28 +107,28 @@ discard block |
||
107 | 107 | 'metamatter' => sys_get_param_float('metamatter'), |
108 | 108 | ); |
109 | 109 | |
110 | -if(!$request['metamatter']) { |
|
110 | +if (!$request['metamatter']) { |
|
111 | 111 | unset($_POST); |
112 | 112 | } |
113 | 113 | |
114 | 114 | $payment_methods_available = array_combine(array_keys(sn_module_payment::$payment_methods), array_fill(0, count(sn_module_payment::$payment_methods), null)); |
115 | -array_walk($payment_methods_available, function (&$value, $index) { |
|
115 | +array_walk($payment_methods_available, function(&$value, $index) { |
|
116 | 116 | $value = !empty(sn_module_payment::$payment_methods[$index]) ? array_combine(array_keys(sn_module_payment::$payment_methods[$index]), array_fill(0, count(sn_module_payment::$payment_methods[$index]), null)) : $value; |
117 | 117 | }); |
118 | 118 | |
119 | 119 | // pdump($payment_methods_available); |
120 | 120 | $payment_module_valid = false; |
121 | 121 | $payment_module = sys_get_param_str('payment_module'); |
122 | -foreach(sn_module::$sn_module_list['payment'] as $module_name => $module) { |
|
123 | - if(!is_object($module) || !$module->manifest['active']) { |
|
122 | +foreach (sn_module::$sn_module_list['payment'] as $module_name => $module) { |
|
123 | + if (!is_object($module) || !$module->manifest['active']) { |
|
124 | 124 | continue; |
125 | 125 | } |
126 | 126 | |
127 | 127 | lng_include($module_name, $module->manifest['root_relative']); |
128 | 128 | |
129 | - foreach(sn_module_payment::$payment_methods as $payment_type_id => $available_methods) { |
|
130 | - foreach($available_methods as $payment_method => $payment_currency) { |
|
131 | - if(isset($module->manifest['payment_method'][$payment_method])) { |
|
129 | + foreach (sn_module_payment::$payment_methods as $payment_type_id => $available_methods) { |
|
130 | + foreach ($available_methods as $payment_method => $payment_currency) { |
|
131 | + if (isset($module->manifest['payment_method'][$payment_method])) { |
|
132 | 132 | $payment_methods_available[$payment_type_id][$payment_method][$module_name] = $module->manifest['payment_method'][$payment_method]; |
133 | 133 | } |
134 | 134 | } |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | |
140 | 140 | global $template_result; |
141 | 141 | // Доступные платежные методы |
142 | -foreach($payment_methods_available as $payment_type_id => $payment_methods) { |
|
143 | - if(empty($payment_methods)) { |
|
142 | +foreach ($payment_methods_available as $payment_type_id => $payment_methods) { |
|
143 | + if (empty($payment_methods)) { |
|
144 | 144 | continue; |
145 | 145 | } |
146 | 146 | |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | 'ID' => $payment_type_id, |
149 | 149 | 'NAME' => classLocale::$lang['pay_methods'][$payment_type_id], |
150 | 150 | ); |
151 | - foreach($payment_methods as $payment_method_id => $module_list) { |
|
152 | - if(empty($module_list)) { |
|
151 | + foreach ($payment_methods as $payment_method_id => $module_list) { |
|
152 | + if (empty($module_list)) { |
|
153 | 153 | continue; |
154 | 154 | } |
155 | 155 | $template_result['.']['payment'][$payment_type_id]['.']['method'][$payment_method_id] = array( |
@@ -160,14 +160,14 @@ discard block |
||
160 | 160 | 'NAME_FORCE' => isset(sn_module_payment::$payment_methods[$payment_type_id][$payment_method_id]['name']), |
161 | 161 | 'BUTTON' => isset(sn_module_payment::$payment_methods[$payment_type_id][$payment_method_id]['button']), |
162 | 162 | ); |
163 | - foreach($module_list as $payment_module_name => $payment_module_method_details) { |
|
163 | + foreach ($module_list as $payment_module_name => $payment_module_method_details) { |
|
164 | 164 | $template_result['.']['payment'][$payment_type_id]['.']['method'][$payment_method_id]['.']['module'][] = array( |
165 | 165 | 'MODULE' => $payment_module_name, |
166 | 166 | ); |
167 | 167 | } |
168 | 168 | } |
169 | 169 | |
170 | - if(empty($template_result['.']['payment'][$payment_type_id]['.'])) { |
|
170 | + if (empty($template_result['.']['payment'][$payment_type_id]['.'])) { |
|
171 | 171 | unset($template_result['.']['payment'][$payment_type_id]); |
172 | 172 | } |
173 | 173 | } |
@@ -180,19 +180,19 @@ discard block |
||
180 | 180 | $payment_module_valid = $payment_module_valid && (!$payment_method_selected || isset($payment_methods_available[$payment_type_selected][$payment_method_selected][$module_name])); |
181 | 181 | |
182 | 182 | // If payment_module invalid - making it empty OR if there is only one payment_module - selecting it |
183 | -if($payment_module_valid) { |
|
183 | +if ($payment_module_valid) { |
|
184 | 184 | // $payment_module = $payment_module; // Really - do nothing |
185 | -} elseif($payment_type_selected && count($payment_methods_available[$payment_type_selected][$payment_method_selected]) == 1) { |
|
185 | +} elseif ($payment_type_selected && count($payment_methods_available[$payment_type_selected][$payment_method_selected]) == 1) { |
|
186 | 186 | reset($payment_methods_available[$payment_type_selected][$payment_method_selected]); |
187 | 187 | $payment_module = key($payment_methods_available[$payment_type_selected][$payment_method_selected]); |
188 | -} elseif(count(sn_module::$sn_module_list['payment']) == 1) { |
|
188 | +} elseif (count(sn_module::$sn_module_list['payment']) == 1) { |
|
189 | 189 | $payment_module = $module_name; |
190 | 190 | } else { |
191 | 191 | $payment_module = ''; |
192 | 192 | } |
193 | 193 | |
194 | -if($payment_type_selected && $payment_method_selected) { |
|
195 | - foreach($payment_methods_available[$payment_type_selected][$payment_method_selected] as $module_name => $temp) { |
|
194 | +if ($payment_type_selected && $payment_method_selected) { |
|
195 | + foreach ($payment_methods_available[$payment_type_selected][$payment_method_selected] as $module_name => $temp) { |
|
196 | 196 | $template->assign_block_vars('payment_module', array( |
197 | 197 | 'ID' => $module_name, |
198 | 198 | 'NAME' => classLocale::$lang["module_{$module_name}_name"], |
@@ -201,10 +201,10 @@ discard block |
||
201 | 201 | } |
202 | 202 | } |
203 | 203 | |
204 | -foreach(classLocale::$lang['pay_currency_list'] as $key => $value) { |
|
204 | +foreach (classLocale::$lang['pay_currency_list'] as $key => $value) { |
|
205 | 205 | $course = get_exchange_rate($key); |
206 | 206 | // if(!$course || $key == $config->payment_currency_default) { |
207 | - if(!$course) { |
|
207 | + if (!$course) { |
|
208 | 208 | continue; |
209 | 209 | } |
210 | 210 | $template->assign_block_vars('exchange', array( |
@@ -219,17 +219,17 @@ discard block |
||
219 | 219 | )); |
220 | 220 | } |
221 | 221 | |
222 | -if($request['metamatter'] && $payment_module) { |
|
222 | +if ($request['metamatter'] && $payment_module) { |
|
223 | 223 | try { |
224 | 224 | // Any possible errors about generating paylink should be raised in module! |
225 | 225 | $pay_link = sn_module::$sn_module[$payment_module]->compile_request($request); |
226 | 226 | |
227 | 227 | // Поддержка дополнительной информации |
228 | - if(is_array($pay_link['RENDER'])) { |
|
229 | - foreach($pay_link['RENDER'] as $html_data) { |
|
228 | + if (is_array($pay_link['RENDER'])) { |
|
229 | + foreach ($pay_link['RENDER'] as $html_data) { |
|
230 | 230 | $template->assign_block_vars('render', $html_data); |
231 | - if(isset($html_data['VALUE']) && is_array($html_data['VALUE'])) { |
|
232 | - foreach($html_data['VALUE'] as $value_id => $value_value) { |
|
231 | + if (isset($html_data['VALUE']) && is_array($html_data['VALUE'])) { |
|
232 | + foreach ($html_data['VALUE'] as $value_id => $value_value) { |
|
233 | 233 | $template->assign_block_vars('render.value', array( |
234 | 234 | 'FIELD' => $value_id, |
235 | 235 | 'VALUE' => $value_value, |
@@ -240,8 +240,8 @@ discard block |
||
240 | 240 | } |
241 | 241 | |
242 | 242 | // Поддержка передачи данных для многошаговых платежных систем |
243 | - if(is_array($pay_link['DATA'])) { |
|
244 | - foreach($pay_link['DATA'] as $key => $value) { |
|
243 | + if (is_array($pay_link['DATA'])) { |
|
244 | + foreach ($pay_link['DATA'] as $key => $value) { |
|
245 | 245 | $template->assign_block_vars('pay_link_data', array( |
246 | 246 | 'FIELD' => $key, |
247 | 247 | 'VALUE' => $value, |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | } |
250 | 250 | } |
251 | 251 | |
252 | - if(is_array($pay_link) && in_array($pay_link['PAY_LINK_METHOD'], array('POST', 'GET', 'LINK', 'STEP'))) { |
|
252 | + if (is_array($pay_link) && in_array($pay_link['PAY_LINK_METHOD'], array('POST', 'GET', 'LINK', 'STEP'))) { |
|
253 | 253 | // TODO Переделать это под assign_vars_recursive и возвращать пустые строки если нет платежного метода - для унификации формы в темплейте |
254 | 254 | $template->assign_vars(array( |
255 | 255 | 'PAY_LINK_METHOD' => $pay_link['PAY_LINK_METHOD'], |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | } else { |
259 | 259 | throw new exception(classLocale::$lang['pay_msg_request_paylink_unsupported'], ERR_ERROR); |
260 | 260 | } |
261 | - } catch(exception $e) { |
|
261 | + } catch (exception $e) { |
|
262 | 262 | $template->assign_block_vars('result', $response = array( |
263 | 263 | 'STATUS' => $e->getCode(), |
264 | 264 | 'MESSAGE' => $e->getMessage(), |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | } |
269 | 269 | |
270 | 270 | // Прегенерированные пакеты |
271 | -foreach($unit_available_amount_list as $unit_amount => $discount) { |
|
271 | +foreach ($unit_available_amount_list as $unit_amount => $discount) { |
|
272 | 272 | $temp = sn_module_payment::currency_convert($unit_amount, 'MM_', $player_currency); |
273 | 273 | $template->assign_block_vars('mm_amount', array( |
274 | 274 | 'VALUE' => $unit_amount, |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | 'PLAYER_CURRENCY' => $player_currency, |
304 | 304 | 'PLAYER_CURRENCY_PRICE_PER_MM' => sn_module_payment::currency_convert(1, $player_currency, 'MM_', 10), |
305 | 305 | |
306 | - 'UNIT_AMOUNT' => (float)$request['metamatter'], |
|
306 | + 'UNIT_AMOUNT' => (float) $request['metamatter'], |
|
307 | 307 | 'UNIT_AMOUNT_TEXT' => pretty_number($request['metamatter']), |
308 | 308 | 'UNIT_AMOUNT_BONUS_PERCENT' => $bonus_percent, |
309 | 309 | 'UNIT_AMOUNT_TEXT_DISCOUNTED' => $income_metamatter_text, |
@@ -21,8 +21,8 @@ |
||
21 | 21 | $mode = sys_get_param_escaped('mode'); |
22 | 22 | $mode = (!$mode || $mode == 'buildings') ? QUE_STRUCTURES : ($mode == 'fleet' ? SUBQUE_FLEET : ($mode == 'defense' ? SUBQUE_DEFENSE : ($mode == 'research' ? QUE_RESEARCH : $mode))); |
23 | 23 | |
24 | -if($building_sort = sys_get_param_id('sort_elements')) { |
|
25 | - if(!empty(classLocale::$lang['player_option_building_sort'][$building_sort])) { |
|
24 | +if ($building_sort = sys_get_param_id('sort_elements')) { |
|
25 | + if (!empty(classLocale::$lang['player_option_building_sort'][$building_sort])) { |
|
26 | 26 | classSupernova::$user_options[array(PLAYER_OPTION_BUILDING_SORT, $mode)] = $building_sort; |
27 | 27 | classSupernova::$user_options[array(PLAYER_OPTION_BUILDING_SORT_INVERSE, $mode)] = sys_get_param_id('sort_elements_inverse', 0); |
28 | 28 | } |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | |
22 | 22 | function sn_admin_planet_edit_template(&$template, $edit_planet_row, $mode) { |
23 | 23 | $unit_list = sn_get_groups($mode); |
24 | - if(empty($unit_list)) { |
|
24 | + if (empty($unit_list)) { |
|
25 | 25 | return; |
26 | 26 | } |
27 | 27 | $name_list = classLocale::$lang['tech']; |
28 | 28 | |
29 | - foreach($unit_list as $unit_id) { |
|
29 | + foreach ($unit_list as $unit_id) { |
|
30 | 30 | $template->assign_block_vars('unit', array( |
31 | 31 | 'ID' => $unit_id, |
32 | 32 | 'NAME' => $name_list[$unit_id], |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | function admin_planet_edit_query_string($unit_id, $unit_amount, $mode) { return sn_function_call(__FUNCTION__, array($unit_id, $unit_amount, $mode)); } |
40 | 40 | |
41 | 41 | function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode) { |
42 | - if($unit_amount && in_array($unit_id, sn_get_groups($mode))) { |
|
42 | + if ($unit_amount && in_array($unit_id, sn_get_groups($mode))) { |
|
43 | 43 | $unit_amount = round($unit_amount); |
44 | 44 | $unit_name = get_unit_param($unit_id, P_NAME); |
45 | 45 | $result = "{$unit_name} = GREATEST(0, {$unit_name} + ({$unit_amount}))"; |
@@ -22,17 +22,17 @@ discard block |
||
22 | 22 | $sn_group_factories = sn_get_groups('factories'); |
23 | 23 | $planet_density = sn_get_groups('planet_density'); |
24 | 24 | |
25 | - if(sys_get_param('save_production')) { |
|
25 | + if (sys_get_param('save_production')) { |
|
26 | 26 | $production = sys_get_param('percent'); |
27 | - if(is_array($production) && !empty($production)) { |
|
27 | + if (is_array($production) && !empty($production)) { |
|
28 | 28 | // sn_db_transaction_start(); |
29 | 29 | $query = array(); |
30 | 30 | $planet_row_list = db_planet_list_sorted($user, false, '*'); |
31 | 31 | // while($planet = db_fetch($planet_row_list)) |
32 | - foreach($planet_row_list as $planet) { |
|
33 | - foreach($sn_group_factories as $factory_unit_id) { |
|
32 | + foreach ($planet_row_list as $planet) { |
|
33 | + foreach ($sn_group_factories as $factory_unit_id) { |
|
34 | 34 | $unit_db_name_porcent = pname_factory_production_field_name($factory_unit_id); |
35 | - if( |
|
35 | + if ( |
|
36 | 36 | get_unit_param($factory_unit_id, P_MINING_IS_MANAGED) |
37 | 37 | && isset($production[$factory_unit_id][$planet['id']]) |
38 | 38 | && ($actual_porcent = intval($production[$factory_unit_id][$planet['id']] / 10)) >= 0 |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | } |
44 | 44 | } |
45 | 45 | } |
46 | - foreach($query as $planet_id => $query_data) { |
|
46 | + foreach ($query as $planet_id => $query_data) { |
|
47 | 47 | db_planet_set_by_id($planet_id, implode(',', $query_data)); |
48 | 48 | } |
49 | 49 | // sn_db_transaction_commit(); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | $planet_row_list = db_planet_list_sorted($user); |
54 | 54 | // while ($planet = db_fetch($planet_row_list)) |
55 | - foreach($planet_row_list as $planet) { |
|
55 | + foreach ($planet_row_list as $planet) { |
|
56 | 56 | sn_db_transaction_start(); |
57 | 57 | $global_data = sys_o_get_updated($user, $planet['id'], SN_TIME_NOW, false, true); |
58 | 58 | $planets[$planet['id']] = $global_data['planet']; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $template = gettemplate('imperium', $template); |
65 | 65 | $template->assign_var('amount', count($planets) + 2); |
66 | 66 | |
67 | - for($i = 100; $i >= 0; $i -= 10) { |
|
67 | + for ($i = 100; $i >= 0; $i -= 10) { |
|
68 | 68 | $template->assign_block_vars('percent', array('PERCENT' => $i)); |
69 | 69 | } |
70 | 70 | |
@@ -74,13 +74,13 @@ discard block |
||
74 | 74 | $total['temp_min'] = 1000; |
75 | 75 | $total['temp_max'] = -999; |
76 | 76 | |
77 | - foreach($planets as $planet_index => &$planet) { |
|
77 | + foreach ($planets as $planet_index => &$planet) { |
|
78 | 78 | $list_planet_que = $ques[$planet_index]; |
79 | 79 | $planet_template = tpl_parse_planet($planet); |
80 | 80 | |
81 | 81 | $planet_fleet_id = 0; |
82 | - $fleet_list = $planet_template['fleet_list'];//flt_get_fleets_to_planet($planet); |
|
83 | - if($fleet_list['own']['count']) { |
|
82 | + $fleet_list = $planet_template['fleet_list']; //flt_get_fleets_to_planet($planet); |
|
83 | + if ($fleet_list['own']['count']) { |
|
84 | 84 | $planet_fleet_id = "p{$fleet_id}"; |
85 | 85 | $fleets[] = tpl_parse_fleet_sn($fleet_list['own']['total'], $planet_fleet_id); |
86 | 86 | $fleet_id++; |
@@ -141,17 +141,17 @@ discard block |
||
141 | 141 | UNIT_DEFENCE => 'defense', |
142 | 142 | ); |
143 | 143 | |
144 | - foreach($show_groups as $unit_group_id => $mode) { |
|
144 | + foreach ($show_groups as $unit_group_id => $mode) { |
|
145 | 145 | $template->assign_block_vars('prods', array( |
146 | 146 | 'NAME' => classLocale::$lang['tech'][$unit_group_id], |
147 | 147 | )); |
148 | 148 | $unit_group = get_unit_param('techtree', $unit_group_id); |
149 | - foreach($unit_group as $unit_id) { |
|
149 | + foreach ($unit_group as $unit_id) { |
|
150 | 150 | $unit_count = $unit_count_abs = 0; |
151 | 151 | $block_vars = array(); |
152 | 152 | $unit_is_factory = in_array($unit_id, $sn_group_factories) && get_unit_param($unit_id, P_MINING_IS_MANAGED); |
153 | 153 | // $unit_db_name = pname_resource_name($unit_id); |
154 | - foreach($planets as $planet) { |
|
154 | + foreach ($planets as $planet) { |
|
155 | 155 | $unit_level_plain = mrc_get_level($user, $planet, $unit_id, false, true); |
156 | 156 | |
157 | 157 | $level_plus['FACTORY'] = $unit_is_factory; |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $level_plus['LEVEL_PLUS_GREEN'] = 0; |
160 | 160 | |
161 | 161 | $level_plus['PERCENT'] = $unit_is_factory ? ($unit_level_plain ? $planet[pname_factory_production_field_name($unit_id)] * 10 : -1) : -1; |
162 | - switch($mode) { |
|
162 | + switch ($mode) { |
|
163 | 163 | /* |
164 | 164 | case 'structures': |
165 | 165 | $level_plus_build = $ques[$planet['id']]['in_que'][que_get_unit_que($unit_id)][$user['id']][$planet['id']][$unit_id]; |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | case 'structures': |
180 | 180 | case 'defense': |
181 | 181 | $level_plus_build = $ques[$planet['id']]['in_que'][que_get_unit_que($unit_id)][$user['id']][$planet['id']][$unit_id]; |
182 | - if($level_plus_build) { |
|
182 | + if ($level_plus_build) { |
|
183 | 183 | $level_plus['LEVEL_PLUS_GREEN'] = $level_plus_build < 0 ? $level_plus_build : "+{$level_plus_build}"; |
184 | 184 | // $level_plus['LEVEL_PLUS_GREEN'] = "+{$level_plus_build}"; |
185 | 185 | $total['units'][$unit_id]['LEVEL_PLUS_GREEN'] += $level_plus['LEVEL_PLUS_GREEN']; |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $unit_count_abs += $unit_level_plain + abs($level_plus['LEVEL_PLUS_YELLOW']) + abs($level_plus['LEVEL_PLUS_GREEN']); |
200 | 200 | } |
201 | 201 | |
202 | - if($unit_count_abs) { |
|
202 | + if ($unit_count_abs) { |
|
203 | 203 | $template->assign_block_vars('prods', array( |
204 | 204 | 'ID' => $unit_id, |
205 | 205 | 'FIELD' => 'unit_' . $unit_id, // pname_resource_name($unit_id), // TODO Делать это прямо в темплейте |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | 'MODE' => $mode, |
208 | 208 | )); |
209 | 209 | |
210 | - foreach($block_vars as $block_var) { |
|
210 | + foreach ($block_vars as $block_var) { |
|
211 | 211 | $template->assign_block_vars('prods.planet', $block_var); |
212 | 212 | } |
213 | 213 | $unit_green = $total['units'][$unit_id]['LEVEL_PLUS_GREEN']; |
@@ -16,7 +16,7 @@ |
||
16 | 16 | $query = db_user_list("`authlevel` > 0 ORDER BY `authlevel` ASC"); |
17 | 17 | |
18 | 18 | // while($row = db_fetch($query)) |
19 | - foreach($query as $row) { |
|
19 | + foreach ($query as $row) { |
|
20 | 20 | $template_result['.']['contact'][] = array( |
21 | 21 | 'NAME' => $row['username'], |
22 | 22 | 'LEVEL' => classLocale::$lang['user_level'][$row['authlevel']], |
@@ -2,31 +2,31 @@ discard block |
||
2 | 2 | |
3 | 3 | $classLocale = classLocale::$lang; |
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 | 9 | // Changing rank for single user |
10 | 10 | $id_user = sys_get_param_id('id_user'); |
11 | -if(isset($_GET['id_rank'])) { |
|
11 | +if (isset($_GET['id_rank'])) { |
|
12 | 12 | $id_rank = sys_get_param_int('id_rank'); |
13 | 13 | } |
14 | -if($id_user && isset($id_rank) && $user_admin) { |
|
14 | +if ($id_user && isset($id_rank) && $user_admin) { |
|
15 | 15 | db_user_set_by_id($id_user, "`ally_rank_id` = {$id_rank}"); |
16 | 16 | } |
17 | 17 | |
18 | 18 | $id_kick = sys_get_param_id('kick'); |
19 | 19 | |
20 | -if($id_kick && $user_can_kick) { |
|
20 | +if ($id_kick && $user_can_kick) { |
|
21 | 21 | $u = db_user_by_id($id_kick, true); |
22 | - if($u['ally_id'] == $ally['id'] && $u['id'] != $ally['ally_owner']) { |
|
22 | + if ($u['ally_id'] == $ally['id'] && $u['id'] != $ally['ally_owner']) { |
|
23 | 23 | db_user_set_by_id($id_kick, '`ally_id`= null, `ally_name` = null, `ally_tag` = null, ally_register_time = 0, ally_rank_id = 0'); |
24 | 24 | db_ally_update_member_decrease($ally); |
25 | 25 | } |
26 | 26 | } |
27 | 27 | |
28 | 28 | $sort2 = sys_get_param_int('sort2'); |
29 | -if($sort2) { |
|
29 | +if ($sort2) { |
|
30 | 30 | $sort2s = "DESC"; |
31 | 31 | $sort2 = 0; |
32 | 32 | } else { |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | $sort1 = sys_get_param_int('sort1'); |
38 | -if($sort1 > 5 || $sort1 < 0) { |
|
38 | +if ($sort1 > 5 || $sort1 < 0) { |
|
39 | 39 | $sort1 = 0; |
40 | 40 | } |
41 | 41 | $sort1s = array( |
@@ -53,21 +53,21 @@ discard block |
||
53 | 53 | 'id, username, galaxy, system, planet, onlinetime, ally_rank_id, ally_register_time, total_points'); |
54 | 54 | |
55 | 55 | // while ($userRow = db_fetch($userList)) |
56 | -foreach($userList as $userRow) { |
|
56 | +foreach ($userList as $userRow) { |
|
57 | 57 | $i++; |
58 | - if(!isset($ranks[$userRow['ally_rank_id']])) { |
|
58 | + if (!isset($ranks[$userRow['ally_rank_id']])) { |
|
59 | 59 | $userRow['ally_rank_id'] = 0; |
60 | 60 | } |
61 | 61 | |
62 | - if($ally['ally_owner'] == $userRow['id']) { |
|
62 | + if ($ally['ally_owner'] == $userRow['id']) { |
|
63 | 63 | $ally_range = ($ally['ally_owner_range']) ? $ally['ally_owner_range'] : classLocale::$lang['Founder']; |
64 | 64 | } else { |
65 | - if($user_admin) { |
|
65 | + if ($user_admin) { |
|
66 | 66 | $ally_range = '<select onchange="window.location=\'alliance.php?mode=admin&edit=members&id_user=' . $userRow['id'] . '&id_rank=\' + this.value">'; |
67 | 67 | |
68 | - foreach($ranks as $rankID => $rankArray) { |
|
68 | + foreach ($ranks as $rankID => $rankArray) { |
|
69 | 69 | $ally_range .= '<option value="' . $rankID . '"'; |
70 | - if($rankID == $userRow['ally_rank_id']) { |
|
70 | + if ($rankID == $userRow['ally_rank_id']) { |
|
71 | 71 | $ally_range .= " selected"; |
72 | 72 | } |
73 | 73 | $ally_range .= '>' . $rankArray['name']; |
@@ -80,20 +80,20 @@ discard block |
||
80 | 80 | } |
81 | 81 | |
82 | 82 | $last_active = time() - $userRow["onlinetime"]; |
83 | - if($user_admin) { |
|
84 | - if($last_active < 60) { |
|
83 | + if ($user_admin) { |
|
84 | + if ($last_active < 60) { |
|
85 | 85 | $tmp = "lime>{$classLocale['On']}"; |
86 | - } elseif($last_active < 60 * 60) { |
|
86 | + } elseif ($last_active < 60 * 60) { |
|
87 | 87 | $last_active = round($last_active / 60); |
88 | 88 | $tmp = "lime>{$last_active} {$classLocale['sys_min_short']}"; |
89 | - } elseif($last_active < 60 * 60 * 24) { |
|
89 | + } elseif ($last_active < 60 * 60 * 24) { |
|
90 | 90 | $last_active = round($last_active / (60 * 60)); |
91 | 91 | $tmp = "green>{$last_active} {$classLocale['sys_hrs_short']}"; |
92 | 92 | } else { |
93 | 93 | $last_active = round($last_active / (60 * 60 * 24)); |
94 | - if($last_active < 7) { |
|
94 | + if ($last_active < 7) { |
|
95 | 95 | $tmp = "yellow"; |
96 | - } elseif($last_active < 30) { |
|
96 | + } elseif ($last_active < 30) { |
|
97 | 97 | $tmp = "orange"; |
98 | 98 | } else { |
99 | 99 | $tmp = "red"; |
@@ -101,10 +101,10 @@ discard block |
||
101 | 101 | $tmp .= ">{$last_active} {$classLocale['sys_day_short']}"; |
102 | 102 | } |
103 | 103 | } else { |
104 | - if($user_onlinestatus) { |
|
105 | - if($last_active < 60 * 5) { |
|
104 | + if ($user_onlinestatus) { |
|
105 | + if ($last_active < 60 * 5) { |
|
106 | 106 | $tmp = "lime>{$classLocale['On']}"; |
107 | - } elseif($last_active < 60 * 15) { |
|
107 | + } elseif ($last_active < 60 * 15) { |
|
108 | 108 | $tmp = "yellow>{$classLocale['ali_lessThen15min']}"; |
109 | 109 | } else { |
110 | 110 | $tmp = "red>{$classLocale['Off']}"; |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | )); |
132 | 132 | } |
133 | 133 | |
134 | -if($i != $ally['ally_members']) { |
|
134 | +if ($i != $ally['ally_members']) { |
|
135 | 135 | db_ally_update_member_set($i, $ally); |
136 | 136 | } |
137 | 137 |
@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | |
15 | 15 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
16 | 16 | |
17 | -if($user['authlevel'] < 3) { |
|
17 | +if ($user['authlevel'] < 3) { |
|
18 | 18 | AdminMessage(classLocale::$lang['adm_err_denied']); |
19 | 19 | } |
20 | 20 | |
21 | -if($delete = sys_get_param_str('delete')) { |
|
21 | +if ($delete = sys_get_param_str('delete')) { |
|
22 | 22 | db_chat_message_delete($delete); |
23 | -} elseif(sys_get_param_str('deleteall') == 'yes') { |
|
23 | +} elseif (sys_get_param_str('deleteall') == 'yes') { |
|
24 | 24 | db_chat_message_purge(); |
25 | 25 | } |
26 | 26 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | $query = db_chat_message_get_last_25(); |
30 | 30 | $i = 0; |
31 | -while($e = db_fetch($query)) { |
|
31 | +while ($e = db_fetch($query)) { |
|
32 | 32 | $i++; |
33 | 33 | $template->assign_block_vars('messages', array( |
34 | 34 | 'ID' => $e['messageid'], |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
18 | 18 | |
19 | -if($user['authlevel'] < 1) { |
|
19 | +if ($user['authlevel'] < 1) { |
|
20 | 20 | AdminMessage(classLocale::$lang['adm_err_denied']); |
21 | 21 | } |
22 | 22 | |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | $template = gettemplate("admin/admin_ban", true); |
29 | 29 | |
30 | 30 | $player_banned_row = db_user_by_username($name_unsafe); |
31 | -if($mode == 'banit' && $action) { |
|
32 | - if($player_banned_row) { |
|
31 | +if ($mode == 'banit' && $action) { |
|
32 | + if ($player_banned_row) { |
|
33 | 33 | $reas = $_POST['why']; |
34 | 34 | $days = $_POST['days']; |
35 | 35 | $hour = $_POST['hour']; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $adm_bn_thpl = classLocale::$lang['adm_bn_thpl']; |
50 | 50 | $DoneMessage = "{$adm_bn_thpl} {$name_output} {$adm_bn_isbn}"; |
51 | 51 | |
52 | - if($is_vacation) { |
|
52 | + if ($is_vacation) { |
|
53 | 53 | $DoneMessage .= classLocale::$lang['adm_bn_vctn']; |
54 | 54 | } |
55 | 55 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | AdminMessage($DoneMessage, classLocale::$lang['adm_ban_title']); |
62 | -} elseif($mode == 'unbanit' && $action) { |
|
62 | +} elseif ($mode == 'unbanit' && $action) { |
|
63 | 63 | sys_admin_player_ban_unset($user, $player_banned_row, ($reason = sys_get_param_str('why')) ? $reason : classLocale::$lang['sys_unbanned']); |
64 | 64 | |
65 | 65 | $DoneMessage = classLocale::$lang['adm_unbn_thpl'] . " " . $name_output . " " . classLocale::$lang['adm_unbn_isbn']; |