@@ -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, |
@@ -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 | ]; |
@@ -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 | /** |
@@ -44,11 +44,11 @@ discard block |
||
| 44 | 44 | $planet = sys_get_param_int('planet', $planetrow['planet']); |
| 45 | 45 | |
| 46 | 46 | $target_mission = sys_get_param_int('target_mission'); |
| 47 | -if($target_mission == MT_COLONIZE || $target_mission == MT_EXPLORE) { |
|
| 47 | +if ($target_mission == MT_COLONIZE || $target_mission == MT_EXPLORE) { |
|
| 48 | 48 | $planet_type = PT_PLANET; |
| 49 | -} elseif($target_mission == MT_RECYCLE) { |
|
| 49 | +} elseif ($target_mission == MT_RECYCLE) { |
|
| 50 | 50 | $planet_type = PT_DEBRIS; |
| 51 | -} elseif($target_mission == MT_DESTROY) { |
|
| 51 | +} elseif ($target_mission == MT_DESTROY) { |
|
| 52 | 52 | $planet_type = PT_MOON; |
| 53 | 53 | } else { |
| 54 | 54 | $planet_type = sys_get_param_int('planet_type'); |
@@ -64,15 +64,15 @@ discard block |
||
| 64 | 64 | //$FlyingFleets = doquery("SELECT COUNT(fleet_id) as Number FROM {{fleets}} WHERE `fleet_owner`='{$user['id']}'", true); |
| 65 | 65 | //$FlyingFleets = $FlyingFleets['Number']; |
| 66 | 66 | $FlyingFleets = DbFleetStatic::fleet_count_flying($user['id']); |
| 67 | -if($MaxFleets <= $FlyingFleets && $fleet_page && $fleet_page != 4) { |
|
| 67 | +if ($MaxFleets <= $FlyingFleets && $fleet_page && $fleet_page != 4) { |
|
| 68 | 68 | SnTemplate::messageBox($lang['fl_noslotfree'], $lang['fl_error'], "fleet." . PHP_EX, 5); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | $MaxExpeditions = get_player_max_expeditons($user); |
| 72 | -if($MaxExpeditions) { |
|
| 72 | +if ($MaxExpeditions) { |
|
| 73 | 73 | // $FlyingExpeditions = doquery("SELECT COUNT(fleet_owner) AS `expedi` FROM {{fleets}} WHERE `fleet_owner` = {$user['id']} AND `fleet_mission` = '" . MT_EXPLORE . "';", '', true); |
| 74 | 74 | // $FlyingExpeditions = $FlyingExpeditions['expedi']; |
| 75 | - $FlyingExpeditions = DbFleetStatic::fleet_count_flying($user['id'], MT_EXPLORE); |
|
| 75 | + $FlyingExpeditions = DbFleetStatic::fleet_count_flying($user['id'], MT_EXPLORE); |
|
| 76 | 76 | } else { |
| 77 | 77 | $FlyingExpeditions = 0; |
| 78 | 78 | } |
@@ -85,8 +85,8 @@ discard block |
||
| 85 | 85 | $fleetarray = json_decode(base64_decode(str_rot13(sys_get_param('usedfleet'))), true); |
| 86 | 86 | $fleetarray = is_array($fleetarray) ? $fleetarray : array(); |
| 87 | 87 | |
| 88 | - foreach($fleetarray as $ship_id => &$ship_amount) { |
|
| 89 | - if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) { |
|
| 88 | + foreach ($fleetarray as $ship_id => &$ship_amount) { |
|
| 89 | + if (!in_array($ship_id, sn_get_groups('fleet')) || (string) floatval($ship_amount) != $ship_amount || $ship_amount < 1) { |
|
| 90 | 90 | $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true)); |
| 91 | 91 | die(); |
| 92 | 92 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | } else { |
| 123 | 123 | $recyclers = 0; |
| 124 | - foreach(sn_get_groups('flt_recyclers') as $recycler_id) { |
|
| 124 | + foreach (sn_get_groups('flt_recyclers') as $recycler_id) { |
|
| 125 | 125 | $recyclers += $fleetarray[$recycler_id]; |
| 126 | 126 | } |
| 127 | 127 | if ($recyclers > 0 && $planet_type == PT_DEBRIS) { |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD]; |
| 148 | 148 | |
| 149 | - if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) { |
|
| 149 | + if ($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) { |
|
| 150 | 150 | $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY]; |
| 151 | 151 | } |
| 152 | 152 | } |
@@ -206,14 +206,14 @@ discard block |
||
| 206 | 206 | ); |
| 207 | 207 | |
| 208 | 208 | $is_transport_missions = false; |
| 209 | -if($missiontype) { |
|
| 209 | +if ($missiontype) { |
|
| 210 | 210 | $sn_group_missions = sn_get_groups('missions'); |
| 211 | - foreach($missiontype as $mission_data_id => $mission_data) { |
|
| 211 | + foreach ($missiontype as $mission_data_id => $mission_data) { |
|
| 212 | 212 | $is_transport_missions = $is_transport_missions || (isset($sn_group_missions[$mission_data_id]['transport']) && $sn_group_missions[$mission_data_id]['transport']); |
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | -switch($fleet_page) { |
|
| 216 | +switch ($fleet_page) { |
|
| 217 | 217 | case 1: |
| 218 | 218 | require('includes/includes/flt_page1.inc'); |
| 219 | 219 | break; |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | |
| 23 | 23 | $template = SnTemplate::gettemplate("admin/add_moon", true); |
| 24 | 24 | |
| 25 | -if(sys_get_param_str('mode') == 'addit') |
|
| 25 | +if (sys_get_param_str('mode') == 'addit') |
|
| 26 | 26 | { |
| 27 | 27 | $PlanetID = sys_get_param_id('user'); |
| 28 | 28 | $MoonName = sys_get_param_str('name'); |