@@ -105,109 +105,109 @@ |
||
| 105 | 105 | |
| 106 | 106 | // Services -------------------------------------------------------------------------------------------------------- |
| 107 | 107 | // Default db |
| 108 | - $gc->db = function (GlobalContainer $c) { |
|
| 108 | + $gc->db = function(GlobalContainer $c) { |
|
| 109 | 109 | SN::$db = new db_mysql($c); |
| 110 | 110 | |
| 111 | 111 | return SN::$db; |
| 112 | 112 | }; |
| 113 | 113 | |
| 114 | - $gc->debug = function (/** @noinspection PhpUnusedParameterInspection */ |
|
| 114 | + $gc->debug = function(/** @noinspection PhpUnusedParameterInspection */ |
|
| 115 | 115 | GlobalContainer $c) { |
| 116 | 116 | return new debug(); |
| 117 | 117 | }; |
| 118 | 118 | |
| 119 | - $gc->cache = function (GlobalContainer $gc) { |
|
| 119 | + $gc->cache = function(GlobalContainer $gc) { |
|
| 120 | 120 | return new classCache($gc->cachePrefix); |
| 121 | 121 | }; |
| 122 | 122 | |
| 123 | - $gc->config = function (GlobalContainer $gc) { |
|
| 123 | + $gc->config = function(GlobalContainer $gc) { |
|
| 124 | 124 | return new classConfig($gc->cachePrefix); |
| 125 | 125 | }; |
| 126 | 126 | |
| 127 | 127 | |
| 128 | - $gc->repository = function (GlobalContainer $gc) { |
|
| 128 | + $gc->repository = function(GlobalContainer $gc) { |
|
| 129 | 129 | /** @noinspection PhpDeprecationInspection */ |
| 130 | 130 | return new Repository($gc); |
| 131 | 131 | }; |
| 132 | 132 | |
| 133 | - $gc->storage = function (GlobalContainer $gc) { |
|
| 133 | + $gc->storage = function(GlobalContainer $gc) { |
|
| 134 | 134 | /** @noinspection PhpDeprecationInspection */ |
| 135 | 135 | return new Storage($gc); |
| 136 | 136 | }; |
| 137 | 137 | |
| 138 | - $gc->repoV2 = function (GlobalContainer $gc) { |
|
| 138 | + $gc->repoV2 = function(GlobalContainer $gc) { |
|
| 139 | 139 | return new RepoV2($gc); |
| 140 | 140 | }; |
| 141 | 141 | |
| 142 | - $gc->storageV2 = function (GlobalContainer $gc) { |
|
| 142 | + $gc->storageV2 = function(GlobalContainer $gc) { |
|
| 143 | 143 | return new StorageV2($gc); |
| 144 | 144 | }; |
| 145 | 145 | |
| 146 | - $gc->storageSqlV2 = function (GlobalContainer $gc) { |
|
| 146 | + $gc->storageSqlV2 = function(GlobalContainer $gc) { |
|
| 147 | 147 | return new StorageSqlV2($gc); |
| 148 | 148 | }; |
| 149 | 149 | |
| 150 | - $gc->design = function (GlobalContainer $gc) { |
|
| 150 | + $gc->design = function(GlobalContainer $gc) { |
|
| 151 | 151 | return new Design($gc); |
| 152 | 152 | }; |
| 153 | 153 | |
| 154 | - $gc->bbCodeParser = function (GlobalContainer $gc) { |
|
| 154 | + $gc->bbCodeParser = function(GlobalContainer $gc) { |
|
| 155 | 155 | return new BBCodeParser($gc); |
| 156 | 156 | }; |
| 157 | 157 | |
| 158 | - $gc->fleetDispatcher = function (GlobalContainer $gc) { |
|
| 158 | + $gc->fleetDispatcher = function(GlobalContainer $gc) { |
|
| 159 | 159 | return new FleetDispatcher($gc); |
| 160 | 160 | }; |
| 161 | 161 | |
| 162 | - $gc->watchdog = function (GlobalContainer $gc) { |
|
| 162 | + $gc->watchdog = function(GlobalContainer $gc) { |
|
| 163 | 163 | return new Watchdog($gc); |
| 164 | 164 | }; |
| 165 | 165 | |
| 166 | - $gc->valueStorage = function (/** @noinspection PhpUnusedParameterInspection */ GlobalContainer $gc) { |
|
| 166 | + $gc->valueStorage = function(/** @noinspection PhpUnusedParameterInspection */ GlobalContainer $gc) { |
|
| 167 | 167 | return new ValueStorage([]); |
| 168 | 168 | }; |
| 169 | 169 | |
| 170 | - $gc->bonusCatalog = function (GlobalContainer $gc) { |
|
| 170 | + $gc->bonusCatalog = function(GlobalContainer $gc) { |
|
| 171 | 171 | return new BonusCatalog($gc); |
| 172 | 172 | }; |
| 173 | 173 | |
| 174 | - $gc->general = function (GlobalContainer $gc) { |
|
| 174 | + $gc->general = function(GlobalContainer $gc) { |
|
| 175 | 175 | return new General($gc); |
| 176 | 176 | }; |
| 177 | 177 | |
| 178 | - $gc->economicHelper = function (GlobalContainer $gc) { |
|
| 178 | + $gc->economicHelper = function(GlobalContainer $gc) { |
|
| 179 | 179 | return new EconomicHelper($gc); |
| 180 | 180 | }; |
| 181 | 181 | |
| 182 | - $gc->playerLevelHelper = function (GlobalContainer $gc) { |
|
| 182 | + $gc->playerLevelHelper = function(GlobalContainer $gc) { |
|
| 183 | 183 | return new PlayerLevelHelper($gc); |
| 184 | 184 | }; |
| 185 | 185 | |
| 186 | - $gc->pimp = function (GlobalContainer $gc) { |
|
| 186 | + $gc->pimp = function(GlobalContainer $gc) { |
|
| 187 | 187 | return new SnPimp($gc); |
| 188 | 188 | }; |
| 189 | 189 | |
| 190 | - $gc->modules = function (GlobalContainer $gc) { |
|
| 190 | + $gc->modules = function(GlobalContainer $gc) { |
|
| 191 | 191 | return new ModulesManager($gc); |
| 192 | 192 | }; |
| 193 | 193 | |
| 194 | 194 | // Dummy objects --------------------------------------------------------------------------------------------------- |
| 195 | - $gc->theUser = function (GlobalContainer $gc) { |
|
| 195 | + $gc->theUser = function(GlobalContainer $gc) { |
|
| 196 | 196 | return new TheUser($gc); |
| 197 | 197 | }; |
| 198 | 198 | |
| 199 | 199 | |
| 200 | 200 | // Models ---------------------------------------------------------------------------------------------------------- |
| 201 | 201 | $gc->skinEntityClass = SkinV2::class; |
| 202 | - $gc->skinModel = function (GlobalContainer $gc) { |
|
| 202 | + $gc->skinModel = function(GlobalContainer $gc) { |
|
| 203 | 203 | return new SkinModel($gc); |
| 204 | 204 | }; |
| 205 | 205 | |
| 206 | - $gc->textModel = function (GlobalContainer $gc) { |
|
| 206 | + $gc->textModel = function(GlobalContainer $gc) { |
|
| 207 | 207 | return new TextModel($gc); |
| 208 | 208 | }; |
| 209 | 209 | |
| 210 | - $gc->ignores = function (GlobalContainer $gc) { |
|
| 210 | + $gc->ignores = function(GlobalContainer $gc) { |
|
| 211 | 211 | return new PlayerIgnore($gc); |
| 212 | 212 | }; |
| 213 | 213 | |
@@ -78,121 +78,121 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | switch ($fleet_page) { |
| 81 | - case 3: |
|
| 81 | + case 3: |
|
| 82 | 82 | |
| 83 | - case 2: |
|
| 84 | - $fleet_group_mr = sys_get_param_id('fleet_group'); |
|
| 85 | - $fleetarray = json_decode(base64_decode(str_rot13(sys_get_param('usedfleet'))), true); |
|
| 86 | - $fleetarray = is_array($fleetarray) ? $fleetarray : array(); |
|
| 83 | + case 2: |
|
| 84 | + $fleet_group_mr = sys_get_param_id('fleet_group'); |
|
| 85 | + $fleetarray = json_decode(base64_decode(str_rot13(sys_get_param('usedfleet'))), true); |
|
| 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) { |
|
| 90 | - $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true)); |
|
| 91 | - die(); |
|
| 92 | - } |
|
| 93 | - $ship_amount = floatval($ship_amount); |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - $UsedPlanet = false; |
|
| 97 | - $YourPlanet = false; |
|
| 98 | - $missiontype = array(); |
|
| 99 | - if ($planet > SN::$config->game_maxPlanet) { |
|
| 100 | - $target_mission = MT_EXPLORE; |
|
| 101 | - $missiontype[MT_EXPLORE] = $lang['type_mission'][MT_EXPLORE]; |
|
| 102 | - } elseif ($galaxy && $system && $planet) { |
|
| 103 | - $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
| 104 | - |
|
| 105 | - $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
| 106 | - |
|
| 107 | - if ($TargetPlanet['id_owner']) { |
|
| 108 | - $UsedPlanet = true; |
|
| 109 | - if ($TargetPlanet['id_owner'] == $user['id']) { |
|
| 110 | - $YourPlanet = true; |
|
| 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 | + $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true)); |
|
| 91 | + die(); |
|
| 111 | 92 | } |
| 93 | + $ship_amount = floatval($ship_amount); |
|
| 112 | 94 | } |
| 113 | 95 | |
| 114 | - if (!$UsedPlanet) { |
|
| 115 | - if ($fleetarray[SHIP_COLONIZER]) { |
|
| 116 | - $missiontype[MT_COLONIZE] = $lang['type_mission'][MT_COLONIZE]; |
|
| 117 | - $target_mission = MT_COLONIZE; |
|
| 118 | - $planet_type = PT_PLANET; |
|
| 119 | - } else { |
|
| 120 | - SnTemplate::messageBox("<font color=\"red\"><b>" . $lang['fl_no_planet_type'] . "</b></font>", $lang['fl_error']); |
|
| 121 | - } |
|
| 122 | - } else { |
|
| 123 | - $recyclers = 0; |
|
| 124 | - foreach(sn_get_groups('flt_recyclers') as $recycler_id) { |
|
| 125 | - $recyclers += $fleetarray[$recycler_id]; |
|
| 96 | + $UsedPlanet = false; |
|
| 97 | + $YourPlanet = false; |
|
| 98 | + $missiontype = array(); |
|
| 99 | + if ($planet > SN::$config->game_maxPlanet) { |
|
| 100 | + $target_mission = MT_EXPLORE; |
|
| 101 | + $missiontype[MT_EXPLORE] = $lang['type_mission'][MT_EXPLORE]; |
|
| 102 | + } elseif ($galaxy && $system && $planet) { |
|
| 103 | + $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
| 104 | + |
|
| 105 | + $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
| 106 | + |
|
| 107 | + if ($TargetPlanet['id_owner']) { |
|
| 108 | + $UsedPlanet = true; |
|
| 109 | + if ($TargetPlanet['id_owner'] == $user['id']) { |
|
| 110 | + $YourPlanet = true; |
|
| 111 | + } |
|
| 126 | 112 | } |
| 127 | - if ($recyclers > 0 && $planet_type == PT_DEBRIS) { |
|
| 128 | - $target_mission = MT_RECYCLE; |
|
| 129 | - $missiontype[MT_RECYCLE] = $lang['type_mission'][MT_RECYCLE]; |
|
| 130 | - } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) { |
|
| 131 | - if ($YourPlanet) { |
|
| 132 | - $missiontype[MT_RELOCATE] = $lang['type_mission'][MT_RELOCATE]; |
|
| 133 | - $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
| 113 | + |
|
| 114 | + if (!$UsedPlanet) { |
|
| 115 | + if ($fleetarray[SHIP_COLONIZER]) { |
|
| 116 | + $missiontype[MT_COLONIZE] = $lang['type_mission'][MT_COLONIZE]; |
|
| 117 | + $target_mission = MT_COLONIZE; |
|
| 118 | + $planet_type = PT_PLANET; |
|
| 134 | 119 | } else { |
| 135 | - // Not Your Planet |
|
| 136 | - if ($fleetarray[SHIP_SPY]) { |
|
| 137 | - // Only spy missions if any spy |
|
| 138 | - $missiontype[MT_SPY] = $lang['type_mission'][MT_SPY]; |
|
| 120 | + SnTemplate::messageBox("<font color=\"red\"><b>" . $lang['fl_no_planet_type'] . "</b></font>", $lang['fl_error']); |
|
| 121 | + } |
|
| 122 | + } else { |
|
| 123 | + $recyclers = 0; |
|
| 124 | + foreach(sn_get_groups('flt_recyclers') as $recycler_id) { |
|
| 125 | + $recyclers += $fleetarray[$recycler_id]; |
|
| 126 | + } |
|
| 127 | + if ($recyclers > 0 && $planet_type == PT_DEBRIS) { |
|
| 128 | + $target_mission = MT_RECYCLE; |
|
| 129 | + $missiontype[MT_RECYCLE] = $lang['type_mission'][MT_RECYCLE]; |
|
| 130 | + } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) { |
|
| 131 | + if ($YourPlanet) { |
|
| 132 | + $missiontype[MT_RELOCATE] = $lang['type_mission'][MT_RELOCATE]; |
|
| 133 | + $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
| 139 | 134 | } else { |
| 140 | - // If no spies... |
|
| 141 | - if ($fleet_group_mr) { |
|
| 142 | - $missiontype[MT_AKS] = $lang['type_mission'][MT_AKS]; |
|
| 135 | + // Not Your Planet |
|
| 136 | + if ($fleetarray[SHIP_SPY]) { |
|
| 137 | + // Only spy missions if any spy |
|
| 138 | + $missiontype[MT_SPY] = $lang['type_mission'][MT_SPY]; |
|
| 143 | 139 | } else { |
| 144 | - $missiontype[MT_ATTACK] = $lang['type_mission'][MT_ATTACK]; |
|
| 145 | - $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
| 146 | - |
|
| 147 | - $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD]; |
|
| 148 | - |
|
| 149 | - if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) { |
|
| 150 | - $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY]; |
|
| 140 | + // If no spies... |
|
| 141 | + if ($fleet_group_mr) { |
|
| 142 | + $missiontype[MT_AKS] = $lang['type_mission'][MT_AKS]; |
|
| 143 | + } else { |
|
| 144 | + $missiontype[MT_ATTACK] = $lang['type_mission'][MT_ATTACK]; |
|
| 145 | + $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
| 146 | + |
|
| 147 | + $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD]; |
|
| 148 | + |
|
| 149 | + if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) { |
|
| 150 | + $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY]; |
|
| 151 | + } |
|
| 151 | 152 | } |
| 152 | 153 | } |
| 153 | 154 | } |
| 154 | 155 | } |
| 155 | 156 | } |
| 156 | 157 | } |
| 157 | - } |
|
| 158 | - |
|
| 159 | - if (!$target_mission && is_array($missiontype)) { |
|
| 160 | - $target_mission = MT_ATTACK; |
|
| 161 | - } |
|
| 162 | - |
|
| 163 | -// $sn_group_missions = sn_get_groups('missions'); |
|
| 164 | -// foreach($sn_group_missions as $mission_id => $cork) { |
|
| 165 | -// $missiontype[$mission_id] = $lang['type_mission'][$mission_id]; |
|
| 166 | -// } |
|
| 167 | -// |
|
| 168 | -// |
|
| 169 | - ksort($missiontype); |
|
| 170 | - |
|
| 171 | - $speed_percent = sys_get_param_int('speed', 10); |
|
| 172 | - $travel_data = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent); |
|
| 173 | - |
|
| 174 | -// $fleet_speed = flt_fleet_speed($user, $fleetarray); |
|
| 175 | - $fleet_speed = $travel_data['fleet_speed']; |
|
| 176 | - $distance = $travel_data['distance']; |
|
| 177 | - $duration = $travel_data['duration']; |
|
| 178 | - $consumption = $travel_data['consumption']; |
|
| 179 | - // No Break |
|
| 180 | - |
|
| 181 | - case 1: |
|
| 182 | - if ($galaxy && $system && $planet) { |
|
| 183 | - $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
| 184 | - |
|
| 185 | - $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
| 186 | - } |
|
| 187 | - |
|
| 188 | - case 0: |
|
| 189 | - $template_result += array( |
|
| 190 | - 'thisgalaxy' => $planetrow['galaxy'], |
|
| 191 | - 'thissystem' => $planetrow['system'], |
|
| 192 | - 'thisplanet' => $planetrow['planet'], |
|
| 193 | - 'thisplanet_type' => $planetrow['planet_type'], |
|
| 194 | - ); |
|
| 195 | - // no break |
|
| 158 | + |
|
| 159 | + if (!$target_mission && is_array($missiontype)) { |
|
| 160 | + $target_mission = MT_ATTACK; |
|
| 161 | + } |
|
| 162 | + |
|
| 163 | + // $sn_group_missions = sn_get_groups('missions'); |
|
| 164 | + // foreach($sn_group_missions as $mission_id => $cork) { |
|
| 165 | + // $missiontype[$mission_id] = $lang['type_mission'][$mission_id]; |
|
| 166 | + // } |
|
| 167 | + // |
|
| 168 | + // |
|
| 169 | + ksort($missiontype); |
|
| 170 | + |
|
| 171 | + $speed_percent = sys_get_param_int('speed', 10); |
|
| 172 | + $travel_data = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent); |
|
| 173 | + |
|
| 174 | + // $fleet_speed = flt_fleet_speed($user, $fleetarray); |
|
| 175 | + $fleet_speed = $travel_data['fleet_speed']; |
|
| 176 | + $distance = $travel_data['distance']; |
|
| 177 | + $duration = $travel_data['duration']; |
|
| 178 | + $consumption = $travel_data['consumption']; |
|
| 179 | + // No Break |
|
| 180 | + |
|
| 181 | + case 1: |
|
| 182 | + if ($galaxy && $system && $planet) { |
|
| 183 | + $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
| 184 | + |
|
| 185 | + $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
| 186 | + } |
|
| 187 | + |
|
| 188 | + case 0: |
|
| 189 | + $template_result += array( |
|
| 190 | + 'thisgalaxy' => $planetrow['galaxy'], |
|
| 191 | + 'thissystem' => $planetrow['system'], |
|
| 192 | + 'thisplanet' => $planetrow['planet'], |
|
| 193 | + 'thisplanet_type' => $planetrow['planet_type'], |
|
| 194 | + ); |
|
| 195 | + // no break |
|
| 196 | 196 | |
| 197 | 197 | } |
| 198 | 198 | |
@@ -214,35 +214,35 @@ discard block |
||
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | switch($fleet_page) { |
| 217 | - case 1: |
|
| 218 | - require('includes/includes/flt_page1.inc'); |
|
| 219 | - break; |
|
| 220 | - |
|
| 221 | - case 2: |
|
| 222 | - require_once('includes/includes/flt_page2.inc'); |
|
| 223 | - sn_fleet_page2(); |
|
| 224 | - break; |
|
| 225 | - |
|
| 226 | - case 3: |
|
| 227 | - require_once('includes/includes/flt_page3.inc'); |
|
| 228 | - sn_fleet_page3(); |
|
| 229 | - break; |
|
| 230 | - |
|
| 231 | - case 4: |
|
| 232 | - require('includes/includes/flt_page4.inc'); |
|
| 233 | - break; |
|
| 234 | - |
|
| 235 | - case 5: |
|
| 236 | - $template = SnTemplate::gettemplate('fleet5', true); |
|
| 237 | - $pageFleet5Gathering = new \Pages\Deprecated\PageFleet5Gathering(); |
|
| 238 | - $pageFleet5Gathering->modelFleet5Gathering($user, $planetrow, $template); |
|
| 239 | - // Building list of own planets & moons |
|
| 240 | - $pageFleet5Gathering->viewPage5Gathering($user, $planetrow, $template); |
|
| 241 | - break; |
|
| 242 | - |
|
| 243 | - default: |
|
| 244 | - define('SN_RENDER_NAVBAR_PLANET', true); |
|
| 245 | - |
|
| 246 | - require('includes/includes/flt_page0.inc'); |
|
| 247 | - break; |
|
| 217 | + case 1: |
|
| 218 | + require('includes/includes/flt_page1.inc'); |
|
| 219 | + break; |
|
| 220 | + |
|
| 221 | + case 2: |
|
| 222 | + require_once('includes/includes/flt_page2.inc'); |
|
| 223 | + sn_fleet_page2(); |
|
| 224 | + break; |
|
| 225 | + |
|
| 226 | + case 3: |
|
| 227 | + require_once('includes/includes/flt_page3.inc'); |
|
| 228 | + sn_fleet_page3(); |
|
| 229 | + break; |
|
| 230 | + |
|
| 231 | + case 4: |
|
| 232 | + require('includes/includes/flt_page4.inc'); |
|
| 233 | + break; |
|
| 234 | + |
|
| 235 | + case 5: |
|
| 236 | + $template = SnTemplate::gettemplate('fleet5', true); |
|
| 237 | + $pageFleet5Gathering = new \Pages\Deprecated\PageFleet5Gathering(); |
|
| 238 | + $pageFleet5Gathering->modelFleet5Gathering($user, $planetrow, $template); |
|
| 239 | + // Building list of own planets & moons |
|
| 240 | + $pageFleet5Gathering->viewPage5Gathering($user, $planetrow, $template); |
|
| 241 | + break; |
|
| 242 | + |
|
| 243 | + default: |
|
| 244 | + define('SN_RENDER_NAVBAR_PLANET', true); |
|
| 245 | + |
|
| 246 | + require('includes/includes/flt_page0.inc'); |
|
| 247 | + break; |
|
| 248 | 248 | } |
@@ -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; |
@@ -12,11 +12,11 @@ |
||
| 12 | 12 | $time_server = $time_local - $time_diff |
| 13 | 13 | */ |
| 14 | 14 | |
| 15 | -if($font_size = sys_get_param_str('font_size')) { |
|
| 16 | - if(strpos($font_size, '%') !== false) { |
|
| 15 | +if ($font_size = sys_get_param_str('font_size')) { |
|
| 16 | + if (strpos($font_size, '%') !== false) { |
|
| 17 | 17 | // Размер шрифта в процентах |
| 18 | 18 | $font_size = min(max(floatval($font_size), FONT_SIZE_PERCENT_MIN), FONT_SIZE_PERCENT_MAX) . '%'; |
| 19 | - } elseif(strpos($font_size, 'px') !== false) { |
|
| 19 | + } elseif (strpos($font_size, 'px') !== false) { |
|
| 20 | 20 | // Размер шрифта в пикселях |
| 21 | 21 | $font_size = min(max(floatval($font_size), FONT_SIZE_PIXELS_MIN), FONT_SIZE_PIXELS_MAX) . 'px'; |
| 22 | 22 | } else { |
@@ -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'); |
@@ -18,26 +18,26 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | SnTemplate::messageBoxAdminAccessDenied(AUTH_LEVEL_ADMINISTRATOR); |
| 20 | 20 | |
| 21 | -if($delete = sys_get_param_id('delete')) |
|
| 21 | +if ($delete = sys_get_param_id('delete')) |
|
| 22 | 22 | { |
| 23 | 23 | doquery("DELETE FROM `{{logs}}` WHERE `log_id` = {$delete} LIMIT 1;"); |
| 24 | 24 | } |
| 25 | -elseif(sys_get_param_str('delete_update_info')) |
|
| 25 | +elseif (sys_get_param_str('delete_update_info')) |
|
| 26 | 26 | { |
| 27 | 27 | doquery("DELETE FROM `{{logs}}` WHERE `log_code` in (103, 180, 191);"); |
| 28 | 28 | } |
| 29 | -elseif(sys_get_param_str('deleteall') == 'yes') |
|
| 29 | +elseif (sys_get_param_str('deleteall') == 'yes') |
|
| 30 | 30 | { |
| 31 | 31 | // doquery("TRUNCATE TABLE `{{logs}}`"); |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | -if($detail = sys_get_param_id('detail')) |
|
| 34 | +if ($detail = sys_get_param_id('detail')) |
|
| 35 | 35 | { |
| 36 | 36 | $template = SnTemplate::gettemplate('admin/adm_log_main_detail', true); |
| 37 | 37 | |
| 38 | 38 | $errorInfo = doquery("SELECT * FROM `{{logs}}` WHERE `log_id` = {$detail} LIMIT 1;", true); |
| 39 | 39 | $error_dump = unserialize($errorInfo['log_dump']); |
| 40 | - if(is_array($error_dump)) |
|
| 40 | + if (is_array($error_dump)) |
|
| 41 | 41 | { |
| 42 | 42 | foreach ($error_dump as $key => $value) |
| 43 | 43 | { |
@@ -57,11 +57,11 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | $i = 0; |
| 59 | 59 | $query = doquery("SELECT * FROM `{{logs}}` ORDER BY log_id DESC LIMIT 100;"); |
| 60 | - while($u = db_fetch($query)) |
|
| 60 | + while ($u = db_fetch($query)) |
|
| 61 | 61 | { |
| 62 | 62 | $i++; |
| 63 | 63 | $v = array(); |
| 64 | - foreach($u as $key => $value) |
|
| 64 | + foreach ($u as $key => $value) |
|
| 65 | 65 | { |
| 66 | 66 | $v[strtoupper($key)] = $value; |
| 67 | 67 | } |
@@ -21,12 +21,10 @@ discard block |
||
| 21 | 21 | if($delete = sys_get_param_id('delete')) |
| 22 | 22 | { |
| 23 | 23 | doquery("DELETE FROM `{{logs}}` WHERE `log_id` = {$delete} LIMIT 1;"); |
| 24 | -} |
|
| 25 | -elseif(sys_get_param_str('delete_update_info')) |
|
| 24 | +} elseif(sys_get_param_str('delete_update_info')) |
|
| 26 | 25 | { |
| 27 | 26 | doquery("DELETE FROM `{{logs}}` WHERE `log_code` in (103, 180, 191);"); |
| 28 | -} |
|
| 29 | -elseif(sys_get_param_str('deleteall') == 'yes') |
|
| 27 | +} elseif(sys_get_param_str('deleteall') == 'yes') |
|
| 30 | 28 | { |
| 31 | 29 | // doquery("TRUNCATE TABLE `{{logs}}`"); |
| 32 | 30 | } |
@@ -50,8 +48,7 @@ discard block |
||
| 50 | 48 | } |
| 51 | 49 | } |
| 52 | 50 | $template->assign_vars($errorInfo); |
| 53 | -} |
|
| 54 | -else |
|
| 51 | +} else |
|
| 55 | 52 | { |
| 56 | 53 | $template = SnTemplate::gettemplate('admin/adm_log_main', true); |
| 57 | 54 | |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | if ($unit_query_string = admin_planet_edit_query_string($unit_id, $unit_amount, $mode)) { |
| 71 | 71 | $query_string[] = $unit_query_string; |
| 72 | 72 | } |
| 73 | - } elseif (in_array($mode, [UNIT_SHIPS_STR, UNIT_STRUCTURES_STR, UNIT_DEFENCE_STR,]) ) { |
|
| 73 | + } elseif (in_array($mode, [UNIT_SHIPS_STR, UNIT_STRUCTURES_STR, UNIT_DEFENCE_STR, ])) { |
|
| 74 | 74 | if (!floatval($unit_amount)) { |
| 75 | 75 | continue; |
| 76 | 76 | } |
@@ -9,8 +9,8 @@ discard block |
||
| 9 | 9 | * @copyright 2008 by Chlorel for XNova |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -define('INSIDE' , true); |
|
| 13 | -define('INSTALL' , false); |
|
| 12 | +define('INSIDE', true); |
|
| 13 | +define('INSTALL', false); |
|
| 14 | 14 | define('IN_ADMIN', true); |
| 15 | 15 | require_once('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
| 16 | 16 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | SnTemplate::messageBoxAdminAccessDenied(AUTH_LEVEL_ADMINISTRATOR); |
| 20 | 20 | |
| 21 | -if(SN_TIME_NOW >= SN::$config->pass()->var_stat_update_admin_forced && SN_TIME_NOW >= SN::$config->pass()->var_stat_update_end) |
|
| 21 | +if (SN_TIME_NOW >= SN::$config->pass()->var_stat_update_admin_forced && SN_TIME_NOW >= SN::$config->pass()->var_stat_update_end) |
|
| 22 | 22 | { |
| 23 | 23 | SN::$config->pass()->var_stat_update_admin_forced = SN_TIME_NOW + 120; |
| 24 | 24 | |
@@ -37,8 +37,7 @@ |
||
| 37 | 37 | </script>'; |
| 38 | 38 | |
| 39 | 39 | SnTemplate::messageBoxAdmin("{$script}<img src=\"design/images/progressbar.gif\"><br>{$lang['sys_wait']}", $lang['adm_stat_title'], '', 0); |
| 40 | -} |
|
| 41 | -else |
|
| 40 | +} else |
|
| 42 | 41 | { |
| 43 | 42 | SnTemplate::messageBoxAdmin($lang['adm_stat_already_started'], $lang['adm_stat_title'], 'admin/overview.php'); |
| 44 | 43 | } |
@@ -10,8 +10,8 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | use Unit\DBStaticUnit; |
| 12 | 12 | |
| 13 | -define('INSIDE' , true); |
|
| 14 | -define('INSTALL' , false); |
|
| 13 | +define('INSIDE', true); |
|
| 14 | +define('INSTALL', false); |
|
| 15 | 15 | define('IN_ADMIN', true); |
| 16 | 16 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
| 17 | 17 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | $template = SnTemplate::gettemplate('admin/settings', true); |
| 23 | 23 | |
| 24 | -if(sys_get_param('save')) { |
|
| 24 | +if (sys_get_param('save')) { |
|
| 25 | 25 | SN::$config->game_name = sys_get_param_str_unsafe('game_name'); |
| 26 | 26 | SN::$config->game_mode = sys_get_param_int('game_mode'); |
| 27 | 27 | SN::$config->game_speed = sys_get_param_float('game_speed', 1); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | SN::$config->url_faq = sys_get_param_str_unsafe('url_faq'); |
| 32 | 32 | SN::$config->url_forum = sys_get_param_str_unsafe('url_forum'); |
| 33 | 33 | SN::$config->url_rules = sys_get_param_str_unsafe('url_rules'); |
| 34 | - SN::$config->url_purchase_metamatter = sys_get_param_str_unsafe('url_purchase_metamatter'); |
|
| 34 | + SN::$config->url_purchase_metamatter = sys_get_param_str_unsafe('url_purchase_metamatter'); |
|
| 35 | 35 | SN::$config->game_disable = sys_get_param_int('game_disable'); |
| 36 | 36 | SN::$config->game_disable_reason = sys_get_param_str_unsafe('game_disable_reason'); |
| 37 | 37 | SN::$config->server_updater_check_auto = sys_get_param_int('server_updater_check_auto'); |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | SN::$config->stats_schedule = sys_get_param_str('stats_schedule'); |
| 102 | 102 | |
| 103 | 103 | SN::$config->empire_mercenary_base_period = sys_get_param_int('empire_mercenary_base_period'); |
| 104 | - if(SN::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) { |
|
| 105 | - if(SN::$config->empire_mercenary_temporary) { |
|
| 104 | + if (SN::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) { |
|
| 105 | + if (SN::$config->empire_mercenary_temporary) { |
|
| 106 | 106 | DBStaticUnit::db_unit_list_admin_delete_mercenaries_finished(); |
| 107 | 107 | } else { |
| 108 | 108 | DBStaticUnit::db_unit_list_admin_set_mercenaries_expire_time(SN::$config->empire_mercenary_base_period); |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | SnTemplate::tpl_assign_select($template, 'ver_response', SN::$lang['adm_opt_ver_response'], 'ID', 'NAME'); |
| 153 | 153 | |
| 154 | 154 | $lang_list = lng_get_list(); |
| 155 | -foreach($lang_list as $lang_id => $lang_data) { |
|
| 155 | +foreach ($lang_list as $lang_id => $lang_data) { |
|
| 156 | 156 | $template->assign_block_vars('game_languages', array( |
| 157 | 157 | 'ID' => $lang_id, |
| 158 | 158 | 'NAME' => "{$lang_data['LANG_NAME_NATIVE']} ({$lang_data['LANG_NAME_ENGLISH']})", |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | require('../includes/init.' . substr(strrchr(__FILE__, '.'), 1)); |
| 6 | 6 | |
| 7 | -if($user['authlevel'] < 3) |
|
| 7 | +if ($user['authlevel'] < 3) |
|
| 8 | 8 | { |
| 9 | 9 | SnTemplate::messageBox($lang['sys_noalloaw'], $lang['sys_noaccess']); |
| 10 | 10 | die(); |
@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | // [#] info_best_battles 1b0 |
| 21 | 21 | $best_reports = array(); |
| 22 | -if(defined('MODULE_INFO_BEST_BATTLES_QUERY')) { |
|
| 22 | +if (defined('MODULE_INFO_BEST_BATTLES_QUERY')) { |
|
| 23 | 23 | $query = doquery(MODULE_INFO_BEST_BATTLES_QUERY); |
| 24 | - while($row = db_fetch($query)) { |
|
| 24 | + while ($row = db_fetch($query)) { |
|
| 25 | 25 | $best_reports[] = $row['ube_report_id']; |
| 26 | 26 | } |
| 27 | 27 | } |
@@ -188,16 +188,16 @@ discard block |
||
| 188 | 188 | |
| 189 | 189 | function sn_maintenance_pack_user_list($user_list) { |
| 190 | 190 | $user_list = explode(',', $user_list); |
| 191 | - foreach($user_list as $key => $user_id) { |
|
| 192 | - if(!is_numeric($user_id)) { |
|
| 191 | + foreach ($user_list as $key => $user_id) { |
|
| 192 | + if (!is_numeric($user_id)) { |
|
| 193 | 193 | unset($user_list[$key]); |
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | $result = array(); |
| 198 | - if(!empty($user_list)) { |
|
| 198 | + if (!empty($user_list)) { |
|
| 199 | 199 | $query = doquery("SELECT `id` FROM `{{users}}` WHERE `id` in (" . implode(',', $user_list) . ")"); |
| 200 | - while($row = db_fetch($query)) { |
|
| 200 | + while ($row = db_fetch($query)) { |
|
| 201 | 201 | $result[] = $row['id']; |
| 202 | 202 | } |
| 203 | 203 | } |
@@ -212,11 +212,11 @@ discard block |
||
| 212 | 212 | $old_server_status == GAME_DISABLE_NONE ? SN::$config->pass()->game_disable = GAME_DISABLE_MAINTENANCE : false; |
| 213 | 213 | sn_db_transaction_commit(); |
| 214 | 214 | |
| 215 | -foreach($ques as $que_transaction) { |
|
| 215 | +foreach ($ques as $que_transaction) { |
|
| 216 | 216 | sn_db_transaction_start(); |
| 217 | 217 | |
| 218 | 218 | !is_array($que_transaction) ? $que_transaction = array($que_transaction) : false; |
| 219 | - foreach($que_transaction as $que) { |
|
| 219 | + foreach ($que_transaction as $que) { |
|
| 220 | 220 | set_time_limit(120); |
| 221 | 221 | $QryResult = doquery($que); |
| 222 | 222 | //$msg .= '<hr>' . $que . '<hr>'; |