@@ -26,7 +26,7 @@ |
||
26 | 26 | 'GROUP BY `unit_snid`' |
27 | 27 | ); |
28 | 28 | $result = array(); |
29 | - while($row = db_fetch($query)) { |
|
29 | + while ($row = db_fetch($query)) { |
|
30 | 30 | $result[$row['unit_snid']] = $row; |
31 | 31 | } |
32 | 32 |
@@ -75,6 +75,9 @@ |
||
75 | 75 | return classSupernova::db_ins_record(LOC_UNIT, $set); |
76 | 76 | } |
77 | 77 | |
78 | +/** |
|
79 | + * @param integer $unit_location_type |
|
80 | + */ |
|
78 | 81 | function db_unit_list_delete($user_id = 0, $unit_location_type, $unit_location_id, $unit_snid = 0) |
79 | 82 | { |
80 | 83 | return classSupernova::db_del_record_list(LOC_UNIT, |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Created by PhpStorm. |
|
4 | - * User: Gorlum |
|
5 | - * Date: 13.04.2015 |
|
6 | - * Time: 6:27 |
|
7 | - */ |
|
3 | + * Created by PhpStorm. |
|
4 | + * User: Gorlum |
|
5 | + * Date: 13.04.2015 |
|
6 | + * Time: 6:27 |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | function db_account_by_user_id($user_id_safe, &$result = null) { |
10 | 10 | die('db_account_by_user_id() должна быть реализована в класса core_auth!'); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
3 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
4 | 4 | { |
5 | 5 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
6 | 6 | } |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $new_rank_name = sys_get_param_str('newRankName'); |
15 | 15 | if ($new_rank_name) |
16 | 16 | { |
17 | - foreach($ally_rights as $fieldName) |
|
17 | + foreach ($ally_rights as $fieldName) |
|
18 | 18 | { |
19 | 19 | $newRank[$fieldName] = 0; |
20 | 20 | } |
@@ -28,9 +28,9 @@ discard block |
||
28 | 28 | { |
29 | 29 | unset($ranks); |
30 | 30 | |
31 | - foreach($rankListInput as $rankID => $rank) |
|
31 | + foreach ($rankListInput as $rankID => $rank) |
|
32 | 32 | { |
33 | - foreach($ally_rights as $rightName) |
|
33 | + foreach ($ally_rights as $rightName) |
|
34 | 34 | { |
35 | 35 | $ranks[$rankID][$rightName] = $rank[$rightName] ? 1 : 0; |
36 | 36 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $d = sys_get_param_int('d'); |
42 | 42 | if ($d && isset($ranks[$d])) |
43 | 43 | { |
44 | - if(count($ranks) == 1) |
|
44 | + if (count($ranks) == 1) |
|
45 | 45 | { |
46 | 46 | message($lang['ali_adm_lastRank'], $lang['ali_adm_rights_title']); |
47 | 47 | } |
@@ -53,16 +53,16 @@ discard block |
||
53 | 53 | |
54 | 54 | if (count($ranks)) |
55 | 55 | { |
56 | - foreach($ranks as $rankID => $rank) |
|
56 | + foreach ($ranks as $rankID => $rank) |
|
57 | 57 | { |
58 | 58 | $rank_data = array( |
59 | 59 | 'ID' => $rankID, |
60 | 60 | 'NAME' => $rank['name'], |
61 | 61 | ); |
62 | 62 | |
63 | - for($i = 1; $i < count($rank); $i++) |
|
63 | + for ($i = 1; $i < count($rank); $i++) |
|
64 | 64 | { |
65 | - $rank_data['R' . $i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : '') ; |
|
65 | + $rank_data['R' . $i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : ''); |
|
66 | 66 | $rank_data['N' . $i] = $ally_rights[$i]; |
67 | 67 | } |
68 | 68 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
3 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
4 | 4 | { |
5 | 5 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
6 | 6 | } |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | header('Location: alliance.php'); |
21 | 21 | } |
22 | 22 | |
23 | - if($user_request['request_denied']) |
|
23 | + if ($user_request['request_denied']) |
|
24 | 24 | { |
25 | 25 | $lang['request_text'] = sprintf($lang['ali_req_deny_msg'], $ally['ally_tag'], $user_request['request_text']); |
26 | 26 | } |
@@ -42,12 +42,12 @@ discard block |
||
42 | 42 | |
43 | 43 | $ally = doquery("SELECT * FROM {{alliance}} WHERE `id` ='{$id_ally}'", true); |
44 | 44 | |
45 | -if(!$ally) |
|
45 | +if (!$ally) |
|
46 | 46 | { |
47 | 47 | message($lang['ali_sys_notFound'], $lang['ali_req_title']); |
48 | 48 | } |
49 | 49 | |
50 | -if($ally['ally_request_notallow']) |
|
50 | +if ($ally['ally_request_notallow']) |
|
51 | 51 | { |
52 | 52 | message($lang['ali_req_not_allowed'], $lang['ali_req_title']); |
53 | 53 | } |
@@ -115,8 +115,7 @@ |
||
115 | 115 | )); |
116 | 116 | |
117 | 117 | display($template, $lang['tech'][STRUC_MOON_GATE]); |
118 | - } |
|
119 | - else |
|
118 | + } else |
|
120 | 119 | { |
121 | 120 | message($lang['gate_no_src_ga'], $lang['tech'][STRUC_MOON_GATE], "overview.php", 10); |
122 | 121 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
3 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
4 | 4 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
5 | 5 | } |
6 | 6 | |
@@ -9,12 +9,12 @@ discard block |
||
9 | 9 | } |
10 | 10 | |
11 | 11 | $d = sys_get_param_id('d'); |
12 | -if($d) { |
|
12 | +if ($d) { |
|
13 | 13 | doquery("UPDATE {{alliance_requests}} SET `request_denied` = 1, `request_text` = '{$lang['ali_req_deny_reason']}' WHERE `id_user`= {$d} LIMIT 1;"); |
14 | 14 | } |
15 | 15 | |
16 | 16 | $id_user = sys_get_param_id('id_user'); |
17 | -if($id_user) { |
|
17 | +if ($id_user) { |
|
18 | 18 | $ally_name_safe = db_escape($ally['ally_name']); |
19 | 19 | $ally_tag_safe = db_escape($ally['ally_tag']); |
20 | 20 | db_user_set_by_id($id_user, "`ally_id` = '{$ally['id']}', `ally_name` = '{$ally_name_safe}', `ally_tag` = '{$ally_tag_safe}', `ally_register_time` = " . SN_TIME_NOW . ", `ally_rank_id` = 0"); |
@@ -46,8 +46,7 @@ |
||
46 | 46 | sn_db_transaction_commit(); |
47 | 47 | sys_redirect("galaxy.php?mode=name&galaxy={$uni_galaxy}&system={$uni_system}"); |
48 | 48 | } |
49 | - } |
|
50 | - catch (exception $e) |
|
49 | + } catch (exception $e) |
|
51 | 50 | { |
52 | 51 | sn_db_transaction_rollback(); |
53 | 52 | $template->assign_block_vars('result', array( |
@@ -9,12 +9,12 @@ discard block |
||
9 | 9 | $uni_galaxy = sys_get_param_int('galaxy', $planetrow['galaxy']); |
10 | 10 | $uni_system = sys_get_param_int('system'); |
11 | 11 | |
12 | - if($uni_galaxy < 1 || $uni_galaxy > classSupernova::$config->game_maxGalaxy) |
|
12 | + if ($uni_galaxy < 1 || $uni_galaxy > classSupernova::$config->game_maxGalaxy) |
|
13 | 13 | { |
14 | 14 | throw new exception(classLocale::$lang['uni_msg_error_wrong_galaxy'], ERR_ERROR); |
15 | 15 | } |
16 | 16 | |
17 | - if($uni_system < 0 || $uni_system > classSupernova::$config->game_maxSystem) |
|
17 | + if ($uni_system < 0 || $uni_system > classSupernova::$config->game_maxSystem) |
|
18 | 18 | { |
19 | 19 | throw new exception(classLocale::$lang['uni_msg_error_wrong_system'], ERR_ERROR); |
20 | 20 | } |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | $uni_row['universe_price'] += $uni_system ? classSupernova::$config->uni_price_system : classSupernova::$config->uni_price_galaxy; |
24 | 24 | $uni_row['universe_name'] = strip_tags($uni_row['universe_name'] ? $uni_row['universe_name'] : ($uni_system ? "{$classLocale['sys_system']} [{$uni_galaxy}:{$uni_system}]" : "{$classLocale['sys_galaxy']} {$uni_galaxy}")); |
25 | 25 | |
26 | - if(sys_get_param_str('uni_name_submit')) |
|
26 | + if (sys_get_param_str('uni_name_submit')) |
|
27 | 27 | { |
28 | 28 | $uni_row['universe_name'] = strip_tags(sys_get_param_str('uni_name')); |
29 | 29 | |
30 | 30 | $uni_price = sys_get_param_float('uni_price'); |
31 | - if($uni_price < $uni_row['universe_price']) |
|
31 | + if ($uni_price < $uni_row['universe_price']) |
|
32 | 32 | { |
33 | 33 | throw new exception(classLocale::$lang['uni_msg_error_low_price'], ERR_ERROR); |
34 | 34 | } |
@@ -37,12 +37,12 @@ discard block |
||
37 | 37 | sn_db_transaction_start(); |
38 | 38 | $user = db_user_by_id($user['id'], true); |
39 | 39 | // if($user[get_unit_param(RES_DARK_MATTER, P_NAME)] < $uni_price) |
40 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < $uni_price) |
|
40 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < $uni_price) |
|
41 | 41 | { |
42 | 42 | throw new exception(classLocale::$lang['uni_msg_error_no_dm'], ERR_ERROR); |
43 | 43 | } |
44 | 44 | |
45 | - if(!rpg_points_change($user['id'], RPG_RENAME, -$uni_price, "Renaming [{$uni_galaxy}:{$uni_system}] to " . sys_get_param_str_unsafe('uni_name'))) |
|
45 | + if (!rpg_points_change($user['id'], RPG_RENAME, -$uni_price, "Renaming [{$uni_galaxy}:{$uni_system}] to " . sys_get_param_str_unsafe('uni_name'))) |
|
46 | 46 | { |
47 | 47 | throw new exception(classLocale::$lang['sys_msg_err_update_dm'], ERR_ERROR); |
48 | 48 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | * |
13 | 13 | **/ |
14 | 14 | |
15 | -if(SN_IN_FLEET !== true) { |
|
15 | +if (SN_IN_FLEET !== true) { |
|
16 | 16 | $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
17 | 17 | } |
18 | 18 | |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | |
26 | 26 | $planet_list = array(); |
27 | 27 | |
28 | - if(is_array($resources_taken)) |
|
28 | + if (is_array($resources_taken)) |
|
29 | 29 | { |
30 | 30 | $query = implode(',', array_keys($resources_taken)); |
31 | 31 | $query = " AND `destruyed` = 0 AND `id` IN ({$query})"; |
@@ -33,16 +33,16 @@ discard block |
||
33 | 33 | $query = ''; |
34 | 34 | } |
35 | 35 | |
36 | - foreach(sn_get_groups('flt_transports') as $transport_id) { |
|
36 | + foreach (sn_get_groups('flt_transports') as $transport_id) { |
|
37 | 37 | $transports[$transport_id] = get_unit_param($transport_id, P_CAPACITY); |
38 | 38 | } |
39 | 39 | arsort($transports); |
40 | 40 | |
41 | 41 | $planets_db_list = db_planet_list_sorted($user, $planetrow['id'], '*', $query); |
42 | 42 | !is_array($planets_db_list) ? $planets_db_list = array() : false; |
43 | - foreach($planets_db_list as $planet_db_data) { |
|
43 | + foreach ($planets_db_list as $planet_db_data) { |
|
44 | 44 | // begin planet loop |
45 | - if(!$query) { |
|
45 | + if (!$query) { |
|
46 | 46 | $resources_taken[$planet_db_data['id']] = 1; |
47 | 47 | } |
48 | 48 | sn_db_transaction_start(); |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | $planet_id = $planet_db_data['id']; |
55 | 55 | |
56 | 56 | $planet_resources = 0; |
57 | - foreach(sn_get_groups('resources_loot') as $resource_id) { |
|
58 | - if($resources_taken[$planet_id] == 1 || $resources_taken[$planet_id][$resource_id]) { |
|
57 | + foreach (sn_get_groups('resources_loot') as $resource_id) { |
|
58 | + if ($resources_taken[$planet_id] == 1 || $resources_taken[$planet_id][$resource_id]) { |
|
59 | 59 | $planet_resources += floor(mrc_get_level($user, $planet_db_data, $resource_id, true, true)); // $planet_db_data[get_unit_param($resource_id, P_NAME)]); |
60 | 60 | } |
61 | 61 | } |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | $fleet_capacity = 0; |
87 | 87 | $ship_loadout = array(); |
88 | 88 | $fleet = array(); |
89 | - foreach($transports as $ship_id => $ship_capacity) { |
|
90 | - if($ship_count = mrc_get_level($user, $planet_db_data, $ship_id, true, true)) { |
|
89 | + foreach ($transports as $ship_id => $ship_capacity) { |
|
90 | + if ($ship_count = mrc_get_level($user, $planet_db_data, $ship_id, true, true)) { |
|
91 | 91 | $ship_loadout[$ship_id]['capacity'] = $ship_count * $ship_capacity; |
92 | 92 | $ship_loadout[$ship_id]['taken'] = 0; |
93 | 93 | $fleet_capacity += $ship_loadout[$ship_id]['capacity']; |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | |
99 | 99 | $will_take = min($planet_resources, $fleet_capacity); |
100 | 100 | |
101 | - foreach($ship_loadout as $ship_id => &$planet_ship) { |
|
101 | + foreach ($ship_loadout as $ship_id => &$planet_ship) { |
|
102 | 102 | $can_take = min($will_take, $planet_ship['capacity']); |
103 | - if($can_take <= 0) { |
|
103 | + if ($can_take <= 0) { |
|
104 | 104 | continue; |
105 | 105 | } |
106 | 106 | $planet_ship['capacity'] -= $can_take; |
@@ -108,23 +108,23 @@ discard block |
||
108 | 108 | $fleet[$ship_id] = ceil($planet_ship['taken'] / $transports[$ship_id]); |
109 | 109 | |
110 | 110 | $will_take -= $can_take; |
111 | - if($will_take <= 0) { |
|
111 | + if ($will_take <= 0) { |
|
112 | 112 | break; |
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
116 | - if(!empty($fleet)) { |
|
116 | + if (!empty($fleet)) { |
|
117 | 117 | $travel_data = flt_travel_data($user, $planetrow, $planet_db_data, $fleet, 10); |
118 | 118 | $planet_data['FLEET_SPEED'] = $travel_data['fleet_speed']; |
119 | 119 | $planet_data['DISTANCE'] = $travel_data['distance']; |
120 | 120 | $planet_data['DURATION'] = $travel_data['duration']; |
121 | 121 | $planet_data['CONSUMPTION'] = $travel_data['consumption']; |
122 | 122 | |
123 | - if(floor(mrc_get_level($user, $planet_db_data, RES_DEUTERIUM, true)) >= $planet_data['CONSUMPTION']) { |
|
123 | + if (floor(mrc_get_level($user, $planet_db_data, RES_DEUTERIUM, true)) >= $planet_data['CONSUMPTION']) { |
|
124 | 124 | $will_take = min($planet_resources, $fleet_capacity) - $planet_data['CONSUMPTION']; |
125 | 125 | |
126 | - foreach(sn_get_groups('resources_loot') as $resource_id) { |
|
127 | - if($resources_taken[$planet_id] != 1 && !$resources_taken[$planet_id][$resource_id]) { |
|
126 | + foreach (sn_get_groups('resources_loot') as $resource_id) { |
|
127 | + if ($resources_taken[$planet_id] != 1 && !$resources_taken[$planet_id][$resource_id]) { |
|
128 | 128 | continue; |
129 | 129 | } |
130 | 130 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $fleet[$resource_id] = min($will_take, $resource_amount); |
134 | 134 | $will_take -= $resource_amount; |
135 | 135 | |
136 | - if($will_take <= 0) { |
|
136 | + if ($will_take <= 0) { |
|
137 | 137 | break; |
138 | 138 | } |
139 | 139 | } |
@@ -157,19 +157,19 @@ discard block |
||
157 | 157 | |
158 | 158 | $resources_taken = sys_get_param('resources'); |
159 | 159 | |
160 | -if(!empty($resources_taken)) { // begin processing parameters |
|
160 | +if (!empty($resources_taken)) { // begin processing parameters |
|
161 | 161 | $planet_list = flt_build_gathering($resources_taken); |
162 | 162 | |
163 | - foreach($planet_list as $planet_id => $planet_data) { |
|
164 | - if($planet_data['RESULT'] == ATTACK_ALLOWED) { |
|
163 | + foreach ($planet_list as $planet_id => $planet_data) { |
|
164 | + if ($planet_data['RESULT'] == ATTACK_ALLOWED) { |
|
165 | 165 | $planet_data['RESULT'] = flt_t_send_fleet($user, $planet_data['PLANET_DB_DATA'], $planetrow, $planet_data['FLEET'], MT_TRANSPORT); |
166 | 166 | } |
167 | 167 | |
168 | 168 | $planet_data['MESSAGE'] = $lang['fl_attack_error'][$planet_data['RESULT']]; |
169 | 169 | |
170 | 170 | $template->assign_block_vars('results', $planet_data); |
171 | - if(!empty($planet_data['FLEET']) && $planet_data['RESULT'] == ATTACK_ALLOWED) { |
|
172 | - foreach($planet_data['FLEET'] as $unit_id => $amount) { |
|
171 | + if (!empty($planet_data['FLEET']) && $planet_data['RESULT'] == ATTACK_ALLOWED) { |
|
172 | + foreach ($planet_data['FLEET'] as $unit_id => $amount) { |
|
173 | 173 | $template->assign_block_vars('results.units', array( |
174 | 174 | 'ID' => $unit_id, |
175 | 175 | 'NAME' => $lang['tech'][$unit_id], |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | // Building list of own planets & moons |
184 | 184 | $planet_list = flt_build_gathering(); |
185 | -foreach($planet_list as $planet_data) { |
|
185 | +foreach ($planet_list as $planet_data) { |
|
186 | 186 | $planet_data['DURATION'] = $planet_data['DURATION'] ? pretty_time($planet_data['DURATION']) : $lang['flt_no_fuel']; |
187 | 187 | $template->assign_block_vars('colonies', $planet_data); |
188 | 188 | } |
@@ -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 |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | $classLocale = classLocale::$lang; |
4 | 4 | |
5 | -if(!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) |
|
5 | +if (!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) |
|
6 | 6 | { |
7 | 7 | $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403); |
8 | 8 | } |
@@ -17,50 +17,50 @@ discard block |
||
17 | 17 | )); |
18 | 18 | |
19 | 19 | $info_action = sys_get_param_int('action'); |
20 | -if($info_action) |
|
20 | +if ($info_action) |
|
21 | 21 | { |
22 | 22 | try |
23 | 23 | { |
24 | 24 | sn_db_transaction_start(); |
25 | 25 | |
26 | 26 | $user = db_user_by_id($user['id'], true); |
27 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < classSupernova::$config->rpg_cost_info) |
|
27 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < classSupernova::$config->rpg_cost_info) |
|
28 | 28 | { |
29 | 29 | throw new Exception(MARKET_NO_DM, ERR_ERROR); |
30 | 30 | } |
31 | 31 | |
32 | - switch($info_action) |
|
32 | + switch ($info_action) |
|
33 | 33 | { |
34 | 34 | case MARKET_INFO_PLAYER: |
35 | 35 | $user_info_name_unsafe = sys_get_param_str_unsafe('user_info_name'); |
36 | - if(!$user_info_name_unsafe) |
|
36 | + if (!$user_info_name_unsafe) |
|
37 | 37 | { |
38 | 38 | throw new Exception(MARKET_INFO_PLAYER_WRONG, ERR_ERROR); |
39 | 39 | } |
40 | 40 | |
41 | - if(is_id($user_info_name_unsafe)) |
|
41 | + if (is_id($user_info_name_unsafe)) |
|
42 | 42 | { |
43 | 43 | $user_info = db_user_by_id($user_info_name_unsafe, true, '`id`, `username`', true); |
44 | 44 | } |
45 | - if(!is_array($user_info)) |
|
45 | + if (!is_array($user_info)) |
|
46 | 46 | { |
47 | 47 | $user_info = db_user_by_username($user_info_name_unsafe, true, '`id`, `username`', true, true); |
48 | 48 | } |
49 | - if(!is_array($user_info)) |
|
49 | + if (!is_array($user_info)) |
|
50 | 50 | { |
51 | 51 | throw new Exception(MARKET_INFO_PLAYER_NOT_FOUND, ERR_ERROR); |
52 | 52 | } |
53 | - if($user_info['id'] == $user['id']) |
|
53 | + if ($user_info['id'] == $user['id']) |
|
54 | 54 | { |
55 | 55 | throw new Exception(MARKET_INFO_PLAYER_SAME, ERR_ERROR); |
56 | 56 | } |
57 | 57 | |
58 | 58 | $msg_text = array(); |
59 | - foreach(sn_get_groups('mercenaries') as $mercenary_id) |
|
59 | + foreach (sn_get_groups('mercenaries') as $mercenary_id) |
|
60 | 60 | { |
61 | 61 | $msg_text[] = "{$classLocale['tech'][$mercenary_id]} - " . (($mercenary_level = mrc_get_level($user_info, null, $mercenary_id)) ? "{$classLocale['sys_level']} {$mercenary_level}" : classLocale::$lang['eco_mrk_info_not_hired']); |
62 | 62 | } |
63 | - if($mercenary_level = mrc_get_level($user_info, null, UNIT_PREMIUM)) |
|
63 | + if ($mercenary_level = mrc_get_level($user_info, null, UNIT_PREMIUM)) |
|
64 | 64 | { |
65 | 65 | $msg_text[] = "{$classLocale['tech'][UNIT_PREMIUM]} - {$mercenary_level} {$classLocale['sys_level']}"; |
66 | 66 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | break; |
75 | 75 | } |
76 | 76 | |
77 | - if(!rpg_points_change($user['id'], RPG_MARKET_INFO_MERCENARY, -classSupernova::$config->rpg_cost_info, "Using Black Market page {$classLocale['eco_mrk_info']} - getting info about user ID {$user_info['id']}")) |
|
77 | + if (!rpg_points_change($user['id'], RPG_MARKET_INFO_MERCENARY, -classSupernova::$config->rpg_cost_info, "Using Black Market page {$classLocale['eco_mrk_info']} - getting info about user ID {$user_info['id']}")) |
|
78 | 78 | { |
79 | 79 | // TODO: throw new Exception(MARKET_INFO_PLAYER_SAME, ERR_ERROR); |
80 | 80 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if((!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) && (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)) { |
|
3 | +if ((!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) && (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)) { |
|
4 | 4 | $debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403); |
5 | 5 | } |
6 | 6 | |
@@ -27,12 +27,12 @@ discard block |
||
27 | 27 | |
28 | 28 | // $dm_db_name = pname_resource_name(RES_DARK_MATTER); |
29 | 29 | $exchangeTo = in_array($exchangeTo = sys_get_param_int('exchangeTo'), sn_get_groups('resources_trader')) ? $exchangeTo : 0; |
30 | - if($exchangeTo && is_array($tradeList = $_POST['spend'])) { |
|
30 | + if ($exchangeTo && is_array($tradeList = $_POST['spend'])) { |
|
31 | 31 | $value = 0; |
32 | 32 | $qry = array(); |
33 | 33 | |
34 | 34 | sn_db_transaction_start(); |
35 | - if($planetrow['id_owner']) { |
|
35 | + if ($planetrow['id_owner']) { |
|
36 | 36 | $global_data = sys_o_get_updated($user, $planetrow, SN_TIME_NOW); |
37 | 37 | $planetrow = $global_data['planet']; |
38 | 38 | } |
@@ -41,27 +41,27 @@ discard block |
||
41 | 41 | $user = db_user_by_id($user['id'], true); |
42 | 42 | } |
43 | 43 | |
44 | - foreach(sn_get_groups('resources_trader') as $resource_id) { |
|
44 | + foreach (sn_get_groups('resources_trader') as $resource_id) { |
|
45 | 45 | $amount = floatval($tradeList[$resource_id]); |
46 | - if($amount < 0) { |
|
46 | + if ($amount < 0) { |
|
47 | 47 | $debug->error('Trying to supply negative resource amount on Black Market Page', 'Hack Attempt', 305); |
48 | 48 | } |
49 | 49 | |
50 | - if($resource_id == RES_DARK_MATTER && $exchangeTo == RES_DARK_MATTER) { |
|
50 | + if ($resource_id == RES_DARK_MATTER && $exchangeTo == RES_DARK_MATTER) { |
|
51 | 51 | continue; |
52 | 52 | } |
53 | 53 | |
54 | 54 | $resource_db_name = pname_resource_name($resource_id); |
55 | - if($exchangeTo == RES_DARK_MATTER) { |
|
55 | + if ($exchangeTo == RES_DARK_MATTER) { |
|
56 | 56 | $sign = '+'; |
57 | 57 | $amount = floor($tradeList[RES_DARK_MATTER] / 3 * $rates[RES_DARK_MATTER] / $rates[$resource_id]); |
58 | 58 | $value += $amount; |
59 | 59 | } else { |
60 | 60 | $value += floor($amount * $rates[$resource_id] / $rates[$exchangeTo]); |
61 | - if($resource_id == RES_DARK_MATTER) { |
|
61 | + if ($resource_id == RES_DARK_MATTER) { |
|
62 | 62 | $amount = 0; |
63 | 63 | } else { |
64 | - if(mrc_get_level($user, $planetrow, $resource_id, true) < $amount) { |
|
64 | + if (mrc_get_level($user, $planetrow, $resource_id, true) < $amount) { |
|
65 | 65 | $intError = MARKET_NO_RESOURCES; |
66 | 66 | break; |
67 | 67 | } |
@@ -70,12 +70,12 @@ discard block |
||
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
73 | - if($amount) { |
|
73 | + if ($amount) { |
|
74 | 74 | $qry[] = "`{$resource_db_name}` = `{$resource_db_name}` {$sign} {$amount}"; |
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
78 | - if($exchangeTo != RES_DARK_MATTER) { |
|
78 | + if ($exchangeTo != RES_DARK_MATTER) { |
|
79 | 79 | $amount = floor($value); |
80 | 80 | $exchange_to_db_name = pname_resource_name($exchangeTo); |
81 | 81 | $qry[] = "`{$exchange_to_db_name}` = `{$exchange_to_db_name}` + {$amount}"; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $intError = $value <= 0 ? MARKET_ZERO_DEAL : $intError; |
87 | 87 | $intError = mrc_get_level($user, null, RES_DARK_MATTER) < $operation_cost ? MARKET_NO_DM : $intError; |
88 | 88 | |
89 | - if($intError == MARKET_DEAL) { |
|
89 | + if ($intError == MARKET_DEAL) { |
|
90 | 90 | $qry = implode(', ', $qry); |
91 | 91 | $table = $planetrow['id_owner'] ? 'planets' : 'users'; |
92 | 92 | |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | 'EXCHANGE_TO_RESOURCE_ID' => $exchangeTo, |
112 | 112 | )); |
113 | 113 | |
114 | - foreach(sn_get_groups('resources_trader') as $resource_id) { |
|
115 | - if($resource_id == RES_DARK_MATTER) { |
|
114 | + foreach (sn_get_groups('resources_trader') as $resource_id) { |
|
115 | + if ($resource_id == RES_DARK_MATTER) { |
|
116 | 116 | $amount = floor(mrc_get_level($user, null, RES_DARK_MATTER) - $config->rpg_cost_trader); |
117 | 117 | } else { |
118 | 118 | $amount = floor(mrc_get_level($user, $planetrow, $resource_id)); |
@@ -35,8 +35,7 @@ |
||
35 | 35 | if($planetrow['id_owner']) { |
36 | 36 | $global_data = sys_o_get_updated($user, $planetrow, SN_TIME_NOW); |
37 | 37 | $planetrow = $global_data['planet']; |
38 | - } |
|
39 | - else { |
|
38 | + } else { |
|
40 | 39 | // Locking user record |
41 | 40 | $user = db_user_by_id($user['id'], true); |
42 | 41 | } |