@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | global $lang; |
| 4 | 4 | $classLocale = $lang; |
| 5 | 5 | |
| 6 | -if(!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) |
|
| 6 | +if (!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) |
|
| 7 | 7 | { |
| 8 | 8 | $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403); |
| 9 | 9 | } |
@@ -18,50 +18,50 @@ discard block |
||
| 18 | 18 | )); |
| 19 | 19 | |
| 20 | 20 | $info_action = sys_get_param_int('action'); |
| 21 | -if($info_action) |
|
| 21 | +if ($info_action) |
|
| 22 | 22 | { |
| 23 | 23 | try |
| 24 | 24 | { |
| 25 | 25 | sn_db_transaction_start(); |
| 26 | 26 | |
| 27 | 27 | $user = db_user_by_id($user['id'], true); |
| 28 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < $config->rpg_cost_info) |
|
| 28 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < $config->rpg_cost_info) |
|
| 29 | 29 | { |
| 30 | 30 | throw new Exception(MARKET_NO_DM, ERR_ERROR); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | - switch($info_action) |
|
| 33 | + switch ($info_action) |
|
| 34 | 34 | { |
| 35 | 35 | case MARKET_INFO_PLAYER: |
| 36 | 36 | $user_info_name_unsafe = sys_get_param_str_unsafe('user_info_name'); |
| 37 | - if(!$user_info_name_unsafe) |
|
| 37 | + if (!$user_info_name_unsafe) |
|
| 38 | 38 | { |
| 39 | 39 | throw new Exception(MARKET_INFO_PLAYER_WRONG, ERR_ERROR); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - if(is_id($user_info_name_unsafe)) |
|
| 42 | + if (is_id($user_info_name_unsafe)) |
|
| 43 | 43 | { |
| 44 | 44 | $user_info = db_user_by_id($user_info_name_unsafe, true, '`id`, `username`', true); |
| 45 | 45 | } |
| 46 | - if(!is_array($user_info)) |
|
| 46 | + if (!is_array($user_info)) |
|
| 47 | 47 | { |
| 48 | 48 | $user_info = db_user_by_username($user_info_name_unsafe, true, '`id`, `username`', true, true); |
| 49 | 49 | } |
| 50 | - if(!is_array($user_info)) |
|
| 50 | + if (!is_array($user_info)) |
|
| 51 | 51 | { |
| 52 | 52 | throw new Exception(MARKET_INFO_PLAYER_NOT_FOUND, ERR_ERROR); |
| 53 | 53 | } |
| 54 | - if($user_info['id'] == $user['id']) |
|
| 54 | + if ($user_info['id'] == $user['id']) |
|
| 55 | 55 | { |
| 56 | 56 | throw new Exception(MARKET_INFO_PLAYER_SAME, ERR_ERROR); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | $msg_text = array(); |
| 60 | - foreach(sn_get_groups('mercenaries') as $mercenary_id) |
|
| 60 | + foreach (sn_get_groups('mercenaries') as $mercenary_id) |
|
| 61 | 61 | { |
| 62 | 62 | $msg_text[] = "{$classLocale['tech'][$mercenary_id]} - " . (($mercenary_level = mrc_get_level($user_info, false, $mercenary_id)) ? "{$classLocale['sys_level']} {$mercenary_level}" : classLocale::$lang['eco_mrk_info_not_hired']); |
| 63 | 63 | } |
| 64 | - if($mercenary_level = mrc_get_level($user_info, false, UNIT_PREMIUM)) |
|
| 64 | + if ($mercenary_level = mrc_get_level($user_info, false, UNIT_PREMIUM)) |
|
| 65 | 65 | { |
| 66 | 66 | $msg_text[] = "{$classLocale['tech'][UNIT_PREMIUM]} - {$mercenary_level} {$classLocale['sys_level']}"; |
| 67 | 67 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | break; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - if(!rpg_points_change($user['id'], RPG_MARKET_INFO_MERCENARY, -$config->rpg_cost_info, "Using Black Market page {$classLocale['eco_mrk_info']} - getting info about user ID {$user_info['id']}")) |
|
| 78 | + if (!rpg_points_change($user['id'], RPG_MARKET_INFO_MERCENARY, -$config->rpg_cost_info, "Using Black Market page {$classLocale['eco_mrk_info']} - getting info about user ID {$user_info['id']}")) |
|
| 79 | 79 | { |
| 80 | 80 | // TODO: throw new Exception(MARKET_INFO_PLAYER_SAME, ERR_ERROR); |
| 81 | 81 | } |
@@ -22,17 +22,17 @@ discard block |
||
| 22 | 22 | $sn_group_factories = sn_get_groups('factories'); |
| 23 | 23 | $planet_density = sn_get_groups('planet_density'); |
| 24 | 24 | |
| 25 | - if(sys_get_param('save_production')) { |
|
| 25 | + if (sys_get_param('save_production')) { |
|
| 26 | 26 | $production = sys_get_param('percent'); |
| 27 | - if(is_array($production) && !empty($production)) { |
|
| 27 | + if (is_array($production) && !empty($production)) { |
|
| 28 | 28 | // sn_db_transaction_start(); |
| 29 | 29 | $query = array(); |
| 30 | 30 | $planet_row_list = db_planet_list_sorted($user, false, '*'); |
| 31 | 31 | // while($planet = db_fetch($planet_row_list)) |
| 32 | - foreach($planet_row_list as $planet) { |
|
| 33 | - foreach($sn_group_factories as $factory_unit_id) { |
|
| 32 | + foreach ($planet_row_list as $planet) { |
|
| 33 | + foreach ($sn_group_factories as $factory_unit_id) { |
|
| 34 | 34 | $unit_db_name_porcent = pname_factory_production_field_name($factory_unit_id); |
| 35 | - if( |
|
| 35 | + if ( |
|
| 36 | 36 | get_unit_param($factory_unit_id, P_MINING_IS_MANAGED) |
| 37 | 37 | && isset($production[$factory_unit_id][$planet['id']]) |
| 38 | 38 | && ($actual_porcent = intval($production[$factory_unit_id][$planet['id']] / 10)) >= 0 |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | - foreach($query as $planet_id => $query_data) { |
|
| 46 | + foreach ($query as $planet_id => $query_data) { |
|
| 47 | 47 | db_planet_set_by_id($planet_id, implode(',', $query_data)); |
| 48 | 48 | } |
| 49 | 49 | // sn_db_transaction_commit(); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | $planet_row_list = db_planet_list_sorted($user); |
| 54 | 54 | // while ($planet = db_fetch($planet_row_list)) |
| 55 | - foreach($planet_row_list as $planet) { |
|
| 55 | + foreach ($planet_row_list as $planet) { |
|
| 56 | 56 | sn_db_transaction_start(); |
| 57 | 57 | $global_data = sys_o_get_updated($user, $planet['id'], SN_TIME_NOW, false, true); |
| 58 | 58 | $planets[$planet['id']] = $global_data['planet']; |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $template = gettemplate('imperium', $template); |
| 65 | 65 | $template->assign_var('amount', count($planets) + 2); |
| 66 | 66 | |
| 67 | - for($i = 100; $i >= 0; $i -= 10) { |
|
| 67 | + for ($i = 100; $i >= 0; $i -= 10) { |
|
| 68 | 68 | $template->assign_block_vars('percent', array('PERCENT' => $i)); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -74,13 +74,13 @@ discard block |
||
| 74 | 74 | $total['temp_min'] = 1000; |
| 75 | 75 | $total['temp_max'] = -999; |
| 76 | 76 | |
| 77 | - foreach($planets as $planet_index => &$planet) { |
|
| 77 | + foreach ($planets as $planet_index => &$planet) { |
|
| 78 | 78 | $list_planet_que = $ques[$planet_index]; |
| 79 | 79 | $planet_template = tpl_parse_planet($planet); |
| 80 | 80 | |
| 81 | 81 | $planet_fleet_id = 0; |
| 82 | - $fleet_list = $planet_template['fleet_list'];//flt_get_fleets_to_planet($planet); |
|
| 83 | - if($fleet_list['own']['count']) { |
|
| 82 | + $fleet_list = $planet_template['fleet_list']; //flt_get_fleets_to_planet($planet); |
|
| 83 | + if ($fleet_list['own']['count']) { |
|
| 84 | 84 | $planet_fleet_id = "p{$fleet_id}"; |
| 85 | 85 | $fleets[] = tpl_parse_fleet_sn($fleet_list['own']['total'], $planet_fleet_id); |
| 86 | 86 | $fleet_id++; |
@@ -141,17 +141,17 @@ discard block |
||
| 141 | 141 | UNIT_DEFENCE => 'defense', |
| 142 | 142 | ); |
| 143 | 143 | |
| 144 | - foreach($show_groups as $unit_group_id => $mode) { |
|
| 144 | + foreach ($show_groups as $unit_group_id => $mode) { |
|
| 145 | 145 | $template->assign_block_vars('prods', array( |
| 146 | 146 | 'NAME' => classLocale::$lang['tech'][$unit_group_id], |
| 147 | 147 | )); |
| 148 | 148 | $unit_group = get_unit_param('techtree', $unit_group_id); |
| 149 | - foreach($unit_group as $unit_id) { |
|
| 149 | + foreach ($unit_group as $unit_id) { |
|
| 150 | 150 | $unit_count = $unit_count_abs = 0; |
| 151 | 151 | $block_vars = array(); |
| 152 | 152 | $unit_is_factory = in_array($unit_id, $sn_group_factories) && get_unit_param($unit_id, P_MINING_IS_MANAGED); |
| 153 | 153 | // $unit_db_name = pname_resource_name($unit_id); |
| 154 | - foreach($planets as $planet) { |
|
| 154 | + foreach ($planets as $planet) { |
|
| 155 | 155 | $unit_level_plain = mrc_get_level($user, $planet, $unit_id, false, true); |
| 156 | 156 | |
| 157 | 157 | $level_plus['FACTORY'] = $unit_is_factory; |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $level_plus['LEVEL_PLUS_GREEN'] = 0; |
| 160 | 160 | |
| 161 | 161 | $level_plus['PERCENT'] = $unit_is_factory ? ($unit_level_plain ? $planet[pname_factory_production_field_name($unit_id)] * 10 : -1) : -1; |
| 162 | - switch($mode) { |
|
| 162 | + switch ($mode) { |
|
| 163 | 163 | /* |
| 164 | 164 | case 'structures': |
| 165 | 165 | $level_plus_build = $ques[$planet['id']]['in_que'][que_get_unit_que($unit_id)][$user['id']][$planet['id']][$unit_id]; |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | case 'structures': |
| 180 | 180 | case 'defense': |
| 181 | 181 | $level_plus_build = $ques[$planet['id']]['in_que'][que_get_unit_que($unit_id)][$user['id']][$planet['id']][$unit_id]; |
| 182 | - if($level_plus_build) { |
|
| 182 | + if ($level_plus_build) { |
|
| 183 | 183 | $level_plus['LEVEL_PLUS_GREEN'] = $level_plus_build < 0 ? $level_plus_build : "+{$level_plus_build}"; |
| 184 | 184 | // $level_plus['LEVEL_PLUS_GREEN'] = "+{$level_plus_build}"; |
| 185 | 185 | $total['units'][$unit_id]['LEVEL_PLUS_GREEN'] += $level_plus['LEVEL_PLUS_GREEN']; |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | $unit_count_abs += $unit_level_plain + abs($level_plus['LEVEL_PLUS_YELLOW']) + abs($level_plus['LEVEL_PLUS_GREEN']); |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - if($unit_count_abs) { |
|
| 202 | + if ($unit_count_abs) { |
|
| 203 | 203 | $template->assign_block_vars('prods', array( |
| 204 | 204 | 'ID' => $unit_id, |
| 205 | 205 | 'FIELD' => 'unit_' . $unit_id, // pname_resource_name($unit_id), // TODO Делать это прямо в темплейте |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | 'MODE' => $mode, |
| 208 | 208 | )); |
| 209 | 209 | |
| 210 | - foreach($block_vars as $block_var) { |
|
| 210 | + foreach ($block_vars as $block_var) { |
|
| 211 | 211 | $template->assign_block_vars('prods.planet', $block_var); |
| 212 | 212 | } |
| 213 | 213 | $unit_green = $total['units'][$unit_id]['LEVEL_PLUS_GREEN']; |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | $query = db_user_list("`authlevel` > 0 ORDER BY `authlevel` ASC"); |
| 17 | 17 | |
| 18 | 18 | // while($row = db_fetch($query)) |
| 19 | - foreach($query as $row) { |
|
| 19 | + foreach ($query as $row) { |
|
| 20 | 20 | $template_result['.']['contact'][] = array( |
| 21 | 21 | 'NAME' => $row['username'], |
| 22 | 22 | 'LEVEL' => classLocale::$lang['user_level'][$row['authlevel']], |