@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | * @return string |
| 339 | 339 | */ |
| 340 | 340 | protected function stringValue($value) { |
| 341 | - return "'" . $this->escape((string)$value) . "'"; |
|
| 341 | + return "'" . $this->escape((string) $value) . "'"; |
|
| 342 | 342 | } |
| 343 | 343 | |
| 344 | 344 | /** |
@@ -349,7 +349,7 @@ discard block |
||
| 349 | 349 | * @return string |
| 350 | 350 | */ |
| 351 | 351 | public function quote($fieldName) { |
| 352 | - return "`" . $this->escape((string)$fieldName) . "`"; |
|
| 352 | + return "`" . $this->escape((string) $fieldName) . "`"; |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | /** |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | * @return string |
| 397 | 397 | */ |
| 398 | 398 | protected function quoteTable($tableName) { |
| 399 | - return "`{{" . $this->escape((string)$tableName) . "}}`"; |
|
| 399 | + return "`{{" . $this->escape((string) $tableName) . "}}`"; |
|
| 400 | 400 | } |
| 401 | 401 | |
| 402 | 402 | /** |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | */ |
| 44 | 44 | public function toArray() { |
| 45 | 45 | $tutorial = array(); |
| 46 | - foreach($this->keys() as $key) { |
|
| 46 | + foreach ($this->keys() as $key) { |
|
| 47 | 47 | $tutorial[$key] = $this->$key; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -7,16 +7,16 @@ discard block |
||
| 7 | 7 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
| 8 | 8 | |
| 9 | 9 | $unit_id = sys_get_param_id('gid'); |
| 10 | -if($unit_id == RES_DARK_MATTER) { |
|
| 10 | +if ($unit_id == RES_DARK_MATTER) { |
|
| 11 | 11 | sys_redirect('dark_matter.php'); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | -if($unit_id == RES_METAMATTER) { |
|
| 14 | +if ($unit_id == RES_METAMATTER) { |
|
| 15 | 15 | sys_redirect('metamatter.php'); |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | lng_include('infos'); |
| 19 | -if(!$unit_id || (!get_unit_param($unit_id) && !isset($lang['info'][$unit_id]))) { |
|
| 19 | +if (!$unit_id || (!get_unit_param($unit_id) && !isset($lang['info'][$unit_id]))) { |
|
| 20 | 20 | sys_redirect('index.php?page=techtree'); |
| 21 | 21 | } |
| 22 | 22 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $unit_data = get_unit_param($unit_id); |
| 26 | 26 | $unit_type = $unit_data['type']; |
| 27 | 27 | |
| 28 | -if($unit_type == UNIT_SHIPS) { |
|
| 28 | +if ($unit_type == UNIT_SHIPS) { |
|
| 29 | 29 | $template_result['UNIT_IS_SHIP'] = true; |
| 30 | 30 | |
| 31 | 31 | $ship_data = get_ship_data($unit_id, $user); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | ); |
| 42 | 42 | |
| 43 | 43 | $engine_template_info = array(); |
| 44 | - foreach($unit_data['engine'] as $unit_engine_data) { |
|
| 44 | + foreach ($unit_data['engine'] as $unit_engine_data) { |
|
| 45 | 45 | $unit_engine_data = get_engine_data($user, $unit_engine_data); |
| 46 | 46 | |
| 47 | 47 | $engine_template_info[] = array( |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | $sn_data_group_combat = sn_get_groups('combat'); |
| 63 | -if(in_array($unit_id, $sn_data_group_combat)) { |
|
| 63 | +if (in_array($unit_id, $sn_data_group_combat)) { |
|
| 64 | 64 | $template_result['UNIT_IS_COMBAT'] = true; |
| 65 | 65 | |
| 66 | 66 | $unit_durability = $unit_data['shield'] + $unit_data['armor']; |
@@ -68,21 +68,21 @@ discard block |
||
| 68 | 68 | $volley_arr = $rapid_to = $rapid_from = array(); |
| 69 | 69 | $str_rapid_from = ''; |
| 70 | 70 | $str_rapid_to = ''; |
| 71 | - foreach($sn_data_group_combat as $enemy_id) { |
|
| 71 | + foreach ($sn_data_group_combat as $enemy_id) { |
|
| 72 | 72 | $enemy_data = get_unit_param($enemy_id); |
| 73 | 73 | $enemy_durability = $enemy_data['shield'] + $enemy_data['armor']; |
| 74 | 74 | |
| 75 | 75 | $rapid = $unit_data['attack'] * (isset($unit_data['amplify'][$enemy_id]) ? $unit_data['amplify'][$enemy_id] : 1) / $enemy_durability; |
| 76 | - if($rapid >= 1) { |
|
| 76 | + if ($rapid >= 1) { |
|
| 77 | 77 | $volley_arr[$enemy_id]['TO'] = floor($rapid); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | $rapid = $enemy_data['attack'] * (isset($enemy_data['amplify'][$unit_id]) ? $enemy_data['amplify'][$unit_id] : 1) / $unit_durability; |
| 81 | - if($rapid >= 1) { |
|
| 81 | + if ($rapid >= 1) { |
|
| 82 | 82 | $volley_arr[$enemy_id]['FROM'] = floor($rapid); |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | - foreach($volley_arr as $enemy_id => &$rapid) { |
|
| 85 | + foreach ($volley_arr as $enemy_id => &$rapid) { |
|
| 86 | 86 | $rapid['ENEMY_ID'] = $enemy_id; |
| 87 | 87 | $rapid['ENEMY_NAME'] = $lang['tech'][$enemy_id]; |
| 88 | 88 | } |
@@ -100,11 +100,11 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | -if($lang['info'][$unit_id]['effect']) { |
|
| 103 | +if ($lang['info'][$unit_id]['effect']) { |
|
| 104 | 104 | $template_result['UNIT_EFFECT'] = $lang['info'][$unit_id]['effect']; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | -if($unit_data['bonus']) { |
|
| 107 | +if ($unit_data['bonus']) { |
|
| 108 | 108 | $unit_bonus = !$unit_data['bonus'] || $unit_data['bonus_type'] == BONUS_ABILITY ? '' : ( |
| 109 | 109 | ($unit_data['bonus'] >= 0 ? '+' : '') . $unit_data['bonus'] . ($unit_data['bonus_type'] == BONUS_PERCENT ? '%' : '') |
| 110 | 110 | ); |
@@ -8,8 +8,8 @@ discard block |
||
| 8 | 8 | * @copyright 2008 by ??????? for XNova |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -define('INSIDE' , true); |
|
| 12 | -define('INSTALL' , false); |
|
| 11 | +define('INSIDE', true); |
|
| 12 | +define('INSTALL', false); |
|
| 13 | 13 | define('IN_ADMIN', true); |
| 14 | 14 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
| 15 | 15 | |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | $template = gettemplate('admin/settings', true); |
| 21 | 21 | |
| 22 | -if(sys_get_param('save')) { |
|
| 22 | +if (sys_get_param('save')) { |
|
| 23 | 23 | classSupernova::$config->game_name = sys_get_param_str_unsafe('game_name'); |
| 24 | 24 | classSupernova::$config->game_mode = sys_get_param_int('game_mode'); |
| 25 | 25 | classSupernova::$config->game_speed = sys_get_param_float('game_speed', 1); |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | classSupernova::$config->url_faq = sys_get_param_str_unsafe('url_faq'); |
| 30 | 30 | classSupernova::$config->url_forum = sys_get_param_str_unsafe('url_forum'); |
| 31 | 31 | classSupernova::$config->url_rules = sys_get_param_str_unsafe('url_rules'); |
| 32 | - classSupernova::$config->url_purchase_metamatter = sys_get_param_str_unsafe('url_purchase_metamatter'); |
|
| 32 | + classSupernova::$config->url_purchase_metamatter = sys_get_param_str_unsafe('url_purchase_metamatter'); |
|
| 33 | 33 | classSupernova::$config->game_disable = sys_get_param_int('game_disable'); |
| 34 | 34 | classSupernova::$config->game_disable_reason = sys_get_param_str_unsafe('game_disable_reason'); |
| 35 | 35 | classSupernova::$config->server_updater_check_auto = sys_get_param_int('server_updater_check_auto'); |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | classSupernova::$config->stats_schedule = sys_get_param_str('stats_schedule'); |
| 97 | 97 | |
| 98 | 98 | classSupernova::$config->empire_mercenary_base_period = sys_get_param_int('empire_mercenary_base_period'); |
| 99 | - if(classSupernova::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) { |
|
| 100 | - if(classSupernova::$config->empire_mercenary_temporary) { |
|
| 99 | + if (classSupernova::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) { |
|
| 100 | + if (classSupernova::$config->empire_mercenary_temporary) { |
|
| 101 | 101 | DBStaticUnit::db_unit_list_admin_delete_mercenaries_finished(); |
| 102 | 102 | } else { |
| 103 | 103 | DBStaticUnit::db_unit_list_admin_set_mercenaries_expire_time(classSupernova::$config->empire_mercenary_base_period); |
@@ -140,21 +140,21 @@ discard block |
||
| 140 | 140 | // 'STATS_SCHEDULE' => classSupernova::$config->stats_hide_player_list, |
| 141 | 141 | )); |
| 142 | 142 | |
| 143 | -foreach($lang['sys_game_disable_reason'] as $id => $name) { |
|
| 143 | +foreach ($lang['sys_game_disable_reason'] as $id => $name) { |
|
| 144 | 144 | $template->assign_block_vars('sys_game_disable_reason', array( |
| 145 | 145 | 'ID' => $id, |
| 146 | 146 | 'NAME' => $name, |
| 147 | 147 | )); |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | -foreach($lang['sys_game_mode'] as $mode_id => $mode_name) { |
|
| 150 | +foreach ($lang['sys_game_mode'] as $mode_id => $mode_name) { |
|
| 151 | 151 | $template->assign_block_vars('game_modes', array( |
| 152 | 152 | 'ID' => $mode_id, |
| 153 | 153 | 'NAME' => $mode_name, |
| 154 | 154 | )); |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | -foreach($lang['adm_opt_ver_response'] as $ver_id => $ver_response) { |
|
| 157 | +foreach ($lang['adm_opt_ver_response'] as $ver_id => $ver_response) { |
|
| 158 | 158 | $template->assign_block_vars('ver_response', array( |
| 159 | 159 | 'ID' => $ver_id, |
| 160 | 160 | 'NAME' => js_safe_string($ver_response), |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | $lang_list = lng_get_list(); |
| 165 | -foreach($lang_list as $lang_id => $lang_data) { |
|
| 165 | +foreach ($lang_list as $lang_id => $lang_data) { |
|
| 166 | 166 | $template->assign_block_vars('game_languages', array( |
| 167 | 167 | 'ID' => $lang_id, |
| 168 | 168 | 'NAME' => "{$lang_data['LANG_NAME_NATIVE']} ({$lang_data['LANG_NAME_ENGLISH']})", |
@@ -7,9 +7,9 @@ |
||
| 7 | 7 | * |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -define('INSIDE' , true); |
|
| 11 | -define('INSTALL' , false); |
|
| 12 | -define('IN_ADMIN' , true); |
|
| 10 | +define('INSIDE', true); |
|
| 11 | +define('INSTALL', false); |
|
| 12 | +define('IN_ADMIN', true); |
|
| 13 | 13 | |
| 14 | 14 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
| 15 | 15 | |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | global $config, $lang, $user; |
| 19 | 19 | |
| 20 | -if($user['authlevel'] < 3) { |
|
| 20 | +if ($user['authlevel'] < 3) { |
|
| 21 | 21 | sys_redirect(SN_ROOT_VIRTUAL . 'admin/banned.php'); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | $sort = sys_get_param_int('sort', SORT_ID); |
| 42 | 42 | $sort = $sort_fields[$sort] ? $sort : SORT_ID; |
| 43 | 43 | |
| 44 | -if(($action = sys_get_param_int('action')) && ($user_id = sys_get_param_id('uid')) && ($user_selected = db_user_by_id($user_id, false, 'id, username, authlevel'))) { |
|
| 45 | - if($user_selected['authlevel'] < $user['authlevel'] && $user['authlevel'] >= 3) { |
|
| 46 | - switch($action) { |
|
| 44 | +if (($action = sys_get_param_int('action')) && ($user_id = sys_get_param_id('uid')) && ($user_selected = db_user_by_id($user_id, false, 'id, username, authlevel'))) { |
|
| 45 | + if ($user_selected['authlevel'] < $user['authlevel'] && $user['authlevel'] >= 3) { |
|
| 46 | + switch ($action) { |
|
| 47 | 47 | case ACTION_DELETE: |
| 48 | 48 | DeleteSelectedUser($user_id); |
| 49 | 49 | sys_redirect("{$_SERVER['SCRIPT_NAME']}?sort={$sort}"); |
@@ -64,20 +64,20 @@ discard block |
||
| 64 | 64 | |
| 65 | 65 | $multi_ip = array(); |
| 66 | 66 | $ip_query = db_user_list_admin_multiaccounts(); |
| 67 | -while($ip = db_fetch($ip_query)) { |
|
| 67 | +while ($ip = db_fetch($ip_query)) { |
|
| 68 | 68 | $multi_ip[$ip['user_lastip']] = $ip['ip_count']; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | $geoip = geoip_status(); |
| 72 | 72 | |
| 73 | 73 | $query = db_user_list_admin_sorted($sort_fields[$sort], $is_players_online_page); |
| 74 | -while($user_row = db_fetch($query)) { |
|
| 75 | - if($user_row['banaday']) { |
|
| 74 | +while ($user_row = db_fetch($query)) { |
|
| 75 | + if ($user_row['banaday']) { |
|
| 76 | 76 | $ban_details = doquery("SELECT * FROM {{banned}} WHERE `ban_user_id` = {$user_row['id']} ORDER BY ban_id DESC LIMIT 1", true); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $geoip_info = $geoip ? geoip_ip_info(ip2longu($user_row['user_lastip'])) : array(); |
| 80 | - foreach($geoip_info as $key => $value) { |
|
| 80 | + foreach ($geoip_info as $key => $value) { |
|
| 81 | 81 | $geoip_info[strtoupper($key)] = $value; |
| 82 | 82 | unset($geoip_info[$key]); |
| 83 | 83 | } |
@@ -8,8 +8,8 @@ discard block |
||
| 8 | 8 | * |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | -define('INSIDE' , true); |
|
| 12 | -define('INSTALL' , false); |
|
| 11 | +define('INSIDE', true); |
|
| 12 | +define('INSTALL', false); |
|
| 13 | 13 | define('IN_ADMIN', true); |
| 14 | 14 | |
| 15 | 15 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | ), |
| 29 | 29 | ); |
| 30 | 30 | $template->assign_block_vars('int_type_selected', $allowed_types[-1]); |
| 31 | -foreach($sn_message_class_list as $key => $value) |
|
| 31 | +foreach ($sn_message_class_list as $key => $value) |
|
| 32 | 32 | { |
| 33 | - if($key == MSG_TYPE_NEW || $key == MSG_TYPE_OUTBOX) |
|
| 33 | + if ($key == MSG_TYPE_NEW || $key == MSG_TYPE_OUTBOX) |
|
| 34 | 34 | { |
| 35 | 35 | continue; |
| 36 | 36 | } |
@@ -43,19 +43,19 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | $message_delete = sys_get_param_id('msg_del'); |
| 46 | -if(sys_get_param('str_delete_selected') && is_array($message_delete = sys_get_param('selected')) && !empty($message_delete)) |
|
| 46 | +if (sys_get_param('str_delete_selected') && is_array($message_delete = sys_get_param('selected')) && !empty($message_delete)) |
|
| 47 | 47 | { |
| 48 | 48 | $message_delete = implode(', ', $message_delete); |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | -if($message_delete) |
|
| 51 | +if ($message_delete) |
|
| 52 | 52 | { |
| 53 | 53 | doquery("DELETE FROM {{messages}} WHERE `message_id` in ({$message_delete});"); |
| 54 | 54 | $template->assign_block_vars('result', array('MESSAGE' => sprintf($lang['mlst_messages_deleted'], $message_delete))); |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | |
| 58 | -if(sys_get_param('str_delete_date') && checkdate($month = sys_get_param_id('delete_month'), $day = sys_get_param_id('delete_day'), $year = sys_get_param_id('delete_year'))) |
|
| 58 | +if (sys_get_param('str_delete_date') && checkdate($month = sys_get_param_id('delete_month'), $day = sys_get_param_id('delete_day'), $year = sys_get_param_id('delete_year'))) |
|
| 59 | 59 | { |
| 60 | 60 | $delete_date = "{$year}-{$month}-{$day}"; |
| 61 | 61 | doquery("DELETE FROM {{messages}} WHERE message_time <= UNIX_TIMESTAMP('{$delete_date}')" . ($int_type_selected >= 0 ? " AND `message_type` = {$int_type_selected}" : '')); |
@@ -68,16 +68,16 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | $int_page_current = min(sys_get_param_id('int_page_current', 1), $page_max); |
| 70 | 70 | |
| 71 | -if(sys_get_param('page_prev') && $int_page_current > 1) |
|
| 71 | +if (sys_get_param('page_prev') && $int_page_current > 1) |
|
| 72 | 72 | { |
| 73 | 73 | $int_page_current--; |
| 74 | 74 | } |
| 75 | -elseif(sys_get_param('page_next') && $int_page_current < $page_max) |
|
| 75 | +elseif (sys_get_param('page_next') && $int_page_current < $page_max) |
|
| 76 | 76 | { |
| 77 | 77 | $int_page_current++; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | -for($i = 1; $i <= $page_max; $i++) |
|
| 80 | +for ($i = 1; $i <= $page_max; $i++) |
|
| 81 | 81 | { |
| 82 | 82 | $template->assign_block_vars('page', array('NUMBER' => $i)); |
| 83 | 83 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | $StartRec = ($int_page_current - 1) * 25; |
| 86 | 86 | |
| 87 | 87 | $Messages = db_message_list_admin_by_type($int_type_selected, $StartRec); |
| 88 | -while($row = db_fetch($Messages)) |
|
| 88 | +while ($row = db_fetch($Messages)) |
|
| 89 | 89 | { |
| 90 | 90 | $row['FROM'] = htmlentities($row['FROM'], ENT_COMPAT, 'UTF-8'); |
| 91 | 91 | $row['OWNER_NAME'] = htmlentities($row['OWNER_NAME'], ENT_COMPAT, 'UTF-8'); |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -define('INSIDE' , true); |
|
| 3 | -define('INSTALL' , false); |
|
| 2 | +define('INSIDE', true); |
|
| 3 | +define('INSTALL', false); |
|
| 4 | 4 | define('IN_ADMIN', true); |
| 5 | 5 | |
| 6 | 6 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | $username_unsafe = sys_get_param_str_unsafe('username'); |
| 25 | 25 | $username = sys_get_param_escaped('username'); |
| 26 | 26 | |
| 27 | -if($galaxy_src) |
|
| 27 | +if ($galaxy_src) |
|
| 28 | 28 | { |
| 29 | 29 | sn_db_transaction_start(); |
| 30 | 30 | $errors = array(); |
@@ -34,41 +34,41 @@ discard block |
||
| 34 | 34 | $planet = sys_o_get_updated($owner, array('galaxy' => $galaxy_src, 'system' => $system_src, 'planet' => $planet_src, 'planet_type' => 1), SN_TIME_NOW); |
| 35 | 35 | $que = $planet['que']; |
| 36 | 36 | $planet = $planet['planet']; |
| 37 | - if(!$planet) |
|
| 37 | + if (!$planet) |
|
| 38 | 38 | { |
| 39 | 39 | $errors[] = $lang['adm_pl_comp_err_0']; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - if($planet['destruyed']) |
|
| 42 | + if ($planet['destruyed']) |
|
| 43 | 43 | { |
| 44 | 44 | $errors[] = $lang['adm_pl_comp_err_1']; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - if($planet['id_owner'] != $owner['id'] || !$username) |
|
| 47 | + if ($planet['id_owner'] != $owner['id'] || !$username) |
|
| 48 | 48 | { |
| 49 | 49 | $errors[] = $lang['adm_pl_comp_err_4']; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | $destination = sys_o_get_updated($owner, array('galaxy' => $galaxy_dst, 'system' => $system_dst, 'planet' => $planet_dst, 'planet_type' => 1), SN_TIME_NOW); |
| 53 | 53 | $destination = $destination['planet']; |
| 54 | - if(!$destination) |
|
| 54 | + if (!$destination) |
|
| 55 | 55 | { |
| 56 | 56 | $errors[] = $lang['adm_pl_comp_err_2']; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - if($planet['id'] == $destination['id']) |
|
| 59 | + if ($planet['id'] == $destination['id']) |
|
| 60 | 60 | { |
| 61 | 61 | $errors[] = $lang['adm_pl_comp_err_5']; |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - if($planet['id_owner'] != $destination['id_owner']) |
|
| 64 | + if ($planet['id_owner'] != $destination['id_owner']) |
|
| 65 | 65 | { |
| 66 | 66 | $errors[] = $lang['adm_pl_comp_err_3']; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - if(!empty($errors)) |
|
| 69 | + if (!empty($errors)) |
|
| 70 | 70 | { |
| 71 | - foreach($errors as $error) |
|
| 71 | + foreach ($errors as $error) |
|
| 72 | 72 | { |
| 73 | 73 | $template->assign_block_vars('error', array( |
| 74 | 74 | 'TEXT' => $error, |
@@ -82,14 +82,14 @@ discard block |
||
| 82 | 82 | killer_add_planet($planet); |
| 83 | 83 | |
| 84 | 84 | $moon = DBStaticPlanet::db_planet_by_gspt($galaxy_src, $system_src, $planet_src, PT_MOON, true); |
| 85 | - if($moon) |
|
| 85 | + if ($moon) |
|
| 86 | 86 | { |
| 87 | 87 | $moon = sys_o_get_updated($owner, $moon, SN_TIME_NOW); |
| 88 | 88 | $moon = $moon['planet']; |
| 89 | 89 | killer_add_planet($moon); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - foreach(sn_get_groups('resources_loot') as $resource_id) |
|
| 92 | + foreach (sn_get_groups('resources_loot') as $resource_id) |
|
| 93 | 93 | { |
| 94 | 94 | $resource_name = pname_resource_name($resource_id); |
| 95 | 95 | $template->assign_var("{$resource_name}_cost", $final_cost[$resource_id]); |
@@ -97,13 +97,13 @@ discard block |
||
| 97 | 97 | $template->assign_var("{$resource_name}_bonus", $final_cost[$resource_id]); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - if($_GET['btn_confirm']) |
|
| 100 | + if ($_GET['btn_confirm']) |
|
| 101 | 101 | { |
| 102 | 102 | $time = SN_TIME_NOW + PERIOD_DAY; |
| 103 | 103 | |
| 104 | 104 | DBStaticUnit::db_unit_list_delete($planet['id_owner'], LOC_PLANET, $planet['id']); |
| 105 | 105 | DBStaticPlanet::db_planet_set_by_id($planet['id'], "id_owner = 0, destruyed = {$time}"); |
| 106 | - if($moon) |
|
| 106 | + if ($moon) |
|
| 107 | 107 | { |
| 108 | 108 | DBStaticUnit::db_unit_list_delete($planet['id_owner'], LOC_PLANET, $moon['id']); |
| 109 | 109 | DBStaticPlanet::db_planet_set_by_id($moon['id'], "id_owner = 0, destruyed = {$time}"); |
@@ -145,34 +145,34 @@ discard block |
||
| 145 | 145 | } |
| 146 | 146 | */ |
| 147 | 147 | |
| 148 | - foreach(sn_get_groups('structures') as $unit_id) |
|
| 148 | + foreach (sn_get_groups('structures') as $unit_id) |
|
| 149 | 149 | { |
| 150 | 150 | $build_level = mrc_get_level($user, $planet, $unit_id, true, true); |
| 151 | - if($build_level > 0) |
|
| 151 | + if ($build_level > 0) |
|
| 152 | 152 | { |
| 153 | 153 | $unit_cost = get_unit_param($unit_id, 'cost'); |
| 154 | 154 | $build_factor = $unit_cost['factor'] != 1 ? (1 - pow($unit_cost['factor'], $build_level)) / (1 - $unit_cost['factor']) : $unit_cost['factor']; |
| 155 | - foreach($sn_group_resources_loot as $resource_id) |
|
| 155 | + foreach ($sn_group_resources_loot as $resource_id) |
|
| 156 | 156 | { |
| 157 | 157 | $final_cost[$resource_id] += isset($unit_cost[$resource_id]) && $unit_cost[$resource_id] > 0 ? floor($unit_cost[$resource_id] * $build_factor) : 0; |
| 158 | 158 | } |
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - foreach(sn_get_groups(array('defense', 'fleet')) as $unit_id) |
|
| 162 | + foreach (sn_get_groups(array('defense', 'fleet')) as $unit_id) |
|
| 163 | 163 | { |
| 164 | 164 | $unit_count = mrc_get_level($user, $planet, $unit_id, true, true); |
| 165 | - if($unit_count > 0) |
|
| 165 | + if ($unit_count > 0) |
|
| 166 | 166 | { |
| 167 | 167 | $unit_cost = get_unit_param($unit_id, 'cost'); |
| 168 | - foreach($sn_group_resources_loot as $resource_id) |
|
| 168 | + foreach ($sn_group_resources_loot as $resource_id) |
|
| 169 | 169 | { |
| 170 | 170 | $final_cost[$resource_id] += isset($unit_cost[$resource_id]) && $unit_cost[$resource_id] > 0 ? floor($unit_cost[$resource_id] * $unit_count) : 0; |
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - foreach($sn_group_resources_loot as $resource_id) |
|
| 175 | + foreach ($sn_group_resources_loot as $resource_id) |
|
| 176 | 176 | { |
| 177 | 177 | $final_cost[$resource_id] += floor(mrc_get_level($user, $planet, $resource_id, true, true)); |
| 178 | 178 | } |
@@ -20,30 +20,30 @@ |
||
| 20 | 20 | $planet_id = sys_get_param_id('planet_id'); |
| 21 | 21 | |
| 22 | 22 | $unit_list = sys_get_param('unit_list'); |
| 23 | -if(sys_get_param('change_data') && !empty($unit_list)) |
|
| 23 | +if (sys_get_param('change_data') && !empty($unit_list)) |
|
| 24 | 24 | { |
| 25 | 25 | $query_string = array(); |
| 26 | - foreach($unit_list as $unit_id => $unit_amount) |
|
| 26 | + foreach ($unit_list as $unit_id => $unit_amount) |
|
| 27 | 27 | { |
| 28 | - if($unit_query_string = admin_planet_edit_query_string($unit_id, $unit_amount, $mode)) |
|
| 28 | + if ($unit_query_string = admin_planet_edit_query_string($unit_id, $unit_amount, $mode)) |
|
| 29 | 29 | { |
| 30 | 30 | $query_string[] = $unit_query_string; |
| 31 | 31 | } |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | - if(!empty($query_string)) |
|
| 34 | + if (!empty($query_string)) |
|
| 35 | 35 | { |
| 36 | 36 | DBStaticPlanet::db_planet_set_by_id($planet_id, implode(', ', $query_string)); |
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | -if($planet_id) |
|
| 40 | +if ($planet_id) |
|
| 41 | 41 | { |
| 42 | 42 | $edit_planet_row = DBStaticPlanet::db_planet_by_id($planet_id); |
| 43 | 43 | admin_planet_edit_template($template, $edit_planet_row, $mode); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | -foreach($admin_planet_edit_mode_list as $page_mode => $mode_locale) |
|
| 46 | +foreach ($admin_planet_edit_mode_list as $page_mode => $mode_locale) |
|
| 47 | 47 | { |
| 48 | 48 | $template->assign_block_vars('page_menu', array( |
| 49 | 49 | 'ID' => $page_mode, |