Passed
Push — trunk ( 72cafa...79712a )
by SuperNova.WS
03:36
created
classes/FleetDispatcher.php 1 patch
Spacing   +5 added lines, -9 removed lines patch added patch discarded remove patch
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
       MT_EXPLORE   => 'flt_mission_explore',
210 210
     );
211 211
     foreach ($missions_used as $mission_id => $cork) {
212
-      if(empty($mission_files[$mission_id])) {
212
+      if (empty($mission_files[$mission_id])) {
213 213
         continue;
214 214
       }
215 215
 
@@ -474,15 +474,11 @@  discard block
 block discarded – undo
474 474
   protected function flt_flyingFleetsSort($a, $b) {
475 475
     return
476 476
       // Сравниваем время флотов - кто раньше, тот и первый обрабатывается
477
-      $a['fleet_time'] > $b['fleet_time'] ? 1 : ($a['fleet_time'] < $b['fleet_time'] ? -1 :
478
-        // Если время - одинаковое, сравниваем события флотов
477
+      $a['fleet_time'] > $b['fleet_time'] ? 1 : ($a['fleet_time'] < $b['fleet_time'] ? -1 : // Если время - одинаковое, сравниваем события флотов
479 478
         // Если события - одинаковые, то флоты равны
480
-        ($a['fleet_event'] == $b['fleet_event'] ? 0 :
481
-          // Если события разные - первыми считаем прибывающие флоты
482
-          ($a['fleet_event'] == EVENT_FLT_ARRIVE ? 1 : ($b['fleet_event'] == EVENT_FLT_ARRIVE ? -1 :
483
-            // Если нет прибывающих флотов - дальше считаем флоты, которые закончили миссию
484
-            ($a['fleet_event'] == EVENT_FLT_ACOMPLISH ? 1 : ($b['fleet_event'] == EVENT_FLT_ACOMPLISH ? -1 :
485
-              // Если нет флотов, закончивших задание - остались возвращающиеся флоты, которые равны между собой
479
+        ($a['fleet_event'] == $b['fleet_event'] ? 0 : // Если события разные - первыми считаем прибывающие флоты
480
+          ($a['fleet_event'] == EVENT_FLT_ARRIVE ? 1 : ($b['fleet_event'] == EVENT_FLT_ARRIVE ? -1 : // Если нет прибывающих флотов - дальше считаем флоты, которые закончили миссию
481
+            ($a['fleet_event'] == EVENT_FLT_ACOMPLISH ? 1 : ($b['fleet_event'] == EVENT_FLT_ACOMPLISH ? -1 : // Если нет флотов, закончивших задание - остались возвращающиеся флоты, которые равны между собой
486 482
               // TODO: Добавить еще проверку по ID флота и/или времени запуска - что бы обсчитывать их в порядке запуска
487 483
               (
488 484
               0 // Вообще сюда доходить не должно - будет отсекаться на равенстве событий
Please login to merge, or discard this patch.
classes/Fleet/MissionEspionage.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
 
31 31
       $this->target_message = "{$lang['sys_mess_spy_enemy_fleet']} {$this->src_planet['name']} " . uni_render_coordinates_href($this->src_planet, '', 3);
32 32
       $this->target_message .= " {$lang['sys_mess_spy_seen_at']} {$this->dst_planet['name']} " . uni_render_coordinates($this->dst_planet);
33
-      if($this->missionReport->isSpyDetected()) {
33
+      if ($this->missionReport->isSpyDetected()) {
34 34
         $this->target_message .= "<br />{$lang['sys_mess_spy_destroyed_enemy']}";
35 35
       }
36 36
 
Please login to merge, or discard this patch.
classes/Pm/DecodeEspionage.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
       $groups[get_unit_param($unitId, P_UNIT_TYPE)][$unitId] = $unitAmount;
26 26
     }
27 27
 
28
-    foreach(static::ALLOWED_UNITS as $groupId) {
29
-      if(empty($groups[$groupId])) {
28
+    foreach (static::ALLOWED_UNITS as $groupId) {
29
+      if (empty($groups[$groupId])) {
30 30
         continue;
31 31
       }
32 32
 
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
         'NAME' => $lang['tech'][$groupId],
36 36
       ]);
37 37
 
38
-      foreach($general->getGroupsById($groupId) as $unitId) {
39
-        if((!isset($groups[$groupId][$unitId]) || floor($groups[$groupId][$unitId]) < 1) && $unitId != RES_ENERGY) {
38
+      foreach ($general->getGroupsById($groupId) as $unitId) {
39
+        if ((!isset($groups[$groupId][$unitId]) || floor($groups[$groupId][$unitId]) < 1) && $unitId != RES_ENERGY) {
40 40
           continue;
41 41
         }
42 42
 
Please login to merge, or discard this patch.
includes/functions/msg_send_simple_message.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
     "ally_id = '{$ally_id}'" . ($ally_rank_id >= 0 ? " AND ally_rank_id = {$ally_rank_id}" : ''),
27 27
     false, 'id, username');
28 28
   // while ($u = db_fetch($query))
29
-  foreach($query as $u)
29
+  foreach ($query as $u)
30 30
   {
31 31
     $sendList[] = $u['id'];
32 32
     $list .= "<br>{$u['username']} ";
@@ -53,19 +53,19 @@  discard block
 block discarded – undo
53 53
 {
54 54
   global $config, $user, $sn_message_class_list;
55 55
 
56
-  if(!$owners)
56
+  if (!$owners)
57 57
   {
58 58
     return;
59 59
   }
60 60
 
61 61
   $timestamp = $timestamp ? $timestamp : SN_TIME_NOW;
62 62
   $sender = intval($sender);
63
-  if(!is_array($owners))
63
+  if (!is_array($owners))
64 64
   {
65 65
     $owners = array($owners);
66 66
   }
67 67
 
68
-  if($escaped == STRING_NEED_ESCAPING)
68
+  if ($escaped == STRING_NEED_ESCAPING)
69 69
   {
70 70
     $from = db_escape($from);
71 71
     $subject = db_escape($subject);
@@ -81,9 +81,9 @@  discard block
 block discarded – undo
81 81
 
82 82
   $message_class_name_total = $sn_message_class_list[MSG_TYPE_NEW]['name'];
83 83
 
84
-  if($owners[0] == '*')
84
+  if ($owners[0] == '*')
85 85
   {
86
-    if($user['authlevel'] < 3)
86
+    if ($user['authlevel'] < 3)
87 87
     {
88 88
       return false;
89 89
     }
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
 
100 100
     foreach ($owners as $owner)
101 101
     {
102
-      if($user['id'] != $owner)
102
+      if ($user['id'] != $owner)
103 103
       {
104 104
         $owner_row = db_user_by_id($owner);
105 105
       }
@@ -109,14 +109,14 @@  discard block
 block discarded – undo
109 109
       }
110 110
       sys_user_options_unpack($owner_row);
111 111
 
112
-      if($force || !$message_class_switchable || $owner_row["opt_{$message_class_name}"])
112
+      if ($force || !$message_class_switchable || $owner_row["opt_{$message_class_name}"])
113 113
       {
114 114
         $insert_values[] = sprintf($insert_template, $owner);
115 115
       }
116 116
 
117
-      if($message_class_email && $config->game_email_pm && $owner_row["opt_email_{$message_class_name}"])
117
+      if ($message_class_email && $config->game_email_pm && $owner_row["opt_email_{$message_class_name}"])
118 118
       {
119
-        if($message_type == MSG_TYPE_SPY) {
119
+        if ($message_type == MSG_TYPE_SPY) {
120 120
           @$result = mymail($owner_row['email'], $subject, classSupernova::$lang['sys_spy_activity'], '', true);
121 121
         } else {
122 122
           @$result = mymail($owner_row['email'], $subject, $text_unescaped, '', true);
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
       }
125 125
     }
126 126
 
127
-    if(empty($insert_values))
127
+    if (empty($insert_values))
128 128
     {
129 129
       return;
130 130
     }
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
   }
135 135
   db_user_list_set_mass_mail($owners, "`{$message_class_name}` = `{$message_class_name}` + 1, `{$message_class_name_total}` = `{$message_class_name_total}` + 1");
136 136
 
137
-  if(in_array($user['id'], $owners) || $owners[0] == '*')
137
+  if (in_array($user['id'], $owners) || $owners[0] == '*')
138 138
   {
139 139
     $user[$message_class_name]++;
140 140
     $user[$message_class_name_total]++;
Please login to merge, or discard this patch.
includes/vars_combats.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -223,7 +223,7 @@
 block discarded – undo
223 223
       'factor'      => 1,
224 224
     ),
225 225
     P_UNIT_PRODUCTION   => array(
226
-      RES_ENERGY => function ($level, $production_factor, $user, $planet_row) { return ($planet_row["temp_max"] / 4 + 20) * $level * (0.1 * $production_factor); },
226
+      RES_ENERGY => function($level, $production_factor, $user, $planet_row) { return ($planet_row["temp_max"] / 4 + 20) * $level * (0.1 * $production_factor); },
227 227
     ),
228 228
     P_MINING_IS_MANAGED => true,
229 229
 
Please login to merge, or discard this patch.
includes/vars_structures.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
       'factor'      => 1.5,
17 17
     ),
18 18
     P_UNIT_PRODUCTION   => array(
19
-      RES_METAL  => function ($level, $production_factor, $user, $planet_row) { return 40 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
20
-      RES_ENERGY => function ($level, $production_factor, $user, $planet_row) { return -13 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
19
+      RES_METAL  => function($level, $production_factor, $user, $planet_row) { return 40 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
20
+      RES_ENERGY => function($level, $production_factor, $user, $planet_row) { return -13 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
21 21
     ),
22 22
     P_MINING_IS_MANAGED => true,
23 23
   ),
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
       'factor'      => 1.6,
35 35
     ),
36 36
     P_UNIT_PRODUCTION   => array(
37
-      RES_CRYSTAL => function ($level, $production_factor, $user, $planet_row) { return 32 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
38
-      RES_ENERGY  => function ($level, $production_factor, $user, $planet_row) { return -16 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
37
+      RES_CRYSTAL => function($level, $production_factor, $user, $planet_row) { return 32 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
38
+      RES_ENERGY  => function($level, $production_factor, $user, $planet_row) { return -16 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
39 39
     ),
40 40
     P_MINING_IS_MANAGED => true,
41 41
   ),
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
       'factor'      => 1.5,
53 53
     ),
54 54
     P_UNIT_PRODUCTION   => array(
55
-      RES_DEUTERIUM => function ($level, $production_factor, $user, $planet_row) { return 10 * $level * pow(1.1, $level) * (0.1 * $production_factor) * (-0.002 * $planet_row["temp_max"] + 1.28); },
56
-      RES_ENERGY    => function ($level, $production_factor, $user, $planet_row) { return -20 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
55
+      RES_DEUTERIUM => function($level, $production_factor, $user, $planet_row) { return 10 * $level * pow(1.1, $level) * (0.1 * $production_factor) * (-0.002 * $planet_row["temp_max"] + 1.28); },
56
+      RES_ENERGY    => function($level, $production_factor, $user, $planet_row) { return -20 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
57 57
     ),
58 58
     P_MINING_IS_MANAGED => true,
59 59
   ),
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
       'factor'      => 1.5,
71 71
     ),
72 72
     P_UNIT_PRODUCTION   => array(
73
-      RES_ENERGY => function ($level, $production_factor, $user, $planet_row) { return ($planet_row["temp_max"] / 5 + 15) * $level * pow(1.1, $level) * (0.1 * $production_factor); },
73
+      RES_ENERGY => function($level, $production_factor, $user, $planet_row) { return ($planet_row["temp_max"] / 5 + 15) * $level * pow(1.1, $level) * (0.1 * $production_factor); },
74 74
     ),
75 75
     P_MINING_IS_MANAGED => true,
76 76
   ),
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
       'factor'      => 1.8,
89 89
     ),
90 90
     P_UNIT_PRODUCTION   => array(
91
-      RES_DEUTERIUM => function ($level, $production_factor, $user, $planet_row) { return -10 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
92
-      RES_ENERGY    => function ($level, $production_factor, $user, $planet_row) { return 30 * $level * pow(1.05 + 0.01 * mrc_get_level($user, "", TECH_ENERGY), $level) * (0.1 * $production_factor); },
91
+      RES_DEUTERIUM => function($level, $production_factor, $user, $planet_row) { return -10 * $level * pow(1.1, $level) * (0.1 * $production_factor); },
92
+      RES_ENERGY    => function($level, $production_factor, $user, $planet_row) { return 30 * $level * pow(1.05 + 0.01 * mrc_get_level($user, "", TECH_ENERGY), $level) * (0.1 * $production_factor); },
93 93
     ),
94 94
     P_MINING_IS_MANAGED => true,
95 95
   ),
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
       'factor'      => 2,
107 107
     ),
108 108
     'storage'  => array(
109
-      RES_METAL => function ($level) { return BASE_STORAGE_SIZE * pow(1.5, $level); },
109
+      RES_METAL => function($level) { return BASE_STORAGE_SIZE * pow(1.5, $level); },
110 110
     ),
111 111
   ),
112 112
 
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
       'factor'      => 2,
123 123
     ),
124 124
     'storage'  => array(
125
-      RES_CRYSTAL => function ($level) { return BASE_STORAGE_SIZE * pow(1.5, $level); },
125
+      RES_CRYSTAL => function($level) { return BASE_STORAGE_SIZE * pow(1.5, $level); },
126 126
     ),
127 127
   ),
128 128
 
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
       'factor'      => 2,
139 139
     ),
140 140
     'storage'  => array(
141
-      RES_DEUTERIUM => function ($level) { return BASE_STORAGE_SIZE * pow(1.5, $level); },
141
+      RES_DEUTERIUM => function($level) { return BASE_STORAGE_SIZE * pow(1.5, $level); },
142 142
     ),
143 143
   ),
144 144
 
Please login to merge, or discard this patch.
classes/_SnCacheInternal.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
     //print("<br />CACHE CLEAR {$cache_id} " . ($hard ? 'HARD' : 'SOFT') . "<br />");
53 53
     if ($hard && !empty(_SnCacheInternal::$data[$location_type])) {
54 54
       // Здесь нельзя делать unset - надо записывать NULL, что бы это отразилось на зависимых записях
55
-      array_walk(_SnCacheInternal::$data[$location_type], function (&$item) { $item = null; });
55
+      array_walk(_SnCacheInternal::$data[$location_type], function(&$item) { $item = null; });
56 56
     }
57 57
     _SnCacheInternal::$locator[$location_type] = [];
58 58
     _SnCacheInternal::$queries[$location_type] = [];
Please login to merge, or discard this patch.
classes/debug.php 1 patch
Spacing   +42 added lines, -43 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
  * que esperabas!!! soy newbie!!! D':<
25 25
 */
26 26
 
27
-if(!defined('INSIDE')) {
27
+if (!defined('INSIDE')) {
28 28
   die("attemp hacking");
29 29
 }
30 30
 
@@ -37,16 +37,16 @@  discard block
 block discarded – undo
37 37
   function log_file($message, $ident_change = 0) {
38 38
     static $ident = 0;
39 39
 
40
-    if(!defined('SN_DEBUG_LOG')) {
40
+    if (!defined('SN_DEBUG_LOG')) {
41 41
       return;
42 42
     }
43 43
 
44
-    if($this->log_file_handler === null) {
44
+    if ($this->log_file_handler === null) {
45 45
       $this->log_file_handler = @fopen(SN_ROOT_PHYSICAL . '/.logs/supernova.log', 'a+');
46 46
       @fwrite($this->log_file_handler, "\r\n\r\n");
47 47
     }
48 48
     $ident_change < 0 ? $ident += $ident_change * 2 : false;
49
-    if($this->log_file_handler) {
49
+    if ($this->log_file_handler) {
50 50
       @fwrite($this->log_file_handler, date(FMT_DATE_TIME_SQL, time()) . str_repeat(' ', $ident + 1) . $message . "\r\n");
51 51
     }
52 52
     $ident_change > 0 ? $ident += $ident_change * 2 : false;
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
     $result = array();
82 82
     $transaction_id = classSupernova::db_transaction_check(false) ? classSupernova::$transaction_id : classSupernova::$transaction_id++;
83 83
     $result[] = "tID {$transaction_id}";
84
-    foreach($backtrace as $a_trace) {
85
-      if(in_array($a_trace['function'], $exclude_functions)) {
84
+    foreach ($backtrace as $a_trace) {
85
+      if (in_array($a_trace['function'], $exclude_functions)) {
86 86
         continue;
87 87
       }
88 88
       $function =
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 
99 99
       $result[] = "{$function} - '{$file}' Line {$a_trace['line']}";
100 100
 
101
-      if(!$long_comment) {
101
+      if (!$long_comment) {
102 102
         break;
103 103
       }
104 104
     }
@@ -107,26 +107,26 @@  discard block
 block discarded – undo
107 107
   }
108 108
 
109 109
   function dump($dump = false, $force_base = false, $deadlock = false) {
110
-    if($dump === false) {
110
+    if ($dump === false) {
111 111
       return;
112 112
     }
113 113
 
114 114
     $error_backtrace = array();
115 115
     $base_dump = false;
116 116
 
117
-    if($force_base === true) {
117
+    if ($force_base === true) {
118 118
       $base_dump = true;
119 119
     }
120 120
 
121
-    if($dump === true) {
121
+    if ($dump === true) {
122 122
       $base_dump = true;
123 123
     } else {
124
-      if(!is_array($dump)) {
124
+      if (!is_array($dump)) {
125 125
         $dump = array('var' => $dump);
126 126
       }
127 127
 
128
-      foreach($dump as $dump_var_name => $dump_var) {
129
-        if($dump_var_name == 'base_dump') {
128
+      foreach ($dump as $dump_var_name => $dump_var) {
129
+        if ($dump_var_name == 'base_dump') {
130 130
           $base_dump = $dump_var;
131 131
         } else {
132 132
           $error_backtrace[$dump_var_name] = $dump_var;
@@ -134,24 +134,23 @@  discard block
 block discarded – undo
134 134
       }
135 135
     }
136 136
 
137
-    if($deadlock && ($q = db_fetch(classSupernova::$db->mysql_get_innodb_status()))) {
137
+    if ($deadlock && ($q = db_fetch(classSupernova::$db->mysql_get_innodb_status()))) {
138 138
       $error_backtrace['deadlock'] = explode("\n", $q['Status']);
139 139
       $error_backtrace['locks'] = _SnCacheInternal::$locks;
140 140
       $error_backtrace['cSN_data'] = _SnCacheInternal::$data;
141
-      foreach($error_backtrace['cSN_data'] as &$location) {
142
-        foreach($location as $location_id => &$location_data) //          $location_data = $location_id;
141
+      foreach ($error_backtrace['cSN_data'] as &$location) {
142
+        foreach ($location as $location_id => &$location_data) //          $location_data = $location_id;
143 143
         {
144
-          $location_data = isset($location_data['username']) ? $location_data['username'] :
145
-            (isset($location_data['name']) ? $location_data['name'] : $location_id);
144
+          $location_data = isset($location_data['username']) ? $location_data['username'] : (isset($location_data['name']) ? $location_data['name'] : $location_id);
146 145
         }
147 146
       }
148 147
     }
149 148
 
150
-    if($base_dump) {
151
-      if(!is_array($this->log_array) || empty($this->log_array)) {
149
+    if ($base_dump) {
150
+      if (!is_array($this->log_array) || empty($this->log_array)) {
152 151
         $this->log_array = [];
153 152
       } else {
154
-        foreach($this->log_array as $log) {
153
+        foreach ($this->log_array as $log) {
155 154
           $error_backtrace['queries'][] = $log;
156 155
         }
157 156
       }
@@ -163,17 +162,17 @@  discard block
 block discarded – undo
163 162
       // Converting object instances to object names
164 163
 
165 164
       foreach ($error_backtrace['backtrace'] as &$backtrace) {
166
-        if(is_object($backtrace['object'])) {
165
+        if (is_object($backtrace['object'])) {
167 166
           $backtrace['object'] = get_class($backtrace['object']);
168 167
         }
169 168
 
170
-        if(empty($backtrace['args'])) {
169
+        if (empty($backtrace['args'])) {
171 170
           continue;
172 171
         }
173 172
 
174 173
         // Doing same conversion for backtrace params
175
-        foreach($backtrace['args'] as &$arg) {
176
-          if(is_object($arg)) {
174
+        foreach ($backtrace['args'] as &$arg) {
175
+          if (is_object($arg)) {
177 176
             $arg = 'object::' . get_class($arg);
178 177
           }
179 178
         }
@@ -202,14 +201,14 @@  discard block
 block discarded – undo
202 201
   function error($message = 'There is a error on page', $title = 'Internal Error', $error_code = 500, $dump = true) {
203 202
     global $config, $sys_stop_log_hit, $lang, $sys_log_disabled, $user;
204 203
 
205
-    if(empty(classSupernova::$db->connected)) {
204
+    if (empty(classSupernova::$db->connected)) {
206 205
       // TODO - писать ошибку в файл
207 206
       die('SQL server currently unavailable. Please contact Administration...');
208 207
     }
209 208
 
210 209
     sn_db_transaction_rollback();
211 210
 
212
-    if(classSupernova::$config->debug == 1) {
211
+    if (classSupernova::$config->debug == 1) {
213 212
       echo "<h2>{$title}</h2><br><font color=red>" . htmlspecialchars($message) . "</font><br><hr>";
214 213
       echo "<table>{$this->log}</table>";
215 214
     }
@@ -219,7 +218,7 @@  discard block
 block discarded – undo
219 218
     $error_text = db_escape($message);
220 219
     $error_backtrace = $this->dump($dump, true, strpos($message, 'Deadlock') !== false);
221 220
 
222
-    if(!$sys_log_disabled) {
221
+    if (!$sys_log_disabled) {
223 222
       $query = "INSERT INTO `{{logs}}` SET
224 223
         `log_time` = '" . time() . "', `log_code` = '" . db_escape($error_code) . "', `log_sender` = '" . ($user['id'] ? db_escape($user['id']) : 0) . "',
225 224
         `log_username` = '" . db_escape($user['user_name']) . "', `log_title` = '" . db_escape($title) . "',  `log_text` = '" . db_escape($message) . "',
@@ -237,7 +236,7 @@  discard block
 block discarded – undo
237 236
       ob_start();
238 237
       print("<hr>User ID {$user['id']} raised error code {$error_code} titled '{$title}' with text '{$error_text}' on page {$_SERVER['SCRIPT_NAME']}");
239 238
 
240
-      foreach($error_backtrace as $name => $value) {
239
+      foreach ($error_backtrace as $name => $value) {
241 240
         print('<hr>');
242 241
         pdump($value, $name);
243 242
       }
@@ -249,14 +248,14 @@  discard block
 block discarded – undo
249 248
   function warning($message, $title = 'System Message', $log_code = 300, $dump = false) {
250 249
     global $user, $lang, $sys_log_disabled;
251 250
 
252
-    if(empty(classSupernova::$db->connected)) {
251
+    if (empty(classSupernova::$db->connected)) {
253 252
       // TODO - писать ошибку в файл
254 253
       die('SQL server currently unavailable. Please contact Administration...');
255 254
     }
256 255
 
257 256
     $error_backtrace = $this->dump($dump, false);
258 257
 
259
-    if(!$sys_log_disabled) {
258
+    if (!$sys_log_disabled) {
260 259
       $query = "INSERT INTO `{{logs}}` SET
261 260
         `log_time` = '" . time() . "', `log_code` = '" . db_escape($log_code) . "', `log_sender` = '" . ($user['id'] ? db_escape($user['id']) : 0) . "',
262 261
         `log_username` = '" . db_escape($user['user_name']) . "', `log_title` = '" . db_escape($title) . "',  `log_text` = '" . db_escape($message) . "',
@@ -274,11 +273,11 @@  discard block
 block discarded – undo
274 273
 // Dump variables nicer then var_dump()
275 274
 
276 275
 function dump($value, $varname = null, $level = 0, $dumper = '') {
277
-  if(isset($varname)) {
276
+  if (isset($varname)) {
278 277
     $varname .= " = ";
279 278
   }
280 279
 
281
-  if($level == -1) {
280
+  if ($level == -1) {
282 281
     $trans[' '] = '&there4;';
283 282
     $trans["\t"] = '&rArr;';
284 283
     $trans["\n"] = '&para;;';
@@ -287,7 +286,7 @@  discard block
 block discarded – undo
287 286
 
288 287
     return strtr(htmlspecialchars($value), $trans);
289 288
   }
290
-  if($level == 0) {
289
+  if ($level == 0) {
291 290
 //    $dumper = '<pre>' . mt_rand(10, 99) . '|' . $varname;
292 291
     $dumper = mt_rand(10, 99) . '|' . $varname;
293 292
   }
@@ -295,22 +294,22 @@  discard block
 block discarded – undo
295 294
   $type = gettype($value);
296 295
   $dumper .= $type;
297 296
 
298
-  if($type == 'string') {
297
+  if ($type == 'string') {
299 298
     $dumper .= '(' . strlen($value) . ')';
300 299
     $value = dump($value, '', -1);
301
-  } elseif($type == 'boolean') {
300
+  } elseif ($type == 'boolean') {
302 301
     $value = ($value ? 'true' : 'false');
303
-  } elseif($type == 'object') {
302
+  } elseif ($type == 'object') {
304 303
     $props = get_class_vars(get_class($value));
305 304
     $dumper .= '(' . count($props) . ') <u>' . get_class($value) . '</u>';
306
-    foreach($props as $key => $val) {
305
+    foreach ($props as $key => $val) {
307 306
       $dumper .= "\n" . str_repeat("\t", $level + 1) . $key . ' => ';
308 307
       $dumper .= dump($value->$key, '', $level + 1);
309 308
     }
310 309
     $value = '';
311
-  } elseif($type == 'array') {
310
+  } elseif ($type == 'array') {
312 311
     $dumper .= '(' . count($value) . ')';
313
-    foreach($value as $key => $val) {
312
+    foreach ($value as $key => $val) {
314 313
       $dumper .= "\n" . str_repeat("\t", $level + 1) . dump($key, '', -1) . ' => ';
315 314
       $dumper .= dump($val, '', $level + 1);
316 315
     }
@@ -330,7 +329,7 @@  discard block
 block discarded – undo
330 329
 //  $backtrace = $backtrace[1];
331 330
 
332 331
   $caller = '';
333
-  if(defined('SN_DEBUG_PDUMP_CALLER') && SN_DEBUG_PDUMP_CALLER) {
332
+  if (defined('SN_DEBUG_PDUMP_CALLER') && SN_DEBUG_PDUMP_CALLER) {
334 333
     $caller = (!empty($backtrace[1]['class']) ? $backtrace[1]['class'] : '') .
335 334
       (!empty($backtrace[1]['type']) ? $backtrace[1]['type'] : '') .
336 335
       $backtrace[1]['function'] .
@@ -357,7 +356,7 @@  discard block
 block discarded – undo
357 356
 }
358 357
 
359 358
 function pr($prePrint = false) {
360
-  if($prePrint) {
359
+  if ($prePrint) {
361 360
     print("<br>");
362 361
   }
363 362
   print(mt_rand() . "<br>");
@@ -367,7 +366,7 @@  discard block
 block discarded – undo
367 366
   global $_PRINT_COUNT_VALUE;
368 367
   $_PRINT_COUNT_VALUE++;
369 368
 
370
-  if($prePrint) {
369
+  if ($prePrint) {
371 370
     print("<br>");
372 371
   }
373 372
   print($_PRINT_COUNT_VALUE . "<br>");
Please login to merge, or discard this patch.
includes/db/db_queries_users.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     "SELECT `id` AS `ID`, `username` AS `NAME`, `ally_name` AS `ALLY`, `total_points` AS `STAT_POINTS`,
181 181
       `onlinetime` AS `ACTIVITY`
182 182
     FROM `{{users}}`
183
-    WHERE `onlinetime` >= ". (SN_TIME_NOW - $config->game_users_online_timeout) ." ORDER BY user_as_ally, `". $TypeSort ."` ASC;");
183
+    WHERE `onlinetime` >= ". (SN_TIME_NOW - $config->game_users_online_timeout) . " ORDER BY user_as_ally, `" . $TypeSort . "` ASC;");
184 184
 }
185 185
 
186 186
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
   return doquery("SELECT u.*, COUNT(r.id) AS referral_count, SUM(r.dark_matter) AS referral_dm FROM {{users}} as u
196 196
     LEFT JOIN {{referrals}} as r on r.id_partner = u.id
197 197
     WHERE" .
198
-    ($online ? " `onlinetime` >= ". (SN_TIME_NOW - $config->game_users_online_timeout) : ' user_as_ally IS NULL') .
198
+    ($online ? " `onlinetime` >= " . (SN_TIME_NOW - $config->game_users_online_timeout) : ' user_as_ally IS NULL') .
199 199
     " GROUP BY u.id
200 200
     ORDER BY user_as_ally, {$sort} ASC");
201 201
 }
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
   !is_array($user_id_list) ? $user_id_list = array($user_id_list) : false;
212 212
 
213 213
   $user_list = array();
214
-  foreach($user_id_list as $user_id_unsafe) {
214
+  foreach ($user_id_list as $user_id_unsafe) {
215 215
     $user = db_user_by_id($user_id_unsafe);
216 216
     !empty($user) ? $user_list[$user_id_unsafe] = $user : false;
217 217
   }
Please login to merge, or discard this patch.