Completed
Push — work-fleets ( 094cef...4ec5b3 )
by SuperNova.WS
06:12
created
includes/functions/int_banner_create.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
       $img_name = classSupernova::$config->int_userbar_background;
25 25
     break;
26 26
   }
27
-  $size = getimagesize(SN_ROOT_PHYSICAL . $img_name);
28
-  $im = imagecreatefrompng(SN_ROOT_PHYSICAL . $img_name);
27
+  $size = getimagesize(SN_ROOT_PHYSICAL.$img_name);
28
+  $im = imagecreatefrompng(SN_ROOT_PHYSICAL.$img_name);
29 29
   $image = imagecreatetruecolor($size[0], $size[1]);
30 30
   imagecopy($image, $im, 0, 0, 0, 0, $size[0], $size[1]);
31 31
   imagedestroy($im);
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
   $txt_color2 = imagecolorallocatealpha($image, 255, 255, 255, 40);
38 38
 
39 39
   $fonts = array(
40
-    'userbar'  => SN_ROOT_PHYSICAL . "design/fonts/" . classSupernova::$config->int_userbar_font,
41
-    'universe' => SN_ROOT_PHYSICAL . "design/fonts/" . classSupernova::$config->int_banner_fontUniverse,
42
-    'raids'    => SN_ROOT_PHYSICAL . "design/fonts/" . classSupernova::$config->int_banner_fontRaids,
43
-    'info'     => SN_ROOT_PHYSICAL . "design/fonts/" . classSupernova::$config->int_banner_fontInfo,
40
+    'userbar'  => SN_ROOT_PHYSICAL."design/fonts/".classSupernova::$config->int_userbar_font,
41
+    'universe' => SN_ROOT_PHYSICAL."design/fonts/".classSupernova::$config->int_banner_fontUniverse,
42
+    'raids'    => SN_ROOT_PHYSICAL."design/fonts/".classSupernova::$config->int_banner_fontRaids,
43
+    'info'     => SN_ROOT_PHYSICAL."design/fonts/".classSupernova::$config->int_banner_fontInfo,
44 44
   );
45 45
 
46 46
   if ($id) {
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
     $b_user = $user['username'];
53 53
     $b_ally = $user['ally_name'];
54 54
     $b_planet = $planet_row['name'];
55
-    $b_xyz = "[" . $planet_row['galaxy'] . ":" . $planet_row['system'] . ":" . $planet_row['planet'] . "]";
56
-    $b_lvl = ($user['total_rank'] ? $user['total_rank'] : classSupernova::$config->users_amount) . "/" . classSupernova::$config->users_amount;
55
+    $b_xyz = "[".$planet_row['galaxy'].":".$planet_row['system'].":".$planet_row['planet']."]";
56
+    $b_lvl = ($user['total_rank'] ? $user['total_rank'] : classSupernova::$config->users_amount)."/".classSupernova::$config->users_amount;
57 57
   } else {
58 58
     $b_user = classLocale::$lang['ov_banner_empty_id'];
59 59
     $b_lvl = '';
@@ -88,11 +88,11 @@  discard block
 block discarded – undo
88 88
         imagettftext($image, 9, 0, 410 - $is[2], 35, $txt_color, $fonts['info'], $b_ally);
89 89
 
90 90
         // Player b_planet
91
-        imagettftext($image, 6, 0, 8, 10, $txt_shadow2, $fonts['raids'], $b_planet . " " . $b_xyz);
92
-        imagettftext($image, 6, 0, 6, 9, $txt_color2, $fonts['raids'], $b_planet . " " . $b_xyz);
91
+        imagettftext($image, 6, 0, 8, 10, $txt_shadow2, $fonts['raids'], $b_planet." ".$b_xyz);
92
+        imagettftext($image, 6, 0, 6, 9, $txt_color2, $fonts['raids'], $b_planet." ".$b_xyz);
93 93
 
94 94
         //StatPoint
95
-        $b_points = classLocale::$lang['ov_points'] . ": " . pretty_number(!empty($user['total_points']) ? $user['total_points'] : 0);
95
+        $b_points = classLocale::$lang['ov_points'].": ".pretty_number(!empty($user['total_points']) ? $user['total_points'] : 0);
96 96
         $is = imagettfbbox(8, 0, $fonts['info'], $b_points);
97 97
         imagettftext($image, 8, 0, 412 - $is[2], 11, $txt_shadow, $fonts['info'], $b_points);
98 98
         imagettftext($image, 8, 0, 410 - $is[2], 9, $txt_color, $fonts['info'], $b_points);
@@ -100,21 +100,21 @@  discard block
 block discarded – undo
100 100
         //Raids Total
101 101
         imagettftext($image, 6, 0, 8, 37, $txt_shadow2, $fonts['raids'], classLocale::$lang['NumberOfRaids']);
102 102
         imagettftext($image, 6, 0, 6, 35, $txt_color2, $fonts['raids'], classLocale::$lang['NumberOfRaids']);
103
-        $b_points = ": " . pretty_number(!empty($user['raids']) ? $user['raids'] : 0);
103
+        $b_points = ": ".pretty_number(!empty($user['raids']) ? $user['raids'] : 0);
104 104
         imagettftext($image, 6, 0, 61, 37, $txt_shadow2, $fonts['raids'], $b_points);
105 105
         imagettftext($image, 6, 0, 59, 35, $txt_color2, $fonts['raids'], $b_points);
106 106
 
107 107
         //Raids Won
108 108
         imagettftext($image, 6, 0, 8, 47, $txt_shadow2, $fonts['raids'], classLocale::$lang['RaidsWin']);
109 109
         imagettftext($image, 6, 0, 6, 45, $txt_color2, $fonts['raids'], classLocale::$lang['RaidsWin']);
110
-        $b_points = ": " . pretty_number(!empty($user['raidswin']) ? $user['raidswin'] : 0);
110
+        $b_points = ": ".pretty_number(!empty($user['raidswin']) ? $user['raidswin'] : 0);
111 111
         imagettftext($image, 6, 0, 61, 47, $txt_shadow2, $fonts['raids'], $b_points);
112 112
         imagettftext($image, 6, 0, 59, 45, $txt_color2, $fonts['raids'], $b_points);
113 113
 
114 114
         //Raids Lost
115 115
         imagettftext($image, 6, 0, 8, 57, $txt_shadow2, $fonts['raids'], classLocale::$lang['RaidsLoose']);
116 116
         imagettftext($image, 6, 0, 6, 55, $txt_color2, $fonts['raids'], classLocale::$lang['RaidsLoose']);
117
-        $b_points = ": " . pretty_number(!empty($user['raidsloose']) ? $user['raidsloose'] : 0);
117
+        $b_points = ": ".pretty_number(!empty($user['raidsloose']) ? $user['raidsloose'] : 0);
118 118
         imagettftext($image, 6, 0, 61, 57, $txt_shadow2, $fonts['raids'], $b_points);
119 119
         imagettftext($image, 6, 0, 59, 55, $txt_color2, $fonts['raids'], $b_points);
120 120
       }
Please login to merge, or discard this patch.
includes/includes/eco_bld_structures.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
     }
69 69
     $build_unit_list = sn_get_groups('tech');
70 70
     $artifact_id = ART_HEURISTIC_CHIP;
71
-    $page_header = classLocale::$lang['tech'][UNIT_TECHNOLOGIES] . ($user['user_as_ally'] ? " {$classLocale['sys_of_ally']} {$user['username']}" : '');
71
+    $page_header = classLocale::$lang['tech'][UNIT_TECHNOLOGIES].($user['user_as_ally'] ? " {$classLocale['sys_of_ally']} {$user['username']}" : '');
72 72
   } elseif ($que_type == QUE_MERCENARY) {
73 73
     $build_unit_list = sn_get_groups('mercenaries');
74 74
     $artifact_id = 0;
75
-    $page_header = classLocale::$lang['tech'][UNIT_MERCENARIES] . ($user['user_as_ally'] ? " {$classLocale['sys_of_ally']} {$user['username']}" : '');
75
+    $page_header = classLocale::$lang['tech'][UNIT_MERCENARIES].($user['user_as_ally'] ? " {$classLocale['sys_of_ally']} {$user['username']}" : '');
76 76
   } else {
77 77
     if (mrc_get_level($user, $planet, STRUC_FACTORY_HANGAR) == 0) {
78 78
       message(classLocale::$lang['need_hangar'], classLocale::$lang['tech'][STRUC_FACTORY_HANGAR]);
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
               * ($resource_id == RES_ENERGY ? $config_resource_multiplier_plain : $config_resource_multiplier)
246 246
               * (isset($density_info[$resource_id]) ? $density_info[$resource_id] : 1)))
247 247
           ) {
248
-            $level_production_base['R' . $resource_id] = $resource_income;
248
+            $level_production_base['R'.$resource_id] = $resource_income;
249 249
           }
250 250
         }
251 251
       }
@@ -272,8 +272,8 @@  discard block
 block discarded – undo
272 272
             * ($resource_id == RES_ENERGY ? $config_resource_multiplier_plain : $config_resource_multiplier)
273 273
             * (isset($density_info[$resource_id]) ? $density_info[$resource_id] : 1)))
274 274
           ) {
275
-            $level_production['R' . $resource_id] = $resource_income;
276
-            $level_production['D' . $resource_id] = $resource_income - $level_production_base[$resource_id];
275
+            $level_production['R'.$resource_id] = $resource_income;
276
+            $level_production['D'.$resource_id] = $resource_income - $level_production_base[$resource_id];
277 277
           }
278 278
         }
279 279
         $production['.']['resource'][] = $level_production;
@@ -288,15 +288,15 @@  discard block
 block discarded – undo
288 288
       $level_start = $level_base_and_que > 1 ? $level_effective + $level_in_que - 1 : 1;
289 289
       for ($i = 0; $i < 6; $i++) {
290 290
         $level_production = array('LEVEL' => $level_start + $i);
291
-        $level_production['R' . UNIT_PLAYER_EXPEDITIONS_MAX] = get_player_max_expeditons($user, $level_start + $i);
292
-        $level_production['D' . UNIT_PLAYER_EXPEDITIONS_MAX] = $level_production['R' . UNIT_PLAYER_EXPEDITIONS_MAX] - $level_production_base[UNIT_PLAYER_EXPEDITIONS_MAX];
293
-        $level_production['R' . UNIT_PLAYER_COLONIES_MAX] = get_player_max_colonies($user, $level_start + $i);
294
-        $level_production['D' . UNIT_PLAYER_COLONIES_MAX] = $level_production['R' . UNIT_PLAYER_COLONIES_MAX] - $level_production_base[UNIT_PLAYER_COLONIES_MAX];
291
+        $level_production['R'.UNIT_PLAYER_EXPEDITIONS_MAX] = get_player_max_expeditons($user, $level_start + $i);
292
+        $level_production['D'.UNIT_PLAYER_EXPEDITIONS_MAX] = $level_production['R'.UNIT_PLAYER_EXPEDITIONS_MAX] - $level_production_base[UNIT_PLAYER_EXPEDITIONS_MAX];
293
+        $level_production['R'.UNIT_PLAYER_COLONIES_MAX] = get_player_max_colonies($user, $level_start + $i);
294
+        $level_production['D'.UNIT_PLAYER_COLONIES_MAX] = $level_production['R'.UNIT_PLAYER_COLONIES_MAX] - $level_production_base[UNIT_PLAYER_COLONIES_MAX];
295 295
         $production['.']['resource'][] = $level_production;
296 296
 
297 297
         $level_production_base = array(
298
-          UNIT_PLAYER_EXPEDITIONS_MAX => $level_production['R' . UNIT_PLAYER_EXPEDITIONS_MAX],
299
-          UNIT_PLAYER_COLONIES_MAX    => $level_production['R' . UNIT_PLAYER_COLONIES_MAX],
298
+          UNIT_PLAYER_EXPEDITIONS_MAX => $level_production['R'.UNIT_PLAYER_EXPEDITIONS_MAX],
299
+          UNIT_PLAYER_COLONIES_MAX    => $level_production['R'.UNIT_PLAYER_COLONIES_MAX],
300 300
         );
301 301
       }
302 302
     }
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 2 patches
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.
Doc Comments   +7 added lines, -1 removed lines patch added patch discarded remove patch
@@ -134,7 +134,6 @@  discard block
 block discarded – undo
134 134
   /**
135 135
    * Попытка залогиниться с использованием метода $method
136 136
    *
137
-   * @param string $method_name
138 137
    */
139 138
   public function login() {
140 139
     // TODO Проверяем поддерживаемость метода
@@ -162,6 +161,10 @@  discard block
 block discarded – undo
162 161
    * @return array|bool|resource
163 162
    */
164 163
   // OK v4.5
164
+
165
+  /**
166
+   * @param string $salt_unsafe
167
+   */
165 168
   public function password_change($old_password_unsafe, $new_password_unsafe, $salt_unsafe = null) {
166 169
     $result = parent::password_change($old_password_unsafe, $new_password_unsafe, $salt_unsafe);
167 170
     if($result) {
@@ -171,6 +174,9 @@  discard block
 block discarded – undo
171 174
     return $result;
172 175
   }
173 176
 
177
+  /**
178
+   * @param Account $account_to_impersonate
179
+   */
174 180
   public function impersonate($account_to_impersonate) {
175 181
     $this->cookie_set($account_to_impersonate);
176 182
   }
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.
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/alliance/ali_internal_members.inc 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -2,31 +2,31 @@  discard block
 block discarded – undo
2 2
 
3 3
 $classLocale = classLocale::$lang;
4 4
 
5
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
5
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
6 6
   classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
7 7
 }
8 8
 
9 9
 // Changing rank for single user
10 10
 $id_user = sys_get_param_id('id_user');
11
-if(isset($_GET['id_rank'])) {
11
+if (isset($_GET['id_rank'])) {
12 12
   $id_rank = sys_get_param_int('id_rank');
13 13
 }
14
-if($id_user && isset($id_rank) && $user_admin) {
14
+if ($id_user && isset($id_rank) && $user_admin) {
15 15
   DBStaticUser::db_user_set_by_id($id_user, "`ally_rank_id` = {$id_rank}");
16 16
 }
17 17
 
18 18
 $id_kick = sys_get_param_id('kick');
19 19
 
20
-if($id_kick && $user_can_kick) {
20
+if ($id_kick && $user_can_kick) {
21 21
   $u = DBStaticUser::db_user_by_id($id_kick, true);
22
-  if($u['ally_id'] == $ally['id'] && $u['id'] != $ally['ally_owner']) {
22
+  if ($u['ally_id'] == $ally['id'] && $u['id'] != $ally['ally_owner']) {
23 23
     DBStaticUser::db_user_set_by_id($id_kick, '`ally_id`= null, `ally_name` = null, `ally_tag` = null, ally_register_time = 0, ally_rank_id = 0');
24 24
     db_ally_update_member_decrease($ally);
25 25
   }
26 26
 }
27 27
 
28 28
 $sort2 = sys_get_param_int('sort2');
29
-if($sort2) {
29
+if ($sort2) {
30 30
   $sort2s = "DESC";
31 31
   $sort2 = 0;
32 32
 } else {
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 }
36 36
 
37 37
 $sort1 = sys_get_param_int('sort1');
38
-if($sort1 > 5 || $sort1 < 0) {
38
+if ($sort1 > 5 || $sort1 < 0) {
39 39
   $sort1 = 0;
40 40
 }
41 41
 $sort1s = array(
@@ -49,28 +49,28 @@  discard block
 block discarded – undo
49 49
 
50 50
 $template = gettemplate('ali_members', true);
51 51
 
52
-$userList = DBStaticUser::db_user_list("`ally_id`= {$user['ally_id']} ORDER BY " . sprintf($sort1s[$sort1], $sort2s), false,
52
+$userList = DBStaticUser::db_user_list("`ally_id`= {$user['ally_id']} ORDER BY ".sprintf($sort1s[$sort1], $sort2s), false,
53 53
   'id, username, galaxy, system, planet, onlinetime, ally_rank_id, ally_register_time, total_points');
54 54
 
55 55
 // while ($userRow = db_fetch($userList))
56
-foreach($userList as $userRow) {
56
+foreach ($userList as $userRow) {
57 57
   $i++;
58
-  if(!isset($ranks[$userRow['ally_rank_id']])) {
58
+  if (!isset($ranks[$userRow['ally_rank_id']])) {
59 59
     $userRow['ally_rank_id'] = 0;
60 60
   }
61 61
 
62
-  if($ally['ally_owner'] == $userRow['id']) {
62
+  if ($ally['ally_owner'] == $userRow['id']) {
63 63
     $ally_range = ($ally['ally_owner_range']) ? $ally['ally_owner_range'] : classLocale::$lang['Founder'];
64 64
   } else {
65
-    if($user_admin) {
66
-      $ally_range = '<select onchange="window.location=\'alliance.php?mode=admin&edit=members&id_user=' . $userRow['id'] . '&id_rank=\' + this.value">';
65
+    if ($user_admin) {
66
+      $ally_range = '<select onchange="window.location=\'alliance.php?mode=admin&edit=members&id_user='.$userRow['id'].'&id_rank=\' + this.value">';
67 67
 
68
-      foreach($ranks as $rankID => $rankArray) {
69
-        $ally_range .= '<option value="' . $rankID . '"';
70
-        if($rankID == $userRow['ally_rank_id']) {
68
+      foreach ($ranks as $rankID => $rankArray) {
69
+        $ally_range .= '<option value="'.$rankID.'"';
70
+        if ($rankID == $userRow['ally_rank_id']) {
71 71
           $ally_range .= " selected";
72 72
         }
73
-        $ally_range .= '>' . $rankArray['name'];
73
+        $ally_range .= '>'.$rankArray['name'];
74 74
         $ally_range .= '</option>';
75 75
       }
76 76
       $ally_range .= '</select>';
@@ -80,20 +80,20 @@  discard block
 block discarded – undo
80 80
   }
81 81
 
82 82
   $last_active = time() - $userRow["onlinetime"];
83
-  if($user_admin) {
84
-    if($last_active < 60) {
83
+  if ($user_admin) {
84
+    if ($last_active < 60) {
85 85
       $tmp = "lime>{$classLocale['On']}";
86
-    } elseif($last_active < 60 * 60) {
86
+    } elseif ($last_active < 60 * 60) {
87 87
       $last_active = round($last_active / 60);
88 88
       $tmp = "lime>{$last_active} {$classLocale['sys_min_short']}";
89
-    } elseif($last_active < 60 * 60 * 24) {
89
+    } elseif ($last_active < 60 * 60 * 24) {
90 90
       $last_active = round($last_active / (60 * 60));
91 91
       $tmp = "green>{$last_active} {$classLocale['sys_hrs_short']}";
92 92
     } else {
93 93
       $last_active = round($last_active / (60 * 60 * 24));
94
-      if($last_active < 7) {
94
+      if ($last_active < 7) {
95 95
         $tmp = "yellow";
96
-      } elseif($last_active < 30) {
96
+      } elseif ($last_active < 30) {
97 97
         $tmp = "orange";
98 98
       } else {
99 99
         $tmp = "red";
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
       $tmp .= ">{$last_active} {$classLocale['sys_day_short']}";
102 102
     }
103 103
   } else {
104
-    if($user_onlinestatus) {
105
-      if($last_active < 60 * 5) {
104
+    if ($user_onlinestatus) {
105
+      if ($last_active < 60 * 5) {
106 106
         $tmp = "lime>{$classLocale['On']}";
107
-      } elseif($last_active < 60 * 15) {
107
+      } elseif ($last_active < 60 * 15) {
108 108
         $tmp = "yellow>{$classLocale['ali_lessThen15min']}";
109 109
       } else {
110 110
         $tmp = "red>{$classLocale['Off']}";
@@ -124,21 +124,21 @@  discard block
 block discarded – undo
124 124
     'SYSTEM'        => $userRow['system'],
125 125
     'PLANET'        => $userRow['planet'],
126 126
     'POINTS'        => pretty_number($userRow['total_points']),
127
-    'ONLINE'        => '<font color=' . $tmp . '</font>',
127
+    'ONLINE'        => '<font color='.$tmp.'</font>',
128 128
     'RANK'          => $ally_range,
129 129
     'REGISTER_TIME' => date(FMT_DATE_TIME, $userRow['ally_register_time']),
130 130
     'SHOW_KICK'     => $user['id'] != $userRow['id'] && $ally['ally_owner'] != $userRow['id'],
131 131
   ));
132 132
 }
133 133
 
134
-if($i != $ally['ally_members']) {
134
+if ($i != $ally['ally_members']) {
135 135
   db_ally_update_member_set($i, $ally);
136 136
 }
137 137
 
138 138
 $template->assign_vars(array(
139
-  'mode'          => $mode . ($edit ? "&edit=" . $edit : ''),
139
+  'mode'          => $mode.($edit ? "&edit=".$edit : ''),
140 140
   'ADMIN_MODE'    => $user_can_kick,
141
-  'dpath'         => SN_ROOT_VIRTUAL . $dpath,
141
+  'dpath'         => SN_ROOT_VIRTUAL.$dpath,
142 142
   'onlineMessage' => $user_admin ? classLocale::$lang['ali_sys_lastActive'] : classLocale::$lang['Online'],
143 143
   'memberCount'   => count($userList),
144 144
   'memberslist'   => $page_list,
Please login to merge, or discard this patch.
includes/includes/art_artifact.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
   $unit_level = $artifact_level_old = mrc_get_level($user, null, $unit_id, true);
14 14
   if ($unit_level > 0) {
15 15
     $db_changeset = array();
16
-    switch($unit_id) {
16
+    switch ($unit_id) {
17 17
       case ART_LHC:
18 18
       case ART_HOOK_SMALL:
19 19
       case ART_HOOK_MEDIUM:
@@ -133,6 +133,6 @@  discard block
 block discarded – undo
133 133
 
134 134
   sn_db_transaction_commit();
135 135
   message($message, "{$classLocale['tech'][UNIT_ARTIFACTS]} - {$classLocale['tech'][$unit_id]}",
136
-    ($request_uri = sys_get_param_str_unsafe('REQUEST_URI')) ? $request_uri : ('artifacts' . DOT_PHP_EX . '#' . $unit_id),
136
+    ($request_uri = sys_get_param_str_unsafe('REQUEST_URI')) ? $request_uri : ('artifacts'.DOT_PHP_EX.'#'.$unit_id),
137 137
     5);
138 138
 }
Please login to merge, or discard this patch.
includes/classes/DbSqlAware.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -45,8 +45,8 @@
 block discarded – undo
45 45
    */
46 46
   protected function quoteStringAsFieldByRef(&$string) {
47 47
     $string = $this->stringEscape($string);
48
-    if ((string)$string && '*' != $string) {
49
-      $string = '`' . $string . '`';
48
+    if ((string) $string && '*' != $string) {
49
+      $string = '`'.$string.'`';
50 50
     }
51 51
   }
52 52
 
Please login to merge, or discard this patch.