Completed
Push — work-fleets ( 9e446e...674b8a )
by SuperNova.WS
12:48 queued 05:50
created
classes/SnDbCachedOperator.php 3 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -314,6 +314,9 @@  discard block
 block discarded – undo
314 314
     return $result;
315 315
   }
316 316
 
317
+  /**
318
+   * @param integer $location_type
319
+   */
317 320
   public static function db_ins_field_set($location_type, $field_set, $serialize = false) {
318 321
     // TODO multiinsert
319 322
     !sn_db_field_set_is_safe($field_set) ? $field_set = sn_db_field_set_make_safe($field_set, $serialize) : false;
@@ -350,7 +353,7 @@  discard block
 block discarded – undo
350 353
   /**
351 354
    * Блокирует указанные таблицу/список таблиц
352 355
    *
353
-   * @param string|array $tables Таблица/список таблиц для блокировки. Названия таблиц - без префиксов
356
+   * @param string $tables Таблица/список таблиц для блокировки. Названия таблиц - без префиксов
354 357
    * <p>string - название таблицы для блокировки</p>
355 358
    * <p>array - массив, где ключ - имя таблицы, а значение - условия блокировки элементов</p>
356 359
    */
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -298,9 +298,11 @@
 block discarded – undo
298 298
     $set = trim($set);
299 299
     $table_name = static::$location_info[$location_type][P_TABLE_NAME];
300 300
     if ($result = $this->db->doInsert("INSERT INTO `{{{$table_name}}}` SET {$set}")) {
301
-      if ($this->db->db_affected_rows()) // Обновляем данные только если ряд был затронут
301
+      if ($this->db->db_affected_rows()) {
302
+        // Обновляем данные только если ряд был затронут
302 303
       {
303 304
         $record_id = $this->db->db_insert_id();
305
+      }
304 306
         // Вытаскиваем запись целиком, потому что в $set могли быть "данные по умолчанию"
305 307
         $result = $this->db_get_record_by_id($location_type, $record_id);
306 308
         // Очищаем второстепенные кэши - потому что вставленная запись могла повлиять на результаты запросов или локация или еще чего
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
               ($filter ? ' WHERE ' . $filter : '') .
243 243
               ($fetch ? ' LIMIT 1' : ''));
244 244
           }
245
-          while($row = db_fetch($query)) {
245
+          while ($row = db_fetch($query)) {
246 246
             // Исключаем из списка родительских ИД уже заблокированные записи
247 247
             if (!$this->snCache->cache_lock_get($owner_location_type, $row['parent_id'])) {
248 248
               $parent_id_list[$row['parent_id']] = $row['parent_id'];
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
           . " FOR UPDATE"
283 283
         );
284 284
       }
285
-      while($row = db_fetch($query)) {
285
+      while ($row = db_fetch($query)) {
286 286
         // Caching record in row cache
287 287
         $this->snCache->cache_set($location_type, $row);
288 288
         // Making ref to cached record in query cache
Please login to merge, or discard this patch.
classes/template.php 5 patches
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -103,6 +103,7 @@
 block discarded – undo
103 103
   /**
104 104
   * Set custom template location (able to use directory outside of phpBB)
105 105
   * @access public
106
+  * @param string $template_path
106 107
   */
107 108
   function set_custom_template($template_path, $template_name, $fallback_template_path = false)
108 109
   {
Please login to merge, or discard this patch.
Indentation   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
 class template
26 26
 {
27 27
   /** variable that holds all the data we'll be substituting into
28
-  * the compiled templates. Takes form:
29
-  * --> $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value
30
-  * if it's a root-level variable, it'll be like this:
31
-  * --> $this->_tpldata[.][0][varname] == value
32
-  */
28
+   * the compiled templates. Takes form:
29
+   * --> $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value
30
+   * if it's a root-level variable, it'll be like this:
31
+   * --> $this->_tpldata[.][0][varname] == value
32
+   */
33 33
   var $_tpldata = array('.' => array(0 => array()));
34 34
   var $_rootref;
35 35
 //  var $_block_counter = array();
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
   var $parsed = false;
61 61
 
62 62
   /**
63
-  * Set template location
64
-  * @access public
65
-  */
63
+   * Set template location
64
+   * @access public
65
+   */
66 66
   function set_template()
67 67
   {
68 68
     global $phpbb_root_path, $user;
@@ -101,9 +101,9 @@  discard block
 block discarded – undo
101 101
   }
102 102
 
103 103
   /**
104
-  * Set custom template location (able to use directory outside of phpBB)
105
-  * @access public
106
-  */
104
+   * Set custom template location (able to use directory outside of phpBB)
105
+   * @access public
106
+   */
107 107
   function set_custom_template($template_path, $template_name, $fallback_template_path = false)
108 108
   {
109 109
     global $phpbb_root_path, $user;
@@ -142,10 +142,10 @@  discard block
 block discarded – undo
142 142
   }
143 143
 
144 144
   /**
145
-  * Sets the template filenames for handles. $filename_array
146
-  * should be a hash of handle => filename pairs.
147
-  * @access public
148
-  */
145
+   * Sets the template filenames for handles. $filename_array
146
+   * should be a hash of handle => filename pairs.
147
+   * @access public
148
+   */
149 149
   function set_filenames($filename_array)
150 150
   {
151 151
     if (!is_array($filename_array))
@@ -172,9 +172,9 @@  discard block
 block discarded – undo
172 172
   }
173 173
 
174 174
   /**
175
-  * Destroy template data set
176
-  * @access public
177
-  */
175
+   * Destroy template data set
176
+   * @access public
177
+   */
178 178
   function destroy()
179 179
   {
180 180
     $this->_tpldata = array('.' => array(0 => array()));
@@ -182,9 +182,9 @@  discard block
 block discarded – undo
182 182
   }
183 183
 
184 184
   /**
185
-  * Reset/empty complete block
186
-  * @access public
187
-  */
185
+   * Reset/empty complete block
186
+   * @access public
187
+   */
188 188
   function destroy_block_vars($blockname)
189 189
   {
190 190
     if (strpos($blockname, '.') !== false)
@@ -212,9 +212,9 @@  discard block
 block discarded – undo
212 212
   }
213 213
 
214 214
   /**
215
-  * Display handle
216
-  * @access public
217
-  */
215
+   * Display handle
216
+   * @access public
217
+   */
218 218
   function display($handle, $include_once = true)
219 219
   {
220 220
     global $user, $phpbb_hook, $lang, $config;
@@ -248,9 +248,9 @@  discard block
 block discarded – undo
248 248
   }
249 249
 
250 250
   /**
251
-  * Display the handle and assign the output to a template variable or return the compiled result.
252
-  * @access public
253
-  */
251
+   * Display the handle and assign the output to a template variable or return the compiled result.
252
+   * @access public
253
+   */
254 254
   function assign_display($handle, $template_var = '', $return_content = true, $include_once = false)
255 255
   {
256 256
     ob_start();
@@ -268,9 +268,9 @@  discard block
 block discarded – undo
268 268
   }
269 269
 
270 270
   /**
271
-  * Load a compiled template if possible, if not, recompile it
272
-  * @access private
273
-  */
271
+   * Load a compiled template if possible, if not, recompile it
272
+   * @access private
273
+   */
274 274
   function _tpl_load(&$handle)
275 275
   {
276 276
     global $user, $config;
@@ -453,9 +453,9 @@  discard block
 block discarded – undo
453 453
   }
454 454
 
455 455
   /**
456
-  * Assign key variable pairs from an array
457
-  * @access public
458
-  */
456
+   * Assign key variable pairs from an array
457
+   * @access public
458
+   */
459 459
   function assign_vars($vararray)
460 460
   {
461 461
     foreach ($vararray as $key => $val)
@@ -467,9 +467,9 @@  discard block
 block discarded – undo
467 467
   }
468 468
 
469 469
   /**
470
-  * Assign a single variable to a single key
471
-  * @access public
472
-  */
470
+   * Assign a single variable to a single key
471
+   * @access public
472
+   */
473 473
   function assign_var($varname, $varval)
474 474
   {
475 475
     $this->_rootref[$varname] = $varval;
@@ -478,9 +478,9 @@  discard block
 block discarded – undo
478 478
   }
479 479
 
480 480
   /**
481
-  * Assign key variable pairs from an array to a specified block
482
-  * @access public
483
-  */
481
+   * Assign key variable pairs from an array to a specified block
482
+   * @access public
483
+   */
484 484
   function assign_block_vars($blockname, $vararray)
485 485
   {
486 486
     if (strpos($blockname, '.') !== false)
@@ -545,33 +545,33 @@  discard block
 block discarded – undo
545 545
   }
546 546
 
547 547
   /**
548
-  * Change already assigned key variable pair (one-dimensional - single loop entry)
549
-  *
550
-  * An example of how to use this function:
551
-  * {@example alter_block_array.php}
552
-  *
553
-  * @param  string  $blockname  the blockname, for example 'loop'
554
-  * @param  array $vararray the var array to insert/add or merge
555
-  * @param  mixed $key    Key to search for
556
-  *
557
-  * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position]
558
-  *
559
-  * int: Position [the position to change or insert at directly given]
560
-  *
561
-  * If key is false the position is set to 0
562
-  * If key is true the position is set to the last entry
563
-  *
564
-  * @param  string  $mode   Mode to execute (valid modes are 'insert' and 'change')
565
-  *
566
-  * If insert, the vararray is inserted at the given position (position counting from zero).
567
-  * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value).
568
-  *
569
-  * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array)
570
-  * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars)
571
-  *
572
-  * @return bool false on error, true on success
573
-  * @access public
574
-  */
548
+   * Change already assigned key variable pair (one-dimensional - single loop entry)
549
+   *
550
+   * An example of how to use this function:
551
+   * {@example alter_block_array.php}
552
+   *
553
+   * @param  string  $blockname  the blockname, for example 'loop'
554
+   * @param  array $vararray the var array to insert/add or merge
555
+   * @param  mixed $key    Key to search for
556
+   *
557
+   * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position]
558
+   *
559
+   * int: Position [the position to change or insert at directly given]
560
+   *
561
+   * If key is false the position is set to 0
562
+   * If key is true the position is set to the last entry
563
+   *
564
+   * @param  string  $mode   Mode to execute (valid modes are 'insert' and 'change')
565
+   *
566
+   * If insert, the vararray is inserted at the given position (position counting from zero).
567
+   * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value).
568
+   *
569
+   * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array)
570
+   * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars)
571
+   *
572
+   * @return bool false on error, true on success
573
+   * @access public
574
+   */
575 575
   function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert')
576 576
   {
577 577
     if (strpos($blockname, '.') !== false)
@@ -655,9 +655,9 @@  discard block
 block discarded – undo
655 655
   }
656 656
 
657 657
   /**
658
-  * Include a separate template
659
-  * @access private
660
-  */
658
+   * Include a separate template
659
+   * @access private
660
+   */
661 661
   function _tpl_include($filename, $include = true)
662 662
   {
663 663
     global $lang, $config;
@@ -686,9 +686,9 @@  discard block
 block discarded – undo
686 686
   }
687 687
 
688 688
   /**
689
-  * Include a php-file
690
-  * @access private
691
-  */
689
+   * Include a php-file
690
+   * @access private
691
+   */
692 692
   function _php_include($filename)
693 693
   {
694 694
     global $phpbb_root_path;
@@ -705,9 +705,9 @@  discard block
 block discarded – undo
705 705
   }
706 706
 
707 707
   /**
708
-  * Assign key variable pairs from an array with block support
709
-  * @access public
710
-  */
708
+   * Assign key variable pairs from an array with block support
709
+   * @access public
710
+   */
711 711
   function assign_recursive($values, $name = '')
712 712
   {
713 713
     if(isset($values['.']))
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
       // Re-position template blocks
629 629
       for ($i = sizeof($this->_tpldata[$blockname]); $i > $key; $i--)
630 630
       {
631
-        $this->_tpldata[$blockname][$i] = $this->_tpldata[$blockname][$i-1];
631
+        $this->_tpldata[$blockname][$i] = $this->_tpldata[$blockname][$i - 1];
632 632
         $this->_tpldata[$blockname][$i]['S_ROW_COUNT'] = $i;
633 633
       }
634 634
 
@@ -710,13 +710,13 @@  discard block
 block discarded – undo
710 710
   */
711 711
   function assign_recursive($values, $name = '')
712 712
   {
713
-    if(isset($values['.']))
713
+    if (isset($values['.']))
714 714
     {
715 715
       $values_extra = $values['.'];
716 716
       unset($values['.']);
717 717
     }
718 718
 
719
-    if(!$name)
719
+    if (!$name)
720 720
     {
721 721
       $this->assign_vars($values);
722 722
     }
@@ -725,12 +725,12 @@  discard block
 block discarded – undo
725 725
       $this->assign_block_vars($name, $values);
726 726
     }
727 727
 
728
-    if(isset($values_extra))
728
+    if (isset($values_extra))
729 729
     {
730
-      foreach($values_extra as $sub_array_name => $sub_array)
730
+      foreach ($values_extra as $sub_array_name => $sub_array)
731 731
       {
732 732
         $new_name = $name . ($name ? '.' : '') . $sub_array_name;
733
-        foreach($sub_array as $sub_element)
733
+        foreach ($sub_array as $sub_element)
734 734
         {
735 735
           $this->assign_recursive($sub_element, $new_name);
736 736
         }
Please login to merge, or discard this patch.
Braces   +29 added lines, -58 removed lines patch added patch discarded remove patch
@@ -16,8 +16,7 @@  discard block
 block discarded – undo
16 16
 * Base Template class.
17 17
 * @package phpBB3
18 18
 */
19
-class template
20
-{
19
+class template {
21 20
   /** variable that holds all the data we'll be substituting into
22 21
   * the compiled templates. Takes form:
23 22
   * --> $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value
@@ -57,8 +56,7 @@  discard block
 block discarded – undo
57 56
   * Set template location
58 57
   * @access public
59 58
   */
60
-  public function set_template()
61
-  {
59
+  public function set_template() {
62 60
     global $phpbb_root_path, $user;
63 61
 
64 62
     if (file_exists($phpbb_root_path . 'styles/' . $user->theme['template_path'] . '/template'))
@@ -83,8 +81,7 @@  discard block
 block discarded – undo
83 81
       {
84 82
         $this->inherit_root = $phpbb_root_path . 'styles/' . $user->theme['template_inherit_path'] . '/template';
85 83
       }
86
-    }
87
-    else
84
+    } else
88 85
     {
89 86
       trigger_error('Template path could not be found: styles/' . $user->theme['template_path'] . '/template', E_USER_ERROR);
90 87
     }
@@ -98,8 +95,7 @@  discard block
 block discarded – undo
98 95
   * Set custom template location (able to use directory outside of phpBB)
99 96
   * @access public
100 97
   */
101
-  public function set_custom_template($template_path, $template_name, $fallback_template_path = false)
102
-  {
98
+  public function set_custom_template($template_path, $template_name, $fallback_template_path = false) {
103 99
     global $phpbb_root_path, $user;
104 100
 
105 101
     // Make sure $template_path has no ending slash
@@ -120,8 +116,7 @@  discard block
 block discarded – undo
120 116
 
121 117
       $this->inherit_root = $fallback_template_path;
122 118
       $this->orig_tpl_inherits_id = true;
123
-    }
124
-    else
119
+    } else
125 120
     {
126 121
       $this->orig_tpl_inherits_id = false;
127 122
     }
@@ -140,8 +135,7 @@  discard block
 block discarded – undo
140 135
   * should be a hash of handle => filename pairs.
141 136
   * @access public
142 137
   */
143
-  public function set_filenames($filename_array)
144
-  {
138
+  public function set_filenames($filename_array) {
145 139
     if (!is_array($filename_array))
146 140
     {
147 141
       return false;
@@ -169,8 +163,7 @@  discard block
 block discarded – undo
169 163
   * Destroy template data set
170 164
   * @access public
171 165
   */
172
-  public function destroy()
173
-  {
166
+  public function destroy() {
174 167
     $this->_tpldata = array('.' => array(0 => array()));
175 168
     $this->_rootref = &$this->_tpldata['.'][0];
176 169
   }
@@ -179,8 +172,7 @@  discard block
 block discarded – undo
179 172
   * Reset/empty complete block
180 173
   * @access public
181 174
   */
182
-  public function destroy_block_vars($blockname)
183
-  {
175
+  public function destroy_block_vars($blockname) {
184 176
     if (strpos($blockname, '.') !== false)
185 177
     {
186 178
       // Nested block.
@@ -195,8 +187,7 @@  discard block
 block discarded – undo
195 187
       }
196 188
 
197 189
       unset($str[$blocks[$blockcount]]);
198
-    }
199
-    else
190
+    } else
200 191
     {
201 192
       // Top-level block.
202 193
       unset($this->_tpldata[$blockname]);
@@ -209,8 +200,7 @@  discard block
 block discarded – undo
209 200
   * Display handle
210 201
   * @access public
211 202
   */
212
-  public function display($handle, $include_once = true)
213
-  {
203
+  public function display($handle, $include_once = true) {
214 204
     global $phpbb_hook;
215 205
 
216 206
     if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, __FUNCTION__), $handle, $include_once))
@@ -232,8 +222,7 @@  discard block
 block discarded – undo
232 222
     if ($filename = $this->_tpl_load($handle))
233 223
     {
234 224
       ($include_once) ? include_once($filename) : include($filename);
235
-    }
236
-    else
225
+    } else
237 226
     {
238 227
       eval(' ?>' . $this->compiled_code[$handle] . '<?php ');
239 228
     }
@@ -245,8 +234,7 @@  discard block
 block discarded – undo
245 234
   * Display the handle and assign the output to a template variable or return the compiled result.
246 235
   * @access public
247 236
   */
248
-  public function assign_display($handle, $template_var = '', $return_content = true, $include_once = false)
249
-  {
237
+  public function assign_display($handle, $template_var = '', $return_content = true, $include_once = false) {
250 238
     ob_start();
251 239
     $this->display($handle, $include_once);
252 240
     $contents = ob_get_clean();
@@ -265,8 +253,7 @@  discard block
 block discarded – undo
265 253
   * Load a compiled template if possible, if not, recompile it
266 254
   * @access private
267 255
   */
268
-  public function _tpl_load(&$handle)
269
-  {
256
+  public function _tpl_load(&$handle) {
270 257
     global $user;
271 258
 
272 259
     if (!isset($this->filename[$handle]))
@@ -287,8 +274,7 @@  discard block
 block discarded – undo
287 274
     if (!file_exists($filename) || @filesize($filename) === 0)
288 275
     {
289 276
       $recompile = true;
290
-    }
291
-    else if (classSupernova::$config->load_tplcompile)
277
+    } else if (classSupernova::$config->load_tplcompile)
292 278
     {
293 279
       // No way around it: we need to check inheritance here
294 280
       if ($user->theme['template_inherits_id'] && !file_exists($this->files[$handle]))
@@ -376,15 +362,13 @@  discard block
 block discarded – undo
376 362
               $this->files[$row['template_filename']] = $file;
377 363
               $this->files_inherit[$row['template_filename']] = $file;
378 364
               $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id'];
379
-            }
380
-            else if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id'])
365
+            } else if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id'])
381 366
             {
382 367
               // Ok, we have a situation. There is a file in the subtemplate, but nothing in the DB. We have to fix that.
383 368
               $force_reload = true;
384 369
               $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id'];
385 370
             }
386
-          }
387
-          else
371
+          } else
388 372
           {
389 373
             $this->files_template[$row['template_filename']] = $user->theme['template_id'];
390 374
           }
@@ -394,8 +378,7 @@  discard block
 block discarded – undo
394 378
             if ($row['template_filename'] == $this->filename[$handle])
395 379
             {
396 380
               $compile->_tpl_load_file($handle, true);
397
-            }
398
-            else
381
+            } else
399 382
             {
400 383
               $this->files[$row['template_filename']] = $file;
401 384
               $this->filename[$row['template_filename']] = $row['template_filename'];
@@ -410,8 +393,7 @@  discard block
 block discarded – undo
410 393
           {
411 394
             $this->compiled_code[$handle] = $compile->compile(trim($row['template_data']));
412 395
             $compile->compile_write($handle, $this->compiled_code[$handle]);
413
-          }
414
-          else
396
+          } else
415 397
           {
416 398
             // Only bother compiling if it doesn't already exist
417 399
             if (!file_exists($this->cachepath . str_replace('/', '.', $row['template_filename']) . DOT_PHP_EX))
@@ -422,8 +404,7 @@  discard block
 block discarded – undo
422 404
             }
423 405
           }
424 406
         }
425
-      }
426
-      else
407
+      } else
427 408
       {
428 409
         $file = $this->root . '/' . $row['template_filename'];
429 410
 
@@ -450,8 +431,7 @@  discard block
 block discarded – undo
450 431
   * Assign key variable pairs from an array
451 432
   * @access public
452 433
   */
453
-  public function assign_vars($vararray)
454
-  {
434
+  public function assign_vars($vararray) {
455 435
     foreach ($vararray as $key => $val)
456 436
     {
457 437
       $this->_rootref[$key] = $val;
@@ -464,8 +444,7 @@  discard block
 block discarded – undo
464 444
   * Assign a single variable to a single key
465 445
   * @access public
466 446
   */
467
-  public function assign_var($varname, $varval)
468
-  {
447
+  public function assign_var($varname, $varval) {
469 448
     $this->_rootref[$varname] = $varval;
470 449
 
471 450
     return true;
@@ -475,8 +454,7 @@  discard block
 block discarded – undo
475 454
   * Assign key variable pairs from an array to a specified block
476 455
   * @access public
477 456
   */
478
-  public function assign_block_vars($blockname, $vararray)
479
-  {
457
+  public function assign_block_vars($blockname, $vararray) {
480 458
     if (strpos($blockname, '.') !== false)
481 459
     {
482 460
       // Nested block.
@@ -511,8 +489,7 @@  discard block
 block discarded – undo
511 489
       // We're adding a new iteration to this block with the given
512 490
       // variable assignments.
513 491
       $str[$blocks[$blockcount]][] = $vararray;
514
-    }
515
-    else
492
+    } else
516 493
     {
517 494
       // Top-level block.
518 495
       $s_row_count = (isset($this->_tpldata[$blockname])) ? sizeof($this->_tpldata[$blockname]) : 0;
@@ -566,8 +543,7 @@  discard block
 block discarded – undo
566 543
   * @return bool false on error, true on success
567 544
   * @access public
568 545
   */
569
-  public function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert')
570
-  {
546
+  public function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert') {
571 547
     if (strpos($blockname, '.') !== false)
572 548
     {
573 549
       // Nested blocks are not supported
@@ -612,8 +588,7 @@  discard block
 block discarded – undo
612 588
         $key = sizeof($this->_tpldata[$blockname]);
613 589
         unset($this->_tpldata[$blockname][($key - 1)]['S_LAST_ROW']);
614 590
         $vararray['S_LAST_ROW'] = true;
615
-      }
616
-      else if ($key === 0)
591
+      } else if ($key === 0)
617 592
       {
618 593
         unset($this->_tpldata[$blockname][0]['S_FIRST_ROW']);
619 594
         $vararray['S_FIRST_ROW'] = true;
@@ -652,8 +627,7 @@  discard block
 block discarded – undo
652 627
   * Include a separate template
653 628
   * @access private
654 629
   */
655
-  public function _tpl_include($filename, $include = true)
656
-  {
630
+  public function _tpl_include($filename, $include = true) {
657 631
     $handle = $filename;
658 632
     $this->filename[$handle] = $filename;
659 633
     $this->files[$handle] = $this->root . '/' . $filename;
@@ -681,8 +655,7 @@  discard block
 block discarded – undo
681 655
   * Include a php-file
682 656
   * @access private
683 657
   */
684
-  public function _php_include($filename)
685
-  {
658
+  public function _php_include($filename) {
686 659
     global $phpbb_root_path;
687 660
 
688 661
     $file = $phpbb_root_path . $filename;
@@ -700,8 +673,7 @@  discard block
 block discarded – undo
700 673
   * Assign key variable pairs from an array with block support
701 674
   * @access public
702 675
   */
703
-  public function assign_recursive($values, $name = '')
704
-  {
676
+  public function assign_recursive($values, $name = '') {
705 677
     if(isset($values['.']))
706 678
     {
707 679
       $values_extra = $values['.'];
@@ -711,8 +683,7 @@  discard block
 block discarded – undo
711 683
     if(!$name)
712 684
     {
713 685
       $this->assign_vars($values);
714
-    }
715
-    else
686
+    } else
716 687
     {
717 688
       $this->assign_block_vars($name, $values);
718 689
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
       // Search array to get correct position
587 587
       list($search_key, $search_value) = @each($key);
588 588
 
589
-      $key = NULL;
589
+      $key = null;
590 590
       foreach ($this->_tpldata[$blockname] as $i => $val_ary)
591 591
       {
592 592
         if ($val_ary[$search_key] === $search_value)
@@ -597,7 +597,7 @@  discard block
 block discarded – undo
597 597
       }
598 598
 
599 599
       // key/value pair not found
600
-      if ($key === NULL)
600
+      if ($key === null)
601 601
       {
602 602
         return false;
603 603
       }
Please login to merge, or discard this patch.
classes/template_compile.php 4 patches
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -47,6 +47,7 @@  discard block
 block discarded – undo
47 47
 
48 48
   /**
49 49
   * constuctor
50
+  * @param template $template
50 51
   */
51 52
   function template_compile(&$template)
52 53
   {
@@ -463,6 +464,7 @@  discard block
 block discarded – undo
463 464
   * Compile IF tags - much of this is from Smarty with
464 465
   * some adaptions for our block level methods
465 466
   * @access private
467
+  * @param boolean $elseif
466 468
   */
467 469
   function compile_tag_if($tag_args, $elseif)
468 470
   {
@@ -620,6 +622,7 @@  discard block
 block discarded – undo
620 622
   /**
621 623
   * Compile DEFINE tags
622 624
   * @access private
625
+  * @param boolean $op
623 626
   */
624 627
   function compile_tag_define($tag_args, $op)
625 628
   {
@@ -698,6 +701,7 @@  discard block
 block discarded – undo
698 701
   * parse expression
699 702
   * This is from Smarty
700 703
   * @access private
704
+  * @param string $is_arg
701 705
   */
702 706
   function _parse_is_expr($is_arg, $tokens)
703 707
   {
@@ -794,6 +798,8 @@  discard block
 block discarded – undo
794 798
   * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above.
795 799
   * NOTE: does not expect a trailing "." on the blockname.
796 800
   * @access private
801
+  * @param string $blockname
802
+  * @param boolean $include_last_iterator
797 803
   */
798 804
   function generate_block_data_ref($blockname, $include_last_iterator, $defop = false)
799 805
   {
@@ -832,6 +838,7 @@  discard block
 block discarded – undo
832 838
   /**
833 839
   * Write compiled file to cache directory
834 840
   * @access private
841
+  * @param string $data
835 842
   */
836 843
   function compile_write($handle, $data)
837 844
   {
@@ -857,6 +864,7 @@  discard block
 block discarded – undo
857 864
   /**
858 865
   * Minifies template w/i PHP code by removing extra spaces
859 866
   * @access private
867
+  * @return string
860 868
   */
861 869
   function minify($html)
862 870
   {
Please login to merge, or discard this patch.
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -44,17 +44,17 @@  discard block
 block discarded – undo
44 44
   var $block_else_level = array();
45 45
 
46 46
   /**
47
-  * constuctor
48
-  */
47
+   * constuctor
48
+   */
49 49
   function template_compile(&$template)
50 50
   {
51 51
     $this->template = &$template;
52 52
   }
53 53
 
54 54
   /**
55
-  * Load template source from file
56
-  * @access private
57
-  */
55
+   * Load template source from file
56
+   * @access private
57
+   */
58 58
   function _tpl_load_file($handle, $store_in_db = false)
59 59
   {
60 60
     // Try and open template for read
@@ -97,10 +97,10 @@  discard block
 block discarded – undo
97 97
   }
98 98
 
99 99
   /**
100
-  * Remove any PHP tags that do not belong, these regular expressions are derived from
101
-  * the ones that exist in zend_language_scanner.l
102
-  * @access private
103
-  */
100
+   * Remove any PHP tags that do not belong, these regular expressions are derived from
101
+   * the ones that exist in zend_language_scanner.l
102
+   * @access private
103
+   */
104 104
   function remove_php_tags(&$code)
105 105
   {
106 106
     // This matches the information gathered from the internal PHP lexer
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
   }
115 115
 
116 116
   /**
117
-  * The all seeing all doing compile method. Parts are inspired by or directly from Smarty
118
-  * @access private
119
-  */
117
+   * The all seeing all doing compile method. Parts are inspired by or directly from Smarty
118
+   * @access private
119
+   */
120 120
   function compile($code, $no_echo = false, $echo_var = '')
121 121
   {
122 122
     if ($echo_var)
@@ -285,9 +285,9 @@  discard block
 block discarded – undo
285 285
   }
286 286
 
287 287
   /**
288
-  * Compile variables
289
-  * @access private
290
-  */
288
+   * Compile variables
289
+   * @access private
290
+   */
291 291
   function compile_var_tags(&$text_blocks)
292 292
   {
293 293
     // change template varrefs into PHP varrefs
@@ -347,9 +347,9 @@  discard block
 block discarded – undo
347 347
   }
348 348
 
349 349
   /**
350
-  * Compile blocks
351
-  * @access private
352
-  */
350
+   * Compile blocks
351
+   * @access private
352
+   */
353 353
   function compile_tag_block($tag_args)
354 354
   {
355 355
     $no_nesting = false;
@@ -435,14 +435,14 @@  discard block
 block discarded – undo
435 435
     $tag_template_php .= 'if ($_' . $tag_args . '_count) {';
436 436
 
437 437
     /**
438
-    * 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
439
-    * <code>
440
-    * if (!$offset)
441
-    * {
442
-    *   $tag_template_php .= 'foreach (' . $varref . ' as $_' . $tag_args . '_i => $_' . $tag_args . '_val){';
443
-    * }
444
-    * </code>
445
-    */
438
+     * 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
439
+     * <code>
440
+     * if (!$offset)
441
+     * {
442
+     *   $tag_template_php .= 'foreach (' . $varref . ' as $_' . $tag_args . '_i => $_' . $tag_args . '_val){';
443
+     * }
444
+     * </code>
445
+     */
446 446
 
447 447
     $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){';
448 448
 //    $tag_template_php .= '$this->_block_counter["'. $tag_args . '"] = $_' . $tag_args . '_i;';
@@ -453,10 +453,10 @@  discard block
 block discarded – undo
453 453
   }
454 454
 
455 455
   /**
456
-  * Compile IF tags - much of this is from Smarty with
457
-  * some adaptions for our block level methods
458
-  * @access private
459
-  */
456
+   * Compile IF tags - much of this is from Smarty with
457
+   * some adaptions for our block level methods
458
+   * @access private
459
+   */
460 460
   function compile_tag_if($tag_args, $elseif)
461 461
   {
462 462
     // Tokenize args for 'if' tag.
@@ -611,9 +611,9 @@  discard block
 block discarded – undo
611 611
   }
612 612
 
613 613
   /**
614
-  * Compile DEFINE tags
615
-  * @access private
616
-  */
614
+   * Compile DEFINE tags
615
+   * @access private
616
+   */
617 617
   function compile_tag_define($tag_args, $op)
618 618
   {
619 619
     preg_match('#^((?:[a-z0-9\-_]+\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (\'?)([^\']*)(\'?))?$#', $tag_args, $match);
@@ -664,9 +664,9 @@  discard block
 block discarded – undo
664 664
   }
665 665
 
666 666
   /**
667
-  * Compile INCLUDE tag
668
-  * @access private
669
-  */
667
+   * Compile INCLUDE tag
668
+   * @access private
669
+   */
670 670
   function compile_tag_include($tag_args)
671 671
   {
672 672
     // Process dynamic includes
@@ -679,19 +679,19 @@  discard block
 block discarded – undo
679 679
   }
680 680
 
681 681
   /**
682
-  * Compile INCLUDE_PHP tag
683
-  * @access private
684
-  */
682
+   * Compile INCLUDE_PHP tag
683
+   * @access private
684
+   */
685 685
   function compile_tag_include_php($tag_args)
686 686
   {
687 687
     return "\$this->_php_include('$tag_args');";
688 688
   }
689 689
 
690 690
   /**
691
-  * parse expression
692
-  * This is from Smarty
693
-  * @access private
694
-  */
691
+   * parse expression
692
+   * This is from Smarty
693
+   * @access private
694
+   */
695 695
   function _parse_is_expr($is_arg, $tokens)
696 696
   {
697 697
     $expr_end = 0;
@@ -756,13 +756,13 @@  discard block
 block discarded – undo
756 756
   }
757 757
 
758 758
   /**
759
-  * Generates a reference to the given variable inside the given (possibly nested)
760
-  * block namespace. This is a string of the form:
761
-  * ' . $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['varname'] . '
762
-  * It's ready to be inserted into an "echo" line in one of the templates.
763
-  * NOTE: expects a trailing "." on the namespace.
764
-  * @access private
765
-  */
759
+   * Generates a reference to the given variable inside the given (possibly nested)
760
+   * block namespace. This is a string of the form:
761
+   * ' . $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['varname'] . '
762
+   * It's ready to be inserted into an "echo" line in one of the templates.
763
+   * NOTE: expects a trailing "." on the namespace.
764
+   * @access private
765
+   */
766 766
   function generate_block_varref($namespace, $varname, $echo = true, $defop = false)
767 767
   {
768 768
     // Strip the trailing period.
@@ -780,14 +780,14 @@  discard block
 block discarded – undo
780 780
   }
781 781
 
782 782
   /**
783
-  * Generates a reference to the array of data values for the given
784
-  * (possibly nested) block namespace. This is a string of the form:
785
-  * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN']
786
-  *
787
-  * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above.
788
-  * NOTE: does not expect a trailing "." on the blockname.
789
-  * @access private
790
-  */
783
+   * Generates a reference to the array of data values for the given
784
+   * (possibly nested) block namespace. This is a string of the form:
785
+   * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN']
786
+   *
787
+   * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above.
788
+   * NOTE: does not expect a trailing "." on the blockname.
789
+   * @access private
790
+   */
791 791
   function generate_block_data_ref($blockname, $include_last_iterator, $defop = false)
792 792
   {
793 793
     // Get an array of the blocks involved.
@@ -823,9 +823,9 @@  discard block
 block discarded – undo
823 823
   }
824 824
 
825 825
   /**
826
-  * Write compiled file to cache directory
827
-  * @access private
828
-  */
826
+   * Write compiled file to cache directory
827
+   * @access private
828
+   */
829 829
   function compile_write($handle, $data)
830 830
   {
831 831
     $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . DOT_PHP_EX;
@@ -848,8 +848,8 @@  discard block
 block discarded – undo
848 848
 
849 849
   // Gorlum's minifier BOF
850 850
   /**
851
-  * Minifies template w/i PHP code by removing extra spaces
852
-  */
851
+   * Minifies template w/i PHP code by removing extra spaces
852
+   */
853 853
   private function minify($html)
854 854
   {
855 855
     if(!classSupernova::$config->tpl_minifier)
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -138,9 +138,9 @@  discard block
 block discarded – undo
138 138
 
139 139
     preg_match_all('#<!-- INCLUDE (\{\$?[A-Z0-9\-_]+\}|[a-zA-Z0-9\_\-\+\./]+) -->#', $code, $matches);
140 140
     $include_blocks = $matches[1];
141
-    if($include_blocks)
141
+    if ($include_blocks)
142 142
     {
143
-      foreach($include_blocks as &$included_file)
143
+      foreach ($include_blocks as &$included_file)
144 144
       {
145 145
         $included_file .= '.tpl.html';
146 146
       }
@@ -446,8 +446,8 @@  discard block
 block discarded – undo
446 446
 
447 447
     $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){';
448 448
 //    $tag_template_php .= '$this->_block_counter["'. $tag_args . '"] = $_' . $tag_args . '_i;';
449
-    $tag_template_php .= '$_'. $tag_args . '_val = &' . $varref . '[$_'. $tag_args. '_i];';
450
-    $tag_template_php .= '$this->_block_value["'. $tag_args . '"] = &' . $varref . '[$_'. $tag_args. '_i];';
449
+    $tag_template_php .= '$_' . $tag_args . '_val = &' . $varref . '[$_' . $tag_args . '_i];';
450
+    $tag_template_php .= '$this->_block_value["' . $tag_args . '"] = &' . $varref . '[$_' . $tag_args . '_i];';
451 451
 
452 452
     return $tag_template_php;
453 453
   }
@@ -551,10 +551,10 @@  discard block
 block discarded – undo
551 551
         break;
552 552
 
553 553
         case 'is':
554
-          $is_arg_start = ($tokens[$i-1] == ')') ? array_pop($is_arg_stack) : $i-1;
554
+          $is_arg_start = ($tokens[$i - 1] == ')') ? array_pop($is_arg_stack) : $i - 1;
555 555
           $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start));
556 556
 
557
-          $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1));
557
+          $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i + 1));
558 558
 
559 559
           array_splice($tokens, $is_arg_start, sizeof($tokens), $new_tokens);
560 560
 
@@ -814,11 +814,11 @@  discard block
 block discarded – undo
814 814
     }
815 815
     else if ($include_last_iterator)
816 816
     {
817
-      return '$_'. $blocks[$blockcount] . '_val';
817
+      return '$_' . $blocks[$blockcount] . '_val';
818 818
     }
819 819
     else
820 820
     {
821
-      return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']';
821
+      return '$_' . $blocks[$blockcount - 1] . '_val[\'' . $blocks[$blockcount] . '\']';
822 822
     }
823 823
   }
824 824
 
@@ -835,7 +835,7 @@  discard block
 block discarded – undo
835 835
     if ($fp = @fopen($filename, 'wb'))
836 836
     {
837 837
       @flock($fp, LOCK_EX);
838
-      @fwrite ($fp, $data);
838
+      @fwrite($fp, $data);
839 839
       @flock($fp, LOCK_UN);
840 840
       @fclose($fp);
841 841
 
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
   */
853 853
   private function minify($html)
854 854
   {
855
-    if(!classSupernova::$config->tpl_minifier)
855
+    if (!classSupernova::$config->tpl_minifier)
856 856
     {
857 857
       return $html;
858 858
     }
@@ -862,14 +862,14 @@  discard block
 block discarded – undo
862 862
     $html = preg_replace('/(<script[^>]*?>.*?<\/script>)/si', '#pre#', $html);
863 863
     $html = preg_replace('/>[\s]*</', '><', $html); // Strip spacechars between tags
864 864
     $html = preg_replace('/[\s]+/', ' ', $html); // Replace several spacechars with one space
865
-    if(!empty($pre[0]))
865
+    if (!empty($pre[0]))
866 866
     {
867
-      foreach($pre[0] as $tag)
867
+      foreach ($pre[0] as $tag)
868 868
       {
869 869
         $tag = preg_replace('/^\ *\/\/[^\<]*?$/m', ' ', $tag); // Strips comments - except those that contains HTML comment inside
870 870
         $tag = preg_replace('/[\ \t]{2,}/', ' ', $tag); // Replace several spaces by one
871 871
         $tag = preg_replace('/\s{2,}/', "\r\n", $tag); // Replace several linefeeds by one
872
-        $html = preg_replace('/#pre#/', $tag, $html,1);
872
+        $html = preg_replace('/#pre#/', $tag, $html, 1);
873 873
       }
874 874
     }
875 875
 
Please login to merge, or discard this patch.
Braces   +34 added lines, -68 removed lines patch added patch discarded remove patch
@@ -35,8 +35,7 @@  discard block
 block discarded – undo
35 35
 *
36 36
 * @package phpBB3
37 37
 */
38
-class template_compile
39
-{
38
+class template_compile {
40 39
   var $template;
41 40
 
42 41
   // Various storage arrays
@@ -46,8 +45,7 @@  discard block
 block discarded – undo
46 45
   /**
47 46
   * constuctor
48 47
   */
49
-  public function template_compile(&$template)
50
-  {
48
+  public function template_compile(&$template) {
51 49
     $this->template = &$template;
52 50
   }
53 51
 
@@ -55,8 +53,7 @@  discard block
 block discarded – undo
55 53
   * Load template source from file
56 54
   * @access private
57 55
   */
58
-  public function _tpl_load_file($handle, $store_in_db = false)
59
-  {
56
+  public function _tpl_load_file($handle, $store_in_db = false) {
60 57
     // Try and open template for read
61 58
     if (!file_exists($this->template->files[$handle]))
62 59
     {
@@ -64,8 +61,7 @@  discard block
 block discarded – undo
64 61
       {
65 62
         return;
66 63
         trigger_error("template->_tpl_load_file(): File {$this->template->files[$handle]} does not exist or is empty", E_USER_ERROR);
67
-      }
68
-      else
64
+      } else
69 65
       {
70 66
         $this->template->files[$handle] = $this->template->files_inherit[$handle];
71 67
       }
@@ -101,8 +97,7 @@  discard block
 block discarded – undo
101 97
   * the ones that exist in zend_language_scanner.l
102 98
   * @access private
103 99
   */
104
-  public function remove_php_tags(&$code)
105
-  {
100
+  public function remove_php_tags(&$code) {
106 101
     // This matches the information gathered from the internal PHP lexer
107 102
     $match = array(
108 103
       '#<([\?%])=?.*?\1>#s',
@@ -117,8 +112,7 @@  discard block
 block discarded – undo
117 112
   * The all seeing all doing compile method. Parts are inspired by or directly from Smarty
118 113
   * @access private
119 114
   */
120
-  public function compile($code, $no_echo = false, $echo_var = '')
121
-  {
115
+  public function compile($code, $no_echo = false, $echo_var = '') {
122 116
     if ($echo_var)
123 117
     {
124 118
       global $$echo_var;
@@ -221,15 +215,13 @@  discard block
 block discarded – undo
221 215
               $var = substr($temp, 2, -1);
222 216
               //$file = $this->template->_tpldata['DEFINE']['.'][$var];
223 217
               $temp = "\$this->_tpldata['DEFINE']['.']['$var']";
224
-            }
225
-            else
218
+            } else
226 219
             {
227 220
               $var = substr($temp, 1, -1);
228 221
               //$file = $this->template->_rootref[$var];
229 222
               $temp = "\$this->_rootref['$var']";
230 223
             }
231
-          }
232
-          else
224
+          } else
233 225
           {
234 226
             $file = $temp;
235 227
           }
@@ -288,8 +280,7 @@  discard block
 block discarded – undo
288 280
   * Compile variables
289 281
   * @access private
290 282
   */
291
-  public function compile_var_tags(&$text_blocks)
292
-  {
283
+  public function compile_var_tags(&$text_blocks) {
293 284
     // change template varrefs into PHP varrefs
294 285
     $varrefs = array();
295 286
 
@@ -350,8 +341,7 @@  discard block
 block discarded – undo
350 341
   * Compile blocks
351 342
   * @access private
352 343
   */
353
-  public function compile_tag_block($tag_args)
354
-  {
344
+  public function compile_tag_block($tag_args) {
355 345
     $no_nesting = false;
356 346
 
357 347
     // Is the designer wanting to call another loop in a loop?
@@ -374,8 +364,7 @@  discard block
 block discarded – undo
374 364
       if ($match[2] < 0)
375 365
       {
376 366
         $loop_start = '($_' . $tag_args . '_count ' . $match[2] . ' < 0 ? 0 : $_' . $tag_args . '_count ' . $match[2] . ')';
377
-      }
378
-      else
367
+      } else
379 368
       {
380 369
         $loop_start = '($_' . $tag_args . '_count < ' . $match[2] . ' ? $_' . $tag_args . '_count : ' . $match[2] . ')';
381 370
       }
@@ -383,17 +372,14 @@  discard block
 block discarded – undo
383 372
       if (strlen($match[3]) < 1 || $match[3] == -1)
384 373
       {
385 374
         $loop_end = '$_' . $tag_args . '_count';
386
-      }
387
-      else if ($match[3] >= 0)
375
+      } else if ($match[3] >= 0)
388 376
       {
389 377
         $loop_end = '(' . ($match[3] + 1) . ' > $_' . $tag_args . '_count ? $_' . $tag_args . '_count : ' . ($match[3] + 1) . ')';
390
-      }
391
-      else //if ($match[3] < -1)
378
+      } else //if ($match[3] < -1)
392 379
       {
393 380
         $loop_end = '$_' . $tag_args . '_count' . ($match[3] + 1);
394 381
       }
395
-    }
396
-    else
382
+    } else
397 383
     {
398 384
       $loop_start = 0;
399 385
       $loop_end = '$_' . $tag_args . '_count';
@@ -406,8 +392,7 @@  discard block
 block discarded – undo
406 392
     {
407 393
       // We need to implode $no_nesting times from the end...
408 394
       $block = array_slice($this->block_names, -$no_nesting);
409
-    }
410
-    else
395
+    } else
411 396
     {
412 397
       $block = $this->block_names;
413 398
     }
@@ -417,8 +402,7 @@  discard block
 block discarded – undo
417 402
       // Block is not nested.
418 403
       $tag_template_php = '$_' . $tag_args . "_count = (isset(\$this->_tpldata['$tag_args'])) ? sizeof(\$this->_tpldata['$tag_args']) : 0;";
419 404
       $varref = "\$this->_tpldata['$tag_args']";
420
-    }
421
-    else
405
+    } else
422 406
     {
423 407
       // This block is nested.
424 408
       // Generate a namespace string for this block.
@@ -457,8 +441,7 @@  discard block
 block discarded – undo
457 441
   * some adaptions for our block level methods
458 442
   * @access private
459 443
   */
460
-  public function compile_tag_if($tag_args, $elseif)
461
-  {
444
+  public function compile_tag_if($tag_args, $elseif) {
462 445
     // Tokenize args for 'if' tag.
463 446
     preg_match_all('/(?:
464 447
       "[^"\\\\]*(?:\\\\.[^"\\\\]*)*"         |
@@ -566,8 +549,7 @@  discard block
 block discarded – undo
566 549
           if (preg_match('#^((?:[a-z0-9\-_]+\.)+)?(\$)?(?=[A-Za-z])([A-Za-z0-9\-_]+)#s', $token, $varrefs))
567 550
           {
568 551
             $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] . '\']');
569
-          }
570
-          else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs))
552
+          } else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs))
571 553
           {
572 554
             // Allow checking if loops are set with .loopname
573 555
             // It is also possible to check the loop count by doing <!-- IF .loopname > 1 --> for example
@@ -583,8 +565,7 @@  discard block
 block discarded – undo
583 565
 
584 566
               // Add the block reference for the last child.
585 567
               $varref .= "['" . $block . "']";
586
-            }
587
-            else
568
+            } else
588 569
             {
589 570
               $varref = '$this->_tpldata';
590 571
 
@@ -592,8 +573,7 @@  discard block
 block discarded – undo
592 573
               $varref .= "['" . $blocks[0] . "']";
593 574
             }
594 575
             $token = "sizeof($varref)";
595
-          }
596
-          else if (!empty($token))
576
+          } else if (!empty($token))
597 577
           {
598 578
             $token = '(' . $token . ')';
599 579
           }
@@ -614,8 +594,7 @@  discard block
 block discarded – undo
614 594
   * Compile DEFINE tags
615 595
   * @access private
616 596
   */
617
-  public function compile_tag_define($tag_args, $op)
618
-  {
597
+  public function compile_tag_define($tag_args, $op) {
619 598
     preg_match('#^((?:[a-z0-9\-_]+\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (\'?)([^\']*)(\'?))?$#', $tag_args, $match);
620 599
 
621 600
     if (empty($match[2]) || (!isset($match[4]) && $op))
@@ -638,8 +617,7 @@  discard block
 block discarded – undo
638 617
 
639 618
       // Now replace the php code
640 619
       $match[4] = "'" . str_replace(array('<?php echo ', '; ?>'), array("' . ", " . '"), $match[4]) . "'";
641
-    }
642
-    else
620
+    } else
643 621
     {
644 622
       preg_match('#true|false|\.#i', $match[4], $type);
645 623
 
@@ -667,8 +645,7 @@  discard block
 block discarded – undo
667 645
   * Compile INCLUDE tag
668 646
   * @access private
669 647
   */
670
-  public function compile_tag_include($tag_args)
671
-  {
648
+  public function compile_tag_include($tag_args) {
672 649
     // Process dynamic includes
673 650
     if ($tag_args[0] == '$')
674 651
     {
@@ -682,8 +659,7 @@  discard block
 block discarded – undo
682 659
   * Compile INCLUDE_PHP tag
683 660
   * @access private
684 661
   */
685
-  public function compile_tag_include_php($tag_args)
686
-  {
662
+  public function compile_tag_include_php($tag_args) {
687 663
     return "\$this->_php_include('$tag_args');";
688 664
   }
689 665
 
@@ -692,8 +668,7 @@  discard block
 block discarded – undo
692 668
   * This is from Smarty
693 669
   * @access private
694 670
   */
695
-  public function _parse_is_expr($is_arg, $tokens)
696
-  {
671
+  public function _parse_is_expr($is_arg, $tokens) {
697 672
     $expr_end = 0;
698 673
     $negate_expr = false;
699 674
 
@@ -701,8 +676,7 @@  discard block
 block discarded – undo
701 676
     {
702 677
       $negate_expr = true;
703 678
       $expr_type = array_shift($tokens);
704
-    }
705
-    else
679
+    } else
706 680
     {
707 681
       $expr_type = $first_token;
708 682
     }
@@ -716,8 +690,7 @@  discard block
 block discarded – undo
716 690
           $expr_end++;
717 691
           $expr_arg = $tokens[$expr_end++];
718 692
           $expr = "!(($is_arg / $expr_arg) % $expr_arg)";
719
-        }
720
-        else
693
+        } else
721 694
         {
722 695
           $expr = "!($is_arg & 1)";
723 696
         }
@@ -729,8 +702,7 @@  discard block
 block discarded – undo
729 702
           $expr_end++;
730 703
           $expr_arg = $tokens[$expr_end++];
731 704
           $expr = "(($is_arg / $expr_arg) % $expr_arg)";
732
-        }
733
-        else
705
+        } else
734 706
         {
735 707
           $expr = "($is_arg & 1)";
736 708
         }
@@ -764,8 +736,7 @@  discard block
 block discarded – undo
764 736
   * NOTE: expects a trailing "." on the namespace.
765 737
   * @access private
766 738
   */
767
-  public function generate_block_varref($namespace, $varname, $echo = true, $defop = false)
768
-  {
739
+  public function generate_block_varref($namespace, $varname, $echo = true, $defop = false) {
769 740
     // Strip the trailing period.
770 741
     $namespace = substr($namespace, 0, -1);
771 742
 
@@ -789,8 +760,7 @@  discard block
 block discarded – undo
789 760
   * NOTE: does not expect a trailing "." on the blockname.
790 761
   * @access private
791 762
   */
792
-  public function generate_block_data_ref($blockname, $include_last_iterator, $defop = false)
793
-  {
763
+  public function generate_block_data_ref($blockname, $include_last_iterator, $defop = false) {
794 764
     // Get an array of the blocks involved.
795 765
     $blocks = explode('.', $blockname);
796 766
     $blockcount = sizeof($blocks) - 1;
@@ -812,12 +782,10 @@  discard block
 block discarded – undo
812 782
         $varref .= '[$_' . $blocks[$blockcount] . '_i]';
813 783
       }
814 784
       return $varref;
815
-    }
816
-    else if ($include_last_iterator)
785
+    } else if ($include_last_iterator)
817 786
     {
818 787
       return '$_'. $blocks[$blockcount] . '_val';
819
-    }
820
-    else
788
+    } else
821 789
     {
822 790
       return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']';
823 791
     }
@@ -827,8 +795,7 @@  discard block
 block discarded – undo
827 795
   * Write compiled file to cache directory
828 796
   * @access private
829 797
   */
830
-  public function compile_write($handle, $data)
831
-  {
798
+  public function compile_write($handle, $data) {
832 799
     $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . DOT_PHP_EX;
833 800
 
834 801
     $data = "<?php if (!defined('INSIDE')) exit;" . ((strpos($data, '<?php') === 0) ? substr($data, 5) : ' ?>' . $data);
@@ -851,8 +818,7 @@  discard block
 block discarded – undo
851 818
   /**
852 819
   * Minifies template w/i PHP code by removing extra spaces
853 820
   */
854
-  private function minify($html)
855
-  {
821
+  private function minify($html) {
856 822
     if(!classSupernova::$config->tpl_minifier)
857 823
     {
858 824
       return $html;
Please login to merge, or discard this patch.
classes/UBE/ArrayAccessV2.php 1 patch
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@
 block discarded – undo
118 118
    * @param mixed $offset <p>
119 119
    * The offset to assign the value to.
120 120
    * </p>
121
-   * @param mixed $value <p>
121
+   * @param Unit $value <p>
122 122
    * The value to set.
123 123
    * </p>
124 124
    *
Please login to merge, or discard this patch.
classes/UBE/UBE.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
    * Преобразовывает данные симулятора в данные для расчета боя
460 460
    *
461 461
    * @param     $side_info
462
-   * @param     $attacker
462
+   * @param     boolean $attacker
463 463
    * @param int $player_id
464 464
    *
465 465
    */
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
   }
522 522
 
523 523
   /**
524
-   * @return int
524
+   * @return double
525 525
    */
526 526
   public function get_time_spent() {
527 527
     return $this->time_spent;
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
   }
565 565
 
566 566
   /**
567
-   * @param $template
567
+   * @param null|template $template
568 568
    *
569 569
    * @return template
570 570
    */
Please login to merge, or discard this patch.
Spacing   +44 added lines, -45 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     $this->players->db_load_player_by_id($player_id, UBE_PLAYER_IS_DEFENDER);
151 151
 
152 152
     $player_db_row = $this->players[$player_id]->getDbRow();
153
-    if($fortifier_level = mrc_get_level($player_db_row, $this->combatMission->dst_planet, MRC_FORTIFIER)) {
153
+    if ($fortifier_level = mrc_get_level($player_db_row, $this->combatMission->dst_planet, MRC_FORTIFIER)) {
154 154
       $this->planet_bonus->add_unit_by_snid(MRC_FORTIFIER, $fortifier_level);
155 155
     }
156 156
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
     $this->rounds[0] = new UBERound(0);
182 182
     $this->rounds[0]->make_snapshot($this->fleet_list);
183 183
 
184
-    for($round = 1; $round <= 10; $round++) {
184
+    for ($round = 1; $round <= 10; $round++) {
185 185
       // Проводим раунд
186 186
       defined('DEBUG_UBE') ? print("Round {$round}<br>") : false;
187 187
 
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 
195 195
       // Анализируем итоги текущего раунда и готовим данные для следующего
196 196
       $this->combat_result = $this->fleet_list->ubeAnalyzeFleetOutcome($round);
197
-      if($this->combat_result != UBE_COMBAT_RESULT_DRAW) {
197
+      if ($this->combat_result != UBE_COMBAT_RESULT_DRAW) {
198 198
         break;
199 199
       }
200 200
 
@@ -223,11 +223,11 @@  discard block
 block discarded – undo
223 223
     // Генерируем результат боя
224 224
     $this->fleet_list->ube_analyze_fleets($this->is_simulator, $this->debris, $this->resource_exchange_rates);
225 225
 
226
-    if(!$this->is_ube_loaded) {
226
+    if (!$this->is_ube_loaded) {
227 227
       $this->moon_calculator->calculate_moon($this);
228 228
 
229 229
       // Лутаем ресурсы - если аттакер выиграл
230
-      if($this->combat_result == UBE_COMBAT_RESULT_WIN) {
230
+      if ($this->combat_result == UBE_COMBAT_RESULT_WIN) {
231 231
         $this->sn_ube_combat_analyze_loot();
232 232
       }
233 233
     }
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
       RES_DEUTERIUM => 0,
248 248
     );
249 249
 
250
-    if(
250
+    if (
251 251
       (($planet_resource_total = $this->fleet_list[0]->get_resources_amount()) > 0)
252 252
       &&
253 253
       (($total_capacity = $this->fleet_list->ube_get_capacity_attackers()) > 0)
@@ -259,9 +259,9 @@  discard block
 block discarded – undo
259 259
       $planet_lootable_percent = $planet_lootable / $planet_resource_total;
260 260
 
261 261
       // Вычисляем сколько ресурсов вывезено
262
-      foreach($this->fleet_list->_container as $fleet_id => $fleet) {
262
+      foreach ($this->fleet_list->_container as $fleet_id => $fleet) {
263 263
         $looted_in_metal = 0;
264
-        foreach($this->fleet_list[0]->resource_list as $resource_id => $resource_amount) {
264
+        foreach ($this->fleet_list[0]->resource_list as $resource_id => $resource_amount) {
265 265
           // Вычисляем какой процент общей емкости трюмов атакующих будет задействован
266 266
           $fleet_lootable_percent = $fleet->fleet_capacity / $total_capacity;
267 267
           $looted = floor($resource_amount * $planet_lootable_percent * $fleet_lootable_percent);
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
     $destination_user_id = $this->fleet_list[0]->owner_id;
327 327
 
328 328
     // Обновляем поле обломков на планете
329
-    if(!$this->is_admin_in_combat && $this->debris->debris_total() > 0) {
329
+    if (!$this->is_admin_in_combat && $this->debris->debris_total() > 0) {
330 330
       DBStaticPlanet::db_planet_update_by_gspt(
331 331
         $this->ube_planet_info[PLANET_GALAXY], $this->ube_planet_info[PLANET_SYSTEM], $this->ube_planet_info[PLANET_PLANET], PT_PLANET,
332 332
         array(),
@@ -337,10 +337,10 @@  discard block
 block discarded – undo
337 337
       );
338 338
     }
339 339
 
340
-    foreach($this->fleet_list->_container as $fleet_id => $UBEFleet) {
340
+    foreach ($this->fleet_list->_container as $fleet_id => $UBEFleet) {
341 341
       $ship_count_lost = $UBEFleet->unit_list->unitCountLost();
342 342
 
343
-      if($fleet_id) {
343
+      if ($fleet_id) {
344 344
         // Флот
345 345
         $UBEFleet->db_save_combat_result_fleet($this->is_small_fleet_recce, $this->moon_calculator->get_reapers_status());
346 346
       } else {
@@ -348,9 +348,9 @@  discard block
 block discarded – undo
348 348
 
349 349
         // Сохраняем изменения ресурсов - если они есть
350 350
         $resource_delta = $UBEFleet->ube_combat_result_calculate_resources();
351
-        if(!empty($resource_delta)) {
351
+        if (!empty($resource_delta)) {
352 352
           $temp = array();
353
-          foreach($resource_delta as $resource_id => $resource_amount) {
353
+          foreach ($resource_delta as $resource_id => $resource_amount) {
354 354
             $resource_db_name = pname_resource_name($resource_id);
355 355
             $temp[$resource_db_name] = $resource_amount;
356 356
           }
@@ -360,9 +360,9 @@  discard block
 block discarded – undo
360 360
           );
361 361
         }
362 362
 
363
-        if($ship_count_lost) {
363
+        if ($ship_count_lost) {
364 364
           $planet_row_cache = $this->players[$destination_user_id]->getDbRow();
365
-          foreach($UBEFleet->unit_list->_container as $UBEUnit) {
365
+          foreach ($UBEFleet->unit_list->_container as $UBEUnit) {
366 366
             DBStaticUnit::dbUpdateOrInsertUnit($UBEUnit->unitId, -$UBEUnit->units_lost, $planet_row_cache, $this->ube_planet_info[PLANET_ID]);
367 367
           }
368 368
         }
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
     // TODO: Связать сабы с флотами констраинтами ON DELETE SET NULL
373 373
     // Для САБов
374 374
     $fleet_group_id_list = $this->fleet_list->ube_get_groups();
375
-    if(!empty($fleet_group_id_list)) {
375
+    if (!empty($fleet_group_id_list)) {
376 376
       $fleet_group_id_list = implode(',', $fleet_group_id_list);
377 377
       DBStaticFleetACS::db_acs_delete_by_list($fleet_group_id_list);
378 378
     }
@@ -380,14 +380,14 @@  discard block
 block discarded – undo
380 380
     $this->moon_calculator->db_apply_result($this->ube_planet_info, $destination_user_id);
381 381
 
382 382
     $bashing_list = array();
383
-    foreach($this->players->get_player_sides() as $player_id => $player_side) {
384
-      if($player_side != UBE_PLAYER_IS_ATTACKER) {
383
+    foreach ($this->players->get_player_sides() as $player_id => $player_side) {
384
+      if ($player_side != UBE_PLAYER_IS_ATTACKER) {
385 385
         continue;
386 386
       }
387
-      if($this->moon_calculator->get_status() != UBE_MOON_DESTROY_SUCCESS) {
387
+      if ($this->moon_calculator->get_status() != UBE_MOON_DESTROY_SUCCESS) {
388 388
         $bashing_list[] = array($player_id, $this->ube_planet_info[PLANET_ID], $this->combat_timestamp);
389 389
       }
390
-      if($this->mission_type_id == MT_ATTACK && $this->is_defender_active_player) {
390
+      if ($this->mission_type_id == MT_ATTACK && $this->is_defender_active_player) {
391 391
         $str_loose_or_win = $this->combat_result == UBE_COMBAT_RESULT_WIN ? 'raidswin' : 'raidsloose';
392 392
         DBStaticUser::db_user_adjust_by_id(
393 393
           $player_id,
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
         );
400 400
       }
401 401
     }
402
-    if(!empty($bashing_list)) {
402
+    if (!empty($bashing_list)) {
403 403
       DBStaticFleetBashing::db_bashing_insert($bashing_list);
404 404
     }
405 405
 
@@ -425,20 +425,19 @@  discard block
 block discarded – undo
425 425
       $planet_info[PLANET_SYSTEM],
426 426
       $planet_info[PLANET_PLANET],
427 427
       htmlentities($planet_info[PLANET_NAME], ENT_COMPAT, 'UTF-8'),
428
-      classLocale::$lang[$this->combat_result == UBE_COMBAT_RESULT_WIN ? 'ube_report_info_outcome_win' :
429
-        ($this->combat_result == UBE_COMBAT_RESULT_DRAW ? 'ube_report_info_outcome_draw' : 'ube_report_info_outcome_loss')]
428
+      classLocale::$lang[$this->combat_result == UBE_COMBAT_RESULT_WIN ? 'ube_report_info_outcome_win' : ($this->combat_result == UBE_COMBAT_RESULT_DRAW ? 'ube_report_info_outcome_draw' : 'ube_report_info_outcome_loss')]
430 429
     );
431 430
 
432 431
     $text_defender = '';
433 432
     $debris = $this->debris->get_debris();
434
-    foreach($debris as $resource_id => $resource_amount) {
435
-      if($resource_id == RES_DEUTERIUM) {
433
+    foreach ($debris as $resource_id => $resource_amount) {
434
+      if ($resource_id == RES_DEUTERIUM) {
436 435
         continue;
437 436
       }
438 437
 
439 438
       $text_defender .= "{$classLocale['tech'][$resource_id]}: " . pretty_number($resource_amount) . '<br />';
440 439
     }
441
-    if($text_defender) {
440
+    if ($text_defender) {
442 441
       $text_defender = "{$classLocale['ube_report_msg_body_debris']}{$text_defender}<br />";
443 442
     }
444 443
 
@@ -448,7 +447,7 @@  discard block
 block discarded – undo
448 447
 
449 448
     // TODO: Оптимизировать отсылку сообщений - отсылать пакетами
450 449
     $player_sides = $this->players->get_player_sides();
451
-    foreach($player_sides as $player_id => $player_side) {
450
+    foreach ($player_sides as $player_id => $player_side) {
452 451
       $message = $text_common . ($this->is_small_fleet_recce && ($player_side == UBE_PLAYER_IS_ATTACKER) ? classLocale::$lang['ube_report_msg_body_sfr'] : $text_defender);
453 452
       DBStaticMessages::msg_send_simple_message($player_id, '', $this->combat_timestamp, MSG_TYPE_COMBAT, classLocale::$lang['sys_mess_tower'], classLocale::$lang['sys_mess_attack_report'], $message);
454 453
     }
@@ -484,11 +483,11 @@  discard block
 block discarded – undo
484 483
     $player_id = $player_id == -1 ? $this->players->count() : $player_id;
485 484
     $fleet_id = $player_id; // FOR SIMULATOR!
486 485
 
487
-    if(empty($this->players[$player_id])) {
486
+    if (empty($this->players[$player_id])) {
488 487
       $this->players[$player_id] = new UBEPlayer();
489 488
     }
490 489
 
491
-    foreach($side_info as $fleet_data) {
490
+    foreach ($side_info as $fleet_data) {
492 491
       $this->players[$player_id]->name = $player_id;
493 492
       $this->players[$player_id]->setSide($attacker);
494 493
 
@@ -496,32 +495,32 @@  discard block
 block discarded – undo
496 495
       $this->fleet_list[$fleet_id] = $objFleet;
497 496
 
498 497
       $this->fleet_list[$fleet_id]->owner_id = $player_id;
499
-      foreach($fleet_data as $unit_id => $unit_count) {
500
-        if(!$unit_count) {
498
+      foreach ($fleet_data as $unit_id => $unit_count) {
499
+        if (!$unit_count) {
501 500
           continue;
502 501
         }
503 502
 
504 503
         $unit_type = get_unit_param($unit_id, P_UNIT_TYPE);
505 504
 
506
-        if($unit_type == UNIT_SHIPS || $unit_type == UNIT_DEFENCE) {
505
+        if ($unit_type == UNIT_SHIPS || $unit_type == UNIT_DEFENCE) {
507 506
           $this->fleet_list[$fleet_id]->unit_list->unitAdjustCount($unit_id, $unit_count);
508
-        } elseif($unit_type == UNIT_RESOURCES) {
507
+        } elseif ($unit_type == UNIT_RESOURCES) {
509 508
           $this->fleet_list[$fleet_id]->resource_list[$unit_id] = $unit_count;
510
-        } elseif($unit_type == UNIT_TECHNOLOGIES) {
511
-          if($unit_id == TECH_WEAPON) {
509
+        } elseif ($unit_type == UNIT_TECHNOLOGIES) {
510
+          if ($unit_id == TECH_WEAPON) {
512 511
             $this->players[$player_id]->player_bonus->add_unit_by_snid(TECH_WEAPON, $unit_count);
513
-          } elseif($unit_id == TECH_SHIELD) {
512
+          } elseif ($unit_id == TECH_SHIELD) {
514 513
             $this->players[$player_id]->player_bonus->add_unit_by_snid(TECH_SHIELD, $unit_count);
515
-          } elseif($unit_id == TECH_ARMOR) {
514
+          } elseif ($unit_id == TECH_ARMOR) {
516 515
             $this->players[$player_id]->player_bonus->add_unit_by_snid(TECH_ARMOR, $unit_count);
517 516
           }
518
-        } elseif($unit_type == UNIT_GOVERNORS) {
519
-          if($unit_id == MRC_FORTIFIER) {
517
+        } elseif ($unit_type == UNIT_GOVERNORS) {
518
+          if ($unit_id == MRC_FORTIFIER) {
520 519
             // Фортифаер даёт бонус ко всему
521 520
             $this->planet_bonus->add_unit_by_snid(MRC_FORTIFIER, $unit_count);
522 521
           }
523
-        } elseif($unit_type == UNIT_MERCENARIES) {
524
-          if($unit_id == MRC_ADMIRAL) {
522
+        } elseif ($unit_type == UNIT_MERCENARIES) {
523
+          if ($unit_id == MRC_ADMIRAL) {
525 524
             $this->players[$player_id]->player_bonus->add_unit_by_snid(MRC_ADMIRAL, $unit_count);
526 525
           }
527 526
         }
@@ -590,7 +589,7 @@  discard block
 block discarded – undo
590 589
 
591 590
     $ube_report = new UBEReport();
592 591
     $ube = $ube_report->sn_ube_report_load(sys_get_param_str('cypher'));
593
-    if($ube != UBE_REPORT_NOT_FOUND) {
592
+    if ($ube != UBE_REPORT_NOT_FOUND) {
594 593
       $ube_report->sn_ube_report_generate($ube, $template_result);
595 594
 
596 595
       $template = gettemplate('ube_combat_report', $template);
@@ -618,9 +617,9 @@  discard block
 block discarded – undo
618 617
     $ube->sn_ube_combat();
619 618
     $ube_report = new UBEReport();
620 619
 
621
-    if(sys_get_param_str('reload')) {
620
+    if (sys_get_param_str('reload')) {
622 621
       $ube_new = $ube_report->sn_ube_report_load($ube->get_cypher()); // $combat_data = sn_ube_report_load($combat_data[UBE_REPORT_CYPHER]);
623
-      if($ube_new != UBE_REPORT_NOT_FOUND && is_object($ube_new)) {
622
+      if ($ube_new != UBE_REPORT_NOT_FOUND && is_object($ube_new)) {
624 623
         $ube = $ube_new;
625 624
       }
626 625
     }
@@ -668,7 +667,7 @@  discard block
 block discarded – undo
668 667
     $this->debris->load_from_report_row($report_row);
669 668
 
670 669
     $query = classSupernova::$db->doSelect("SELECT * FROM {{ube_report_player}} WHERE `ube_report_id` = {$report_row['ube_report_id']}");
671
-    while($player_row = db_fetch($query)) {
670
+    while ($player_row = db_fetch($query)) {
672 671
       $this->players->init_player_from_report_info($player_row);
673 672
     }
674 673
 
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -183,7 +183,7 @@
 block discarded – undo
183 183
 
184 184
     for($round = 1; $round <= 10; $round++) {
185 185
       // Проводим раунд
186
-      defined('DEBUG_UBE') ? print("Round {$round}<br>") : false;
186
+      defined('DEBUG_UBE') ? print("round {$round}<br>") : false;
187 187
 
188 188
       $this->fleet_list->ube_calculate_attack_results($this);
189 189
 
Please login to merge, or discard this patch.
classes/UBE/UBEFleet.php 2 patches
Doc Comments   +11 added lines, -4 removed lines patch added patch discarded remove patch
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
   }
151 151
 
152 152
   /**
153
-   * @param $ube_report_id
153
+   * @param integer $ube_report_id
154 154
    *
155 155
    * @return array
156 156
    *
@@ -288,7 +288,7 @@  discard block
 block discarded – undo
288 288
 
289 289
 
290 290
   /**
291
-   * @param $ube_report_id
291
+   * @param integer $ube_report_id
292 292
    *
293 293
    * @return array
294 294
    */
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
   // Рендерит таблицу общего результата боя
337 337
   /**
338 338
    * @param $array
339
-   * @param $lang_header_index
339
+   * @param string $lang_header_index
340 340
    *
341 341
    * @return array
342 342
    */
@@ -362,6 +362,9 @@  discard block
 block discarded – undo
362 362
   }
363 363
 
364 364
 
365
+  /**
366
+   * @param integer $ube_report_id
367
+   */
365 368
   public function sql_generate_outcome_unit_array(&$sql_perform_report_unit, $ube_report_id) {
366 369
     $fleet_id = $this->db_id;
367 370
 
@@ -468,6 +471,10 @@  discard block
 block discarded – undo
468 471
     $this->fleet_capacity -= $fleet_total_resources;
469 472
   }
470 473
 
474
+  /**
475
+   * @param integer $is_small_fleet_recce
476
+   * @param integer $reapers_status
477
+   */
471 478
   public function db_save_combat_result_fleet($is_small_fleet_recce, $reapers_status) {
472 479
     $ship_count_initial = $this->unit_list->unitsCount();
473 480
     $ship_count_lost = $this->unit_list->unitCountLost();
@@ -535,7 +542,7 @@  discard block
 block discarded – undo
535 542
 
536 543
   /**
537 544
    * @param UBEFleetList $fleet_list
538
-   * @param              $is_simulator
545
+   * @param              boolean $is_simulator
539 546
    *
540 547
    * @version 2016-02-25 23:42:45 41a4.68
541 548
    */
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -159,20 +159,20 @@  discard block
 block discarded – undo
159 159
       $this->owner_id,
160 160
       $this->db_id,
161 161
 
162
-      (float)$this->UBE_PLANET[PLANET_ID],
162
+      (float) $this->UBE_PLANET[PLANET_ID],
163 163
       "'" . db_escape($this->UBE_PLANET[PLANET_NAME]) . "'",
164
-      (int)$this->UBE_PLANET[PLANET_GALAXY],
165
-      (int)$this->UBE_PLANET[PLANET_SYSTEM],
166
-      (int)$this->UBE_PLANET[PLANET_PLANET],
167
-      (int)$this->UBE_PLANET[PLANET_TYPE],
168
-
169
-      (float)$this->resource_list[RES_METAL],
170
-      (float)$this->resource_list[RES_CRYSTAL],
171
-      (float)$this->resource_list[RES_DEUTERIUM],
172
-
173
-      (float)$this->fleet_bonus->calcBonus(P_ATTACK),
174
-      (float)$this->fleet_bonus->calcBonus(P_SHIELD),
175
-      (float)$this->fleet_bonus->calcBonus(P_ARMOR),
164
+      (int) $this->UBE_PLANET[PLANET_GALAXY],
165
+      (int) $this->UBE_PLANET[PLANET_SYSTEM],
166
+      (int) $this->UBE_PLANET[PLANET_PLANET],
167
+      (int) $this->UBE_PLANET[PLANET_TYPE],
168
+
169
+      (float) $this->resource_list[RES_METAL],
170
+      (float) $this->resource_list[RES_CRYSTAL],
171
+      (float) $this->resource_list[RES_DEUTERIUM],
172
+
173
+      (float) $this->fleet_bonus->calcBonus(P_ATTACK),
174
+      (float) $this->fleet_bonus->calcBonus(P_SHIELD),
175
+      (float) $this->fleet_bonus->calcBonus(P_ARMOR),
176 176
     );
177 177
   }
178 178
 
@@ -185,13 +185,13 @@  discard block
 block discarded – undo
185 185
     $this->owner_id = $objFleet->playerOwnerId;
186 186
     $this->group_id = $objFleet->group_id;
187 187
 
188
-    foreach($objFleet->shipsIterator() as $unit_id => $unit) {
189
-      if(!$unit->count) {
188
+    foreach ($objFleet->shipsIterator() as $unit_id => $unit) {
189
+      if (!$unit->count) {
190 190
         continue;
191 191
       }
192 192
 
193 193
       $unit_type = get_unit_param($unit_id, P_UNIT_TYPE);
194
-      if($unit_type == UNIT_SHIPS || $unit_type == UNIT_DEFENCE) {
194
+      if ($unit_type == UNIT_SHIPS || $unit_type == UNIT_DEFENCE) {
195 195
         $this->unit_list->unitAdjustCount($unit_id, $unit->count);
196 196
       }
197 197
     }
@@ -227,13 +227,13 @@  discard block
 block discarded – undo
227 227
 //      }
228 228
 //    }
229 229
 
230
-    foreach($sn_group_combat as $unit_id) {
231
-      if($unit_count = mrc_get_level($player_db_row, $planet_row, $unit_id)) {
230
+    foreach ($sn_group_combat as $unit_id) {
231
+      if ($unit_count = mrc_get_level($player_db_row, $planet_row, $unit_id)) {
232 232
         $this->unit_list->unitAdjustCount($unit_id, $unit_count);
233 233
       }
234 234
     }
235 235
 
236
-    foreach(sn_get_groups('resources_loot') as $resource_id) {
236
+    foreach (sn_get_groups('resources_loot') as $resource_id) {
237 237
       $this->resource_list[$resource_id] = floor(mrc_get_level($player_db_row, $planet_row, $resource_id));
238 238
     }
239 239
 
@@ -292,27 +292,27 @@  discard block
 block discarded – undo
292 292
       $ube_report_id,
293 293
       $this->db_id,
294 294
 
295
-      (float)$this->resources_lost_on_units[RES_METAL],
296
-      (float)$this->resources_lost_on_units[RES_CRYSTAL],
297
-      (float)$this->resources_lost_on_units[RES_DEUTERIUM],
298
-      (float)$this->cargo_dropped[RES_METAL],
299
-      (float)$this->cargo_dropped[RES_CRYSTAL],
300
-      (float)$this->cargo_dropped[RES_DEUTERIUM],
301
-      (float)$this->resources_looted[RES_METAL],
302
-      (float)$this->resources_looted[RES_CRYSTAL],
303
-      (float)$this->resources_looted[RES_DEUTERIUM],
304
-      (float)$this->resources_lost_in_metal[RES_METAL],
295
+      (float) $this->resources_lost_on_units[RES_METAL],
296
+      (float) $this->resources_lost_on_units[RES_CRYSTAL],
297
+      (float) $this->resources_lost_on_units[RES_DEUTERIUM],
298
+      (float) $this->cargo_dropped[RES_METAL],
299
+      (float) $this->cargo_dropped[RES_CRYSTAL],
300
+      (float) $this->cargo_dropped[RES_DEUTERIUM],
301
+      (float) $this->resources_looted[RES_METAL],
302
+      (float) $this->resources_looted[RES_CRYSTAL],
303
+      (float) $this->resources_looted[RES_DEUTERIUM],
304
+      (float) $this->resources_lost_in_metal[RES_METAL],
305 305
     );
306 306
   }
307 307
 
308 308
   public function report_render_outcome_side_fleet() {
309 309
     $UBE_DEFENCE_RESTORE = array();
310 310
     $UBE_UNITS_LOST = array();
311
-    foreach($this->unit_list->_container as $UBEUnit) {
312
-      if($UBEUnit->units_restored) {
311
+    foreach ($this->unit_list->_container as $UBEUnit) {
312
+      if ($UBEUnit->units_restored) {
313 313
         $UBE_DEFENCE_RESTORE[$UBEUnit->unitId] = $UBEUnit->units_restored;
314 314
       }
315
-      if($UBEUnit->units_lost) {
315
+      if ($UBEUnit->units_lost) {
316 316
         $UBE_UNITS_LOST[$UBEUnit->unitId] = $UBEUnit->units_lost;
317 317
       }
318 318
     }
@@ -337,16 +337,16 @@  discard block
 block discarded – undo
337 337
    */
338 338
   protected function report_render_outcome_side_fleet_line(&$array, $lang_header_index) {
339 339
     $result = array();
340
-    if(!empty($array)) {
341
-      foreach($array as $unit_id => $unit_count) {
342
-        if($unit_count) {
340
+    if (!empty($array)) {
341
+      foreach ($array as $unit_id => $unit_count) {
342
+        if ($unit_count) {
343 343
           $result[] = array(
344 344
             'NAME' => classLocale::$lang['tech'][$unit_id],
345 345
             'LOSS' => pretty_number($unit_count),
346 346
           );
347 347
         }
348 348
       }
349
-      if($lang_header_index && count($result)) {
349
+      if ($lang_header_index && count($result)) {
350 350
         array_unshift($result, array('NAME' => classLocale::$lang[$lang_header_index]));
351 351
       }
352 352
     }
@@ -359,16 +359,16 @@  discard block
 block discarded – undo
359 359
     $fleet_id = $this->db_id;
360 360
 
361 361
     $unit_sort_order = 0;
362
-    foreach($this->unit_list->_container as $UBEUnit) {
363
-      if($UBEUnit->units_lost || $UBEUnit->units_restored) {
362
+    foreach ($this->unit_list->_container as $UBEUnit) {
363
+      if ($UBEUnit->units_lost || $UBEUnit->units_restored) {
364 364
         $unit_sort_order++;
365 365
         $sql_perform_report_unit[] = array(
366 366
           $ube_report_id,
367 367
           $fleet_id,
368 368
 
369 369
           $UBEUnit->unitId,
370
-          (float)$UBEUnit->units_restored,
371
-          (float)$UBEUnit->units_lost,
370
+          (float) $UBEUnit->units_restored,
371
+          (float) $UBEUnit->units_lost,
372 372
 
373 373
           $unit_sort_order,
374 374
         );
@@ -384,9 +384,9 @@  discard block
 block discarded – undo
384 384
   public function ube_combat_result_calculate_resources() {
385 385
     $resource_delta_fleet = array();
386 386
     // Если во флоте остались юниты или это планета - генерируем изменение ресурсов
387
-    foreach(sn_get_groups('resources_loot') as $resource_id) {
388
-      $resource_change = (float)$this->resources_looted[$resource_id] + (float)$this->cargo_dropped[$resource_id];
389
-      if($resource_change) {
387
+    foreach (sn_get_groups('resources_loot') as $resource_id) {
388
+      $resource_change = (float) $this->resources_looted[$resource_id] + (float) $this->cargo_dropped[$resource_id];
389
+      if ($resource_change) {
390 390
         $resource_delta_fleet[$resource_id] = -($resource_change);
391 391
       }
392 392
     }
@@ -419,12 +419,12 @@  discard block
 block discarded – undo
419 419
     );
420 420
 
421 421
     $this->fleet_capacity = 0;
422
-    foreach($this->unit_list->_container as $UBEUnit) {
422
+    foreach ($this->unit_list->_container as $UBEUnit) {
423 423
       $this->fleet_capacity += $UBEUnit->capacity * $UBEUnit->count;
424 424
 
425
-      if($UBEUnit->units_lost) {
426
-        foreach($UBEUnit->price as $resource_id => $unit_resource_price) {
427
-          if(!$unit_resource_price) {
425
+      if ($UBEUnit->units_lost) {
426
+        foreach ($UBEUnit->price as $resource_id => $unit_resource_price) {
427
+          if (!$unit_resource_price) {
428 428
             continue;
429 429
           }
430 430
 
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
           $this->resources_lost_on_units[$resource_id] += $resources_lost;
433 433
           // Если это корабль - прибавляем потери к обломкам на орбите
434 434
           // TODO - опция выбрасывания обороны в обломки
435
-          if($UBEUnit->getType() == UNIT_SHIPS) {
435
+          if ($UBEUnit->getType() == UNIT_SHIPS) {
436 436
             $this->resources_lost_on_ships[$resource_id] += $resources_lost;
437 437
           }
438 438
         }
@@ -444,11 +444,11 @@  discard block
 block discarded – undo
444 444
 
445 445
     // Если емкость трюмов меньше количество ресурсов - часть ресов выбрасываем нахуй
446 446
     // На планете ($fleet_id = 0) ресурсы в космос не выбрасываются
447
-    if($this->db_id != 0 && $this->fleet_capacity < $fleet_total_resources) {
447
+    if ($this->db_id != 0 && $this->fleet_capacity < $fleet_total_resources) {
448 448
       $drop_share = 1 - $this->fleet_capacity / $fleet_total_resources; // Какая часть ресурсов выброшена
449
-      foreach($this->resource_list as $resource_id => &$resource_amount) {
449
+      foreach ($this->resource_list as $resource_id => &$resource_amount) {
450 450
         // Не просчитываем ресурсы, которых нет на борту кораблей флота
451
-        if(!$resource_amount) {
451
+        if (!$resource_amount) {
452 452
           continue;
453 453
         }
454 454
 
@@ -469,19 +469,19 @@  discard block
 block discarded – undo
469 469
     $objFleet2->dbId = $this->db_id;
470 470
 
471 471
     // Если это была миссия Уничтожения И звезда смерти взорвалась И мы работаем с аттакерами - значит все аттакеры умерли
472
-    if($this->is_attacker == UBE_PLAYER_IS_ATTACKER && $reapers_status == UBE_MOON_REAPERS_DIED) {
472
+    if ($this->is_attacker == UBE_PLAYER_IS_ATTACKER && $reapers_status == UBE_MOON_REAPERS_DIED) {
473 473
       $objFleet2->dbDelete();
474
-    } elseif($ship_count_initial == 0) { // $ship_count_lost == $ship_count_initial ||
474
+    } elseif ($ship_count_initial == 0) { // $ship_count_lost == $ship_count_initial ||
475 475
       $objFleet2->dbDelete();
476 476
     } else {
477
-      if($ship_count_lost) {
477
+      if ($ship_count_lost) {
478 478
         // Просматриваем результаты изменения флотов
479
-        foreach($this->unit_list->_container as $UBEUnit) {
479
+        foreach ($this->unit_list->_container as $UBEUnit) {
480 480
           // Перебираем аутком на случай восстановления юнитов
481 481
 //          if(($units_left = $UBEUnit->getCount() - (float)$UBEUnit->units_lost) > 0) {
482 482
 //            $fleet_real_array[$UBEUnit->unitId] = $units_left;
483 483
 //          };
484
-          if(floatval($UBEUnit->units_lost) != 0) {
484
+          if (floatval($UBEUnit->units_lost) != 0) {
485 485
             $objFleet2->shipAdjustCount($UBEUnit->unitId, floatval($UBEUnit->units_lost));
486 486
           };
487 487
         }
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
       $objFleet2->resourcesAdjust($resource_delta_fleet);
492 492
 
493 493
       // Если защитник и не РМФ - отправляем флот назад
494
-      if($this->is_attacker == UBE_PLAYER_IS_ATTACKER || ($this->is_attacker == UBE_PLAYER_IS_DEFENDER && !$is_small_fleet_recce)) {
494
+      if ($this->is_attacker == UBE_PLAYER_IS_ATTACKER || ($this->is_attacker == UBE_PLAYER_IS_DEFENDER && !$is_small_fleet_recce)) {
495 495
         $objFleet2->is_returning = 1;
496 496
       }
497 497
       $objFleet2->dbSave();
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
   public function calculate_unit_partial_data(UBEASA $side_ASA) {
522 522
     $this->fleet_share_of_side_armor = $this->total_stats[P_ARMOR] / $side_ASA->getArmor();
523 523
 
524
-    foreach($this->unit_list->_container as $UBEUnit) {
524
+    foreach ($this->unit_list->_container as $UBEUnit) {
525 525
       $UBEUnit->share_of_side_armor = $UBEUnit->pool_armor / $side_ASA->getArmor();
526 526
     }
527 527
   }
@@ -533,9 +533,9 @@  discard block
 block discarded – undo
533 533
    * @version 2016-02-25 23:42:45 41a4.68
534 534
    */
535 535
   public function attack_fleets(UBEFleetList $fleet_list, $is_simulator) {
536
-    foreach($fleet_list->_container as $defending_fleet) {
536
+    foreach ($fleet_list->_container as $defending_fleet) {
537 537
       // Не атакуются флоты на своей стороне
538
-      if($this->is_attacker == $defending_fleet->is_attacker) {
538
+      if ($this->is_attacker == $defending_fleet->is_attacker) {
539 539
         continue;
540 540
       }
541 541
       $this->attack_fleet($defending_fleet, $is_simulator);
@@ -550,12 +550,12 @@  discard block
 block discarded – undo
550 550
   public function attack_fleet(UBEFleet $defending_fleet, $is_simulator) {
551 551
     UBEDebug::unit_dump_header();
552 552
 
553
-    foreach($this->unit_list->_container as $attacking_unit_pool) {
553
+    foreach ($this->unit_list->_container as $attacking_unit_pool) {
554 554
       UBEDebug::unit_dump($attacking_unit_pool, 'attacker');
555 555
 
556 556
       // if($attack_unit_count <= 0) continue; // TODO: Это пока нельзя включать - вот если будут "боевые порядки юнитов..."
557
-      foreach($defending_fleet->unit_list->_container as $defending_unit_pool) {
558
-        if($defending_unit_pool->isEmpty()) {
557
+      foreach ($defending_fleet->unit_list->_container as $defending_unit_pool) {
558
+        if ($defending_unit_pool->isEmpty()) {
559 559
           continue;
560 560
         }
561 561
 
Please login to merge, or discard this patch.
classes/UBE/UBEFleetList.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -278,6 +278,9 @@
 block discarded – undo
278 278
     return count($this->ube_side_present_at_round_start);
279 279
   }
280 280
 
281
+  /**
282
+   * @param integer $round
283
+   */
281 284
   public function ubeAnalyzeFleetOutcome($round) {
282 285
     $this->ube_actualize_sides();
283 286
 
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -82,13 +82,13 @@  discard block
 block discarded – undo
82 82
    */
83 83
   public function ube_db_load_fleets_outcome($report_row) {
84 84
     $query = doquery("SELECT * FROM {{ube_report_outcome_fleet}} WHERE `ube_report_id` = {$report_row['ube_report_id']}");
85
-    while($row = db_fetch($query)) {
85
+    while ($row = db_fetch($query)) {
86 86
       $fleet_id = $row['ube_report_outcome_fleet_fleet_id'];
87 87
       $this[$fleet_id]->load_outcome_from_report_row($row);
88 88
     }
89 89
 
90 90
     $query = doquery("SELECT * FROM {{ube_report_outcome_unit}} WHERE `ube_report_id` = {$report_row['ube_report_id']} ORDER BY `ube_report_outcome_unit_sort_order`");
91
-    while($row = db_fetch($query)) {
91
+    while ($row = db_fetch($query)) {
92 92
       $fleet_id = $row['ube_report_outcome_unit_fleet_id'];
93 93
       $this[$fleet_id]->load_unit_outcome_from_row($row);
94 94
     }
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
       UBE_PLAYER_IS_DEFENDER => array(),
109 109
     );
110 110
 
111
-    foreach($this->_container as $fleet_id => $UBEFleet) {
111
+    foreach ($this->_container as $fleet_id => $UBEFleet) {
112 112
       $result[$UBEFleet->is_attacker][] = array(
113 113
         'ID'          => $fleet_id,
114 114
         'NAME'        => $ube->players[$UBEFleet->owner_id]->name,
@@ -131,11 +131,11 @@  discard block
 block discarded – undo
131 131
    */
132 132
   public function ube_analyze_fleets($is_simulator, UBEDebris $debris, array $resource_exchange_rates) {
133 133
     // Генерируем результат боя
134
-    foreach($this->_container as $fleet_id => $UBEFleet) {
134
+    foreach ($this->_container as $fleet_id => $UBEFleet) {
135 135
       // Инициализируем массив результатов для флота
136 136
 //      $this->init_fleet_outcome_and_link_to_side($UBEFleet);
137 137
 
138
-      foreach($UBEFleet->unit_list->_container as $UBEUnit) {
138
+      foreach ($UBEFleet->unit_list->_container as $UBEUnit) {
139 139
         $UBEUnit->ube_analyze_unit($is_simulator);
140 140
       }
141 141
 
@@ -152,10 +152,10 @@  discard block
 block discarded – undo
152 152
       $this->resources_lost_in_metal = array(
153 153
         RES_METAL => 0,
154 154
       );
155
-      foreach($UBEFleet->resources_lost_on_units as $resource_id => $resource_amount) {
155
+      foreach ($UBEFleet->resources_lost_on_units as $resource_id => $resource_amount) {
156 156
         $UBEFleet->resources_lost_in_metal[RES_METAL] += $resource_amount * $resource_exchange_rates[$resource_id];
157 157
       }
158
-      foreach($UBEFleet->cargo_dropped as $resource_id => $resource_amount) {
158
+      foreach ($UBEFleet->cargo_dropped as $resource_id => $resource_amount) {
159 159
         $UBEFleet->resources_lost_in_metal[RES_METAL] += $resource_amount * $resource_exchange_rates[$resource_id];
160 160
       }
161 161
     }
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
    */
167 167
   public function ube_get_groups() {
168 168
     $result = array();
169
-    foreach($this->_container as $UBEFleet) {
170
-      if($UBEFleet->group_id) {
169
+    foreach ($this->_container as $UBEFleet) {
170
+      if ($UBEFleet->group_id) {
171 171
         $result[$UBEFleet->group_id] = $UBEFleet->group_id;
172 172
       }
173 173
     }
@@ -180,8 +180,8 @@  discard block
 block discarded – undo
180 180
    */
181 181
   public function ube_get_capacity_attackers() {
182 182
     $result = 0;
183
-    foreach($this->_container as $UBEFleet) {
184
-      if($UBEFleet->is_attacker) {
183
+    foreach ($this->_container as $UBEFleet) {
184
+      if ($UBEFleet->is_attacker) {
185 185
         $result += $UBEFleet->fleet_capacity;
186 186
       }
187 187
     }
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
    */
196 196
   public function ube_db_load_from_report_row(array $report_row, UBE $ube) {
197 197
     $query = doquery("SELECT * FROM {{ube_report_fleet}} WHERE `ube_report_id` = {$report_row['ube_report_id']}");
198
-    while($fleet_row = db_fetch($query)) {
198
+    while ($fleet_row = db_fetch($query)) {
199 199
       $objFleet = new UBEFleet();
200 200
       $objFleet->load_from_report($fleet_row, $ube);
201 201
       $this[$objFleet->db_id] = $objFleet;
@@ -209,20 +209,20 @@  discard block
 block discarded – undo
209 209
    * @version 2016-02-25 23:42:45 41a4.68
210 210
    */
211 211
   public function ube_prepare_for_next_round($is_simulator) {
212
-    foreach($this->_container as $fleet_id => $UBEFleet) {
212
+    foreach ($this->_container as $fleet_id => $UBEFleet) {
213 213
       $UBEFleet->prepare_for_next_round($is_simulator);
214 214
     }
215 215
 
216 216
     // Суммируем данные по атакующим и защитникам
217 217
     $this->ube_total[UBE_PLAYER_IS_ATTACKER]->_reset();
218 218
     $this->ube_total[UBE_PLAYER_IS_DEFENDER]->_reset();
219
-    foreach($this->_container as $fleet_id => $UBEFleet) {
219
+    foreach ($this->_container as $fleet_id => $UBEFleet) {
220 220
       $this->ube_total[$UBEFleet->is_attacker]->add_unit_stats_array($UBEFleet->total_stats);
221 221
     }
222 222
 //pvar_dump($this->ube_total);
223 223
 
224 224
     // Высчитываем долю атаки, приходящейся на юнит равную отношению брони юнита к общей броне - крупные цели атакуют чаще
225
-    foreach($this->_container as $fleet_id => $UBEFleet) {
225
+    foreach ($this->_container as $fleet_id => $UBEFleet) {
226 226
       $UBEFleet->calculate_unit_partial_data($this->ube_total[$UBEFleet->is_attacker]);
227 227
     }
228 228
   }
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
    */
237 237
   public function ube_calculate_attack_results(UBE $ube) {
238 238
     // Каждый флот атакует все
239
-    foreach($this->_container as $attack_fleet_data) {
239
+    foreach ($this->_container as $attack_fleet_data) {
240 240
       defined('DEBUG_UBE') ? print("Fleet {$attack_fleet_data->db_id} attacks<br /><div style='margin-left: 30px;'>") : false;
241 241
 
242 242
       $attack_fleet_data->attack_fleets($this, $ube->is_simulator);
@@ -251,8 +251,8 @@  discard block
 block discarded – undo
251 251
    * @version 2016-02-25 23:42:45 41a4.68
252 252
    */
253 253
   public function ube_actualize_sides() {
254
-    foreach($this->_container as $UBEFleet) {
255
-      if($UBEFleet->get_unit_count() > 0) {
254
+    foreach ($this->_container as $UBEFleet) {
255
+      if ($UBEFleet->get_unit_count() > 0) {
256 256
         $this->ube_side_present_at_round_start[$UBEFleet->is_attacker] = 1;
257 257
       }
258 258
     }
@@ -265,8 +265,8 @@  discard block
 block discarded – undo
265 265
    */
266 266
   public function ube_calculate_attack_reapers() {
267 267
     $reapers = 0;
268
-    foreach($this->_container as $fleet_id => $UBERoundFleetCombat) {
269
-      if($UBERoundFleetCombat->is_attacker == UBE_PLAYER_IS_ATTACKER) {
268
+    foreach ($this->_container as $fleet_id => $UBERoundFleetCombat) {
269
+      if ($UBERoundFleetCombat->is_attacker == UBE_PLAYER_IS_ATTACKER) {
270 270
         $reapers += $UBERoundFleetCombat->unit_list->unitCountReapers();
271 271
       }
272 272
     }
@@ -283,10 +283,10 @@  discard block
 block discarded – undo
283 283
 
284 284
     $result = UBE_COMBAT_RESULT_DRAW;
285 285
     // Проверяем результат боя
286
-    if($this->ube_get_sides_count() == 0 || $round >= 10) {
286
+    if ($this->ube_get_sides_count() == 0 || $round >= 10) {
287 287
       // Если кого-то не осталось или не осталось обоих - заканчиваем цикл
288 288
       $result = UBE_COMBAT_RESULT_DRAW_END;
289
-    } elseif($this->ube_get_sides_count() == 1) {
289
+    } elseif ($this->ube_get_sides_count() == 1) {
290 290
       // Если осталась одна сторона - она и выиграла
291 291
       $result = isset($this->ube_side_present_at_round_start[UBE_PLAYER_IS_ATTACKER]) ? UBE_COMBAT_RESULT_WIN : UBE_COMBAT_RESULT_LOSS;
292 292
     }
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
    * @version 41a6.16
304 304
    */
305 305
   public function ubeInitGetAttackers(Fleet $objFleet, UBEPlayerList $players) {
306
-    if($objFleet->group_id) {
306
+    if ($objFleet->group_id) {
307 307
       $fleets_added = $this->dbLoadWhere("`fleet_group` = {$objFleet->group_id}");
308 308
     } else {
309 309
       $this->ube_insert_from_Fleet($objFleet);
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -232,7 +232,7 @@
 block discarded – undo
232 232
   public function ube_calculate_attack_results(UBE $ube) {
233 233
     // Каждый флот атакует все
234 234
     foreach($this->_container as $attack_fleet_data) {
235
-      defined('DEBUG_UBE') ? print("Fleet {$attack_fleet_data->db_id} attacks<br /><div style='margin-left: 30px;'>") : false;
235
+      defined('DEBUG_UBE') ? print("fleet {$attack_fleet_data->db_id} attacks<br /><div style='margin-left: 30px;'>") : false;
236 236
 
237 237
       $attack_fleet_data->attack_fleets($this, $ube->is_simulator);
238 238
 
Please login to merge, or discard this patch.
classes/UBE/UBEReport.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
   /**
8 8
    * @param UBE $ube
9 9
    *
10
-   * @return bool|string
10
+   * @return false|string
11 11
    *
12 12
    * @version 2016-02-25 23:42:45 41a4.68
13 13
    */
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -13,14 +13,14 @@  discard block
 block discarded – undo
13 13
    */
14 14
   public function sn_ube_report_save($ube) {
15 15
     // Если уже есть ИД репорта - значит репорт был взят из таблицы. С таким мы не работаем
16
-    if($ube->get_cypher()) {
16
+    if ($ube->get_cypher()) {
17 17
       return false;
18 18
     }
19 19
 
20 20
     // Генерируем уникальный секретный ключ и проверяем наличие в базе
21 21
     do {
22 22
       $ube->report_cypher = sys_random_string(32);
23
-    } while(classSupernova::$db->doSelectFetchArray("SELECT ube_report_cypher FROM {{ube_report}} WHERE ube_report_cypher = '{$ube->report_cypher}' LIMIT 1 FOR UPDATE"));
23
+    } while (classSupernova::$db->doSelectFetchArray("SELECT ube_report_cypher FROM {{ube_report}} WHERE ube_report_cypher = '{$ube->report_cypher}' LIMIT 1 FOR UPDATE"));
24 24
 
25 25
     // Инициализация таблицы для пакетной вставки информации
26 26
     $sql_perform = array(
@@ -106,21 +106,21 @@  discard block
 block discarded – undo
106 106
 
107 107
     // Сохраняем общую информацию о бое
108 108
     classSupernova::$db->doInsertSet(TABLE_UBE_REPORT, array(
109
-        'ube_report_cypher'             => (string)$ube->report_cypher,
110
-        'ube_report_time_combat'        => (string)date(FMT_DATE_TIME_SQL, $ube->combat_timestamp),
111
-        'ube_report_time_spent'         => (float)$ube->time_spent,
112
-        'ube_report_combat_admin'       => (int)$ube->is_admin_in_combat,
113
-        'ube_report_mission_type'       => (int)$ube->mission_type_id,
114
-        'ube_report_combat_result'      => (int)$ube->combat_result,
115
-        'ube_report_combat_sfr'         => (int)$ube->is_small_fleet_recce,
116
-        'ube_report_planet_id'          => (int)$ube->ube_planet_info[PLANET_ID],
117
-        'ube_report_planet_name'        => (string)$ube->ube_planet_info[PLANET_NAME],
118
-        'ube_report_planet_size'        => (int)$ube->ube_planet_info[PLANET_SIZE],
119
-        'ube_report_planet_galaxy'      => (int)$ube->ube_planet_info[PLANET_GALAXY],
120
-        'ube_report_planet_system'      => (int)$ube->ube_planet_info[PLANET_SYSTEM],
121
-        'ube_report_planet_planet'      => (int)$ube->ube_planet_info[PLANET_PLANET],
122
-        'ube_report_planet_planet_type' => (int)$ube->ube_planet_info[PLANET_TYPE],
123
-        'ube_report_capture_result'     => (int)$ube->capture_result,
109
+        'ube_report_cypher'             => (string) $ube->report_cypher,
110
+        'ube_report_time_combat'        => (string) date(FMT_DATE_TIME_SQL, $ube->combat_timestamp),
111
+        'ube_report_time_spent'         => (float) $ube->time_spent,
112
+        'ube_report_combat_admin'       => (int) $ube->is_admin_in_combat,
113
+        'ube_report_mission_type'       => (int) $ube->mission_type_id,
114
+        'ube_report_combat_result'      => (int) $ube->combat_result,
115
+        'ube_report_combat_sfr'         => (int) $ube->is_small_fleet_recce,
116
+        'ube_report_planet_id'          => (int) $ube->ube_planet_info[PLANET_ID],
117
+        'ube_report_planet_name'        => (string) $ube->ube_planet_info[PLANET_NAME],
118
+        'ube_report_planet_size'        => (int) $ube->ube_planet_info[PLANET_SIZE],
119
+        'ube_report_planet_galaxy'      => (int) $ube->ube_planet_info[PLANET_GALAXY],
120
+        'ube_report_planet_system'      => (int) $ube->ube_planet_info[PLANET_SYSTEM],
121
+        'ube_report_planet_planet'      => (int) $ube->ube_planet_info[PLANET_PLANET],
122
+        'ube_report_planet_planet_type' => (int) $ube->ube_planet_info[PLANET_TYPE],
123
+        'ube_report_capture_result'     => (int) $ube->capture_result,
124 124
       )
125 125
       + $ube->debris->report_generate_array()
126 126
       + $ube->moon_calculator->report_generate_array()
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 
130 130
     // Сохраняем общую информацию по игрокам
131 131
     $player_sides = $ube->players->get_player_sides();
132
-    foreach($player_sides as $player_id => $player_side) {
132
+    foreach ($player_sides as $player_id => $player_side) {
133 133
       $sql_perform['ube_report_player'][] = array(
134 134
         $ube_report_id,
135 135
         $player_id,
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
         "'" . db_escape($ube->players[$player_id]->name) . "'",
138 138
         $ube->players[$player_id]->getSide() == UBE_PLAYER_IS_ATTACKER ? 1 : 0,
139 139
 
140
-        (float)$ube->players[$player_id]->player_bonus->calcBonus(P_ATTACK),
141
-        (float)$ube->players[$player_id]->player_bonus->calcBonus(P_SHIELD),
142
-        (float)$ube->players[$player_id]->player_bonus->calcBonus(P_ARMOR),
140
+        (float) $ube->players[$player_id]->player_bonus->calcBonus(P_ATTACK),
141
+        (float) $ube->players[$player_id]->player_bonus->calcBonus(P_SHIELD),
142
+        (float) $ube->players[$player_id]->player_bonus->calcBonus(P_ARMOR),
143 143
       );
144 144
     }
145 145
 
146 146
     // Всякая информация по флотам
147
-    foreach($ube->fleet_list->_container as $fleet_id => $UBEFleet) {
147
+    foreach ($ube->fleet_list->_container as $fleet_id => $UBEFleet) {
148 148
       // Сохраняем общую информацию по флотам
149 149
       $sql_perform['ube_report_fleet'][] = $UBEFleet->sql_generate_array($ube_report_id);
150 150
 
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
 
161 161
     // Пакетная вставка данных
162 162
     // First row is a list of field names
163
-    foreach($sql_perform as $table_name => &$table_data) {
163
+    foreach ($sql_perform as $table_name => &$table_data) {
164 164
       // If only field names in this table - doing nothing
165
-      if(count($table_data) < 2) {
165
+      if (count($table_data) < 2) {
166 166
         continue;
167 167
       }
168 168
       // Picking up field names
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
     $report_cypher = db_escape($report_cypher);
186 186
 
187 187
     $report_row = classSupernova::$db->doSelectFetchArray("SELECT * FROM {{ube_report}} WHERE ube_report_cypher = '{$report_cypher}' LIMIT 1");
188
-    if(!$report_row) {
188
+    if (!$report_row) {
189 189
       return UBE_REPORT_NOT_FOUND;
190 190
     }
191 191
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
    * @param     $template_result
202 202
    */
203 203
   public function sn_ube_report_generate(UBE $ube, &$template_result) {
204
-    if(!is_object($ube)) {
204
+    if (!is_object($ube)) {
205 205
       return;
206 206
     }
207 207
 
@@ -216,15 +216,15 @@  discard block
 block discarded – undo
216 216
 
217 217
     // Координаты, тип и название планеты - если есть
218 218
 //R  $planet_owner_id = $combat_data[UBE_FLEETS][0][UBE_OWNER];
219
-    if(isset($ube->ube_planet_info)) {
219
+    if (isset($ube->ube_planet_info)) {
220 220
       $template_result += $ube->ube_planet_info;
221 221
       $template_result[PLANET_NAME] = str_replace(' ', '&nbsp;', htmlentities($template_result[PLANET_NAME], ENT_COMPAT, 'UTF-8'));
222 222
     }
223 223
 
224 224
     // Обломки
225 225
     $debris = array();
226
-    foreach(array(RES_METAL, RES_CRYSTAL) as $resource_id) {
227
-      if($resource_amount = $ube->debris->debris_get_resource($resource_id)) {
226
+    foreach (array(RES_METAL, RES_CRYSTAL) as $resource_id) {
227
+      if ($resource_amount = $ube->debris->debris_get_resource($resource_id)) {
228 228
         $debris[] = array(
229 229
           'NAME'   => classLocale::$lang['tech'][$resource_id],
230 230
           'AMOUNT' => pretty_number($resource_amount),
Please login to merge, or discard this patch.
classes/userOptions.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -151,6 +151,9 @@
 block discarded – undo
151 151
   }
152 152
 
153 153
 
154
+  /**
155
+   * @param integer $user_id
156
+   */
154 157
   public function __construct($user_id) {
155 158
     $this->user_change($user_id);
156 159
   }
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -122,8 +122,8 @@  discard block
 block discarded – undo
122 122
 
123 123
     $update_cache = false;
124 124
 
125
-    if(!empty($this->to_write)) {
126
-      foreach($this->to_write as $key => &$value) {
125
+    if (!empty($this->to_write)) {
126
+      foreach ($this->to_write as $key => &$value) {
127 127
         $value = is_array($this->data[$key]) ? serialize($this->data[$key]) : $this->data[$key]; // Сериализация для массивов при сохранении в БД
128 128
         $value = array($this->user_id, $key, $value);
129 129
       }
@@ -141,9 +141,9 @@  discard block
 block discarded – undo
141 141
       $update_cache = true;
142 142
     }
143 143
 
144
-    if(!empty($this->to_delete)) {
145
-      foreach($this->to_delete as $key => &$value) {
146
-        $value = is_string($key) ? "'". db_escape($key) . "'" : $key;
144
+    if (!empty($this->to_delete)) {
145
+      foreach ($this->to_delete as $key => &$value) {
146
+        $value = is_string($key) ? "'" . db_escape($key) . "'" : $key;
147 147
       }
148 148
 
149 149
       classSupernova::$db->doDeleteDanger(
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
       $update_cache = true;
161 161
     }
162 162
 
163
-    if($update_cache) {
163
+    if ($update_cache) {
164 164
       $field_name = $this->cached_name();
165 165
       classSupernova::$cache->$field_name = $this->data;
166 166
     }
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
   }
184 184
 
185 185
   protected function load() {
186
-    if($this->loaded) {
186
+    if ($this->loaded) {
187 187
       return;
188 188
     }
189 189
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     $this->to_write = array();
192 192
     $this->to_delete = array();
193 193
 
194
-    if(!$this->user_id) {
194
+    if (!$this->user_id) {
195 195
       $this->loaded = true;
196 196
       return;
197 197
     }
@@ -199,13 +199,13 @@  discard block
 block discarded – undo
199 199
     $field_name = $this->cached_name();
200 200
     $a_data = classSupernova::$cache->$field_name;
201 201
 
202
-    if(!empty($a_data)) {
202
+    if (!empty($a_data)) {
203 203
       $this->data = array_replace_recursive($this->data, $a_data);
204 204
       return;
205 205
     }
206 206
 
207 207
     $query = classSupernova::$db->doSelect("SELECT * FROM `{{player_options}}` WHERE `player_id` = {$this->user_id} FOR UPDATE");
208
-    while($row = db_fetch($query)) {
208
+    while ($row = db_fetch($query)) {
209 209
       // $this->data[$row['option_id']] = $row['value'];
210 210
       $this->data[$row['option_id']] = is_string($row['value']) && ($temp = unserialize($row['value'])) !== false ? $temp : $row['value']; // Десериализация
211 211
     }
@@ -290,14 +290,14 @@  discard block
 block discarded – undo
290 290
     // Если в массиве индекса только один элемент - значит это просто индекс
291 291
     is_array($option_id) && count($option_id) == 1 ? $option_id = reset($option_id) : false;
292 292
 
293
-    if(!isset($this->data[is_array($option_id) ? reset($option_id) : $option_id])) {
293
+    if (!isset($this->data[is_array($option_id) ? reset($option_id) : $option_id])) {
294 294
       $this->load();
295 295
     }
296 296
 
297
-    if(is_array($option_id)) {
297
+    if (is_array($option_id)) {
298 298
       $result = $this->data;
299
-      foreach($option_id as $sub_key) {
300
-        if(!isset($result) || !isset($result[$sub_key])) {
299
+      foreach ($option_id as $sub_key) {
300
+        if (!isset($result) || !isset($result[$sub_key])) {
301 301
           $result = null;
302 302
           break;
303 303
         }
@@ -315,12 +315,12 @@  discard block
 block discarded – undo
315 315
    * @param null|mixed $value
316 316
    */
317 317
   public function __set($option, $value = null) {
318
-    if(empty($option) || !$this->user_id) {
318
+    if (empty($option) || !$this->user_id) {
319 319
       return;
320 320
     }
321 321
 
322 322
     // Если в массиве индекса только один элемент - значит это просто индекс
323
-    if(is_array($option) && count($option) == 1) {
323
+    if (is_array($option) && count($option) == 1) {
324 324
       // Разворачиваем его в индекс
325 325
       $option = array(reset($option) => $value);
326 326
       unset($value);
@@ -329,13 +329,13 @@  discard block
 block discarded – undo
329 329
 
330 330
     $to_write = array();
331 331
     // Адресация многомерного массива через массив индексов в $option
332
-    if(is_array($option) && isset($value)) {
332
+    if (is_array($option) && isset($value)) {
333 333
       $a_data = &$this->data;
334
-      foreach($option as $option_id) {
334
+      foreach ($option as $option_id) {
335 335
         !is_array($a_data[$option_id]) ? $a_data[$option_id] = array() : false;
336 336
         $a_data = &$a_data[$option_id];
337 337
       }
338
-      if($a_data != $value) {
338
+      if ($a_data != $value) {
339 339
         $a_data = $value;
340 340
         $to_write[reset($option)] = null;
341 341
       }
@@ -343,10 +343,10 @@  discard block
 block discarded – undo
343 343
       // Пакетная запись из массива ключ -> значение
344 344
       !is_array($option) ? $option = array($option => $value) : false;
345 345
 
346
-      foreach($option as $option_id => $option_value) {
347
-        if($this->data[$option_id] !== $option_value) {
346
+      foreach ($option as $option_id => $option_value) {
347
+        if ($this->data[$option_id] !== $option_value) {
348 348
           // TODO - вынести отдельно в обработчик
349
-          if($option_id == PLAYER_OPTION_MENU_HIDE_SHOW_BUTTON &&  $option_value == PLAYER_OPTION_MENU_HIDE_SHOW_BUTTON_HIDDEN) {
349
+          if ($option_id == PLAYER_OPTION_MENU_HIDE_SHOW_BUTTON && $option_value == PLAYER_OPTION_MENU_HIDE_SHOW_BUTTON_HIDDEN) {
350 350
             sn_setcookie(SN_COOKIE . '_menu_hidden', '0', time() - PERIOD_WEEK, SN_ROOT_RELATIVE);
351 351
           }
352 352
 
@@ -356,11 +356,11 @@  discard block
 block discarded – undo
356 356
       }
357 357
     }
358 358
 
359
-    if(!empty($to_write)) {
359
+    if (!empty($to_write)) {
360 360
       $field_name = $this->cached_name();
361 361
       classSupernova::$cache->$field_name = $this->data;
362 362
 
363
-      foreach($to_write as $option_id => &$option_value) {
363
+      foreach ($to_write as $option_id => &$option_value) {
364 364
         $option_value = is_array($this->data[$option_id]) ? serialize($this->data[$option_id]) : $this->data[$option_id]; // Сериализация для массивов при сохранении в БД
365 365
         $option_value = array($this->user_id, $option_id, $option_value);
366 366
       }
@@ -376,26 +376,26 @@  discard block
 block discarded – undo
376 376
   }
377 377
 
378 378
   protected function load() {
379
-    if($this->loaded) {
379
+    if ($this->loaded) {
380 380
       return;
381 381
     }
382 382
 
383 383
     $this->data = $this->defaults;
384 384
 
385
-    if(!$this->user_id) {
385
+    if (!$this->user_id) {
386 386
       return;
387 387
     }
388 388
 
389 389
     $field_name = $this->cached_name();
390 390
     $a_data = classSupernova::$cache->$field_name;
391 391
 
392
-    if(!empty($a_data)) {
392
+    if (!empty($a_data)) {
393 393
       $this->data = array_replace($this->data, $a_data);
394 394
       return;
395 395
     }
396 396
 
397 397
     $query = classSupernova::$db->doSelect("SELECT * FROM `{{player_options}}` WHERE `player_id` = {$this->user_id} FOR UPDATE");
398
-    while($row = db_fetch($query)) {
398
+    while ($row = db_fetch($query)) {
399 399
       // $this->data[$row['option_id']] = $row['value'];
400 400
       $this->data[$row['option_id']] = is_string($row['value']) && ($temp = unserialize($row['value'])) !== false ? $temp : $row['value']; // Десериализация
401 401
     }
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
     return $this->__get($offset);
412 412
   }
413 413
   public function offsetSet($offset, $value) {
414
-    if(!is_null($offset)) {
414
+    if (!is_null($offset)) {
415 415
       // $this->data[$offset] = $value;
416 416
       $this->__set($offset, $value);
417 417
     } else {
Please login to merge, or discard this patch.