Completed
Push — work-fleets ( 47cb39...a1ac53 )
by SuperNova.WS
05:19
created
includes/classes/Player.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -228,8 +228,8 @@  discard block
 block discarded – undo
228 228
    * @return int|mixed
229 229
    */
230 230
   public function calcColonyMaxCount($astrotech = -1) {
231
-    if($astrotech == -1) {
232
-      if(!isset($this->_dbRow[UNIT_PLAYER_COLONIES_MAX])) {
231
+    if ($astrotech == -1) {
232
+      if (!isset($this->_dbRow[UNIT_PLAYER_COLONIES_MAX])) {
233 233
 
234 234
         $expeditions = get_player_max_expeditons($this->_dbRow);
235 235
         $astrotech = mrc_get_level($this->_dbRow, null, TECH_ASTROTECH);
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 
303 303
 
304 304
   public function expeditionsMax() {
305
-    if($this->expeditionsMax === null) {
305
+    if ($this->expeditionsMax === null) {
306 306
       $this->expeditionsMax = get_player_max_expeditons($this->_dbRow);
307 307
     }
308 308
 
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
   }
311 311
 
312 312
   public function expeditionsFlying() {
313
-    if($this->expeditionsFlying === null) {
313
+    if ($this->expeditionsFlying === null) {
314 314
       $this->expeditionsFlying = FleetList::fleet_count_flying($this->_dbId, MT_EXPLORE);
315 315
     }
316 316
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 
320 320
 
321 321
   public function fleetsMax() {
322
-    if($this->fleetMax === null) {
322
+    if ($this->fleetMax === null) {
323 323
       $this->fleetMax = GetMaxFleets($this->_dbRow);
324 324
     }
325 325
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
   }
328 328
 
329 329
   public function fleetsFlying() {
330
-    if($this->fleetFlying === null) {
330
+    if ($this->fleetFlying === null) {
331 331
       $this->fleetFlying = FleetList::fleet_count_flying($this->_dbId);
332 332
     }
333 333
 
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 
337 337
 
338 338
   public function coloniesMax() {
339
-    if($this->coloniesMax === null) {
339
+    if ($this->coloniesMax === null) {
340 340
       $this->coloniesMax = get_player_max_colonies($this->_dbRow);
341 341
     }
342 342
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
   }
345 345
 
346 346
   public function coloniesCurrent() {
347
-    if($this->coloniesCurrent === null) {
347
+    if ($this->coloniesCurrent === null) {
348 348
       $this->coloniesCurrent = get_player_current_colonies($this->_dbRow);
349 349
     }
350 350
 
Please login to merge, or discard this patch.
includes/includes/flt_page5.inc 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 *
13 13
 **/
14 14
 
15
-if(SN_IN_FLEET !== true) {
15
+if (SN_IN_FLEET !== true) {
16 16
   $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403);
17 17
 }
18 18
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
   $planet_list = array();
27 27
 
28
-  if(is_array($resources_taken))
28
+  if (is_array($resources_taken))
29 29
   {
30 30
     $query = implode(',', array_keys($resources_taken));
31 31
     $query = " AND `destruyed` = 0 AND `id` IN ({$query})";
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
     $query = '';
34 34
   }
35 35
 
36
-  foreach(sn_get_groups('flt_transports') as $transport_id) {
36
+  foreach (sn_get_groups('flt_transports') as $transport_id) {
37 37
     $transports[$transport_id] = get_unit_param($transport_id, P_CAPACITY);
38 38
   }
39 39
   arsort($transports);
40 40
 
41 41
   $planets_db_list = db_planet_list_sorted($user, $planetrow['id'], '*', $query);
42 42
   !is_array($planets_db_list) ? $planets_db_list = array() : false;
43
-  foreach($planets_db_list as $planet_db_data) {
43
+  foreach ($planets_db_list as $planet_db_data) {
44 44
   // begin planet loop
45
-    if(!$query) {
45
+    if (!$query) {
46 46
       $resources_taken[$planet_db_data['id']] = 1;
47 47
     }
48 48
     sn_db_transaction_start();
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
     $planet_id = $planet_db_data['id'];
55 55
 
56 56
     $planet_resources = 0;
57
-    foreach(sn_get_groups('resources_loot') as $resource_id) {
58
-      if($resources_taken[$planet_id] == 1 || $resources_taken[$planet_id][$resource_id]) {
57
+    foreach (sn_get_groups('resources_loot') as $resource_id) {
58
+      if ($resources_taken[$planet_id] == 1 || $resources_taken[$planet_id][$resource_id]) {
59 59
         $planet_resources += floor(mrc_get_level($user, $planet_db_data, $resource_id, true, true)); // $planet_db_data[get_unit_param($resource_id, P_NAME)]);
60 60
       }
61 61
     }
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
     $fleet_capacity = 0;
87 87
     $ship_loadout = array();
88 88
     $fleet = array();
89
-    foreach($transports as $ship_id => $ship_capacity) {
90
-      if($ship_count = mrc_get_level($user, $planet_db_data, $ship_id, true, true)) {
89
+    foreach ($transports as $ship_id => $ship_capacity) {
90
+      if ($ship_count = mrc_get_level($user, $planet_db_data, $ship_id, true, true)) {
91 91
         $ship_loadout[$ship_id]['capacity'] = $ship_count * $ship_capacity;
92 92
         $ship_loadout[$ship_id]['taken'] = 0;
93 93
         $fleet_capacity += $ship_loadout[$ship_id]['capacity'];
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
 
99 99
     $will_take = min($planet_resources, $fleet_capacity);
100 100
 
101
-    foreach($ship_loadout as $ship_id => &$planet_ship) {
101
+    foreach ($ship_loadout as $ship_id => &$planet_ship) {
102 102
       $can_take = min($will_take, $planet_ship['capacity']);
103
-      if($can_take <= 0) {
103
+      if ($can_take <= 0) {
104 104
         continue;
105 105
       }
106 106
       $planet_ship['capacity'] -= $can_take;
@@ -108,23 +108,23 @@  discard block
 block discarded – undo
108 108
       $fleet[$ship_id] = ceil($planet_ship['taken'] / $transports[$ship_id]);
109 109
 
110 110
       $will_take -= $can_take;
111
-      if($will_take <= 0) {
111
+      if ($will_take <= 0) {
112 112
         break;
113 113
       }
114 114
     }
115 115
 
116
-    if(!empty($fleet)) {
116
+    if (!empty($fleet)) {
117 117
       $travel_data = flt_travel_data($user, $planetrow, $planet_db_data, $fleet, 10);
118 118
       $planet_data['FLEET_SPEED'] = $travel_data['fleet_speed'];
119 119
       $planet_data['DISTANCE']    = $travel_data['distance'];
120 120
       $planet_data['DURATION']    = $travel_data['duration'];
121 121
       $planet_data['CONSUMPTION'] = $travel_data['consumption'];
122 122
 
123
-      if(floor(mrc_get_level($user, $planet_db_data, RES_DEUTERIUM, true)) >= $planet_data['CONSUMPTION']) {
123
+      if (floor(mrc_get_level($user, $planet_db_data, RES_DEUTERIUM, true)) >= $planet_data['CONSUMPTION']) {
124 124
         $will_take = min($planet_resources, $fleet_capacity) - $planet_data['CONSUMPTION'];
125 125
 
126
-        foreach(sn_get_groups('resources_loot') as $resource_id) {
127
-          if($resources_taken[$planet_id] != 1 && !$resources_taken[$planet_id][$resource_id]) {
126
+        foreach (sn_get_groups('resources_loot') as $resource_id) {
127
+          if ($resources_taken[$planet_id] != 1 && !$resources_taken[$planet_id][$resource_id]) {
128 128
             continue;
129 129
           }
130 130
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
           $fleet[$resource_id] = min($will_take, $resource_amount);
134 134
           $will_take -= $resource_amount;
135 135
 
136
-          if($will_take <= 0) {
136
+          if ($will_take <= 0) {
137 137
             break;
138 138
           }
139 139
         }
@@ -157,19 +157,19 @@  discard block
 block discarded – undo
157 157
 
158 158
 $resources_taken = sys_get_param('resources');
159 159
 
160
-if(!empty($resources_taken))  { // begin processing parameters
160
+if (!empty($resources_taken)) { // begin processing parameters
161 161
   $planet_list = flt_build_gathering($resources_taken);
162 162
 
163
-  foreach($planet_list as $planet_id => $planet_data) {
164
-    if($planet_data['RESULT'] == FLIGHT_ALLOWED) {
163
+  foreach ($planet_list as $planet_id => $planet_data) {
164
+    if ($planet_data['RESULT'] == FLIGHT_ALLOWED) {
165 165
       $planet_data['RESULT'] = flt_t_send_fleet($user, $planet_data['PLANET_DB_DATA'], $planetrow, $planet_data['FLEET'], MT_TRANSPORT);
166 166
     }
167 167
 
168 168
     $planet_data['MESSAGE'] = classLocale::$lang['fl_attack_error'][$planet_data['RESULT']];
169 169
 
170 170
     $template->assign_block_vars('results', $planet_data);
171
-    if(!empty($planet_data['FLEET']) && $planet_data['RESULT'] == FLIGHT_ALLOWED) {
172
-      foreach($planet_data['FLEET'] as $unit_id => $amount) {
171
+    if (!empty($planet_data['FLEET']) && $planet_data['RESULT'] == FLIGHT_ALLOWED) {
172
+      foreach ($planet_data['FLEET'] as $unit_id => $amount) {
173 173
         $template->assign_block_vars('results.units', array(
174 174
           'ID'     => $unit_id,
175 175
           'NAME'   => classLocale::$lang['tech'][$unit_id],
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 
183 183
 // Building list of own planets & moons
184 184
 $planet_list = flt_build_gathering();
185
-foreach($planet_list as $planet_data) {
185
+foreach ($planet_list as $planet_data) {
186 186
   $planet_data['DURATION'] = $planet_data['DURATION'] ? pretty_time($planet_data['DURATION']) : classLocale::$lang['flt_no_fuel'];
187 187
   $template->assign_block_vars('colonies', $planet_data);
188 188
 }
Please login to merge, or discard this patch.
includes/general.php 2 patches
Doc Comments   +27 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 require_once('general_pname.php');
13 13
 
14 14
 /**
15
- * @param       $func_name
15
+ * @param       string $func_name
16 16
  * @param array $func_arg
17 17
  *
18 18
  * @return mixed
@@ -63,6 +63,9 @@  discard block
 block discarded – undo
63 63
 
64 64
 // ----------------------------------------------------------------------------------------------------------------
65 65
 // Fonction de lecture / ecriture / exploitation de templates
66
+/**
67
+ * @param string $filename
68
+ */
66 69
 function sys_file_read($filename) {
67 70
   return @file_get_contents($filename);
68 71
 }
@@ -105,7 +108,7 @@  discard block
 block discarded – undo
105 108
 /**
106 109
  * Получение курса обмены валюты в серверную валюту
107 110
  *
108
- * @param $currency_symbol
111
+ * @param string $currency_symbol
109 112
  *
110 113
  * @return float
111 114
  */
@@ -146,7 +149,7 @@  discard block
 block discarded – undo
146 149
  * @param float     $n
147 150
  * @param int|bool  $floor
148 151
  * @param int|bool  $color
149
- * @param int|bool  $limit
152
+ * @param boolean  $limit
150 153
  * @param bool|null $style
151 154
  *
152 155
  * @return array|float|string
@@ -247,6 +250,9 @@  discard block
 block discarded – undo
247 250
   return preg_replace($ListCensure, '*', $String);
248 251
 }
249 252
 
253
+/**
254
+ * @param string $email
255
+ */
250 256
 function is_email($email) {
251 257
   return (preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i", $email));
252 258
 }
@@ -283,6 +289,9 @@  discard block
 block discarded – undo
283 289
   return floatval(sys_get_param($param_name, $default));
284 290
 }
285 291
 
292
+/**
293
+ * @param string $param_name
294
+ */
286 295
 function sys_get_param_escaped($param_name, $default = '') {
287 296
   return db_escape(sys_get_param($param_name, $default));
288 297
 }
@@ -515,6 +524,9 @@  discard block
 block discarded – undo
515 524
 }
516 525
 
517 526
 // Generates random string of $length symbols from $allowed_chars charset
527
+/**
528
+ * @param string $allowed_chars
529
+ */
518 530
 function sys_random_string($length = 16, $allowed_chars = SN_SYS_SEC_CHARS_ALLOWED) {
519 531
   $allowed_length = strlen($allowed_chars);
520 532
 
@@ -619,6 +631,9 @@  discard block
 block discarded – undo
619 631
   return implode(';', $fleet_string);
620 632
 }
621 633
 
634
+/**
635
+ * @param string $body
636
+ */
622 637
 function mymail($email_unsafe, $title, $body, $from = '', $html = false) {
623 638
   $from = trim($from ? $from : classSupernova::$config->game_adminEmail);
624 639
 
@@ -873,6 +888,9 @@  discard block
 block discarded – undo
873 888
   return serialize($nick_array);
874 889
 }
875 890
 
891
+/**
892
+ * @param string $nick_string
893
+ */
876 894
 function player_nick_uncompact($nick_string) {
877 895
   try {
878 896
     $result = unserialize($nick_string);
@@ -1120,6 +1138,9 @@  discard block
 block discarded – undo
1120 1138
   return $ranks;
1121 1139
 }
1122 1140
 
1141
+/**
1142
+ * @param boolean $planet_id
1143
+ */
1123 1144
 function sys_player_new_adjust($user_id, $planet_id) { return sn_function_call(__FUNCTION__, array($user_id, $planet_id, &$result)); }
1124 1145
 
1125 1146
 function sn_sys_player_new_adjust($user_id, $planet_id, &$result) {
@@ -1430,6 +1451,9 @@  discard block
 block discarded – undo
1430 1451
   return version_compare(sn_version_compare_extra($ver1), sn_version_compare_extra($ver2));
1431 1452
 }
1432 1453
 
1454
+/**
1455
+ * @param string $name
1456
+ */
1433 1457
 function sn_setcookie($name, $value = null, $expire = null, $path = SN_ROOT_RELATIVE, $domain = null, $secure = null, $httponly = null) {
1434 1458
   $_COOKIE[$name] = $value;
1435 1459
 
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     }
37 37
   } else {
38 38
     // TODO: This is left for backward compatibility. Appropriate code should be rewrote!
39
-    $func_name = isset(classSupernova::$functions[$func_name]) && is_callable(classSupernova::$functions[$func_name]) ? classSupernova::$functions[$func_name] : ('sn_' . $func_name);
39
+    $func_name = isset(classSupernova::$functions[$func_name]) && is_callable(classSupernova::$functions[$func_name]) ? classSupernova::$functions[$func_name] : ('sn_'.$func_name);
40 40
     if (is_callable($func_name)) {
41 41
       $result = call_user_func_array($func_name, $func_arg);
42 42
     }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
  */
112 112
 function get_exchange_rate($currency_symbol) {
113 113
   $currency_symbol = strtolower($currency_symbol);
114
-  $config_field = 'payment_currency_exchange_' . $currency_symbol;
114
+  $config_field = 'payment_currency_exchange_'.$currency_symbol;
115 115
 
116 116
   // Заворачиваем получение стоимости ММ через перекрываемую процедуру
117 117
   $exchange_rate = floatval($currency_symbol == 'mm_' ? get_mm_cost() : classSupernova::$config->$config_field);
@@ -623,8 +623,8 @@  discard block
 block discarded – undo
623 623
   $from = trim($from ? $from : classSupernova::$config->game_adminEmail);
624 624
 
625 625
   $head = '';
626
-  $head .= "Content-Type: text/" . ($html ? 'html' : 'plain') . "; charset=utf-8 \r\n";
627
-  $head .= "Date: " . date('r') . " \r\n";
626
+  $head .= "Content-Type: text/".($html ? 'html' : 'plain')."; charset=utf-8 \r\n";
627
+  $head .= "Date: ".date('r')." \r\n";
628 628
   $classConfig = classSupernova::$config;
629 629
   $head .= "Return-Path: {$classConfig->game_adminEmail} \r\n";
630 630
   $head .= "From: {$from} \r\n";
@@ -637,10 +637,10 @@  discard block
 block discarded – undo
637 637
   $body = str_replace("\n", "\r\n", $body);
638 638
 
639 639
   if ($html) {
640
-    $body = '<html><head><base href="' . SN_ROOT_VIRTUAL . '"></head><body>' . nl2br($body) . '</body></html>';
640
+    $body = '<html><head><base href="'.SN_ROOT_VIRTUAL.'"></head><body>'.nl2br($body).'</body></html>';
641 641
   }
642 642
 
643
-  $title = '=?UTF-8?B?' . base64_encode($title) . '?=';
643
+  $title = '=?UTF-8?B?'.base64_encode($title).'?=';
644 644
 
645 645
   return @mail($email_unsafe, $title, $body, $head);
646 646
 }
@@ -656,14 +656,14 @@  discard block
 block discarded – undo
656 656
   $classLocale = classLocale::$lang;
657 657
 
658 658
   return
659
-    ($full || $time ? "{$time} {$classLocale['sys_day']}&nbsp;" : '') .
660
-    ($full || $hours ? "{$hours} {$classLocale['sys_hrs']}&nbsp;" : '') .
661
-    ($full || $minutes ? "{$minutes} {$classLocale['sys_min']}&nbsp;" : '') .
659
+    ($full || $time ? "{$time} {$classLocale['sys_day']}&nbsp;" : '').
660
+    ($full || $hours ? "{$hours} {$classLocale['sys_hrs']}&nbsp;" : '').
661
+    ($full || $minutes ? "{$minutes} {$classLocale['sys_min']}&nbsp;" : '').
662 662
     ($full || !$time || $seconds ? "{$seconds} {$classLocale['sys_sec']}" : '');
663 663
 }
664 664
 
665 665
 function sys_time_human_system($time) {
666
-  return $time ? date(FMT_DATE_TIME_SQL, $time) . " ({$time}), " . sys_time_human(SN_TIME_NOW - $time) : '{NEVER}';
666
+  return $time ? date(FMT_DATE_TIME_SQL, $time)." ({$time}), ".sys_time_human(SN_TIME_NOW - $time) : '{NEVER}';
667 667
 }
668 668
 
669 669
 function sys_redirect($url) {
@@ -756,13 +756,13 @@  discard block
 block discarded – undo
756 756
       // usw..
757 757
     );
758 758
 
759
-    $rexep = "#" . strtr(preg_quote($format), $masks) . "#";
759
+    $rexep = "#".strtr(preg_quote($format), $masks)."#";
760 760
     if (preg_match($rexep, $date, $out)) {
761 761
       $ret = array(
762
-        "tm_sec"  => (int)$out['S'],
763
-        "tm_min"  => (int)$out['M'],
764
-        "tm_hour" => (int)$out['H'],
765
-        "tm_mday" => (int)$out['d'],
762
+        "tm_sec"  => (int) $out['S'],
763
+        "tm_min"  => (int) $out['M'],
764
+        "tm_hour" => (int) $out['H'],
765
+        "tm_mday" => (int) $out['d'],
766 766
         "tm_mon"  => $out['m'] ? $out['m'] - 1 : 0,
767 767
         "tm_year" => $out['Y'] > 1900 ? $out['Y'] - 1900 : 0,
768 768
       );
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
         $functions[$function_name] = array();
833 833
       } elseif (!isset($functions[$function_name])) {
834 834
         $functions[$function_name] = array();
835
-        $sn_function_name = 'sn_' . $function_name . ($sub_type ? '_' . $sub_type : '');
835
+        $sn_function_name = 'sn_'.$function_name.($sub_type ? '_'.$sub_type : '');
836 836
         $functions[$function_name][] = $sn_function_name;
837 837
       }
838 838
 
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
   }
900 900
 
901 901
   if (isset($nick_array[NICK_GENDER])) {
902
-    $result[NICK_GENDER] = '<img src="' . ($user['dpath'] ? $user['dpath'] : DEFAULT_SKINPATH) . 'images/gender_' . $nick_array[NICK_GENDER] . '.png" />';
902
+    $result[NICK_GENDER] = '<img src="'.($user['dpath'] ? $user['dpath'] : DEFAULT_SKINPATH).'images/gender_'.$nick_array[NICK_GENDER].'.png" />';
903 903
   }
904 904
 
905 905
   if (isset($nick_array[NICK_AUTH_LEVEL]) || isset($nick_array[NICK_PREMIUM])) {
@@ -931,14 +931,14 @@  discard block
 block discarded – undo
931 931
   }
932 932
 
933 933
   if (isset($nick_array[NICK_CLASS])) {
934
-    $result[NICK_CLASS] = '<span ' . $nick_array[NICK_CLASS] . '>';
934
+    $result[NICK_CLASS] = '<span '.$nick_array[NICK_CLASS].'>';
935 935
     $result[NICK_CLASS_END] = '</span>';
936 936
   }
937 937
 
938 938
   $result[NICK_NICK] = sys_safe_output($nick_array[NICK_NICK]);
939 939
 
940 940
   if (isset($nick_array[NICK_ALLY])) {
941
-    $result[NICK_ALLY] = '[' . sys_safe_output($nick_array[NICK_ALLY]) . ']';
941
+    $result[NICK_ALLY] = '['.sys_safe_output($nick_array[NICK_ALLY]).']';
942 942
   }
943 943
 
944 944
   $result[NICK_HTML] = true;
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
   */
962 962
 
963 963
 
964
-  if ($render_user['user_birthday'] && ($options === true || isset($options['icons']) || isset($options['birthday'])) && (date('Y', SN_TIME_NOW) . date('-m-d', strtotime($render_user['user_birthday'])) == date('Y-m-d', SN_TIME_NOW))) {
964
+  if ($render_user['user_birthday'] && ($options === true || isset($options['icons']) || isset($options['birthday'])) && (date('Y', SN_TIME_NOW).date('-m-d', strtotime($render_user['user_birthday'])) == date('Y-m-d', SN_TIME_NOW))) {
965 965
     $result[NICK_BIRTHSDAY] = '';
966 966
   }
967 967
 
@@ -983,7 +983,7 @@  discard block
 block discarded – undo
983 983
   }
984 984
 
985 985
   if ((isset($options['class']) && $options['class'])) {
986
-    $result[NICK_CLASS] = (isset($result_options[NICK_CLASS]) ? ' ' . $result_options[NICK_CLASS] : '') . $options['class'];
986
+    $result[NICK_CLASS] = (isset($result_options[NICK_CLASS]) ? ' '.$result_options[NICK_CLASS] : '').$options['class'];
987 987
   }
988 988
 
989 989
   if ($render_user['ally_tag'] && ($options === true || (isset($options['ally']) && $options['ally']))) {
@@ -1011,7 +1011,7 @@  discard block
 block discarded – undo
1011 1011
     foreach ($temp as $user_id) {
1012 1012
       $user_id = floatval($user_id);
1013 1013
       if ($user_id) {
1014
-        $user_skip_list[] = '`id` = ' . $user_id;
1014
+        $user_skip_list[] = '`id` = '.$user_id;
1015 1015
       }
1016 1016
     }
1017 1017
   }
@@ -1410,7 +1410,7 @@  discard block
 block discarded – undo
1410 1410
     $time_left = min(floor($time_left / PERIOD_DAY), $term_original);
1411 1411
     $cost_left = $term_original > 0 ? ceil($time_left / $term_original * $original_cost) : 0;
1412 1412
 
1413
-    array_walk_recursive($result, function (&$value) use ($cost_left) {
1413
+    array_walk_recursive($result, function(&$value) use ($cost_left) {
1414 1414
       $value -= $cost_left;
1415 1415
     });
1416 1416
   }
@@ -1465,7 +1465,7 @@  discard block
 block discarded – undo
1465 1465
 }
1466 1466
 
1467 1467
 function print_rr($var, $capture = false) {
1468
-  $print = '<pre>' . htmlspecialchars(print_r($var, true)) . '</pre>';
1468
+  $print = '<pre>'.htmlspecialchars(print_r($var, true)).'</pre>';
1469 1469
   if ($capture) {
1470 1470
     return $print;
1471 1471
   } else {
@@ -1567,7 +1567,7 @@  discard block
 block discarded – undo
1567 1567
       break;
1568 1568
     }
1569 1569
     $sort_option_inverse_closure = $sort_option_inverse ? -1 : 1;
1570
-    usort($ListToSort, function ($a, $b) use ($sort_option_field, $sort_option_inverse_closure) {
1570
+    usort($ListToSort, function($a, $b) use ($sort_option_field, $sort_option_inverse_closure) {
1571 1571
       return $a[$sort_option_field] < $b[$sort_option_field] ? -1 * $sort_option_inverse_closure : (
1572 1572
       $a[$sort_option_field] > $b[$sort_option_field] ? 1 * $sort_option_inverse_closure : 0
1573 1573
       );
Please login to merge, or discard this patch.
includes/vars.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -333,26 +333,26 @@  discard block
 block discarded – undo
333 333
     // Each mission will filter only necessary checks and do it in this order
334 334
     'mission_checks' => array(
335 335
       // Cheap checks - class Fleet already have all this info internally
336
-      'checkSenderNoVacation'        => FLIGHT_PLAYER_VACATION_OWN,                           //+
337
-      'checkTargetNoVacation'        => FLIGHT_PLAYER_VACATION,                                  //+
338
-      'checkFleetNotEmpty'           => FLIGHT_SHIPS_NO_SHIPS,                                //+
336
+      'checkSenderNoVacation'        => FLIGHT_PLAYER_VACATION_OWN, //+
337
+      'checkTargetNoVacation'        => FLIGHT_PLAYER_VACATION, //+
338
+      'checkFleetNotEmpty'           => FLIGHT_SHIPS_NO_SHIPS, //+
339 339
       // FLIGHT_MISSION_UNKNOWN
340 340
       // FLIGHT_RESOURCES_FORBIDDEN
341
-      'checkSpeedPercentOld'         => FLIGHT_FLEET_SPEED_WRONG,                             //+
342
-      'checkTargetNotSource'         => FLIGHT_VECTOR_SAME_SOURCE,                            //+
341
+      'checkSpeedPercentOld'         => FLIGHT_FLEET_SPEED_WRONG, //+
342
+      'checkTargetNotSource'         => FLIGHT_VECTOR_SAME_SOURCE, //+
343 343
       'checkTargetInUniverse'        => FLIGHT_VECTOR_BEYOND_UNIVERSE,
344
-      'checkUnitsPositive'           => FLIGHT_SHIPS_NEGATIVE,                                //+
344
+      'checkUnitsPositive'           => FLIGHT_SHIPS_NEGATIVE, //+
345 345
       'checkOnlyFleetUnits'          => FLIGHT_SHIPS_UNIT_WRONG,
346
-      'checkOnlyFlyingUnits'         => FLIGHT_SHIPS_UNMOVABLE,                               //+
347
-      'checkResourcesPositive'       => FLIGHT_RESOURCES_NEGATIVE,                            //+
348
-      'checkNotTooFar'               => FLIGHT_FLEET_TOO_FAR,                                //+
349
-      'checkEnoughCapacity'          => FLIGHT_FLEET_OVERLOAD,                                //+
346
+      'checkOnlyFlyingUnits'         => FLIGHT_SHIPS_UNMOVABLE, //+
347
+      'checkResourcesPositive'       => FLIGHT_RESOURCES_NEGATIVE, //+
348
+      'checkNotTooFar'               => FLIGHT_FLEET_TOO_FAR, //+
349
+      'checkEnoughCapacity'          => FLIGHT_FLEET_OVERLOAD, //+
350 350
       // Medium checks - currently requires access to DB but potentially doesn't
351
-      'checkSourceEnoughShips'       => FLIGHT_SHIPS_NOT_ENOUGH,                              //+
352
-      'checkSourceEnoughFuel'        => FLIGHT_RESOURCES_FUEL_NOT_ENOUGH,                     //+
353
-      'checkSourceEnoughResources'   => FLIGHT_RESOURCES_NOT_ENOUGH,                          //+
351
+      'checkSourceEnoughShips'       => FLIGHT_SHIPS_NOT_ENOUGH, //+
352
+      'checkSourceEnoughFuel'        => FLIGHT_RESOURCES_FUEL_NOT_ENOUGH, //+
353
+      'checkSourceEnoughResources'   => FLIGHT_RESOURCES_NOT_ENOUGH, //+
354 354
       // Heavy checks - will absolutely require DB access
355
-      'checkEnoughFleetSlots'        => FLIGHT_FLEET_NO_SLOTS,                                //+
355
+      'checkEnoughFleetSlots'        => FLIGHT_FLEET_NO_SLOTS, //+
356 356
 
357 357
       // Vector targeting space beyond MaxPlanet forces MT_EXPLORE mission
358 358
       'checkKnownSpace'              => array(
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
           'checkNotOnlySpies'   => FLIGHT_SHIPS_NOT_ONLY_SPIES,
363 363
           'checkNoMissiles'     => FLIGHT_SHIPS_NO_MISSILES,
364 364
           'forceMissionExplore' => array(
365
-            true  => FLIGHT_ALLOWED,                                                         //+
365
+            true  => FLIGHT_ALLOWED, //+
366 366
             false => FLIGHT_VECTOR_BEYOND_SYSTEM,
367 367
           ),
368 368
         ),
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
           'checkNoMissiles'      => FLIGHT_SHIPS_NO_MISSILES,
378 378
           'checkTargetIsPlanet'  => FLIGHT_MISSION_COLONIZE_NOT_PLANET,
379 379
           'forceMissionColonize' => array(
380
-            true  => FLIGHT_ALLOWED,                                                         //+
380
+            true  => FLIGHT_ALLOWED, //+
381 381
             false => FLIGHT_VECTOR_NO_TARGET,
382 382
           ),
383 383
         ),
@@ -388,11 +388,11 @@  discard block
 block discarded – undo
388 388
       'checkTargetIsDebris'          => array(
389 389
         true => array(
390 390
           // Recycle mission checks
391
-          'checkHaveRecyclers'  => FLIGHT_SHIPS_NO_RECYCLERS,             //+
391
+          'checkHaveRecyclers'  => FLIGHT_SHIPS_NO_RECYCLERS, //+
392 392
           'checkNoMissiles'     => FLIGHT_SHIPS_NO_MISSILES,
393
-          'checkDebrisExists'   => FLIGHT_MISSION_RECYCLE_NO_DEBRIS,    //+
393
+          'checkDebrisExists'   => FLIGHT_MISSION_RECYCLE_NO_DEBRIS, //+
394 394
           'forceMissionRecycle' => array(
395
-            true  => FLIGHT_ALLOWED,                                                                           //+
395
+            true  => FLIGHT_ALLOWED, //+
396 396
             false => FLIGHT_VECTOR_TARGET_DEBRIS,
397 397
           ),
398 398
         ),
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
 
489 489
 
490 490
       // Check for multiaccount
491
-      'checkMultiAccount'            => FLIGHT_PLAYER_SAME_IP,                                  //+
491
+      'checkMultiAccount'            => FLIGHT_PLAYER_SAME_IP, //+
492 492
       // TODO - check for moratorium
493 493
 
494 494
 
Please login to merge, or discard this patch.
includes/classes/Fleet.php 2 patches
Doc Comments   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
   /**
973 973
    * Set current resource list from array of units
974 974
    *
975
-   * @param array $resource_list
975
+   * @param integer[] $resource_list
976 976
    */
977 977
   public function resourcesSet($resource_list) {
978 978
     if (!empty($this->propertiesAdjusted['resource_list'])) {
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
   }
1021 1021
 
1022 1022
   /**
1023
-   * @param array $rate
1023
+   * @param integer[] $rate
1024 1024
    *
1025 1025
    * @return float
1026 1026
    */
@@ -1051,7 +1051,6 @@  discard block
 block discarded – undo
1051 1051
    * Restores fleet or resources to planet
1052 1052
    *
1053 1053
    * @param bool $start
1054
-   * @param bool $only_resources
1055 1054
    * @param int  $result
1056 1055
    *
1057 1056
    * @return int
@@ -1205,6 +1204,9 @@  discard block
 block discarded – undo
1205 1204
   }
1206 1205
 
1207 1206
 
1207
+  /**
1208
+   * @param integer $missionStartTimeStamp
1209
+   */
1208 1210
   protected function renderFleetCoordinates($missionStartTimeStamp = SN_TIME_NOW, $timeMissionJob = 0) {
1209 1211
     $timeToReturn = $this->travelData['duration'] * 2 + $timeMissionJob;
1210 1212
 
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -397,31 +397,31 @@  discard block
 block discarded – undo
397 397
 
398 398
     return doquery(
399 399
     // Блокировка самого флота
400
-      "SELECT 1 FROM {{fleets}} AS f " .
400
+      "SELECT 1 FROM {{fleets}} AS f ".
401 401
 
402 402
       // Блокировка всех юнитов, принадлежащих этому флоту
403
-      "LEFT JOIN {{unit}} as unit ON unit.unit_location_type = " . static::$locationType . " AND unit.unit_location_id = f.fleet_id " .
403
+      "LEFT JOIN {{unit}} as unit ON unit.unit_location_type = ".static::$locationType." AND unit.unit_location_id = f.fleet_id ".
404 404
 
405 405
       // Блокировка всех прилетающих и улетающих флотов, если нужно
406 406
       // TODO - lock fleets by COORDINATES
407
-      ($mission_data['dst_fleets'] ? "LEFT JOIN {{fleets}} AS fd ON fd.fleet_end_planet_id = f.fleet_end_planet_id OR fd.fleet_start_planet_id = f.fleet_end_planet_id " : '') .
407
+      ($mission_data['dst_fleets'] ? "LEFT JOIN {{fleets}} AS fd ON fd.fleet_end_planet_id = f.fleet_end_planet_id OR fd.fleet_start_planet_id = f.fleet_end_planet_id " : '').
408 408
       // Блокировка всех юнитов, принадлежащих прилетающим и улетающим флотам - ufd = unit_fleet_destination
409
-      ($mission_data['dst_fleets'] ? "LEFT JOIN {{unit}} AS ufd ON ufd.unit_location_type = " . static::$locationType . " AND ufd.unit_location_id = fd.fleet_id " : '') .
409
+      ($mission_data['dst_fleets'] ? "LEFT JOIN {{unit}} AS ufd ON ufd.unit_location_type = ".static::$locationType." AND ufd.unit_location_id = fd.fleet_id " : '').
410 410
 
411
-      ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{users}} AS ud ON ud.id = f.fleet_target_owner " : '') .
411
+      ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{users}} AS ud ON ud.id = f.fleet_target_owner " : '').
412 412
       // Блокировка всех юнитов, принадлежащих владельцу планеты-цели
413
-      ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS unit_player_dest ON unit_player_dest.unit_player_id = ud.id " : '') .
413
+      ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS unit_player_dest ON unit_player_dest.unit_player_id = ud.id " : '').
414 414
       // Блокировка планеты-цели
415
-      ($mission_data['dst_planet'] ? "LEFT JOIN {{planets}} AS pd ON pd.id = f.fleet_end_planet_id " : '') .
415
+      ($mission_data['dst_planet'] ? "LEFT JOIN {{planets}} AS pd ON pd.id = f.fleet_end_planet_id " : '').
416 416
       // Блокировка всех юнитов, принадлежащих планете-цели - НЕ НУЖНО. Уже залочили ранее, как принадлежащие игроку-цели
417 417
 //      ($mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS upd ON upd.unit_location_type = " . LOC_PLANET . " AND upd.unit_location_id = pd.id " : '') .
418 418
 
419 419
 
420
-      ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{users}} AS us ON us.id = f.fleet_owner " : '') .
420
+      ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{users}} AS us ON us.id = f.fleet_owner " : '').
421 421
       // Блокировка всех юнитов, принадлежащих владельцу флота
422
-      ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS unit_player_src ON unit_player_src.unit_player_id = us.id " : '') .
422
+      ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS unit_player_src ON unit_player_src.unit_player_id = us.id " : '').
423 423
       // Блокировка планеты отправления
424
-      ($mission_data['src_planet'] ? "LEFT JOIN {{planets}} AS ps ON ps.id = f.fleet_start_planet_id " : '') .
424
+      ($mission_data['src_planet'] ? "LEFT JOIN {{planets}} AS ps ON ps.id = f.fleet_start_planet_id " : '').
425 425
       // Блокировка всех юнитов, принадлежащих планете с которой юниты были отправлены - НЕ НУЖНО. Уже залочили ранее, как принадлежащие владельцу флота
426 426
 //      ($mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS ups ON ups.unit_location_type = " . LOC_PLANET . " AND ups.unit_location_id = ps.id " : '') .
427 427
 
@@ -438,11 +438,11 @@  discard block
 block discarded – undo
438 438
   public function dbGetLockById($dbId) {
439 439
     doquery(
440 440
     // Блокировка самого флота
441
-      "SELECT 1 FROM {{fleets}} AS FLEET0 " .
441
+      "SELECT 1 FROM {{fleets}} AS FLEET0 ".
442 442
       // Lock fleet owner
443
-      "LEFT JOIN {{users}} as USER0 on USER0.id = FLEET0.fleet_owner " .
443
+      "LEFT JOIN {{users}} as USER0 on USER0.id = FLEET0.fleet_owner ".
444 444
       // Блокировка всех юнитов, принадлежащих этому флоту
445
-      "LEFT JOIN {{unit}} as UNIT0 ON UNIT0.unit_location_type = " . LOC_FLEET . " AND UNIT0.unit_location_id = FLEET0.fleet_id " .
445
+      "LEFT JOIN {{unit}} as UNIT0 ON UNIT0.unit_location_type = ".LOC_FLEET." AND UNIT0.unit_location_id = FLEET0.fleet_id ".
446 446
 
447 447
       // Без предварительной выборки неизвестно - куда летит этот флот.
448 448
       // Поэтому надо выбирать флоты, чьи координаты прибытия ИЛИ отбытия совпадают с координатами прибытия ИЛИ отбытия текущего флота.
@@ -458,9 +458,9 @@  discard block
 block discarded – undo
458 458
         FLEET1.fleet_end_planet = FLEET0.fleet_end_planet
459 459
       " .
460 460
       // Блокировка всех юнитов, принадлежащих этим флотам
461
-      "LEFT JOIN {{unit}} as UNIT1 ON UNIT1.unit_location_type = " . LOC_FLEET . " AND UNIT1.unit_location_id = FLEET1.fleet_id " .
461
+      "LEFT JOIN {{unit}} as UNIT1 ON UNIT1.unit_location_type = ".LOC_FLEET." AND UNIT1.unit_location_id = FLEET1.fleet_id ".
462 462
       // Lock fleet owner
463
-      "LEFT JOIN {{users}} as USER1 on USER1.id = FLEET1.fleet_owner " .
463
+      "LEFT JOIN {{users}} as USER1 on USER1.id = FLEET1.fleet_owner ".
464 464
 
465 465
       "LEFT JOIN {{fleets}} AS FLEET2 ON
466 466
         FLEET2.fleet_mess = 1   AND FLEET0.fleet_mess = 0 AND
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
       " .
471 471
       // Блокировка всех юнитов, принадлежащих этим флотам
472 472
       "LEFT JOIN {{unit}} as UNIT2 ON
473
-        UNIT2.unit_location_type = " . LOC_FLEET . " AND
473
+        UNIT2.unit_location_type = " . LOC_FLEET." AND
474 474
         UNIT2.unit_location_id = FLEET2.fleet_id
475 475
       " .
476 476
       // Lock fleet owner
@@ -487,11 +487,11 @@  discard block
 block discarded – undo
487 487
       " .
488 488
       // Блокировка всех юнитов, принадлежащих этим флотам
489 489
       "LEFT JOIN {{unit}} as UNIT3 ON
490
-        UNIT3.unit_location_type = " . LOC_FLEET . " AND
490
+        UNIT3.unit_location_type = " . LOC_FLEET." AND
491 491
         UNIT3.unit_location_id = FLEET3.fleet_id
492 492
       " .
493 493
       // Lock fleet owner
494
-      "LEFT JOIN {{users}} as USER3 on USER3.id = FLEET3.fleet_owner " .
494
+      "LEFT JOIN {{users}} as USER3 on USER3.id = FLEET3.fleet_owner ".
495 495
 
496 496
       "LEFT JOIN {{fleets}} AS FLEET4 ON
497 497
         FLEET4.fleet_mess = 1   AND FLEET0.fleet_mess = 1 AND
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
       " .
502 502
       // Блокировка всех юнитов, принадлежащих этим флотам
503 503
       "LEFT JOIN {{unit}} as UNIT4 ON
504
-        UNIT4.unit_location_type = " . LOC_FLEET . " AND
504
+        UNIT4.unit_location_type = " . LOC_FLEET." AND
505 505
         UNIT4.unit_location_id = FLEET4.fleet_id
506 506
       " .
507 507
       // Lock fleet owner
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
       " .
524 524
       // Блокировка всех юнитов, принадлежащих этой планете
525 525
       "LEFT JOIN {{unit}} as UNIT5 ON
526
-        UNIT5.unit_location_type = " . LOC_PLANET . " AND
526
+        UNIT5.unit_location_type = " . LOC_PLANET." AND
527 527
         UNIT5.unit_location_id = PLANETS5.id
528 528
       " .
529 529
 
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
       " .
542 542
       // Блокировка всех юнитов, принадлежащих этой планете
543 543
       "LEFT JOIN {{unit}} as UNIT6 ON
544
-        UNIT6.unit_location_type = " . LOC_PLANET . " AND
544
+        UNIT6.unit_location_type = " . LOC_PLANET." AND
545 545
         UNIT6.unit_location_id = PLANETS6.id
546 546
       " .
547 547
       "WHERE FLEET0.fleet_id = {$dbId} GROUP BY 1 FOR UPDATE"
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
       } elseif ($this->isResource($unit_id)) {
661 661
         $this->resource_list[$unit_id] = $unit_count;
662 662
       } else {
663
-        throw new Exception('Trying to pass to fleet non-resource and non-ship ' . var_export($unit_array, true), ERR_ERROR);
663
+        throw new Exception('Trying to pass to fleet non-resource and non-ship '.var_export($unit_array, true), ERR_ERROR);
664 664
       }
665 665
     }
666 666
   }
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
    */
986 986
   public function resourcesSet($resource_list) {
987 987
     if (!empty($this->propertiesAdjusted['resource_list'])) {
988
-      throw new PropertyAccessException('Property "resource_list" already was adjusted so no SET is possible until dbSave in ' . get_called_class() . '::unitSetResourceList', ERR_ERROR);
988
+      throw new PropertyAccessException('Property "resource_list" already was adjusted so no SET is possible until dbSave in '.get_called_class().'::unitSetResourceList', ERR_ERROR);
989 989
     }
990 990
     $this->resourcesAdjust($resource_list, true);
991 991
   }
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
       // Check for negative unit value
1020 1020
       if ($this->resource_list[$resource_id] < 0) {
1021 1021
         // TODO
1022
-        throw new Exception('Resource ' . $resource_id . ' will become negative in ' . get_called_class() . '::unitAdjustResourceList', ERR_ERROR);
1022
+        throw new Exception('Resource '.$resource_id.' will become negative in '.get_called_class().'::unitAdjustResourceList', ERR_ERROR);
1023 1023
       }
1024 1024
     }
1025 1025
   }
@@ -1190,7 +1190,7 @@  discard block
 block discarded – undo
1190 1190
 
1191 1191
   protected function printErrorIfNoShips() {
1192 1192
     if ($this->unitList->unitsCount() <= 0) {
1193
-      message(classLocale::$lang['fl_err_no_ships'], classLocale::$lang['fl_error'], 'fleet' . DOT_PHP_EX, 5);
1193
+      message(classLocale::$lang['fl_err_no_ships'], classLocale::$lang['fl_error'], 'fleet'.DOT_PHP_EX, 5);
1194 1194
     }
1195 1195
   }
1196 1196
 
@@ -1637,7 +1637,7 @@  discard block
 block discarded – undo
1637 1637
 
1638 1638
     if ($errorlist) {
1639 1639
       sn_db_transaction_rollback();
1640
-      message("<span class='error'><ul>{$errorlist}</ul></span>", classLocale::$lang['fl_error'], 'fleet' . DOT_PHP_EX, false);
1640
+      message("<span class='error'><ul>{$errorlist}</ul></span>", classLocale::$lang['fl_error'], 'fleet'.DOT_PHP_EX, false);
1641 1641
     }
1642 1642
 
1643 1643
     //Normally... unless its acs...
@@ -1669,7 +1669,7 @@  discard block
 block discarded – undo
1669 1669
     if ($this->_mission_type == MT_ACS && $aks) {
1670 1670
       $acsTimeToArrive = $aks['ankunft'] - SN_TIME_NOW;
1671 1671
       if ($acsTimeToArrive < $this->travelData['duration']) {
1672
-        message(classLocale::$lang['fl_aks_too_slow'] . 'Fleet arrival: ' . date(FMT_DATE_TIME, SN_TIME_NOW + $this->travelData['duration']) . " AKS arrival: " . date(FMT_DATE_TIME, $aks['ankunft']), classLocale::$lang['fl_error']);
1672
+        message(classLocale::$lang['fl_aks_too_slow'].'Fleet arrival: '.date(FMT_DATE_TIME, SN_TIME_NOW + $this->travelData['duration'])." AKS arrival: ".date(FMT_DATE_TIME, $aks['ankunft']), classLocale::$lang['fl_error']);
1673 1673
       }
1674 1674
       // Set time to travel to ACS' TTT
1675 1675
       $this->travelData['duration'] = $acsTimeToArrive;
@@ -1711,14 +1711,14 @@  discard block
 block discarded – undo
1711 1711
 
1712 1712
 
1713 1713
     if (!empty($captain['unit_id'])) {
1714
-      db_unit_set_by_id($captain['unit_id'], "`unit_location_type` = " . LOC_FLEET . ", `unit_location_id` = {$this->_dbId}");
1714
+      db_unit_set_by_id($captain['unit_id'], "`unit_location_type` = ".LOC_FLEET.", `unit_location_id` = {$this->_dbId}");
1715 1715
     }
1716 1716
 
1717 1717
 
1718 1718
     $template_result['.']['fleets'][] = $this->renderFleet(SN_TIME_NOW, $timeMissionJob);
1719 1719
 
1720 1720
     $template_result += array(
1721
-      'mission'         => classLocale::$lang['type_mission'][$this->_mission_type] . ($this->_mission_type == MT_EXPLORE || $this->_mission_type == MT_HOLD ? ' ' . pretty_time($timeMissionJob) : ''),
1721
+      'mission'         => classLocale::$lang['type_mission'][$this->_mission_type].($this->_mission_type == MT_EXPLORE || $this->_mission_type == MT_HOLD ? ' '.pretty_time($timeMissionJob) : ''),
1722 1722
       'dist'            => pretty_number($this->travelData['distance']),
1723 1723
       'speed'           => pretty_number($this->travelData['fleet_speed']),
1724 1724
       'deute_need'      => pretty_number($this->travelData['consumption']),
Please login to merge, or discard this patch.
includes/classes/FleetValidator.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -190,8 +190,8 @@
 block discarded – undo
190 190
 
191 191
 
192 192
     /**
193
-   * @return bool
194
-   */
193
+     * @return bool
194
+     */
195 195
   protected function checkEnoughCapacity($includeResources = true) {
196 196
     $checkVia = $this->fleet->travelData['consumption'];
197 197
     $checkVia = ceil(($includeResources ? array_sum($this->fleet->resource_list) : 0) + $checkVia);
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -802,7 +802,7 @@
 block discarded – undo
802 802
    * @return bool
803 803
    */
804 804
   protected function checkCaptainNotRelocating() {
805
-    if($this->fleet->mission_type == MT_RELOCATE) {
805
+    if ($this->fleet->mission_type == MT_RELOCATE) {
806 806
       $arriving_captain = mrc_get_level($this->fleet->dbOwnerRow, $this->fleet->dbTargetRow, UNIT_CAPTAIN, true);
807 807
     } else {
808 808
       $arriving_captain = false;
Please login to merge, or discard this patch.
includes/debug.class.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -70,6 +70,9 @@  discard block
 block discarded – undo
70 70
     $this->numqueries = 0;
71 71
   }
72 72
 
73
+  /**
74
+   * @param string $mes
75
+   */
73 76
   function add($mes) {
74 77
     $this->log .= $mes;
75 78
     $this->numqueries++;
@@ -185,6 +188,9 @@  discard block
 block discarded – undo
185 188
     return $error_backtrace;
186 189
   }
187 190
 
191
+  /**
192
+   * @param string $die_message
193
+   */
188 194
   function error_fatal($die_message, $details = 'There is a fatal error on page') {
189 195
     // TODO - Записывать детали ошибки в лог-файл
190 196
     die($die_message);
Please login to merge, or discard this 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.
metamatter.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@  discard block
 block discarded – undo
4 4
 // Может добавить спецстатус "Ответ системы платежа" и парсить дальше getMessage
5 5
 // см constants.php
6 6
 
7
-include_once('common.' . substr(strrchr(__FILE__, '.'), 1));
7
+include_once('common.'.substr(strrchr(__FILE__, '.'), 1));
8 8
 
9
-if(!sn_module_get_active_count('payment')) {
9
+if (!sn_module_get_active_count('payment')) {
10 10
   sys_redirect('dark_matter.php');
11 11
   die();
12 12
 }
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 
24 24
 // Таблица скидок
25 25
 $prev_discount = 0;
26
-if(isset(sn_module_payment::$bonus_table) && is_array(sn_module_payment::$bonus_table)) {
27
-  foreach(sn_module_payment::$bonus_table as $sum => $discount) {
28
-    if($discount && $discount != $prev_discount) {
26
+if (isset(sn_module_payment::$bonus_table) && is_array(sn_module_payment::$bonus_table)) {
27
+  foreach (sn_module_payment::$bonus_table as $sum => $discount) {
28
+    if ($discount && $discount != $prev_discount) {
29 29
       $template->assign_block_vars('discount', array(
30 30
         'SUM'          => $sum,
31 31
         'DISCOUNT'     => $discount * 100,
@@ -38,19 +38,19 @@  discard block
 block discarded – undo
38 38
 }
39 39
 
40 40
 // Результат платежа
41
-if($payment_id = sys_get_param_id('payment_id')) {
41
+if ($payment_id = sys_get_param_id('payment_id')) {
42 42
   $payment = db_payment_get($payment_id);
43
-  if($payment && $payment['payment_user_id'] == $user['id']) {
44
-    if($payment['payment_status'] == PAYMENT_STATUS_COMPLETE) {
43
+  if ($payment && $payment['payment_user_id'] == $user['id']) {
44
+    if ($payment['payment_status'] == PAYMENT_STATUS_COMPLETE) {
45 45
       $template->assign_block_vars('result', array('MESSAGE' => sprintf(classLocale::$lang['pay_msg_mm_purchase_complete'], $payment['payment_dark_matter_paid'], $payment['payment_module_name'], $payment['payment_dark_matter_gained'])));
46 46
     }
47
-    if($payment['payment_status'] == PAYMENT_STATUS_NONE) {
47
+    if ($payment['payment_status'] == PAYMENT_STATUS_NONE) {
48 48
       $template->assign_block_vars('result', array(
49 49
         'MESSAGE' => sprintf(classLocale::$lang['pay_msg_mm_purchase_incomplete'], $payment['payment_dark_matter_paid'], $payment['payment_module_name']),
50 50
         'STATUS'  => 1,
51 51
       ));
52 52
     }
53
-    if($payment['payment_test']) {
53
+    if ($payment['payment_test']) {
54 54
       $template->assign_block_vars('result', array(
55 55
         'MESSAGE' => sprintf(classLocale::$lang['pay_msg_mm_purchase_test']),
56 56
         'STATUS'  => -1,
@@ -65,28 +65,28 @@  discard block
 block discarded – undo
65 65
   'metamatter' => sys_get_param_float('metamatter'),
66 66
 );
67 67
 
68
-if(!$request['metamatter']) {
68
+if (!$request['metamatter']) {
69 69
   unset($_POST);
70 70
 }
71 71
 
72 72
 $payment_methods_available = array_combine(array_keys(sn_module_payment::$payment_methods), array_fill(0, count(sn_module_payment::$payment_methods), null));
73
-array_walk($payment_methods_available, function (&$value, $index) {
73
+array_walk($payment_methods_available, function(&$value, $index) {
74 74
   $value = !empty(sn_module_payment::$payment_methods[$index]) ? array_combine(array_keys(sn_module_payment::$payment_methods[$index]), array_fill(0, count(sn_module_payment::$payment_methods[$index]), null)) : $value;
75 75
 });
76 76
 
77 77
 // pdump($payment_methods_available);
78 78
 $payment_module_valid = false;
79 79
 $payment_module = sys_get_param_str('payment_module');
80
-foreach(sn_module::$sn_module_list['payment'] as $module_name => $module) {
81
-  if(!is_object($module) || !$module->manifest['active']) {
80
+foreach (sn_module::$sn_module_list['payment'] as $module_name => $module) {
81
+  if (!is_object($module) || !$module->manifest['active']) {
82 82
     continue;
83 83
   }
84 84
 
85 85
   lng_include($module_name, $module->manifest['root_relative']);
86 86
 
87
-  foreach(sn_module_payment::$payment_methods as $payment_type_id => $available_methods) {
88
-    foreach($available_methods as $payment_method => $payment_currency) {
89
-      if(isset($module->manifest['payment_method'][$payment_method])) {
87
+  foreach (sn_module_payment::$payment_methods as $payment_type_id => $available_methods) {
88
+    foreach ($available_methods as $payment_method => $payment_currency) {
89
+      if (isset($module->manifest['payment_method'][$payment_method])) {
90 90
         $payment_methods_available[$payment_type_id][$payment_method][$module_name] = $module->manifest['payment_method'][$payment_method];
91 91
       }
92 92
     }
@@ -97,8 +97,8 @@  discard block
 block discarded – undo
97 97
 
98 98
 global $template_result;
99 99
 // Доступные платежные методы
100
-foreach($payment_methods_available as $payment_type_id => $payment_methods) {
101
-  if(empty($payment_methods)) {
100
+foreach ($payment_methods_available as $payment_type_id => $payment_methods) {
101
+  if (empty($payment_methods)) {
102 102
     continue;
103 103
   }
104 104
 
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
     'ID'   => $payment_type_id,
107 107
     'NAME' => classLocale::$lang['pay_methods'][$payment_type_id],
108 108
   );
109
-  foreach($payment_methods as $payment_method_id => $module_list) {
110
-    if(empty($module_list)) {
109
+  foreach ($payment_methods as $payment_method_id => $module_list) {
110
+    if (empty($module_list)) {
111 111
       continue;
112 112
     }
113 113
     $template_result['.']['payment'][$payment_type_id]['.']['method'][$payment_method_id] = array(
@@ -118,14 +118,14 @@  discard block
 block discarded – undo
118 118
       'NAME_FORCE' => isset(sn_module_payment::$payment_methods[$payment_type_id][$payment_method_id]['name']),
119 119
       'BUTTON'     => isset(sn_module_payment::$payment_methods[$payment_type_id][$payment_method_id]['button']),
120 120
     );
121
-    foreach($module_list as $payment_module_name => $payment_module_method_details) {
121
+    foreach ($module_list as $payment_module_name => $payment_module_method_details) {
122 122
       $template_result['.']['payment'][$payment_type_id]['.']['method'][$payment_method_id]['.']['module'][] = array(
123 123
         'MODULE' => $payment_module_name,
124 124
       );
125 125
     }
126 126
   }
127 127
 
128
-  if(empty($template_result['.']['payment'][$payment_type_id]['.'])) {
128
+  if (empty($template_result['.']['payment'][$payment_type_id]['.'])) {
129 129
     unset($template_result['.']['payment'][$payment_type_id]);
130 130
   }
131 131
 }
@@ -138,19 +138,19 @@  discard block
 block discarded – undo
138 138
 $payment_module_valid = $payment_module_valid && (!$payment_method_selected || isset($payment_methods_available[$payment_type_selected][$payment_method_selected][$module_name]));
139 139
 
140 140
 // If payment_module invalid - making it empty OR if there is only one payment_module - selecting it
141
-if($payment_module_valid) {
141
+if ($payment_module_valid) {
142 142
   // $payment_module = $payment_module; // Really - do nothing
143
-} elseif($payment_type_selected && count($payment_methods_available[$payment_type_selected][$payment_method_selected]) == 1) {
143
+} elseif ($payment_type_selected && count($payment_methods_available[$payment_type_selected][$payment_method_selected]) == 1) {
144 144
   reset($payment_methods_available[$payment_type_selected][$payment_method_selected]);
145 145
   $payment_module = key($payment_methods_available[$payment_type_selected][$payment_method_selected]);
146
-} elseif(count(sn_module::$sn_module_list['payment']) == 1) {
146
+} elseif (count(sn_module::$sn_module_list['payment']) == 1) {
147 147
   $payment_module = $module_name;
148 148
 } else {
149 149
   $payment_module = '';
150 150
 }
151 151
 
152
-if($payment_type_selected && $payment_method_selected) {
153
-  foreach($payment_methods_available[$payment_type_selected][$payment_method_selected] as $module_name => $temp) {
152
+if ($payment_type_selected && $payment_method_selected) {
153
+  foreach ($payment_methods_available[$payment_type_selected][$payment_method_selected] as $module_name => $temp) {
154 154
     $template->assign_block_vars('payment_module', array(
155 155
       'ID'          => $module_name,
156 156
       'NAME'        => classLocale::$lang["module_{$module_name}_name"],
@@ -159,9 +159,9 @@  discard block
 block discarded – undo
159 159
   }
160 160
 }
161 161
 
162
-foreach(classLocale::$lang['pay_currency_list'] as $key => $value) {
162
+foreach (classLocale::$lang['pay_currency_list'] as $key => $value) {
163 163
   $course = get_exchange_rate($key);
164
-  if(!$course) {
164
+  if (!$course) {
165 165
     continue;
166 166
   }
167 167
   $template->assign_block_vars('exchange', array(
@@ -176,17 +176,17 @@  discard block
 block discarded – undo
176 176
   ));
177 177
 }
178 178
 
179
-if($request['metamatter'] && $payment_module) {
179
+if ($request['metamatter'] && $payment_module) {
180 180
   try {
181 181
     // Any possible errors about generating paylink should be raised in module!
182 182
     $pay_link = sn_module::$sn_module[$payment_module]->compile_request($request);
183 183
 
184 184
     // Поддержка дополнительной информации
185
-    if(is_array($pay_link['RENDER'])) {
186
-      foreach($pay_link['RENDER'] as $html_data) {
185
+    if (is_array($pay_link['RENDER'])) {
186
+      foreach ($pay_link['RENDER'] as $html_data) {
187 187
         $template->assign_block_vars('render', $html_data);
188
-        if(isset($html_data['VALUE']) && is_array($html_data['VALUE'])) {
189
-          foreach($html_data['VALUE'] as $value_id => $value_value) {
188
+        if (isset($html_data['VALUE']) && is_array($html_data['VALUE'])) {
189
+          foreach ($html_data['VALUE'] as $value_id => $value_value) {
190 190
             $template->assign_block_vars('render.value', array(
191 191
               'FIELD' => $value_id,
192 192
               'VALUE' => $value_value,
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
     }
198 198
 
199 199
     // Поддержка передачи данных для многошаговых платежных систем
200
-    if(is_array($pay_link['DATA'])) {
201
-      foreach($pay_link['DATA'] as $key => $value) {
200
+    if (is_array($pay_link['DATA'])) {
201
+      foreach ($pay_link['DATA'] as $key => $value) {
202 202
         $template->assign_block_vars('pay_link_data', array(
203 203
           'FIELD' => $key,
204 204
           'VALUE' => $value,
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
       }
207 207
     }
208 208
 
209
-    if(is_array($pay_link) && in_array($pay_link['PAY_LINK_METHOD'], array('POST', 'GET', 'LINK', 'STEP'))) {
209
+    if (is_array($pay_link) && in_array($pay_link['PAY_LINK_METHOD'], array('POST', 'GET', 'LINK', 'STEP'))) {
210 210
       // TODO Переделать это под assign_vars_recursive и возвращать пустые строки если нет платежного метода - для унификации формы в темплейте
211 211
       $template->assign_vars(array(
212 212
         'PAY_LINK_METHOD' => $pay_link['PAY_LINK_METHOD'],
@@ -215,17 +215,17 @@  discard block
 block discarded – undo
215 215
     } else {
216 216
       throw new exception(classLocale::$lang['pay_msg_request_paylink_unsupported'], ERR_ERROR);
217 217
     }
218
-  } catch(exception $e) {
218
+  } catch (exception $e) {
219 219
     $template->assign_block_vars('result', $response = array(
220 220
       'STATUS'  => $e->getCode(),
221 221
       'MESSAGE' => $e->getMessage(),
222 222
     ));
223
-    classSupernova::$debug->warning('Результат операции: код ' . $e->getCode() . ' сообщение "' . $e->getMessage() . '"', 'Ошибка платежа', LOG_INFO_PAYMENT);
223
+    classSupernova::$debug->warning('Результат операции: код '.$e->getCode().' сообщение "'.$e->getMessage().'"', 'Ошибка платежа', LOG_INFO_PAYMENT);
224 224
   }
225 225
 }
226 226
 
227 227
 // Прегенерированные пакеты
228
-foreach($unit_available_amount_list as $unit_amount => $discount) {
228
+foreach ($unit_available_amount_list as $unit_amount => $discount) {
229 229
   $temp = sn_module_payment::currency_convert($unit_amount, 'MM_', $player_currency);
230 230
   $template->assign_block_vars('mm_amount', array(
231 231
     'VALUE'            => $unit_amount,
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
   'PLAYER_CURRENCY'              => $player_currency,
261 261
   'PLAYER_CURRENCY_PRICE_PER_MM' => sn_module_payment::currency_convert(1, $player_currency, 'MM_', 10),
262 262
 
263
-  'UNIT_AMOUNT'                 => (float)$request['metamatter'],
263
+  'UNIT_AMOUNT'                 => (float) $request['metamatter'],
264 264
   'UNIT_AMOUNT_TEXT'            => pretty_number($request['metamatter']),
265 265
   'UNIT_AMOUNT_BONUS_PERCENT'   => $bonus_percent,
266 266
   'UNIT_AMOUNT_TEXT_DISCOUNTED' => $income_metamatter_text,
Please login to merge, or discard this patch.
infos.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @version 1.1
10 10
  * @copyright 2008 By Chlorel for XNova
11 11
  */
12
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
12
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
13 13
 
14 14
 function ShowProductionTable($CurrentUser, $CurrentPlanet, $BuildID, $Template) {
15 15
   $config_resource_multiplier = game_resource_multiplier();
@@ -47,20 +47,20 @@  discard block
 block discarded – undo
47 47
   ));
48 48
 
49 49
   $ActualProd = floor($Prod[$BuildID]);
50
-  if($BuildID != STRUC_MINE_FUSION) {
50
+  if ($BuildID != STRUC_MINE_FUSION) {
51 51
     $ActualNeed = floor($Prod[STRUC_MINE_SOLAR]);
52 52
   } else {
53 53
     $ActualNeed = floor($Prod[STRUC_MINE_DEUTERIUM]);
54 54
   }
55 55
 
56 56
   $BuildStartLvl = $CurrentBuildtLvl - 2;
57
-  if($BuildStartLvl < 1) {
57
+  if ($BuildStartLvl < 1) {
58 58
     $BuildStartLvl = 1;
59 59
   }
60 60
   $Table = '';
61 61
   $ProdFirst = 0;
62
-  for($BuildLevel = $BuildStartLvl; $BuildLevel < $BuildStartLvl + 10; $BuildLevel++) {
63
-    if($BuildID != STRUC_MOON_PHALANX) {
62
+  for ($BuildLevel = $BuildStartLvl; $BuildLevel < $BuildStartLvl + 10; $BuildLevel++) {
63
+    if ($BuildID != STRUC_MOON_PHALANX) {
64 64
       $Prod[STRUC_MINE_METAL] = floor(mrc_modify_value(
65 65
         $CurrentUser,
66 66
         $CurrentPlanet,
@@ -86,17 +86,17 @@  discard block
 block discarded – undo
86 86
         $config_resource_multiplier_plain * $unit_data[P_UNIT_PRODUCTION][RES_ENERGY]($BuildLevel, 100, $CurrentUser, $CurrentPlanet)
87 87
       ));
88 88
 
89
-      $bloc['build_lvl'] = ($CurrentBuildtLvl == $BuildLevel) ? "<font color=\"#ff0000\">" . $BuildLevel . "</font>" : $BuildLevel;
90
-      if($ProdFirst > 0) {
91
-        if($BuildID != STRUC_MINE_FUSION) {
92
-          $bloc['build_gain'] = "<font color=\"lime\">(" . pretty_number(floor($Prod[$BuildID] - $ProdFirst)) . ")</font>";
89
+      $bloc['build_lvl'] = ($CurrentBuildtLvl == $BuildLevel) ? "<font color=\"#ff0000\">".$BuildLevel."</font>" : $BuildLevel;
90
+      if ($ProdFirst > 0) {
91
+        if ($BuildID != STRUC_MINE_FUSION) {
92
+          $bloc['build_gain'] = "<font color=\"lime\">(".pretty_number(floor($Prod[$BuildID] - $ProdFirst)).")</font>";
93 93
         } else {
94
-          $bloc['build_gain'] = "<font color=\"lime\">(" . pretty_number(floor($Prod[STRUC_MINE_SOLAR] - $ProdFirst)) . ")</font>";
94
+          $bloc['build_gain'] = "<font color=\"lime\">(".pretty_number(floor($Prod[STRUC_MINE_SOLAR] - $ProdFirst)).")</font>";
95 95
         }
96 96
       } else {
97 97
         $bloc['build_gain'] = '';
98 98
       }
99
-      if($BuildID != STRUC_MINE_FUSION) {
99
+      if ($BuildID != STRUC_MINE_FUSION) {
100 100
         $bloc['build_prod'] = pretty_number(floor($Prod[$BuildID]));
101 101
         $bloc['build_prod_diff'] = pretty_number(floor($Prod[$BuildID] - $ActualProd), true, true);
102 102
         $bloc['build_need'] = pretty_number(floor($Prod[STRUC_MINE_SOLAR]), true, true);
@@ -107,8 +107,8 @@  discard block
 block discarded – undo
107 107
         $bloc['build_need'] = pretty_number(floor($Prod[STRUC_MINE_DEUTERIUM]), true, true);
108 108
         $bloc['build_need_diff'] = pretty_number(floor($Prod[STRUC_MINE_DEUTERIUM] - $ActualNeed), true, true);
109 109
       }
110
-      if($ProdFirst == 0) {
111
-        if($BuildID != STRUC_MINE_FUSION) {
110
+      if ($ProdFirst == 0) {
111
+        if ($BuildID != STRUC_MINE_FUSION) {
112 112
           $ProdFirst = floor($Prod[$BuildID]);
113 113
         } else {
114 114
           $ProdFirst = floor($Prod[STRUC_MINE_SOLAR]);
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
       }
117 117
     } else {
118 118
       // Cas particulier de la phalange
119
-      $bloc['build_lvl'] = ($CurrentBuildtLvl == $BuildLevel) ? "<font color=\"#ff0000\">" . $BuildLevel . "</font>" : $BuildLevel;
119
+      $bloc['build_lvl'] = ($CurrentBuildtLvl == $BuildLevel) ? "<font color=\"#ff0000\">".$BuildLevel."</font>" : $BuildLevel;
120 120
       $bloc['build_range'] = ($BuildLevel * $BuildLevel) - 1;
121 121
     }
122 122
     $Table .= parsetemplate($Template, $bloc);
@@ -133,22 +133,22 @@  discard block
 block discarded – undo
133 133
 
134 134
   $str_rapid_from = '';
135 135
   $str_rapid_to = '';
136
-  foreach(sn_get_groups(array('fleet', 'defense_active')) as $enemy_id) {
136
+  foreach (sn_get_groups(array('fleet', 'defense_active')) as $enemy_id) {
137 137
     $enemy_data = get_unit_param($enemy_id);
138 138
     $enemy_durability = $enemy_data['shield'] + $enemy_data['armor'];
139 139
 
140 140
     $rapid = floor($unit_data['attack'] * (isset($unit_data['amplify'][$enemy_id]) ? $unit_data['amplify'][$enemy_id] : 1) / $enemy_durability);
141
-    if($rapid >= 1) {
141
+    if ($rapid >= 1) {
142 142
       $str_rapid_to .= "{$classLocale['nfo_rf_again']} {$classLocale['tech'][$enemy_id]} <font color=\"#00ff00\">{$rapid}</font><br>";
143 143
     }
144 144
 
145 145
     $rapid = floor($enemy_data['attack'] * (isset($enemy_data['amplify'][$unit_id]) ? $enemy_data['amplify'][$unit_id] : 1) / $unit_durability);
146
-    if($rapid >= 1) {
146
+    if ($rapid >= 1) {
147 147
       $str_rapid_from .= "{$classLocale['tech'][$enemy_id]} {$classLocale['nfo_rf_from']} <font color=\"#ff0000\">{$rapid}</font><br>";
148 148
     }
149 149
   }
150 150
 
151
-  if($str_rapid_to && $str_rapid_from) {
151
+  if ($str_rapid_to && $str_rapid_from) {
152 152
     $str_rapid_to .= '<hr>';
153 153
   }
154 154
 
@@ -156,16 +156,16 @@  discard block
 block discarded – undo
156 156
 }
157 157
 
158 158
 $unit_id = sys_get_param_id('gid');
159
-if($unit_id == RES_DARK_MATTER) {
159
+if ($unit_id == RES_DARK_MATTER) {
160 160
   sys_redirect('dark_matter.php');
161 161
 }
162 162
 
163
-if($unit_id == RES_METAMATTER) {
163
+if ($unit_id == RES_METAMATTER) {
164 164
   sys_redirect('metamatter.php');
165 165
 }
166 166
 
167 167
 lng_include('infos');
168
-if(!$unit_id || (!get_unit_param($unit_id) && !isset(classLocale::$lang['info'][$unit_id]))) {
168
+if (!$unit_id || (!get_unit_param($unit_id) && !isset(classLocale::$lang['info'][$unit_id]))) {
169 169
   sys_redirect('index.php?page=techtree');
170 170
 }
171 171
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 $unit_data = get_unit_param($unit_id);
175 175
 $unit_type = $unit_data['type'];
176 176
 
177
-if($unit_type == UNIT_SHIPS) {
177
+if ($unit_type == UNIT_SHIPS) {
178 178
   $template_result['UNIT_IS_SHIP'] = true;
179 179
 
180 180
   $ship_data = get_ship_data($unit_id, $user);
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
   );
191 191
 
192 192
   $engine_template_info = array();
193
-  foreach($unit_data['engine'] as $unit_engine_data) {
193
+  foreach ($unit_data['engine'] as $unit_engine_data) {
194 194
     $unit_engine_data = get_engine_data($user, $unit_engine_data);
195 195
 
196 196
     $engine_template_info[] = array(
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 
210 210
 
211 211
 $sn_data_group_combat = sn_get_groups('combat');
212
-if(in_array($unit_id, $sn_data_group_combat)) {
212
+if (in_array($unit_id, $sn_data_group_combat)) {
213 213
   $template_result['UNIT_IS_COMBAT'] = true;
214 214
 
215 215
   $unit_durability = $unit_data['shield'] + $unit_data['armor'];
@@ -217,21 +217,21 @@  discard block
 block discarded – undo
217 217
   $volley_arr = $rapid_to = $rapid_from = array();
218 218
   $str_rapid_from = '';
219 219
   $str_rapid_to = '';
220
-  foreach($sn_data_group_combat as $enemy_id) {
220
+  foreach ($sn_data_group_combat as $enemy_id) {
221 221
     $enemy_data = get_unit_param($enemy_id);
222 222
     $enemy_durability = $enemy_data['shield'] + $enemy_data['armor'];
223 223
 
224 224
     $rapid = $unit_data['attack'] * (isset($unit_data['amplify'][$enemy_id]) ? $unit_data['amplify'][$enemy_id] : 1) / $enemy_durability;
225
-    if($rapid >= 1) {
225
+    if ($rapid >= 1) {
226 226
       $volley_arr[$enemy_id]['TO'] = floor($rapid);
227 227
     }
228 228
 
229 229
     $rapid = $enemy_data['attack'] * (isset($enemy_data['amplify'][$unit_id]) ? $enemy_data['amplify'][$unit_id] : 1) / $unit_durability;
230
-    if($rapid >= 1) {
230
+    if ($rapid >= 1) {
231 231
       $volley_arr[$enemy_id]['FROM'] = floor($rapid);
232 232
     }
233 233
   }
234
-  foreach($volley_arr as $enemy_id => &$rapid) {
234
+  foreach ($volley_arr as $enemy_id => &$rapid) {
235 235
     $rapid['ENEMY_ID'] = $enemy_id;
236 236
     $rapid['ENEMY_NAME'] = classLocale::$lang['tech'][$enemy_id];
237 237
   }
@@ -249,13 +249,13 @@  discard block
 block discarded – undo
249 249
 
250 250
 }
251 251
 
252
-if(classLocale::$lang['info'][$unit_id]['effect']) {
252
+if (classLocale::$lang['info'][$unit_id]['effect']) {
253 253
   $template_result['UNIT_EFFECT'] = classLocale::$lang['info'][$unit_id]['effect'];
254 254
 }
255 255
 
256
-if($unit_data['bonus']) {
256
+if ($unit_data['bonus']) {
257 257
   $unit_bonus = !$unit_data['bonus'] || $unit_data['bonus_type'] == BONUS_ABILITY ? '' : (
258
-    ($unit_data['bonus'] >= 0 ? '+' : '') . $unit_data['bonus'] . ($unit_data['bonus_type'] == BONUS_PERCENT ? '%' : '')
258
+    ($unit_data['bonus'] >= 0 ? '+' : '').$unit_data['bonus'].($unit_data['bonus_type'] == BONUS_PERCENT ? '%' : '')
259 259
   );
260 260
   $template_result['UNIT_BONUS'] = $unit_bonus;
261 261
 }
Please login to merge, or discard this patch.