@@ -118,7 +118,7 @@ |
||
| 118 | 118 | * @param mixed $offset <p> |
| 119 | 119 | * The offset to assign the value to. |
| 120 | 120 | * </p> |
| 121 | - * @param mixed $value <p> |
|
| 121 | + * @param Unit $value <p> |
|
| 122 | 122 | * The value to set. |
| 123 | 123 | * </p> |
| 124 | 124 | * |
@@ -19,8 +19,8 @@ discard block |
||
| 19 | 19 | * @param array $arguments |
| 20 | 20 | */ |
| 21 | 21 | public function __call($method_name, array $arguments) { |
| 22 | - foreach($this->_container as $object) { |
|
| 23 | - if(is_object($object) && method_exists($object, $method_name)) { |
|
| 22 | + foreach ($this->_container as $object) { |
|
| 23 | + if (is_object($object) && method_exists($object, $method_name)) { |
|
| 24 | 24 | call_user_func_array(array($object, $method_name), $arguments); |
| 25 | 25 | } |
| 26 | 26 | } |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function getSumProperty($property_name) { |
| 37 | 37 | $result = 0.0; |
| 38 | - foreach($this->_container as $object) { |
|
| 39 | - if(is_object($object) && property_exists($object, $property_name)) { |
|
| 38 | + foreach ($this->_container as $object) { |
|
| 39 | + if (is_object($object) && property_exists($object, $property_name)) { |
|
| 40 | 40 | $result += $object->$property_name; |
| 41 | 41 | } |
| 42 | 42 | } |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | * @return mixed |
| 53 | 53 | */ |
| 54 | 54 | public function aggregateByMethod($method_name, &$result) { |
| 55 | - foreach($this->_container as $object) { |
|
| 56 | - if(is_object($object) && method_exists($object, $method_name)) { |
|
| 55 | + foreach ($this->_container as $object) { |
|
| 56 | + if (is_object($object) && method_exists($object, $method_name)) { |
|
| 57 | 57 | call_user_func(array($object, $method_name), $result); |
| 58 | 58 | } |
| 59 | 59 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | function flt_mission_recycle($mission_data) { |
| 13 | 13 | $objFleet = $mission_data->fleet; |
| 14 | 14 | $destination_planet = &$mission_data->dst_planet; |
| 15 | - if(empty($destination_planet['id'])) { |
|
| 15 | + if (empty($destination_planet['id'])) { |
|
| 16 | 16 | $objFleet->markReturned(); |
| 17 | 17 | $objFleet->dbSave(); |
| 18 | 18 | |
@@ -22,10 +22,10 @@ discard block |
||
| 22 | 22 | $RecyclerCapacity = 0; |
| 23 | 23 | $OtherFleetCapacity = 0; |
| 24 | 24 | |
| 25 | - foreach($objFleet->shipsIterator() as $unit_id => $unit) { |
|
| 26 | - if(in_array($unit_id, Fleet::$snGroupFleet)) { |
|
| 25 | + foreach ($objFleet->shipsIterator() as $unit_id => $unit) { |
|
| 26 | + if (in_array($unit_id, Fleet::$snGroupFleet)) { |
|
| 27 | 27 | $capacity = get_unit_param($unit_id, P_CAPACITY) * $unit->count; |
| 28 | - if(in_array($unit_id, Fleet::$snGroupRecyclers)) { |
|
| 28 | + if (in_array($unit_id, Fleet::$snGroupRecyclers)) { |
|
| 29 | 29 | $RecyclerCapacity += $capacity; |
| 30 | 30 | } else { |
| 31 | 31 | $OtherFleetCapacity += $capacity; |
@@ -34,33 +34,33 @@ discard block |
||
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | $fleet_resources_amount = $objFleet->resourcesGetTotal(); |
| 37 | - if($fleet_resources_amount > $OtherFleetCapacity) { |
|
| 37 | + if ($fleet_resources_amount > $OtherFleetCapacity) { |
|
| 38 | 38 | // Если во флоте есть другие корабли И количество ресурсов больше, чем их ёмкость трюмов - значит часть этих ресурсов лежит в трюмах переработчиков |
| 39 | 39 | // Уменьшаем ёмкость переработчиков на указанную величину |
| 40 | 40 | $RecyclerCapacity -= ($fleet_resources_amount - $OtherFleetCapacity); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | $resources_recycled = array(); |
| 44 | - if(($destination_planet["debris_metal"] + $destination_planet["debris_crystal"]) <= $RecyclerCapacity) { |
|
| 44 | + if (($destination_planet["debris_metal"] + $destination_planet["debris_crystal"]) <= $RecyclerCapacity) { |
|
| 45 | 45 | $resources_recycled[RES_METAL] = $destination_planet["debris_metal"]; |
| 46 | 46 | $resources_recycled[RES_CRYSTAL] = $destination_planet["debris_crystal"]; |
| 47 | 47 | } else { |
| 48 | - if(($destination_planet["debris_metal"] > $RecyclerCapacity / 2) && |
|
| 48 | + if (($destination_planet["debris_metal"] > $RecyclerCapacity / 2) && |
|
| 49 | 49 | ($destination_planet["debris_crystal"] > $RecyclerCapacity / 2) |
| 50 | 50 | ) { |
| 51 | 51 | $resources_recycled[RES_METAL] = $RecyclerCapacity / 2; |
| 52 | 52 | $resources_recycled[RES_CRYSTAL] = $RecyclerCapacity / 2; |
| 53 | 53 | } else { |
| 54 | - if($destination_planet["debris_metal"] > $destination_planet["debris_crystal"]) { |
|
| 54 | + if ($destination_planet["debris_metal"] > $destination_planet["debris_crystal"]) { |
|
| 55 | 55 | $resources_recycled[RES_CRYSTAL] = $destination_planet["debris_crystal"]; |
| 56 | - if($destination_planet["debris_metal"] > ($RecyclerCapacity - $resources_recycled[RES_CRYSTAL])) { |
|
| 56 | + if ($destination_planet["debris_metal"] > ($RecyclerCapacity - $resources_recycled[RES_CRYSTAL])) { |
|
| 57 | 57 | $resources_recycled[RES_METAL] = $RecyclerCapacity - $resources_recycled[RES_CRYSTAL]; |
| 58 | 58 | } else { |
| 59 | 59 | $resources_recycled[RES_METAL] = $destination_planet["debris_metal"]; |
| 60 | 60 | } |
| 61 | 61 | } else { |
| 62 | 62 | $resources_recycled[RES_METAL] = $destination_planet["debris_metal"]; |
| 63 | - if($destination_planet["debris_crystal"] > ($RecyclerCapacity - $resources_recycled[RES_METAL])) { |
|
| 63 | + if ($destination_planet["debris_crystal"] > ($RecyclerCapacity - $resources_recycled[RES_METAL])) { |
|
| 64 | 64 | $resources_recycled[RES_CRYSTAL] = $RecyclerCapacity - $resources_recycled[RES_METAL]; |
| 65 | 65 | } else { |
| 66 | 66 | $resources_recycled[RES_CRYSTAL] = $destination_planet["debris_crystal"]; |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | $destination_planet = &$mission_data->dst_planet; |
| 16 | 16 | |
| 17 | - if(empty($destination_planet['id_owner']) || $objFleet->playerOwnerId != $destination_planet['id_owner']) { |
|
| 17 | + if (empty($destination_planet['id_owner']) || $objFleet->playerOwnerId != $destination_planet['id_owner']) { |
|
| 18 | 18 | $objFleet->markReturnedAndSave(); |
| 19 | 19 | |
| 20 | 20 | return CACHE_FLEET; |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | $fleet_resources[RES_METAL], classLocale::$lang['Metal'], |
| 28 | 28 | $fleet_resources[RES_CRYSTAL], classLocale::$lang['Crystal'], |
| 29 | 29 | $fleet_resources[RES_DEUTERIUM], classLocale::$lang['Deuterium'] |
| 30 | - ) . '<br />' . classLocale::$lang['sys_relocate_mess_user']; |
|
| 31 | - foreach($objFleet->shipsIterator() as $ship_id => $ship) { |
|
| 32 | - $Message .= classLocale::$lang['tech'][$ship_id] . ' - ' . $ship->count . '<br />'; |
|
| 30 | + ).'<br />'.classLocale::$lang['sys_relocate_mess_user']; |
|
| 31 | + foreach ($objFleet->shipsIterator() as $ship_id => $ship) { |
|
| 32 | + $Message .= classLocale::$lang['tech'][$ship_id].' - '.$ship->count.'<br />'; |
|
| 33 | 33 | } |
| 34 | 34 | DBStaticMessages::msg_send_simple_message( |
| 35 | 35 | $objFleet->playerOwnerId, '', $objFleet->time_arrive_to_target, MSG_TYPE_TRANSPORT, |
@@ -39,23 +39,23 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | $sta_update_msg = db_escape($sta_update_msg); |
| 41 | 41 | |
| 42 | - if($next_step) { |
|
| 42 | + if ($next_step) { |
|
| 43 | 43 | $sta_update_step++; |
| 44 | 44 | } |
| 45 | 45 | $sta_update_msg = "Update in progress. Step {$sta_update_step}/14: {$sta_update_msg}."; |
| 46 | 46 | |
| 47 | 47 | classSupernova::$config->db_saveItem('var_stat_update_msg', $sta_update_msg); |
| 48 | - if($next_step) { |
|
| 48 | + if ($next_step) { |
|
| 49 | 49 | classSupernova::$debug->warning($sta_update_msg, 'Stat update', LOG_INFO_STAT_PROCESS); |
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | function sys_stat_calculate_flush(&$data, $force = false) { |
| 54 | - if(count($data) < 25 && !$force) { |
|
| 54 | + if (count($data) < 25 && !$force) { |
|
| 55 | 55 | return; |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - if(!empty($data)) { |
|
| 58 | + if (!empty($data)) { |
|
| 59 | 59 | doquery('REPLACE INTO {{statpoints}} |
| 60 | 60 | (`id_owner`, `id_ally`, `stat_type`, `stat_code`, `tech_points`, `tech_count`, `build_points`, `build_count`, |
| 61 | 61 | `defs_points`, `defs_count`, `fleet_points`, `fleet_count`, `res_points`, `res_count`, `total_points`, |
@@ -95,11 +95,11 @@ discard block |
||
| 95 | 95 | $user_list = DBStaticUser::db_user_list('', true, 'id, dark_matter, metal, crystal, deuterium, user_as_ally, ally_id'); |
| 96 | 96 | $row_num = count($user_list); |
| 97 | 97 | // while($player = db_fetch($query)) |
| 98 | - foreach($user_list as $player) { |
|
| 99 | - if($i++ % 100 == 0) { |
|
| 98 | + foreach ($user_list as $player) { |
|
| 99 | + if ($i++ % 100 == 0) { |
|
| 100 | 100 | sta_set_time_limit("calculating players stats (player {$i}/{$row_num})", false); |
| 101 | 101 | } |
| 102 | - if(array_key_exists($user_id = $player['id'], $user_skip_list)) { |
|
| 102 | + if (array_key_exists($user_id = $player['id'], $user_skip_list)) { |
|
| 103 | 103 | continue; |
| 104 | 104 | } |
| 105 | 105 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | // $points[$user_id][UNIT_RESOURCES] += $resources; |
| 110 | 110 | |
| 111 | 111 | // А здесь мы фильтруем пользователей по $user_skip_list - далее не нужно этого делать, потому что |
| 112 | - if(!isset($user_skip_list[$user_id])) { |
|
| 112 | + if (!isset($user_skip_list[$user_id])) { |
|
| 113 | 113 | $user_allies[$user_id] = $player['ally_id']; |
| 114 | 114 | } |
| 115 | 115 | } |
@@ -123,11 +123,11 @@ discard block |
||
| 123 | 123 | $i = 0; |
| 124 | 124 | $query = DBStaticPlanet::db_planet_list_resources_by_owner(); |
| 125 | 125 | $row_num = db_num_rows($query); |
| 126 | - while($planet = db_fetch($query)) { |
|
| 127 | - if($i++ % 100 == 0) { |
|
| 126 | + while ($planet = db_fetch($query)) { |
|
| 127 | + if ($i++ % 100 == 0) { |
|
| 128 | 128 | sta_set_time_limit("calculating planets stats (planet {$i}/{$row_num})", false); |
| 129 | 129 | } |
| 130 | - if(array_key_exists($user_id = $planet['id_owner'], $user_skip_list)) { |
|
| 130 | + if (array_key_exists($user_id = $planet['id_owner'], $user_skip_list)) { |
|
| 131 | 131 | continue; |
| 132 | 132 | } |
| 133 | 133 | |
@@ -142,8 +142,8 @@ discard block |
||
| 142 | 142 | $i = 0; |
| 143 | 143 | $query = FleetList::dbQueryAllId(); |
| 144 | 144 | $row_num = db_num_rows($query); |
| 145 | - while($fleet_row = db_fetch($query)) { |
|
| 146 | - if($i++ % 100 == 0) { |
|
| 145 | + while ($fleet_row = db_fetch($query)) { |
|
| 146 | + if ($i++ % 100 == 0) { |
|
| 147 | 147 | sta_set_time_limit("calculating flying fleets stats (fleet {$i}/{$row_num})", false); |
| 148 | 148 | } |
| 149 | 149 | $objFleet = new Fleet(); |
@@ -151,14 +151,14 @@ discard block |
||
| 151 | 151 | // К тому же при включённом кэшировании это быстро забъёт кэш холодными данными |
| 152 | 152 | // $objFleet->_reset(); |
| 153 | 153 | $objFleet->dbRowParse($fleet_row); |
| 154 | - if(array_key_exists($user_id = $objFleet->playerOwnerId, $user_skip_list)) { |
|
| 154 | + if (array_key_exists($user_id = $objFleet->playerOwnerId, $user_skip_list)) { |
|
| 155 | 155 | continue; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - foreach($objFleet->shipsIterator() as $unit_id => $unit) { |
|
| 158 | + foreach ($objFleet->shipsIterator() as $unit_id => $unit) { |
|
| 159 | 159 | $counts[$user_id][UNIT_SHIPS] += $unit->count; |
| 160 | 160 | |
| 161 | - if(!isset($unit_cost_cache[$unit_id][0])) { |
|
| 161 | + if (!isset($unit_cost_cache[$unit_id][0])) { |
|
| 162 | 162 | $unit_cost_cache[$unit_id][0] = get_unit_param($unit_id, P_COST); |
| 163 | 163 | } |
| 164 | 164 | $unit_cost_data = &$unit_cost_cache[$unit_id][0]; |
@@ -178,11 +178,11 @@ discard block |
||
| 178 | 178 | $i = 0; |
| 179 | 179 | $query = DBStaticUnit::db_unit_list_stat_calculate(); |
| 180 | 180 | $row_num = db_num_rows($query); |
| 181 | - while($unit = db_fetch($query)) { |
|
| 182 | - if($i++ % 100 == 0) { |
|
| 181 | + while ($unit = db_fetch($query)) { |
|
| 182 | + if ($i++ % 100 == 0) { |
|
| 183 | 183 | sta_set_time_limit("calculating unit stats (unit {$i}/{$row_num})", false); |
| 184 | 184 | } |
| 185 | - if(array_key_exists($user_id = $unit['unit_player_id'], $user_skip_list)) { |
|
| 185 | + if (array_key_exists($user_id = $unit['unit_player_id'], $user_skip_list)) { |
|
| 186 | 186 | continue; |
| 187 | 187 | } |
| 188 | 188 | |
@@ -196,11 +196,11 @@ discard block |
||
| 196 | 196 | $i = 0; |
| 197 | 197 | $query = DBStaticQue::db_que_list_stat(); |
| 198 | 198 | $row_num = db_num_rows($query); |
| 199 | - while($que_item = db_fetch($query)) { |
|
| 200 | - if($i++ % 100 == 0) { |
|
| 199 | + while ($que_item = db_fetch($query)) { |
|
| 200 | + if ($i++ % 100 == 0) { |
|
| 201 | 201 | sta_set_time_limit("calculating ques stats (que item {$i}/{$row_num})", false); |
| 202 | 202 | } |
| 203 | - if(array_key_exists($user_id = $que_item['que_player_id'], $user_skip_list)) { |
|
| 203 | + if (array_key_exists($user_id = $que_item['que_player_id'], $user_skip_list)) { |
|
| 204 | 204 | continue; |
| 205 | 205 | } |
| 206 | 206 | $que_unit_amount = $que_item['que_unit_amount']; |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | |
| 220 | 220 | sta_set_time_limit('posting new user stats to DB'); |
| 221 | 221 | $data = array(); |
| 222 | - foreach($user_allies as $user_id => $ally_id) { |
|
| 222 | + foreach ($user_allies as $user_id => $ally_id) { |
|
| 223 | 223 | // $counts[UNIT_RESOURCES] дублирует $points[UNIT_RESOURCES], поэтому $points не заполняем, а берем $counts и делим на 1000 |
| 224 | 224 | $points[$user_id][UNIT_RESOURCES] = $counts[$user_id][UNIT_RESOURCES] / 1000; |
| 225 | 225 | $points[$user_id] = array_map('floor', $points[$user_id]); |
@@ -231,10 +231,10 @@ discard block |
||
| 231 | 231 | $user_points = array_sum($points[$user_id]); |
| 232 | 232 | $user_counts = array_sum($counts[$user_id]); |
| 233 | 233 | |
| 234 | - $data[] = $q = "({$user_id},{$ally_id},1,1,'{$points[$user_id][UNIT_TECHNOLOGIES]}','{$counts[$user_id][UNIT_TECHNOLOGIES]}'," . |
|
| 235 | - "'{$points[$user_id][UNIT_STRUCTURES]}','{$counts[$user_id][UNIT_STRUCTURES]}','{$user_defence_points}','{$user_defence_counts}'," . |
|
| 236 | - "'{$points[$user_id][UNIT_SHIPS]}','{$counts[$user_id][UNIT_SHIPS]}','{$points[$user_id][UNIT_RESOURCES]}','{$counts[$user_id][UNIT_RESOURCES]}'," . |
|
| 237 | - "{$user_points},{$user_counts}," . SN_TIME_NOW . ")"; |
|
| 234 | + $data[] = $q = "({$user_id},{$ally_id},1,1,'{$points[$user_id][UNIT_TECHNOLOGIES]}','{$counts[$user_id][UNIT_TECHNOLOGIES]}',". |
|
| 235 | + "'{$points[$user_id][UNIT_STRUCTURES]}','{$counts[$user_id][UNIT_STRUCTURES]}','{$user_defence_points}','{$user_defence_counts}',". |
|
| 236 | + "'{$points[$user_id][UNIT_SHIPS]}','{$counts[$user_id][UNIT_SHIPS]}','{$points[$user_id][UNIT_RESOURCES]}','{$counts[$user_id][UNIT_RESOURCES]}',". |
|
| 237 | + "{$user_points},{$user_counts},".SN_TIME_NOW.")"; |
|
| 238 | 238 | |
| 239 | 239 | sys_stat_calculate_flush($data); |
| 240 | 240 | } |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | SUM(u.`tech_points`)+aus.`tech_points`, SUM(u.`tech_count`)+aus.`tech_count`, SUM(u.`build_points`)+aus.`build_points`, SUM(u.`build_count`)+aus.`build_count`, |
| 255 | 255 | SUM(u.`defs_points`)+aus.`defs_points`, SUM(u.`defs_count`)+aus.`defs_count`, SUM(u.`fleet_points`)+aus.`fleet_points`, SUM(u.`fleet_count`)+aus.`fleet_count`, |
| 256 | 256 | SUM(u.`res_points`)+aus.`res_points`, SUM(u.`res_count`)+aus.`res_count`, SUM(u.`total_points`)+aus.`total_points`, SUM(u.`total_count`)+aus.`total_count`, |
| 257 | - " . SN_TIME_NOW . ", NULL, u.`id_ally`, 2, 1, |
|
| 257 | + " . SN_TIME_NOW.", NULL, u.`id_ally`, 2, 1, |
|
| 258 | 258 | a.tech_rank, a.build_rank, a.defs_rank, a.fleet_rank, a.res_rank, a.total_rank |
| 259 | 259 | FROM {{statpoints}} AS u |
| 260 | 260 | JOIN {{alliance}} AS al ON al.id = u.id_ally |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | |
| 276 | 276 | // Updating player's ranks |
| 277 | 277 | sta_set_time_limit("updating ranks for players"); |
| 278 | - foreach($rankNames as $rankName) { |
|
| 278 | + foreach ($rankNames as $rankName) { |
|
| 279 | 279 | sta_set_time_limit("updating player rank '{$rankName}'", false); |
| 280 | 280 | doquery($qryResetRowNum); |
| 281 | 281 | doquery(sprintf($qryFormat, $rankName, 1)); |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | sta_set_time_limit("updating ranks for Alliances"); |
| 285 | 285 | // --- Updating Allie's ranks |
| 286 | - foreach($rankNames as $rankName) { |
|
| 286 | + foreach ($rankNames as $rankName) { |
|
| 287 | 287 | sta_set_time_limit("updating Alliances rank '{$rankName}'", false); |
| 288 | 288 | doquery($qryResetRowNum); |
| 289 | 289 | doquery(sprintf($qryFormat, $rankName, 2)); |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * Galaxy view |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
| 9 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
| 10 | 10 | |
| 11 | 11 | lng_include('universe'); |
| 12 | 12 | lng_include('stat'); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | $uni_system = sys_get_param_int('system', $planetrow['system']); |
| 17 | 17 | $planet = sys_get_param_int('planet', $planetrow['planet']); |
| 18 | 18 | |
| 19 | -if($mode == 'name') { |
|
| 19 | +if ($mode == 'name') { |
|
| 20 | 20 | require_once('includes/includes/uni_rename.php'); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -37,8 +37,8 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | $flying_fleet_count = FleetList::fleet_count_flying($user['id']); |
| 39 | 39 | |
| 40 | -if($mode == 1) { |
|
| 41 | -} elseif($mode == 2 || $mode == 3) { |
|
| 40 | +if ($mode == 1) { |
|
| 41 | +} elseif ($mode == 2 || $mode == 3) { |
|
| 42 | 42 | $planet = $planetrow['planet']; |
| 43 | 43 | } else { |
| 44 | 44 | $uni_galaxy = $planetrow['galaxy']; |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $planet = $planetrow['planet']; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | -$uni_galaxy = $uni_galaxy < 1 ? 1 : ($uni_galaxy > Vector::$knownGalaxies? Vector::$knownGalaxies: $uni_galaxy); |
|
| 49 | +$uni_galaxy = $uni_galaxy < 1 ? 1 : ($uni_galaxy > Vector::$knownGalaxies ? Vector::$knownGalaxies : $uni_galaxy); |
|
| 50 | 50 | $uni_system = $uni_system < 1 ? 1 : ($uni_system > Vector::$knownSystems ? Vector::$knownSystems : $uni_system); |
| 51 | 51 | $planet = $planet < 1 ? 1 : ($planet > Vector::$knownPlanets + 1 ? Vector::$knownPlanets + 1 : $planet); |
| 52 | 52 | |
@@ -64,8 +64,8 @@ discard block |
||
| 64 | 64 | $PhalanxRange = GetPhalanxRange($HavePhalanx); |
| 65 | 65 | |
| 66 | 66 | $planet_precache_query = DBStaticPlanet::db_planet_list_in_system($uni_galaxy, $uni_system); |
| 67 | -if(!empty($planet_precache_query)) { |
|
| 68 | - foreach($planet_precache_query as $planet_row) { |
|
| 67 | +if (!empty($planet_precache_query)) { |
|
| 68 | + foreach ($planet_precache_query as $planet_row) { |
|
| 69 | 69 | $planet_list[$planet_row['planet']][$planet_row['planet_type']] = $planet_row; |
| 70 | 70 | } |
| 71 | 71 | } |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | * @var Fleet[][][] $fleet_list |
| 84 | 84 | */ |
| 85 | 85 | $fleet_list = array(); |
| 86 | -foreach($system_fleet_list->_container as $objFleetSystem) { |
|
| 87 | - if(!$objFleetSystem->isReturning()) { |
|
| 86 | +foreach ($system_fleet_list->_container as $objFleetSystem) { |
|
| 87 | + if (!$objFleetSystem->isReturning()) { |
|
| 88 | 88 | $fleet_planet = $objFleetSystem->fleet_end_planet; |
| 89 | 89 | $fleet_type = $objFleetSystem->fleet_end_type; |
| 90 | 90 | } else { |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | $recycler_info = array(); |
| 100 | 100 | $planet_recyclers_orbiting = 0; |
| 101 | 101 | $recyclers_fleet = array(); |
| 102 | -foreach(Fleet::$snGroupRecyclers as $recycler_id) { |
|
| 102 | +foreach (Fleet::$snGroupRecyclers as $recycler_id) { |
|
| 103 | 103 | $recycler_info[$recycler_id] = get_ship_data($recycler_id, $user); |
| 104 | 104 | $recyclers_fleet[$recycler_id] = mrc_get_level($user, $planetrow, $recycler_id); |
| 105 | 105 | $planet_recyclers_orbiting += $recyclers_fleet[$recycler_id]; |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | $fleet_id = 1; |
| 110 | 110 | $fleets = array(); |
| 111 | 111 | $config_game_max_planet = Vector::$knownPlanets + 1; |
| 112 | -for($Planet = 1; $Planet < $config_game_max_planet; $Planet++) { |
|
| 112 | +for ($Planet = 1; $Planet < $config_game_max_planet; $Planet++) { |
|
| 113 | 113 | unset($uni_galaxyRowPlanet); |
| 114 | 114 | unset($uni_galaxyRowMoon); |
| 115 | 115 | unset($uni_galaxyRowUser); |
@@ -119,27 +119,27 @@ discard block |
||
| 119 | 119 | $uni_galaxyRowPlanet = $planet_list[$Planet][PT_PLANET]; |
| 120 | 120 | |
| 121 | 121 | $planet_fleet_id = 0; |
| 122 | - if($uni_galaxyRowPlanet['destruyed']) { |
|
| 122 | + if ($uni_galaxyRowPlanet['destruyed']) { |
|
| 123 | 123 | CheckAbandonPlanetState($uni_galaxyRowPlanet); |
| 124 | - } elseif($uni_galaxyRowPlanet['id']) { |
|
| 125 | - if($cached['users'][$uni_galaxyRowPlanet['id_owner']]) { |
|
| 124 | + } elseif ($uni_galaxyRowPlanet['id']) { |
|
| 125 | + if ($cached['users'][$uni_galaxyRowPlanet['id_owner']]) { |
|
| 126 | 126 | $uni_galaxyRowUser = $cached['users'][$uni_galaxyRowPlanet['id_owner']]; |
| 127 | 127 | } else { |
| 128 | 128 | $uni_galaxyRowUser = DBStaticUser::db_user_by_id($uni_galaxyRowPlanet['id_owner']); |
| 129 | 129 | $cached['users'][$uni_galaxyRowUser['id']] = $uni_galaxyRowUser; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | - if(!$uni_galaxyRowUser['id']) { |
|
| 132 | + if (!$uni_galaxyRowUser['id']) { |
|
| 133 | 133 | classSupernova::$debug->warning("Planet '{$uni_galaxyRowPlanet['name']}' [{$uni_galaxy}:{$uni_system}:{$Planet}] has no owner!", 'Userless planet', 503); |
| 134 | 134 | $uni_galaxyRowPlanet['destruyed'] = SN_TIME_NOW + 60 * 60 * 24; |
| 135 | 135 | $uni_galaxyRowPlanet['id_owner'] = 0; |
| 136 | 136 | DBStaticPlanet::db_planet_set_by_id($uni_galaxyRowPlanet['id'], "id_owner = 0, destruyed = {$uni_galaxyRowPlanet['destruyed']}"); |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | - if($uni_galaxyRowUser['id']) { |
|
| 139 | + if ($uni_galaxyRowUser['id']) { |
|
| 140 | 140 | $planetcount++; |
| 141 | - if($uni_galaxyRowUser['ally_id']) { |
|
| 142 | - if($cached['allies'][$uni_galaxyRowUser['ally_id']]) { |
|
| 141 | + if ($uni_galaxyRowUser['ally_id']) { |
|
| 142 | + if ($cached['allies'][$uni_galaxyRowUser['ally_id']]) { |
|
| 143 | 143 | $allyquery = $cached['allies'][$uni_galaxyRowUser['ally_id']]; |
| 144 | 144 | } else { |
| 145 | 145 | $allyquery = DBStaticAlly::db_ally_get_by_id($uni_galaxyRowUser['ally_id']); |
@@ -148,19 +148,19 @@ discard block |
||
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | $fleets_to_planet = flt_get_fleets_to_planet_by_array_of_Fleet($fleet_list[$Planet][PT_PLANET]); |
| 151 | - if(!empty($fleets_to_planet['own']['count'])) { |
|
| 151 | + if (!empty($fleets_to_planet['own']['count'])) { |
|
| 152 | 152 | $planet_fleet_id = $fleet_id; |
| 153 | 153 | $fleets[] = tpl_parse_fleet_sn($fleets_to_planet['own']['total'], $fleet_id); |
| 154 | 154 | $fleet_id++; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | $uni_galaxyRowMoon = $planet_list[$Planet][PT_MOON]; |
| 158 | - if($uni_galaxyRowMoon['destruyed']) { |
|
| 158 | + if ($uni_galaxyRowMoon['destruyed']) { |
|
| 159 | 159 | CheckAbandonPlanetState($uni_galaxyRowMoon); |
| 160 | 160 | } else { |
| 161 | 161 | $moon_fleet_id = 0; |
| 162 | 162 | $fleets_to_planet = flt_get_fleets_to_planet_by_array_of_Fleet($fleet_list[$Planet][PT_MOON]); |
| 163 | - if(!empty($fleets_to_planet['own']['count'])) { |
|
| 163 | + if (!empty($fleets_to_planet['own']['count'])) { |
|
| 164 | 164 | $moon_fleet_id = $fleet_id; |
| 165 | 165 | $fleets[] = tpl_parse_fleet_sn($fleets_to_planet['own']['total'], $fleet_id); |
| 166 | 166 | $fleet_id++; |
@@ -171,10 +171,10 @@ discard block |
||
| 171 | 171 | |
| 172 | 172 | $recyclers_incoming_capacity = 0; |
| 173 | 173 | $uni_galaxyRowPlanet['debris'] = $uni_galaxyRowPlanet['debris_metal'] + $uni_galaxyRowPlanet['debris_crystal']; |
| 174 | - if($uni_galaxyRowPlanet['debris']) { |
|
| 175 | - if(!empty($fleet_list[$Planet][PT_DEBRIS])) { |
|
| 176 | - foreach($fleet_list[$Planet][PT_DEBRIS] as $objFleetToDebris) { |
|
| 177 | - if($objFleetToDebris->playerOwnerId == $user['id']) { |
|
| 174 | + if ($uni_galaxyRowPlanet['debris']) { |
|
| 175 | + if (!empty($fleet_list[$Planet][PT_DEBRIS])) { |
|
| 176 | + foreach ($fleet_list[$Planet][PT_DEBRIS] as $objFleetToDebris) { |
|
| 177 | + if ($objFleetToDebris->playerOwnerId == $user['id']) { |
|
| 178 | 178 | $recyclers_incoming_capacity += $objFleetToDebris->shipsGetCapacityRecyclers($recycler_info); |
| 179 | 179 | } |
| 180 | 180 | } |
@@ -251,21 +251,21 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | tpl_assign_fleet($template, $fleets); |
| 253 | 253 | |
| 254 | -foreach(sn_get_groups('defense_active') as $unit_id) { |
|
| 254 | +foreach (sn_get_groups('defense_active') as $unit_id) { |
|
| 255 | 255 | $template->assign_block_vars('defense_active', array( |
| 256 | 256 | 'ID' => $unit_id, |
| 257 | 257 | 'NAME' => classLocale::$lang['tech'][$unit_id], |
| 258 | 258 | )); |
| 259 | 259 | } |
| 260 | 260 | |
| 261 | -foreach($cached['users'] as $PlanetUser) { |
|
| 262 | - if(!$PlanetUser) { |
|
| 261 | +foreach ($cached['users'] as $PlanetUser) { |
|
| 262 | + if (!$PlanetUser) { |
|
| 263 | 263 | continue; |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | $user_ally = $cached['allies'][$PlanetUser['ally_id']]; |
| 267 | - if(isset($user_ally)) { |
|
| 268 | - if($PlanetUser['id'] == $user_ally['ally_owner']) { |
|
| 267 | + if (isset($user_ally)) { |
|
| 268 | + if ($PlanetUser['id'] == $user_ally['ally_owner']) { |
|
| 269 | 269 | $user_rank_title = $user_ally['ally_owner_range']; |
| 270 | 270 | } else { |
| 271 | 271 | $ally_ranks = explode(';', $user_ally['ranklist']); |
@@ -288,8 +288,8 @@ discard block |
||
| 288 | 288 | )); |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | -foreach($cached['allies'] as $PlanetAlly) { |
|
| 292 | - if($PlanetAlly) { |
|
| 291 | +foreach ($cached['allies'] as $PlanetAlly) { |
|
| 292 | + if ($PlanetAlly) { |
|
| 293 | 293 | $template->assign_block_vars('alliances', array( |
| 294 | 294 | 'ID' => $PlanetAlly['id'], |
| 295 | 295 | 'NAME_JS' => js_safe_string($PlanetAlly['ally_name']), |
@@ -103,23 +103,23 @@ |
||
| 103 | 103 | |
| 104 | 104 | !empty(classSupernova::$config->url_faq) ? $msg = str_replace('faq://', classSupernova::$config->url_faq, $msg) : false; |
| 105 | 105 | |
| 106 | - foreach(classSupernova::$design['bbcodes'] as $auth_level => $replaces) { |
|
| 107 | - if($auth_level > $author_auth) { |
|
| 106 | + foreach (classSupernova::$design['bbcodes'] as $auth_level => $replaces) { |
|
| 107 | + if ($auth_level > $author_auth) { |
|
| 108 | 108 | continue; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - foreach($replaces as $key => $html) { |
|
| 111 | + foreach ($replaces as $key => $html) { |
|
| 112 | 112 | $msg = preg_replace(''.$key.'', $html, $msg); |
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - foreach(classSupernova::$design['smiles'] as $auth_level => $replaces) { |
|
| 117 | - if($auth_level > $author_auth) { |
|
| 116 | + foreach (classSupernova::$design['smiles'] as $auth_level => $replaces) { |
|
| 117 | + if ($auth_level > $author_auth) { |
|
| 118 | 118 | continue; |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - foreach($replaces as $key => $imgName) { |
|
| 122 | - $msg = preg_replace("#" . addcslashes($key, '()[]{}') . "#isU","<img src=\"design/images/smileys/".$imgName.".gif\" align=\"absmiddle\" title=\"".$key."\" alt=\"".$key."\">",$msg); |
|
| 121 | + foreach ($replaces as $key => $imgName) { |
|
| 122 | + $msg = preg_replace("#".addcslashes($key, '()[]{}')."#isU", "<img src=\"design/images/smileys/".$imgName.".gif\" align=\"absmiddle\" title=\"".$key."\" alt=\"".$key."\">", $msg); |
|
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | |
@@ -12,10 +12,10 @@ discard block |
||
| 12 | 12 | define('INSIDE', true); |
| 13 | 13 | define('INSTALL', false); |
| 14 | 14 | define('IN_ADMIN', true); |
| 15 | -require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
| 15 | +require('../common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
| 16 | 16 | |
| 17 | 17 | global $user; |
| 18 | -if($user['authlevel'] < 3) { |
|
| 18 | +if ($user['authlevel'] < 3) { |
|
| 19 | 19 | AdminMessage(classLocale::$lang['adm_err_denied']); |
| 20 | 20 | } |
| 21 | 21 | |
@@ -39,10 +39,10 @@ discard block |
||
| 39 | 39 | $sort = sys_get_param_int('sort', SORT_ID); |
| 40 | 40 | $sort = $sort_fields[$sort] ? $sort : SORT_ID; |
| 41 | 41 | |
| 42 | -if(($action = sys_get_param_int('action')) && ($user_id = sys_get_param_id('uid'))) { |
|
| 42 | +if (($action = sys_get_param_int('action')) && ($user_id = sys_get_param_id('uid'))) { |
|
| 43 | 43 | $user_selected = DBStaticUser::db_user_by_id($user_id, false, 'id, username, authlevel'); |
| 44 | - if($user_selected['authlevel'] < $user['authlevel'] && $user['authlevel'] >= 3) { |
|
| 45 | - switch($action) { |
|
| 44 | + if ($user_selected['authlevel'] < $user['authlevel'] && $user['authlevel'] >= 3) { |
|
| 45 | + switch ($action) { |
|
| 46 | 46 | case ACTION_DELETE: |
| 47 | 47 | DeleteSelectedUser($user_id); |
| 48 | 48 | sys_redirect("{$_SERVER['SCRIPT_NAME']}?sort={$sort}"); |
@@ -62,20 +62,20 @@ discard block |
||
| 62 | 62 | $template = gettemplate('admin/userlist', true); |
| 63 | 63 | |
| 64 | 64 | $multi_ip = array(); |
| 65 | -foreach(DBStaticUser::db_user_list_admin_multiaccounts() as $ip) { |
|
| 65 | +foreach (DBStaticUser::db_user_list_admin_multiaccounts() as $ip) { |
|
| 66 | 66 | $multi_ip[$ip['user_lastip']] = $ip['ip_count']; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $geoip = geoip_status(); |
| 70 | 70 | $count = 0; |
| 71 | -foreach(DBStaticUser::db_user_list_admin_sorted($sort_fields[$sort], $is_players_online_page) as $user_row ) { |
|
| 71 | +foreach (DBStaticUser::db_user_list_admin_sorted($sort_fields[$sort], $is_players_online_page) as $user_row) { |
|
| 72 | 72 | $count++; |
| 73 | - if($user_row['banaday']) { |
|
| 73 | + if ($user_row['banaday']) { |
|
| 74 | 74 | $ban_details = db_ban_list_get_details($user_row); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | $geoip_info = $geoip ? geoip_ip_info(ip2longu($user_row['user_lastip'])) : array(); |
| 78 | - foreach($geoip_info as $key => $value) { |
|
| 78 | + foreach ($geoip_info as $key => $value) { |
|
| 79 | 79 | $geoip_info[strtoupper($key)] = $value; |
| 80 | 80 | unset($geoip_info[$key]); |
| 81 | 81 | } |
@@ -116,12 +116,12 @@ |
||
| 116 | 116 | * @return static |
| 117 | 117 | */ |
| 118 | 118 | public static function convertToVector($coordinates, $prefix = '') { |
| 119 | - $galaxy = !empty($coordinates[$prefix . 'galaxy']) ? intval($coordinates[$prefix . 'galaxy']) : 0; |
|
| 120 | - $system = !empty($coordinates[$prefix . 'system']) ? intval($coordinates[$prefix . 'system']) : 0; |
|
| 121 | - $planet = !empty($coordinates[$prefix . 'planet']) ? intval($coordinates[$prefix . 'planet']) : 0; |
|
| 122 | - $type = !empty($coordinates[$prefix . 'type']) |
|
| 123 | - ? intval($coordinates[$prefix . 'type']) |
|
| 124 | - : (!empty($coordinates[$prefix . 'planet_type']) ? intval($coordinates[$prefix . 'planet_type']) : 0); |
|
| 119 | + $galaxy = !empty($coordinates[$prefix.'galaxy']) ? intval($coordinates[$prefix.'galaxy']) : 0; |
|
| 120 | + $system = !empty($coordinates[$prefix.'system']) ? intval($coordinates[$prefix.'system']) : 0; |
|
| 121 | + $planet = !empty($coordinates[$prefix.'planet']) ? intval($coordinates[$prefix.'planet']) : 0; |
|
| 122 | + $type = !empty($coordinates[$prefix.'type']) |
|
| 123 | + ? intval($coordinates[$prefix.'type']) |
|
| 124 | + : (!empty($coordinates[$prefix.'planet_type']) ? intval($coordinates[$prefix.'planet_type']) : 0); |
|
| 125 | 125 | |
| 126 | 126 | return new static($galaxy, $system, $planet, $type); |
| 127 | 127 | } |