@@ -4,18 +4,18 @@ discard block |
||
4 | 4 | // @version 1.0 |
5 | 5 | // @copyright 2008 by Chlorel for XNova |
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 = 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 | message($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 = doquery('SELECT * FROM {{aks}};'); |
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'], |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $source_planet = &$mission_data['src_planet']; |
15 | 15 | $destination_planet = &$mission_data['dst_planet']; |
16 | 16 | |
17 | - if(!isset($destination_planet['id']) || !$destination_planet['id_owner']) |
|
17 | + if (!isset($destination_planet['id']) || !$destination_planet['id_owner']) |
|
18 | 18 | { |
19 | 19 | // doquery("UPDATE {{fleets}} SET `fleet_mess` = 1 WHERE `fleet_id` = {$fleet_row['fleet_id']} LIMIT 1;"); |
20 | 20 | fleet_send_back($fleet_row); |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | $destination_planet['name'], uni_render_coordinates_href($fleet_row, 'fleet_end_', 3, ''), |
28 | 28 | $fleet_row['fleet_resource_metal'], $lang['Metal'], |
29 | 29 | $fleet_row['fleet_resource_crystal'], $lang['Crystal'], |
30 | - $fleet_row['fleet_resource_deuterium'], $lang['Deuterium'] ); |
|
30 | + $fleet_row['fleet_resource_deuterium'], $lang['Deuterium']); |
|
31 | 31 | msg_send_simple_message($fleet_row['fleet_target_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_TRANSPORT, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message); |
32 | 32 | |
33 | - if($fleet_row['fleet_target_owner'] <> $fleet_row['fleet_owner']) |
|
33 | + if ($fleet_row['fleet_target_owner'] <> $fleet_row['fleet_owner']) |
|
34 | 34 | { |
35 | 35 | msg_send_simple_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_TRANSPORT, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message); |
36 | 36 | } |
@@ -39,21 +39,21 @@ discard block |
||
39 | 39 | |
40 | 40 | $sta_update_msg = db_escape($sta_update_msg); |
41 | 41 | |
42 | - if($next_step) { |
|
42 | + if ($next_step) { |
|
43 | 43 | $sta_update_step++; |
44 | 44 | } |
45 | 45 | $sta_update_msg = "Update in progress. Step {$sta_update_step}/14: {$sta_update_msg}."; |
46 | 46 | |
47 | 47 | $config->db_saveItem('var_stat_update_msg', $sta_update_msg); |
48 | - if($next_step) { |
|
48 | + if ($next_step) { |
|
49 | 49 | $debug->warning($sta_update_msg, 'Stat update', LOG_INFO_STAT_PROCESS); |
50 | 50 | } |
51 | 51 | } |
52 | 52 | |
53 | 53 | function sys_stat_calculate_flush(&$data, $force = false) { |
54 | - if(count($data) < 25 && !$force) return; |
|
54 | + if (count($data) < 25 && !$force) return; |
|
55 | 55 | |
56 | - if(!empty($data)) { |
|
56 | + if (!empty($data)) { |
|
57 | 57 | doquery('REPLACE INTO {{statpoints}} |
58 | 58 | (`id_owner`, `id_ally`, `stat_type`, `stat_code`, `tech_points`, `tech_count`, `build_points`, `build_count`, |
59 | 59 | `defs_points`, `defs_count`, `fleet_points`, `fleet_count`, `res_points`, `res_count`, `total_points`, |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | $user_list = db_user_list('', true, 'id, dark_matter, metal, crystal, deuterium, user_as_ally, ally_id'); |
94 | 94 | $row_num = count($user_list); |
95 | 95 | // while($player = db_fetch($query)) |
96 | - foreach($user_list as $player) { |
|
97 | - if($i++ % 100 == 0) sta_set_time_limit("calculating players stats (player {$i}/{$row_num})", false); |
|
98 | - if(array_key_exists($user_id = $player['id'], $user_skip_list)) continue; |
|
96 | + foreach ($user_list as $player) { |
|
97 | + if ($i++ % 100 == 0) sta_set_time_limit("calculating players stats (player {$i}/{$row_num})", false); |
|
98 | + if (array_key_exists($user_id = $player['id'], $user_skip_list)) continue; |
|
99 | 99 | |
100 | 100 | $resources = $player['metal'] * $rate[RES_METAL] + $player['crystal'] * $rate[RES_CRYSTAL] + |
101 | 101 | $player['deuterium'] * $rate[RES_DEUTERIUM] + $player['dark_matter'] * $rate[RES_DARK_MATTER]; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | // $points[$user_id][UNIT_RESOURCES] += $resources; |
104 | 104 | |
105 | 105 | // А здесь мы фильтруем пользователей по $user_skip_list - далее не нужно этого делать, потому что |
106 | - if(!isset($user_skip_list[$user_id])) { |
|
106 | + if (!isset($user_skip_list[$user_id])) { |
|
107 | 107 | $user_allies[$user_id] = $player['ally_id']; |
108 | 108 | } |
109 | 109 | } |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | $i = 0; |
117 | 117 | $query = DBStaticPlanet::db_planet_list_resources_by_owner(); |
118 | 118 | $row_num = db_num_rows($query); |
119 | - while($planet = db_fetch($query)) { |
|
120 | - if($i++ % 100 == 0) sta_set_time_limit("calculating planets stats (planet {$i}/{$row_num})", false); |
|
121 | - if(array_key_exists($user_id = $planet['id_owner'], $user_skip_list)) continue; |
|
119 | + while ($planet = db_fetch($query)) { |
|
120 | + if ($i++ % 100 == 0) sta_set_time_limit("calculating planets stats (planet {$i}/{$row_num})", false); |
|
121 | + if (array_key_exists($user_id = $planet['id_owner'], $user_skip_list)) continue; |
|
122 | 122 | |
123 | 123 | $resources = $planet['metal'] * $rate[RES_METAL] + $planet['crystal'] * $rate[RES_CRYSTAL] + |
124 | 124 | $planet['deuterium'] * $rate[RES_DEUTERIUM]; |
@@ -131,15 +131,15 @@ discard block |
||
131 | 131 | $i = 0; |
132 | 132 | $query = db_fleet_list_query_all_stat(); |
133 | 133 | $row_num = db_num_rows($query); |
134 | - while($fleet_row = db_fetch($query)) { |
|
135 | - if($i++ % 100 == 0) sta_set_time_limit("calculating flying fleets stats (fleet {$i}/{$row_num})", false); |
|
136 | - if(array_key_exists($user_id = $fleet_row['fleet_owner'], $user_skip_list)) continue; |
|
134 | + while ($fleet_row = db_fetch($query)) { |
|
135 | + if ($i++ % 100 == 0) sta_set_time_limit("calculating flying fleets stats (fleet {$i}/{$row_num})", false); |
|
136 | + if (array_key_exists($user_id = $fleet_row['fleet_owner'], $user_skip_list)) continue; |
|
137 | 137 | |
138 | 138 | $fleet = sys_unit_str2arr($fleet_row['fleet_array']); |
139 | - foreach($fleet as $unit_id => $unit_amount) { |
|
139 | + foreach ($fleet as $unit_id => $unit_amount) { |
|
140 | 140 | $counts[$user_id][UNIT_SHIPS] += $unit_amount; |
141 | 141 | |
142 | - if(!isset($unit_cost_cache[$unit_id][0])) { |
|
142 | + if (!isset($unit_cost_cache[$unit_id][0])) { |
|
143 | 143 | $unit_cost_cache[$unit_id][0] = get_unit_param($unit_id, P_COST); |
144 | 144 | } |
145 | 145 | $unit_cost_data = &$unit_cost_cache[$unit_id][0]; |
@@ -156,9 +156,9 @@ discard block |
||
156 | 156 | $i = 0; |
157 | 157 | $query = DBStaticUnit::db_unit_list_stat_calculate(); |
158 | 158 | $row_num = db_num_rows($query); |
159 | - while($unit = db_fetch($query)) { |
|
160 | - if($i++ % 100 == 0) sta_set_time_limit("calculating unit stats (unit {$i}/{$row_num})", false); |
|
161 | - if(array_key_exists($user_id = $unit['unit_player_id'], $user_skip_list)) continue; |
|
159 | + while ($unit = db_fetch($query)) { |
|
160 | + if ($i++ % 100 == 0) sta_set_time_limit("calculating unit stats (unit {$i}/{$row_num})", false); |
|
161 | + if (array_key_exists($user_id = $unit['unit_player_id'], $user_skip_list)) continue; |
|
162 | 162 | |
163 | 163 | $counts[$user_id][$unit['unit_type']] += $unit['unit_level'] * $unit['unit_amount']; |
164 | 164 | $total_cost = eco_get_total_cost($unit['unit_snid'], $unit['unit_level']); |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | $i = 0; |
171 | 171 | $query = DBStaticQue::db_que_list_stat(); |
172 | 172 | $row_num = db_num_rows($query); |
173 | - while($que_item = db_fetch($query)) { |
|
174 | - if($i++ % 100 == 0) sta_set_time_limit("calculating ques stats (que item {$i}/{$row_num})", false); |
|
175 | - if(array_key_exists($user_id = $que_item['que_player_id'], $user_skip_list)) continue; |
|
173 | + while ($que_item = db_fetch($query)) { |
|
174 | + if ($i++ % 100 == 0) sta_set_time_limit("calculating ques stats (que item {$i}/{$row_num})", false); |
|
175 | + if (array_key_exists($user_id = $que_item['que_player_id'], $user_skip_list)) continue; |
|
176 | 176 | $que_unit_amount = $que_item['que_unit_amount']; |
177 | 177 | $que_item = sys_unit_str2arr($que_item['que_unit_price']); |
178 | 178 | $resources = ($que_item[RES_METAL] * $rate[RES_METAL] + $que_item[RES_CRYSTAL] * $rate[RES_CRYSTAL] + $que_item[RES_DEUTERIUM] * $rate[RES_DEUTERIUM]) * $que_unit_amount; |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | |
189 | 189 | sta_set_time_limit('posting new user stats to DB'); |
190 | 190 | $data = array(); |
191 | - foreach($user_allies as $user_id => $ally_id) { |
|
191 | + foreach ($user_allies as $user_id => $ally_id) { |
|
192 | 192 | // $counts[UNIT_RESOURCES] дублирует $points[UNIT_RESOURCES], поэтому $points не заполняем, а берем $counts и делим на 1000 |
193 | 193 | $points[$user_id][UNIT_RESOURCES] = $counts[$user_id][UNIT_RESOURCES] / 1000; |
194 | 194 | $points[$user_id] = array_map('floor', $points[$user_id]); |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | |
245 | 245 | // Updating player's ranks |
246 | 246 | sta_set_time_limit("updating ranks for players"); |
247 | - foreach($rankNames as $rankName) { |
|
247 | + foreach ($rankNames as $rankName) { |
|
248 | 248 | sta_set_time_limit("updating player rank '{$rankName}'", false); |
249 | 249 | doquery($qryResetRowNum); |
250 | 250 | doquery(sprintf($qryFormat, $rankName, 1)); |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | |
253 | 253 | sta_set_time_limit("updating ranks for Alliances"); |
254 | 254 | // --- Updating Allie's ranks |
255 | - foreach($rankNames as $rankName) { |
|
255 | + foreach ($rankNames as $rankName) { |
|
256 | 256 | sta_set_time_limit("updating Alliances rank '{$rankName}'", false); |
257 | 257 | doquery($qryResetRowNum); |
258 | 258 | doquery(sprintf($qryFormat, $rankName, 2)); |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | |
5 | 5 | require('../includes/init.' . substr(strrchr(__FILE__, '.'), 1)); |
6 | 6 | |
7 | -if($user['authlevel'] < 3) |
|
7 | +if ($user['authlevel'] < 3) |
|
8 | 8 | { |
9 | 9 | message($lang['sys_noalloaw'], $lang['sys_noaccess']); |
10 | 10 | die(); |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | |
20 | 20 | // [#] info_best_battles 1b0 |
21 | 21 | $best_reports = array(); |
22 | -if(defined('MODULE_INFO_BEST_BATTLES_QUERY')) { |
|
22 | +if (defined('MODULE_INFO_BEST_BATTLES_QUERY')) { |
|
23 | 23 | $query = doquery(MODULE_INFO_BEST_BATTLES_QUERY); |
24 | - while($row = db_fetch($query)) { |
|
24 | + while ($row = db_fetch($query)) { |
|
25 | 25 | $best_reports[] = $row['ube_report_id']; |
26 | 26 | } |
27 | 27 | } |
@@ -185,16 +185,16 @@ discard block |
||
185 | 185 | |
186 | 186 | function sn_maintenance_pack_user_list($user_list) { |
187 | 187 | $user_list = explode(',', $user_list); |
188 | - foreach($user_list as $key => $user_id) { |
|
189 | - if(!ceil(floatval($user_id))) { |
|
188 | + foreach ($user_list as $key => $user_id) { |
|
189 | + if (!ceil(floatval($user_id))) { |
|
190 | 190 | unset($user_list[$key]); |
191 | 191 | } |
192 | 192 | } |
193 | 193 | |
194 | 194 | $result = array(); |
195 | - if(!empty($user_list)) { |
|
195 | + if (!empty($user_list)) { |
|
196 | 196 | $query = doquery("SELECT `id` FROM {{users}} WHERE `id` in (" . implode(',', $user_list) . ")"); |
197 | - while($row = db_fetch($query)) { |
|
197 | + while ($row = db_fetch($query)) { |
|
198 | 198 | $result[] = $row['id']; |
199 | 199 | } |
200 | 200 | } |
@@ -209,11 +209,11 @@ discard block |
||
209 | 209 | $old_server_status == GAME_DISABLE_NONE ? classSupernova::$config->db_saveItem('game_disable', GAME_DISABLE_MAINTENANCE) : false; |
210 | 210 | sn_db_transaction_commit(); |
211 | 211 | |
212 | -foreach($ques as $que_transaction) { |
|
212 | +foreach ($ques as $que_transaction) { |
|
213 | 213 | sn_db_transaction_start(); |
214 | 214 | |
215 | 215 | !is_array($que_transaction) ? $que_transaction = array($que_transaction) : false; |
216 | - foreach($que_transaction as $que) { |
|
216 | + foreach ($que_transaction as $que) { |
|
217 | 217 | set_time_limit(120); |
218 | 218 | $QryResult = doquery($que); |
219 | 219 | //$msg .= '<hr>' . $que . '<hr>'; |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | [!] DB code updates |
22 | 22 | */ |
23 | 23 | |
24 | -if(!defined('INIT')) { |
|
24 | +if (!defined('INIT')) { |
|
25 | 25 | // include_once('init.php'); |
26 | 26 | die('Unauthorized access'); |
27 | 27 | } |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | |
41 | 41 | |
42 | 42 | //$config->db_loadItem('db_version'); |
43 | -if($config->db_version == DB_VERSION) { |
|
44 | -} elseif($config->db_version > DB_VERSION) { |
|
43 | +if ($config->db_version == DB_VERSION) { |
|
44 | +} elseif ($config->db_version > DB_VERSION) { |
|
45 | 45 | $config->db_saveItem('var_db_update_end', SN_TIME_NOW); |
46 | 46 | die( |
47 | 47 | 'Internal error! Auotupdater detects DB version greater then can be handled!<br /> |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | |
53 | 53 | $upd_log = ''; |
54 | 54 | $new_version = floatval($config->db_version); |
55 | -if($new_version < 37) { |
|
55 | +if ($new_version < 37) { |
|
56 | 56 | die('This version does not supports upgrades from SN below v37. Please, use SN v40 to upgrade old database.<br /> |
57 | 57 | Эта версия игры не поддерживает обновление движка версий ниже 37й. Пожалуйста, используйте SN v40 для апгрейда со старых версий игры.'); |
58 | 58 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $update_tables = array(); |
71 | 71 | $update_indexes = array(); |
72 | 72 | $query = upd_do_query('SHOW TABLES;', true); |
73 | -while($row = db_fetch_row($query)) { |
|
73 | +while ($row = db_fetch_row($query)) { |
|
74 | 74 | upd_load_table_info($row[0]); |
75 | 75 | } |
76 | 76 | upd_log_message('Table info loaded. Now looking DB for upgrades...'); |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | |
81 | 81 | ini_set('memory_limit', '1024M'); |
82 | 82 | |
83 | -switch($new_version) { |
|
83 | +switch ($new_version) { |
|
84 | 84 | case 37: |
85 | 85 | upd_log_version_update(); |
86 | 86 | |
87 | 87 | upd_check_key('player_vacation_timeout', PERIOD_WEEK, $config->player_vacation_timeout != PERIOD_WEEK); |
88 | - upd_check_key('player_vacation_time', PERIOD_WEEK , $config->player_vacation_time != PERIOD_WEEK); |
|
88 | + upd_check_key('player_vacation_time', PERIOD_WEEK, $config->player_vacation_time != PERIOD_WEEK); |
|
89 | 89 | |
90 | 90 | upd_alter_table('users', "ADD `vacation_next` INT(11) NOT NULL DEFAULT 0 COMMENT 'Next datetime when player can go on vacation'", !$update_tables['users']['vacation_next']); |
91 | 91 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | upd_check_key('payment_currency_exchange_mm_', 2500, !$config->payment_currency_exchange_mm_); |
97 | 97 | |
98 | - if(!$update_tables['log_metamatter']) |
|
98 | + if (!$update_tables['log_metamatter']) |
|
99 | 99 | { |
100 | 100 | upd_create_table('log_metamatter', |
101 | 101 | "( |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | "ADD `payment_test` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Is this a test payment?'", |
122 | 122 | ), !$update_tables['payment']['payment_test']); |
123 | 123 | |
124 | - if($update_tables['payment']['payment_test']['Default'] == 1) |
|
124 | + if ($update_tables['payment']['payment_test']['Default'] == 1) |
|
125 | 125 | { |
126 | 126 | upd_alter_table('payment', array( |
127 | 127 | "MODIFY COLUMN `payment_test` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Is this a test payment?'", |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | ), $update_tables['users']['metamatter']['Type'] == 'int(20)'); |
140 | 140 | |
141 | 141 | $query = upd_do_query("SELECT * FROM {{que}} WHERE `que_type` = " . QUE_RESEARCH . " AND que_unit_id in (" . TECH_EXPEDITION . "," . TECH_COLONIZATION . ") FOR UPDATE"); |
142 | - while($row = db_fetch($query)) |
|
142 | + while ($row = db_fetch($query)) |
|
143 | 143 | { |
144 | 144 | $planet_id = ($row['que_planet_id_origin'] ? $row['que_planet_id_origin'] : $row['que_planet_id']); |
145 | 145 | upd_do_query("SELECT id FROM {{planets}} WHERE id = {$planet_id} FOR UPDATE"); |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | LEFT JOIN {{planets}} AS p ON p.id = u.id_planet |
159 | 159 | WHERE unit_snid in (" . TECH_EXPEDITION . "," . TECH_COLONIZATION . ") |
160 | 160 | FOR UPDATE"); |
161 | - while($row = db_fetch($query)) |
|
161 | + while ($row = db_fetch($query)) |
|
162 | 162 | { |
163 | - if(!$row['id_planet']) |
|
163 | + if (!$row['id_planet']) |
|
164 | 164 | { |
165 | 165 | continue; |
166 | 166 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | $unit_level = $row['unit_level']; |
170 | 170 | $price = get_unit_param($unit_id, P_COST); |
171 | 171 | $factor = $price['factor']; |
172 | - foreach($price as $resource_id => &$resource_amount) |
|
172 | + foreach ($price as $resource_id => &$resource_amount) |
|
173 | 173 | { |
174 | 174 | $resource_amount = $resource_amount * (pow($factor, $unit_level) - 1) / ($factor - 1); |
175 | 175 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | // Вернуть ресы за уже исследованную Экспедиционную технологию |
190 | 190 | upd_check_key('player_max_colonies', -1, $config->player_max_colonies >= 0); |
191 | 191 | |
192 | - if(!isset($update_tables['users']['player_rpg_explore_xp'])) |
|
192 | + if (!isset($update_tables['users']['player_rpg_explore_xp'])) |
|
193 | 193 | { |
194 | 194 | upd_alter_table('users', array( |
195 | 195 | "ADD COLUMN `player_rpg_explore_level` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 AFTER `dark_matter`", |
@@ -197,9 +197,9 @@ discard block |
||
197 | 197 | ), !isset($update_tables['users']['player_rpg_explore_xp'])); |
198 | 198 | } |
199 | 199 | |
200 | - if(!$update_tables['log_users_online']) |
|
200 | + if (!$update_tables['log_users_online']) |
|
201 | 201 | { |
202 | - upd_create_table('log_users_online',"( |
|
202 | + upd_create_table('log_users_online', "( |
|
203 | 203 | `online_timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Measure time', |
204 | 204 | `online_count` SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Users online', |
205 | 205 | |
@@ -213,12 +213,12 @@ discard block |
||
213 | 213 | "ADD `user_time_measured` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'When was time diff measured last time' AFTER `onlinetime`", |
214 | 214 | ), !$update_tables['users']['user_time_measured']); |
215 | 215 | |
216 | - if($update_tables['rw']) |
|
216 | + if ($update_tables['rw']) |
|
217 | 217 | { |
218 | 218 | upd_do_query("DROP TABLE IF EXISTS {{rw}};"); |
219 | 219 | } |
220 | 220 | |
221 | - if(!$update_tables['player_award']) |
|
221 | + if (!$update_tables['player_award']) |
|
222 | 222 | { |
223 | 223 | upd_create_table('player_award', "( |
224 | 224 | `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
@@ -261,14 +261,14 @@ discard block |
||
261 | 261 | upd_log_version_update(); |
262 | 262 | |
263 | 263 | |
264 | - if(!isset($update_tables['planets']['que_processed'])) { |
|
264 | + if (!isset($update_tables['planets']['que_processed'])) { |
|
265 | 265 | upd_alter_table('planets', array( |
266 | 266 | "ADD COLUMN `que_processed` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `last_update`", |
267 | 267 | ), true); |
268 | 268 | upd_do_query("UPDATE {{planets}} SET que_processed = last_update;"); |
269 | 269 | } |
270 | 270 | |
271 | - if(!isset($update_tables['users']['que_processed'])) { |
|
271 | + if (!isset($update_tables['users']['que_processed'])) { |
|
272 | 272 | upd_alter_table('users', array( |
273 | 273 | "ADD COLUMN `que_processed` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `onlinetime`", |
274 | 274 | ), true); |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | |
280 | 280 | |
281 | 281 | |
282 | - if(isset($update_tables['planets']['que'])) { |
|
282 | + if (isset($update_tables['planets']['que'])) { |
|
283 | 283 | $sn_data_aux = array( |
284 | 284 | SHIP_SMALL_FIGHTER_WRATH => array( |
285 | 285 | 'name' => 'ship_fighter_wrath', |
@@ -364,20 +364,20 @@ discard block |
||
364 | 364 | $unit_data = array(); |
365 | 365 | $planets = array(); |
366 | 366 | |
367 | - foreach($planet_unit_list as $unit_id) { |
|
368 | - if(!($unit_name = get_unit_param($unit_id, P_NAME))) { |
|
367 | + foreach ($planet_unit_list as $unit_id) { |
|
368 | + if (!($unit_name = get_unit_param($unit_id, P_NAME))) { |
|
369 | 369 | $unit_name = $sn_data_aux[$unit_id][P_NAME]; |
370 | 370 | } |
371 | - if(isset($update_tables['planets'][$unit_name])) { |
|
371 | + if (isset($update_tables['planets'][$unit_name])) { |
|
372 | 372 | $drop[] = "DROP COLUMN `{$unit_name}`"; |
373 | 373 | |
374 | - if(isset($aux_group[$unit_id])) { |
|
374 | + if (isset($aux_group[$unit_id])) { |
|
375 | 375 | $units_info[$unit_id] = $sn_data_aux[$unit_id]; |
376 | 376 | $units_info[$unit_id]['que'] = QUE_HANGAR; |
377 | 377 | } else { |
378 | 378 | $units_info[$unit_id] = get_unit_param($unit_id); |
379 | - foreach($ques_info as $que_id => $que_data1) { |
|
380 | - if(in_array($unit_id, $que_data1['unit_list'])) { |
|
379 | + foreach ($ques_info as $que_id => $que_data1) { |
|
380 | + if (in_array($unit_id, $que_data1['unit_list'])) { |
|
381 | 381 | $units_info[$unit_id]['que'] = $que_id; |
382 | 382 | break; |
383 | 383 | } |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | } |
388 | 388 | |
389 | 389 | $query = upd_do_query("SELECT * FROM {{planets}} FOR UPDATE"); |
390 | - while($row = db_fetch($query)) { |
|
390 | + while ($row = db_fetch($query)) { |
|
391 | 391 | $user_id = $row['id_owner']; |
392 | 392 | $planet_id = $row['id']; |
393 | 393 | |
@@ -395,12 +395,12 @@ discard block |
||
395 | 395 | |
396 | 396 | // Конвертируем юниты |
397 | 397 | $units_levels = array(); |
398 | - foreach($planet_unit_list as $unit_id) { |
|
398 | + foreach ($planet_unit_list as $unit_id) { |
|
399 | 399 | $unit_name = &$units_info[$unit_id][P_NAME]; |
400 | - if(!isset($row[$unit_name]) || !$row[$unit_name]) continue; |
|
400 | + if (!isset($row[$unit_name]) || !$row[$unit_name]) continue; |
|
401 | 401 | $units_levels[$unit_id] = $row[$unit_name]; |
402 | 402 | $unit_data[] = "({$user_id}," . LOC_PLANET . ",{$planet_id},{$units_info[$unit_id][P_UNIT_TYPE]},{$unit_id},{$units_levels[$unit_id]})"; |
403 | - if(count($unit_data) > 30) { |
|
403 | + if (count($unit_data) > 30) { |
|
404 | 404 | $unit_data_max = strlen(implode(',', $unit_data)) > $unit_data_max ? strlen(implode(',', $unit_data)) : $unit_data_max; |
405 | 405 | upd_do_query('REPLACE INTO {{unit}} (`unit_player_id`, `unit_location_type`, `unit_location_id`, `unit_type`, `unit_snid`, `unit_level`) VALUES ' . implode(',', $unit_data) . ';'); |
406 | 406 | $unit_data = array(); |
@@ -408,10 +408,10 @@ discard block |
||
408 | 408 | } |
409 | 409 | |
410 | 410 | // Конвертируем очередь построек |
411 | - if($row['que']) { |
|
411 | + if ($row['que']) { |
|
412 | 412 | $que = explode(';', $row['que']); |
413 | - foreach($que as $que_item) { |
|
414 | - if(!$que_item) continue; |
|
413 | + foreach ($que as $que_item) { |
|
414 | + if (!$que_item) continue; |
|
415 | 415 | |
416 | 416 | $que_item = explode(',', $que_item); |
417 | 417 | |
@@ -424,8 +424,8 @@ discard block |
||
424 | 424 | $unit_factor = $unit_cost[P_FACTOR] ? $unit_cost[P_FACTOR] : 1; |
425 | 425 | $price_increase = pow($unit_factor, $unit_level); |
426 | 426 | // $unit_time = 0; |
427 | - foreach($unit_cost as $resource_id => &$resource_amount) { |
|
428 | - if(!in_array($resource_id, $group_resource_loot)) { |
|
427 | + foreach ($unit_cost as $resource_id => &$resource_amount) { |
|
428 | + if (!in_array($resource_id, $group_resource_loot)) { |
|
429 | 429 | unset($unit_cost[$resource_id]); |
430 | 430 | continue; |
431 | 431 | } |
@@ -439,33 +439,33 @@ discard block |
||
439 | 439 | } |
440 | 440 | |
441 | 441 | // Конвертируем очередь верфи |
442 | - if($row['b_hangar_id']) { |
|
443 | - $return_resources = array(RES_METAL => 0, RES_CRYSTAL => 0, RES_DEUTERIUM => 0, ); |
|
442 | + if ($row['b_hangar_id']) { |
|
443 | + $return_resources = array(RES_METAL => 0, RES_CRYSTAL => 0, RES_DEUTERIUM => 0,); |
|
444 | 444 | $hangar_units = sys_unit_str2arr($row['b_hangar_id']); |
445 | - foreach($hangar_units as $unit_id => $unit_count) { |
|
446 | - if($unit_count <= 0) continue; |
|
447 | - foreach($units_info[$unit_id][P_COST] as $resource_id => $resource_amount) { |
|
448 | - if(!in_array($resource_id, $group_resource_loot)) continue; |
|
445 | + foreach ($hangar_units as $unit_id => $unit_count) { |
|
446 | + if ($unit_count <= 0) continue; |
|
447 | + foreach ($units_info[$unit_id][P_COST] as $resource_id => $resource_amount) { |
|
448 | + if (!in_array($resource_id, $group_resource_loot)) continue; |
|
449 | 449 | $return_resources[$resource_id] += $unit_count * $resource_amount; |
450 | 450 | } |
451 | 451 | } |
452 | - if(array_sum($return_resources) > 0) { |
|
452 | + if (array_sum($return_resources) > 0) { |
|
453 | 453 | upd_do_query("UPDATE {{planets}} SET `metal` = `metal` + {$return_resources[RES_METAL]}, `crystal` = `crystal` + {$return_resources[RES_CRYSTAL]}, `deuterium` = `deuterium` + {$return_resources[RES_DEUTERIUM]} WHERE `id` = {$planet_id} LIMIT 1"); |
454 | 454 | } |
455 | 455 | } |
456 | 456 | |
457 | 457 | |
458 | - if(count($que_data) > 10) { |
|
458 | + if (count($que_data) > 10) { |
|
459 | 459 | $que_data_max = strlen(implode(',', $que_data)) > $que_data_max ? strlen(implode(',', $que_data)) : $que_data_max; |
460 | 460 | upd_do_query('INSERT INTO {{que}} (`que_player_id`, `que_planet_id`, `que_planet_id_origin`, `que_type`, `que_time_left`, `que_unit_id`, `que_unit_amount`, `que_unit_mode`, `que_unit_level`, `que_unit_time`, `que_unit_price`) VALUES ' . implode(',', $que_data) . ';'); |
461 | 461 | $que_data = array(); |
462 | 462 | } |
463 | 463 | } |
464 | 464 | |
465 | - if(!empty($unit_data)) |
|
465 | + if (!empty($unit_data)) |
|
466 | 466 | upd_do_query('REPLACE INTO {{unit}} (`unit_player_id`, `unit_location_type`, `unit_location_id`, `unit_type`, `unit_snid`, `unit_level`) VALUES ' . implode(',', $unit_data) . ';'); |
467 | 467 | |
468 | - if(!empty($que_data)) |
|
468 | + if (!empty($que_data)) |
|
469 | 469 | upd_do_query('INSERT INTO {{que}} (`que_player_id`, `que_planet_id`, `que_planet_id_origin`, `que_type`, `que_time_left`, `que_unit_id`, `que_unit_amount`, `que_unit_mode`, `que_unit_level`, `que_unit_time`, `que_unit_price`) VALUES ' . implode(',', $que_data) . ';'); |
470 | 470 | |
471 | 471 | upd_alter_table('planets', $drop, true); |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | JOIN `{{users}}` AS u ON a.`id` = u.`user_as_ally` AND `user_as_ally` IS NOT NULL AND `username` = '' |
476 | 476 | SET u.`username` = CONCAT('[', a.`ally_tag`, ']');"); |
477 | 477 | |
478 | - if($update_indexes['statpoints']['I_stats_id_ally'] != 'id_ally,stat_type,stat_code,') { |
|
478 | + if ($update_indexes['statpoints']['I_stats_id_ally'] != 'id_ally,stat_type,stat_code,') { |
|
479 | 479 | upd_do_query("SET FOREIGN_KEY_CHECKS=0;"); |
480 | 480 | upd_alter_table('statpoints', "DROP FOREIGN KEY `FK_stats_id_ally`", $update_foreigns['statpoints']['FK_stats_id_ally']); |
481 | 481 | upd_alter_table('statpoints', "DROP KEY `I_stats_id_ally`", $update_indexes['statpoints']['I_stats_id_ally']); |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | "ADD CONSTRAINT `FK_users_browser_id` FOREIGN KEY (`user_last_browser_id`) REFERENCES `{$config->db_prefix}security_browser` (`browser_id`) ON DELETE SET NULL ON UPDATE CASCADE", |
572 | 572 | ), !isset($update_tables['users']['user_last_proxy'])); |
573 | 573 | |
574 | - if(!isset($update_tables['notes']['planet_type'])) { |
|
574 | + if (!isset($update_tables['notes']['planet_type'])) { |
|
575 | 575 | upd_alter_table('notes', array( |
576 | 576 | // "ADD COLUMN `planet_name` VARCHAR(64) NOT NULL DEFAULT '' AFTER `title`", |
577 | 577 | "ADD COLUMN `galaxy` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 0 AFTER `title`", |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | upd_alter_table('users', "ADD COLUMN `user_bot` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0", !isset($update_tables['users']['user_bot'])); |
591 | 591 | upd_alter_table('unit', "ADD KEY `I_unit_type_snid` (unit_type, unit_snid) USING BTREE", !$update_indexes['unit']['I_unit_type_snid']); |
592 | 592 | |
593 | - if($update_tables['users']['settings_tooltiptime']['Type'] != 'smallint(5) unsigned') { |
|
593 | + if ($update_tables['users']['settings_tooltiptime']['Type'] != 'smallint(5) unsigned') { |
|
594 | 594 | upd_alter_table('users', array( |
595 | 595 | "MODIFY COLUMN `settings_tooltiptime` smallint(5) unsigned NOT NULL DEFAULT '500'", |
596 | 596 | ), $update_tables['users']['settings_tooltiptime']['Type'] != 'smallint'); |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | upd_do_query("UPDATE `{{users}}` SET settings_tooltiptime = 500;"); |
599 | 599 | } |
600 | 600 | |
601 | - if(!isset($update_tables['log_users_online']['online_aggregated'])) { |
|
601 | + if (!isset($update_tables['log_users_online']['online_aggregated'])) { |
|
602 | 602 | upd_alter_table('log_users_online', "ADD COLUMN `online_aggregated` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0", !isset($update_tables['log_users_online']['online_aggregated'])); |
603 | 603 | upd_alter_table('log_users_online', array( |
604 | 604 | "DROP PRIMARY KEY", |
@@ -606,13 +606,13 @@ discard block |
||
606 | 606 | ), $update_indexes['log_users_online']['PRIMARY'] != 'online_timestamp,online_aggregated,'); |
607 | 607 | } |
608 | 608 | |
609 | - if(!isset($update_tables['users']['gender'])) { |
|
609 | + if (!isset($update_tables['users']['gender'])) { |
|
610 | 610 | upd_alter_table('users', "ADD COLUMN `gender` TINYINT(1) UNSIGNED NOT NULL DEFAULT " . GENDER_UNKNOWN, !isset($update_tables['users']['gender'])); |
611 | - upd_do_query("UPDATE {{users}} SET `gender` = IF(UPPER(`sex`) = 'F', " . GENDER_FEMALE. ", IF(UPPER(`sex`) = 'M', " . GENDER_MALE . ", " . GENDER_UNKNOWN . "));"); |
|
611 | + upd_do_query("UPDATE {{users}} SET `gender` = IF(UPPER(`sex`) = 'F', " . GENDER_FEMALE . ", IF(UPPER(`sex`) = 'M', " . GENDER_MALE . ", " . GENDER_UNKNOWN . "));"); |
|
612 | 612 | } |
613 | 613 | upd_alter_table('users', "DROP COLUMN `sex`", isset($update_tables['users']['sex'])); |
614 | 614 | |
615 | - if(!$update_tables['users']['dark_matter_total']) { |
|
615 | + if (!$update_tables['users']['dark_matter_total']) { |
|
616 | 616 | upd_alter_table('users', "ADD `dark_matter_total` BIGINT(20) NOT NULL DEFAULT 0 COMMENT 'Total Dark Matter amount ever gained' AFTER `dark_matter`", !$update_tables['users']['dark_matter_total']); |
617 | 617 | upd_do_query( |
618 | 618 | "UPDATE `{{users}}` AS u |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | } |
626 | 626 | |
627 | 627 | upd_check_key('player_metamatter_immortal', 100000, !isset($config->player_metamatter_immortal)); |
628 | - if(!$update_tables['users']['metamatter_total']) { |
|
628 | + if (!$update_tables['users']['metamatter_total']) { |
|
629 | 629 | upd_alter_table('users', "ADD `metamatter_total` BIGINT(20) NOT NULL DEFAULT 0 COMMENT 'Total Metamatter amount ever bought'", !$update_tables['users']['metamatter_total']); |
630 | 630 | |
631 | 631 | upd_do_query( |
@@ -637,11 +637,11 @@ discard block |
||
637 | 637 | (SELECT IF(sum(amount) IS NULL, 0, sum(amount)) FROM {{log_metamatter}} AS mm WHERE mm.user_id = u.id AND mm.amount > 0) |
638 | 638 | );"); |
639 | 639 | } |
640 | - if(!isset($update_tables['users']['immortal'])) { |
|
640 | + if (!isset($update_tables['users']['immortal'])) { |
|
641 | 641 | upd_alter_table('users', "ADD COLUMN `immortal` TIMESTAMP NULL", !isset($update_tables['users']['immortal'])); |
642 | 642 | upd_do_query("UPDATE {{users}} SET `immortal` = NOW() WHERE `metamatter_total` > 0;"); |
643 | 643 | } |
644 | - if(isset($update_tables['player_award'])) { |
|
644 | + if (isset($update_tables['player_award'])) { |
|
645 | 645 | upd_do_query( |
646 | 646 | "UPDATE {{users}} AS u JOIN {{player_award}} AS pa ON u.id = pa.player_id |
647 | 647 | SET metamatter_total = 1, immortal = NOW() |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | CONSTRAINT `FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `{{users}}` (`id`) ON DELETE CASCADE ON UPDATE CASCADE |
669 | 669 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"); |
670 | 670 | |
671 | - if(empty($update_tables['blitz_statpoints'])) { |
|
671 | + if (empty($update_tables['blitz_statpoints'])) { |
|
672 | 672 | upd_create_table('blitz_statpoints', " ( |
673 | 673 | `stat_date` int(11) NOT NULL DEFAULT '0', |
674 | 674 | `id_owner` bigint(20) unsigned DEFAULT NULL, |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | CONSTRAINT `FK_survey_votes_survey_parent_id` FOREIGN KEY (`survey_parent_id`) REFERENCES `{{survey}}` (`survey_id`) ON DELETE CASCADE ON UPDATE CASCADE |
737 | 737 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;"); |
738 | 738 | |
739 | - if(empty($update_tables['security_url'])) { |
|
739 | + if (empty($update_tables['security_url'])) { |
|
740 | 740 | upd_create_table('security_url', " ( |
741 | 741 | `url_id` int unsigned NOT NULL AUTO_INCREMENT, |
742 | 742 | `url_string` VARCHAR(250) NOT NULL DEFAULT '', |
@@ -749,9 +749,9 @@ discard block |
||
749 | 749 | |
750 | 750 | $strings = array(); |
751 | 751 | $query = doquery($query); |
752 | - while($row = db_fetch($query)) { |
|
752 | + while ($row = db_fetch($query)) { |
|
753 | 753 | $strings[] = '("' . db_escape($row['url']) . '")'; |
754 | - if(count($strings) > 100) { |
|
754 | + if (count($strings) > 100) { |
|
755 | 755 | doquery($query_string . implode(',', $strings)); |
756 | 756 | $strings = array(); |
757 | 757 | } |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | !empty($strings) ? doquery($query_string . implode(',', $strings)) : false; |
760 | 760 | } |
761 | 761 | |
762 | - if(isset($update_tables['counter']['page'])) // TODO REMOVE |
|
762 | + if (isset($update_tables['counter']['page'])) // TODO REMOVE |
|
763 | 763 | { |
764 | 764 | update_security_url("SELECT DISTINCT `page` as url FROM {{counter}}"); |
765 | 765 | update_security_url("SELECT DISTINCT `url` as url FROM {{counter}}"); |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | "ADD CONSTRAINT `FK_counter_page_url_id` FOREIGN KEY (`page_url_id`) REFERENCES `{{security_url}}` (`url_id`) ON DELETE CASCADE ON UPDATE CASCADE", |
785 | 785 | "ADD CONSTRAINT `FK_counter_plain_url_id` FOREIGN KEY (`plain_url_id`) REFERENCES `{{security_url}}` (`url_id`) ON DELETE CASCADE ON UPDATE CASCADE", |
786 | 786 | ), !isset($update_tables['counter']['device_id'])); |
787 | - if(isset($update_tables['counter']['ip'])) { |
|
787 | + if (isset($update_tables['counter']['ip'])) { |
|
788 | 788 | // upd_do_query('UPDATE `{{counter}}` SET `user_ip` = INET_ATON(`ip`), `user_proxy` = `proxy`, `visit_time` = FROM_UNIXTIME(`time`)'); |
789 | 789 | upd_do_query('UPDATE `{{counter}}` SET `user_ip` = INET_ATON(`ip`), `visit_time` = FROM_UNIXTIME(`time`)'); |
790 | 790 | upd_do_query('UPDATE `{{counter}}` AS c JOIN {{security_url}} AS u ON u.url_string = c.page SET c.page_url_id = u.url_id'); |
@@ -835,8 +835,8 @@ discard block |
||
835 | 835 | |
836 | 836 | upd_check_key('stats_history_days', 14, !$config->stats_history_days); |
837 | 837 | |
838 | - if($config->payment_currency_default != 'USD') { |
|
839 | - upd_check_key('payment_currency_default', 'USD', true); |
|
838 | + if ($config->payment_currency_default != 'USD') { |
|
839 | + upd_check_key('payment_currency_default', 'USD', true); |
|
840 | 840 | upd_check_key('payment_currency_exchange_dm_', 20000, true); |
841 | 841 | upd_check_key('payment_currency_exchange_mm_', 20000, true); |
842 | 842 | upd_check_key('payment_currency_exchange_usd', 1, true); |
@@ -918,7 +918,7 @@ discard block |
||
918 | 918 | function propagade_player_options($old_option_name, $new_option_id) { |
919 | 919 | global $update_tables; |
920 | 920 | |
921 | - if(!empty($update_tables['users'][$old_option_name])) { |
|
921 | + if (!empty($update_tables['users'][$old_option_name])) { |
|
922 | 922 | upd_do_query( |
923 | 923 | "REPLACE INTO {{player_options}} (`player_id`, `option_id`, `value`) |
924 | 924 | SELECT `id`, {$new_option_id}, `{$old_option_name}` |
@@ -952,7 +952,7 @@ discard block |
||
952 | 952 | |
953 | 953 | // 2015-08-03 15:05:26 40a6.0 |
954 | 954 | |
955 | - if(empty($update_tables['planets']['position_original'])) { |
|
955 | + if (empty($update_tables['planets']['position_original'])) { |
|
956 | 956 | upd_alter_table('planets', array( |
957 | 957 | "ADD COLUMN `position_original` smallint NOT NULL DEFAULT 0", |
958 | 958 | "ADD COLUMN `field_max_original` smallint NOT NULL DEFAULT 0", |
@@ -980,12 +980,12 @@ discard block |
||
980 | 980 | // 2015-08-27 19:14:05 40a10.0 |
981 | 981 | |
982 | 982 | // Старая версия таблицы |
983 | - if(!empty($update_tables['account']['account_is_global']) || empty($update_tables['account']['account_immortal'])) { |
|
983 | + if (!empty($update_tables['account']['account_is_global']) || empty($update_tables['account']['account_immortal'])) { |
|
984 | 984 | upd_drop_table('account'); |
985 | 985 | upd_drop_table('account_translate'); |
986 | 986 | } |
987 | 987 | |
988 | - if(empty($update_tables['account'])) { |
|
988 | + if (empty($update_tables['account'])) { |
|
989 | 989 | upd_create_table('account', " ( |
990 | 990 | `account_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
991 | 991 | `account_name` varchar(32) CHARACTER SET utf8 NOT NULL DEFAULT '', |
@@ -1043,7 +1043,7 @@ discard block |
||
1043 | 1043 | upd_alter_table('security_url', "MODIFY COLUMN `url_string` VARCHAR(250) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ''", empty($update_tables['security_url']['ube_report_capture_result'])); |
1044 | 1044 | |
1045 | 1045 | // 2015-09-24 11:39:37 40a10.25 |
1046 | - if(empty($update_tables['log_metamatter']['provider_id'])) { |
|
1046 | + if (empty($update_tables['log_metamatter']['provider_id'])) { |
|
1047 | 1047 | upd_alter_table('log_metamatter', array( |
1048 | 1048 | "ADD COLUMN `provider_id` tinyint unsigned NOT NULL DEFAULT " . ACCOUNT_PROVIDER_LOCAL . " COMMENT 'Account provider'", |
1049 | 1049 | "ADD COLUMN `account_id` bigint(20) unsigned NOT NULL DEFAULT 0", |
@@ -1093,7 +1093,7 @@ discard block |
||
1093 | 1093 | upd_check_key('event_halloween_2015_code', '', !isset($config->event_halloween_2015_code)); |
1094 | 1094 | upd_check_key('event_halloween_2015_timestamp', SN_TIME_SQL, !isset($config->event_halloween_2015_timestamp)); |
1095 | 1095 | upd_check_key('event_halloween_2015_units_used', serialize(array()), !isset($config->event_halloween_2015_units_used)); |
1096 | - if(empty($update_tables['log_halloween_2015'])) { |
|
1096 | + if (empty($update_tables['log_halloween_2015'])) { |
|
1097 | 1097 | upd_create_table('log_halloween_2015', " ( |
1098 | 1098 | `log_hw2015_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
1099 | 1099 | `player_id` bigint(20) unsigned NOT NULL COMMENT 'User ID', |
@@ -1107,7 +1107,7 @@ discard block |
||
1107 | 1107 | } |
1108 | 1108 | |
1109 | 1109 | // 2015-11-28 06:30:27 40a19.21 |
1110 | - if(!isset($update_tables['ube_report']['ube_report_debris_total_in_metal'])) { |
|
1110 | + if (!isset($update_tables['ube_report']['ube_report_debris_total_in_metal'])) { |
|
1111 | 1111 | upd_alter_table('ube_report', array( |
1112 | 1112 | "ADD COLUMN `ube_report_debris_total_in_metal` DECIMAL(65,0) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Total debris in metal'", |
1113 | 1113 | // "ADD KEY `I_ube_report_debris_id` (`ube_report_debris_total_in_metal` DESC, `ube_report_id` ASC)", // For Best Battles module |
@@ -1122,7 +1122,7 @@ discard block |
||
1122 | 1122 | } |
1123 | 1123 | |
1124 | 1124 | // 2015-12-06 15:10:58 40b1.0 |
1125 | - if(!empty($update_indexes['planets']['I_metal_mine'])) { |
|
1125 | + if (!empty($update_indexes['planets']['I_metal_mine'])) { |
|
1126 | 1126 | upd_alter_table('planets', "DROP KEY `I_metal`", $update_indexes['planets']['I_metal']); |
1127 | 1127 | upd_alter_table('planets', "DROP KEY `I_ship_sattelite_sloth`", $update_indexes['planets']['I_ship_sattelite_sloth']); |
1128 | 1128 | upd_alter_table('planets', "DROP KEY `I_ship_bomber_envy`", $update_indexes['planets']['I_ship_bomber_envy']); |
@@ -1187,7 +1187,7 @@ discard block |
||
1187 | 1187 | case 40: |
1188 | 1188 | upd_log_version_update(); |
1189 | 1189 | |
1190 | - if(empty($update_tables['festival'])) { |
|
1190 | + if (empty($update_tables['festival'])) { |
|
1191 | 1191 | upd_create_table('festival', " ( |
1192 | 1192 | `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
1193 | 1193 | `start` datetime NOT NULL COMMENT 'Festival start datetime', |
@@ -1228,7 +1228,7 @@ discard block |
||
1228 | 1228 | ); |
1229 | 1229 | } |
1230 | 1230 | |
1231 | - if(empty($update_tables['festival_unit'])) { |
|
1231 | + if (empty($update_tables['festival_unit'])) { |
|
1232 | 1232 | upd_create_table('festival_unit', " ( |
1233 | 1233 | `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
1234 | 1234 | `highspot_id` int(10) unsigned DEFAULT NULL, |
@@ -1245,7 +1245,7 @@ discard block |
||
1245 | 1245 | } |
1246 | 1246 | |
1247 | 1247 | // 2015-12-21 06:06:09 41a0.12 |
1248 | - if(empty($update_tables['festival_unit_log'])) { |
|
1248 | + if (empty($update_tables['festival_unit_log'])) { |
|
1249 | 1249 | upd_create_table('festival_unit_log', " ( |
1250 | 1250 | `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
1251 | 1251 | `highspot_id` int(10) unsigned DEFAULT NULL, |
@@ -1273,13 +1273,13 @@ discard block |
||
1273 | 1273 | $update_tables['security_browser']['browser_user_agent']['Collation'] == 'latin1_bin' |
1274 | 1274 | ); |
1275 | 1275 | |
1276 | - if($update_indexes_full['security_browser']['I_browser_user_agent']['browser_user_agent']['Index_type'] == 'BTREE') { |
|
1276 | + if ($update_indexes_full['security_browser']['I_browser_user_agent']['browser_user_agent']['Index_type'] == 'BTREE') { |
|
1277 | 1277 | upd_alter_table('security_browser', "DROP KEY `I_browser_user_agent`", true); |
1278 | 1278 | upd_alter_table('security_browser', "ADD KEY `I_browser_user_agent` (`browser_user_agent`) USING HASH", true); |
1279 | 1279 | } |
1280 | 1280 | |
1281 | 1281 | // 2016-12-03 20:36:46 41a61.0 |
1282 | - if(empty($update_tables['auth_vkontakte_account'])) { |
|
1282 | + if (empty($update_tables['auth_vkontakte_account'])) { |
|
1283 | 1283 | upd_create_table('auth_vkontakte_account', " ( |
1284 | 1284 | `user_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
1285 | 1285 | `access_token` varchar(250) NOT NULL DEFAULT '', |
@@ -1321,7 +1321,7 @@ discard block |
||
1321 | 1321 | |
1322 | 1322 | classSupernova::$cache->unset_by_prefix('lng_'); |
1323 | 1323 | |
1324 | -if($new_version) { |
|
1324 | +if ($new_version) { |
|
1325 | 1325 | $config->db_saveItem('db_version', $new_version); |
1326 | 1326 | upd_log_message("<font color=green>DB version is now {$new_version}</font>"); |
1327 | 1327 | } else { |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $uni_system = sys_get_param_int('system', $planetrow['system']); |
31 | 31 | $planet = sys_get_param_int('planet', $planetrow['planet']); |
32 | 32 | |
33 | -if($mode == 'name') { |
|
33 | +if ($mode == 'name') { |
|
34 | 34 | require_once('includes/includes/uni_rename.php'); |
35 | 35 | } |
36 | 36 | |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | |
82 | 82 | $planet_precache_query = DBStaticPlanet::db_planet_list_in_system($uni_galaxy, $uni_system); |
83 | 83 | // while($planet_row = db_fetch($planet_precache_query)) |
84 | -if(!empty($planet_precache_query)) |
|
85 | -foreach($planet_precache_query as $planet_row) |
|
84 | +if (!empty($planet_precache_query)) |
|
85 | +foreach ($planet_precache_query as $planet_row) |
|
86 | 86 | { |
87 | 87 | $planet_list[$planet_row['planet']][$planet_row['planet_type']] = $planet_row; |
88 | 88 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | // $fleet_list[$fleet_planet][$fleet_type][] = $fleet_row; |
102 | 102 | //} |
103 | 103 | $system_fleet_list = fleet_list_by_planet_coords($uni_galaxy, $uni_system); |
104 | -foreach($system_fleet_list as $fleet_row) { |
|
104 | +foreach ($system_fleet_list as $fleet_row) { |
|
105 | 105 | $fleet_planet = $fleet_row['fleet_mess'] == 0 ? $fleet_row['fleet_end_planet'] : $fleet_row['fleet_start_planet']; |
106 | 106 | $fleet_type = $fleet_row['fleet_mess'] == 0 ? $fleet_row['fleet_end_type'] : $fleet_row['fleet_start_type']; |
107 | 107 | $fleet_list[$fleet_planet][$fleet_type][] = $fleet_row; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $recycler_info = array(); |
113 | 113 | $planet_recyclers_orbiting = 0; |
114 | 114 | $recyclers_fleet = array(); |
115 | -foreach(sn_get_groups('flt_recyclers') as $recycler_id) |
|
115 | +foreach (sn_get_groups('flt_recyclers') as $recycler_id) |
|
116 | 116 | { |
117 | 117 | $recycler_info[$recycler_id] = get_ship_data($recycler_id, $user); |
118 | 118 | $recyclers_fleet[$recycler_id] = mrc_get_level($user, $planetrow, $recycler_id); |
@@ -139,11 +139,11 @@ discard block |
||
139 | 139 | $planet_fleet_id = 0; |
140 | 140 | if ($uni_galaxyRowPlanet['destruyed']) |
141 | 141 | { |
142 | - CheckAbandonPlanetState ($uni_galaxyRowPlanet); |
|
142 | + CheckAbandonPlanetState($uni_galaxyRowPlanet); |
|
143 | 143 | } |
144 | - elseif($uni_galaxyRowPlanet['id']) |
|
144 | + elseif ($uni_galaxyRowPlanet['id']) |
|
145 | 145 | { |
146 | - if($cached['users'][$uni_galaxyRowPlanet['id_owner']]) |
|
146 | + if ($cached['users'][$uni_galaxyRowPlanet['id_owner']]) |
|
147 | 147 | { |
148 | 148 | $uni_galaxyRowUser = $cached['users'][$uni_galaxyRowPlanet['id_owner']]; |
149 | 149 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $cached['users'][$uni_galaxyRowUser['id']] = $uni_galaxyRowUser; |
154 | 154 | } |
155 | 155 | |
156 | - if(!$uni_galaxyRowUser['id']) |
|
156 | + if (!$uni_galaxyRowUser['id']) |
|
157 | 157 | { |
158 | 158 | $debug->warning("Planet '{$uni_galaxyRowPlanet['name']}' [{$uni_galaxy}:{$uni_system}:{$Planet}] has no owner!", 'Userless planet', 503); |
159 | 159 | $uni_galaxyRowPlanet['destruyed'] = SN_TIME_NOW + 60 * 60 * 24; |
@@ -161,12 +161,12 @@ discard block |
||
161 | 161 | DBStaticPlanet::db_planet_set_by_id($uni_galaxyRowPlanet['id'], "id_owner = 0, destruyed = {$uni_galaxyRowPlanet['destruyed']}"); |
162 | 162 | } |
163 | 163 | |
164 | - if($uni_galaxyRowUser['id']) |
|
164 | + if ($uni_galaxyRowUser['id']) |
|
165 | 165 | { |
166 | 166 | $planetcount++; |
167 | - if($uni_galaxyRowUser['ally_id']) |
|
167 | + if ($uni_galaxyRowUser['ally_id']) |
|
168 | 168 | { |
169 | - if($cached['allies'][$uni_galaxyRowUser['ally_id']]) |
|
169 | + if ($cached['allies'][$uni_galaxyRowUser['ally_id']]) |
|
170 | 170 | { |
171 | 171 | $allyquery = $cached['allies'][$uni_galaxyRowUser['ally_id']]; |
172 | 172 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | } |
179 | 179 | |
180 | 180 | $fleets_to_planet = flt_get_fleets_to_planet(false, $fleet_list[$Planet][PT_PLANET]); |
181 | - if($fleets_to_planet['own']['count']) |
|
181 | + if ($fleets_to_planet['own']['count']) |
|
182 | 182 | { |
183 | 183 | $planet_fleet_id = $fleet_id; |
184 | 184 | $fleets[] = tpl_parse_fleet_sn($fleets_to_planet['own']['total'], $fleet_id); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | { |
195 | 195 | $moon_fleet_id = 0; |
196 | 196 | $fleets_to_planet = flt_get_fleets_to_planet(false, $fleet_list[$Planet][PT_MOON]); |
197 | - if($fleets_to_planet['own']['count']) |
|
197 | + if ($fleets_to_planet['own']['count']) |
|
198 | 198 | { |
199 | 199 | $moon_fleet_id = $fleet_id; |
200 | 200 | $fleets[] = tpl_parse_fleet_sn($fleets_to_planet['own']['total'], $fleet_id); |
@@ -207,12 +207,12 @@ discard block |
||
207 | 207 | // $recyclers_incoming = 0; |
208 | 208 | $recyclers_incoming_capacity = 0; |
209 | 209 | $uni_galaxyRowPlanet['debris'] = $uni_galaxyRowPlanet['debris_metal'] + $uni_galaxyRowPlanet['debris_crystal']; |
210 | - if($uni_galaxyRowPlanet['debris']) { |
|
211 | - if($fleet_list[$Planet][PT_DEBRIS]) { |
|
212 | - foreach($fleet_list[$Planet][PT_DEBRIS] as $fleet_row) { |
|
213 | - if($fleet_row['fleet_owner'] == $user['id']) { |
|
210 | + if ($uni_galaxyRowPlanet['debris']) { |
|
211 | + if ($fleet_list[$Planet][PT_DEBRIS]) { |
|
212 | + foreach ($fleet_list[$Planet][PT_DEBRIS] as $fleet_row) { |
|
213 | + if ($fleet_row['fleet_owner'] == $user['id']) { |
|
214 | 214 | $fleet_data = sys_unit_str2arr($fleet_row['fleet_array']); |
215 | - foreach($recycler_info as $recycler_id => $recycler_data) { |
|
215 | + foreach ($recycler_info as $recycler_id => $recycler_data) { |
|
216 | 216 | $recyclers_incoming_capacity += $fleet_data[$recycler_id] * $recycler_data['capacity']; |
217 | 217 | } |
218 | 218 | } |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | |
237 | 237 | $RowUserPoints = $uni_galaxyRowUser['total_points']; |
238 | 238 | $birthday_array = $uni_galaxyRowUser['user_birthday'] ? date_parse($uni_galaxyRowUser['user_birthday']) : array(); |
239 | - $user_activity = floor((SN_TIME_NOW - $uni_galaxyRowUser['onlinetime'])/(60*60*24)); |
|
239 | + $user_activity = floor((SN_TIME_NOW - $uni_galaxyRowUser['onlinetime']) / (60 * 60 * 24)); |
|
240 | 240 | $template->assign_block_vars('galaxyrow', array( |
241 | 241 | 'PLANET_ID' => $uni_galaxyRowPlanet['id'], |
242 | 242 | 'PLANET_NUM' => $Planet, |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | 'PLANET_NAME_JS' => js_safe_string($uni_galaxyRowPlanet['name']), |
245 | 245 | 'PLANET_DESTROYED' => $uni_galaxyRowPlanet["destruyed"], |
246 | 246 | 'PLANET_TYPE' => $uni_galaxyRowPlanet["planet_type"], |
247 | - 'PLANET_ACTIVITY' => floor((SN_TIME_NOW - $uni_galaxyRowPlanet['last_update'])/60), |
|
247 | + 'PLANET_ACTIVITY' => floor((SN_TIME_NOW - $uni_galaxyRowPlanet['last_update']) / 60), |
|
248 | 248 | 'PLANET_IMAGE' => $uni_galaxyRowPlanet['image'], |
249 | 249 | 'PLANET_FLEET_ID' => $planet_fleet_id, |
250 | 250 | 'PLANET_DIAMETER' => number_format($uni_galaxyRowPlanet['diameter'], 0, '', '.'), |
@@ -290,21 +290,21 @@ discard block |
||
290 | 290 | |
291 | 291 | tpl_assign_fleet($template, $fleets); |
292 | 292 | |
293 | -foreach(sn_get_groups('defense_active') as $unit_id) { |
|
293 | +foreach (sn_get_groups('defense_active') as $unit_id) { |
|
294 | 294 | $template->assign_block_vars('defense_active', array( |
295 | 295 | 'ID' => $unit_id, |
296 | 296 | 'NAME' => $lang['tech'][$unit_id], |
297 | 297 | )); |
298 | 298 | } |
299 | 299 | |
300 | -foreach($cached['users'] as $PlanetUser) { |
|
301 | - if(!$PlanetUser) { |
|
300 | +foreach ($cached['users'] as $PlanetUser) { |
|
301 | + if (!$PlanetUser) { |
|
302 | 302 | continue; |
303 | 303 | } |
304 | 304 | |
305 | 305 | $user_ally = $cached['allies'][$PlanetUser['ally_id']]; |
306 | - if(isset($user_ally)) { |
|
307 | - if($PlanetUser['id'] == $user_ally['ally_owner']) { |
|
306 | + if (isset($user_ally)) { |
|
307 | + if ($PlanetUser['id'] == $user_ally['ally_owner']) { |
|
308 | 308 | $user_rank_title = $user_ally['ally_owner_range']; |
309 | 309 | } else { |
310 | 310 | $ally_ranks = explode(';', $user_ally['ranklist']); |
@@ -327,9 +327,9 @@ discard block |
||
327 | 327 | )); |
328 | 328 | } |
329 | 329 | |
330 | -foreach($cached['allies'] as $PlanetAlly) |
|
330 | +foreach ($cached['allies'] as $PlanetAlly) |
|
331 | 331 | { |
332 | - if($PlanetAlly) |
|
332 | + if ($PlanetAlly) |
|
333 | 333 | { |
334 | 334 | $template->assign_block_vars('alliances', array( |
335 | 335 | 'ID' => $PlanetAlly['id'], |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | ) |
400 | 400 | ); |
401 | 401 | |
402 | -if($scan) { |
|
402 | +if ($scan) { |
|
403 | 403 | $template->assign_vars(array( |
404 | 404 | 'MENU' => false, |
405 | 405 | 'NAVBAR' => false, |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | |
23 | 23 | $sn_group_artifacts = sn_get_groups('artifacts'); |
24 | 24 | |
25 | -if(($action = sys_get_param_int('action')) && in_array($unit_id = sys_get_param_int('unit_id'), $sn_group_artifacts)) |
|
25 | +if (($action = sys_get_param_int('action')) && in_array($unit_id = sys_get_param_int('unit_id'), $sn_group_artifacts)) |
|
26 | 26 | { |
27 | - switch($action) |
|
27 | + switch ($action) |
|
28 | 28 | { |
29 | 29 | case ACTION_BUY: |
30 | 30 | sn_db_transaction_start(); |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | $darkmater_cost = $build_data[BUILD_CREATE][RES_DARK_MATTER]; |
37 | 37 | |
38 | 38 | // TODO: more correct check - with "FOR UPDATE" |
39 | - if(mrc_get_level($user, null, RES_DARK_MATTER) >= $darkmater_cost) |
|
39 | + if (mrc_get_level($user, null, RES_DARK_MATTER) >= $darkmater_cost) |
|
40 | 40 | { |
41 | 41 | $unit_max_stack = get_unit_param($unit_id, P_MAX_STACK); |
42 | - if(!isset($unit_max_stack) || $unit_max_stack > mrc_get_level($user, $planetrow, $unit_id)) |
|
42 | + if (!isset($unit_max_stack) || $unit_max_stack > mrc_get_level($user, $planetrow, $unit_id)) |
|
43 | 43 | { |
44 | 44 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, 1, $user); |
45 | 45 | OldDbChangeSet::db_changeset_apply($db_changeset); |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | $template = gettemplate('artifacts', true); |
75 | 75 | |
76 | -foreach($sn_group_artifacts as $artifact_id) |
|
76 | +foreach ($sn_group_artifacts as $artifact_id) |
|
77 | 77 | { |
78 | 78 | $artifact_level = mrc_get_level($user, array(), $artifact_id, true); |
79 | 79 | $build_data = eco_get_build_data($user, $planetrow, $artifact_id, $artifact_level); |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $artifact_data = get_unit_param($artifact_id); |
82 | 82 | $artifact_data_bonus = $artifact_data['bonus']; |
83 | 83 | $artifact_data_bonus = $artifact_data_bonus >= 0 ? "+{$artifact_data_bonus}" : "{$artifact_data_bonus}"; |
84 | - switch($artifact_data['bonus_type']) |
|
84 | + switch ($artifact_data['bonus_type']) |
|
85 | 85 | { |
86 | 86 | case BONUS_PERCENT: |
87 | 87 | $artifact_data_bonus = "{$artifact_data_bonus}% "; |
@@ -29,14 +29,14 @@ discard block |
||
29 | 29 | 'planet' => $target_planet = sys_get_param_int('planet'), |
30 | 30 | ); |
31 | 31 | |
32 | -if(!uni_coordinates_valid($target_coord)) |
|
32 | +if (!uni_coordinates_valid($target_coord)) |
|
33 | 33 | { |
34 | 34 | die($lang['gs_c02']); |
35 | 35 | } |
36 | 36 | |
37 | 37 | $target_mission = sys_get_param_int('mission'); |
38 | 38 | $sn_group_missions = sn_get_groups('missions'); |
39 | -if(!isset($sn_group_missions[$target_mission]['AJAX']) || !$sn_group_missions[$target_mission]['AJAX']) |
|
39 | +if (!isset($sn_group_missions[$target_mission]['AJAX']) || !$sn_group_missions[$target_mission]['AJAX']) |
|
40 | 40 | { |
41 | 41 | die($lang['gs_c00']); |
42 | 42 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $target_coord['planet_type'] = $target_planet_check; |
53 | 53 | $target_row = DBStaticPlanet::db_planet_by_vector($target_coord); |
54 | 54 | |
55 | -if(empty($target_row)) |
|
55 | +if (empty($target_row)) |
|
56 | 56 | { |
57 | 57 | $target_row = array( |
58 | 58 | 'galaxy' => $target_coord['galaxy'], |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | } |
65 | 65 | |
66 | 66 | $fleet_array = array(); |
67 | -switch($target_mission) |
|
67 | +switch ($target_mission) |
|
68 | 68 | { |
69 | 69 | case MT_SPY: |
70 | 70 | // $fleet_array[SHIP_SPY] = min(mrc_get_level($user, $planetrow, SHIP_SPY), abs($user['spio_anz'])); |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | break; |
74 | 74 | |
75 | 75 | case MT_RECYCLE: |
76 | - foreach(sn_get_groups('flt_recyclers') as $unit_id) |
|
76 | + foreach (sn_get_groups('flt_recyclers') as $unit_id) |
|
77 | 77 | { |
78 | - if($unit_count = mrc_get_level($user, $planetrow, $unit_id)) |
|
78 | + if ($unit_count = mrc_get_level($user, $planetrow, $unit_id)) |
|
79 | 79 | { |
80 | 80 | $fleet_array[$unit_id] = $unit_count; |
81 | 81 | } |
@@ -96,14 +96,14 @@ discard block |
||
96 | 96 | $cant_attack = flt_can_attack($planetrow, $target_row, $fleet_array, $target_mission, $options); |
97 | 97 | |
98 | 98 | |
99 | -if($cant_attack != ATTACK_ALLOWED) |
|
99 | +if ($cant_attack != ATTACK_ALLOWED) |
|
100 | 100 | { |
101 | 101 | die($lang['fl_attack_error'][$cant_attack]); |
102 | 102 | } |
103 | 103 | |
104 | -$FleetDBArray = array(); |
|
104 | +$FleetDBArray = array(); |
|
105 | 105 | $db_changeset = array(); |
106 | -foreach($fleet_array as $unit_id => $unit_count) |
|
106 | +foreach ($fleet_array as $unit_id => $unit_count) |
|
107 | 107 | { |
108 | 108 | $FleetDBArray[] = "{$unit_id},{$unit_count}"; |
109 | 109 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($unit_id, -$unit_count, $user, $planetrow); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | $fleet_ship_count = array_sum($fleet_array); |
114 | 114 | |
115 | -if($target_mission == MT_MISSILE) |
|
115 | +if ($target_mission == MT_MISSILE) |
|
116 | 116 | { |
117 | 117 | $distance = abs($target_coord['system'] - $planetrow['system']); |
118 | 118 | $duration = round((30 + (60 * $distance)) / flt_server_flight_speed_multiplier()); |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | { |
131 | 131 | $travel_data = flt_travel_data($user, $planetrow, $target_coord, $fleet_array, 10); |
132 | 132 | |
133 | - if($planetrow['deuterium'] < $travel_data['consumption']) |
|
133 | + if ($planetrow['deuterium'] < $travel_data['consumption']) |
|
134 | 134 | { |
135 | 135 | die($lang['gs_c13']); |
136 | 136 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | $ships_sent = array(); |
190 | 190 | //$ships_sent_js = array(); |
191 | 191 | $ships_sent_js = 0; |
192 | -foreach($fleet_array as $unit_id => $unit_count) |
|
192 | +foreach ($fleet_array as $unit_id => $unit_count) |
|
193 | 193 | { |
194 | 194 | $ships_sent[] = "{$unit_count} {$lang['tech'][$unit_id]}"; |
195 | 195 | $ships_sent_js += mrc_get_level($user, $planetrow, $unit_id, false, true); |
@@ -198,6 +198,6 @@ discard block |
||
198 | 198 | //$ships_sent_js = implode(',', $ships_sent_js); |
199 | 199 | $ships_sent_js = "{$unit_group}={$ships_sent_js}"; |
200 | 200 | |
201 | -$ResultMessage = "{$lang['gs_sending']} {$ships_sent} {$lang['gs_to']} {$target_coord['galaxy']}:{$target_coord['system']}:{$target_coord['planet']}|{$ships_sent_js}"; |
|
201 | +$ResultMessage = "{$lang['gs_sending']} {$ships_sent} {$lang['gs_to']} {$target_coord['galaxy']}:{$target_coord['system']}:{$target_coord['planet']}|{$ships_sent_js}"; |
|
202 | 202 | |
203 | 203 | die($ResultMessage); |
@@ -18,39 +18,39 @@ discard block |
||
18 | 18 | { |
19 | 19 | sn_db_transaction_start(); |
20 | 20 | |
21 | - if($buddy_id = sys_get_param_id('buddy_id')) |
|
21 | + if ($buddy_id = sys_get_param_id('buddy_id')) |
|
22 | 22 | { |
23 | 23 | $buddy_row = doquery("SELECT BUDDY_SENDER_ID, BUDDY_OWNER_ID, BUDDY_STATUS FROM {{buddy}} WHERE `BUDDY_ID` = {$buddy_id} LIMIT 1 FOR UPDATE;", true); |
24 | - if(!is_array($buddy_row)) |
|
24 | + if (!is_array($buddy_row)) |
|
25 | 25 | { |
26 | 26 | throw new exception('buddy_err_not_exist', ERR_ERROR); |
27 | 27 | } |
28 | 28 | |
29 | - switch($mode = sys_get_param_str('mode')) |
|
29 | + switch ($mode = sys_get_param_str('mode')) |
|
30 | 30 | { |
31 | 31 | case 'accept': |
32 | - if($buddy_row['BUDDY_SENDER_ID'] == $user['id']) |
|
32 | + if ($buddy_row['BUDDY_SENDER_ID'] == $user['id']) |
|
33 | 33 | { |
34 | 34 | throw new exception('buddy_err_accept_own', ERR_ERROR); |
35 | 35 | } |
36 | 36 | |
37 | - if($buddy_row['BUDDY_OWNER_ID'] != $user['id']) |
|
37 | + if ($buddy_row['BUDDY_OWNER_ID'] != $user['id']) |
|
38 | 38 | { |
39 | 39 | throw new exception('buddy_err_accept_alien', ERR_ERROR); |
40 | 40 | } |
41 | 41 | |
42 | - if($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) |
|
42 | + if ($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) |
|
43 | 43 | { |
44 | 44 | throw new exception('buddy_err_accept_already', ERR_WARNING); |
45 | 45 | } |
46 | 46 | |
47 | - if($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_DENIED) |
|
47 | + if ($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_DENIED) |
|
48 | 48 | { |
49 | 49 | throw new exception('buddy_err_accept_denied', ERR_ERROR); |
50 | 50 | } |
51 | 51 | |
52 | 52 | doquery("UPDATE {{buddy}} SET `BUDDY_STATUS` = " . BUDDY_REQUEST_ACTIVE . " WHERE `BUDDY_ID` = {$buddy_id} LIMIT 1;"); |
53 | - if(classSupernova::$db->db_affected_rows()) |
|
53 | + if (classSupernova::$db->db_affected_rows()) |
|
54 | 54 | { |
55 | 55 | msg_send_simple_message($buddy_row['BUDDY_SENDER_ID'], $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, $user['username'], $lang['buddy_msg_accept_title'], |
56 | 56 | sprintf($lang['buddy_msg_accept_text'], $user['username'])); |
@@ -64,12 +64,12 @@ discard block |
||
64 | 64 | break; |
65 | 65 | |
66 | 66 | case 'delete': |
67 | - if($buddy_row['BUDDY_SENDER_ID'] != $user['id'] && $buddy_row['BUDDY_OWNER_ID'] != $user['id']) |
|
67 | + if ($buddy_row['BUDDY_SENDER_ID'] != $user['id'] && $buddy_row['BUDDY_OWNER_ID'] != $user['id']) |
|
68 | 68 | { |
69 | 69 | throw new exception('buddy_err_delete_alien', ERR_ERROR); |
70 | 70 | } |
71 | 71 | |
72 | - if($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) // Existing friendship |
|
72 | + if ($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) // Existing friendship |
|
73 | 73 | { |
74 | 74 | $ex_friend_id = $buddy_row['BUDDY_SENDER_ID'] == $user['id'] ? $buddy_row['BUDDY_OWNER_ID'] : $buddy_row['BUDDY_SENDER_ID']; |
75 | 75 | |
@@ -80,13 +80,13 @@ discard block |
||
80 | 80 | sn_db_transaction_commit(); |
81 | 81 | throw new exception('buddy_err_unfriend_none', ERR_NONE); |
82 | 82 | } |
83 | - elseif($buddy_row['BUDDY_SENDER_ID'] == $user['id']) // Player's outcoming request - either denied or waiting |
|
83 | + elseif ($buddy_row['BUDDY_SENDER_ID'] == $user['id']) // Player's outcoming request - either denied or waiting |
|
84 | 84 | { |
85 | 85 | doquery("DELETE FROM {{buddy}} WHERE `BUDDY_ID` = {$buddy_id} LIMIT 1;"); |
86 | 86 | sn_db_transaction_commit(); |
87 | 87 | throw new exception('buddy_err_delete_own', ERR_NONE); |
88 | 88 | } |
89 | - elseif($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_WAITING) // Deny incoming request |
|
89 | + elseif ($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_WAITING) // Deny incoming request |
|
90 | 90 | { |
91 | 91 | msg_send_simple_message($buddy_row['BUDDY_SENDER_ID'], $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, $user['username'], $lang['buddy_msg_deny_title'], |
92 | 92 | sprintf($lang['buddy_msg_deny_text'], $user['username'])); |
@@ -101,24 +101,24 @@ discard block |
||
101 | 101 | |
102 | 102 | // New request? |
103 | 103 | // Checking for user ID - in case if it was request from outside buddy system |
104 | - if($new_friend_id = sys_get_param_id('request_user_id')) |
|
104 | + if ($new_friend_id = sys_get_param_id('request_user_id')) |
|
105 | 105 | { |
106 | 106 | $new_friend_row = db_user_by_id($new_friend_id, true, '`id`, `username`'); |
107 | 107 | } |
108 | - elseif($new_friend_name = sys_get_param_str_unsafe('request_user_name')) |
|
108 | + elseif ($new_friend_name = sys_get_param_str_unsafe('request_user_name')) |
|
109 | 109 | { |
110 | 110 | $new_friend_row = db_user_by_username($new_friend_name, true, '`id`, `username`'); |
111 | 111 | $new_friend_name = db_escape($new_friend_name); |
112 | 112 | } |
113 | 113 | |
114 | - if($new_friend_row['id'] == $user['id']) |
|
114 | + if ($new_friend_row['id'] == $user['id']) |
|
115 | 115 | { |
116 | 116 | unset($new_friend_row); |
117 | 117 | throw new exception('buddy_err_adding_self', ERR_ERROR); |
118 | 118 | } |
119 | 119 | |
120 | 120 | // Checking for user name & request text - in case if it was request to adding new request |
121 | - if(isset($new_friend_row['id']) && ($new_request_text = sys_get_param_str('request_text'))) |
|
121 | + if (isset($new_friend_row['id']) && ($new_request_text = sys_get_param_str('request_text'))) |
|
122 | 122 | { |
123 | 123 | $check_relation = doquery("SELECT `BUDDY_ID` FROM {{buddy}} WHERE |
124 | 124 | (`BUDDY_SENDER_ID` = {$user['id']} AND `BUDDY_OWNER_ID` = {$new_friend_row['id']}) |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | (`BUDDY_SENDER_ID` = {$new_friend_row['id']} AND `BUDDY_OWNER_ID` = {$user['id']}) |
127 | 127 | LIMIT 1 FOR UPDATE;" |
128 | 128 | , true); |
129 | - if(isset($check_relation['BUDDY_ID'])) |
|
129 | + if (isset($check_relation['BUDDY_ID'])) |
|
130 | 130 | { |
131 | 131 | throw new exception('buddy_err_adding_exists', ERR_WARNING); |
132 | 132 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | throw new exception('buddy_err_adding_none', ERR_NONE); |
140 | 140 | } |
141 | 141 | } |
142 | -catch(exception $e) |
|
142 | +catch (exception $e) |
|
143 | 143 | { |
144 | 144 | $result[] = array( |
145 | 145 | 'STATUS' => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR, |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | sn_db_transaction_rollback(); |
151 | 151 | |
152 | 152 | $query = db_buddy_list_by_user($user['id']); |
153 | -while($row = db_fetch($query)) |
|
153 | +while ($row = db_fetch($query)) |
|
154 | 154 | { |
155 | 155 | $row['BUDDY_REQUEST'] = HelperString::nl2br($row['BUDDY_REQUEST']); |
156 | 156 |