@@ -56,7 +56,7 @@ |
||
56 | 56 | $config->pass()->game_disable = GAME_DISABLE_STAT; |
57 | 57 | |
58 | 58 | $statMinimalInterval = intval($config->pass()->stats_minimal_interval); |
59 | - $config->pass()->var_stat_update_end= date(FMT_DATE_TIME_SQL, SN_TIME_NOW + ($statMinimalInterval ? $statMinimalInterval : STATS_RUN_INTERVAL_MINIMUM)); |
|
59 | + $config->pass()->var_stat_update_end = date(FMT_DATE_TIME_SQL, SN_TIME_NOW + ($statMinimalInterval ? $statMinimalInterval : STATS_RUN_INTERVAL_MINIMUM)); |
|
60 | 60 | $config->pass()->var_stat_update_msg = 'Update started'; |
61 | 61 | SN::db_transaction_commit(); |
62 | 62 |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | $planet = $planetrow['planet']; |
66 | 66 | } |
67 | 67 | |
68 | -$uni_galaxy = (int)$uni_galaxy; |
|
69 | -$uni_system = (int)$uni_system; |
|
68 | +$uni_galaxy = (int) $uni_galaxy; |
|
69 | +$uni_system = (int) $uni_system; |
|
70 | 70 | |
71 | 71 | $uni_galaxy = $uni_galaxy < 1 ? 1 : ($uni_galaxy > SN::$config->game_maxGalaxy ? SN::$config->game_maxGalaxy : $uni_galaxy); |
72 | 72 | $uni_system = $uni_system < 1 ? 1 : ($uni_system > SN::$config->game_maxSystem ? SN::$config->game_maxSystem : $uni_system); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | || |
132 | 132 | (!empty($uni_galaxyRowPlanet['destruyed']) && CheckAbandonPlanetState($uni_galaxyRowPlanet)) |
133 | 133 | ) { |
134 | - $template->assign_block_vars('galaxyrow', ['PLANET_NUM' => $Planet,]); |
|
134 | + $template->assign_block_vars('galaxyrow', ['PLANET_NUM' => $Planet, ]); |
|
135 | 135 | continue; |
136 | 136 | } |
137 | 137 | |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | 'IS_CAPITAL' => $uni_galaxyRowUser['id_planet'] == $uni_galaxyRowPlanet['id'], |
250 | 250 | |
251 | 251 | 'USER_ID' => $uni_galaxyRowUser['id'], |
252 | - 'USER_NAME' => $renderedNick = player_nick_render_to_html($uni_galaxyRowUser, ['icons' => true,]), |
|
252 | + 'USER_NAME' => $renderedNick = player_nick_render_to_html($uni_galaxyRowUser, ['icons' => true, ]), |
|
253 | 253 | 'USER_NAME_JS' => js_safe_string($renderedNick), |
254 | 254 | 'USER_RANK' => in_array($uni_galaxyRowUser['id'], $user_skip_list) ? '-' : $uni_galaxyRowUser['total_rank'], |
255 | 255 | 'USER_BANNED' => $uni_galaxyRowUser['banaday'], |
@@ -29,19 +29,19 @@ discard block |
||
29 | 29 | */ |
30 | 30 | function db_set_make_safe_string($set, $delta = false) { |
31 | 31 | $set_safe = array(); |
32 | - foreach($set as $field => $value) { |
|
33 | - if(empty($field)) { |
|
32 | + foreach ($set as $field => $value) { |
|
33 | + if (empty($field)) { |
|
34 | 34 | continue; |
35 | 35 | } |
36 | 36 | |
37 | 37 | $field = '`' . SN::$db->db_escape($field) . '`'; |
38 | 38 | $new_value = $value; |
39 | - if($value === null) { |
|
39 | + if ($value === null) { |
|
40 | 40 | $new_value = 'NULL'; |
41 | - } elseif(is_string($value) && (string)($new_value = floatval($value)) != (string)$value) { |
|
41 | + } elseif (is_string($value) && (string) ($new_value = floatval($value)) != (string) $value) { |
|
42 | 42 | // non-float |
43 | 43 | $new_value = '"' . SN::$db->db_escape($value) . '"'; |
44 | - } elseif($delta) { |
|
44 | + } elseif ($delta) { |
|
45 | 45 | // float and DELTA-set |
46 | 46 | $new_value = "{$field} + ({$new_value})"; |
47 | 47 | } |
@@ -61,8 +61,8 @@ discard block |
||
61 | 61 | */ |
62 | 62 | function missile_list_convert_to_fleet(&$missile_db_list, &$fleet_db_list) { |
63 | 63 | // Missile attack |
64 | - foreach($missile_db_list as $irak) { |
|
65 | - if($irak['fleet_end_time'] >= SN_TIME_NOW) { |
|
64 | + foreach ($missile_db_list as $irak) { |
|
65 | + if ($irak['fleet_end_time'] >= SN_TIME_NOW) { |
|
66 | 66 | $irak['fleet_start_type'] = PT_PLANET; |
67 | 67 | $planet_start = DBStaticPlanet::db_planet_by_vector($irak, 'fleet_start_', false, 'name'); |
68 | 68 | $irak['fleet_id'] = -$irak['id']; |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | function sys_user_vacation($user) { |
13 | 13 | global $config; |
14 | 14 | |
15 | - if(sys_get_param_str('vacation') == 'leave') { |
|
15 | + if (sys_get_param_str('vacation') == 'leave') { |
|
16 | 16 | if ($user['vacation'] < SN_TIME_NOW) { |
17 | 17 | $user['vacation'] = 0; |
18 | 18 | $user['vacation_next'] = SN_TIME_NOW + $config->player_vacation_timeout; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | } |
21 | 21 | } |
22 | 22 | |
23 | - if($user['vacation']) { |
|
23 | + if ($user['vacation']) { |
|
24 | 24 | // sn_sys_logout(false, true); |
25 | 25 | // core_auth::logout(false, true); |
26 | 26 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | \DBAL\DbQuery::build()->setTable('users')->setValues($field_set)->doInsert(); |
164 | 164 | $user_new = db_user_by_id(SN::$db->db_insert_id()); |
165 | 165 | |
166 | - if(!($options['galaxy'] && $options['system'] && $options['planet'])) { |
|
166 | + if (!($options['galaxy'] && $options['system'] && $options['planet'])) { |
|
167 | 167 | $options['galaxy'] = SN::$config->LastSettedGalaxyPos; |
168 | 168 | $options['system'] = SN::$config->LastSettedSystemPos; |
169 | 169 | $segment_size = floor(SN::$config->game_maxPlanet / 3); |
@@ -171,19 +171,19 @@ discard block |
||
171 | 171 | $segment++; |
172 | 172 | $options['planet'] = mt_rand(1 + $segment * $segment_size, ($segment + 1) * $segment_size); |
173 | 173 | |
174 | - while(true) { |
|
175 | - if($options['planet'] > SN::$config->game_maxPlanet) { |
|
174 | + while (true) { |
|
175 | + if ($options['planet'] > SN::$config->game_maxPlanet) { |
|
176 | 176 | $options['planet'] = mt_rand(0, $segment_size - 1) + 1; |
177 | 177 | $options['system']++; |
178 | 178 | } |
179 | - if($options['system'] > SN::$config->game_maxSystem) { |
|
179 | + if ($options['system'] > SN::$config->game_maxSystem) { |
|
180 | 180 | $options['system'] = 1; |
181 | 181 | $options['galaxy']++; |
182 | 182 | } |
183 | 183 | $options['galaxy'] > SN::$config->game_maxGalaxy ? $options['galaxy'] = 1 : false; |
184 | 184 | |
185 | 185 | $galaxy_row = DBStaticPlanet::db_planet_by_gspt($options['galaxy'], $options['system'], $options['planet'], PT_PLANET, true, 'id'); |
186 | - if(!$galaxy_row['id']) { |
|
186 | + if (!$galaxy_row['id']) { |
|
187 | 187 | SN::$config->db_saveItem(array( |
188 | 188 | 'LastSettedGalaxyPos' => $options['galaxy'], |
189 | 189 | 'LastSettedSystemPos' => $options['system'], |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | $username_safe = SN::$db->db_escape($username_unsafe); |
205 | 205 | doquery("REPLACE INTO `{{player_name_history}}` SET `player_id` = {$user_new['id']}, `player_name` = '{$username_safe}'"); |
206 | 206 | |
207 | - if(!empty($options['partner_id']) && ($referral_row = db_user_by_id($options['partner_id'], true))) { |
|
207 | + if (!empty($options['partner_id']) && ($referral_row = db_user_by_id($options['partner_id'], true))) { |
|
208 | 208 | doquery("INSERT INTO `{{referrals}}` SET `id` = {$user_new['id']}, `id_partner` = {$options['partner_id']}"); |
209 | 209 | } |
210 | 210 |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | * @copyright 2008-2015 Gorlum for Project "SuperNova.WS" |
6 | 6 | */ |
7 | 7 | |
8 | -if(!defined('INSIDE')) { |
|
8 | +if (!defined('INSIDE')) { |
|
9 | 9 | die(); |
10 | 10 | } |
11 | 11 | |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | function db_change_units_perform($query, $tablename, $object_id) { |
15 | 15 | $query = implode(',', $query); |
16 | - if($query && $object_id) { |
|
16 | + if ($query && $object_id) { |
|
17 | 17 | return SN::db_upd_record_by_id($tablename == 'users' ? LOC_USER : LOC_PLANET, $object_id, $query); |
18 | 18 | } |
19 | 19 | |
@@ -31,15 +31,15 @@ discard block |
||
31 | 31 | |
32 | 32 | $group = sn_get_groups('resources_loot'); |
33 | 33 | |
34 | - foreach($unit_list as $unit_id => $unit_amount) { |
|
35 | - if(!in_array($unit_id, $group)) { |
|
34 | + foreach ($unit_list as $unit_id => $unit_amount) { |
|
35 | + if (!in_array($unit_id, $group)) { |
|
36 | 36 | // TODO - remove later |
37 | 37 | print('<h1>СООБЩИТЕ ЭТО АДМИНУ: db_change_units() вызван для не-ресурсов!</h1>'); |
38 | 38 | pdump(debug_backtrace()); |
39 | 39 | die('db_change_units() вызван для не-ресурсов!'); |
40 | 40 | } |
41 | 41 | |
42 | - if(!$unit_amount) { |
|
42 | + if (!$unit_amount) { |
|
43 | 43 | continue; |
44 | 44 | } |
45 | 45 | |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $unit_location = sys_get_unit_location($user, $planet, $unit_id); |
49 | 49 | |
50 | 50 | // Changing value in object |
51 | - switch($unit_location) { |
|
51 | + switch ($unit_location) { |
|
52 | 52 | case LOC_USER: |
53 | 53 | $user[$unit_db_name] += $unit_amount; |
54 | 54 | break; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @deprecated |
76 | 76 | */ |
77 | 77 | function doquery($query, $table = '', $fetch = false, $skip_query_check = false) { |
78 | - if(is_bool($table) || !is_string($table)) { |
|
78 | + if (is_bool($table) || !is_string($table)) { |
|
79 | 79 | $fetch = $table; |
80 | 80 | } |
81 | 81 | return SN::$db->doquery($query, $fetch, $skip_query_check); |
@@ -3,18 +3,18 @@ discard block |
||
3 | 3 | use Fleet\DbFleetStatic; |
4 | 4 | use Planet\DBStaticPlanet; |
5 | 5 | |
6 | -if(SN_IN_FLEET !== true) { |
|
6 | +if (SN_IN_FLEET !== true) { |
|
7 | 7 | $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
8 | 8 | } |
9 | 9 | |
10 | 10 | $fleetid = sys_get_param_id('fleetid'); |
11 | 11 | |
12 | -if(!is_numeric($fleetid) || empty($fleetid)) { |
|
12 | +if (!is_numeric($fleetid) || empty($fleetid)) { |
|
13 | 13 | sys_redirect("fleet.php"); |
14 | 14 | } |
15 | 15 | |
16 | 16 | $fleet = DbFleetStatic::db_fleet_get($fleetid); |
17 | -if(!$fleet) { |
|
17 | +if (!$fleet) { |
|
18 | 18 | SnTemplate::messageBox($lang['fl_fleet_not_exists'], $lang['fl_error']); |
19 | 19 | } |
20 | 20 | |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | SnTemplate::messageBox($lang['fl_isback'], $lang['fl_error']); |
23 | 23 | } |
24 | 24 | |
25 | -if($fleet['fleet_owner'] != $user['id']) { |
|
26 | - $debug->warning($lang['fl_aks_hack_wrong_fleet'],'Wrong Fleet Owner',301); |
|
25 | +if ($fleet['fleet_owner'] != $user['id']) { |
|
26 | + $debug->warning($lang['fl_aks_hack_wrong_fleet'], 'Wrong Fleet Owner', 301); |
|
27 | 27 | SnTemplate::messageBox($lang['fl_aks_hack_wrong_fleet'], $lang['fl_error']); |
28 | 28 | } |
29 | 29 | |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | 'MISSION_NAME' => $lang['type_mission'][MT_AKS], |
58 | 58 | )); |
59 | 59 | |
60 | -if($aks['eingeladen'] && is_array($members = db_user_list("`id` in ({$aks['eingeladen']})")) && !empty($members)) { |
|
61 | - foreach($members as $row) { |
|
60 | +if ($aks['eingeladen'] && is_array($members = db_user_list("`id` in ({$aks['eingeladen']})")) && !empty($members)) { |
|
61 | + foreach ($members as $row) { |
|
62 | 62 | $template->assign_block_vars('invited', array( |
63 | 63 | 'NAME' => $row['username'], |
64 | 64 | )); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $i++; |
69 | 69 | $fleet_row = DbFleetStatic::db_fleet_get($fleetid); |
70 | 70 | |
71 | -if(is_array($fleet_row) && !empty($fleet_row)) { |
|
71 | +if (is_array($fleet_row) && !empty($fleet_row)) { |
|
72 | 72 | $planet_start = DBStaticPlanet::db_planet_by_id($fleet_row['fleet_start_planet_id']); |
73 | 73 | $fleet_row['fleet_start_name'] = !empty($planet_start['name']) ? $planet_start['name'] : ''; |
74 | 74 | $planet_end = DBStaticPlanet::db_planet_by_id($fleet_row['fleet_end_planet_id']); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | $fleet_data = tpl_parse_fleet_db($fleet_row, $i, $user); |
78 | 78 | $template->assign_block_vars('fleets', $fleet_data['fleet']); |
79 | -foreach($fleet_data['ships'] as $ship_data) { |
|
79 | +foreach ($fleet_data['ships'] as $ship_data) { |
|
80 | 80 | $template->assign_block_vars('fleets.ships', $ship_data); |
81 | 81 | } |
82 | 82 | } |
@@ -4,18 +4,18 @@ discard block |
||
4 | 4 | use Fleet\FleetStatic; |
5 | 5 | use Planet\DBStaticPlanet; |
6 | 6 | |
7 | -if(SN_IN_FLEET !== true) { |
|
7 | +if (SN_IN_FLEET !== true) { |
|
8 | 8 | $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
9 | 9 | } |
10 | 10 | |
11 | 11 | $template = SnTemplate::gettemplate('fleet1', true); |
12 | 12 | |
13 | 13 | $ships = sys_get_param('ships', array()); |
14 | -if(!is_array($ships)) { |
|
14 | +if (!is_array($ships)) { |
|
15 | 15 | $ships = array(); |
16 | 16 | } |
17 | 17 | |
18 | -foreach(array(PT_PLANET, PT_DEBRIS, PT_MOON) as $possible_planet_type_id) { |
|
18 | +foreach (array(PT_PLANET, PT_DEBRIS, PT_MOON) as $possible_planet_type_id) { |
|
19 | 19 | $template->assign_block_vars('possible_planet_type_id', array( |
20 | 20 | 'ID' => $possible_planet_type_id, |
21 | 21 | 'NAME' => $lang['sys_planet_type_sh'][$possible_planet_type_id], |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | 'START_NAME' => $planetrow['name'], |
29 | 29 | ); |
30 | 30 | |
31 | -if(!empty($TargetPlanet)) { |
|
31 | +if (!empty($TargetPlanet)) { |
|
32 | 32 | $template_route += array( |
33 | 33 | 'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$TargetPlanet['planet_type']], |
34 | 34 | 'END_COORDS' => uni_render_coordinates($TargetPlanet), |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | $template->assign_block_vars('fleets', $template_route); |
40 | 40 | |
41 | 41 | $sn_groups_fleet = sn_get_groups('fleet'); |
42 | -foreach($ships as $ship_id => $ship_count) { |
|
43 | - if(in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
42 | +foreach ($ships as $ship_id => $ship_count) { |
|
43 | + if (in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
44 | 44 | $ship_info = get_unit_param($ship_id); |
45 | - if($ship_count > mrc_get_level($user, $planetrow, $ship_id, false, true)) { |
|
45 | + if ($ship_count > mrc_get_level($user, $planetrow, $ship_id, false, true)) { |
|
46 | 46 | $page .= $lang['fl_noenought']; |
47 | 47 | } else { |
48 | 48 | $fleet['fleetarray'][$ship_id] = $ship_count; |
@@ -61,13 +61,13 @@ discard block |
||
61 | 61 | } |
62 | 62 | } |
63 | 63 | |
64 | -if(empty($fleet['fleetarray'])) { |
|
64 | +if (empty($fleet['fleetarray'])) { |
|
65 | 65 | SnTemplate::messageBox($lang['fl_err_no_ships'], $lang['fl_error'], 'fleet' . DOT_PHP_EX, 5); |
66 | 66 | } |
67 | 67 | |
68 | 68 | // Building list of shortcuts |
69 | 69 | $query = doquery("SELECT * FROM {{notes}} WHERE `owner` = {$user['id']} AND `galaxy` <> 0 AND `system` <> 0 AND `planet` <> 0 ORDER BY `priority` DESC, `galaxy`, `system`, `planet`, `planet_type`;"); |
70 | -while($shortcut = db_fetch($query)) { |
|
70 | +while ($shortcut = db_fetch($query)) { |
|
71 | 71 | $template->assign_block_vars('shortcut', array( |
72 | 72 | 'NAME' => $shortcut['title'], |
73 | 73 | 'GALAXY' => $shortcut['galaxy'], |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | // Building list of own planets & moons |
84 | -$colonies = DBStaticPlanet::db_planet_list_sorted ( $user ); |
|
85 | -if(count($colonies) > 1) { |
|
84 | +$colonies = DBStaticPlanet::db_planet_list_sorted($user); |
|
85 | +if (count($colonies) > 1) { |
|
86 | 86 | // while($row = db_fetch($colonies)) |
87 | - foreach($colonies as $row) { |
|
87 | + foreach ($colonies as $row) { |
|
88 | 88 | $template->assign_block_vars('colonies', array( |
89 | 89 | 'NAME' => $row['name'], |
90 | 90 | 'GALAXY' => $row['galaxy'], |
@@ -99,9 +99,9 @@ discard block |
||
99 | 99 | //ACS Start |
100 | 100 | //Need to look for acs attacks. |
101 | 101 | $aks_madnessred = DbFleetStatic::dbAcsGetAll(); |
102 | -while($row = db_fetch($aks_madnessred)) { |
|
102 | +while ($row = db_fetch($aks_madnessred)) { |
|
103 | 103 | $members = explode(',', $row['eingeladen']); |
104 | - foreach($members as $a => $b) { |
|
104 | + foreach ($members as $a => $b) { |
|
105 | 105 | if ($b == $user['id']) { |
106 | 106 | $template->assign_block_vars('acss', array( |
107 | 107 | 'ID' => $row['id'], |
@@ -6,12 +6,12 @@ discard block |
||
6 | 6 | $uni_galaxy = sys_get_param_int('galaxy', $planetrow['galaxy']); |
7 | 7 | $uni_system = sys_get_param_int('system'); |
8 | 8 | |
9 | - if($uni_galaxy < 1 || $uni_galaxy > $config->game_maxGalaxy) |
|
9 | + if ($uni_galaxy < 1 || $uni_galaxy > $config->game_maxGalaxy) |
|
10 | 10 | { |
11 | 11 | throw new exception($lang['uni_msg_error_wrong_galaxy'], ERR_ERROR); |
12 | 12 | } |
13 | 13 | |
14 | - if($uni_system < 0 || $uni_system > $config->game_maxSystem) |
|
14 | + if ($uni_system < 0 || $uni_system > $config->game_maxSystem) |
|
15 | 15 | { |
16 | 16 | throw new exception($lang['uni_msg_error_wrong_system'], ERR_ERROR); |
17 | 17 | } |
@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | $uni_row['universe_price'] += $uni_system ? $config->uni_price_system : $config->uni_price_galaxy; |
21 | 21 | $uni_row['universe_name'] = strip_tags($uni_row['universe_name'] ? $uni_row['universe_name'] : ($uni_system ? "{$lang['sys_system']} [{$uni_galaxy}:{$uni_system}]" : "{$lang['sys_galaxy']} {$uni_galaxy}")); |
22 | 22 | |
23 | - if(sys_get_param_str('uni_name_submit')) |
|
23 | + if (sys_get_param_str('uni_name_submit')) |
|
24 | 24 | { |
25 | 25 | $uni_row['universe_name'] = strip_tags(sys_get_param_str('uni_name')); |
26 | 26 | |
27 | 27 | $uni_price = sys_get_param_float('uni_price'); |
28 | - if($uni_price < $uni_row['universe_price']) |
|
28 | + if ($uni_price < $uni_row['universe_price']) |
|
29 | 29 | { |
30 | 30 | throw new exception($lang['uni_msg_error_low_price'], ERR_ERROR); |
31 | 31 | } |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | SN::db_transaction_start(); |
35 | 35 | $user = db_user_by_id($user['id'], true); |
36 | 36 | // if($user[get_unit_param(RES_DARK_MATTER, P_NAME)] < $uni_price) |
37 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < $uni_price) |
|
37 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < $uni_price) |
|
38 | 38 | { |
39 | 39 | throw new exception($lang['uni_msg_error_no_dm'], ERR_ERROR); |
40 | 40 | } |
41 | 41 | |
42 | - if(!rpg_points_change($user['id'], RPG_RENAME, -$uni_price, "Renaming [{$uni_galaxy}:{$uni_system}] to " . sys_get_param_str_unsafe('uni_name'))) |
|
42 | + if (!rpg_points_change($user['id'], RPG_RENAME, -$uni_price, "Renaming [{$uni_galaxy}:{$uni_system}] to " . sys_get_param_str_unsafe('uni_name'))) |
|
43 | 43 | { |
44 | 44 | throw new exception($lang['sys_msg_err_update_dm'], ERR_ERROR); |
45 | 45 | } |
@@ -49,8 +49,7 @@ |
||
49 | 49 | SN::db_transaction_commit(); |
50 | 50 | sys_redirect("galaxy.php?mode=name&galaxy={$uni_galaxy}&system={$uni_system}"); |
51 | 51 | } |
52 | - } |
|
53 | - catch (exception $e) |
|
52 | + } catch (exception $e) |
|
54 | 53 | { |
55 | 54 | SN::db_transaction_rollback(); |
56 | 55 | $template->assign_block_vars('result', array( |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) |
|
3 | +if (!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) |
|
4 | 4 | { |
5 | 5 | $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403); |
6 | 6 | } |
@@ -15,50 +15,50 @@ discard block |
||
15 | 15 | )); |
16 | 16 | |
17 | 17 | $info_action = sys_get_param_int('action'); |
18 | -if($info_action) |
|
18 | +if ($info_action) |
|
19 | 19 | { |
20 | 20 | try |
21 | 21 | { |
22 | 22 | SN::db_transaction_start(); |
23 | 23 | |
24 | 24 | $user = db_user_by_id($user['id'], true); |
25 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < $config->rpg_cost_info) |
|
25 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < $config->rpg_cost_info) |
|
26 | 26 | { |
27 | 27 | throw new Exception(MARKET_NO_DM, ERR_ERROR); |
28 | 28 | } |
29 | 29 | |
30 | - switch($info_action) |
|
30 | + switch ($info_action) |
|
31 | 31 | { |
32 | 32 | case MARKET_INFO_PLAYER: |
33 | 33 | $user_info_name_unsafe = sys_get_param_str_unsafe('user_info_name'); |
34 | - if(!$user_info_name_unsafe) |
|
34 | + if (!$user_info_name_unsafe) |
|
35 | 35 | { |
36 | 36 | throw new Exception(MARKET_INFO_PLAYER_WRONG, ERR_ERROR); |
37 | 37 | } |
38 | 38 | |
39 | - if(is_id($user_info_name_unsafe)) |
|
39 | + if (is_id($user_info_name_unsafe)) |
|
40 | 40 | { |
41 | 41 | $user_info = db_user_by_id($user_info_name_unsafe, true, '`id`, `username`', true); |
42 | 42 | } |
43 | - if(!is_array($user_info)) |
|
43 | + if (!is_array($user_info)) |
|
44 | 44 | { |
45 | 45 | $user_info = db_user_by_username($user_info_name_unsafe, true); |
46 | 46 | } |
47 | - if(!is_array($user_info)) |
|
47 | + if (!is_array($user_info)) |
|
48 | 48 | { |
49 | 49 | throw new Exception(MARKET_INFO_PLAYER_NOT_FOUND, ERR_ERROR); |
50 | 50 | } |
51 | - if($user_info['id'] == $user['id']) |
|
51 | + if ($user_info['id'] == $user['id']) |
|
52 | 52 | { |
53 | 53 | throw new Exception(MARKET_INFO_PLAYER_SAME, ERR_ERROR); |
54 | 54 | } |
55 | 55 | |
56 | 56 | $msg_text = array(); |
57 | - foreach(sn_get_groups('mercenaries') as $mercenary_id) |
|
57 | + foreach (sn_get_groups('mercenaries') as $mercenary_id) |
|
58 | 58 | { |
59 | 59 | $msg_text[] = "{$lang['tech'][$mercenary_id]} - " . (($mercenary_level = mrc_get_level($user_info, false, $mercenary_id)) ? "{$lang['sys_level']} {$mercenary_level}" : $lang['eco_mrk_info_not_hired']); |
60 | 60 | } |
61 | - if($mercenary_level = mrc_get_level($user_info, false, UNIT_PREMIUM)) |
|
61 | + if ($mercenary_level = mrc_get_level($user_info, false, UNIT_PREMIUM)) |
|
62 | 62 | { |
63 | 63 | $msg_text[] = "{$lang['tech'][UNIT_PREMIUM]} - {$mercenary_level} {$lang['sys_level']}"; |
64 | 64 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | break; |
73 | 73 | } |
74 | 74 | |
75 | - if(!rpg_points_change($user['id'], RPG_MARKET_INFO_MERCENARY, -$config->rpg_cost_info, "Using Black Market page {$lang['eco_mrk_info']} - getting info about user ID {$user_info['id']}")) |
|
75 | + if (!rpg_points_change($user['id'], RPG_MARKET_INFO_MERCENARY, -$config->rpg_cost_info, "Using Black Market page {$lang['eco_mrk_info']} - getting info about user ID {$user_info['id']}")) |
|
76 | 76 | { |
77 | 77 | // TODO: throw new Exception(MARKET_INFO_PLAYER_SAME, ERR_ERROR); |
78 | 78 | } |
@@ -79,8 +79,7 @@ |
||
79 | 79 | |
80 | 80 | SN::db_transaction_commit(); |
81 | 81 | throw new Exception($info_action, ERR_NONE); |
82 | - } |
|
83 | - catch (Exception $e) |
|
82 | + } catch (Exception $e) |
|
84 | 83 | { |
85 | 84 | SN::db_transaction_rollback(); |
86 | 85 |