Completed
Push — trunk ( d06df9...f48ee3 )
by SuperNova.WS
11:23
created
jumpgate.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -17,39 +17,39 @@  discard block
 block discarded – undo
17 17
 
18 18
 lng_include('fleet');
19 19
 
20
-if($TargetPlanet = sys_get_param_id('jmpto'))
20
+if ($TargetPlanet = sys_get_param_id('jmpto'))
21 21
 {
22 22
   sn_db_transaction_start();
23 23
   db_user_by_id($user['id'], true, 'id');
24 24
   $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true);
25
-  if(!($NextJumpTime = uni_get_time_to_jump($planetrow)))
25
+  if (!($NextJumpTime = uni_get_time_to_jump($planetrow)))
26 26
   {
27 27
     $TargetGate = DBStaticPlanet::db_planet_by_id($TargetPlanet, true, '`id`, `last_jump_time`');
28
-    if(mrc_get_level($user, $TargetGate, STRUC_MOON_GATE) > 0)
28
+    if (mrc_get_level($user, $TargetGate, STRUC_MOON_GATE) > 0)
29 29
     {
30
-      $NextDestTime = uni_get_time_to_jump ( $TargetGate );
31
-      if(!$NextDestTime)
30
+      $NextDestTime = uni_get_time_to_jump($TargetGate);
31
+      if (!$NextDestTime)
32 32
       {
33 33
         // $SubQueryOri = "";
34 34
         // $SubQueryDes = "";
35 35
         $ship_list = sys_get_param('ships');
36 36
         $db_changeset = array();
37
-        foreach($ship_list as $ship_id => $ship_count)
37
+        foreach ($ship_list as $ship_id => $ship_count)
38 38
         {
39
-          if(!in_array($ship_id, sn_get_groups('fleet')))
39
+          if (!in_array($ship_id, sn_get_groups('fleet')))
40 40
           {
41 41
             continue;
42 42
           }
43 43
 
44 44
           $ship_count = max(0, min(floor($ship_count), mrc_get_level($user, $planetrow, $ship_id)));
45
-          if($ship_count)
45
+          if ($ship_count)
46 46
           {
47 47
             $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($ship_id, -$ship_count, $user, $planetrow['id']);
48 48
             $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($ship_id, $ship_count, $user, $TargetGate['id']);
49 49
           }
50 50
         }
51 51
         // Dit monsieur, y avait quelque chose a envoyer ???
52
-        if(!empty($db_changeset))
52
+        if (!empty($db_changeset))
53 53
         {
54 54
           DBStaticPlanet::db_planet_set_by_id($TargetGate['id'], "`last_jump_time` = " . SN_TIME_NOW . "");
55 55
           DBStaticPlanet::db_planet_set_by_id($planetrow['id'], "`last_jump_time` = " . SN_TIME_NOW . "");
@@ -58,31 +58,31 @@  discard block
 block discarded – undo
58 58
           db_user_set_by_id($user['id'], "`current_planet` = '{$TargetGate['id']}'");
59 59
 
60 60
           $planetrow['last_jump_time'] = SN_TIME_NOW;
61
-          $RetMessage = $lang['gate_jump_done'] ." - ". pretty_time(uni_get_time_to_jump($planetrow));
61
+          $RetMessage = $lang['gate_jump_done'] . " - " . pretty_time(uni_get_time_to_jump($planetrow));
62 62
         } else {
63 63
           $RetMessage = $lang['gate_wait_data'];
64 64
         }
65 65
       } else {
66
-        $RetMessage = $lang['gate_wait_dest'] ." - ". pretty_time($NextDestTime);
66
+        $RetMessage = $lang['gate_wait_dest'] . " - " . pretty_time($NextDestTime);
67 67
       }
68 68
     } else {
69 69
       $RetMessage = $lang['gate_no_dest_g'];
70 70
     }
71 71
   } else {
72
-    $RetMessage = $lang['gate_wait_star'] ." - ". pretty_time($NextJumpTime);
72
+    $RetMessage = $lang['gate_wait_star'] . " - " . pretty_time($NextJumpTime);
73 73
   }
74 74
   sn_db_transaction_commit();
75 75
   SnTemplate::messageBox($RetMessage, $lang['tech'][STRUC_MOON_GATE], "jumpgate.php", 10);
76 76
 } else {
77 77
   $template = SnTemplate::gettemplate('jumpgate', true);
78
-  if(mrc_get_level($user, $planetrow, STRUC_MOON_GATE) > 0)
78
+  if (mrc_get_level($user, $planetrow, STRUC_MOON_GATE) > 0)
79 79
   {
80 80
     $Combo = '';
81 81
     $MoonList = DBStaticPlanet::db_planet_list_moon_other($user['id'], $planetrow['id']);
82 82
     // while($CurMoon = db_fetch($MoonList))
83
-    foreach($MoonList as $CurMoon)
83
+    foreach ($MoonList as $CurMoon)
84 84
     {
85
-      if(mrc_get_level($user, $CurMoon, STRUC_MOON_GATE) >= 1)
85
+      if (mrc_get_level($user, $CurMoon, STRUC_MOON_GATE) >= 1)
86 86
       {
87 87
         $NextJumpTime = uni_get_time_to_jump($CurMoon);
88 88
         $template->assign_block_vars('moon', array(
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
       }
97 97
     }
98 98
 
99
-    foreach(sn_get_groups('fleet') as $Ship)
99
+    foreach (sn_get_groups('fleet') as $Ship)
100 100
     {
101
-      if(($ship_count = mrc_get_level($user, $planetrow, $Ship)) <= 0)
101
+      if (($ship_count = mrc_get_level($user, $planetrow, $Ship)) <= 0)
102 102
       {
103 103
         continue;
104 104
       }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -118,8 +118,7 @@
 block discarded – undo
118 118
     ));
119 119
 
120 120
     SnTemplate::display($template, $lang['tech'][STRUC_MOON_GATE]);
121
-  }
122
-  else
121
+  } else
123 122
   {
124 123
     SnTemplate::messageBox($lang['gate_no_src_ga'], $lang['tech'][STRUC_MOON_GATE], "overview.php", 10);
125 124
   }
Please login to merge, or discard this patch.
notes.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -15,34 +15,34 @@  discard block
 block discarded – undo
15 15
 $template = SnTemplate::gettemplate('notes', true);
16 16
 
17 17
 $result = array();
18
-if(($result_message = sys_get_param_str('MESSAGE')) && isset($lang[$result_message])) {
18
+if (($result_message = sys_get_param_str('MESSAGE')) && isset($lang[$result_message])) {
19 19
   $result[] = array('STATUS' => sys_get_param_int('STATUS'), 'MESSAGE' => $lang[$result_message]);
20 20
 }
21 21
 
22 22
 $note_id_edit = sys_get_param_id('note_id_edit');
23
-if(sys_get_param('note_delete')) {
23
+if (sys_get_param('note_delete')) {
24 24
   try {
25 25
     $not = '';
26 26
     $query_where = '';
27
-    switch(sys_get_param_str('note_delete_range')) {
27
+    switch (sys_get_param_str('note_delete_range')) {
28 28
       case 'all':
29 29
       break;
30 30
 
31 31
       case 'marked_not':
32 32
         $not = 'NOT';
33 33
       case 'marked':
34
-        if(!is_array($notes_marked = sys_get_param('note'))) {
34
+        if (!is_array($notes_marked = sys_get_param('note'))) {
35 35
           throw new exception('note_err_none_selected', ERR_WARNING);
36 36
         }
37 37
 
38 38
         $notes_marked_filtered = array();
39
-        foreach($notes_marked as $note_id => $note_select) {
40
-          if($note_select == 'on' && $note_id = idval($note_id)) {
39
+        foreach ($notes_marked as $note_id => $note_select) {
40
+          if ($note_select == 'on' && $note_id = idval($note_id)) {
41 41
             $notes_marked_filtered[] = $note_id;
42 42
           }
43 43
         }
44 44
 
45
-        if(empty($notes_marked_filtered)) {
45
+        if (empty($notes_marked_filtered)) {
46 46
           throw new exception('note_err_none_selected', ERR_WARNING);
47 47
         }
48 48
 
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
     doquery("DELETE FROM {{notes}} WHERE `owner` = {$user['id']} {$query_where};");
60 60
     sn_db_transaction_commit();
61 61
     throw new exception($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added', ERR_NONE);
62
-  } catch(exception $e) {
62
+  } catch (exception $e) {
63 63
     $note_id_edit = 0;
64 64
     sn_db_transaction_rollback();
65 65
     $result[] = array(
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
       'MESSAGE' => $lang[$e->getMessage()],
68 68
     );
69 69
   }
70
-} elseif(($note_title = sys_get_param_str('note_title')) || ($note_text = sys_get_param_str('note_text'))) {
70
+} elseif (($note_title = sys_get_param_str('note_title')) || ($note_text = sys_get_param_str('note_text'))) {
71 71
   $note_title == db_escape($lang['note_new_title']) ? $note_title = '' : false;
72 72
   ($note_text = sys_get_param_str('note_text')) == db_escape($lang['note_new_text']) ? $note_text = '' : false;
73 73
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     $note_system = max(0, min(sys_get_param_id('note_system'), SN::$config->game_maxSystem));
77 77
     $note_planet = max(0, min(sys_get_param_id('note_planet'), SN::$config->game_maxPlanet + 1));
78 78
 
79
-    if(!$note_text && !$note_title && !$note_galaxy && !$note_system && !$note_planet) {
79
+    if (!$note_text && !$note_title && !$note_galaxy && !$note_system && !$note_planet) {
80 80
       throw new exception('note_err_note_empty', ERR_WARNING);
81 81
     }
82 82
 
@@ -85,15 +85,15 @@  discard block
 block discarded – undo
85 85
     $note_sticky = intval(sys_get_param_id('note_sticky')) ? 1 : 0;
86 86
 
87 87
     sn_db_transaction_start();
88
-    if($note_id_edit) {
88
+    if ($note_id_edit) {
89 89
       $check_note_id = doquery("SELECT `id`, `owner` FROM {{notes}} WHERE `id` = {$note_id_edit} LIMIT 1 FOR UPDATE", true);
90
-      if(!$check_note_id) {
90
+      if (!$check_note_id) {
91 91
         throw new exception('note_err_note_not_found', ERR_ERROR);
92 92
       }
93 93
     }
94 94
 
95
-    if($note_id_edit) {
96
-      if($check_note_id['owner'] != $user['id']) {
95
+    if ($note_id_edit) {
96
+      if ($check_note_id['owner'] != $user['id']) {
97 97
         throw new exception('note_err_owner_wrong', ERR_ERROR);
98 98
       }
99 99
 
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
     sn_db_transaction_commit();
109 109
     sys_redirect('notes.php?STATUS=' . ERR_NONE . '&MESSAGE=' . ($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added'));
110 110
 //    throw new exception($note_id_edit ? 'note_err_none_changed' : 'note_err_none_added', ERR_NONE);
111
-  } catch(exception $e) {
111
+  } catch (exception $e) {
112 112
     $note_id_edit = 0;
113 113
     sn_db_transaction_rollback();
114 114
     $result[] = array(
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
   }
119 119
 }
120 120
 
121
-if(!$note_id_edit) {
121
+if (!$note_id_edit) {
122 122
   \Note\Note::note_assign($template, array(
123 123
     'id' => 0,
124 124
     'time' => SN_TIME_NOW,
@@ -131,13 +131,13 @@  discard block
 block discarded – undo
131 131
 
132 132
 $note_exist = false;
133 133
 $notes_query = doquery("SELECT * FROM {{notes}} WHERE owner={$user['id']} ORDER BY priority DESC, galaxy ASC, system ASC, planet ASC, planet_type ASC, `time` DESC");
134
-while($note_row = db_fetch($notes_query)) {
134
+while ($note_row = db_fetch($notes_query)) {
135 135
   \Note\Note::note_assign($template, $note_row);
136 136
   $note_exist = $note_exist || $note_row['id'] == $note_id_edit;
137 137
 }
138 138
 $note_id_edit = $note_exist ? $note_id_edit : 0;
139 139
 
140
-foreach($note_priority_classes as $note_priority_id => $note_priority_class) {
140
+foreach ($note_priority_classes as $note_priority_id => $note_priority_class) {
141 141
   $template->assign_block_vars('note_priority', array(
142 142
     'ID' => $note_priority_id,
143 143
     'CLASS' => $note_priority_classes[$note_priority_id],
@@ -145,14 +145,14 @@  discard block
 block discarded – undo
145 145
   ));
146 146
 }
147 147
 
148
-foreach($lang['sys_planet_type'] as $planet_type_id => $planet_type_string) {
148
+foreach ($lang['sys_planet_type'] as $planet_type_id => $planet_type_string) {
149 149
   $template->assign_block_vars('planet_type', array(
150 150
     'ID' => $planet_type_id,
151 151
     'TEXT' => $planet_type_string,
152 152
   ));
153 153
 }
154 154
 
155
-foreach($result as $result_data) {
155
+foreach ($result as $result_data) {
156 156
   $template->assign_block_vars('result', $result_data);
157 157
 }
158 158
 
Please login to merge, or discard this patch.
includes/update.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
       }
238 238
     }
239 239
 
240
-    $updater->upd_alter_table('users', ["DROP COLUMN `dpath`",], $updater->isFieldExists('users', 'dpath'));
240
+    $updater->upd_alter_table('users', ["DROP COLUMN `dpath`", ], $updater->isFieldExists('users', 'dpath'));
241 241
 
242 242
     // 2017-06-12 13:47:36 42c1
243 243
     $updater->new_version = 42;
@@ -250,14 +250,14 @@  discard block
 block discarded – undo
250 250
 
251 251
     // 2017-10-11 09:51:49 43a4.3
252 252
     $updater->upd_alter_table('messages',
253
-      ["ADD COLUMN `message_json` tinyint(1) unsigned NOT NULL DEFAULT 0 AFTER `message_text`",],
253
+      ["ADD COLUMN `message_json` tinyint(1) unsigned NOT NULL DEFAULT 0 AFTER `message_text`", ],
254 254
       !$updater->isFieldExists('messages', 'message_json')
255 255
     );
256 256
 
257 257
 
258 258
     // 2017-10-17 09:49:24 43a6.0
259 259
     // Removing old index i_user_id
260
-    $updater->upd_alter_table('counter', ['DROP KEY `i_user_id`',], $updater->isIndexExists('counter', 'i_user_id'));
260
+    $updater->upd_alter_table('counter', ['DROP KEY `i_user_id`', ], $updater->isIndexExists('counter', 'i_user_id'));
261 261
     // Adding new index I_counter_user_id
262 262
     $updater->upd_alter_table('counter',
263 263
       [
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
       );
312 312
     }
313 313
 
314
-    $updater->updPatchApply(1, function () use ($updater) {
314
+    $updater->updPatchApply(1, function() use ($updater) {
315 315
       $q = $updater->upd_do_query("SELECT `messageid`, `user` FROM `{{chat}}`", true);
316 316
       while ($row = db_fetch($q)) {
317 317
         if (strpos($row['user'], 'a:') !== 0) {
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
     });
334 334
 
335 335
     // 2018-03-07 09:23:41 43a13.23 + 2018-03-07 12:00:47 43a13.24
336
-    $updater->updPatchApply(2, function () use ($updater) {
336
+    $updater->updPatchApply(2, function() use ($updater) {
337 337
       $updater->upd_alter_table('festival_gifts', [
338 338
         "ADD COLUMN `disclosure` tinyint(1) unsigned NOT NULL DEFAULT 0 AFTER `amount`",
339 339
         "ADD COLUMN `message` VARCHAR(4096) CHARSET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT '' AFTER `disclosure`",
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
     });
342 342
 
343 343
     // 2018-03-12 13:23:10 43a13.33
344
-    $updater->updPatchApply(3, function () use ($updater) {
344
+    $updater->updPatchApply(3, function() use ($updater) {
345 345
       $updater->upd_alter_table('player_options',
346 346
         [
347 347
           "MODIFY COLUMN `value` VARCHAR(16000) CHARSET utf8 COLLATE utf8_unicode_ci NOT NULL DEFAULT ''",
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
     });
352 352
 
353 353
     // 2018-03-24 21:31:51 43a16.16 - OiS
354
-    $updater->updPatchApply(4, function () use ($updater) {
354
+    $updater->updPatchApply(4, function() use ($updater) {
355 355
       if (!$updater->isTableExists('festival_ois_player')) {
356 356
         $updater->upd_create_table(
357 357
           'festival_ois_player',
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
     });
371 371
 
372 372
     // 2018-03-25 08:11:39 43a16.21
373
-    $updater->updPatchApply(5, function () use ($updater) {
373
+    $updater->updPatchApply(5, function() use ($updater) {
374 374
       $updater->upd_alter_table(
375 375
         'que',
376 376
         "ADD COLUMN `que_unit_one_time_raw` DECIMAL(20,5) NOT NULL DEFAULT 0",
@@ -387,7 +387,7 @@  discard block
 block discarded – undo
387 387
     $updater->upd_log_version_update();
388 388
 
389 389
     // 2018-12-21 14:00:41 44a5 Module "ad_promo_code" support
390
-    $updater->updPatchApply(6, function () use ($updater) {
390
+    $updater->updPatchApply(6, function() use ($updater) {
391 391
       if (!$updater->isTableExists('ad_promo_codes')) {
392 392
         $updater->upd_create_table(
393 393
           'ad_promo_codes',
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
     });
429 429
 
430 430
     // 2018-12-22 11:42:20 44a12
431
-    $updater->updPatchApply(7, function () use ($updater) {
431
+    $updater->updPatchApply(7, function() use ($updater) {
432 432
       // Creating table for HTTP query strings
433 433
       $updater->upd_create_table(
434 434
         'security_query_strings',
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
         // Adding unique index for all significant fields
514 514
         $updater->upd_alter_table('security_player_entry', [
515 515
           "ADD UNIQUE KEY `I_player_entry_unique` (`device_id`, `browser_id`, `user_ip`, `user_proxy`)",
516
-        ], ! $updater->isIndexExists('security_player_entry', 'I_player_entry_unique'));
516
+        ], !$updater->isIndexExists('security_player_entry', 'I_player_entry_unique'));
517 517
         // Filling `security_player_entry` from temp table
518 518
         $updater->upd_do_query(
519 519
           "INSERT IGNORE INTO `{{security_player_entry}}` (`device_id`, `browser_id`, `user_ip`, `user_proxy`, `first_visit`)
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
     $updater->upd_log_version_update();
576 576
 
577 577
     // 2019-08-15 00:10:48 45a8
578
-    $updater->updPatchApply(8, function () use ($updater) {
578
+    $updater->updPatchApply(8, function() use ($updater) {
579 579
       if (!$updater->isTableExists('player_ignore')) {
580 580
         $updater->upd_create_table(
581 581
           'player_ignore',
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
         $updater->upd_alter_table('payment', [
603 603
           'ADD COLUMN `payment_method_id` smallint DEFAULT NULL AFTER `payment_module_name`',
604 604
           'ADD KEY `I_payment_method_id` (`payment_method_id`)',
605
-        ], ! $updater->isFieldExists('payment', 'payment_method_id'));
605
+        ], !$updater->isFieldExists('payment', 'payment_method_id'));
606 606
 
607 607
 //      }
608 608
     }, PATCH_PRE_CHECK);
Please login to merge, or discard this patch.
includes/init.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
 use Player\playerTimeDiff;
7 7
 
8 8
 // Защита от двойного инита
9
-if(defined('INIT')) {
9
+if (defined('INIT')) {
10 10
   return;
11 11
 }
12 12
 
@@ -125,48 +125,48 @@  discard block
 block discarded – undo
125 125
 // Но нужно, пока у нас есть не MVC-страницы
126 126
 $sn_page_data = $sn_mvc['pages'][$sn_page_name];
127 127
 $sn_page_name_file = 'includes/pages/' . $sn_page_data['filename'] . DOT_PHP_EX;
128
-if($sn_page_name) {
128
+if ($sn_page_name) {
129 129
   // Merging page options to global option pull
130
-  if(is_array($sn_page_data['options'])) {
130
+  if (is_array($sn_page_data['options'])) {
131 131
     SN::$options = array_merge(SN::$options, $sn_page_data['options']);
132 132
   }
133 133
 
134
-  if(isset($sn_page_data) && file_exists($sn_page_name_file)) {
134
+  if (isset($sn_page_data) && file_exists($sn_page_name_file)) {
135 135
     require_once($sn_page_name_file);
136 136
   }
137 137
 }
138 138
 
139
-if((defined('IN_AJAX') && IN_AJAX === true) || (defined('IN_ADMIN') && IN_ADMIN === true) || (!empty(SN::$options[PAGE_OPTION_ADMIN]))) {
139
+if ((defined('IN_AJAX') && IN_AJAX === true) || (defined('IN_ADMIN') && IN_ADMIN === true) || (!empty(SN::$options[PAGE_OPTION_ADMIN]))) {
140 140
   SN::$options[PAGE_OPTION_FLEET_UPDATE_SKIP] = true;
141 141
 }
142 142
 
143 143
 
144 144
 // А теперь проверяем - поддерживают ли у нас загруженный код такую страницу
145 145
 // TODO - костыль, что бы работали старые модули. Убрать!
146
-if(is_array($sn_data['pages'])) {
146
+if (is_array($sn_data['pages'])) {
147 147
   $sn_mvc['pages'] = array_merge($sn_mvc['pages'], $sn_data['pages']);
148 148
 }
149
-if(!isset($sn_mvc['pages'][$sn_page_name])) {
149
+if (!isset($sn_mvc['pages'][$sn_page_name])) {
150 150
   $sn_page_name = '';
151 151
 }
152 152
 
153 153
 $lang->lng_switch(sys_get_param_str('lang'));
154 154
 
155 155
 
156
-if(SN::$config->server_updater_check_auto && SN::$config->server_updater_check_last + SN::$config->server_updater_check_period <= SN_TIME_NOW) {
156
+if (SN::$config->server_updater_check_auto && SN::$config->server_updater_check_last + SN::$config->server_updater_check_period <= SN_TIME_NOW) {
157 157
   VersionCheckerDeprecated::performCheckVersion();
158 158
 }
159 159
 
160
-if(SN::$config->user_birthday_gift && SN_TIME_NOW - SN::$config->user_birthday_celebrate > PERIOD_DAY) {
160
+if (SN::$config->user_birthday_gift && SN_TIME_NOW - SN::$config->user_birthday_celebrate > PERIOD_DAY) {
161 161
   require_once(SN_ROOT_PHYSICAL . 'includes/includes/user_birthday_celebrate.php');
162 162
   sn_user_birthday_celebrate();
163 163
 }
164 164
 
165
-if(!SN::$config->var_online_user_count || SN::$config->var_online_user_time + SN::$config->game_users_update_online < SN_TIME_NOW) {
165
+if (!SN::$config->var_online_user_count || SN::$config->var_online_user_time + SN::$config->game_users_update_online < SN_TIME_NOW) {
166 166
   dbUpdateUsersCount(db_user_count());
167 167
   dbUpdateUsersOnline(db_user_count(true));
168 168
   SN::$config->pass()->var_online_user_time = SN_TIME_NOW;
169
-  if(SN::$config->server_log_online) {
169
+  if (SN::$config->server_log_online) {
170 170
     /** @noinspection SqlResolve */
171 171
     doquery("INSERT IGNORE INTO `{{log_users_online}}` SET online_count = " . SN::$config->var_online_user_count . ";");
172 172
   }
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 
191 191
 $template_result[F_ACCOUNT_IS_AUTHORIZED] = $sys_user_logged_in = !empty($user) && isset($user['id']) && $user['id'];
192 192
 
193
-if(!empty($user['id'])) {
193
+if (!empty($user['id'])) {
194 194
   SN::$user_options->user_change($user['id']);
195 195
 }
196 196
 
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
         : false
204 204
       );
205 205
 
206
-if($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) {
206
+if ($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) {
207 207
   $prohibited_characters = array_map(function($value) {
208 208
     return "'" . htmlentities($value, ENT_QUOTES, 'UTF-8') . "'";
209 209
   }, str_split(LOGIN_REGISTER_CHARACTERS_PROHIBITED));
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 }
212 212
 
213 213
 
214
-if(defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) {
214
+if (defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) {
215 215
   pdump('Отключи отладку перед продакшном!');
216 216
 }
217 217
 
@@ -225,17 +225,17 @@  discard block
 block discarded – undo
225 225
 
226 226
 StatUpdateLauncher::unlock();
227 227
 
228
-if($template_result[F_GAME_DISABLE] = SN::$config->game_disable) {
228
+if ($template_result[F_GAME_DISABLE] = SN::$config->game_disable) {
229 229
   $template_result[F_GAME_DISABLE_REASON] = HelperString::nl2br(
230 230
     SN::$config->game_disable == GAME_DISABLE_REASON
231 231
       ? SN::$config->game_disable_reason
232 232
       : $lang['sys_game_disable_reason'][SN::$config->game_disable]
233 233
   );
234
-  if(defined('IN_API')) {
234
+  if (defined('IN_API')) {
235 235
     return;
236 236
   }
237 237
 
238
-  if(
238
+  if (
239 239
     ($user['authlevel'] < 1 || !(defined('IN_ADMIN') && IN_ADMIN))
240 240
     &&
241 241
     !(defined('INSTALL_MODE') && defined('LOGIN_LOGOUT'))
@@ -251,8 +251,8 @@  discard block
 block discarded – undo
251 251
 // TODO ban
252 252
 // TODO $skip_ban_check
253 253
 global $skip_ban_check;
254
-if($template_result[F_BANNED_STATUS] && !$skip_ban_check) {
255
-  if(defined('IN_API')) {
254
+if ($template_result[F_BANNED_STATUS] && !$skip_ban_check) {
255
+  if (defined('IN_API')) {
256 256
     return;
257 257
   }
258 258
 
@@ -266,10 +266,10 @@  discard block
 block discarded – undo
266 266
 $allow_anonymous = $allow_anonymous || (isset($sn_page_data['allow_anonymous']) && $sn_page_data['allow_anonymous']);
267 267
 
268 268
 
269
-if($sys_user_logged_in && INITIAL_PAGE == 'login') {
269
+if ($sys_user_logged_in && INITIAL_PAGE == 'login') {
270 270
   sys_redirect(SN_ROOT_VIRTUAL . 'overview.php');
271
-} elseif($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id'])
272
-} elseif(!$allow_anonymous && !$sys_user_logged_in) {
271
+} elseif ($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id'])
272
+} elseif (!$allow_anonymous && !$sys_user_logged_in) {
273 273
   sys_redirect(SN_ROOT_VIRTUAL . 'login.php');
274 274
 }
275 275
 
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
   'fleet_update_last',
289 289
   SN::$config->fleet_update_interval,
290 290
   // Promise
291
-  function () {SN::$gc->fleetDispatcher->dispatch();},
291
+  function() {SN::$gc->fleetDispatcher->dispatch(); },
292 292
   WATCHDOG_TIME_SQL,
293 293
   false
294 294
 );
Please login to merge, or discard this patch.
includes/pages/chat.php 2 patches
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
   $user_auth_level = isset($user['authlevel']) ? $user['authlevel'] : AUTH_LEVEL_ANONYMOUS;
15 15
 
16 16
   $mode = sys_get_param_int('mode');
17
-  switch($mode)
17
+  switch ($mode)
18 18
   {
19 19
     case CHAT_MODE_ALLY:
20 20
       $template_result['ALLY'] = intval($user['ally_id']);
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
   }
29 29
 
30 30
   $template_result['.']['smiles'] = array();
31
-  foreach(SN::$gc->design->getSmilesList() as $auth_level => $replaces) {
32
-    if($auth_level > $user_auth_level) {
31
+  foreach (SN::$gc->design->getSmilesList() as $auth_level => $replaces) {
32
+    if ($auth_level > $user_auth_level) {
33 33
       continue;
34 34
     }
35 35
 
36
-    foreach($replaces as $bbcode => $filename)
36
+    foreach ($replaces as $bbcode => $filename)
37 37
     {
38 38
       $template_result['.']['smiles'][] = array(
39 39
         'BBCODE' => $bbcode,
@@ -57,12 +57,12 @@  discard block
 block discarded – undo
57 57
 
58 58
   define('IN_AJAX', true);
59 59
 
60
-  if($config->getMode() != classCache::CACHER_NO_CACHE && $config->chat_timeout && SN_TIME_MICRO - $config->array_get('users', $user['id'], 'chat_last_activity') > $config->chat_timeout)
60
+  if ($config->getMode() != classCache::CACHER_NO_CACHE && $config->chat_timeout && SN_TIME_MICRO - $config->array_get('users', $user['id'], 'chat_last_activity') > $config->chat_timeout)
61 61
   {
62 62
     die();
63 63
   }
64 64
 
65
-  if(($message = sys_get_param_str('message')) && $user['username'])
65
+  if (($message = sys_get_param_str('message')) && $user['username'])
66 66
   {
67 67
     $ally_id = sys_get_param('ally') && $user['ally_id'] ? $user['ally_id'] : 0;
68 68
     $nick = db_escape(player_nick_compact(player_nick_render_current_to_array($user, array('color' => true, 'icons' => true, 'ally' => !$ally_id))));
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
   define('IN_AJAX', true);
90 90
 
91 91
   $history = sys_get_param_str('history');
92
-  if(!$history)
92
+  if (!$history)
93 93
   {
94 94
     $config->array_set('users', $user['id'], 'chat_last_refresh', SN_TIME_MICRO);
95 95
   }
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
   $last_message = '';
99 99
   $alliance = 0;
100 100
   $template_result['.']['chat'] = array();
101
-  if(!$history && $config->getMode() != classCache::CACHER_NO_CACHE && $config->chat_timeout && SN_TIME_MICRO - $config->array_get('users', $user['id'], 'chat_last_activity') > $config->chat_timeout)
101
+  if (!$history && $config->getMode() != classCache::CACHER_NO_CACHE && $config->chat_timeout && SN_TIME_MICRO - $config->array_get('users', $user['id'], 'chat_last_activity') > $config->chat_timeout)
102 102
   {
103 103
     $result['disable'] = true;
104 104
     $template_result['.']['chat'][] = array(
@@ -114,12 +114,12 @@  discard block
 block discarded – undo
114 114
 
115 115
     $where_add = '';
116 116
     $last_message = 0;
117
-    if($history)
117
+    if ($history)
118 118
     {
119 119
       $rows = doquery("SELECT count(1) AS CNT FROM {{chat}} WHERE ally_id = '{$alliance}';", true);
120 120
       $page_count = ceil($rows['CNT'] / $page_limit);
121 121
 
122
-      for($i = 0; $i < $page_count; $i++)
122
+      for ($i = 0; $i < $page_count; $i++)
123 123
       {
124 124
         $template_result['.']['page'][] = array(
125 125
           'NUMBER' => $i
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
         {{chat}} AS c
142 142
         LEFT JOIN {{users}} AS u ON u.id = c.chat_message_sender_id
143 143
       WHERE c.chat_message_recipient_id IS NULL AND c.ally_id = '{$alliance}' {$where_add} ORDER BY messageid DESC LIMIT {$start_row}, {$page_limit};");
144
-    while($chat_row = db_fetch($query))
144
+    while ($chat_row = db_fetch($query))
145 145
     {
146 146
       // Little magik here - to retain HTML codes from DB and stripping HTML codes from nick
147 147
       $chat_row['user'] = player_nick_render_to_html($chat_row['user']);
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
   $template = SnTemplate::gettemplate('chat_messages', $template);
171 171
   $template->assign_recursive($template_result);
172 172
 
173
-  if($history)
173
+  if ($history)
174 174
   {
175 175
     $pageTitle = "{$lang['chat_history']} - {$lang[$alliance ? 'chat_ally' : 'chat_common']}";
176 176
     SnTemplate::display($template, $pageTitle);
Please login to merge, or discard this patch.
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -4,8 +4,7 @@  discard block
 block discarded – undo
4 4
  *
5 5
  */
6 6
 
7
-function sn_chat_model()
8
-{
7
+function sn_chat_model() {
9 8
   global $config, $user, $template_result, $lang;
10 9
 
11 10
   $config->array_set('users', $user['id'], 'chat_last_activity', SN_TIME_MICRO);
@@ -44,15 +43,13 @@  discard block
 block discarded – undo
44 43
 
45 44
   $template_result['PAGE_HEADER'] = $page_title;
46 45
 }
47
-function sn_chat_view($template = null)
48
-{
46
+function sn_chat_view($template = null) {
49 47
   $template = SnTemplate::gettemplate('chat_body', $template);
50 48
 
51 49
   return $template;
52 50
 }
53 51
 
54
-function sn_chat_add_model()
55
-{
52
+function sn_chat_add_model() {
56 53
   global $config, $user;
57 54
 
58 55
   define('IN_AJAX', true);
@@ -82,8 +79,7 @@  discard block
 block discarded – undo
82 79
 
83 80
   die();
84 81
 }
85
-function sn_chat_msg_view($template = null)
86
-{
82
+function sn_chat_msg_view($template = null) {
87 83
   global $config, $user, $lang;
88 84
 
89 85
   define('IN_AJAX', true);
@@ -105,8 +101,7 @@  discard block
 block discarded – undo
105 101
       'TIME' => date(FMT_DATE_TIME, htmlentities(SN_CLIENT_TIME_LOCAL, ENT_QUOTES, 'utf-8')),
106 102
       'DISABLE' => true,
107 103
     );
108
-  }
109
-  else
104
+  } else
110 105
   {
111 106
     $alliance = sys_get_param_str('ally') && $user['ally_id'] ? $user['ally_id'] : 0;
112 107
 
@@ -127,8 +122,7 @@  discard block
 block discarded – undo
127 122
       }
128 123
 
129 124
       $page = min($page_count, max(0, sys_get_param_int('sheet')));
130
-    }
131
-    else
125
+    } else
132 126
     {
133 127
       $last_message = sys_get_param_id('last_message');
134 128
       $where_add = $last_message ? "AND `messageid` > {$last_message}" : '';
@@ -174,8 +168,7 @@  discard block
 block discarded – undo
174 168
   {
175 169
     $pageTitle = "{$lang['chat_history']} - {$lang[$alliance ? 'chat_ally' : 'chat_common']}";
176 170
     SnTemplate::display($template, $pageTitle);
177
-  }
178
-  else
171
+  } else
179 172
   {
180 173
     $result['last_message'] = $last_message;
181 174
     $result['html'] = SnTemplate::templateRenderToHtml($template);
Please login to merge, or discard this patch.
includes/pages/imperator.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 //    $same_user = false;
48 48
 //  }
49 49
 
50
-  if(!$user_data) {
50
+  if (!$user_data) {
51 51
     SnTemplate::messageBox($lang['imp_imperator_none'], $lang['sys_error'], 'index.php', 10);
52 52
     die();
53 53
   }
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
   $stat_array = array();
59 59
   $query = doquery("SELECT * FROM {{statpoints}} WHERE `stat_type` = 1 AND `id_owner` = {$user_id} ORDER BY `stat_code` DESC;");
60 60
   $stat_count = SN::$db->db_affected_rows();
61
-  while($row = db_fetch($query)) {
62
-    foreach($stat_fields as $field_db_name => $field_template_name) {
61
+  while ($row = db_fetch($query)) {
62
+    foreach ($stat_fields as $field_db_name => $field_template_name) {
63 63
       // $stat_count - $row['stat_code'] - для реверсирования ID статы в JS
64 64
       $stat_array[$field_template_name]['DATA'][$stat_count - $row['stat_code']] = $row[$field_db_name];
65 65
     }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 
68 68
   $stat_array_date = $stat_array['STAT_DATE'];
69 69
   empty($stat_array_date['DATA']) ? $stat_array_date['DATA'] = array() : false;
70
-  foreach($stat_array_date['DATA'] as $key => $value) {
70
+  foreach ($stat_array_date['DATA'] as $key => $value) {
71 71
     $template->assign_block_vars('stat_date', array(
72 72
       'ID' => $key,
73 73
       'VALUE' => $value,
@@ -77,21 +77,21 @@  discard block
 block discarded – undo
77 77
 
78 78
   unset($stat_array['STAT_DATE']);
79 79
   $template_data = array();
80
-  foreach($stat_array as $stat_type => &$stat_type_data) {
80
+  foreach ($stat_array as $stat_type => &$stat_type_data) {
81 81
     $reverse_min_max = strpos($stat_type, '_RANK') !== false;
82 82
     $stat_type_data['MIN'] = $reverse_min_max ? max($stat_type_data['DATA']) : min($stat_type_data['DATA']);
83 83
     $stat_type_data['MAX'] = $reverse_min_max ? min($stat_type_data['DATA']) : max($stat_type_data['DATA']);
84 84
     $stat_type_data['AVG'] = avg($stat_type_data['DATA']);
85
-    foreach($stat_type_data['DATA'] as $key => $value) {
85
+    foreach ($stat_type_data['DATA'] as $key => $value) {
86 86
       $stat_type_data['PERCENT'][$key] = ($stat_type_data['MAX'] - $value ? ($value - $stat_type_data['MIN']) / ($stat_type_data['MAX'] - $stat_type_data['MIN']) : 1) * 100;
87 87
       $template_data[$stat_type][$key]['ID'] = $key;
88 88
       $template_data[$stat_type][$key]['VALUE'] = $value;
89
-      $template_data[$stat_type][$key]['DELTA'] = ($reverse_min_max ? $stat_type_data['MIN']  - $value : $value - $stat_type_data['MAX']);
89
+      $template_data[$stat_type][$key]['DELTA'] = ($reverse_min_max ? $stat_type_data['MIN'] - $value : $value - $stat_type_data['MAX']);
90 90
       $template_data[$stat_type][$key]['PERCENT'] = $stat_type_data['PERCENT'][$key];
91 91
     }
92 92
   }
93 93
 
94
-  foreach($template_data as $stat_type => $stat_type_data) {
94
+  foreach ($template_data as $stat_type => $stat_type_data) {
95 95
     $template->assign_block_vars('stat', array(
96 96
       'TYPE' => $stat_type,
97 97
       'TEXT' => $lang['imp_stat_types'][$stat_type],
@@ -99,13 +99,13 @@  discard block
 block discarded – undo
99 99
       'MAX' => $stat_array[$stat_type]['MAX'],
100 100
       'AVG' => $stat_array[$stat_type]['AVG'],
101 101
     ));
102
-    foreach($stat_type_data as $stat_entry) {
102
+    foreach ($stat_type_data as $stat_entry) {
103 103
       $template->assign_block_vars('stat.entry', $stat_entry);
104 104
     }
105 105
   }
106 106
 
107 107
 
108
-  if($same_user) {
108
+  if ($same_user) {
109 109
     rpg_level_up($user, RPG_STRUCTURE);
110 110
     rpg_level_up($user, RPG_RAID);
111 111
     rpg_level_up($user, RPG_TECH);
@@ -142,29 +142,29 @@  discard block
 block discarded – undo
142 142
     'builder_xp'           => HelperString::numberFloorAndFormat($user_data['xpminier']),
143 143
     'builder_lvl'          => HelperString::numberFloorAndFormat($user_data['lvl_minier']),
144 144
     'builder_lvl_st'       => HelperString::numberFloorAndFormat(rpg_get_miner_xp($user_data['lvl_minier'])),
145
-    'builder_lvl_up'       => HelperString::numberFloorAndFormat(rpg_get_miner_xp($user_data['lvl_minier']+1)),
145
+    'builder_lvl_up'       => HelperString::numberFloorAndFormat(rpg_get_miner_xp($user_data['lvl_minier'] + 1)),
146 146
     'raid_xp'              => HelperString::numberFloorAndFormat($user_data['xpraid']),
147 147
     'raid_lvl'             => HelperString::numberFloorAndFormat($user_data['lvl_raid']),
148
-    'raid_lvl_up'          => HelperString::numberFloorAndFormat(rpg_get_raider_xp($user_data['lvl_raid']+1)),
148
+    'raid_lvl_up'          => HelperString::numberFloorAndFormat(rpg_get_raider_xp($user_data['lvl_raid'] + 1)),
149 149
     'raids'                => HelperString::numberFloorAndFormat($user_data['raids']),
150 150
     'raidswin'             => HelperString::numberFloorAndFormat($user_data['raidswin']),
151 151
     'raidsloose'           => HelperString::numberFloorAndFormat($user_data['raidsloose']),
152 152
     'tech_xp'              => HelperString::numberFloorAndFormat($user_data['player_rpg_tech_xp']),
153 153
     'tech_lvl'             => HelperString::numberFloorAndFormat($user_data['player_rpg_tech_level']),
154 154
     'tech_lvl_st'          => HelperString::numberFloorAndFormat(rpg_get_tech_xp($user_data['player_rpg_tech_level'])),
155
-    'tech_lvl_up'          => HelperString::numberFloorAndFormat(rpg_get_tech_xp($user_data['player_rpg_tech_level']+1)),
155
+    'tech_lvl_up'          => HelperString::numberFloorAndFormat(rpg_get_tech_xp($user_data['player_rpg_tech_level'] + 1)),
156 156
 
157 157
     'explore_xp'           => HelperString::numberFloorAndFormat($user_data['player_rpg_explore_xp']),
158 158
     'explore_lvl'          => HelperString::numberFloorAndFormat($user_data['player_rpg_explore_level']),
159 159
     'explore_lvl_st'       => HelperString::numberFloorAndFormat(rpg_get_explore_xp($user_data['player_rpg_explore_level'])),
160
-    'explore_lvl_up'       => HelperString::numberFloorAndFormat(rpg_get_explore_xp($user_data['player_rpg_explore_level']+1)),
161
-
162
-    'build_points'         => HelperString::numberFloorAndFormat( $StatRecord['build_points'] ),
163
-    'tech_points'          => HelperString::numberFloorAndFormat( $StatRecord['tech_points'] ),
164
-    'fleet_points'         => HelperString::numberFloorAndFormat( $StatRecord['fleet_points'] ),
165
-    'defs_points'          => HelperString::numberFloorAndFormat( $StatRecord['defs_points'] ),
166
-    'res_points'           => HelperString::numberFloorAndFormat( $StatRecord['res_points'] ),
167
-    'total_points'         => HelperString::numberFloorAndFormat( $StatRecord['total_points'] ),
160
+    'explore_lvl_up'       => HelperString::numberFloorAndFormat(rpg_get_explore_xp($user_data['player_rpg_explore_level'] + 1)),
161
+
162
+    'build_points'         => HelperString::numberFloorAndFormat($StatRecord['build_points']),
163
+    'tech_points'          => HelperString::numberFloorAndFormat($StatRecord['tech_points']),
164
+    'fleet_points'         => HelperString::numberFloorAndFormat($StatRecord['fleet_points']),
165
+    'defs_points'          => HelperString::numberFloorAndFormat($StatRecord['defs_points']),
166
+    'res_points'           => HelperString::numberFloorAndFormat($StatRecord['res_points']),
167
+    'total_points'         => HelperString::numberFloorAndFormat($StatRecord['total_points']),
168 168
     'user_rank'            => $StatRecord['total_rank'],
169 169
     'RANK_DIFF'            => $StatRecord['total_old_rank'] - $StatRecord['total_rank'],
170 170
 
Please login to merge, or discard this patch.
includes/pages/battle_report.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
 
13 13
   $combat_data = sn_ube_report_load(sys_get_param_str('cypher'));
14 14
 
15
-  if($combat_data != UBE_REPORT_NOT_FOUND) {
15
+  if ($combat_data != UBE_REPORT_NOT_FOUND) {
16 16
     sn_ube_report_generate($combat_data, $template_result);
17 17
     $template = SnTemplate::gettemplate('ube_combat_report', $template);
18 18
     $template->assign_vars(array(
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin_rights.inc 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 global $lang, $debug;
4 4
 
5
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
5
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
6 6
 {
7 7
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
8 8
 }
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 if ($new_rank_name = sys_get_param_str('newRankName'))
17 17
 {
18
-  foreach($ally_rights as $fieldName)
18
+  foreach ($ally_rights as $fieldName)
19 19
   {
20 20
     $newRank[$fieldName] = 0;
21 21
   }
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 {
29 29
   unset($ranks);
30 30
 
31
-  foreach($rankListInput as $rankID => $rank)
31
+  foreach ($rankListInput as $rankID => $rank)
32 32
   {
33
-    foreach($ally_rights as $rightName)
33
+    foreach ($ally_rights as $rightName)
34 34
     {
35 35
       $ranks[$rankID][$rightName] = $rank[$rightName] ? 1 : 0;
36 36
     }
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 $d = sys_get_param_int('d');
42 42
 if ($d && isset($ranks[$d]))
43 43
 {
44
-  if(count($ranks) == 1)
44
+  if (count($ranks) == 1)
45 45
   {
46 46
     SnTemplate::messageBox($lang['ali_adm_lastRank'], $lang['ali_adm_rights_title']);
47 47
   }
@@ -53,16 +53,16 @@  discard block
 block discarded – undo
53 53
 
54 54
 if (count($ranks))
55 55
 {
56
-  foreach($ranks as $rankID => $rank)
56
+  foreach ($ranks as $rankID => $rank)
57 57
   {
58 58
     $rank_data = array(
59 59
       'ID'   => $rankID,
60 60
       'NAME' => $rank['name'],
61 61
     );
62 62
 
63
-    for($i = 1; $i < count($rank); $i++)
63
+    for ($i = 1; $i < count($rank); $i++)
64 64
     {
65
-      $rank_data['R' . $i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : '') ;
65
+      $rank_data['R' . $i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : '');
66 66
       $rank_data['N' . $i] = $ally_rights[$i];
67 67
     }
68 68
 
Please login to merge, or discard this patch.
includes/alliance/ali_external_create_ally.inc 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 // Pretty Safe
3 3
 // TODO: Add ally_tag to usertable
4 4
 
5
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
5
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true)
6 6
 {
7 7
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
8 8
 }
@@ -12,15 +12,15 @@  discard block
 block discarded – undo
12 12
 $ally_name_raw = sys_get_param_str_unsafe('name');
13 13
 $ally_name     = db_escape($ally_name_raw);
14 14
 
15
-if($ally_tag)
15
+if ($ally_tag)
16 16
 {
17
-  if(!$ally_name_raw || !$ally_tag_raw)
17
+  if (!$ally_name_raw || !$ally_tag_raw)
18 18
   {
19 19
     SnTemplate::messageBox($lang['have_not_name'], $lang['make_alliance']);
20 20
   }
21 21
 
22 22
   $query = doquery("SELECT ally_tag FROM {{alliance}} WHERE `ally_tag` = '{$ally_tag}' or `ally_name` = '{$ally_name}' LIMIT 1;", true);
23
-  if($query)
23
+  if ($query)
24 24
   {
25 25
     SnTemplate::messageBox(str_replace('%s', $query['ally_tag'] == $ally_tag_raw ? $ally_tag_raw : $ally_name_raw, $lang['always_exist']), $lang['make_alliance']);
26 26
   }
Please login to merge, or discard this patch.