Completed
Push — work-fleets ( 3604bd...203362 )
by SuperNova.WS
06:25
created
includes/constants.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 define('SN_PAYMENT_REQUEST_OK', 0);
303 303
 define('SN_PAYMENT_REQUEST_ERROR_UNIT_AMOUNT', 1);
304 304
 define('SN_PAYMENT_REQUEST_ERROR_PAYLINK_UNSUPPORTED', 2);
305
-define('SN_PAYMENT_REQUEST_IP_WRONG', 3);  // Неправильный IP входящей системы - обычно хак
305
+define('SN_PAYMENT_REQUEST_IP_WRONG', 3); // Неправильный IP входящей системы - обычно хак
306 306
 define('SN_PAYMENT_REQUEST_COMMAND_UNSUPPORTED', 4); // Неподдерживаемая команда - обычно хак
307 307
 define('SN_PAYMENT_REQUEST_SIGNATURE_INVALID', 5); // Неправильная подпись или не сошлась контрольная сумма - обычно хак
308 308
 define('SN_MODULE_DISABLED', 6); // Модуль отключен // УНИВЕРСАЛЬНЫЙ ОТВЕТ!
@@ -772,14 +772,14 @@  discard block
 block discarded – undo
772 772
 
773 773
 
774 774
 // *** Mercenary/talent bonus types
775
-define('BONUS_NONE', 0);  // No bonus
776
-define('BONUS_PERCENT', 1);  // Percent on base value
777
-define('BONUS_ADD', 2);  // Add
778
-define('BONUS_ABILITY', 3);  // Some ability
779
-define('BONUS_MULTIPLY', 4);  // Multiply by value
780
-define('BONUS_PERCENT_CUMULATIVE', 5);  // Cumulative percent on base value
781
-define('BONUS_PERCENT_DEGRADED', 6);  // Bonus amount degraded with increase as pow(bonus, level) (?)
782
-define('BONUS_SPEED', 7);  // Speed bonus
775
+define('BONUS_NONE', 0); // No bonus
776
+define('BONUS_PERCENT', 1); // Percent on base value
777
+define('BONUS_ADD', 2); // Add
778
+define('BONUS_ABILITY', 3); // Some ability
779
+define('BONUS_MULTIPLY', 4); // Multiply by value
780
+define('BONUS_PERCENT_CUMULATIVE', 5); // Cumulative percent on base value
781
+define('BONUS_PERCENT_DEGRADED', 6); // Bonus amount degraded with increase as pow(bonus, level) (?)
782
+define('BONUS_SPEED', 7); // Speed bonus
783 783
 
784 784
 // *** Action constant (build should be replaced with ACTION)
785 785
 define('BUILD_CREATE', 1);
@@ -991,10 +991,10 @@  discard block
 block discarded – undo
991 991
 
992 992
 // === Artifacts
993 993
 define('UNIT_ARTIFACTS', 1000);
994
-define('ART_LHC', 1001);      // Additional moon chance
995
-define('ART_RCD_SMALL', 1002);   // Rapid Colony Deployment - Set of buildings up to 10th level - 10/14/ 3/0 -   405 DM
996
-define('ART_RCD_MEDIUM', 1003);  // Rapid Colony Deployment - Set of buildings up to 15th level - 15/20/ 8/0 -  4704 DM
997
-define('ART_RCD_LARGE', 1004);   // Rapid Colony Deployment - Set of buildings up to 20th level - 20/25/10/1 - 39790 DM
994
+define('ART_LHC', 1001); // Additional moon chance
995
+define('ART_RCD_SMALL', 1002); // Rapid Colony Deployment - Set of buildings up to 10th level - 10/14/ 3/0 -   405 DM
996
+define('ART_RCD_MEDIUM', 1003); // Rapid Colony Deployment - Set of buildings up to 15th level - 15/20/ 8/0 -  4704 DM
997
+define('ART_RCD_LARGE', 1004); // Rapid Colony Deployment - Set of buildings up to 20th level - 20/25/10/1 - 39790 DM
998 998
 define('ART_HEURISTIC_CHIP', 1005); // Speed up research
999 999
 define('ART_NANO_BUILDER', 1006); // Speed up building
1000 1000
 define('ART_NANO_CONSTRUCTOR', 1007); // RESERVED Speed up hangar constructions
@@ -1064,18 +1064,18 @@  discard block
 block discarded – undo
1064 1064
 define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE1', 2201); // Блиц-сервер, участник 0-го раунда, 1-е место
1065 1065
 define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE2', 2202); // Блиц-сервер, участник 0-го раунда, 2-е место
1066 1066
 define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE3', 2203); // Блиц-сервер, участник 0-го раунда, 3-е место
1067
-define('UNIT_AWARD_MEDAL_2016_WOMEN_DAY_BEST', 2204);  // Медаль Лучшему Кавалеру за максимум потраченной ММ/максимум одаренных женщин Женщине от Мужчины во время ивента 8 марта 2016 года
1067
+define('UNIT_AWARD_MEDAL_2016_WOMEN_DAY_BEST', 2204); // Медаль Лучшему Кавалеру за максимум потраченной ММ/максимум одаренных женщин Женщине от Мужчины во время ивента 8 марта 2016 года
1068 1068
 
1069 1069
 define('UNIT_AWARD_MEMORY', 2300); // Памятные знаки за существование и участие - например "4 года в игре". "Был онлайн в новогоднюю ночь 2013". итд
1070
-define('UNIT_AWARD_MEMORY_IMMORTAL', 2301);  // Бессмертный
1071
-define('UNIT_AWARD_MEMORY_2015_WOMEN_DAY', 2302);  // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2015 года
1070
+define('UNIT_AWARD_MEMORY_IMMORTAL', 2301); // Бессмертный
1071
+define('UNIT_AWARD_MEMORY_2015_WOMEN_DAY', 2302); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2015 года
1072 1072
 define('UNIT_AWARD_MEMORY_BLITZ_R0', 2303); // Блиц-сервер, участник 0-го раунда
1073 1073
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_SIMPLE', 2304); // День Рождения СН
1074 1074
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_BRONZE', 2305); // День Рождения СН
1075 1075
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_SILVER', 2306); // День Рождения СН
1076 1076
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_GOLD', 2307); // День Рождения СН
1077 1077
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_PLATINUM', 2308); // День Рождения СН
1078
-define('UNIT_AWARD_MEMORY_2016_WOMEN_DAY', 2309);  // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2016 года
1078
+define('UNIT_AWARD_MEMORY_2016_WOMEN_DAY', 2309); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2016 года
1079 1079
 
1080 1080
 define('UNIT_AWARD_PENNANT', 2400); // Переходящий вымпел - индикация статуса на сервере: "Топ-1", "Топ", "Сабтоп", "Самый большой флот" итд
1081 1081
 define('UNIT_AWARD_BADGE', 2600); // Бейджики/значки за ачивки - например, "Построил 1000 кораблей"
Please login to merge, or discard this patch.
includes/alliance/ali_external_create_ally.inc 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 use DBStatic\DBStaticAlly;
6 6
 use DBStatic\DBStaticUser;
7 7
 
8
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
8
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
9 9
   classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
10 10
 }
11 11
 
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
 $ally_name_unsafe = sys_get_param_str_unsafe('name');
15 15
 $ally_name = db_escape($ally_name_unsafe);
16 16
 
17
-if($ally_tag) {
18
-  if(!$ally_name_unsafe || !$ally_tag_unsafe) {
17
+if ($ally_tag) {
18
+  if (!$ally_name_unsafe || !$ally_tag_unsafe) {
19 19
     message(classLocale::$lang['have_not_name'], classLocale::$lang['make_alliance']);
20 20
   }
21 21
 
22 22
   $query = DBStaticAlly::db_ally_get_by_name_or_tag($ally_tag, $ally_name);
23
-  if($query) {
23
+  if ($query) {
24 24
     message(str_replace('%s', $query['ally_tag'] == $ally_tag_unsafe ? $ally_tag_unsafe : $ally_name_unsafe, classLocale::$lang['always_exist']), classLocale::$lang['make_alliance']);
25 25
   }
26 26
 
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin_mail.inc 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
3
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
4 4
   classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
5 5
 }
6 6
 
7
-if(!$user_can_send_mails) {
7
+if (!$user_can_send_mails) {
8 8
   message(classLocale::$lang['Denied_access'], classLocale::$lang['Send_circular_mail']);
9 9
 }
10 10
 
11 11
 $POST_text = sys_get_param_str('text');
12 12
 $internalAliSendTextUnsafe = sys_get_param_str_unsafe('text');
13
-if($internalAliSendTextUnsafe) {
13
+if ($internalAliSendTextUnsafe) {
14 14
   message(classLocale::$lang['members_who_recived_message'] . DBStaticMessages::msg_ali_send($internalAliSendTextUnsafe, classLocale::$lang['ali_adm_msg_subject'], sys_get_param_int('r')), classLocale::$lang['Circular_sended'], "alliance.php", '');
15 15
 }
16 16
 
17 17
 $r_list = "<option value=\"-1\">" . classLocale::$lang['All_players'] . "</option>";
18
-if($ranks) {
19
-  foreach($ranks as $id => $array) {
18
+if ($ranks) {
19
+  foreach ($ranks as $id => $array) {
20 20
     $r_list .= "<option value=\"" . $id . "\">" . $array['name'] . "</option>";
21 21
   }
22 22
 }
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin.inc 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -3,11 +3,11 @@  discard block
 block discarded – undo
3 3
 use DBStatic\DBStaticAlly;
4 4
 use DBStatic\DBStaticUser;
5 5
 
6
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
6
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
7 7
   classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
8 8
 }
9 9
 
10
-if(!$user_admin) {
10
+if (!$user_admin) {
11 11
   message(classLocale::$lang['Denied_access'], classLocale::$lang['ally_admin']);
12 12
 }
13 13
 
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
 $allyTextID = ($allyTextID < 1 || $allyTextID > 3) ? 1 : $allyTextID;
24 24
 
25 25
 
26
-if(sys_get_param_str('isSaveOptions')) {
26
+if (sys_get_param_str('isSaveOptions')) {
27 27
   require_once('includes/includes/sys_avatar.php');
28 28
 
29 29
   $fieldChange = array();
30
-  if(($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) != $ally['ally_tag']) {
30
+  if (($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) != $ally['ally_tag']) {
31 31
     $fieldChange['ally_tag'] = $new_tag;
32 32
     DBStaticUser::db_user_set_by_id(
33 33
       $ally['ally_user_id'],
@@ -36,19 +36,19 @@  discard block
 block discarded – undo
36 36
       )
37 37
     );
38 38
   }
39
-  if(($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) != $ally['ally_name']) {
39
+  if (($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) != $ally['ally_name']) {
40 40
     $fieldChange['ally_name'] = $new_name;
41 41
   }
42 42
 
43
-  if(($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) != $ally['ally_owner_range']) {
43
+  if (($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) != $ally['ally_owner_range']) {
44 44
     $fieldChange['ally_owner_range'] = $new_owner_rank;
45 45
   }
46 46
 
47
-  if(($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) != $ally['ally_web']) {
47
+  if (($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) != $ally['ally_web']) {
48 48
     $fieldChange['ally_web'] = $new_web;
49 49
   }
50 50
 
51
-  if(($new_request = sys_get_param_int('request_notallow', $ally['ally_request_notallow'])) != $ally['ally_request_notallow']) {
51
+  if (($new_request = sys_get_param_int('request_notallow', $ally['ally_request_notallow'])) != $ally['ally_request_notallow']) {
52 52
     $fieldChange['ally_request_notallow'] = sys_get_param_int('request_notallow', $ally['ally_request_notallow']);
53 53
   }
54 54
 
@@ -58,11 +58,11 @@  discard block
 block discarded – undo
58 58
     'AVATAR_UPLOAD_STATUS'  => $avatar_upload_result['STATUS'],
59 59
     'AVATAR_UPLOAD_MESSAGE' => $avatar_upload_result['MESSAGE'],
60 60
   ));
61
-  if($new_image != $ally['ally_image']) {
61
+  if ($new_image != $ally['ally_image']) {
62 62
     $fieldChange['ally_image'] = $new_image;
63 63
   }
64 64
 
65
-  if(!empty($fieldChange)) {
65
+  if (!empty($fieldChange)) {
66 66
     classSupernova::$db->doUpdateRowSet(
67 67
       TABLE_ALLIANCE,
68 68
       $fieldChange,
@@ -73,17 +73,17 @@  discard block
 block discarded – undo
73 73
 
74 74
     sys_redirect('alliance.php?mode=admin&edit=ally');
75 75
   }
76
-} elseif(sys_get_param_str('isSaveText')) {
76
+} elseif (sys_get_param_str('isSaveText')) {
77 77
   $text_unsafe = sys_get_param_str_unsafe('text');
78 78
   DBStaticAlly::db_ally_update_texts($text_unsafe, $ally['id'], $text_list[$allyTextID]['db_field']);
79 79
   $ally[$text_list[$allyTextID]['db_field']] = db_escape($text_unsafe);
80
-} elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) {
81
-  if(!$isAllyOwner) {
80
+} elseif (sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) {
81
+  if (!$isAllyOwner) {
82 82
     message(classLocale::$lang['Denied_access'], classLocale::$lang['ally_admin']);
83 83
   }
84 84
 
85 85
   $newLeader = DBStaticUser::db_user_by_id($idNewLeader, false, `ally_id`);
86
-  if($newLeader['ally_id'] == $user['ally_id']) {
86
+  if ($newLeader['ally_id'] == $user['ally_id']) {
87 87
     sn_db_transaction_start();
88 88
     DBStaticUser::db_user_set_by_id(
89 89
       $user['id'],
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
     sn_db_transaction_commit();
103 103
     sys_redirect('alliance.php');
104 104
   }
105
-} elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) {
106
-  if(!$isAllyOwner) {
105
+} elseif (sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) {
106
+  if (!$isAllyOwner) {
107 107
     message(classLocale::$lang['Denied_access'], classLocale::$lang['ally_admin']);
108 108
   }
109 109
   sn_db_transaction_start();
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
   $userAllyAdmins = DBStaticUser::db_user_list("`ally_id`= {$ally['id']}", false, '`id`, `username`');
160 160
   unset($tmp);
161 161
   // while ($userAllyAdmin = db_fetch($userAllyAdmins))
162
-  foreach($userAllyAdmins as $userAllyAdmin) {
162
+  foreach ($userAllyAdmins as $userAllyAdmin) {
163 163
 // pdump($userAllyAdmin);
164 164
     $tmp .= "<option value={$userAllyAdmin['id']}>{$userAllyAdmin['username']}</option>";
165 165
   }
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
   $template->assign_var('adminMembers', $tmp);
168 168
 }
169 169
 
170
-foreach($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) {
171
-  if(!$sn_ali_admin_action_locale['title']) {
170
+foreach ($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) {
171
+  if (!$sn_ali_admin_action_locale['title']) {
172 172
     continue;
173 173
   }
174 174
   $template->assign_block_vars('admin_actions', array(
Please login to merge, or discard this patch.
includes/init.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 // Защита от двойного инита
4
-if(defined('INIT')) {
4
+if (defined('INIT')) {
5 5
   return;
6 6
 }
7 7
 
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 define('SN_DEBUG_PDUMP_CALLER', true);
20 20
 
21 21
 // Бенчмарк
22
-register_shutdown_function(function () {
23
-  if(defined('IN_AJAX')) {
22
+register_shutdown_function(function() {
23
+  if (defined('IN_AJAX')) {
24 24
     return;
25 25
   }
26 26
 
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
     (!empty($locale_cache_statistic['misses']) ? ', LOCALE MISSED' : '') .
31 31
     (class_exists('classSupernova') && is_object(classSupernova::$db) ? ', DB time: ' . classSupernova::$db->time_mysql_total . 'ms' : '') .
32 32
     '</div>');
33
-  if($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL . 'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL . 'badqrys.txt') > 0) {
33
+  if ($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL . 'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL . 'badqrys.txt') > 0) {
34 34
     echo '<a href="badqrys.txt" target="_blank" style="color:red">', 'HACK ALERT!', '</a>';
35 35
   }
36 36
 
37
-  if(!empty($locale_cache_statistic['misses'])) {
37
+  if (!empty($locale_cache_statistic['misses'])) {
38 38
     print('<!--');
39 39
     pdump($locale_cache_statistic);
40 40
     print('-->');
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 
55 55
 define('SN_TIME_NOW_GMT_STRING', gmdate(DATE_ATOM, SN_TIME_NOW));
56 56
 
57
-if(strpos(strtolower($_SERVER['SERVER_NAME']), 'google.') !== false) {
57
+if (strpos(strtolower($_SERVER['SERVER_NAME']), 'google.') !== false) {
58 58
   define('SN_GOOGLE', true);
59 59
 }
60 60
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 ini_set('error_reporting', E_ALL ^ E_NOTICE);
83 83
 
84 84
 empty($classRoot) ? $classRoot = SN_ROOT_PHYSICAL . 'classes/' : false;
85
-spl_autoload_register(function ($class) use ($classRoot) {
85
+spl_autoload_register(function($class) use ($classRoot) {
86 86
   $class = str_replace('\\', '/', $class);
87 87
   if (file_exists($classRoot . $class . '.php')) {
88 88
     require_once $classRoot . $class . '.php';
@@ -161,9 +161,9 @@  discard block
 block discarded – undo
161 161
 // Но нужно, пока у нас есть не MVC-страницы
162 162
 $sn_page_data = $sn_data['pages'][$sn_page_name];
163 163
 $sn_page_name_file = 'includes/pages/' . $sn_page_data['filename'] . DOT_PHP_EX;
164
-if($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) {
164
+if ($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) {
165 165
   require_once($sn_page_name_file);
166
-  if(is_array($sn_page_data['options'])) {
166
+  if (is_array($sn_page_data['options'])) {
167 167
     classSupernova::$options = array_merge(classSupernova::$options, $sn_page_data['options']);
168 168
   }
169 169
 }
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 
174 174
 
175 175
 // А теперь проверяем - поддерживают ли у нас загруженный код такую страницу
176
-if(!isset($sn_data['pages'][$sn_page_name])) {
176
+if (!isset($sn_data['pages'][$sn_page_name])) {
177 177
   $sn_page_name = '';
178 178
 }
179 179
 
@@ -181,6 +181,6 @@  discard block
 block discarded – undo
181 181
 classLocale::$lang = $lang = classSupernova::$gc->localePlayer;
182 182
 classLocale::$lang->lng_switch(sys_get_param_str('lang'));
183 183
 
184
-if(!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) {
184
+if (!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) {
185 185
   require_once "init_secondary.php";
186 186
 }
Please login to merge, or discard this patch.
includes/init/init_functions.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
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) || !is_dir($dir_name)) {
5
+  if (!file_exists($dir_name) || !is_dir($dir_name)) {
6 6
     return;
7 7
   }
8 8
 
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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 />
Please login to merge, or discard this patch.
includes/general_pname.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,8 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 // Эти функции будут переписаны по добавлению инфы в БД
4 4
 
5
-function pname_factory_production_field_name($factory_unit_id)
6
-{
5
+function pname_factory_production_field_name($factory_unit_id) {
7 6
   return get_unit_param($factory_unit_id, P_NAME) . '_porcent';
8 7
 }
9 8
 
@@ -14,7 +13,6 @@  discard block
 block discarded – undo
14 13
  *
15 14
  * @return mixed
16 15
  */
17
-function pname_resource_name($resource_id)
18
-{
16
+function pname_resource_name($resource_id) {
19 17
   return get_unit_param($resource_id, P_NAME);
20 18
 }
21 19
\ No newline at end of file
Please login to merge, or discard this patch.
includes/includes/flt_page4.inc 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -7,28 +7,28 @@  discard block
 block discarded – undo
7 7
 
8 8
 $classLocale = classLocale::$lang;
9 9
 
10
-if(SN_IN_FLEET !== true) {
10
+if (SN_IN_FLEET !== true) {
11 11
   classSupernova::$debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403);
12 12
 }
13 13
 
14 14
 $fleetid = sys_get_param_id('fleetid');
15 15
 
16
-if(!is_numeric($fleetid) || empty($fleetid)) {
16
+if (!is_numeric($fleetid) || empty($fleetid)) {
17 17
   header("Location: fleet.php");
18 18
   exit();
19 19
 }
20 20
 
21 21
 $objFleet = new Fleet();
22 22
 $objFleet->dbLoad($fleetid);
23
-if(!$objFleet->dbId) {
23
+if (!$objFleet->dbId) {
24 24
   message(classLocale::$lang['fl_fleet_not_exists'], classLocale::$lang['fl_error']);
25 25
 }
26 26
 
27
-if($objFleet->time_arrive_to_target <= SN_TIME_NOW || $objFleet->time_return_to_source < SN_TIME_NOW || $objFleet->isReturning()) {
27
+if ($objFleet->time_arrive_to_target <= SN_TIME_NOW || $objFleet->time_return_to_source < SN_TIME_NOW || $objFleet->isReturning()) {
28 28
   message(classLocale::$lang['fl_isback'], classLocale::$lang['fl_error']);
29 29
 }
30 30
 
31
-if($objFleet->playerOwnerId != $user['id']) {
31
+if ($objFleet->playerOwnerId != $user['id']) {
32 32
   classSupernova::$debug->warning(classLocale::$lang['fl_aks_hack_wrong_fleet'], 'Wrong Fleet Owner', 301);
33 33
   message(classLocale::$lang['fl_aks_hack_wrong_fleet'], classLocale::$lang['fl_error']);
34 34
 }
@@ -39,19 +39,19 @@  discard block
 block discarded – undo
39 39
 
40 40
 !$aks && !$userToAdd_unsafe ? $userToAdd_unsafe = $user['username'] : false;
41 41
 
42
-if($userToAdd_unsafe) {
42
+if ($userToAdd_unsafe) {
43 43
   $userToAdd = db_escape($userToAdd_unsafe);
44 44
   $userToAddID = DBStaticUser::db_user_by_username($userToAdd_unsafe, false, 'id', true, true);
45 45
   $userToAddID = $userToAddID['id'];
46 46
 
47
-  if($objFleet->target_owner_id == $userToAddID) {
47
+  if ($objFleet->target_owner_id == $userToAddID) {
48 48
     message(classLocale::$lang['flt_aks_player_same'], classLocale::$lang['fl_error']);
49 49
   }
50 50
 
51
-  if($userToAddID) {
52
-    if(!$aks) {
51
+  if ($userToAddID) {
52
+    if (!$aks) {
53 53
       // No AСS exists - making one
54
-      if(!$objFleet->group_id) {
54
+      if (!$objFleet->group_id) {
55 55
         DBStaticFleetACS::db_acs_insert($fleetid, $user['id'], $objFleet);
56 56
 
57 57
         $aks = DBStaticFleetACS::db_acs_get_by_fleet($fleetid);
@@ -66,21 +66,21 @@  discard block
 block discarded – undo
66 66
 
67 67
     $isUserExists = false;
68 68
     $invited_ar = explode(",", $aks['eingeladen']);
69
-    foreach($invited_ar as $inv) {
70
-      if($userToAddID == $inv) {
69
+    foreach ($invited_ar as $inv) {
70
+      if ($userToAddID == $inv) {
71 71
         $isUserExists = true;
72 72
       }
73 73
     }
74 74
 
75
-    if(count($invited_ar) >= 5) {
75
+    if (count($invited_ar) >= 5) {
76 76
       message(classLocale::$lang['flt_aks_error_too_much_players'], classLocale::$lang['fl_error']);
77 77
     }
78 78
 
79
-    if($isUserExists) {
79
+    if ($isUserExists) {
80 80
       $userToAdd_unsafe != $user['username'] ? $add_user_message_mr = sprintf(classLocale::$lang['fl_aks_player_invited_already'], $userToAdd) : false;
81 81
     } else {
82 82
       $add_user_message_mr = sprintf(classLocale::$lang['fl_aks_player_invited'], $userToAdd);
83
-      if(!(DBStaticFleetACS::db_acs_update($userToAddID, $fleetid))) {
83
+      if (!(DBStaticFleetACS::db_acs_update($userToAddID, $fleetid))) {
84 84
         die(sprintf(classLocale::$lang['fl_aks_adding_error'], classSupernova::$db->db_error()));
85 85
       }
86 86
       $aks['eingeladen'] .= ',' . $userToAddID;
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
   'MISSION_NAME' => classLocale::$lang['type_mission'][MT_ACS],
100 100
 ));
101 101
 
102
-if($aks['eingeladen'] && is_array($members = classSupernova::$gc->cacheOperator->db_get_record_list(LOC_USER, "`id` in ({$aks['eingeladen']})")) && !empty($members)) {
103
-  foreach($members as $row) {
102
+if ($aks['eingeladen'] && is_array($members = classSupernova::$gc->cacheOperator->db_get_record_list(LOC_USER, "`id` in ({$aks['eingeladen']})")) && !empty($members)) {
103
+  foreach ($members as $row) {
104 104
     $template->assign_block_vars('invited', array(
105 105
       'NAME' => $row['username'],
106 106
     ));
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 $fleet_data = tplParseFleetObject($objFleet, $i, $user);
126 126
 
127 127
 $template->assign_block_vars('fleets', $fleet_data['fleet']);
128
-foreach($fleet_data['ships'] as $ship_data) {
128
+foreach ($fleet_data['ships'] as $ship_data) {
129 129
   $template->assign_block_vars('fleets.ships', $ship_data);
130 130
 }
131 131
 
Please login to merge, or discard this patch.
includes/includes/market_fleeter.inc 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 
6 6
 $classLocale = classLocale::$lang;
7 7
 
8
-if(!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) {
8
+if (!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) {
9 9
   classSupernova::$debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403);
10 10
 }
11 11
 
@@ -17,8 +17,8 @@  discard block
 block discarded – undo
17 17
   'rpg_cost' => $rpg_cost,
18 18
 ));
19 19
 
20
-if(is_array($shipList)) {
21
-  if(mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) {
20
+if (is_array($shipList)) {
21
+  if (mrc_get_level($user, null, RES_DARK_MATTER) < $rpg_cost) {
22 22
     $intError = MARKET_NO_DM;
23 23
   }
24 24
 
@@ -33,30 +33,30 @@  discard block
 block discarded – undo
33 33
 
34 34
   $message .= classLocale::$lang["eco_mrk_{$submode}_ships"] . '<ul>';
35 35
   $total = array();
36
-  foreach($shipList as $shipID => &$shipCount) {
36
+  foreach ($shipList as $shipID => &$shipCount) {
37 37
     $shipCount = ceil(floatval($shipCount));
38
-    if(!$shipCount) {
38
+    if (!$shipCount) {
39 39
       continue;
40 40
     }
41 41
 
42
-    if($shipCount < 0) {
42
+    if ($shipCount < 0) {
43 43
       classSupernova::$debug->warning('User supplied negative ship count on Black Market page', 'Hack Attempt', 307);
44 44
       $intError = MARKET_NEGATIVE_SHIPS;
45 45
       break;
46 46
     }
47 47
 
48
-    if($mode == MARKET_SCRAPPER) {
48
+    if ($mode == MARKET_SCRAPPER) {
49 49
       $amount = mrc_get_level($user, $planetrow, $shipID, true, true); // $planetrow[get_unit_param($shipID, P_NAME)];
50
-    } elseif($mode == MARKET_STOCKMAN) {
50
+    } elseif ($mode == MARKET_STOCKMAN) {
51 51
       $amount = $stock[$shipID];
52 52
     }
53 53
 
54
-    if($amount < $shipCount) {
54
+    if ($amount < $shipCount) {
55 55
       $intError = $error_no_stock;
56 56
       break;
57 57
     }
58 58
 
59
-    if(!in_array($shipID, classSupernova::$gc->groupFleet)) {
59
+    if (!in_array($shipID, classSupernova::$gc->groupFleet)) {
60 60
       classSupernova::$debug->warning('Hack Attempt', 'User supplied non-ship unit ID on Black Market page', 306);
61 61
       $intError = MARKET_NOT_A_SHIP;
62 62
       break;
@@ -72,16 +72,16 @@  discard block
 block discarded – undo
72 72
     $resTemp[RES_CRYSTAL] = floor($build_data[BUILD_CREATE][RES_CRYSTAL] * $shipCount * $config_rpg_scrape_crystal * (-$multiplier));
73 73
     $resTemp[RES_DEUTERIUM] = floor($build_data[BUILD_CREATE][RES_DEUTERIUM] * $shipCount * $config_rpg_scrape_deuterium * (-$multiplier));
74 74
 
75
-    foreach($resTemp as $resID => $resCount) {
75
+    foreach ($resTemp as $resID => $resCount) {
76 76
       $total[$resID] += $resCount;
77 77
     }
78 78
 
79 79
     $message .= "<li>{$classLocale['tech'][$shipID]}: " . pretty_number($shipCount);
80 80
   }
81 81
 
82
-  if($mode == MARKET_STOCKMAN && $intError == MARKET_DEAL) {
83
-    foreach($total as $resID => $resCount) {
84
-      if(mrc_get_level($user, $planetrow, $resID, true, true) < -$resCount) {
82
+  if ($mode == MARKET_STOCKMAN && $intError == MARKET_DEAL) {
83
+    foreach ($total as $resID => $resCount) {
84
+      if (mrc_get_level($user, $planetrow, $resID, true, true) < -$resCount) {
85 85
         $intError = MARKET_NO_RESOURCES;
86 86
         classSupernova::$debug->warning('Trying to use bug in s/h market', 'S/H Ship Market', 301);
87 87
         break;
@@ -92,10 +92,10 @@  discard block
 block discarded – undo
92 92
   $intError = ($intError == MARKET_DEAL) && (array_sum($total) == 0) ? $error_zero_res : $intError;
93 93
 
94 94
   $qry = array();
95
-  if($intError == MARKET_DEAL) {
95
+  if ($intError == MARKET_DEAL) {
96 96
     $message .= '</ul>' . classLocale::$lang["eco_mrk_{$submode}_res"] . '<ul>';
97
-    foreach($total as $resID => $resCount) {
98
-      if(!$resCount) {
97
+    foreach ($total as $resID => $resCount) {
98
+      if (!$resCount) {
99 99
         continue;
100 100
       }
101 101
 
@@ -128,38 +128,38 @@  discard block
 block discarded – undo
128 128
       'MESSAGE' => classLocale::$lang['eco_mrk_errors'][$intError],
129 129
     ));
130 130
 
131
-    foreach($shipList as $shipID => $shipCount) {
131
+    foreach ($shipList as $shipID => $shipCount) {
132 132
       $data['ships'][$shipID] = max(0, intval($shipCount));
133 133
     }
134 134
   }
135 135
 }
136 136
 $message = '';
137 137
 
138
-if(!classSupernova::$config->eco_stockman_fleet && classSupernova::$config->eco_stockman_fleet_populate) {
139
-  classSupernova::$config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item){return mt_rand(1, 1000);}, classSupernova::$gc->groupFleet)));
138
+if (!classSupernova::$config->eco_stockman_fleet && classSupernova::$config->eco_stockman_fleet_populate) {
139
+  classSupernova::$config->db_saveItem('eco_stockman_fleet', sys_unit_arr2str(array_map(function($item) {return mt_rand(1, 1000); }, classSupernova::$gc->groupFleet)));
140 140
 }
141 141
 
142 142
 tpl_set_resource_info($template, $planetrow, array());
143 143
 
144
-if(!$array) {
144
+if (!$array) {
145 145
   $array = array();
146 146
 }
147 147
 
148 148
 $group_fleet = classSupernova::$gc->groupFleet;
149
-foreach($array as $key => $value) {
150
-  if($mode == MARKET_SCRAPPER) {
149
+foreach ($array as $key => $value) {
150
+  if ($mode == MARKET_SCRAPPER) {
151 151
     $shipID = $value;
152 152
     $amount = mrc_get_level($user, $planetrow, $shipID, false, true); // $planetrow[get_unit_param($shipID, P_NAME)];
153
-  } elseif($mode == MARKET_STOCKMAN) {
153
+  } elseif ($mode == MARKET_STOCKMAN) {
154 154
     $shipID = $key;
155 155
     $amount = $value;
156 156
   }
157 157
 
158
-  if(!in_array($shipID, $group_fleet)) {
158
+  if (!in_array($shipID, $group_fleet)) {
159 159
     continue;
160 160
   }
161 161
 
162
-  if($amount > 0) {
162
+  if ($amount > 0) {
163 163
     $build_data = eco_get_build_data($user, $planetrow, $shipID);
164 164
     $template->assign_block_vars('ships', array(
165 165
       'ID'        => $shipID,
Please login to merge, or discard this patch.