@@ -11,7 +11,7 @@ |
||
11 | 11 | class SnBootstrap { |
12 | 12 | |
13 | 13 | public static function install_benchmark() { |
14 | - register_shutdown_function(function () { |
|
14 | + register_shutdown_function(function() { |
|
15 | 15 | if (defined('IN_AJAX')) { |
16 | 16 | return; |
17 | 17 | } |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | ]); |
53 | 53 | }; |
54 | 54 | |
55 | -$ValidList['percent'] = array ( 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 ); |
|
55 | +$ValidList['percent'] = array(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100); |
|
56 | 56 | $template = SnTemplate::gettemplate('resources', true); |
57 | 57 | |
58 | 58 | /** @noinspection PhpUnhandledExceptionInspection */ |
59 | 59 | $planet = SN::$gc->repoV2->getPlanet($planetrow['id']); |
60 | -if(!empty($transmutation_result = $planet->sn_sys_planet_core_transmute($user))) { |
|
60 | +if (!empty($transmutation_result = $planet->sn_sys_planet_core_transmute($user))) { |
|
61 | 61 | $template->assign_block_vars('result', $transmutation_result); |
62 | 62 | $planet->dbLoadRecord($planetrow['id']); |
63 | 63 | } |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | 'ENERGY_TYPE' => $capsObj->productionCurrentMatrix[RES_ENERGY][0], |
130 | 130 | )); |
131 | 131 | |
132 | -foreach($sn_group_factories as $unit_id) |
|
132 | +foreach ($sn_group_factories as $unit_id) |
|
133 | 133 | { |
134 | - if(mrc_get_level($user, $planetrow, $unit_id) > 0 && get_unit_param($unit_id)) |
|
134 | + if (mrc_get_level($user, $planetrow, $unit_id) > 0 && get_unit_param($unit_id)) |
|
135 | 135 | { |
136 | 136 | $level_plain = mrc_get_level($user, $planetrow, $unit_id, false, true); |
137 | 137 | $template->assign_block_vars('production', array( |
@@ -115,7 +115,7 @@ |
||
115 | 115 | $this->addFirstLast(); |
116 | 116 | } |
117 | 117 | |
118 | - if(!empty($this->result)) { |
|
118 | + if (!empty($this->result)) { |
|
119 | 119 | $template = SnTemplate::gettemplate('_paging'); |
120 | 120 | $template->assign_recursive([ |
121 | 121 | 'PAGING_ROOT' => $this->rootUrl, |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $insert_position = $is_positioned == '-' ? 0 : count($menu); |
129 | 129 | } |
130 | 130 | |
131 | - $insert_position += $is_positioned == '+' ? 1 : 0; |
|
131 | + $insert_position += $is_positioned == '+' ? 1 : 0; |
|
132 | 132 | $spliced = array_splice($menu, $insert_position, count($menu) - $insert_position); |
133 | 133 | $menu[$menu_item_id] = $menu_item; |
134 | 134 | |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | 'LANG' => $language ? $language : '', |
662 | 662 | 'referral' => $id_ref ? '&id_ref=' . $id_ref : '', |
663 | 663 | |
664 | - 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '',// "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''), |
|
664 | + 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '', // "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''), |
|
665 | 665 | 'FILENAME' => basename($_SERVER['PHP_SELF']), |
666 | 666 | )); |
667 | 667 | |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | 'QUE_ID' => QUE_RESEARCH, |
889 | 889 | 'QUE_HTML' => 'topnav', |
890 | 890 | |
891 | - 'RESEARCH_ONGOING' => (boolean)$user['que'], |
|
891 | + 'RESEARCH_ONGOING' => (boolean) $user['que'], |
|
892 | 892 | |
893 | 893 | 'TIME_TEXT' => sprintf($str_date_format, $time_now_parsed['year'], $lang['months'][$time_now_parsed['mon']], $time_now_parsed['mday'], |
894 | 894 | $time_now_parsed['hours'], $time_now_parsed['minutes'], $time_now_parsed['seconds'] |
@@ -1058,7 +1058,7 @@ discard block |
||
1058 | 1058 | |
1059 | 1059 | $isRenderGlobal = is_object($page) && isset($template_result['GLOBAL_DISPLAY_HEADER']) ? $template_result['GLOBAL_DISPLAY_HEADER'] : true; |
1060 | 1060 | |
1061 | - if(self::getCurrentTemplate()->isRenderWhole()) { |
|
1061 | + if (self::getCurrentTemplate()->isRenderWhole()) { |
|
1062 | 1062 | ob_start(); |
1063 | 1063 | } else { |
1064 | 1064 | // Global header |
@@ -1103,7 +1103,7 @@ discard block |
||
1103 | 1103 | } |
1104 | 1104 | } |
1105 | 1105 | |
1106 | - if(self::getCurrentTemplate()->isRenderWhole()) { |
|
1106 | + if (self::getCurrentTemplate()->isRenderWhole()) { |
|
1107 | 1107 | $renderedContent = ob_get_clean(); |
1108 | 1108 | // Global header |
1109 | 1109 | if ($isRenderGlobal) { |
@@ -1122,7 +1122,7 @@ discard block |
||
1122 | 1122 | SnTemplate::renderFooter($page, $template_result); |
1123 | 1123 | } |
1124 | 1124 | |
1125 | - $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false;; |
|
1125 | + $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false; ; |
|
1126 | 1126 | |
1127 | 1127 | sn_db_disconnect(); |
1128 | 1128 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | public static function db_unit_count_by_user_and_type_and_snid($user_id, $unit_type = 0, $unit_snid = 0) { |
43 | - $query = doquery( |
|
43 | + $query = doquery( |
|
44 | 44 | "SELECT unit_snid, sum(unit_level) as `qty` FROM {{unit}} WHERE `unit_player_id` = {$user_id} " . |
45 | 45 | ($unit_type ? "AND `unit_type` = {$unit_type} " : '') . |
46 | 46 | ($unit_snid ? "AND `unit_snid` = {$unit_snid} " : '') . |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | * @return bool |
190 | 190 | */ |
191 | 191 | protected static function dbAdd($playerId, $planetId, $unitSnId, $amount) { |
192 | - if (!in_array($unitSnId, sn_get_groups([UNIT_SHIPS_STR, UNIT_DEFENCE_STR, UNIT_ARTIFACTS_STR, UNIT_STRUCTURES_STR,]))) { |
|
192 | + if (!in_array($unitSnId, sn_get_groups([UNIT_SHIPS_STR, UNIT_DEFENCE_STR, UNIT_ARTIFACTS_STR, UNIT_STRUCTURES_STR, ]))) { |
|
193 | 193 | return false; |
194 | 194 | } |
195 | 195 | |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | // 'unit_level' => $level, |
223 | 223 | // ]); |
224 | 224 | |
225 | - $fields += [ |
|
225 | + $fields += [ |
|
226 | 226 | 'unit_type' => get_unit_param($unitSnId, P_UNIT_TYPE), |
227 | 227 | 'unit_level' => $amount, |
228 | 228 | ]; |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | |
22 | 22 | define('IN_AJAX', true); |
23 | 23 | |
24 | - if(!is_object($template)) { |
|
24 | + if (!is_object($template)) { |
|
25 | 25 | $template = SnTemplate::gettemplate('_ajax', true); |
26 | 26 | } |
27 | 27 | |
@@ -39,16 +39,16 @@ discard block |
||
39 | 39 | |
40 | 40 | $mode = sys_get_param_str('mode'); |
41 | 41 | |
42 | - if(class_exists($className = 'Pages\\Page' . ucfirst($mode))) { |
|
42 | + if (class_exists($className = 'Pages\\Page' . ucfirst($mode))) { |
|
43 | 43 | /** |
44 | 44 | * @var \Pages\IPage $page |
45 | 45 | */ |
46 | 46 | $page = new $className(); |
47 | - if(method_exists($page, 'loadParams')) { |
|
47 | + if (method_exists($page, 'loadParams')) { |
|
48 | 48 | $page->loadParams(); |
49 | 49 | } |
50 | 50 | |
51 | - if(method_exists($page, $action = sys_get_param('action')) && $page->checkAction($action)) { |
|
51 | + if (method_exists($page, $action = sys_get_param('action')) && $page->checkAction($action)) { |
|
52 | 52 | $result = $page->$action(); |
53 | 53 | is_array($result) ? HelperArray::merge($template_result['AJAX'], $result) : false; |
54 | 54 | } |
@@ -281,7 +281,7 @@ |
||
281 | 281 | // var_dump($pl); |
282 | 282 | // var_dump(uni_render_planet_full($pl, '', false, true)); |
283 | 283 | |
284 | - foreach(DBStaticPlanet::db_planet_list_sorted($user_row) as $planetRow) { |
|
284 | + foreach (DBStaticPlanet::db_planet_list_sorted($user_row) as $planetRow) { |
|
285 | 285 | $result['.']['planet'][] = [ |
286 | 286 | 'ID' => $planetRow['id'], |
287 | 287 | 'NAME' => $planetRow['name'], |
@@ -345,7 +345,7 @@ |
||
345 | 345 | $wasIgnored = 0; |
346 | 346 | $template = SnTemplate::gettemplate('msg_message_list', true); |
347 | 347 | foreach ($message_query as $message_row) { |
348 | - if( |
|
348 | + if ( |
|
349 | 349 | $message_row['message_type'] == MSG_TYPE_PLAYER |
350 | 350 | && |
351 | 351 | SN::$gc->ignores->isIgnored(floatval($message_row['message_owner']), floatval($message_row['message_sender'])) |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | * @return array |
241 | 241 | */ |
242 | 242 | public static function parseParamStrings($array, $delimiter = '=') { |
243 | - !is_array($array) ? $array = array((string)$array) : false; |
|
243 | + !is_array($array) ? $array = array((string) $array) : false; |
|
244 | 244 | |
245 | 245 | $result = array(); |
246 | 246 | foreach ($array as $param) { |
@@ -262,8 +262,8 @@ discard block |
||
262 | 262 | * @return float|null |
263 | 263 | */ |
264 | 264 | public static function maxValueByField(&$array, $fieldName) { |
265 | - return array_reduce($array, function ($carry, $item) use ($fieldName) { |
|
266 | - if(is_array($item) && isset($item[$fieldName]) && (!isset($carry) || $carry < $item[$fieldName])) { |
|
265 | + return array_reduce($array, function($carry, $item) use ($fieldName) { |
|
266 | + if (is_array($item) && isset($item[$fieldName]) && (!isset($carry) || $carry < $item[$fieldName])) { |
|
267 | 267 | $carry = $item[$fieldName]; |
268 | 268 | } |
269 | 269 | |
@@ -280,8 +280,8 @@ discard block |
||
280 | 280 | |
281 | 281 | return |
282 | 282 | array_reduce($array, |
283 | - function ($carry, $item) use (&$fieldName, $maxValue) { |
|
284 | - if(is_array($item) && isset($item[$fieldName]) && $item[$fieldName] == $maxValue) { |
|
283 | + function($carry, $item) use (&$fieldName, $maxValue) { |
|
284 | + if (is_array($item) && isset($item[$fieldName]) && $item[$fieldName] == $maxValue) { |
|
285 | 285 | $carry[] = $item; |
286 | 286 | } |
287 | 287 | |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | } |
293 | 293 | |
294 | 294 | public static function intersectByKeys(array &$array1, array &$array2) { |
295 | - return array_uintersect_assoc($array1, $array2, function ($a, $b) {return 0;}); |
|
295 | + return array_uintersect_assoc($array1, $array2, function($a, $b) {return 0; }); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | /** |