@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * Galaxy view |
7 | 7 | */ |
8 | 8 | |
9 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
9 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
10 | 10 | |
11 | 11 | lng_include('universe'); |
12 | 12 | lng_include('stat'); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | $uni_system = sys_get_param_int('system', $planetrow['system']); |
17 | 17 | $planet = sys_get_param_int('planet', $planetrow['planet']); |
18 | 18 | |
19 | -if($mode == 'name') { |
|
19 | +if ($mode == 'name') { |
|
20 | 20 | require_once('includes/includes/uni_rename.php'); |
21 | 21 | } |
22 | 22 | |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | |
38 | 38 | $flying_fleet_count = FleetList::fleet_count_flying($user['id']); |
39 | 39 | |
40 | -if($mode == 1) { |
|
41 | -} elseif($mode == 2 || $mode == 3) { |
|
40 | +if ($mode == 1) { |
|
41 | +} elseif ($mode == 2 || $mode == 3) { |
|
42 | 42 | $planet = $planetrow['planet']; |
43 | 43 | } else { |
44 | 44 | $uni_galaxy = $planetrow['galaxy']; |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | $planet = $planetrow['planet']; |
47 | 47 | } |
48 | 48 | |
49 | -$uni_galaxy = $uni_galaxy < 1 ? 1 : ($uni_galaxy > Vector::$knownGalaxies? Vector::$knownGalaxies: $uni_galaxy); |
|
49 | +$uni_galaxy = $uni_galaxy < 1 ? 1 : ($uni_galaxy > Vector::$knownGalaxies ? Vector::$knownGalaxies : $uni_galaxy); |
|
50 | 50 | $uni_system = $uni_system < 1 ? 1 : ($uni_system > Vector::$knownSystems ? Vector::$knownSystems : $uni_system); |
51 | 51 | $planet = $planet < 1 ? 1 : ($planet > Vector::$knownPlanets + 1 ? Vector::$knownPlanets + 1 : $planet); |
52 | 52 | |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | $PhalanxRange = GetPhalanxRange($HavePhalanx); |
65 | 65 | |
66 | 66 | $planet_precache_query = DBStaticPlanet::db_planet_list_in_system($uni_galaxy, $uni_system); |
67 | -if(!empty($planet_precache_query)) { |
|
68 | - foreach($planet_precache_query as $planet_row) { |
|
67 | +if (!empty($planet_precache_query)) { |
|
68 | + foreach ($planet_precache_query as $planet_row) { |
|
69 | 69 | $planet_list[$planet_row['planet']][$planet_row['planet_type']] = $planet_row; |
70 | 70 | } |
71 | 71 | } |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | * @var Fleet[][][] $fleet_list |
84 | 84 | */ |
85 | 85 | $fleet_list = array(); |
86 | -foreach($system_fleet_list->_container as $objFleetSystem) { |
|
87 | - if(!$objFleetSystem->isReturning()) { |
|
86 | +foreach ($system_fleet_list->_container as $objFleetSystem) { |
|
87 | + if (!$objFleetSystem->isReturning()) { |
|
88 | 88 | $fleet_planet = $objFleetSystem->fleet_end_planet; |
89 | 89 | $fleet_type = $objFleetSystem->fleet_end_type; |
90 | 90 | } else { |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $recycler_info = array(); |
100 | 100 | $planet_recyclers_orbiting = 0; |
101 | 101 | $recyclers_fleet = array(); |
102 | -foreach(Fleet::$snGroupRecyclers as $recycler_id) { |
|
102 | +foreach (Fleet::$snGroupRecyclers as $recycler_id) { |
|
103 | 103 | $recycler_info[$recycler_id] = get_ship_data($recycler_id, $user); |
104 | 104 | $recyclers_fleet[$recycler_id] = mrc_get_level($user, $planetrow, $recycler_id); |
105 | 105 | $planet_recyclers_orbiting += $recyclers_fleet[$recycler_id]; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | $fleet_id = 1; |
110 | 110 | $fleets = array(); |
111 | 111 | $config_game_max_planet = Vector::$knownPlanets + 1; |
112 | -for($Planet = 1; $Planet < $config_game_max_planet; $Planet++) { |
|
112 | +for ($Planet = 1; $Planet < $config_game_max_planet; $Planet++) { |
|
113 | 113 | unset($uni_galaxyRowPlanet); |
114 | 114 | unset($uni_galaxyRowMoon); |
115 | 115 | unset($uni_galaxyRowUser); |
@@ -119,27 +119,27 @@ discard block |
||
119 | 119 | $uni_galaxyRowPlanet = $planet_list[$Planet][PT_PLANET]; |
120 | 120 | |
121 | 121 | $planet_fleet_id = 0; |
122 | - if($uni_galaxyRowPlanet['destruyed']) { |
|
122 | + if ($uni_galaxyRowPlanet['destruyed']) { |
|
123 | 123 | CheckAbandonPlanetState($uni_galaxyRowPlanet); |
124 | - } elseif($uni_galaxyRowPlanet['id']) { |
|
125 | - if($cached['users'][$uni_galaxyRowPlanet['id_owner']]) { |
|
124 | + } elseif ($uni_galaxyRowPlanet['id']) { |
|
125 | + if ($cached['users'][$uni_galaxyRowPlanet['id_owner']]) { |
|
126 | 126 | $uni_galaxyRowUser = $cached['users'][$uni_galaxyRowPlanet['id_owner']]; |
127 | 127 | } else { |
128 | 128 | $uni_galaxyRowUser = DBStaticUser::db_user_by_id($uni_galaxyRowPlanet['id_owner']); |
129 | 129 | $cached['users'][$uni_galaxyRowUser['id']] = $uni_galaxyRowUser; |
130 | 130 | } |
131 | 131 | |
132 | - if(!$uni_galaxyRowUser['id']) { |
|
132 | + if (!$uni_galaxyRowUser['id']) { |
|
133 | 133 | classSupernova::$debug->warning("Planet '{$uni_galaxyRowPlanet['name']}' [{$uni_galaxy}:{$uni_system}:{$Planet}] has no owner!", 'Userless planet', 503); |
134 | 134 | $uni_galaxyRowPlanet['destruyed'] = SN_TIME_NOW + 60 * 60 * 24; |
135 | 135 | $uni_galaxyRowPlanet['id_owner'] = 0; |
136 | 136 | DBStaticPlanet::db_planet_set_by_id($uni_galaxyRowPlanet['id'], "id_owner = 0, destruyed = {$uni_galaxyRowPlanet['destruyed']}"); |
137 | 137 | } |
138 | 138 | |
139 | - if($uni_galaxyRowUser['id']) { |
|
139 | + if ($uni_galaxyRowUser['id']) { |
|
140 | 140 | $planetcount++; |
141 | - if($uni_galaxyRowUser['ally_id']) { |
|
142 | - if($cached['allies'][$uni_galaxyRowUser['ally_id']]) { |
|
141 | + if ($uni_galaxyRowUser['ally_id']) { |
|
142 | + if ($cached['allies'][$uni_galaxyRowUser['ally_id']]) { |
|
143 | 143 | $allyquery = $cached['allies'][$uni_galaxyRowUser['ally_id']]; |
144 | 144 | } else { |
145 | 145 | $allyquery = DBStaticAlly::db_ally_get_by_id($uni_galaxyRowUser['ally_id']); |
@@ -148,19 +148,19 @@ discard block |
||
148 | 148 | } |
149 | 149 | |
150 | 150 | $fleets_to_planet = flt_get_fleets_to_planet_by_array_of_Fleet($fleet_list[$Planet][PT_PLANET]); |
151 | - if(!empty($fleets_to_planet['own']['count'])) { |
|
151 | + if (!empty($fleets_to_planet['own']['count'])) { |
|
152 | 152 | $planet_fleet_id = $fleet_id; |
153 | 153 | $fleets[] = tpl_parse_fleet_sn($fleets_to_planet['own']['total'], $fleet_id); |
154 | 154 | $fleet_id++; |
155 | 155 | } |
156 | 156 | |
157 | 157 | $uni_galaxyRowMoon = $planet_list[$Planet][PT_MOON]; |
158 | - if($uni_galaxyRowMoon['destruyed']) { |
|
158 | + if ($uni_galaxyRowMoon['destruyed']) { |
|
159 | 159 | CheckAbandonPlanetState($uni_galaxyRowMoon); |
160 | 160 | } else { |
161 | 161 | $moon_fleet_id = 0; |
162 | 162 | $fleets_to_planet = flt_get_fleets_to_planet_by_array_of_Fleet($fleet_list[$Planet][PT_MOON]); |
163 | - if(!empty($fleets_to_planet['own']['count'])) { |
|
163 | + if (!empty($fleets_to_planet['own']['count'])) { |
|
164 | 164 | $moon_fleet_id = $fleet_id; |
165 | 165 | $fleets[] = tpl_parse_fleet_sn($fleets_to_planet['own']['total'], $fleet_id); |
166 | 166 | $fleet_id++; |
@@ -171,10 +171,10 @@ discard block |
||
171 | 171 | |
172 | 172 | $recyclers_incoming_capacity = 0; |
173 | 173 | $uni_galaxyRowPlanet['debris'] = $uni_galaxyRowPlanet['debris_metal'] + $uni_galaxyRowPlanet['debris_crystal']; |
174 | - if($uni_galaxyRowPlanet['debris']) { |
|
175 | - if(!empty($fleet_list[$Planet][PT_DEBRIS])) { |
|
176 | - foreach($fleet_list[$Planet][PT_DEBRIS] as $objFleetToDebris) { |
|
177 | - if($objFleetToDebris->playerOwnerId == $user['id']) { |
|
174 | + if ($uni_galaxyRowPlanet['debris']) { |
|
175 | + if (!empty($fleet_list[$Planet][PT_DEBRIS])) { |
|
176 | + foreach ($fleet_list[$Planet][PT_DEBRIS] as $objFleetToDebris) { |
|
177 | + if ($objFleetToDebris->playerOwnerId == $user['id']) { |
|
178 | 178 | $recyclers_incoming_capacity += $objFleetToDebris->shipsGetCapacityRecyclers($recycler_info); |
179 | 179 | } |
180 | 180 | } |
@@ -251,21 +251,21 @@ discard block |
||
251 | 251 | |
252 | 252 | tpl_assign_fleet($template, $fleets); |
253 | 253 | |
254 | -foreach(sn_get_groups('defense_active') as $unit_id) { |
|
254 | +foreach (sn_get_groups('defense_active') as $unit_id) { |
|
255 | 255 | $template->assign_block_vars('defense_active', array( |
256 | 256 | 'ID' => $unit_id, |
257 | 257 | 'NAME' => classLocale::$lang['tech'][$unit_id], |
258 | 258 | )); |
259 | 259 | } |
260 | 260 | |
261 | -foreach($cached['users'] as $PlanetUser) { |
|
262 | - if(!$PlanetUser) { |
|
261 | +foreach ($cached['users'] as $PlanetUser) { |
|
262 | + if (!$PlanetUser) { |
|
263 | 263 | continue; |
264 | 264 | } |
265 | 265 | |
266 | 266 | $user_ally = $cached['allies'][$PlanetUser['ally_id']]; |
267 | - if(isset($user_ally)) { |
|
268 | - if($PlanetUser['id'] == $user_ally['ally_owner']) { |
|
267 | + if (isset($user_ally)) { |
|
268 | + if ($PlanetUser['id'] == $user_ally['ally_owner']) { |
|
269 | 269 | $user_rank_title = $user_ally['ally_owner_range']; |
270 | 270 | } else { |
271 | 271 | $ally_ranks = explode(';', $user_ally['ranklist']); |
@@ -288,8 +288,8 @@ discard block |
||
288 | 288 | )); |
289 | 289 | } |
290 | 290 | |
291 | -foreach($cached['allies'] as $PlanetAlly) { |
|
292 | - if($PlanetAlly) { |
|
291 | +foreach ($cached['allies'] as $PlanetAlly) { |
|
292 | + if ($PlanetAlly) { |
|
293 | 293 | $template->assign_block_vars('alliances', array( |
294 | 294 | 'ID' => $PlanetAlly['id'], |
295 | 295 | 'NAME_JS' => js_safe_string($PlanetAlly['ally_name']), |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | //define('SN_RENDER_NAVBAR_PLANET', false); |
32 | 32 | |
33 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
33 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
34 | 34 | |
35 | 35 | // |
36 | 36 | ////$player = new Player(); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $result = array(); |
80 | 80 | |
81 | -switch($mode = sys_get_param_str('mode')) { |
|
81 | +switch ($mode = sys_get_param_str('mode')) { |
|
82 | 82 | case 'manage': |
83 | 83 | sn_sys_sector_buy('overview.php?mode=manage'); |
84 | 84 | |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | $template = gettemplate('planet_manage', true); |
89 | 89 | $planet_id = sys_get_param_id('planet_id'); |
90 | 90 | |
91 | - if(sys_get_param_str('rename') && $new_name = sys_get_param_str('new_name')) { |
|
91 | + if (sys_get_param_str('rename') && $new_name = sys_get_param_str('new_name')) { |
|
92 | 92 | $planetrow['name'] = $new_name; |
93 | 93 | // $new_name = db_escape($new_name); |
94 | 94 | DBStaticPlanet::db_planet_set_by_id($planetrow['id'], "`name` = '{$new_name}'"); |
95 | - } elseif(sys_get_param_str('action') == 'make_capital') { |
|
95 | + } elseif (sys_get_param_str('action') == 'make_capital') { |
|
96 | 96 | try { |
97 | 97 | sn_db_transaction_start(); |
98 | 98 | $user = DBStaticUser::db_user_by_id($user['id'], true, '*'); |
@@ -101,15 +101,15 @@ discard block |
||
101 | 101 | // $user = $global_data['user']; |
102 | 102 | // $planetrow = $global_data['planet']; |
103 | 103 | |
104 | - if($planetrow['planet_type'] != PT_PLANET) { |
|
104 | + if ($planetrow['planet_type'] != PT_PLANET) { |
|
105 | 105 | throw new exception(classLocale::$lang['ov_capital_err_not_a_planet'], ERR_ERROR); |
106 | 106 | } |
107 | 107 | |
108 | - if($planetrow['id'] == $user['id_planet']) { |
|
108 | + if ($planetrow['id'] == $user['id_planet']) { |
|
109 | 109 | throw new exception(classLocale::$lang['ov_capital_err_capital_already'], ERR_ERROR); |
110 | 110 | } |
111 | 111 | |
112 | - if($user_dark_matter < classSupernova::$config->planet_capital_cost) { |
|
112 | + if ($user_dark_matter < classSupernova::$config->planet_capital_cost) { |
|
113 | 113 | throw new exception(classLocale::$lang['ov_capital_err_no_dark_matter'], ERR_ERROR); |
114 | 114 | } |
115 | 115 | |
@@ -126,16 +126,16 @@ discard block |
||
126 | 126 | ); |
127 | 127 | sn_db_transaction_commit(); |
128 | 128 | sys_redirect('overview.php?mode=manage'); |
129 | - } catch(exception $e) { |
|
129 | + } catch (exception $e) { |
|
130 | 130 | sn_db_transaction_rollback(); |
131 | 131 | $result[] = array( |
132 | 132 | 'STATUS' => $e->getCode(), |
133 | 133 | 'MESSAGE' => $e->getMessage(), |
134 | 134 | ); |
135 | 135 | } |
136 | - } elseif(sys_get_param_str('action') == 'planet_teleport') { |
|
136 | + } elseif (sys_get_param_str('action') == 'planet_teleport') { |
|
137 | 137 | try { |
138 | - if(!uni_coordinates_valid($new_coordinates = array( |
|
138 | + if (!uni_coordinates_valid($new_coordinates = array( |
|
139 | 139 | 'galaxy' => sys_get_param_int('new_galaxy'), |
140 | 140 | 'system' => sys_get_param_int('new_system'), |
141 | 141 | 'planet' => sys_get_param_int('new_planet'))) |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | // $planetrow = $global_data['planet']; |
153 | 153 | |
154 | 154 | $can_teleport = uni_planet_teleport_check($user, $planetrow, $new_coordinates); |
155 | - if($can_teleport['result'] != ERR_NONE) { |
|
155 | + if ($can_teleport['result'] != ERR_NONE) { |
|
156 | 156 | throw new exception($can_teleport['message'], $can_teleport['result']); |
157 | 157 | } |
158 | 158 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | DBStaticPlanet::db_planet_set_by_gspt($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], PT_ALL, |
164 | 164 | "galaxy = {$new_coordinates['galaxy']}, system = {$new_coordinates['system']}, planet = {$new_coordinates['planet']}, planet_teleport_next = {$planet_teleport_next}"); |
165 | 165 | |
166 | - if($planetrow['id'] == $user['id_planet']) { |
|
166 | + if ($planetrow['id'] == $user['id_planet']) { |
|
167 | 167 | DBStaticUser::db_user_set_by_id($user['id'], "galaxy = {$new_coordinates['galaxy']}, system = {$new_coordinates['system']}, planet = {$new_coordinates['planet']}"); |
168 | 168 | } |
169 | 169 | |
@@ -176,17 +176,17 @@ discard block |
||
176 | 176 | 'MESSAGE' => classLocale::$lang['ov_teleport_err_none'], |
177 | 177 | ); |
178 | 178 | sys_redirect('overview.php?mode=manage'); |
179 | - } catch(exception $e) { |
|
179 | + } catch (exception $e) { |
|
180 | 180 | sn_db_transaction_rollback(); |
181 | 181 | $result[] = array( |
182 | 182 | 'STATUS' => $e->getCode(), |
183 | 183 | 'MESSAGE' => $e->getMessage(), |
184 | 184 | ); |
185 | 185 | } |
186 | - } elseif(sys_get_param_str('action') == 'planet_abandon') { |
|
186 | + } elseif (sys_get_param_str('action') == 'planet_abandon') { |
|
187 | 187 | // if(sec_password_check($user['id'], sys_get_param('abandon_confirm'))) { |
188 | - if(classSupernova::$auth->password_check(sys_get_param('abandon_confirm'))) { |
|
189 | - if($user['id_planet'] != $user['current_planet'] && $user['current_planet'] == $planet_id) { |
|
188 | + if (classSupernova::$auth->password_check(sys_get_param('abandon_confirm'))) { |
|
189 | + if ($user['id_planet'] != $user['current_planet'] && $user['current_planet'] == $planet_id) { |
|
190 | 190 | $destroyed = SN_TIME_NOW + 60 * 60 * 24; |
191 | 191 | DBStaticPlanet::db_planet_set_by_id($user['current_planet'], "`destruyed`='{$destroyed}', `id_owner`=0"); |
192 | 192 | DBStaticPlanet::db_planet_set_by_parent($user['current_planet'], "`destruyed`='{$destroyed}', `id_owner`=0"); |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | message(classLocale::$lang['ov_delete_wrong_planet'], classLocale::$lang['colony_abandon'], 'overview.php?mode=manage'); |
197 | 197 | } |
198 | 198 | } else { |
199 | - message(classLocale::$lang['ov_delete_wrong_pass'] , classLocale::$lang['colony_abandon'], 'overview.php?mode=manage'); |
|
199 | + message(classLocale::$lang['ov_delete_wrong_pass'], classLocale::$lang['colony_abandon'], 'overview.php?mode=manage'); |
|
200 | 200 | } |
201 | - } elseif( |
|
201 | + } elseif ( |
|
202 | 202 | ($hire = sys_get_param_int('hire')) && in_array($hire, sn_get_groups('governors')) |
203 | 203 | && ( |
204 | 204 | !get_unit_param($hire, P_MAX_STACK) || |
@@ -213,8 +213,8 @@ discard block |
||
213 | 213 | $user = DBStaticUser::db_user_by_id($user['id'], true); |
214 | 214 | $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true); |
215 | 215 | $build_data = eco_get_build_data($user, $planetrow, $hire, $planetrow['PLANET_GOVERNOR_ID'] == $hire ? $planetrow['PLANET_GOVERNOR_LEVEL'] : 0); |
216 | - if($build_data['CAN'][BUILD_CREATE]) { |
|
217 | - if($planetrow['PLANET_GOVERNOR_ID'] == $hire) { |
|
216 | + if ($build_data['CAN'][BUILD_CREATE]) { |
|
217 | + if ($planetrow['PLANET_GOVERNOR_ID'] == $hire) { |
|
218 | 218 | $planetrow['PLANET_GOVERNOR_LEVEL']++; |
219 | 219 | $query = '`PLANET_GOVERNOR_LEVEL` + 1'; |
220 | 220 | } else { |
@@ -240,8 +240,8 @@ discard block |
||
240 | 240 | |
241 | 241 | lng_include('mrc_mercenary'); |
242 | 242 | int_planet_pretemplate($planetrow, $template); |
243 | - foreach(sn_get_groups('governors') as $governor_id) { |
|
244 | - if($planetrow['planet_type'] == PT_MOON && $governor_id == MRC_TECHNOLOGIST) { |
|
243 | + foreach (sn_get_groups('governors') as $governor_id) { |
|
244 | + if ($planetrow['planet_type'] == PT_MOON && $governor_id == MRC_TECHNOLOGIST) { |
|
245 | 245 | continue; |
246 | 246 | } |
247 | 247 | |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | 'PAGE_HINT' => classLocale::$lang['ov_manage_page_hint'], |
294 | 294 | )); |
295 | 295 | |
296 | - foreach($result as &$a_result) { |
|
296 | + foreach ($result as &$a_result) { |
|
297 | 297 | $template->assign_block_vars('result', $a_result); |
298 | 298 | } |
299 | 299 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | default: |
304 | 304 | sn_sys_sector_buy(); |
305 | 305 | |
306 | - if(sys_get_param_str('rename') && $new_name = sys_get_param_str('new_name')) { |
|
306 | + if (sys_get_param_str('rename') && $new_name = sys_get_param_str('new_name')) { |
|
307 | 307 | $planetrow['name'] = $new_name; |
308 | 308 | $new_name_safe = db_escape($new_name); |
309 | 309 | DBStaticPlanet::db_planet_set_by_id($planetrow['id'], "`name` = '{$new_name_safe}'"); |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | |
334 | 334 | $planet_count = 0; |
335 | 335 | $planets_query = DBStaticPlanet::db_planet_list_sorted($user, false, '*'); |
336 | - foreach($planets_query as $an_id => $UserPlanet) { |
|
336 | + foreach ($planets_query as $an_id => $UserPlanet) { |
|
337 | 337 | sn_db_transaction_start(); |
338 | 338 | $UserPlanet = sys_o_get_updated($user, $UserPlanet['id'], SN_TIME_NOW, false, true); |
339 | 339 | sn_db_transaction_commit(); |
@@ -344,16 +344,16 @@ discard block |
||
344 | 344 | |
345 | 345 | $planet_fleet_id = 0; |
346 | 346 | $fleet_list = $template_planet['fleet_list']; |
347 | - if($fleet_list['own']['count']) { |
|
347 | + if ($fleet_list['own']['count']) { |
|
348 | 348 | $planet_fleet_id = "p{$UserPlanet['id']}"; |
349 | 349 | $fleets_to_planet[$UserPlanet['id']] = tpl_parse_fleet_sn($fleet_list['own']['total'], $planet_fleet_id); |
350 | 350 | // $fleet_id++;tpl_parse_fleet_sn |
351 | 351 | } |
352 | - if($UserPlanet['planet_type'] == PT_MOON) { |
|
352 | + if ($UserPlanet['planet_type'] == PT_MOON) { |
|
353 | 353 | continue; |
354 | 354 | } |
355 | 355 | $moon = DBStaticPlanet::db_planet_by_parent($UserPlanet['id']); |
356 | - if($moon) { |
|
356 | + if ($moon) { |
|
357 | 357 | $moon_fill = min(100, floor($moon['field_current'] / eco_planet_fields_max($moon) * 100)); |
358 | 358 | } else { |
359 | 359 | $moon_fill = 0; |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | tpl_assign_fleet($template, $fleets); |
394 | 394 | |
395 | 395 | $lune = $planetrow['planet_type'] == PT_PLANET ? DBStaticPlanet::db_planet_by_parent($planetrow['id']) : DBStaticPlanet::db_planet_by_id($planetrow['parent_planet']); |
396 | - if($lune) { |
|
396 | + if ($lune) { |
|
397 | 397 | $template->assign_vars(array( |
398 | 398 | 'MOON_ID' => $lune['id'], |
399 | 399 | 'MOON_IMG' => $lune['image'], |
@@ -405,15 +405,15 @@ discard block |
||
405 | 405 | $planet_fill = $planet_fill > 100 ? 100 : $planet_fill; |
406 | 406 | |
407 | 407 | $planet_recyclers_orbiting = 0; |
408 | - foreach(Fleet::$snGroupRecyclers as $recycler_id) { |
|
408 | + foreach (Fleet::$snGroupRecyclers as $recycler_id) { |
|
409 | 409 | $planet_recyclers_orbiting += mrc_get_level($user, $planetrow, $recycler_id); |
410 | 410 | } |
411 | 411 | |
412 | 412 | int_planet_pretemplate($planetrow, $template); |
413 | 413 | |
414 | 414 | $sn_group_ques = sn_get_groups('ques'); |
415 | - if(!defined('GAME_STRUCTURES_DISABLED') || !GAME_STRUCTURES_DISABLED) { |
|
416 | - foreach(array(QUE_STRUCTURES => $sn_group_ques[QUE_STRUCTURES]) as $que_id => $que_type_data) { |
|
415 | + if (!defined('GAME_STRUCTURES_DISABLED') || !GAME_STRUCTURES_DISABLED) { |
|
416 | + foreach (array(QUE_STRUCTURES => $sn_group_ques[QUE_STRUCTURES]) as $que_id => $que_type_data) { |
|
417 | 417 | $this_que = $que['ques'][$que_id][$user['id']][$planetrow['id']]; |
418 | 418 | $template->assign_block_vars('ques', array( |
419 | 419 | 'ID' => $que_id, |
@@ -421,8 +421,8 @@ discard block |
||
421 | 421 | 'LENGTH' => empty($this_que) ? 0 : count($this_que), |
422 | 422 | )); |
423 | 423 | |
424 | - if(!empty($this_que)) { |
|
425 | - foreach($this_que as $que_item) { |
|
424 | + if (!empty($this_que)) { |
|
425 | + foreach ($this_que as $que_item) { |
|
426 | 426 | $template->assign_block_vars('que', que_tpl_parse_element($que_item)); |
427 | 427 | } |
428 | 428 | } |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | 'LENGTH' => $que_hangar_length, |
437 | 437 | )); |
438 | 438 | |
439 | - if(!defined('GAME_DEFENSE_DISABLED') || !GAME_DEFENSE_DISABLED) { |
|
439 | + if (!defined('GAME_DEFENSE_DISABLED') || !GAME_DEFENSE_DISABLED) { |
|
440 | 440 | $que_hangar_length = tpl_assign_hangar($template, $planetrow, SUBQUE_DEFENSE); |
441 | 441 | $template->assign_block_vars('ques', array( |
442 | 442 | 'ID' => SUBQUE_DEFENSE, |
@@ -448,12 +448,12 @@ discard block |
||
448 | 448 | $overview_planet_rows = $user['opt_int_overview_planet_rows']; |
449 | 449 | $overview_planet_columns = $user['opt_int_overview_planet_columns']; |
450 | 450 | |
451 | - if($overview_planet_rows <= 0 && $overview_planet_columns <= 0) { |
|
451 | + if ($overview_planet_rows <= 0 && $overview_planet_columns <= 0) { |
|
452 | 452 | $overview_planet_rows = $user_option_list[OPT_INTERFACE]['opt_int_overview_planet_rows']; |
453 | 453 | $overview_planet_columns = $user_option_list[OPT_INTERFACE]['opt_int_overview_planet_columns']; |
454 | 454 | } |
455 | 455 | |
456 | - if($overview_planet_rows > 0 && $overview_planet_columns <= 0) { |
|
456 | + if ($overview_planet_rows > 0 && $overview_planet_columns <= 0) { |
|
457 | 457 | $overview_planet_columns = ceil($planet_count / $overview_planet_rows); |
458 | 458 | } |
459 | 459 | |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | )); |
511 | 511 | tpl_set_resource_info($template, $planetrow, $fleets_to_planet, 2); |
512 | 512 | |
513 | - foreach($result as &$a_result) { |
|
513 | + foreach ($result as &$a_result) { |
|
514 | 514 | $template->assign_block_vars('result', $a_result); |
515 | 515 | } |
516 | 516 |
@@ -103,23 +103,23 @@ |
||
103 | 103 | |
104 | 104 | !empty(classSupernova::$config->url_faq) ? $msg = str_replace('faq://', classSupernova::$config->url_faq, $msg) : false; |
105 | 105 | |
106 | - foreach(classSupernova::$design['bbcodes'] as $auth_level => $replaces) { |
|
107 | - if($auth_level > $author_auth) { |
|
106 | + foreach (classSupernova::$design['bbcodes'] as $auth_level => $replaces) { |
|
107 | + if ($auth_level > $author_auth) { |
|
108 | 108 | continue; |
109 | 109 | } |
110 | 110 | |
111 | - foreach($replaces as $key => $html) { |
|
111 | + foreach ($replaces as $key => $html) { |
|
112 | 112 | $msg = preg_replace(''.$key.'', $html, $msg); |
113 | 113 | } |
114 | 114 | } |
115 | 115 | |
116 | - foreach(classSupernova::$design['smiles'] as $auth_level => $replaces) { |
|
117 | - if($auth_level > $author_auth) { |
|
116 | + foreach (classSupernova::$design['smiles'] as $auth_level => $replaces) { |
|
117 | + if ($auth_level > $author_auth) { |
|
118 | 118 | continue; |
119 | 119 | } |
120 | 120 | |
121 | - foreach($replaces as $key => $imgName) { |
|
122 | - $msg = preg_replace("#" . addcslashes($key, '()[]{}') . "#isU","<img src=\"design/images/smileys/".$imgName.".gif\" align=\"absmiddle\" title=\"".$key."\" alt=\"".$key."\">",$msg); |
|
121 | + foreach ($replaces as $key => $imgName) { |
|
122 | + $msg = preg_replace("#".addcslashes($key, '()[]{}')."#isU", "<img src=\"design/images/smileys/".$imgName.".gif\" align=\"absmiddle\" title=\"".$key."\" alt=\"".$key."\">", $msg); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $user_auth_level = isset($user['authlevel']) ? $user['authlevel'] : AUTH_LEVEL_ANONYMOUS; |
37 | 37 | |
38 | 38 | $mode = sys_get_param_int('mode'); |
39 | - switch($mode) { |
|
39 | + switch ($mode) { |
|
40 | 40 | case CHAT_MODE_ALLY: |
41 | 41 | $template_result['ALLY'] = intval($user['ally_id']); |
42 | 42 | $page_title = classLocale::$lang['chat_ally']; |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | } |
50 | 50 | |
51 | 51 | $template_result['.']['smiles'] = array(); |
52 | - foreach(classSupernova::$design['smiles'] as $auth_level => $replaces) { |
|
53 | - if($auth_level > $user_auth_level) { |
|
52 | + foreach (classSupernova::$design['smiles'] as $auth_level => $replaces) { |
|
53 | + if ($auth_level > $user_auth_level) { |
|
54 | 54 | continue; |
55 | 55 | } |
56 | 56 | |
57 | - foreach($replaces as $bbcode => $filename) { |
|
57 | + foreach ($replaces as $bbcode => $filename) { |
|
58 | 58 | $template_result['.']['smiles'][] = array( |
59 | 59 | 'BBCODE' => $bbcode, |
60 | 60 | 'FILENAME' => $filename, |
@@ -77,11 +77,11 @@ discard block |
||
77 | 77 | define('IN_AJAX', true); |
78 | 78 | $skip_fleet_update = true; |
79 | 79 | |
80 | - if(classSupernova::$config->_MODE != CACHER_NO_CACHE && classSupernova::$config->chat_timeout && SN_TIME_MICRO - classSupernova::$config->array_get('users', $user['id'], 'chat_last_activity') > classSupernova::$config->chat_timeout) { |
|
80 | + if (classSupernova::$config->_MODE != CACHER_NO_CACHE && classSupernova::$config->chat_timeout && SN_TIME_MICRO - classSupernova::$config->array_get('users', $user['id'], 'chat_last_activity') > classSupernova::$config->chat_timeout) { |
|
81 | 81 | die(); |
82 | 82 | } |
83 | 83 | |
84 | - if(($message = sys_get_param_str('message')) && $user['username']) { |
|
84 | + if (($message = sys_get_param_str('message')) && $user['username']) { |
|
85 | 85 | $ally_id = sys_get_param('ally') && $user['ally_id'] ? $user['ally_id'] : 0; |
86 | 86 | $nick = db_escape(player_nick_compact(player_nick_render_current_to_array($user, array('color' => true, 'icons' => true, 'ally' => !$ally_id)))); |
87 | 87 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $skip_fleet_update = true; |
104 | 104 | |
105 | 105 | $history = sys_get_param_str('history'); |
106 | - if(!$history) { |
|
106 | + if (!$history) { |
|
107 | 107 | classSupernova::$config->array_set('users', $user['id'], 'chat_last_refresh', SN_TIME_MICRO); |
108 | 108 | } |
109 | 109 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $last_message = ''; |
112 | 112 | $alliance = 0; |
113 | 113 | $template_result['.']['chat'] = array(); |
114 | - if(!$history && classSupernova::$config->_MODE != CACHER_NO_CACHE && classSupernova::$config->chat_timeout && SN_TIME_MICRO - classSupernova::$config->array_get('users', $user['id'], 'chat_last_activity') > classSupernova::$config->chat_timeout) { |
|
114 | + if (!$history && classSupernova::$config->_MODE != CACHER_NO_CACHE && classSupernova::$config->chat_timeout && SN_TIME_MICRO - classSupernova::$config->array_get('users', $user['id'], 'chat_last_activity') > classSupernova::$config->chat_timeout) { |
|
115 | 115 | $result['disable'] = true; |
116 | 116 | $template_result['.']['chat'][] = array( |
117 | 117 | 'TIME' => date(FMT_DATE_TIME, htmlentities(SN_CLIENT_TIME_LOCAL, ENT_QUOTES, 'utf-8')), |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | |
125 | 125 | $where_add = ''; |
126 | 126 | $last_message = 0; |
127 | - if($history) { |
|
127 | + if ($history) { |
|
128 | 128 | $rows = DBStaticChat::db_chat_message_count_by_ally($alliance); |
129 | 129 | $page_count = ceil($rows['CNT'] / $page_limit); |
130 | 130 | |
131 | - for($i = 0; $i < $page_count; $i++) { |
|
131 | + for ($i = 0; $i < $page_count; $i++) { |
|
132 | 132 | $template_result['.']['page'][] = array( |
133 | 133 | 'NUMBER' => $i |
134 | 134 | ); |
@@ -142,12 +142,12 @@ discard block |
||
142 | 142 | |
143 | 143 | $start_row = $page * $page_limit; |
144 | 144 | $query = DBStaticChat::db_chat_message_get_page($alliance, $where_add, $start_row, $page_limit); |
145 | - while($chat_row = db_fetch($query)) { |
|
145 | + while ($chat_row = db_fetch($query)) { |
|
146 | 146 | // Little magik here - to retain HTML codes from DB and stripping HTML codes from nick |
147 | 147 | $chat_row['user'] = player_nick_render_to_html($chat_row['user']); |
148 | 148 | $nick_stripped = htmlentities(strip_tags($chat_row['user']), ENT_QUOTES, 'utf-8'); |
149 | 149 | $nick = str_replace(strip_tags($chat_row['user']), $nick_stripped, $chat_row['user']); |
150 | - if(!$history) { |
|
150 | + if (!$history) { |
|
151 | 151 | $nick = "<span style=\"cursor: pointer;\" onclick=\"addSmiley('({$nick_stripped})');\">{$nick}</span>"; |
152 | 152 | } |
153 | 153 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | $template = gettemplate('chat_messages', $template); |
173 | 173 | $template->assign_recursive($template_result); |
174 | 174 | |
175 | - if($history) { |
|
175 | + if ($history) { |
|
176 | 176 | display($template, "{$classLocale['chat_history']} - {$classLocale[$alliance ? 'chat_ally' : 'chat_common']}", true, '', false, true); |
177 | 177 | } else { |
178 | 178 | $result['last_message'] = $last_message; |
@@ -116,12 +116,12 @@ |
||
116 | 116 | * @return static |
117 | 117 | */ |
118 | 118 | public static function convertToVector($coordinates, $prefix = '') { |
119 | - $galaxy = !empty($coordinates[$prefix . 'galaxy']) ? intval($coordinates[$prefix . 'galaxy']) : 0; |
|
120 | - $system = !empty($coordinates[$prefix . 'system']) ? intval($coordinates[$prefix . 'system']) : 0; |
|
121 | - $planet = !empty($coordinates[$prefix . 'planet']) ? intval($coordinates[$prefix . 'planet']) : 0; |
|
122 | - $type = !empty($coordinates[$prefix . 'type']) |
|
123 | - ? intval($coordinates[$prefix . 'type']) |
|
124 | - : (!empty($coordinates[$prefix . 'planet_type']) ? intval($coordinates[$prefix . 'planet_type']) : 0); |
|
119 | + $galaxy = !empty($coordinates[$prefix.'galaxy']) ? intval($coordinates[$prefix.'galaxy']) : 0; |
|
120 | + $system = !empty($coordinates[$prefix.'system']) ? intval($coordinates[$prefix.'system']) : 0; |
|
121 | + $planet = !empty($coordinates[$prefix.'planet']) ? intval($coordinates[$prefix.'planet']) : 0; |
|
122 | + $type = !empty($coordinates[$prefix.'type']) |
|
123 | + ? intval($coordinates[$prefix.'type']) |
|
124 | + : (!empty($coordinates[$prefix.'planet_type']) ? intval($coordinates[$prefix.'planet_type']) : 0); |
|
125 | 125 | |
126 | 126 | return new static($galaxy, $system, $planet, $type); |
127 | 127 | } |
@@ -76,6 +76,9 @@ discard block |
||
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
79 | + /** |
|
80 | + * @param string $name |
|
81 | + */ |
|
79 | 82 | private function getPhysicalPropertyName($name) { |
80 | 83 | return '_' . $name; |
81 | 84 | } |
@@ -146,6 +149,9 @@ discard block |
||
146 | 149 | return $this->propertyMethodResult($name, $diff, 'delta'); |
147 | 150 | } |
148 | 151 | |
152 | + /** |
|
153 | + * @param string $action |
|
154 | + */ |
|
149 | 155 | protected function actionProperty($action, $name, $value) { |
150 | 156 | $result = null; |
151 | 157 | // Now deciding - will we call a protected setter or will we work with protected property |
@@ -66,18 +66,18 @@ discard block |
||
66 | 66 | |
67 | 67 | protected function checkPropertyExists($name) { |
68 | 68 | if (!array_key_exists($name, static::$_properties)) { |
69 | - throw new ExceptionPropertyNotExists('Property [' . get_called_class() . '::' . $name . '] not exists', ERR_ERROR); |
|
69 | + throw new ExceptionPropertyNotExists('Property ['.get_called_class().'::'.$name.'] not exists', ERR_ERROR); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
73 | 73 | protected function checkOverwriteAdjusted($name) { |
74 | 74 | if (array_key_exists($name, $this->propertiesAdjusted)) { |
75 | - throw new PropertyAccessException('Property [' . get_called_class() . '::' . $name . '] already was adjusted so no SET is possible until dbSave', ERR_ERROR); |
|
75 | + throw new PropertyAccessException('Property ['.get_called_class().'::'.$name.'] already was adjusted so no SET is possible until dbSave', ERR_ERROR); |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
79 | 79 | private function getPhysicalPropertyName($name) { |
80 | - return '_' . $name; |
|
80 | + return '_'.$name; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -149,15 +149,15 @@ discard block |
||
149 | 149 | protected function actionProperty($action, $name, $value) { |
150 | 150 | $result = null; |
151 | 151 | // Now deciding - will we call a protected setter or will we work with protected property |
152 | - if (method_exists($this, $methodName = $action . ucfirst($name))) { |
|
152 | + if (method_exists($this, $methodName = $action.ucfirst($name))) { |
|
153 | 153 | // If method exists - just calling it |
154 | 154 | // TODO - should return TRUE if value changed or FALSE otherwise |
155 | 155 | $result = call_user_func_array(array($this, $methodName), array($value)); |
156 | 156 | } elseif ($this->isPropertyActionAvailable($name, $action)) { |
157 | 157 | // No setter exists - works directly with protected property |
158 | - $result = $this->{$action . 'Property'}($name, $value); |
|
158 | + $result = $this->{$action.'Property'}($name, $value); |
|
159 | 159 | } else { |
160 | - throw new ExceptionPropertyNotExists('Property [' . get_called_class() . '::' . $name . '] does not have ' . $action . 'ter/property to ' . $action, ERR_ERROR); |
|
160 | + throw new ExceptionPropertyNotExists('Property ['.get_called_class().'::'.$name.'] does not have '.$action.'ter/property to '.$action, ERR_ERROR); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | return $result; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * @return string |
249 | 249 | */ |
250 | 250 | protected function adjustPropertyString($name, $diff) { |
251 | - return (string)$this->$name . (string)$diff; |
|
251 | + return (string) $this->$name.(string) $diff; |
|
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
@@ -258,8 +258,8 @@ discard block |
||
258 | 258 | * @return array |
259 | 259 | */ |
260 | 260 | protected function adjustPropertyArray($name, $diff) { |
261 | - $copy = (array)$this->$name; |
|
262 | - HelperArray::merge($copy, (array)$diff, HelperArray::MERGE_PHP); |
|
261 | + $copy = (array) $this->$name; |
|
262 | + HelperArray::merge($copy, (array) $diff, HelperArray::MERGE_PHP); |
|
263 | 263 | |
264 | 264 | return $copy; |
265 | 265 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | * @return int |
272 | 272 | */ |
273 | 273 | protected function deltaInteger($name, $diff) { |
274 | - return (int)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0) + (int)$diff; |
|
274 | + return (int) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0) + (int) $diff; |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | * @return float |
282 | 282 | */ |
283 | 283 | protected function deltaDouble($name, $diff) { |
284 | - return (float)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0.0) + (float)$diff; |
|
284 | + return (float) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0.0) + (float) $diff; |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | /** |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | * @return string |
292 | 292 | */ |
293 | 293 | protected function deltaString($name, $diff) { |
294 | - return (string)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, '') . (string)$diff; |
|
294 | + return (string) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, '').(string) $diff; |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | * @return array |
302 | 302 | */ |
303 | 303 | protected function deltaArray($name, $diff) { |
304 | - $copy = (array)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, array()); |
|
304 | + $copy = (array) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, array()); |
|
305 | 305 | HelperArray::merge($copy, $diff, HelperArray::MERGE_PHP); |
306 | 306 | |
307 | 307 | return $copy; |
@@ -324,10 +324,10 @@ discard block |
||
324 | 324 | // Capitalizing type name |
325 | 325 | $methodName = explode(' ', $type); |
326 | 326 | array_walk($methodName, 'DbSqlHelper::UCFirstByRef'); |
327 | - $methodName = $prefix . implode('', $methodName); |
|
327 | + $methodName = $prefix.implode('', $methodName); |
|
328 | 328 | |
329 | 329 | if (!method_exists($this, $methodName)) { |
330 | - throw new ExceptionTypeUnsupported('Type "' . $type . '" is unsupported in PropertyHider::propertyMethodResult'); |
|
330 | + throw new ExceptionTypeUnsupported('Type "'.$type.'" is unsupported in PropertyHider::propertyMethodResult'); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | return call_user_func(array($this, $methodName), $name, $diff); |
@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | |
39 | 39 | // Game type constants starts with GAME_ |
40 | 40 | define('GAME_SUPERNOVA', 0); |
41 | -define('GAME_OGAME' , 1); |
|
42 | -define('GAME_BLITZ' , 2); |
|
41 | +define('GAME_OGAME', 1); |
|
42 | +define('GAME_BLITZ', 2); |
|
43 | 43 | |
44 | 44 | // Date & time range constants |
45 | 45 | define('DATE_FOREVER', 2000000000); |
@@ -52,27 +52,27 @@ discard block |
||
52 | 52 | define('PERIOD_YEAR', PERIOD_DAY * 365); |
53 | 53 | define('PERIOD_FOREVER', PERIOD_YEAR * 100); |
54 | 54 | |
55 | -define('PERIOD_MINUTE_2' , PERIOD_MINUTE * 2); |
|
56 | -define('PERIOD_MINUTE_3' , PERIOD_MINUTE * 3); |
|
57 | -define('PERIOD_MINUTE_5' , PERIOD_MINUTE * 5); |
|
55 | +define('PERIOD_MINUTE_2', PERIOD_MINUTE * 2); |
|
56 | +define('PERIOD_MINUTE_3', PERIOD_MINUTE * 3); |
|
57 | +define('PERIOD_MINUTE_5', PERIOD_MINUTE * 5); |
|
58 | 58 | define('PERIOD_MINUTE_10', PERIOD_MINUTE * 10); |
59 | -define('PERIOD_DAY_3' , PERIOD_DAY * 3); |
|
60 | -define('PERIOD_WEEK_2' , PERIOD_WEEK * 2); |
|
61 | -define('PERIOD_MONTH_2' , PERIOD_MONTH * 2); |
|
62 | -define('PERIOD_MONTH_3' , PERIOD_MONTH * 3); |
|
59 | +define('PERIOD_DAY_3', PERIOD_DAY * 3); |
|
60 | +define('PERIOD_WEEK_2', PERIOD_WEEK * 2); |
|
61 | +define('PERIOD_MONTH_2', PERIOD_MONTH * 2); |
|
62 | +define('PERIOD_MONTH_3', PERIOD_MONTH * 3); |
|
63 | 63 | |
64 | 64 | define('FONT_SIZE_PERCENT_MIN', 56.25); |
65 | 65 | define('FONT_SIZE_PERCENT_DEFAULT', 68.75); |
66 | 66 | define('FONT_SIZE_PERCENT_MAX', 131.25); |
67 | 67 | define('FONT_SIZE_PERCENT_STEP', 12.5); |
68 | -define('FONT_SIZE_PERCENT_DEFAULT_STRING', FONT_SIZE_PERCENT_DEFAULT . '%'); |
|
68 | +define('FONT_SIZE_PERCENT_DEFAULT_STRING', FONT_SIZE_PERCENT_DEFAULT.'%'); |
|
69 | 69 | |
70 | 70 | define('FONT_SIZE_PIXELS_BROWSER_BASE', 16); |
71 | 71 | define('FONT_SIZE_PIXELS_MIN', 9); |
72 | 72 | define('FONT_SIZE_PIXELS_DEFAULT', 11); |
73 | 73 | define('FONT_SIZE_PIXELS_MAX', 21); |
74 | 74 | define('FONT_SIZE_PIXELS_STEP', 1); |
75 | -define('FONT_SIZE_PIXELS_DEFAULT_STRING', FONT_SIZE_PIXELS_DEFAULT . 'px'); |
|
75 | +define('FONT_SIZE_PIXELS_DEFAULT_STRING', FONT_SIZE_PIXELS_DEFAULT.'px'); |
|
76 | 76 | |
77 | 77 | define('DEFAULT_PICTURE_EXTENSION_DOTTED', '.jpg'); |
78 | 78 | |
@@ -115,54 +115,54 @@ discard block |
||
115 | 115 | define('SN_SYS_SEC_CHARS_ALLOWED', 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghkmnpqrstuvwxyz0123456789'); |
116 | 116 | |
117 | 117 | // Mot qui sont interdit a la saisie ! |
118 | -$ListCensure = array ( '/</', '/>/', '/script/i', '/doquery/i', '/http/i', '/javascript/i'); |
|
118 | +$ListCensure = array('/</', '/>/', '/script/i', '/doquery/i', '/http/i', '/javascript/i'); |
|
119 | 119 | |
120 | 120 | // Confirmation record types |
121 | -define('CONFIRM_REGISTRATION' , 1); |
|
121 | +define('CONFIRM_REGISTRATION', 1); |
|
122 | 122 | define('CONFIRM_PASSWORD_RESET', 2); |
123 | -define('CONFIRM_DELETE' , 3); |
|
123 | +define('CONFIRM_DELETE', 3); |
|
124 | 124 | |
125 | 125 | define('AFFILIATE_MM_TO_REFERRAL_DM', 2); |
126 | 126 | |
127 | 127 | // Ally diplomacy statuses |
128 | -define('ALLY_DIPLOMACY_SELF' , 'self'); |
|
129 | -define('ALLY_DIPLOMACY_NEUTRAL' , 'neutral'); |
|
130 | -define('ALLY_DIPLOMACY_WAR' , 'war'); |
|
131 | -define('ALLY_DIPLOMACY_PEACE' , 'peace'); |
|
128 | +define('ALLY_DIPLOMACY_SELF', 'self'); |
|
129 | +define('ALLY_DIPLOMACY_NEUTRAL', 'neutral'); |
|
130 | +define('ALLY_DIPLOMACY_WAR', 'war'); |
|
131 | +define('ALLY_DIPLOMACY_PEACE', 'peace'); |
|
132 | 132 | define('ALLY_DIPLOMACY_CONFEDERATION', 'confederation'); |
133 | -define('ALLY_DIPLOMACY_FEDERATION' , 'federation'); |
|
134 | -define('ALLY_DIPLOMACY_UNION' , 'union'); |
|
135 | -define('ALLY_DIPLOMACY_MASTER' , 'master'); |
|
136 | -define('ALLY_DIPLOMACY_SLAVE' , 'slave'); |
|
133 | +define('ALLY_DIPLOMACY_FEDERATION', 'federation'); |
|
134 | +define('ALLY_DIPLOMACY_UNION', 'union'); |
|
135 | +define('ALLY_DIPLOMACY_MASTER', 'master'); |
|
136 | +define('ALLY_DIPLOMACY_SLAVE', 'slave'); |
|
137 | 137 | |
138 | 138 | define('ALLY_PROPOSE_SEND', 0); |
139 | 139 | |
140 | 140 | // Quest types |
141 | -define('QUEST_TYPE_BUILD' , 1); |
|
141 | +define('QUEST_TYPE_BUILD', 1); |
|
142 | 142 | define('QUEST_TYPE_RESEARCH', 2); |
143 | -define('QUEST_TYPE_COMBAT' , 3); |
|
143 | +define('QUEST_TYPE_COMBAT', 3); |
|
144 | 144 | |
145 | -define('QUEST_STATUS_NOT_STARTED' , 0); |
|
146 | -define('QUEST_STATUS_STARTED' , 1); |
|
147 | -define('QUEST_STATUS_COMPLETE' , 2); |
|
145 | +define('QUEST_STATUS_NOT_STARTED', 0); |
|
146 | +define('QUEST_STATUS_STARTED', 1); |
|
147 | +define('QUEST_STATUS_COMPLETE', 2); |
|
148 | 148 | |
149 | 149 | // *** Combat-related constants |
150 | 150 | // *** Mission Type constants starts with MT_ |
151 | -define('MT_NONE' , 0); |
|
152 | -define('MT_EXPLORE' , 15); |
|
153 | -define('MT_COLONIZE' , 7); |
|
154 | -define('MT_RECYCLE' , 8); |
|
151 | +define('MT_NONE', 0); |
|
152 | +define('MT_EXPLORE', 15); |
|
153 | +define('MT_COLONIZE', 7); |
|
154 | +define('MT_RECYCLE', 8); |
|
155 | 155 | |
156 | -define('MT_RELOCATE' , 4); |
|
156 | +define('MT_RELOCATE', 4); |
|
157 | 157 | |
158 | -define('MT_TRANSPORT', 3); |
|
159 | -define('MT_HOLD' , 5); |
|
158 | +define('MT_TRANSPORT', 3); |
|
159 | +define('MT_HOLD', 5); |
|
160 | 160 | |
161 | -define('MT_MISSILE' , 10); |
|
162 | -define('MT_SPY' , 6); |
|
163 | -define('MT_ATTACK' , 1); |
|
164 | -define('MT_ACS' , 2); |
|
165 | -define('MT_DESTROY' , 9); |
|
161 | +define('MT_MISSILE', 10); |
|
162 | +define('MT_SPY', 6); |
|
163 | +define('MT_ATTACK', 1); |
|
164 | +define('MT_ACS', 2); |
|
165 | +define('MT_DESTROY', 9); |
|
166 | 166 | // 11, 12, 13, 14, 16... |
167 | 167 | |
168 | 168 | // *** Planet Target constants starts with PT_ |
@@ -170,49 +170,49 @@ discard block |
||
170 | 170 | define('PT_ALL', 0); |
171 | 171 | define('PT_PLANET', 1); |
172 | 172 | define('PT_DEBRIS', 2); |
173 | -define('PT_MOON' , 3); |
|
173 | +define('PT_MOON', 3); |
|
174 | 174 | |
175 | 175 | // *** Unit locations - shows db table where unit belong |
176 | 176 | // Also cache indexes |
177 | -define('LOC_NONE', -1); |
|
177 | +define('LOC_NONE', -1); |
|
178 | 178 | define('LOC_UNIVERSE', 0); |
179 | -define('LOC_PLANET', 1); |
|
180 | -define('LOC_DEBRIS', 2); // Translates to `planets` table planet_type = 1, `debris_*` fields |
|
181 | -define('LOC_MOON', 3); // Translates to `planets` table planet_type = 3 |
|
182 | -define('LOC_USER', 4); |
|
183 | -define('LOC_FLEET', 5); |
|
184 | -define('LOC_ALLY', 6); |
|
185 | -define('LOC_UNIT_NUMERIC', 7); |
|
186 | -define('LOC_UNIT_LIST', 8); |
|
179 | +define('LOC_PLANET', 1); |
|
180 | +define('LOC_DEBRIS', 2); // Translates to `planets` table planet_type = 1, `debris_*` fields |
|
181 | +define('LOC_MOON', 3); // Translates to `planets` table planet_type = 3 |
|
182 | +define('LOC_USER', 4); |
|
183 | +define('LOC_FLEET', 5); |
|
184 | +define('LOC_ALLY', 6); |
|
185 | +define('LOC_UNIT_NUMERIC', 7); |
|
186 | +define('LOC_UNIT_LIST', 8); |
|
187 | 187 | |
188 | 188 | // ТОЛЬКО ВНУТРЕНЕЕ!!! |
189 | -define('LOC_UNIT', 'LOC_UNIT'); |
|
190 | -define('LOC_QUE', 'LOC_QUE'); |
|
191 | -define('LOC_LOCATION','LOC_LOCATION'); |
|
192 | -define('LOC_LOCKS','LOC_LOCKS'); |
|
189 | +define('LOC_UNIT', 'LOC_UNIT'); |
|
190 | +define('LOC_QUE', 'LOC_QUE'); |
|
191 | +define('LOC_LOCATION', 'LOC_LOCATION'); |
|
192 | +define('LOC_LOCKS', 'LOC_LOCKS'); |
|
193 | 193 | |
194 | 194 | // *** Caching masks |
195 | -define('CACHE_NOTHING' , 0); |
|
196 | -define('CACHE_FLEET' , 1); |
|
197 | -define('CACHE_PLANET' , 2); |
|
198 | -define('CACHE_USER' , 4); |
|
199 | -define('CACHE_SOURCE' , 8); |
|
195 | +define('CACHE_NOTHING', 0); |
|
196 | +define('CACHE_FLEET', 1); |
|
197 | +define('CACHE_PLANET', 2); |
|
198 | +define('CACHE_USER', 4); |
|
199 | +define('CACHE_SOURCE', 8); |
|
200 | 200 | define('CACHE_DESTINATION', 16); |
201 | -define('CACHE_EVENT' , 32); |
|
201 | +define('CACHE_EVENT', 32); |
|
202 | 202 | |
203 | -define('CACHE_USER_SRC' , CACHE_USER | CACHE_SOURCE); |
|
204 | -define('CACHE_USER_DST' , CACHE_USER | CACHE_DESTINATION); |
|
203 | +define('CACHE_USER_SRC', CACHE_USER | CACHE_SOURCE); |
|
204 | +define('CACHE_USER_DST', CACHE_USER | CACHE_DESTINATION); |
|
205 | 205 | define('CACHE_PLANET_SRC', CACHE_PLANET | CACHE_SOURCE); |
206 | 206 | define('CACHE_PLANET_DST', CACHE_PLANET | CACHE_DESTINATION); |
207 | -define('CACHE_COMBAT' , CACHE_FLEET | CACHE_PLANET | CACHE_USER | CACHE_SOURCE | CACHE_DESTINATION); |
|
207 | +define('CACHE_COMBAT', CACHE_FLEET | CACHE_PLANET | CACHE_USER | CACHE_SOURCE | CACHE_DESTINATION); |
|
208 | 208 | |
209 | -define('CACHE_ALL' , CACHE_FLEET | CACHE_PLANET | CACHE_USER | CACHE_SOURCE | CACHE_DESTINATION | CACHE_EVENT); |
|
209 | +define('CACHE_ALL', CACHE_FLEET | CACHE_PLANET | CACHE_USER | CACHE_SOURCE | CACHE_DESTINATION | CACHE_EVENT); |
|
210 | 210 | |
211 | -define('CACHE_NONE' , CACHE_NOTHING); // Alias for me |
|
211 | +define('CACHE_NONE', CACHE_NOTHING); // Alias for me |
|
212 | 212 | |
213 | 213 | // *** Event types |
214 | 214 | define('EVENT_FLEET_ARRIVE', 1); |
215 | -define('EVENT_FLEET_STAY' , 2); |
|
215 | +define('EVENT_FLEET_STAY', 2); |
|
216 | 216 | define('EVENT_FLEET_RETURN', 3); |
217 | 217 | |
218 | 218 | // *** Constants for changing DM |
@@ -267,10 +267,10 @@ discard block |
||
267 | 267 | |
268 | 268 | |
269 | 269 | // Operation error status HARDCODE! |
270 | -define('ERR_NONE' , 0); // No error |
|
271 | -define('ERR_WARNING' , 1); // There is warning - something altering normal operation process |
|
272 | -define('ERR_ERROR' , 2); // There is error - something permits operation from process |
|
273 | -define('ERR_HACK' , 4); // Operation is qualified as hack attempt |
|
270 | +define('ERR_NONE', 0); // No error |
|
271 | +define('ERR_WARNING', 1); // There is warning - something altering normal operation process |
|
272 | +define('ERR_ERROR', 2); // There is error - something permits operation from process |
|
273 | +define('ERR_HACK', 4); // Operation is qualified as hack attempt |
|
274 | 274 | // New GLOBAL operation results |
275 | 275 | //define('RESULT_DEFAULT' , 0); // Default result - all went OK or result really doesn't matter |
276 | 276 | //define('RESULT_WARNING' , 1); |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | define('SN_PAYMENT_REQUEST_OK', 0); |
291 | 291 | define('SN_PAYMENT_REQUEST_ERROR_UNIT_AMOUNT', 1); |
292 | 292 | define('SN_PAYMENT_REQUEST_ERROR_PAYLINK_UNSUPPORTED', 2); |
293 | -define('SN_PAYMENT_REQUEST_IP_WRONG', 3); // Неправильный IP входящей системы - обычно хак |
|
293 | +define('SN_PAYMENT_REQUEST_IP_WRONG', 3); // Неправильный IP входящей системы - обычно хак |
|
294 | 294 | define('SN_PAYMENT_REQUEST_COMMAND_UNSUPPORTED', 4); // Неподдерживаемая команда - обычно хак |
295 | 295 | define('SN_PAYMENT_REQUEST_SIGNATURE_INVALID', 5); // Неправильная подпись или не сошлась контрольная сумма - обычно хак |
296 | 296 | define('SN_MODULE_DISABLED', 6); // Модуль отключен // УНИВЕРСАЛЬНЫЙ ОТВЕТ! |
@@ -563,16 +563,16 @@ discard block |
||
563 | 563 | //define('F_DEVICE_ID', 'F_DEVICE_ID'); |
564 | 564 | //define('F_DEVICE_CYPHER', 'F_DEVICE_CYPHER'); |
565 | 565 | |
566 | -define('F_PROVIDER_ID', 'F_PROVIDER_ID'); |
|
566 | +define('F_PROVIDER_ID', 'F_PROVIDER_ID'); |
|
567 | 567 | // define('F_PROVIDER_LIST', 'F_PROVIDER_LIST'); |
568 | 568 | |
569 | 569 | define('F_IMPERSONATE_STATUS', 'F_IMPERSONATE_STATUS'); |
570 | 570 | define('F_IMPERSONATE_OPERATOR', 'F_IMPERSONATE_OPERATOR'); |
571 | 571 | |
572 | -define('F_LOGIN_STATUS', 'F_LOGIN_STATUS'); |
|
572 | +define('F_LOGIN_STATUS', 'F_LOGIN_STATUS'); |
|
573 | 573 | define('F_LOGIN_MESSAGE', 'F_LOGIN_MESSAGE'); |
574 | 574 | |
575 | -define('F_PLAYER_REGISTER_STATUS', 'F_PLAYER_REGISTER_STATUS'); |
|
575 | +define('F_PLAYER_REGISTER_STATUS', 'F_PLAYER_REGISTER_STATUS'); |
|
576 | 576 | define('F_PLAYER_REGISTER_MESSAGE', 'F_PLAYER_REGISTER_MESSAGE'); |
577 | 577 | |
578 | 578 | define('F_USER_ID', 'F_USER_ID'); |
@@ -616,68 +616,68 @@ discard block |
||
616 | 616 | |
617 | 617 | |
618 | 618 | // Option groups |
619 | -define('OPT_ALL', 0); |
|
620 | -define('OPT_MESSAGE', 1); |
|
619 | +define('OPT_ALL', 0); |
|
620 | +define('OPT_MESSAGE', 1); |
|
621 | 621 | define('OPT_UNIVERSE', 2); |
622 | 622 | define('OPT_INTERFACE', 3); |
623 | 623 | |
624 | 624 | // Message classes |
625 | -define('MSG_TYPE_OUTBOX' , -1); |
|
626 | -define('MSG_TYPE_SPY' , 0); |
|
627 | -define('MSG_TYPE_PLAYER' , 1); |
|
628 | -define('MSG_TYPE_ALLIANCE' , 2); |
|
629 | -define('MSG_TYPE_COMBAT' , 3); |
|
630 | -define('MSG_TYPE_RECYCLE' , 4); |
|
631 | -define('MSG_TYPE_TRANSPORT', 5); |
|
632 | -define('MSG_TYPE_ADMIN' , 6); |
|
633 | -define('MSG_TYPE_EXPLORE' , 15); |
|
634 | -define('MSG_TYPE_QUE' , 99); |
|
635 | -define('MSG_TYPE_NEW' , 100); |
|
625 | +define('MSG_TYPE_OUTBOX', -1); |
|
626 | +define('MSG_TYPE_SPY', 0); |
|
627 | +define('MSG_TYPE_PLAYER', 1); |
|
628 | +define('MSG_TYPE_ALLIANCE', 2); |
|
629 | +define('MSG_TYPE_COMBAT', 3); |
|
630 | +define('MSG_TYPE_RECYCLE', 4); |
|
631 | +define('MSG_TYPE_TRANSPORT', 5); |
|
632 | +define('MSG_TYPE_ADMIN', 6); |
|
633 | +define('MSG_TYPE_EXPLORE', 15); |
|
634 | +define('MSG_TYPE_QUE', 99); |
|
635 | +define('MSG_TYPE_NEW', 100); |
|
636 | 636 | |
637 | 637 | // Attack verification statuses |
638 | -define('FLIGHT_ALLOWED_NEW' , -1); |
|
638 | +define('FLIGHT_ALLOWED_NEW', -1); |
|
639 | 639 | //define('FLIGHT_DO_NOTHING' , 0); |
640 | -define('FLIGHT_ALLOWED' , 0); |
|
641 | -define('FLIGHT_VECTOR_NO_TARGET' , 1); |
|
642 | -define('FLIGHT_PLAYER_OWN' , 2); |
|
643 | -define('FLIGHT_MISSION_IMPOSSIBLE' , 3); |
|
644 | -define('FLIGHT_MISSION_HOLD_NO_ALLY_DEPOSIT' , 4); |
|
645 | -define('FLIGHT_MISSION_RECYCLE_NO_DEBRIS' , 5); |
|
646 | -define('FLIGHT_PLAYER_VACATION' , 6); |
|
647 | -define('FLIGHT_PLAYER_SAME_IP' , 7); |
|
648 | -define('FLIGHT_PLAYER_BUFFING' , 8); |
|
649 | -define('FLIGHT_PLAYER_ADMIN' , 9); |
|
650 | -define('FLIGHT_PLAYER_NOOB' , 10); |
|
651 | -define('FLIGHT_PLAYER_VACATION_OWN' , 11); |
|
652 | -define('FLIGHT_MISSION_MISSILE_NO_SILO' , 12); |
|
653 | -define('FLIGHT_MISSION_MISSILE_NO_MISSILES' , 13); |
|
654 | -define('FLIGHT_SHIPS_NO_SHIPS' , 14); |
|
655 | -define('FLIGHT_FLEET_NO_SLOTS' , 15); |
|
656 | -define('FLIGHT_SHIPS_NOT_ENOUGH_OR_RESOURCES' , 16); |
|
657 | -define('FLIGHT_SHIPS_NO_RECYCLERS' , 17); |
|
658 | -define('FLIGHT_MISSION_SPY_NO_SPIES' , 18); |
|
659 | -define('FLIGHT_SHIPS_NO_COLONIZER' , 19); |
|
660 | -define('FLIGHT_MISSION_MISSILE_TOO_FAR' , 20); |
|
661 | -define('FLIGHT_MISSION_MISSILE_WRONG_STRUCTURE' , 21); |
|
662 | -define('FLIGHT_RESOURCES_FUEL_NOT_ENOUGH' , 22); |
|
663 | -define('FLIGHT_RESOURCES_NOT_ENOUGH' , 23); |
|
664 | -define('FLIGHT_MISSION_ACS_NOT_EXISTS' , 24); |
|
665 | -define('FLIGHT_MISSION_ACS_MISSTARGET' , 25); |
|
666 | -define('FLIGHT_FLEET_SPEED_WRONG' , 26); |
|
667 | -define('FLIGHT_MISSION_ACS_TOO_LATE' , 27); |
|
668 | -define('FLIGHT_MISSION_ATTACK_BASHING' , 28); |
|
669 | -define('FLIGHT_MISSION_ATTACK_BASHING_WAR_DELAY' , 29); |
|
670 | -define('FLIGHT_MISSION_ACS_WRONG_TARGET' , 30); |
|
671 | -define('FLIGHT_VECTOR_SAME_SOURCE' , 31); |
|
640 | +define('FLIGHT_ALLOWED', 0); |
|
641 | +define('FLIGHT_VECTOR_NO_TARGET', 1); |
|
642 | +define('FLIGHT_PLAYER_OWN', 2); |
|
643 | +define('FLIGHT_MISSION_IMPOSSIBLE', 3); |
|
644 | +define('FLIGHT_MISSION_HOLD_NO_ALLY_DEPOSIT', 4); |
|
645 | +define('FLIGHT_MISSION_RECYCLE_NO_DEBRIS', 5); |
|
646 | +define('FLIGHT_PLAYER_VACATION', 6); |
|
647 | +define('FLIGHT_PLAYER_SAME_IP', 7); |
|
648 | +define('FLIGHT_PLAYER_BUFFING', 8); |
|
649 | +define('FLIGHT_PLAYER_ADMIN', 9); |
|
650 | +define('FLIGHT_PLAYER_NOOB', 10); |
|
651 | +define('FLIGHT_PLAYER_VACATION_OWN', 11); |
|
652 | +define('FLIGHT_MISSION_MISSILE_NO_SILO', 12); |
|
653 | +define('FLIGHT_MISSION_MISSILE_NO_MISSILES', 13); |
|
654 | +define('FLIGHT_SHIPS_NO_SHIPS', 14); |
|
655 | +define('FLIGHT_FLEET_NO_SLOTS', 15); |
|
656 | +define('FLIGHT_SHIPS_NOT_ENOUGH_OR_RESOURCES', 16); |
|
657 | +define('FLIGHT_SHIPS_NO_RECYCLERS', 17); |
|
658 | +define('FLIGHT_MISSION_SPY_NO_SPIES', 18); |
|
659 | +define('FLIGHT_SHIPS_NO_COLONIZER', 19); |
|
660 | +define('FLIGHT_MISSION_MISSILE_TOO_FAR', 20); |
|
661 | +define('FLIGHT_MISSION_MISSILE_WRONG_STRUCTURE', 21); |
|
662 | +define('FLIGHT_RESOURCES_FUEL_NOT_ENOUGH', 22); |
|
663 | +define('FLIGHT_RESOURCES_NOT_ENOUGH', 23); |
|
664 | +define('FLIGHT_MISSION_ACS_NOT_EXISTS', 24); |
|
665 | +define('FLIGHT_MISSION_ACS_MISSTARGET', 25); |
|
666 | +define('FLIGHT_FLEET_SPEED_WRONG', 26); |
|
667 | +define('FLIGHT_MISSION_ACS_TOO_LATE', 27); |
|
668 | +define('FLIGHT_MISSION_ATTACK_BASHING', 28); |
|
669 | +define('FLIGHT_MISSION_ATTACK_BASHING_WAR_DELAY', 29); |
|
670 | +define('FLIGHT_MISSION_ACS_WRONG_TARGET', 30); |
|
671 | +define('FLIGHT_VECTOR_SAME_SOURCE', 31); |
|
672 | 672 | define('FLIGHT_RESOURCES_FORBIDDEN', 32); |
673 | -define('FLIGHT_MISSION_TRANSPORT_EMPTY_CARGO' , 33); |
|
674 | -define('FLIGHT_SHIPS_NOT_ONLY_SPIES' , 34); |
|
675 | -define('FLIGHT_FLEET_TOO_FAR' , 35); |
|
676 | -define('FLIGHT_FLEET_OVERLOAD' , 36); |
|
677 | -define('FLIGHT_MISSION_UNKNOWN' , 37); |
|
678 | -define('FLIGHT_SHIPS_UNIT_WRONG' , 38); |
|
679 | -define('FLIGHT_SHIPS_UNMOVABLE' , 39); |
|
680 | -define('FLIGHT_SHIPS_NEGATIVE' , 40); |
|
673 | +define('FLIGHT_MISSION_TRANSPORT_EMPTY_CARGO', 33); |
|
674 | +define('FLIGHT_SHIPS_NOT_ONLY_SPIES', 34); |
|
675 | +define('FLIGHT_FLEET_TOO_FAR', 35); |
|
676 | +define('FLIGHT_FLEET_OVERLOAD', 36); |
|
677 | +define('FLIGHT_MISSION_UNKNOWN', 37); |
|
678 | +define('FLIGHT_SHIPS_UNIT_WRONG', 38); |
|
679 | +define('FLIGHT_SHIPS_UNMOVABLE', 39); |
|
680 | +define('FLIGHT_SHIPS_NEGATIVE', 40); |
|
681 | 681 | define('FLIGHT_RESOURCES_NEGATIVE', 41); |
682 | 682 | define('FLIGHT_MISSION_MORATORIUM', 42); |
683 | 683 | define('FLIGHT_PLAYER_CHILD_PROTECTION', 43); |
@@ -711,12 +711,12 @@ discard block |
||
711 | 711 | |
712 | 712 | |
713 | 713 | // *** Races - Homeworlds |
714 | -define('RACE_NONE' , 0); |
|
715 | -define('RACE_EARTH' , 1); |
|
716 | -define('RACE_MOON' , 2); |
|
717 | -define('RACE_MERCURY' , 3); |
|
718 | -define('RACE_VENUS' , 4); |
|
719 | -define('RACE_MARS' , 5); |
|
714 | +define('RACE_NONE', 0); |
|
715 | +define('RACE_EARTH', 1); |
|
716 | +define('RACE_MOON', 2); |
|
717 | +define('RACE_MERCURY', 3); |
|
718 | +define('RACE_VENUS', 4); |
|
719 | +define('RACE_MARS', 5); |
|
720 | 720 | define('RACE_ASTEROID', 6); |
721 | 721 | // define('MARKET_INFO' , 7); |
722 | 722 | |
@@ -724,114 +724,114 @@ discard block |
||
724 | 724 | |
725 | 725 | // *** Market variables |
726 | 726 | // === Market blocks |
727 | -define('MARKET_ENTRY' , 0); |
|
728 | -define('MARKET_RESOURCES' , 1); |
|
729 | -define('MARKET_SCRAPPER' , 2); |
|
730 | -define('MARKET_STOCKMAN' , 3); |
|
731 | -define('MARKET_EXCHANGE' , 4); |
|
732 | -define('MARKET_BANKER' , 5); |
|
733 | -define('MARKET_PAWNSHOP' , 6); |
|
734 | -define('MARKET_INFO' , 7); |
|
727 | +define('MARKET_ENTRY', 0); |
|
728 | +define('MARKET_RESOURCES', 1); |
|
729 | +define('MARKET_SCRAPPER', 2); |
|
730 | +define('MARKET_STOCKMAN', 3); |
|
731 | +define('MARKET_EXCHANGE', 4); |
|
732 | +define('MARKET_BANKER', 5); |
|
733 | +define('MARKET_PAWNSHOP', 6); |
|
734 | +define('MARKET_INFO', 7); |
|
735 | 735 | |
736 | 736 | // === Market error statuses |
737 | -define('MARKET_NOTHING' , 0); |
|
738 | -define('MARKET_DEAL' , 1); |
|
739 | -define('MARKET_DEAL_TRADE' , 2); |
|
740 | -define('MARKET_NO_DM' , 3); |
|
741 | -define('MARKET_NO_RESOURCES' , 4); |
|
742 | -define('MARKET_ZERO_DEAL' , 5); |
|
743 | -define('MARKET_NO_SHIPS' , 6); |
|
744 | -define('MARKET_NOT_A_SHIP' , 7); |
|
745 | -define('MARKET_NO_STOCK' , 8); |
|
746 | -define('MARKET_ZERO_RES_STOCK' , 9); |
|
747 | -define('MARKET_NEGATIVE_SHIPS' , 10); |
|
748 | - |
|
749 | -define('MARKET_INFO_PLAYER' , 12); |
|
750 | -define('MARKET_INFO_WRONG' , 11); |
|
737 | +define('MARKET_NOTHING', 0); |
|
738 | +define('MARKET_DEAL', 1); |
|
739 | +define('MARKET_DEAL_TRADE', 2); |
|
740 | +define('MARKET_NO_DM', 3); |
|
741 | +define('MARKET_NO_RESOURCES', 4); |
|
742 | +define('MARKET_ZERO_DEAL', 5); |
|
743 | +define('MARKET_NO_SHIPS', 6); |
|
744 | +define('MARKET_NOT_A_SHIP', 7); |
|
745 | +define('MARKET_NO_STOCK', 8); |
|
746 | +define('MARKET_ZERO_RES_STOCK', 9); |
|
747 | +define('MARKET_NEGATIVE_SHIPS', 10); |
|
748 | + |
|
749 | +define('MARKET_INFO_PLAYER', 12); |
|
750 | +define('MARKET_INFO_WRONG', 11); |
|
751 | 751 | define('MARKET_INFO_PLAYER_NOT_FOUND', 13); |
752 | -define('MARKET_INFO_PLAYER_WRONG' , 14); |
|
753 | -define('MARKET_INFO_PLAYER_SAME' , 15); |
|
752 | +define('MARKET_INFO_PLAYER_WRONG', 14); |
|
753 | +define('MARKET_INFO_PLAYER_SAME', 15); |
|
754 | 754 | |
755 | 755 | |
756 | 756 | |
757 | 757 | |
758 | 758 | // *** Mercenary/talent bonus types |
759 | -define('BONUS_NONE' , 0); // No bonus |
|
760 | -define('BONUS_PERCENT' , 1); // Percent on base value |
|
761 | -define('BONUS_ADD' , 2); // Add |
|
762 | -define('BONUS_ABILITY' , 3); // Some ability |
|
763 | -define('BONUS_MULTIPLY', 4); // Multiply by value |
|
764 | -define('BONUS_PERCENT_CUMULATIVE' , 5); // Cumulative percent on base value |
|
765 | -define('BONUS_PERCENT_DEGRADED' , 6); // Bonus amount degraded with increase as pow(bonus, level) (?) |
|
766 | -define('BONUS_SPEED', 7); // Speed bonus |
|
759 | +define('BONUS_NONE', 0); // No bonus |
|
760 | +define('BONUS_PERCENT', 1); // Percent on base value |
|
761 | +define('BONUS_ADD', 2); // Add |
|
762 | +define('BONUS_ABILITY', 3); // Some ability |
|
763 | +define('BONUS_MULTIPLY', 4); // Multiply by value |
|
764 | +define('BONUS_PERCENT_CUMULATIVE', 5); // Cumulative percent on base value |
|
765 | +define('BONUS_PERCENT_DEGRADED', 6); // Bonus amount degraded with increase as pow(bonus, level) (?) |
|
766 | +define('BONUS_SPEED', 7); // Speed bonus |
|
767 | 767 | |
768 | 768 | // *** Action constant (build should be replaced with ACTION) |
769 | -define('BUILD_CREATE' , 1); |
|
769 | +define('BUILD_CREATE', 1); |
|
770 | 770 | define('BUILD_DESTROY', -1); |
771 | 771 | define('BUILD_AUTOCONVERT', 2); |
772 | 772 | |
773 | -define('ACTION_SELL' , -1); |
|
774 | -define('ACTION_NOTHING' , 0); |
|
775 | -define('ACTION_BUY' , 1); |
|
776 | -define('ACTION_USE' , 2); |
|
777 | -define('ACTION_DELETE' , 3); |
|
773 | +define('ACTION_SELL', -1); |
|
774 | +define('ACTION_NOTHING', 0); |
|
775 | +define('ACTION_BUY', 1); |
|
776 | +define('ACTION_USE', 2); |
|
777 | +define('ACTION_DELETE', 3); |
|
778 | 778 | |
779 | 779 | // *** Check unit availability codes |
780 | -define('BUILD_ALLOWED' , 0); // HARDCODED! DO NOT CHANGE! |
|
780 | +define('BUILD_ALLOWED', 0); // HARDCODED! DO NOT CHANGE! |
|
781 | 781 | define('BUILD_REQUIRE_NOT_MEET', 1); |
782 | -define('BUILD_AMOUNT_WRONG' , 2); |
|
783 | -define('BUILD_QUE_WRONG' , 3); |
|
784 | -define('BUILD_QUE_UNIT_WRONG' , 4); |
|
785 | -define('BUILD_INDESTRUCTABLE' , 5); |
|
786 | -define('BUILD_NO_RESOURCES' , 6); |
|
787 | -define('BUILD_NO_UNITS' , 7); |
|
788 | -define('BUILD_UNIT_BUSY' , 8); |
|
789 | -define('BUILD_QUE_FULL' , 9); |
|
790 | -define('BUILD_SILO_FULL' ,10); |
|
791 | -define('BUILD_MAX_REACHED' ,11); |
|
792 | -define('BUILD_SECTORS_NONE' ,12); |
|
782 | +define('BUILD_AMOUNT_WRONG', 2); |
|
783 | +define('BUILD_QUE_WRONG', 3); |
|
784 | +define('BUILD_QUE_UNIT_WRONG', 4); |
|
785 | +define('BUILD_INDESTRUCTABLE', 5); |
|
786 | +define('BUILD_NO_RESOURCES', 6); |
|
787 | +define('BUILD_NO_UNITS', 7); |
|
788 | +define('BUILD_UNIT_BUSY', 8); |
|
789 | +define('BUILD_QUE_FULL', 9); |
|
790 | +define('BUILD_SILO_FULL', 10); |
|
791 | +define('BUILD_MAX_REACHED', 11); |
|
792 | +define('BUILD_SECTORS_NONE', 12); |
|
793 | 793 | define('BUILD_AUTOCONVERT_AVAILABLE', 13); |
794 | 794 | |
795 | 795 | |
796 | 796 | // *** Que types |
797 | 797 | define('QUE_STRUCTURES', 1); |
798 | -define('QUE_HANGAR' , 4); |
|
799 | -define('QUE_RESEARCH' , 7); |
|
800 | -define('QUE_MERCENARY' , 600); // UNIT_MERCENARIES |
|
798 | +define('QUE_HANGAR', 4); |
|
799 | +define('QUE_RESEARCH', 7); |
|
800 | +define('QUE_MERCENARY', 600); // UNIT_MERCENARIES |
|
801 | 801 | // *** Subque types |
802 | -define('SUBQUE_PLANET' , 1); |
|
803 | -define('SUBQUE_MOON' , 3); |
|
804 | -define('SUBQUE_FLEET' , 4); |
|
805 | -define('SUBQUE_DEFENSE' , 6); |
|
802 | +define('SUBQUE_PLANET', 1); |
|
803 | +define('SUBQUE_MOON', 3); |
|
804 | +define('SUBQUE_FLEET', 4); |
|
805 | +define('SUBQUE_DEFENSE', 6); |
|
806 | 806 | define('SUBQUE_RESEARCH', 7); |
807 | 807 | |
808 | 808 | // *** Que items |
809 | -define('QI_UNIT_ID' , 0); |
|
810 | -define('QI_AMOUNT' , 1); |
|
811 | -define('QI_TIME' , 2); |
|
812 | -define('QI_MODE' , 3); |
|
813 | -define('QI_QUE_ID' , 4); |
|
814 | -define('QI_QUE_TYPE' , 4); |
|
815 | -define('QI_PLANET_ID' , 5); |
|
809 | +define('QI_UNIT_ID', 0); |
|
810 | +define('QI_AMOUNT', 1); |
|
811 | +define('QI_TIME', 2); |
|
812 | +define('QI_MODE', 3); |
|
813 | +define('QI_QUE_ID', 4); |
|
814 | +define('QI_QUE_TYPE', 4); |
|
815 | +define('QI_PLANET_ID', 5); |
|
816 | 816 | |
817 | 817 | |
818 | 818 | // *** Units |
819 | 819 | |
820 | 820 | // *** Sort options |
821 | -define('SORT_ASCENDING' , 0); |
|
821 | +define('SORT_ASCENDING', 0); |
|
822 | 822 | define('SORT_DESCENDING', 1); |
823 | 823 | |
824 | -define('SORT_ID' , 0); |
|
825 | -define('SORT_LOCATION' , 1); |
|
826 | -define('SORT_NAME' , 2); |
|
827 | -define('SORT_SIZE' , 3); |
|
828 | -define('SORT_EMAIL' , 4); |
|
829 | -define('SORT_IP' , 5); |
|
824 | +define('SORT_ID', 0); |
|
825 | +define('SORT_LOCATION', 1); |
|
826 | +define('SORT_NAME', 2); |
|
827 | +define('SORT_SIZE', 3); |
|
828 | +define('SORT_EMAIL', 4); |
|
829 | +define('SORT_IP', 5); |
|
830 | 830 | define('SORT_TIME_REGISTERED', 6); |
831 | 831 | define('SORT_TIME_LAST_VISIT', 7); |
832 | -define('SORT_TIME_BAN_UNTIL' , 8); |
|
833 | -define('SORT_REFERRAL_COUNT' , 9); |
|
834 | -define('SORT_REFERRAL_DM' , 10); |
|
832 | +define('SORT_TIME_BAN_UNTIL', 8); |
|
833 | +define('SORT_REFERRAL_COUNT', 9); |
|
834 | +define('SORT_REFERRAL_DM', 10); |
|
835 | 835 | |
836 | 836 | |
837 | 837 | define('HULL_SIZE_TINY', 1); |
@@ -974,10 +974,10 @@ discard block |
||
974 | 974 | |
975 | 975 | // === Artifacts |
976 | 976 | define('UNIT_ARTIFACTS', 1000); |
977 | -define('ART_LHC', 1001); // Additional moon chance |
|
978 | -define('ART_RCD_SMALL', 1002); // Rapid Colony Deployment - Set of buildings up to 10th level - 10/14/ 3/0 - 405 DM |
|
979 | -define('ART_RCD_MEDIUM', 1003); // Rapid Colony Deployment - Set of buildings up to 15th level - 15/20/ 8/0 - 4704 DM |
|
980 | -define('ART_RCD_LARGE', 1004); // Rapid Colony Deployment - Set of buildings up to 20th level - 20/25/10/1 - 39790 DM |
|
977 | +define('ART_LHC', 1001); // Additional moon chance |
|
978 | +define('ART_RCD_SMALL', 1002); // Rapid Colony Deployment - Set of buildings up to 10th level - 10/14/ 3/0 - 405 DM |
|
979 | +define('ART_RCD_MEDIUM', 1003); // Rapid Colony Deployment - Set of buildings up to 15th level - 15/20/ 8/0 - 4704 DM |
|
980 | +define('ART_RCD_LARGE', 1004); // Rapid Colony Deployment - Set of buildings up to 20th level - 20/25/10/1 - 39790 DM |
|
981 | 981 | define('ART_HEURISTIC_CHIP', 1005); // Speed up research |
982 | 982 | define('ART_NANO_BUILDER', 1006); // Speed up building |
983 | 983 | define('ART_NANO_CONSTRUCTOR', 1007); // RESERVED Speed up hangar constructions |
@@ -1048,18 +1048,18 @@ discard block |
||
1048 | 1048 | define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE1', 2201); // Блиц-сервер, участник 0-го раунда, 1-е место |
1049 | 1049 | define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE2', 2202); // Блиц-сервер, участник 0-го раунда, 2-е место |
1050 | 1050 | define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE3', 2203); // Блиц-сервер, участник 0-го раунда, 3-е место |
1051 | -define('UNIT_AWARD_MEDAL_2016_WOMEN_DAY_BEST', 2204); // Медаль Лучшему Кавалеру за максимум потраченной ММ/максимум одаренных женщин Женщине от Мужчины во время ивента 8 марта 2016 года |
|
1051 | +define('UNIT_AWARD_MEDAL_2016_WOMEN_DAY_BEST', 2204); // Медаль Лучшему Кавалеру за максимум потраченной ММ/максимум одаренных женщин Женщине от Мужчины во время ивента 8 марта 2016 года |
|
1052 | 1052 | |
1053 | 1053 | define('UNIT_AWARD_MEMORY', 2300); // Памятные знаки за существование и участие - например "4 года в игре". "Был онлайн в новогоднюю ночь 2013". итд |
1054 | -define('UNIT_AWARD_MEMORY_IMMORTAL', 2301); // Бессмертный |
|
1055 | -define('UNIT_AWARD_MEMORY_2015_WOMEN_DAY', 2302); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2015 года |
|
1054 | +define('UNIT_AWARD_MEMORY_IMMORTAL', 2301); // Бессмертный |
|
1055 | +define('UNIT_AWARD_MEMORY_2015_WOMEN_DAY', 2302); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2015 года |
|
1056 | 1056 | define('UNIT_AWARD_MEMORY_BLITZ_R0', 2303); // Блиц-сервер, участник 0-го раунда |
1057 | 1057 | define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_SIMPLE', 2304); // День Рождения СН |
1058 | 1058 | define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_BRONZE', 2305); // День Рождения СН |
1059 | 1059 | define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_SILVER', 2306); // День Рождения СН |
1060 | 1060 | define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_GOLD', 2307); // День Рождения СН |
1061 | 1061 | define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_PLATINUM', 2308); // День Рождения СН |
1062 | -define('UNIT_AWARD_MEMORY_2016_WOMEN_DAY', 2309); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2016 года |
|
1062 | +define('UNIT_AWARD_MEMORY_2016_WOMEN_DAY', 2309); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2016 года |
|
1063 | 1063 | |
1064 | 1064 | define('UNIT_AWARD_PENNANT', 2400); // Переходящий вымпел - индикация статуса на сервере: "Топ-1", "Топ", "Сабтоп", "Самый большой флот" итд |
1065 | 1065 | define('UNIT_AWARD_BADGE', 2600); // Бейджики/значки за ачивки - например, "Построил 1000 кораблей" |
@@ -1156,7 +1156,7 @@ discard block |
||
1156 | 1156 | |
1157 | 1157 | define('UNIT_NEXT', 4000); // !!! Next unit start on 4000 !!! |
1158 | 1158 | |
1159 | -define('GROUP_PART', 800000); |
|
1159 | +define('GROUP_PART', 800000); |
|
1160 | 1160 | // Зарезервировано для запчастей: 800.001 - 899.999 |
1161 | 1161 | // define('GROUP_PART_HULL', 801000); // Корпуса - 1000 штук |
1162 | 1162 | // define('GROUP_PART_ARMOR', 802000); // Броня - 1000 штук |
@@ -1413,32 +1413,32 @@ discard block |
||
1413 | 1413 | |
1414 | 1414 | |
1415 | 1415 | // define('NICK_ID', -1); |
1416 | -define('NICK_HTML', 0); |
|
1417 | - |
|
1418 | -define('NICK_FIRST', 1); |
|
1419 | -define('NICK_RACE', 1000); |
|
1420 | -define('NICK_GENDER', 2000); |
|
1421 | -define('NICK_AWARD', 3000); |
|
1422 | -define('NICK_VACATION', 3500); |
|
1423 | -define('NICK_BIRTHSDAY', 4000); |
|
1424 | -define('NICK_PREMIUM', 5000); |
|
1425 | -define('NICK_AUTH_LEVEL', 6000); |
|
1426 | - |
|
1427 | -define('NICK_HIGHLIGHT', 6300); |
|
1428 | -define('NICK_CLASS', 6450); |
|
1429 | - |
|
1430 | -define('NICK_NICK_CLASS', 6600); |
|
1431 | -define('NICK_NICK', 7000); |
|
1416 | +define('NICK_HTML', 0); |
|
1417 | + |
|
1418 | +define('NICK_FIRST', 1); |
|
1419 | +define('NICK_RACE', 1000); |
|
1420 | +define('NICK_GENDER', 2000); |
|
1421 | +define('NICK_AWARD', 3000); |
|
1422 | +define('NICK_VACATION', 3500); |
|
1423 | +define('NICK_BIRTHSDAY', 4000); |
|
1424 | +define('NICK_PREMIUM', 5000); |
|
1425 | +define('NICK_AUTH_LEVEL', 6000); |
|
1426 | + |
|
1427 | +define('NICK_HIGHLIGHT', 6300); |
|
1428 | +define('NICK_CLASS', 6450); |
|
1429 | + |
|
1430 | +define('NICK_NICK_CLASS', 6600); |
|
1431 | +define('NICK_NICK', 7000); |
|
1432 | 1432 | define('NICK_NICK_CLASS_END', 7300); |
1433 | 1433 | |
1434 | -define('NICK_ALLY_CLASS', 7600); |
|
1435 | -define('NICK_ALLY', 8000); |
|
1434 | +define('NICK_ALLY_CLASS', 7600); |
|
1435 | +define('NICK_ALLY', 8000); |
|
1436 | 1436 | define('NICK_ALLY_CLASS_END', 8300); |
1437 | 1437 | |
1438 | -define('NICK_CLASS_END', 8450); |
|
1439 | -define('NICK_HIGHLIGHT_END', 8600); |
|
1438 | +define('NICK_CLASS_END', 8450); |
|
1439 | +define('NICK_HIGHLIGHT_END', 8600); |
|
1440 | 1440 | |
1441 | -define('NICK_LAST', 9999); |
|
1441 | +define('NICK_LAST', 9999); |
|
1442 | 1442 | |
1443 | 1443 | // Настройки игрока |
1444 | 1444 | define('PLAYER_OPTION_MENU_SORT', 1); |
@@ -1531,8 +1531,8 @@ discard block |
||
1531 | 1531 | define('LOG_ONLIINE_AGGREGATE_PERIOD_MINUTE_10', 1); |
1532 | 1532 | |
1533 | 1533 | define('BLITZ_REGISTER_DISABLED', 0); |
1534 | -define('BLITZ_REGISTER_OPEN' , 1); |
|
1535 | -define('BLITZ_REGISTER_CLOSED' , 2); |
|
1534 | +define('BLITZ_REGISTER_OPEN', 1); |
|
1535 | +define('BLITZ_REGISTER_CLOSED', 2); |
|
1536 | 1536 | define('BLITZ_REGISTER_SHOW_LOGIN', 3); |
1537 | 1537 | define('BLITZ_REGISTER_DISCLOSURE_NAMES', 4); |
1538 | 1538 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Защита от двойного инита |
4 | -if(defined('INIT')) { |
|
4 | +if (defined('INIT')) { |
|
5 | 5 | return; |
6 | 6 | } |
7 | 7 | |
@@ -20,22 +20,22 @@ discard block |
||
20 | 20 | version_compare(PHP_VERSION, '5.3.2') < 0 ? die('FATAL ERROR: SuperNova REQUIRE PHP version > 5.3.2') : false; |
21 | 21 | |
22 | 22 | // Бенчмарк |
23 | -register_shutdown_function(function () { |
|
24 | - if(defined('IN_AJAX')) { |
|
23 | +register_shutdown_function(function() { |
|
24 | + if (defined('IN_AJAX')) { |
|
25 | 25 | return; |
26 | 26 | } |
27 | 27 | |
28 | 28 | global $user, $locale_cache_statistic; |
29 | 29 | |
30 | - print('<hr><div class="benchmark">Benchmark ' . (microtime(true) - SN_TIME_MICRO) . 's, memory: ' . number_format(memory_get_usage() - SN_MEM_START) . |
|
31 | - (!empty($locale_cache_statistic['misses']) ? ', LOCALE MISSED' : '') . |
|
32 | - (class_exists('classSupernova') && is_object(classSupernova::$db) ? ', DB time: ' . classSupernova::$db->time_mysql_total . 'ms' : '') . |
|
30 | + print('<hr><div class="benchmark">Benchmark '.(microtime(true) - SN_TIME_MICRO).'s, memory: '.number_format(memory_get_usage() - SN_MEM_START). |
|
31 | + (!empty($locale_cache_statistic['misses']) ? ', LOCALE MISSED' : ''). |
|
32 | + (class_exists('classSupernova') && is_object(classSupernova::$db) ? ', DB time: '.classSupernova::$db->time_mysql_total.'ms' : ''). |
|
33 | 33 | '</div>'); |
34 | - if($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL . 'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL . 'badqrys.txt') > 0) { |
|
34 | + if ($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL.'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL.'badqrys.txt') > 0) { |
|
35 | 35 | echo '<a href="badqrys.txt" target="_blank" style="color:red">', 'HACK ALERT!', '</a>'; |
36 | 36 | } |
37 | 37 | |
38 | - if(!empty($locale_cache_statistic['misses'])) { |
|
38 | + if (!empty($locale_cache_statistic['misses'])) { |
|
39 | 39 | print('<!--'); |
40 | 40 | pdump($locale_cache_statistic); |
41 | 41 | print('-->'); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | define('SN_TIME_NOW_GMT_STRING', gmdate(DATE_ATOM, SN_TIME_NOW)); |
57 | 57 | |
58 | -if(strpos(strtolower($_SERVER['SERVER_NAME']), 'google.') !== false) { |
|
58 | +if (strpos(strtolower($_SERVER['SERVER_NAME']), 'google.') !== false) { |
|
59 | 59 | define('SN_GOOGLE', true); |
60 | 60 | } |
61 | 61 | |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | $sn_root_relative = str_replace($sn_root_relative, '', $_SERVER['SCRIPT_NAME']); |
75 | 75 | define('SN_ROOT_RELATIVE', $sn_root_relative); |
76 | 76 | |
77 | -define('SN_ROOT_VIRTUAL', 'http' . (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . SN_ROOT_RELATIVE); |
|
77 | +define('SN_ROOT_VIRTUAL', 'http'.(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '').'://'.$_SERVER['HTTP_HOST'].SN_ROOT_RELATIVE); |
|
78 | 78 | define('SN_ROOT_VIRTUAL_PARENT', str_replace('//google.', '//', SN_ROOT_VIRTUAL)); |
79 | 79 | |
80 | 80 | $phpEx = strpos($phpEx = substr(strrchr(__FILE__, '.'), 1), '/') === false ? $phpEx : ''; |
81 | 81 | define('PHP_EX', $phpEx); // PHP extension on this server |
82 | -define('DOT_PHP_EX', '.' . PHP_EX); // PHP extension on this server |
|
82 | +define('DOT_PHP_EX', '.'.PHP_EX); // PHP extension on this server |
|
83 | 83 | |
84 | 84 | |
85 | 85 | require_once('constants.php'); |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | |
101 | 101 | // required for db.php |
102 | 102 | // Initializing global 'debug' object |
103 | -require_once(SN_ROOT_PHYSICAL . "includes/debug.class" . DOT_PHP_EX); |
|
103 | +require_once(SN_ROOT_PHYSICAL."includes/debug.class".DOT_PHP_EX); |
|
104 | 104 | classSupernova::$debug = new debug(); |
105 | 105 | |
106 | -spl_autoload_register(function ($class) { |
|
107 | - if(file_exists(SN_ROOT_PHYSICAL . 'includes/classes/' . $class . '.php')) { |
|
108 | - require_once SN_ROOT_PHYSICAL . 'includes/classes/' . $class . '.php'; |
|
109 | - } elseif(file_exists(SN_ROOT_PHYSICAL . 'includes/classes/UBE/' . $class . '.php')) { |
|
110 | - require_once SN_ROOT_PHYSICAL . 'includes/classes/UBE/' . $class . '.php'; |
|
106 | +spl_autoload_register(function($class) { |
|
107 | + if (file_exists(SN_ROOT_PHYSICAL.'includes/classes/'.$class.'.php')) { |
|
108 | + require_once SN_ROOT_PHYSICAL.'includes/classes/'.$class.'.php'; |
|
109 | + } elseif (file_exists(SN_ROOT_PHYSICAL.'includes/classes/UBE/'.$class.'.php')) { |
|
110 | + require_once SN_ROOT_PHYSICAL.'includes/classes/UBE/'.$class.'.php'; |
|
111 | 111 | } |
112 | 112 | }); |
113 | 113 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | //}); |
123 | 123 | |
124 | 124 | |
125 | -require_once(SN_ROOT_PHYSICAL . "includes/db" . DOT_PHP_EX); |
|
125 | +require_once(SN_ROOT_PHYSICAL."includes/db".DOT_PHP_EX); |
|
126 | 126 | require_once('classes/db_mysql_v4.php'); |
127 | 127 | require_once('classes/db_mysql_v5.php'); |
128 | 128 | require_once('classes/db_mysql.php'); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | require_once('classes/module.php'); |
136 | 136 | |
137 | 137 | require_once('classes/user_options.php'); |
138 | -require_once(SN_ROOT_PHYSICAL . "includes/init/init_functions" . DOT_PHP_EX); |
|
138 | +require_once(SN_ROOT_PHYSICAL."includes/init/init_functions".DOT_PHP_EX); |
|
139 | 139 | |
140 | 140 | /** |
141 | 141 | * @var classConfig $config |
@@ -148,8 +148,8 @@ discard block |
||
148 | 148 | // define('BE_DEBUG', true); // Отладка боевого движка |
149 | 149 | classSupernova::init_debug_state(); |
150 | 150 | |
151 | -require_once(SN_ROOT_PHYSICAL . "includes/vars" . DOT_PHP_EX); |
|
152 | -require_once(SN_ROOT_PHYSICAL . "includes/general" . DOT_PHP_EX); |
|
151 | +require_once(SN_ROOT_PHYSICAL."includes/vars".DOT_PHP_EX); |
|
152 | +require_once(SN_ROOT_PHYSICAL."includes/general".DOT_PHP_EX); |
|
153 | 153 | |
154 | 154 | init_update(); |
155 | 155 | |
@@ -158,28 +158,28 @@ discard block |
||
158 | 158 | ? trim(strip_tags($_GET['page'])) |
159 | 159 | : str_replace(DOT_PHP_EX, '', str_replace(SN_ROOT_RELATIVE, '', str_replace('\\', '/', $_SERVER['SCRIPT_NAME']))); |
160 | 160 | define('INITIAL_PAGE', $sn_page_name_original); |
161 | -define('SN_COOKIE', (classSupernova::$config->COOKIE_NAME ? classSupernova::$config->COOKIE_NAME : 'SuperNova') . (defined('SN_GOOGLE') ? '_G' : '')); |
|
162 | -define('SN_COOKIE_I', SN_COOKIE . AUTH_COOKIE_IMPERSONATE_SUFFIX); |
|
163 | -define('SN_COOKIE_D', SN_COOKIE . '_D'); |
|
164 | -define('SN_COOKIE_T', SN_COOKIE . '_T'); // Time measure cookie |
|
165 | -define('SN_COOKIE_F', SN_COOKIE . '_F'); // Font size cookie |
|
166 | -define('SN_COOKIE_U', SN_COOKIE . '_U'); // Current user cookie aka user ID |
|
167 | -define('SN_COOKIE_U_I', SN_COOKIE_U . AUTH_COOKIE_IMPERSONATE_SUFFIX); // Current impersonator user cookie aka impersonator user ID |
|
161 | +define('SN_COOKIE', (classSupernova::$config->COOKIE_NAME ? classSupernova::$config->COOKIE_NAME : 'SuperNova').(defined('SN_GOOGLE') ? '_G' : '')); |
|
162 | +define('SN_COOKIE_I', SN_COOKIE.AUTH_COOKIE_IMPERSONATE_SUFFIX); |
|
163 | +define('SN_COOKIE_D', SN_COOKIE.'_D'); |
|
164 | +define('SN_COOKIE_T', SN_COOKIE.'_T'); // Time measure cookie |
|
165 | +define('SN_COOKIE_F', SN_COOKIE.'_F'); // Font size cookie |
|
166 | +define('SN_COOKIE_U', SN_COOKIE.'_U'); // Current user cookie aka user ID |
|
167 | +define('SN_COOKIE_U_I', SN_COOKIE_U.AUTH_COOKIE_IMPERSONATE_SUFFIX); // Current impersonator user cookie aka impersonator user ID |
|
168 | 168 | define('TEMPLATE_NAME', classSupernova::$config->game_default_template ? classSupernova::$config->game_default_template : 'OpenGame'); |
169 | -define('TEMPLATE_PATH', 'design/templates/' . TEMPLATE_NAME); |
|
170 | -define('TEMPLATE_DIR', SN_ROOT_PHYSICAL . TEMPLATE_PATH); |
|
169 | +define('TEMPLATE_PATH', 'design/templates/'.TEMPLATE_NAME); |
|
170 | +define('TEMPLATE_DIR', SN_ROOT_PHYSICAL.TEMPLATE_PATH); |
|
171 | 171 | define('DEFAULT_SKINPATH', classSupernova::$config->game_default_skin ? classSupernova::$config->game_default_skin : 'skins/EpicBlue/'); |
172 | 172 | define('DEFAULT_LANG', classSupernova::$config->game_default_language ? classSupernova::$config->game_default_language : 'ru'); |
173 | 173 | define('FMT_DATE', classSupernova::$config->int_format_date ? classSupernova::$config->int_format_date : 'd.m.Y'); |
174 | 174 | define('FMT_TIME', classSupernova::$config->int_format_time ? classSupernova::$config->int_format_time : 'H:i:s'); |
175 | -define('FMT_DATE_TIME', FMT_DATE . ' ' . FMT_TIME); |
|
175 | +define('FMT_DATE_TIME', FMT_DATE.' '.FMT_TIME); |
|
176 | 176 | |
177 | 177 | $HTTP_ACCEPT_LANGUAGE = DEFAULT_LANG; |
178 | 178 | |
179 | -require_once(SN_ROOT_PHYSICAL . "includes/template" . DOT_PHP_EX); |
|
179 | +require_once(SN_ROOT_PHYSICAL."includes/template".DOT_PHP_EX); |
|
180 | 180 | $template_result = array('.' => array('result' => array())); |
181 | 181 | |
182 | -sn_sys_load_php_files(SN_ROOT_PHYSICAL . "includes/functions/", PHP_EX); |
|
182 | +sn_sys_load_php_files(SN_ROOT_PHYSICAL."includes/functions/", PHP_EX); |
|
183 | 183 | |
184 | 184 | |
185 | 185 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | // Конфиг - часть манифеста? |
191 | 191 | classSupernova::$auth = new core_auth(); |
192 | 192 | |
193 | -sn_sys_load_php_files(SN_ROOT_PHYSICAL . "modules/", PHP_EX, true); |
|
193 | +sn_sys_load_php_files(SN_ROOT_PHYSICAL."modules/", PHP_EX, true); |
|
194 | 194 | // Здесь - потому что core_auth модуль лежит в другом каталоге и его нужно инициализировать отдельно |
195 | 195 | |
196 | 196 | // Подключаем дефолтную страницу |
@@ -198,10 +198,10 @@ discard block |
||
198 | 198 | // Сейчас мы делаем это здесь только для того, что бы содержание дефолтной страницы оказалось вверху. Что не факт, что нужно всегда |
199 | 199 | // Но нужно, пока у нас есть не MVC-страницы |
200 | 200 | $sn_page_data = $sn_data['pages'][$sn_page_name]; |
201 | -$sn_page_name_file = 'includes/pages/' . $sn_page_data['filename'] . DOT_PHP_EX; |
|
202 | -if($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
201 | +$sn_page_name_file = 'includes/pages/'.$sn_page_data['filename'].DOT_PHP_EX; |
|
202 | +if ($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
203 | 203 | require_once($sn_page_name_file); |
204 | - if(is_array($sn_page_data['options'])) { |
|
204 | + if (is_array($sn_page_data['options'])) { |
|
205 | 205 | classSupernova::$options = array_merge(classSupernova::$options, $sn_page_data['options']); |
206 | 206 | } |
207 | 207 | } |
@@ -216,10 +216,10 @@ discard block |
||
216 | 216 | $load_order = array(); |
217 | 217 | $sn_req = array(); |
218 | 218 | |
219 | -foreach(sn_module::$sn_module as $loaded_module_name => $module_data) { |
|
219 | +foreach (sn_module::$sn_module as $loaded_module_name => $module_data) { |
|
220 | 220 | $load_order[$loaded_module_name] = isset($module_data->manifest['load_order']) && !empty($module_data->manifest['load_order']) ? $module_data->manifest['load_order'] : 100000; |
221 | - if(isset($module_data->manifest['require']) && !empty($module_data->manifest['require'])) { |
|
222 | - foreach($module_data->manifest['require'] as $require_name) { |
|
221 | + if (isset($module_data->manifest['require']) && !empty($module_data->manifest['require'])) { |
|
222 | + foreach ($module_data->manifest['require'] as $require_name) { |
|
223 | 223 | $sn_req[$loaded_module_name][$require_name] = 0; |
224 | 224 | } |
225 | 225 | } |
@@ -232,10 +232,10 @@ discard block |
||
232 | 232 | do { |
233 | 233 | $prev_order = $load_order; |
234 | 234 | |
235 | - foreach($sn_req as $loaded_module_name => &$req_data) { |
|
235 | + foreach ($sn_req as $loaded_module_name => &$req_data) { |
|
236 | 236 | $level = 1; |
237 | - foreach($req_data as $req_name => &$req_level) { |
|
238 | - if($load_order[$req_name] == -1 || !isset($load_order[$req_name])) { |
|
237 | + foreach ($req_data as $req_name => &$req_level) { |
|
238 | + if ($load_order[$req_name] == -1 || !isset($load_order[$req_name])) { |
|
239 | 239 | $level = $req_level = -1; |
240 | 240 | break; |
241 | 241 | } else { |
@@ -243,20 +243,20 @@ discard block |
||
243 | 243 | } |
244 | 244 | $req_level = $load_order[$req_name]; |
245 | 245 | } |
246 | - if($level > $load_order[$loaded_module_name] || $level == -1) { |
|
246 | + if ($level > $load_order[$loaded_module_name] || $level == -1) { |
|
247 | 247 | $load_order[$loaded_module_name] = $level; |
248 | 248 | } |
249 | 249 | } |
250 | -} while($prev_order != $load_order); |
|
250 | +} while ($prev_order != $load_order); |
|
251 | 251 | |
252 | 252 | asort($load_order); |
253 | 253 | |
254 | 254 | // Инициализируем модули |
255 | 255 | // По нормальным делам это должна быть загрузка модулей и лишь затем инициализация - что бы минимизировать размер процесса в памяти |
256 | -foreach($load_order as $loaded_module_name => $load_order_order) { |
|
257 | - if($load_order_order >= 0) { |
|
256 | +foreach ($load_order as $loaded_module_name => $load_order_order) { |
|
257 | + if ($load_order_order >= 0) { |
|
258 | 258 | sn_module::$sn_module[$loaded_module_name]->check_status(); |
259 | - if(!sn_module::$sn_module[$loaded_module_name]->manifest['active']) { |
|
259 | + if (!sn_module::$sn_module[$loaded_module_name]->manifest['active']) { |
|
260 | 260 | unset(sn_module::$sn_module[$loaded_module_name]); |
261 | 261 | continue; |
262 | 262 | } |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | unset($sn_req); |
274 | 274 | |
275 | 275 | // А теперь проверяем - поддерживают ли у нас загруженный код такую страницу |
276 | -if(!isset($sn_data['pages'][$sn_page_name])) { |
|
276 | +if (!isset($sn_data['pages'][$sn_page_name])) { |
|
277 | 277 | $sn_page_name = ''; |
278 | 278 | } |
279 | 279 | |
@@ -281,6 +281,6 @@ discard block |
||
281 | 281 | classLocale::$lang = $lang = new classLocale(classSupernova::$config->server_locale_log_usage); |
282 | 282 | classLocale::$lang->lng_switch(sys_get_param_str('lang')); |
283 | 283 | |
284 | -if(!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) { |
|
284 | +if (!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) { |
|
285 | 285 | require_once "init_secondary.php"; |
286 | 286 | } |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | define('INSIDE', true); |
13 | 13 | define('INSTALL', false); |
14 | 14 | define('IN_ADMIN', true); |
15 | -require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
15 | +require('../common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
16 | 16 | |
17 | 17 | global $user; |
18 | -if($user['authlevel'] < 3) { |
|
18 | +if ($user['authlevel'] < 3) { |
|
19 | 19 | AdminMessage(classLocale::$lang['adm_err_denied']); |
20 | 20 | } |
21 | 21 | |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | $sort = sys_get_param_int('sort', SORT_ID); |
40 | 40 | $sort = $sort_fields[$sort] ? $sort : SORT_ID; |
41 | 41 | |
42 | -if(($action = sys_get_param_int('action')) && ($user_id = sys_get_param_id('uid'))) { |
|
42 | +if (($action = sys_get_param_int('action')) && ($user_id = sys_get_param_id('uid'))) { |
|
43 | 43 | $user_selected = DBStaticUser::db_user_by_id($user_id, false, 'id, username, authlevel'); |
44 | - if($user_selected['authlevel'] < $user['authlevel'] && $user['authlevel'] >= 3) { |
|
45 | - switch($action) { |
|
44 | + if ($user_selected['authlevel'] < $user['authlevel'] && $user['authlevel'] >= 3) { |
|
45 | + switch ($action) { |
|
46 | 46 | case ACTION_DELETE: |
47 | 47 | DeleteSelectedUser($user_id); |
48 | 48 | sys_redirect("{$_SERVER['SCRIPT_NAME']}?sort={$sort}"); |
@@ -62,20 +62,20 @@ discard block |
||
62 | 62 | $template = gettemplate('admin/userlist', true); |
63 | 63 | |
64 | 64 | $multi_ip = array(); |
65 | -foreach(DBStaticUser::db_user_list_admin_multiaccounts() as $ip) { |
|
65 | +foreach (DBStaticUser::db_user_list_admin_multiaccounts() as $ip) { |
|
66 | 66 | $multi_ip[$ip['user_lastip']] = $ip['ip_count']; |
67 | 67 | } |
68 | 68 | |
69 | 69 | $geoip = geoip_status(); |
70 | 70 | $count = 0; |
71 | -foreach(DBStaticUser::db_user_list_admin_sorted($sort_fields[$sort], $is_players_online_page) as $user_row ) { |
|
71 | +foreach (DBStaticUser::db_user_list_admin_sorted($sort_fields[$sort], $is_players_online_page) as $user_row) { |
|
72 | 72 | $count++; |
73 | - if($user_row['banaday']) { |
|
73 | + if ($user_row['banaday']) { |
|
74 | 74 | $ban_details = db_ban_list_get_details($user_row); |
75 | 75 | } |
76 | 76 | |
77 | 77 | $geoip_info = $geoip ? geoip_ip_info(ip2longu($user_row['user_lastip'])) : array(); |
78 | - foreach($geoip_info as $key => $value) { |
|
78 | + foreach ($geoip_info as $key => $value) { |
|
79 | 79 | $geoip_info[strtoupper($key)] = $value; |
80 | 80 | unset($geoip_info[$key]); |
81 | 81 | } |