@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if(!defined('IN_UPDATE') || IN_UPDATE !== true) { |
|
3 | +if (!defined('IN_UPDATE') || IN_UPDATE !== true) { |
|
4 | 4 | die('Hack attempt'); |
5 | 5 | } |
6 | 6 | |
7 | -switch($new_version) { |
|
7 | +switch ($new_version) { |
|
8 | 8 | case 0: |
9 | 9 | case 1: |
10 | 10 | case 2: |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | ); |
33 | 33 | upd_drop_table('lunas'); |
34 | 34 | |
35 | - if($update_tables['galaxy']) { |
|
35 | + if ($update_tables['galaxy']) { |
|
36 | 36 | upd_do_query( |
37 | 37 | 'UPDATE `{{planets}}` |
38 | 38 | LEFT JOIN `{{galaxy}}` ON {{galaxy}}.id_planet = {{planets}}.id |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | ); |
83 | 83 | upd_add_more_time(); |
84 | 84 | |
85 | - if($update_tables['users']['rpg_points']) { |
|
85 | + if ($update_tables['users']['rpg_points']) { |
|
86 | 86 | upd_do_query( |
87 | 87 | "UPDATE {{users}} AS u |
88 | 88 | RIGHT JOIN {{referrals}} AS r |
@@ -175,18 +175,18 @@ discard block |
||
175 | 175 | upd_alter_table('planets', "ADD `governor_level` smallint unsigned NOT NULL DEFAULT '0' COMMENT 'Governor level'", !$update_tables['planets']['governor_level']); |
176 | 176 | upd_alter_table('planets', "ADD `que` varchar(4096) NOT NULL DEFAULT '' COMMENT 'Planet que'", !$update_tables['planets']['que']); |
177 | 177 | |
178 | - if($update_tables['planets']['b_building']) { |
|
178 | + if ($update_tables['planets']['b_building']) { |
|
179 | 179 | $planet_query = upd_do_query('SELECT * FROM {{planets}} WHERE `b_building` <> 0;'); |
180 | 180 | $const_que_structures = QUE_STRUCTURES; |
181 | - while($planet_data = db_fetch($planet_query)) { |
|
181 | + while ($planet_data = db_fetch($planet_query)) { |
|
182 | 182 | $old_que = explode(';', $planet_data['b_building_id']); |
183 | - foreach($old_que as $old_que_item_string) { |
|
184 | - if(!$old_que_item_string) { |
|
183 | + foreach ($old_que as $old_que_item_string) { |
|
184 | + if (!$old_que_item_string) { |
|
185 | 185 | continue; |
186 | 186 | } |
187 | 187 | |
188 | 188 | $old_que_item = explode(',', $old_que_item_string); |
189 | - if($old_que_item[4] == 'build') { |
|
189 | + if ($old_que_item[4] == 'build') { |
|
190 | 190 | $old_que_item[4] = BUILD_CREATE; |
191 | 191 | } else { |
192 | 192 | $old_que_item[4] = BUILD_DESTROY; |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;" |
220 | 220 | ); |
221 | 221 | |
222 | - if($update_tables['users']['urlaubs_until']) { |
|
222 | + if ($update_tables['users']['urlaubs_until']) { |
|
223 | 223 | upd_alter_table('users', "ADD `vacation` int(11) NOT NULL DEFAULT '0' COMMENT 'Time when user can leave vacation mode'", !$update_tables['users']['vacation']); |
224 | 224 | upd_do_query('UPDATE {{users}} SET `vacation` = `urlaubs_until` WHERE `urlaubs_modus` <> 0;'); |
225 | 225 | upd_alter_table('users', 'DROP COLUMN `urlaubs_until`, DROP COLUMN `urlaubs_modus`, DROP COLUMN `urlaubs_modus_time`', $update_tables['users']['urlaubs_until']); |
@@ -269,9 +269,9 @@ discard block |
||
269 | 269 | ), !$update_tables['logs']['log_timestamp']); |
270 | 270 | upd_do_query('DELETE FROM `{{logs}}` WHERE `log_code` = 303;'); |
271 | 271 | |
272 | - if($update_tables['errors']) { |
|
272 | + if ($update_tables['errors']) { |
|
273 | 273 | upd_do_query('INSERT INTO `{{logs}}` (`log_code`, `log_sender`, `log_title`, `log_text`, `log_page`, `log_time`) SELECT 500, `error_sender`, `error_type`, `error_text`, `error_page`, `error_time` FROM `{{errors}}`;'); |
274 | - if($update_tables['errors_backup']) { |
|
274 | + if ($update_tables['errors_backup']) { |
|
275 | 275 | upd_drop_table('errors_backup'); |
276 | 276 | } |
277 | 277 | upd_alter_table('errors', ' RENAME TO ' . classSupernova::$config->db_prefix . 'errors_backup'); |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | |
333 | 333 | upd_alter_table('users', 'CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci'); |
334 | 334 | |
335 | - if(!$update_tables['shortcut']) { |
|
335 | + if (!$update_tables['shortcut']) { |
|
336 | 336 | upd_create_table('shortcut', |
337 | 337 | "( |
338 | 338 | `shortcut_id` SERIAL, |
@@ -356,10 +356,10 @@ discard block |
||
356 | 356 | $temp_planet_types = array(PT_PLANET, PT_DEBRIS, PT_MOON); |
357 | 357 | |
358 | 358 | $query = upd_do_query("SELECT id, fleet_shortcut FROM {{users}} WHERE fleet_shortcut > '';"); |
359 | - while($user_data = db_fetch($query)) { |
|
359 | + while ($user_data = db_fetch($query)) { |
|
360 | 360 | $shortcuts = explode("\r\n", $user_data['fleet_shortcut']); |
361 | - foreach($shortcuts as $shortcut) { |
|
362 | - if(!$shortcut) { |
|
361 | + foreach ($shortcuts as $shortcut) { |
|
362 | + if (!$shortcut) { |
|
363 | 363 | continue; |
364 | 364 | } |
365 | 365 | |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | $shortcut[3] = intval($shortcut[3]); |
371 | 371 | $shortcut[4] = intval($shortcut[4]); |
372 | 372 | |
373 | - if($shortcut[0] && $shortcut[1] && $shortcut[2] && $shortcut[3] && in_array($shortcut[4], $temp_planet_types)) { |
|
373 | + if ($shortcut[0] && $shortcut[1] && $shortcut[2] && $shortcut[3] && in_array($shortcut[4], $temp_planet_types)) { |
|
374 | 374 | upd_do_query("INSERT INTO {classSupernova::$config->db_prefix}shortcut (shortcut_user_id, shortcut_galaxy, shortcut_system, shortcut_planet, shortcut_planet_type, shortcut_text) VALUES ({$user_data['id']}, {$shortcut[1]}, {$shortcut[2]}, {$shortcut[3]}, {$shortcut[4]}, '{$shortcut[0]}');", true); |
375 | 375 | } |
376 | 376 | } |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | |
523 | 523 | upd_check_key('quest_total', 0, !isset(classSupernova::$config->quest_total)); |
524 | 524 | |
525 | - for($i = 0; $i < 25; $i++) { |
|
525 | + for ($i = 0; $i < 25; $i++) { |
|
526 | 526 | upd_alter_table('alliance', array("DROP INDEX `id_{$i}`",), $update_indexes['alliance']["id_{$i}"]); |
527 | 527 | upd_alter_table('users', array("DROP INDEX `id_{$i}`",), $update_indexes['users']["id_{$i}"]); |
528 | 528 | upd_alter_table('planets', array("DROP INDEX `id_{$i}`",), $update_indexes['planets']["id_{$i}"]); |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | "ADD `msg_admin` bigint(11) unsigned DEFAULT '0' AFTER mnl_buildlist" |
551 | 551 | ), !$update_tables['users']['msg_admin']); |
552 | 552 | |
553 | - if(!$update_foreigns['users']['FK_users_ally_id']) { |
|
553 | + if (!$update_foreigns['users']['FK_users_ally_id']) { |
|
554 | 554 | upd_alter_table('users', array( |
555 | 555 | 'MODIFY COLUMN `ally_name` VARCHAR(32) DEFAULT NULL', |
556 | 556 | 'MODIFY COLUMN `ally_id` BIGINT(20) UNSIGNED DEFAULT NULL', |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | ), strtoupper($update_tables['planets']['debris_metal']['Type']) != 'BIGINT(20) UNSIGNED'); |
573 | 573 | |
574 | 574 | $illegal_moon_query = upd_do_query("SELECT id FROM `{{planets}}` WHERE `id_owner` <> 0 AND `planet_type` = 3 AND `parent_planet` <> 0 AND `parent_planet` NOT IN (SELECT `id` FROM {{planets}} WHERE `planet_type` = 1);"); |
575 | - while($illegal_moon_row = db_fetch($illegal_moon_query)) { |
|
575 | + while ($illegal_moon_row = db_fetch($illegal_moon_query)) { |
|
576 | 576 | upd_do_query("DELETE FROM {{planets}} WHERE id = {$illegal_moon_row['id']} LIMIT 1;", true); |
577 | 577 | } |
578 | 578 | |
@@ -609,16 +609,16 @@ discard block |
||
609 | 609 | upd_do_query('COMMIT;', true); |
610 | 610 | |
611 | 611 | $records = 1; |
612 | - while($records) { |
|
612 | + while ($records) { |
|
613 | 613 | upd_do_query('START TRANSACTION;', true); |
614 | 614 | $query = upd_do_query("SELECT * FROM {{LOGS}} WHERE log_code = 102 ORDER BY log_id LIMIT 1000;"); |
615 | 615 | $records = db_num_rows($query); |
616 | - while($row = db_fetch($query)) { |
|
616 | + while ($row = db_fetch($query)) { |
|
617 | 617 | $result = preg_match('/^Player ID (\d+) Dark Matter was adjusted with (\-?\d+). Reason: (.+)$/', $row['log_text'], $matches); |
618 | 618 | |
619 | 619 | $reason = RPG_NONE; |
620 | 620 | $comment = $matches[3]; |
621 | - switch($matches[3]) { |
|
621 | + switch ($matches[3]) { |
|
622 | 622 | case 'Level Up For Structure Building': |
623 | 623 | $reason = RPG_STRUCTURE; |
624 | 624 | break; |
@@ -634,22 +634,22 @@ discard block |
||
634 | 634 | break; |
635 | 635 | |
636 | 636 | default: |
637 | - if(preg_match('/^Using Black Market page (\d+)$/', $comment, $matches2)) { |
|
637 | + if (preg_match('/^Using Black Market page (\d+)$/', $comment, $matches2)) { |
|
638 | 638 | $reason = RPG_MARKET; |
639 | - } elseif(preg_match('/^Spent for officer (.+) ID (\d+)$/', $comment, $matches2)) { |
|
639 | + } elseif (preg_match('/^Spent for officer (.+) ID (\d+)$/', $comment, $matches2)) { |
|
640 | 640 | $reason = RPG_MERCENARY; |
641 | 641 | $comment = "Spent for mercenary {$matches2[1]} GUID {$matches2[2]}"; |
642 | - } elseif(preg_match('/^Incoming From Referral ID\ ?(\d+)$/', $comment, $matches2)) { |
|
642 | + } elseif (preg_match('/^Incoming From Referral ID\ ?(\d+)$/', $comment, $matches2)) { |
|
643 | 643 | $reason = RPG_REFERRAL; |
644 | 644 | $comment = "Incoming from referral ID {$matches[1]}"; |
645 | - } elseif(preg_match('/^Through admin interface for user .* ID \d+ (.*)$/', $comment, $matches2)) { |
|
645 | + } elseif (preg_match('/^Through admin interface for user .* ID \d+ (.*)$/', $comment, $matches2)) { |
|
646 | 646 | $reason = RPG_ADMIN; |
647 | 647 | $comment = $matches2[1]; |
648 | 648 | } |
649 | 649 | break; |
650 | 650 | } |
651 | 651 | |
652 | - if($matches[2]) { |
|
652 | + if ($matches[2]) { |
|
653 | 653 | $row['log_username'] = db_escape($row['log_username']); |
654 | 654 | $row['log_page'] = db_escape($row['log_page']); |
655 | 655 | $comment = db_escape($comment); |
@@ -668,12 +668,12 @@ discard block |
||
668 | 668 | upd_do_query('COMMIT;', true); |
669 | 669 | } |
670 | 670 | |
671 | - foreach($update_tables as $table_name => $cork) { |
|
671 | + foreach ($update_tables as $table_name => $cork) { |
|
672 | 672 | $row = db_fetch(upd_do_query("SELECT * FROM information_schema.TABLES WHERE TABLE_SCHEMA = '" . db_escape(classSupernova::$db_name) . "' AND TABLE_NAME = '" . classSupernova::$config->db_prefix . "{$table_name}';", true)); |
673 | - if($row['ENGINE'] != 'InnoDB') { |
|
673 | + if ($row['ENGINE'] != 'InnoDB') { |
|
674 | 674 | upd_alter_table($table_name, 'ENGINE=InnoDB', true); |
675 | 675 | } |
676 | - if($row['TABLE_COLLATION'] != 'utf8_general_ci') { |
|
676 | + if ($row['TABLE_COLLATION'] != 'utf8_general_ci') { |
|
677 | 677 | upd_alter_table($table_name, 'CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci', true); |
678 | 678 | } |
679 | 679 | } |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | "CHANGE COLUMN `governor_level` `PLANET_GOVERNOR_LEVEL` SMALLINT(5) NOT NULL DEFAULT 0", |
694 | 694 | ), !$update_tables['planets']['PLANET_GOVERNOR_ID']); |
695 | 695 | |
696 | - if($update_tables['users']['rpg_geologue']) { |
|
696 | + if ($update_tables['users']['rpg_geologue']) { |
|
697 | 697 | doquery("UPDATE {{users}} SET `dark_matter` = `dark_matter` + (`rpg_geologue` + `rpg_ingenieur` + `rpg_constructeur` + `rpg_technocrate` + `rpg_scientifique` + `rpg_defenseur`) * 3;"); |
698 | 698 | |
699 | 699 | upd_alter_table('users', array( |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | ), $update_tables['users']['rpg_geologue']); |
707 | 707 | } |
708 | 708 | |
709 | - if($update_tables['users']['rpg_bunker']) { |
|
709 | + if ($update_tables['users']['rpg_bunker']) { |
|
710 | 710 | doquery("UPDATE {{users}} SET `dark_matter` = `dark_matter` + (`rpg_bunker`) * 3;"); |
711 | 711 | |
712 | 712 | upd_alter_table('users', array( |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | ), !isset($update_tables['alliance']['total_rank'])); |
757 | 757 | doquery("UPDATE {{alliance}} AS a JOIN {{statpoints}} AS sp ON sp.id_owner = a.id AND sp.stat_code = 1 AND sp.stat_type = 2 SET a.total_rank = sp.total_rank, a.total_points = sp.total_points;"); |
758 | 758 | |
759 | - if(!isset($update_tables['users']['ally_tag'])) { |
|
759 | + if (!isset($update_tables['users']['ally_tag'])) { |
|
760 | 760 | upd_alter_table('users', array( |
761 | 761 | "ADD COLUMN `ally_tag` varchar(8) DEFAULT NULL AFTER `ally_id`", |
762 | 762 | ), !isset($update_tables['users']['ally_tag'])); |
@@ -771,7 +771,7 @@ discard block |
||
771 | 771 | "ADD COLUMN `player_artifact_list` TEXT", |
772 | 772 | ), !isset($update_tables['users']['player_artifact_list'])); |
773 | 773 | |
774 | - if(!isset($update_tables['users']['player_rpg_tech_xp'])) { |
|
774 | + if (!isset($update_tables['users']['player_rpg_tech_xp'])) { |
|
775 | 775 | upd_check_key('eco_scale_storage', 1, !isset(classSupernova::$config->eco_scale_storage)); |
776 | 776 | |
777 | 777 | upd_alter_table('users', array( |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | "MODIFY COLUMN `ally_owner` BIGINT(20) UNSIGNED DEFAULT NULL", |
802 | 802 | ), strtoupper($update_tables['alliance']['ally_owner']['Type']) != 'BIGINT(20) UNSIGNED'); |
803 | 803 | |
804 | - if(strtoupper($update_tables['alliance_diplomacy']['alliance_diplomacy_ally_id']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
804 | + if (strtoupper($update_tables['alliance_diplomacy']['alliance_diplomacy_ally_id']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
805 | 805 | upd_alter_table('alliance_diplomacy', array( |
806 | 806 | "DROP FOREIGN KEY `FK_diplomacy_ally_id`", |
807 | 807 | "DROP FOREIGN KEY `FK_diplomacy_contr_ally_id`" |
@@ -816,7 +816,7 @@ discard block |
||
816 | 816 | ), true); |
817 | 817 | } |
818 | 818 | |
819 | - if(strtoupper($update_tables['alliance_negotiation']['alliance_negotiation_ally_id']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
819 | + if (strtoupper($update_tables['alliance_negotiation']['alliance_negotiation_ally_id']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
820 | 820 | upd_alter_table('alliance_negotiation', array( |
821 | 821 | "DROP FOREIGN KEY `FK_negotiation_ally_id`", |
822 | 822 | "DROP FOREIGN KEY `FK_negotiation_contr_ally_id`" |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | ), true); |
833 | 833 | } |
834 | 834 | |
835 | - if(strtoupper($update_tables['alliance_requests']['id_user']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
835 | + if (strtoupper($update_tables['alliance_requests']['id_user']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
836 | 836 | upd_do_query('DELETE FROM {{alliance_requests}} WHERE id_user NOT IN (SELECT id FROM {{users}}) OR id_ally NOT IN (SELECT id FROM {{alliance}});', true); |
837 | 837 | |
838 | 838 | upd_alter_table('alliance_requests', array( |
@@ -846,7 +846,7 @@ discard block |
||
846 | 846 | ), true); |
847 | 847 | } |
848 | 848 | |
849 | - if(strtoupper($update_tables['annonce']['id']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
849 | + if (strtoupper($update_tables['annonce']['id']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
850 | 850 | upd_do_query('DELETE FROM {{annonce}} WHERE USER NOT IN (SELECT username FROM {{users}});', true); |
851 | 851 | |
852 | 852 | upd_alter_table('annonce', array( |
@@ -859,7 +859,7 @@ discard block |
||
859 | 859 | ), true); |
860 | 860 | } |
861 | 861 | |
862 | - if(strtoupper($update_tables['bashing']['bashing_user_id']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
862 | + if (strtoupper($update_tables['bashing']['bashing_user_id']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
863 | 863 | upd_alter_table('bashing', array( |
864 | 864 | "DROP FOREIGN KEY `FK_bashing_user_id`", |
865 | 865 | "DROP FOREIGN KEY `FK_bashing_planet_id`", |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | ), true); |
875 | 875 | } |
876 | 876 | |
877 | - if(strtoupper($update_tables['buddy']['id']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
877 | + if (strtoupper($update_tables['buddy']['id']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
878 | 878 | upd_do_query('DELETE FROM {{buddy}} WHERE sender NOT IN (SELECT id FROM {{users}}) OR OWNER NOT IN (SELECT id FROM {{users}});', true); |
879 | 879 | |
880 | 880 | upd_alter_table('buddy', array( |
@@ -912,7 +912,7 @@ discard block |
||
912 | 912 | "MODIFY COLUMN `fleet_resource_deuterium` DECIMAL(65,0) DEFAULT '0'", |
913 | 913 | ), strtoupper($update_tables['fleets']['fleet_resource_metal']['Type']) != 'DECIMAL(65,0)'); |
914 | 914 | |
915 | - if(strtoupper($update_tables['iraks']['fleet_owner']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
915 | + if (strtoupper($update_tables['iraks']['fleet_owner']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
916 | 916 | upd_do_query('DELETE FROM {{iraks}} WHERE OWNER NOT IN (SELECT id FROM {{users}}) OR zielid NOT IN (SELECT id FROM {{users}});', true); |
917 | 917 | |
918 | 918 | upd_alter_table('iraks', array( |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | ), true); |
937 | 937 | } |
938 | 938 | |
939 | - if(strtoupper($update_tables['notes']['owner']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
939 | + if (strtoupper($update_tables['notes']['owner']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
940 | 940 | upd_do_query('DELETE FROM {{notes}} WHERE OWNER NOT IN (SELECT id FROM {{users}});', true); |
941 | 941 | |
942 | 942 | upd_alter_table('notes', array( |
@@ -1061,7 +1061,7 @@ discard block |
||
1061 | 1061 | "DROP COLUMN `b_hangar_plus`", |
1062 | 1062 | ), isset($update_tables['planets']['b_hangar_plus'])); |
1063 | 1063 | |
1064 | - if(strtoupper($update_tables['referrals']['id_partner']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
1064 | + if (strtoupper($update_tables['referrals']['id_partner']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
1065 | 1065 | upd_do_query('DELETE FROM {{referrals}} WHERE id NOT IN (SELECT id FROM {{users}}) OR id_partner NOT IN (SELECT id FROM {{users}});', true); |
1066 | 1066 | |
1067 | 1067 | upd_alter_table('referrals', array( |
@@ -1080,7 +1080,7 @@ discard block |
||
1080 | 1080 | "MODIFY COLUMN `id_owner2` BIGINT(20) UNSIGNED", |
1081 | 1081 | ), strtoupper($update_tables['rw']['id_owner1']['Type']) != 'BIGINT(20) UNSIGNED'); |
1082 | 1082 | |
1083 | - if(strtoupper($update_tables['shortcut']['shortcut_user_id']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
1083 | + if (strtoupper($update_tables['shortcut']['shortcut_user_id']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
1084 | 1084 | upd_do_query('DELETE FROM {{shortcut}} WHERE shortcut_user_id NOT IN (SELECT id FROM {{users}}) OR shortcut_planet_id NOT IN (SELECT id FROM {{planets}});', true); |
1085 | 1085 | |
1086 | 1086 | upd_alter_table('shortcut', array( |
@@ -1095,7 +1095,7 @@ discard block |
||
1095 | 1095 | ), true); |
1096 | 1096 | } |
1097 | 1097 | |
1098 | - if(strtoupper($update_tables['statpoints']['id_owner']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
1098 | + if (strtoupper($update_tables['statpoints']['id_owner']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
1099 | 1099 | upd_do_query('DELETE FROM {{statpoints}} WHERE id_owner NOT IN (SELECT id FROM {{users}}) OR id_ally NOT IN (SELECT id FROM {{alliance}});', true); |
1100 | 1100 | |
1101 | 1101 | upd_alter_table('statpoints', array( |
@@ -1249,7 +1249,7 @@ discard block |
||
1249 | 1249 | "DROP COLUMN `settings_allylogo`", |
1250 | 1250 | ), isset($update_tables['users']['settings_allylogo'])); |
1251 | 1251 | |
1252 | - if(!isset($update_tables['powerup'])) { |
|
1252 | + if (!isset($update_tables['powerup'])) { |
|
1253 | 1253 | upd_do_query("DROP TABLE IF EXISTS {{mercenaries}};"); |
1254 | 1254 | |
1255 | 1255 | upd_create_table('powerup', |
@@ -1279,24 +1279,24 @@ discard block |
||
1279 | 1279 | |
1280 | 1280 | $update_query_template = "UPDATE {{users}} SET id = id %s WHERE id = %d LIMIT 1;"; |
1281 | 1281 | $user_list = upd_do_query("SELECT * FROM {{users}};"); |
1282 | - while($user_row = db_fetch($user_list)) { |
|
1282 | + while ($user_row = db_fetch($user_list)) { |
|
1283 | 1283 | $update_query_str = ''; |
1284 | - foreach(sn_get_groups('mercenaries') as $mercenary_id) { |
|
1284 | + foreach (sn_get_groups('mercenaries') as $mercenary_id) { |
|
1285 | 1285 | $mercenary_data_name = get_unit_param($mercenary_id, P_NAME); |
1286 | - if($mercenary_level = $user_row[$mercenary_data_name]) { |
|
1286 | + if ($mercenary_level = $user_row[$mercenary_data_name]) { |
|
1287 | 1287 | $update_query_str = ", `{$mercenary_data_name}` = 0"; |
1288 | 1288 | upd_do_query("DELETE FROM {{powerup}} WHERE powerup_user_id = {$user_row['id']} AND powerup_unit_id = {$mercenary_id} LIMIT 1;"); |
1289 | 1289 | upd_do_query("INSERT {{powerup}} SET powerup_user_id = {$user_row['id']}, powerup_unit_id = {$mercenary_id}, powerup_unit_level = {$mercenary_level};"); |
1290 | 1290 | } |
1291 | 1291 | } |
1292 | 1292 | |
1293 | - if($update_query_str) { |
|
1293 | + if ($update_query_str) { |
|
1294 | 1294 | upd_do_query(sprintf($update_query_template, $update_query_str, $user_row['id'])); |
1295 | 1295 | } |
1296 | 1296 | } |
1297 | 1297 | } |
1298 | 1298 | |
1299 | - if(!isset($update_tables['universe'])) { |
|
1299 | + if (!isset($update_tables['universe'])) { |
|
1300 | 1300 | upd_create_table('universe', |
1301 | 1301 | "( |
1302 | 1302 | `universe_galaxy` SMALLINT UNSIGNED NOT NULL DEFAULT '0', |
@@ -1319,7 +1319,7 @@ discard block |
||
1319 | 1319 | |
1320 | 1320 | // ------------------------------------------------------------------------ |
1321 | 1321 | // Modifying tables |
1322 | - if(strtoupper($update_tables['users']['user_as_ally']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
1322 | + if (strtoupper($update_tables['users']['user_as_ally']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
1323 | 1323 | upd_alter_table('users', array( |
1324 | 1324 | "ADD COLUMN user_as_ally BIGINT(20) UNSIGNED DEFAULT NULL", |
1325 | 1325 | |
@@ -1340,7 +1340,7 @@ discard block |
||
1340 | 1340 | // ------------------------------------------------------------------------ |
1341 | 1341 | // Creating players for allies |
1342 | 1342 | $ally_row_list = doquery("SELECT `id`, `ally_tag` FROM {{alliance}} WHERE ally_user_id IS NULL;"); |
1343 | - while($ally_row = db_fetch($ally_row_list)) { |
|
1343 | + while ($ally_row = db_fetch($ally_row_list)) { |
|
1344 | 1344 | $ally_user_name = db_escape("[{$ally_row['ally_tag']}]"); |
1345 | 1345 | doquery("INSERT INTO {{users}} SET `username` = '{$ally_user_name}', `register_time` = " . SN_TIME_NOW . ", `user_as_ally` = {$ally_row['id']};"); |
1346 | 1346 | $ally_user_id = db_insert_id(); |
@@ -1354,7 +1354,7 @@ discard block |
||
1354 | 1354 | // ------------------------------------------------------------------------ |
1355 | 1355 | // Creating planets for allies |
1356 | 1356 | $ally_user_list = doquery("SELECT `id`, `username` FROM {{users}} WHERE `user_as_ally` IS NOT NULL AND `id_planet` = 0;"); |
1357 | - while($ally_user_row = db_fetch($ally_user_list)) { |
|
1357 | + while ($ally_user_row = db_fetch($ally_user_list)) { |
|
1358 | 1358 | $ally_planet_name = db_escape($ally_user_row['username']); |
1359 | 1359 | doquery("INSERT INTO {{planets}} SET `name` = '{$ally_planet_name}', `last_update` = " . SN_TIME_NOW . ", `id_owner` = {$ally_user_row['id']};"); |
1360 | 1360 | $ally_planet_id = db_insert_id(); |
@@ -1385,9 +1385,9 @@ discard block |
||
1385 | 1385 | // Adding db field |
1386 | 1386 | upd_alter_table('users', "ADD `que` varchar(4096) NOT NULL DEFAULT '' COMMENT 'User que'", !$update_tables['users']['que']); |
1387 | 1387 | // Converting old data to new one and dropping old fields |
1388 | - if($update_tables['users']['b_tech_planet']) { |
|
1388 | + if ($update_tables['users']['b_tech_planet']) { |
|
1389 | 1389 | $query = doquery("SELECT * FROM {{planets}} WHERE `b_tech_id` <> 0;"); |
1390 | - while($planet_row = db_fetch($query)) { |
|
1390 | + while ($planet_row = db_fetch($query)) { |
|
1391 | 1391 | $que_item_string = "{$planet_row['b_tech_id']},1," . max(0, $planet_row['b_tech'] - SN_TIME_NOW) . "," . BUILD_CREATE . "," . QUE_RESEARCH; |
1392 | 1392 | doquery("UPDATE {{users}} SET `que` = '{$que_item_string}' WHERE `id` = {$planet_row['id_owner']} LIMIT 1;"); |
1393 | 1393 | } |
@@ -1400,7 +1400,7 @@ discard block |
||
1400 | 1400 | upd_alter_table('users', "DROP COLUMN `b_tech_planet`", $update_tables['users']['b_tech_planet']); |
1401 | 1401 | } |
1402 | 1402 | |
1403 | - if(!$update_tables['powerup']['powerup_category']) { |
|
1403 | + if (!$update_tables['powerup']['powerup_category']) { |
|
1404 | 1404 | upd_alter_table('powerup', "ADD COLUMN `powerup_category` SMALLINT NOT NULL DEFAULT 0 AFTER `powerup_planet_id`", !$update_tables['powerup']['powerup_category']); |
1405 | 1405 | |
1406 | 1406 | doquery("UPDATE {{powerup}} SET powerup_category = " . BONUS_MERCENARY); |
@@ -1421,7 +1421,7 @@ discard block |
||
1421 | 1421 | upd_check_key('ali_bonus_brackets', 10, !isset(classSupernova::$config->ali_bonus_brackets)); |
1422 | 1422 | upd_check_key('ali_bonus_brackets_divisor', 50, !isset(classSupernova::$config->ali_bonus_brackets_divisor)); |
1423 | 1423 | |
1424 | - if(!classSupernova::$config->db_loadItem('rpg_flt_explore')) { |
|
1424 | + if (!classSupernova::$config->db_loadItem('rpg_flt_explore')) { |
|
1425 | 1425 | $inflation_rate = 1000; |
1426 | 1426 | |
1427 | 1427 | classSupernova::$config->db_saveItem('rpg_cost_banker', classSupernova::$config->rpg_cost_banker * $inflation_rate); |
@@ -1438,17 +1438,17 @@ discard block |
||
1438 | 1438 | doquery("UPDATE {{users}} SET `dark_matter` = `dark_matter` * {$inflation_rate};"); |
1439 | 1439 | |
1440 | 1440 | $query = doquery("SELECT * FROM {{quest}}"); |
1441 | - while($row = db_fetch($query)) { |
|
1441 | + while ($row = db_fetch($query)) { |
|
1442 | 1442 | $query_add = ''; |
1443 | 1443 | $quest_reward_list = explode(';', $row['quest_rewards']); |
1444 | - foreach($quest_reward_list as &$quest_reward) { |
|
1444 | + foreach ($quest_reward_list as &$quest_reward) { |
|
1445 | 1445 | list($reward_resource, $reward_amount) = explode(',', $quest_reward); |
1446 | - if($reward_resource == RES_DARK_MATTER) { |
|
1446 | + if ($reward_resource == RES_DARK_MATTER) { |
|
1447 | 1447 | $quest_reward = "{$reward_resource}," . $reward_amount * 1000; |
1448 | 1448 | } |
1449 | 1449 | } |
1450 | 1450 | $new_rewards = implode(';', $quest_reward_list); |
1451 | - if($new_rewards != $row['quest_rewards']) { |
|
1451 | + if ($new_rewards != $row['quest_rewards']) { |
|
1452 | 1452 | doquery("UPDATE {{quest}} SET `quest_rewards` = '{$new_rewards}' WHERE quest_id = {$row['quest_id']} LIMIT 1;"); |
1453 | 1453 | } |
1454 | 1454 | } |
@@ -1478,7 +1478,7 @@ discard block |
||
1478 | 1478 | upd_check_key('user_birthday_range', 30, !isset(classSupernova::$config->user_birthday_range)); |
1479 | 1479 | upd_check_key('user_birthday_celebrate', 0, !isset(classSupernova::$config->user_birthday_celebrate)); |
1480 | 1480 | |
1481 | - if(!isset($update_tables['payment'])) { |
|
1481 | + if (!isset($update_tables['payment'])) { |
|
1482 | 1482 | upd_alter_table('users', array( |
1483 | 1483 | "ADD KEY `I_user_id_name` (`id`, `username`)", |
1484 | 1484 | ), !$update_indexes['users']['I_user_id_name']); |
@@ -1529,7 +1529,7 @@ discard block |
||
1529 | 1529 | ), !$update_tables['iraks']['fleet_start_type']); |
1530 | 1530 | |
1531 | 1531 | |
1532 | - if(!$update_tables['payment']['payment_status']) { |
|
1532 | + if (!$update_tables['payment']['payment_status']) { |
|
1533 | 1533 | upd_alter_table('payment', array( |
1534 | 1534 | "ADD COLUMN `payment_status` INT DEFAULT 0 COMMENT 'Payment status' AFTER `payment_id`", |
1535 | 1535 | |
@@ -1613,7 +1613,7 @@ discard block |
||
1613 | 1613 | "ADD INDEX `I_owner_priority_time` (`owner`, `priority`, `time`)", |
1614 | 1614 | ), !$update_indexes['notes']['I_owner_priority_time']); |
1615 | 1615 | |
1616 | - if(!$update_tables['buddy']['BUDDY_ID']) { |
|
1616 | + if (!$update_tables['buddy']['BUDDY_ID']) { |
|
1617 | 1617 | upd_alter_table('buddy', array( |
1618 | 1618 | "CHANGE COLUMN `id` `BUDDY_ID` SERIAL COMMENT 'Buddy table row ID'", |
1619 | 1619 | "CHANGE COLUMN `active` `BUDDY_STATUS` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Buddy request status'", |
@@ -1634,16 +1634,16 @@ discard block |
||
1634 | 1634 | |
1635 | 1635 | $query = upd_do_query("SELECT `BUDDY_ID`, `BUDDY_SENDER_ID`, `BUDDY_OWNER_ID` FROM {{buddy}} ORDER BY `BUDDY_ID`;"); |
1636 | 1636 | $found = $lost = array(); |
1637 | - while($row = db_fetch($query)) { |
|
1637 | + while ($row = db_fetch($query)) { |
|
1638 | 1638 | $index = min($row['BUDDY_SENDER_ID'], $row['BUDDY_OWNER_ID']) . ';' . max($row['BUDDY_SENDER_ID'], $row['BUDDY_OWNER_ID']); |
1639 | - if(!isset($found[$index])) { |
|
1639 | + if (!isset($found[$index])) { |
|
1640 | 1640 | $found[$index] = $row['BUDDY_ID']; |
1641 | 1641 | } else { |
1642 | 1642 | $lost[] = $row['BUDDY_ID']; |
1643 | 1643 | } |
1644 | 1644 | } |
1645 | 1645 | $lost = implode(',', $lost); |
1646 | - if($lost) { |
|
1646 | + if ($lost) { |
|
1647 | 1647 | upd_do_query("DELETE FROM {{buddy}} WHERE `BUDDY_ID` IN ({$lost})"); |
1648 | 1648 | } |
1649 | 1649 | |
@@ -1664,7 +1664,7 @@ discard block |
||
1664 | 1664 | |
1665 | 1665 | upd_do_query("UPDATE {{users}} SET `ally_name` = NULL, `ally_tag` = NULL, ally_register_time = 0, ally_rank_id = 0 WHERE `ally_id` IS NULL"); |
1666 | 1666 | |
1667 | - if(!$update_tables['ube_report']) { |
|
1667 | + if (!$update_tables['ube_report']) { |
|
1668 | 1668 | upd_create_table('ube_report', |
1669 | 1669 | "( |
1670 | 1670 | `ube_report_id` SERIAL COMMENT 'Report ID', |
@@ -1705,7 +1705,7 @@ discard block |
||
1705 | 1705 | ); |
1706 | 1706 | } |
1707 | 1707 | |
1708 | - if(!$update_tables['ube_report_player']) { |
|
1708 | + if (!$update_tables['ube_report_player']) { |
|
1709 | 1709 | upd_create_table('ube_report_player', |
1710 | 1710 | "( |
1711 | 1711 | `ube_report_player_id` SERIAL COMMENT 'Record ID', |
@@ -1726,7 +1726,7 @@ discard block |
||
1726 | 1726 | ); |
1727 | 1727 | } |
1728 | 1728 | |
1729 | - if(!$update_tables['ube_report_fleet']) { |
|
1729 | + if (!$update_tables['ube_report_fleet']) { |
|
1730 | 1730 | upd_create_table('ube_report_fleet', |
1731 | 1731 | "( |
1732 | 1732 | `ube_report_fleet_id` SERIAL COMMENT 'Record DB ID', |
@@ -1756,7 +1756,7 @@ discard block |
||
1756 | 1756 | ); |
1757 | 1757 | } |
1758 | 1758 | |
1759 | - if(!$update_tables['ube_report_unit']) { |
|
1759 | + if (!$update_tables['ube_report_unit']) { |
|
1760 | 1760 | // TODO: Сохранять так же имя корабля - на случай конструкторов - не, хуйня. Конструктор может давать имена разные на разных языках |
1761 | 1761 | // Может сохранять имена удаленных кораблей долго? |
1762 | 1762 | |
@@ -1793,7 +1793,7 @@ discard block |
||
1793 | 1793 | ); |
1794 | 1794 | } |
1795 | 1795 | |
1796 | - if(!$update_tables['ube_report_outcome_fleet']) { |
|
1796 | + if (!$update_tables['ube_report_outcome_fleet']) { |
|
1797 | 1797 | upd_create_table('ube_report_outcome_fleet', |
1798 | 1798 | "( |
1799 | 1799 | `ube_report_outcome_fleet_id` SERIAL COMMENT 'Record DB ID', |
@@ -1822,7 +1822,7 @@ discard block |
||
1822 | 1822 | ); |
1823 | 1823 | } |
1824 | 1824 | |
1825 | - if(!$update_tables['ube_report_outcome_unit']) { |
|
1825 | + if (!$update_tables['ube_report_outcome_unit']) { |
|
1826 | 1826 | upd_create_table('ube_report_outcome_unit', |
1827 | 1827 | "( |
1828 | 1828 | `ube_report_outcome_unit_id` SERIAL COMMENT 'Record DB ID', |
@@ -1843,7 +1843,7 @@ discard block |
||
1843 | 1843 | ); |
1844 | 1844 | } |
1845 | 1845 | |
1846 | - if(!$update_tables['unit']) { |
|
1846 | + if (!$update_tables['unit']) { |
|
1847 | 1847 | upd_create_table('unit', |
1848 | 1848 | "( |
1849 | 1849 | `unit_id` SERIAL COMMENT 'Record ID', |
@@ -1862,7 +1862,7 @@ discard block |
||
1862 | 1862 | ); |
1863 | 1863 | } |
1864 | 1864 | |
1865 | - if(!$update_tables['captain']) { |
|
1865 | + if (!$update_tables['captain']) { |
|
1866 | 1866 | upd_create_table('captain', |
1867 | 1867 | "( |
1868 | 1868 | `captain_id` SERIAL COMMENT 'Record ID', |
@@ -1882,7 +1882,7 @@ discard block |
||
1882 | 1882 | ); |
1883 | 1883 | } |
1884 | 1884 | |
1885 | - if(!$update_tables['fleets']['fleet_start_planet_id']) { |
|
1885 | + if (!$update_tables['fleets']['fleet_start_planet_id']) { |
|
1886 | 1886 | upd_alter_table('fleets', array( |
1887 | 1887 | "ADD `fleet_start_planet_id` BIGINT(20) UNSIGNED DEFAULT NULL COMMENT 'Fleet start planet ID' AFTER `fleet_start_time`", |
1888 | 1888 | "ADD `fleet_end_planet_id` BIGINT(20) UNSIGNED DEFAULT NULL COMMENT 'Fleet end planet ID' AFTER `fleet_end_stay`", |
@@ -1904,7 +1904,7 @@ discard block |
||
1904 | 1904 | |
1905 | 1905 | upd_alter_table('fleets', array("DROP COLUMN `processing_start`"), $update_tables['fleets']['processing_start']); |
1906 | 1906 | |
1907 | - if(!$update_tables['chat_player']) { |
|
1907 | + if (!$update_tables['chat_player']) { |
|
1908 | 1908 | upd_create_table('chat_player', |
1909 | 1909 | "( |
1910 | 1910 | `chat_player_id` SERIAL COMMENT 'Record ID', |
@@ -1966,7 +1966,7 @@ discard block |
||
1966 | 1966 | "DROP FOREIGN KEY `FK_payment_user`", |
1967 | 1967 | ), $update_foreigns['payment']['FK_payment_user']); |
1968 | 1968 | |
1969 | - if($update_foreigns['chat']['FK_chat_message_sender_user_id'] != 'chat_message_sender_id,users,id;') { |
|
1969 | + if ($update_foreigns['chat']['FK_chat_message_sender_user_id'] != 'chat_message_sender_id,users,id;') { |
|
1970 | 1970 | upd_alter_table('chat', array( |
1971 | 1971 | "DROP FOREIGN KEY `FK_chat_message_sender_user_id`", |
1972 | 1972 | "DROP FOREIGN KEY `FK_chat_message_sender_recipient_id`", |
@@ -1999,7 +1999,7 @@ discard block |
||
1999 | 1999 | "ADD KEY `I_ube_report_time_combat` (`ube_report_time_combat`)", |
2000 | 2000 | ), !$update_indexes['ube_report']['I_ube_report_time_combat']); |
2001 | 2001 | |
2002 | - if(!$update_tables['unit']['unit_time_start']) { |
|
2002 | + if (!$update_tables['unit']['unit_time_start']) { |
|
2003 | 2003 | upd_alter_table('unit', array( |
2004 | 2004 | "ADD COLUMN `unit_time_start` DATETIME NULL DEFAULT NULL COMMENT 'Unit activation start time'", |
2005 | 2005 | "ADD COLUMN `unit_time_finish` DATETIME NULL DEFAULT NULL COMMENT 'Unit activation end time'", |
@@ -2015,7 +2015,7 @@ discard block |
||
2015 | 2015 | ); |
2016 | 2016 | } |
2017 | 2017 | |
2018 | - if(!$update_tables['que']) { |
|
2018 | + if (!$update_tables['que']) { |
|
2019 | 2019 | upd_create_table('que', |
2020 | 2020 | "( |
2021 | 2021 | `que_id` SERIAL COMMENT 'Internal que id', |
@@ -2047,25 +2047,25 @@ discard block |
||
2047 | 2047 | } |
2048 | 2048 | |
2049 | 2049 | // Конвертирум очередь исследований |
2050 | - if($update_tables['users']['que']) { |
|
2050 | + if ($update_tables['users']['que']) { |
|
2051 | 2051 | $que_lines = array(); |
2052 | 2052 | $que_query = upd_do_query("SELECT * FROM {{users}} WHERE `que`"); |
2053 | - while($que_row = db_fetch($que_query)) { |
|
2053 | + while ($que_row = db_fetch($que_query)) { |
|
2054 | 2054 | $que_data = explode(',', $que_row['que']); |
2055 | 2055 | |
2056 | - if(!in_array($que_data[QI_UNIT_ID], sn_get_groups('tech'))) { |
|
2056 | + if (!in_array($que_data[QI_UNIT_ID], sn_get_groups('tech'))) { |
|
2057 | 2057 | continue; |
2058 | 2058 | } |
2059 | 2059 | |
2060 | 2060 | $que_data[QI_TIME] = $que_data[QI_TIME] >= 0 ? $que_data[QI_TIME] : 0; |
2061 | 2061 | // Если планета пустая - ставим главку |
2062 | 2062 | $que_data[QI_PLANET_ID] = $que_data[QI_PLANET_ID] ? $que_data[QI_PLANET_ID] : $que_row['id_planet']; |
2063 | - if($que_data[QI_PLANET_ID]) { |
|
2063 | + if ($que_data[QI_PLANET_ID]) { |
|
2064 | 2064 | $que_planet_check = db_fetch(upd_do_query("SELECT `id` FROM {{planets}} WHERE `id` = {$que_data[QI_PLANET_ID]}")); |
2065 | - if(!$que_planet_check['id']) { |
|
2065 | + if (!$que_planet_check['id']) { |
|
2066 | 2066 | $que_data[QI_PLANET_ID] = $que_row['id_planet']; |
2067 | 2067 | $que_planet_check = db_fetch(upd_do_query("SELECT `id` FROM {{planets}} WHERE `id` = {$que_data[QI_PLANET_ID]}")); |
2068 | - if(!$que_planet_check['id']) { |
|
2068 | + if (!$que_planet_check['id']) { |
|
2069 | 2069 | $que_data[QI_PLANET_ID] = 'NULL'; |
2070 | 2070 | } |
2071 | 2071 | } |
@@ -2079,8 +2079,8 @@ discard block |
||
2079 | 2079 | $price_increase = pow($unit_factor, $unit_level); |
2080 | 2080 | $unit_level++; |
2081 | 2081 | $unit_cost = array(); |
2082 | - foreach($unit_info[P_COST] as $resource_id => $resource_amount) { |
|
2083 | - if($resource_id === P_FACTOR || $resource_id == RES_ENERGY || !($resource_cost = $resource_amount * $price_increase)) { |
|
2082 | + foreach ($unit_info[P_COST] as $resource_id => $resource_amount) { |
|
2083 | + if ($resource_id === P_FACTOR || $resource_id == RES_ENERGY || !($resource_cost = $resource_amount * $price_increase)) { |
|
2084 | 2084 | continue; |
2085 | 2085 | } |
2086 | 2086 | $unit_cost[] = $resource_id . ',' . floor($resource_cost); |
@@ -2091,7 +2091,7 @@ discard block |
||
2091 | 2091 | BUILD_CREATE . ",{$unit_level},{$que_data[QI_TIME]},'{$unit_cost}')"; |
2092 | 2092 | } |
2093 | 2093 | |
2094 | - if(!empty($que_lines)) { |
|
2094 | + if (!empty($que_lines)) { |
|
2095 | 2095 | upd_do_query('INSERT INTO `{{que}}` (`que_player_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_lines)); |
2096 | 2096 | } |
2097 | 2097 | |
@@ -2105,22 +2105,22 @@ discard block |
||
2105 | 2105 | |
2106 | 2106 | |
2107 | 2107 | // Ковертируем технологии в таблицы |
2108 | - if($update_tables['users']['graviton_tech']) { |
|
2108 | + if ($update_tables['users']['graviton_tech']) { |
|
2109 | 2109 | upd_do_query("DELETE FROM {{unit}} WHERE unit_type = " . UNIT_TECHNOLOGIES); |
2110 | 2110 | |
2111 | 2111 | $que_lines = array(); |
2112 | 2112 | $user_query = upd_do_query("SELECT * FROM {{users}}"); |
2113 | 2113 | upd_add_more_time(300); |
2114 | 2114 | $sn_group_tech = sn_get_groups('tech'); |
2115 | - while($user_row = db_fetch($user_query)) { |
|
2116 | - foreach($sn_group_tech as $tech_id) { |
|
2117 | - if($tech_level = intval($user_row[get_unit_param($tech_id, P_NAME)])) { |
|
2115 | + while ($user_row = db_fetch($user_query)) { |
|
2116 | + foreach ($sn_group_tech as $tech_id) { |
|
2117 | + if ($tech_level = intval($user_row[get_unit_param($tech_id, P_NAME)])) { |
|
2118 | 2118 | $que_lines[] = "({$user_row['id']}," . LOC_USER . ",{$user_row['id']}," . UNIT_TECHNOLOGIES . ",{$tech_id},{$tech_level})"; |
2119 | 2119 | } |
2120 | 2120 | } |
2121 | 2121 | } |
2122 | 2122 | |
2123 | - if(!empty($que_lines)) { |
|
2123 | + if (!empty($que_lines)) { |
|
2124 | 2124 | upd_do_query("INSERT INTO {{unit}} (unit_player_id, unit_location_type, unit_location_id, unit_type, unit_snid, unit_level) VALUES " . implode(',', $que_lines)); |
2125 | 2125 | } |
2126 | 2126 | |
@@ -2129,25 +2129,25 @@ discard block |
||
2129 | 2129 | ), $update_tables['users']['graviton_tech']); |
2130 | 2130 | } |
2131 | 2131 | |
2132 | - if(!$update_indexes['unit']['I_unit_record_search']) { |
|
2132 | + if (!$update_indexes['unit']['I_unit_record_search']) { |
|
2133 | 2133 | upd_alter_table('unit', array( |
2134 | 2134 | "ADD KEY `I_unit_record_search` (`unit_snid`,`unit_player_id`,`unit_level` DESC,`unit_id`)", |
2135 | 2135 | ), !$update_indexes['unit']['I_unit_record_search']); |
2136 | 2136 | |
2137 | - foreach(sn_get_groups(array('structures', 'fleet', 'defense')) as $unit_id) { |
|
2137 | + foreach (sn_get_groups(array('structures', 'fleet', 'defense')) as $unit_id) { |
|
2138 | 2138 | $planet_units[get_unit_param($unit_id, P_NAME)] = 1; |
2139 | 2139 | } |
2140 | 2140 | $drop_index = array(); |
2141 | 2141 | $create_index = &$drop_index; // array(); |
2142 | - foreach($planet_units as $unit_name => $unit_create) { |
|
2143 | - if($update_indexes['planets']['I_' . $unit_name]) { |
|
2142 | + foreach ($planet_units as $unit_name => $unit_create) { |
|
2143 | + if ($update_indexes['planets']['I_' . $unit_name]) { |
|
2144 | 2144 | $drop_index[] = "DROP KEY I_{$unit_name}"; |
2145 | 2145 | } |
2146 | - if($update_indexes['planets']['i_' . $unit_name]) { |
|
2146 | + if ($update_indexes['planets']['i_' . $unit_name]) { |
|
2147 | 2147 | $drop_index[] = "DROP KEY i_{$unit_name}"; |
2148 | 2148 | } |
2149 | 2149 | |
2150 | - if($unit_create) { |
|
2150 | + if ($unit_create) { |
|
2151 | 2151 | $create_index[] = "ADD KEY `I_{$unit_name}` (`id_owner`, {$unit_name} DESC)"; |
2152 | 2152 | } |
2153 | 2153 | } |
@@ -2158,7 +2158,7 @@ discard block |
||
2158 | 2158 | "ADD `user_time_utc_offset` INT(11) DEFAULT NULL COMMENT 'User time difference with server time' AFTER `user_time_diff`", |
2159 | 2159 | ), !$update_tables['users']['user_time_utc_offset']); |
2160 | 2160 | |
2161 | - if(!$update_foreigns['alliance']['FK_alliance_owner']) { |
|
2161 | + if (!$update_foreigns['alliance']['FK_alliance_owner']) { |
|
2162 | 2162 | upd_do_query("UPDATE {{alliance}} SET ally_owner = NULL WHERE ally_owner NOT IN (SELECT id FROM {{users}})"); |
2163 | 2163 | |
2164 | 2164 | upd_alter_table('alliance', array( |
@@ -2178,7 +2178,7 @@ discard block |
||
2178 | 2178 | |
2179 | 2179 | upd_check_key('chat_highlight_developer', '<span class="nick_developer">$1</span>', !classSupernova::$config->chat_highlight_developer); |
2180 | 2180 | |
2181 | - if(!$update_tables['player_name_history']) { |
|
2181 | + if (!$update_tables['player_name_history']) { |
|
2182 | 2182 | upd_check_key('game_user_changename_cost', 100000, !classSupernova::$config->game_user_changename_cost); |
2183 | 2183 | upd_check_key('game_user_changename', SERVER_PLAYER_NAME_CHANGE_PAY, classSupernova::$config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_PAY); |
2184 | 2184 | |
@@ -2207,7 +2207,7 @@ discard block |
||
2207 | 2207 | "ADD `density_index` TINYINT NOT NULL DEFAULT " . PLANET_DENSITY_STANDARD . " COMMENT 'Planet cached density index'", |
2208 | 2208 | ), !$update_tables['planets']['density_index']); |
2209 | 2209 | |
2210 | - if($update_tables['users']['player_artifact_list']) { |
|
2210 | + if ($update_tables['users']['player_artifact_list']) { |
|
2211 | 2211 | upd_alter_table('unit', "DROP KEY `unit_id`", $update_indexes['unit']['unit_id']); |
2212 | 2212 | |
2213 | 2213 | upd_alter_table('unit', "ADD KEY `I_unit_player_location_snid` (`unit_player_id`, `unit_location_type`, `unit_location_id`, `unit_snid`)", !$update_indexes['unit']['I_unit_player_location_snid']); |
@@ -2217,14 +2217,14 @@ discard block |
||
2217 | 2217 | $db_changeset = array(); |
2218 | 2218 | |
2219 | 2219 | $query = upd_do_query("SELECT `id`, `player_artifact_list` FROM {{users}} WHERE `player_artifact_list` IS NOT NULL AND `player_artifact_list` != '' FOR UPDATE"); |
2220 | - while($row = db_fetch($query)) { |
|
2220 | + while ($row = db_fetch($query)) { |
|
2221 | 2221 | $artifact_list = explode(';', $row['player_artifact_list']); |
2222 | - if(!$row['player_artifact_list'] || empty($artifact_list)) { |
|
2222 | + if (!$row['player_artifact_list'] || empty($artifact_list)) { |
|
2223 | 2223 | continue; |
2224 | 2224 | } |
2225 | - foreach($artifact_list as $key => &$value) { |
|
2225 | + foreach ($artifact_list as $key => &$value) { |
|
2226 | 2226 | $value = explode(',', $value); |
2227 | - if(!isset($value[1]) || $value[1] <= 0 || !isset($sn_data_artifacts[$value[0]])) { |
|
2227 | + if (!isset($value[1]) || $value[1] <= 0 || !isset($sn_data_artifacts[$value[0]])) { |
|
2228 | 2228 | unset($artifact_list[$key]); |
2229 | 2229 | continue; |
2230 | 2230 | } |
@@ -2,25 +2,25 @@ discard block |
||
2 | 2 | |
3 | 3 | // ------------------------------------------------------------------------------------------------------------------------------ |
4 | 4 | function sn_sys_load_php_files($dir_name, $load_extension = 'php', $modules = false) { |
5 | - if(file_exists($dir_name)) { |
|
5 | + if (file_exists($dir_name)) { |
|
6 | 6 | $dir = opendir($dir_name); |
7 | - while(($file = readdir($dir)) !== false) { |
|
8 | - if($file == '..' || $file == '.') { |
|
7 | + while (($file = readdir($dir)) !== false) { |
|
8 | + if ($file == '..' || $file == '.') { |
|
9 | 9 | continue; |
10 | 10 | } |
11 | 11 | |
12 | 12 | $full_filename = $dir_name . $file; |
13 | - if($modules && is_dir($full_filename)) { |
|
14 | - if(file_exists($full_filename = "{$full_filename}/{$file}.{$load_extension}")) { |
|
13 | + if ($modules && is_dir($full_filename)) { |
|
14 | + if (file_exists($full_filename = "{$full_filename}/{$file}.{$load_extension}")) { |
|
15 | 15 | require_once($full_filename); |
16 | 16 | // Registering module |
17 | - if(class_exists($file)) { |
|
17 | + if (class_exists($file)) { |
|
18 | 18 | new $file($full_filename); |
19 | 19 | } |
20 | 20 | } |
21 | 21 | } else { |
22 | 22 | $extension = substr($full_filename, -strlen($load_extension)); |
23 | - if($extension == $load_extension) { |
|
23 | + if ($extension == $load_extension) { |
|
24 | 24 | require_once($full_filename); |
25 | 25 | } |
26 | 26 | } |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | */ |
40 | 40 | function init_update() { |
41 | 41 | $update_file = SN_ROOT_PHYSICAL . "includes/update" . DOT_PHP_EX; |
42 | - if(file_exists($update_file)) { |
|
43 | - if(filemtime($update_file) > classSupernova::$config->db_loadItem('var_db_update') || classSupernova::$config->db_loadItem('db_version') < DB_VERSION) { |
|
44 | - if(defined('IN_ADMIN')) { |
|
42 | + if (file_exists($update_file)) { |
|
43 | + if (filemtime($update_file) > classSupernova::$config->db_loadItem('var_db_update') || classSupernova::$config->db_loadItem('db_version') < DB_VERSION) { |
|
44 | + if (defined('IN_ADMIN')) { |
|
45 | 45 | sn_db_transaction_start(); // Для защиты от двойного запуска апдейта - начинаем транзакцию. Так запись в базе будет блокирована |
46 | - if(SN_TIME_NOW >= classSupernova::$config->db_loadItem('var_db_update_end')) { |
|
46 | + if (SN_TIME_NOW >= classSupernova::$config->db_loadItem('var_db_update_end')) { |
|
47 | 47 | classSupernova::$config->db_saveItem('var_db_update_end', SN_TIME_NOW + (classSupernova::$config->upd_lock_time ? classSupernova::$config->upd_lock_time : 300)); |
48 | 48 | sn_db_transaction_commit(); |
49 | 49 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $current_time = time(); |
54 | 54 | classSupernova::$config->db_saveItem('var_db_update', $current_time); |
55 | 55 | classSupernova::$config->db_saveItem('var_db_update_end', $current_time); |
56 | - } elseif(filemtime($update_file) > classSupernova::$config->var_db_update) { |
|
56 | + } elseif (filemtime($update_file) > classSupernova::$config->var_db_update) { |
|
57 | 57 | $timeout = classSupernova::$config->var_db_update_end - SN_TIME_NOW; |
58 | 58 | die( |
59 | 59 | "Обновляется база данных. Рассчетное время окончания - {$timeout} секунд (время обновления может увеличиваться). Пожалуйста, подождите...<br /> |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | function gettemplatename($u_dpath) { |
11 | 11 | static $template_names = array(); |
12 | 12 | |
13 | - if(!isset($template_names[$u_dpath])) { |
|
13 | + if (!isset($template_names[$u_dpath])) { |
|
14 | 14 | $template_names[$u_dpath] = file_exists(SN_ROOT_PHYSICAL . $u_dpath . 'tmpl.ini') ? sys_file_read(SN_ROOT_PHYSICAL . $u_dpath . 'tmpl.ini') : TEMPLATE_NAME; |
15 | 15 | } |
16 | 16 | |
@@ -52,12 +52,12 @@ discard block |
||
52 | 52 | * @param $sn_menu_extra |
53 | 53 | */ |
54 | 54 | function tpl_menu_merge_extra(&$sn_menu, &$sn_menu_extra) { |
55 | - if(empty($sn_menu) || empty($sn_menu_extra)) { |
|
55 | + if (empty($sn_menu) || empty($sn_menu_extra)) { |
|
56 | 56 | return; |
57 | 57 | } |
58 | 58 | |
59 | - foreach($sn_menu_extra as $menu_item_id => $menu_item) { |
|
60 | - if(empty($menu_item['LOCATION'])) { |
|
59 | + foreach ($sn_menu_extra as $menu_item_id => $menu_item) { |
|
60 | + if (empty($menu_item['LOCATION'])) { |
|
61 | 61 | $sn_menu[$menu_item_id] = $menu_item; |
62 | 62 | continue; |
63 | 63 | } |
@@ -66,16 +66,16 @@ discard block |
||
66 | 66 | unset($menu_item['LOCATION']); |
67 | 67 | |
68 | 68 | $is_positioned = $item_location[0]; |
69 | - if($is_positioned == '+' || $is_positioned == '-') { |
|
69 | + if ($is_positioned == '+' || $is_positioned == '-') { |
|
70 | 70 | $item_location = substr($item_location, 1); |
71 | 71 | } else { |
72 | 72 | $is_positioned = ''; |
73 | 73 | } |
74 | 74 | |
75 | - if($item_location) { |
|
75 | + if ($item_location) { |
|
76 | 76 | $menu_keys = array_keys($sn_menu); |
77 | 77 | $insert_position = array_search($item_location, $menu_keys); |
78 | - if($insert_position === false) { |
|
78 | + if ($insert_position === false) { |
|
79 | 79 | $insert_position = count($sn_menu) - 1; |
80 | 80 | $is_positioned = '+'; |
81 | 81 | $item_location = ''; |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $spliced = array_splice($sn_menu, $insert_position, count($sn_menu) - $insert_position); |
89 | 89 | $sn_menu[$menu_item_id] = $menu_item; |
90 | 90 | |
91 | - if(!$is_positioned && $item_location) { |
|
91 | + if (!$is_positioned && $item_location) { |
|
92 | 92 | unset($spliced[$item_location]); |
93 | 93 | } |
94 | 94 | $sn_menu = array_merge($sn_menu, $spliced); |
@@ -102,24 +102,24 @@ discard block |
||
102 | 102 | * @param template $template |
103 | 103 | */ |
104 | 104 | function tpl_menu_assign_to_template(&$sn_menu, &$template) { |
105 | - if(empty($sn_menu) || !is_array($sn_menu)) { |
|
105 | + if (empty($sn_menu) || !is_array($sn_menu)) { |
|
106 | 106 | return; |
107 | 107 | } |
108 | 108 | |
109 | - foreach($sn_menu as $menu_item_id => $menu_item) { |
|
110 | - if(!$menu_item) { |
|
109 | + foreach ($sn_menu as $menu_item_id => $menu_item) { |
|
110 | + if (!$menu_item) { |
|
111 | 111 | continue; |
112 | 112 | } |
113 | 113 | |
114 | - if(is_string($menu_item_id)) { |
|
114 | + if (is_string($menu_item_id)) { |
|
115 | 115 | $menu_item['ID'] = $menu_item_id; |
116 | 116 | } |
117 | 117 | |
118 | - if($menu_item['TYPE'] == 'lang') { |
|
118 | + if ($menu_item['TYPE'] == 'lang') { |
|
119 | 119 | $lang_string = &classLocale::$lang; |
120 | - if(preg_match('#(\w+)(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?#', $menu_item['ITEM'], $matches) && count($matches) > 1) { |
|
121 | - for($i = 1; $i < count($matches); $i++) { |
|
122 | - if(defined($matches[$i])) { |
|
120 | + if (preg_match('#(\w+)(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?#', $menu_item['ITEM'], $matches) && count($matches) > 1) { |
|
121 | + for ($i = 1; $i < count($matches); $i++) { |
|
122 | + if (defined($matches[$i])) { |
|
123 | 123 | $matches[$i] = constant($matches[$i]); |
124 | 124 | } |
125 | 125 | $lang_string = &$lang_string[$matches[$i]]; |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | $menu_item['ALT'] = htmlentities($menu_item['ALT']); |
132 | 132 | $menu_item['TITLE'] = htmlentities($menu_item['TITLE']); |
133 | 133 | |
134 | - if(!empty($menu_item['ICON'])) { |
|
135 | - if(is_string($menu_item['ICON'])) { |
|
134 | + if (!empty($menu_item['ICON'])) { |
|
135 | + if (is_string($menu_item['ICON'])) { |
|
136 | 136 | $menu_item['ICON_PATH'] = $menu_item['ICON']; |
137 | 137 | } else { |
138 | 138 | $menu_item['ICON'] = $menu_item_id; |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | 'MENU_START_HIDE' => !empty($_COOKIE[SN_COOKIE . '_menu_hidden']) || defined('SN_GOOGLE'), |
163 | 163 | )); |
164 | 164 | |
165 | - if(isset($template_result['MENU_CUSTOMIZE'])) { |
|
165 | + if (isset($template_result['MENU_CUSTOMIZE'])) { |
|
166 | 166 | $template->assign_vars(array( |
167 | 167 | 'PLAYER_OPTION_MENU_SHOW_ON_BUTTON' => classSupernova::$user_options[PLAYER_OPTION_MENU_SHOW_ON_BUTTON], |
168 | 168 | 'PLAYER_OPTION_MENU_HIDE_ON_BUTTON' => classSupernova::$user_options[PLAYER_OPTION_MENU_HIDE_ON_BUTTON], |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | )); |
177 | 177 | } |
178 | 178 | |
179 | - if(defined('IN_ADMIN') && IN_ADMIN === true && !empty($user['authlevel']) && $user['authlevel'] > 0) { |
|
179 | + if (defined('IN_ADMIN') && IN_ADMIN === true && !empty($user['authlevel']) && $user['authlevel'] > 0) { |
|
180 | 180 | tpl_menu_merge_extra($sn_menu_admin, $sn_menu_admin_extra); |
181 | 181 | tpl_menu_assign_to_template($sn_menu_admin, $template); |
182 | 182 | } else { |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | $in_admin = defined('IN_ADMIN') && IN_ADMIN === true; |
217 | 217 | $is_login = defined('LOGIN_LOGOUT') && LOGIN_LOGOUT === true; |
218 | 218 | |
219 | - if(is_object($page)) { |
|
219 | + if (is_object($page)) { |
|
220 | 220 | isset($page->_rootref['MENU']) ? $isDisplayMenu = $page->_rootref['MENU'] : false; |
221 | 221 | isset($page->_rootref['NAVBAR']) ? $isDisplayTopNav = $page->_rootref['NAVBAR'] : false; |
222 | 222 | |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | !isset($page->_rootref['PAGE_HEADER']) && $title ? $page->assign_var('PAGE_HEADER', $title) : false; |
225 | 225 | } |
226 | 226 | |
227 | - if(empty($user['id']) || !is_numeric($user['id'])) { |
|
227 | + if (empty($user['id']) || !is_numeric($user['id'])) { |
|
228 | 228 | $isDisplayMenu = false; |
229 | 229 | $isDisplayTopNav = false; |
230 | 230 | } |
@@ -236,10 +236,10 @@ discard block |
||
236 | 236 | $user_time_measured_unix = intval(isset($user_time_diff[PLAYER_OPTION_TIME_DIFF_MEASURE_TIME]) ? strtotime($user_time_diff[PLAYER_OPTION_TIME_DIFF_MEASURE_TIME]) : 0); |
237 | 237 | |
238 | 238 | $font_size = !empty($_COOKIE[SN_COOKIE_F]) ? $_COOKIE[SN_COOKIE_F] : classSupernova::$user_options[PLAYER_OPTION_BASE_FONT_SIZE]; |
239 | - if(strpos($font_size, '%') !== false) { |
|
239 | + if (strpos($font_size, '%') !== false) { |
|
240 | 240 | // Размер шрифта в процентах |
241 | 241 | $font_size = min(max(floatval($font_size), FONT_SIZE_PERCENT_MIN), FONT_SIZE_PERCENT_MAX) . '%'; |
242 | - } elseif(strpos($font_size, 'px') !== false) { |
|
242 | + } elseif (strpos($font_size, 'px') !== false) { |
|
243 | 243 | // Размер шрифта в пикселях |
244 | 244 | $font_size = min(max(floatval($font_size), FONT_SIZE_PIXELS_MIN), FONT_SIZE_PIXELS_MAX) . 'px'; |
245 | 245 | } else { |
@@ -251,10 +251,10 @@ discard block |
||
251 | 251 | |
252 | 252 | $template = gettemplate('_global_header', true); |
253 | 253 | |
254 | - if(!empty(classSupernova::$sn_mvc['javascript'])) { |
|
255 | - foreach(classSupernova::$sn_mvc['javascript'] as $page_name => $script_list) { |
|
256 | - if(empty($page_name) || $page_name == $sn_page_name) { |
|
257 | - foreach($script_list as $filename => $content) { |
|
254 | + if (!empty(classSupernova::$sn_mvc['javascript'])) { |
|
255 | + foreach (classSupernova::$sn_mvc['javascript'] as $page_name => $script_list) { |
|
256 | + if (empty($page_name) || $page_name == $sn_page_name) { |
|
257 | + foreach ($script_list as $filename => $content) { |
|
258 | 258 | $template_result['.']['javascript'][] = array( |
259 | 259 | 'FILE' => $filename, |
260 | 260 | 'CONTENT' => $content, |
@@ -280,9 +280,9 @@ discard block |
||
280 | 280 | classSupernova::$sn_mvc['css'][''] = array_merge($standard_css, classSupernova::$sn_mvc['css']['']); |
281 | 281 | |
282 | 282 | |
283 | - foreach(classSupernova::$sn_mvc['css'] as $page_name => $script_list) { |
|
284 | - if(empty($page_name) || $page_name == $sn_page_name) { |
|
285 | - foreach($script_list as $filename => $content) { |
|
283 | + foreach (classSupernova::$sn_mvc['css'] as $page_name => $script_list) { |
|
284 | + if (empty($page_name) || $page_name == $sn_page_name) { |
|
285 | + foreach ($script_list as $filename => $content) { |
|
286 | 286 | $template_result['.']['css'][] = array( |
287 | 287 | 'FILE' => $filename, |
288 | 288 | 'CONTENT' => $content, |
@@ -329,12 +329,12 @@ discard block |
||
329 | 329 | $template->assign_recursive($template_result); |
330 | 330 | displayP(parsetemplate($template)); |
331 | 331 | |
332 | - if(($isDisplayMenu || $in_admin) && !isset($_COOKIE['menu_disable'])) { |
|
332 | + if (($isDisplayMenu || $in_admin) && !isset($_COOKIE['menu_disable'])) { |
|
333 | 333 | // $AdminPage = $AdminPage ? $user['authlevel'] : 0; |
334 | 334 | displayP(parsetemplate(tpl_render_menu())); |
335 | 335 | } |
336 | 336 | |
337 | - if($isDisplayTopNav && !$in_admin) { |
|
337 | + if ($isDisplayTopNav && !$in_admin) { |
|
338 | 338 | displayP(parsetemplate(tpl_render_topnav($user, $planetrow))); |
339 | 339 | } |
340 | 340 | |
@@ -342,8 +342,8 @@ discard block |
||
342 | 342 | |
343 | 343 | !is_array($page) ? $page = array($page) : false; |
344 | 344 | $result_added = false; |
345 | - foreach($page as $page_item) { |
|
346 | - if(!$result_added && is_object($page_item) && isset($page_item->_tpldata['result'])) { |
|
345 | + foreach ($page as $page_item) { |
|
346 | + if (!$result_added && is_object($page_item) && isset($page_item->_tpldata['result'])) { |
|
347 | 347 | $page_item = gettemplate('_result_message', $page_item); |
348 | 348 | $temp = $page_item->files['_result_message']; |
349 | 349 | unset($page_item->files['_result_message']); |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | )); |
367 | 367 | displayP(parsetemplate($template)); |
368 | 368 | |
369 | - $user['authlevel'] >= 3 && classSupernova::$config->debug ? $debug->echo_log() : false;; |
|
369 | + $user['authlevel'] >= 3 && classSupernova::$config->debug ? $debug->echo_log() : false; ; |
|
370 | 370 | |
371 | 371 | sn_db_disconnect(); |
372 | 372 | |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | * @param string $type |
405 | 405 | */ |
406 | 406 | function tpl_topnav_event_build(&$template, $FleetList, $type = 'fleet') { |
407 | - if(empty($FleetList)) { |
|
407 | + if (empty($FleetList)) { |
|
408 | 408 | return; |
409 | 409 | } |
410 | 410 | |
@@ -413,19 +413,19 @@ discard block |
||
413 | 413 | $fleet_event_count = 0; |
414 | 414 | $fleet_flying_sorter = array(); |
415 | 415 | $fleet_flying_events = array(); |
416 | - foreach($FleetList->_container as $objFleet) { |
|
416 | + foreach ($FleetList->_container as $objFleet) { |
|
417 | 417 | $will_return = true; |
418 | - if(!$objFleet->isReturning()) { |
|
418 | + if (!$objFleet->isReturning()) { |
|
419 | 419 | // cut fleets on Hold and Expedition |
420 | - if($objFleet->time_arrive_to_target >= SN_TIME_NOW) { |
|
420 | + if ($objFleet->time_arrive_to_target >= SN_TIME_NOW) { |
|
421 | 421 | $objFleet->mission_type == MT_RELOCATE ? $will_return = false : false; |
422 | 422 | tpl_topnav_event_build_helper($objFleet->time_arrive_to_target, EVENT_FLEET_ARRIVE, classLocale::$lang['sys_event_arrive'], $objFleet->target_coordinates_typed(), !$will_return, $objFleet, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count); |
423 | 423 | } |
424 | - if($objFleet->time_mission_job_complete) { |
|
424 | + if ($objFleet->time_mission_job_complete) { |
|
425 | 425 | tpl_topnav_event_build_helper($objFleet->time_mission_job_complete, EVENT_FLEET_STAY, classLocale::$lang['sys_event_stay'], $objFleet->target_coordinates_typed(), false, $objFleet, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count); |
426 | 426 | } |
427 | 427 | } |
428 | - if($will_return) { |
|
428 | + if ($will_return) { |
|
429 | 429 | tpl_topnav_event_build_helper($objFleet->time_return_to_source, EVENT_FLEET_RETURN, classLocale::$lang['sys_event_return'], $objFleet->launch_coordinates_typed(), true, $objFleet, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count); |
430 | 430 | } |
431 | 431 | } |
@@ -433,7 +433,7 @@ discard block |
||
433 | 433 | asort($fleet_flying_sorter); |
434 | 434 | |
435 | 435 | $fleet_flying_count = $FleetList->count(); |
436 | - foreach($fleet_flying_sorter as $fleet_event_id => $fleet_time) { |
|
436 | + foreach ($fleet_flying_sorter as $fleet_event_id => $fleet_time) { |
|
437 | 437 | $fleet_event = &$fleet_flying_events[$fleet_event_id]; |
438 | 438 | $template->assign_block_vars("flying_{$type}s", array( |
439 | 439 | 'TIME' => max(0, $fleet_time - SN_TIME_NOW), |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | global $template_result; |
463 | 463 | $classLocale = classLocale::$lang; |
464 | 464 | |
465 | - if(!is_array($user)) { |
|
465 | + if (!is_array($user)) { |
|
466 | 466 | return ''; |
467 | 467 | } |
468 | 468 | |
@@ -483,8 +483,8 @@ discard block |
||
483 | 483 | |
484 | 484 | $ThisUsersPlanets = db_planet_list_sorted($user); |
485 | 485 | // while ($CurPlanet = db_fetch($ThisUsersPlanets)) |
486 | - foreach($ThisUsersPlanets as $CurPlanet) { |
|
487 | - if($CurPlanet['destruyed']) { |
|
486 | + foreach ($ThisUsersPlanets as $CurPlanet) { |
|
487 | + if ($CurPlanet['destruyed']) { |
|
488 | 488 | continue; |
489 | 489 | } |
490 | 490 | |
@@ -508,8 +508,8 @@ discard block |
||
508 | 508 | */ |
509 | 509 | $fleet_flying_list = array(); |
510 | 510 | $fleet_flying_list[0] = FleetList::dbGetFleetListByOwnerId($user['id']); |
511 | - foreach($fleet_flying_list[0]->_container as $fleet_id => $objFleet) { |
|
512 | - if(empty($fleet_flying_list[$objFleet->mission_type])) { |
|
511 | + foreach ($fleet_flying_list[0]->_container as $fleet_id => $objFleet) { |
|
512 | + if (empty($fleet_flying_list[$objFleet->mission_type])) { |
|
513 | 513 | $fleet_flying_list[$objFleet->mission_type] = new FleetList(); |
514 | 514 | } |
515 | 515 | $fleet_flying_list[$objFleet->mission_type][$fleet_id] = $objFleet; |
@@ -521,8 +521,8 @@ discard block |
||
521 | 521 | que_tpl_parse($template, QUE_RESEARCH, $user, array(), null, !classSupernova::$user_options[PLAYER_OPTION_NAVBAR_RESEARCH_WIDE]); |
522 | 522 | que_tpl_parse($template, SUBQUE_FLEET, $user, $planetrow, null, true); |
523 | 523 | |
524 | - if(!empty(classSupernova::$sn_mvc['navbar_prefix_button']) && is_array(classSupernova::$sn_mvc['navbar_prefix_button'])) { |
|
525 | - foreach(classSupernova::$sn_mvc['navbar_prefix_button'] as $navbar_button_image => $navbar_button_url) { |
|
524 | + if (!empty(classSupernova::$sn_mvc['navbar_prefix_button']) && is_array(classSupernova::$sn_mvc['navbar_prefix_button'])) { |
|
525 | + foreach (classSupernova::$sn_mvc['navbar_prefix_button'] as $navbar_button_image => $navbar_button_url) { |
|
526 | 526 | $template->assign_block_vars('navbar_prefix_button', array( |
527 | 527 | 'IMAGE' => $navbar_button_image, |
528 | 528 | 'URL_RELATIVE' => $navbar_button_url, |
@@ -536,13 +536,13 @@ discard block |
||
536 | 536 | $time_now_parsed = getdate(SN_TIME_NOW); |
537 | 537 | $time_local_parsed = getdate(defined('SN_CLIENT_TIME_LOCAL') ? SN_CLIENT_TIME_LOCAL : SN_TIME_NOW); |
538 | 538 | |
539 | - if(classSupernova::$config->game_news_overview) { |
|
539 | + if (classSupernova::$config->game_news_overview) { |
|
540 | 540 | $user_last_read_safe = intval($user['news_lastread']); |
541 | 541 | nws_render($template, "WHERE UNIX_TIMESTAMP(`tsTimeStamp`) >= {$user_last_read_safe}", classSupernova::$config->game_news_overview); |
542 | 542 | } |
543 | 543 | |
544 | 544 | $notes_query = db_note_list_by_owner($user['id'], true); |
545 | - while($note_row = db_fetch($notes_query)) { |
|
545 | + while ($note_row = db_fetch($notes_query)) { |
|
546 | 546 | note_assign($template, $note_row); |
547 | 547 | } |
548 | 548 | |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | 'QUE_ID' => QUE_RESEARCH, |
557 | 557 | 'QUE_HTML' => 'topnav', |
558 | 558 | |
559 | - 'RESEARCH_ONGOING' => (boolean)$user['que'], |
|
559 | + 'RESEARCH_ONGOING' => (boolean) $user['que'], |
|
560 | 560 | |
561 | 561 | 'TIME_TEXT' => sprintf($str_date_format, $time_now_parsed['year'], classLocale::$lang['months'][$time_now_parsed['mon']], $time_now_parsed['mday'], |
562 | 562 | $time_now_parsed['hours'], $time_now_parsed['minutes'], $time_now_parsed['seconds'] |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | 'QUE_STRUCTURES' => QUE_STRUCTURES, |
634 | 634 | )); |
635 | 635 | |
636 | - if((defined('SN_RENDER_NAVBAR_PLANET') && SN_RENDER_NAVBAR_PLANET === true) || ($user['option_list'][OPT_INTERFACE]['opt_int_navbar_resource_force'] && SN_RENDER_NAVBAR_PLANET !== false)) { |
|
636 | + if ((defined('SN_RENDER_NAVBAR_PLANET') && SN_RENDER_NAVBAR_PLANET === true) || ($user['option_list'][OPT_INTERFACE]['opt_int_navbar_resource_force'] && SN_RENDER_NAVBAR_PLANET !== false)) { |
|
637 | 637 | tpl_set_resource_info($template, $planetrow); |
638 | 638 | $template->assign_vars(array( |
639 | 639 | 'SN_RENDER_NAVBAR_PLANET' => true, |
@@ -648,12 +648,12 @@ discard block |
||
648 | 648 | * @param template|string $template |
649 | 649 | */ |
650 | 650 | function displayP($template) { |
651 | - if(is_object($template)) { |
|
652 | - if(empty($template->parsed)) { |
|
651 | + if (is_object($template)) { |
|
652 | + if (empty($template->parsed)) { |
|
653 | 653 | parsetemplate($template); |
654 | 654 | } |
655 | 655 | |
656 | - foreach($template->files as $section => $filename) { |
|
656 | + foreach ($template->files as $section => $filename) { |
|
657 | 657 | $template->display($section); |
658 | 658 | } |
659 | 659 | } else { |
@@ -668,11 +668,11 @@ discard block |
||
668 | 668 | * @return mixed |
669 | 669 | */ |
670 | 670 | function parsetemplate($template, $array = false) { |
671 | - if(is_object($template)) { |
|
671 | + if (is_object($template)) { |
|
672 | 672 | global $user; |
673 | 673 | |
674 | - if(!empty($array) && is_array($array)) { |
|
675 | - foreach($array as $key => $data) { |
|
674 | + if (!empty($array) && is_array($array)) { |
|
675 | + foreach ($array as $key => $data) { |
|
676 | 676 | $template->assign_var($key, $data); |
677 | 677 | } |
678 | 678 | } |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | |
714 | 714 | $template_ex = '.tpl.html'; |
715 | 715 | |
716 | - if($template === false) { |
|
716 | + if ($template === false) { |
|
717 | 717 | return sys_file_read(TEMPLATE_DIR . '/' . $files . $template_ex); |
718 | 718 | } |
719 | 719 | |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | !empty(classSupernova::$sn_mvc['i18n']['']) ? lng_load_i18n(classSupernova::$sn_mvc['i18n']['']) : false; |
734 | 734 | $sn_page_name ? lng_load_i18n(classSupernova::$sn_mvc['i18n'][$sn_page_name]) : false; |
735 | 735 | |
736 | - foreach($files as &$filename) { |
|
736 | + foreach ($files as &$filename) { |
|
737 | 737 | $filename = $filename . $template_ex; |
738 | 738 | } |
739 | 739 | |
@@ -758,13 +758,13 @@ discard block |
||
758 | 758 | 'LANG' => $language ? $language : '', |
759 | 759 | 'referral' => $id_ref ? '&id_ref=' . $id_ref : '', |
760 | 760 | |
761 | - 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '',// "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''), |
|
761 | + 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '', // "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''), |
|
762 | 762 | 'FILENAME' => basename($_SERVER['PHP_SELF']), |
763 | 763 | )); |
764 | 764 | |
765 | - foreach(lng_get_list() as $lng_id => $lng_data) { |
|
766 | - if(isset($lng_data['LANG_VARIANTS']) && is_array($lng_data['LANG_VARIANTS'])) { |
|
767 | - foreach($lng_data['LANG_VARIANTS'] as $lang_variant) { |
|
765 | + foreach (lng_get_list() as $lng_id => $lng_data) { |
|
766 | + if (isset($lng_data['LANG_VARIANTS']) && is_array($lng_data['LANG_VARIANTS'])) { |
|
767 | + foreach ($lng_data['LANG_VARIANTS'] as $lang_variant) { |
|
768 | 768 | $lng_data1 = $lng_data; |
769 | 769 | $lng_data1 = array_merge($lng_data1, $lang_variant); |
770 | 770 | $template->assign_block_vars('language', $lng_data1); |
@@ -787,8 +787,8 @@ discard block |
||
787 | 787 | $que = $que['ques'][$que_type][$planet['id_owner']][$planet['id']]; |
788 | 788 | |
789 | 789 | $que_length = 0; |
790 | - if(!empty($que)) { |
|
791 | - foreach($que as $que_item) { |
|
790 | + if (!empty($que)) { |
|
791 | + foreach ($que as $que_item) { |
|
792 | 792 | $template->assign_block_vars('que', que_tpl_parse_element($que_item)); |
793 | 793 | } |
794 | 794 | $que_length = count($que); |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | * @param int $user_dark_matter |
804 | 804 | */ |
805 | 805 | function tpl_planet_density_info(&$template, &$density_price_chart, $user_dark_matter) { |
806 | - foreach($density_price_chart as $density_price_index => &$density_price_data) { |
|
806 | + foreach ($density_price_chart as $density_price_index => &$density_price_data) { |
|
807 | 807 | $density_cost = $density_price_data; |
808 | 808 | $density_number_style = pretty_number($density_cost, true, $user_dark_matter, false, false); |
809 | 809 | |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | function tpl_assign_select(&$template, $name, $values) { |
828 | 828 | !is_array($values) ? $values = array($values => $values) : false; |
829 | 829 | |
830 | - foreach($values as $key => $value) { |
|
830 | + foreach ($values as $key => $value) { |
|
831 | 831 | $template->assign_block_vars($name, array( |
832 | 832 | 'KEY' => htmlentities($key, ENT_COMPAT, 'UTF-8'), |
833 | 833 | 'VALUE' => htmlentities($value, ENT_COMPAT, 'UTF-8'), |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
4 | 4 | |
5 | -if(classSupernova::$config->game_mode == GAME_BLITZ) { |
|
5 | +if (classSupernova::$config->game_mode == GAME_BLITZ) { |
|
6 | 6 | message(classLocale::$lang['sys_blitz_page_disabled'], classLocale::$lang['sys_error'], 'overview.php', 10); |
7 | 7 | die(); |
8 | 8 | } |
@@ -14,16 +14,16 @@ discard block |
||
14 | 14 | |
15 | 15 | $mode = sys_get_param_str('mode'); |
16 | 16 | |
17 | -if($mode == 'ainfo') { |
|
17 | +if ($mode == 'ainfo') { |
|
18 | 18 | include('includes/alliance/ali_info.inc'); |
19 | 19 | } |
20 | 20 | |
21 | -if(!$user['ally_id']) { |
|
21 | +if (!$user['ally_id']) { |
|
22 | 22 | $user_request = db_ally_request_get_by_user_id($user['id']); |
23 | - if($user_request['id_user']) { |
|
23 | + if ($user_request['id_user']) { |
|
24 | 24 | require('includes/alliance/ali_external_request.inc'); |
25 | 25 | } else { |
26 | - switch($mode) { |
|
26 | + switch ($mode) { |
|
27 | 27 | case 'search': |
28 | 28 | require('includes/alliance/ali_external_search.inc'); |
29 | 29 | break; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | sn_ali_fill_user_ally($user); |
47 | -if(!isset($user['ally'])) { |
|
47 | +if (!isset($user['ally'])) { |
|
48 | 48 | db_user_set_by_id($user['id'], "`ally_id` = null, `ally_name` = null, `ally_register_time` = 0, `ally_rank_id` = 0"); |
49 | 49 | message(classLocale::$lang['ali_sys_notFound'], classLocale::$lang['your_alliance'], 'alliance.php'); |
50 | 50 | } |
@@ -72,18 +72,18 @@ discard block |
||
72 | 72 | |
73 | 73 | // This piece converting old ally data to new one |
74 | 74 | // unset($ally['ranklist']); |
75 | -if(!$ally['ranklist'] && $ally['ally_ranks']) { |
|
75 | +if (!$ally['ranklist'] && $ally['ally_ranks']) { |
|
76 | 76 | $ally_ranks = unserialize($ally['ally_ranks']); |
77 | 77 | $i = 0; |
78 | - foreach($ally_ranks as $rank_id => $rank) { |
|
79 | - foreach($ally_rights as $key => $value) { |
|
78 | + foreach ($ally_ranks as $rank_id => $rank) { |
|
79 | + foreach ($ally_rights as $key => $value) { |
|
80 | 80 | $ranks[$i][$value] = $rank[$rights_old[$key]]; |
81 | 81 | } |
82 | 82 | db_user_list_set_ally_deprecated_convert_ranks($user['ally_id'], $i, $rank_id); |
83 | 83 | $i++; |
84 | 84 | } |
85 | 85 | |
86 | - if(!empty($ranks)) { |
|
86 | + if (!empty($ranks)) { |
|
87 | 87 | ali_rank_list_save($ranks); |
88 | 88 | } |
89 | 89 | } |
@@ -101,15 +101,15 @@ discard block |
||
101 | 101 | |
102 | 102 | $edit = sys_get_param_str('edit'); |
103 | 103 | ally_pre_call(); |
104 | -switch($mode) { |
|
104 | +switch ($mode) { |
|
105 | 105 | case 'admin': |
106 | - if(!array_key_exists($edit, $sn_ali_admin_internal)) { |
|
106 | + if (!array_key_exists($edit, $sn_ali_admin_internal)) { |
|
107 | 107 | $edit = 'default'; |
108 | 108 | } |
109 | - if($sn_ali_admin_internal[$edit]['include']) { |
|
109 | + if ($sn_ali_admin_internal[$edit]['include']) { |
|
110 | 110 | require("includes/{$sn_ali_admin_internal[$edit]['include']}"); |
111 | 111 | } |
112 | - if(isset($sn_ali_admin_internal[$edit]['function']) && is_callable($sn_ali_admin_internal[$edit]['function'])) { |
|
112 | + if (isset($sn_ali_admin_internal[$edit]['function']) && is_callable($sn_ali_admin_internal[$edit]['function'])) { |
|
113 | 113 | call_user_func($sn_ali_admin_internal[$edit]['function']); |
114 | 114 | } |
115 | 115 | break; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $result = array(); |
80 | 80 | |
81 | -switch($mode = sys_get_param_str('mode')) { |
|
81 | +switch ($mode = sys_get_param_str('mode')) { |
|
82 | 82 | case 'manage': |
83 | 83 | sn_sys_sector_buy('overview.php?mode=manage'); |
84 | 84 | |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | $template = gettemplate('planet_manage', true); |
89 | 89 | $planet_id = sys_get_param_id('planet_id'); |
90 | 90 | |
91 | - if(sys_get_param_str('rename') && $new_name = sys_get_param_str('new_name')) { |
|
91 | + if (sys_get_param_str('rename') && $new_name = sys_get_param_str('new_name')) { |
|
92 | 92 | $planetrow['name'] = $new_name; |
93 | 93 | // $new_name = db_escape($new_name); |
94 | 94 | db_planet_set_by_id($planetrow['id'], "`name` = '{$new_name}'"); |
95 | - } elseif(sys_get_param_str('action') == 'make_capital') { |
|
95 | + } elseif (sys_get_param_str('action') == 'make_capital') { |
|
96 | 96 | try { |
97 | 97 | sn_db_transaction_start(); |
98 | 98 | $user = db_user_by_id($user['id'], true, '*'); |
@@ -101,15 +101,15 @@ discard block |
||
101 | 101 | // $user = $global_data['user']; |
102 | 102 | // $planetrow = $global_data['planet']; |
103 | 103 | |
104 | - if($planetrow['planet_type'] != PT_PLANET) { |
|
104 | + if ($planetrow['planet_type'] != PT_PLANET) { |
|
105 | 105 | throw new exception(classLocale::$lang['ov_capital_err_not_a_planet'], ERR_ERROR); |
106 | 106 | } |
107 | 107 | |
108 | - if($planetrow['id'] == $user['id_planet']) { |
|
108 | + if ($planetrow['id'] == $user['id_planet']) { |
|
109 | 109 | throw new exception(classLocale::$lang['ov_capital_err_capital_already'], ERR_ERROR); |
110 | 110 | } |
111 | 111 | |
112 | - if($user_dark_matter < classSupernova::$config->planet_capital_cost) { |
|
112 | + if ($user_dark_matter < classSupernova::$config->planet_capital_cost) { |
|
113 | 113 | throw new exception(classLocale::$lang['ov_capital_err_no_dark_matter'], ERR_ERROR); |
114 | 114 | } |
115 | 115 | |
@@ -126,16 +126,16 @@ discard block |
||
126 | 126 | ); |
127 | 127 | sn_db_transaction_commit(); |
128 | 128 | sys_redirect('overview.php?mode=manage'); |
129 | - } catch(exception $e) { |
|
129 | + } catch (exception $e) { |
|
130 | 130 | sn_db_transaction_rollback(); |
131 | 131 | $result[] = array( |
132 | 132 | 'STATUS' => $e->getCode(), |
133 | 133 | 'MESSAGE' => $e->getMessage(), |
134 | 134 | ); |
135 | 135 | } |
136 | - } elseif(sys_get_param_str('action') == 'planet_teleport') { |
|
136 | + } elseif (sys_get_param_str('action') == 'planet_teleport') { |
|
137 | 137 | try { |
138 | - if(!uni_coordinates_valid($new_coordinates = array( |
|
138 | + if (!uni_coordinates_valid($new_coordinates = array( |
|
139 | 139 | 'galaxy' => sys_get_param_int('new_galaxy'), |
140 | 140 | 'system' => sys_get_param_int('new_system'), |
141 | 141 | 'planet' => sys_get_param_int('new_planet'))) |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | // $planetrow = $global_data['planet']; |
153 | 153 | |
154 | 154 | $can_teleport = uni_planet_teleport_check($user, $planetrow, $new_coordinates); |
155 | - if($can_teleport['result'] != ERR_NONE) { |
|
155 | + if ($can_teleport['result'] != ERR_NONE) { |
|
156 | 156 | throw new exception($can_teleport['message'], $can_teleport['result']); |
157 | 157 | } |
158 | 158 | |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | db_planet_set_by_gspt($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], PT_ALL, |
164 | 164 | "galaxy = {$new_coordinates['galaxy']}, system = {$new_coordinates['system']}, planet = {$new_coordinates['planet']}, planet_teleport_next = {$planet_teleport_next}"); |
165 | 165 | |
166 | - if($planetrow['id'] == $user['id_planet']) { |
|
166 | + if ($planetrow['id'] == $user['id_planet']) { |
|
167 | 167 | db_user_set_by_id($user['id'], "galaxy = {$new_coordinates['galaxy']}, system = {$new_coordinates['system']}, planet = {$new_coordinates['planet']}"); |
168 | 168 | } |
169 | 169 | |
@@ -176,17 +176,17 @@ discard block |
||
176 | 176 | 'MESSAGE' => classLocale::$lang['ov_teleport_err_none'], |
177 | 177 | ); |
178 | 178 | sys_redirect('overview.php?mode=manage'); |
179 | - } catch(exception $e) { |
|
179 | + } catch (exception $e) { |
|
180 | 180 | sn_db_transaction_rollback(); |
181 | 181 | $result[] = array( |
182 | 182 | 'STATUS' => $e->getCode(), |
183 | 183 | 'MESSAGE' => $e->getMessage(), |
184 | 184 | ); |
185 | 185 | } |
186 | - } elseif(sys_get_param_str('action') == 'planet_abandon') { |
|
186 | + } elseif (sys_get_param_str('action') == 'planet_abandon') { |
|
187 | 187 | // if(sec_password_check($user['id'], sys_get_param('abandon_confirm'))) { |
188 | - if(classSupernova::$auth->password_check(sys_get_param('abandon_confirm'))) { |
|
189 | - if($user['id_planet'] != $user['current_planet'] && $user['current_planet'] == $planet_id) { |
|
188 | + if (classSupernova::$auth->password_check(sys_get_param('abandon_confirm'))) { |
|
189 | + if ($user['id_planet'] != $user['current_planet'] && $user['current_planet'] == $planet_id) { |
|
190 | 190 | $destroyed = SN_TIME_NOW + 60 * 60 * 24; |
191 | 191 | db_planet_set_by_id($user['current_planet'], "`destruyed`='{$destroyed}', `id_owner`=0"); |
192 | 192 | db_planet_set_by_parent($user['current_planet'], "`destruyed`='{$destroyed}', `id_owner`=0"); |
@@ -196,9 +196,9 @@ discard block |
||
196 | 196 | message(classLocale::$lang['ov_delete_wrong_planet'], classLocale::$lang['colony_abandon'], 'overview.php?mode=manage'); |
197 | 197 | } |
198 | 198 | } else { |
199 | - message(classLocale::$lang['ov_delete_wrong_pass'] , classLocale::$lang['colony_abandon'], 'overview.php?mode=manage'); |
|
199 | + message(classLocale::$lang['ov_delete_wrong_pass'], classLocale::$lang['colony_abandon'], 'overview.php?mode=manage'); |
|
200 | 200 | } |
201 | - } elseif( |
|
201 | + } elseif ( |
|
202 | 202 | ($hire = sys_get_param_int('hire')) && in_array($hire, sn_get_groups('governors')) |
203 | 203 | && ( |
204 | 204 | !get_unit_param($hire, P_MAX_STACK) || |
@@ -213,8 +213,8 @@ discard block |
||
213 | 213 | $user = db_user_by_id($user['id'], true); |
214 | 214 | $planetrow = db_planet_by_id($planetrow['id'], true); |
215 | 215 | $build_data = eco_get_build_data($user, $planetrow, $hire, $planetrow['PLANET_GOVERNOR_ID'] == $hire ? $planetrow['PLANET_GOVERNOR_LEVEL'] : 0); |
216 | - if($build_data['CAN'][BUILD_CREATE]) { |
|
217 | - if($planetrow['PLANET_GOVERNOR_ID'] == $hire) { |
|
216 | + if ($build_data['CAN'][BUILD_CREATE]) { |
|
217 | + if ($planetrow['PLANET_GOVERNOR_ID'] == $hire) { |
|
218 | 218 | $planetrow['PLANET_GOVERNOR_LEVEL']++; |
219 | 219 | $query = '`PLANET_GOVERNOR_LEVEL` + 1'; |
220 | 220 | } else { |
@@ -240,8 +240,8 @@ discard block |
||
240 | 240 | |
241 | 241 | lng_include('mrc_mercenary'); |
242 | 242 | int_planet_pretemplate($planetrow, $template); |
243 | - foreach(sn_get_groups('governors') as $governor_id) { |
|
244 | - if($planetrow['planet_type'] == PT_MOON && $governor_id == MRC_TECHNOLOGIST) { |
|
243 | + foreach (sn_get_groups('governors') as $governor_id) { |
|
244 | + if ($planetrow['planet_type'] == PT_MOON && $governor_id == MRC_TECHNOLOGIST) { |
|
245 | 245 | continue; |
246 | 246 | } |
247 | 247 | |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | 'PAGE_HINT' => classLocale::$lang['ov_manage_page_hint'], |
294 | 294 | )); |
295 | 295 | |
296 | - foreach($result as &$a_result) { |
|
296 | + foreach ($result as &$a_result) { |
|
297 | 297 | $template->assign_block_vars('result', $a_result); |
298 | 298 | } |
299 | 299 | |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | default: |
304 | 304 | sn_sys_sector_buy(); |
305 | 305 | |
306 | - if(sys_get_param_str('rename') && $new_name = sys_get_param_str('new_name')) { |
|
306 | + if (sys_get_param_str('rename') && $new_name = sys_get_param_str('new_name')) { |
|
307 | 307 | $planetrow['name'] = $new_name; |
308 | 308 | $new_name_safe = db_escape($new_name); |
309 | 309 | db_planet_set_by_id($planetrow['id'], "`name` = '{$new_name_safe}'"); |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | |
334 | 334 | $planet_count = 0; |
335 | 335 | $planets_query = db_planet_list_sorted($user, false, '*'); |
336 | - foreach($planets_query as $an_id => $UserPlanet) { |
|
336 | + foreach ($planets_query as $an_id => $UserPlanet) { |
|
337 | 337 | sn_db_transaction_start(); |
338 | 338 | $UserPlanet = sys_o_get_updated($user, $UserPlanet['id'], SN_TIME_NOW, false, true); |
339 | 339 | sn_db_transaction_commit(); |
@@ -344,16 +344,16 @@ discard block |
||
344 | 344 | |
345 | 345 | $planet_fleet_id = 0; |
346 | 346 | $fleet_list = $template_planet['fleet_list']; |
347 | - if($fleet_list['own']['count']) { |
|
347 | + if ($fleet_list['own']['count']) { |
|
348 | 348 | $planet_fleet_id = "p{$UserPlanet['id']}"; |
349 | 349 | $fleets_to_planet[$UserPlanet['id']] = tpl_parse_fleet_sn($fleet_list['own']['total'], $planet_fleet_id); |
350 | 350 | // $fleet_id++;tpl_parse_fleet_sn |
351 | 351 | } |
352 | - if($UserPlanet['planet_type'] == PT_MOON) { |
|
352 | + if ($UserPlanet['planet_type'] == PT_MOON) { |
|
353 | 353 | continue; |
354 | 354 | } |
355 | 355 | $moon = db_planet_by_parent($UserPlanet['id']); |
356 | - if($moon) { |
|
356 | + if ($moon) { |
|
357 | 357 | $moon_fill = min(100, floor($moon['field_current'] / eco_planet_fields_max($moon) * 100)); |
358 | 358 | } else { |
359 | 359 | $moon_fill = 0; |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | tpl_assign_fleet($template, $fleets); |
394 | 394 | |
395 | 395 | $lune = $planetrow['planet_type'] == PT_PLANET ? db_planet_by_parent($planetrow['id']) : db_planet_by_id($planetrow['parent_planet']); |
396 | - if($lune) { |
|
396 | + if ($lune) { |
|
397 | 397 | $template->assign_vars(array( |
398 | 398 | 'MOON_ID' => $lune['id'], |
399 | 399 | 'MOON_IMG' => $lune['image'], |
@@ -405,15 +405,15 @@ discard block |
||
405 | 405 | $planet_fill = $planet_fill > 100 ? 100 : $planet_fill; |
406 | 406 | |
407 | 407 | $planet_recyclers_orbiting = 0; |
408 | - foreach(sn_get_groups('flt_recyclers') as $recycler_id) { |
|
408 | + foreach (sn_get_groups('flt_recyclers') as $recycler_id) { |
|
409 | 409 | $planet_recyclers_orbiting += mrc_get_level($user, $planetrow, $recycler_id); |
410 | 410 | } |
411 | 411 | |
412 | 412 | int_planet_pretemplate($planetrow, $template); |
413 | 413 | |
414 | 414 | $sn_group_ques = sn_get_groups('ques'); |
415 | - if(!defined('GAME_STRUCTURES_DISABLED') || !GAME_STRUCTURES_DISABLED) { |
|
416 | - foreach(array(QUE_STRUCTURES => $sn_group_ques[QUE_STRUCTURES]) as $que_id => $que_type_data) { |
|
415 | + if (!defined('GAME_STRUCTURES_DISABLED') || !GAME_STRUCTURES_DISABLED) { |
|
416 | + foreach (array(QUE_STRUCTURES => $sn_group_ques[QUE_STRUCTURES]) as $que_id => $que_type_data) { |
|
417 | 417 | $this_que = $que['ques'][$que_id][$user['id']][$planetrow['id']]; |
418 | 418 | $template->assign_block_vars('ques', array( |
419 | 419 | 'ID' => $que_id, |
@@ -421,8 +421,8 @@ discard block |
||
421 | 421 | 'LENGTH' => empty($this_que) ? 0 : count($this_que), |
422 | 422 | )); |
423 | 423 | |
424 | - if(!empty($this_que)) { |
|
425 | - foreach($this_que as $que_item) { |
|
424 | + if (!empty($this_que)) { |
|
425 | + foreach ($this_que as $que_item) { |
|
426 | 426 | $template->assign_block_vars('que', que_tpl_parse_element($que_item)); |
427 | 427 | } |
428 | 428 | } |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | 'LENGTH' => $que_hangar_length, |
437 | 437 | )); |
438 | 438 | |
439 | - if(!defined('GAME_DEFENSE_DISABLED') || !GAME_DEFENSE_DISABLED) { |
|
439 | + if (!defined('GAME_DEFENSE_DISABLED') || !GAME_DEFENSE_DISABLED) { |
|
440 | 440 | $que_hangar_length = tpl_assign_hangar($template, $planetrow, SUBQUE_DEFENSE); |
441 | 441 | $template->assign_block_vars('ques', array( |
442 | 442 | 'ID' => SUBQUE_DEFENSE, |
@@ -448,12 +448,12 @@ discard block |
||
448 | 448 | $overview_planet_rows = $user['opt_int_overview_planet_rows']; |
449 | 449 | $overview_planet_columns = $user['opt_int_overview_planet_columns']; |
450 | 450 | |
451 | - if($overview_planet_rows <= 0 && $overview_planet_columns <= 0) { |
|
451 | + if ($overview_planet_rows <= 0 && $overview_planet_columns <= 0) { |
|
452 | 452 | $overview_planet_rows = $user_option_list[OPT_INTERFACE]['opt_int_overview_planet_rows']; |
453 | 453 | $overview_planet_columns = $user_option_list[OPT_INTERFACE]['opt_int_overview_planet_columns']; |
454 | 454 | } |
455 | 455 | |
456 | - if($overview_planet_rows > 0 && $overview_planet_columns <= 0) { |
|
456 | + if ($overview_planet_rows > 0 && $overview_planet_columns <= 0) { |
|
457 | 457 | $overview_planet_columns = ceil($planet_count / $overview_planet_rows); |
458 | 458 | } |
459 | 459 | |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | )); |
511 | 511 | tpl_set_resource_info($template, $planetrow, $fleets_to_planet, 2); |
512 | 512 | |
513 | - foreach($result as &$a_result) { |
|
513 | + foreach ($result as &$a_result) { |
|
514 | 514 | $template->assign_block_vars('result', $a_result); |
515 | 515 | } |
516 | 516 |
@@ -2,12 +2,12 @@ discard block |
||
2 | 2 | |
3 | 3 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
4 | 4 | |
5 | -if($user['authlevel'] < AUTH_LEVEL_DEVELOPER) { |
|
5 | +if ($user['authlevel'] < AUTH_LEVEL_DEVELOPER) { |
|
6 | 6 | $error_message = classSupernova::$config->game_mode == GAME_BLITZ ? 'sys_blitz_page_disabled' : ( |
7 | 7 | !classSupernova::$config->game_blitz_register ? 'sys_blitz_registration_disabled' : '' |
8 | 8 | ); |
9 | 9 | |
10 | - if($error_message) { |
|
10 | + if ($error_message) { |
|
11 | 11 | message(classLocale::$lang[$error_message], classLocale::$lang['sys_error'], 'overview.php', 10); |
12 | 12 | die(); |
13 | 13 | } |
@@ -16,16 +16,16 @@ discard block |
||
16 | 16 | $current_round = intval(classSupernova::$config->db_loadItem('game_blitz_register_round')); |
17 | 17 | $current_price = intval(classSupernova::$config->db_loadItem('game_blitz_register_price')); |
18 | 18 | |
19 | -if(classSupernova::$config->db_loadItem('game_blitz_register') == BLITZ_REGISTER_OPEN && (sys_get_param_str('register_me') || sys_get_param_str('register_me_not'))) { |
|
19 | +if (classSupernova::$config->db_loadItem('game_blitz_register') == BLITZ_REGISTER_OPEN && (sys_get_param_str('register_me') || sys_get_param_str('register_me_not'))) { |
|
20 | 20 | sn_db_transaction_start(); |
21 | 21 | $user = db_user_by_id($user['id'], true); |
22 | 22 | $is_registered = db_blitz_reg_get_id_by_player_and_round($user, $current_round); |
23 | - if(sys_get_param_str('register_me')) { |
|
24 | - if(empty($is_registered) && mrc_get_level($user, null, RES_METAMATTER) >= $current_price) { |
|
23 | + if (sys_get_param_str('register_me')) { |
|
24 | + if (empty($is_registered) && mrc_get_level($user, null, RES_METAMATTER) >= $current_price) { |
|
25 | 25 | db_blitz_reg_insert($user, $current_round); |
26 | 26 | classSupernova::$auth->account->metamatter_change(RPG_BLITZ_REGISTRATION, -$current_price, "Регистрация в раунде {$current_round} Блица"); |
27 | 27 | } |
28 | - } elseif(sys_get_param_str('register_me_not') && !empty($is_registered)) { |
|
28 | + } elseif (sys_get_param_str('register_me_not') && !empty($is_registered)) { |
|
29 | 29 | db_blitz_reg_delete($user, $current_round); |
30 | 30 | classSupernova::$auth->account->metamatter_change(RPG_BLITZ_REGISTRATION_CANCEL, $current_price, "Отмена регистрации в раунде {$current_round} Блица"); |
31 | 31 | } |
@@ -40,17 +40,17 @@ discard block |
||
40 | 40 | $blitz_players = 0; |
41 | 41 | $blitz_prize_dark_matter = 0; |
42 | 42 | $blitz_prize_places = 0; |
43 | -if($user['authlevel'] >= AUTH_LEVEL_DEVELOPER) { |
|
44 | - if(sys_get_param_str('generate')) { |
|
43 | +if ($user['authlevel'] >= AUTH_LEVEL_DEVELOPER) { |
|
44 | + if (sys_get_param_str('generate')) { |
|
45 | 45 | $next_id = 0; |
46 | 46 | $query = db_blitz_reg_get_random_id($current_round); |
47 | - while($row = db_fetch($query)) { |
|
47 | + while ($row = db_fetch($query)) { |
|
48 | 48 | $next_id++; |
49 | 49 | $blitz_name = 'Игрок' . $next_id; |
50 | 50 | $blitz_password = sys_random_string(8); |
51 | 51 | db_blitz_reg_update_with_name_and_password($blitz_name, $blitz_password, $row, $current_round); |
52 | 52 | } |
53 | - } elseif(sys_get_param_str('import_generated')) { |
|
53 | + } elseif (sys_get_param_str('import_generated')) { |
|
54 | 54 | // ЭТО НА БЛИЦЕ!!! |
55 | 55 | db_player_list_blitz_delete_players(); |
56 | 56 | db_planets_purge(); |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $system = $system_step; |
73 | 73 | $planet = round(classSupernova::$config->game_maxPlanet / 2); |
74 | 74 | |
75 | - foreach($imported_string as &$string_data) { |
|
75 | + foreach ($imported_string as &$string_data) { |
|
76 | 76 | $string_data = explode(',', $string_data); |
77 | 77 | $username_safe = $string_data[0]; |
78 | 78 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | |
93 | 93 | $moon_row = uni_create_moon($galaxy, $system, $planet, $user_new['id'], 30, '', false); |
94 | 94 | |
95 | - if(($system += $system_step) >= classSupernova::$config->game_maxSystem) { |
|
95 | + if (($system += $system_step) >= classSupernova::$config->game_maxSystem) { |
|
96 | 96 | $galaxy++; |
97 | 97 | $system = $system_step; |
98 | 98 | } |
@@ -102,13 +102,13 @@ discard block |
||
102 | 102 | classSupernova::$config->db_saveItem('users_amount', classSupernova::$config->users_amount + $new_players); |
103 | 103 | // pdump($imported_string); |
104 | 104 | // generated_string |
105 | - } elseif(sys_get_param_str('import_result') && ($blitz_result_string = sys_get_param_str('blitz_result_string'))) { |
|
105 | + } elseif (sys_get_param_str('import_result') && ($blitz_result_string = sys_get_param_str('blitz_result_string'))) { |
|
106 | 106 | $blitz_result = explode(';', $blitz_result_string); |
107 | 107 | $blitz_last_update = $blitz_result[0]; // Пока не используется |
108 | 108 | unset($blitz_result[0]); |
109 | - foreach($blitz_result as $blitz_result_data) { |
|
109 | + foreach ($blitz_result as $blitz_result_data) { |
|
110 | 110 | $blitz_result_data = explode(',', $blitz_result_data); |
111 | - if(count($blitz_result_data) == 5) { |
|
111 | + if (count($blitz_result_data) == 5) { |
|
112 | 112 | $blitz_result_data[1] = db_escape($blitz_result_data[1]); |
113 | 113 | db_blitz_reg_update_results($blitz_result_data, $current_round); |
114 | 114 | } |
@@ -116,15 +116,15 @@ discard block |
||
116 | 116 | $blitz_result = array(); |
117 | 117 | } |
118 | 118 | |
119 | - if(classSupernova::$config->game_mode == GAME_BLITZ) { |
|
119 | + if (classSupernova::$config->game_mode == GAME_BLITZ) { |
|
120 | 120 | $blitz_result = array(classSupernova::$config->db_loadItem('var_stat_update')); |
121 | 121 | $query = db_player_list_export_blitz_info(); |
122 | - while($row = db_fetch($query)) { |
|
122 | + while ($row = db_fetch($query)) { |
|
123 | 123 | $blitz_result[] = "{$row['id']},{$row['username']},{$row['onlinetime']},{$row['total_rank']},{$row['total_points']}"; |
124 | 124 | } |
125 | 125 | } else { |
126 | 126 | $query = db_blitz_reg_get_player_list($current_round); |
127 | - while($row = db_fetch($query)) { |
|
127 | + while ($row = db_fetch($query)) { |
|
128 | 128 | $blitz_generated[] = "{$row['blitz_name']},{$row['blitz_password']}"; |
129 | 129 | $row['blitz_online'] ? $blitz_prize_players_active++ : false; |
130 | 130 | $blitz_players++; |
@@ -132,13 +132,13 @@ discard block |
||
132 | 132 | $blitz_prize_dark_matter = $blitz_prize_players_active * 20000; |
133 | 133 | $blitz_prize_places = ceil($blitz_prize_players_active / 5); |
134 | 134 | |
135 | - if(sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) { |
|
135 | + if (sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) { |
|
136 | 136 | // $blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'); |
137 | 137 | $blitz_prize_places_actual = sys_get_param_int('blitz_prize_places'); |
138 | 138 | sn_db_transaction_start(); |
139 | 139 | $query = db_blitz_reg_get_player_list_order_by_place($current_round); |
140 | - while($row = db_fetch($query)) { |
|
141 | - if(!$row['blitz_place']) { |
|
140 | + while ($row = db_fetch($query)) { |
|
141 | + if (!$row['blitz_place']) { |
|
142 | 142 | continue; |
143 | 143 | } |
144 | 144 | |
@@ -147,14 +147,14 @@ discard block |
||
147 | 147 | |
148 | 148 | $reward = $blitz_prize_dark_matter_actual - $row['blitz_reward_dark_matter']; |
149 | 149 | pdump("{{$row['id']}} {$row['blitz_name']}, Place {$row['blitz_place']}, Prize places {$blitz_prize_places_actual}, Prize {$reward}", $row['id']); |
150 | - if($reward) { |
|
150 | + if ($reward) { |
|
151 | 151 | rpg_points_change($row['user_id'], RPG_BLITZ, $reward, sprintf( |
152 | 152 | classLocale::$lang['sys_blitz_reward_log_message'], $row['blitz_place'], $row['blitz_name'] |
153 | 153 | )); |
154 | 154 | db_blitz_reg_update_apply_results($reward, $row, $current_round); |
155 | 155 | } |
156 | 156 | |
157 | - if(!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) { |
|
157 | + if (!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) { |
|
158 | 158 | break; |
159 | 159 | } |
160 | 160 | } |
@@ -169,12 +169,12 @@ discard block |
||
169 | 169 | |
170 | 170 | $player_registered = false; |
171 | 171 | $query = db_blitz_reg_get_player_list_and_users($current_round); |
172 | -while($row = db_fetch($query)) { |
|
172 | +while ($row = db_fetch($query)) { |
|
173 | 173 | $tpl_player_data = array( |
174 | 174 | 'NAME' => player_nick_render_to_html($row, array('icons' => true, 'color' => true, 'ally' => true)), |
175 | 175 | ); |
176 | 176 | |
177 | - if(classSupernova::$config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES) { |
|
177 | + if (classSupernova::$config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES) { |
|
178 | 178 | // Вот так хитро, что бы не было не единого шанса попадания на страницу данных об игроках Блиц-сервера до закрытия раунда |
179 | 179 | $tpl_player_data = array_merge($tpl_player_data, array( |
180 | 180 | 'ID' => $row['id'], |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | } |
188 | 188 | |
189 | 189 | $template->assign_block_vars('registrations', $tpl_player_data); |
190 | - if($row['id'] == $user['id']) { |
|
190 | + if ($row['id'] == $user['id']) { |
|
191 | 191 | $player_registered = $row; |
192 | 192 | } |
193 | 193 | } |
@@ -12,19 +12,19 @@ discard block |
||
12 | 12 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
13 | 13 | |
14 | 14 | // if($user['authlevel'] < 1) |
15 | -if($user['authlevel'] < 3) { |
|
15 | +if ($user['authlevel'] < 3) { |
|
16 | 16 | AdminMessage(classLocale::$lang['adm_err_denied']); |
17 | 17 | } |
18 | 18 | |
19 | 19 | $mode = sys_get_param_int('mode'); |
20 | 20 | |
21 | -switch($mode) { |
|
21 | +switch ($mode) { |
|
22 | 22 | case ADM_TOOL_CONFIG_RELOAD: |
23 | 23 | classSupernova::$config->db_loadAll(); |
24 | 24 | sys_refresh_tablelist(); |
25 | 25 | |
26 | 26 | classSupernova::$config->db_loadItem('game_watchlist'); |
27 | - if(classSupernova::$config->game_watchlist) { |
|
27 | + if (classSupernova::$config->game_watchlist) { |
|
28 | 28 | classSupernova::$config->game_watchlist_array = explode(';', classSupernova::$config->game_watchlist); |
29 | 29 | } else { |
30 | 30 | unset(classSupernova::$config->game_watchlist_array); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | classLocale::$lang['adm_tool_sql_client_version'] => db_get_client_info(), |
70 | 70 | classLocale::$lang['adm_tool_sql_host_info'] => db_get_host_info(), |
71 | 71 | ); |
72 | - foreach($status as $key => $value) { |
|
72 | + foreach ($status as $key => $value) { |
|
73 | 73 | $template->assign_block_vars('table.row', array( |
74 | 74 | 'VALUE_1' => $key, |
75 | 75 | 'VALUE_2' => $value, |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $template->assign_block_vars('table', classLocale::$lang['adm_tool_sql_table']['status']); |
80 | 80 | $status = explode(' ', db_server_stat()); |
81 | - foreach($status as $value) { |
|
81 | + foreach ($status as $value) { |
|
82 | 82 | $row = explode(': ', $value); |
83 | 83 | $template->assign_block_vars('table.row', array( |
84 | 84 | 'VALUE_1' => $row[0], |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | $template->assign_block_vars('table', classLocale::$lang['adm_tool_sql_table']['params']); |
91 | 91 | $result = db_core_show_status(); |
92 | - while($row = db_fetch($result)) { |
|
92 | + while ($row = db_fetch($result)) { |
|
93 | 93 | $template->assign_block_vars('table.row', array( |
94 | 94 | 'VALUE_1' => $row['Variable_name'], |
95 | 95 | 'VALUE_2' => $row['Value'], |
@@ -9,18 +9,18 @@ |
||
9 | 9 | * @copyright 2008 by Chlorel for XNova |
10 | 10 | */ |
11 | 11 | |
12 | -define('INSIDE' , true); |
|
13 | -define('INSTALL' , false); |
|
12 | +define('INSIDE', true); |
|
13 | +define('INSTALL', false); |
|
14 | 14 | define('IN_ADMIN', true); |
15 | 15 | require_once('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
16 | 16 | |
17 | 17 | // if($user['authlevel'] < 1) |
18 | -if($user['authlevel'] < 3) |
|
18 | +if ($user['authlevel'] < 3) |
|
19 | 19 | { |
20 | 20 | AdminMessage(classLocale::$lang['adm_err_denied']); |
21 | 21 | } |
22 | 22 | |
23 | -if(SN_TIME_NOW >= classSupernova::$config->db_loadAll('var_stat_update_admin_forced') && SN_TIME_NOW >= classSupernova::$config->db_loadAll('var_stat_update_end')) |
|
23 | +if (SN_TIME_NOW >= classSupernova::$config->db_loadAll('var_stat_update_admin_forced') && SN_TIME_NOW >= classSupernova::$config->db_loadAll('var_stat_update_end')) |
|
24 | 24 | { |
25 | 25 | classSupernova::$config->db_saveItem('var_stat_update_admin_forced', SN_TIME_NOW + 120); |
26 | 26 |
@@ -8,18 +8,18 @@ discard block |
||
8 | 8 | * @copyright 2008 by ??????? for XNova |
9 | 9 | */ |
10 | 10 | |
11 | -define('INSIDE' , true); |
|
12 | -define('INSTALL' , false); |
|
11 | +define('INSIDE', true); |
|
12 | +define('INSTALL', false); |
|
13 | 13 | define('IN_ADMIN', true); |
14 | 14 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
15 | 15 | |
16 | -if($user['authlevel'] < 3) { |
|
16 | +if ($user['authlevel'] < 3) { |
|
17 | 17 | AdminMessage(classLocale::$lang['adm_err_denied']); |
18 | 18 | } |
19 | 19 | |
20 | 20 | $template = gettemplate('admin/settings', true); |
21 | 21 | |
22 | -if(sys_get_param('save')) { |
|
22 | +if (sys_get_param('save')) { |
|
23 | 23 | classSupernova::$config->game_name = sys_get_param_str_unsafe('game_name'); |
24 | 24 | classSupernova::$config->game_mode = sys_get_param_int('game_mode'); |
25 | 25 | classSupernova::$config->game_speed = sys_get_param_float('game_speed', 1); |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | classSupernova::$config->url_faq = sys_get_param_str_unsafe('url_faq'); |
30 | 30 | classSupernova::$config->url_forum = sys_get_param_str_unsafe('url_forum'); |
31 | 31 | classSupernova::$config->url_rules = sys_get_param_str_unsafe('url_rules'); |
32 | - classSupernova::$config->url_purchase_metamatter = sys_get_param_str_unsafe('url_purchase_metamatter'); |
|
32 | + classSupernova::$config->url_purchase_metamatter = sys_get_param_str_unsafe('url_purchase_metamatter'); |
|
33 | 33 | classSupernova::$config->game_disable = sys_get_param_int('game_disable'); |
34 | 34 | classSupernova::$config->game_disable_reason = sys_get_param_str_unsafe('game_disable_reason'); |
35 | 35 | classSupernova::$config->server_updater_check_auto = sys_get_param_int('server_updater_check_auto'); |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | classSupernova::$config->stats_schedule = sys_get_param_str('stats_schedule'); |
97 | 97 | |
98 | 98 | classSupernova::$config->empire_mercenary_base_period = sys_get_param_int('empire_mercenary_base_period'); |
99 | - if(classSupernova::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) { |
|
100 | - if(classSupernova::$config->empire_mercenary_temporary) { |
|
99 | + if (classSupernova::$config->empire_mercenary_temporary != sys_get_param_int('empire_mercenary_temporary')) { |
|
100 | + if (classSupernova::$config->empire_mercenary_temporary) { |
|
101 | 101 | db_unit_list_admin_delete_mercenaries_finished(); |
102 | 102 | } else { |
103 | 103 | db_unit_list_admin_set_mercenaries_expire_time(classSupernova::$config->empire_mercenary_base_period); |
@@ -138,21 +138,21 @@ discard block |
||
138 | 138 | 'STATS_HIDE_PM_LINK' => classSupernova::$config->stats_hide_pm_link, |
139 | 139 | )); |
140 | 140 | |
141 | -foreach(classLocale::$lang['sys_game_disable_reason'] as $id => $name) { |
|
141 | +foreach (classLocale::$lang['sys_game_disable_reason'] as $id => $name) { |
|
142 | 142 | $template->assign_block_vars('sys_game_disable_reason', array( |
143 | 143 | 'ID' => $id, |
144 | 144 | 'NAME' => $name, |
145 | 145 | )); |
146 | 146 | } |
147 | 147 | |
148 | -foreach(classLocale::$lang['sys_game_mode'] as $mode_id => $mode_name) { |
|
148 | +foreach (classLocale::$lang['sys_game_mode'] as $mode_id => $mode_name) { |
|
149 | 149 | $template->assign_block_vars('game_modes', array( |
150 | 150 | 'ID' => $mode_id, |
151 | 151 | 'NAME' => $mode_name, |
152 | 152 | )); |
153 | 153 | } |
154 | 154 | |
155 | -foreach(classLocale::$lang['adm_opt_ver_response'] as $ver_id => $ver_response) { |
|
155 | +foreach (classLocale::$lang['adm_opt_ver_response'] as $ver_id => $ver_response) { |
|
156 | 156 | $template->assign_block_vars('ver_response', array( |
157 | 157 | 'ID' => $ver_id, |
158 | 158 | 'NAME' => js_safe_string($ver_response), |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | } |
161 | 161 | |
162 | 162 | $lang_list = lng_get_list(); |
163 | -foreach($lang_list as $lang_id => $lang_data) { |
|
163 | +foreach ($lang_list as $lang_id => $lang_data) { |
|
164 | 164 | $template->assign_block_vars('game_languages', array( |
165 | 165 | 'ID' => $lang_id, |
166 | 166 | 'NAME' => "{$lang_data['LANG_NAME_NATIVE']} ({$lang_data['LANG_NAME_ENGLISH']})", |