Completed
Push — work-fleets ( 71ccb1...0d1d7f )
by SuperNova.WS
06:04
created
includes/classes/cache.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -98,11 +98,11 @@  discard block
 block discarded – undo
98 98
       default:
99 99
         switch (self::$mode) {
100 100
           case CACHER_NO_CACHE:
101
-            self::$data[$this->prefix . $name] = $value;
101
+            self::$data[$this->prefix.$name] = $value;
102 102
           break;
103 103
 
104 104
           case CACHER_XCACHE:
105
-            xcache_set($this->prefix . $name, $value);
105
+            xcache_set($this->prefix.$name, $value);
106 106
           break;
107 107
         }
108 108
       break;
@@ -122,11 +122,11 @@  discard block
 block discarded – undo
122 122
       default:
123 123
         switch (self::$mode) {
124 124
           case CACHER_NO_CACHE:
125
-            return self::$data[$this->prefix . $name];
125
+            return self::$data[$this->prefix.$name];
126 126
           break;
127 127
 
128 128
           case CACHER_XCACHE:
129
-            return xcache_get($this->prefix . $name);
129
+            return xcache_get($this->prefix.$name);
130 130
           break;
131 131
 
132 132
         }
@@ -139,11 +139,11 @@  discard block
 block discarded – undo
139 139
   public function __isset($name) {
140 140
     switch (self::$mode) {
141 141
       case CACHER_NO_CACHE:
142
-        return isset(self::$data[$this->prefix . $name]);
142
+        return isset(self::$data[$this->prefix.$name]);
143 143
       break;
144 144
 
145 145
       case CACHER_XCACHE:
146
-        return xcache_isset($this->prefix . $name) && ($this->__get($name) !== null);
146
+        return xcache_isset($this->prefix.$name) && ($this->__get($name) !== null);
147 147
       break;
148 148
     }
149 149
 
@@ -153,25 +153,25 @@  discard block
 block discarded – undo
153 153
   public function __unset($name) {
154 154
     switch (self::$mode) {
155 155
       case CACHER_NO_CACHE:
156
-        unset(self::$data[$this->prefix . $name]);
156
+        unset(self::$data[$this->prefix.$name]);
157 157
       break;
158 158
 
159 159
       case CACHER_XCACHE:
160
-        xcache_unset($this->prefix . $name);
160
+        xcache_unset($this->prefix.$name);
161 161
       break;
162 162
     }
163 163
   }
164 164
 
165 165
   public function unset_by_prefix($prefix_unset = '') {
166 166
     static $array_clear;
167
-    !$array_clear ? $array_clear = function (&$v, $k, $p) {
167
+    !$array_clear ? $array_clear = function(&$v, $k, $p) {
168 168
       strpos($k, $p) === 0 ? $v = null : false;
169 169
     } : false;
170 170
 
171 171
     switch (self::$mode) {
172 172
       case CACHER_NO_CACHE:
173 173
 //        array_walk(self::$data, create_function('&$v,$k,$p', 'if(strpos($k, $p) === 0)$v = NULL;'), $this->prefix.$prefix_unset);
174
-        array_walk(self::$data, $array_clear, $this->prefix . $prefix_unset);
174
+        array_walk(self::$data, $array_clear, $this->prefix.$prefix_unset);
175 175
 
176 176
         return true;
177 177
       break;
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
           return false;
182 182
         }
183 183
 
184
-        return xcache_unset_by_prefix($this->prefix . $prefix_unset);
184
+        return xcache_unset_by_prefix($this->prefix.$prefix_unset);
185 185
       break;
186 186
     }
187 187
 
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
     if ($this->$name[0] === null) {
220 220
       for ($i = count($name) - 1; $i > 0; $i--) {
221 221
         $cName = "{$name[$i]}_COUNT";
222
-        $cName1 = "{$name[$i-1]}_COUNT";
222
+        $cName1 = "{$name[$i - 1]}_COUNT";
223 223
         if ($this->$cName1 == null || $i == 1) {
224 224
           $this->$cName++;
225 225
         }
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 
265 265
     for ($i = 1; $i < count($name); $i++) {
266 266
       $cName = "{$name[$i]}_COUNT";
267
-      $cName1 = "{$name[$i-1]}_COUNT";
267
+      $cName1 = "{$name[$i - 1]}_COUNT";
268 268
 
269 269
       if ($i == 1 || $this->$cName1 === null) {
270 270
         $this->$cName--;
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
         $qry[] = "('{$item_name}', '{$item_value}')";
401 401
       }
402 402
     }
403
-    doquery("REPLACE INTO `{{" . $this->table_name . "}}` (`{$this->sql_index_field}`, `{$this->sql_value_field}`) VALUES " . implode(',', $qry) . ";");
403
+    doquery("REPLACE INTO `{{".$this->table_name."}}` (`{$this->sql_index_field}`, `{$this->sql_value_field}`) VALUES ".implode(',', $qry).";");
404 404
 
405 405
     // И только после взятия блокировок - меняем значения в кэше
406 406
     foreach ($item_list as $item_name => $item_value) {
@@ -600,9 +600,9 @@  discard block
 block discarded – undo
600 600
     'advGoogleLeftMenuCode'        => '(Place here code for banner)',
601 601
 
602 602
     // Alliance bonus calculations
603
-    'ali_bonus_algorithm'          => 0,  // Bonus calculation algorithm
603
+    'ali_bonus_algorithm'          => 0, // Bonus calculation algorithm
604 604
     'ali_bonus_brackets'           => 10, // Brackets count for ALI_BONUS_BY_RANK
605
-    'ali_bonus_brackets_divisor'   => 10,// Bonus divisor for ALI_BONUS_BY_RANK
605
+    'ali_bonus_brackets_divisor'   => 10, // Bonus divisor for ALI_BONUS_BY_RANK
606 606
     'ali_bonus_divisor'            => 10000000, // Rank divisor for ALI_BONUS_BY_POINTS
607 607
     'ali_bonus_members'            => 10, // Minumum alliace size to start using bonus
608 608
 
@@ -633,25 +633,25 @@  discard block
 block discarded – undo
633 633
     'deuterium_basic_income'       => 0,
634 634
     'eco_scale_storage'            => 1,
635 635
     'eco_stockman_fleet'           => '', // Black Market - Starting amount of s/h ship merchant to sell
636
-    'eco_stockman_fleet_populate'  => 1,  // Populate empty Stockman fleet with ships or not
636
+    'eco_stockman_fleet_populate'  => 1, // Populate empty Stockman fleet with ships or not
637 637
     'empire_mercenary_base_period' => PERIOD_MONTH, // Base
638 638
     'empire_mercenary_temporary'   => 0, // Temporary empire-wide mercenaries
639 639
     'energy_basic_income'          => 0,
640 640
 
641 641
     // Bashing protection settings
642
-    'fleet_bashing_attacks'        => 3,      // Max amount of attack per wave - 3 by default
643
-    'fleet_bashing_interval'       => 1800,   // Maximum interval between attacks when they still count as one wave - 30m by default
644
-    'fleet_bashing_scope'          => 86400,  // Interval on which bashing waves counts - 24h by default
645
-    'fleet_bashing_war_delay'      => 43200,  // Delay before start bashing after declaring war to alliance - 12h by default
646
-    'fleet_bashing_waves'          => 3,      // Max amount of waves per day - 3 by default
642
+    'fleet_bashing_attacks'        => 3, // Max amount of attack per wave - 3 by default
643
+    'fleet_bashing_interval'       => 1800, // Maximum interval between attacks when they still count as one wave - 30m by default
644
+    'fleet_bashing_scope'          => 86400, // Interval on which bashing waves counts - 24h by default
645
+    'fleet_bashing_war_delay'      => 43200, // Delay before start bashing after declaring war to alliance - 12h by default
646
+    'fleet_bashing_waves'          => 3, // Max amount of waves per day - 3 by default
647 647
 
648 648
     'Fleet_Cdr'   => 30,
649 649
     'fleet_speed' => 1,
650 650
 
651 651
     'fleet_update_interval' => 4,
652 652
 
653
-    'game_adminEmail'       => 'root@localhost',    // Admin's email to show to users
654
-    'game_counter'          => 0,  // Does built-in page hit counter is on?
653
+    'game_adminEmail'       => 'root@localhost', // Admin's email to show to users
654
+    'game_counter'          => 0, // Does built-in page hit counter is on?
655 655
     // Defaults
656 656
     'game_default_language' => 'ru',
657 657
     'game_default_skin'     => 'skins/EpicBlue/',
@@ -665,13 +665,13 @@  discard block
 block discarded – undo
665 665
     'game_maxSystem'      => 199,
666 666
     'game_maxPlanet'      => 15,
667 667
     // Game global settings
668
-    'game_mode'           => 0,           // 0 - SuperNova, 1 - oGame
668
+    'game_mode'           => 0, // 0 - SuperNova, 1 - oGame
669 669
     'game_name'           => 'SuperNova', // Server name (would be on banners and on top of left menu)
670 670
 
671 671
     'game_news_actual'   => 259200, // How long announcement would be marked as "New". In seconds. Default - 3 days
672
-    'game_news_overview' => 3,    // How much last news to show in Overview page
672
+    'game_news_overview' => 3, // How much last news to show in Overview page
673 673
     // Noob protection
674
-    'game_noob_factor'   => 5,    // Multiplier to divide "stronger" and "weaker" users
674
+    'game_noob_factor'   => 5, // Multiplier to divide "stronger" and "weaker" users
675 675
     'game_noob_points'   => 5000, // Below this point user threated as noob. 0 to disable
676 676
 
677 677
     'game_multiaccount_enabled' => 0, // 1 - allow interactions for players with same IP (multiaccounts)
@@ -721,8 +721,8 @@  discard block
 block discarded – undo
721 721
     'payment_currency_exchange_wmu' => 30,
722 722
     'payment_currency_exchange_wmz' => 1,
723 723
 
724
-    'payment_lot_price' => 1,     // Lot price in default currency
725
-    'payment_lot_size'  => 2500,  // Lot size. Also service as minimum amount of DM that could be bought with one transaction
724
+    'payment_lot_price' => 1, // Lot price in default currency
725
+    'payment_lot_size'  => 2500, // Lot size. Also service as minimum amount of DM that could be bought with one transaction
726 726
 
727 727
     'planet_teleport_cost'    => 50000, //
728 728
     'planet_teleport_timeout' => 86400, //
@@ -740,7 +740,7 @@  discard block
 block discarded – undo
740 740
     'resource_multiplier'     => 1,
741 741
 
742 742
     //Roleplay system
743
-    'rpg_bonus_divisor'       => 10,    // Amount of DM referral shoud get for partner have 1 DM bonus
743
+    'rpg_bonus_divisor'       => 10, // Amount of DM referral shoud get for partner have 1 DM bonus
744 744
     'rpg_bonus_minimum'       => 10000, // Minimum DM ammount for starting paying bonuses to affiliate
745 745
 
746 746
     // Black Market - General
Please login to merge, or discard this patch.
includes/db/db_queries.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
 
18 18
 function db_planet_list_admin_list($table_parent_columns, $planet_active, $active_time, $planet_type) {
19 19
   return doquery(
20
-    "SELECT p.*, u.username" . ($table_parent_columns ? ', p1.name AS parent_name' : '') .
20
+    "SELECT p.*, u.username".($table_parent_columns ? ', p1.name AS parent_name' : '').
21 21
     " FROM {{planets}} AS p
22 22
       LEFT JOIN {{users}} AS u ON u.id = p.id_owner" .
23
-    ($table_parent_columns ? ' LEFT JOIN {{planets}} AS p1 ON p1.id = p.parent_planet' : '') .
24
-    " WHERE " . ($planet_active ? "p.last_update >= {$active_time}" : "p.planet_type = {$planet_type}"));
23
+    ($table_parent_columns ? ' LEFT JOIN {{planets}} AS p1 ON p1.id = p.parent_planet' : '').
24
+    " WHERE ".($planet_active ? "p.last_update >= {$active_time}" : "p.planet_type = {$planet_type}"));
25 25
 }
26 26
 
27 27
 function db_planet_list_search($searchtext) {
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     ORDER BY
122 122
       sp.`{$Rank}_rank`, subject.{$source['id']}
123 123
     LIMIT
124
-      " . $start . ",100;";
124
+      ".$start.",100;";
125 125
     } else { // , UNIX_TIMESTAMP(CONCAT(YEAR(CURRENT_DATE), DATE_FORMAT(`user_birthday`, '-%m-%d'))) AS `nearest_birthday`
126 126
       $query_str =
127 127
         "SELECT
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     ORDER BY
135 135
       subject.{$Rank} DESC, subject.{$source['id']}
136 136
     LIMIT
137
-      " . $start . ",100;";
137
+      ".$start.",100;";
138 138
     }
139 139
   } else {
140 140
     // TODO
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
   ORDER BY
152 152
     sp.`{$Rank}_rank`, subject.id
153 153
   LIMIT
154
-    " . $start . ",100;";
154
+    ".$start.",100;";
155 155
   }
156 156
 
157 157
   return doquery($query_str);
@@ -374,9 +374,9 @@  discard block
 block discarded – undo
374 374
  */
375 375
 function db_payment_list_get($flt_payer, $flt_status, $flt_test, $flt_module) {
376 376
   $extra_conditions =
377
-    ($flt_payer > 0 ? "AND payment_user_id = {$flt_payer} " : '') .
378
-    ($flt_status >= 0 ? "AND payment_status = {$flt_status} " : '') .
379
-    ($flt_test >= 0 ? "AND payment_test = {$flt_test} " : '') .
377
+    ($flt_payer > 0 ? "AND payment_user_id = {$flt_payer} " : '').
378
+    ($flt_status >= 0 ? "AND payment_status = {$flt_status} " : '').
379
+    ($flt_test >= 0 ? "AND payment_test = {$flt_test} " : '').
380 380
     ($flt_module ? "AND payment_module_name = '{$flt_module}' " : '');
381 381
   $query = doquery("SELECT * FROM `{{payment}}` WHERE 1 {$extra_conditions} ORDER BY payment_id DESC;");
382 382
 
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 
405 405
 // Log Online *************************************************************************************************************
406 406
 function db_log_online_insert() {
407
-  doquery("INSERT IGNORE INTO {{log_users_online}} SET online_count = " . classSupernova::$config->var_online_user_count);
407
+  doquery("INSERT IGNORE INTO {{log_users_online}} SET online_count = ".classSupernova::$config->var_online_user_count);
408 408
 }
409 409
 
410 410
 // Log *************************************************************************************************************
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
       `ban_user_id` = '{$banned['id']}',
613 613
       `ban_user_name` = '{$banned['username']}',
614 614
       `ban_reason` = '{$reason}',
615
-      `ban_time` = " . SN_TIME_NOW . ",
615
+      `ban_time` = ".SN_TIME_NOW.",
616 616
       `ban_until` = {$ban_until},
617 617
       `ban_issuer_id` = '{$banner['id']}',
618 618
       `ban_issuer_name` = '{$banner['username']}',
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
       `ban_user_name` = '{$banned['username']}',
635 635
       `ban_reason` = '{$reason}',
636 636
       `ban_time` = 0,
637
-      `ban_until` = " . SN_TIME_NOW . ",
637
+      `ban_until` = ".SN_TIME_NOW.",
638 638
       `ban_issuer_id` = '{$banner['id']}',
639 639
       `ban_issuer_name` = '{$banner['username']}',
640 640
       `ban_issuer_email` = '{$banner['email']}'
@@ -693,9 +693,9 @@  discard block
 block discarded – undo
693 693
 function db_ube_report_get_best_battles() {
694 694
   $query = doquery("SELECT *
695 695
       FROM {{ube_report}}
696
-      WHERE `ube_report_time_process` <  DATE(DATE_SUB(NOW(), INTERVAL " . MODULE_INFO_BEST_BATTLES_LOCK_DAYS . " DAY))
696
+      WHERE `ube_report_time_process` <  DATE(DATE_SUB(NOW(), INTERVAL " . MODULE_INFO_BEST_BATTLES_LOCK_DAYS." DAY))
697 697
       ORDER BY `ube_report_debris_total_in_metal` DESC, `ube_report_id` ASC
698
-      LIMIT " . MODULE_INFO_BEST_BATTLES_REPORT_VIEW . ";");
698
+      LIMIT " . MODULE_INFO_BEST_BATTLES_REPORT_VIEW.";");
699 699
 
700 700
   return $query;
701 701
 }
Please login to merge, or discard this patch.
flotenajax.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
3
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
4 4
 
5 5
 $template = gettemplate('viewreport', true);
6 6
 $template->assign_var('PAGE_HINT', classLocale::$lang['cr_view_hint']);
Please login to merge, or discard this patch.
includes/classes/auth_local.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -93,12 +93,12 @@  discard block
 block discarded – undo
93 93
     $this->prepare();
94 94
 
95 95
     $this->manifest['active'] = false;
96
-    if(!empty($this->config) && is_array($this->config['db'])) {
96
+    if (!empty($this->config) && is_array($this->config['db'])) {
97 97
       // БД, отличная от стандартной
98 98
       $this->db = new db_mysql();
99 99
 
100 100
       $this->db->sn_db_connect($this->config['db']);
101
-      if($this->manifest['active'] = $this->db->connected) {
101
+      if ($this->manifest['active'] = $this->db->connected) {
102 102
         $this->provider_id = ACCOUNT_PROVIDER_CENTRAL;
103 103
 
104 104
         $this->domain = $this->config['domain'];
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     }
113 113
 
114 114
     // Fallback to local DB
115
-    if(!$this->manifest['active']) {
115
+    if (!$this->manifest['active']) {
116 116
       $this->db = classSupernova::$db;
117 117
 
118 118
       $this->provider_id = ACCOUNT_PROVIDER_LOCAL;
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
       $this->manifest['active'] = true;
126 126
     }
127 127
 
128
-    $this->cookie_name_impersonate = $this->cookie_name . AUTH_COOKIE_IMPERSONATE_SUFFIX;
128
+    $this->cookie_name_impersonate = $this->cookie_name.AUTH_COOKIE_IMPERSONATE_SUFFIX;
129 129
 
130 130
     $this->account = new Account($this->db);
131 131
     $this->confirmation = new Confirmation($this->db);
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
   // OK v4.5
167 167
   public function password_change($old_password_unsafe, $new_password_unsafe, $salt_unsafe = null) {
168 168
     $result = parent::password_change($old_password_unsafe, $new_password_unsafe, $salt_unsafe);
169
-    if($result) {
169
+    if ($result) {
170 170
       $this->cookie_set();
171 171
     }
172 172
 
@@ -194,12 +194,12 @@  discard block
 block discarded – undo
194 194
    */
195 195
   // OK v4.6
196 196
   protected function password_reset_send_code() {
197
-    if(!$this->is_password_reset) {
197
+    if (!$this->is_password_reset) {
198 198
       return $this->account_login_status;
199 199
     }
200 200
 
201 201
     // Проверяем поддержку сброса пароля
202
-    if(!$this->is_feature_supported(AUTH_FEATURE_PASSWORD_RESET)) {
202
+    if (!$this->is_feature_supported(AUTH_FEATURE_PASSWORD_RESET)) {
203 203
       return $this->account_login_status;
204 204
     }
205 205
 
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
       unset($this->account);
210 210
       $this->account = new Account($this->db);
211 211
 
212
-      if(!$this->account->db_get_by_email($email_unsafe)) {
212
+      if (!$this->account->db_get_by_email($email_unsafe)) {
213 213
         throw new Exception(PASSWORD_RESTORE_ERROR_EMAIL_NOT_EXISTS, ERR_ERROR);
214 214
         // return $this->account_login_status;
215 215
       }
@@ -219,14 +219,14 @@  discard block
 block discarded – undo
219 219
 
220 220
       // TODO - Проверять уровень доступа аккаунта!
221 221
       // Аккаунты с АУТЛЕВЕЛ больше 0 - НЕ СБРАСЫВАЮТ ПАРОЛИ!
222
-      foreach($user_list as $user_id => $user_data) {
223
-        if($user_data['authlevel'] > AUTH_LEVEL_REGISTERED) {
222
+      foreach ($user_list as $user_id => $user_data) {
223
+        if ($user_data['authlevel'] > AUTH_LEVEL_REGISTERED) {
224 224
           throw new Exception(PASSWORD_RESTORE_ERROR_ADMIN_ACCOUNT, ERR_ERROR);
225 225
         }
226 226
       }
227 227
 
228 228
       $confirmation = $this->confirmation->db_confirmation_get_latest_by_type_and_email(CONFIRM_PASSWORD_RESET, $email_unsafe); // OK 4.5
229
-      if(isset($confirmation['create_time']) && SN_TIME_NOW - strtotime($confirmation['create_time']) < PERIOD_MINUTE_10) {
229
+      if (isset($confirmation['create_time']) && SN_TIME_NOW - strtotime($confirmation['create_time']) < PERIOD_MINUTE_10) {
230 230
         throw new Exception(PASSWORD_RESTORE_ERROR_TOO_OFTEN, ERR_ERROR);
231 231
       }
232 232
 
@@ -239,11 +239,11 @@  discard block
 block discarded – undo
239 239
 
240 240
       @$result = mymail($email_unsafe,
241 241
         sprintf(classLocale::$lang['log_lost_email_title'], classSupernova::$config->game_name),
242
-        sprintf(classLocale::$lang['log_lost_email_code'], SN_ROOT_VIRTUAL . 'login.php', $confirm_code_unsafe, date(FMT_DATE_TIME, SN_TIME_NOW + AUTH_PASSWORD_RESET_CONFIRMATION_EXPIRE), classSupernova::$config->game_name)
242
+        sprintf(classLocale::$lang['log_lost_email_code'], SN_ROOT_VIRTUAL.'login.php', $confirm_code_unsafe, date(FMT_DATE_TIME, SN_TIME_NOW + AUTH_PASSWORD_RESET_CONFIRMATION_EXPIRE), classSupernova::$config->game_name)
243 243
       );
244 244
 
245 245
       $result = $result ? PASSWORD_RESTORE_SUCCESS_CODE_SENT : PASSWORD_RESTORE_ERROR_SENDING;
246
-    } catch(Exception $e) {
246
+    } catch (Exception $e) {
247 247
       sn_db_transaction_rollback();
248 248
       $result = $e->getMessage();
249 249
     }
@@ -256,46 +256,46 @@  discard block
 block discarded – undo
256 256
    * @return int|string
257 257
    */
258 258
   protected function password_reset_confirm() {
259
-    if(!$this->is_password_reset_confirm) {
259
+    if (!$this->is_password_reset_confirm) {
260 260
       return $this->account_login_status;
261 261
     }
262 262
 
263
-    if($this->account_login_status != LOGIN_UNDEFINED) {
263
+    if ($this->account_login_status != LOGIN_UNDEFINED) {
264 264
       return $this->account_login_status;
265 265
     }
266 266
 
267 267
     // Проверяем поддержку сброса пароля
268
-    if(!$this->is_feature_supported(AUTH_FEATURE_PASSWORD_RESET)) {
268
+    if (!$this->is_feature_supported(AUTH_FEATURE_PASSWORD_RESET)) {
269 269
       return $this->account_login_status;
270 270
     }
271 271
 
272 272
     try {
273 273
       $code_unsafe = sys_get_param_str_unsafe('password_reset_code');
274
-      if(empty($code_unsafe)) {
274
+      if (empty($code_unsafe)) {
275 275
         throw new Exception(PASSWORD_RESTORE_ERROR_CODE_EMPTY, ERR_ERROR);
276 276
       }
277 277
 
278 278
       sn_db_transaction_start();
279 279
       $confirmation = $this->confirmation->db_confirmation_get_by_type_and_code(CONFIRM_PASSWORD_RESET, $code_unsafe); // OK 4.5
280 280
 
281
-      if(empty($confirmation)) {
281
+      if (empty($confirmation)) {
282 282
         throw new Exception(PASSWORD_RESTORE_ERROR_CODE_WRONG, ERR_ERROR);
283 283
       }
284 284
 
285
-      if(SN_TIME_NOW - strtotime($confirmation['create_time']) > AUTH_PASSWORD_RESET_CONFIRMATION_EXPIRE) {
285
+      if (SN_TIME_NOW - strtotime($confirmation['create_time']) > AUTH_PASSWORD_RESET_CONFIRMATION_EXPIRE) {
286 286
         throw new Exception(PASSWORD_RESTORE_ERROR_CODE_TOO_OLD, ERR_ERROR);
287 287
       }
288 288
 
289 289
       unset($this->account);
290 290
       $this->account = new Account($this->db);
291 291
 
292
-      if(!$this->account->db_get_by_email($confirmation['email'])) {
292
+      if (!$this->account->db_get_by_email($confirmation['email'])) {
293 293
         throw new Exception(PASSWORD_RESTORE_ERROR_CODE_OK_BUT_NO_ACCOUNT_FOR_EMAIL, ERR_ERROR);
294 294
       }
295 295
 
296 296
       $new_password_unsafe = $this->make_random_password();
297 297
       $salt_unsafe = $this->password_salt_generate();
298
-      if(!$this->account->db_set_password($new_password_unsafe, $salt_unsafe)) {
298
+      if (!$this->account->db_set_password($new_password_unsafe, $salt_unsafe)) {
299 299
         // Ошибка смены пароля
300 300
         throw new Exception(AUTH_ERROR_INTERNAL_PASSWORD_CHANGE_ON_RESTORE, ERR_ERROR);
301 301
       }
@@ -305,14 +305,14 @@  discard block
 block discarded – undo
305 305
       $this->cookie_set();
306 306
       $this->login_cookie();
307 307
 
308
-      if($this->account_login_status == LOGIN_SUCCESS) {
308
+      if ($this->account_login_status == LOGIN_SUCCESS) {
309 309
         // TODO - НЕ ОБЯЗАТЕЛЬНО ОТПРАВЛЯТЬ ЧЕРЕЗ ЕМЕЙЛ! ЕСЛИ ЭТО ФЕЙСБУЧЕК ИЛИ ВКШЕЧКА - МОЖНО ЧЕРЕЗ ЛС ПИСАТЬ!!
310 310
         $message_header = sprintf(classLocale::$lang['log_lost_email_title'], classSupernova::$config->game_name);
311 311
         $message = sprintf(classLocale::$lang['log_lost_email_pass'], classSupernova::$config->game_name, $this->account->account_name, $new_password_unsafe);
312 312
         @$operation_result = mymail($confirmation['email'], $message_header, htmlspecialchars($message));
313 313
 
314 314
         $users_translated = PlayerToAccountTranslate::db_translate_get_users_from_account_list($this->provider_id, $this->account->account_id); // OK 4.5
315
-        if(!empty($users_translated)) {
315
+        if (!empty($users_translated)) {
316 316
           // Отправляем в лички письмо о сбросе пароля
317 317
 
318 318
           // ПО ОПРЕДЕЛЕНИЮ в $users_translated только
@@ -321,9 +321,9 @@  discard block
 block discarded – undo
321 321
           //    - игроки, привязанные только к этим аккаунтам
322 322
           // Значит им всем сразу скопом можно отправлять сообщения
323 323
           $message = sprintf(classLocale::$lang['sys_password_reset_message_body'], $new_password_unsafe);
324
-          $message = sys_bbcodeParse($message) . '<br><br>';
324
+          $message = sys_bbcodeParse($message).'<br><br>';
325 325
 
326
-          foreach($users_translated as $user_id => $providers_list) {
326
+          foreach ($users_translated as $user_id => $providers_list) {
327 327
             msg_send_simple_message($user_id, 0, SN_TIME_NOW, MSG_TYPE_ADMIN, classLocale::$lang['sys_administration'], classLocale::$lang['sys_login_register_message_title'], $message);
328 328
           }
329 329
         } else {
@@ -375,10 +375,10 @@  discard block
 block discarded – undo
375 375
   // OK v4.5
376 376
   protected function register() {
377 377
     // TODO РЕГИСТРАЦИЯ ВСЕГДА ДОЛЖНА ЛОГИНИТЬ ПОЛЬЗОВАТЕЛЯ!
378
-    $this->flog('Регистрация: начинаем. Провайдер ' . $this->provider_id);
378
+    $this->flog('Регистрация: начинаем. Провайдер '.$this->provider_id);
379 379
 
380 380
     try {
381
-      if(!$this->is_register) {
381
+      if (!$this->is_register) {
382 382
         $this->flog('Регистрация: не выставлен флаг регистрации - пропускаем');
383 383
         throw new Exception(LOGIN_UNDEFINED, ERR_ERROR);
384 384
       }
@@ -388,8 +388,8 @@  discard block
 block discarded – undo
388 388
       sn_db_transaction_start();
389 389
 
390 390
       $this->account->db_get_by_name_or_email($this->input_login_unsafe, $this->input_email_unsafe);
391
-      if($this->account->is_exists) {
392
-        if($this->account->account_email == $this->input_email_unsafe) {
391
+      if ($this->account->is_exists) {
392
+        if ($this->account->account_email == $this->input_email_unsafe) {
393 393
           throw new Exception(REGISTER_ERROR_EMAIL_EXISTS, ERR_ERROR);
394 394
         } else {
395 395
           throw new Exception(REGISTER_ERROR_ACCOUNT_NAME_EXISTS, ERR_ERROR);
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
       // А вот это пока не нужно. Трансляцией аккаунтов в юзеров и созданием новых юзеров для новозашедших аккаунтов занимается Auth
412 412
       // $this->register_account();
413 413
       sn_db_transaction_commit();
414
-    } catch(Exception $e) {
414
+    } catch (Exception $e) {
415 415
       sn_db_transaction_rollback();
416 416
       $this->account_login_status == LOGIN_UNDEFINED ? $this->account_login_status = $e->getMessage() : false;
417 417
     }
@@ -427,19 +427,19 @@  discard block
 block discarded – undo
427 427
    */
428 428
   // OK v4.5
429 429
   protected function login_cookie() {
430
-    if($this->account_login_status != LOGIN_UNDEFINED) {
430
+    if ($this->account_login_status != LOGIN_UNDEFINED) {
431 431
       return $this->account_login_status;
432 432
     }
433 433
 
434 434
     // Пытаемся войти по куке
435
-    if(!empty($_COOKIE[$this->cookie_name])) {
436
-      if(count(explode("/%/", $_COOKIE[$this->cookie_name])) < 4) {
435
+    if (!empty($_COOKIE[$this->cookie_name])) {
436
+      if (count(explode("/%/", $_COOKIE[$this->cookie_name])) < 4) {
437 437
         list($account_id_unsafe, $cookie_password_hash_salted, $user_remember_me) = explode(AUTH_COOKIE_DELIMETER, $_COOKIE[$this->cookie_name]);
438 438
       } else {
439 439
         list($account_id_unsafe, $user_name, $cookie_password_hash_salted, $user_remember_me) = explode("/%/", $_COOKIE[$this->cookie_name]);
440 440
       }
441 441
 
442
-      if(
442
+      if (
443 443
         $this->account->db_get_by_id($account_id_unsafe)
444 444
         && ($this->password_encode_for_cookie($this->account->account_password) == $cookie_password_hash_salted)
445 445
       ) {
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
       }
449 449
     }
450 450
 
451
-    if($this->account_login_status != LOGIN_SUCCESS) {
451
+    if ($this->account_login_status != LOGIN_SUCCESS) {
452 452
       // Невалидная кука - чистим
453 453
       $this->cookie_clear();
454 454
     }
@@ -466,29 +466,29 @@  discard block
 block discarded – undo
466 466
   protected function login_username() {
467 467
     // TODO - Логин по старым именам
468 468
     try {
469
-      if(!$this->is_login) {
469
+      if (!$this->is_login) {
470 470
         $this->flog('Логин: не выставлен флаг входа в игру - это не логин');
471 471
         throw new Exception(LOGIN_UNDEFINED, ERR_ERROR);
472 472
       }
473 473
 
474 474
       // TODO Пустое имя аккаунта
475
-      if(!$this->input_login_unsafe) {
475
+      if (!$this->input_login_unsafe) {
476 476
         throw new Exception(LOGIN_UNDEFINED, ERR_ERROR);
477 477
       }
478 478
 
479 479
       $this->login_validate_input();
480 480
 
481
-      if(!$this->account->db_get_by_name($this->input_login_unsafe) && !$this->account->db_get_by_email($this->input_login_unsafe)) {
481
+      if (!$this->account->db_get_by_name($this->input_login_unsafe) && !$this->account->db_get_by_email($this->input_login_unsafe)) {
482 482
         throw new Exception(LOGIN_ERROR_USERNAME, ERR_ERROR);
483 483
       }
484 484
 
485
-      if(!$this->account->password_check($this->input_login_password_raw)) {
485
+      if (!$this->account->password_check($this->input_login_password_raw)) {
486 486
         throw new Exception(LOGIN_ERROR_PASSWORD, ERR_ERROR);
487 487
       }
488 488
 
489 489
       $this->cookie_set();
490 490
       $this->account_login_status = LOGIN_SUCCESS;
491
-    } catch(Exception $e) {
491
+    } catch (Exception $e) {
492 492
       $this->account_login_status == LOGIN_UNDEFINED ? $this->account_login_status = $e->getMessage() : false;
493 493
     }
494 494
 
@@ -510,18 +510,18 @@  discard block
 block discarded – undo
510 510
   protected function cookie_set($account_to_impersonate = null) {
511 511
     $this_account = is_object($account_to_impersonate) ? $account_to_impersonate : $this->account;
512 512
 
513
-    if(!is_object($this_account) || !$this_account->is_exists) {
513
+    if (!is_object($this_account) || !$this_account->is_exists) {
514 514
       throw new Exception(LOGIN_ERROR_NO_ACCOUNT_FOR_COOKIE_SET, ERR_ERROR);
515 515
     }
516 516
 
517
-    if(is_object($account_to_impersonate) && $account_to_impersonate->is_exists) {
517
+    if (is_object($account_to_impersonate) && $account_to_impersonate->is_exists) {
518 518
       sn_setcookie($this->cookie_name_impersonate, $_COOKIE[$this->cookie_name], SN_TIME_NOW + PERIOD_YEAR, $this->sn_root_path, $this->domain);
519 519
     }
520 520
 
521 521
     $expire_time = $this->remember_me ? SN_TIME_NOW + PERIOD_YEAR : 0;
522 522
 
523 523
     $password_encoded = $this->password_encode_for_cookie($this_account->account_password);
524
-    $cookie = $this_account->account_id . AUTH_COOKIE_DELIMETER . $password_encoded . AUTH_COOKIE_DELIMETER . $this->remember_me;
524
+    $cookie = $this_account->account_id.AUTH_COOKIE_DELIMETER.$password_encoded.AUTH_COOKIE_DELIMETER.$this->remember_me;
525 525
     $this->flog("cookie_set() - Устанавливаем куку {$cookie}");
526 526
     return sn_setcookie($this->cookie_name, $cookie, $expire_time, $this->sn_root_path, $this->domain);
527 527
   }
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
   // OK v4.1
533 533
   protected function cookie_clear() {
534 534
     // Автоматически вообще-то - если установлена кука имперсонатора - то чистим обычную, а куку имперсонатора - копируем в неё
535
-    if(!empty($_COOKIE[$this->cookie_name_impersonate])) {
535
+    if (!empty($_COOKIE[$this->cookie_name_impersonate])) {
536 536
       sn_setcookie($this->cookie_name, $_COOKIE[$this->cookie_name_impersonate], SN_TIME_NOW + PERIOD_YEAR, $this->sn_root_path, $this->domain);
537 537
       sn_setcookie($this->cookie_name_impersonate, '', SN_TIME_NOW - PERIOD_WEEK, $this->sn_root_path, $this->domain);
538 538
     } else {
@@ -551,10 +551,10 @@  discard block
 block discarded – undo
551 551
   protected function login_validate_input() {
552 552
     // Проверяем, что бы в начале и конце не было пустых символов
553 553
     // TODO - при копировании Эксель -> Опера - в конце образуются пустые места. Это не должно быть проблемой! Вынести проверку пароля в регистрацию!
554
-    if($this->input_login_password_raw != trim($this->input_login_password_raw)) {
554
+    if ($this->input_login_password_raw != trim($this->input_login_password_raw)) {
555 555
       throw new Exception(LOGIN_ERROR_PASSWORD_TRIMMED, ERR_ERROR);
556 556
     }
557
-    if(!$this->input_login_password_raw) {
557
+    if (!$this->input_login_password_raw) {
558 558
       throw new Exception(LOGIN_ERROR_PASSWORD_EMPTY, ERR_ERROR);
559 559
     }
560 560
   }
@@ -570,37 +570,37 @@  discard block
 block discarded – undo
570 570
     $this->login_validate_input();
571 571
 
572 572
     // Если нет имени пользователя - NO GO!
573
-    if(!$this->input_login_unsafe) {
573
+    if (!$this->input_login_unsafe) {
574 574
       throw new Exception(LOGIN_ERROR_USERNAME_EMPTY, ERR_ERROR);
575 575
     }
576 576
     // Если логин имеет запрещенные символы - NO GO!
577
-    if(strpbrk($this->input_login_unsafe, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) {
577
+    if (strpbrk($this->input_login_unsafe, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) {
578 578
       throw new Exception(LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS, ERR_ERROR);
579 579
     }
580 580
     // Если логин меньше минимальной длины - NO GO!
581
-    if(strlen($this->input_login_unsafe) < LOGIN_LENGTH_MIN) {
581
+    if (strlen($this->input_login_unsafe) < LOGIN_LENGTH_MIN) {
582 582
       throw new Exception(REGISTER_ERROR_USERNAME_SHORT, ERR_ERROR);
583 583
     }
584 584
     // Если пароль меньше минимальной длины - NO GO!
585
-    if(strlen($this->input_login_password_raw) < PASSWORD_LENGTH_MIN) {
585
+    if (strlen($this->input_login_password_raw) < PASSWORD_LENGTH_MIN) {
586 586
       throw new Exception(REGISTER_ERROR_PASSWORD_INSECURE, ERR_ERROR);
587 587
     }
588 588
     // Если пароль имеет пробельные символы в начале или конце - NO GO!
589
-    if($this->input_login_password_raw != trim($this->input_login_password_raw)) {
589
+    if ($this->input_login_password_raw != trim($this->input_login_password_raw)) {
590 590
       throw new Exception(LOGIN_ERROR_PASSWORD_TRIMMED, ERR_ERROR);
591 591
     }
592 592
     // Если пароль не совпадает с подтверждением - NO GO! То, что у пароля нет пробельных символов в начале/конце - мы уже проверили выше
593 593
     //Если они есть у повтора - значит пароль и повтор не совпадут
594
-    if($this->input_login_password_raw <> $this->input_login_password_raw_repeat) {
594
+    if ($this->input_login_password_raw <> $this->input_login_password_raw_repeat) {
595 595
       throw new Exception(REGISTER_ERROR_PASSWORD_DIFFERENT, ERR_ERROR);
596 596
     }
597 597
     // Если нет емейла - NO GO!
598 598
     // TODO - регистрация без емейла
599
-    if(!$this->input_email_unsafe) {
599
+    if (!$this->input_email_unsafe) {
600 600
       throw new Exception(REGISTER_ERROR_EMAIL_EMPTY, ERR_ERROR);
601 601
     }
602 602
     // Если емейл не является емейлом - NO GO!
603
-    if(!is_email($this->input_email_unsafe)) {
603
+    if (!is_email($this->input_email_unsafe)) {
604 604
       throw new Exception(REGISTER_ERROR_EMAIL_WRONG, ERR_ERROR);
605 605
     }
606 606
   }
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
 
610 610
   // OK v4
611 611
   protected function password_encode_for_cookie($password) {
612
-    return md5("{$password}--" . $this->secret_word);
612
+    return md5("{$password}--".$this->secret_word);
613 613
   }
614 614
   // OK v4
615 615
   protected function password_encode($password, $salt) {
@@ -629,22 +629,22 @@  discard block
 block discarded – undo
629 629
     return core_auth::make_random_password();
630 630
   }
631 631
   protected function flog($message, $die = false) {
632
-    if(!defined('DEBUG_AUTH') || !DEBUG_AUTH) {
632
+    if (!defined('DEBUG_AUTH') || !DEBUG_AUTH) {
633 633
       return;
634 634
     }
635 635
     list($called, $caller) = debug_backtrace(false);
636 636
 
637 637
     $caller_name =
638
-      ((get_called_class()) ? get_called_class() : (!empty($caller['class']) ? $caller['class'] : '')) .
639
-      (!empty($caller['type']) ? $caller['type'] : '') .
640
-      (!empty($caller['function']) ? $caller['function'] : '') .
641
-      (!empty($called['line']) ? ':' . $called['line'] : '');
638
+      ((get_called_class()) ? get_called_class() : (!empty($caller['class']) ? $caller['class'] : '')).
639
+      (!empty($caller['type']) ? $caller['type'] : '').
640
+      (!empty($caller['function']) ? $caller['function'] : '').
641
+      (!empty($called['line']) ? ':'.$called['line'] : '');
642 642
 
643 643
     $_SERVER['SERVER_NAME'] == 'localhost' ? print("<div class='debug'>$message - $caller_name\r\n</div>") : false;
644 644
 
645 645
     classSupernova::log_file("$message - $caller_name");
646
-    if($die) {
647
-      $die && die("<div class='negative'>СТОП! Функция {$caller_name} при вызове в " . get_called_class() . " (располагается в " . get_class() . "). СООБЩИТЕ АДМИНИСТРАЦИИ!</div>");
646
+    if ($die) {
647
+      $die && die("<div class='negative'>СТОП! Функция {$caller_name} при вызове в ".get_called_class()." (располагается в ".get_class()."). СООБЩИТЕ АДМИНИСТРАЦИИ!</div>");
648 648
     }
649 649
   }
650 650
 
Please login to merge, or discard this patch.
includes/constants.php 1 patch
Spacing   +238 added lines, -238 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
 
39 39
 // Game type constants starts with GAME_
40 40
 define('GAME_SUPERNOVA', 0);
41
-define('GAME_OGAME'    , 1);
42
-define('GAME_BLITZ'    , 2);
41
+define('GAME_OGAME', 1);
42
+define('GAME_BLITZ', 2);
43 43
 
44 44
 // Date & time range constants
45 45
 define('DATE_FOREVER', 2000000000);
@@ -52,27 +52,27 @@  discard block
 block discarded – undo
52 52
 define('PERIOD_YEAR', PERIOD_DAY * 365);
53 53
 define('PERIOD_FOREVER', PERIOD_YEAR * 100);
54 54
 
55
-define('PERIOD_MINUTE_2' , PERIOD_MINUTE * 2);
56
-define('PERIOD_MINUTE_3' , PERIOD_MINUTE * 3);
57
-define('PERIOD_MINUTE_5' , PERIOD_MINUTE * 5);
55
+define('PERIOD_MINUTE_2', PERIOD_MINUTE * 2);
56
+define('PERIOD_MINUTE_3', PERIOD_MINUTE * 3);
57
+define('PERIOD_MINUTE_5', PERIOD_MINUTE * 5);
58 58
 define('PERIOD_MINUTE_10', PERIOD_MINUTE * 10);
59
-define('PERIOD_DAY_3'    , PERIOD_DAY * 3);
60
-define('PERIOD_WEEK_2'   , PERIOD_WEEK * 2);
61
-define('PERIOD_MONTH_2'  , PERIOD_MONTH * 2);
62
-define('PERIOD_MONTH_3'  , PERIOD_MONTH * 3);
59
+define('PERIOD_DAY_3', PERIOD_DAY * 3);
60
+define('PERIOD_WEEK_2', PERIOD_WEEK * 2);
61
+define('PERIOD_MONTH_2', PERIOD_MONTH * 2);
62
+define('PERIOD_MONTH_3', PERIOD_MONTH * 3);
63 63
 
64 64
 define('FONT_SIZE_PERCENT_MIN', 56.25);
65 65
 define('FONT_SIZE_PERCENT_DEFAULT', 68.75);
66 66
 define('FONT_SIZE_PERCENT_MAX', 131.25);
67 67
 define('FONT_SIZE_PERCENT_STEP', 12.5);
68
-define('FONT_SIZE_PERCENT_DEFAULT_STRING', FONT_SIZE_PERCENT_DEFAULT . '%');
68
+define('FONT_SIZE_PERCENT_DEFAULT_STRING', FONT_SIZE_PERCENT_DEFAULT.'%');
69 69
 
70 70
 define('FONT_SIZE_PIXELS_BROWSER_BASE', 16);
71 71
 define('FONT_SIZE_PIXELS_MIN', 9);
72 72
 define('FONT_SIZE_PIXELS_DEFAULT', 11);
73 73
 define('FONT_SIZE_PIXELS_MAX', 21);
74 74
 define('FONT_SIZE_PIXELS_STEP', 1);
75
-define('FONT_SIZE_PIXELS_DEFAULT_STRING', FONT_SIZE_PIXELS_DEFAULT . 'px');
75
+define('FONT_SIZE_PIXELS_DEFAULT_STRING', FONT_SIZE_PIXELS_DEFAULT.'px');
76 76
 
77 77
 define('DEFAULT_PICTURE_EXTENSION_DOTTED', '.jpg');
78 78
 
@@ -115,54 +115,54 @@  discard block
 block discarded – undo
115 115
 define('SN_SYS_SEC_CHARS_ALLOWED', 'ABCDEFGHJKLMNPQRSTUVWXYZabcdefghkmnpqrstuvwxyz0123456789');
116 116
 
117 117
 // Mot qui sont interdit a la saisie !
118
-$ListCensure = array ( '/</', '/>/', '/script/i', '/doquery/i', '/http/i', '/javascript/i');
118
+$ListCensure = array('/</', '/>/', '/script/i', '/doquery/i', '/http/i', '/javascript/i');
119 119
 
120 120
 // Confirmation record types
121
-define('CONFIRM_REGISTRATION'  , 1);
121
+define('CONFIRM_REGISTRATION', 1);
122 122
 define('CONFIRM_PASSWORD_RESET', 2);
123
-define('CONFIRM_DELETE'        , 3);
123
+define('CONFIRM_DELETE', 3);
124 124
 
125 125
 define('AFFILIATE_MM_TO_REFERRAL_DM', 2);
126 126
 
127 127
 // Ally diplomacy statuses
128
-define('ALLY_DIPLOMACY_SELF'         , 'self');
129
-define('ALLY_DIPLOMACY_NEUTRAL'      , 'neutral');
130
-define('ALLY_DIPLOMACY_WAR'          , 'war');
131
-define('ALLY_DIPLOMACY_PEACE'        , 'peace');
128
+define('ALLY_DIPLOMACY_SELF', 'self');
129
+define('ALLY_DIPLOMACY_NEUTRAL', 'neutral');
130
+define('ALLY_DIPLOMACY_WAR', 'war');
131
+define('ALLY_DIPLOMACY_PEACE', 'peace');
132 132
 define('ALLY_DIPLOMACY_CONFEDERATION', 'confederation');
133
-define('ALLY_DIPLOMACY_FEDERATION'   , 'federation');
134
-define('ALLY_DIPLOMACY_UNION'        , 'union');
135
-define('ALLY_DIPLOMACY_MASTER'       , 'master');
136
-define('ALLY_DIPLOMACY_SLAVE'        , 'slave');
133
+define('ALLY_DIPLOMACY_FEDERATION', 'federation');
134
+define('ALLY_DIPLOMACY_UNION', 'union');
135
+define('ALLY_DIPLOMACY_MASTER', 'master');
136
+define('ALLY_DIPLOMACY_SLAVE', 'slave');
137 137
 
138 138
 define('ALLY_PROPOSE_SEND', 0);
139 139
 
140 140
 // Quest types
141
-define('QUEST_TYPE_BUILD'   , 1);
141
+define('QUEST_TYPE_BUILD', 1);
142 142
 define('QUEST_TYPE_RESEARCH', 2);
143
-define('QUEST_TYPE_COMBAT'  , 3);
143
+define('QUEST_TYPE_COMBAT', 3);
144 144
 
145
-define('QUEST_STATUS_NOT_STARTED' , 0);
146
-define('QUEST_STATUS_STARTED'     , 1);
147
-define('QUEST_STATUS_COMPLETE'    , 2);
145
+define('QUEST_STATUS_NOT_STARTED', 0);
146
+define('QUEST_STATUS_STARTED', 1);
147
+define('QUEST_STATUS_COMPLETE', 2);
148 148
 
149 149
 // *** Combat-related constants
150 150
 // *** Mission Type constants starts with MT_
151
-define('MT_NONE'     ,  0);
152
-define('MT_EXPLORE'  , 15);
153
-define('MT_COLONIZE' ,  7);
154
-define('MT_RECYCLE'  ,  8);
151
+define('MT_NONE', 0);
152
+define('MT_EXPLORE', 15);
153
+define('MT_COLONIZE', 7);
154
+define('MT_RECYCLE', 8);
155 155
 
156
-define('MT_RELOCATE' ,  4);
156
+define('MT_RELOCATE', 4);
157 157
 
158
-define('MT_TRANSPORT',  3);
159
-define('MT_HOLD'     ,  5);
158
+define('MT_TRANSPORT', 3);
159
+define('MT_HOLD', 5);
160 160
 
161
-define('MT_MISSILE'  , 10);
162
-define('MT_SPY'      ,  6);
163
-define('MT_ATTACK'   ,  1);
164
-define('MT_ACS'      ,  2);
165
-define('MT_DESTROY'  ,  9);
161
+define('MT_MISSILE', 10);
162
+define('MT_SPY', 6);
163
+define('MT_ATTACK', 1);
164
+define('MT_ACS', 2);
165
+define('MT_DESTROY', 9);
166 166
 // 11, 12, 13, 14, 16...
167 167
 
168 168
 // *** Planet Target constants starts with PT_
@@ -170,49 +170,49 @@  discard block
 block discarded – undo
170 170
 define('PT_ALL', 0);
171 171
 define('PT_PLANET', 1);
172 172
 define('PT_DEBRIS', 2);
173
-define('PT_MOON'  , 3);
173
+define('PT_MOON', 3);
174 174
 
175 175
 // *** Unit locations - shows db table where unit belong
176 176
 // Also cache indexes
177
-define('LOC_NONE',    -1);
177
+define('LOC_NONE', -1);
178 178
 define('LOC_UNIVERSE', 0);
179
-define('LOC_PLANET',   1);
180
-define('LOC_DEBRIS',   2); // Translates to `planets` table planet_type = 1, `debris_*` fields
181
-define('LOC_MOON',     3); // Translates to `planets` table planet_type = 3
182
-define('LOC_USER',     4);
183
-define('LOC_FLEET',    5);
184
-define('LOC_ALLY',     6);
185
-define('LOC_UNIT_NUMERIC',     7);
186
-define('LOC_UNIT_LIST',     8);
179
+define('LOC_PLANET', 1);
180
+define('LOC_DEBRIS', 2); // Translates to `planets` table planet_type = 1, `debris_*` fields
181
+define('LOC_MOON', 3); // Translates to `planets` table planet_type = 3
182
+define('LOC_USER', 4);
183
+define('LOC_FLEET', 5);
184
+define('LOC_ALLY', 6);
185
+define('LOC_UNIT_NUMERIC', 7);
186
+define('LOC_UNIT_LIST', 8);
187 187
 
188 188
 // ТОЛЬКО ВНУТРЕНЕЕ!!!
189
-define('LOC_UNIT',    'LOC_UNIT');
190
-define('LOC_QUE',     'LOC_QUE');
191
-define('LOC_LOCATION','LOC_LOCATION');
192
-define('LOC_LOCKS','LOC_LOCKS');
189
+define('LOC_UNIT', 'LOC_UNIT');
190
+define('LOC_QUE', 'LOC_QUE');
191
+define('LOC_LOCATION', 'LOC_LOCATION');
192
+define('LOC_LOCKS', 'LOC_LOCKS');
193 193
 
194 194
 // *** Caching masks
195
-define('CACHE_NOTHING'    ,  0);
196
-define('CACHE_FLEET'      ,  1);
197
-define('CACHE_PLANET'     ,  2);
198
-define('CACHE_USER'       ,  4);
199
-define('CACHE_SOURCE'     ,  8);
195
+define('CACHE_NOTHING', 0);
196
+define('CACHE_FLEET', 1);
197
+define('CACHE_PLANET', 2);
198
+define('CACHE_USER', 4);
199
+define('CACHE_SOURCE', 8);
200 200
 define('CACHE_DESTINATION', 16);
201
-define('CACHE_EVENT'      , 32);
201
+define('CACHE_EVENT', 32);
202 202
 
203
-define('CACHE_USER_SRC'  , CACHE_USER | CACHE_SOURCE);
204
-define('CACHE_USER_DST'  , CACHE_USER | CACHE_DESTINATION);
203
+define('CACHE_USER_SRC', CACHE_USER | CACHE_SOURCE);
204
+define('CACHE_USER_DST', CACHE_USER | CACHE_DESTINATION);
205 205
 define('CACHE_PLANET_SRC', CACHE_PLANET | CACHE_SOURCE);
206 206
 define('CACHE_PLANET_DST', CACHE_PLANET | CACHE_DESTINATION);
207
-define('CACHE_COMBAT'    , CACHE_FLEET | CACHE_PLANET | CACHE_USER | CACHE_SOURCE | CACHE_DESTINATION);
207
+define('CACHE_COMBAT', CACHE_FLEET | CACHE_PLANET | CACHE_USER | CACHE_SOURCE | CACHE_DESTINATION);
208 208
 
209
-define('CACHE_ALL'       , CACHE_FLEET | CACHE_PLANET | CACHE_USER | CACHE_SOURCE | CACHE_DESTINATION | CACHE_EVENT);
209
+define('CACHE_ALL', CACHE_FLEET | CACHE_PLANET | CACHE_USER | CACHE_SOURCE | CACHE_DESTINATION | CACHE_EVENT);
210 210
 
211
-define('CACHE_NONE'      , CACHE_NOTHING); // Alias for me
211
+define('CACHE_NONE', CACHE_NOTHING); // Alias for me
212 212
 
213 213
 // *** Event types
214 214
 define('EVENT_FLEET_ARRIVE', 1);
215
-define('EVENT_FLEET_STAY'  , 2);
215
+define('EVENT_FLEET_STAY', 2);
216 216
 define('EVENT_FLEET_RETURN', 3);
217 217
 
218 218
 // *** Constants for changing DM
@@ -265,10 +265,10 @@  discard block
 block discarded – undo
265 265
 
266 266
 
267 267
 // Operation error status HARDCODE!
268
-define('ERR_NONE'               , 0); // No error
269
-define('ERR_WARNING'            , 1); // There is warning - something altering normal operation process
270
-define('ERR_ERROR'              , 2); // There is error - something permits operation from process
271
-define('ERR_HACK'               , 4); // Operation is qualified as hack attempt
268
+define('ERR_NONE', 0); // No error
269
+define('ERR_WARNING', 1); // There is warning - something altering normal operation process
270
+define('ERR_ERROR', 2); // There is error - something permits operation from process
271
+define('ERR_HACK', 4); // Operation is qualified as hack attempt
272 272
 // New GLOBAL operation results
273 273
 //define('RESULT_DEFAULT' , 0); // Default result - all went OK or result really doesn't matter
274 274
 //define('RESULT_WARNING' , 1);
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 define('SN_PAYMENT_REQUEST_OK', 0);
289 289
 define('SN_PAYMENT_REQUEST_ERROR_UNIT_AMOUNT', 1);
290 290
 define('SN_PAYMENT_REQUEST_ERROR_PAYLINK_UNSUPPORTED', 2);
291
-define('SN_PAYMENT_REQUEST_IP_WRONG', 3);  // Неправильный IP входящей системы - обычно хак
291
+define('SN_PAYMENT_REQUEST_IP_WRONG', 3); // Неправильный IP входящей системы - обычно хак
292 292
 define('SN_PAYMENT_REQUEST_COMMAND_UNSUPPORTED', 4); // Неподдерживаемая команда - обычно хак
293 293
 define('SN_PAYMENT_REQUEST_SIGNATURE_INVALID', 5); // Неправильная подпись или не сошлась контрольная сумма - обычно хак
294 294
 define('SN_MODULE_DISABLED', 6); // Модуль отключен // УНИВЕРСАЛЬНЫЙ ОТВЕТ!
@@ -561,16 +561,16 @@  discard block
 block discarded – undo
561 561
 //define('F_DEVICE_ID',     'F_DEVICE_ID');
562 562
 //define('F_DEVICE_CYPHER', 'F_DEVICE_CYPHER');
563 563
 
564
-define('F_PROVIDER_ID',   'F_PROVIDER_ID');
564
+define('F_PROVIDER_ID', 'F_PROVIDER_ID');
565 565
 // define('F_PROVIDER_LIST', 'F_PROVIDER_LIST');
566 566
 
567 567
 define('F_IMPERSONATE_STATUS', 'F_IMPERSONATE_STATUS');
568 568
 define('F_IMPERSONATE_OPERATOR', 'F_IMPERSONATE_OPERATOR');
569 569
 
570
-define('F_LOGIN_STATUS',  'F_LOGIN_STATUS');
570
+define('F_LOGIN_STATUS', 'F_LOGIN_STATUS');
571 571
 define('F_LOGIN_MESSAGE', 'F_LOGIN_MESSAGE');
572 572
 
573
-define('F_PLAYER_REGISTER_STATUS',  'F_PLAYER_REGISTER_STATUS');
573
+define('F_PLAYER_REGISTER_STATUS', 'F_PLAYER_REGISTER_STATUS');
574 574
 define('F_PLAYER_REGISTER_MESSAGE', 'F_PLAYER_REGISTER_MESSAGE');
575 575
 
576 576
 define('F_USER_ID', 'F_USER_ID');
@@ -614,66 +614,66 @@  discard block
 block discarded – undo
614 614
 
615 615
 
616 616
 // Option groups
617
-define('OPT_ALL',      0);
618
-define('OPT_MESSAGE',  1);
617
+define('OPT_ALL', 0);
618
+define('OPT_MESSAGE', 1);
619 619
 define('OPT_UNIVERSE', 2);
620 620
 define('OPT_INTERFACE', 3);
621 621
 
622 622
 // Message classes
623
-define('MSG_TYPE_OUTBOX'   ,  -1);
624
-define('MSG_TYPE_SPY'      ,   0);
625
-define('MSG_TYPE_PLAYER'   ,   1);
626
-define('MSG_TYPE_ALLIANCE' ,   2);
627
-define('MSG_TYPE_COMBAT'   ,   3);
628
-define('MSG_TYPE_RECYCLE'  ,   4);
629
-define('MSG_TYPE_TRANSPORT',   5);
630
-define('MSG_TYPE_ADMIN'    ,   6);
631
-define('MSG_TYPE_EXPLORE'  ,  15);
632
-define('MSG_TYPE_QUE'      ,  99);
633
-define('MSG_TYPE_NEW'      , 100);
623
+define('MSG_TYPE_OUTBOX', -1);
624
+define('MSG_TYPE_SPY', 0);
625
+define('MSG_TYPE_PLAYER', 1);
626
+define('MSG_TYPE_ALLIANCE', 2);
627
+define('MSG_TYPE_COMBAT', 3);
628
+define('MSG_TYPE_RECYCLE', 4);
629
+define('MSG_TYPE_TRANSPORT', 5);
630
+define('MSG_TYPE_ADMIN', 6);
631
+define('MSG_TYPE_EXPLORE', 15);
632
+define('MSG_TYPE_QUE', 99);
633
+define('MSG_TYPE_NEW', 100);
634 634
 
635 635
 // Attack verification statuses
636
-define('FLIGHT_ALLOWED'           ,  0);
637
-define('FLIGHT_VECTOR_NO_TARGET'         ,  1);
638
-define('FLIGHT_PLAYER_OWN'               ,  2);
639
-define('FLIGHT_MISSION_IMPOSSIBLE'     ,  3);
640
-define('FLIGHT_MISSION_HOLD_NO_ALLY_DEPOSIT'   ,  4);
641
-define('FLIGHT_MISSION_RECYCLE_NO_DEBRIS'         ,  5);
642
-define('FLIGHT_PLAYER_VACATION'          ,  6);
643
-define('FLIGHT_PLAYER_SAME_IP'           ,  7);
644
-define('FLIGHT_PLAYER_BUFFING'           ,  8);
645
-define('FLIGHT_PLAYER_ADMIN'             ,  9);
646
-define('FLIGHT_PLAYER_NOOB'              , 10);
647
-define('FLIGHT_PLAYER_VACATION_OWN'      , 11);
648
-define('FLIGHT_MISSION_MISSILE_NO_SILO'           , 12);
649
-define('FLIGHT_MISSION_MISSILE_NO_MISSILES'        , 13);
650
-define('FLIGHT_SHIPS_NO_SHIPS'          , 14);
651
-define('FLIGHT_FLEET_NO_SLOTS'          , 15);
652
-define('FLIGHT_SHIPS_NOT_ENOUGH_OR_RESOURCES'          , 16);
653
-define('FLIGHT_SHIPS_NO_RECYCLERS'      , 17);
654
-define('FLIGHT_MISSION_SPY_NO_SPIES'          , 18);
655
-define('FLIGHT_SHIPS_NO_COLONIZER'      , 19);
656
-define('FLIGHT_MISSION_MISSILE_TOO_FAR'   , 20);
657
-define('FLIGHT_MISSION_MISSILE_WRONG_STRUCTURE'   , 21);
658
-define('FLIGHT_RESOURCES_FUEL_NOT_ENOUGH'           , 22);
659
-define('FLIGHT_RESOURCES_NOT_ENOUGH'      , 23);
660
-define('FLIGHT_MISSION_ACS_NOT_EXISTS'            , 24);
661
-define('FLIGHT_MISSION_ACS_MISSTARGET'    , 25);
662
-define('FLIGHT_FLEET_SPEED_WRONG'       , 26);
663
-define('FLIGHT_MISSION_ACS_TOO_LATE'      , 27);
664
-define('FLIGHT_MISSION_ATTACK_BASHING'           , 28);
665
-define('FLIGHT_MISSION_ATTACK_BASHING_WAR_DELAY' , 29);
666
-define('FLIGHT_MISSION_ACS_WRONG_TARGET'  , 30);
667
-define('FLIGHT_VECTOR_SAME_SOURCE'              , 31);
636
+define('FLIGHT_ALLOWED', 0);
637
+define('FLIGHT_VECTOR_NO_TARGET', 1);
638
+define('FLIGHT_PLAYER_OWN', 2);
639
+define('FLIGHT_MISSION_IMPOSSIBLE', 3);
640
+define('FLIGHT_MISSION_HOLD_NO_ALLY_DEPOSIT', 4);
641
+define('FLIGHT_MISSION_RECYCLE_NO_DEBRIS', 5);
642
+define('FLIGHT_PLAYER_VACATION', 6);
643
+define('FLIGHT_PLAYER_SAME_IP', 7);
644
+define('FLIGHT_PLAYER_BUFFING', 8);
645
+define('FLIGHT_PLAYER_ADMIN', 9);
646
+define('FLIGHT_PLAYER_NOOB', 10);
647
+define('FLIGHT_PLAYER_VACATION_OWN', 11);
648
+define('FLIGHT_MISSION_MISSILE_NO_SILO', 12);
649
+define('FLIGHT_MISSION_MISSILE_NO_MISSILES', 13);
650
+define('FLIGHT_SHIPS_NO_SHIPS', 14);
651
+define('FLIGHT_FLEET_NO_SLOTS', 15);
652
+define('FLIGHT_SHIPS_NOT_ENOUGH_OR_RESOURCES', 16);
653
+define('FLIGHT_SHIPS_NO_RECYCLERS', 17);
654
+define('FLIGHT_MISSION_SPY_NO_SPIES', 18);
655
+define('FLIGHT_SHIPS_NO_COLONIZER', 19);
656
+define('FLIGHT_MISSION_MISSILE_TOO_FAR', 20);
657
+define('FLIGHT_MISSION_MISSILE_WRONG_STRUCTURE', 21);
658
+define('FLIGHT_RESOURCES_FUEL_NOT_ENOUGH', 22);
659
+define('FLIGHT_RESOURCES_NOT_ENOUGH', 23);
660
+define('FLIGHT_MISSION_ACS_NOT_EXISTS', 24);
661
+define('FLIGHT_MISSION_ACS_MISSTARGET', 25);
662
+define('FLIGHT_FLEET_SPEED_WRONG', 26);
663
+define('FLIGHT_MISSION_ACS_TOO_LATE', 27);
664
+define('FLIGHT_MISSION_ATTACK_BASHING', 28);
665
+define('FLIGHT_MISSION_ATTACK_BASHING_WAR_DELAY', 29);
666
+define('FLIGHT_MISSION_ACS_WRONG_TARGET', 30);
667
+define('FLIGHT_VECTOR_SAME_SOURCE', 31);
668 668
 define('FLIGHT_RESOURCES_FORBIDDEN', 32);
669
-define('FLIGHT_MISSION_TRANSPORT_EMPTY_CARGO'   , 33);
670
-define('FLIGHT_SHIPS_NOT_ONLY_SPIES'       , 34);
671
-define('FLIGHT_FLEET_TOO_FAR'           , 35);
672
-define('FLIGHT_FLEET_OVERLOAD'        , 36);
673
-define('FLIGHT_MISSION_UNKNOWN'    , 37);
674
-define('FLIGHT_SHIPS_UNIT_WRONG'        , 38);
675
-define('FLIGHT_SHIPS_UNMOVABLE'        , 39);
676
-define('FLIGHT_SHIPS_NEGATIVE'  , 40);
669
+define('FLIGHT_MISSION_TRANSPORT_EMPTY_CARGO', 33);
670
+define('FLIGHT_SHIPS_NOT_ONLY_SPIES', 34);
671
+define('FLIGHT_FLEET_TOO_FAR', 35);
672
+define('FLIGHT_FLEET_OVERLOAD', 36);
673
+define('FLIGHT_MISSION_UNKNOWN', 37);
674
+define('FLIGHT_SHIPS_UNIT_WRONG', 38);
675
+define('FLIGHT_SHIPS_UNMOVABLE', 39);
676
+define('FLIGHT_SHIPS_NEGATIVE', 40);
677 677
 define('FLIGHT_RESOURCES_NEGATIVE', 41);
678 678
 define('FLIGHT_MISSION_MORATORIUM', 42);
679 679
 define('FLIGHT_PLAYER_CHILD_PROTECTION', 43);
@@ -707,12 +707,12 @@  discard block
 block discarded – undo
707 707
 
708 708
 
709 709
 // *** Races - Homeworlds
710
-define('RACE_NONE'    , 0);
711
-define('RACE_EARTH'   , 1);
712
-define('RACE_MOON'    , 2);
713
-define('RACE_MERCURY' , 3);
714
-define('RACE_VENUS'   , 4);
715
-define('RACE_MARS'    , 5);
710
+define('RACE_NONE', 0);
711
+define('RACE_EARTH', 1);
712
+define('RACE_MOON', 2);
713
+define('RACE_MERCURY', 3);
714
+define('RACE_VENUS', 4);
715
+define('RACE_MARS', 5);
716 716
 define('RACE_ASTEROID', 6);
717 717
 // define('MARKET_INFO'         , 7);
718 718
 
@@ -720,114 +720,114 @@  discard block
 block discarded – undo
720 720
 
721 721
 // *** Market variables
722 722
 // === Market blocks
723
-define('MARKET_ENTRY'        , 0);
724
-define('MARKET_RESOURCES'    , 1);
725
-define('MARKET_SCRAPPER'     , 2);
726
-define('MARKET_STOCKMAN'     , 3);
727
-define('MARKET_EXCHANGE'     , 4);
728
-define('MARKET_BANKER'       , 5);
729
-define('MARKET_PAWNSHOP'     , 6);
730
-define('MARKET_INFO'         , 7);
723
+define('MARKET_ENTRY', 0);
724
+define('MARKET_RESOURCES', 1);
725
+define('MARKET_SCRAPPER', 2);
726
+define('MARKET_STOCKMAN', 3);
727
+define('MARKET_EXCHANGE', 4);
728
+define('MARKET_BANKER', 5);
729
+define('MARKET_PAWNSHOP', 6);
730
+define('MARKET_INFO', 7);
731 731
 
732 732
 // === Market error statuses
733
-define('MARKET_NOTHING'              ,  0);
734
-define('MARKET_DEAL'                 ,  1);
735
-define('MARKET_DEAL_TRADE'           ,  2);
736
-define('MARKET_NO_DM'                ,  3);
737
-define('MARKET_NO_RESOURCES'         ,  4);
738
-define('MARKET_ZERO_DEAL'            ,  5);
739
-define('MARKET_NO_SHIPS'             ,  6);
740
-define('MARKET_NOT_A_SHIP'           ,  7);
741
-define('MARKET_NO_STOCK'             ,  8);
742
-define('MARKET_ZERO_RES_STOCK'       ,  9);
743
-define('MARKET_NEGATIVE_SHIPS'       , 10);
744
-
745
-define('MARKET_INFO_PLAYER'          , 12);
746
-define('MARKET_INFO_WRONG'           , 11);
733
+define('MARKET_NOTHING', 0);
734
+define('MARKET_DEAL', 1);
735
+define('MARKET_DEAL_TRADE', 2);
736
+define('MARKET_NO_DM', 3);
737
+define('MARKET_NO_RESOURCES', 4);
738
+define('MARKET_ZERO_DEAL', 5);
739
+define('MARKET_NO_SHIPS', 6);
740
+define('MARKET_NOT_A_SHIP', 7);
741
+define('MARKET_NO_STOCK', 8);
742
+define('MARKET_ZERO_RES_STOCK', 9);
743
+define('MARKET_NEGATIVE_SHIPS', 10);
744
+
745
+define('MARKET_INFO_PLAYER', 12);
746
+define('MARKET_INFO_WRONG', 11);
747 747
 define('MARKET_INFO_PLAYER_NOT_FOUND', 13);
748
-define('MARKET_INFO_PLAYER_WRONG'    , 14);
749
-define('MARKET_INFO_PLAYER_SAME'     , 15);
748
+define('MARKET_INFO_PLAYER_WRONG', 14);
749
+define('MARKET_INFO_PLAYER_SAME', 15);
750 750
 
751 751
 
752 752
 
753 753
 
754 754
 // *** Mercenary/talent bonus types
755
-define('BONUS_NONE'    ,            0);  // No bonus
756
-define('BONUS_PERCENT' ,            1);  // Percent on base value
757
-define('BONUS_ADD'     ,            2);  // Add
758
-define('BONUS_ABILITY' ,            3);  // Some ability
759
-define('BONUS_MULTIPLY',            4);  // Multiply by value
760
-define('BONUS_PERCENT_CUMULATIVE' , 5);  // Cumulative percent on base value
761
-define('BONUS_PERCENT_DEGRADED' ,   6);  // Bonus amount degraded with increase as pow(bonus, level) (?)
762
-define('BONUS_SPEED',               7);  // Speed bonus
755
+define('BONUS_NONE', 0); // No bonus
756
+define('BONUS_PERCENT', 1); // Percent on base value
757
+define('BONUS_ADD', 2); // Add
758
+define('BONUS_ABILITY', 3); // Some ability
759
+define('BONUS_MULTIPLY', 4); // Multiply by value
760
+define('BONUS_PERCENT_CUMULATIVE', 5); // Cumulative percent on base value
761
+define('BONUS_PERCENT_DEGRADED', 6); // Bonus amount degraded with increase as pow(bonus, level) (?)
762
+define('BONUS_SPEED', 7); // Speed bonus
763 763
 
764 764
 // *** Action constant (build should be replaced with ACTION)
765
-define('BUILD_CREATE' ,  1);
765
+define('BUILD_CREATE', 1);
766 766
 define('BUILD_DESTROY', -1);
767 767
 define('BUILD_AUTOCONVERT', 2);
768 768
 
769
-define('ACTION_SELL'       , -1);
770
-define('ACTION_NOTHING'    ,  0);
771
-define('ACTION_BUY'        ,  1);
772
-define('ACTION_USE'        ,  2);
773
-define('ACTION_DELETE'     ,  3);
769
+define('ACTION_SELL', -1);
770
+define('ACTION_NOTHING', 0);
771
+define('ACTION_BUY', 1);
772
+define('ACTION_USE', 2);
773
+define('ACTION_DELETE', 3);
774 774
 
775 775
 // *** Check unit availability codes
776
-define('BUILD_ALLOWED'         , 0); // HARDCODED! DO NOT CHANGE!
776
+define('BUILD_ALLOWED', 0); // HARDCODED! DO NOT CHANGE!
777 777
 define('BUILD_REQUIRE_NOT_MEET', 1);
778
-define('BUILD_AMOUNT_WRONG'    , 2);
779
-define('BUILD_QUE_WRONG'       , 3);
780
-define('BUILD_QUE_UNIT_WRONG'  , 4);
781
-define('BUILD_INDESTRUCTABLE'  , 5);
782
-define('BUILD_NO_RESOURCES'    , 6);
783
-define('BUILD_NO_UNITS'        , 7);
784
-define('BUILD_UNIT_BUSY'       , 8);
785
-define('BUILD_QUE_FULL'        , 9);
786
-define('BUILD_SILO_FULL'       ,10);
787
-define('BUILD_MAX_REACHED'     ,11);
788
-define('BUILD_SECTORS_NONE'    ,12);
778
+define('BUILD_AMOUNT_WRONG', 2);
779
+define('BUILD_QUE_WRONG', 3);
780
+define('BUILD_QUE_UNIT_WRONG', 4);
781
+define('BUILD_INDESTRUCTABLE', 5);
782
+define('BUILD_NO_RESOURCES', 6);
783
+define('BUILD_NO_UNITS', 7);
784
+define('BUILD_UNIT_BUSY', 8);
785
+define('BUILD_QUE_FULL', 9);
786
+define('BUILD_SILO_FULL', 10);
787
+define('BUILD_MAX_REACHED', 11);
788
+define('BUILD_SECTORS_NONE', 12);
789 789
 define('BUILD_AUTOCONVERT_AVAILABLE', 13);
790 790
 
791 791
 
792 792
 // *** Que types
793 793
 define('QUE_STRUCTURES', 1);
794
-define('QUE_HANGAR'    , 4);
795
-define('QUE_RESEARCH'  , 7);
796
-define('QUE_MERCENARY' , 600); // UNIT_MERCENARIES
794
+define('QUE_HANGAR', 4);
795
+define('QUE_RESEARCH', 7);
796
+define('QUE_MERCENARY', 600); // UNIT_MERCENARIES
797 797
 // *** Subque types
798
-define('SUBQUE_PLANET'  , 1);
799
-define('SUBQUE_MOON'    , 3);
800
-define('SUBQUE_FLEET'   , 4);
801
-define('SUBQUE_DEFENSE' , 6);
798
+define('SUBQUE_PLANET', 1);
799
+define('SUBQUE_MOON', 3);
800
+define('SUBQUE_FLEET', 4);
801
+define('SUBQUE_DEFENSE', 6);
802 802
 define('SUBQUE_RESEARCH', 7);
803 803
 
804 804
 // *** Que items
805
-define('QI_UNIT_ID'   , 0);
806
-define('QI_AMOUNT'    , 1);
807
-define('QI_TIME'      , 2);
808
-define('QI_MODE'      , 3);
809
-define('QI_QUE_ID'    , 4);
810
-define('QI_QUE_TYPE'  , 4);
811
-define('QI_PLANET_ID' , 5);
805
+define('QI_UNIT_ID', 0);
806
+define('QI_AMOUNT', 1);
807
+define('QI_TIME', 2);
808
+define('QI_MODE', 3);
809
+define('QI_QUE_ID', 4);
810
+define('QI_QUE_TYPE', 4);
811
+define('QI_PLANET_ID', 5);
812 812
 
813 813
 
814 814
 // *** Units
815 815
 
816 816
 // *** Sort options
817
-define('SORT_ASCENDING' , 0);
817
+define('SORT_ASCENDING', 0);
818 818
 define('SORT_DESCENDING', 1);
819 819
 
820
-define('SORT_ID'             , 0);
821
-define('SORT_LOCATION'       , 1);
822
-define('SORT_NAME'           , 2);
823
-define('SORT_SIZE'           , 3);
824
-define('SORT_EMAIL'          , 4);
825
-define('SORT_IP'             , 5);
820
+define('SORT_ID', 0);
821
+define('SORT_LOCATION', 1);
822
+define('SORT_NAME', 2);
823
+define('SORT_SIZE', 3);
824
+define('SORT_EMAIL', 4);
825
+define('SORT_IP', 5);
826 826
 define('SORT_TIME_REGISTERED', 6);
827 827
 define('SORT_TIME_LAST_VISIT', 7);
828
-define('SORT_TIME_BAN_UNTIL' , 8);
829
-define('SORT_REFERRAL_COUNT' , 9);
830
-define('SORT_REFERRAL_DM'    , 10);
828
+define('SORT_TIME_BAN_UNTIL', 8);
829
+define('SORT_REFERRAL_COUNT', 9);
830
+define('SORT_REFERRAL_DM', 10);
831 831
 
832 832
 
833 833
 define('HULL_SIZE_TINY', 1);
@@ -970,10 +970,10 @@  discard block
 block discarded – undo
970 970
 
971 971
 // === Artifacts
972 972
 define('UNIT_ARTIFACTS', 1000);
973
-define('ART_LHC', 1001);      // Additional moon chance
974
-define('ART_RCD_SMALL', 1002);   // Rapid Colony Deployment - Set of buildings up to 10th level - 10/14/ 3/0 -   405 DM
975
-define('ART_RCD_MEDIUM', 1003);  // Rapid Colony Deployment - Set of buildings up to 15th level - 15/20/ 8/0 -  4704 DM
976
-define('ART_RCD_LARGE', 1004);   // Rapid Colony Deployment - Set of buildings up to 20th level - 20/25/10/1 - 39790 DM
973
+define('ART_LHC', 1001); // Additional moon chance
974
+define('ART_RCD_SMALL', 1002); // Rapid Colony Deployment - Set of buildings up to 10th level - 10/14/ 3/0 -   405 DM
975
+define('ART_RCD_MEDIUM', 1003); // Rapid Colony Deployment - Set of buildings up to 15th level - 15/20/ 8/0 -  4704 DM
976
+define('ART_RCD_LARGE', 1004); // Rapid Colony Deployment - Set of buildings up to 20th level - 20/25/10/1 - 39790 DM
977 977
 define('ART_HEURISTIC_CHIP', 1005); // Speed up research
978 978
 define('ART_NANO_BUILDER', 1006); // Speed up building
979 979
 define('ART_NANO_CONSTRUCTOR', 1007); // RESERVED Speed up hangar constructions
@@ -1044,18 +1044,18 @@  discard block
 block discarded – undo
1044 1044
 define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE1', 2201); // Блиц-сервер, участник 0-го раунда, 1-е место
1045 1045
 define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE2', 2202); // Блиц-сервер, участник 0-го раунда, 2-е место
1046 1046
 define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE3', 2203); // Блиц-сервер, участник 0-го раунда, 3-е место
1047
-define('UNIT_AWARD_MEDAL_2016_WOMEN_DAY_BEST', 2204);  // Медаль Лучшему Кавалеру за максимум потраченной ММ/максимум одаренных женщин Женщине от Мужчины во время ивента 8 марта 2016 года
1047
+define('UNIT_AWARD_MEDAL_2016_WOMEN_DAY_BEST', 2204); // Медаль Лучшему Кавалеру за максимум потраченной ММ/максимум одаренных женщин Женщине от Мужчины во время ивента 8 марта 2016 года
1048 1048
 
1049 1049
 define('UNIT_AWARD_MEMORY', 2300); // Памятные знаки за существование и участие - например "4 года в игре". "Был онлайн в новогоднюю ночь 2013". итд
1050
-define('UNIT_AWARD_MEMORY_IMMORTAL', 2301);  // Бессмертный
1051
-define('UNIT_AWARD_MEMORY_2015_WOMEN_DAY', 2302);  // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2015 года
1050
+define('UNIT_AWARD_MEMORY_IMMORTAL', 2301); // Бессмертный
1051
+define('UNIT_AWARD_MEMORY_2015_WOMEN_DAY', 2302); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2015 года
1052 1052
 define('UNIT_AWARD_MEMORY_BLITZ_R0', 2303); // Блиц-сервер, участник 0-го раунда
1053 1053
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_SIMPLE', 2304); // День Рождения СН
1054 1054
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_BRONZE', 2305); // День Рождения СН
1055 1055
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_SILVER', 2306); // День Рождения СН
1056 1056
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_GOLD', 2307); // День Рождения СН
1057 1057
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_PLATINUM', 2308); // День Рождения СН
1058
-define('UNIT_AWARD_MEMORY_2016_WOMEN_DAY', 2309);  // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2016 года
1058
+define('UNIT_AWARD_MEMORY_2016_WOMEN_DAY', 2309); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2016 года
1059 1059
 
1060 1060
 define('UNIT_AWARD_PENNANT', 2400); // Переходящий вымпел - индикация статуса на сервере: "Топ-1", "Топ", "Сабтоп", "Самый большой флот" итд
1061 1061
 define('UNIT_AWARD_BADGE', 2600); // Бейджики/значки за ачивки - например, "Построил 1000 кораблей"
@@ -1152,7 +1152,7 @@  discard block
 block discarded – undo
1152 1152
 
1153 1153
 define('UNIT_NEXT', 4000); // !!! Next unit start on 4000 !!!
1154 1154
 
1155
-define('GROUP_PART',         800000);
1155
+define('GROUP_PART', 800000);
1156 1156
 // Зарезервировано для запчастей: 800.001 - 899.999
1157 1157
 // define('GROUP_PART_HULL',    801000); // Корпуса - 1000 штук
1158 1158
 // define('GROUP_PART_ARMOR',   802000); // Броня - 1000 штук
@@ -1409,32 +1409,32 @@  discard block
 block discarded – undo
1409 1409
 
1410 1410
 
1411 1411
 // define('NICK_ID',               -1);
1412
-define('NICK_HTML',              0);
1413
-
1414
-define('NICK_FIRST',             1);
1415
-define('NICK_RACE',           1000);
1416
-define('NICK_GENDER',         2000);
1417
-define('NICK_AWARD',          3000);
1418
-define('NICK_VACATION',       3500);
1419
-define('NICK_BIRTHSDAY',      4000);
1420
-define('NICK_PREMIUM',        5000);
1421
-define('NICK_AUTH_LEVEL',     6000);
1422
-
1423
-define('NICK_HIGHLIGHT',      6300);
1424
-define('NICK_CLASS',          6450);
1425
-
1426
-define('NICK_NICK_CLASS',     6600);
1427
-define('NICK_NICK',           7000);
1412
+define('NICK_HTML', 0);
1413
+
1414
+define('NICK_FIRST', 1);
1415
+define('NICK_RACE', 1000);
1416
+define('NICK_GENDER', 2000);
1417
+define('NICK_AWARD', 3000);
1418
+define('NICK_VACATION', 3500);
1419
+define('NICK_BIRTHSDAY', 4000);
1420
+define('NICK_PREMIUM', 5000);
1421
+define('NICK_AUTH_LEVEL', 6000);
1422
+
1423
+define('NICK_HIGHLIGHT', 6300);
1424
+define('NICK_CLASS', 6450);
1425
+
1426
+define('NICK_NICK_CLASS', 6600);
1427
+define('NICK_NICK', 7000);
1428 1428
 define('NICK_NICK_CLASS_END', 7300);
1429 1429
 
1430
-define('NICK_ALLY_CLASS',     7600);
1431
-define('NICK_ALLY',           8000);
1430
+define('NICK_ALLY_CLASS', 7600);
1431
+define('NICK_ALLY', 8000);
1432 1432
 define('NICK_ALLY_CLASS_END', 8300);
1433 1433
 
1434
-define('NICK_CLASS_END',      8450);
1435
-define('NICK_HIGHLIGHT_END',  8600);
1434
+define('NICK_CLASS_END', 8450);
1435
+define('NICK_HIGHLIGHT_END', 8600);
1436 1436
 
1437
-define('NICK_LAST',           9999);
1437
+define('NICK_LAST', 9999);
1438 1438
 
1439 1439
 // Настройки игрока
1440 1440
 define('PLAYER_OPTION_MENU_SORT', 1);
@@ -1527,8 +1527,8 @@  discard block
 block discarded – undo
1527 1527
 define('LOG_ONLIINE_AGGREGATE_PERIOD_MINUTE_10', 1);
1528 1528
 
1529 1529
 define('BLITZ_REGISTER_DISABLED', 0);
1530
-define('BLITZ_REGISTER_OPEN'    , 1);
1531
-define('BLITZ_REGISTER_CLOSED'  , 2);
1530
+define('BLITZ_REGISTER_OPEN', 1);
1531
+define('BLITZ_REGISTER_CLOSED', 2);
1532 1532
 define('BLITZ_REGISTER_SHOW_LOGIN', 3);
1533 1533
 define('BLITZ_REGISTER_DISCLOSURE_NAMES', 4);
1534 1534
 
Please login to merge, or discard this patch.
admin/ajax_maintenance.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -2,9 +2,9 @@  discard block
 block discarded – undo
2 2
 
3 3
 define('IN_ADMIN', true);
4 4
 
5
-require('../includes/init.' . substr(strrchr(__FILE__, '.'), 1));
5
+require('../includes/init.'.substr(strrchr(__FILE__, '.'), 1));
6 6
 
7
-if($user['authlevel'] < 3)
7
+if ($user['authlevel'] < 3)
8 8
 {
9 9
   message(classLocale::$lang['sys_noalloaw'], classLocale::$lang['sys_noaccess']);
10 10
   die();
@@ -20,13 +20,13 @@  discard block
 block discarded – undo
20 20
 // [#] info_best_battles 1b0
21 21
 $best_reports = array();
22 22
 
23
-if(defined('MODULE_INFO_BEST_BATTLES_QUERY')) {
23
+if (defined('MODULE_INFO_BEST_BATTLES_QUERY')) {
24 24
   $query = db_ube_report_get_best_battles();
25
-  while($row = db_fetch($query)) {
25
+  while ($row = db_fetch($query)) {
26 26
     $best_reports[] = $row['ube_report_id'];
27 27
   }
28 28
 }
29
-$best_reports = !empty($best_reports) ? ' AND ube_report_id NOT IN (' . implode(',', $best_reports) . ')' : '';
29
+$best_reports = !empty($best_reports) ? ' AND ube_report_id NOT IN ('.implode(',', $best_reports).')' : '';
30 30
 
31 31
 
32 32
 $ques = array(
@@ -90,14 +90,14 @@  discard block
 block discarded – undo
90 90
   // Удаляем юниты без планет
91 91
   'DELETE un FROM {{unit}} AS un
92 92
     LEFT JOIN {{planets}} AS pl ON pl.id = un.unit_location_id
93
-  WHERE unit_location_type = ' . LOC_PLANET . ' AND pl.id IS NULL;',
93
+  WHERE unit_location_type = ' . LOC_PLANET.' AND pl.id IS NULL;',
94 94
   // Удаляем пустые юниты с 0 уровнем (кроме Капитана)
95
-  'DELETE FROM {{unit}} WHERE unit_location_type = ' . LOC_PLANET . ' AND unit_level = 0 AND unit_type <> ' . UNIT_CAPTAIN,
95
+  'DELETE FROM {{unit}} WHERE unit_location_type = '.LOC_PLANET.' AND unit_level = 0 AND unit_type <> '.UNIT_CAPTAIN,
96 96
   // Удаляем очереди на ничьих планетах
97 97
   'DELETE q FROM {{que}} AS q
98 98
     LEFT JOIN {{planets}} AS p ON p.id = q.que_planet_id
99 99
   WHERE
100
-    que_type IN (' . QUE_STRUCTURES . ', ' . QUE_HANGAR . ', ' . SUBQUE_FLEET . ', ' . SUBQUE_DEFENSE . ')
100
+    que_type IN (' . QUE_STRUCTURES.', '.QUE_HANGAR.', '.SUBQUE_FLEET.', '.SUBQUE_DEFENSE.')
101 101
     AND
102 102
     (p.id_owner = 0 OR p.id_owner IS NULL);',
103 103
 
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
   // Удаляются сообщения, старше  4 недель, кроме личных и Альянсовских
113 113
   'DELETE FROM {{messages}} WHERE
114 114
     UNIX_TIMESTAMP() - message_time > 4*7 * 24 * 60 * 60 AND
115
-    message_type NOT IN (' . MSG_TYPE_PLAYER . ', ' . MSG_TYPE_ALLIANCE . ');',
115
+    message_type NOT IN (' . MSG_TYPE_PLAYER.', '.MSG_TYPE_ALLIANCE.');',
116 116
   // Удаляются сообщения у пользователей, которые неактивны больше 4 недель - кроме личных и Альянсовских
117 117
   'DELETE m FROM `{{users}}` AS u
118 118
   JOIN {{messages}} AS m ON m.message_owner = u.id
119 119
   WHERE
120
-    message_type NOT IN (' . MSG_TYPE_PLAYER . ', ' . MSG_TYPE_ALLIANCE . ') AND
120
+    message_type NOT IN (' . MSG_TYPE_PLAYER.', '.MSG_TYPE_ALLIANCE.') AND
121 121
     authlevel = 0 AND  user_as_ally IS NULL AND /* Не админы, Не Альянсы */
122 122
     UNIX_TIMESTAMP() - onlinetime > 4*7 *86400;',
123 123
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
       (log_dark_matter_timestamp, log_dark_matter_username, log_dark_matter_reason, log_dark_matter_amount,
138 138
       log_dark_matter_comment, log_dark_matter_page, log_dark_matter_sender)
139 139
     SELECT
140
-      '{$pack_until}', IF(u.username IS NULL, ldm.log_dark_matter_username, u.username), " . RPG_CUMULATIVE . ", sum(ldm.log_dark_matter_amount),
140
+      '{$pack_until}', IF(u.username IS NULL, ldm.log_dark_matter_username, u.username), ".RPG_CUMULATIVE.", sum(ldm.log_dark_matter_amount),
141 141
       'Баланс на {$pack_until}', 'admin/ajax_maintenance.php', ldm.log_dark_matter_sender
142 142
     FROM
143 143
       {{log_dark_matter}} AS ldm
@@ -155,22 +155,22 @@  discard block
 block discarded – undo
155 155
     "REPLACE INTO `{{log_users_online}}`
156 156
       (online_timestamp, online_count, online_aggregated)
157 157
     SELECT
158
-      FROM_UNIXTIME((UNIX_TIMESTAMP(online_timestamp) DIV " . PERIOD_MINUTE_10 . ") * (" . PERIOD_MINUTE_10 . ")), ceil(avg(online_count)), " . LOG_ONLIINE_AGGREGATE_PERIOD_MINUTE_10 . "
158
+      FROM_UNIXTIME((UNIX_TIMESTAMP(online_timestamp) DIV " . PERIOD_MINUTE_10.") * (".PERIOD_MINUTE_10.")), ceil(avg(online_count)), ".LOG_ONLIINE_AGGREGATE_PERIOD_MINUTE_10."
159 159
     FROM
160 160
       `{{log_users_online}}`
161 161
     WHERE
162
-      online_timestamp < '{$pack_until}' AND online_aggregated = " . LOG_ONLIINE_AGGREGATE_NONE . "
162
+      online_timestamp < '{$pack_until}' AND online_aggregated = ".LOG_ONLIINE_AGGREGATE_NONE."
163 163
     GROUP BY
164
-      (UNIX_TIMESTAMP(online_timestamp) DIV " . PERIOD_MINUTE_10 . ") * (" . PERIOD_MINUTE_10 . ");",
164
+      (UNIX_TIMESTAMP(online_timestamp) DIV " . PERIOD_MINUTE_10.") * (".PERIOD_MINUTE_10.");",
165 165
 
166
-    "DELETE FROM {{log_users_online}} WHERE online_timestamp < '{$pack_until}' AND online_aggregated = " . LOG_ONLIINE_AGGREGATE_NONE,
166
+    "DELETE FROM {{log_users_online}} WHERE online_timestamp < '{$pack_until}' AND online_aggregated = ".LOG_ONLIINE_AGGREGATE_NONE,
167 167
   ),
168 168
 
169 169
   // Удаляем старые записи из логов
170 170
   "DELETE FROM `{{logs}}` WHERE log_timestamp < '{$pack_until}';",
171 171
   // Удаляем записи о маинтенансе, апдейте и пересчете статистики более чем недельной давности - они нам уже не нужны
172 172
   'DELETE FROM `{{logs}}` WHERE
173
-    `log_code` IN (' . LOG_INFO_DB_CHANGE . ', ' . LOG_INFO_MAINTENANCE . ', ' . LOG_INFO_STAT_START . ', ' . LOG_INFO_STAT_PROCESS . ', ' . LOG_INFO_STAT_FINISH . ')
173
+    `log_code` IN (' . LOG_INFO_DB_CHANGE.', '.LOG_INFO_MAINTENANCE.', '.LOG_INFO_STAT_START.', '.LOG_INFO_STAT_PROCESS.', '.LOG_INFO_STAT_FINISH.')
174 174
     AND `log_timestamp` < DATE_SUB(NOW(),INTERVAL 7 DAY);',
175 175
 
176 176
 
@@ -189,13 +189,13 @@  discard block
 block discarded – undo
189 189
 $old_server_status == GAME_DISABLE_NONE ? classSupernova::$config->db_saveItem('game_disable', GAME_DISABLE_MAINTENANCE) : false;
190 190
 sn_db_transaction_commit();
191 191
 
192
-foreach($ques as $que_transaction) {
192
+foreach ($ques as $que_transaction) {
193 193
   sn_db_transaction_start();
194 194
 
195 195
   !is_array($que_transaction) ? $que_transaction = array($que_transaction) : false;
196
-  foreach($que_transaction as $que) {
196
+  foreach ($que_transaction as $que) {
197 197
     set_time_limit(120);
198
-    if(is_callable($que)) {
198
+    if (is_callable($que)) {
199 199
       $QryResult = call_user_func($que);
200 200
     } else {
201 201
       $QryResult = doquery($que);
@@ -206,12 +206,12 @@  discard block
 block discarded – undo
206 206
     //$que = str_replace('}}', '', $que);
207 207
 
208 208
     $msg .=
209
-      '<li>' . htmlspecialchars($que) .
210
-        ' --- <span style="' . ($QryResult ? 'ok">OK' : 'error">FAILED!') . '</span> ' .
211
-      classSupernova::$db->db_affected_rows() . ' ' . classLocale::$lang['adm_records'] .
209
+      '<li>'.htmlspecialchars($que).
210
+        ' --- <span style="'.($QryResult ? 'ok">OK' : 'error">FAILED!').'</span> '.
211
+      classSupernova::$db->db_affected_rows().' '.classLocale::$lang['adm_records'].
212 212
       "</li>";
213 213
 
214
-    classSupernova::$debug->warning($que . ' --- ' . ($QryResult ? 'OK' : 'FAILED!') . ' ' . classSupernova::$db->db_affected_rows() . ' ' . classLocale::$lang['adm_records'], 'System maintenance', LOG_INFO_MAINTENANCE);
214
+    classSupernova::$debug->warning($que.' --- '.($QryResult ? 'OK' : 'FAILED!').' '.classSupernova::$db->db_affected_rows().' '.classLocale::$lang['adm_records'], 'System maintenance', LOG_INFO_MAINTENANCE);
215 215
   }
216 216
 
217 217
   sn_db_transaction_commit();
@@ -239,5 +239,5 @@  discard block
 block discarded – undo
239 239
 
240 240
 $adm_stat_title = classLocale::$lang['adm_stat_title'];
241 241
 $result = $result ? "<li>{$adm_stat_title} - {$result}</li>" : '';
242
-$result = '<div align="left"><ul>' . $msg . $result . '</ul></div>';
243
-echo json_encode($result . ' ' . $totaltime);
242
+$result = '<div align="left"><ul>'.$msg.$result.'</ul></div>';
243
+echo json_encode($result.' '.$totaltime);
Please login to merge, or discard this patch.
common.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,24 +12,24 @@  discard block
 block discarded – undo
12 12
 global $template_result, $user;
13 13
 
14 14
 // Напоминание для Администрации, что игра отключена
15
-if($template_result[F_GAME_DISABLE]) {
15
+if ($template_result[F_GAME_DISABLE]) {
16 16
   echo '<div class="global_admin_warning">', $template_result[F_GAME_DISABLE_REASON], '</div>';
17 17
 }
18 18
 unset($disable_reason);
19 19
 
20 20
 
21
-if(defined('IN_ADMIN') && IN_ADMIN === true) {
21
+if (defined('IN_ADMIN') && IN_ADMIN === true) {
22 22
   lng_include('admin');
23
-} elseif($sys_user_logged_in) {
23
+} elseif ($sys_user_logged_in) {
24 24
   sys_user_vacation($user);
25 25
 
26 26
   $planet_id = SetSelectedPlanet($user);
27 27
 
28 28
   // TODO НЕ НУЖНО АЛЬЯНС КАЖДЫЙ РАЗ ОБНОВЛЯТЬ!!!
29
-  if($user['ally_id']) {
29
+  if ($user['ally_id']) {
30 30
     sn_db_transaction_start();
31 31
     sn_ali_fill_user_ally($user);
32
-    if(!$user['ally']['player']['id']) {
32
+    if (!$user['ally']['player']['id']) {
33 33
       // sn_sys_logout(false, true);
34 34
       // core_auth::logout(false);
35 35
       classSupernova::$auth->logout(false);
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
     }
38 38
     // TODO UNCOMMENT
39 39
     que_process($user['ally']['player']);
40
-    DBStaticUser::db_user_set_by_id($user['ally']['player']['id'], '`onlinetime` = ' . SN_TIME_NOW);
40
+    DBStaticUser::db_user_set_by_id($user['ally']['player']['id'], '`onlinetime` = '.SN_TIME_NOW);
41 41
     sn_db_transaction_commit();
42 42
   }
43 43
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
   sn_db_transaction_commit();
49 49
 
50 50
   $planetrow = $global_data['planet'];
51
-  if(!($planetrow && isset($planetrow['id']) && $planetrow['id'])) {
51
+  if (!($planetrow && isset($planetrow['id']) && $planetrow['id'])) {
52 52
     // sn_sys_logout(false, true);
53 53
     // core_auth::logout(false);
54 54
     classSupernova::$auth->logout(false);
Please login to merge, or discard this patch.
admin/admin_user.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,22 +3,22 @@  discard block
 block discarded – undo
3 3
 define('INSIDE', true);
4 4
 define('INSTALL', false);
5 5
 define('IN_ADMIN', true);
6
-require('../common.' . substr(strrchr(__FILE__, '.'), 1));
6
+require('../common.'.substr(strrchr(__FILE__, '.'), 1));
7 7
 
8
-if($user['authlevel'] < 3) {
8
+if ($user['authlevel'] < 3) {
9 9
   AdminMessage(classLocale::$lang['adm_err_denied']);
10 10
 }
11 11
 
12 12
 lng_include('admin');
13 13
 
14 14
 $user_id = sys_get_param_id('uid');
15
-if(!($user_row = DBStaticUser::db_user_by_id($user_id))) {
15
+if (!($user_row = DBStaticUser::db_user_by_id($user_id))) {
16 16
   AdminMessage(sprintf(classLocale::$lang['adm_dm_user_none'], $user_id));
17 17
 }
18 18
 
19 19
 $template = gettemplate('admin/admin_user', true);
20 20
 
21
-if(!empty($user_row['user_last_browser_id'])) {
21
+if (!empty($user_row['user_last_browser_id'])) {
22 22
   $user_row['browser_user_agent'] = db_browser_agent_get_by_id($user_row['user_last_browser_id']);
23 23
 }
24 24
 
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
     'raidsloose',
55 55
     'raidswin',
56 56
     'total_rank',
57
-    'total_points',  ),
57
+    'total_points',),
58 58
 );
59
-foreach($formats as $callable => $field_list) {
60
-  foreach($field_list as $field_name) {
59
+foreach ($formats as $callable => $field_list) {
60
+  foreach ($field_list as $field_name) {
61 61
     $user_row[$field_name] = call_user_func($callable, $user_row[$field_name]);
62 62
   }
63 63
 }
Please login to merge, or discard this patch.
includes/functions/sys_user.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 function sys_user_vacation($user) {
10
-  if(sys_get_param_str('vacation') == 'leave') {
10
+  if (sys_get_param_str('vacation') == 'leave') {
11 11
     if ($user['vacation'] < SN_TIME_NOW) {
12 12
       $user['vacation'] = 0;
13 13
       $user['vacation_next'] = SN_TIME_NOW + classSupernova::$config->player_vacation_timeout;
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     }
16 16
   }
17 17
 
18
-  if($user['vacation']) {
18
+  if ($user['vacation']) {
19 19
     // sn_sys_logout(false, true);
20 20
     // core_auth::logout(false, true);
21 21
 
@@ -45,33 +45,33 @@  discard block
 block discarded – undo
45 45
   // TODO: Full rewrite
46 46
   sn_db_transaction_start();
47 47
   $TheUser = DBStaticUser::db_user_by_id($UserID);
48
-  if ( $TheUser['ally_id'] != 0 ) {
49
-    $TheAlly = doquery ( "SELECT * FROM `{{alliance}}` WHERE `id` = '" . $TheUser['ally_id'] . "';", '', true );
48
+  if ($TheUser['ally_id'] != 0) {
49
+    $TheAlly = doquery("SELECT * FROM `{{alliance}}` WHERE `id` = '".$TheUser['ally_id']."';", '', true);
50 50
     $TheAlly['ally_members'] -= 1;
51
-    if ( $TheAlly['ally_members'] > 0 ) {
52
-      doquery ( "UPDATE `{{alliance}}` SET `ally_members` = '" . $TheAlly['ally_members'] . "' WHERE `id` = '" . $TheAlly['id'] . "';");
51
+    if ($TheAlly['ally_members'] > 0) {
52
+      doquery("UPDATE `{{alliance}}` SET `ally_members` = '".$TheAlly['ally_members']."' WHERE `id` = '".$TheAlly['id']."';");
53 53
     } else {
54
-      doquery ( "DELETE FROM `{{alliance}}` WHERE `id` = '" . $TheAlly['id'] . "';");
55
-      doquery ( "DELETE FROM `{{statpoints}}` WHERE `stat_type` = '2' AND `id_owner` = '" . $TheAlly['id'] . "';");
54
+      doquery("DELETE FROM `{{alliance}}` WHERE `id` = '".$TheAlly['id']."';");
55
+      doquery("DELETE FROM `{{statpoints}}` WHERE `stat_type` = '2' AND `id_owner` = '".$TheAlly['id']."';");
56 56
     }
57 57
   }
58
-  doquery ( "DELETE FROM `{{statpoints}}` WHERE `stat_type` = '1' AND `id_owner` = '" . $UserID . "';");
58
+  doquery("DELETE FROM `{{statpoints}}` WHERE `stat_type` = '1' AND `id_owner` = '".$UserID."';");
59 59
 
60 60
   db_planet_list_delete_by_owner($UserID);
61 61
 
62
-  doquery ( "DELETE FROM `{{messages}}` WHERE `message_sender` = '" . $UserID . "';");
63
-  doquery ( "DELETE FROM `{{messages}}` WHERE `message_owner` = '" . $UserID . "';");
64
-  doquery ( "DELETE FROM `{{notes}}` WHERE `owner` = '" . $UserID . "';");
62
+  doquery("DELETE FROM `{{messages}}` WHERE `message_sender` = '".$UserID."';");
63
+  doquery("DELETE FROM `{{messages}}` WHERE `message_owner` = '".$UserID."';");
64
+  doquery("DELETE FROM `{{notes}}` WHERE `owner` = '".$UserID."';");
65 65
   FleetList::db_fleet_list_delete_by_owner($UserID);
66 66
 //  doquery ( "DELETE FROM `{{rw}}` WHERE `id_owner1` = '" . $UserID . "';");
67 67
 //  doquery ( "DELETE FROM `{{rw}}` WHERE `id_owner2` = '" . $UserID . "';");
68
-  doquery ( "DELETE FROM `{{buddy}}` WHERE `BUDDY_SENDER_ID` = '" . $UserID . "';");
69
-  doquery ( "DELETE FROM `{{buddy}}` WHERE `BUDDY_OWNER_ID` = '" . $UserID . "';");
70
-  doquery ( "DELETE FROM `{{annonce}}` WHERE `user` = '" . $UserID . "';");
68
+  doquery("DELETE FROM `{{buddy}}` WHERE `BUDDY_SENDER_ID` = '".$UserID."';");
69
+  doquery("DELETE FROM `{{buddy}}` WHERE `BUDDY_OWNER_ID` = '".$UserID."';");
70
+  doquery("DELETE FROM `{{annonce}}` WHERE `user` = '".$UserID."';");
71 71
 
72 72
 
73 73
   classSupernova::db_del_record_by_id(LOC_USER, $UserID);
74
-  doquery ( "DELETE FROM `{{referrals}}` WHERE (`id` = '{$UserID}') OR (`id_partner` = '{$UserID}');");
74
+  doquery("DELETE FROM `{{referrals}}` WHERE (`id` = '{$UserID}') OR (`id_partner` = '{$UserID}');");
75 75
   classSupernova::$config->db_saveItem('users_amount', classSupernova::$config->db_loadItem('users_amount') - 1);
76 76
   sn_db_transaction_commit();
77 77
 }
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
   $ban_current = DBStaticUser::db_user_by_id($banned['id'], false, 'banaday');
88 88
   $ban_until = ($ban_current['banaday'] ? $ban_current['banaday'] : SN_TIME_NOW) + $term;
89 89
 
90
-  DBStaticUser::db_user_set_by_id($banned['id'], "`banaday` = {$ban_until} " . ($is_vacation ? ", `vacation` = '{$ban_until}' " : ''));
90
+  DBStaticUser::db_user_set_by_id($banned['id'], "`banaday` = {$ban_until} ".($is_vacation ? ", `vacation` = '{$ban_until}' " : ''));
91 91
 
92 92
   $banned['username'] = db_escape($banned['username']);
93 93
   $banner['username'] = db_escape($banner['username']);
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
  * @param string $reason
106 106
  */
107 107
 function sys_admin_player_ban_unset($banner, $banned, $reason = '') {
108
-  DBStaticUser::db_user_set_by_id($banned['id'], "`banaday` = 0, `vacation` = " . SN_TIME_NOW . "");
108
+  DBStaticUser::db_user_set_by_id($banned['id'], "`banaday` = 0, `vacation` = ".SN_TIME_NOW."");
109 109
 
110 110
   $banned['username'] = db_escape($banned['username']);
111 111
   $banner['username'] = db_escape($banner['username']);
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 
135 135
     'total_points' => $options['total_points'] = empty($options['total_points']) ? 0 : $options['total_points'],
136 136
 
137
-    'options' => (empty($options['options']) ? $player_options_string : $options['options']) . (empty($options['options_extra']) ? '' : $options['options_extra']),
137
+    'options' => (empty($options['options']) ? $player_options_string : $options['options']).(empty($options['options_extra']) ? '' : $options['options_extra']),
138 138
 
139 139
     'galaxy' => $options['galaxy'] = intval($options['galaxy'] ? $options['galaxy'] : 0),
140 140
     'system' => $options['system'] = intval($options['system'] ? $options['system'] : 0),
@@ -145,28 +145,28 @@  discard block
 block discarded – undo
145 145
   !empty($options['password_encoded_unsafe']) ? $field_set['password'] = $options['password_encoded_unsafe'] : false;
146 146
 
147 147
   $user_new = classSupernova::db_ins_field_set(LOC_USER, $field_set);
148
-  if(!($options['galaxy'] && $options['system'] && $options['planet'])) {
148
+  if (!($options['galaxy'] && $options['system'] && $options['planet'])) {
149 149
     $options['galaxy'] = classSupernova::$config->LastSettedGalaxyPos;
150 150
     $options['system'] = classSupernova::$config->LastSettedSystemPos;
151
-    $segment_size = floor(Vector::$knownPlanets/ 3);
151
+    $segment_size = floor(Vector::$knownPlanets / 3);
152 152
     $segment = floor(classSupernova::$config->LastSettedPlanetPos / $segment_size);
153 153
     $segment++;
154 154
     $options['planet'] = mt_rand(1 + $segment * $segment_size, ($segment + 1) * $segment_size);
155 155
 
156 156
     // $new_planet_id = 0;
157
-    while(true) {
158
-      if($options['planet'] > Vector::$knownPlanets) {
157
+    while (true) {
158
+      if ($options['planet'] > Vector::$knownPlanets) {
159 159
         $options['planet'] = mt_rand(0, $segment_size - 1) + 1;
160 160
         $options['system']++;
161 161
       }
162
-      if($options['system'] > Vector::$knownSystems) {
162
+      if ($options['system'] > Vector::$knownSystems) {
163 163
         $options['system'] = 1;
164 164
         $options['galaxy']++;
165 165
       }
166
-      $options['galaxy'] > Vector::$knownGalaxies? $options['galaxy'] = 1 : false;
166
+      $options['galaxy'] > Vector::$knownGalaxies ? $options['galaxy'] = 1 : false;
167 167
 
168 168
       $galaxy_row = db_planet_by_gspt($options['galaxy'], $options['system'], $options['planet'], PT_PLANET, true, 'id');
169
-      if(!$galaxy_row['id']) {
169
+      if (!$galaxy_row['id']) {
170 170
         classSupernova::$config->db_saveItem(array(
171 171
           'LastSettedGalaxyPos' => $options['galaxy'],
172 172
           'LastSettedSystemPos' => $options['system'],
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
   $username_safe = db_escape($username_unsafe);
190 190
   db_player_name_history_replace($user_new, $username_safe);
191 191
 
192
-  if(!empty($options['partner_id']) && ($referral_row = DBStaticUser::db_user_by_id($options['partner_id'], true))) {
192
+  if (!empty($options['partner_id']) && ($referral_row = DBStaticUser::db_user_by_id($options['partner_id'], true))) {
193 193
     db_referral_insert($options, $user_new);
194 194
   }
195 195
 
Please login to merge, or discard this patch.