Completed
Push — work-fleets ( 753b64...82c271 )
by SuperNova.WS
10:48 queued 05:39
created
includes/debug.class.php 1 patch
Spacing   +74 added lines, -75 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
 
31 31
 defined('INSIDE') || die();
32 32
 
33
-if(php_sapi_name() == "cli") {
33
+if (php_sapi_name() == "cli") {
34 34
   // In cli-mode
35 35
   define('__DEBUG_CRLF', "\r\n");
36
-  define('__DEBUG_LINE', '-------------------------------------------------' . __DEBUG_CRLF);
36
+  define('__DEBUG_LINE', '-------------------------------------------------'.__DEBUG_CRLF);
37 37
 } else {
38 38
   // Not in cli-mode
39 39
   define('__DEBUG_CRLF', '<br />');
@@ -50,17 +50,17 @@  discard block
 block discarded – undo
50 50
   function log_file($message, $ident_change = 0) {
51 51
     static $ident = 0;
52 52
 
53
-    if(!defined('SN_DEBUG_LOG')) {
53
+    if (!defined('SN_DEBUG_LOG')) {
54 54
       return;
55 55
     }
56 56
 
57
-    if($this->log_file_handler === null) {
58
-      $this->log_file_handler = @fopen(SN_ROOT_PHYSICAL . '/.logs/supernova.log', 'a+');
57
+    if ($this->log_file_handler === null) {
58
+      $this->log_file_handler = @fopen(SN_ROOT_PHYSICAL.'/.logs/supernova.log', 'a+');
59 59
       @fwrite($this->log_file_handler, "\r\n\r\n");
60 60
     }
61 61
     $ident_change < 0 ? $ident += $ident_change * 2 : false;
62
-    if($this->log_file_handler) {
63
-      @fwrite($this->log_file_handler, date(FMT_DATE_TIME_SQL, time()) . str_repeat(' ', $ident + 1) . $message . "\r\n");
62
+    if ($this->log_file_handler) {
63
+      @fwrite($this->log_file_handler, date(FMT_DATE_TIME_SQL, time()).str_repeat(' ', $ident + 1).$message."\r\n");
64 64
     }
65 65
     $ident_change > 0 ? $ident += $ident_change * 2 : false;
66 66
   }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
   }
81 81
 
82 82
   function echo_log() {
83
-    echo '<br><table><tr><td class=k colspan=4><a href="' . SN_ROOT_PHYSICAL . "admin/settings.php\">Debug Log</a>:</td></tr>{$this->log}</table>";
83
+    echo '<br><table><tr><td class=k colspan=4><a href="'.SN_ROOT_PHYSICAL."admin/settings.php\">Debug Log</a>:</td></tr>{$this->log}</table>";
84 84
     die();
85 85
   }
86 86
 
@@ -90,25 +90,25 @@  discard block
 block discarded – undo
90 90
     $result = array();
91 91
     $transaction_id = classSupernova::db_transaction_check(false) ? classSupernova::$transaction_id : classSupernova::$transaction_id++;
92 92
     $result[] = "tID {$transaction_id}";
93
-    foreach($backtrace as $a_trace) {
94
-      if(in_array($a_trace['function'], $exclude_functions)) {
93
+    foreach ($backtrace as $a_trace) {
94
+      if (in_array($a_trace['function'], $exclude_functions)) {
95 95
         continue;
96 96
       }
97 97
       $function =
98 98
         ($a_trace['type']
99 99
           ? ($a_trace['type'] == '->'
100
-            ? "({$a_trace['class']})" . get_class($a_trace['object'])
100
+            ? "({$a_trace['class']})".get_class($a_trace['object'])
101 101
             : $a_trace['class']
102
-          ) . $a_trace['type']
102
+          ).$a_trace['type']
103 103
           : ''
104
-        ) . $a_trace['function'] . '()';
104
+        ).$a_trace['function'].'()';
105 105
 
106 106
       $file = str_replace(SN_ROOT_PHYSICAL, '', str_replace('\\', '/', $a_trace['file']));
107 107
 
108 108
       // $result[] = "{$function} ({$a_trace['line']})'{$file}'";
109 109
       $result[] = "{$function} - '{$file}' Line {$a_trace['line']}";
110 110
 
111
-      if(!$long_comment) {
111
+      if (!$long_comment) {
112 112
         break;
113 113
       }
114 114
     }
@@ -122,26 +122,26 @@  discard block
 block discarded – undo
122 122
   function dump($dump = false, $force_base = false, $deadlock = false) {
123 123
     global $user, $planetrow;
124 124
 
125
-    if($dump === false) {
125
+    if ($dump === false) {
126 126
       return;
127 127
     }
128 128
 
129 129
     $error_backtrace = array();
130 130
     $base_dump = false;
131 131
 
132
-    if($force_base === true) {
132
+    if ($force_base === true) {
133 133
       $base_dump = true;
134 134
     }
135 135
 
136
-    if($dump === true) {
136
+    if ($dump === true) {
137 137
       $base_dump = true;
138 138
     } else {
139
-      if(!is_array($dump)) {
139
+      if (!is_array($dump)) {
140 140
         $dump = array('var' => $dump);
141 141
       }
142 142
 
143
-      foreach($dump as $dump_var_name => $dump_var) {
144
-        if($dump_var_name == 'base_dump') {
143
+      foreach ($dump as $dump_var_name => $dump_var) {
144
+        if ($dump_var_name == 'base_dump') {
145 145
           $base_dump = $dump_var;
146 146
         } else {
147 147
           $error_backtrace[$dump_var_name] = $dump_var;
@@ -149,22 +149,21 @@  discard block
 block discarded – undo
149 149
       }
150 150
     }
151 151
 
152
-    if($deadlock && ($q = db_fetch(classSupernova::$db->mysql_get_innodb_status()))) {
152
+    if ($deadlock && ($q = db_fetch(classSupernova::$db->mysql_get_innodb_status()))) {
153 153
       $error_backtrace['deadlock'] = explode("\n", $q['Status']);
154 154
       $error_backtrace['locks'] = classSupernova::$locks;
155 155
       $error_backtrace['cSN_data'] = classSupernova::$data;
156
-      foreach($error_backtrace['cSN_data'] as &$location) {
157
-        foreach($location as $location_id => &$location_data) {
158
-          $location_data = isset($location_data['username']) ? $location_data['username'] :
159
-            (isset($location_data['name']) ? $location_data['name'] : $location_id);
156
+      foreach ($error_backtrace['cSN_data'] as &$location) {
157
+        foreach ($location as $location_id => &$location_data) {
158
+          $location_data = isset($location_data['username']) ? $location_data['username'] : (isset($location_data['name']) ? $location_data['name'] : $location_id);
160 159
         }
161 160
       }
162 161
       $error_backtrace['cSN_queries'] = classSupernova::$queries;
163 162
     }
164 163
 
165
-    if($base_dump) {
166
-      if(is_array($this->log_array) && count($this->log_array) > 0) {
167
-        foreach($this->log_array as $log) {
164
+    if ($base_dump) {
165
+      if (is_array($this->log_array) && count($this->log_array) > 0) {
166
+        foreach ($this->log_array as $log) {
168 167
           $error_backtrace['queries'][] = $log;
169 168
         }
170 169
       }
@@ -193,14 +192,14 @@  discard block
 block discarded – undo
193 192
   function error($message = 'There is a error on page', $title = 'Internal Error', $error_code = 500, $dump = true) {
194 193
     global $sys_stop_log_hit, $sys_log_disabled, $user;
195 194
 
196
-    if(empty(classSupernova::$db->connected)) {
195
+    if (empty(classSupernova::$db->connected)) {
197 196
       // TODO - писать ошибку в файл
198 197
       die('SQL server currently unavailable. Please contact Administration...');
199 198
     }
200 199
 
201 200
     sn_db_transaction_rollback();
202 201
 
203
-    if(classSupernova::$config->debug == 1) {
202
+    if (classSupernova::$config->debug == 1) {
204 203
       echo "<h2>{$title}</h2><br><font color=red>{$message}</font><br><hr>";
205 204
       echo "<table>{$this->log}</table>";
206 205
     }
@@ -210,15 +209,15 @@  discard block
 block discarded – undo
210 209
     $error_text = db_escape($message);
211 210
     $error_backtrace = $this->dump($dump, true, strpos($message, 'Deadlock') !== false);
212 211
 
213
-    if(!$sys_log_disabled) {
212
+    if (!$sys_log_disabled) {
214 213
       $query = "INSERT INTO `{{logs}}` SET
215
-        `log_time` = '" . time() . "', `log_code` = '" . db_escape($error_code) . "', `log_sender` = '" . db_escape($user['id']) . "',
216
-        `log_username` = '" . db_escape($user['user_name']) . "', `log_title` = '" . db_escape($title) . "',  `log_text` = '" . db_escape($message) . "',
217
-        `log_page` = '" . db_escape(strpos($_SERVER['SCRIPT_NAME'], SN_ROOT_RELATIVE) === false ? $_SERVER['SCRIPT_NAME'] : substr($_SERVER['SCRIPT_NAME'], strlen(SN_ROOT_RELATIVE))) . "'" .
218
-        ($error_backtrace ? ", `log_dump` = '" . db_escape(serialize($error_backtrace)) . "'" : '') . ";";
219
-      doquery($query, '', false, true) or die($fatal_error . db_error());
214
+        `log_time` = '" . time()."', `log_code` = '".db_escape($error_code)."', `log_sender` = '".db_escape($user['id'])."',
215
+        `log_username` = '" . db_escape($user['user_name'])."', `log_title` = '".db_escape($title)."',  `log_text` = '".db_escape($message)."',
216
+        `log_page` = '" . db_escape(strpos($_SERVER['SCRIPT_NAME'], SN_ROOT_RELATIVE) === false ? $_SERVER['SCRIPT_NAME'] : substr($_SERVER['SCRIPT_NAME'], strlen(SN_ROOT_RELATIVE)))."'".
217
+        ($error_backtrace ? ", `log_dump` = '".db_escape(serialize($error_backtrace))."'" : '').";";
218
+      doquery($query, '', false, true) or die($fatal_error.db_error());
220 219
 
221
-      $message = "Пожалуйста, свяжитесь с админом, если ошибка повторится. Ошибка №: <b>" . db_insert_id() . "</b>";
220
+      $message = "Пожалуйста, свяжитесь с админом, если ошибка повторится. Ошибка №: <b>".db_insert_id()."</b>";
222 221
 
223 222
       $sys_stop_log_hit = true;
224 223
       $sys_log_disabled = true;
@@ -228,7 +227,7 @@  discard block
 block discarded – undo
228 227
       ob_start();
229 228
       print("<hr>User ID {$user['id']} raised error code {$error_code} titled '{$title}' with text '{$error_text}' on page {$_SERVER['SCRIPT_NAME']}");
230 229
 
231
-      foreach($error_backtrace as $name => $value) {
230
+      foreach ($error_backtrace as $name => $value) {
232 231
         print(__DEBUG_LINE);
233 232
         pdump($value, $name);
234 233
       }
@@ -240,19 +239,19 @@  discard block
 block discarded – undo
240 239
   function warning($message, $title = 'System Message', $log_code = 300, $dump = false) {
241 240
     global $user, $sys_log_disabled;
242 241
 
243
-    if(empty(classSupernova::$db->connected)) {
242
+    if (empty(classSupernova::$db->connected)) {
244 243
       // TODO - писать ошибку в файл
245 244
       die('SQL server currently unavailable. Please contact Administration...');
246 245
     }
247 246
 
248 247
     $error_backtrace = $this->dump($dump, false);
249 248
 
250
-    if(!$sys_log_disabled) {
249
+    if (!$sys_log_disabled) {
251 250
       $query = "INSERT INTO `{{logs}}` SET
252
-        `log_time` = '" . time() . "', `log_code` = '" . db_escape($log_code) . "', `log_sender` = '" . db_escape($user['id']) . "',
253
-        `log_username` = '" . db_escape($user['user_name']) . "', `log_title` = '" . db_escape($title) . "',  `log_text` = '" . db_escape($message) . "',
254
-        `log_page` = '" . db_escape(strpos($_SERVER['SCRIPT_NAME'], SN_ROOT_RELATIVE) === false ? $_SERVER['SCRIPT_NAME'] : substr($_SERVER['SCRIPT_NAME'], strlen(SN_ROOT_RELATIVE))) . "'" .
255
-        ($error_backtrace ? ", `log_dump` = '" . db_escape(serialize($error_backtrace)) . "'" : '') . ";";
251
+        `log_time` = '" . time()."', `log_code` = '".db_escape($log_code)."', `log_sender` = '".db_escape($user['id'])."',
252
+        `log_username` = '" . db_escape($user['user_name'])."', `log_title` = '".db_escape($title)."',  `log_text` = '".db_escape($message)."',
253
+        `log_page` = '" . db_escape(strpos($_SERVER['SCRIPT_NAME'], SN_ROOT_RELATIVE) === false ? $_SERVER['SCRIPT_NAME'] : substr($_SERVER['SCRIPT_NAME'], strlen(SN_ROOT_RELATIVE)))."'".
254
+        ($error_backtrace ? ", `log_dump` = '".db_escape(serialize($error_backtrace))."'" : '').";";
256 255
       doquery($query, '', false, true);
257 256
     } else {
258 257
 //        // TODO Здесь надо писать в файло
@@ -265,11 +264,11 @@  discard block
 block discarded – undo
265 264
 // Dump variables nicer then var_dump()
266 265
 
267 266
 function dump($value, $varname = null, $level = 0, $dumper = '') {
268
-  if(isset($varname)) {
267
+  if (isset($varname)) {
269 268
     $varname .= " = ";
270 269
   }
271 270
 
272
-  if($level == -1) {
271
+  if ($level == -1) {
273 272
     $trans[' '] = '&there4;';
274 273
     $trans["\t"] = '&rArr;';
275 274
     $trans["\n"] = '&para;;';
@@ -278,31 +277,31 @@  discard block
 block discarded – undo
278 277
 
279 278
     return strtr(htmlspecialchars($value), $trans);
280 279
   }
281
-  if($level == 0) {
280
+  if ($level == 0) {
282 281
 //    $dumper = '<pre>' . mt_rand(10, 99) . '|' . $varname;
283
-    $dumper = mt_rand(10, 99) . '|' . $varname;
282
+    $dumper = mt_rand(10, 99).'|'.$varname;
284 283
   }
285 284
 
286 285
   $type = gettype($value);
287 286
   $dumper .= $type;
288 287
 
289
-  if($type == 'string') {
290
-    $dumper .= '(' . strlen($value) . ')';
288
+  if ($type == 'string') {
289
+    $dumper .= '('.strlen($value).')';
291 290
     $value = dump($value, '', -1);
292
-  } elseif($type == 'boolean') {
291
+  } elseif ($type == 'boolean') {
293 292
     $value = ($value ? 'true' : 'false');
294
-  } elseif($type == 'object') {
293
+  } elseif ($type == 'object') {
295 294
     $props = get_class_vars(get_class($value));
296
-    $dumper .= '(' . count($props) . ') <u>' . get_class($value) . '</u>';
297
-    foreach($props as $key => $val) {
298
-      $dumper .= "\n" . str_repeat("\t", $level + 1) . $key . ' => ';
295
+    $dumper .= '('.count($props).') <u>'.get_class($value).'</u>';
296
+    foreach ($props as $key => $val) {
297
+      $dumper .= "\n".str_repeat("\t", $level + 1).$key.' => ';
299 298
       $dumper .= dump($value->$key, '', $level + 1);
300 299
     }
301 300
     $value = '';
302
-  } elseif($type == 'array') {
303
-    $dumper .= '(' . count($value) . ')';
304
-    foreach($value as $key => $val) {
305
-      $dumper .= "\n" . str_repeat("\t", $level + 1) . dump($key, '', -1) . ' => ';
301
+  } elseif ($type == 'array') {
302
+    $dumper .= '('.count($value).')';
303
+    foreach ($value as $key => $val) {
304
+      $dumper .= "\n".str_repeat("\t", $level + 1).dump($key, '', -1).' => ';
306 305
       $dumper .= dump($val, '', $level + 1);
307 306
     }
308 307
     $value = '';
@@ -321,24 +320,24 @@  discard block
 block discarded – undo
321 320
 //  $backtrace = $backtrace[1];
322 321
 
323 322
   $caller = '';
324
-  if(defined('SN_DEBUG_PDUMP_CALLER') && SN_DEBUG_PDUMP_CALLER) {
325
-    $caller = (!empty($backtrace[1]['class']) ? $backtrace[1]['class'] : '') .
326
-      (!empty($backtrace[1]['type']) ? $backtrace[1]['type'] : '') .
327
-      $backtrace[1]['function'] .
323
+  if (defined('SN_DEBUG_PDUMP_CALLER') && SN_DEBUG_PDUMP_CALLER) {
324
+    $caller = (!empty($backtrace[1]['class']) ? $backtrace[1]['class'] : '').
325
+      (!empty($backtrace[1]['type']) ? $backtrace[1]['type'] : '').
326
+      $backtrace[1]['function'].
328 327
       (!empty($backtrace[0]['file'])
329 328
         ? (
330
-          ' (' . substr($backtrace[0]['file'], SN_ROOT_PHYSICAL_STR_LEN) .
331
-          (!empty($backtrace[0]['line']) ? ':' . $backtrace[0]['line'] : '') .
329
+          ' ('.substr($backtrace[0]['file'], SN_ROOT_PHYSICAL_STR_LEN).
330
+          (!empty($backtrace[0]['line']) ? ':'.$backtrace[0]['line'] : '').
332 331
           ')'
333 332
         )
334 333
         : ''
335 334
       );
336
-    $caller = "\r\n" . $caller;
335
+    $caller = "\r\n".$caller;
337 336
   }
338 337
 
339
-  print('<pre style="text-align: left; background-color: #111111; color: #0A0; font-family: Courier, monospace !important; padding: 1em 0; font-weight: 800; font-size: 14px;">' .
340
-    dump($value, $varname) .
341
-    $caller .
338
+  print('<pre style="text-align: left; background-color: #111111; color: #0A0; font-family: Courier, monospace !important; padding: 1em 0; font-weight: 800; font-size: 14px;">'.
339
+    dump($value, $varname).
340
+    $caller.
342 341
     '</pre>'
343 342
   );
344 343
 }
@@ -348,24 +347,24 @@  discard block
 block discarded – undo
348 347
 }
349 348
 
350 349
 function pr($prePrint = false) {
351
-  if($prePrint) {
350
+  if ($prePrint) {
352 351
     print(__DEBUG_CRLF);
353 352
   }
354
-  print(mt_rand() . __DEBUG_CRLF);
353
+  print(mt_rand().__DEBUG_CRLF);
355 354
 }
356 355
 
357 356
 function pc($prePrint = false) {
358 357
   global $_PRINT_COUNT_VALUE;
359 358
   $_PRINT_COUNT_VALUE++;
360 359
 
361
-  if($prePrint) {
360
+  if ($prePrint) {
362 361
     print(__DEBUG_CRLF);
363 362
   }
364
-  print($_PRINT_COUNT_VALUE . __DEBUG_CRLF);
363
+  print($_PRINT_COUNT_VALUE.__DEBUG_CRLF);
365 364
 }
366 365
 
367 366
 function prep($message) {
368
-  print('<pre>' . $message . '</pre>');
367
+  print('<pre>'.$message.'</pre>');
369 368
 }
370 369
 
371 370
 function backtrace_no_arg() {
@@ -388,5 +387,5 @@  discard block
 block discarded – undo
388 387
  */
389 388
 function pdie($message = '') {
390 389
   $backtrace = debug_backtrace();
391
-  die(__DEBUG_LINE . ($message ? $message . ' @ ' : '') . $backtrace[0]['file'] . ':' . $backtrace[0]['line']);
390
+  die(__DEBUG_LINE.($message ? $message.' @ ' : '').$backtrace[0]['file'].':'.$backtrace[0]['line']);
392 391
 }
Please login to merge, or discard this patch.
includes/functions/eco_planet_update.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
 
15 15
   $no_data = array('user' => false, 'planet' => false, 'que' => false);
16 16
 
17
-  if(!$planet) {
17
+  if (!$planet) {
18 18
     return $no_data;
19 19
   }
20 20
 
21
-  if(!$no_user_update) {
21
+  if (!$no_user_update) {
22 22
     $user = intval(is_array($user) && $user['id'] ? $user['id'] : $user);
23
-    if(!$user) {
23
+    if (!$user) {
24 24
       // TODO - Убрать позже
25 25
       print('<h1>СООБЩИТЕ ЭТО АДМИНУ: sys_o_get_updated() - USER пустой!</h1>');
26 26
       $backtrace = debug_backtrace();
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
     $user = db_user_by_id($user, !$simulation, '*', true);
33 33
   }
34 34
 
35
-  if(empty($user['id'])) {
35
+  if (empty($user['id'])) {
36 36
     return $no_data;
37 37
   }
38 38
 
39
-  if(is_array($planet) && isset($planet['galaxy']) && $planet['galaxy']) {
39
+  if (is_array($planet) && isset($planet['galaxy']) && $planet['galaxy']) {
40 40
     $planet = db_planet_by_vector($planet, '', !$simulation);
41 41
   } else {
42 42
     $planet = intval(is_array($planet) && isset($planet['id']) ? $planet['id'] : $planet);
43 43
     $planet = db_planet_by_id($planet, !$simulation);
44 44
   }
45
-  if(!is_array($planet) || !isset($planet['id'])) {
45
+  if (!is_array($planet) || !isset($planet['id'])) {
46 46
     return $no_data;
47 47
   }
48 48
 
@@ -65,19 +65,19 @@  discard block
 block discarded – undo
65 65
     RES_DEUTERIUM => 0,
66 66
   );
67 67
 
68
-  switch($planet['planet_type']) {
68
+  switch ($planet['planet_type']) {
69 69
     case PT_PLANET:
70
-      foreach($resources_increase as $resource_id => &$increment) {
70
+      foreach ($resources_increase as $resource_id => &$increment) {
71 71
         $resource_name = pname_resource_name($resource_id);
72 72
         $increment = $caps_real['total'][$resource_id] * $ProductionTime / 3600;
73 73
         $store_free = $caps_real['total_storage'][$resource_id] - $planet[$resource_name];
74 74
         $increment = min($increment, max(0, $store_free));
75 75
 
76
-        if($planet[$resource_name] + $increment < 0 && !$simulation) {
76
+        if ($planet[$resource_name] + $increment < 0 && !$simulation) {
77 77
           classSupernova::$debug->warning("Player ID {$user['id']} have negative resources on ID {$planet['id']}.{$planet['planet_type']} [{$planet['galaxy']}:{$planet['system']}:{$planet['planet']}]. Difference {$planet[$resource_name]} of {$resource_name}", 'Negative Resources', 501);
78 78
         }
79 79
         $planet[$resource_name] += $increment;
80
-        $planet[$resource_name . '_perhour'] = $caps_real['total'][$resource_id];
80
+        $planet[$resource_name.'_perhour'] = $caps_real['total'][$resource_id];
81 81
       }
82 82
     break;
83 83
 
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
   // TODO пересчитывать размер планеты только при постройке чего-нибудь и при покупке сектора
95 95
   $planet['field_current'] = 0;
96 96
   $sn_group_build_allow = sn_get_groups('build_allow');
97
-  if(is_array($sn_group_build_allow[$planet['planet_type']])) {
98
-    foreach($sn_group_build_allow[$planet['planet_type']] as $building_id) {
97
+  if (is_array($sn_group_build_allow[$planet['planet_type']])) {
98
+    foreach ($sn_group_build_allow[$planet['planet_type']] as $building_id) {
99 99
       $planet['field_current'] += mrc_get_level($user, $planet, $building_id, !$simulation, true);
100 100
     }
101 101
   }
102 102
 
103
-  if($simulation) {
103
+  if ($simulation) {
104 104
     return array('user' => $user, 'planet' => $planet, 'que' => $que);
105 105
   }
106 106
 
Please login to merge, or discard this patch.
includes/functions/ali_alliances.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,10 +3,10 @@  discard block
 block discarded – undo
3 3
 function ali_rank_list_save($ranks) {
4 4
   global $user;
5 5
 
6
-  if(!empty($ranks)) {
7
-    foreach($ranks as $rank => $rights) {
6
+  if (!empty($ranks)) {
7
+    foreach ($ranks as $rank => $rights) {
8 8
       $rights = implode(',', $rights);
9
-      $ranklist .= $rights . ';';
9
+      $ranklist .= $rights.';';
10 10
     }
11 11
   }
12 12
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
   $temp_array = array();
23 23
   $query = db_ally_diplomacy_get_relations($ally_from, $ally_to);
24 24
 
25
-  while($record = db_fetch($query)) {
25
+  while ($record = db_fetch($query)) {
26 26
     $temp_array[$record['alliance_diplomacy_contr_ally_id']] = $record;
27 27
   }
28 28
 
Please login to merge, or discard this patch.
includes/functions/msg_send_simple_message.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
 
23 23
   $list = '';
24 24
   $query = db_user_list(
25
-    "ally_id = '{$ally_id}'" . ($ally_rank_id >= 0 ? " AND ally_rank_id = {$ally_rank_id}" : ''),
25
+    "ally_id = '{$ally_id}'".($ally_rank_id >= 0 ? " AND ally_rank_id = {$ally_rank_id}" : ''),
26 26
     false, 'id, username');
27 27
   // while ($u = db_fetch($query))
28
-  foreach($query as $u) {
28
+  foreach ($query as $u) {
29 29
     $sendList[] = $u['id'];
30 30
     $list .= "<br>{$u['username']} ";
31 31
   }
@@ -38,17 +38,17 @@  discard block
 block discarded – undo
38 38
 function msg_send_simple_message($owners, $sender, $timestamp, $message_type, $from, $subject, $text, $escaped = false, $force = false) {
39 39
   global $user, $sn_message_class_list;
40 40
 
41
-  if(!$owners) {
41
+  if (!$owners) {
42 42
     return;
43 43
   }
44 44
 
45 45
   $timestamp = $timestamp ? $timestamp : SN_TIME_NOW;
46 46
   $sender = intval($sender);
47
-  if(!is_array($owners)) {
47
+  if (!is_array($owners)) {
48 48
     $owners = array($owners);
49 49
   }
50 50
 
51
-  if(!$escaped) {
51
+  if (!$escaped) {
52 52
     $from = db_escape($from);
53 53
     $subject = db_escape($subject);
54 54
     $text = db_escape($text);
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
 
64 64
   $message_class_name_total = $sn_message_class_list[MSG_TYPE_NEW]['name'];
65 65
 
66
-  if($owners[0] == '*') {
67
-    if($user['authlevel'] < 3) {
66
+  if ($owners[0] == '*') {
67
+    if ($user['authlevel'] < 3) {
68 68
       return false;
69 69
     }
70 70
     // TODO Добавить $timestamp - рассылка может быть и отсроченной
@@ -73,26 +73,26 @@  discard block
 block discarded – undo
73 73
     $owners = array();
74 74
   } else {
75 75
     $insert_values = array();
76
-    $insert_template = "('%u'," . str_replace('%', '%%', " '{$sender}', '{$timestamp}', '{$message_type}', '{$from}', '{$subject}', '{$text}')");
76
+    $insert_template = "('%u',".str_replace('%', '%%', " '{$sender}', '{$timestamp}', '{$message_type}', '{$from}', '{$subject}', '{$text}')");
77 77
 
78
-    foreach($owners as $owner) {
79
-      if($user['id'] != $owner) {
78
+    foreach ($owners as $owner) {
79
+      if ($user['id'] != $owner) {
80 80
         $owner_row = db_user_by_id($owner);
81 81
       } else {
82 82
         $owner_row = $user;
83 83
       }
84 84
       sys_user_options_unpack($owner_row);
85 85
 
86
-      if($force || !$message_class_switchable || $owner_row["opt_{$message_class_name}"]) {
86
+      if ($force || !$message_class_switchable || $owner_row["opt_{$message_class_name}"]) {
87 87
         $insert_values[] = sprintf($insert_template, $owner);
88 88
       }
89 89
 
90
-      if($message_class_email && classSupernova::$config->game_email_pm && $owner_row["opt_email_{$message_class_name}"]) {
90
+      if ($message_class_email && classSupernova::$config->game_email_pm && $owner_row["opt_email_{$message_class_name}"]) {
91 91
         @$result = mymail($owner_row['email'], $subject, $text_unescaped, '', true);
92 92
       }
93 93
     }
94 94
 
95
-    if(empty($insert_values)) {
95
+    if (empty($insert_values)) {
96 96
       return;
97 97
     }
98 98
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
   }
101 101
   db_user_list_set_mass_mail($owners, "`{$message_class_name}` = `{$message_class_name}` + 1, `{$message_class_name_total}` = `{$message_class_name_total}` + 1");
102 102
 
103
-  if(in_array($user['id'], $owners) || $owners[0] == '*') {
103
+  if (in_array($user['id'], $owners) || $owners[0] == '*') {
104 104
     $user[$message_class_name]++;
105 105
     $user[$message_class_name_total]++;
106 106
   }
Please login to merge, or discard this patch.
includes/functions/lng_language.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@
 block discarded – undo
3 3
 // ----------------------------------------------------------------------------------------------------------------
4 4
 function lng_try_filepath($path, $file_path_relative)
5 5
 {
6
-  $file_path = SN_ROOT_PHYSICAL . ($path && file_exists(SN_ROOT_PHYSICAL . $path . $file_path_relative) ? $path : '') . $file_path_relative;
6
+  $file_path = SN_ROOT_PHYSICAL.($path && file_exists(SN_ROOT_PHYSICAL.$path.$file_path_relative) ? $path : '').$file_path_relative;
7 7
   return file_exists($file_path) ? $file_path : false;
8 8
 }
9 9
 
Please login to merge, or discard this patch.
includes/functions/sys_maintenance.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -22,10 +22,10 @@  discard block
 block discarded – undo
22 22
     ),
23 23
   );
24 24
 
25
-  foreach($queries as &$query) {
26
-    if(!empty($query['query'])) {
25
+  foreach ($queries as &$query) {
26
+    if (!empty($query['query'])) {
27 27
       $query['result'] = doquery($query['query']);
28
-    } elseif(!empty($query['callable']) && is_callable($query['callable'])) {
28
+    } elseif (!empty($query['callable']) && is_callable($query['callable'])) {
29 29
       call_user_func($query['callable']);
30 30
     }
31 31
     $query['error'] = classSupernova::$db->db_error();
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
   $today_array = array($today_array['seconds'], $today_array['minutes'], $today_array['hours'], $today_array['mday'], $today_array['mon'], $today_array['year']);
70 70
 //  pdump($prev_run_array);
71 71
   $scheduleList = explode(',', $scheduleList);
72
-  array_walk($scheduleList, function (&$schedule) use ($prev_run_array, $today_array, $date_part_names_reverse, &$possible_schedules) {
72
+  array_walk($scheduleList, function(&$schedule) use ($prev_run_array, $today_array, $date_part_names_reverse, &$possible_schedules) {
73 73
     // pdump($schedule);
74 74
     $schedule = array('schedule_array' => array_reverse(explode(':', trim($schedule))));
75 75
 
@@ -81,21 +81,21 @@  discard block
 block discarded – undo
81 81
     */
82 82
     // pdump($schedule);
83 83
 
84
-    foreach($prev_run_array as $index => $date_part) {
84
+    foreach ($prev_run_array as $index => $date_part) {
85 85
       $schedule['array']['recorded'][$index] = isset($schedule['schedule_array'][$index]) ? intval($schedule['schedule_array'][$index]) : $date_part;
86 86
       $schedule['array']['now'][$index] = isset($schedule['schedule_array'][$index]) ? intval($schedule['schedule_array'][$index]) : $today_array[$index];
87 87
     }
88
-    if($schedule['array']['recorded'] == $schedule['array']['now']) {
88
+    if ($schedule['array']['recorded'] == $schedule['array']['now']) {
89 89
       unset($schedule['array']['now']);
90 90
     }
91 91
 
92
-    foreach($schedule['array'] as $name => $array) {
92
+    foreach ($schedule['array'] as $name => $array) {
93 93
       $schedule['string'][$name] = "{$array[5]}-{$array[4]}-{$array[3]} {$array[2]}:{$array[1]}:{$array[0]}";
94
-      $schedule['string'][$name . '_next'] = $schedule['string'][$name] . ' +1 ' . $interval;
95
-      $schedule['string'][$name . '_prev'] = $schedule['string'][$name] . ' -1 ' . $interval;
94
+      $schedule['string'][$name.'_next'] = $schedule['string'][$name].' +1 '.$interval;
95
+      $schedule['string'][$name.'_prev'] = $schedule['string'][$name].' -1 '.$interval;
96 96
     }
97 97
 
98
-    foreach($schedule['string'] as $string) {
98
+    foreach ($schedule['string'] as $string) {
99 99
       $timestamp = strtotime($string);
100 100
       $schedule['timestamp'][$timestamp] = $possible_schedules[$timestamp] = date(FMT_DATE_TIME_SQL, strtotime($string));
101 101
     }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 
128 128
   $prev_run = 0;
129 129
   $next_run = 0;
130
-  foreach($possible_schedules as $timestamp => $string_date) {
130
+  foreach ($possible_schedules as $timestamp => $string_date) {
131 131
     $prev_run = SN_TIME_NOW >= $timestamp ? $timestamp : $prev_run;
132 132
     $next_run = SN_TIME_NOW < $timestamp && !$next_run ? $timestamp : $next_run;
133 133
 //    pdump($schedule, '$schedule ' . date(FMT_DATE_TIME_SQL, $schedule));
Please login to merge, or discard this patch.
includes/functions/sys_bbcode.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -107,23 +107,23 @@
 block discarded – undo
107 107
 
108 108
   !empty(classSupernova::$config->url_faq) ? $msg = str_replace('faq://', classSupernova::$config->url_faq, $msg) : false;
109 109
 
110
-  foreach($supernova->design['bbcodes'] as $auth_level => $replaces) {
111
-    if($auth_level > $author_auth) {
110
+  foreach ($supernova->design['bbcodes'] as $auth_level => $replaces) {
111
+    if ($auth_level > $author_auth) {
112 112
       continue;
113 113
     }
114 114
 
115
-    foreach($replaces as $key => $html) {
115
+    foreach ($replaces as $key => $html) {
116 116
       $msg = preg_replace(''.$key.'', $html, $msg);
117 117
     }
118 118
   }
119 119
 
120
-  foreach($supernova->design['smiles'] as $auth_level => $replaces) {
121
-    if($auth_level > $author_auth) {
120
+  foreach ($supernova->design['smiles'] as $auth_level => $replaces) {
121
+    if ($auth_level > $author_auth) {
122 122
       continue;
123 123
     }
124 124
 
125
-    foreach($replaces as $key => $imgName) {
126
-      $msg = preg_replace("#" . addcslashes($key, '()[]{}') . "#isU","<img src=\"design/images/smileys/".$imgName.".gif\" align=\"absmiddle\" title=\"".$key."\" alt=\"".$key."\">",$msg);
125
+    foreach ($replaces as $key => $imgName) {
126
+      $msg = preg_replace("#".addcslashes($key, '()[]{}')."#isU", "<img src=\"design/images/smileys/".$imgName.".gif\" align=\"absmiddle\" title=\"".$key."\" alt=\"".$key."\">", $msg);
127 127
     }
128 128
   }
129 129
 
Please login to merge, or discard this patch.
includes/functions/flt_mission_missile.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
   $mip_data = get_unit_param(UNIT_DEF_MISSILE_INTERPLANET);
15 15
   $MIPDamage = floor(mrc_modify_value($attackerTech, false, TECH_WEAPON, $MIPs * $mip_data[P_ATTACK] * mt_rand(80, 120) / 100));
16
-  foreach($structures as $key => $structure)
16
+  foreach ($structures as $key => $structure)
17 17
   {
18 18
     $unit_info = get_unit_param($key);
19 19
     $amplify = isset($mip_data[P_AMPLIFY][$key]) ? $mip_data[P_AMPLIFY][$key] : 1;
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
   {
32 32
     //attacking only selected structure
33 33
     $damageDone = $structures[$targetedStructure][$damageTo];
34
-    $structsDestroyed = min( floor($MIPDamage/$damageDone), $structures[$targetedStructure][0] );
34
+    $structsDestroyed = min(floor($MIPDamage / $damageDone), $structures[$targetedStructure][0]);
35 35
     $structures[$targetedStructure][0] -= $structsDestroyed;
36
-    $MIPDamage -= $structsDestroyed*$damageDone;
36
+    $MIPDamage -= $structsDestroyed * $damageDone;
37 37
   }
38 38
   else
39 39
   {
@@ -44,16 +44,16 @@  discard block
 block discarded – undo
44 44
     do
45 45
     {
46 46
       // finding is there any structure that can be damaged with leftovers of $MIPDamage
47
-      foreach($can_be_damaged as $key => $unit_id)
47
+      foreach ($can_be_damaged as $key => $unit_id)
48 48
       {
49 49
 //debug($structures[$unit_id][0]);
50 50
 //debug($structures[$unit_id][$damageTo], $MIPDamage);
51
-        if($structures[$unit_id][0] <= 0 || $structures[$unit_id][$damageTo] > $MIPDamage)
51
+        if ($structures[$unit_id][0] <= 0 || $structures[$unit_id][$damageTo] > $MIPDamage)
52 52
         {
53 53
           unset($can_be_damaged[$key]);
54 54
         }
55 55
       }
56
-      if(empty($can_be_damaged))
56
+      if (empty($can_be_damaged))
57 57
       {
58 58
         break;
59 59
       }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 //debug($destroyed, 'Actually destroyed');
73 73
 
74 74
 //print('<hr>');
75
-    } while($MIPDamage > 0 && !empty($can_be_damaged));
75
+    } while ($MIPDamage > 0 && !empty($can_be_damaged));
76 76
 //debug($MIPDamage, 'MIPDamage left');
77 77
   }
78 78
 //debug($structures);//die();
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
     $crystal += $destroyed * $unit_info[P_COST][RES_CRYSTAL] / 4;
88 88
   }
89 89
 
90
-  $return['structures'] = $structures;     // Structures left after attack
91
-  $return['metal']      = floor($metal);   // Metal scraps
90
+  $return['structures'] = $structures; // Structures left after attack
91
+  $return['metal']      = floor($metal); // Metal scraps
92 92
   $return['crystal']    = floor($crystal); // Crystal scraps
93 93
 
94 94
   return $return;
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 
113 113
   $iraks = db_missile_list_by_arrival();
114 114
 
115
-  while($fleetRow = db_fetch($iraks)) {
115
+  while ($fleetRow = db_fetch($iraks)) {
116 116
     set_time_limit(15);
117 117
     $db_changeset = array();
118 118
 
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 
129 129
     $rowAttacker = db_user_by_id($fleetRow['fleet_owner'], true);
130 130
 
131
-    if($target_planet_row['id']) {
131
+    if ($target_planet_row['id']) {
132 132
       $planetDefense = array();
133
-      foreach(sn_get_groups('defense_active') as $unit_id) {
133
+      foreach (sn_get_groups('defense_active') as $unit_id) {
134 134
         $planetDefense[$unit_id] = array(mrc_get_level($targetUser, $target_planet_row, $unit_id, true, true));
135 135
       }
136 136
 
@@ -141,24 +141,24 @@  discard block
 block discarded – undo
141 141
         $message = classLocale::$lang['mip_all_destroyed'];
142 142
         $db_changeset['unit'][] = sn_db_unit_changeset_prepare(UNIT_DEF_MISSILE_INTERCEPTOR, -$missiles, $targetUser, $target_planet_row['id']);
143 143
       } else {
144
-        if($interceptors) {
144
+        if ($interceptors) {
145 145
           $message = sprintf(classLocale::$lang['mip_destroyed'], $interceptors);
146 146
           $db_changeset['unit'][] = sn_db_unit_changeset_prepare(UNIT_DEF_MISSILE_INTERCEPTOR, -$interceptors, $targetUser, $target_planet_row['id']);
147 147
         }
148 148
 
149 149
         $attackResult = COE_missileAttack($targetUser, $rowAttacker, $missiles - $interceptors, $planetDefense, $fleetRow['primaer']);
150 150
 
151
-        foreach($attackResult['structures'] as $key => $structure) {
151
+        foreach ($attackResult['structures'] as $key => $structure) {
152 152
           $destroyed = $planetDefense[$key][0] - $structure[0];
153
-          if($destroyed) {
153
+          if ($destroyed) {
154 154
             $db_changeset['unit'][] = sn_db_unit_changeset_prepare($key, -$destroyed, $targetUser, $target_planet_row['id']);
155 155
 
156 156
             $message .= "&nbsp;&nbsp;{$classLocale['tech'][$key]} - {$destroyed} {$classLocale['quantity']}<br>";
157 157
           }
158 158
         }
159 159
 
160
-        if(!empty($message)) {
161
-          $message = classLocale::$lang['mip_defense_destroyed'] . $message . "{$classLocale['mip_recycled']}{$classLocale['Metal']}: {$attackResult['metal']}, {$classLocale['Crystal']}: {$attackResult['crystal']}<br>";
160
+        if (!empty($message)) {
161
+          $message = classLocale::$lang['mip_defense_destroyed'].$message."{$classLocale['mip_recycled']}{$classLocale['Metal']}: {$attackResult['metal']}, {$classLocale['Crystal']}: {$attackResult['crystal']}<br>";
162 162
 
163 163
           db_planet_set_by_id($target_planet_row['id'], "`metal` = `metal` + {$attackResult['metal']}, `crystal` = `crystal` + {$attackResult['crystal']}");
164 164
         }
@@ -175,8 +175,8 @@  discard block
 block discarded – undo
175 175
 
176 176
       empty($message) ? $message = classLocale::$lang['mip_no_defense'] : false;
177 177
 
178
-      msg_send_simple_message ( $fleetRow['fleet_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['mip_sender_amd'], classLocale::$lang['mip_subject_amd'], $message_vorlage . $message );
179
-      msg_send_simple_message ( $fleetRow['fleet_target_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['mip_sender_amd'], classLocale::$lang['mip_subject_amd'], $message_vorlage . $message );
178
+      msg_send_simple_message($fleetRow['fleet_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['mip_sender_amd'], classLocale::$lang['mip_subject_amd'], $message_vorlage.$message);
179
+      msg_send_simple_message($fleetRow['fleet_target_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['mip_sender_amd'], classLocale::$lang['mip_subject_amd'], $message_vorlage.$message);
180 180
     }
181 181
     db_missile_delete($fleetRow);
182 182
   }
Please login to merge, or discard this patch.
includes/functions/tpl_helpers.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 
3 3
 // Compare function to sort fleet in time order
4 4
 function tpl_assign_fleet_compare($a, $b) {
5
-  if($a['fleet']['OV_THIS_PLANET'] == $b['fleet']['OV_THIS_PLANET']) {
6
-    if($a['fleet']['OV_LEFT'] == $b['fleet']['OV_LEFT']) {
5
+  if ($a['fleet']['OV_THIS_PLANET'] == $b['fleet']['OV_THIS_PLANET']) {
6
+    if ($a['fleet']['OV_LEFT'] == $b['fleet']['OV_LEFT']) {
7 7
       return 0;
8 8
     }
9 9
 
@@ -19,17 +19,17 @@  discard block
 block discarded – undo
19 19
  * @param string   $js_name
20 20
  */
21 21
 function tpl_assign_fleet(&$template, $fleets, $js_name = 'fleets') {
22
-  if(!$fleets) {
22
+  if (!$fleets) {
23 23
     return;
24 24
   }
25 25
 
26 26
   usort($fleets, 'tpl_assign_fleet_compare');
27 27
 
28
-  foreach($fleets as $fleet_data) {
28
+  foreach ($fleets as $fleet_data) {
29 29
     $template->assign_block_vars($js_name, $fleet_data['fleet']);
30 30
 
31
-    if($fleet_data['ships']) {
32
-      foreach($fleet_data['ships'] as $ship_data) {
31
+    if ($fleet_data['ships']) {
32
+      foreach ($fleet_data['ships'] as $ship_data) {
33 33
         $template->assign_block_vars("{$js_name}.ships", $ship_data);
34 34
       }
35 35
     }
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
     'DEUTERIUM' => $fleet[RES_DEUTERIUM],
51 51
   );
52 52
 
53
-  foreach($fleet as $ship_id => $ship_amount) {
54
-    if(in_array($ship_id, sn_get_groups('fleet'))) {
53
+  foreach ($fleet as $ship_id => $ship_amount) {
54
+    if (in_array($ship_id, sn_get_groups('fleet'))) {
55 55
       $single_ship_data = get_ship_data($ship_id, $user_data);
56 56
       $return['ships'][$ship_id] = array(
57 57
         'ID'          => $ship_id,
@@ -90,11 +90,11 @@  discard block
 block discarded – undo
90 90
 
91 91
   $result = array();
92 92
 
93
-  if(!$user_data) {
93
+  if (!$user_data) {
94 94
     $user_data = $user;
95 95
   }
96 96
 
97
-  if(!$objFleet->isReturning() && $objFleet->mission_type == MT_ACS) {
97
+  if (!$objFleet->isReturning() && $objFleet->mission_type == MT_ACS) {
98 98
     $aks = db_acs_get_by_group_id($objFleet->group_id);
99 99
   }
100 100
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     'MISSION'      => $objFleet->mission_type,
114 114
     'MISSION_NAME' => classLocale::$lang['type_mission'][$objFleet->mission_type],
115 115
     'ACS'          => !empty($aks['name']) ? $aks['name'] : (!empty($objFleet->group_id) ? $objFleet->group_id : ''),
116
-    'AMOUNT'       => $spy_level >= 4 ? (pretty_number($objFleet->shipsGetTotal()) . (array_sum($fleet_resources) ? '+' : '')) : '?',
116
+    'AMOUNT'       => $spy_level >= 4 ? (pretty_number($objFleet->shipsGetTotal()).(array_sum($fleet_resources) ? '+' : '')) : '?',
117 117
 
118 118
     'METAL'     => $spy_level >= 8 ? $fleet_resources[RES_METAL] : 0,
119 119
     'CRYSTAL'   => $spy_level >= 8 ? $fleet_resources[RES_CRYSTAL] : 0,
@@ -135,14 +135,14 @@  discard block
 block discarded – undo
135 135
     'STAY_LEFT' => floor($objFleet->time_mission_job_complete + 1 - SN_TIME_NOW),
136 136
   );
137 137
 
138
-  if(property_exists($objFleet, 'fleet_start_name')) {
138
+  if (property_exists($objFleet, 'fleet_start_name')) {
139 139
     $result['START_NAME'] = $objFleet->fleet_start_name;
140 140
   }
141
-  if(property_exists($objFleet, 'fleet_end_name')) {
141
+  if (property_exists($objFleet, 'fleet_end_name')) {
142 142
     $result['END_NAME'] = $objFleet->fleet_end_name;
143 143
   }
144 144
 
145
-  if(property_exists($objFleet, 'event_time')) {
145
+  if (property_exists($objFleet, 'event_time')) {
146 146
     $result['fleet'] = array_merge($result['fleet'], array(
147 147
       'OV_LABEL'        => $objFleet->ov_label,
148 148
       'EVENT_TIME_TEXT' => property_exists($objFleet, 'event_time') ? date(FMT_DATE_TIME, $objFleet->event_time + SN_CLIENT_TIME_DIFF) : '',
@@ -155,9 +155,9 @@  discard block
 block discarded – undo
155 155
 
156 156
   $ship_id = 0;
157 157
   $result['ships'] = array();
158
-  if($spy_level >= 6) {
159
-    foreach($ship_list_fully_parsed as $ship_sn_id => $ship_amount) {
160
-      if($spy_level >= 10) {
158
+  if ($spy_level >= 6) {
159
+    foreach ($ship_list_fully_parsed as $ship_sn_id => $ship_amount) {
160
+      if ($spy_level >= 10) {
161 161
         $single_ship_data = get_ship_data($ship_sn_id, $user_data);
162 162
         $result['ships'][$ship_sn_id] = array(
163 163
           'ID'          => $ship_sn_id,
@@ -190,8 +190,8 @@  discard block
 block discarded – undo
190 190
 function tpl_parse_planet_que($que, $planet, $que_id) {
191 191
   $hangar_que = array();
192 192
   $que_hangar = $que['ques'][$que_id][$planet['id_owner']][$planet['id']];
193
-  if(!empty($que_hangar)) {
194
-    foreach($que_hangar as $que_item) {
193
+  if (!empty($que_hangar)) {
194
+    foreach ($que_hangar as $que_item) {
195 195
       $hangar_que['que'][] = array('id' => $que_item['que_unit_id'], 'count' => $que_item['que_unit_amount']);
196 196
       $hangar_que[$que_item['que_unit_id']] += $que_item['que_unit_amount'];
197 197
     }
@@ -251,10 +251,10 @@  discard block
 block discarded – undo
251 251
     'PLANET_GOVERNOR_LEVEL_MAX' => get_unit_param($planet['PLANET_GOVERNOR_ID'], P_MAX_STACK),
252 252
   );
253 253
 
254
-  if(!empty($que['ques'][QUE_STRUCTURES][$planet['id_owner']][$planet['id']])) {
254
+  if (!empty($que['ques'][QUE_STRUCTURES][$planet['id_owner']][$planet['id']])) {
255 255
     $result['building_que'] = array();
256 256
     $building_que = &$que['ques'][QUE_STRUCTURES][$planet['id_owner']][$planet['id']];
257
-    foreach($building_que as $que_element) {
257
+    foreach ($building_que as $que_element) {
258 258
       $result['building_que'][] = que_tpl_parse_element($que_element);
259 259
     }
260 260
   }
@@ -270,19 +270,19 @@  discard block
 block discarded – undo
270 270
 function flt_get_fleets_to_planet_by_array_of_Fleet($array_of_Fleet) {
271 271
   global $user;
272 272
 
273
-  if(empty($array_of_Fleet)) {
273
+  if (empty($array_of_Fleet)) {
274 274
     return false;
275 275
   }
276 276
 
277 277
   $fleet_list = array();
278
-  foreach($array_of_Fleet as $fleet) {
279
-    if($fleet->playerOwnerId == $user['id']) {
280
-      if($fleet->mission_type == MT_MISSILE) {
278
+  foreach ($array_of_Fleet as $fleet) {
279
+    if ($fleet->playerOwnerId == $user['id']) {
280
+      if ($fleet->mission_type == MT_MISSILE) {
281 281
         continue;
282 282
       }
283 283
       $fleet_ownage = 'own';
284 284
     } else {
285
-      switch($fleet->mission_type) {
285
+      switch ($fleet->mission_type) {
286 286
         case MT_ATTACK:
287 287
         case MT_ACS:
288 288
         case MT_DESTROY:
@@ -299,10 +299,10 @@  discard block
 block discarded – undo
299 299
 
300 300
     $fleet_list[$fleet_ownage]['fleets'][$fleet->dbId] = $fleet;
301 301
 
302
-    if($fleet->isReturning() || (!$fleet->isReturning() && $fleet->mission_type == MT_RELOCATE) || ($fleet->target_owner_id != $user['id'])) {
302
+    if ($fleet->isReturning() || (!$fleet->isReturning() && $fleet->mission_type == MT_RELOCATE) || ($fleet->target_owner_id != $user['id'])) {
303 303
       $fleet_sn = $fleet->shipsGetArray();
304
-      foreach($fleet_sn as $ship_id => $ship_amount) {
305
-        if(in_array($ship_id, sn_get_groups('fleet'))) {
304
+      foreach ($fleet_sn as $ship_id => $ship_amount) {
305
+        if (in_array($ship_id, sn_get_groups('fleet'))) {
306 306
           $fleet_list[$fleet_ownage]['total'][$ship_id] += $ship_amount;
307 307
         }
308 308
       }
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
   return $fleet_list;
320 320
 }
321 321
 
322
-function tpl_set_resource_info(template &$template, $planet_row, $fleets_to_planet = array(), $round = 0) {
322
+function tpl_set_resource_info(template & $template, $planet_row, $fleets_to_planet = array(), $round = 0) {
323 323
   $template->assign_vars(array(
324 324
     'RESOURCE_ROUNDING' => $round,
325 325
 
Please login to merge, or discard this patch.