Completed
Push — work-fleets ( 7f5906...04acf9 )
by SuperNova.WS
06:14
created
includes/classes/UBE/UBEDebris.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
    */
31 31
   public function debris_add_resource($resource_id, $resource_amount) {
32 32
     // В обломках может быть только металл или кристалл
33
-    if($resource_id != RES_METAL && $resource_id != RES_CRYSTAL) {
33
+    if ($resource_id != RES_METAL && $resource_id != RES_CRYSTAL) {
34 34
       return;
35 35
     }
36 36
     $this->debris[$resource_id] += $resource_amount;
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
    * @param bool  $is_simulator
42 42
    */
43 43
   public function add_wrecks(array $wreckage, $is_simulator) {
44
-    foreach($wreckage as $resource_id => $resource_amount) {
44
+    foreach ($wreckage as $resource_id => $resource_amount) {
45 45
       $this->debris_add_resource($resource_id, floor($resource_amount *
46 46
         ($is_simulator
47 47
           ? UBE_SHIP_WRECKS_TO_DEBRIS_AVG
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
    * @param bool  $is_simulator
58 58
    */
59 59
   public function add_cargo_drop(array $dropped_resources, $is_simulator) {
60
-    foreach($dropped_resources as $resource_id => $resource_amount) {
60
+    foreach ($dropped_resources as $resource_id => $resource_amount) {
61 61
       $this->debris_add_resource($resource_id, floor($resource_amount *
62 62
         ($is_simulator
63 63
           ? UBE_CARGO_DROPPED_TO_DEBRIS_AVG
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
    * @param $moon_debris_left_part
97 97
    */
98 98
   public function debris_adjust_proportional($moon_debris_left_part) {
99
-    foreach($this->debris as $resource_id => &$resource_amount) {
99
+    foreach ($this->debris as $resource_id => &$resource_amount) {
100 100
       $resource_amount = floor($resource_amount * $moon_debris_left_part);
101 101
     }
102 102
   }
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
    */
118 118
   public function report_generate_sql() {
119 119
     return "
120
-      `ube_report_debris_metal` = " . (float)$this->debris_get_resource(RES_METAL) . ",
121
-      `ube_report_debris_crystal` = " . (float)$this->debris_get_resource(RES_CRYSTAL) . ",
122
-      `ube_report_debris_total_in_metal` = " . (float)$this->debris_in_metal() . ", ";
120
+      `ube_report_debris_metal` = " . (float) $this->debris_get_resource(RES_METAL).",
121
+      `ube_report_debris_crystal` = " . (float) $this->debris_get_resource(RES_CRYSTAL).",
122
+      `ube_report_debris_total_in_metal` = " . (float) $this->debris_in_metal().", ";
123 123
   }
124 124
 
125 125
   /**
Please login to merge, or discard this patch.
includes/classes/UBE/UBEDebug.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
    * @version 41a6.49
12 12
    */
13 13
   public static function unit_dump_header() {
14
-    if(!defined('DEBUG_UBE')) {
14
+    if (!defined('DEBUG_UBE')) {
15 15
       return;
16 16
     }
17 17
 
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
    * @version 41a6.49
49 49
    */
50 50
   public static function unit_dump(UBEUnit $unit, $desc = '', UBEUnit $before = null) {
51
-    if(!defined('DEBUG_UBE')) {
51
+    if (!defined('DEBUG_UBE')) {
52 52
       return;
53 53
     }
54 54
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 //  print("<td>" . $this->units_lost . "</td>");
76 76
 //  print("<td>" . $this->units_restored . "</td>");
77 77
 //  print("<td>" . $this->capacity . "</td>");
78
-    print("<td>" . round($unit->share_of_side_armor, 4) . "</td>");
78
+    print("<td>".round($unit->share_of_side_armor, 4)."</td>");
79 79
     print('</tr>');
80 80
   }
81 81
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
    * @version 41a6.49
87 87
    */
88 88
   public static function unit_dump_footer() {
89
-    if(!defined('DEBUG_UBE')) {
89
+    if (!defined('DEBUG_UBE')) {
90 90
       return;
91 91
     }
92 92
 
@@ -101,16 +101,16 @@  discard block
 block discarded – undo
101 101
    * @return UBEUnit
102 102
    */
103 103
   public static function unit_dump_defender(UBEUnit $attacking_unit_pool, UBEUnit $defending_unit_pool, $defending_fleet_id) {
104
-    if(!defined('DEBUG_UBE')) {
104
+    if (!defined('DEBUG_UBE')) {
105 105
       return null;
106 106
     }
107 107
 
108 108
     $classLocale = classLocale::$lang;
109 109
 
110
-    print("[{$attacking_unit_pool->unitId}]{$classLocale['tech'][$attacking_unit_pool->unitId]}" .
111
-      ' attacks ' .
112
-      $defending_fleet_id . '@' . "[{$defending_unit_pool->unitId}]{$classLocale['tech'][$defending_unit_pool->unitId]}" .
113
-      ' with ' . pretty_number($defending_unit_pool->attack_income) .
110
+    print("[{$attacking_unit_pool->unitId}]{$classLocale['tech'][$attacking_unit_pool->unitId]}".
111
+      ' attacks '.
112
+      $defending_fleet_id.'@'."[{$defending_unit_pool->unitId}]{$classLocale['tech'][$defending_unit_pool->unitId]}".
113
+      ' with '.pretty_number($defending_unit_pool->attack_income).
114 114
       '<br>'
115 115
     );
116 116
     $before = clone $defending_unit_pool;
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
    * @version 41a6.49
128 128
    */
129 129
   public static function unit_dump_delta(UBEUnit $unit, $field, UBEUnit $before = null) {
130
-    if(!defined('DEBUG_UBE')) {
130
+    if (!defined('DEBUG_UBE')) {
131 131
       return;
132 132
     }
133 133
 
@@ -136,8 +136,8 @@  discard block
 block discarded – undo
136 136
     print(pretty_number($unit->$field));
137 137
     print("</td>");
138 138
     print("<td>");
139
-    if(!empty($before)) {
140
-      print('' . pretty_number($unit->$field - $before->$field) . '');
139
+    if (!empty($before)) {
140
+      print(''.pretty_number($unit->$field - $before->$field).'');
141 141
     }
142 142
     print("</td>");
143 143
   }
Please login to merge, or discard this patch.
includes/classes/RequestInfo.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -89,15 +89,15 @@  discard block
 block discarded – undo
89 89
     // Инфа об устройстве и браузере - общая для всех
90 90
     sn_db_transaction_start();
91 91
     $this->device_cypher = $_COOKIE[SN_COOKIE_D];
92
-    if($this->device_cypher) {
92
+    if ($this->device_cypher) {
93 93
       $cypher_safe = db_escape($this->device_cypher);
94 94
       $device_id = doquery("SELECT `device_id` FROM {{security_device}} WHERE `device_cypher` = '{$cypher_safe}' LIMIT 1 FOR UPDATE", true);
95
-      if(!empty($device_id['device_id'])) {
95
+      if (!empty($device_id['device_id'])) {
96 96
         $this->device_id = $device_id['device_id'];
97 97
       }
98 98
     }
99 99
 
100
-    if($this->device_id <= 0) {
100
+    if ($this->device_id <= 0) {
101 101
       do {
102 102
         $cypher_safe = db_escape($this->device_cypher = sys_random_string());
103 103
         $row = doquery("SELECT `device_id` FROM {{security_device}} WHERE `device_cypher` = '{$cypher_safe}' LIMIT 1 FOR UPDATE", true);
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
     $this->page_address_id = db_get_set_unique_id_value($this->page_address, 'url_id', 'security_url', 'url_string');
119 119
     sn_db_transaction_commit();
120 120
 
121
-    if($this->write_full_url) {
121
+    if ($this->write_full_url) {
122 122
       sn_db_transaction_start();
123 123
       $this->page_url = substr($_SERVER['REQUEST_URI'], strlen(SN_ROOT_RELATIVE));
124
-      if(strpos($_SERVER['REQUEST_URI'], '/simulator.php') === 0) {
124
+      if (strpos($_SERVER['REQUEST_URI'], '/simulator.php') === 0) {
125 125
         $this->page_url = '/simulator.php';
126 126
       }
127 127
       $this->page_url_id = db_get_set_unique_id_value($this->page_url, 'url_id', 'security_url', 'url_string');
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
    */
145 145
   public function db_security_entry_insert($user_id_unsafe) {
146 146
     // TODO $user_id = !empty(self::$user['id']) ? self::$user['id'] : 'NULL';
147
-    if(empty($user_id_unsafe)) {
147
+    if (empty($user_id_unsafe)) {
148 148
       // self::flog('Нет ИД пользователя');
149 149
       return true;
150 150
     }
@@ -154,8 +154,8 @@  discard block
 block discarded – undo
154 154
     // self::flog('Вставляем запись системы безопасности');
155 155
     return doquery(
156 156
       "INSERT IGNORE INTO {{security_player_entry}} (`player_id`, `device_id`, `browser_id`, `user_ip`, `user_proxy`)
157
-        VALUES ({$user_id_safe}," . $this->device_id . "," . $this->browser_id . "," .
158
-      $this->ip_v4_int . ", '" . db_escape($this->ip_v4_proxy_chain) . "');"
157
+        VALUES ({$user_id_safe},".$this->device_id.",".$this->browser_id.",".
158
+      $this->ip_v4_int.", '".db_escape($this->ip_v4_proxy_chain)."');"
159 159
     );
160 160
   }
161 161
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
   public function db_counter_insert($user_id_unsafe) {
168 168
     global $sys_stop_log_hit;
169 169
 
170
-    if($sys_stop_log_hit || !classSupernova::$config->game_counter) {
170
+    if ($sys_stop_log_hit || !classSupernova::$config->game_counter) {
171 171
       return;
172 172
     }
173 173
 
@@ -177,14 +177,14 @@  discard block
 block discarded – undo
177 177
     classSupernova::$db->isWatching = true;
178 178
     doquery(
179 179
       "INSERT INTO {{counter}} SET
180
-        `visit_time` = '" . SN_TIME_SQL. "',
180
+        `visit_time` = '" . SN_TIME_SQL."',
181 181
         `user_id` = {$user_id_safe},
182 182
         `device_id` = {$this->device_id},
183 183
         `browser_id` = {$this->browser_id},
184 184
         `user_ip` = {$this->ip_v4_int},
185 185
         `user_proxy` = '{$proxy_safe}',
186
-        `page_url_id` = {$this->page_address_id}" .
187
-        ($this->write_full_url ? ", `plain_url_id` = {$this->page_url_id}" : '' ).
186
+        `page_url_id` = {$this->page_address_id}".
187
+        ($this->write_full_url ? ", `plain_url_id` = {$this->page_url_id}" : '').
188 188
       ";");
189 189
 
190 190
     classSupernova::$db->isWatching = false;
Please login to merge, or discard this patch.
includes/classes/template.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -61,10 +61,10 @@  discard block
 block discarded – undo
61 61
   {
62 62
     global $phpbb_root_path, $user;
63 63
 
64
-    if (file_exists($phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template'))
64
+    if (file_exists($phpbb_root_path.'styles/'.$user->theme['template_path'].'/template'))
65 65
     {
66
-      $this->root = $phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template';
67
-      $this->cachepath = $phpbb_root_path . 'cache/tpl_' . str_replace('_', '-', $user->theme['template_path']) . '_';
66
+      $this->root = $phpbb_root_path.'styles/'.$user->theme['template_path'].'/template';
67
+      $this->cachepath = $phpbb_root_path.'cache/tpl_'.str_replace('_', '-', $user->theme['template_path']).'_';
68 68
 
69 69
       if ($this->orig_tpl_storedb === null)
70 70
       {
@@ -81,12 +81,12 @@  discard block
 block discarded – undo
81 81
 
82 82
       if ($user->theme['template_inherits_id'])
83 83
       {
84
-        $this->inherit_root = $phpbb_root_path . 'styles/' . $user->theme['template_inherit_path'] . '/template';
84
+        $this->inherit_root = $phpbb_root_path.'styles/'.$user->theme['template_inherit_path'].'/template';
85 85
       }
86 86
     }
87 87
     else
88 88
     {
89
-      trigger_error('Template path could not be found: styles/' . $user->theme['template_path'] . '/template', E_USER_ERROR);
89
+      trigger_error('Template path could not be found: styles/'.$user->theme['template_path'].'/template', E_USER_ERROR);
90 90
     }
91 91
 
92 92
     $this->_rootref = &$this->_tpldata['.'][0];
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
     }
110 110
 
111 111
     $this->root = $template_path;
112
-    $this->cachepath = $phpbb_root_path . 'cache/ctpl_' . str_replace('_', '-', $template_name) . '_';
112
+    $this->cachepath = $phpbb_root_path.'cache/ctpl_'.str_replace('_', '-', $template_name).'_';
113 113
 
114 114
     if ($fallback_template_path !== false)
115 115
     {
@@ -154,11 +154,11 @@  discard block
 block discarded – undo
154 154
       }
155 155
 
156 156
       $this->filename[$handle] = $filename;
157
-      $this->files[$handle] = $this->root . '/' . $filename;
157
+      $this->files[$handle] = $this->root.'/'.$filename;
158 158
 
159 159
       if ($this->inherit_root)
160 160
       {
161
-        $this->files_inherit[$handle] = $this->inherit_root . '/' . $filename;
161
+        $this->files_inherit[$handle] = $this->inherit_root.'/'.$filename;
162 162
       }
163 163
     }
164 164
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
     }
236 236
     else
237 237
     {
238
-      eval(' ?>' . $this->compiled_code[$handle] . '<?php ');
238
+      eval(' ?>'.$this->compiled_code[$handle].'<?php ');
239 239
     }
240 240
 
241 241
     return true;
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
     //$user->theme['template_storedb'] = $this->orig_tpl_storedb;
281 281
     //$user->theme['template_inherits_id'] = $this->orig_tpl_inherits_id;
282 282
 
283
-    $filename = $this->cachepath . str_replace('/', '.', $this->filename[$handle]) . DOT_PHP_EX;
283
+    $filename = $this->cachepath.str_replace('/', '.', $this->filename[$handle]).DOT_PHP_EX;
284 284
     //$this->files_template[$handle] = (isset($user->theme['template_id'])) ? $user->theme['template_id'] : 0;
285 285
 
286 286
     $recompile = false;
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
 
310 310
     if (!class_exists('template_compile'))
311 311
     {
312
-      include($phpbb_root_path . 'includes/functions_template' . DOT_PHP_EX);
312
+      include($phpbb_root_path.'includes/functions_template'.DOT_PHP_EX);
313 313
     }
314 314
 
315 315
     // Inheritance - we point to another template file for this one. Equality is also used for store_db
@@ -348,10 +348,10 @@  discard block
 block discarded – undo
348 348
       foreach ($ids as $id)
349 349
       {
350 350
         $sql = 'SELECT *
351
-        FROM ' . STYLES_TEMPLATE_DATA_TABLE . '
352
-        WHERE template_id = ' . $id . "
353
-          AND (template_filename = '" . $db->sql_escape($this->filename[$handle]) . "'
354
-            OR template_included " . $db->sql_like_expression($db->any_char . $this->filename[$handle] . ':' . $db->any_char) . ')';
351
+        FROM ' . STYLES_TEMPLATE_DATA_TABLE.'
352
+        WHERE template_id = ' . $id."
353
+          AND (template_filename = '" . $db->sql_escape($this->filename[$handle])."'
354
+            OR template_included " . $db->sql_like_expression($db->any_char.$this->filename[$handle].':'.$db->any_char).')';
355 355
 
356 356
         $result = $db->sql_query($sql);
357 357
         while ($row = $db->sql_fetchrow($result))
@@ -365,14 +365,14 @@  discard block
 block discarded – undo
365 365
       {
366 366
         foreach ($rows as $row)
367 367
         {
368
-          $file = $this->root . '/' . $row['template_filename'];
368
+          $file = $this->root.'/'.$row['template_filename'];
369 369
           $force_reload = false;
370 370
           if ($row['template_id'] != $user->theme['template_id'])
371 371
           {
372 372
             // make sure that we are not overlooking a file not in the db yet
373 373
             if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id'] && !file_exists($file))
374 374
             {
375
-              $file = $this->inherit_root . '/' . $row['template_filename'];
375
+              $file = $this->inherit_root.'/'.$row['template_filename'];
376 376
               $this->files[$row['template_filename']] = $file;
377 377
               $this->files_inherit[$row['template_filename']] = $file;
378 378
               $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id'];
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
           else
415 415
           {
416 416
             // Only bother compiling if it doesn't already exist
417
-            if (!file_exists($this->cachepath . str_replace('/', '.', $row['template_filename']) . DOT_PHP_EX))
417
+            if (!file_exists($this->cachepath.str_replace('/', '.', $row['template_filename']).DOT_PHP_EX))
418 418
             {
419 419
               $this->filename[$row['template_filename']] = $row['template_filename'];
420 420
               $compile->compile_write($row['template_filename'], $compile->compile(trim($row['template_data'])));
@@ -425,11 +425,11 @@  discard block
 block discarded – undo
425 425
       }
426 426
       else
427 427
       {
428
-        $file = $this->root . '/' . $row['template_filename'];
428
+        $file = $this->root.'/'.$row['template_filename'];
429 429
 
430 430
         if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id'] && !file_exists($file))
431 431
         {
432
-          $file = $this->inherit_root . '/' . $row['template_filename'];
432
+          $file = $this->inherit_root.'/'.$row['template_filename'];
433 433
           $this->files[$row['template_filename']] = $file;
434 434
           $this->files_inherit[$row['template_filename']] = $file;
435 435
           $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id'];
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
       // Re-position template blocks
623 623
       for ($i = sizeof($this->_tpldata[$blockname]); $i > $key; $i--)
624 624
       {
625
-        $this->_tpldata[$blockname][$i] = $this->_tpldata[$blockname][$i-1];
625
+        $this->_tpldata[$blockname][$i] = $this->_tpldata[$blockname][$i - 1];
626 626
         $this->_tpldata[$blockname][$i]['S_ROW_COUNT'] = $i;
627 627
       }
628 628
 
@@ -656,10 +656,10 @@  discard block
 block discarded – undo
656 656
   {
657 657
     $handle = $filename;
658 658
     $this->filename[$handle] = $filename;
659
-    $this->files[$handle] = $this->root . '/' . $filename;
659
+    $this->files[$handle] = $this->root.'/'.$filename;
660 660
     if ($this->inherit_root)
661 661
     {
662
-      $this->files_inherit[$handle] = $this->inherit_root . '/' . $filename;
662
+      $this->files_inherit[$handle] = $this->inherit_root.'/'.$filename;
663 663
     }
664 664
 
665 665
     $filename = $this->_tpl_load($handle);
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
         include($filename);
674 674
         return;
675 675
       }
676
-      eval(' ?>' . $this->compiled_code[$handle] . '<?php ');
676
+      eval(' ?>'.$this->compiled_code[$handle].'<?php ');
677 677
     }
678 678
   }
679 679
 
@@ -685,12 +685,12 @@  discard block
 block discarded – undo
685 685
   {
686 686
     global $phpbb_root_path;
687 687
 
688
-    $file = $phpbb_root_path . $filename;
688
+    $file = $phpbb_root_path.$filename;
689 689
 
690 690
     if (!file_exists($file))
691 691
     {
692 692
       // trigger_error cannot be used here, as the output already started
693
-      echo 'template->_php_include(): File ' . htmlspecialchars($file) . ' does not exist or is empty';
693
+      echo 'template->_php_include(): File '.htmlspecialchars($file).' does not exist or is empty';
694 694
       return;
695 695
     }
696 696
     include($file);
@@ -702,13 +702,13 @@  discard block
 block discarded – undo
702 702
   */
703 703
   function assign_recursive($values, $name = '')
704 704
   {
705
-    if(isset($values['.']))
705
+    if (isset($values['.']))
706 706
     {
707 707
       $values_extra = $values['.'];
708 708
       unset($values['.']);
709 709
     }
710 710
 
711
-    if(!$name)
711
+    if (!$name)
712 712
     {
713 713
       $this->assign_vars($values);
714 714
     }
@@ -717,12 +717,12 @@  discard block
 block discarded – undo
717 717
       $this->assign_block_vars($name, $values);
718 718
     }
719 719
 
720
-    if(isset($values_extra))
720
+    if (isset($values_extra))
721 721
     {
722
-      foreach($values_extra as $sub_array_name => $sub_array)
722
+      foreach ($values_extra as $sub_array_name => $sub_array)
723 723
       {
724
-        $new_name = $name . ($name ? '.' : '') . $sub_array_name;
725
-        foreach($sub_array as $sub_element)
724
+        $new_name = $name.($name ? '.' : '').$sub_array_name;
725
+        foreach ($sub_array as $sub_element)
726 726
         {
727 727
           $this->assign_recursive($sub_element, $new_name);
728 728
         }
Please login to merge, or discard this patch.
includes/classes/db_mysql_v4.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@
 block discarded – undo
52 52
     !mysql_select_db($settings['name'])
53 53
       ? classSupernova::$debug->error_fatal('DB error - cannot find DB on server', $this->mysql_error())
54 54
       : false;
55
-    !$this->mysql_query('SET SESSION TRANSACTION ISOLATION LEVEL ' . self::DB_MYSQL_TRANSACTION_REPEATABLE_READ . ';')
55
+    !$this->mysql_query('SET SESSION TRANSACTION ISOLATION LEVEL '.self::DB_MYSQL_TRANSACTION_REPEATABLE_READ.';')
56 56
       ? classSupernova::$debug->error_fatal('DB error - cannot set desired isolation level', $this->mysql_error())
57 57
       : false;
58 58
 
Please login to merge, or discard this patch.
includes/classes/UnitResourceLoot.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
   public static function _init($group_name = '') {
27 27
     parent::_init($group_name);
28 28
 
29
-    foreach(static::$_group_unit_id_list as $resource_id) {
29
+    foreach (static::$_group_unit_id_list as $resource_id) {
30 30
       static::$_group_pnames[$resource_id] = pname_resource_name($resource_id);
31 31
     }
32 32
 
@@ -48,13 +48,13 @@  discard block
 block discarded – undo
48 48
 
49 49
     !is_array($resource_array) ? $resource_array = array() : false;
50 50
 
51
-    foreach($resource_array as $resource_id => $resource_actual_delta) {
52
-      if(!$resource_actual_delta) {
51
+    foreach ($resource_array as $resource_id => $resource_actual_delta) {
52
+      if (!$resource_actual_delta) {
53 53
         // No delta - no changes
54 54
         continue;
55 55
       }
56 56
 
57
-      $result[$prefix . static::$_group_pnames[$resource_id]] = $resource_actual_delta;
57
+      $result[$prefix.static::$_group_pnames[$resource_id]] = $resource_actual_delta;
58 58
     }
59 59
 
60 60
     return $result;
Please login to merge, or discard this patch.
includes/classes/db_mysql_v5.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -39,19 +39,19 @@
 block discarded – undo
39 39
 
40 40
     @$this->link = mysqli_connect($settings['server'], $settings['user'], $settings['pass'], $settings['name']);
41 41
     if (!is_object($this->link) || $this->link->connect_error) {
42
-      classSupernova::$debug->error_fatal('DB Error - cannot connect to server error #' . $this->link->connect_errno, $this->link->connect_error);
42
+      classSupernova::$debug->error_fatal('DB Error - cannot connect to server error #'.$this->link->connect_errno, $this->link->connect_error);
43 43
     }
44 44
 
45 45
 
46 46
     !$this->mysql_query("/*!40101 SET NAMES 'utf8' */")
47
-      ? classSupernova::$debug->error_fatal('DB error - cannot set names 1 error #' . $this->link->errno, $this->link->error)
47
+      ? classSupernova::$debug->error_fatal('DB error - cannot set names 1 error #'.$this->link->errno, $this->link->error)
48 48
       : false;
49 49
     !$this->mysql_query("SET NAMES 'utf8';")
50
-      ? classSupernova::$debug->error_fatal('DB error - cannot set names 2 error #' . $this->link->errno, $this->link->error)
50
+      ? classSupernova::$debug->error_fatal('DB error - cannot set names 2 error #'.$this->link->errno, $this->link->error)
51 51
       : false;
52 52
 
53
-    !$this->mysql_query('SET SESSION TRANSACTION ISOLATION LEVEL ' . self::DB_MYSQL_TRANSACTION_REPEATABLE_READ . ';')
54
-      ? classSupernova::$debug->error_fatal('DB error - cannot set desired isolation level error #' . $this->link->errno, $this->link->error)
53
+    !$this->mysql_query('SET SESSION TRANSACTION ISOLATION LEVEL '.self::DB_MYSQL_TRANSACTION_REPEATABLE_READ.';')
54
+      ? classSupernova::$debug->error_fatal('DB error - cannot set desired isolation level error #'.$this->link->errno, $this->link->error)
55 55
       : false;
56 56
 
57 57
     $this->connected = true;
Please login to merge, or discard this patch.
includes/classes/PlayerToAccountTranslate.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
   protected static $is_init = false;
20 20
 
21 21
   protected static function init() {
22
-    if(!empty(static::$db)) {
22
+    if (!empty(static::$db)) {
23 23
       return;
24 24
     }
25 25
     static::$db = classSupernova::$db;
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
     $provider_id_safe = intval($provider_id_unsafe);
67 67
     !is_array($account_list) ? $account_list = array($account_list) : false;
68 68
 
69
-    foreach($account_list as $provider_account_id_unsafe) {
69
+    foreach ($account_list as $provider_account_id_unsafe) {
70 70
       $provider_account_id_safe = intval($provider_account_id_unsafe);
71 71
 
72 72
       // TODO - Здесь могут отсутствовать аккаунты - проверять провайдером
73 73
       $query = static::$db->doquery("SELECT `user_id` FROM {{account_translate}} WHERE `provider_id` = {$provider_id_safe} AND `provider_account_id` = {$provider_account_id_safe} FOR UPDATE");
74
-      while($row = static::$db->db_fetch($query)) {
74
+      while ($row = static::$db->db_fetch($query)) {
75 75
         $account_translation[$row['user_id']][$provider_id_unsafe][$provider_account_id_unsafe] = true;
76 76
       }
77 77
     }
@@ -88,10 +88,10 @@  discard block
 block discarded – undo
88 88
     $account_translation = array();
89 89
 
90 90
     $query = static::$db->doquery(
91
-      "SELECT * FROM {{account_translate}} WHERE `user_id` = {$user_id_safe} " .
92
-      ($provider_id_unsafe ? "AND `provider_id` = {$provider_id_safe} " : '') .
91
+      "SELECT * FROM {{account_translate}} WHERE `user_id` = {$user_id_safe} ".
92
+      ($provider_id_unsafe ? "AND `provider_id` = {$provider_id_safe} " : '').
93 93
       "ORDER BY `timestamp` FOR UPDATE");
94
-    while($row = static::$db->db_fetch($query)) {
94
+    while ($row = static::$db->db_fetch($query)) {
95 95
       $account_translation[$row['user_id']][$row['provider_id']][$row['provider_account_id']] = $row;
96 96
     }
97 97
 
Please login to merge, or discard this patch.
includes/classes/Account.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
     $this->reset();
80 80
     $this->db = is_object($db) ? $db : classSupernova::$db;
81 81
 
82
-    foreach($this->table_check as $table_name) {
83
-      if(empty($this->db->table_list[$table_name])) {
82
+    foreach ($this->table_check as $table_name) {
83
+      if (empty($this->db->table_list[$table_name])) {
84 84
         die('Если вы видите это сообщение первый раз после обновления релиза - просто перегрузите страницу.<br />
85 85
               В противном случае - сообщите Администрации сервера об ошибке.<br/>
86 86
               Не хватает таблицы для работы системы авторизации: ' . $table_name);
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
    */
105 105
   // OK v4.6
106 106
   public function password_change($old_password_unsafe, $new_password_unsafe, $salt_unsafe = null) {
107
-    if(!$this->password_check($old_password_unsafe)) {
107
+    if (!$this->password_check($old_password_unsafe)) {
108 108
       return false;
109 109
     }
110 110
 
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
   // OK v4.5
126 126
   public function assign_from_db_row($row) {
127 127
     $this->reset();
128
-    if(empty($row) || !is_array($row)) {
128
+    if (empty($row) || !is_array($row)) {
129 129
       return false;
130 130
     }
131 131
     $this->account_id = $row['account_id'];
@@ -242,11 +242,11 @@  discard block
 block discarded – undo
242 242
         `account_email` = LOWER('{$email_safe}'),
243 243
         `account_language` = '{$language_safe}'"
244 244
     );
245
-    if(!$result) {
245
+    if (!$result) {
246 246
       throw new Exception(REGISTER_ERROR_ACCOUNT_CREATE, ERR_ERROR);
247 247
     }
248 248
 
249
-    if(!($account_id = $this->db->db_insert_id())) {
249
+    if (!($account_id = $this->db->db_insert_id())) {
250 250
       throw new Exception(REGISTER_ERROR_ACCOUNT_CREATE, ERR_ERROR);
251 251
     }
252 252
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
       WHERE `account_id` = '{$account_id_safe}'"
277 277
     ) ? true : false;
278 278
 
279
-    if($result) {
279
+    if ($result) {
280 280
       $result = $this->db_get_by_id($this->account_id);
281 281
     }
282 282
 
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
   public function metamatter_change($change_type, $metamatter, $comment = '', $already_changed = false) {
364 364
     global $mm_change_legit;
365 365
 
366
-    if(!$this->is_exists || !($metamatter = round(floatval($metamatter)))) {
366
+    if (!$this->is_exists || !($metamatter = round(floatval($metamatter)))) {
367 367
       classSupernova::$debug->error('Ошибка при попытке манипуляции с ММ');
368 368
 
369 369
       return false;
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 
374 374
     $mm_change_legit = true;
375 375
     // $sn_data_metamatter_db_name = pname_resource_name(RES_METAMATTER);
376
-    if($already_changed) {
376
+    if ($already_changed) {
377 377
       $metamatter_total_delta = 0;
378 378
       $result = -1;
379 379
     } else {
@@ -383,17 +383,17 @@  discard block
 block discarded – undo
383 383
       $result = $this->db->doquery(
384 384
         "UPDATE {{account}}
385 385
         SET
386
-          `account_metamatter` = `account_metamatter` + '{$metamatter}'" .
387
-        ($metamatter_total_delta ? ", `account_immortal` = IF(`account_metamatter_total` + '{$metamatter_total_delta}' >= {$classConfig->player_metamatter_immortal}, NOW(), `account_immortal`), `account_metamatter_total` = `account_metamatter_total` + '{$metamatter_total_delta}'" : '') .
386
+          `account_metamatter` = `account_metamatter` + '{$metamatter}'".
387
+        ($metamatter_total_delta ? ", `account_immortal` = IF(`account_metamatter_total` + '{$metamatter_total_delta}' >= {$classConfig->player_metamatter_immortal}, NOW(), `account_immortal`), `account_metamatter_total` = `account_metamatter_total` + '{$metamatter_total_delta}'" : '').
388 388
         " WHERE `account_id` = {$account_id_safe}"
389 389
       );
390
-      if(!$result) {
390
+      if (!$result) {
391 391
         classSupernova::$debug->error("Error adjusting Metamatter for player ID {$this->account_id} (Player Not Found?) with {$metamatter}. Reason: {$comment}", 'Metamatter Change', 402);
392 392
       }
393 393
       $result = classSupernova::$db->db_affected_rows();
394 394
     }
395 395
 
396
-    if(empty(core_auth::$user['id'])) {
396
+    if (empty(core_auth::$user['id'])) {
397 397
       $user_list = PlayerToAccountTranslate::db_translate_get_users_from_account_list(core_auth::$main_provider->provider_id, $this->account_id);
398 398
       reset($user_list);
399 399
       $user_id_unsafe = key($user_list);
@@ -402,30 +402,30 @@  discard block
 block discarded – undo
402 402
     }
403 403
     $user_id_safe = $this->db->db_escape($user_id_unsafe);
404 404
 
405
-    if(!$result) {
405
+    if (!$result) {
406 406
       classSupernova::$debug->error("Error adjusting Metamatter for player ID {$this->account_id} (Player Not Found?) with {$metamatter}. Reason: {$comment}", 'Metamatter Change', 402);
407 407
     }
408 408
 
409
-    if(!$already_changed) {
409
+    if (!$already_changed) {
410 410
       $this->account_metamatter += $metamatter;
411 411
       $this->account_metamatter_total += $metamatter_total_delta;
412 412
     }
413 413
 
414
-    if(is_array($comment)) {
414
+    if (is_array($comment)) {
415 415
       $comment = call_user_func_array('sprintf', $comment);
416 416
     }
417 417
 
418 418
     $result = $this->db_mm_log_insert($comment, $change_type, $metamatter, $user_id_unsafe);
419 419
 
420
-    if($metamatter > 0 && !empty($user_id_safe)) {
420
+    if ($metamatter > 0 && !empty($user_id_safe)) {
421 421
       $old_referral = db_referral_get_by_id($user_id_safe);
422
-      if($old_referral['id']) {
422
+      if ($old_referral['id']) {
423 423
         $dark_matter_from_metamatter = $metamatter * AFFILIATE_MM_TO_REFERRAL_DM;
424 424
         db_referral_update_dm($user_id_safe, $dark_matter_from_metamatter);
425 425
         $new_referral = db_referral_get_by_id($user_id_safe);
426 426
 
427 427
         $partner_bonus = floor($new_referral['dark_matter'] / classSupernova::$config->rpg_bonus_divisor) - ($old_referral['dark_matter'] >= classSupernova::$config->rpg_bonus_minimum ? floor($old_referral['dark_matter'] / classSupernova::$config->rpg_bonus_divisor) : 0);
428
-        if($partner_bonus > 0 && $new_referral['dark_matter'] >= classSupernova::$config->rpg_bonus_minimum) {
428
+        if ($partner_bonus > 0 && $new_referral['dark_matter'] >= classSupernova::$config->rpg_bonus_minimum) {
429 429
           rpg_points_change($new_referral['id_partner'], RPG_REFERRAL_BOUGHT_MM, $partner_bonus, "Incoming MM From Referral ID {$user_id_safe}");
430 430
         }
431 431
       }
Please login to merge, or discard this patch.