@@ -69,8 +69,8 @@ |
||
| 69 | 69 | |
| 70 | 70 | /** |
| 71 | 71 | * @param Fleet $objFleet |
| 72 | - * @param $ov_label |
|
| 73 | - * @param $planet_end_type |
|
| 72 | + * @param integer $ov_label |
|
| 73 | + * @param integer $planet_end_type |
|
| 74 | 74 | * |
| 75 | 75 | * @return mixed |
| 76 | 76 | */ |
@@ -6,26 +6,26 @@ discard block |
||
| 6 | 6 | $fleet_events = array(); |
| 7 | 7 | $fleet_number = 0; |
| 8 | 8 | |
| 9 | - if($objFleetList->count() <= 0) { |
|
| 9 | + if ($objFleetList->count() <= 0) { |
|
| 10 | 10 | return; |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | - foreach($objFleetList->_container as $objFleet) { |
|
| 13 | + foreach ($objFleetList->_container as $objFleet) { |
|
| 14 | 14 | $planet_start_type = $objFleet->fleet_start_type == PT_MOON ? PT_MOON : PT_PLANET; |
| 15 | 15 | $planet_start = db_planet_by_gspt($objFleet->fleet_start_galaxy, $objFleet->fleet_start_system, $objFleet->fleet_start_planet, $planet_start_type, false, 'name'); |
| 16 | 16 | $objFleet->fleet_start_name = $planet_start['name']; |
| 17 | 17 | |
| 18 | 18 | $planet_end_type = $objFleet->fleet_end_type == PT_MOON ? PT_MOON : PT_PLANET; |
| 19 | - if($objFleet->fleet_end_planet > $config->game_maxPlanet) { |
|
| 19 | + if ($objFleet->fleet_end_planet > $config->game_maxPlanet) { |
|
| 20 | 20 | $objFleet->fleet_end_name = $lang['ov_fleet_exploration']; |
| 21 | - } elseif($objFleet->mission_type == MT_COLONIZE) { |
|
| 21 | + } elseif ($objFleet->mission_type == MT_COLONIZE) { |
|
| 22 | 22 | $objFleet->fleet_end_name = $lang['ov_fleet_colonization']; |
| 23 | 23 | } else { |
| 24 | 24 | $planet_end = db_planet_by_gspt($objFleet->fleet_end_galaxy, $objFleet->fleet_end_system, $objFleet->fleet_end_planet, $planet_end_type, false, 'name'); |
| 25 | 25 | $objFleet->fleet_end_name = $planet_end['name']; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - if($objFleet->time_arrive_to_target > SN_TIME_NOW && !$objFleet->isReturning() && $objFleet->mission_type != MT_MISSILE && |
|
| 28 | + if ($objFleet->time_arrive_to_target > SN_TIME_NOW && !$objFleet->isReturning() && $objFleet->mission_type != MT_MISSILE && |
|
| 29 | 29 | ($planet_scanned === false |
| 30 | 30 | || |
| 31 | 31 | ( |
@@ -39,11 +39,11 @@ discard block |
||
| 39 | 39 | $fleet_events[] = flt_register_event_objFleet($objFleet, 0, $planet_end_type); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - if($objFleet->time_mission_job_complete > SN_TIME_NOW && !$objFleet->isReturning() && $planet_scanned === false && $objFleet->mission_type != MT_MISSILE) { |
|
| 42 | + if ($objFleet->time_mission_job_complete > SN_TIME_NOW && !$objFleet->isReturning() && $planet_scanned === false && $objFleet->mission_type != MT_MISSILE) { |
|
| 43 | 43 | $fleet_events[] = flt_register_event_objFleet($objFleet, 1, $planet_end_type); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if( |
|
| 46 | + if ( |
|
| 47 | 47 | $objFleet->time_return_to_source > SN_TIME_NOW && $objFleet->mission_type != MT_MISSILE && ($objFleet->isReturning() || ($objFleet->mission_type != MT_RELOCATE && $objFleet->mission_type != MT_COLONIZE)) && |
| 48 | 48 | ( |
| 49 | 49 | ($planet_scanned === false && $objFleet->playerOwnerId == $user['id']) |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $fleet_events[] = flt_register_event_objFleet($objFleet, 2, $planet_end_type); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if($objFleet->mission_type == MT_MISSILE) { |
|
| 62 | + if ($objFleet->mission_type == MT_MISSILE) { |
|
| 63 | 63 | $fleet_events[] = flt_register_event_objFleet($objFleet, 3, $planet_end_type); |
| 64 | 64 | } |
| 65 | 65 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | $is_this_planet = false; |
| 81 | 81 | |
| 82 | - switch($objFleet->ov_label = $ov_label) { |
|
| 82 | + switch ($objFleet->ov_label = $ov_label) { |
|
| 83 | 83 | case 0: |
| 84 | 84 | $objFleet->event_time = $objFleet->time_arrive_to_target; |
| 85 | 85 | $is_this_planet = ( |
@@ -110,9 +110,9 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - $objFleet->ov_this_planet = $is_this_planet;// || $planet_scanned != false; |
|
| 113 | + $objFleet->ov_this_planet = $is_this_planet; // || $planet_scanned != false; |
|
| 114 | 114 | |
| 115 | - if($objFleet->playerOwnerId == $user['id']) { |
|
| 115 | + if ($objFleet->playerOwnerId == $user['id']) { |
|
| 116 | 116 | $user_data = $user; |
| 117 | 117 | } else { |
| 118 | 118 | $user_data = db_user_by_id($objFleet->playerOwnerId); |
@@ -185,6 +185,9 @@ |
||
| 185 | 185 | return $result; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | +/** |
|
| 189 | + * @param integer $que_id |
|
| 190 | + */ |
|
| 188 | 191 | function tpl_parse_planet_que($que, $planet, $que_id) { |
| 189 | 192 | $hangar_que = array(); |
| 190 | 193 | $que_hangar = $que['ques'][$que_id][$planet['id_owner']][$planet['id']]; |
@@ -2,8 +2,8 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | // Compare function to sort fleet in time order |
| 4 | 4 | function tpl_assign_fleet_compare($a, $b) { |
| 5 | - if($a['fleet']['OV_THIS_PLANET'] == $b['fleet']['OV_THIS_PLANET']) { |
|
| 6 | - if($a['fleet']['OV_LEFT'] == $b['fleet']['OV_LEFT']) { |
|
| 5 | + if ($a['fleet']['OV_THIS_PLANET'] == $b['fleet']['OV_THIS_PLANET']) { |
|
| 6 | + if ($a['fleet']['OV_LEFT'] == $b['fleet']['OV_LEFT']) { |
|
| 7 | 7 | return 0; |
| 8 | 8 | } |
| 9 | 9 | |
@@ -19,17 +19,17 @@ discard block |
||
| 19 | 19 | * @param string $js_name |
| 20 | 20 | */ |
| 21 | 21 | function tpl_assign_fleet(&$template, $fleets, $js_name = 'fleets') { |
| 22 | - if(!$fleets) { |
|
| 22 | + if (!$fleets) { |
|
| 23 | 23 | return; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | usort($fleets, 'tpl_assign_fleet_compare'); |
| 27 | 27 | |
| 28 | - foreach($fleets as $fleet_data) { |
|
| 28 | + foreach ($fleets as $fleet_data) { |
|
| 29 | 29 | $template->assign_block_vars($js_name, $fleet_data['fleet']); |
| 30 | 30 | |
| 31 | - if($fleet_data['ships']) { |
|
| 32 | - foreach($fleet_data['ships'] as $ship_data) { |
|
| 31 | + if ($fleet_data['ships']) { |
|
| 32 | + foreach ($fleet_data['ships'] as $ship_data) { |
|
| 33 | 33 | $template->assign_block_vars("{$js_name}.ships", $ship_data); |
| 34 | 34 | } |
| 35 | 35 | } |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | 'DEUTERIUM' => $fleet[RES_DEUTERIUM], |
| 51 | 51 | ); |
| 52 | 52 | |
| 53 | - foreach($fleet as $ship_id => $ship_amount) { |
|
| 54 | - if(in_array($ship_id, sn_get_groups('fleet'))) { |
|
| 53 | + foreach ($fleet as $ship_id => $ship_amount) { |
|
| 54 | + if (in_array($ship_id, sn_get_groups('fleet'))) { |
|
| 55 | 55 | $single_ship_data = get_ship_data($ship_id, $user_data); |
| 56 | 56 | $return['ships'][$ship_id] = array( |
| 57 | 57 | 'ID' => $ship_id, |
@@ -90,11 +90,11 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | $result = array(); |
| 92 | 92 | |
| 93 | - if(!$user_data) { |
|
| 93 | + if (!$user_data) { |
|
| 94 | 94 | $user_data = $user; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - if(!$objFleet->isReturning() && $objFleet->mission_type == MT_AKS) { |
|
| 97 | + if (!$objFleet->isReturning() && $objFleet->mission_type == MT_AKS) { |
|
| 98 | 98 | $aks = db_acs_get_by_group_id($objFleet->group_id); |
| 99 | 99 | } |
| 100 | 100 | |
@@ -135,14 +135,14 @@ discard block |
||
| 135 | 135 | 'STAY_LEFT' => floor($objFleet->time_mission_job_complete + 1 - SN_TIME_NOW), |
| 136 | 136 | ); |
| 137 | 137 | |
| 138 | - if(property_exists($objFleet, 'fleet_start_name')) { |
|
| 138 | + if (property_exists($objFleet, 'fleet_start_name')) { |
|
| 139 | 139 | $result['START_NAME'] = $objFleet->fleet_start_name; |
| 140 | 140 | } |
| 141 | - if(property_exists($objFleet, 'fleet_end_name')) { |
|
| 141 | + if (property_exists($objFleet, 'fleet_end_name')) { |
|
| 142 | 142 | $result['END_NAME'] = $objFleet->fleet_end_name; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - if(property_exists($objFleet, 'event_time')) { |
|
| 145 | + if (property_exists($objFleet, 'event_time')) { |
|
| 146 | 146 | $result['fleet'] = array_merge($result['fleet'], array( |
| 147 | 147 | 'OV_LABEL' => $objFleet->ov_label, |
| 148 | 148 | 'EVENT_TIME_TEXT' => property_exists($objFleet, 'event_time') ? date(FMT_DATE_TIME, $objFleet->event_time + SN_CLIENT_TIME_DIFF) : '', |
@@ -154,9 +154,9 @@ discard block |
||
| 154 | 154 | $ship_list_fully_parsed = $objFleet->shipsGetArray(); |
| 155 | 155 | |
| 156 | 156 | $ship_id = 0; |
| 157 | - if($spy_level >= 6) { |
|
| 158 | - foreach($ship_list_fully_parsed as $ship_sn_id => $ship_amount) { |
|
| 159 | - if($spy_level >= 10) { |
|
| 157 | + if ($spy_level >= 6) { |
|
| 158 | + foreach ($ship_list_fully_parsed as $ship_sn_id => $ship_amount) { |
|
| 159 | + if ($spy_level >= 10) { |
|
| 160 | 160 | $single_ship_data = get_ship_data($ship_sn_id, $user_data); |
| 161 | 161 | $result['ships'][$ship_sn_id] = array( |
| 162 | 162 | 'ID' => $ship_sn_id, |
@@ -188,8 +188,8 @@ discard block |
||
| 188 | 188 | function tpl_parse_planet_que($que, $planet, $que_id) { |
| 189 | 189 | $hangar_que = array(); |
| 190 | 190 | $que_hangar = $que['ques'][$que_id][$planet['id_owner']][$planet['id']]; |
| 191 | - if(!empty($que_hangar)) { |
|
| 192 | - foreach($que_hangar as $que_item) { |
|
| 191 | + if (!empty($que_hangar)) { |
|
| 192 | + foreach ($que_hangar as $que_item) { |
|
| 193 | 193 | $hangar_que['que'][] = array('id' => $que_item['que_unit_id'], 'count' => $que_item['que_unit_amount']); |
| 194 | 194 | $hangar_que[$que_item['que_unit_id']] += $que_item['que_unit_amount']; |
| 195 | 195 | } |
@@ -252,10 +252,10 @@ discard block |
||
| 252 | 252 | 'PLANET_GOVERNOR_LEVEL_MAX' => get_unit_param($planet['PLANET_GOVERNOR_ID'], P_MAX_STACK), |
| 253 | 253 | ); |
| 254 | 254 | |
| 255 | - if(!empty($que['ques'][QUE_STRUCTURES][$planet['id_owner']][$planet['id']])) { |
|
| 255 | + if (!empty($que['ques'][QUE_STRUCTURES][$planet['id_owner']][$planet['id']])) { |
|
| 256 | 256 | $result['building_que'] = array(); |
| 257 | 257 | $building_que = &$que['ques'][QUE_STRUCTURES][$planet['id_owner']][$planet['id']]; |
| 258 | - foreach($building_que as $que_element) { |
|
| 258 | + foreach ($building_que as $que_element) { |
|
| 259 | 259 | $result['building_que'][] = que_tpl_parse_element($que_element); |
| 260 | 260 | } |
| 261 | 261 | } |
@@ -271,19 +271,19 @@ discard block |
||
| 271 | 271 | function flt_get_fleets_to_planet_by_array_of_Fleet($array_of_Fleet) { |
| 272 | 272 | global $user; |
| 273 | 273 | |
| 274 | - if(empty($array_of_Fleet)) { |
|
| 274 | + if (empty($array_of_Fleet)) { |
|
| 275 | 275 | return false; |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | $fleet_list = array(); |
| 279 | - foreach($array_of_Fleet as $fleet) { |
|
| 280 | - if($fleet->playerOwnerId == $user['id']) { |
|
| 281 | - if($fleet->mission_type == MT_MISSILE) { |
|
| 279 | + foreach ($array_of_Fleet as $fleet) { |
|
| 280 | + if ($fleet->playerOwnerId == $user['id']) { |
|
| 281 | + if ($fleet->mission_type == MT_MISSILE) { |
|
| 282 | 282 | continue; |
| 283 | 283 | } |
| 284 | 284 | $fleet_ownage = 'own'; |
| 285 | 285 | } else { |
| 286 | - switch($fleet->mission_type) { |
|
| 286 | + switch ($fleet->mission_type) { |
|
| 287 | 287 | case MT_ATTACK: |
| 288 | 288 | case MT_AKS: |
| 289 | 289 | case MT_DESTROY: |
@@ -300,10 +300,10 @@ discard block |
||
| 300 | 300 | |
| 301 | 301 | $fleet_list[$fleet_ownage]['fleets'][$fleet->dbId] = $fleet; |
| 302 | 302 | |
| 303 | - if($fleet->isReturning() || (!$fleet->isReturning() && $fleet->mission_type == MT_RELOCATE) || ($fleet->target_owner_id != $user['id'])) { |
|
| 303 | + if ($fleet->isReturning() || (!$fleet->isReturning() && $fleet->mission_type == MT_RELOCATE) || ($fleet->target_owner_id != $user['id'])) { |
|
| 304 | 304 | $fleet_sn = $fleet->shipsGetArray(); |
| 305 | - foreach($fleet_sn as $ship_id => $ship_amount) { |
|
| 306 | - if(in_array($ship_id, sn_get_groups('fleet'))) { |
|
| 305 | + foreach ($fleet_sn as $ship_id => $ship_amount) { |
|
| 306 | + if (in_array($ship_id, sn_get_groups('fleet'))) { |
|
| 307 | 307 | $fleet_list[$fleet_ownage]['total'][$ship_id] += $ship_amount; |
| 308 | 308 | } |
| 309 | 309 | } |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | return $fleet_list; |
| 321 | 321 | } |
| 322 | 322 | |
| 323 | -function tpl_set_resource_info(template &$template, $planet_row, $fleets_to_planet = array(), $round = 0) { |
|
| 323 | +function tpl_set_resource_info(template & $template, $planet_row, $fleets_to_planet = array(), $round = 0) { |
|
| 324 | 324 | $template->assign_vars(array( |
| 325 | 325 | 'RESOURCE_ROUNDING' => $round, |
| 326 | 326 | |
@@ -1,5 +1,8 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | +/** |
|
| 4 | + * @param string $type |
|
| 5 | + */ |
|
| 3 | 6 | function sn_ube_simulator_encode_replay($combat, $type) |
| 4 | 7 | { |
| 5 | 8 | $strPacked = "{$type}!"; |
@@ -4,9 +4,9 @@ discard block |
||
| 4 | 4 | { |
| 5 | 5 | $strPacked = "{$type}!"; |
| 6 | 6 | |
| 7 | - foreach($combat as $fleetID => $fleetCompress) |
|
| 7 | + foreach ($combat as $fleetID => $fleetCompress) |
|
| 8 | 8 | { |
| 9 | - foreach($fleetCompress as $key => $value) |
|
| 9 | + foreach ($fleetCompress as $key => $value) |
|
| 10 | 10 | { |
| 11 | 11 | $value = intval($value); |
| 12 | 12 | $strPacked .= "{$key},{$value};"; |
@@ -22,29 +22,29 @@ discard block |
||
| 22 | 22 | $fleet_id = 0; |
| 23 | 23 | |
| 24 | 24 | $arr_data_unpacked = explode('!', $str_data); |
| 25 | - foreach($arr_data_unpacked as $data_piece) |
|
| 25 | + foreach ($arr_data_unpacked as $data_piece) |
|
| 26 | 26 | { |
| 27 | - if(!$data_piece) |
|
| 27 | + if (!$data_piece) |
|
| 28 | 28 | { |
| 29 | 29 | continue; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - if($data_piece == 'A' || $data_piece == 'D') |
|
| 32 | + if ($data_piece == 'A' || $data_piece == 'D') |
|
| 33 | 33 | { |
| 34 | 34 | $fleet_type = $data_piece; |
| 35 | 35 | continue; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | $arr_unit_strings = explode(';', $data_piece); |
| 39 | - foreach($arr_unit_strings as $str_unit_string) |
|
| 39 | + foreach ($arr_unit_strings as $str_unit_string) |
|
| 40 | 40 | { |
| 41 | - if(!$str_unit_string) |
|
| 41 | + if (!$str_unit_string) |
|
| 42 | 42 | { |
| 43 | 43 | continue; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $arr_unit_data = explode(',', $str_unit_string); |
| 47 | - if($arr_unit_data[1]) |
|
| 47 | + if ($arr_unit_data[1]) |
|
| 48 | 48 | { |
| 49 | 49 | $unpacked[$fleet_type][$fleet_id][$arr_unit_data[0]] = intval($arr_unit_data[1]); |
| 50 | 50 | } |
@@ -10,9 +10,8 @@ |
||
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * @param Mission $objMission |
| 13 | - * @param array $mission_data |
|
| 14 | 13 | * |
| 15 | - * @return array|null |
|
| 14 | + * @return null|boolean |
|
| 16 | 15 | */ |
| 17 | 16 | function flt_mission_attack($objMission) { |
| 18 | 17 | $objFleet = $objMission->fleet; |
@@ -17,14 +17,14 @@ |
||
| 17 | 17 | function flt_mission_attack($objMission) { |
| 18 | 18 | $objFleet = $objMission->fleet; |
| 19 | 19 | |
| 20 | - if($objFleet->shipsGetTotal() <= 0) { |
|
| 20 | + if ($objFleet->shipsGetTotal() <= 0) { |
|
| 21 | 21 | return null; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | $destination_user = $objMission->dst_user; |
| 25 | 25 | $destination_planet = $objMission->dst_planet; |
| 26 | 26 | |
| 27 | - if( |
|
| 27 | + if ( |
|
| 28 | 28 | // Нет данных о планете назначения или её владельце |
| 29 | 29 | empty($destination_user) || empty($destination_planet) || !is_array($destination_user) || !is_array($destination_planet) |
| 30 | 30 | || |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | /** |
| 32 | 32 | * Fleet mission "Relocate" |
| 33 | 33 | * |
| 34 | - * @param $mission_data Mission |
|
| 34 | + * @param Mission $mission_data Mission |
|
| 35 | 35 | * |
| 36 | 36 | * @return int |
| 37 | 37 | * |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | global $lang, $config; |
| 22 | 22 | static $ship_data, $rates; |
| 23 | 23 | |
| 24 | - if(empty($mission_data->fleet_event) || $mission_data->fleet_event != EVENT_FLT_ACOMPLISH) { |
|
| 24 | + if (empty($mission_data->fleet_event) || $mission_data->fleet_event != EVENT_FLT_ACOMPLISH) { |
|
| 25 | 25 | return CACHE_NONE; |
| 26 | 26 | } |
| 27 | 27 | |
@@ -46,10 +46,10 @@ discard block |
||
| 46 | 46 | $outcome_value = &$result['$outcome_value']; |
| 47 | 47 | $outcome_list = &$result['$outcome_list']; |
| 48 | 48 | |
| 49 | - if(!$ship_data) { |
|
| 50 | - foreach(sn_get_groups('fleet') as $unit_id) { |
|
| 49 | + if (!$ship_data) { |
|
| 50 | + foreach (sn_get_groups('fleet') as $unit_id) { |
|
| 51 | 51 | $unit_info = get_unit_param($unit_id); |
| 52 | - if($unit_info[P_UNIT_TYPE] != UNIT_SHIPS || !isset($unit_info['engine'][0]['speed']) || !$unit_info['engine'][0]['speed']) { |
|
| 52 | + if ($unit_info[P_UNIT_TYPE] != UNIT_SHIPS || !isset($unit_info['engine'][0]['speed']) || !$unit_info['engine'][0]['speed']) { |
|
| 53 | 53 | continue; |
| 54 | 54 | } |
| 55 | 55 | $ship_data[$unit_id][P_COST_METAL] = get_unit_cost_in($unit_info[P_COST]); |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | $max_metal_cost = 0; |
| 61 | 61 | $fleet_real_array = $objFleet->shipsGetArray(); |
| 62 | - foreach($fleet_real_array as $ship_id => $ship_amount) { |
|
| 62 | + foreach ($fleet_real_array as $ship_id => $ship_amount) { |
|
| 63 | 63 | $ship_cost_in_metal = $ship_amount * $ship_data[$ship_id][P_COST_METAL]; |
| 64 | 64 | $result['$fleet_metal_points'] += $ship_amount * $ship_data[$ship_id][P_COST_METAL]; |
| 65 | 65 | // Рассчитываем стоимость самого дорого корабля в металле |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | $outcome_list[FLT_EXPEDITION_OUTCOME_NONE]['chance'] = ceil(200 / pow($flt_stay_hours, 1 / 1.7)); |
| 74 | 74 | |
| 75 | 75 | $chance_max = 0; |
| 76 | - foreach($outcome_list as $key => &$value) { |
|
| 77 | - if(!$value['chance']) { |
|
| 76 | + foreach ($outcome_list as $key => &$value) { |
|
| 77 | + if (!$value['chance']) { |
|
| 78 | 78 | unset($outcome_list[$key]); |
| 79 | 79 | continue; |
| 80 | 80 | } |
@@ -82,13 +82,13 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | $outcome_value = mt_rand(0, $chance_max); |
| 84 | 84 | $outcome_description = &$outcome_list[$mission_outcome = FLT_EXPEDITION_OUTCOME_NONE]; |
| 85 | - foreach($outcome_list as $key => &$value) { |
|
| 86 | - if(!$value['chance']) { |
|
| 85 | + foreach ($outcome_list as $key => &$value) { |
|
| 86 | + if (!$value['chance']) { |
|
| 87 | 87 | continue; |
| 88 | 88 | } |
| 89 | 89 | $mission_outcome = $key; |
| 90 | 90 | $outcome_description = $value; |
| 91 | - if($outcome_value <= $outcome_description['value']) { |
|
| 91 | + if ($outcome_value <= $outcome_description['value']) { |
|
| 92 | 92 | break; |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | // $outcome_mission_sub = -1; |
| 106 | 106 | |
| 107 | 107 | $fleet_found = array(); |
| 108 | - switch($mission_outcome) { |
|
| 108 | + switch ($mission_outcome) { |
|
| 109 | 109 | case FLT_EXPEDITION_OUTCOME_LOST_FLEET: |
| 110 | 110 | $objFleet->shipsCountApplyLossMultiplier(mt_rand(1, 3) * mt_rand(200000, 300000) / 1000000); |
| 111 | 111 | break; |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | |
| 127 | 127 | // Ограничиваем корабли только теми, чья стоимость в металле меньше или равно стоимости самого дорогого корабля |
| 128 | 128 | $can_be_found = array(); |
| 129 | - foreach($ship_data as $ship_id => $ship_info) { |
|
| 130 | - if($ship_info['metal_cost'] < $max_metal_cost) { |
|
| 129 | + foreach ($ship_data as $ship_id => $ship_info) { |
|
| 130 | + if ($ship_info['metal_cost'] < $max_metal_cost) { |
|
| 131 | 131 | $can_be_found[$ship_id] = $ship_info['metal_cost']; |
| 132 | 132 | } |
| 133 | 133 | } |
@@ -135,13 +135,13 @@ discard block |
||
| 135 | 135 | unset($can_be_found[SHIP_COLONIZER]); |
| 136 | 136 | unset($can_be_found[SHIP_SPY]); |
| 137 | 137 | |
| 138 | - while(count($can_be_found) && $found_in_metal >= max($can_be_found)) { |
|
| 138 | + while (count($can_be_found) && $found_in_metal >= max($can_be_found)) { |
|
| 139 | 139 | $found_index = mt_rand(1, count($can_be_found)) - 1; |
| 140 | 140 | $found_ship = array_slice($can_be_found, $found_index, 1, true); |
| 141 | 141 | $found_ship_cost = reset($found_ship); |
| 142 | 142 | $found_ship_id = key($found_ship); |
| 143 | 143 | |
| 144 | - if($found_ship_cost > $found_in_metal) { |
|
| 144 | + if ($found_ship_cost > $found_in_metal) { |
|
| 145 | 145 | unset($can_be_found[$found_ship_id]); |
| 146 | 146 | } else { |
| 147 | 147 | $found_ship_count = mt_rand(1, floor($found_in_metal / $found_ship_cost)); |
@@ -150,10 +150,10 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - if(empty($fleet_found)) { |
|
| 153 | + if (empty($fleet_found)) { |
|
| 154 | 154 | $msg_text_addon = $lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result']; |
| 155 | 155 | } else { |
| 156 | - foreach($fleet_found as $unit_id => $unit_amount) { |
|
| 156 | + foreach ($fleet_found as $unit_id => $unit_amount) { |
|
| 157 | 157 | $objFleet->shipAdjustCount($unit_id, $unit_amount); |
| 158 | 158 | } |
| 159 | 159 | } |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | $objFleet->resourcesAdjust($resources_found); |
| 179 | 179 | |
| 180 | - if(array_sum($resources_found) == 0) { |
|
| 180 | + if (array_sum($resources_found) == 0) { |
|
| 181 | 181 | $msg_text_addon = $lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result']; |
| 182 | 182 | } |
| 183 | 183 | break; |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | // Рассчитываем количество найденной ТМ |
| 189 | 189 | $found_dark_matter = floor(min($outcome_percent * $result['$fleet_metal_points'] / $rates[RES_DARK_MATTER], 10000) * mt_rand(750000, 1000000) / 1000000); |
| 190 | 190 | |
| 191 | - if(!$found_dark_matter) { |
|
| 191 | + if (!$found_dark_matter) { |
|
| 192 | 192 | $msg_text_addon = $lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result']; |
| 193 | 193 | } |
| 194 | 194 | break; |
@@ -202,40 +202,39 @@ discard block |
||
| 202 | 202 | |
| 203 | 203 | mission_expedition_result_adjust($result, $objFleet); |
| 204 | 204 | |
| 205 | - if($found_dark_matter) { |
|
| 205 | + if ($found_dark_matter) { |
|
| 206 | 206 | rpg_points_change($objFleet->playerOwnerId, RPG_EXPEDITION, $found_dark_matter, 'Expedition Bonus'); |
| 207 | 207 | $msg_text_addon = sprintf($lang['flt_mission_expedition']['found_dark_matter'], $found_dark_matter); |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - if(!empty($fleet_lost)) { |
|
| 210 | + if (!empty($fleet_lost)) { |
|
| 211 | 211 | $msg_text_addon = $lang['flt_mission_expedition']['lost_fleet']; |
| 212 | - foreach($fleet_lost as $ship_id => $ship_amount) { |
|
| 212 | + foreach ($fleet_lost as $ship_id => $ship_amount) { |
|
| 213 | 213 | $msg_text_addon .= $lang['tech'][$ship_id] . ' - ' . $ship_amount . "\r\n"; |
| 214 | 214 | } |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | - if(!empty($fleet_found)) { |
|
| 217 | + if (!empty($fleet_found)) { |
|
| 218 | 218 | $msg_text_addon = $lang['flt_mission_expedition']['found_fleet']; |
| 219 | - foreach($fleet_found as $ship_id => $ship_amount) { |
|
| 219 | + foreach ($fleet_found as $ship_id => $ship_amount) { |
|
| 220 | 220 | $msg_text_addon .= $lang['tech'][$ship_id] . ' - ' . $ship_amount . "\r\n"; |
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - if(!empty($resources_found) && array_sum($resources_found) > 0) { |
|
| 224 | + if (!empty($resources_found) && array_sum($resources_found) > 0) { |
|
| 225 | 225 | $msg_text_addon = $lang['flt_mission_expedition']['found_resources']; |
| 226 | - foreach($resources_found as $resource_id => $resource_amount) { |
|
| 226 | + foreach ($resources_found as $resource_id => $resource_amount) { |
|
| 227 | 227 | $msg_text_addon .= $lang['tech'][$resource_id] . ' - ' . $resource_amount . "\r\n"; |
| 228 | 228 | } |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - if(!$msg_text) { |
|
| 231 | + if (!$msg_text) { |
|
| 232 | 232 | $messages = &$lang['flt_mission_expedition']['outcomes'][$mission_outcome]['messages']; |
| 233 | - if($outcome_mission_sub >= 0 && is_array($messages)) { |
|
| 233 | + if ($outcome_mission_sub >= 0 && is_array($messages)) { |
|
| 234 | 234 | $messages = &$messages[$outcome_mission_sub]; |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | - $msg_text = is_string($messages) ? $messages : |
|
| 238 | - (is_array($messages) ? $messages[mt_rand(0, count($messages) - 1)] : ''); |
|
| 237 | + $msg_text = is_string($messages) ? $messages : (is_array($messages) ? $messages[mt_rand(0, count($messages) - 1)] : ''); |
|
| 239 | 238 | } |
| 240 | 239 | |
| 241 | 240 | $fleet_row_end_coordinates_without_type = $objFleet->target_coordinates_without_type(); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @param string $title |
| 35 | 35 | * @param string $dest |
| 36 | 36 | * @param int $time |
| 37 | - * @param bool|true $show_header |
|
| 37 | + * @param boolean $show_header |
|
| 38 | 38 | */ |
| 39 | 39 | function message($mes, $title = 'Error', $dest = '', $time = 5, $show_header = true) { |
| 40 | 40 | $template = gettemplate('message_body', true); |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | * @param bool|true $isDisplayTopNav |
| 196 | 196 | * @param string $metatags |
| 197 | 197 | * @param bool|false $AdminPage |
| 198 | - * @param bool|true $isDisplayMenu |
|
| 198 | + * @param boolean $isDisplayMenu |
|
| 199 | 199 | * |
| 200 | 200 | * @return mixed |
| 201 | 201 | */ |
@@ -208,7 +208,6 @@ discard block |
||
| 208 | 208 | * @param string $title |
| 209 | 209 | * @param bool|true $isDisplayTopNav |
| 210 | 210 | * @param string $metatags |
| 211 | - * @param bool|false $AdminPage |
|
| 212 | 211 | * @param bool|true $isDisplayMenu |
| 213 | 212 | * @param bool|int|string $exitStatus - Код или сообщение выхода |
| 214 | 213 | */ |
@@ -385,10 +384,10 @@ discard block |
||
| 385 | 384 | |
| 386 | 385 | /** |
| 387 | 386 | * @param $time |
| 388 | - * @param $event |
|
| 387 | + * @param integer $event |
|
| 389 | 388 | * @param $msg |
| 390 | 389 | * @param $coordinates |
| 391 | - * @param $is_decrease |
|
| 390 | + * @param boolean $is_decrease |
|
| 392 | 391 | * @param Fleet $objFleet |
| 393 | 392 | * @param $fleet_flying_sorter |
| 394 | 393 | * @param $fleet_flying_events |
@@ -708,7 +707,7 @@ discard block |
||
| 708 | 707 | } |
| 709 | 708 | |
| 710 | 709 | /** |
| 711 | - * @param array|string $files |
|
| 710 | + * @param string $files |
|
| 712 | 711 | * @param template|bool $template |
| 713 | 712 | * @param string|bool $template_path |
| 714 | 713 | * |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | function gettemplatename($u_dpath) { |
| 11 | 11 | static $template_names = array(); |
| 12 | 12 | |
| 13 | - if(!isset($template_names[$u_dpath])) { |
|
| 13 | + if (!isset($template_names[$u_dpath])) { |
|
| 14 | 14 | $template_names[$u_dpath] = file_exists(SN_ROOT_PHYSICAL . $u_dpath . 'tmpl.ini') ? sys_file_read(SN_ROOT_PHYSICAL . $u_dpath . 'tmpl.ini') : TEMPLATE_NAME; |
| 15 | 15 | } |
| 16 | 16 | |
@@ -52,12 +52,12 @@ discard block |
||
| 52 | 52 | * @param $sn_menu_extra |
| 53 | 53 | */ |
| 54 | 54 | function tpl_menu_merge_extra(&$sn_menu, &$sn_menu_extra) { |
| 55 | - if(empty($sn_menu) || empty($sn_menu_extra)) { |
|
| 55 | + if (empty($sn_menu) || empty($sn_menu_extra)) { |
|
| 56 | 56 | return; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - foreach($sn_menu_extra as $menu_item_id => $menu_item) { |
|
| 60 | - if(empty($menu_item['LOCATION'])) { |
|
| 59 | + foreach ($sn_menu_extra as $menu_item_id => $menu_item) { |
|
| 60 | + if (empty($menu_item['LOCATION'])) { |
|
| 61 | 61 | $sn_menu[$menu_item_id] = $menu_item; |
| 62 | 62 | continue; |
| 63 | 63 | } |
@@ -66,16 +66,16 @@ discard block |
||
| 66 | 66 | unset($menu_item['LOCATION']); |
| 67 | 67 | |
| 68 | 68 | $is_positioned = $item_location[0]; |
| 69 | - if($is_positioned == '+' || $is_positioned == '-') { |
|
| 69 | + if ($is_positioned == '+' || $is_positioned == '-') { |
|
| 70 | 70 | $item_location = substr($item_location, 1); |
| 71 | 71 | } else { |
| 72 | 72 | $is_positioned = ''; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - if($item_location) { |
|
| 75 | + if ($item_location) { |
|
| 76 | 76 | $menu_keys = array_keys($sn_menu); |
| 77 | 77 | $insert_position = array_search($item_location, $menu_keys); |
| 78 | - if($insert_position === false) { |
|
| 78 | + if ($insert_position === false) { |
|
| 79 | 79 | $insert_position = count($sn_menu) - 1; |
| 80 | 80 | $is_positioned = '+'; |
| 81 | 81 | $item_location = ''; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $spliced = array_splice($sn_menu, $insert_position, count($sn_menu) - $insert_position); |
| 89 | 89 | $sn_menu[$menu_item_id] = $menu_item; |
| 90 | 90 | |
| 91 | - if(!$is_positioned && $item_location) { |
|
| 91 | + if (!$is_positioned && $item_location) { |
|
| 92 | 92 | unset($spliced[$item_location]); |
| 93 | 93 | } |
| 94 | 94 | $sn_menu = array_merge($sn_menu, $spliced); |
@@ -104,24 +104,24 @@ discard block |
||
| 104 | 104 | function tpl_menu_assign_to_template(&$sn_menu, &$template) { |
| 105 | 105 | global $lang; |
| 106 | 106 | |
| 107 | - if(empty($sn_menu) || !is_array($sn_menu)) { |
|
| 107 | + if (empty($sn_menu) || !is_array($sn_menu)) { |
|
| 108 | 108 | return; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - foreach($sn_menu as $menu_item_id => $menu_item) { |
|
| 112 | - if(!$menu_item) { |
|
| 111 | + foreach ($sn_menu as $menu_item_id => $menu_item) { |
|
| 112 | + if (!$menu_item) { |
|
| 113 | 113 | continue; |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - if(is_string($menu_item_id)) { |
|
| 116 | + if (is_string($menu_item_id)) { |
|
| 117 | 117 | $menu_item['ID'] = $menu_item_id; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - if($menu_item['TYPE'] == 'lang') { |
|
| 120 | + if ($menu_item['TYPE'] == 'lang') { |
|
| 121 | 121 | $lang_string = &$lang; |
| 122 | - if(preg_match('#(\w+)(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?#', $menu_item['ITEM'], $matches) && count($matches) > 1) { |
|
| 123 | - for($i = 1; $i < count($matches); $i++) { |
|
| 124 | - if(defined($matches[$i])) { |
|
| 122 | + if (preg_match('#(\w+)(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?#', $menu_item['ITEM'], $matches) && count($matches) > 1) { |
|
| 123 | + for ($i = 1; $i < count($matches); $i++) { |
|
| 124 | + if (defined($matches[$i])) { |
|
| 125 | 125 | $matches[$i] = constant($matches[$i]); |
| 126 | 126 | } |
| 127 | 127 | $lang_string = &$lang_string[$matches[$i]]; |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | $menu_item['ALT'] = htmlentities($menu_item['ALT']); |
| 134 | 134 | $menu_item['TITLE'] = htmlentities($menu_item['TITLE']); |
| 135 | 135 | |
| 136 | - if(!empty($menu_item['ICON'])) { |
|
| 137 | - if(is_string($menu_item['ICON'])) { |
|
| 136 | + if (!empty($menu_item['ICON'])) { |
|
| 137 | + if (is_string($menu_item['ICON'])) { |
|
| 138 | 138 | $menu_item['ICON_PATH'] = $menu_item['ICON']; |
| 139 | 139 | } else { |
| 140 | 140 | $menu_item['ICON'] = $menu_item_id; |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | 'MENU_START_HIDE' => !empty($_COOKIE[SN_COOKIE . '_menu_hidden']) || defined('SN_GOOGLE'), |
| 165 | 165 | )); |
| 166 | 166 | |
| 167 | - if(isset($template_result['MENU_CUSTOMIZE'])) { |
|
| 167 | + if (isset($template_result['MENU_CUSTOMIZE'])) { |
|
| 168 | 168 | $template->assign_vars(array( |
| 169 | 169 | 'PLAYER_OPTION_MENU_SHOW_ON_BUTTON' => classSupernova::$user_options[PLAYER_OPTION_MENU_SHOW_ON_BUTTON], |
| 170 | 170 | 'PLAYER_OPTION_MENU_HIDE_ON_BUTTON' => classSupernova::$user_options[PLAYER_OPTION_MENU_HIDE_ON_BUTTON], |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | )); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - if(defined('IN_ADMIN') && IN_ADMIN === true && !empty($user['authlevel']) && $user['authlevel'] > 0) { |
|
| 181 | + if (defined('IN_ADMIN') && IN_ADMIN === true && !empty($user['authlevel']) && $user['authlevel'] > 0) { |
|
| 182 | 182 | tpl_menu_merge_extra($sn_menu_admin, $sn_menu_admin_extra); |
| 183 | 183 | tpl_menu_assign_to_template($sn_menu_admin, $template); |
| 184 | 184 | } else { |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | $in_admin = defined('IN_ADMIN') && IN_ADMIN === true; |
| 219 | 219 | $is_login = defined('LOGIN_LOGOUT') && LOGIN_LOGOUT === true; |
| 220 | 220 | |
| 221 | - if(is_object($page)) { |
|
| 221 | + if (is_object($page)) { |
|
| 222 | 222 | isset($page->_rootref['MENU']) ? $isDisplayMenu = $page->_rootref['MENU'] : false; |
| 223 | 223 | isset($page->_rootref['NAVBAR']) ? $isDisplayTopNav = $page->_rootref['NAVBAR'] : false; |
| 224 | 224 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | !isset($page->_rootref['PAGE_HEADER']) && $title ? $page->assign_var('PAGE_HEADER', $title) : false; |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | - if(empty($user['id']) || !is_numeric($user['id'])) { |
|
| 229 | + if (empty($user['id']) || !is_numeric($user['id'])) { |
|
| 230 | 230 | $isDisplayMenu = false; |
| 231 | 231 | $isDisplayTopNav = false; |
| 232 | 232 | } |
@@ -238,10 +238,10 @@ discard block |
||
| 238 | 238 | $user_time_measured_unix = intval(isset($user_time_diff[PLAYER_OPTION_TIME_DIFF_MEASURE_TIME]) ? strtotime($user_time_diff[PLAYER_OPTION_TIME_DIFF_MEASURE_TIME]) : 0); |
| 239 | 239 | |
| 240 | 240 | $font_size = !empty($_COOKIE[SN_COOKIE_F]) ? $_COOKIE[SN_COOKIE_F] : classSupernova::$user_options[PLAYER_OPTION_BASE_FONT_SIZE]; |
| 241 | - if(strpos($font_size, '%') !== false) { |
|
| 241 | + if (strpos($font_size, '%') !== false) { |
|
| 242 | 242 | // Размер шрифта в процентах |
| 243 | 243 | $font_size = min(max(floatval($font_size), FONT_SIZE_PERCENT_MIN), FONT_SIZE_PERCENT_MAX) . '%'; |
| 244 | - } elseif(strpos($font_size, 'px') !== false) { |
|
| 244 | + } elseif (strpos($font_size, 'px') !== false) { |
|
| 245 | 245 | // Размер шрифта в пикселях |
| 246 | 246 | $font_size = min(max(floatval($font_size), FONT_SIZE_PIXELS_MIN), FONT_SIZE_PIXELS_MAX) . 'px'; |
| 247 | 247 | } else { |
@@ -253,10 +253,10 @@ discard block |
||
| 253 | 253 | |
| 254 | 254 | $template = gettemplate('_global_header', true); |
| 255 | 255 | |
| 256 | - if(!empty(classSupernova::$sn_mvc['javascript'])) { |
|
| 257 | - foreach(classSupernova::$sn_mvc['javascript'] as $page_name => $script_list) { |
|
| 258 | - if(empty($page_name) || $page_name == $sn_page_name) { |
|
| 259 | - foreach($script_list as $filename => $content) { |
|
| 256 | + if (!empty(classSupernova::$sn_mvc['javascript'])) { |
|
| 257 | + foreach (classSupernova::$sn_mvc['javascript'] as $page_name => $script_list) { |
|
| 258 | + if (empty($page_name) || $page_name == $sn_page_name) { |
|
| 259 | + foreach ($script_list as $filename => $content) { |
|
| 260 | 260 | $template_result['.']['javascript'][] = array( |
| 261 | 261 | 'FILE' => $filename, |
| 262 | 262 | 'CONTENT' => $content, |
@@ -282,9 +282,9 @@ discard block |
||
| 282 | 282 | classSupernova::$sn_mvc['css'][''] = array_merge($standard_css, classSupernova::$sn_mvc['css']['']); |
| 283 | 283 | |
| 284 | 284 | |
| 285 | - foreach(classSupernova::$sn_mvc['css'] as $page_name => $script_list) { |
|
| 286 | - if(empty($page_name) || $page_name == $sn_page_name) { |
|
| 287 | - foreach($script_list as $filename => $content) { |
|
| 285 | + foreach (classSupernova::$sn_mvc['css'] as $page_name => $script_list) { |
|
| 286 | + if (empty($page_name) || $page_name == $sn_page_name) { |
|
| 287 | + foreach ($script_list as $filename => $content) { |
|
| 288 | 288 | $template_result['.']['css'][] = array( |
| 289 | 289 | 'FILE' => $filename, |
| 290 | 290 | 'CONTENT' => $content, |
@@ -331,12 +331,12 @@ discard block |
||
| 331 | 331 | $template->assign_recursive($template_result); |
| 332 | 332 | displayP(parsetemplate($template)); |
| 333 | 333 | |
| 334 | - if(($isDisplayMenu || $in_admin) && !isset($_COOKIE['menu_disable'])) { |
|
| 334 | + if (($isDisplayMenu || $in_admin) && !isset($_COOKIE['menu_disable'])) { |
|
| 335 | 335 | // $AdminPage = $AdminPage ? $user['authlevel'] : 0; |
| 336 | 336 | displayP(parsetemplate(tpl_render_menu())); |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | - if($isDisplayTopNav && !$in_admin) { |
|
| 339 | + if ($isDisplayTopNav && !$in_admin) { |
|
| 340 | 340 | displayP(parsetemplate(tpl_render_topnav($user, $planetrow))); |
| 341 | 341 | } |
| 342 | 342 | |
@@ -344,8 +344,8 @@ discard block |
||
| 344 | 344 | |
| 345 | 345 | !is_array($page) ? $page = array($page) : false; |
| 346 | 346 | $result_added = false; |
| 347 | - foreach($page as $page_item) { |
|
| 348 | - if(!$result_added && is_object($page_item) && isset($page_item->_tpldata['result'])) { |
|
| 347 | + foreach ($page as $page_item) { |
|
| 348 | + if (!$result_added && is_object($page_item) && isset($page_item->_tpldata['result'])) { |
|
| 349 | 349 | $page_item = gettemplate('_result_message', $page_item); |
| 350 | 350 | $temp = $page_item->files['_result_message']; |
| 351 | 351 | unset($page_item->files['_result_message']); |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | )); |
| 369 | 369 | displayP(parsetemplate($template)); |
| 370 | 370 | |
| 371 | - $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false;; |
|
| 371 | + $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false; ; |
|
| 372 | 372 | |
| 373 | 373 | sn_db_disconnect(); |
| 374 | 374 | |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | * @param string $type |
| 407 | 407 | */ |
| 408 | 408 | function tpl_topnav_event_build(&$template, $FleetList, $type = 'fleet') { |
| 409 | - if(empty($FleetList)) { |
|
| 409 | + if (empty($FleetList)) { |
|
| 410 | 410 | return; |
| 411 | 411 | } |
| 412 | 412 | |
@@ -415,19 +415,19 @@ discard block |
||
| 415 | 415 | $fleet_event_count = 0; |
| 416 | 416 | $fleet_flying_sorter = array(); |
| 417 | 417 | $fleet_flying_events = array(); |
| 418 | - foreach($FleetList->_container as $objFleet) { |
|
| 418 | + foreach ($FleetList->_container as $objFleet) { |
|
| 419 | 419 | $will_return = true; |
| 420 | - if(!$objFleet->isReturning()) { |
|
| 420 | + if (!$objFleet->isReturning()) { |
|
| 421 | 421 | // cut fleets on Hold and Expedition |
| 422 | - if($objFleet->time_arrive_to_target >= SN_TIME_NOW) { |
|
| 422 | + if ($objFleet->time_arrive_to_target >= SN_TIME_NOW) { |
|
| 423 | 423 | $objFleet->mission_type == MT_RELOCATE ? $will_return = false : false; |
| 424 | 424 | tpl_topnav_event_build_helper($objFleet->time_arrive_to_target, EVENT_FLEET_ARRIVE, $lang['sys_event_arrive'], $objFleet->target_coordinates_typed(), !$will_return, $objFleet, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count); |
| 425 | 425 | } |
| 426 | - if($objFleet->time_mission_job_complete) { |
|
| 426 | + if ($objFleet->time_mission_job_complete) { |
|
| 427 | 427 | tpl_topnav_event_build_helper($objFleet->time_mission_job_complete, EVENT_FLEET_STAY, $lang['sys_event_stay'], $objFleet->target_coordinates_typed(), false, $objFleet, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count); |
| 428 | 428 | } |
| 429 | 429 | } |
| 430 | - if($will_return) { |
|
| 430 | + if ($will_return) { |
|
| 431 | 431 | tpl_topnav_event_build_helper($objFleet->time_return_to_source, EVENT_FLEET_RETURN, $lang['sys_event_return'], $objFleet->launch_coordinates_typed(), true, $objFleet, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count); |
| 432 | 432 | } |
| 433 | 433 | } |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | asort($fleet_flying_sorter); |
| 436 | 436 | |
| 437 | 437 | $fleet_flying_count = $FleetList->count(); |
| 438 | - foreach($fleet_flying_sorter as $fleet_event_id => $fleet_time) { |
|
| 438 | + foreach ($fleet_flying_sorter as $fleet_event_id => $fleet_time) { |
|
| 439 | 439 | $fleet_event = &$fleet_flying_events[$fleet_event_id]; |
| 440 | 440 | $template->assign_block_vars("flying_{$type}s", array( |
| 441 | 441 | 'TIME' => max(0, $fleet_time - SN_TIME_NOW), |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | function sn_tpl_render_topnav(&$user, $planetrow) { |
| 464 | 464 | global $lang, $config, $template_result; |
| 465 | 465 | |
| 466 | - if(!is_array($user)) { |
|
| 466 | + if (!is_array($user)) { |
|
| 467 | 467 | return ''; |
| 468 | 468 | } |
| 469 | 469 | |
@@ -484,8 +484,8 @@ discard block |
||
| 484 | 484 | |
| 485 | 485 | $ThisUsersPlanets = db_planet_list_sorted($user); |
| 486 | 486 | // while ($CurPlanet = db_fetch($ThisUsersPlanets)) |
| 487 | - foreach($ThisUsersPlanets as $CurPlanet) { |
|
| 488 | - if($CurPlanet['destruyed']) { |
|
| 487 | + foreach ($ThisUsersPlanets as $CurPlanet) { |
|
| 488 | + if ($CurPlanet['destruyed']) { |
|
| 489 | 489 | continue; |
| 490 | 490 | } |
| 491 | 491 | |
@@ -509,8 +509,8 @@ discard block |
||
| 509 | 509 | */ |
| 510 | 510 | $fleet_flying_list = array(); |
| 511 | 511 | $fleet_flying_list[0] = FleetList::dbGetFleetListByOwnerId($user['id']); |
| 512 | - foreach($fleet_flying_list[0]->_container as $fleet_id => $objFleet) { |
|
| 513 | - if(empty($fleet_flying_list[$objFleet->mission_type])) { |
|
| 512 | + foreach ($fleet_flying_list[0]->_container as $fleet_id => $objFleet) { |
|
| 513 | + if (empty($fleet_flying_list[$objFleet->mission_type])) { |
|
| 514 | 514 | $fleet_flying_list[$objFleet->mission_type] = new FleetList(); |
| 515 | 515 | } |
| 516 | 516 | $fleet_flying_list[$objFleet->mission_type][$fleet_id] = $objFleet; |
@@ -522,8 +522,8 @@ discard block |
||
| 522 | 522 | que_tpl_parse($template, QUE_RESEARCH, $user, array(), null, !classSupernova::$user_options[PLAYER_OPTION_NAVBAR_RESEARCH_WIDE]); |
| 523 | 523 | que_tpl_parse($template, SUBQUE_FLEET, $user, $planetrow, null, true); |
| 524 | 524 | |
| 525 | - if(!empty(classSupernova::$sn_mvc['navbar_prefix_button']) && is_array(classSupernova::$sn_mvc['navbar_prefix_button'])) { |
|
| 526 | - foreach(classSupernova::$sn_mvc['navbar_prefix_button'] as $navbar_button_image => $navbar_button_url) { |
|
| 525 | + if (!empty(classSupernova::$sn_mvc['navbar_prefix_button']) && is_array(classSupernova::$sn_mvc['navbar_prefix_button'])) { |
|
| 526 | + foreach (classSupernova::$sn_mvc['navbar_prefix_button'] as $navbar_button_image => $navbar_button_url) { |
|
| 527 | 527 | $template->assign_block_vars('navbar_prefix_button', array( |
| 528 | 528 | 'IMAGE' => $navbar_button_image, |
| 529 | 529 | 'URL_RELATIVE' => $navbar_button_url, |
@@ -537,13 +537,13 @@ discard block |
||
| 537 | 537 | $time_now_parsed = getdate(SN_TIME_NOW); |
| 538 | 538 | $time_local_parsed = getdate(defined('SN_CLIENT_TIME_LOCAL') ? SN_CLIENT_TIME_LOCAL : SN_TIME_NOW); |
| 539 | 539 | |
| 540 | - if($config->game_news_overview) { |
|
| 540 | + if ($config->game_news_overview) { |
|
| 541 | 541 | $user_last_read_safe = intval($user['news_lastread']); |
| 542 | 542 | nws_render($template, "WHERE UNIX_TIMESTAMP(`tsTimeStamp`) >= {$user_last_read_safe}", $config->game_news_overview); |
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | $notes_query = db_note_list_by_owner($user['id'], true); |
| 546 | - while($note_row = db_fetch($notes_query)) { |
|
| 546 | + while ($note_row = db_fetch($notes_query)) { |
|
| 547 | 547 | note_assign($template, $note_row); |
| 548 | 548 | } |
| 549 | 549 | |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | 'QUE_ID' => QUE_RESEARCH, |
| 555 | 555 | 'QUE_HTML' => 'topnav', |
| 556 | 556 | |
| 557 | - 'RESEARCH_ONGOING' => (boolean)$user['que'], |
|
| 557 | + 'RESEARCH_ONGOING' => (boolean) $user['que'], |
|
| 558 | 558 | |
| 559 | 559 | 'TIME_TEXT' => sprintf($str_date_format, $time_now_parsed['year'], $lang['months'][$time_now_parsed['mon']], $time_now_parsed['mday'], |
| 560 | 560 | $time_now_parsed['hours'], $time_now_parsed['minutes'], $time_now_parsed['seconds'] |
@@ -631,7 +631,7 @@ discard block |
||
| 631 | 631 | 'QUE_STRUCTURES' => QUE_STRUCTURES, |
| 632 | 632 | )); |
| 633 | 633 | |
| 634 | - if((defined('SN_RENDER_NAVBAR_PLANET') && SN_RENDER_NAVBAR_PLANET === true) || ($user['option_list'][OPT_INTERFACE]['opt_int_navbar_resource_force'] && SN_RENDER_NAVBAR_PLANET !== false)) { |
|
| 634 | + if ((defined('SN_RENDER_NAVBAR_PLANET') && SN_RENDER_NAVBAR_PLANET === true) || ($user['option_list'][OPT_INTERFACE]['opt_int_navbar_resource_force'] && SN_RENDER_NAVBAR_PLANET !== false)) { |
|
| 635 | 635 | tpl_set_resource_info($template, $planetrow); |
| 636 | 636 | $template->assign_vars(array( |
| 637 | 637 | 'SN_RENDER_NAVBAR_PLANET' => true, |
@@ -646,12 +646,12 @@ discard block |
||
| 646 | 646 | * @param template|string $template |
| 647 | 647 | */ |
| 648 | 648 | function displayP($template) { |
| 649 | - if(is_object($template)) { |
|
| 650 | - if(empty($template->parsed)) { |
|
| 649 | + if (is_object($template)) { |
|
| 650 | + if (empty($template->parsed)) { |
|
| 651 | 651 | parsetemplate($template); |
| 652 | 652 | } |
| 653 | 653 | |
| 654 | - foreach($template->files as $section => $filename) { |
|
| 654 | + foreach ($template->files as $section => $filename) { |
|
| 655 | 655 | $template->display($section); |
| 656 | 656 | } |
| 657 | 657 | } else { |
@@ -666,11 +666,11 @@ discard block |
||
| 666 | 666 | * @return mixed |
| 667 | 667 | */ |
| 668 | 668 | function parsetemplate($template, $array = false) { |
| 669 | - if(is_object($template)) { |
|
| 669 | + if (is_object($template)) { |
|
| 670 | 670 | global $user; |
| 671 | 671 | |
| 672 | - if(!empty($array) && is_array($array)) { |
|
| 673 | - foreach($array as $key => $data) { |
|
| 672 | + if (!empty($array) && is_array($array)) { |
|
| 673 | + foreach ($array as $key => $data) { |
|
| 674 | 674 | $template->assign_var($key, $data); |
| 675 | 675 | } |
| 676 | 676 | } |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | |
| 712 | 712 | $template_ex = '.tpl.html'; |
| 713 | 713 | |
| 714 | - if($template === false) { |
|
| 714 | + if ($template === false) { |
|
| 715 | 715 | return sys_file_read(TEMPLATE_DIR . '/' . $files . $template_ex); |
| 716 | 716 | } |
| 717 | 717 | |
@@ -731,7 +731,7 @@ discard block |
||
| 731 | 731 | !empty(classSupernova::$sn_mvc['i18n']['']) ? lng_load_i18n(classSupernova::$sn_mvc['i18n']['']) : false; |
| 732 | 732 | $sn_page_name ? lng_load_i18n(classSupernova::$sn_mvc['i18n'][$sn_page_name]) : false; |
| 733 | 733 | |
| 734 | - foreach($files as &$filename) { |
|
| 734 | + foreach ($files as &$filename) { |
|
| 735 | 735 | $filename = $filename . $template_ex; |
| 736 | 736 | } |
| 737 | 737 | |
@@ -756,13 +756,13 @@ discard block |
||
| 756 | 756 | 'LANG' => $language ? $language : '', |
| 757 | 757 | 'referral' => $id_ref ? '&id_ref=' . $id_ref : '', |
| 758 | 758 | |
| 759 | - 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '',// "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''), |
|
| 759 | + 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '', // "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''), |
|
| 760 | 760 | 'FILENAME' => basename($_SERVER['PHP_SELF']), |
| 761 | 761 | )); |
| 762 | 762 | |
| 763 | - foreach(lng_get_list() as $lng_id => $lng_data) { |
|
| 764 | - if(isset($lng_data['LANG_VARIANTS']) && is_array($lng_data['LANG_VARIANTS'])) { |
|
| 765 | - foreach($lng_data['LANG_VARIANTS'] as $lang_variant) { |
|
| 763 | + foreach (lng_get_list() as $lng_id => $lng_data) { |
|
| 764 | + if (isset($lng_data['LANG_VARIANTS']) && is_array($lng_data['LANG_VARIANTS'])) { |
|
| 765 | + foreach ($lng_data['LANG_VARIANTS'] as $lang_variant) { |
|
| 766 | 766 | $lng_data1 = $lng_data; |
| 767 | 767 | $lng_data1 = array_merge($lng_data1, $lang_variant); |
| 768 | 768 | $template->assign_block_vars('language', $lng_data1); |
@@ -785,8 +785,8 @@ discard block |
||
| 785 | 785 | $que = $que['ques'][$que_type][$planet['id_owner']][$planet['id']]; |
| 786 | 786 | |
| 787 | 787 | $que_length = 0; |
| 788 | - if(!empty($que)) { |
|
| 789 | - foreach($que as $que_item) { |
|
| 788 | + if (!empty($que)) { |
|
| 789 | + foreach ($que as $que_item) { |
|
| 790 | 790 | $template->assign_block_vars('que', que_tpl_parse_element($que_item)); |
| 791 | 791 | } |
| 792 | 792 | $que_length = count($que); |
@@ -803,7 +803,7 @@ discard block |
||
| 803 | 803 | function tpl_planet_density_info(&$template, &$density_price_chart, $user_dark_matter) { |
| 804 | 804 | global $lang; |
| 805 | 805 | |
| 806 | - foreach($density_price_chart as $density_price_index => &$density_price_data) { |
|
| 806 | + foreach ($density_price_chart as $density_price_index => &$density_price_data) { |
|
| 807 | 807 | $density_cost = $density_price_data; |
| 808 | 808 | $density_number_style = pretty_number($density_cost, true, $user_dark_matter, false, false); |
| 809 | 809 | |
@@ -827,7 +827,7 @@ discard block |
||
| 827 | 827 | function tpl_assign_select(&$template, $name, $values) { |
| 828 | 828 | !is_array($values) ? $values = array($values => $values) : false; |
| 829 | 829 | |
| 830 | - foreach($values as $key => $value) { |
|
| 830 | + foreach ($values as $key => $value) { |
|
| 831 | 831 | $template->assign_block_vars($name, array( |
| 832 | 832 | 'KEY' => htmlentities($key, ENT_COMPAT, 'UTF-8'), |
| 833 | 833 | 'VALUE' => htmlentities($value, ENT_COMPAT, 'UTF-8'), |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
| 14 | 14 | |
| 15 | -if($config->game_mode == GAME_BLITZ) { |
|
| 15 | +if ($config->game_mode == GAME_BLITZ) { |
|
| 16 | 16 | message($lang['sys_blitz_page_disabled'], $lang['sys_error'], 'overview.php', 10); |
| 17 | 17 | die(); |
| 18 | 18 | } |
@@ -25,8 +25,8 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | $template = gettemplate('search', true); |
| 27 | 27 | |
| 28 | -if($searchtext && $type) { |
|
| 29 | - switch($type) { |
|
| 28 | +if ($searchtext && $type) { |
|
| 29 | + switch ($type) { |
|
| 30 | 30 | case "planetname": |
| 31 | 31 | // $search = db_planet_list_search($searchtext); |
| 32 | 32 | break; |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | break; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - while($row = db_fetch($search)) { |
|
| 45 | - if($type == 'playername' || $type == 'planetname') { |
|
| 44 | + while ($row = db_fetch($search)) { |
|
| 45 | + if ($type == 'playername' || $type == 'planetname') { |
|
| 46 | 46 | $template->assign_block_vars('search_result', array( |
| 47 | 47 | 'PLAYER_ID' => $row['uid'], |
| 48 | 48 | 'PLAYER_NAME' => htmlentities($row['username'], ENT_COMPAT, 'UTF-8'), |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | 'ALLY_NAME' => htmlentities($row['ally_name'], ENT_COMPAT, 'UTF-8'), |
| 58 | 58 | 'ALLY_TAG' => htmlentities($row['ally_tag'], ENT_COMPAT, 'UTF-8'), |
| 59 | 59 | )); |
| 60 | - } elseif($type == 'ally') { |
|
| 60 | + } elseif ($type == 'ally') { |
|
| 61 | 61 | $template->assign_block_vars('search_result', array( |
| 62 | 62 | 'ALLY_NAME' => htmlentities($row['ally_name'], ENT_COMPAT, 'UTF-8'), |
| 63 | 63 | 'ALLY_TAG' => htmlentities($row['ally_tag'], ENT_COMPAT, 'UTF-8'), |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | 'ally' => 'sys_alliance', |
| 76 | 76 | ); |
| 77 | 77 | |
| 78 | -foreach($search_type as $type_id => $type_lang) { |
|
| 78 | +foreach ($search_type as $type_id => $type_lang) { |
|
| 79 | 79 | $template->assign_block_vars('type', array( |
| 80 | 80 | 'ID' => $type_id, |
| 81 | 81 | 'TEXT' => $lang[$type_lang], |
@@ -12,25 +12,25 @@ discard block |
||
| 12 | 12 | global $debug, $sn_mvc, $template_result, $user; |
| 13 | 13 | |
| 14 | 14 | // Напоминание для Администрации, что игра отключена |
| 15 | -if($template_result[F_GAME_DISABLE]) { |
|
| 15 | +if ($template_result[F_GAME_DISABLE]) { |
|
| 16 | 16 | // $disable_reason = sys_bbcodeParse($config->game_disable_reason); // Должна быть инициализирована выше по коду - в init.php |
| 17 | 17 | echo '<div class="global_admin_warning">', $template_result[F_GAME_DISABLE_REASON], '</div>'; |
| 18 | 18 | } |
| 19 | 19 | unset($disable_reason); |
| 20 | 20 | |
| 21 | 21 | |
| 22 | -if(defined('IN_ADMIN') && IN_ADMIN === true) { |
|
| 22 | +if (defined('IN_ADMIN') && IN_ADMIN === true) { |
|
| 23 | 23 | lng_include('admin'); |
| 24 | -} elseif($sys_user_logged_in) { |
|
| 24 | +} elseif ($sys_user_logged_in) { |
|
| 25 | 25 | sys_user_vacation($user); |
| 26 | 26 | |
| 27 | 27 | $planet_id = SetSelectedPlanet($user); |
| 28 | 28 | |
| 29 | 29 | // TODO НЕ НУЖНО АЛЬЯНС КАЖДЫЙ РАЗ ОБНОВЛЯТЬ!!! |
| 30 | - if($user['ally_id']) { |
|
| 30 | + if ($user['ally_id']) { |
|
| 31 | 31 | sn_db_transaction_start(); |
| 32 | 32 | sn_ali_fill_user_ally($user); |
| 33 | - if(!$user['ally']['player']['id']) { |
|
| 33 | + if (!$user['ally']['player']['id']) { |
|
| 34 | 34 | // sn_sys_logout(false, true); |
| 35 | 35 | // core_auth::logout(false); |
| 36 | 36 | classSupernova::$auth->logout(false); |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | sn_db_transaction_commit(); |
| 50 | 50 | |
| 51 | 51 | $planetrow = $global_data['planet']; |
| 52 | - if(!($planetrow && isset($planetrow['id']) && $planetrow['id'])) { |
|
| 52 | + if (!($planetrow && isset($planetrow['id']) && $planetrow['id'])) { |
|
| 53 | 53 | // sn_sys_logout(false, true); |
| 54 | 54 | // core_auth::logout(false); |
| 55 | 55 | classSupernova::$auth->logout(false); |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | |
| 21 | 21 | $query = db_banned_list_select(); |
| 22 | 22 | $i = 0; |
| 23 | -while($ban_row = db_fetch($query)) { |
|
| 23 | +while ($ban_row = db_fetch($query)) { |
|
| 24 | 24 | $template->assign_block_vars('banlist', array( |
| 25 | 25 | 'USER_NAME' => $ban_row['ban_user_name'], |
| 26 | 26 | 'REASON' => $ban_row['ban_reason'], |