Completed
Push — work-fleets ( a5ca82...ab0738 )
by SuperNova.WS
05:46
created
includes/alliance/ali_internal_admin.inc 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 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_admin) {
7
+if (!$user_admin) {
8 8
   message(classLocale::$lang['Denied_access'], classLocale::$lang['ally_admin']);
9 9
 }
10 10
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 $allyTextID = ($allyTextID < 1 || $allyTextID > 3) ? 1 : $allyTextID;
21 21
 
22 22
 
23
-if(sys_get_param_str('isSaveOptions')) {
23
+if (sys_get_param_str('isSaveOptions')) {
24 24
   require_once('includes/includes/sys_avatar.php');
25 25
 
26 26
   $new_image = $ally['ally_image'];
@@ -32,46 +32,46 @@  discard block
 block discarded – undo
32 32
 //  $template->assign_block_vars('result', $avatar_upload_result);
33 33
 
34 34
   $ally_changeset = array();
35
-  if(($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) && $new_tag != $ally['ally_tag']) {
35
+  if (($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) && $new_tag != $ally['ally_tag']) {
36 36
     $new_tag = db_escape($new_tag);
37 37
     $ally_changeset[] = "`ally_tag`='{$new_tag}'";
38 38
     db_user_set_by_id($ally['ally_user_id'], "`username`='[{$new_tag}]'");
39 39
   }
40
-  if(($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) && $new_name != $ally['ally_name']) {
40
+  if (($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) && $new_name != $ally['ally_name']) {
41 41
     $new_name = db_escape($new_name);
42 42
     $ally_changeset[] = "`ally_name`='{$new_name}'";
43 43
   }
44 44
 
45
-  if(($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) && $new_owner_rank != $ally['ally_owner_range']) {
45
+  if (($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) && $new_owner_rank != $ally['ally_owner_range']) {
46 46
     $new_owner_rank = db_escape($new_owner_rank);
47 47
     $ally_changeset[] = "`ally_owner_range` = '{$new_owner_rank}'";
48 48
   }
49
-  if(($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) && $new_web != $ally['ally_web']) {
49
+  if (($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) && $new_web != $ally['ally_web']) {
50 50
     $new_web = db_escape($new_web);
51 51
     $ally_changeset[] = "`ally_web` = '{$new_web}'";
52 52
   }
53 53
   $new_request = sys_get_param_int('request_notallow', $ally['ally_request_notallow']);
54 54
   $ally_changeset[] = "`ally_request_notallow` = '{$new_request}'";
55
-  if($new_image != $ally['ally_image']) {
55
+  if ($new_image != $ally['ally_image']) {
56 56
     $new_image = intval($new_image);
57 57
     $ally_changeset[] = "`ally_image` = '{$new_image}'";
58 58
   }
59 59
 
60
-  if(!empty($ally_changeset)) {
60
+  if (!empty($ally_changeset)) {
61 61
     db_ally_update_by_changeset($ally_changeset, $ally);
62 62
     sys_redirect('alliance.php?mode=admin&edit=ally');
63 63
   }
64
-} elseif(sys_get_param_str('isSaveText')) {
64
+} elseif (sys_get_param_str('isSaveText')) {
65 65
   $text = sys_get_param_str_both('text');
66 66
   db_ally_update_texts($text_list, $allyTextID, $text, $ally);
67 67
   $ally[$text_list[$allyTextID]['db_field']] = $text['unsafe'];
68
-} elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) {
69
-  if(!$isAllyOwner) {
68
+} elseif (sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) {
69
+  if (!$isAllyOwner) {
70 70
     message(classLocale::$lang['Denied_access'], classLocale::$lang['ally_admin']);
71 71
   }
72 72
 
73 73
   $newLeader = db_user_by_id($idNewLeader, false, `ally_id`);
74
-  if($newLeader['ally_id'] == $user['ally_id']) {
74
+  if ($newLeader['ally_id'] == $user['ally_id']) {
75 75
     sn_db_transaction_start();
76 76
     db_user_set_by_id($user['id'], "`ally_rank_id`='0'");
77 77
     db_ally_update_owner($idNewLeader, $user);
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
     sn_db_transaction_commit();
80 80
     sys_redirect('alliance.php');
81 81
   }
82
-} elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) {
83
-  if(!$isAllyOwner) {
82
+} elseif (sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) {
83
+  if (!$isAllyOwner) {
84 84
     message(classLocale::$lang['Denied_access'], classLocale::$lang['ally_admin']);
85 85
   }
86 86
   sn_db_transaction_start();
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 $request = db_ally_request_count_by_id($ally);
94 94
 
95 95
 $template->assign_vars(array(
96
-  'request_count'           => $request['request_count'] ? classLocale::$lang['ali_req_requestCount'] . ': ' . intval($request['request_count']) . '. ' . classLocale::$lang['ali_req_check'] : classLocale::$lang['ali_req_emptyList'],
96
+  'request_count'           => $request['request_count'] ? classLocale::$lang['ali_req_requestCount'].': '.intval($request['request_count']).'. '.classLocale::$lang['ali_req_check'] : classLocale::$lang['ali_req_emptyList'],
97 97
   'text'                    => $ally[$text_list[$allyTextID]['db_field']],
98 98
   'request_type'            => classLocale::$lang[$text_list[$allyTextID]['text_type']],
99 99
   't'                       => $allyTextID,
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
   $userAllyAdmins = db_user_list("`ally_id`= {$ally['id']}", false, '`id`, `username`');
127 127
   unset($tmp);
128 128
   // while ($userAllyAdmin = db_fetch($userAllyAdmins))
129
-  foreach($userAllyAdmins as $userAllyAdmin) {
129
+  foreach ($userAllyAdmins as $userAllyAdmin) {
130 130
 // pdump($userAllyAdmin);
131 131
     $tmp .= "<option value={$userAllyAdmin['id']}>{$userAllyAdmin['username']}</option>";
132 132
   }
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
   $template->assign_var('adminMembers', $tmp);
135 135
 }
136 136
 
137
-foreach($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) {
138
-  if(!$sn_ali_admin_action_locale['title']) {
137
+foreach ($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) {
138
+  if (!$sn_ali_admin_action_locale['title']) {
139 139
     continue;
140 140
   }
141 141
   $template->assign_block_vars('admin_actions', array(
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin_rights.inc 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 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
 {
5 5
   classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
6 6
 }
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 $new_rank_name = sys_get_param_str('newRankName');
15 15
 if ($new_rank_name)
16 16
 {
17
-  foreach($ally_rights as $fieldName)
17
+  foreach ($ally_rights as $fieldName)
18 18
   {
19 19
     $newRank[$fieldName] = 0;
20 20
   }
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 {
29 29
   unset($ranks);
30 30
 
31
-  foreach($rankListInput as $rankID => $rank)
31
+  foreach ($rankListInput as $rankID => $rank)
32 32
   {
33
-    foreach($ally_rights as $rightName)
33
+    foreach ($ally_rights as $rightName)
34 34
     {
35 35
       $ranks[$rankID][$rightName] = $rank[$rightName] ? 1 : 0;
36 36
     }
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 $d = sys_get_param_int('d');
42 42
 if ($d && isset($ranks[$d]))
43 43
 {
44
-  if(count($ranks) == 1)
44
+  if (count($ranks) == 1)
45 45
   {
46 46
     message(classLocale::$lang['ali_adm_lastRank'], classLocale::$lang['ali_adm_rights_title']);
47 47
   }
@@ -53,17 +53,17 @@  discard block
 block discarded – undo
53 53
 
54 54
 if (count($ranks))
55 55
 {
56
-  foreach($ranks as $rankID => $rank)
56
+  foreach ($ranks as $rankID => $rank)
57 57
   {
58 58
     $rank_data = array(
59 59
       'ID'   => $rankID,
60 60
       'NAME' => $rank['name'],
61 61
     );
62 62
 
63
-    for($i = 1; $i < count($rank); $i++)
63
+    for ($i = 1; $i < count($rank); $i++)
64 64
     {
65
-      $rank_data['R' . $i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : '') ;
66
-      $rank_data['N' . $i] = $ally_rights[$i];
65
+      $rank_data['R'.$i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : '');
66
+      $rank_data['N'.$i] = $ally_rights[$i];
67 67
     }
68 68
 
69 69
     $template->assign_block_vars('rank', $rank_data);
Please login to merge, or discard this patch.
includes/db/db_helpers.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,19 +27,19 @@
 block discarded – undo
27 27
  */
28 28
 function db_set_make_safe_string($set, $delta = false) {
29 29
   $set_safe = array();
30
-  foreach($set as $field => $value) {
31
-    if(empty($field)) {
30
+  foreach ($set as $field => $value) {
31
+    if (empty($field)) {
32 32
       continue;
33 33
     }
34 34
 
35
-    $field = '`' . db_escape($field) . '`';
35
+    $field = '`'.db_escape($field).'`';
36 36
     $new_value = $value;
37
-    if($value === null) {
37
+    if ($value === null) {
38 38
       $new_value = 'NULL';
39
-    } elseif(is_string($value) && (string)($new_value = floatval($value)) != (string)$value) {
39
+    } elseif (is_string($value) && (string) ($new_value = floatval($value)) != (string) $value) {
40 40
       // non-float
41
-      $new_value = '"' . db_escape($value) . '"';
42
-    } elseif($delta) {
41
+      $new_value = '"'.db_escape($value).'"';
42
+    } elseif ($delta) {
43 43
       // float and DELTA-set
44 44
       $new_value = "{$field} + ({$new_value})";
45 45
     }
Please login to merge, or discard this patch.
includes/init_secondary.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -2,19 +2,19 @@  discard block
 block discarded – undo
2 2
 
3 3
 $classLocale = classLocale::$lang;
4 4
 
5
-if(classSupernova::$config->server_updater_check_auto && classSupernova::$config->server_updater_check_last + classSupernova::$config->server_updater_check_period <= SN_TIME_NOW) {
6
-  include(SN_ROOT_PHYSICAL . 'ajax_version_check' . DOT_PHP_EX);
5
+if (classSupernova::$config->server_updater_check_auto && classSupernova::$config->server_updater_check_last + classSupernova::$config->server_updater_check_period <= SN_TIME_NOW) {
6
+  include(SN_ROOT_PHYSICAL.'ajax_version_check'.DOT_PHP_EX);
7 7
 }
8 8
 
9
-if(classSupernova::$config->user_birthday_gift && SN_TIME_NOW - classSupernova::$config->user_birthday_celebrate > PERIOD_DAY) {
10
-  require_once(SN_ROOT_PHYSICAL . "includes/includes/user_birthday_celebrate" . DOT_PHP_EX);
9
+if (classSupernova::$config->user_birthday_gift && SN_TIME_NOW - classSupernova::$config->user_birthday_celebrate > PERIOD_DAY) {
10
+  require_once(SN_ROOT_PHYSICAL."includes/includes/user_birthday_celebrate".DOT_PHP_EX);
11 11
   sn_user_birthday_celebrate();
12 12
 }
13 13
 
14
-if(!classSupernova::$config->var_online_user_count || classSupernova::$config->var_online_user_time + 30 < SN_TIME_NOW) {
14
+if (!classSupernova::$config->var_online_user_count || classSupernova::$config->var_online_user_time + 30 < SN_TIME_NOW) {
15 15
   classSupernova::$config->db_saveItem('var_online_user_count', db_user_count(true));
16 16
   classSupernova::$config->db_saveItem('var_online_user_time', SN_TIME_NOW);
17
-  if(classSupernova::$config->server_log_online) {
17
+  if (classSupernova::$config->server_log_online) {
18 18
     db_log_online_insert();
19 19
   }
20 20
 }
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 $template_result[F_ACCOUNT_IS_AUTHORIZED] = $sys_user_logged_in = !empty($user) && isset($user['id']) && $user['id'];
42 42
 //pdump($template_result[F_ACCOUNT_IS_AUTHORIZED]);die();
43 43
 
44
-if(!empty($user['id'])) {
44
+if (!empty($user['id'])) {
45 45
   classSupernova::$user_options->user_change($user['id']);
46 46
 }
47 47
 
@@ -54,15 +54,15 @@  discard block
 block discarded – undo
54 54
     : false
55 55
   );
56 56
 
57
-if($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) {
58
-  $prohibited_characters = array_map(function ($value) {
59
-    return "'" . htmlentities($value, ENT_QUOTES, 'UTF-8') . "'";
57
+if ($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) {
58
+  $prohibited_characters = array_map(function($value) {
59
+    return "'".htmlentities($value, ENT_QUOTES, 'UTF-8')."'";
60 60
   }, str_split(LOGIN_REGISTER_CHARACTERS_PROHIBITED));
61 61
   $template_result[F_LOGIN_MESSAGE] .= implode(', ', $prohibited_characters);
62 62
 }
63 63
 
64 64
 
65
-if(defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) {
65
+if (defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) {
66 66
   pdump("Отключи отладку перед продакшном!");
67 67
 }
68 68
 
@@ -76,17 +76,17 @@  discard block
 block discarded – undo
76 76
   ? define('INSTALL_MODE', GAME_DISABLE_INSTALL)
77 77
   : false;
78 78
 
79
-if($template_result[F_GAME_DISABLE] = classSupernova::$config->game_disable) {
79
+if ($template_result[F_GAME_DISABLE] = classSupernova::$config->game_disable) {
80 80
   $template_result[F_GAME_DISABLE_REASON] = sys_bbcodeParse(
81 81
     classSupernova::$config->game_disable == GAME_DISABLE_REASON
82 82
       ? classSupernova::$config->game_disable_reason
83 83
       : classLocale::$lang['sys_game_disable_reason'][classSupernova::$config->game_disable]
84 84
   );
85
-  if(defined('IN_API')) {
85
+  if (defined('IN_API')) {
86 86
     return;
87 87
   }
88 88
 
89
-  if(
89
+  if (
90 90
     ($user['authlevel'] < 1 || !(defined('IN_ADMIN') && IN_ADMIN))
91 91
     &&
92 92
     !(defined('INSTALL_MODE') && defined('LOGIN_LOGOUT'))
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 
101 101
 // TODO ban
102 102
 // TODO $skip_ban_check
103
-if($template_result[F_BANNED_STATUS] && !$skip_ban_check) {
104
-  if(defined('IN_API')) {
103
+if ($template_result[F_BANNED_STATUS] && !$skip_ban_check) {
104
+  if (defined('IN_API')) {
105 105
     return;
106 106
   }
107 107
 
@@ -119,15 +119,15 @@  discard block
 block discarded – undo
119 119
 // pdump($allow_anonymous, '$allow_anonymous');
120 120
 // pdump($sys_user_logged_in, '$sys_user_logged_in');
121 121
 
122
-if($sys_user_logged_in && INITIAL_PAGE == 'login') {
123
-  sys_redirect(SN_ROOT_VIRTUAL . 'overview.php');
124
-} elseif($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id'])
122
+if ($sys_user_logged_in && INITIAL_PAGE == 'login') {
123
+  sys_redirect(SN_ROOT_VIRTUAL.'overview.php');
124
+} elseif ($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id'])
125 125
 //  pdump($sn_page_name);
126 126
 //  pdump(INITIAL_PAGE);
127 127
 //  die('{Тут должна быть ваша реклама. Точнее - ввод имени игрока}');
128
-} elseif(!$allow_anonymous && !$sys_user_logged_in) {
128
+} elseif (!$allow_anonymous && !$sys_user_logged_in) {
129 129
   // sn_setcookie(SN_COOKIE, '', time() - PERIOD_WEEK, SN_ROOT_RELATIVE);
130
-  sys_redirect(SN_ROOT_VIRTUAL . 'login.php');
130
+  sys_redirect(SN_ROOT_VIRTUAL.'login.php');
131 131
 }
132 132
 
133 133
 $user_time_diff = playerTimeDiff::user_time_diff_get();
@@ -146,16 +146,16 @@  discard block
 block discarded – undo
146 146
 
147 147
 global $skip_fleet_update;
148 148
 $skip_fleet_update = $skip_fleet_update || $supernova->options['fleet_update_skip'] || defined('IN_ADMIN');
149
-if(
149
+if (
150 150
   !$skip_fleet_update
151 151
   && !(defined('IN_AJAX') && IN_AJAX === true)
152 152
   && SN_TIME_NOW - strtotime(classSupernova::$config->fleet_update_last) > classSupernova::$config->fleet_update_interval
153 153
 ) {
154
-  require_once(SN_ROOT_PHYSICAL . "includes/includes/flt_flying_fleet_handler2" . DOT_PHP_EX);
154
+  require_once(SN_ROOT_PHYSICAL."includes/includes/flt_flying_fleet_handler2".DOT_PHP_EX);
155 155
   flt_flying_fleet_handler($skip_fleet_update);
156 156
 }
157 157
 
158
-if(!defined('IN_AJAX')) {
158
+if (!defined('IN_AJAX')) {
159 159
   print("Scheduled processes is disabled<br />");
160 160
 }
161 161
 // scheduler_process();
Please login to merge, or discard this patch.
includes/vars_menu.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -104,21 +104,21 @@  discard block
 block discarded – undo
104 104
     'LEVEL' => 'submenu',
105 105
     'TYPE'  => 'lang',
106 106
     'ITEM'  => 'tech[UNIT_STRUCTURES]',
107
-    'LINK'  => 'buildings.php?mode=' . QUE_STRUCTURES,
107
+    'LINK'  => 'buildings.php?mode='.QUE_STRUCTURES,
108 108
     'ICON'  => true,
109 109
   ),
110 110
   'menu_planet_shipyard'   => array(
111 111
     'LEVEL' => 'submenu',
112 112
     'TYPE'  => 'lang',
113 113
     'ITEM'  => 'Shipyard',
114
-    'LINK'  => 'buildings.php?mode=' . SUBQUE_FLEET,
114
+    'LINK'  => 'buildings.php?mode='.SUBQUE_FLEET,
115 115
     'ICON'  => true,
116 116
   ),
117 117
   'menu_planet_defense'    => array(
118 118
     'LEVEL' => 'submenu',
119 119
     'TYPE'  => 'lang',
120 120
     'ITEM'  => 'Defense',
121
-    'LINK'  => 'buildings.php?mode=' . SUBQUE_DEFENSE,
121
+    'LINK'  => 'buildings.php?mode='.SUBQUE_DEFENSE,
122 122
     'ICON'  => true,
123 123
   ),
124 124
   'menu_planet_resources'  => array(
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     'LEVEL' => 'submenu',
148 148
     'TYPE'  => 'lang',
149 149
     'ITEM'  => 'Research',
150
-    'LINK'  => 'buildings.php?mode=' . QUE_RESEARCH,
150
+    'LINK'  => 'buildings.php?mode='.QUE_RESEARCH,
151 151
     'ICON'  => true,
152 152
   ),
153 153
   'menu_empire_techtree' => array(
@@ -233,14 +233,14 @@  discard block
 block discarded – undo
233 233
     'LEVEL' => 'submenu',
234 234
     'TYPE'  => 'lang',
235 235
     'ITEM'  => 'tech[UNIT_MERCENARIES]',
236
-    'LINK'  => 'officer.php?mode=' . UNIT_MERCENARIES,
236
+    'LINK'  => 'officer.php?mode='.UNIT_MERCENARIES,
237 237
     'ICON'  => true,
238 238
   ),
239 239
   'menu_empire_schematics'  => array(
240 240
     'LEVEL' => 'submenu',
241 241
     'TYPE'  => 'lang',
242 242
     'ITEM'  => 'tech[UNIT_PLANS]',
243
-    'LINK'  => 'officer.php?mode=' . UNIT_PLANS,
243
+    'LINK'  => 'officer.php?mode='.UNIT_PLANS,
244 244
     'ICON'  => true,
245 245
   ),
246 246
   'menu_empire_artifacts'   => array(
@@ -270,14 +270,14 @@  discard block
 block discarded – undo
270 270
     'LEVEL' => 'submenu',
271 271
     'TYPE'  => 'lang',
272 272
     'ITEM'  => 'Chat',
273
-    'LINK'  => 'index.php?page=chat&mode=' . CHAT_MODE_COMMON,
273
+    'LINK'  => 'index.php?page=chat&mode='.CHAT_MODE_COMMON,
274 274
     'ICON'  => true,
275 275
   ),
276 276
   'menu_ally_chat'     => array(
277 277
     'LEVEL'    => 'submenu',
278 278
     'TYPE'     => 'lang',
279 279
     'ITEM'     => 'AllyChat',
280
-    'LINK'     => 'index.php?page=chat&mode=' . CHAT_MODE_ALLY,
280
+    'LINK'     => 'index.php?page=chat&mode='.CHAT_MODE_ALLY,
281 281
     'ICON'     => true,
282 282
     'DISABLED' => classSupernova::$config->game_mode == GAME_BLITZ,
283 283
   ),
@@ -458,8 +458,8 @@  discard block
 block discarded – undo
458 458
   ),
459 459
   'menu_admin_version_info'  => array(
460 460
     'TYPE' => 'text',
461
-    'ITEM' => (classSupernova::$config->server_updater_check_last ? date(FMT_DATE, classSupernova::$config->server_updater_check_last) : '') . '<div class="' .
462
-      $sn_version_check_class[classSupernova::$config->server_updater_check_result] . '">' . classLocale::$lang['adm_opt_ver_response_short'][classSupernova::$config->server_updater_check_result] . '</div>',
461
+    'ITEM' => (classSupernova::$config->server_updater_check_last ? date(FMT_DATE, classSupernova::$config->server_updater_check_last) : '').'<div class="'.
462
+      $sn_version_check_class[classSupernova::$config->server_updater_check_result].'">'.classLocale::$lang['adm_opt_ver_response_short'][classSupernova::$config->server_updater_check_result].'</div>',
463 463
   ),
464 464
 
465 465
   'USER_AUTHLEVEL_NAME'      => array(
@@ -547,13 +547,13 @@  discard block
 block discarded – undo
547 547
   'menu_admin_planet_list_planets' => array(
548 548
     'TYPE'       => 'lang',
549 549
     'ITEM'       => 'adm_pltlst',
550
-    'LINK'       => 'admin/adm_planet_list.php?planet_type=' . PT_PLANET,
550
+    'LINK'       => 'admin/adm_planet_list.php?planet_type='.PT_PLANET,
551 551
     'AUTH_LEVEL' => 3,
552 552
   ),
553 553
   'menu_admin_planet_list_moons'   => array(
554 554
     'TYPE'       => 'lang',
555 555
     'ITEM'       => 'adm_moonlst',
556
-    'LINK'       => 'admin/adm_planet_list.php?planet_type=' . PT_MOON,
556
+    'LINK'       => 'admin/adm_planet_list.php?planet_type='.PT_MOON,
557 557
     'AUTH_LEVEL' => 3,
558 558
   ),
559 559
   'menu_admin_planet_moon_add'     => array(
Please login to merge, or discard this patch.
includes/init.php 1 patch
Spacing   +56 added lines, -56 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
 
@@ -20,22 +20,22 @@  discard block
 block discarded – undo
20 20
 version_compare(PHP_VERSION, '5.3.2') < 0 ? die('FATAL ERROR: SuperNova REQUIRE PHP version > 5.3.2') : false;
21 21
 
22 22
 // Бенчмарк
23
-register_shutdown_function(function () {
24
-  if(defined('IN_AJAX')) {
23
+register_shutdown_function(function() {
24
+  if (defined('IN_AJAX')) {
25 25
     return;
26 26
   }
27 27
 
28 28
   global $user, $locale_cache_statistic;
29 29
 
30
-  print('<hr><div class="benchmark">Benchmark ' . (microtime(true) - SN_TIME_MICRO) . 's, memory: ' . number_format(memory_get_usage() - SN_MEM_START) .
31
-    (!empty($locale_cache_statistic['misses']) ? ', LOCALE MISSED' : '') .
32
-    (class_exists('classSupernova') && is_object(classSupernova::$db) ? ', DB time: ' . classSupernova::$db->time_mysql_total . 'ms' : '') .
30
+  print('<hr><div class="benchmark">Benchmark '.(microtime(true) - SN_TIME_MICRO).'s, memory: '.number_format(memory_get_usage() - SN_MEM_START).
31
+    (!empty($locale_cache_statistic['misses']) ? ', LOCALE MISSED' : '').
32
+    (class_exists('classSupernova') && is_object(classSupernova::$db) ? ', DB time: '.classSupernova::$db->time_mysql_total.'ms' : '').
33 33
     '</div>');
34
-  if($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL . 'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL . 'badqrys.txt') > 0) {
34
+  if ($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL.'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL.'badqrys.txt') > 0) {
35 35
     echo '<a href="badqrys.txt" target="_blank" style="color:red">', 'HACK ALERT!', '</a>';
36 36
   }
37 37
 
38
-  if(!empty($locale_cache_statistic['misses'])) {
38
+  if (!empty($locale_cache_statistic['misses'])) {
39 39
     print('<!--');
40 40
     pdump($locale_cache_statistic);
41 41
     print('-->');
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 
56 56
 define('SN_TIME_NOW_GMT_STRING', gmdate(DATE_ATOM, SN_TIME_NOW));
57 57
 
58
-if(strpos(strtolower($_SERVER['SERVER_NAME']), 'google.') !== false) {
58
+if (strpos(strtolower($_SERVER['SERVER_NAME']), 'google.') !== false) {
59 59
   define('SN_GOOGLE', true);
60 60
 }
61 61
 
@@ -74,12 +74,12 @@  discard block
 block discarded – undo
74 74
 $sn_root_relative = str_replace($sn_root_relative, '', $_SERVER['SCRIPT_NAME']);
75 75
 define('SN_ROOT_RELATIVE', $sn_root_relative);
76 76
 
77
-define('SN_ROOT_VIRTUAL', 'http' . (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . SN_ROOT_RELATIVE);
77
+define('SN_ROOT_VIRTUAL', 'http'.(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '').'://'.$_SERVER['HTTP_HOST'].SN_ROOT_RELATIVE);
78 78
 define('SN_ROOT_VIRTUAL_PARENT', str_replace('//google.', '//', SN_ROOT_VIRTUAL));
79 79
 
80 80
 $phpEx = strpos($phpEx = substr(strrchr(__FILE__, '.'), 1), '/') === false ? $phpEx : '';
81 81
 define('PHP_EX', $phpEx); // PHP extension on this server
82
-define('DOT_PHP_EX', '.' . PHP_EX); // PHP extension on this server
82
+define('DOT_PHP_EX', '.'.PHP_EX); // PHP extension on this server
83 83
 
84 84
 
85 85
 require_once('constants.php');
@@ -100,22 +100,22 @@  discard block
 block discarded – undo
100 100
 
101 101
 // required for db.php
102 102
 // Initializing global 'debug' object
103
-require_once(SN_ROOT_PHYSICAL . "includes/debug.class" . DOT_PHP_EX);
103
+require_once(SN_ROOT_PHYSICAL."includes/debug.class".DOT_PHP_EX);
104 104
 classSupernova::$debug = new debug();
105 105
 
106
-spl_autoload_register(function ($class) {
107
-  if(file_exists(SN_ROOT_PHYSICAL . 'includes/classes/' . $class . '.php')) {
108
-    require_once SN_ROOT_PHYSICAL . 'includes/classes/' . $class . '.php';
106
+spl_autoload_register(function($class) {
107
+  if (file_exists(SN_ROOT_PHYSICAL.'includes/classes/'.$class.'.php')) {
108
+    require_once SN_ROOT_PHYSICAL.'includes/classes/'.$class.'.php';
109 109
   }
110 110
 });
111 111
 
112
-spl_autoload_register(function ($class) {
113
-  if(file_exists(SN_ROOT_PHYSICAL . 'includes/classes/UBE/' . $class . '.php')) {
114
-    require_once SN_ROOT_PHYSICAL . 'includes/classes/UBE/' . $class . '.php';
112
+spl_autoload_register(function($class) {
113
+  if (file_exists(SN_ROOT_PHYSICAL.'includes/classes/UBE/'.$class.'.php')) {
114
+    require_once SN_ROOT_PHYSICAL.'includes/classes/UBE/'.$class.'.php';
115 115
   }
116 116
 });
117 117
 
118
-require_once(SN_ROOT_PHYSICAL . "includes/db" . DOT_PHP_EX);
118
+require_once(SN_ROOT_PHYSICAL."includes/db".DOT_PHP_EX);
119 119
 require_once('classes/db_mysql_v4.php');
120 120
 require_once('classes/db_mysql_v5.php');
121 121
 require_once('classes/db_mysql.php');
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 require_once('classes/module.php');
129 129
 
130 130
 require_once('classes/user_options.php');
131
-require_once(SN_ROOT_PHYSICAL . "includes/init/init_functions" . DOT_PHP_EX);
131
+require_once(SN_ROOT_PHYSICAL."includes/init/init_functions".DOT_PHP_EX);
132 132
 
133 133
 /**
134 134
  * @var classConfig    $config
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
 // define('BE_DEBUG', true); // Отладка боевого движка
143 143
 classSupernova::init_debug_state();
144 144
 
145
-require_once(SN_ROOT_PHYSICAL . "includes/vars" . DOT_PHP_EX);
146
-require_once(SN_ROOT_PHYSICAL . "includes/general" . DOT_PHP_EX);
145
+require_once(SN_ROOT_PHYSICAL."includes/vars".DOT_PHP_EX);
146
+require_once(SN_ROOT_PHYSICAL."includes/general".DOT_PHP_EX);
147 147
 
148 148
 init_update();
149 149
 
@@ -152,34 +152,34 @@  discard block
 block discarded – undo
152 152
   ? trim(strip_tags($_GET['page']))
153 153
   : str_replace(DOT_PHP_EX, '', str_replace(SN_ROOT_RELATIVE, '', str_replace('\\', '/', $_SERVER['SCRIPT_NAME'])));
154 154
 define('INITIAL_PAGE', $sn_page_name_original);
155
-define('SN_COOKIE', (classSupernova::$config->COOKIE_NAME ? classSupernova::$config->COOKIE_NAME : 'SuperNova') . (defined('SN_GOOGLE') ? '_G' : ''));
156
-define('SN_COOKIE_I', SN_COOKIE . AUTH_COOKIE_IMPERSONATE_SUFFIX);
157
-define('SN_COOKIE_D', SN_COOKIE . '_D');
158
-define('SN_COOKIE_T', SN_COOKIE . '_T'); // Time measure cookie
159
-define('SN_COOKIE_F', SN_COOKIE . '_F'); // Font size cookie
160
-define('SN_COOKIE_U', SN_COOKIE . '_U'); // Current user cookie aka user ID
161
-define('SN_COOKIE_U_I', SN_COOKIE_U . AUTH_COOKIE_IMPERSONATE_SUFFIX); // Current impersonator user cookie aka impersonator user ID
155
+define('SN_COOKIE', (classSupernova::$config->COOKIE_NAME ? classSupernova::$config->COOKIE_NAME : 'SuperNova').(defined('SN_GOOGLE') ? '_G' : ''));
156
+define('SN_COOKIE_I', SN_COOKIE.AUTH_COOKIE_IMPERSONATE_SUFFIX);
157
+define('SN_COOKIE_D', SN_COOKIE.'_D');
158
+define('SN_COOKIE_T', SN_COOKIE.'_T'); // Time measure cookie
159
+define('SN_COOKIE_F', SN_COOKIE.'_F'); // Font size cookie
160
+define('SN_COOKIE_U', SN_COOKIE.'_U'); // Current user cookie aka user ID
161
+define('SN_COOKIE_U_I', SN_COOKIE_U.AUTH_COOKIE_IMPERSONATE_SUFFIX); // Current impersonator user cookie aka impersonator user ID
162 162
 define('TEMPLATE_NAME', classSupernova::$config->game_default_template ? classSupernova::$config->game_default_template : 'OpenGame');
163
-define('TEMPLATE_PATH', 'design/templates/' . TEMPLATE_NAME);
164
-define('TEMPLATE_DIR', SN_ROOT_PHYSICAL . TEMPLATE_PATH);
163
+define('TEMPLATE_PATH', 'design/templates/'.TEMPLATE_NAME);
164
+define('TEMPLATE_DIR', SN_ROOT_PHYSICAL.TEMPLATE_PATH);
165 165
 define('DEFAULT_SKINPATH', classSupernova::$config->game_default_skin ? classSupernova::$config->game_default_skin : 'skins/EpicBlue/');
166 166
 define('DEFAULT_LANG', classSupernova::$config->game_default_language ? classSupernova::$config->game_default_language : 'ru');
167 167
 define('FMT_DATE', classSupernova::$config->int_format_date ? classSupernova::$config->int_format_date : 'd.m.Y');
168 168
 define('FMT_TIME', classSupernova::$config->int_format_time ? classSupernova::$config->int_format_time : 'H:i:s');
169
-define('FMT_DATE_TIME', FMT_DATE . ' ' . FMT_TIME);
169
+define('FMT_DATE_TIME', FMT_DATE.' '.FMT_TIME);
170 170
 
171 171
 $HTTP_ACCEPT_LANGUAGE = DEFAULT_LANG;
172 172
 
173
-require_once(SN_ROOT_PHYSICAL . "includes/template" . DOT_PHP_EX);
173
+require_once(SN_ROOT_PHYSICAL."includes/template".DOT_PHP_EX);
174 174
 $template_result = array('.' => array('result' => array()));
175 175
 
176
-sn_sys_load_php_files(SN_ROOT_PHYSICAL . "includes/functions/", PHP_EX);
176
+sn_sys_load_php_files(SN_ROOT_PHYSICAL."includes/functions/", PHP_EX);
177 177
 
178
-spl_autoload_register(function ($class) {
179
-  if(file_exists('includes/classes/' . $class . '.php')) {
180
-    require_once 'includes/classes/' . $class . '.php';
181
-  } elseif(file_exists('includes/classes/UBE/' . $class . '.php')) {
182
-    require_once 'includes/classes/UBE/' . $class . '.php';
178
+spl_autoload_register(function($class) {
179
+  if (file_exists('includes/classes/'.$class.'.php')) {
180
+    require_once 'includes/classes/'.$class.'.php';
181
+  } elseif (file_exists('includes/classes/UBE/'.$class.'.php')) {
182
+    require_once 'includes/classes/UBE/'.$class.'.php';
183 183
   } else {
184 184
 //    die("Can't find {$class} class");
185 185
   }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 // Конфиг - часть манифеста?
194 194
 classSupernova::$auth = new core_auth();
195 195
 
196
-sn_sys_load_php_files(SN_ROOT_PHYSICAL . "modules/", PHP_EX, true);
196
+sn_sys_load_php_files(SN_ROOT_PHYSICAL."modules/", PHP_EX, true);
197 197
 // Здесь - потому что core_auth модуль лежит в другом каталоге и его нужно инициализировать отдельно
198 198
 
199 199
 // Подключаем дефолтную страницу
@@ -201,10 +201,10 @@  discard block
 block discarded – undo
201 201
 // Сейчас мы делаем это здесь только для того, что бы содержание дефолтной страницы оказалось вверху. Что не факт, что нужно всегда
202 202
 // Но нужно, пока у нас есть не MVC-страницы
203 203
 $sn_page_data = $sn_data['pages'][$sn_page_name];
204
-$sn_page_name_file = 'includes/pages/' . $sn_page_data['filename'] . DOT_PHP_EX;
205
-if($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) {
204
+$sn_page_name_file = 'includes/pages/'.$sn_page_data['filename'].DOT_PHP_EX;
205
+if ($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) {
206 206
   require_once($sn_page_name_file);
207
-  if(is_array($sn_page_data['options'])) {
207
+  if (is_array($sn_page_data['options'])) {
208 208
     $supernova->options = array_merge($supernova->options, $sn_page_data['options']);
209 209
   }
210 210
 }
@@ -219,10 +219,10 @@  discard block
 block discarded – undo
219 219
 $load_order = array();
220 220
 $sn_req = array();
221 221
 
222
-foreach(sn_module::$sn_module as $loaded_module_name => $module_data) {
222
+foreach (sn_module::$sn_module as $loaded_module_name => $module_data) {
223 223
   $load_order[$loaded_module_name] = isset($module_data->manifest['load_order']) && !empty($module_data->manifest['load_order']) ? $module_data->manifest['load_order'] : 100000;
224
-  if(isset($module_data->manifest['require']) && !empty($module_data->manifest['require'])) {
225
-    foreach($module_data->manifest['require'] as $require_name) {
224
+  if (isset($module_data->manifest['require']) && !empty($module_data->manifest['require'])) {
225
+    foreach ($module_data->manifest['require'] as $require_name) {
226 226
       $sn_req[$loaded_module_name][$require_name] = 0;
227 227
     }
228 228
   }
@@ -235,10 +235,10 @@  discard block
 block discarded – undo
235 235
 do {
236 236
   $prev_order = $load_order;
237 237
 
238
-  foreach($sn_req as $loaded_module_name => &$req_data) {
238
+  foreach ($sn_req as $loaded_module_name => &$req_data) {
239 239
     $level = 1;
240
-    foreach($req_data as $req_name => &$req_level) {
241
-      if($load_order[$req_name] == -1 || !isset($load_order[$req_name])) {
240
+    foreach ($req_data as $req_name => &$req_level) {
241
+      if ($load_order[$req_name] == -1 || !isset($load_order[$req_name])) {
242 242
         $level = $req_level = -1;
243 243
         break;
244 244
       } else {
@@ -246,20 +246,20 @@  discard block
 block discarded – undo
246 246
       }
247 247
       $req_level = $load_order[$req_name];
248 248
     }
249
-    if($level > $load_order[$loaded_module_name] || $level == -1) {
249
+    if ($level > $load_order[$loaded_module_name] || $level == -1) {
250 250
       $load_order[$loaded_module_name] = $level;
251 251
     }
252 252
   }
253
-} while($prev_order != $load_order);
253
+} while ($prev_order != $load_order);
254 254
 
255 255
 asort($load_order);
256 256
 
257 257
 // Инициализируем модули
258 258
 // По нормальным делам это должна быть загрузка модулей и лишь затем инициализация - что бы минимизировать размер процесса в памяти
259
-foreach($load_order as $loaded_module_name => $load_order_order) {
260
-  if($load_order_order >= 0) {
259
+foreach ($load_order as $loaded_module_name => $load_order_order) {
260
+  if ($load_order_order >= 0) {
261 261
     sn_module::$sn_module[$loaded_module_name]->check_status();
262
-    if(!sn_module::$sn_module[$loaded_module_name]->manifest['active']) {
262
+    if (!sn_module::$sn_module[$loaded_module_name]->manifest['active']) {
263 263
       unset(sn_module::$sn_module[$loaded_module_name]);
264 264
       continue;
265 265
     }
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 unset($sn_req);
277 277
 
278 278
 // А теперь проверяем - поддерживают ли у нас загруженный код такую страницу
279
-if(!isset($sn_data['pages'][$sn_page_name])) {
279
+if (!isset($sn_data['pages'][$sn_page_name])) {
280 280
   $sn_page_name = '';
281 281
 }
282 282
 
@@ -284,6 +284,6 @@  discard block
 block discarded – undo
284 284
 classLocale::$lang = $lang = new classLocale(classSupernova::$config->server_locale_log_usage);
285 285
 classLocale::$lang->lng_switch(sys_get_param_str('lang'));
286 286
 
287
-if(!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) {
287
+if (!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) {
288 288
   require_once "init_secondary.php";
289 289
 }
Please login to merge, or discard this patch.
includes/general_pname.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@
 block discarded – undo
4 4
 
5 5
 function pname_factory_production_field_name($factory_unit_id)
6 6
 {
7
-  return get_unit_param($factory_unit_id, P_NAME) . '_porcent';
7
+  return get_unit_param($factory_unit_id, P_NAME).'_porcent';
8 8
 }
9 9
 
10 10
 /**
Please login to merge, or discard this patch.
includes/includes/ube_zi_helpers.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
   print($round);
28 28
   print('<table border=1>');
29 29
   print('<tr align="left">');
30
-  foreach($header as $key => $value)
30
+  foreach ($header as $key => $value)
31 31
   {
32
-    if(is_array($value))
32
+    if (is_array($value))
33 33
     {
34 34
       continue;
35 35
     }
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
   );
62 62
 
63 63
   print('<tr align="right">');
64
-  foreach($unit_crossfire_result as $key => $value)
64
+  foreach ($unit_crossfire_result as $key => $value)
65 65
   {
66
-    if(is_array($value))
66
+    if (is_array($value))
67 67
     {
68 68
       continue;
69 69
     }
Please login to merge, or discard this patch.
includes/includes/flt_mission_colonize.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,14 +20,14 @@  discard block
 block discarded – undo
20 20
   $TargetAddress = sprintf(classLocale::$lang['sys_adress_planet'], $fleet_end_coordinates['galaxy'], $fleet_end_coordinates['system'], $fleet_end_coordinates['planet']);
21 21
 
22 22
   $TheMessage = classLocale::$lang['sys_colo_no_colonizer'];
23
-  if($objFleet->shipsGetTotalById(SHIP_COLONIZER) >= 1) {
23
+  if ($objFleet->shipsGetTotalById(SHIP_COLONIZER) >= 1) {
24 24
     $TheMessage = classLocale::$lang['sys_colo_notfree'];
25
-    if(empty($mission_data->dst_planet)) {
25
+    if (empty($mission_data->dst_planet)) {
26 26
       $iPlanetCount = get_player_current_colonies($src_user_row);
27 27
 
28 28
       // Can we colonize more planets?
29 29
       $TheMessage = classLocale::$lang['sys_colo_maxcolo'];
30
-      if($iPlanetCount < get_player_max_colonies($src_user_row)) {
30
+      if ($iPlanetCount < get_player_max_colonies($src_user_row)) {
31 31
         // Yes, we can colonize
32 32
         $TheMessage = classLocale::$lang['sys_colo_badpos'];
33 33
 
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
           $fleet_end_coordinates['galaxy'], $fleet_end_coordinates['system'], $fleet_end_coordinates['planet'],
36 36
           $objFleet->playerOwnerId, "{$classLocale['sys_colo_defaultname']} {$iPlanetCount}", false,
37 37
           array('user_row' => $src_user_row));
38
-        if($NewOwnerPlanet) {
39
-          $TheMessage = classLocale::$lang['sys_colo_arrival'] . $TargetAddress . classLocale::$lang['sys_colo_allisok'];
38
+        if ($NewOwnerPlanet) {
39
+          $TheMessage = classLocale::$lang['sys_colo_arrival'].$TargetAddress.classLocale::$lang['sys_colo_allisok'];
40 40
           msg_send_simple_message($objFleet->playerOwnerId, '', $objFleet->time_arrive_to_target, MSG_TYPE_SPY, classLocale::$lang['sys_colo_mess_from'], classLocale::$lang['sys_colo_mess_report'], $TheMessage);
41 41
 
42 42
           $objFleet->shipAdjustCount(SHIP_COLONIZER, -1);
Please login to merge, or discard this patch.