@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | |
24 | 24 | use Vector\Vector; |
25 | 25 | |
26 | -if(!defined('INIT')) { |
|
26 | +if (!defined('INIT')) { |
|
27 | 27 | // include_once('init.php'); |
28 | 28 | die('Unauthorized access'); |
29 | 29 | } |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | classSupernova::$config->debug = 0; |
42 | 42 | |
43 | 43 | |
44 | -if(classSupernova::$config->db_version == DB_VERSION) { |
|
45 | -} elseif(classSupernova::$config->db_version > DB_VERSION) { |
|
44 | +if (classSupernova::$config->db_version == DB_VERSION) { |
|
45 | +} elseif (classSupernova::$config->db_version > DB_VERSION) { |
|
46 | 46 | classSupernova::$config->db_saveItem('var_db_update_end', SN_TIME_NOW); |
47 | 47 | die( |
48 | 48 | 'Internal error! Auotupdater detects DB version greater then can be handled!<br /> |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | ); |
52 | 52 | } |
53 | 53 | |
54 | -if(classSupernova::$config->db_version < 26) { |
|
54 | +if (classSupernova::$config->db_version < 26) { |
|
55 | 55 | $sys_log_disabled = true; |
56 | 56 | } |
57 | 57 | |
@@ -70,20 +70,20 @@ discard block |
||
70 | 70 | $update_tables = array(); |
71 | 71 | $update_indexes = array(); |
72 | 72 | $query = upd_do_query('SHOW TABLES;', true); |
73 | -while($row = classSupernova::$db->db_fetch_row($query)) { |
|
73 | +while ($row = classSupernova::$db->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...'); |
77 | 77 | |
78 | 78 | upd_do_query('SET FOREIGN_KEY_CHECKS=0;', true); |
79 | 79 | |
80 | -if($new_version < 37) { |
|
80 | +if ($new_version < 37) { |
|
81 | 81 | require_once('update_old.php'); |
82 | 82 | } |
83 | 83 | |
84 | 84 | ini_set('memory_limit', '1024M'); |
85 | 85 | |
86 | -switch($new_version) { |
|
86 | +switch ($new_version) { |
|
87 | 87 | case 37: |
88 | 88 | upd_log_version_update(); |
89 | 89 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | upd_check_key('payment_currency_exchange_mm_', 2500, !classSupernova::$config->payment_currency_exchange_mm_); |
100 | 100 | |
101 | - if(!$update_tables['log_metamatter']) { |
|
101 | + if (!$update_tables['log_metamatter']) { |
|
102 | 102 | upd_create_table('log_metamatter', |
103 | 103 | "( |
104 | 104 | `id` SERIAL, |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | "ADD `payment_test` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Is this a test payment?'", |
124 | 124 | ), !$update_tables['payment']['payment_test']); |
125 | 125 | |
126 | - if($update_tables['payment']['payment_test']['Default'] == 1) { |
|
126 | + if ($update_tables['payment']['payment_test']['Default'] == 1) { |
|
127 | 127 | upd_alter_table('payment', array( |
128 | 128 | "MODIFY COLUMN `payment_test` TINYINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Is this a test payment?'", |
129 | 129 | )); |
@@ -139,15 +139,15 @@ discard block |
||
139 | 139 | "MODIFY COLUMN `metamatter` BIGINT(20) NOT NULL DEFAULT 0 COMMENT 'Metamatter amount'", |
140 | 140 | ), $update_tables['users']['metamatter']['Type'] == 'int(20)'); |
141 | 141 | |
142 | - $query = upd_do_query("SELECT * FROM {{que}} WHERE `que_type` = " . QUE_RESEARCH . " AND que_unit_id IN (" . TECH_EXPEDITION . "," . TECH_COLONIZATION . ") FOR UPDATE"); |
|
143 | - while($row = db_fetch($query)) { |
|
142 | + $query = upd_do_query("SELECT * FROM {{que}} WHERE `que_type` = ".QUE_RESEARCH." AND que_unit_id IN (".TECH_EXPEDITION.",".TECH_COLONIZATION.") FOR UPDATE"); |
|
143 | + while ($row = db_fetch($query)) { |
|
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"); |
146 | 146 | $price = sys_unit_str2arr($row['que_unit_price']); |
147 | - upd_do_query("UPDATE {{planets}} SET " . |
|
148 | - "`metal` = `metal` + " . ($price[RES_METAL] ? $price[RES_METAL] : 0) . "," . |
|
149 | - "`crystal` = `crystal` + " . ($price[RES_CRYSTAL] ? $price[RES_CRYSTAL] : 0) . "," . |
|
150 | - "`deuterium` = `deuterium` + " . ($price[RES_DEUTERIUM] ? $price[RES_DEUTERIUM] : 0) . |
|
147 | + upd_do_query("UPDATE {{planets}} SET ". |
|
148 | + "`metal` = `metal` + ".($price[RES_METAL] ? $price[RES_METAL] : 0).",". |
|
149 | + "`crystal` = `crystal` + ".($price[RES_CRYSTAL] ? $price[RES_CRYSTAL] : 0).",". |
|
150 | + "`deuterium` = `deuterium` + ".($price[RES_DEUTERIUM] ? $price[RES_DEUTERIUM] : 0). |
|
151 | 151 | " WHERE id = {$planet_id}" |
152 | 152 | ); |
153 | 153 | upd_do_query("DELETE FROM {{que}} WHERE que_id = {$row['que_id']}"); |
@@ -156,10 +156,10 @@ discard block |
||
156 | 156 | $query = upd_do_query("SELECT unit_id, unit_snid, unit_level, id_planet FROM {{unit}} AS un |
157 | 157 | LEFT JOIN {{users}} AS u ON u.id = un.unit_player_id |
158 | 158 | LEFT JOIN {{planets}} AS p ON p.id = u.id_planet |
159 | - WHERE unit_snid IN (" . TECH_EXPEDITION . "," . TECH_COLONIZATION . ") |
|
159 | + WHERE unit_snid IN (" . TECH_EXPEDITION.",".TECH_COLONIZATION.") |
|
160 | 160 | FOR UPDATE"); |
161 | - while($row = db_fetch($query)) { |
|
162 | - if(!$row['id_planet']) { |
|
161 | + while ($row = db_fetch($query)) { |
|
162 | + if (!$row['id_planet']) { |
|
163 | 163 | continue; |
164 | 164 | } |
165 | 165 | |
@@ -167,14 +167,14 @@ discard block |
||
167 | 167 | $unit_level = $row['unit_level']; |
168 | 168 | $price = get_unit_param($unit_id, P_COST); |
169 | 169 | $factor = $price['factor']; |
170 | - foreach($price as $resource_id => &$resource_amount) { |
|
170 | + foreach ($price as $resource_id => &$resource_amount) { |
|
171 | 171 | $resource_amount = $resource_amount * (pow($factor, $unit_level) - 1) / ($factor - 1); |
172 | 172 | } |
173 | 173 | // upd_do_query |
174 | - upd_do_query($q = "UPDATE {{planets}} SET " . |
|
175 | - "`metal` = `metal` + " . ($price[RES_METAL] ? $price[RES_METAL] : 0) . "," . |
|
176 | - "`crystal` = `crystal` + " . ($price[RES_CRYSTAL] ? $price[RES_CRYSTAL] : 0) . "," . |
|
177 | - "`deuterium` = `deuterium` + " . ($price[RES_DEUTERIUM] ? $price[RES_DEUTERIUM] : 0) . |
|
174 | + upd_do_query($q = "UPDATE {{planets}} SET ". |
|
175 | + "`metal` = `metal` + ".($price[RES_METAL] ? $price[RES_METAL] : 0).",". |
|
176 | + "`crystal` = `crystal` + ".($price[RES_CRYSTAL] ? $price[RES_CRYSTAL] : 0).",". |
|
177 | + "`deuterium` = `deuterium` + ".($price[RES_DEUTERIUM] ? $price[RES_DEUTERIUM] : 0). |
|
178 | 178 | " WHERE id = {$row['id_planet']}" |
179 | 179 | ); |
180 | 180 | upd_do_query("DELETE FROM {{unit}} WHERE unit_id = {$row['unit_id']}"); |
@@ -186,14 +186,14 @@ discard block |
||
186 | 186 | // Вернуть ресы за уже исследованную Экспедиционную технологию |
187 | 187 | upd_check_key('player_max_colonies', -1, classSupernova::$config->player_max_colonies >= 0); |
188 | 188 | |
189 | - if(!isset($update_tables['users']['player_rpg_explore_xp'])) { |
|
189 | + if (!isset($update_tables['users']['player_rpg_explore_xp'])) { |
|
190 | 190 | upd_alter_table('users', array( |
191 | 191 | "ADD COLUMN `player_rpg_explore_level` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 AFTER `dark_matter`", |
192 | 192 | "ADD COLUMN `player_rpg_explore_xp` BIGINT(20) UNSIGNED NOT NULL DEFAULT 0 AFTER `dark_matter`", |
193 | 193 | ), !isset($update_tables['users']['player_rpg_explore_xp'])); |
194 | 194 | } |
195 | 195 | |
196 | - if(!$update_tables['log_users_online']) { |
|
196 | + if (!$update_tables['log_users_online']) { |
|
197 | 197 | upd_create_table('log_users_online', "( |
198 | 198 | `online_timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'Measure time', |
199 | 199 | `online_count` SMALLINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Users online', |
@@ -208,11 +208,11 @@ discard block |
||
208 | 208 | "ADD `user_time_measured` INT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'When was time diff measured last time' AFTER `onlinetime`", |
209 | 209 | ), !$update_tables['users']['user_time_measured']); |
210 | 210 | |
211 | - if($update_tables['rw']) { |
|
211 | + if ($update_tables['rw']) { |
|
212 | 212 | upd_do_query("DROP TABLE IF EXISTS {{rw}};"); |
213 | 213 | } |
214 | 214 | |
215 | - if(!$update_tables['player_award']) { |
|
215 | + if (!$update_tables['player_award']) { |
|
216 | 216 | upd_create_table('player_award', "( |
217 | 217 | `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
218 | 218 | `award_type_id` int(11) DEFAULT NULL COMMENT 'Award type i.e. order, medal, pennant, rank etc', |
@@ -254,14 +254,14 @@ discard block |
||
254 | 254 | upd_log_version_update(); |
255 | 255 | |
256 | 256 | |
257 | - if(!isset($update_tables['planets']['que_processed'])) { |
|
257 | + if (!isset($update_tables['planets']['que_processed'])) { |
|
258 | 258 | upd_alter_table('planets', array( |
259 | 259 | "ADD COLUMN `que_processed` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `last_update`", |
260 | 260 | ), true); |
261 | 261 | upd_do_query("UPDATE {{planets}} SET que_processed = last_update;"); |
262 | 262 | } |
263 | 263 | |
264 | - if(!isset($update_tables['users']['que_processed'])) { |
|
264 | + if (!isset($update_tables['users']['que_processed'])) { |
|
265 | 265 | upd_alter_table('users', array( |
266 | 266 | "ADD COLUMN `que_processed` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `onlinetime`", |
267 | 267 | ), true); |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | } |
270 | 270 | |
271 | 271 | |
272 | - if(isset($update_tables['planets']['que'])) { |
|
272 | + if (isset($update_tables['planets']['que'])) { |
|
273 | 273 | $sn_data_aux = array( |
274 | 274 | SHIP_SMALL_FIGHTER_WRATH => array( |
275 | 275 | 'name' => 'ship_fighter_wrath', |
@@ -354,20 +354,20 @@ discard block |
||
354 | 354 | $unit_data = array(); |
355 | 355 | $planets = array(); |
356 | 356 | |
357 | - foreach($planet_unit_list as $unit_id) { |
|
358 | - if(!($unit_name = get_unit_param($unit_id, P_NAME))) { |
|
357 | + foreach ($planet_unit_list as $unit_id) { |
|
358 | + if (!($unit_name = get_unit_param($unit_id, P_NAME))) { |
|
359 | 359 | $unit_name = $sn_data_aux[$unit_id][P_NAME]; |
360 | 360 | } |
361 | - if(isset($update_tables['planets'][$unit_name])) { |
|
361 | + if (isset($update_tables['planets'][$unit_name])) { |
|
362 | 362 | $drop[] = "DROP COLUMN `{$unit_name}`"; |
363 | 363 | |
364 | - if(isset($aux_group[$unit_id])) { |
|
364 | + if (isset($aux_group[$unit_id])) { |
|
365 | 365 | $units_info[$unit_id] = $sn_data_aux[$unit_id]; |
366 | 366 | $units_info[$unit_id]['que'] = QUE_HANGAR; |
367 | 367 | } else { |
368 | 368 | $units_info[$unit_id] = get_unit_param($unit_id); |
369 | - foreach($ques_info as $que_id => $que_data1) { |
|
370 | - if(in_array($unit_id, $que_data1['unit_list'])) { |
|
369 | + foreach ($ques_info as $que_id => $que_data1) { |
|
370 | + if (in_array($unit_id, $que_data1['unit_list'])) { |
|
371 | 371 | $units_info[$unit_id]['que'] = $que_id; |
372 | 372 | break; |
373 | 373 | } |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | } |
378 | 378 | |
379 | 379 | $query = upd_do_query("SELECT * FROM {{planets}} FOR UPDATE"); |
380 | - while($row = db_fetch($query)) { |
|
380 | + while ($row = db_fetch($query)) { |
|
381 | 381 | $user_id = $row['id_owner']; |
382 | 382 | $planet_id = $row['id']; |
383 | 383 | |
@@ -385,25 +385,25 @@ discard block |
||
385 | 385 | |
386 | 386 | // Конвертируем юниты |
387 | 387 | $units_levels = array(); |
388 | - foreach($planet_unit_list as $unit_id) { |
|
388 | + foreach ($planet_unit_list as $unit_id) { |
|
389 | 389 | $unit_name = &$units_info[$unit_id][P_NAME]; |
390 | - if(!isset($row[$unit_name]) || !$row[$unit_name]) { |
|
390 | + if (!isset($row[$unit_name]) || !$row[$unit_name]) { |
|
391 | 391 | continue; |
392 | 392 | } |
393 | 393 | $units_levels[$unit_id] = $row[$unit_name]; |
394 | - $unit_data[] = "({$user_id}," . LOC_PLANET . ",{$planet_id},{$units_info[$unit_id][P_UNIT_TYPE]},{$unit_id},{$units_levels[$unit_id]})"; |
|
395 | - if(count($unit_data) > 30) { |
|
394 | + $unit_data[] = "({$user_id},".LOC_PLANET.",{$planet_id},{$units_info[$unit_id][P_UNIT_TYPE]},{$unit_id},{$units_levels[$unit_id]})"; |
|
395 | + if (count($unit_data) > 30) { |
|
396 | 396 | $unit_data_max = strlen(implode(',', $unit_data)) > $unit_data_max ? strlen(implode(',', $unit_data)) : $unit_data_max; |
397 | - 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) . ';'); |
|
397 | + 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).';'); |
|
398 | 398 | $unit_data = array(); |
399 | 399 | } |
400 | 400 | } |
401 | 401 | |
402 | 402 | // Конвертируем очередь построек |
403 | - if($row['que']) { |
|
403 | + if ($row['que']) { |
|
404 | 404 | $que = explode(';', $row['que']); |
405 | - foreach($que as $que_item) { |
|
406 | - if(!$que_item) { |
|
405 | + foreach ($que as $que_item) { |
|
406 | + if (!$que_item) { |
|
407 | 407 | continue; |
408 | 408 | } |
409 | 409 | |
@@ -418,8 +418,8 @@ discard block |
||
418 | 418 | $unit_factor = $unit_cost[P_FACTOR] ? $unit_cost[P_FACTOR] : 1; |
419 | 419 | $price_increase = pow($unit_factor, $unit_level); |
420 | 420 | // $unit_time = 0; |
421 | - foreach($unit_cost as $resource_id => &$resource_amount) { |
|
422 | - if(!in_array($resource_id, $group_resource_loot)) { |
|
421 | + foreach ($unit_cost as $resource_id => &$resource_amount) { |
|
422 | + if (!in_array($resource_id, $group_resource_loot)) { |
|
423 | 423 | unset($unit_cost[$resource_id]); |
424 | 424 | continue; |
425 | 425 | } |
@@ -433,39 +433,39 @@ discard block |
||
433 | 433 | } |
434 | 434 | |
435 | 435 | // Конвертируем очередь верфи |
436 | - if($row['b_hangar_id']) { |
|
436 | + if ($row['b_hangar_id']) { |
|
437 | 437 | $return_resources = array(RES_METAL => 0, RES_CRYSTAL => 0, RES_DEUTERIUM => 0,); |
438 | 438 | $hangar_units = sys_unit_str2arr($row['b_hangar_id']); |
439 | - foreach($hangar_units as $unit_id => $unit_count) { |
|
440 | - if($unit_count <= 0) { |
|
439 | + foreach ($hangar_units as $unit_id => $unit_count) { |
|
440 | + if ($unit_count <= 0) { |
|
441 | 441 | continue; |
442 | 442 | } |
443 | - foreach($units_info[$unit_id][P_COST] as $resource_id => $resource_amount) { |
|
444 | - if(!in_array($resource_id, $group_resource_loot)) { |
|
443 | + foreach ($units_info[$unit_id][P_COST] as $resource_id => $resource_amount) { |
|
444 | + if (!in_array($resource_id, $group_resource_loot)) { |
|
445 | 445 | continue; |
446 | 446 | } |
447 | 447 | $return_resources[$resource_id] += $unit_count * $resource_amount; |
448 | 448 | } |
449 | 449 | } |
450 | - if(array_sum($return_resources) > 0) { |
|
450 | + if (array_sum($return_resources) > 0) { |
|
451 | 451 | 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"); |
452 | 452 | } |
453 | 453 | } |
454 | 454 | |
455 | 455 | |
456 | - if(count($que_data) > 10) { |
|
456 | + if (count($que_data) > 10) { |
|
457 | 457 | $que_data_max = strlen(implode(',', $que_data)) > $que_data_max ? strlen(implode(',', $que_data)) : $que_data_max; |
458 | - 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) . ';'); |
|
458 | + 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).';'); |
|
459 | 459 | $que_data = array(); |
460 | 460 | } |
461 | 461 | } |
462 | 462 | |
463 | - if(!empty($unit_data)) { |
|
464 | - 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) . ';'); |
|
463 | + if (!empty($unit_data)) { |
|
464 | + 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).';'); |
|
465 | 465 | } |
466 | 466 | |
467 | - if(!empty($que_data)) { |
|
468 | - 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) . ';'); |
|
467 | + if (!empty($que_data)) { |
|
468 | + 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).';'); |
|
469 | 469 | } |
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 `{{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 `galaxy` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 0 AFTER `title`", |
577 | 577 | "ADD COLUMN `system` SMALLINT(6) UNSIGNED NOT NULL DEFAULT 0 AFTER `galaxy`", |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | upd_alter_table('users', "ADD COLUMN `user_bot` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0", !isset($update_tables['users']['user_bot'])); |
590 | 590 | upd_alter_table('unit', "ADD KEY `I_unit_type_snid` (unit_type, unit_snid) USING BTREE", !$update_indexes['unit']['I_unit_type_snid']); |
591 | 591 | |
592 | - if($update_tables['users']['settings_tooltiptime']['Type'] != 'smallint(5) unsigned') { |
|
592 | + if ($update_tables['users']['settings_tooltiptime']['Type'] != 'smallint(5) unsigned') { |
|
593 | 593 | upd_alter_table('users', array( |
594 | 594 | "MODIFY COLUMN `settings_tooltiptime` smallint(5) unsigned NOT NULL DEFAULT '500'", |
595 | 595 | ), $update_tables['users']['settings_tooltiptime']['Type'] != 'smallint'); |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | upd_do_query("UPDATE `{{users}}` SET settings_tooltiptime = 500;"); |
598 | 598 | } |
599 | 599 | |
600 | - if(!isset($update_tables['log_users_online']['online_aggregated'])) { |
|
600 | + if (!isset($update_tables['log_users_online']['online_aggregated'])) { |
|
601 | 601 | 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'])); |
602 | 602 | upd_alter_table('log_users_online', array( |
603 | 603 | "DROP PRIMARY KEY", |
@@ -605,13 +605,13 @@ discard block |
||
605 | 605 | ), $update_indexes['log_users_online']['PRIMARY'] != 'online_timestamp,online_aggregated,'); |
606 | 606 | } |
607 | 607 | |
608 | - if(!isset($update_tables['users']['gender'])) { |
|
609 | - upd_alter_table('users', "ADD COLUMN `gender` TINYINT(1) UNSIGNED NOT NULL DEFAULT " . GENDER_UNKNOWN, !isset($update_tables['users']['gender'])); |
|
610 | - upd_do_query("UPDATE {{users}} SET `gender` = IF(UPPER(`sex`) = 'F', " . GENDER_FEMALE . ", IF(UPPER(`sex`) = 'M', " . GENDER_MALE . ", " . GENDER_UNKNOWN . "));"); |
|
608 | + if (!isset($update_tables['users']['gender'])) { |
|
609 | + upd_alter_table('users', "ADD COLUMN `gender` TINYINT(1) UNSIGNED NOT NULL DEFAULT ".GENDER_UNKNOWN, !isset($update_tables['users']['gender'])); |
|
610 | + upd_do_query("UPDATE {{users}} SET `gender` = IF(UPPER(`sex`) = 'F', ".GENDER_FEMALE.", IF(UPPER(`sex`) = 'M', ".GENDER_MALE.", ".GENDER_UNKNOWN."));"); |
|
611 | 611 | } |
612 | 612 | upd_alter_table('users', "DROP COLUMN `sex`", isset($update_tables['users']['sex'])); |
613 | 613 | |
614 | - if(!$update_tables['users']['dark_matter_total']) { |
|
614 | + if (!$update_tables['users']['dark_matter_total']) { |
|
615 | 615 | 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']); |
616 | 616 | upd_do_query( |
617 | 617 | "UPDATE `{{users}}` AS u |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | } |
625 | 625 | |
626 | 626 | upd_check_key('player_metamatter_immortal', 100000, !isset(classSupernova::$config->player_metamatter_immortal)); |
627 | - if(!$update_tables['users']['metamatter_total']) { |
|
627 | + if (!$update_tables['users']['metamatter_total']) { |
|
628 | 628 | upd_alter_table('users', "ADD `metamatter_total` BIGINT(20) NOT NULL DEFAULT 0 COMMENT 'Total Metamatter amount ever bought'", !$update_tables['users']['metamatter_total']); |
629 | 629 | |
630 | 630 | upd_do_query( |
@@ -636,11 +636,11 @@ discard block |
||
636 | 636 | (SELECT IF(sum(amount) IS NULL, 0, sum(amount)) FROM {{log_metamatter}} AS mm WHERE mm.user_id = u.id AND mm.amount > 0) |
637 | 637 | );"); |
638 | 638 | } |
639 | - if(!isset($update_tables['users']['immortal'])) { |
|
639 | + if (!isset($update_tables['users']['immortal'])) { |
|
640 | 640 | upd_alter_table('users', "ADD COLUMN `immortal` TIMESTAMP NULL", !isset($update_tables['users']['immortal'])); |
641 | 641 | upd_do_query("UPDATE {{users}} SET `immortal` = NOW() WHERE `metamatter_total` > 0;"); |
642 | 642 | } |
643 | - if(isset($update_tables['player_award'])) { |
|
643 | + if (isset($update_tables['player_award'])) { |
|
644 | 644 | upd_do_query( |
645 | 645 | "UPDATE {{users}} AS u JOIN {{player_award}} AS pa ON u.id = pa.player_id |
646 | 646 | SET metamatter_total = 1, immortal = NOW() |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | CONSTRAINT `FK_user_id` FOREIGN KEY (`user_id`) REFERENCES `{{users}}` (`id`) ON DELETE CASCADE ON UPDATE CASCADE |
668 | 668 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;"); |
669 | 669 | |
670 | - if(empty($update_tables['blitz_statpoints'])) { |
|
670 | + if (empty($update_tables['blitz_statpoints'])) { |
|
671 | 671 | upd_create_table('blitz_statpoints', " ( |
672 | 672 | `stat_date` int(11) NOT NULL DEFAULT '0', |
673 | 673 | `id_owner` bigint(20) unsigned DEFAULT NULL, |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | CONSTRAINT `FK_survey_votes_survey_parent_id` FOREIGN KEY (`survey_parent_id`) REFERENCES `{{survey}}` (`survey_id`) ON DELETE CASCADE ON UPDATE CASCADE |
736 | 736 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;"); |
737 | 737 | |
738 | - if(empty($update_tables['security_url'])) { |
|
738 | + if (empty($update_tables['security_url'])) { |
|
739 | 739 | upd_create_table('security_url', " ( |
740 | 740 | `url_id` int unsigned NOT NULL AUTO_INCREMENT, |
741 | 741 | `url_string` VARCHAR(250) NOT NULL DEFAULT '', |
@@ -748,17 +748,17 @@ discard block |
||
748 | 748 | |
749 | 749 | $strings = array(); |
750 | 750 | $query = doquery($query); |
751 | - while($row = db_fetch($query)) { |
|
752 | - $strings[] = '("' . db_escape($row['url']) . '")'; |
|
753 | - if(count($strings) > 100) { |
|
754 | - doquery($query_string . implode(',', $strings)); |
|
751 | + while ($row = db_fetch($query)) { |
|
752 | + $strings[] = '("'.db_escape($row['url']).'")'; |
|
753 | + if (count($strings) > 100) { |
|
754 | + doquery($query_string.implode(',', $strings)); |
|
755 | 755 | $strings = array(); |
756 | 756 | } |
757 | 757 | } |
758 | - !empty($strings) ? doquery($query_string . implode(',', $strings)) : false; |
|
758 | + !empty($strings) ? doquery($query_string.implode(',', $strings)) : false; |
|
759 | 759 | } |
760 | 760 | |
761 | - if(isset($update_tables['counter']['page'])) // TODO REMOVE |
|
761 | + if (isset($update_tables['counter']['page'])) // TODO REMOVE |
|
762 | 762 | { |
763 | 763 | update_security_url("SELECT DISTINCT `page` AS url FROM {{counter}}"); |
764 | 764 | update_security_url("SELECT DISTINCT `url` AS url FROM {{counter}}"); |
@@ -783,7 +783,7 @@ discard block |
||
783 | 783 | "ADD CONSTRAINT `FK_counter_page_url_id` FOREIGN KEY (`page_url_id`) REFERENCES `{{security_url}}` (`url_id`) ON DELETE CASCADE ON UPDATE CASCADE", |
784 | 784 | "ADD CONSTRAINT `FK_counter_plain_url_id` FOREIGN KEY (`plain_url_id`) REFERENCES `{{security_url}}` (`url_id`) ON DELETE CASCADE ON UPDATE CASCADE", |
785 | 785 | ), !isset($update_tables['counter']['device_id'])); |
786 | - if(isset($update_tables['counter']['ip'])) { |
|
786 | + if (isset($update_tables['counter']['ip'])) { |
|
787 | 787 | // upd_do_query('UPDATE `{{counter}}` SET `user_ip` = INET_ATON(`ip`), `user_proxy` = `proxy`, `visit_time` = FROM_UNIXTIME(`time`)'); |
788 | 788 | upd_do_query('UPDATE `{{counter}}` SET `user_ip` = INET_ATON(`ip`), `visit_time` = FROM_UNIXTIME(`time`)'); |
789 | 789 | 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'); |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | |
835 | 835 | upd_check_key('stats_history_days', 14, !classSupernova::$config->stats_history_days); |
836 | 836 | |
837 | - if(classSupernova::$config->payment_currency_default != 'USD') { |
|
837 | + if (classSupernova::$config->payment_currency_default != 'USD') { |
|
838 | 838 | upd_check_key('payment_currency_default', 'USD', true); |
839 | 839 | upd_check_key('payment_currency_exchange_dm_', 20000, true); |
840 | 840 | upd_check_key('payment_currency_exchange_mm_', 20000, true); |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | |
892 | 892 | $virtual_exploded = explode('/', SN_ROOT_VIRTUAL_PARENT); |
893 | 893 | // TODO - переделать всё на db_loadItem... НАВЕРНОЕ |
894 | - upd_check_key('server_email', 'root@' . $virtual_exploded[2], !classSupernova::$config->db_loadItem('server_email')); |
|
894 | + upd_check_key('server_email', 'root@'.$virtual_exploded[2], !classSupernova::$config->db_loadItem('server_email')); |
|
895 | 895 | |
896 | 896 | upd_alter_table('survey_votes', array( |
897 | 897 | "DROP FOREIGN KEY `FK_survey_votes_user`", |
@@ -917,12 +917,12 @@ discard block |
||
917 | 917 | function propagade_player_options($old_option_name, $new_option_id) { |
918 | 918 | global $update_tables; |
919 | 919 | |
920 | - if(!empty($update_tables['users'][$old_option_name])) { |
|
920 | + if (!empty($update_tables['users'][$old_option_name])) { |
|
921 | 921 | upd_do_query( |
922 | 922 | "REPLACE INTO {{player_options}} (`player_id`, `option_id`, `value`) |
923 | 923 | SELECT `id`, {$new_option_id}, `{$old_option_name}` |
924 | 924 | FROM {{users}} |
925 | - WHERE `user_as_ally` is null and `user_bot` = " . USER_BOT_PLAYER); |
|
925 | + WHERE `user_as_ally` is null and `user_bot` = ".USER_BOT_PLAYER); |
|
926 | 926 | // TODO - UNCOMMENT !!! |
927 | 927 | upd_alter_table('users', array("DROP COLUMN `{$old_option_name}`",)); |
928 | 928 | } |
@@ -951,7 +951,7 @@ discard block |
||
951 | 951 | |
952 | 952 | |
953 | 953 | // 2015-08-03 15:05:26 40a6.0 |
954 | - if(empty($update_tables['planets']['position_original'])) { |
|
954 | + if (empty($update_tables['planets']['position_original'])) { |
|
955 | 955 | upd_alter_table('planets', array( |
956 | 956 | "ADD COLUMN `position_original` smallint NOT NULL DEFAULT 0", |
957 | 957 | "ADD COLUMN `field_max_original` smallint NOT NULL DEFAULT 0", |
@@ -966,7 +966,7 @@ discard block |
||
966 | 966 | upd_do_query('UPDATE {{planets}} SET `position_original` = `planet`, `field_max_original` = `field_max`, `temp_min_original` = `temp_min`, `temp_max_original` = `temp_max`;'); |
967 | 967 | |
968 | 968 | // Миграция тяжмета в оливин |
969 | - upd_do_query('UPDATE {{planets}} SET `density_index` = ' . PLANET_DENSITY_METAL_PERIDOT . ' WHERE `density_index` = 7'); // deprecated define('PLANET_DENSITY_METAL_HEAVY', 7); |
|
969 | + upd_do_query('UPDATE {{planets}} SET `density_index` = '.PLANET_DENSITY_METAL_PERIDOT.' WHERE `density_index` = 7'); // deprecated define('PLANET_DENSITY_METAL_HEAVY', 7); |
|
970 | 970 | |
971 | 971 | // Добавляем планету-странника |
972 | 972 | upd_check_key('game_maxPlanet', 16, Vector::$knownPlanets == 15); |
@@ -979,12 +979,12 @@ discard block |
||
979 | 979 | |
980 | 980 | // 2015-08-27 19:14:05 40a10.0 |
981 | 981 | // Старая версия таблицы |
982 | - if(!empty($update_tables['account']['account_is_global']) || empty($update_tables['account']['account_immortal'])) { |
|
982 | + if (!empty($update_tables['account']['account_is_global']) || empty($update_tables['account']['account_immortal'])) { |
|
983 | 983 | upd_drop_table('account'); |
984 | 984 | upd_drop_table('account_translate'); |
985 | 985 | } |
986 | 986 | |
987 | - if(empty($update_tables['account'])) { |
|
987 | + if (empty($update_tables['account'])) { |
|
988 | 988 | upd_create_table('account', " ( |
989 | 989 | `account_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
990 | 990 | `account_name` varchar(32) CHARACTER SET utf8 NOT NULL DEFAULT '', |
@@ -1003,7 +1003,7 @@ discard block |
||
1003 | 1003 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;"); |
1004 | 1004 | |
1005 | 1005 | upd_create_table('account_translate', " ( |
1006 | - `provider_id` tinyint unsigned NOT NULL DEFAULT " . ACCOUNT_PROVIDER_LOCAL . " COMMENT 'Account provider', |
|
1006 | + `provider_id` tinyint unsigned NOT NULL DEFAULT " . ACCOUNT_PROVIDER_LOCAL." COMMENT 'Account provider', |
|
1007 | 1007 | `provider_account_id` bigint(20) unsigned NOT NULL COMMENT 'Account ID on provider', |
1008 | 1008 | `user_id` bigint(20) unsigned NOT NULL COMMENT 'User ID', |
1009 | 1009 | `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, |
@@ -1018,12 +1018,12 @@ discard block |
||
1018 | 1018 | (`account_id`, `account_name`, `account_password`, `account_salt`, `account_email`, `account_register_time`, `account_language`, `account_metamatter`, `account_metamatter_total`, `account_immortal`) |
1019 | 1019 | SELECT |
1020 | 1020 | `id`, `username`, `password`, `salt`, `email_2`, FROM_UNIXTIME(register_time), `lang`, `metamatter`, `metamatter_total`, `immortal` |
1021 | - FROM {{users}} WHERE `user_as_ally` IS NULL AND `user_bot` = " . USER_BOT_PLAYER . ";" |
|
1021 | + FROM {{users}} WHERE `user_as_ally` IS NULL AND `user_bot` = " . USER_BOT_PLAYER.";" |
|
1022 | 1022 | ); |
1023 | 1023 | |
1024 | 1024 | upd_do_query( |
1025 | 1025 | "REPLACE INTO {{account_translate}} (`provider_id`, `provider_account_id`, `user_id`, `timestamp`) |
1026 | - SELECT " . ACCOUNT_PROVIDER_LOCAL . ", a.account_id, u.id, a.`account_register_time` |
|
1026 | + SELECT " . ACCOUNT_PROVIDER_LOCAL.", a.account_id, u.id, a.`account_register_time` |
|
1027 | 1027 | FROM {{users}} AS u |
1028 | 1028 | JOIN {{account}} AS a ON |
1029 | 1029 | a.account_name = u.username |
@@ -1038,7 +1038,7 @@ discard block |
||
1038 | 1038 | |
1039 | 1039 | |
1040 | 1040 | // 2015-09-05 17:07:15 40a10.17 |
1041 | - upd_alter_table('ube_report', "ADD COLUMN `ube_report_capture_result` tinyint unsigned NOT NULL DEFAULT " . UBE_CAPTURE_DISABLED, empty($update_tables['ube_report']['ube_report_capture_result'])); |
|
1041 | + upd_alter_table('ube_report', "ADD COLUMN `ube_report_capture_result` tinyint unsigned NOT NULL DEFAULT ".UBE_CAPTURE_DISABLED, empty($update_tables['ube_report']['ube_report_capture_result'])); |
|
1042 | 1042 | |
1043 | 1043 | |
1044 | 1044 | // 2015-09-07 21:11:48 40a10.19 |
@@ -1046,18 +1046,18 @@ discard block |
||
1046 | 1046 | |
1047 | 1047 | |
1048 | 1048 | // 2015-09-24 11:39:37 40a10.25 |
1049 | - if(empty($update_tables['log_metamatter']['provider_id'])) { |
|
1049 | + if (empty($update_tables['log_metamatter']['provider_id'])) { |
|
1050 | 1050 | upd_alter_table('log_metamatter', array( |
1051 | - "ADD COLUMN `provider_id` tinyint unsigned NOT NULL DEFAULT " . ACCOUNT_PROVIDER_LOCAL . " COMMENT 'Account provider'", |
|
1051 | + "ADD COLUMN `provider_id` tinyint unsigned NOT NULL DEFAULT ".ACCOUNT_PROVIDER_LOCAL." COMMENT 'Account provider'", |
|
1052 | 1052 | "ADD COLUMN `account_id` bigint(20) unsigned NOT NULL DEFAULT 0", |
1053 | 1053 | "ADD COLUMN `account_name` varchar(32) CHARACTER SET utf8 NOT NULL DEFAULT ''", |
1054 | - "ADD COLUMN `server_name` varchar(128) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '" . SN_ROOT_VIRTUAL . "'", |
|
1054 | + "ADD COLUMN `server_name` varchar(128) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL DEFAULT '".SN_ROOT_VIRTUAL."'", |
|
1055 | 1055 | ), empty($update_tables['log_metamatter']['provider_id'])); |
1056 | 1056 | |
1057 | 1057 | upd_do_query("UPDATE {{log_metamatter}} SET `account_id` = `user_id`, `account_name` = `username`"); |
1058 | 1058 | |
1059 | 1059 | upd_alter_table('payment', array( |
1060 | - "ADD COLUMN `payment_provider_id` tinyint unsigned NOT NULL DEFAULT " . ACCOUNT_PROVIDER_LOCAL . " COMMENT 'Payment account provider'", |
|
1060 | + "ADD COLUMN `payment_provider_id` tinyint unsigned NOT NULL DEFAULT ".ACCOUNT_PROVIDER_LOCAL." COMMENT 'Payment account provider'", |
|
1061 | 1061 | "ADD COLUMN `payment_account_id` bigint(20) unsigned NOT NULL", |
1062 | 1062 | "ADD COLUMN `payment_account_name` varchar(32) CHARACTER SET utf8 NOT NULL DEFAULT ''", |
1063 | 1063 | ), !$update_tables['payment']['payment_account_id']); |
@@ -1098,7 +1098,7 @@ discard block |
||
1098 | 1098 | upd_check_key('event_halloween_2015_code', '', !isset(classSupernova::$config->event_halloween_2015_code)); |
1099 | 1099 | upd_check_key('event_halloween_2015_timestamp', SN_TIME_SQL, !isset(classSupernova::$config->event_halloween_2015_timestamp)); |
1100 | 1100 | upd_check_key('event_halloween_2015_units_used', serialize(array()), !isset(classSupernova::$config->event_halloween_2015_units_used)); |
1101 | - if(empty($update_tables['log_halloween_2015'])) { |
|
1101 | + if (empty($update_tables['log_halloween_2015'])) { |
|
1102 | 1102 | upd_create_table('log_halloween_2015', " ( |
1103 | 1103 | `log_hw2015_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
1104 | 1104 | `player_id` bigint(20) unsigned NOT NULL COMMENT 'User ID', |
@@ -1113,7 +1113,7 @@ discard block |
||
1113 | 1113 | |
1114 | 1114 | |
1115 | 1115 | // 2015-11-28 06:30:27 40a19.21 |
1116 | - if(!isset($update_tables['ube_report']['ube_report_debris_total_in_metal'])) { |
|
1116 | + if (!isset($update_tables['ube_report']['ube_report_debris_total_in_metal'])) { |
|
1117 | 1117 | upd_alter_table('ube_report', array( |
1118 | 1118 | "ADD COLUMN `ube_report_debris_total_in_metal` DECIMAL(65,0) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Total debris in metal'", |
1119 | 1119 | "ADD KEY `I_ube_report_time_debris_id` (`ube_report_time_process` DESC, `ube_report_debris_total_in_metal` DESC, `ube_report_id` ASC)", // For Best Battles module |
@@ -1128,7 +1128,7 @@ discard block |
||
1128 | 1128 | |
1129 | 1129 | |
1130 | 1130 | // 2015-12-06 15:10:58 40b1.0 |
1131 | - if(!empty($update_indexes['planets']['I_metal_mine'])) { |
|
1131 | + if (!empty($update_indexes['planets']['I_metal_mine'])) { |
|
1132 | 1132 | upd_alter_table('planets', "DROP KEY `I_metal`", $update_indexes['planets']['I_metal']); |
1133 | 1133 | upd_alter_table('planets', "DROP KEY `I_ship_sattelite_sloth`", $update_indexes['planets']['I_ship_sattelite_sloth']); |
1134 | 1134 | upd_alter_table('planets', "DROP KEY `I_ship_bomber_envy`", $update_indexes['planets']['I_ship_bomber_envy']); |
@@ -1191,7 +1191,7 @@ discard block |
||
1191 | 1191 | case 40: |
1192 | 1192 | upd_log_version_update(); |
1193 | 1193 | |
1194 | - if(empty($update_tables['festival'])) { |
|
1194 | + if (empty($update_tables['festival'])) { |
|
1195 | 1195 | upd_create_table('festival', " ( |
1196 | 1196 | `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT, |
1197 | 1197 | `start` datetime NOT NULL COMMENT 'Festival start datetime', |
@@ -1232,7 +1232,7 @@ discard block |
||
1232 | 1232 | ); |
1233 | 1233 | } |
1234 | 1234 | |
1235 | - if(empty($update_tables['festival_unit'])) { |
|
1235 | + if (empty($update_tables['festival_unit'])) { |
|
1236 | 1236 | upd_create_table('festival_unit', " ( |
1237 | 1237 | `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
1238 | 1238 | `highspot_id` int(10) unsigned DEFAULT NULL, |
@@ -1249,7 +1249,7 @@ discard block |
||
1249 | 1249 | } |
1250 | 1250 | |
1251 | 1251 | // 2015-12-21 06:06:09 41a0.12 |
1252 | - if(empty($update_tables['festival_unit_log'])) { |
|
1252 | + if (empty($update_tables['festival_unit_log'])) { |
|
1253 | 1253 | upd_create_table('festival_unit_log', " ( |
1254 | 1254 | `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, |
1255 | 1255 | `highspot_id` int(10) unsigned DEFAULT NULL, |
@@ -1279,19 +1279,19 @@ discard block |
||
1279 | 1279 | $update_tables['security_browser']['browser_user_agent']['Collation'] == 'latin1_bin' |
1280 | 1280 | ); |
1281 | 1281 | |
1282 | - if($update_indexes_full['security_browser']['I_browser_user_agent']['browser_user_agent']['Index_type'] == 'BTREE') { |
|
1282 | + if ($update_indexes_full['security_browser']['I_browser_user_agent']['browser_user_agent']['Index_type'] == 'BTREE') { |
|
1283 | 1283 | upd_alter_table('security_browser', "DROP KEY `I_browser_user_agent`", true); |
1284 | 1284 | upd_alter_table('security_browser', "ADD KEY `I_browser_user_agent` (`browser_user_agent`) USING HASH", true); |
1285 | 1285 | } |
1286 | 1286 | |
1287 | - if(!empty($update_tables['fleets']['fleet_array'])) { |
|
1287 | + if (!empty($update_tables['fleets']['fleet_array'])) { |
|
1288 | 1288 | $query = upd_do_query("SELECT * FROM {{fleets}}"); |
1289 | - while($row = db_fetch($query)) { |
|
1289 | + while ($row = db_fetch($query)) { |
|
1290 | 1290 | $unit_list = sys_unit_str2arr($row['fleet_array']); |
1291 | - foreach($unit_list as $unit_id => $unit_count) { |
|
1291 | + foreach ($unit_list as $unit_id => $unit_count) { |
|
1292 | 1292 | upd_do_query( |
1293 | 1293 | "REPLACE INTO {{unit}} (`unit_player_id`,`unit_location_type`,`unit_location_id`,`unit_type`,`unit_snid`,`unit_level`) VALUES |
1294 | - ({$row['fleet_owner']}, " . LOC_FLEET . ", {$row['fleet_id']}, 200, {$unit_id}, {$unit_count});", |
|
1294 | + ({$row['fleet_owner']}, ".LOC_FLEET.", {$row['fleet_id']}, 200, {$unit_id}, {$unit_count});", |
|
1295 | 1295 | // ({$row['fleet_owner']}, " . LOC_FLEET . ", {$row['fleet_id']}, " . get_unit_param($unit_id, P_UNIT_TYPE) . ", {$unit_id}, {$unit_count});", |
1296 | 1296 | true |
1297 | 1297 | ); |
@@ -1325,11 +1325,11 @@ discard block |
||
1325 | 1325 | |
1326 | 1326 | classSupernova::$cache->unset_by_prefix('lng_'); |
1327 | 1327 | |
1328 | -if($new_version) { |
|
1328 | +if ($new_version) { |
|
1329 | 1329 | classSupernova::$config->db_saveItem('db_version', $new_version); |
1330 | 1330 | upd_log_message("<font color=green>DB version is now {$new_version}</font>"); |
1331 | 1331 | } else { |
1332 | - upd_log_message("DB version didn't changed from " . classSupernova::$config->db_version); |
|
1332 | + upd_log_message("DB version didn't changed from ".classSupernova::$config->db_version); |
|
1333 | 1333 | } |
1334 | 1334 | |
1335 | 1335 | classSupernova::$config->db_loadAll(); |
@@ -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,69 +616,69 @@ 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_NO_RESULT' , -2); |
|
639 | -define('FLIGHT_ALLOWED_NEW' , -1); |
|
638 | +define('FLIGHT_NO_RESULT', -2); |
|
639 | +define('FLIGHT_ALLOWED_NEW', -1); |
|
640 | 640 | //define('FLIGHT_DO_NOTHING' , 0); |
641 | -define('FLIGHT_ALLOWED' , 0); |
|
642 | -define('FLIGHT_VECTOR_NO_TARGET' , 1); |
|
643 | -define('FLIGHT_PLAYER_OWN' , 2); |
|
644 | -define('FLIGHT_MISSION_IMPOSSIBLE' , 3); |
|
645 | -define('FLIGHT_MISSION_HOLD_NO_ALLY_DEPOSIT' , 4); |
|
646 | -define('FLIGHT_MISSION_RECYCLE_NO_DEBRIS' , 5); |
|
647 | -define('FLIGHT_PLAYER_VACATION' , 6); |
|
648 | -define('FLIGHT_PLAYER_SAME_IP' , 7); |
|
649 | -define('FLIGHT_PLAYER_BUFFING' , 8); |
|
650 | -define('FLIGHT_PLAYER_ADMIN' , 9); |
|
651 | -define('FLIGHT_PLAYER_NOOB' , 10); |
|
652 | -define('FLIGHT_PLAYER_VACATION_OWN' , 11); |
|
653 | -define('FLIGHT_MISSION_MISSILE_NO_SILO' , 12); |
|
654 | -define('FLIGHT_MISSION_MISSILE_NO_MISSILES' , 13); |
|
655 | -define('FLIGHT_SHIPS_NO_SHIPS' , 14); |
|
656 | -define('FLIGHT_FLEET_NO_SLOTS' , 15); |
|
657 | -define('FLIGHT_SHIPS_NOT_ENOUGH_OR_RESOURCES' , 16); |
|
658 | -define('FLIGHT_SHIPS_NO_RECYCLERS' , 17); |
|
659 | -define('FLIGHT_MISSION_SPY_NO_SPIES' , 18); |
|
660 | -define('FLIGHT_SHIPS_NO_COLONIZER' , 19); |
|
661 | -define('FLIGHT_MISSION_MISSILE_TOO_FAR' , 20); |
|
662 | -define('FLIGHT_MISSION_MISSILE_WRONG_STRUCTURE' , 21); |
|
663 | -define('FLIGHT_RESOURCES_FUEL_NOT_ENOUGH' , 22); |
|
664 | -define('FLIGHT_RESOURCES_NOT_ENOUGH' , 23); |
|
665 | -define('FLIGHT_MISSION_ACS_NOT_EXISTS' , 24); |
|
666 | -define('FLIGHT_MISSION_ACS_MISSTARGET' , 25); |
|
667 | -define('FLIGHT_FLEET_SPEED_WRONG' , 26); |
|
668 | -define('FLIGHT_MISSION_ACS_TOO_LATE' , 27); |
|
669 | -define('FLIGHT_MISSION_ATTACK_BASHING' , 28); |
|
670 | -define('FLIGHT_MISSION_ATTACK_BASHING_WAR_DELAY' , 29); |
|
671 | -define('FLIGHT_MISSION_ACS_WRONG_TARGET' , 30); |
|
672 | -define('FLIGHT_VECTOR_SAME_SOURCE' , 31); |
|
641 | +define('FLIGHT_ALLOWED', 0); |
|
642 | +define('FLIGHT_VECTOR_NO_TARGET', 1); |
|
643 | +define('FLIGHT_PLAYER_OWN', 2); |
|
644 | +define('FLIGHT_MISSION_IMPOSSIBLE', 3); |
|
645 | +define('FLIGHT_MISSION_HOLD_NO_ALLY_DEPOSIT', 4); |
|
646 | +define('FLIGHT_MISSION_RECYCLE_NO_DEBRIS', 5); |
|
647 | +define('FLIGHT_PLAYER_VACATION', 6); |
|
648 | +define('FLIGHT_PLAYER_SAME_IP', 7); |
|
649 | +define('FLIGHT_PLAYER_BUFFING', 8); |
|
650 | +define('FLIGHT_PLAYER_ADMIN', 9); |
|
651 | +define('FLIGHT_PLAYER_NOOB', 10); |
|
652 | +define('FLIGHT_PLAYER_VACATION_OWN', 11); |
|
653 | +define('FLIGHT_MISSION_MISSILE_NO_SILO', 12); |
|
654 | +define('FLIGHT_MISSION_MISSILE_NO_MISSILES', 13); |
|
655 | +define('FLIGHT_SHIPS_NO_SHIPS', 14); |
|
656 | +define('FLIGHT_FLEET_NO_SLOTS', 15); |
|
657 | +define('FLIGHT_SHIPS_NOT_ENOUGH_OR_RESOURCES', 16); |
|
658 | +define('FLIGHT_SHIPS_NO_RECYCLERS', 17); |
|
659 | +define('FLIGHT_MISSION_SPY_NO_SPIES', 18); |
|
660 | +define('FLIGHT_SHIPS_NO_COLONIZER', 19); |
|
661 | +define('FLIGHT_MISSION_MISSILE_TOO_FAR', 20); |
|
662 | +define('FLIGHT_MISSION_MISSILE_WRONG_STRUCTURE', 21); |
|
663 | +define('FLIGHT_RESOURCES_FUEL_NOT_ENOUGH', 22); |
|
664 | +define('FLIGHT_RESOURCES_NOT_ENOUGH', 23); |
|
665 | +define('FLIGHT_MISSION_ACS_NOT_EXISTS', 24); |
|
666 | +define('FLIGHT_MISSION_ACS_MISSTARGET', 25); |
|
667 | +define('FLIGHT_FLEET_SPEED_WRONG', 26); |
|
668 | +define('FLIGHT_MISSION_ACS_TOO_LATE', 27); |
|
669 | +define('FLIGHT_MISSION_ATTACK_BASHING', 28); |
|
670 | +define('FLIGHT_MISSION_ATTACK_BASHING_WAR_DELAY', 29); |
|
671 | +define('FLIGHT_MISSION_ACS_WRONG_TARGET', 30); |
|
672 | +define('FLIGHT_VECTOR_SAME_SOURCE', 31); |
|
673 | 673 | define('FLIGHT_RESOURCES_FORBIDDEN', 32); |
674 | -define('FLIGHT_MISSION_TRANSPORT_EMPTY_CARGO' , 33); |
|
675 | -define('FLIGHT_SHIPS_NOT_ONLY_SPIES' , 34); |
|
676 | -define('FLIGHT_FLEET_TOO_FAR' , 35); |
|
677 | -define('FLIGHT_FLEET_OVERLOAD' , 36); |
|
678 | -define('FLIGHT_MISSION_UNKNOWN' , 37); |
|
679 | -define('FLIGHT_SHIPS_UNIT_WRONG' , 38); |
|
680 | -define('FLIGHT_SHIPS_UNMOVABLE' , 39); |
|
681 | -define('FLIGHT_SHIPS_NEGATIVE' , 40); |
|
674 | +define('FLIGHT_MISSION_TRANSPORT_EMPTY_CARGO', 33); |
|
675 | +define('FLIGHT_SHIPS_NOT_ONLY_SPIES', 34); |
|
676 | +define('FLIGHT_FLEET_TOO_FAR', 35); |
|
677 | +define('FLIGHT_FLEET_OVERLOAD', 36); |
|
678 | +define('FLIGHT_MISSION_UNKNOWN', 37); |
|
679 | +define('FLIGHT_SHIPS_UNIT_WRONG', 38); |
|
680 | +define('FLIGHT_SHIPS_UNMOVABLE', 39); |
|
681 | +define('FLIGHT_SHIPS_NEGATIVE', 40); |
|
682 | 682 | define('FLIGHT_RESOURCES_NEGATIVE', 41); |
683 | 683 | define('FLIGHT_MISSION_MORATORIUM', 42); |
684 | 684 | define('FLIGHT_PLAYER_CHILD_PROTECTION', 43); |
@@ -723,12 +723,12 @@ discard block |
||
723 | 723 | |
724 | 724 | |
725 | 725 | // *** Races - Homeworlds |
726 | -define('RACE_NONE' , 0); |
|
727 | -define('RACE_EARTH' , 1); |
|
728 | -define('RACE_MOON' , 2); |
|
729 | -define('RACE_MERCURY' , 3); |
|
730 | -define('RACE_VENUS' , 4); |
|
731 | -define('RACE_MARS' , 5); |
|
726 | +define('RACE_NONE', 0); |
|
727 | +define('RACE_EARTH', 1); |
|
728 | +define('RACE_MOON', 2); |
|
729 | +define('RACE_MERCURY', 3); |
|
730 | +define('RACE_VENUS', 4); |
|
731 | +define('RACE_MARS', 5); |
|
732 | 732 | define('RACE_ASTEROID', 6); |
733 | 733 | // define('MARKET_INFO' , 7); |
734 | 734 | |
@@ -736,114 +736,114 @@ discard block |
||
736 | 736 | |
737 | 737 | // *** Market variables |
738 | 738 | // === Market blocks |
739 | -define('MARKET_ENTRY' , 0); |
|
740 | -define('MARKET_RESOURCES' , 1); |
|
741 | -define('MARKET_SCRAPPER' , 2); |
|
742 | -define('MARKET_STOCKMAN' , 3); |
|
743 | -define('MARKET_EXCHANGE' , 4); |
|
744 | -define('MARKET_BANKER' , 5); |
|
745 | -define('MARKET_PAWNSHOP' , 6); |
|
746 | -define('MARKET_INFO' , 7); |
|
739 | +define('MARKET_ENTRY', 0); |
|
740 | +define('MARKET_RESOURCES', 1); |
|
741 | +define('MARKET_SCRAPPER', 2); |
|
742 | +define('MARKET_STOCKMAN', 3); |
|
743 | +define('MARKET_EXCHANGE', 4); |
|
744 | +define('MARKET_BANKER', 5); |
|
745 | +define('MARKET_PAWNSHOP', 6); |
|
746 | +define('MARKET_INFO', 7); |
|
747 | 747 | |
748 | 748 | // === Market error statuses |
749 | -define('MARKET_NOTHING' , 0); |
|
750 | -define('MARKET_DEAL' , 1); |
|
751 | -define('MARKET_DEAL_TRADE' , 2); |
|
752 | -define('MARKET_NO_DM' , 3); |
|
753 | -define('MARKET_NO_RESOURCES' , 4); |
|
754 | -define('MARKET_ZERO_DEAL' , 5); |
|
755 | -define('MARKET_NO_SHIPS' , 6); |
|
756 | -define('MARKET_NOT_A_SHIP' , 7); |
|
757 | -define('MARKET_NO_STOCK' , 8); |
|
758 | -define('MARKET_ZERO_RES_STOCK' , 9); |
|
759 | -define('MARKET_NEGATIVE_SHIPS' , 10); |
|
760 | - |
|
761 | -define('MARKET_INFO_PLAYER' , 12); |
|
762 | -define('MARKET_INFO_WRONG' , 11); |
|
749 | +define('MARKET_NOTHING', 0); |
|
750 | +define('MARKET_DEAL', 1); |
|
751 | +define('MARKET_DEAL_TRADE', 2); |
|
752 | +define('MARKET_NO_DM', 3); |
|
753 | +define('MARKET_NO_RESOURCES', 4); |
|
754 | +define('MARKET_ZERO_DEAL', 5); |
|
755 | +define('MARKET_NO_SHIPS', 6); |
|
756 | +define('MARKET_NOT_A_SHIP', 7); |
|
757 | +define('MARKET_NO_STOCK', 8); |
|
758 | +define('MARKET_ZERO_RES_STOCK', 9); |
|
759 | +define('MARKET_NEGATIVE_SHIPS', 10); |
|
760 | + |
|
761 | +define('MARKET_INFO_PLAYER', 12); |
|
762 | +define('MARKET_INFO_WRONG', 11); |
|
763 | 763 | define('MARKET_INFO_PLAYER_NOT_FOUND', 13); |
764 | -define('MARKET_INFO_PLAYER_WRONG' , 14); |
|
765 | -define('MARKET_INFO_PLAYER_SAME' , 15); |
|
764 | +define('MARKET_INFO_PLAYER_WRONG', 14); |
|
765 | +define('MARKET_INFO_PLAYER_SAME', 15); |
|
766 | 766 | |
767 | 767 | |
768 | 768 | |
769 | 769 | |
770 | 770 | // *** Mercenary/talent bonus types |
771 | -define('BONUS_NONE' , 0); // No bonus |
|
772 | -define('BONUS_PERCENT' , 1); // Percent on base value |
|
773 | -define('BONUS_ADD' , 2); // Add |
|
774 | -define('BONUS_ABILITY' , 3); // Some ability |
|
775 | -define('BONUS_MULTIPLY', 4); // Multiply by value |
|
776 | -define('BONUS_PERCENT_CUMULATIVE' , 5); // Cumulative percent on base value |
|
777 | -define('BONUS_PERCENT_DEGRADED' , 6); // Bonus amount degraded with increase as pow(bonus, level) (?) |
|
778 | -define('BONUS_SPEED', 7); // Speed bonus |
|
771 | +define('BONUS_NONE', 0); // No bonus |
|
772 | +define('BONUS_PERCENT', 1); // Percent on base value |
|
773 | +define('BONUS_ADD', 2); // Add |
|
774 | +define('BONUS_ABILITY', 3); // Some ability |
|
775 | +define('BONUS_MULTIPLY', 4); // Multiply by value |
|
776 | +define('BONUS_PERCENT_CUMULATIVE', 5); // Cumulative percent on base value |
|
777 | +define('BONUS_PERCENT_DEGRADED', 6); // Bonus amount degraded with increase as pow(bonus, level) (?) |
|
778 | +define('BONUS_SPEED', 7); // Speed bonus |
|
779 | 779 | |
780 | 780 | // *** Action constant (build should be replaced with ACTION) |
781 | -define('BUILD_CREATE' , 1); |
|
781 | +define('BUILD_CREATE', 1); |
|
782 | 782 | define('BUILD_DESTROY', -1); |
783 | 783 | define('BUILD_AUTOCONVERT', 2); |
784 | 784 | |
785 | -define('ACTION_SELL' , -1); |
|
786 | -define('ACTION_NOTHING' , 0); |
|
787 | -define('ACTION_BUY' , 1); |
|
788 | -define('ACTION_USE' , 2); |
|
789 | -define('ACTION_DELETE' , 3); |
|
785 | +define('ACTION_SELL', -1); |
|
786 | +define('ACTION_NOTHING', 0); |
|
787 | +define('ACTION_BUY', 1); |
|
788 | +define('ACTION_USE', 2); |
|
789 | +define('ACTION_DELETE', 3); |
|
790 | 790 | |
791 | 791 | // *** Check unit availability codes |
792 | -define('BUILD_ALLOWED' , 0); // HARDCODED! DO NOT CHANGE! |
|
792 | +define('BUILD_ALLOWED', 0); // HARDCODED! DO NOT CHANGE! |
|
793 | 793 | define('BUILD_REQUIRE_NOT_MEET', 1); |
794 | -define('BUILD_AMOUNT_WRONG' , 2); |
|
795 | -define('BUILD_QUE_WRONG' , 3); |
|
796 | -define('BUILD_QUE_UNIT_WRONG' , 4); |
|
797 | -define('BUILD_INDESTRUCTABLE' , 5); |
|
798 | -define('BUILD_NO_RESOURCES' , 6); |
|
799 | -define('BUILD_NO_UNITS' , 7); |
|
800 | -define('BUILD_UNIT_BUSY' , 8); |
|
801 | -define('BUILD_QUE_FULL' , 9); |
|
802 | -define('BUILD_SILO_FULL' ,10); |
|
803 | -define('BUILD_MAX_REACHED' ,11); |
|
804 | -define('BUILD_SECTORS_NONE' ,12); |
|
794 | +define('BUILD_AMOUNT_WRONG', 2); |
|
795 | +define('BUILD_QUE_WRONG', 3); |
|
796 | +define('BUILD_QUE_UNIT_WRONG', 4); |
|
797 | +define('BUILD_INDESTRUCTABLE', 5); |
|
798 | +define('BUILD_NO_RESOURCES', 6); |
|
799 | +define('BUILD_NO_UNITS', 7); |
|
800 | +define('BUILD_UNIT_BUSY', 8); |
|
801 | +define('BUILD_QUE_FULL', 9); |
|
802 | +define('BUILD_SILO_FULL', 10); |
|
803 | +define('BUILD_MAX_REACHED', 11); |
|
804 | +define('BUILD_SECTORS_NONE', 12); |
|
805 | 805 | define('BUILD_AUTOCONVERT_AVAILABLE', 13); |
806 | 806 | |
807 | 807 | |
808 | 808 | // *** Que types |
809 | 809 | define('QUE_STRUCTURES', 1); |
810 | -define('QUE_HANGAR' , 4); |
|
811 | -define('QUE_RESEARCH' , 7); |
|
812 | -define('QUE_MERCENARY' , 600); // UNIT_MERCENARIES |
|
810 | +define('QUE_HANGAR', 4); |
|
811 | +define('QUE_RESEARCH', 7); |
|
812 | +define('QUE_MERCENARY', 600); // UNIT_MERCENARIES |
|
813 | 813 | // *** Subque types |
814 | -define('SUBQUE_PLANET' , 1); |
|
815 | -define('SUBQUE_MOON' , 3); |
|
816 | -define('SUBQUE_FLEET' , 4); |
|
817 | -define('SUBQUE_DEFENSE' , 6); |
|
814 | +define('SUBQUE_PLANET', 1); |
|
815 | +define('SUBQUE_MOON', 3); |
|
816 | +define('SUBQUE_FLEET', 4); |
|
817 | +define('SUBQUE_DEFENSE', 6); |
|
818 | 818 | define('SUBQUE_RESEARCH', 7); |
819 | 819 | |
820 | 820 | // *** Que items |
821 | -define('QI_UNIT_ID' , 0); |
|
822 | -define('QI_AMOUNT' , 1); |
|
823 | -define('QI_TIME' , 2); |
|
824 | -define('QI_MODE' , 3); |
|
825 | -define('QI_QUE_ID' , 4); |
|
826 | -define('QI_QUE_TYPE' , 4); |
|
827 | -define('QI_PLANET_ID' , 5); |
|
821 | +define('QI_UNIT_ID', 0); |
|
822 | +define('QI_AMOUNT', 1); |
|
823 | +define('QI_TIME', 2); |
|
824 | +define('QI_MODE', 3); |
|
825 | +define('QI_QUE_ID', 4); |
|
826 | +define('QI_QUE_TYPE', 4); |
|
827 | +define('QI_PLANET_ID', 5); |
|
828 | 828 | |
829 | 829 | |
830 | 830 | // *** Units |
831 | 831 | |
832 | 832 | // *** Sort options |
833 | -define('SORT_ASCENDING' , 0); |
|
833 | +define('SORT_ASCENDING', 0); |
|
834 | 834 | define('SORT_DESCENDING', 1); |
835 | 835 | |
836 | -define('SORT_ID' , 0); |
|
837 | -define('SORT_LOCATION' , 1); |
|
838 | -define('SORT_NAME' , 2); |
|
839 | -define('SORT_SIZE' , 3); |
|
840 | -define('SORT_EMAIL' , 4); |
|
841 | -define('SORT_IP' , 5); |
|
836 | +define('SORT_ID', 0); |
|
837 | +define('SORT_LOCATION', 1); |
|
838 | +define('SORT_NAME', 2); |
|
839 | +define('SORT_SIZE', 3); |
|
840 | +define('SORT_EMAIL', 4); |
|
841 | +define('SORT_IP', 5); |
|
842 | 842 | define('SORT_TIME_REGISTERED', 6); |
843 | 843 | define('SORT_TIME_LAST_VISIT', 7); |
844 | -define('SORT_TIME_BAN_UNTIL' , 8); |
|
845 | -define('SORT_REFERRAL_COUNT' , 9); |
|
846 | -define('SORT_REFERRAL_DM' , 10); |
|
844 | +define('SORT_TIME_BAN_UNTIL', 8); |
|
845 | +define('SORT_REFERRAL_COUNT', 9); |
|
846 | +define('SORT_REFERRAL_DM', 10); |
|
847 | 847 | |
848 | 848 | |
849 | 849 | define('HULL_SIZE_TINY', 1); |
@@ -987,10 +987,10 @@ discard block |
||
987 | 987 | |
988 | 988 | // === Artifacts |
989 | 989 | define('UNIT_ARTIFACTS', 1000); |
990 | -define('ART_LHC', 1001); // Additional moon chance |
|
991 | -define('ART_RCD_SMALL', 1002); // Rapid Colony Deployment - Set of buildings up to 10th level - 10/14/ 3/0 - 405 DM |
|
992 | -define('ART_RCD_MEDIUM', 1003); // Rapid Colony Deployment - Set of buildings up to 15th level - 15/20/ 8/0 - 4704 DM |
|
993 | -define('ART_RCD_LARGE', 1004); // Rapid Colony Deployment - Set of buildings up to 20th level - 20/25/10/1 - 39790 DM |
|
990 | +define('ART_LHC', 1001); // Additional moon chance |
|
991 | +define('ART_RCD_SMALL', 1002); // Rapid Colony Deployment - Set of buildings up to 10th level - 10/14/ 3/0 - 405 DM |
|
992 | +define('ART_RCD_MEDIUM', 1003); // Rapid Colony Deployment - Set of buildings up to 15th level - 15/20/ 8/0 - 4704 DM |
|
993 | +define('ART_RCD_LARGE', 1004); // Rapid Colony Deployment - Set of buildings up to 20th level - 20/25/10/1 - 39790 DM |
|
994 | 994 | define('ART_HEURISTIC_CHIP', 1005); // Speed up research |
995 | 995 | define('ART_NANO_BUILDER', 1006); // Speed up building |
996 | 996 | define('ART_NANO_CONSTRUCTOR', 1007); // RESERVED Speed up hangar constructions |
@@ -1061,18 +1061,18 @@ discard block |
||
1061 | 1061 | define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE1', 2201); // Блиц-сервер, участник 0-го раунда, 1-е место |
1062 | 1062 | define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE2', 2202); // Блиц-сервер, участник 0-го раунда, 2-е место |
1063 | 1063 | define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE3', 2203); // Блиц-сервер, участник 0-го раунда, 3-е место |
1064 | -define('UNIT_AWARD_MEDAL_2016_WOMEN_DAY_BEST', 2204); // Медаль Лучшему Кавалеру за максимум потраченной ММ/максимум одаренных женщин Женщине от Мужчины во время ивента 8 марта 2016 года |
|
1064 | +define('UNIT_AWARD_MEDAL_2016_WOMEN_DAY_BEST', 2204); // Медаль Лучшему Кавалеру за максимум потраченной ММ/максимум одаренных женщин Женщине от Мужчины во время ивента 8 марта 2016 года |
|
1065 | 1065 | |
1066 | 1066 | define('UNIT_AWARD_MEMORY', 2300); // Памятные знаки за существование и участие - например "4 года в игре". "Был онлайн в новогоднюю ночь 2013". итд |
1067 | -define('UNIT_AWARD_MEMORY_IMMORTAL', 2301); // Бессмертный |
|
1068 | -define('UNIT_AWARD_MEMORY_2015_WOMEN_DAY', 2302); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2015 года |
|
1067 | +define('UNIT_AWARD_MEMORY_IMMORTAL', 2301); // Бессмертный |
|
1068 | +define('UNIT_AWARD_MEMORY_2015_WOMEN_DAY', 2302); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2015 года |
|
1069 | 1069 | define('UNIT_AWARD_MEMORY_BLITZ_R0', 2303); // Блиц-сервер, участник 0-го раунда |
1070 | 1070 | define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_SIMPLE', 2304); // День Рождения СН |
1071 | 1071 | define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_BRONZE', 2305); // День Рождения СН |
1072 | 1072 | define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_SILVER', 2306); // День Рождения СН |
1073 | 1073 | define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_GOLD', 2307); // День Рождения СН |
1074 | 1074 | define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_PLATINUM', 2308); // День Рождения СН |
1075 | -define('UNIT_AWARD_MEMORY_2016_WOMEN_DAY', 2309); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2016 года |
|
1075 | +define('UNIT_AWARD_MEMORY_2016_WOMEN_DAY', 2309); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2016 года |
|
1076 | 1076 | |
1077 | 1077 | define('UNIT_AWARD_PENNANT', 2400); // Переходящий вымпел - индикация статуса на сервере: "Топ-1", "Топ", "Сабтоп", "Самый большой флот" итд |
1078 | 1078 | define('UNIT_AWARD_BADGE', 2600); // Бейджики/значки за ачивки - например, "Построил 1000 кораблей" |
@@ -1169,7 +1169,7 @@ discard block |
||
1169 | 1169 | |
1170 | 1170 | define('UNIT_NEXT', 4000); // !!! Next unit start on 4000 !!! |
1171 | 1171 | |
1172 | -define('GROUP_PART', 800000); |
|
1172 | +define('GROUP_PART', 800000); |
|
1173 | 1173 | // Зарезервировано для запчастей: 800.001 - 899.999 |
1174 | 1174 | // define('GROUP_PART_HULL', 801000); // Корпуса - 1000 штук |
1175 | 1175 | // define('GROUP_PART_ARMOR', 802000); // Броня - 1000 штук |
@@ -1426,32 +1426,32 @@ discard block |
||
1426 | 1426 | |
1427 | 1427 | |
1428 | 1428 | // define('NICK_ID', -1); |
1429 | -define('NICK_HTML', 0); |
|
1430 | - |
|
1431 | -define('NICK_FIRST', 1); |
|
1432 | -define('NICK_RACE', 1000); |
|
1433 | -define('NICK_GENDER', 2000); |
|
1434 | -define('NICK_AWARD', 3000); |
|
1435 | -define('NICK_VACATION', 3500); |
|
1436 | -define('NICK_BIRTHSDAY', 4000); |
|
1437 | -define('NICK_PREMIUM', 5000); |
|
1438 | -define('NICK_AUTH_LEVEL', 6000); |
|
1439 | - |
|
1440 | -define('NICK_HIGHLIGHT', 6300); |
|
1441 | -define('NICK_CLASS', 6450); |
|
1442 | - |
|
1443 | -define('NICK_NICK_CLASS', 6600); |
|
1444 | -define('NICK_NICK', 7000); |
|
1429 | +define('NICK_HTML', 0); |
|
1430 | + |
|
1431 | +define('NICK_FIRST', 1); |
|
1432 | +define('NICK_RACE', 1000); |
|
1433 | +define('NICK_GENDER', 2000); |
|
1434 | +define('NICK_AWARD', 3000); |
|
1435 | +define('NICK_VACATION', 3500); |
|
1436 | +define('NICK_BIRTHSDAY', 4000); |
|
1437 | +define('NICK_PREMIUM', 5000); |
|
1438 | +define('NICK_AUTH_LEVEL', 6000); |
|
1439 | + |
|
1440 | +define('NICK_HIGHLIGHT', 6300); |
|
1441 | +define('NICK_CLASS', 6450); |
|
1442 | + |
|
1443 | +define('NICK_NICK_CLASS', 6600); |
|
1444 | +define('NICK_NICK', 7000); |
|
1445 | 1445 | define('NICK_NICK_CLASS_END', 7300); |
1446 | 1446 | |
1447 | -define('NICK_ALLY_CLASS', 7600); |
|
1448 | -define('NICK_ALLY', 8000); |
|
1447 | +define('NICK_ALLY_CLASS', 7600); |
|
1448 | +define('NICK_ALLY', 8000); |
|
1449 | 1449 | define('NICK_ALLY_CLASS_END', 8300); |
1450 | 1450 | |
1451 | -define('NICK_CLASS_END', 8450); |
|
1452 | -define('NICK_HIGHLIGHT_END', 8600); |
|
1451 | +define('NICK_CLASS_END', 8450); |
|
1452 | +define('NICK_HIGHLIGHT_END', 8600); |
|
1453 | 1453 | |
1454 | -define('NICK_LAST', 9999); |
|
1454 | +define('NICK_LAST', 9999); |
|
1455 | 1455 | |
1456 | 1456 | // Настройки игрока |
1457 | 1457 | define('PLAYER_OPTION_MENU_SORT', 1); |
@@ -1544,8 +1544,8 @@ discard block |
||
1544 | 1544 | define('LOG_ONLIINE_AGGREGATE_PERIOD_MINUTE_10', 1); |
1545 | 1545 | |
1546 | 1546 | define('BLITZ_REGISTER_DISABLED', 0); |
1547 | -define('BLITZ_REGISTER_OPEN' , 1); |
|
1548 | -define('BLITZ_REGISTER_CLOSED' , 2); |
|
1547 | +define('BLITZ_REGISTER_OPEN', 1); |
|
1548 | +define('BLITZ_REGISTER_CLOSED', 2); |
|
1549 | 1549 | define('BLITZ_REGISTER_SHOW_LOGIN', 3); |
1550 | 1550 | define('BLITZ_REGISTER_DISCLOSURE_NAMES', 4); |
1551 | 1551 |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | define('SN_IN_FLEET', true); |
6 | 6 | define('SN_RENDER_NAVBAR_PLANET', true); |
7 | 7 | |
8 | -include('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
8 | +include('../common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
9 | 9 | |
10 | 10 | // TODO - Переместить это куда-нибудь |
11 | 11 | $fleet_page = sys_get_param_int('fleet_page', sys_get_param_int('mode')); |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | // break; |
193 | 193 | } |
194 | 194 | |
195 | - if($exceptionCode !== null) { |
|
196 | - print('<span style="color: red; font-size: 200%;">FAILED! Expected Exception [' . $exceptionCode . ']: "' . classLocale::$lang['fl_attack_error'][$exceptionCode] . '" - FAILED!</span><br />'); |
|
195 | + if ($exceptionCode !== null) { |
|
196 | + print('<span style="color: red; font-size: 200%;">FAILED! Expected Exception ['.$exceptionCode.']: "'.classLocale::$lang['fl_attack_error'][$exceptionCode].'" - FAILED!</span><br />'); |
|
197 | 197 | print('<div style="color: red; font-size: 200%;">NO EXCEPTION RAISED</div>'); |
198 | 198 | pdie(); |
199 | 199 | } else { |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | if ($exceptionCode !== null && $e->getCode() === $exceptionCode) { |
204 | 204 | // print('<span style="color: darkgreen;">Exception [' . $exceptionCode . ']: "' . classLocale::$lang['fl_attack_error'][$exceptionCode] . '" - passed</span><br />'); |
205 | 205 | } else { |
206 | - print('<div style="color: red; font-size: 200%;">Expected Exception [' . $exceptionCode . ']: "' . classLocale::$lang['fl_attack_error'][$exceptionCode] . '" - FAILED!</div>'); |
|
207 | - print('<div style="color: red; font-size: 200%;">Got Exception [' . $e->getCode() . ']: "' . $e->getMessage() . '"/"' . classLocale::$lang['fl_attack_error'][$e->getCode()] . '" . "</div>'); |
|
206 | + print('<div style="color: red; font-size: 200%;">Expected Exception ['.$exceptionCode.']: "'.classLocale::$lang['fl_attack_error'][$exceptionCode].'" - FAILED!</div>'); |
|
207 | + print('<div style="color: red; font-size: 200%;">Got Exception ['.$e->getCode().']: "'.$e->getMessage().'"/"'.classLocale::$lang['fl_attack_error'][$e->getCode()].'" . "</div>'); |
|
208 | 208 | throw $e; |
209 | 209 | } |
210 | 210 | } |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | // Removing comment placeholder from statement |
165 | 165 | $this->queryPrepared = str_replace(static::COMMENT_PLACEHOLDER, DbSqlHelper::quoteComment($this->comment), $this->queryPrepared); |
166 | 166 | // Removing comment value from values list |
167 | - $this->paramsPrepared = array_filter($this->paramsPrepared, function ($value) { return $value != DbSqlPrepare::COMMENT_PLACEHOLDER; }); |
|
167 | + $this->paramsPrepared = array_filter($this->paramsPrepared, function($value) { return $value != DbSqlPrepare::COMMENT_PLACEHOLDER; }); |
|
168 | 168 | // TODO - Add comment value directly to statement |
169 | 169 | } |
170 | 170 | |
@@ -268,9 +268,9 @@ discard block |
||
268 | 268 | } |
269 | 269 | |
270 | 270 | public function getIterator() { |
271 | - if(DbSqlPrepare::$isUseGetResult) { |
|
271 | + if (DbSqlPrepare::$isUseGetResult) { |
|
272 | 272 | $mysqli_result = $this->statement->get_result(); |
273 | - if($mysqli_result instanceof mysqli_result) { |
|
273 | + if ($mysqli_result instanceof mysqli_result) { |
|
274 | 274 | $iterator = new DbMysqliResultIterator($this->statement->get_result()); |
275 | 275 | } else { |
276 | 276 | $iterator = new DbEmptyIterator(); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | public function load_db_settings() { |
66 | 66 | $dbsettings = array(); |
67 | 67 | |
68 | - require(SN_ROOT_PHYSICAL . "config" . DOT_PHP_EX); |
|
68 | + require(SN_ROOT_PHYSICAL."config".DOT_PHP_EX); |
|
69 | 69 | |
70 | 70 | $this->dbsettings = $dbsettings; |
71 | 71 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | $sql = $query; |
131 | 131 | if (strpos($sql, '{{') !== false) { |
132 | 132 | foreach ($this->table_list as $tableName) { |
133 | - $sql = str_replace("{{{$tableName}}}", $this->db_prefix . $tableName, $sql); |
|
133 | + $sql = str_replace("{{{$tableName}}}", $this->db_prefix.$tableName, $sql); |
|
134 | 134 | } |
135 | 135 | } |
136 | 136 | |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $arr = debug_backtrace(); |
151 | 151 | $file = end(explode('/', $arr[0]['file'])); |
152 | 152 | $line = $arr[0]['line']; |
153 | - classSupernova::$debug->add("<tr><th>Query {$this->queryCount}: </th><th>$query</th><th>{$file} @ {$line}</th><th> </th><th> " . ($fetch ? '+' : ' ') . " </th></tr>"); |
|
153 | + classSupernova::$debug->add("<tr><th>Query {$this->queryCount}: </th><th>$query</th><th>{$file} @ {$line}</th><th> </th><th> ".($fetch ? '+' : ' ')." </th></tr>"); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | |
@@ -210,12 +210,12 @@ discard block |
||
210 | 210 | |
211 | 211 | $queryResult = null; |
212 | 212 | try { |
213 | - $queryResult = $this->db_sql_query($stringQuery . DbSqlHelper::quoteComment($queryTrace)); |
|
213 | + $queryResult = $this->db_sql_query($stringQuery.DbSqlHelper::quoteComment($queryTrace)); |
|
214 | 214 | if (!$queryResult) { |
215 | 215 | throw new Exception(); |
216 | 216 | } |
217 | 217 | } catch (Exception $e) { |
218 | - classSupernova::$debug->error($this->db_error() . "<br />{$query}<br />", 'SQL Error'); |
|
218 | + classSupernova::$debug->error($this->db_error()."<br />{$query}<br />", 'SQL Error'); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | if ($fetch) { |
@@ -336,10 +336,10 @@ discard block |
||
336 | 336 | $this->isWatching = true; |
337 | 337 | $msg = "\$query = \"{$query}\"\n\r"; |
338 | 338 | if (!empty($_POST)) { |
339 | - $msg .= "\n\r" . dump($_POST, '$_POST'); |
|
339 | + $msg .= "\n\r".dump($_POST, '$_POST'); |
|
340 | 340 | } |
341 | 341 | if (!empty($_GET)) { |
342 | - $msg .= "\n\r" . dump($_GET, '$_GET'); |
|
342 | + $msg .= "\n\r".dump($_GET, '$_GET'); |
|
343 | 343 | } |
344 | 344 | classSupernova::$debug->warning($msg, "Watching user {$user['id']}", 399, array('base_dump' => true)); |
345 | 345 | $this->isWatching = false; |
@@ -365,37 +365,37 @@ discard block |
||
365 | 365 | case stripos($query, 'RPG_POINTS') != false && stripos(trim($query), 'UPDATE ') === 0 && !$dm_change_legit: |
366 | 366 | case stripos($query, 'METAMATTER') != false && stripos(trim($query), 'UPDATE ') === 0 && !$mm_change_legit: |
367 | 367 | case stripos($query, 'AUTHLEVEL') != false && $user['authlevel'] < 3 && stripos($query, 'SELECT') !== 0: |
368 | - $report = "Hacking attempt (" . date("d.m.Y H:i:s") . " - [" . time() . "]):\n"; |
|
368 | + $report = "Hacking attempt (".date("d.m.Y H:i:s")." - [".time()."]):\n"; |
|
369 | 369 | $report .= ">Database Inforamation\n"; |
370 | - $report .= "\tID - " . $user['id'] . "\n"; |
|
371 | - $report .= "\tUser - " . $user['username'] . "\n"; |
|
372 | - $report .= "\tAuth level - " . $user['authlevel'] . "\n"; |
|
373 | - $report .= "\tAdmin Notes - " . $user['adminNotes'] . "\n"; |
|
374 | - $report .= "\tCurrent Planet - " . $user['current_planet'] . "\n"; |
|
375 | - $report .= "\tUser IP - " . $user['user_lastip'] . "\n"; |
|
376 | - $report .= "\tUser IP at Reg - " . $user['ip_at_reg'] . "\n"; |
|
377 | - $report .= "\tUser Agent- " . $_SERVER['HTTP_USER_AGENT'] . "\n"; |
|
378 | - $report .= "\tCurrent Page - " . $user['current_page'] . "\n"; |
|
379 | - $report .= "\tRegister Time - " . $user['register_time'] . "\n"; |
|
370 | + $report .= "\tID - ".$user['id']."\n"; |
|
371 | + $report .= "\tUser - ".$user['username']."\n"; |
|
372 | + $report .= "\tAuth level - ".$user['authlevel']."\n"; |
|
373 | + $report .= "\tAdmin Notes - ".$user['adminNotes']."\n"; |
|
374 | + $report .= "\tCurrent Planet - ".$user['current_planet']."\n"; |
|
375 | + $report .= "\tUser IP - ".$user['user_lastip']."\n"; |
|
376 | + $report .= "\tUser IP at Reg - ".$user['ip_at_reg']."\n"; |
|
377 | + $report .= "\tUser Agent- ".$_SERVER['HTTP_USER_AGENT']."\n"; |
|
378 | + $report .= "\tCurrent Page - ".$user['current_page']."\n"; |
|
379 | + $report .= "\tRegister Time - ".$user['register_time']."\n"; |
|
380 | 380 | $report .= "\n"; |
381 | 381 | |
382 | 382 | $report .= ">Query Information\n"; |
383 | - $report .= "\tQuery - " . $query . "\n"; |
|
383 | + $report .= "\tQuery - ".$query."\n"; |
|
384 | 384 | $report .= "\n"; |
385 | 385 | |
386 | 386 | $report .= ">\$_SERVER Information\n"; |
387 | - $report .= "\tIP - " . $_SERVER['REMOTE_ADDR'] . "\n"; |
|
388 | - $report .= "\tHost Name - " . $_SERVER['HTTP_HOST'] . "\n"; |
|
389 | - $report .= "\tUser Agent - " . $_SERVER['HTTP_USER_AGENT'] . "\n"; |
|
390 | - $report .= "\tRequest Method - " . $_SERVER['REQUEST_METHOD'] . "\n"; |
|
391 | - $report .= "\tCame From - " . $_SERVER['HTTP_REFERER'] . "\n"; |
|
392 | - $report .= "\tPage is - " . $_SERVER['SCRIPT_NAME'] . "\n"; |
|
393 | - $report .= "\tUses Port - " . $_SERVER['REMOTE_PORT'] . "\n"; |
|
394 | - $report .= "\tServer Protocol - " . $_SERVER['SERVER_PROTOCOL'] . "\n"; |
|
387 | + $report .= "\tIP - ".$_SERVER['REMOTE_ADDR']."\n"; |
|
388 | + $report .= "\tHost Name - ".$_SERVER['HTTP_HOST']."\n"; |
|
389 | + $report .= "\tUser Agent - ".$_SERVER['HTTP_USER_AGENT']."\n"; |
|
390 | + $report .= "\tRequest Method - ".$_SERVER['REQUEST_METHOD']."\n"; |
|
391 | + $report .= "\tCame From - ".$_SERVER['HTTP_REFERER']."\n"; |
|
392 | + $report .= "\tPage is - ".$_SERVER['SCRIPT_NAME']."\n"; |
|
393 | + $report .= "\tUses Port - ".$_SERVER['REMOTE_PORT']."\n"; |
|
394 | + $report .= "\tServer Protocol - ".$_SERVER['SERVER_PROTOCOL']."\n"; |
|
395 | 395 | |
396 | 396 | $report .= "\n--------------------------------------------------------------------------------------------------\n"; |
397 | 397 | |
398 | - $fp = fopen(SN_ROOT_PHYSICAL . 'badqrys.txt', 'a'); |
|
398 | + $fp = fopen(SN_ROOT_PHYSICAL.'badqrys.txt', 'a'); |
|
399 | 399 | fwrite($fp, $report); |
400 | 400 | fclose($fp); |
401 | 401 |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | |
36 | 36 | $this->container = array(); |
37 | 37 | |
38 | - if(classSupernova::$cache->_MODE != CACHER_NO_CACHE && !classSupernova::$config->locale_cache_disable) { |
|
38 | + if (classSupernova::$cache->_MODE != CACHER_NO_CACHE && !classSupernova::$config->locale_cache_disable) { |
|
39 | 39 | $this->cache = classSupernova::$cache; |
40 | 40 | classSupernova::log_file('locale.__constructor: Cache is present'); |
41 | 41 | //$this->cache->unset_by_prefix($this->cache_prefix); // TODO - remove? 'cause debug! |
42 | 42 | } |
43 | 43 | |
44 | - if($enable_stat_usage && empty($this->stat_usage)) { |
|
44 | + if ($enable_stat_usage && empty($this->stat_usage)) { |
|
45 | 45 | $this->enable_stat_usage = $enable_stat_usage; |
46 | 46 | $this->usage_stat_load(); |
47 | 47 | // TODO shutdown function |
@@ -67,18 +67,18 @@ discard block |
||
67 | 67 | unset($fallback[$this->active]); |
68 | 68 | |
69 | 69 | // Проходим по оставшимся локалям |
70 | - foreach($fallback as $try_language) { |
|
70 | + foreach ($fallback as $try_language) { |
|
71 | 71 | // Если нет такой строки - пытаемся вытащить из кэша |
72 | - if(!isset($this->container[$try_language][$offset]) && $this->cache) { |
|
73 | - $this->container[$try_language][$offset] = $this->cache->__get($this->cache_prefix . $try_language . '_' . $offset); |
|
72 | + if (!isset($this->container[$try_language][$offset]) && $this->cache) { |
|
73 | + $this->container[$try_language][$offset] = $this->cache->__get($this->cache_prefix.$try_language.'_'.$offset); |
|
74 | 74 | // Записываем результат работы кэша |
75 | 75 | $locale_cache_statistic['queries']++; |
76 | 76 | isset($this->container[$try_language][$offset]) ? $locale_cache_statistic['hits']++ : $locale_cache_statistic['misses']++; |
77 | -!isset($this->container[$try_language][$offset]) ? $locale_cache_statistic['missed_str'][] = $this->cache_prefix . $try_language . '_' . $offset : false; |
|
77 | +!isset($this->container[$try_language][$offset]) ? $locale_cache_statistic['missed_str'][] = $this->cache_prefix.$try_language.'_'.$offset : false; |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | // Если мы как-то где-то нашли строку... |
81 | - if(isset($this->container[$try_language][$offset])) { |
|
81 | + if (isset($this->container[$try_language][$offset])) { |
|
82 | 82 | // ...значит она получена в результате фоллбэка и записываем её в кэш и контейнер |
83 | 83 | $this[$offset] = $this->container[$try_language][$offset]; |
84 | 84 | $locale_cache_statistic['fallbacks']++; |
@@ -94,16 +94,16 @@ discard block |
||
94 | 94 | $this->container[$this->active][] = $value; |
95 | 95 | } else { |
96 | 96 | $this->container[$this->active][$offset] = $value; |
97 | - if($this->cache) { |
|
98 | - $this->cache->__set($this->cache_prefix_lang . $offset, $value); |
|
97 | + if ($this->cache) { |
|
98 | + $this->cache->__set($this->cache_prefix_lang.$offset, $value); |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | } |
102 | 102 | public function offsetExists($offset) { |
103 | 103 | // Шорткат если у нас уже есть строка в памяти PHP |
104 | - if(!isset($this->container[$this->active][$offset])) { |
|
104 | + if (!isset($this->container[$this->active][$offset])) { |
|
105 | 105 | // pdump($this->cache_prefix_lang . $offset); |
106 | - if(!$this->cache || !($this->container[$this->active][$offset] = $this->cache->__get($this->cache_prefix_lang . $offset))) { |
|
106 | + if (!$this->cache || !($this->container[$this->active][$offset] = $this->cache->__get($this->cache_prefix_lang.$offset))) { |
|
107 | 107 | // pdump($this->cache_prefix_lang . $offset); |
108 | 108 | // Если нету такой строки - делаем фоллбэк |
109 | 109 | $this->locale_string_fallback($offset); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | } |
120 | 120 | public function offsetGet($offset) { |
121 | 121 | $value = $this->offsetExists($offset) ? $this->container[$this->active][$offset] : null; |
122 | - if($this->enable_stat_usage) { |
|
122 | + if ($this->enable_stat_usage) { |
|
123 | 123 | $this->usage_stat_log($offset, $value); |
124 | 124 | } |
125 | 125 | return $value; |
@@ -134,25 +134,25 @@ discard block |
||
134 | 134 | |
135 | 135 | |
136 | 136 | public function usage_stat_load() { |
137 | - $this->stat_usage = classSupernova::$cache->lng_stat_usage = array(); // TODO for debug |
|
138 | - if(empty($this->stat_usage)) { |
|
137 | + $this->stat_usage = classSupernova::$cache->lng_stat_usage = array(); // TODO for debug |
|
138 | + if (empty($this->stat_usage)) { |
|
139 | 139 | $query = doquery("SELECT * FROM {{lng_usage_stat}}"); |
140 | - while($row = db_fetch($query)) { |
|
141 | - $this->stat_usage[$row['lang_code'] . ':' . $row['string_id'] . ':' . $row['file'] . ':' . $row['line']] = $row['is_empty']; |
|
140 | + while ($row = db_fetch($query)) { |
|
141 | + $this->stat_usage[$row['lang_code'].':'.$row['string_id'].':'.$row['file'].':'.$row['line']] = $row['is_empty']; |
|
142 | 142 | } |
143 | 143 | } |
144 | 144 | } |
145 | 145 | public function usage_stat_save() { |
146 | - if(!empty($this->stat_usage_new)) { |
|
146 | + if (!empty($this->stat_usage_new)) { |
|
147 | 147 | classSupernova::$cache->lng_stat_usage = $this->stat_usage; |
148 | 148 | doquery("SELECT 1 FROM {{lng_usage_stat}} LIMIT 1"); |
149 | - foreach($this->stat_usage_new as &$value) { |
|
150 | - foreach($value as &$value2) { |
|
151 | - $value2 = '"' . db_escape($value2) . '"'; |
|
149 | + foreach ($this->stat_usage_new as &$value) { |
|
150 | + foreach ($value as &$value2) { |
|
151 | + $value2 = '"'.db_escape($value2).'"'; |
|
152 | 152 | } |
153 | - $value = '(' . implode(',', $value) .')'; |
|
153 | + $value = '('.implode(',', $value).')'; |
|
154 | 154 | } |
155 | - doquery("REPLACE INTO {{lng_usage_stat}} (lang_code,string_id,`file`,line,is_empty,locale) VALUES " . implode(',', $this->stat_usage_new)); |
|
155 | + doquery("REPLACE INTO {{lng_usage_stat}} (lang_code,string_id,`file`,line,is_empty,locale) VALUES ".implode(',', $this->stat_usage_new)); |
|
156 | 156 | } |
157 | 157 | } |
158 | 158 | public function usage_stat_log(&$offset, &$value) { |
@@ -162,8 +162,8 @@ discard block |
||
162 | 162 | |
163 | 163 | $file = str_replace('\\', '/', substr($trace[1]['file'], strlen(SN_ROOT_PHYSICAL) - 1)); |
164 | 164 | |
165 | - $string_id = $this->active . ':' . $offset . ':' . $file . ':' . $trace[1]['line']; |
|
166 | - if(!isset($this->stat_usage[$string_id]) || $this->stat_usage[$string_id] != empty($value)) { |
|
165 | + $string_id = $this->active.':'.$offset.':'.$file.':'.$trace[1]['line']; |
|
166 | + if (!isset($this->stat_usage[$string_id]) || $this->stat_usage[$string_id] != empty($value)) { |
|
167 | 167 | $this->stat_usage[$string_id] = empty($value); |
168 | 168 | $this->stat_usage_new[] = array( |
169 | 169 | 'lang_code' => $this->active, |
@@ -171,14 +171,14 @@ discard block |
||
171 | 171 | 'file' => $file, |
172 | 172 | 'line' => $trace[1]['line'], |
173 | 173 | 'is_empty' => intval(empty($value)), |
174 | - 'locale' => '' . $value, |
|
174 | + 'locale' => ''.$value, |
|
175 | 175 | ); |
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
179 | 179 | |
180 | 180 | protected function lng_try_filepath($path, $file_path_relative) { |
181 | - $file_path = SN_ROOT_PHYSICAL . ($path && file_exists(SN_ROOT_PHYSICAL . $path . $file_path_relative) ? $path : '') . $file_path_relative; |
|
181 | + $file_path = SN_ROOT_PHYSICAL.($path && file_exists(SN_ROOT_PHYSICAL.$path.$file_path_relative) ? $path : '').$file_path_relative; |
|
182 | 182 | return file_exists($file_path) ? $file_path : false; |
183 | 183 | } |
184 | 184 | |
@@ -200,14 +200,14 @@ discard block |
||
200 | 200 | |
201 | 201 | classSupernova::log_file("locale.include: Loading data from domain '{$filename}'", 1); |
202 | 202 | |
203 | - $cache_file_key = $this->cache_prefix_lang . '__' . $filename; |
|
203 | + $cache_file_key = $this->cache_prefix_lang.'__'.$filename; |
|
204 | 204 | |
205 | 205 | // Подключен ли внешний кэш? |
206 | - if($this->cache) { |
|
206 | + if ($this->cache) { |
|
207 | 207 | // Загружен ли уже данный файл? |
208 | 208 | $cache_file_status = $this->cache->__get($cache_file_key); |
209 | - classSupernova::log_file("locale.include: Cache - '{$filename}' has key '{$cache_file_key}' and is " . ($cache_file_status ? 'already loaded - EXIT' : 'EMPTY'), $cache_file_status ? -1 : 0); |
|
210 | - if($cache_file_status) { |
|
209 | + classSupernova::log_file("locale.include: Cache - '{$filename}' has key '{$cache_file_key}' and is ".($cache_file_status ? 'already loaded - EXIT' : 'EMPTY'), $cache_file_status ? -1 : 0); |
|
210 | + if ($cache_file_status) { |
|
211 | 211 | // Если да - повторять загрузку нет смысла |
212 | 212 | return null; |
213 | 213 | } |
@@ -221,47 +221,47 @@ discard block |
||
221 | 221 | $this->make_fallback($language); |
222 | 222 | |
223 | 223 | $file_path = ''; |
224 | - foreach($this->fallback as $lang_try) { |
|
225 | - if(!$lang_try /* || isset($language_tried[$lang_try]) */) { |
|
224 | + foreach ($this->fallback as $lang_try) { |
|
225 | + if (!$lang_try /* || isset($language_tried[$lang_try]) */) { |
|
226 | 226 | continue; |
227 | 227 | } |
228 | 228 | |
229 | - if($file_path = $this->lng_try_filepath($path, "language/{$lang_try}/{$filename_ext}")) { |
|
229 | + if ($file_path = $this->lng_try_filepath($path, "language/{$lang_try}/{$filename_ext}")) { |
|
230 | 230 | break; |
231 | 231 | } |
232 | 232 | |
233 | - if($file_path = $this->lng_try_filepath($path, "language/{$filename}_{$lang_try}{$ext}")) { |
|
233 | + if ($file_path = $this->lng_try_filepath($path, "language/{$filename}_{$lang_try}{$ext}")) { |
|
234 | 234 | break; |
235 | 235 | } |
236 | 236 | |
237 | 237 | $file_path = ''; |
238 | 238 | } |
239 | 239 | |
240 | - if($file_path) { |
|
240 | + if ($file_path) { |
|
241 | 241 | $a_lang_array = array(); |
242 | 242 | include($file_path); |
243 | 243 | |
244 | - if(!empty($a_lang_array)) { |
|
244 | + if (!empty($a_lang_array)) { |
|
245 | 245 | $this->merge($a_lang_array); |
246 | 246 | |
247 | 247 | // Загрузка данных из файла в кэш |
248 | - if($this->cache) { |
|
248 | + if ($this->cache) { |
|
249 | 249 | classSupernova::log_file("Locale: loading '{$filename}' into cache"); |
250 | - foreach($a_lang_array as $key => $value) { |
|
251 | - $value_cache_key = $this->cache_prefix_lang . $key; |
|
252 | - if($this->cache->__isset($value_cache_key)) { |
|
253 | - if(is_array($value)) { |
|
250 | + foreach ($a_lang_array as $key => $value) { |
|
251 | + $value_cache_key = $this->cache_prefix_lang.$key; |
|
252 | + if ($this->cache->__isset($value_cache_key)) { |
|
253 | + if (is_array($value)) { |
|
254 | 254 | $alt_value = $this->cache->__get($value_cache_key); |
255 | 255 | $value = array_replace_recursive($alt_value, $value); |
256 | 256 | // pdump($alt_value, $alt_value); |
257 | 257 | } |
258 | 258 | } |
259 | - $this->cache->__set($this->cache_prefix_lang . $key, $value); |
|
259 | + $this->cache->__set($this->cache_prefix_lang.$key, $value); |
|
260 | 260 | } |
261 | 261 | } |
262 | 262 | } |
263 | 263 | |
264 | - if($this->cache) { |
|
264 | + if ($this->cache) { |
|
265 | 265 | $this->cache->__set($cache_file_key, true); |
266 | 266 | } |
267 | 267 | |
@@ -274,14 +274,14 @@ discard block |
||
274 | 274 | } |
275 | 275 | |
276 | 276 | public function lng_load_i18n($i18n) { |
277 | - if(!isset($i18n)) { |
|
277 | + if (!isset($i18n)) { |
|
278 | 278 | return; |
279 | 279 | } |
280 | 280 | |
281 | - foreach($i18n as $i18n_data) { |
|
282 | - if(is_string($i18n_data)) { |
|
281 | + foreach ($i18n as $i18n_data) { |
|
282 | + if (is_string($i18n_data)) { |
|
283 | 283 | $this->lng_include($i18n_data); |
284 | - } elseif(is_array($i18n_data)) { |
|
284 | + } elseif (is_array($i18n_data)) { |
|
285 | 285 | $this->lng_include($i18n_data['file'], $i18n_data['path']); |
286 | 286 | } |
287 | 287 | } |
@@ -299,27 +299,27 @@ discard block |
||
299 | 299 | |
300 | 300 | classSupernova::log_file("locale.switch: Trying to switch language to '{$language_new}'"); |
301 | 301 | |
302 | - if($language_new == $this->active) { |
|
302 | + if ($language_new == $this->active) { |
|
303 | 303 | classSupernova::log_file("locale.switch: New language '{$language_new}' is equal to current language '{$this->active}' - EXIT", -1); |
304 | 304 | return false; |
305 | 305 | } |
306 | 306 | |
307 | 307 | $this->active = $language = $language_new; |
308 | - $this->cache_prefix_lang = $this->cache_prefix . $this->active . '_'; |
|
308 | + $this->cache_prefix_lang = $this->cache_prefix.$this->active.'_'; |
|
309 | 309 | |
310 | 310 | $this['LANG_INFO'] = $this->lng_get_info($this->active); |
311 | 311 | $this->make_fallback($this->active); |
312 | 312 | |
313 | - if($this->cache) { |
|
314 | - $cache_lang_init_status = $this->cache->__get($this->cache_prefix_lang . '__INIT'); |
|
315 | - classSupernova::log_file("locale.switch: Cache for '{$this->active}' prefixed '{$this->cache_prefix_lang}' is " . ($cache_lang_init_status ? 'already loaded. Doing nothing - EXIT' : 'EMPTY'), $cache_lang_init_status ? -1 : 0); |
|
316 | - if($cache_lang_init_status) { |
|
313 | + if ($this->cache) { |
|
314 | + $cache_lang_init_status = $this->cache->__get($this->cache_prefix_lang.'__INIT'); |
|
315 | + classSupernova::log_file("locale.switch: Cache for '{$this->active}' prefixed '{$this->cache_prefix_lang}' is ".($cache_lang_init_status ? 'already loaded. Doing nothing - EXIT' : 'EMPTY'), $cache_lang_init_status ? -1 : 0); |
|
316 | + if ($cache_lang_init_status) { |
|
317 | 317 | return false; |
318 | 318 | } |
319 | 319 | |
320 | 320 | // Чистим текущие локализации из кэша. Достаточно почистить только флаги инициализации языкового кэша и загрузки файлов - они начинаются с '__' |
321 | 321 | classSupernova::log_file("locale.switch: Cache - invalidating data"); |
322 | - $this->cache->unset_by_prefix($this->cache_prefix_lang . '__'); |
|
322 | + $this->cache->unset_by_prefix($this->cache_prefix_lang.'__'); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | $this->lng_include('system'); |
@@ -329,9 +329,9 @@ discard block |
||
329 | 329 | // Loading global language files |
330 | 330 | $this->lng_load_i18n(classSupernova::$sn_mvc['i18n']['']); |
331 | 331 | |
332 | - if($this->cache) { |
|
333 | - classSupernova::log_file("locale.switch: Cache - setting flag " . $this->cache_prefix_lang . '__INIT'); |
|
334 | - $this->cache->__set($this->cache_prefix_lang . '__INIT', true); |
|
332 | + if ($this->cache) { |
|
333 | + classSupernova::log_file("locale.switch: Cache - setting flag ".$this->cache_prefix_lang.'__INIT'); |
|
334 | + $this->cache->__set($this->cache_prefix_lang.'__INIT', true); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | classSupernova::log_file("locale.switch: Complete - EXIT"); |
@@ -341,9 +341,9 @@ discard block |
||
341 | 341 | |
342 | 342 | |
343 | 343 | public function lng_get_info($entry) { |
344 | - $file_name = SN_ROOT_PHYSICAL . 'language/' . $entry . '/language.mo.php'; |
|
344 | + $file_name = SN_ROOT_PHYSICAL.'language/'.$entry.'/language.mo.php'; |
|
345 | 345 | $lang_info = array(); |
346 | - if(file_exists($file_name)) { |
|
346 | + if (file_exists($file_name)) { |
|
347 | 347 | include($file_name); |
348 | 348 | } |
349 | 349 | |
@@ -351,15 +351,15 @@ discard block |
||
351 | 351 | } |
352 | 352 | |
353 | 353 | public function lng_get_list() { |
354 | - if(empty($this->lang_list)) { |
|
354 | + if (empty($this->lang_list)) { |
|
355 | 355 | $this->lang_list = array(); |
356 | 356 | |
357 | - $path = SN_ROOT_PHYSICAL . 'language/'; |
|
357 | + $path = SN_ROOT_PHYSICAL.'language/'; |
|
358 | 358 | $dir = dir($path); |
359 | - while(false !== ($entry = $dir->read())) { |
|
360 | - if(is_dir($path . $entry) && $entry[0] != '.') { |
|
359 | + while (false !== ($entry = $dir->read())) { |
|
360 | + if (is_dir($path.$entry) && $entry[0] != '.') { |
|
361 | 361 | $lang_info = $this->lng_get_info($entry); |
362 | - if($lang_info['LANG_NAME_ISO2'] == $entry) { |
|
362 | + if ($lang_info['LANG_NAME_ISO2'] == $entry) { |
|
363 | 363 | $this->lang_list[$lang_info['LANG_NAME_ISO2']] = $lang_info; |
364 | 364 | } |
365 | 365 | } |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | // TODO - rewrite |
229 | 229 | public function getParamsFromStaticClass($className) { |
230 | 230 | if (is_string($className) && $className && class_exists($className)) { |
231 | - if(method_exists($className, 'getDb')) { |
|
231 | + if (method_exists($className, 'getDb')) { |
|
232 | 232 | $this->setDb($className::getDb()); |
233 | 233 | } |
234 | 234 | $this->from($className::$_table); |
@@ -317,9 +317,9 @@ discard block |
||
317 | 317 | } |
318 | 318 | |
319 | 319 | protected function compileFrom() { |
320 | - $this->_compiledQuery[] = 'FROM `{{' . $this->escapeString($this->table) . '}}`'; |
|
320 | + $this->_compiledQuery[] = 'FROM `{{'.$this->escapeString($this->table).'}}`'; |
|
321 | 321 | if (!empty($this->alias)) { |
322 | - $this->_compiledQuery[] = 'AS `' . $this->escapeString($this->alias) . '`'; |
|
322 | + $this->_compiledQuery[] = 'AS `'.$this->escapeString($this->alias).'`'; |
|
323 | 323 | } |
324 | 324 | } |
325 | 325 | |
@@ -329,29 +329,29 @@ discard block |
||
329 | 329 | |
330 | 330 | protected function compileWhere() { |
331 | 331 | // TODO - fields should be escaped !! |
332 | - !empty($this->where) ? $this->_compiledQuery[] = 'WHERE ' . implode(' AND ', $this->where) : false; |
|
332 | + !empty($this->where) ? $this->_compiledQuery[] = 'WHERE '.implode(' AND ', $this->where) : false; |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | protected function compileGroupBy() { |
336 | 336 | // TODO - fields should be escaped !! |
337 | 337 | // !empty($this->groupBy) ? $this->_compiledQuery[] = 'GROUP BY ' . implode(',', $this->arrayEscape($this->groupBy)) : false; |
338 | - !empty($this->groupBy) ? $this->_compiledQuery[] = 'GROUP BY ' . $this->selectFieldsToString($this->groupBy) : false; |
|
338 | + !empty($this->groupBy) ? $this->_compiledQuery[] = 'GROUP BY '.$this->selectFieldsToString($this->groupBy) : false; |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | protected function compileOrderBy() { |
342 | 342 | // TODO - fields should be escaped !! |
343 | - !empty($this->orderBy) ? $this->_compiledQuery[] = 'ORDER BY ' . implode(',', $this->arrayEscape($this->orderBy)) : false; |
|
343 | + !empty($this->orderBy) ? $this->_compiledQuery[] = 'ORDER BY '.implode(',', $this->arrayEscape($this->orderBy)) : false; |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | protected function compileHaving() { |
347 | 347 | // TODO - fields should be escaped !! |
348 | - !empty($this->having) ? $this->_compiledQuery[] = 'HAVING ' . implode(' AND ', $this->having) : false; |
|
348 | + !empty($this->having) ? $this->_compiledQuery[] = 'HAVING '.implode(' AND ', $this->having) : false; |
|
349 | 349 | } |
350 | 350 | |
351 | 351 | protected function compileLimit() { |
352 | 352 | // TODO - fields should be escaped !! |
353 | 353 | if ($limit = $this->fetchOne ? 1 : $this->limit) { |
354 | - $this->_compiledQuery[] = 'LIMIT ' . $limit . (!empty($this->offset) ? ' OFFSET ' . $this->offset : ''); |
|
354 | + $this->_compiledQuery[] = 'LIMIT '.$limit.(!empty($this->offset) ? ' OFFSET '.$this->offset : ''); |
|
355 | 355 | } |
356 | 356 | } |
357 | 357 | |
@@ -395,14 +395,14 @@ discard block |
||
395 | 395 | */ |
396 | 396 | protected function processField($fieldName) { |
397 | 397 | if (is_bool($fieldName)) { |
398 | - $result = (string)intval($fieldName); |
|
398 | + $result = (string) intval($fieldName); |
|
399 | 399 | } elseif (is_numeric($fieldName)) { |
400 | 400 | $result = $fieldName; |
401 | 401 | } elseif (is_null($fieldName)) { |
402 | 402 | $result = 'NULL'; |
403 | 403 | } else { |
404 | 404 | // Field has other type - string or should be convertible to string |
405 | - $result = (string)$fieldName; |
|
405 | + $result = (string) $fieldName; |
|
406 | 406 | if (!$fieldName instanceof DbSqlLiteral) { |
407 | 407 | $result = $this->quoteField($fieldName); |
408 | 408 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | ->where('`user_as_ally` IS NULL') |
24 | 24 | ->orderBy(array('`id` DESC')); |
25 | 25 | |
26 | - return (string)$query->selectValue(); |
|
26 | + return (string) $query->selectValue(); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -48,15 +48,15 @@ discard block |
||
48 | 48 | static::buildDBQ() |
49 | 49 | ->field('id') |
50 | 50 | ->where("`user_as_ally` IS NULL") |
51 | - ->where("`user_bot` = " . USER_BOT_PLAYER) |
|
51 | + ->where("`user_bot` = ".USER_BOT_PLAYER) |
|
52 | 52 | ->setForUpdate(); |
53 | 53 | |
54 | 54 | return $query->selectIterator(); |
55 | 55 | } |
56 | 56 | |
57 | 57 | public static function db_user_lock_with_target_owner_and_acs($user, $planet = array()) { |
58 | - $query = "SELECT 1 FROM `{{users}}` WHERE `id` = " . idval($user['id']) . |
|
59 | - (!empty($planet['id_owner']) ? ' OR `id` = ' . idval($planet['id_owner']) : '') |
|
58 | + $query = "SELECT 1 FROM `{{users}}` WHERE `id` = ".idval($user['id']). |
|
59 | + (!empty($planet['id_owner']) ? ' OR `id` = '.idval($planet['id_owner']) : '') |
|
60 | 60 | . " FOR UPDATE"; |
61 | 61 | |
62 | 62 | static::getDb()->doquery($query); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public static function db_user_count($online = false) { |
71 | 71 | return intval(static::getDb()->doQueryFetchValue( |
72 | - 'SELECT COUNT(`id`) AS `user_count` FROM `{{users}}` WHERE `user_as_ally` IS NULL' . ($online ? ' AND `onlinetime` > ' . (SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : '') |
|
72 | + 'SELECT COUNT(`id`) AS `user_count` FROM `{{users}}` WHERE `user_as_ally` IS NULL'.($online ? ' AND `onlinetime` > '.(SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : '') |
|
73 | 73 | )); |
74 | 74 | } |
75 | 75 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | ->fieldCount('r.id', 'referral_count') |
92 | 92 | ->fieldSingleFunction('sum', 'r.dark_matter', 'referral_dm') |
93 | 93 | ->join('LEFT JOIN {{referrals}} as r on r.id_partner = u.id') |
94 | - ->where($online ? "`onlinetime` >= " . intval(SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : 'user_as_ally IS NULL') |
|
94 | + ->where($online ? "`onlinetime` >= ".intval(SN_TIME_NOW - classSupernova::$config->game_users_online_timeout) : 'user_as_ally IS NULL') |
|
95 | 95 | ->groupBy('u.id') |
96 | 96 | ->orderBy("user_as_ally, {$sort} ASC"); |
97 | 97 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | ->where('(`user_birthday_celebrated` IS NULL OR DATE_ADD(`user_birthday_celebrated`, INTERVAL 1 YEAR) < CURRENT_DATE)') |
110 | 110 | ->where('`user_as_ally` IS NULL') |
111 | 111 | ->having('`days_after_birthday` >= 0') |
112 | - ->having('`days_after_birthday` < ' . intval($config_user_birthday_range)) |
|
112 | + ->having('`days_after_birthday` < '.intval($config_user_birthday_range)) |
|
113 | 113 | ->setForUpdate(); |
114 | 114 | |
115 | 115 | $result = $query->selectIterator(); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | } |
192 | 192 | |
193 | 193 | public static function db_user_list_set_mass_mail(&$owners_list, $set) { |
194 | - return classSupernova::db_upd_record_list(LOC_USER, !empty($owners_list) ? '`id` IN (' . implode(',', $owners_list) . ');' : '', $set); |
|
194 | + return classSupernova::db_upd_record_list(LOC_USER, !empty($owners_list) ? '`id` IN ('.implode(',', $owners_list).');' : '', $set); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | public static function db_user_list_set_by_ally_and_rank($ally_id, $ally_rank_id, $set) { |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | $stmt = |
85 | 85 | static::buildDBQ() |
86 | 86 | ->fields($fieldList) |
87 | - ->where(static::$_idField . '=' . $recordId); |
|
87 | + ->where(static::$_idField.'='.$recordId); |
|
88 | 88 | |
89 | 89 | if ($forUpdate) { |
90 | 90 | $stmt->setForUpdate(); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $query = |
106 | 106 | static::buildDBQ() |
107 | 107 | ->fields(static::$_idField) |
108 | - ->where(array("`" . static::$_idField . "` IN (" . implode(',', $idList) . ")")) |
|
108 | + ->where(array("`".static::$_idField."` IN (".implode(',', $idList).")")) |
|
109 | 109 | ->selectIterator(); |
110 | 110 | } else { |
111 | 111 | $query = new DbEmptyIterator(); |