Completed
Push — trunk ( 34029c...0f5c9b )
by SuperNova.WS
03:54
created
includes/general.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -284,7 +284,7 @@
 block discarded – undo
284 284
     $time_left = min(floor($time_left / PERIOD_DAY), $term_original);
285 285
     $cost_left = $term_original > 0 ? ceil($time_left / $term_original * $original_cost) : 0;
286 286
 
287
-    array_walk_recursive($result, function (&$value) use ($cost_left) {
287
+    array_walk_recursive($result, function(&$value) use ($cost_left) {
288 288
       $value -= $cost_left;
289 289
     });
290 290
   }
Please login to merge, or discard this patch.
classes/Bonus/BonusListAtom.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,8 @@
 block discarded – undo
58 58
   protected function bonusSort(BonusAtom $a, BonusAtom $b) {
59 59
     static $bonusOrder = [BonusAtom::class, BonusAtomAbility::class, BonusAtomAdd::class, BonusAtomPercent::class, BonusAtomMultiply::class];
60 60
 
61
-    $indexA = (int)array_search(get_class($a), $bonusOrder);
62
-    $indexB = (int)array_search(get_class($b), $bonusOrder);
61
+    $indexA = (int) array_search(get_class($a), $bonusOrder);
62
+    $indexB = (int) array_search(get_class($b), $bonusOrder);
63 63
 
64 64
     return $indexA == $indexB ? 0 : ($indexA > $indexB ? +1 : -1);
65 65
   }
Please login to merge, or discard this patch.
includes/includes/flt_mission_explore.php 1 patch
Spacing   +37 added lines, -38 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
 
15 15
   $fleet_left = 1 - mt_rand(1, 3) * mt_rand(200000, 300000) / 1000000;
16 16
   $fleet_lost = array();
17
-  foreach($fleet as $unit_id => &$unit_amount) {
17
+  foreach ($fleet as $unit_id => &$unit_amount) {
18 18
     $ships_left = floor($unit_amount * $fleet_left);
19 19
     $fleet_lost[$unit_id] = $unit_amount - $ships_left;
20 20
     $unit_amount = $ships_left;
21
-    if(!$unit_amount) {
21
+    if (!$unit_amount) {
22 22
       unset($fleet[$unit_id]);
23 23
     }
24 24
   }
@@ -31,14 +31,14 @@  discard block
 block discarded – undo
31 31
 //  $fleet = array();
32 32
 }
33 33
 
34
-function flt_mission_explore_addon(&$result){return sn_function_call('flt_mission_explore_addon', array(&$result));}
34
+function flt_mission_explore_addon(&$result) {return sn_function_call('flt_mission_explore_addon', array(&$result)); }
35 35
 function sn_flt_mission_explore_addon(&$result) {
36 36
   return $result;
37 37
 }
38 38
 
39 39
 
40 40
 function flt_mission_explore(&$mission_data) {
41
-  if(!isset($mission_data['fleet_event']) || $mission_data['fleet_event'] != EVENT_FLT_ACOMPLISH) {
41
+  if (!isset($mission_data['fleet_event']) || $mission_data['fleet_event'] != EVENT_FLT_ACOMPLISH) {
42 42
     return CACHE_NONE;
43 43
   }
44 44
 
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
   $outcome_list = &$result['$outcome_list'];
72 72
   $fleet_metal_points = &$result['$fleet_metal_points'];
73 73
 
74
-  if(!$ship_data) {
75
-    foreach(sn_get_groups('fleet') as $unit_id) {
74
+  if (!$ship_data) {
75
+    foreach (sn_get_groups('fleet') as $unit_id) {
76 76
       $unit_info = get_unit_param($unit_id);
77
-      if($unit_info[P_UNIT_TYPE] != UNIT_SHIPS || !isset($unit_info['engine'][0]['speed']) || !$unit_info['engine'][0]['speed']) {
77
+      if ($unit_info[P_UNIT_TYPE] != UNIT_SHIPS || !isset($unit_info['engine'][0]['speed']) || !$unit_info['engine'][0]['speed']) {
78 78
         continue;
79 79
       }
80 80
       $ship_data[$unit_id][P_COST_METAL] = get_unit_cost_in($unit_info[P_COST]);
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
   $fleet = sys_unit_str2arr($fleet_row['fleet_array']);
87 87
   $fleet_capacity = 0;
88 88
   $fleet_metal_points = 0;
89
-  foreach($fleet as $ship_id => $ship_amount) {
89
+  foreach ($fleet as $ship_id => $ship_amount) {
90 90
     $unit_info = get_unit_param($ship_id);
91 91
     $fleet_capacity += $ship_amount * $unit_info[P_CAPACITY];
92 92
     $fleet_metal_points += $ship_amount * $ship_data[$ship_id][P_COST_METAL];
@@ -96,11 +96,11 @@  discard block
 block discarded – undo
96 96
   $flt_stay_hours = ($fleet_row['fleet_end_stay'] - $fleet_row['fleet_start_time']) / 3600 * ($config->game_speed_expedition ? $config->game_speed_expedition : 1);
97 97
 
98 98
   $outcome_list = sn_get_groups(GROUP_MISSION_EXPLORE_OUTCOMES);
99
-  $outcome_list[FLT_EXPEDITION_OUTCOME_NONE]['chance'] = ceil(200 / pow($flt_stay_hours, 1/1.7));
99
+  $outcome_list[FLT_EXPEDITION_OUTCOME_NONE]['chance'] = ceil(200 / pow($flt_stay_hours, 1 / 1.7));
100 100
 
101 101
   $chance_max = 0;
102
-  foreach($outcome_list as $key => &$value) {
103
-    if(!$value['chance']) {
102
+  foreach ($outcome_list as $key => &$value) {
103
+    if (!$value['chance']) {
104 104
       unset($outcome_list[$key]);
105 105
       continue;
106 106
     }
@@ -109,13 +109,13 @@  discard block
 block discarded – undo
109 109
   $outcome_value = mt_rand(0, $chance_max);
110 110
 // $outcome_value = 409;
111 111
   $outcome_description = &$outcome_list[$mission_outcome = FLT_EXPEDITION_OUTCOME_NONE];
112
-  foreach($outcome_list as $key => &$value) {
113
-    if(!$value['chance']) {
112
+  foreach ($outcome_list as $key => &$value) {
113
+    if (!$value['chance']) {
114 114
       continue;
115 115
     }
116 116
     $mission_outcome = $key;
117 117
     $outcome_description = $value;
118
-    if($outcome_value <= $outcome_description['value']) {
118
+    if ($outcome_value <= $outcome_description['value']) {
119 119
       break;
120 120
     }
121 121
   }
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
   $found_dark_matter = 0;
132 132
 //  $outcome_mission_sub = -1;
133 133
 
134
-  switch($mission_outcome) {
134
+  switch ($mission_outcome) {
135 135
 //  switch(FLT_EXPEDITION_OUTCOME_LOST_FLEET) { // TODO DEBUG!
136 136
     case FLT_EXPEDITION_OUTCOME_LOST_FLEET:
137 137
       flt_mission_explore_outcome_lost_fleet($result);
@@ -166,14 +166,14 @@  discard block
 block discarded – undo
166 166
 
167 167
       // Рассчитываем стоимость самого дорого корабля в металле
168 168
       $max_metal_cost = 0;
169
-      foreach($fleet as $ship_id => $ship_amount) {
169
+      foreach ($fleet as $ship_id => $ship_amount) {
170 170
         $max_metal_cost = max($max_metal_cost, $ship_data[$ship_id]['metal_cost']);
171 171
       }
172 172
 
173 173
       // Ограничиваем корабли только теми, чья стоимость в металле меньше или равно стоимости самого дорогого корабля
174 174
       $can_be_found = array();
175
-      foreach($ship_data as $ship_id => $ship_info) {
176
-        if($ship_info['metal_cost'] < $max_metal_cost) {
175
+      foreach ($ship_data as $ship_id => $ship_info) {
176
+        if ($ship_info['metal_cost'] < $max_metal_cost) {
177 177
           $can_be_found[$ship_id] = $ship_info['metal_cost'];
178 178
         }
179 179
       }
@@ -182,13 +182,13 @@  discard block
 block discarded – undo
182 182
       unset($can_be_found[SHIP_SPY]);
183 183
 
184 184
       $fleet_found = array();
185
-      while(count($can_be_found) && $found_in_metal >= max($can_be_found)) {
185
+      while (count($can_be_found) && $found_in_metal >= max($can_be_found)) {
186 186
         $found_index = mt_rand(1, count($can_be_found)) - 1;
187 187
         $found_ship = array_slice($can_be_found, $found_index, 1, true);
188 188
         $found_ship_cost = reset($found_ship);
189 189
         $found_ship_id = key($found_ship);
190 190
 
191
-        if($found_ship_cost > $found_in_metal) {
191
+        if ($found_ship_cost > $found_in_metal) {
192 192
           unset($can_be_found[$found_ship_id]);
193 193
         } else {
194 194
           $found_ship_count = mt_rand(1, floor($found_in_metal / $found_ship_cost));
@@ -197,10 +197,10 @@  discard block
 block discarded – undo
197 197
         }
198 198
       }
199 199
 
200
-      if(empty($fleet_found)) {
200
+      if (empty($fleet_found)) {
201 201
         $msg_text_addon = $lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result'];
202 202
       } else {
203
-        foreach($fleet_found as $unit_id => $unit_amount) {
203
+        foreach ($fleet_found as $unit_id => $unit_amount) {
204 204
           $fleet[$unit_id] += $unit_amount;
205 205
         }
206 206
       }
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
       $fleet_row['fleet_resource_crystal'] += $resources_found[RES_CRYSTAL];
227 227
       $fleet_row['fleet_resource_deuterium'] += $resources_found[RES_DEUTERIUM];
228 228
 
229
-      if(array_sum($resources_found) == 0) {
229
+      if (array_sum($resources_found) == 0) {
230 230
         $msg_text_addon = $lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result'];
231 231
       }
232 232
     break;
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
       // Рассчитываем количество найденной ТМ
238 238
       $found_dark_matter = floor(min($outcome_percent * $fleet_metal_points / $rates[RES_DARK_MATTER], 10000) * mt_rand(750000, 1000000) / 1000000);
239 239
 
240
-      if(!$found_dark_matter) {
240
+      if (!$found_dark_matter) {
241 241
         $msg_text_addon = $lang['flt_mission_expedition']['outcomes'][$mission_outcome]['no_result'];
242 242
       }
243 243
     break;
@@ -251,31 +251,31 @@  discard block
 block discarded – undo
251 251
 
252 252
   flt_mission_explore_addon($result);
253 253
 
254
-  if($found_dark_matter) {
254
+  if ($found_dark_matter) {
255 255
     rpg_points_change($fleet_row['fleet_owner'], RPG_EXPEDITION, $found_dark_matter, 'Expedition Bonus');
256 256
     $msg_text_addon = sprintf($lang['flt_mission_expedition']['found_dark_matter'], $found_dark_matter);
257 257
   }
258 258
 
259
-  if(!empty($fleet_lost)) {
259
+  if (!empty($fleet_lost)) {
260 260
     $msg_text_addon = $lang['flt_mission_expedition']['lost_fleet'];
261
-    foreach($fleet_lost as $ship_id => $ship_amount) {
261
+    foreach ($fleet_lost as $ship_id => $ship_amount) {
262 262
       $msg_text_addon .= $lang['tech'][$ship_id] . ' - ' . $ship_amount . "\r\n";
263 263
     }
264 264
   }
265 265
 
266 266
   $fleet_row['fleet_amount'] = array_sum($fleet);
267
-  if(!empty($fleet) && $fleet_row['fleet_amount']) {
268
-    if(!empty($fleet_found)) {
267
+  if (!empty($fleet) && $fleet_row['fleet_amount']) {
268
+    if (!empty($fleet_found)) {
269 269
       $msg_text_addon = $lang['flt_mission_expedition']['found_fleet'];
270
-      foreach($fleet_found as $ship_id => $ship_amount) {
270
+      foreach ($fleet_found as $ship_id => $ship_amount) {
271 271
         $msg_text_addon .= $lang['tech'][$ship_id] . ' - ' . $ship_amount . "\r\n";
272 272
       }
273 273
     }
274 274
 
275 275
     $query_delta = array();
276
-    if(!empty($resources_found) && array_sum($resources_found) > 0) {
276
+    if (!empty($resources_found) && array_sum($resources_found) > 0) {
277 277
       $msg_text_addon = $lang['flt_mission_expedition']['found_resources'];
278
-      foreach($resources_found as $ship_id => $ship_amount) {
278
+      foreach ($resources_found as $ship_id => $ship_amount) {
279 279
         $msg_text_addon .= $lang['tech'][$ship_id] . ' - ' . $ship_amount . "\r\n";
280 280
       }
281 281
 
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
     }
289 289
 
290 290
     $query_data = array();
291
-    if(!empty($fleet_lost) || !empty($fleet_found)) {
291
+    if (!empty($fleet_lost) || !empty($fleet_found)) {
292 292
       $fleet_row['fleet_array'] = sys_unit_arr2str($fleet);
293 293
 
294 294
 //      $query_data[] = "`fleet_amount` = {$fleet_row['fleet_amount']}";
@@ -316,17 +316,16 @@  discard block
 block discarded – undo
316 316
 
317 317
   db_user_set_by_id($fleet_row['fleet_owner'], "`player_rpg_explore_xp` = `player_rpg_explore_xp` + 1");
318 318
 
319
-  if(!$msg_text) {
319
+  if (!$msg_text) {
320 320
     $messages = &$lang['flt_mission_expedition']['outcomes'][$mission_outcome]['messages'];
321
-    if($outcome_mission_sub >= 0 && is_array($messages)) {
321
+    if ($outcome_mission_sub >= 0 && is_array($messages)) {
322 322
       $messages = &$messages[$outcome_mission_sub];
323 323
     }
324 324
 
325
-    $msg_text = is_string($messages) ? $messages :
326
-      (is_array($messages) ? $messages[mt_rand(0, count($messages) - 1)] : '');
325
+    $msg_text = is_string($messages) ? $messages : (is_array($messages) ? $messages[mt_rand(0, count($messages) - 1)] : '');
327 326
   }
328 327
   $msg_text = sprintf($msg_text, $fleet_row['fleet_id'], uni_render_coordinates($fleet_row, 'fleet_end_')) .
329
-    ($msg_text_addon ? "\r\n" . $msg_text_addon: '');
328
+    ($msg_text_addon ? "\r\n" . $msg_text_addon : '');
330 329
 
331 330
   msg_send_simple_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_end_stay'], MSG_TYPE_EXPLORE, $msg_sender, $msg_title, $msg_text);
332 331
 
Please login to merge, or discard this patch.
classes/Bonus/ValueStorage.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -48,20 +48,20 @@  discard block
 block discarded – undo
48 48
   }
49 49
 
50 50
   protected function initValues() {
51
-    $this[UNIT_SERVER_SPEED_BUILDING] = function (ValueStorage $vs) {
51
+    $this[UNIT_SERVER_SPEED_BUILDING] = function(ValueStorage $vs) {
52 52
       return new ValueBonused(UNIT_SERVER_SPEED_BUILDING, floatval($vs->getGlobalContainer()->config->game_speed));
53 53
     };
54
-    $this[UNIT_SERVER_SPEED_MINING] = function (ValueStorage $vs) {
54
+    $this[UNIT_SERVER_SPEED_MINING] = function(ValueStorage $vs) {
55 55
       return new ValueBonused(UNIT_SERVER_SPEED_MINING, floatval($vs->getGlobalContainer()->config->resource_multiplier));
56 56
     };
57
-    $this[UNIT_SERVER_SPEED_FLEET] = function (ValueStorage $vs) {
57
+    $this[UNIT_SERVER_SPEED_FLEET] = function(ValueStorage $vs) {
58 58
       return new ValueBonused(UNIT_SERVER_SPEED_FLEET, floatval($vs->getGlobalContainer()->config->fleet_speed));
59 59
     };
60
-    $this[UNIT_SERVER_SPEED_EXPEDITION] = function (ValueStorage $vs) {
60
+    $this[UNIT_SERVER_SPEED_EXPEDITION] = function(ValueStorage $vs) {
61 61
       return new ValueBonused(UNIT_SERVER_SPEED_EXPEDITION, floatval(1));
62 62
     };
63 63
 
64
-    $this[UNIT_SERVER_FLEET_NOOB_POINTS] = function (ValueStorage $vs) {
64
+    $this[UNIT_SERVER_FLEET_NOOB_POINTS] = function(ValueStorage $vs) {
65 65
       $config = $vs->getGlobalContainer()->config;
66 66
 
67 67
       return new ValueBonused(
@@ -69,11 +69,11 @@  discard block
 block discarded – undo
69 69
         floatval($config->game_noob_points * $vs->getBase(UNIT_SERVER_SPEED_MINING))
70 70
       );
71 71
     };
72
-    $this[UNIT_SERVER_FLEET_NOOB_FACTOR] = function (ValueStorage $vs) {
72
+    $this[UNIT_SERVER_FLEET_NOOB_FACTOR] = function(ValueStorage $vs) {
73 73
       return new ValueBonused(UNIT_SERVER_FLEET_NOOB_FACTOR, floatval($vs->getGlobalContainer()->config->game_noob_factor));
74 74
     };
75 75
 
76
-    $this[UNIT_SERVER_PAYMENT_MM_PER_CURRENCY] = function (ValueStorage $vs) {
76
+    $this[UNIT_SERVER_PAYMENT_MM_PER_CURRENCY] = function(ValueStorage $vs) {
77 77
       return new ValueBonused(UNIT_SERVER_PAYMENT_MM_PER_CURRENCY, floatval($vs->getGlobalContainer()->config->payment_currency_exchange_mm_));
78 78
     };
79 79
   }
Please login to merge, or discard this patch.
classes/Unit/Governor.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -105,7 +105,7 @@
 block discarded – undo
105 105
    * @return int
106 106
    */
107 107
   public function getMaxLevel() {
108
-    $snId =  $this->getSnId();
108
+    $snId = $this->getSnId();
109 109
     return !empty($snId) ? get_unit_param($snId, P_MAX_STACK) : 0;
110 110
   }
111 111
 
Please login to merge, or discard this patch.
classes/DBAL/ActiveRecordAbstract.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@
 block discarded – undo
136 136
       $dbq->setWhereArray(static::translateNames($propertyFilter, static::PROPERTIES_TO_FIELDS));
137 137
     }
138 138
 
139
-    if(static::$_forUpdate == DbQuery::DB_FOR_UPDATE) {
139
+    if (static::$_forUpdate == DbQuery::DB_FOR_UPDATE) {
140 140
       $dbq->setForUpdate();
141 141
       static::$_forUpdate = DbQuery::DB_SHARED;
142 142
     }
Please login to merge, or discard this patch.
classes/template_compile.php 3 patches
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
   }
56 56
 
57 57
   /**
58
-  * Load template source from file
59
-  * @access private
60
-  */
58
+   * Load template source from file
59
+   * @access private
60
+   */
61 61
   function _tpl_load_file($handle, $store_in_db = false)
62 62
   {
63 63
     // Try and open template for read
@@ -100,10 +100,10 @@  discard block
 block discarded – undo
100 100
   }
101 101
 
102 102
   /**
103
-  * Remove any PHP tags that do not belong, these regular expressions are derived from
104
-  * the ones that exist in zend_language_scanner.l
105
-  * @access private
106
-  */
103
+   * Remove any PHP tags that do not belong, these regular expressions are derived from
104
+   * the ones that exist in zend_language_scanner.l
105
+   * @access private
106
+   */
107 107
   function remove_php_tags(&$code)
108 108
   {
109 109
     // This matches the information gathered from the internal PHP lexer
@@ -117,9 +117,9 @@  discard block
 block discarded – undo
117 117
   }
118 118
 
119 119
   /**
120
-  * The all seeing all doing compile method. Parts are inspired by or directly from Smarty
121
-  * @access private
122
-  */
120
+   * The all seeing all doing compile method. Parts are inspired by or directly from Smarty
121
+   * @access private
122
+   */
123 123
   function compile($code, $no_echo = false, $echo_var = '')
124 124
   {
125 125
     global $config;
@@ -290,9 +290,9 @@  discard block
 block discarded – undo
290 290
   }
291 291
 
292 292
   /**
293
-  * Compile variables
294
-  * @access private
295
-  */
293
+   * Compile variables
294
+   * @access private
295
+   */
296 296
   function compile_var_tags(&$text_blocks)
297 297
   {
298 298
     // including $lang variable
@@ -365,9 +365,9 @@  discard block
 block discarded – undo
365 365
   }
366 366
 
367 367
   /**
368
-  * Compile blocks
369
-  * @access private
370
-  */
368
+   * Compile blocks
369
+   * @access private
370
+   */
371 371
   function compile_tag_block($tag_args)
372 372
   {
373 373
     $no_nesting = false;
@@ -453,14 +453,14 @@  discard block
 block discarded – undo
453 453
     $tag_template_php .= 'if ($_' . $tag_args . '_count) {';
454 454
 
455 455
     /**
456
-    * The following uses foreach for iteration instead of a for loop, foreach is faster but requires PHP to make a copy of the contents of the array which uses more memory
457
-    * <code>
458
-    * if (!$offset)
459
-    * {
460
-    *   $tag_template_php .= 'foreach (' . $varref . ' as $_' . $tag_args . '_i => $_' . $tag_args . '_val){';
461
-    * }
462
-    * </code>
463
-    */
456
+     * The following uses foreach for iteration instead of a for loop, foreach is faster but requires PHP to make a copy of the contents of the array which uses more memory
457
+     * <code>
458
+     * if (!$offset)
459
+     * {
460
+     *   $tag_template_php .= 'foreach (' . $varref . ' as $_' . $tag_args . '_i => $_' . $tag_args . '_val){';
461
+     * }
462
+     * </code>
463
+     */
464 464
 
465 465
     $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){';
466 466
 //    $tag_template_php .= '$this->_block_counter["'. $tag_args . '"] = $_' . $tag_args . '_i;';
@@ -471,10 +471,10 @@  discard block
 block discarded – undo
471 471
   }
472 472
 
473 473
   /**
474
-  * Compile IF tags - much of this is from Smarty with
475
-  * some adaptions for our block level methods
476
-  * @access private
477
-  */
474
+   * Compile IF tags - much of this is from Smarty with
475
+   * some adaptions for our block level methods
476
+   * @access private
477
+   */
478 478
   function compile_tag_if($tag_args, $elseif)
479 479
   {
480 480
     // Tokenize args for 'if' tag.
@@ -629,9 +629,9 @@  discard block
 block discarded – undo
629 629
   }
630 630
 
631 631
   /**
632
-  * Compile DEFINE tags
633
-  * @access private
634
-  */
632
+   * Compile DEFINE tags
633
+   * @access private
634
+   */
635 635
   function compile_tag_define($tag_args, $op)
636 636
   {
637 637
     preg_match('#^((?:[a-z0-9\-_]+\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (\'?)([^\']*)(\'?))?$#', $tag_args, $match);
@@ -682,9 +682,9 @@  discard block
 block discarded – undo
682 682
   }
683 683
 
684 684
   /**
685
-  * Compile INCLUDE tag
686
-  * @access private
687
-  */
685
+   * Compile INCLUDE tag
686
+   * @access private
687
+   */
688 688
   function compile_tag_include($tag_args)
689 689
   {
690 690
     // Process dynamic includes
@@ -697,19 +697,19 @@  discard block
 block discarded – undo
697 697
   }
698 698
 
699 699
   /**
700
-  * Compile INCLUDE_PHP tag
701
-  * @access private
702
-  */
700
+   * Compile INCLUDE_PHP tag
701
+   * @access private
702
+   */
703 703
   function compile_tag_include_php($tag_args)
704 704
   {
705 705
     return "\$this->_php_include('$tag_args');";
706 706
   }
707 707
 
708 708
   /**
709
-  * parse expression
710
-  * This is from Smarty
711
-  * @access private
712
-  */
709
+   * parse expression
710
+   * This is from Smarty
711
+   * @access private
712
+   */
713 713
   function _parse_is_expr($is_arg, $tokens)
714 714
   {
715 715
     $expr_end = 0;
@@ -802,14 +802,14 @@  discard block
 block discarded – undo
802 802
   }
803 803
 
804 804
   /**
805
-  * Generates a reference to the array of data values for the given
806
-  * (possibly nested) block namespace. This is a string of the form:
807
-  * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN']
808
-  *
809
-  * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above.
810
-  * NOTE: does not expect a trailing "." on the blockname.
811
-  * @access private
812
-  */
805
+   * Generates a reference to the array of data values for the given
806
+   * (possibly nested) block namespace. This is a string of the form:
807
+   * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN']
808
+   *
809
+   * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above.
810
+   * NOTE: does not expect a trailing "." on the blockname.
811
+   * @access private
812
+   */
813 813
   function generate_block_data_ref($blockname, $include_last_iterator, $defop = false)
814 814
   {
815 815
     // Get an array of the blocks involved.
@@ -845,9 +845,9 @@  discard block
 block discarded – undo
845 845
   }
846 846
 
847 847
   /**
848
-  * Write compiled file to cache directory
849
-  * @access private
850
-  */
848
+   * Write compiled file to cache directory
849
+   * @access private
850
+   */
851 851
   function compile_write($handle, $data)
852 852
   {
853 853
     $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . DOT_PHP_EX;
@@ -870,9 +870,9 @@  discard block
 block discarded – undo
870 870
 
871 871
   // Gorlum's minifier BOF
872 872
   /**
873
-  * Minifies template w/i PHP code by removing extra spaces
874
-  * @access private
875
-  */
873
+   * Minifies template w/i PHP code by removing extra spaces
874
+   * @access private
875
+   */
876 876
   function minify($html)
877 877
   {
878 878
     global $config;
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -143,9 +143,9 @@  discard block
 block discarded – undo
143 143
 
144 144
     preg_match_all('#<!-- INCLUDE (\{\$?[A-Z0-9\-_]+\}|[a-zA-Z0-9\_\-\+\./]+) -->#', $code, $matches);
145 145
     $include_blocks = $matches[1];
146
-    if($include_blocks)
146
+    if ($include_blocks)
147 147
     {
148
-      foreach($include_blocks as &$included_file)
148
+      foreach ($include_blocks as &$included_file)
149 149
       {
150 150
         $included_file .= '.tpl.html';
151 151
       }
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
       $varname = $var_val[3];
311 311
       $new = $this->generate_block_varref($namespace, $varname, $var_val[2]);
312 312
 
313
-      if(!empty($var_val[4])) {
313
+      if (!empty($var_val[4])) {
314 314
         $new = \Ptl\PtlVariableDecorator::decorate($var_val[0], $new, $this->template);
315 315
       }
316 316
 
@@ -464,8 +464,8 @@  discard block
 block discarded – undo
464 464
 
465 465
     $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){';
466 466
 //    $tag_template_php .= '$this->_block_counter["'. $tag_args . '"] = $_' . $tag_args . '_i;';
467
-    $tag_template_php .= '$_'. $tag_args . '_val = &' . $varref . '[$_'. $tag_args. '_i];';
468
-    $tag_template_php .= '$this->_block_value["'. $tag_args . '"] = &' . $varref . '[$_'. $tag_args. '_i];';
467
+    $tag_template_php .= '$_' . $tag_args . '_val = &' . $varref . '[$_' . $tag_args . '_i];';
468
+    $tag_template_php .= '$this->_block_value["' . $tag_args . '"] = &' . $varref . '[$_' . $tag_args . '_i];';
469 469
 
470 470
     return $tag_template_php;
471 471
   }
@@ -569,10 +569,10 @@  discard block
 block discarded – undo
569 569
         break;
570 570
 
571 571
         case 'is':
572
-          $is_arg_start = ($tokens[$i-1] == ')') ? array_pop($is_arg_stack) : $i-1;
572
+          $is_arg_start = ($tokens[$i - 1] == ')') ? array_pop($is_arg_stack) : $i - 1;
573 573
           $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start));
574 574
 
575
-          $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1));
575
+          $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i + 1));
576 576
 
577 577
           array_splice($tokens, $is_arg_start, sizeof($tokens), $new_tokens);
578 578
 
@@ -836,11 +836,11 @@  discard block
 block discarded – undo
836 836
     }
837 837
     else if ($include_last_iterator)
838 838
     {
839
-      return '$_'. $blocks[$blockcount] . '_val';
839
+      return '$_' . $blocks[$blockcount] . '_val';
840 840
     }
841 841
     else
842 842
     {
843
-      return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']';
843
+      return '$_' . $blocks[$blockcount - 1] . '_val[\'' . $blocks[$blockcount] . '\']';
844 844
     }
845 845
   }
846 846
 
@@ -857,7 +857,7 @@  discard block
 block discarded – undo
857 857
     if ($fp = @fopen($filename, 'wb'))
858 858
     {
859 859
       @flock($fp, LOCK_EX);
860
-      @fwrite ($fp, $data);
860
+      @fwrite($fp, $data);
861 861
       @flock($fp, LOCK_UN);
862 862
       @fclose($fp);
863 863
 
@@ -877,7 +877,7 @@  discard block
 block discarded – undo
877 877
   {
878 878
     global $config;
879 879
 
880
-    if(!$config->tpl_minifier)
880
+    if (!$config->tpl_minifier)
881 881
     {
882 882
       return $html;
883 883
     }
@@ -889,14 +889,14 @@  discard block
 block discarded – undo
889 889
     //$html = preg_replace('/[\r\n\t]+/', ' ', $html);
890 890
     $html = preg_replace('/>[\s]*</', '><', $html); // Strip spacechars between tags
891 891
     $html = preg_replace('/[\s]+/', ' ', $html); // Replace several spacechars with one space
892
-    if(!empty($pre[0]))
892
+    if (!empty($pre[0]))
893 893
     {
894
-      foreach($pre[0] as $tag)
894
+      foreach ($pre[0] as $tag)
895 895
       {
896 896
         $tag = preg_replace('/^\ *\/\/[^\<]*?$/m', ' ', $tag); // Strips comments - except those that contains HTML comment inside
897 897
         $tag = preg_replace('/[\ \t]{2,}/', ' ', $tag); // Replace several spaces by one
898 898
         $tag = preg_replace('/\s{2,}/', "\r\n", $tag); // Replace several linefeeds by one
899
-        $html = preg_replace('/#pre#/', $tag, $html,1);
899
+        $html = preg_replace('/#pre#/', $tag, $html, 1);
900 900
       }
901 901
     }
902 902
 
Please login to merge, or discard this patch.
Braces   +33 added lines, -66 removed lines patch added patch discarded remove patch
@@ -37,8 +37,7 @@  discard block
 block discarded – undo
37 37
 *
38 38
 * @package phpBB3
39 39
 */
40
-class template_compile
41
-{
40
+class template_compile {
42 41
   var $template;
43 42
 
44 43
   // Various storage arrays
@@ -58,8 +57,7 @@  discard block
 block discarded – undo
58 57
   * Load template source from file
59 58
   * @access private
60 59
   */
61
-  function _tpl_load_file($handle, $store_in_db = false)
62
-  {
60
+  function _tpl_load_file($handle, $store_in_db = false) {
63 61
     // Try and open template for read
64 62
     if (!file_exists($this->template->files[$handle]))
65 63
     {
@@ -67,8 +65,7 @@  discard block
 block discarded – undo
67 65
       {
68 66
         return;
69 67
         trigger_error("template->_tpl_load_file(): File {$this->template->files[$handle]} does not exist or is empty", E_USER_ERROR);
70
-      }
71
-      else
68
+      } else
72 69
       {
73 70
         $this->template->files[$handle] = $this->template->files_inherit[$handle];
74 71
       }
@@ -104,8 +101,7 @@  discard block
 block discarded – undo
104 101
   * the ones that exist in zend_language_scanner.l
105 102
   * @access private
106 103
   */
107
-  function remove_php_tags(&$code)
108
-  {
104
+  function remove_php_tags(&$code) {
109 105
     // This matches the information gathered from the internal PHP lexer
110 106
     $match = array(
111 107
       '#<([\?%])=?.*?\1>#s',
@@ -120,8 +116,7 @@  discard block
 block discarded – undo
120 116
   * The all seeing all doing compile method. Parts are inspired by or directly from Smarty
121 117
   * @access private
122 118
   */
123
-  function compile($code, $no_echo = false, $echo_var = '')
124
-  {
119
+  function compile($code, $no_echo = false, $echo_var = '') {
125 120
     global $config;
126 121
 
127 122
     if ($echo_var)
@@ -226,15 +221,13 @@  discard block
 block discarded – undo
226 221
               $var = substr($temp, 2, -1);
227 222
               //$file = $this->template->_tpldata['DEFINE']['.'][$var];
228 223
               $temp = "\$this->_tpldata['DEFINE']['.']['$var']";
229
-            }
230
-            else
224
+            } else
231 225
             {
232 226
               $var = substr($temp, 1, -1);
233 227
               //$file = $this->template->_rootref[$var];
234 228
               $temp = "\$this->_rootref['$var']";
235 229
             }
236
-          }
237
-          else
230
+          } else
238 231
           {
239 232
             $file = $temp;
240 233
           }
@@ -293,8 +286,7 @@  discard block
 block discarded – undo
293 286
   * Compile variables
294 287
   * @access private
295 288
   */
296
-  function compile_var_tags(&$text_blocks)
297
-  {
289
+  function compile_var_tags(&$text_blocks) {
298 290
     // including $lang variable
299 291
     global $lang, $config;
300 292
 
@@ -368,8 +360,7 @@  discard block
 block discarded – undo
368 360
   * Compile blocks
369 361
   * @access private
370 362
   */
371
-  function compile_tag_block($tag_args)
372
-  {
363
+  function compile_tag_block($tag_args) {
373 364
     $no_nesting = false;
374 365
 
375 366
     // Is the designer wanting to call another loop in a loop?
@@ -392,8 +383,7 @@  discard block
 block discarded – undo
392 383
       if ($match[2] < 0)
393 384
       {
394 385
         $loop_start = '($_' . $tag_args . '_count ' . $match[2] . ' < 0 ? 0 : $_' . $tag_args . '_count ' . $match[2] . ')';
395
-      }
396
-      else
386
+      } else
397 387
       {
398 388
         $loop_start = '($_' . $tag_args . '_count < ' . $match[2] . ' ? $_' . $tag_args . '_count : ' . $match[2] . ')';
399 389
       }
@@ -401,17 +391,14 @@  discard block
 block discarded – undo
401 391
       if (strlen($match[3]) < 1 || $match[3] == -1)
402 392
       {
403 393
         $loop_end = '$_' . $tag_args . '_count';
404
-      }
405
-      else if ($match[3] >= 0)
394
+      } else if ($match[3] >= 0)
406 395
       {
407 396
         $loop_end = '(' . ($match[3] + 1) . ' > $_' . $tag_args . '_count ? $_' . $tag_args . '_count : ' . ($match[3] + 1) . ')';
408
-      }
409
-      else //if ($match[3] < -1)
397
+      } else //if ($match[3] < -1)
410 398
       {
411 399
         $loop_end = '$_' . $tag_args . '_count' . ($match[3] + 1);
412 400
       }
413
-    }
414
-    else
401
+    } else
415 402
     {
416 403
       $loop_start = 0;
417 404
       $loop_end = '$_' . $tag_args . '_count';
@@ -424,8 +411,7 @@  discard block
 block discarded – undo
424 411
     {
425 412
       // We need to implode $no_nesting times from the end...
426 413
       $block = array_slice($this->block_names, -$no_nesting);
427
-    }
428
-    else
414
+    } else
429 415
     {
430 416
       $block = $this->block_names;
431 417
     }
@@ -435,8 +421,7 @@  discard block
 block discarded – undo
435 421
       // Block is not nested.
436 422
       $tag_template_php = '$_' . $tag_args . "_count = (isset(\$this->_tpldata['$tag_args'])) ? sizeof(\$this->_tpldata['$tag_args']) : 0;";
437 423
       $varref = "\$this->_tpldata['$tag_args']";
438
-    }
439
-    else
424
+    } else
440 425
     {
441 426
       // This block is nested.
442 427
       // Generate a namespace string for this block.
@@ -475,8 +460,7 @@  discard block
 block discarded – undo
475 460
   * some adaptions for our block level methods
476 461
   * @access private
477 462
   */
478
-  function compile_tag_if($tag_args, $elseif)
479
-  {
463
+  function compile_tag_if($tag_args, $elseif) {
480 464
     // Tokenize args for 'if' tag.
481 465
     preg_match_all('/(?:
482 466
       "[^"\\\\]*(?:\\\\.[^"\\\\]*)*"         |
@@ -584,8 +568,7 @@  discard block
 block discarded – undo
584 568
           if (preg_match('#^((?:[a-z0-9\-_]+\.)+)?(\$)?(?=[A-Za-z])([A-Za-z0-9\-_]+)#s', $token, $varrefs))
585 569
           {
586 570
             $token = (!empty($varrefs[1])) ? $this->generate_block_data_ref(substr($varrefs[1], 0, -1), true, $varrefs[2]) . '[\'' . $varrefs[3] . '\']' : (($varrefs[2]) ? '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $varrefs[3] . '\']' : '$this->_rootref[\'' . $varrefs[3] . '\']');
587
-          }
588
-          else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs))
571
+          } else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs))
589 572
           {
590 573
             // Allow checking if loops are set with .loopname
591 574
             // It is also possible to check the loop count by doing <!-- IF .loopname > 1 --> for example
@@ -601,8 +584,7 @@  discard block
 block discarded – undo
601 584
 
602 585
               // Add the block reference for the last child.
603 586
               $varref .= "['" . $block . "']";
604
-            }
605
-            else
587
+            } else
606 588
             {
607 589
               $varref = '$this->_tpldata';
608 590
 
@@ -610,8 +592,7 @@  discard block
 block discarded – undo
610 592
               $varref .= "['" . $blocks[0] . "']";
611 593
             }
612 594
             $token = "sizeof($varref)";
613
-          }
614
-          else if (!empty($token))
595
+          } else if (!empty($token))
615 596
           {
616 597
             $token = '(' . $token . ')';
617 598
           }
@@ -632,8 +613,7 @@  discard block
 block discarded – undo
632 613
   * Compile DEFINE tags
633 614
   * @access private
634 615
   */
635
-  function compile_tag_define($tag_args, $op)
636
-  {
616
+  function compile_tag_define($tag_args, $op) {
637 617
     preg_match('#^((?:[a-z0-9\-_]+\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (\'?)([^\']*)(\'?))?$#', $tag_args, $match);
638 618
 
639 619
     if (empty($match[2]) || (!isset($match[4]) && $op))
@@ -656,8 +636,7 @@  discard block
 block discarded – undo
656 636
 
657 637
       // Now replace the php code
658 638
       $match[4] = "'" . str_replace(array('<?php echo ', '; ?>'), array("' . ", " . '"), $match[4]) . "'";
659
-    }
660
-    else
639
+    } else
661 640
     {
662 641
       preg_match('#true|false|\.#i', $match[4], $type);
663 642
 
@@ -685,8 +664,7 @@  discard block
 block discarded – undo
685 664
   * Compile INCLUDE tag
686 665
   * @access private
687 666
   */
688
-  function compile_tag_include($tag_args)
689
-  {
667
+  function compile_tag_include($tag_args) {
690 668
     // Process dynamic includes
691 669
     if ($tag_args[0] == '$')
692 670
     {
@@ -700,8 +678,7 @@  discard block
 block discarded – undo
700 678
   * Compile INCLUDE_PHP tag
701 679
   * @access private
702 680
   */
703
-  function compile_tag_include_php($tag_args)
704
-  {
681
+  function compile_tag_include_php($tag_args) {
705 682
     return "\$this->_php_include('$tag_args');";
706 683
   }
707 684
 
@@ -710,8 +687,7 @@  discard block
 block discarded – undo
710 687
   * This is from Smarty
711 688
   * @access private
712 689
   */
713
-  function _parse_is_expr($is_arg, $tokens)
714
-  {
690
+  function _parse_is_expr($is_arg, $tokens) {
715 691
     $expr_end = 0;
716 692
     $negate_expr = false;
717 693
 
@@ -719,8 +695,7 @@  discard block
 block discarded – undo
719 695
     {
720 696
       $negate_expr = true;
721 697
       $expr_type = array_shift($tokens);
722
-    }
723
-    else
698
+    } else
724 699
     {
725 700
       $expr_type = $first_token;
726 701
     }
@@ -733,8 +708,7 @@  discard block
 block discarded – undo
733 708
           $expr_end++;
734 709
           $expr_arg = $tokens[$expr_end++];
735 710
           $expr = "!(($is_arg / $expr_arg) % $expr_arg)";
736
-        }
737
-        else
711
+        } else
738 712
         {
739 713
           $expr = "!($is_arg & 1)";
740 714
         }
@@ -746,8 +720,7 @@  discard block
 block discarded – undo
746 720
           $expr_end++;
747 721
           $expr_arg = $tokens[$expr_end++];
748 722
           $expr = "(($is_arg / $expr_arg) % $expr_arg)";
749
-        }
750
-        else
723
+        } else
751 724
         {
752 725
           $expr = "($is_arg & 1)";
753 726
         }
@@ -786,8 +759,7 @@  discard block
 block discarded – undo
786 759
    *
787 760
    * @return string
788 761
    */
789
-  private function generate_block_varref($namespace, $varname, $defop = false)
790
-  {
762
+  private function generate_block_varref($namespace, $varname, $defop = false) {
791 763
     // Strip the trailing period.
792 764
     $namespace = substr($namespace, 0, -1);
793 765
 
@@ -810,8 +782,7 @@  discard block
 block discarded – undo
810 782
   * NOTE: does not expect a trailing "." on the blockname.
811 783
   * @access private
812 784
   */
813
-  function generate_block_data_ref($blockname, $include_last_iterator, $defop = false)
814
-  {
785
+  function generate_block_data_ref($blockname, $include_last_iterator, $defop = false) {
815 786
     // Get an array of the blocks involved.
816 787
     $blocks = explode('.', $blockname);
817 788
     $blockcount = sizeof($blocks) - 1;
@@ -833,12 +804,10 @@  discard block
 block discarded – undo
833 804
         $varref .= '[$_' . $blocks[$blockcount] . '_i]';
834 805
       }
835 806
       return $varref;
836
-    }
837
-    else if ($include_last_iterator)
807
+    } else if ($include_last_iterator)
838 808
     {
839 809
       return '$_'. $blocks[$blockcount] . '_val';
840
-    }
841
-    else
810
+    } else
842 811
     {
843 812
       return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']';
844 813
     }
@@ -848,8 +817,7 @@  discard block
 block discarded – undo
848 817
   * Write compiled file to cache directory
849 818
   * @access private
850 819
   */
851
-  function compile_write($handle, $data)
852
-  {
820
+  function compile_write($handle, $data) {
853 821
     $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . DOT_PHP_EX;
854 822
 
855 823
     $data = "<?php if (!defined('INSIDE')) exit;" . ((strpos($data, '<?php') === 0) ? substr($data, 5) : ' ?>' . $data);
@@ -873,8 +841,7 @@  discard block
 block discarded – undo
873 841
   * Minifies template w/i PHP code by removing extra spaces
874 842
   * @access private
875 843
   */
876
-  function minify($html)
877
-  {
844
+  function minify($html) {
878 845
     global $config;
879 846
 
880 847
     if(!$config->tpl_minifier)
Please login to merge, or discard this patch.
includes/includes/ube_attack_calculate.php 2 patches
Spacing   +3 added lines, -4 removed lines patch added patch discarded remove patch
@@ -165,8 +165,7 @@  discard block
 block discarded – undo
165 165
     $planet_info[PLANET_SYSTEM],
166 166
     $planet_info[PLANET_PLANET],
167 167
     htmlentities($planet_info[PLANET_NAME], ENT_COMPAT, 'UTF-8'),
168
-    $lang[$outcome['UBE_COMBAT_RESULT'] == UBE_COMBAT_RESULT_WIN ? 'ube_report_info_outcome_win' :
169
-      ($outcome['UBE_COMBAT_RESULT'] == UBE_COMBAT_RESULT_DRAW ? 'ube_report_info_outcome_draw' : 'ube_report_info_outcome_loss')]
168
+    $lang[$outcome['UBE_COMBAT_RESULT'] == UBE_COMBAT_RESULT_WIN ? 'ube_report_info_outcome_win' : ($outcome['UBE_COMBAT_RESULT'] == UBE_COMBAT_RESULT_DRAW ? 'ube_report_info_outcome_draw' : 'ube_report_info_outcome_loss')]
170 169
   );
171 170
 
172 171
   $text_defender = '';
@@ -251,7 +250,7 @@  discard block
 block discarded – undo
251 250
       // Просматриваем результаты изменения флотов
252 251
       foreach ($fleet_info[UBE_COUNT] as $unit_id => $unit_count) {
253 252
         // Перебираем аутком на случай восстановления юнитов
254
-        $units_lost = (float)$fleets_outcome[$fleet_id][UBE_UNITS_LOST][$unit_id];
253
+        $units_lost = (float) $fleets_outcome[$fleet_id][UBE_UNITS_LOST][$unit_id];
255 254
 
256 255
         $units_left = $unit_count - $units_lost;
257 256
         if ($fleet_id) {
@@ -275,7 +274,7 @@  discard block
 block discarded – undo
275 274
     // Если во флоте остались юниты или это планета - генерируем изменение ресурсов
276 275
     if ($new_fleet_count || !$fleet_id) {
277 276
       foreach (sn_get_groups('resources_loot') as $resource_id) {
278
-        $resource_change = (float)$fleets_outcome[$fleet_id][UBE_RESOURCES_LOOTED][$resource_id] + (float)$fleets_outcome[$fleet_id][UBE_CARGO_DROPPED][$resource_id];
277
+        $resource_change = (float) $fleets_outcome[$fleet_id][UBE_RESOURCES_LOOTED][$resource_id] + (float) $fleets_outcome[$fleet_id][UBE_CARGO_DROPPED][$resource_id];
279 278
         if ($resource_change) {
280 279
           $resource_db_name = ($fleet_id ? 'fleet_resource_' : '') . pname_resource_name($resource_id);
281 280
           $fleet_delta[$resource_db_name] = -($resource_change);
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -290,10 +290,12 @@  discard block
 block discarded – undo
290 290
       }
291 291
     }
292 292
 
293
-    if ($fleet_id) // Не планета
293
+    if ($fleet_id) {
294
+      // Не планета
294 295
     {
295 296
       if ($fleet_info[UBE_FLEET_TYPE] == UBE_ATTACKERS && $outcome[UBE_MOON_REAPERS] == UBE_MOON_REAPERS_DIED) {
296 297
         $new_fleet_count = 0;
298
+    }
297 299
       }
298 300
 
299 301
       if ($new_fleet_count) {
@@ -316,10 +318,12 @@  discard block
 block discarded – undo
316 318
         }
317 319
         DBStaticPlanet::db_planet_set_by_id($planet_id, implode(',', $temp));
318 320
       }
319
-      if (!empty($db_changeset)) // Сохраняем изменения юнитов на планете - если они есть
321
+      if (!empty($db_changeset)) {
322
+        // Сохраняем изменения юнитов на планете - если они есть
320 323
       {
321 324
         OldDbChangeSet::db_changeset_apply($db_changeset);
322 325
       }
326
+      }
323 327
     }
324 328
   }
325 329
 
Please login to merge, or discard this patch.
includes/functions/uni_functions.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -236,9 +236,11 @@
 block discarded – undo
236 236
   }
237 237
 
238 238
   // Если новая планета не найдена или было переключения - проверяем текущую выбранную планету
239
-  if (!isset($planet_row['id'])) // || $planet_row['id'] != $user['current_planet']
239
+  if (!isset($planet_row['id'])) {
240
+    // || $planet_row['id'] != $user['current_planet']
240 241
   {
241 242
     $planet_row = DBStaticPlanet::db_planet_by_id_and_owner($user['current_planet'], $user['id'], false, 'id');
243
+  }
242 244
     // Если текущей планеты не существует - выставляем Столицу
243 245
     if (!isset($planet_row['id'])) {
244 246
       $planet_row = DBStaticPlanet::db_planet_by_id_and_owner($user['id_planet'], $user['id'], false, 'id');
Please login to merge, or discard this patch.