Completed
Push — trunk ( 0d0bfe...e6cc80 )
by SuperNova.WS
03:47
created
includes/pages/options.php 1 patch
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 
12 12
   $language_new = sys_get_param_str('langer', $user['lang']);
13 13
 
14
-  if($language_new != $user['lang']) {
14
+  if ($language_new != $user['lang']) {
15 15
     $lang->lng_switch($language_new);
16 16
   }
17 17
 
@@ -20,35 +20,35 @@  discard block
 block discarded – undo
20 20
 
21 21
   $FMT_DATE = preg_replace(array('/d/', '/m/', '/Y/'), array('DD', 'MM', 'YYYY'), FMT_DATE);
22 22
 
23
-  if(sys_get_param_str('mode') == 'change') {
24
-    if($user['authlevel'] > 0) {
23
+  if (sys_get_param_str('mode') == 'change') {
24
+    if ($user['authlevel'] > 0) {
25 25
       $planet_protection = sys_get_param_int('adm_pl_prot') ? $user['authlevel'] : 0;
26 26
       DBStaticPlanet::db_planet_set_by_owner($user['id'], "`id_level` = '{$planet_protection}'");
27 27
       db_user_set_by_id($user['id'], "`admin_protection` = '{$planet_protection}'");
28 28
       $user['admin_protection'] = $planet_protection;
29 29
     }
30 30
 
31
-    if(sys_get_param_int('vacation') && !$config->user_vacation_disable) {
31
+    if (sys_get_param_int('vacation') && !$config->user_vacation_disable) {
32 32
       sn_db_transaction_start();
33
-      if($user['authlevel'] < 3) {
34
-        if($user['vacation_next'] > SN_TIME_NOW) {
33
+      if ($user['authlevel'] < 3) {
34
+        if ($user['vacation_next'] > SN_TIME_NOW) {
35 35
           messageBox($lang['opt_vacation_err_timeout'], $lang['Error'], 'index.php?page=options', 5);
36 36
           die();
37 37
         }
38 38
 
39
-        if(fleet_count_flying($user['id'])) {
39
+        if (fleet_count_flying($user['id'])) {
40 40
           messageBox($lang['opt_vacation_err_your_fleet'], $lang['Error'], 'index.php?page=options', 5);
41 41
           die();
42 42
         }
43 43
 
44 44
         $que = que_get($user['id'], false);
45
-        if(!empty($que)) {
45
+        if (!empty($que)) {
46 46
           messageBox($lang['opt_vacation_err_que'], $lang['Error'], 'index.php?page=options', 5);
47 47
           die();
48 48
         }
49 49
 
50 50
         $query = classSupernova::db_get_record_list(LOC_PLANET, "`id_owner` = {$user['id']}");
51
-        foreach($query as $planet) {
51
+        foreach ($query as $planet) {
52 52
           DBStaticPlanet::db_planet_set_by_id($planet['id'],
53 53
             "last_update = " . SN_TIME_NOW . ", energy_used = '0', energy_max = '0',
54 54
             metal_perhour = '{$config->metal_basic_income}', crystal_perhour = '{$config->crystal_basic_income}', deuterium_perhour = '{$config->deuterium_basic_income}',
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
       sn_db_transaction_commit();
64 64
     }
65 65
 
66
-    foreach($user_option_list as $option_group_id => $option_group) {
67
-      foreach($option_group as $option_name => $option_value) {
68
-        if($user[$option_name] !== null) {
66
+    foreach ($user_option_list as $option_group_id => $option_group) {
67
+      foreach ($option_group as $option_name => $option_value) {
68
+        if ($user[$option_name] !== null) {
69 69
           $user[$option_name] = sys_get_param_str($option_name);
70 70
         } else {
71 71
           $user[$option_name] = $option_value;
@@ -76,12 +76,12 @@  discard block
 block discarded – undo
76 76
 
77 77
 
78 78
     $player_options = sys_get_param('options');
79
-    if(!empty($player_options)) {
80
-      if($player_options[PLAYER_OPTION_TUTORIAL_CURRENT] == classSupernova::$config->tutorial_first_item) {
79
+    if (!empty($player_options)) {
80
+      if ($player_options[PLAYER_OPTION_TUTORIAL_CURRENT] == classSupernova::$config->tutorial_first_item) {
81 81
         $player_options[PLAYER_OPTION_TUTORIAL_FINISHED] = 0;
82 82
       }
83 83
 
84
-      array_walk($player_options, function (&$value) {
84
+      array_walk($player_options, function(&$value) {
85 85
         // TODO - Когда будет больше параметров - сделать больше проверок
86 86
         $value = intval($value);
87 87
       });
@@ -90,15 +90,15 @@  discard block
 block discarded – undo
90 90
 
91 91
     $username = substr(sys_get_param_str_unsafe('username'), 0, 32);
92 92
     $username_safe = db_escape($username);
93
-    if($username && $user['username'] != $username && $config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_NONE && sys_get_param_int('username_confirm') && !strpbrk($username, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) {
93
+    if ($username && $user['username'] != $username && $config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_NONE && sys_get_param_int('username_confirm') && !strpbrk($username, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) {
94 94
       // проверка на корректность
95 95
       sn_db_transaction_start();
96 96
       $name_check = doquery("SELECT * FROM `{{player_name_history}}` WHERE `player_name` LIKE \"{$username_safe}\" LIMIT 1 FOR UPDATE;", true);
97
-      if(!$name_check || $name_check['player_id'] == $user['id']) {
97
+      if (!$name_check || $name_check['player_id'] == $user['id']) {
98 98
         $user = db_user_by_id($user['id'], true);
99
-        switch($config->game_user_changename) {
99
+        switch ($config->game_user_changename) {
100 100
           case SERVER_PLAYER_NAME_CHANGE_PAY:
101
-            if(mrc_get_level($user, [], RES_DARK_MATTER) < $config->game_user_changename_cost) {
101
+            if (mrc_get_level($user, [], RES_DARK_MATTER) < $config->game_user_changename_cost) {
102 102
               $template_result['.']['result'][] = array(
103 103
                 'STATUS'  => ERR_ERROR,
104 104
                 'MESSAGE' => $lang['opt_msg_name_change_err_no_dm'],
@@ -128,18 +128,18 @@  discard block
 block discarded – undo
128 128
       sn_db_transaction_commit();
129 129
     }
130 130
 
131
-    if($new_password = sys_get_param('newpass1')) {
131
+    if ($new_password = sys_get_param('newpass1')) {
132 132
       try {
133
-        if($new_password != sys_get_param('newpass2')) {
133
+        if ($new_password != sys_get_param('newpass2')) {
134 134
           throw new Exception($lang['opt_err_pass_unmatched'], ERR_WARNING);
135 135
         }
136 136
 
137
-        if(!classSupernova::$auth->password_change(sys_get_param('db_password'), $new_password)) {
137
+        if (!classSupernova::$auth->password_change(sys_get_param('db_password'), $new_password)) {
138 138
           throw new Exception($lang['opt_err_pass_wrong'], ERR_WARNING);
139 139
         }
140 140
 
141 141
         throw new Exception($lang['opt_msg_pass_changed'], ERR_NONE);
142
-      } catch(Exception $e) {
142
+      } catch (Exception $e) {
143 143
         $template_result['.']['result'][] = array(
144 144
           'STATUS'  => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR,
145 145
           'MESSAGE' => $e->getMessage()
@@ -160,12 +160,12 @@  discard block
 block discarded – undo
160 160
     $user['gender'] = $user['gender'] == GENDER_UNKNOWN ? $gender : $user['gender'];
161 161
 
162 162
     try {
163
-      if($user['birthday']) {
163
+      if ($user['birthday']) {
164 164
         throw new exception();
165 165
       }
166 166
 
167 167
       $user_birthday = sys_get_param_str_unsafe('user_birthday');
168
-      if(!$user_birthday || $user_birthday == $FMT_DATE) {
168
+      if (!$user_birthday || $user_birthday == $FMT_DATE) {
169 169
         throw new exception();
170 170
       }
171 171
 
@@ -175,16 +175,16 @@  discard block
 block discarded – undo
175 175
       $pos['Y'] = strpos(FMT_DATE, 'Y');
176 176
       asort($pos);
177 177
       $i = 0;
178
-      foreach($pos as &$position) {
178
+      foreach ($pos as &$position) {
179 179
         $position = ++$i;
180 180
       }
181 181
 
182 182
       $regexp = "/" . preg_replace(array('/\\\\/', '/\//', '/\./', '/\-/', '/d/', '/m/', '/Y/'), array('\\\\\\', '\/', '\.', '\-', '(\d?\d)', '(\d?\d)', '(\d{4})'), FMT_DATE) . "/";
183
-      if(!preg_match($regexp, $user_birthday, $match)) {
183
+      if (!preg_match($regexp, $user_birthday, $match)) {
184 184
         throw new exception();
185 185
       }
186 186
 
187
-      if(!checkdate($match[$pos['m']], $match[$pos['d']], $match[$pos['Y']])) {
187
+      if (!checkdate($match[$pos['m']], $match[$pos['d']], $match[$pos['Y']])) {
188 188
         throw new exception();
189 189
       }
190 190
 
@@ -192,13 +192,13 @@  discard block
 block discarded – undo
192 192
       // EOF black magic! Now we have valid SQL date in $user['user_birthday'] - independent of date format
193 193
 
194 194
       $year = date('Y', SN_TIME_NOW);
195
-      if(mktime(0, 0, 0, $match[$pos['m']], $match[$pos['d']], $year) > SN_TIME_NOW) {
195
+      if (mktime(0, 0, 0, $match[$pos['m']], $match[$pos['d']], $year) > SN_TIME_NOW) {
196 196
         $year--;
197 197
       }
198 198
       $user['user_birthday_celebrated'] = db_escape("{$year}-{$match[$pos['m']]}-{$match[$pos['d']]}");
199 199
 
200 200
       $user_birthday = ", `user_birthday` = '{$user['user_birthday']}', `user_birthday_celebrated` = '{$user['user_birthday_celebrated']}'";
201
-    } catch(exception $e) {
201
+    } catch (exception $e) {
202 202
       $user_birthday = '';
203 203
     }
204 204
 
@@ -208,14 +208,14 @@  discard block
 block discarded – undo
208 208
     $template_result['.']['result'][] = $avatar_upload_result;
209 209
 
210 210
     $user_time_diff = playerTimeDiff::user_time_diff_get();
211
-    if(sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED')) {
211
+    if (sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED')) {
212 212
       playerTimeDiff::user_time_diff_set(array(
213 213
         PLAYER_OPTION_TIME_DIFF              => sys_get_param_int('PLAYER_OPTION_TIME_DIFF'),
214 214
         PLAYER_OPTION_TIME_DIFF_UTC_OFFSET   => 0,
215 215
         PLAYER_OPTION_TIME_DIFF_FORCED       => 1,
216 216
         PLAYER_OPTION_TIME_DIFF_MEASURE_TIME => SN_TIME_SQL,
217 217
       ));
218
-    } elseif(sys_get_param_int('opt_time_diff_clear') || $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) {
218
+    } elseif (sys_get_param_int('opt_time_diff_clear') || $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) {
219 219
       playerTimeDiff::user_time_diff_set(array(
220 220
         PLAYER_OPTION_TIME_DIFF              => '',
221 221
         PLAYER_OPTION_TIME_DIFF_UTC_OFFSET   => 0,
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
       'STATUS'  => ERR_NONE,
236 236
       'MESSAGE' => $lang['opt_msg_saved']
237 237
     );
238
-  } elseif(sys_get_param_str('result') == 'ok') {
238
+  } elseif (sys_get_param_str('result') == 'ok') {
239 239
     $template_result['.']['result'][] = array(
240 240
       'STATUS'  => ERR_NONE,
241 241
       'MESSAGE' => $lang['opt_msg_saved']
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
   $template = gettemplate('options', $template);
259 259
 
260 260
   $dir = dir(SN_ROOT_PHYSICAL . 'skins');
261
-  while(($entry = $dir->read()) !== false) {
262
-    if(is_dir("skins/{$entry}") && $entry[0] != '.') {
261
+  while (($entry = $dir->read()) !== false) {
262
+    if (is_dir("skins/{$entry}") && $entry[0] != '.') {
263 263
       $template_result['.']['skin_list'][] = array(
264 264
         'VALUE'    => $entry,
265 265
         'NAME'     => $entry,
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
   }
270 270
   $dir->close();
271 271
 
272
-  foreach($lang['opt_planet_sort_options'] as $key => &$value) {
272
+  foreach ($lang['opt_planet_sort_options'] as $key => &$value) {
273 273
     $template_result['.']['planet_sort_options'][] = array(
274 274
       'VALUE'    => $key,
275 275
       'NAME'     => $value,
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
     );
278 278
   }
279 279
 
280
-  foreach($lang['sys_gender_list'] as $key => $value) {
280
+  foreach ($lang['sys_gender_list'] as $key => $value) {
281 281
     $template_result['.']['gender_list'][] = array(
282 282
       'VALUE'    => $key,
283 283
       'NAME'     => $value,
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
   }
287 287
 
288 288
   $lang_list = lng_get_list();
289
-  foreach($lang_list as $lang_id => $lang_data) {
289
+  foreach ($lang_list as $lang_id => $lang_data) {
290 290
     $template_result['.']['languages'][] = array(
291 291
       'VALUE'    => $lang_id,
292 292
       'NAME'     => $lang_data['LANG_NAME_NATIVE'],
@@ -295,8 +295,8 @@  discard block
 block discarded – undo
295 295
   }
296 296
 
297 297
 
298
-  if(isset($lang['menu_customize_show_hide_button_state'])) {
299
-    foreach($lang['menu_customize_show_hide_button_state'] as $key => $value) {
298
+  if (isset($lang['menu_customize_show_hide_button_state'])) {
299
+    foreach ($lang['menu_customize_show_hide_button_state'] as $key => $value) {
300 300
       $template->assign_block_vars('menu_customize_show_hide_button_state', array(
301 301
         'ID'   => $key,
302 302
         'NAME' => $value,
@@ -407,10 +407,10 @@  discard block
 block discarded – undo
407 407
     'PAGE_HEADER' => $lang['opt_header'],
408 408
   ));
409 409
 
410
-  foreach($user_option_list as $option_group_id => $option_group) {
411
-    if($option_group_id == OPT_MESSAGE) {
412
-      foreach($sn_message_class_list as $message_class_id => $message_class_data) {
413
-        if($message_class_data['switchable'] || ($message_class_data['email'] && $config->game_email_pm)) {
410
+  foreach ($user_option_list as $option_group_id => $option_group) {
411
+    if ($option_group_id == OPT_MESSAGE) {
412
+      foreach ($sn_message_class_list as $message_class_id => $message_class_data) {
413
+        if ($message_class_data['switchable'] || ($message_class_data['email'] && $config->game_email_pm)) {
414 414
           $option_name = $message_class_data['name'];
415 415
 
416 416
           $template->assign_block_vars("options_{$option_group_id}", array(
@@ -422,8 +422,8 @@  discard block
 block discarded – undo
422 422
         }
423 423
       }
424 424
     } else {
425
-      foreach($option_group as $option_name => $option_value) {
426
-        if(array_key_exists($option_name, $user_option_types)) {
425
+      foreach ($option_group as $option_name => $option_value) {
426
+        if (array_key_exists($option_name, $user_option_types)) {
427 427
           $option_type = $user_option_types[$option_name];
428 428
         } else {
429 429
           $option_type = 'switch';
Please login to merge, or discard this patch.
includes/constants.php 1 patch
Spacing   +242 added lines, -242 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_CONSTANTS_DEFINED') && __SN_CONSTANTS_DEFINED === true) {
3
+if (defined('__SN_CONSTANTS_DEFINED') && __SN_CONSTANTS_DEFINED === true) {
4 4
   return;
5 5
 }
6 6
 
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 define('SN_ROOT_VIRTUAL', 'http' . (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '') . '://' . $_server_http_host . SN_ROOT_RELATIVE);
36 36
 
37 37
 $_server_server_name = isset($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : '';
38
-if(strpos(strtolower($_server_server_name), 'google.') !== false) {
38
+if (strpos(strtolower($_server_server_name), 'google.') !== false) {
39 39
   define('SN_GOOGLE', true);
40 40
 }
41 41
 define('SN_ROOT_VIRTUAL_PARENT', str_replace('//google.', '//', SN_ROOT_VIRTUAL));
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 
57 57
 // Game type constants starts with GAME_
58 58
 define('GAME_SUPERNOVA', 0);
59
-define('GAME_OGAME'    , 1);
60
-define('GAME_BLITZ'    , 2);
59
+define('GAME_OGAME', 1);
60
+define('GAME_BLITZ', 2);
61 61
 
62 62
 // Date & time range constants
63 63
 define('DATE_FOREVER', 2000000000);
@@ -70,15 +70,15 @@  discard block
 block discarded – undo
70 70
 define('PERIOD_YEAR', PERIOD_DAY * 365);
71 71
 define('PERIOD_FOREVER', PERIOD_YEAR * 100);
72 72
 
73
-define('PERIOD_MINUTE_2' , PERIOD_MINUTE * 2);
74
-define('PERIOD_MINUTE_3' , PERIOD_MINUTE * 3);
75
-define('PERIOD_MINUTE_5' , PERIOD_MINUTE * 5);
73
+define('PERIOD_MINUTE_2', PERIOD_MINUTE * 2);
74
+define('PERIOD_MINUTE_3', PERIOD_MINUTE * 3);
75
+define('PERIOD_MINUTE_5', PERIOD_MINUTE * 5);
76 76
 define('PERIOD_MINUTE_10', PERIOD_MINUTE * 10);
77 77
 define('PERIOD_MINUTE_15', PERIOD_MINUTE * 15);
78
-define('PERIOD_DAY_3'    , PERIOD_DAY * 3);
79
-define('PERIOD_WEEK_2'   , PERIOD_WEEK * 2);
80
-define('PERIOD_MONTH_2'  , PERIOD_MONTH * 2);
81
-define('PERIOD_MONTH_3'  , PERIOD_MONTH * 3);
78
+define('PERIOD_DAY_3', PERIOD_DAY * 3);
79
+define('PERIOD_WEEK_2', PERIOD_WEEK * 2);
80
+define('PERIOD_MONTH_2', PERIOD_MONTH * 2);
81
+define('PERIOD_MONTH_3', PERIOD_MONTH * 3);
82 82
 
83 83
 define('FONT_SIZE_PERCENT_MIN', 56.25);
84 84
 define('FONT_SIZE_PERCENT_DEFAULT', 68.75);
@@ -133,38 +133,38 @@  discard block
 block discarded – undo
133 133
 
134 134
 // Mot qui sont interdit a la saisie !
135 135
 global $ListCensure;
136
-$ListCensure = array ( '/</', '/>/', '/script/i', '/doquery/i', '/http/i', '/javascript/i');
136
+$ListCensure = array('/</', '/>/', '/script/i', '/doquery/i', '/http/i', '/javascript/i');
137 137
 
138 138
 // Confirmation record types
139
-define('CONFIRM_REGISTRATION'  , 1);
139
+define('CONFIRM_REGISTRATION', 1);
140 140
 define('CONFIRM_PASSWORD_RESET', 2);
141
-define('CONFIRM_DELETE'        , 3);
141
+define('CONFIRM_DELETE', 3);
142 142
 
143 143
 define('AFFILIATE_MM_TO_REFERRAL_DM', 2);
144 144
 
145 145
 // Ally diplomacy statuses
146
-define('ALLY_DIPLOMACY_SELF'         , 'self');
147
-define('ALLY_DIPLOMACY_NEUTRAL'      , 'neutral');
148
-define('ALLY_DIPLOMACY_WAR'          , 'war');
149
-define('ALLY_DIPLOMACY_PEACE'        , 'peace');
146
+define('ALLY_DIPLOMACY_SELF', 'self');
147
+define('ALLY_DIPLOMACY_NEUTRAL', 'neutral');
148
+define('ALLY_DIPLOMACY_WAR', 'war');
149
+define('ALLY_DIPLOMACY_PEACE', 'peace');
150 150
 define('ALLY_DIPLOMACY_CONFEDERATION', 'confederation');
151
-define('ALLY_DIPLOMACY_FEDERATION'   , 'federation');
152
-define('ALLY_DIPLOMACY_UNION'        , 'union');
153
-define('ALLY_DIPLOMACY_MASTER'       , 'master');
154
-define('ALLY_DIPLOMACY_SLAVE'        , 'slave');
151
+define('ALLY_DIPLOMACY_FEDERATION', 'federation');
152
+define('ALLY_DIPLOMACY_UNION', 'union');
153
+define('ALLY_DIPLOMACY_MASTER', 'master');
154
+define('ALLY_DIPLOMACY_SLAVE', 'slave');
155 155
 
156 156
 define('ALLY_PROPOSE_SEND', 0);
157 157
 
158 158
 // Quest types
159
-define('QUEST_TYPE_BUILD'   , 1);
159
+define('QUEST_TYPE_BUILD', 1);
160 160
 define('QUEST_TYPE_RESEARCH', 2);
161
-define('QUEST_TYPE_COMBAT'  , 3);
161
+define('QUEST_TYPE_COMBAT', 3);
162 162
 
163
-define('QUEST_STATUS_EXCEPT_COMPLETE' , -2);
164
-define('QUEST_STATUS_ALL' , -1);
165
-define('QUEST_STATUS_NOT_STARTED' , 0);
166
-define('QUEST_STATUS_STARTED'     , 1);
167
-define('QUEST_STATUS_COMPLETE'    , 2);
163
+define('QUEST_STATUS_EXCEPT_COMPLETE', -2);
164
+define('QUEST_STATUS_ALL', -1);
165
+define('QUEST_STATUS_NOT_STARTED', 0);
166
+define('QUEST_STATUS_STARTED', 1);
167
+define('QUEST_STATUS_COMPLETE', 2);
168 168
 
169 169
 define('TYPE_EMPTY', '');
170 170
 define('TYPE_INTEGER', 'integer');
@@ -177,68 +177,68 @@  discard block
 block discarded – undo
177 177
 
178 178
 // *** Combat-related constants
179 179
 // *** Mission Type constants starts with MT_
180
-define('MT_NONE'     ,  0);
181
-define('MT_ATTACK'   ,  1);
182
-define('MT_AKS'      ,  2);
183
-define('MT_TRANSPORT',  3);
184
-define('MT_RELOCATE' ,  4);
185
-define('MT_HOLD'     ,  5);
186
-define('MT_SPY'      ,  6);
187
-define('MT_COLONIZE' ,  7);
188
-define('MT_RECYCLE'  ,  8);
189
-define('MT_DESTROY'  ,  9);
190
-define('MT_MISSILE'  , 10);
191
-define('MT_EXPLORE'  , 15);
180
+define('MT_NONE', 0);
181
+define('MT_ATTACK', 1);
182
+define('MT_AKS', 2);
183
+define('MT_TRANSPORT', 3);
184
+define('MT_RELOCATE', 4);
185
+define('MT_HOLD', 5);
186
+define('MT_SPY', 6);
187
+define('MT_COLONIZE', 7);
188
+define('MT_RECYCLE', 8);
189
+define('MT_DESTROY', 9);
190
+define('MT_MISSILE', 10);
191
+define('MT_EXPLORE', 15);
192 192
 
193 193
 // *** Planet Target constants starts with PT_
194 194
 define('PT_NONE', 0);
195 195
 define('PT_ALL', 0);
196 196
 define('PT_PLANET', 1);
197 197
 define('PT_DEBRIS', 2);
198
-define('PT_MOON'  , 3);
198
+define('PT_MOON', 3);
199 199
 
200 200
 // *** Unit locations - shows db table where unit belong
201 201
 // Also cache indexes
202 202
 define('LOC_AUTODETECT', -2);
203
-define('LOC_NONE',    -1); // Deprecated
203
+define('LOC_NONE', -1); // Deprecated
204 204
 define('LOC_UNIVERSE', 0);
205
-define('LOC_PLANET',   1);
206
-define('LOC_DEBRIS',   2); // Translates to `planets` table planet_type = 1, `debris_*` fields
207
-define('LOC_MOON',     3); // Translates to `planets` table planet_type = 3
208
-define('LOC_USER',     4);
209
-define('LOC_FLEET',    5);
210
-define('LOC_ALLY',     6);
211
-define('LOC_SERVER',   7); // Located on server
205
+define('LOC_PLANET', 1);
206
+define('LOC_DEBRIS', 2); // Translates to `planets` table planet_type = 1, `debris_*` fields
207
+define('LOC_MOON', 3); // Translates to `planets` table planet_type = 3
208
+define('LOC_USER', 4);
209
+define('LOC_FLEET', 5);
210
+define('LOC_ALLY', 6);
211
+define('LOC_SERVER', 7); // Located on server
212 212
 
213 213
 // ТОЛЬКО ВНУТРЕНЕЕ!!!
214
-define('LOC_UNIT',    'LOC_UNIT');
215
-define('LOC_QUE',     'LOC_QUE');
216
-define('LOC_LOCATION','LOC_LOCATION');
217
-define('LOC_LOCKS','LOC_LOCKS');
214
+define('LOC_UNIT', 'LOC_UNIT');
215
+define('LOC_QUE', 'LOC_QUE');
216
+define('LOC_LOCATION', 'LOC_LOCATION');
217
+define('LOC_LOCKS', 'LOC_LOCKS');
218 218
 
219 219
 // *** Caching masks
220
-define('CACHE_NOTHING'    ,  0);
221
-define('CACHE_FLEET'      ,  1);
222
-define('CACHE_PLANET'     ,  2);
223
-define('CACHE_USER'       ,  4);
224
-define('CACHE_SOURCE'     ,  8);
220
+define('CACHE_NOTHING', 0);
221
+define('CACHE_FLEET', 1);
222
+define('CACHE_PLANET', 2);
223
+define('CACHE_USER', 4);
224
+define('CACHE_SOURCE', 8);
225 225
 define('CACHE_DESTINATION', 16);
226
-define('CACHE_EVENT'      , 32);
226
+define('CACHE_EVENT', 32);
227 227
 
228
-define('CACHE_USER_SRC'  , CACHE_USER | CACHE_SOURCE);
229
-define('CACHE_USER_DST'  , CACHE_USER | CACHE_DESTINATION);
228
+define('CACHE_USER_SRC', CACHE_USER | CACHE_SOURCE);
229
+define('CACHE_USER_DST', CACHE_USER | CACHE_DESTINATION);
230 230
 define('CACHE_PLANET_SRC', CACHE_PLANET | CACHE_SOURCE);
231 231
 define('CACHE_PLANET_DST', CACHE_PLANET | CACHE_DESTINATION);
232
-define('CACHE_COMBAT'    , CACHE_FLEET | CACHE_PLANET | CACHE_USER | CACHE_SOURCE | CACHE_DESTINATION);
232
+define('CACHE_COMBAT', CACHE_FLEET | CACHE_PLANET | CACHE_USER | CACHE_SOURCE | CACHE_DESTINATION);
233 233
 
234
-define('CACHE_ALL'       , CACHE_FLEET | CACHE_PLANET | CACHE_USER | CACHE_SOURCE | CACHE_DESTINATION | CACHE_EVENT);
234
+define('CACHE_ALL', CACHE_FLEET | CACHE_PLANET | CACHE_USER | CACHE_SOURCE | CACHE_DESTINATION | CACHE_EVENT);
235 235
 
236
-define('CACHE_NONE'      , CACHE_NOTHING); // Alias for me
236
+define('CACHE_NONE', CACHE_NOTHING); // Alias for me
237 237
 
238 238
 // *** Event types
239 239
 define('EVENT_FLEET_NONE', 0);
240 240
 define('EVENT_FLEET_ARRIVE', 1);
241
-define('EVENT_FLEET_STAY'  , 2);
241
+define('EVENT_FLEET_STAY', 2);
242 242
 define('EVENT_FLEET_RETURN', 3);
243 243
 
244 244
 // *** Constants for changing DM
@@ -296,11 +296,11 @@  discard block
 block discarded – undo
296 296
 
297 297
 
298 298
 // Operation error status HARDCODE!
299
-define('ERR_NONE'               , 0); // No error
300
-define('ERR_WARNING'            , 1); // There is warning - something altering normal operation process
301
-define('ERR_ERROR'              , 2); // There is error - something permits operation from process
302
-define('ERR_HACK'               , 4); // Operation is qualified as hack attempt
303
-define('ERR_NOTICE'             , 8); // There is notice - nothing really critical but operator should know
299
+define('ERR_NONE', 0); // No error
300
+define('ERR_WARNING', 1); // There is warning - something altering normal operation process
301
+define('ERR_ERROR', 2); // There is error - something permits operation from process
302
+define('ERR_HACK', 4); // Operation is qualified as hack attempt
303
+define('ERR_NOTICE', 8); // There is notice - nothing really critical but operator should know
304 304
 // New GLOBAL operation results
305 305
 //define('RESULT_DEFAULT' , 0); // Default result - all went OK or result really doesn't matter
306 306
 //define('RESULT_WARNING' , 1);
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 define('SN_PAYMENT_REQUEST_OK', 0);
321 321
 define('SN_PAYMENT_REQUEST_ERROR_UNIT_AMOUNT', 1);
322 322
 define('SN_PAYMENT_REQUEST_ERROR_PAYLINK_UNSUPPORTED', 2);
323
-define('SN_PAYMENT_REQUEST_IP_WRONG', 3);  // Неправильный IP входящей системы - обычно хак
323
+define('SN_PAYMENT_REQUEST_IP_WRONG', 3); // Неправильный IP входящей системы - обычно хак
324 324
 define('SN_PAYMENT_REQUEST_COMMAND_UNSUPPORTED', 4); // Неподдерживаемая команда - обычно хак
325 325
 define('SN_PAYMENT_REQUEST_SIGNATURE_INVALID', 5); // Неправильная подпись или не сошлась контрольная сумма - обычно хак
326 326
 define('SN_MODULE_DISABLED', 6); // Модуль отключен // УНИВЕРСАЛЬНЫЙ ОТВЕТ!
@@ -596,16 +596,16 @@  discard block
 block discarded – undo
596 596
 //define('F_DEVICE_ID',     'F_DEVICE_ID');
597 597
 //define('F_DEVICE_CYPHER', 'F_DEVICE_CYPHER');
598 598
 
599
-define('F_PROVIDER_ID',   'F_PROVIDER_ID');
599
+define('F_PROVIDER_ID', 'F_PROVIDER_ID');
600 600
 // define('F_PROVIDER_LIST', 'F_PROVIDER_LIST');
601 601
 
602 602
 define('F_IMPERSONATE_STATUS', 'F_IMPERSONATE_STATUS');
603 603
 define('F_IMPERSONATE_OPERATOR', 'F_IMPERSONATE_OPERATOR');
604 604
 
605
-define('F_LOGIN_STATUS',  'F_LOGIN_STATUS');
605
+define('F_LOGIN_STATUS', 'F_LOGIN_STATUS');
606 606
 define('F_LOGIN_MESSAGE', 'F_LOGIN_MESSAGE');
607 607
 
608
-define('F_PLAYER_REGISTER_STATUS',  'F_PLAYER_REGISTER_STATUS');
608
+define('F_PLAYER_REGISTER_STATUS', 'F_PLAYER_REGISTER_STATUS');
609 609
 define('F_PLAYER_REGISTER_MESSAGE', 'F_PLAYER_REGISTER_MESSAGE');
610 610
 
611 611
 define('F_USER_ID', 'F_USER_ID');
@@ -649,78 +649,78 @@  discard block
 block discarded – undo
649 649
 
650 650
 
651 651
 // Option groups
652
-define('OPT_ALL',      0);
653
-define('OPT_MESSAGE',  1);
652
+define('OPT_ALL', 0);
653
+define('OPT_MESSAGE', 1);
654 654
 define('OPT_UNIVERSE', 2);
655 655
 define('OPT_INTERFACE', 3);
656 656
 
657 657
 // Message classes
658
-define('MSG_TYPE_OUTBOX'   ,  -1);
659
-define('MSG_TYPE_SPY'      ,   0);
660
-define('MSG_TYPE_PLAYER'   ,   1);
661
-define('MSG_TYPE_ALLIANCE' ,   2);
662
-define('MSG_TYPE_COMBAT'   ,   3);
663
-define('MSG_TYPE_RECYCLE'  ,   4);
664
-define('MSG_TYPE_TRANSPORT',   5);
665
-define('MSG_TYPE_ADMIN'    ,   6);
666
-define('MSG_TYPE_EXPLORE'  ,  15);
667
-define('MSG_TYPE_QUE'      ,  99);
668
-define('MSG_TYPE_NEW'      , 100);
658
+define('MSG_TYPE_OUTBOX', -1);
659
+define('MSG_TYPE_SPY', 0);
660
+define('MSG_TYPE_PLAYER', 1);
661
+define('MSG_TYPE_ALLIANCE', 2);
662
+define('MSG_TYPE_COMBAT', 3);
663
+define('MSG_TYPE_RECYCLE', 4);
664
+define('MSG_TYPE_TRANSPORT', 5);
665
+define('MSG_TYPE_ADMIN', 6);
666
+define('MSG_TYPE_EXPLORE', 15);
667
+define('MSG_TYPE_QUE', 99);
668
+define('MSG_TYPE_NEW', 100);
669 669
 
670 670
 // Attack verification statuses
671
-define('ATTACK_ALLOWED'           ,  0);
672
-define('ATTACK_NO_TARGET'         ,  1);
673
-define('ATTACK_OWN'               ,  2);
674
-define('ATTACK_WRONG_MISSION'     ,  3);
675
-define('ATTACK_NO_ALLY_DEPOSIT'   ,  4);
676
-define('ATTACK_NO_DEBRIS'         ,  5);
677
-define('ATTACK_VACATION'          ,  6);
678
-define('ATTACK_SAME_IP'           ,  7);
679
-define('ATTACK_BUFFING'           ,  8);
680
-define('ATTACK_ADMIN'             ,  9);
681
-define('ATTACK_NOOB'              , 10);
682
-define('ATTACK_OWN_VACATION'      , 11);
683
-define('ATTACK_NO_SILO'           , 12);
684
-define('ATTACK_NO_MISSILE'        , 13);
685
-define('ATTACK_NO_FLEET'          , 14);
686
-define('ATTACK_NO_SLOTS'          , 15);
687
-define('ATTACK_NO_SHIPS'          , 16);
688
-define('ATTACK_NO_RECYCLERS'      , 17);
689
-define('ATTACK_NO_SPIES'          , 18);
690
-define('ATTACK_NO_COLONIZER'      , 19);
691
-define('ATTACK_MISSILE_TOO_FAR'   , 20);
692
-define('ATTACK_WRONG_STRUCTURE'   , 21);
693
-define('ATTACK_NO_FUEL'           , 22);
694
-define('ATTACK_NO_RESOURCES'      , 23);
695
-define('ATTACK_NO_ACS'            , 24);
696
-define('ATTACK_ACS_MISSTARGET'    , 25);
697
-define('ATTACK_WRONG_SPEED'       , 26);
698
-define('ATTACK_ACS_TOO_LATE'      , 27);
699
-define('ATTACK_BASHING'           , 28);
700
-define('ATTACK_BASHING_WAR_DELAY' , 29);
701
-define('ATTACK_ACS_WRONG_TARGET'  , 30);
702
-define('ATTACK_SAME'              , 31);
671
+define('ATTACK_ALLOWED', 0);
672
+define('ATTACK_NO_TARGET', 1);
673
+define('ATTACK_OWN', 2);
674
+define('ATTACK_WRONG_MISSION', 3);
675
+define('ATTACK_NO_ALLY_DEPOSIT', 4);
676
+define('ATTACK_NO_DEBRIS', 5);
677
+define('ATTACK_VACATION', 6);
678
+define('ATTACK_SAME_IP', 7);
679
+define('ATTACK_BUFFING', 8);
680
+define('ATTACK_ADMIN', 9);
681
+define('ATTACK_NOOB', 10);
682
+define('ATTACK_OWN_VACATION', 11);
683
+define('ATTACK_NO_SILO', 12);
684
+define('ATTACK_NO_MISSILE', 13);
685
+define('ATTACK_NO_FLEET', 14);
686
+define('ATTACK_NO_SLOTS', 15);
687
+define('ATTACK_NO_SHIPS', 16);
688
+define('ATTACK_NO_RECYCLERS', 17);
689
+define('ATTACK_NO_SPIES', 18);
690
+define('ATTACK_NO_COLONIZER', 19);
691
+define('ATTACK_MISSILE_TOO_FAR', 20);
692
+define('ATTACK_WRONG_STRUCTURE', 21);
693
+define('ATTACK_NO_FUEL', 22);
694
+define('ATTACK_NO_RESOURCES', 23);
695
+define('ATTACK_NO_ACS', 24);
696
+define('ATTACK_ACS_MISSTARGET', 25);
697
+define('ATTACK_WRONG_SPEED', 26);
698
+define('ATTACK_ACS_TOO_LATE', 27);
699
+define('ATTACK_BASHING', 28);
700
+define('ATTACK_BASHING_WAR_DELAY', 29);
701
+define('ATTACK_ACS_WRONG_TARGET', 30);
702
+define('ATTACK_SAME', 31);
703 703
 define('ATTACK_RESOURCE_FORBIDDEN', 32);
704
-define('ATTACK_TRANSPORT_EMPTY'   , 33);
705
-define('ATTACK_SPIES_LONLY'       , 34);
706
-define('ATTACK_TOO_FAR'           , 35);
707
-define('ATTACK_OVERLOADED'        , 36);
708
-define('ATTACK_MISSION_ABSENT'    , 37);
709
-define('ATTACK_WRONG_UNIT'        , 38);
710
-define('ATTACK_ZERO_SPEED'        , 39);
711
-define('ATTACK_SHIP_COUNT_WRONG'  , 40);
704
+define('ATTACK_TRANSPORT_EMPTY', 33);
705
+define('ATTACK_SPIES_LONLY', 34);
706
+define('ATTACK_TOO_FAR', 35);
707
+define('ATTACK_OVERLOADED', 36);
708
+define('ATTACK_MISSION_ABSENT', 37);
709
+define('ATTACK_WRONG_UNIT', 38);
710
+define('ATTACK_ZERO_SPEED', 39);
711
+define('ATTACK_SHIP_COUNT_WRONG', 40);
712 712
 define('ATTACK_RESOURCE_COUNT_WRONG', 41);
713 713
 define('ATTACK_MORATORIUM', 42);
714 714
 define('ATTACK_CHILD_PROTECTION', 43);
715 715
 
716 716
 
717 717
 // *** Races - Homeworlds
718
-define('RACE_NONE'    , 0);
719
-define('RACE_EARTH'   , 1);
720
-define('RACE_MOON'    , 2);
721
-define('RACE_MERCURY' , 3);
722
-define('RACE_VENUS'   , 4);
723
-define('RACE_MARS'    , 5);
718
+define('RACE_NONE', 0);
719
+define('RACE_EARTH', 1);
720
+define('RACE_MOON', 2);
721
+define('RACE_MERCURY', 3);
722
+define('RACE_VENUS', 4);
723
+define('RACE_MARS', 5);
724 724
 define('RACE_ASTEROID', 6);
725 725
 // define('MARKET_INFO'         , 7);
726 726
 
@@ -728,115 +728,115 @@  discard block
 block discarded – undo
728 728
 
729 729
 // *** Market variables
730 730
 // === Market blocks
731
-define('MARKET_ENTRY'        , 0);
732
-define('MARKET_RESOURCES'    , 1);
733
-define('MARKET_SCRAPPER'     , 2);
734
-define('MARKET_STOCKMAN'     , 3);
735
-define('MARKET_EXCHANGE'     , 4);
736
-define('MARKET_BANKER'       , 5);
737
-define('MARKET_PAWNSHOP'     , 6);
738
-define('MARKET_INFO'         , 7);
731
+define('MARKET_ENTRY', 0);
732
+define('MARKET_RESOURCES', 1);
733
+define('MARKET_SCRAPPER', 2);
734
+define('MARKET_STOCKMAN', 3);
735
+define('MARKET_EXCHANGE', 4);
736
+define('MARKET_BANKER', 5);
737
+define('MARKET_PAWNSHOP', 6);
738
+define('MARKET_INFO', 7);
739 739
 
740 740
 // === Market error statuses
741
-define('MARKET_NOTHING'              ,  0);
742
-define('MARKET_DEAL'                 ,  1);
743
-define('MARKET_DEAL_TRADE'           ,  2);
744
-define('MARKET_NO_DM'                ,  3);
745
-define('MARKET_NO_RESOURCES'         ,  4);
746
-define('MARKET_ZERO_DEAL'            ,  5);
747
-define('MARKET_NO_SHIPS'             ,  6);
748
-define('MARKET_NOT_A_SHIP'           ,  7);
749
-define('MARKET_NO_STOCK'             ,  8);
750
-define('MARKET_ZERO_RES_STOCK'       ,  9);
751
-define('MARKET_NEGATIVE_SHIPS'       , 10);
752
-
753
-define('MARKET_INFO_PLAYER'          , 12);
754
-define('MARKET_INFO_WRONG'           , 11);
741
+define('MARKET_NOTHING', 0);
742
+define('MARKET_DEAL', 1);
743
+define('MARKET_DEAL_TRADE', 2);
744
+define('MARKET_NO_DM', 3);
745
+define('MARKET_NO_RESOURCES', 4);
746
+define('MARKET_ZERO_DEAL', 5);
747
+define('MARKET_NO_SHIPS', 6);
748
+define('MARKET_NOT_A_SHIP', 7);
749
+define('MARKET_NO_STOCK', 8);
750
+define('MARKET_ZERO_RES_STOCK', 9);
751
+define('MARKET_NEGATIVE_SHIPS', 10);
752
+
753
+define('MARKET_INFO_PLAYER', 12);
754
+define('MARKET_INFO_WRONG', 11);
755 755
 define('MARKET_INFO_PLAYER_NOT_FOUND', 13);
756
-define('MARKET_INFO_PLAYER_WRONG'    , 14);
757
-define('MARKET_INFO_PLAYER_SAME'     , 15);
756
+define('MARKET_INFO_PLAYER_WRONG', 14);
757
+define('MARKET_INFO_PLAYER_SAME', 15);
758 758
 
759 759
 
760 760
 
761 761
 
762 762
 // *** Mercenary/talent bonus types
763
-define('BONUS_NONE'    ,            0);  // No bonus
764
-define('BONUS_PERCENT' ,            1);  // Percent on base value
765
-define('BONUS_ADD'     ,            2);  // Add
766
-define('BONUS_ABILITY' ,            3);  // Some ability
767
-define('BONUS_MULTIPLY',            4);  // Multiply by value
763
+define('BONUS_NONE', 0); // No bonus
764
+define('BONUS_PERCENT', 1); // Percent on base value
765
+define('BONUS_ADD', 2); // Add
766
+define('BONUS_ABILITY', 3); // Some ability
767
+define('BONUS_MULTIPLY', 4); // Multiply by value
768 768
 //define('BONUS_PERCENT_CUMULATIVE' , 5);  // Cumulative percent on base value
769 769
 //define('BONUS_PERCENT_DEGRADED' ,   6);  // Bonus amount degraded with increase as pow(bonus, level) (?)
770 770
 //define('BONUS_SPEED',               7);  // Speed bonus
771 771
 
772 772
 // *** Action constant (build should be replaced with ACTION)
773
-define('BUILD_CREATE' ,  1);
773
+define('BUILD_CREATE', 1);
774 774
 define('BUILD_DESTROY', -1);
775 775
 define('BUILD_AUTOCONVERT', 2);
776 776
 
777
-define('ACTION_SELL'       , -1);
778
-define('ACTION_NOTHING'    ,  0);
779
-define('ACTION_BUY'        ,  1);
780
-define('ACTION_USE'        ,  2);
781
-define('ACTION_DELETE'     ,  3);
777
+define('ACTION_SELL', -1);
778
+define('ACTION_NOTHING', 0);
779
+define('ACTION_BUY', 1);
780
+define('ACTION_USE', 2);
781
+define('ACTION_DELETE', 3);
782 782
 
783 783
 // *** Check unit availability codes
784
-define('BUILD_ALLOWED'         , 0); // HARDCODED! DO NOT CHANGE!
784
+define('BUILD_ALLOWED', 0); // HARDCODED! DO NOT CHANGE!
785 785
 define('BUILD_REQUIRE_NOT_MEET', 1);
786
-define('BUILD_AMOUNT_WRONG'    , 2);
787
-define('BUILD_QUE_WRONG'       , 3);
788
-define('BUILD_QUE_UNIT_WRONG'  , 4);
789
-define('BUILD_INDESTRUCTABLE'  , 5);
790
-define('BUILD_NO_RESOURCES'    , 6);
791
-define('BUILD_NO_UNITS'        , 7);
792
-define('BUILD_UNIT_BUSY'       , 8);
793
-define('BUILD_QUE_FULL'        , 9);
794
-define('BUILD_SILO_FULL'       ,10);
795
-define('BUILD_MAX_REACHED'     ,11);
796
-define('BUILD_SECTORS_NONE'    ,12);
786
+define('BUILD_AMOUNT_WRONG', 2);
787
+define('BUILD_QUE_WRONG', 3);
788
+define('BUILD_QUE_UNIT_WRONG', 4);
789
+define('BUILD_INDESTRUCTABLE', 5);
790
+define('BUILD_NO_RESOURCES', 6);
791
+define('BUILD_NO_UNITS', 7);
792
+define('BUILD_UNIT_BUSY', 8);
793
+define('BUILD_QUE_FULL', 9);
794
+define('BUILD_SILO_FULL', 10);
795
+define('BUILD_MAX_REACHED', 11);
796
+define('BUILD_SECTORS_NONE', 12);
797 797
 define('BUILD_AUTOCONVERT_AVAILABLE', 13);
798 798
 
799 799
 
800 800
 // *** Que types
801 801
 define('QUE_STRUCTURES', 1);
802
-define('QUE_HANGAR'    , 4);
803
-define('QUE_RESEARCH'  , 7);
804
-define('QUE_MERCENARY' , 600); // UNIT_MERCENARIES
802
+define('QUE_HANGAR', 4);
803
+define('QUE_RESEARCH', 7);
804
+define('QUE_MERCENARY', 600); // UNIT_MERCENARIES
805 805
 // *** Subque types
806
-define('SUBQUE_PLANET'  , 1);
807
-define('SUBQUE_MOON'    , 3);
808
-define('SUBQUE_FLEET'   , 4);
809
-define('SUBQUE_DEFENSE' , 6);
806
+define('SUBQUE_PLANET', 1);
807
+define('SUBQUE_MOON', 3);
808
+define('SUBQUE_FLEET', 4);
809
+define('SUBQUE_DEFENSE', 6);
810 810
 define('SUBQUE_RESEARCH', 7);
811 811
 
812 812
 // *** Que items
813
-define('QI_UNIT_ID'   , 0);
814
-define('QI_AMOUNT'    , 1);
815
-define('QI_TIME'      , 2);
816
-define('QI_MODE'      , 3);
817
-define('QI_QUE_ID'    , 4);
818
-define('QI_QUE_TYPE'  , 4);
819
-define('QI_PLANET_ID' , 5);
813
+define('QI_UNIT_ID', 0);
814
+define('QI_AMOUNT', 1);
815
+define('QI_TIME', 2);
816
+define('QI_MODE', 3);
817
+define('QI_QUE_ID', 4);
818
+define('QI_QUE_TYPE', 4);
819
+define('QI_PLANET_ID', 5);
820 820
 
821 821
 
822 822
 // *** Units
823 823
 
824 824
 // *** Sort options
825
-define('SORT_ASCENDING' , 0);
825
+define('SORT_ASCENDING', 0);
826 826
 define('SORT_DESCENDING', 1);
827 827
 
828
-define('SORT_ID'             , 0);
829
-define('SORT_LOCATION'       , 1);
830
-define('SORT_NAME'           , 2);
831
-define('SORT_SIZE'           , 3);
832
-define('SORT_EMAIL'          , 4);
833
-define('SORT_IP'             , 5);
828
+define('SORT_ID', 0);
829
+define('SORT_LOCATION', 1);
830
+define('SORT_NAME', 2);
831
+define('SORT_SIZE', 3);
832
+define('SORT_EMAIL', 4);
833
+define('SORT_IP', 5);
834 834
 define('SORT_TIME_REGISTERED', 6);
835 835
 define('SORT_TIME_LAST_VISIT', 7);
836
-define('SORT_TIME_BAN_UNTIL' , 8);
837
-define('SORT_REFERRAL_COUNT' , 9);
838
-define('SORT_REFERRAL_DM'    , 10);
839
-define('SORT_VACATION'       , 11);
836
+define('SORT_TIME_BAN_UNTIL', 8);
837
+define('SORT_REFERRAL_COUNT', 9);
838
+define('SORT_REFERRAL_DM', 10);
839
+define('SORT_VACATION', 11);
840 840
 
841 841
 
842 842
 define('HULL_SIZE_TINY', 1);
@@ -986,10 +986,10 @@  discard block
 block discarded – undo
986 986
 
987 987
 // === Artifacts
988 988
 define('UNIT_ARTIFACTS', 1000);
989
-define('ART_LHC', 1001);      // Additional moon chance
990
-define('ART_RCD_SMALL', 1002);   // Rapid Colony Deployment - Set of buildings up to 10th level - 10/14/ 3/0 -   405 DM
991
-define('ART_RCD_MEDIUM', 1003);  // Rapid Colony Deployment - Set of buildings up to 15th level - 15/20/ 8/0 -  4704 DM
992
-define('ART_RCD_LARGE', 1004);   // Rapid Colony Deployment - Set of buildings up to 20th level - 20/25/10/1 - 39790 DM
989
+define('ART_LHC', 1001); // Additional moon chance
990
+define('ART_RCD_SMALL', 1002); // Rapid Colony Deployment - Set of buildings up to 10th level - 10/14/ 3/0 -   405 DM
991
+define('ART_RCD_MEDIUM', 1003); // Rapid Colony Deployment - Set of buildings up to 15th level - 15/20/ 8/0 -  4704 DM
992
+define('ART_RCD_LARGE', 1004); // Rapid Colony Deployment - Set of buildings up to 20th level - 20/25/10/1 - 39790 DM
993 993
 define('ART_HEURISTIC_CHIP', 1005); // Speed up research
994 994
 define('ART_NANO_BUILDER', 1006); // Speed up building
995 995
 define('ART_NANO_CONSTRUCTOR', 1007); // RESERVED Speed up hangar constructions
@@ -1063,21 +1063,21 @@  discard block
 block discarded – undo
1063 1063
 define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE1', 2201); // Блиц-сервер, участник 0-го раунда, 1-е место
1064 1064
 define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE2', 2202); // Блиц-сервер, участник 0-го раунда, 2-е место
1065 1065
 define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE3', 2203); // Блиц-сервер, участник 0-го раунда, 3-е место
1066
-define('UNIT_AWARD_MEDAL_2016_WOMEN_DAY_BEST', 2204);  // Медаль Лучшему Кавалеру за максимум потраченной ММ/максимум одаренных женщин Женщине от Мужчины во время ивента 8 марта 2016 года
1067
-define('UNIT_AWARD_MEDAL_2017_WOMEN_DAY_BEST', 2205);  // Медаль Лучшему Кавалеру за максимум потраченной ММ/максимум одаренных женщин Женщине от Мужчины во время ивента 8 марта 2017 года
1068
-define('UNIT_AWARD_MEDAL_2017_WOMEN_DAY_QUEEN', 2206);  // Медаль Королевы Весны за максимум полученной ММ/максимум полученных подарков от Мужчины во время ивента 8 марта 2017 года
1066
+define('UNIT_AWARD_MEDAL_2016_WOMEN_DAY_BEST', 2204); // Медаль Лучшему Кавалеру за максимум потраченной ММ/максимум одаренных женщин Женщине от Мужчины во время ивента 8 марта 2016 года
1067
+define('UNIT_AWARD_MEDAL_2017_WOMEN_DAY_BEST', 2205); // Медаль Лучшему Кавалеру за максимум потраченной ММ/максимум одаренных женщин Женщине от Мужчины во время ивента 8 марта 2017 года
1068
+define('UNIT_AWARD_MEDAL_2017_WOMEN_DAY_QUEEN', 2206); // Медаль Королевы Весны за максимум полученной ММ/максимум полученных подарков от Мужчины во время ивента 8 марта 2017 года
1069 1069
 
1070 1070
 define('UNIT_AWARD_MEMORY', 2300); // Памятные знаки за существование и участие - например "4 года в игре". "Был онлайн в новогоднюю ночь 2013". итд
1071
-define('UNIT_AWARD_MEMORY_IMMORTAL', 2301);  // Бессмертный
1072
-define('UNIT_AWARD_MEMORY_2015_WOMEN_DAY', 2302);  // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2015 года
1071
+define('UNIT_AWARD_MEMORY_IMMORTAL', 2301); // Бессмертный
1072
+define('UNIT_AWARD_MEMORY_2015_WOMEN_DAY', 2302); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2015 года
1073 1073
 define('UNIT_AWARD_MEMORY_BLITZ_R0', 2303); // Блиц-сервер, участник 0-го раунда
1074 1074
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_SIMPLE', 2304); // День Рождения СН
1075 1075
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_BRONZE', 2305); // День Рождения СН
1076 1076
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_SILVER', 2306); // День Рождения СН
1077 1077
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_GOLD', 2307); // День Рождения СН
1078 1078
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_PLATINUM', 2308); // День Рождения СН
1079
-define('UNIT_AWARD_MEMORY_2016_WOMEN_DAY', 2309);  // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2016 года
1080
-define('UNIT_AWARD_MEMORY_2017_WOMEN_DAY', 2310);  // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2017 года
1079
+define('UNIT_AWARD_MEMORY_2016_WOMEN_DAY', 2309); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2016 года
1080
+define('UNIT_AWARD_MEMORY_2017_WOMEN_DAY', 2310); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2017 года
1081 1081
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2017_SIMPLE', 2311); // День Рождения СН - 2017
1082 1082
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2017_BRONZE', 2312); // День Рождения СН - 2017
1083 1083
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2017_SILVER', 2313); // День Рождения СН - 2017
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
 define('UNIT_AWARD_MEMORY_NEW_YEAR_2018_SIMPLE', 2326); // СуперНовый Год - 2018
1100 1100
 define('UNIT_AWARD_MEMORY_NEW_YEAR_2018_BRONZE', 2327); // СуперНовый Год - 2018
1101 1101
 define('UNIT_AWARD_MEMORY_NEW_YEAR_2018_SILVER', 2328); // СуперНовый Год - 2018
1102
-define('UNIT_AWARD_MEMORY_NEW_YEAR_2018_GOLD',   2329); // СуперНовый Год - 2018
1102
+define('UNIT_AWARD_MEMORY_NEW_YEAR_2018_GOLD', 2329); // СуперНовый Год - 2018
1103 1103
 define('UNIT_AWARD_MEMORY_NEW_YEAR_2018_PLATINUM', 2330); // СуперНовый Год - 2018
1104 1104
 define('UNIT_AWARD_MEMORY_NEW_YEAR_2018_DIAMOND', 2331); // СуперНовый Год - 2018
1105 1105
 
@@ -1233,7 +1233,7 @@  discard block
 block discarded – undo
1233 1233
 define('UNIT_FLEET_PLANET_SPY', 'UNIT_FLEET_PLANET_SPY');
1234 1234
 
1235 1235
 
1236
-define('GROUP_PART',         800000);
1236
+define('GROUP_PART', 800000);
1237 1237
 // Зарезервировано для запчастей: 800.001 - 899.999
1238 1238
 // define('GROUP_PART_HULL',    801000); // Корпуса - 1000 штук
1239 1239
 // define('GROUP_PART_ARMOR',   802000); // Броня - 1000 штук
@@ -1555,32 +1555,32 @@  discard block
 block discarded – undo
1555 1555
 
1556 1556
 
1557 1557
 // define('NICK_ID',               -1);
1558
-define('NICK_HTML',              0);
1559
-
1560
-define('NICK_FIRST',             1);
1561
-define('NICK_RACE',           1000);
1562
-define('NICK_GENDER',         2000);
1563
-define('NICK_AWARD',          3000);
1564
-define('NICK_VACATION',       3500);
1565
-define('NICK_BIRTHSDAY',      4000);
1566
-define('NICK_PREMIUM',        5000);
1567
-define('NICK_AUTH_LEVEL',     6000);
1568
-
1569
-define('NICK_HIGHLIGHT',      6300);
1570
-define('NICK_CLASS',          6450);
1571
-
1572
-define('NICK_NICK_CLASS',     6600);
1573
-define('NICK_NICK',           7000);
1558
+define('NICK_HTML', 0);
1559
+
1560
+define('NICK_FIRST', 1);
1561
+define('NICK_RACE', 1000);
1562
+define('NICK_GENDER', 2000);
1563
+define('NICK_AWARD', 3000);
1564
+define('NICK_VACATION', 3500);
1565
+define('NICK_BIRTHSDAY', 4000);
1566
+define('NICK_PREMIUM', 5000);
1567
+define('NICK_AUTH_LEVEL', 6000);
1568
+
1569
+define('NICK_HIGHLIGHT', 6300);
1570
+define('NICK_CLASS', 6450);
1571
+
1572
+define('NICK_NICK_CLASS', 6600);
1573
+define('NICK_NICK', 7000);
1574 1574
 define('NICK_NICK_CLASS_END', 7300);
1575 1575
 
1576
-define('NICK_ALLY_CLASS',     7600);
1577
-define('NICK_ALLY',           8000);
1576
+define('NICK_ALLY_CLASS', 7600);
1577
+define('NICK_ALLY', 8000);
1578 1578
 define('NICK_ALLY_CLASS_END', 8300);
1579 1579
 
1580
-define('NICK_CLASS_END',      8450);
1581
-define('NICK_HIGHLIGHT_END',  8600);
1580
+define('NICK_CLASS_END', 8450);
1581
+define('NICK_HIGHLIGHT_END', 8600);
1582 1582
 
1583
-define('NICK_LAST',           9999);
1583
+define('NICK_LAST', 9999);
1584 1584
 
1585 1585
 // Настройки игрока
1586 1586
 define('PLAYER_OPTION_MENU_SORT', 1);
@@ -1682,8 +1682,8 @@  discard block
 block discarded – undo
1682 1682
 define('LOG_ONLIINE_AGGREGATE_PERIOD_MINUTE_10', 1);
1683 1683
 
1684 1684
 define('BLITZ_REGISTER_DISABLED', 0);
1685
-define('BLITZ_REGISTER_OPEN'    , 1);
1686
-define('BLITZ_REGISTER_CLOSED'  , 2);
1685
+define('BLITZ_REGISTER_OPEN', 1);
1686
+define('BLITZ_REGISTER_CLOSED', 2);
1687 1687
 define('BLITZ_REGISTER_SHOW_LOGIN', 3);
1688 1688
 define('BLITZ_REGISTER_DISCLOSURE_NAMES', 4);
1689 1689
 
Please login to merge, or discard this patch.
classes/Bonus/ValueStorage.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -48,20 +48,20 @@  discard block
 block discarded – undo
48 48
   }
49 49
 
50 50
   protected function initValues() {
51
-    $this[UNIT_SERVER_SPEED_BUILDING] = function (ValueStorage $vs) {
51
+    $this[UNIT_SERVER_SPEED_BUILDING] = function(ValueStorage $vs) {
52 52
       return new ValueBonused(UNIT_SERVER_SPEED_BUILDING, floatval($vs->getGlobalContainer()->config->game_speed));
53 53
     };
54
-    $this[UNIT_SERVER_SPEED_MINING] = function (ValueStorage $vs) {
54
+    $this[UNIT_SERVER_SPEED_MINING] = function(ValueStorage $vs) {
55 55
       return new ValueBonused(UNIT_SERVER_SPEED_MINING, floatval($vs->getGlobalContainer()->config->resource_multiplier));
56 56
     };
57
-    $this[UNIT_SERVER_SPEED_FLEET] = function (ValueStorage $vs) {
57
+    $this[UNIT_SERVER_SPEED_FLEET] = function(ValueStorage $vs) {
58 58
       return new ValueBonused(UNIT_SERVER_SPEED_FLEET, floatval($vs->getGlobalContainer()->config->fleet_speed));
59 59
     };
60
-    $this[UNIT_SERVER_SPEED_EXPEDITION] = function (ValueStorage $vs) {
60
+    $this[UNIT_SERVER_SPEED_EXPEDITION] = function(ValueStorage $vs) {
61 61
       return new ValueBonused(UNIT_SERVER_SPEED_EXPEDITION, floatval(1));
62 62
     };
63 63
 
64
-    $this[UNIT_SERVER_FLEET_NOOB_POINTS] = function (ValueStorage $vs) {
64
+    $this[UNIT_SERVER_FLEET_NOOB_POINTS] = function(ValueStorage $vs) {
65 65
       $config = $vs->getGlobalContainer()->config;
66 66
 
67 67
       return new ValueBonused(
@@ -69,11 +69,11 @@  discard block
 block discarded – undo
69 69
         floatval($config->game_noob_points * $vs->getBase(UNIT_SERVER_SPEED_MINING))
70 70
       );
71 71
     };
72
-    $this[UNIT_SERVER_FLEET_NOOB_FACTOR] = function (ValueStorage $vs) {
72
+    $this[UNIT_SERVER_FLEET_NOOB_FACTOR] = function(ValueStorage $vs) {
73 73
       return new ValueBonused(UNIT_SERVER_FLEET_NOOB_FACTOR, floatval($vs->getGlobalContainer()->config->game_noob_factor));
74 74
     };
75 75
 
76
-    $this[UNIT_SERVER_PAYMENT_MM_PER_CURRENCY] = function (ValueStorage $vs) {
76
+    $this[UNIT_SERVER_PAYMENT_MM_PER_CURRENCY] = function(ValueStorage $vs) {
77 77
       return new ValueBonused(UNIT_SERVER_PAYMENT_MM_PER_CURRENCY, floatval($vs->getGlobalContainer()->config->payment_currency_exchange_mm_));
78 78
     };
79 79
   }
Please login to merge, or discard this patch.
classes/classConfig.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
     'advGoogleLeftMenuCode'        => '(Place here code for banner)',
127 127
 
128 128
     // Alliance bonus calculations
129
-    'ali_bonus_algorithm'          => 0,  // Bonus calculation algorithm
129
+    'ali_bonus_algorithm'          => 0, // Bonus calculation algorithm
130 130
     'ali_bonus_brackets'           => 10, // Brackets count for ALI_BONUS_BY_RANK
131
-    'ali_bonus_brackets_divisor'   => 10,// Bonus divisor for ALI_BONUS_BY_RANK
131
+    'ali_bonus_brackets_divisor'   => 10, // Bonus divisor for ALI_BONUS_BY_RANK
132 132
     'ali_bonus_divisor'            => 10000000, // Rank divisor for ALI_BONUS_BY_POINTS
133 133
     'ali_bonus_members'            => 10, // Minimum alliance size to start using bonus
134 134
 
@@ -164,17 +164,17 @@  discard block
 block discarded – undo
164 164
     'deuterium_basic_income'       => 0,
165 165
     'eco_scale_storage'            => 1,
166 166
     'eco_stockman_fleet'           => '', // Black Market - Starting amount of s/h ship merchant to sell
167
-    'eco_stockman_fleet_populate'  => 1,  // Populate empty Stockman fleet with ships or not
167
+    'eco_stockman_fleet_populate'  => 1, // Populate empty Stockman fleet with ships or not
168 168
     'empire_mercenary_base_period' => PERIOD_MONTH, // Base
169 169
     'empire_mercenary_temporary'   => 0, // Temporary empire-wide mercenaries
170 170
     'energy_basic_income'          => 0,
171 171
 
172 172
     // Bashing protection settings
173
-    'fleet_bashing_attacks'        => 3,      // Max amount of attack per wave - 3 by default
174
-    'fleet_bashing_interval'       => 1800,   // Maximum interval between attacks when they still count as one wave - 30m by default
175
-    'fleet_bashing_scope'          => 86400,  // Interval on which bashing waves counts - 24h by default
176
-    'fleet_bashing_war_delay'      => 43200,  // Delay before start bashing after declaring war to alliance - 12h by default
177
-    'fleet_bashing_waves'          => 3,      // Max amount of waves per day - 3 by default
173
+    'fleet_bashing_attacks'        => 3, // Max amount of attack per wave - 3 by default
174
+    'fleet_bashing_interval'       => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default
175
+    'fleet_bashing_scope'          => 86400, // Interval on which bashing waves counts - 24h by default
176
+    'fleet_bashing_war_delay'      => 43200, // Delay before start bashing after declaring war to alliance - 12h by default
177
+    'fleet_bashing_waves'          => 3, // Max amount of waves per day - 3 by default
178 178
 
179 179
     'Fleet_Cdr'   => 30,
180 180
     'fleet_speed' => 1,
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
     'fleet_update_interval' => 4,
183 183
     'fleet_update_lock'     => '', // SQL time when lock was acquired
184 184
 
185
-    'game_adminEmail'       => 'root@localhost',    // Admin's email to show to users
186
-    'game_counter'          => 0,  // Does built-in page hit counter is on?
185
+    'game_adminEmail'       => 'root@localhost', // Admin's email to show to users
186
+    'game_counter'          => 0, // Does built-in page hit counter is on?
187 187
     // Defaults
188 188
     'game_default_language' => 'ru',
189 189
     'game_default_skin'     => 'skins/EpicBlue/',
@@ -197,14 +197,14 @@  discard block
 block discarded – undo
197 197
     'game_maxSystem'      => 199,
198 198
     'game_maxPlanet'      => 15,
199 199
     // Game global settings
200
-    'game_mode'           => 0,           // 0 - SuperNova, 1 - oGame
200
+    'game_mode'           => 0, // 0 - SuperNova, 1 - oGame
201 201
     'game_name'           => 'SuperNova', // Server name (would be on banners and on top of left menu)
202 202
 
203 203
     'game_news_actual'        => PERIOD_DAY_3, // How long announcement would be marked as "New". In seconds. Default - 3 days
204
-    'game_news_overview'      => 3,    // How much last news to show in Overview page
205
-    'game_news_overview_show' => PERIOD_WEEK_2,    // How long news will be shown in Overview page in seconds. Default - 2 weeks
204
+    'game_news_overview'      => 3, // How much last news to show in Overview page
205
+    'game_news_overview_show' => PERIOD_WEEK_2, // How long news will be shown in Overview page in seconds. Default - 2 weeks
206 206
     // Noob protection
207
-    'game_noob_factor'        => 5,    // Multiplier to divide "stronger" and "weaker" users
207
+    'game_noob_factor'        => 5, // Multiplier to divide "stronger" and "weaker" users
208 208
     'game_noob_points'        => 5000, // Below this point user threated as noob. 0 to disable
209 209
 
210 210
     'game_multiaccount_enabled' => 0, // 1 - allow interactions for players with same IP (multiaccounts)
@@ -259,8 +259,8 @@  discard block
 block discarded – undo
259 259
     'payment_currency_exchange_wmu' => 30,
260 260
     'payment_currency_exchange_wmz' => 1,
261 261
 
262
-    'payment_lot_price' => 1,     // Lot price in default currency
263
-    'payment_lot_size'  => 2500,  // Lot size. Also service as minimum amount of DM that could be bought with one transaction
262
+    'payment_lot_price' => 1, // Lot price in default currency
263
+    'payment_lot_size'  => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction
264 264
 
265 265
     'planet_capital_cost'     => 25000, // Cost in DM to move Capital to current planet
266 266
     'planet_teleport_cost'    => 50000, // Cost of planet teleportation
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
     'resource_multiplier'     => 1,
283 283
 
284 284
     //Roleplay system
285
-    'rpg_bonus_divisor'       => 10,    // Amount of DM referral shoud get for partner have 1 DM bonus
285
+    'rpg_bonus_divisor'       => 10, // Amount of DM referral shoud get for partner have 1 DM bonus
286 286
     'rpg_bonus_minimum'       => 10000, // Minimum DM ammount for starting paying bonuses to affiliate
287 287
 
288 288
     // Black Market - General
Please login to merge, or discard this patch.
classes/Unit/Governor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@
 block discarded – undo
105 105
    * @return int
106 106
    */
107 107
   public function getMaxLevel() {
108
-    $snId =  $this->getSnId();
108
+    $snId = $this->getSnId();
109 109
     return !empty($snId) ? get_unit_param($snId, P_MAX_STACK) : 0;
110 110
   }
111 111
 
Please login to merge, or discard this patch.
classes/DBAL/ActiveRecordAbstract.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@
 block discarded – undo
136 136
       $dbq->setWhereArray(static::translateNames($propertyFilter, static::PROPERTIES_TO_FIELDS));
137 137
     }
138 138
 
139
-    if(static::$_forUpdate == DbQuery::DB_FOR_UPDATE) {
139
+    if (static::$_forUpdate == DbQuery::DB_FOR_UPDATE) {
140 140
       $dbq->setForUpdate();
141 141
       static::$_forUpdate = DbQuery::DB_SHARED;
142 142
     }
Please login to merge, or discard this patch.
classes/template_compile.php 3 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
   }
56 56
 
57 57
   /**
58
-  * Load template source from file
59
-  * @access private
60
-  */
58
+   * Load template source from file
59
+   * @access private
60
+   */
61 61
   function _tpl_load_file($handle, $store_in_db = false)
62 62
   {
63 63
     // Try and open template for read
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
   }
101 101
 
102 102
   /**
103
-  * Remove any PHP tags that do not belong, these regular expressions are derived from
104
-  * the ones that exist in zend_language_scanner.l
105
-  * @access private
106
-  */
103
+   * Remove any PHP tags that do not belong, these regular expressions are derived from
104
+   * the ones that exist in zend_language_scanner.l
105
+   * @access private
106
+   */
107 107
   function remove_php_tags(&$code)
108 108
   {
109 109
     // This matches the information gathered from the internal PHP lexer
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
   }
118 118
 
119 119
   /**
120
-  * The all seeing all doing compile method. Parts are inspired by or directly from Smarty
121
-  * @access private
122
-  */
120
+   * The all seeing all doing compile method. Parts are inspired by or directly from Smarty
121
+   * @access private
122
+   */
123 123
   function compile($code, $no_echo = false, $echo_var = '')
124 124
   {
125 125
     global $config;
@@ -290,9 +290,9 @@  discard block
 block discarded – undo
290 290
   }
291 291
 
292 292
   /**
293
-  * Compile variables
294
-  * @access private
295
-  */
293
+   * Compile variables
294
+   * @access private
295
+   */
296 296
   function compile_var_tags(&$text_blocks)
297 297
   {
298 298
     // including $lang variable
@@ -365,9 +365,9 @@  discard block
 block discarded – undo
365 365
   }
366 366
 
367 367
   /**
368
-  * Compile blocks
369
-  * @access private
370
-  */
368
+   * Compile blocks
369
+   * @access private
370
+   */
371 371
   function compile_tag_block($tag_args)
372 372
   {
373 373
     $no_nesting = false;
@@ -453,14 +453,14 @@  discard block
 block discarded – undo
453 453
     $tag_template_php .= 'if ($_' . $tag_args . '_count) {';
454 454
 
455 455
     /**
456
-    * The following uses foreach for iteration instead of a for loop, foreach is faster but requires PHP to make a copy of the contents of the array which uses more memory
457
-    * <code>
458
-    * if (!$offset)
459
-    * {
460
-    *   $tag_template_php .= 'foreach (' . $varref . ' as $_' . $tag_args . '_i => $_' . $tag_args . '_val){';
461
-    * }
462
-    * </code>
463
-    */
456
+     * The following uses foreach for iteration instead of a for loop, foreach is faster but requires PHP to make a copy of the contents of the array which uses more memory
457
+     * <code>
458
+     * if (!$offset)
459
+     * {
460
+     *   $tag_template_php .= 'foreach (' . $varref . ' as $_' . $tag_args . '_i => $_' . $tag_args . '_val){';
461
+     * }
462
+     * </code>
463
+     */
464 464
 
465 465
     $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){';
466 466
 //    $tag_template_php .= '$this->_block_counter["'. $tag_args . '"] = $_' . $tag_args . '_i;';
@@ -471,10 +471,10 @@  discard block
 block discarded – undo
471 471
   }
472 472
 
473 473
   /**
474
-  * Compile IF tags - much of this is from Smarty with
475
-  * some adaptions for our block level methods
476
-  * @access private
477
-  */
474
+   * Compile IF tags - much of this is from Smarty with
475
+   * some adaptions for our block level methods
476
+   * @access private
477
+   */
478 478
   function compile_tag_if($tag_args, $elseif)
479 479
   {
480 480
     // Tokenize args for 'if' tag.
@@ -629,9 +629,9 @@  discard block
 block discarded – undo
629 629
   }
630 630
 
631 631
   /**
632
-  * Compile DEFINE tags
633
-  * @access private
634
-  */
632
+   * Compile DEFINE tags
633
+   * @access private
634
+   */
635 635
   function compile_tag_define($tag_args, $op)
636 636
   {
637 637
     preg_match('#^((?:[a-z0-9\-_]+\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (\'?)([^\']*)(\'?))?$#', $tag_args, $match);
@@ -682,9 +682,9 @@  discard block
 block discarded – undo
682 682
   }
683 683
 
684 684
   /**
685
-  * Compile INCLUDE tag
686
-  * @access private
687
-  */
685
+   * Compile INCLUDE tag
686
+   * @access private
687
+   */
688 688
   function compile_tag_include($tag_args)
689 689
   {
690 690
     // Process dynamic includes
@@ -697,19 +697,19 @@  discard block
 block discarded – undo
697 697
   }
698 698
 
699 699
   /**
700
-  * Compile INCLUDE_PHP tag
701
-  * @access private
702
-  */
700
+   * Compile INCLUDE_PHP tag
701
+   * @access private
702
+   */
703 703
   function compile_tag_include_php($tag_args)
704 704
   {
705 705
     return "\$this->_php_include('$tag_args');";
706 706
   }
707 707
 
708 708
   /**
709
-  * parse expression
710
-  * This is from Smarty
711
-  * @access private
712
-  */
709
+   * parse expression
710
+   * This is from Smarty
711
+   * @access private
712
+   */
713 713
   function _parse_is_expr($is_arg, $tokens)
714 714
   {
715 715
     $expr_end = 0;
@@ -802,14 +802,14 @@  discard block
 block discarded – undo
802 802
   }
803 803
 
804 804
   /**
805
-  * Generates a reference to the array of data values for the given
806
-  * (possibly nested) block namespace. This is a string of the form:
807
-  * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN']
808
-  *
809
-  * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above.
810
-  * NOTE: does not expect a trailing "." on the blockname.
811
-  * @access private
812
-  */
805
+   * Generates a reference to the array of data values for the given
806
+   * (possibly nested) block namespace. This is a string of the form:
807
+   * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN']
808
+   *
809
+   * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above.
810
+   * NOTE: does not expect a trailing "." on the blockname.
811
+   * @access private
812
+   */
813 813
   function generate_block_data_ref($blockname, $include_last_iterator, $defop = false)
814 814
   {
815 815
     // Get an array of the blocks involved.
@@ -845,9 +845,9 @@  discard block
 block discarded – undo
845 845
   }
846 846
 
847 847
   /**
848
-  * Write compiled file to cache directory
849
-  * @access private
850
-  */
848
+   * Write compiled file to cache directory
849
+   * @access private
850
+   */
851 851
   function compile_write($handle, $data)
852 852
   {
853 853
     $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . DOT_PHP_EX;
@@ -870,9 +870,9 @@  discard block
 block discarded – undo
870 870
 
871 871
   // Gorlum's minifier BOF
872 872
   /**
873
-  * Minifies template w/i PHP code by removing extra spaces
874
-  * @access private
875
-  */
873
+   * Minifies template w/i PHP code by removing extra spaces
874
+   * @access private
875
+   */
876 876
   function minify($html)
877 877
   {
878 878
     global $config;
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -143,9 +143,9 @@  discard block
 block discarded – undo
143 143
 
144 144
     preg_match_all('#<!-- INCLUDE (\{\$?[A-Z0-9\-_]+\}|[a-zA-Z0-9\_\-\+\./]+) -->#', $code, $matches);
145 145
     $include_blocks = $matches[1];
146
-    if($include_blocks)
146
+    if ($include_blocks)
147 147
     {
148
-      foreach($include_blocks as &$included_file)
148
+      foreach ($include_blocks as &$included_file)
149 149
       {
150 150
         $included_file .= '.tpl.html';
151 151
       }
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
       $varname = $var_val[3];
311 311
       $new = $this->generate_block_varref($namespace, $varname, $var_val[2]);
312 312
 
313
-      if(!empty($var_val[4])) {
313
+      if (!empty($var_val[4])) {
314 314
         $new = \Ptl\PtlVariableDecorator::decorate($var_val[0], $new, $this->template);
315 315
       }
316 316
 
@@ -464,8 +464,8 @@  discard block
 block discarded – undo
464 464
 
465 465
     $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){';
466 466
 //    $tag_template_php .= '$this->_block_counter["'. $tag_args . '"] = $_' . $tag_args . '_i;';
467
-    $tag_template_php .= '$_'. $tag_args . '_val = &' . $varref . '[$_'. $tag_args. '_i];';
468
-    $tag_template_php .= '$this->_block_value["'. $tag_args . '"] = &' . $varref . '[$_'. $tag_args. '_i];';
467
+    $tag_template_php .= '$_' . $tag_args . '_val = &' . $varref . '[$_' . $tag_args . '_i];';
468
+    $tag_template_php .= '$this->_block_value["' . $tag_args . '"] = &' . $varref . '[$_' . $tag_args . '_i];';
469 469
 
470 470
     return $tag_template_php;
471 471
   }
@@ -569,10 +569,10 @@  discard block
 block discarded – undo
569 569
         break;
570 570
 
571 571
         case 'is':
572
-          $is_arg_start = ($tokens[$i-1] == ')') ? array_pop($is_arg_stack) : $i-1;
572
+          $is_arg_start = ($tokens[$i - 1] == ')') ? array_pop($is_arg_stack) : $i - 1;
573 573
           $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start));
574 574
 
575
-          $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1));
575
+          $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i + 1));
576 576
 
577 577
           array_splice($tokens, $is_arg_start, sizeof($tokens), $new_tokens);
578 578
 
@@ -836,11 +836,11 @@  discard block
 block discarded – undo
836 836
     }
837 837
     else if ($include_last_iterator)
838 838
     {
839
-      return '$_'. $blocks[$blockcount] . '_val';
839
+      return '$_' . $blocks[$blockcount] . '_val';
840 840
     }
841 841
     else
842 842
     {
843
-      return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']';
843
+      return '$_' . $blocks[$blockcount - 1] . '_val[\'' . $blocks[$blockcount] . '\']';
844 844
     }
845 845
   }
846 846
 
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
     if ($fp = @fopen($filename, 'wb'))
858 858
     {
859 859
       @flock($fp, LOCK_EX);
860
-      @fwrite ($fp, $data);
860
+      @fwrite($fp, $data);
861 861
       @flock($fp, LOCK_UN);
862 862
       @fclose($fp);
863 863
 
@@ -877,7 +877,7 @@  discard block
 block discarded – undo
877 877
   {
878 878
     global $config;
879 879
 
880
-    if(!$config->tpl_minifier)
880
+    if (!$config->tpl_minifier)
881 881
     {
882 882
       return $html;
883 883
     }
@@ -889,14 +889,14 @@  discard block
 block discarded – undo
889 889
     //$html = preg_replace('/[\r\n\t]+/', ' ', $html);
890 890
     $html = preg_replace('/>[\s]*</', '><', $html); // Strip spacechars between tags
891 891
     $html = preg_replace('/[\s]+/', ' ', $html); // Replace several spacechars with one space
892
-    if(!empty($pre[0]))
892
+    if (!empty($pre[0]))
893 893
     {
894
-      foreach($pre[0] as $tag)
894
+      foreach ($pre[0] as $tag)
895 895
       {
896 896
         $tag = preg_replace('/^\ *\/\/[^\<]*?$/m', ' ', $tag); // Strips comments - except those that contains HTML comment inside
897 897
         $tag = preg_replace('/[\ \t]{2,}/', ' ', $tag); // Replace several spaces by one
898 898
         $tag = preg_replace('/\s{2,}/', "\r\n", $tag); // Replace several linefeeds by one
899
-        $html = preg_replace('/#pre#/', $tag, $html,1);
899
+        $html = preg_replace('/#pre#/', $tag, $html, 1);
900 900
       }
901 901
     }
902 902
 
Please login to merge, or discard this patch.
Braces   +33 added lines, -66 removed lines patch added patch discarded remove patch
@@ -37,8 +37,7 @@  discard block
 block discarded – undo
37 37
 *
38 38
 * @package phpBB3
39 39
 */
40
-class template_compile
41
-{
40
+class template_compile {
42 41
   var $template;
43 42
 
44 43
   // Various storage arrays
@@ -58,8 +57,7 @@  discard block
 block discarded – undo
58 57
   * Load template source from file
59 58
   * @access private
60 59
   */
61
-  function _tpl_load_file($handle, $store_in_db = false)
62
-  {
60
+  function _tpl_load_file($handle, $store_in_db = false) {
63 61
     // Try and open template for read
64 62
     if (!file_exists($this->template->files[$handle]))
65 63
     {
@@ -67,8 +65,7 @@  discard block
 block discarded – undo
67 65
       {
68 66
         return;
69 67
         trigger_error("template->_tpl_load_file(): File {$this->template->files[$handle]} does not exist or is empty", E_USER_ERROR);
70
-      }
71
-      else
68
+      } else
72 69
       {
73 70
         $this->template->files[$handle] = $this->template->files_inherit[$handle];
74 71
       }
@@ -104,8 +101,7 @@  discard block
 block discarded – undo
104 101
   * the ones that exist in zend_language_scanner.l
105 102
   * @access private
106 103
   */
107
-  function remove_php_tags(&$code)
108
-  {
104
+  function remove_php_tags(&$code) {
109 105
     // This matches the information gathered from the internal PHP lexer
110 106
     $match = array(
111 107
       '#<([\?%])=?.*?\1>#s',
@@ -120,8 +116,7 @@  discard block
 block discarded – undo
120 116
   * The all seeing all doing compile method. Parts are inspired by or directly from Smarty
121 117
   * @access private
122 118
   */
123
-  function compile($code, $no_echo = false, $echo_var = '')
124
-  {
119
+  function compile($code, $no_echo = false, $echo_var = '') {
125 120
     global $config;
126 121
 
127 122
     if ($echo_var)
@@ -226,15 +221,13 @@  discard block
 block discarded – undo
226 221
               $var = substr($temp, 2, -1);
227 222
               //$file = $this->template->_tpldata['DEFINE']['.'][$var];
228 223
               $temp = "\$this->_tpldata['DEFINE']['.']['$var']";
229
-            }
230
-            else
224
+            } else
231 225
             {
232 226
               $var = substr($temp, 1, -1);
233 227
               //$file = $this->template->_rootref[$var];
234 228
               $temp = "\$this->_rootref['$var']";
235 229
             }
236
-          }
237
-          else
230
+          } else
238 231
           {
239 232
             $file = $temp;
240 233
           }
@@ -293,8 +286,7 @@  discard block
 block discarded – undo
293 286
   * Compile variables
294 287
   * @access private
295 288
   */
296
-  function compile_var_tags(&$text_blocks)
297
-  {
289
+  function compile_var_tags(&$text_blocks) {
298 290
     // including $lang variable
299 291
     global $lang, $config;
300 292
 
@@ -368,8 +360,7 @@  discard block
 block discarded – undo
368 360
   * Compile blocks
369 361
   * @access private
370 362
   */
371
-  function compile_tag_block($tag_args)
372
-  {
363
+  function compile_tag_block($tag_args) {
373 364
     $no_nesting = false;
374 365
 
375 366
     // Is the designer wanting to call another loop in a loop?
@@ -392,8 +383,7 @@  discard block
 block discarded – undo
392 383
       if ($match[2] < 0)
393 384
       {
394 385
         $loop_start = '($_' . $tag_args . '_count ' . $match[2] . ' < 0 ? 0 : $_' . $tag_args . '_count ' . $match[2] . ')';
395
-      }
396
-      else
386
+      } else
397 387
       {
398 388
         $loop_start = '($_' . $tag_args . '_count < ' . $match[2] . ' ? $_' . $tag_args . '_count : ' . $match[2] . ')';
399 389
       }
@@ -401,17 +391,14 @@  discard block
 block discarded – undo
401 391
       if (strlen($match[3]) < 1 || $match[3] == -1)
402 392
       {
403 393
         $loop_end = '$_' . $tag_args . '_count';
404
-      }
405
-      else if ($match[3] >= 0)
394
+      } else if ($match[3] >= 0)
406 395
       {
407 396
         $loop_end = '(' . ($match[3] + 1) . ' > $_' . $tag_args . '_count ? $_' . $tag_args . '_count : ' . ($match[3] + 1) . ')';
408
-      }
409
-      else //if ($match[3] < -1)
397
+      } else //if ($match[3] < -1)
410 398
       {
411 399
         $loop_end = '$_' . $tag_args . '_count' . ($match[3] + 1);
412 400
       }
413
-    }
414
-    else
401
+    } else
415 402
     {
416 403
       $loop_start = 0;
417 404
       $loop_end = '$_' . $tag_args . '_count';
@@ -424,8 +411,7 @@  discard block
 block discarded – undo
424 411
     {
425 412
       // We need to implode $no_nesting times from the end...
426 413
       $block = array_slice($this->block_names, -$no_nesting);
427
-    }
428
-    else
414
+    } else
429 415
     {
430 416
       $block = $this->block_names;
431 417
     }
@@ -435,8 +421,7 @@  discard block
 block discarded – undo
435 421
       // Block is not nested.
436 422
       $tag_template_php = '$_' . $tag_args . "_count = (isset(\$this->_tpldata['$tag_args'])) ? sizeof(\$this->_tpldata['$tag_args']) : 0;";
437 423
       $varref = "\$this->_tpldata['$tag_args']";
438
-    }
439
-    else
424
+    } else
440 425
     {
441 426
       // This block is nested.
442 427
       // Generate a namespace string for this block.
@@ -475,8 +460,7 @@  discard block
 block discarded – undo
475 460
   * some adaptions for our block level methods
476 461
   * @access private
477 462
   */
478
-  function compile_tag_if($tag_args, $elseif)
479
-  {
463
+  function compile_tag_if($tag_args, $elseif) {
480 464
     // Tokenize args for 'if' tag.
481 465
     preg_match_all('/(?:
482 466
       "[^"\\\\]*(?:\\\\.[^"\\\\]*)*"         |
@@ -584,8 +568,7 @@  discard block
 block discarded – undo
584 568
           if (preg_match('#^((?:[a-z0-9\-_]+\.)+)?(\$)?(?=[A-Za-z])([A-Za-z0-9\-_]+)#s', $token, $varrefs))
585 569
           {
586 570
             $token = (!empty($varrefs[1])) ? $this->generate_block_data_ref(substr($varrefs[1], 0, -1), true, $varrefs[2]) . '[\'' . $varrefs[3] . '\']' : (($varrefs[2]) ? '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $varrefs[3] . '\']' : '$this->_rootref[\'' . $varrefs[3] . '\']');
587
-          }
588
-          else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs))
571
+          } else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs))
589 572
           {
590 573
             // Allow checking if loops are set with .loopname
591 574
             // It is also possible to check the loop count by doing <!-- IF .loopname > 1 --> for example
@@ -601,8 +584,7 @@  discard block
 block discarded – undo
601 584
 
602 585
               // Add the block reference for the last child.
603 586
               $varref .= "['" . $block . "']";
604
-            }
605
-            else
587
+            } else
606 588
             {
607 589
               $varref = '$this->_tpldata';
608 590
 
@@ -610,8 +592,7 @@  discard block
 block discarded – undo
610 592
               $varref .= "['" . $blocks[0] . "']";
611 593
             }
612 594
             $token = "sizeof($varref)";
613
-          }
614
-          else if (!empty($token))
595
+          } else if (!empty($token))
615 596
           {
616 597
             $token = '(' . $token . ')';
617 598
           }
@@ -632,8 +613,7 @@  discard block
 block discarded – undo
632 613
   * Compile DEFINE tags
633 614
   * @access private
634 615
   */
635
-  function compile_tag_define($tag_args, $op)
636
-  {
616
+  function compile_tag_define($tag_args, $op) {
637 617
     preg_match('#^((?:[a-z0-9\-_]+\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (\'?)([^\']*)(\'?))?$#', $tag_args, $match);
638 618
 
639 619
     if (empty($match[2]) || (!isset($match[4]) && $op))
@@ -656,8 +636,7 @@  discard block
 block discarded – undo
656 636
 
657 637
       // Now replace the php code
658 638
       $match[4] = "'" . str_replace(array('<?php echo ', '; ?>'), array("' . ", " . '"), $match[4]) . "'";
659
-    }
660
-    else
639
+    } else
661 640
     {
662 641
       preg_match('#true|false|\.#i', $match[4], $type);
663 642
 
@@ -685,8 +664,7 @@  discard block
 block discarded – undo
685 664
   * Compile INCLUDE tag
686 665
   * @access private
687 666
   */
688
-  function compile_tag_include($tag_args)
689
-  {
667
+  function compile_tag_include($tag_args) {
690 668
     // Process dynamic includes
691 669
     if ($tag_args[0] == '$')
692 670
     {
@@ -700,8 +678,7 @@  discard block
 block discarded – undo
700 678
   * Compile INCLUDE_PHP tag
701 679
   * @access private
702 680
   */
703
-  function compile_tag_include_php($tag_args)
704
-  {
681
+  function compile_tag_include_php($tag_args) {
705 682
     return "\$this->_php_include('$tag_args');";
706 683
   }
707 684
 
@@ -710,8 +687,7 @@  discard block
 block discarded – undo
710 687
   * This is from Smarty
711 688
   * @access private
712 689
   */
713
-  function _parse_is_expr($is_arg, $tokens)
714
-  {
690
+  function _parse_is_expr($is_arg, $tokens) {
715 691
     $expr_end = 0;
716 692
     $negate_expr = false;
717 693
 
@@ -719,8 +695,7 @@  discard block
 block discarded – undo
719 695
     {
720 696
       $negate_expr = true;
721 697
       $expr_type = array_shift($tokens);
722
-    }
723
-    else
698
+    } else
724 699
     {
725 700
       $expr_type = $first_token;
726 701
     }
@@ -733,8 +708,7 @@  discard block
 block discarded – undo
733 708
           $expr_end++;
734 709
           $expr_arg = $tokens[$expr_end++];
735 710
           $expr = "!(($is_arg / $expr_arg) % $expr_arg)";
736
-        }
737
-        else
711
+        } else
738 712
         {
739 713
           $expr = "!($is_arg & 1)";
740 714
         }
@@ -746,8 +720,7 @@  discard block
 block discarded – undo
746 720
           $expr_end++;
747 721
           $expr_arg = $tokens[$expr_end++];
748 722
           $expr = "(($is_arg / $expr_arg) % $expr_arg)";
749
-        }
750
-        else
723
+        } else
751 724
         {
752 725
           $expr = "($is_arg & 1)";
753 726
         }
@@ -786,8 +759,7 @@  discard block
 block discarded – undo
786 759
    *
787 760
    * @return string
788 761
    */
789
-  private function generate_block_varref($namespace, $varname, $defop = false)
790
-  {
762
+  private function generate_block_varref($namespace, $varname, $defop = false) {
791 763
     // Strip the trailing period.
792 764
     $namespace = substr($namespace, 0, -1);
793 765
 
@@ -810,8 +782,7 @@  discard block
 block discarded – undo
810 782
   * NOTE: does not expect a trailing "." on the blockname.
811 783
   * @access private
812 784
   */
813
-  function generate_block_data_ref($blockname, $include_last_iterator, $defop = false)
814
-  {
785
+  function generate_block_data_ref($blockname, $include_last_iterator, $defop = false) {
815 786
     // Get an array of the blocks involved.
816 787
     $blocks = explode('.', $blockname);
817 788
     $blockcount = sizeof($blocks) - 1;
@@ -833,12 +804,10 @@  discard block
 block discarded – undo
833 804
         $varref .= '[$_' . $blocks[$blockcount] . '_i]';
834 805
       }
835 806
       return $varref;
836
-    }
837
-    else if ($include_last_iterator)
807
+    } else if ($include_last_iterator)
838 808
     {
839 809
       return '$_'. $blocks[$blockcount] . '_val';
840
-    }
841
-    else
810
+    } else
842 811
     {
843 812
       return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']';
844 813
     }
@@ -848,8 +817,7 @@  discard block
 block discarded – undo
848 817
   * Write compiled file to cache directory
849 818
   * @access private
850 819
   */
851
-  function compile_write($handle, $data)
852
-  {
820
+  function compile_write($handle, $data) {
853 821
     $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . DOT_PHP_EX;
854 822
 
855 823
     $data = "<?php if (!defined('INSIDE')) exit;" . ((strpos($data, '<?php') === 0) ? substr($data, 5) : ' ?>' . $data);
@@ -873,8 +841,7 @@  discard block
 block discarded – undo
873 841
   * Minifies template w/i PHP code by removing extra spaces
874 842
   * @access private
875 843
   */
876
-  function minify($html)
877
-  {
844
+  function minify($html) {
878 845
     global $config;
879 846
 
880 847
     if(!$config->tpl_minifier)
Please login to merge, or discard this patch.
metamatter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 }
113 113
 
114 114
 $payment_methods_available = array_combine(array_keys(sn_module_payment::$payment_methods), array_fill(0, count(sn_module_payment::$payment_methods), null));
115
-array_walk($payment_methods_available, function (&$value, $index) {
115
+array_walk($payment_methods_available, function(&$value, $index) {
116 116
   $value = !empty(sn_module_payment::$payment_methods[$index]) ? array_combine(array_keys(sn_module_payment::$payment_methods[$index]), array_fill(0, count(sn_module_payment::$payment_methods[$index]), null)) : $value;
117 117
 });
118 118
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
   'PLAYER_CURRENCY'              => $player_currency,
301 301
   'PLAYER_CURRENCY_PRICE_PER_MM' => sn_module_payment::currency_convert(1, $player_currency, 'MM_', 10),
302 302
 
303
-  'UNIT_AMOUNT'                 => (float)$request['metamatter'],
303
+  'UNIT_AMOUNT'                 => (float) $request['metamatter'],
304 304
   'UNIT_AMOUNT_TEXT'            => HelperString::numberFloorAndFormat($request['metamatter']),
305 305
   'UNIT_AMOUNT_BONUS_PERCENT'   => $bonus_percent,
306 306
   'UNIT_AMOUNT_TEXT_DISCOUNTED' => $income_metamatter_text,
Please login to merge, or discard this patch.
includes/includes/ube_attack_calculate.php 2 patches
Spacing   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -165,8 +165,7 @@  discard block
 block discarded – undo
165 165
     $planet_info[PLANET_SYSTEM],
166 166
     $planet_info[PLANET_PLANET],
167 167
     htmlentities($planet_info[PLANET_NAME], ENT_COMPAT, 'UTF-8'),
168
-    $lang[$outcome['UBE_COMBAT_RESULT'] == UBE_COMBAT_RESULT_WIN ? 'ube_report_info_outcome_win' :
169
-      ($outcome['UBE_COMBAT_RESULT'] == UBE_COMBAT_RESULT_DRAW ? 'ube_report_info_outcome_draw' : 'ube_report_info_outcome_loss')]
168
+    $lang[$outcome['UBE_COMBAT_RESULT'] == UBE_COMBAT_RESULT_WIN ? 'ube_report_info_outcome_win' : ($outcome['UBE_COMBAT_RESULT'] == UBE_COMBAT_RESULT_DRAW ? 'ube_report_info_outcome_draw' : 'ube_report_info_outcome_loss')]
170 169
   );
171 170
 
172 171
   $text_defender = '';
@@ -251,7 +250,7 @@  discard block
 block discarded – undo
251 250
       // Просматриваем результаты изменения флотов
252 251
       foreach ($fleet_info[UBE_COUNT] as $unit_id => $unit_count) {
253 252
         // Перебираем аутком на случай восстановления юнитов
254
-        $units_lost = (float)$fleets_outcome[$fleet_id][UBE_UNITS_LOST][$unit_id];
253
+        $units_lost = (float) $fleets_outcome[$fleet_id][UBE_UNITS_LOST][$unit_id];
255 254
 
256 255
         $units_left = $unit_count - $units_lost;
257 256
         if ($fleet_id) {
@@ -275,7 +274,7 @@  discard block
 block discarded – undo
275 274
     // Если во флоте остались юниты или это планета - генерируем изменение ресурсов
276 275
     if ($new_fleet_count || !$fleet_id) {
277 276
       foreach (sn_get_groups('resources_loot') as $resource_id) {
278
-        $resource_change = (float)$fleets_outcome[$fleet_id][UBE_RESOURCES_LOOTED][$resource_id] + (float)$fleets_outcome[$fleet_id][UBE_CARGO_DROPPED][$resource_id];
277
+        $resource_change = (float) $fleets_outcome[$fleet_id][UBE_RESOURCES_LOOTED][$resource_id] + (float) $fleets_outcome[$fleet_id][UBE_CARGO_DROPPED][$resource_id];
279 278
         if ($resource_change) {
280 279
           $resource_db_name = ($fleet_id ? 'fleet_resource_' : '') . pname_resource_name($resource_id);
281 280
           $fleet_delta[$resource_db_name] = -($resource_change);
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -290,10 +290,12 @@  discard block
 block discarded – undo
290 290
       }
291 291
     }
292 292
 
293
-    if ($fleet_id) // Не планета
293
+    if ($fleet_id) {
294
+      // Не планета
294 295
     {
295 296
       if ($fleet_info[UBE_FLEET_TYPE] == UBE_ATTACKERS && $outcome[UBE_MOON_REAPERS] == UBE_MOON_REAPERS_DIED) {
296 297
         $new_fleet_count = 0;
298
+    }
297 299
       }
298 300
 
299 301
       if ($new_fleet_count) {
@@ -316,10 +318,12 @@  discard block
 block discarded – undo
316 318
         }
317 319
         DBStaticPlanet::db_planet_set_by_id($planet_id, implode(',', $temp));
318 320
       }
319
-      if (!empty($db_changeset)) // Сохраняем изменения юнитов на планете - если они есть
321
+      if (!empty($db_changeset)) {
322
+        // Сохраняем изменения юнитов на планете - если они есть
320 323
       {
321 324
         OldDbChangeSet::db_changeset_apply($db_changeset);
322 325
       }
326
+      }
323 327
     }
324 328
   }
325 329
 
Please login to merge, or discard this patch.