Completed
Push — work-fleets ( abbbcf...8b8b7f )
by SuperNova.WS
05:13
created
includes/includes/market_info.inc 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -79,8 +79,7 @@
 block discarded – undo
79 79
 
80 80
     sn_db_transaction_commit();
81 81
     throw new Exception($info_action, ERR_NONE);
82
-  }
83
-  catch (Exception $e)
82
+  } catch (Exception $e)
84 83
   {
85 84
     sn_db_transaction_rollback();
86 85
 
Please login to merge, or discard this patch.
includes/includes/market_trader.inc 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,8 +35,7 @@
 block discarded – undo
35 35
     if($planetrow['id_owner']) {
36 36
       $global_data = sys_o_get_updated($user, $planetrow, SN_TIME_NOW);
37 37
       $planetrow = $global_data['planet'];
38
-    }
39
-    else {
38
+    } else {
40 39
       // Locking user record
41 40
       $user = db_user_by_id($user['id'], true);
42 41
     }
Please login to merge, or discard this patch.
includes/includes/sys_avatar.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,8 +17,7 @@  discard block
 block discarded – undo
17 17
       }
18 18
       $avatar_field = 0;
19 19
       throw new Exception($lang['opt_msg_avatar_removed'], ERR_NONE);
20
-    }
21
-    elseif($_FILES['avatar']['size'])
20
+    } elseif($_FILES['avatar']['size'])
22 21
     {
23 22
       if(!in_array($_FILES['avatar']['type'], array('image/gif', 'image/jpeg', 'image/jpg', 'image/pjpeg', 'image/png')) || $_FILES['avatar']['size'] > 204800)
24 23
       {
@@ -61,8 +60,7 @@  discard block
 block discarded – undo
61 60
       imagedestroy($avatar_image);
62 61
       throw new Exception($lang['opt_msg_avatar_uploaded'], ERR_NONE);
63 62
     }
64
-  }
65
-  catch (Exception $e)
63
+  } catch (Exception $e)
66 64
   {
67 65
     return array(
68 66
       'STATUS'  => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR,
Please login to merge, or discard this patch.
includes/classes/functions_template.php 1 patch
Braces   +18 added lines, -36 removed lines patch added patch discarded remove patch
@@ -66,8 +66,7 @@  discard block
 block discarded – undo
66 66
       {
67 67
         return;
68 68
         trigger_error("template->_tpl_load_file(): File {$this->template->files[$handle]} does not exist or is empty", E_USER_ERROR);
69
-      }
70
-      else
69
+      } else
71 70
       {
72 71
         $this->template->files[$handle] = $this->template->files_inherit[$handle];
73 72
       }
@@ -225,15 +224,13 @@  discard block
 block discarded – undo
225 224
               $var = substr($temp, 2, -1);
226 225
               //$file = $this->template->_tpldata['DEFINE']['.'][$var];
227 226
               $temp = "\$this->_tpldata['DEFINE']['.']['$var']";
228
-            }
229
-            else
227
+            } else
230 228
             {
231 229
               $var = substr($temp, 1, -1);
232 230
               //$file = $this->template->_rootref[$var];
233 231
               $temp = "\$this->_rootref['$var']";
234 232
             }
235
-          }
236
-          else
233
+          } else
237 234
           {
238 235
             $file = $temp;
239 236
           }
@@ -381,8 +378,7 @@  discard block
 block discarded – undo
381 378
       if ($match[2] < 0)
382 379
       {
383 380
         $loop_start = '($_' . $tag_args . '_count ' . $match[2] . ' < 0 ? 0 : $_' . $tag_args . '_count ' . $match[2] . ')';
384
-      }
385
-      else
381
+      } else
386 382
       {
387 383
         $loop_start = '($_' . $tag_args . '_count < ' . $match[2] . ' ? $_' . $tag_args . '_count : ' . $match[2] . ')';
388 384
       }
@@ -390,17 +386,14 @@  discard block
 block discarded – undo
390 386
       if (strlen($match[3]) < 1 || $match[3] == -1)
391 387
       {
392 388
         $loop_end = '$_' . $tag_args . '_count';
393
-      }
394
-      else if ($match[3] >= 0)
389
+      } else if ($match[3] >= 0)
395 390
       {
396 391
         $loop_end = '(' . ($match[3] + 1) . ' > $_' . $tag_args . '_count ? $_' . $tag_args . '_count : ' . ($match[3] + 1) . ')';
397
-      }
398
-      else //if ($match[3] < -1)
392
+      } else //if ($match[3] < -1)
399 393
       {
400 394
         $loop_end = '$_' . $tag_args . '_count' . ($match[3] + 1);
401 395
       }
402
-    }
403
-    else
396
+    } else
404 397
     {
405 398
       $loop_start = 0;
406 399
       $loop_end = '$_' . $tag_args . '_count';
@@ -413,8 +406,7 @@  discard block
 block discarded – undo
413 406
     {
414 407
       // We need to implode $no_nesting times from the end...
415 408
       $block = array_slice($this->block_names, -$no_nesting);
416
-    }
417
-    else
409
+    } else
418 410
     {
419 411
       $block = $this->block_names;
420 412
     }
@@ -424,8 +416,7 @@  discard block
 block discarded – undo
424 416
       // Block is not nested.
425 417
       $tag_template_php = '$_' . $tag_args . "_count = (isset(\$this->_tpldata['$tag_args'])) ? sizeof(\$this->_tpldata['$tag_args']) : 0;";
426 418
       $varref = "\$this->_tpldata['$tag_args']";
427
-    }
428
-    else
419
+    } else
429 420
     {
430 421
       // This block is nested.
431 422
       // Generate a namespace string for this block.
@@ -573,8 +564,7 @@  discard block
 block discarded – undo
573 564
           if (preg_match('#^((?:[a-z0-9\-_]+\.)+)?(\$)?(?=[A-Za-z])([A-Za-z0-9\-_]+)#s', $token, $varrefs))
574 565
           {
575 566
             $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] . '\']');
576
-          }
577
-          else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs))
567
+          } else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs))
578 568
           {
579 569
             // Allow checking if loops are set with .loopname
580 570
             // It is also possible to check the loop count by doing <!-- IF .loopname > 1 --> for example
@@ -590,8 +580,7 @@  discard block
 block discarded – undo
590 580
 
591 581
               // Add the block reference for the last child.
592 582
               $varref .= "['" . $block . "']";
593
-            }
594
-            else
583
+            } else
595 584
             {
596 585
               $varref = '$this->_tpldata';
597 586
 
@@ -599,8 +588,7 @@  discard block
 block discarded – undo
599 588
               $varref .= "['" . $blocks[0] . "']";
600 589
             }
601 590
             $token = "sizeof($varref)";
602
-          }
603
-          else if (!empty($token))
591
+          } else if (!empty($token))
604 592
           {
605 593
             $token = '(' . $token . ')';
606 594
           }
@@ -645,8 +633,7 @@  discard block
 block discarded – undo
645 633
 
646 634
       // Now replace the php code
647 635
       $match[4] = "'" . str_replace(array('<?php echo ', '; ?>'), array("' . ", " . '"), $match[4]) . "'";
648
-    }
649
-    else
636
+    } else
650 637
     {
651 638
       preg_match('#true|false|\.#i', $match[4], $type);
652 639
 
@@ -708,8 +695,7 @@  discard block
 block discarded – undo
708 695
     {
709 696
       $negate_expr = true;
710 697
       $expr_type = array_shift($tokens);
711
-    }
712
-    else
698
+    } else
713 699
     {
714 700
       $expr_type = $first_token;
715 701
     }
@@ -722,8 +708,7 @@  discard block
 block discarded – undo
722 708
           $expr_end++;
723 709
           $expr_arg = $tokens[$expr_end++];
724 710
           $expr = "!(($is_arg / $expr_arg) % $expr_arg)";
725
-        }
726
-        else
711
+        } else
727 712
         {
728 713
           $expr = "!($is_arg & 1)";
729 714
         }
@@ -735,8 +720,7 @@  discard block
 block discarded – undo
735 720
           $expr_end++;
736 721
           $expr_arg = $tokens[$expr_end++];
737 722
           $expr = "(($is_arg / $expr_arg) % $expr_arg)";
738
-        }
739
-        else
723
+        } else
740 724
         {
741 725
           $expr = "($is_arg & 1)";
742 726
         }
@@ -818,12 +802,10 @@  discard block
 block discarded – undo
818 802
         $varref .= '[$_' . $blocks[$blockcount] . '_i]';
819 803
       }
820 804
       return $varref;
821
-    }
822
-    else if ($include_last_iterator)
805
+    } else if ($include_last_iterator)
823 806
     {
824 807
       return '$_'. $blocks[$blockcount] . '_val';
825
-    }
826
-    else
808
+    } else
827 809
     {
828 810
       return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']';
829 811
     }
Please login to merge, or discard this patch.
includes/classes/template.php 1 patch
Braces   +13 added lines, -26 removed lines patch added patch discarded remove patch
@@ -89,8 +89,7 @@  discard block
 block discarded – undo
89 89
       {
90 90
         $this->inherit_root = $phpbb_root_path . 'styles/' . $user->theme['template_inherit_path'] . '/template';
91 91
       }
92
-    }
93
-    else
92
+    } else
94 93
     {
95 94
       trigger_error('Template path could not be found: styles/' . $user->theme['template_path'] . '/template', E_USER_ERROR);
96 95
     }
@@ -126,8 +125,7 @@  discard block
 block discarded – undo
126 125
 
127 126
       $this->inherit_root = $fallback_template_path;
128 127
       $this->orig_tpl_inherits_id = true;
129
-    }
130
-    else
128
+    } else
131 129
     {
132 130
       $this->orig_tpl_inherits_id = false;
133 131
     }
@@ -201,8 +199,7 @@  discard block
 block discarded – undo
201 199
       }
202 200
 
203 201
       unset($str[$blocks[$blockcount]]);
204
-    }
205
-    else
202
+    } else
206 203
     {
207 204
       // Top-level block.
208 205
       unset($this->_tpldata[$blockname]);
@@ -238,8 +235,7 @@  discard block
 block discarded – undo
238 235
     if ($filename = $this->_tpl_load($handle))
239 236
     {
240 237
       ($include_once) ? include_once($filename) : include($filename);
241
-    }
242
-    else
238
+    } else
243 239
     {
244 240
       eval(' ?>' . $this->compiled_code[$handle] . '<?php ');
245 241
     }
@@ -293,8 +289,7 @@  discard block
 block discarded – undo
293 289
     if (!file_exists($filename) || @filesize($filename) === 0)
294 290
     {
295 291
       $recompile = true;
296
-    }
297
-    else if ($config->load_tplcompile)
292
+    } else if ($config->load_tplcompile)
298 293
     {
299 294
       // No way around it: we need to check inheritance here
300 295
       if ($user->theme['template_inherits_id'] && !file_exists($this->files[$handle]))
@@ -382,15 +377,13 @@  discard block
 block discarded – undo
382 377
               $this->files[$row['template_filename']] = $file;
383 378
               $this->files_inherit[$row['template_filename']] = $file;
384 379
               $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id'];
385
-            }
386
-            else if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id'])
380
+            } else if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id'])
387 381
             {
388 382
               // Ok, we have a situation. There is a file in the subtemplate, but nothing in the DB. We have to fix that.
389 383
               $force_reload = true;
390 384
               $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id'];
391 385
             }
392
-          }
393
-          else
386
+          } else
394 387
           {
395 388
             $this->files_template[$row['template_filename']] = $user->theme['template_id'];
396 389
           }
@@ -400,8 +393,7 @@  discard block
 block discarded – undo
400 393
             if ($row['template_filename'] == $this->filename[$handle])
401 394
             {
402 395
               $compile->_tpl_load_file($handle, true);
403
-            }
404
-            else
396
+            } else
405 397
             {
406 398
               $this->files[$row['template_filename']] = $file;
407 399
               $this->filename[$row['template_filename']] = $row['template_filename'];
@@ -416,8 +408,7 @@  discard block
 block discarded – undo
416 408
           {
417 409
             $this->compiled_code[$handle] = $compile->compile(trim($row['template_data']));
418 410
             $compile->compile_write($handle, $this->compiled_code[$handle]);
419
-          }
420
-          else
411
+          } else
421 412
           {
422 413
             // Only bother compiling if it doesn't already exist
423 414
             if (!file_exists($this->cachepath . str_replace('/', '.', $row['template_filename']) . DOT_PHP_EX))
@@ -428,8 +419,7 @@  discard block
 block discarded – undo
428 419
             }
429 420
           }
430 421
         }
431
-      }
432
-      else
422
+      } else
433 423
       {
434 424
         $file = $this->root . '/' . $row['template_filename'];
435 425
 
@@ -517,8 +507,7 @@  discard block
 block discarded – undo
517 507
       // We're adding a new iteration to this block with the given
518 508
       // variable assignments.
519 509
       $str[$blocks[$blockcount]][] = $vararray;
520
-    }
521
-    else
510
+    } else
522 511
     {
523 512
       // Top-level block.
524 513
       $s_row_count = (isset($this->_tpldata[$blockname])) ? sizeof($this->_tpldata[$blockname]) : 0;
@@ -618,8 +607,7 @@  discard block
 block discarded – undo
618 607
         $key = sizeof($this->_tpldata[$blockname]);
619 608
         unset($this->_tpldata[$blockname][($key - 1)]['S_LAST_ROW']);
620 609
         $vararray['S_LAST_ROW'] = true;
621
-      }
622
-      else if ($key === 0)
610
+      } else if ($key === 0)
623 611
       {
624 612
         unset($this->_tpldata[$blockname][0]['S_FIRST_ROW']);
625 613
         $vararray['S_FIRST_ROW'] = true;
@@ -719,8 +707,7 @@  discard block
 block discarded – undo
719 707
     if(!$name)
720 708
     {
721 709
       $this->assign_vars($values);
722
-    }
723
-    else
710
+    } else
724 711
     {
725 712
       $this->assign_block_vars($name, $values);
726 713
     }
Please login to merge, or discard this patch.
includes/classes/supernova.php 1 patch
Braces   +79 added lines, -35 removed lines patch added patch discarded remove patch
@@ -202,14 +202,18 @@  discard block
 block discarded – undo
202 202
   // Перепаковывает массив на заданную глубину, убирая поля с null
203 203
   public static function array_repack(&$array, $level = 0) {
204 204
     // TODO $lock_table не нужна тут
205
-    if(!is_array($array)) return;
205
+    if(!is_array($array)) {
206
+      return;
207
+    }
206 208
 
207 209
     foreach($array as $key => &$value) {
208 210
       if($value === null) {
209 211
         unset($array[$key]);
210 212
       } elseif($level > 0 && is_array($value)) {
211 213
         static::array_repack($value, $level - 1);
212
-        if(empty($value)) unset($array[$key]);
214
+        if(empty($value)) {
215
+          unset($array[$key]);
216
+        }
213 217
       }
214 218
     }
215 219
   }
@@ -218,7 +222,9 @@  discard block
 block discarded – undo
218 222
   // TODO Вынести в отдельный объект
219 223
   public static function cache_repack($location_type, $record_id = 0) {
220 224
     // Если есть $user_id - проверяем, а надо ли перепаковывать?
221
-    if($record_id && isset(static::$data[$location_type][$record_id]) && static::$data[$location_type][$record_id] !== null) return;
225
+    if($record_id && isset(static::$data[$location_type][$record_id]) && static::$data[$location_type][$record_id] !== null) {
226
+      return;
227
+    }
222 228
 
223 229
     static::array_repack(static::$data[$location_type]);
224 230
     static::array_repack(static::$locator[$location_type], 3); // TODO У каждого типа локации - своя глубина!!!! Но можно и глубже ???
@@ -263,7 +269,9 @@  discard block
 block discarded – undo
263 269
   */
264 270
   public static function cache_set($location_type, $record_id, $record, $force_overwrite = false, $skip_lock = false) {
265 271
     // нет идентификатора - выход
266
-    if(!($record_id = $record[static::$location_info[$location_type][P_ID]])) return;
272
+    if(!($record_id = $record[static::$location_info[$location_type][P_ID]])) {
273
+      return;
274
+    }
267 275
 
268 276
     $in_transaction = static::db_transaction_check(false);
269 277
     if(
@@ -297,8 +305,9 @@  discard block
 block discarded – undo
297 305
     return static::$locks[$location_type][$record_id] = true; // Не всегда - от результата
298 306
   }
299 307
   public static function cache_lock_unset($location_type, $record_id) {
300
-    if(isset(static::$locks[$location_type][$record_id]))
301
-      unset(static::$locks[$location_type][$record_id]);
308
+    if(isset(static::$locks[$location_type][$record_id])) {
309
+          unset(static::$locks[$location_type][$record_id]);
310
+    }
302 311
     return true; // Не всегда - от результата
303 312
   }
304 313
   public static function cache_lock_unset_all() {
@@ -471,8 +480,9 @@  discard block
 block discarded – undo
471 480
           //pdump($q, 'Запрос блокировки');
472 481
           while($row = db_fetch($query)) {
473 482
             // Исключаем из списка родительских ИД уже заблокированные записи
474
-            if(!static::cache_lock_get($owner_location_type, $row['parent_id']))
475
-              $parent_id_list[$row['parent_id']] = $row['parent_id'];
483
+            if(!static::cache_lock_get($owner_location_type, $row['parent_id'])) {
484
+                          $parent_id_list[$row['parent_id']] = $row['parent_id'];
485
+            }
476 486
           }
477 487
           //pdump($parent_id_list, 'Выбраны родители');
478 488
           // Если все-таки какие-то записи еще не заблокированы - вынимаем текущие версии из базы
@@ -506,7 +516,9 @@  discard block
 block discarded – undo
506 516
       if(is_array($query_cache)) {
507 517
         foreach($query_cache as $key => $value) {
508 518
           $result[$key] = $value;
509
-          if($fetch) break;
519
+          if($fetch) {
520
+            break;
521
+          }
510 522
         }
511 523
       }
512 524
       return $fetch ? (is_array($result) ? reset($result) : false) : $result;
@@ -515,12 +527,15 @@  discard block
 block discarded – undo
515 527
 
516 528
   public static function db_upd_record_by_id($location_type, $record_id, $set) {
517 529
     //if(!($record_id = intval($record_id)) || !($set = trim($set))) return false;
518
-    if(!($record_id = idval($record_id)) || !($set = trim($set))) return false;
530
+    if(!($record_id = idval($record_id)) || !($set = trim($set))) {
531
+      return false;
532
+    }
519 533
 
520 534
     $location_info = &static::$location_info[$location_type];
521 535
     $id_field = $location_info[P_ID];
522 536
     $table_name = $location_info[P_TABLE_NAME];
523
-    if($result = static::db_query($q = "UPDATE {{{$table_name}}} SET {$set} WHERE `{$id_field}` = {$record_id}")) // TODO Как-то вернуть может быть LIMIT 1 ?
537
+    if($result = static::db_query($q = "UPDATE {{{$table_name}}} SET {$set} WHERE `{$id_field}` = {$record_id}")) {
538
+      // TODO Как-то вернуть может быть LIMIT 1 ?
524 539
     {
525 540
       if(static::$db->db_affected_rows()) {
526 541
         // Обновляем данные только если ряд был затронут
@@ -528,6 +543,7 @@  discard block
 block discarded – undo
528 543
 
529 544
         // Тут именно так, а не cache_unset - что бы в кэшах автоматически обновилась запись. Будет нужно на будущее
530 545
         static::$data[$location_type][$record_id] = null;
546
+    }
531 547
         // Вытаскиваем обновленную запись
532 548
         static::db_get_record_by_id($location_type, $record_id);
533 549
         static::cache_clear($location_type, false); // Мягкий сброс - только $queries
@@ -537,7 +553,9 @@  discard block
 block discarded – undo
537 553
     return $result;
538 554
   }
539 555
   public static function db_upd_record_list($location_type, $condition, $set) {
540
-    if(!($set = trim($set))) return false;
556
+    if(!($set = trim($set))) {
557
+      return false;
558
+    }
541 559
 
542 560
     $condition = trim($condition);
543 561
     $table_name = static::$location_info[$location_type][P_TABLE_NAME];
@@ -560,9 +578,11 @@  discard block
 block discarded – undo
560 578
     $set = trim($set);
561 579
     $table_name = static::$location_info[$location_type][P_TABLE_NAME];
562 580
     if($result = static::db_query("INSERT INTO `{{{$table_name}}}` SET {$set}")) {
563
-      if(static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут
581
+      if(static::$db->db_affected_rows()) {
582
+        // Обновляем данные только если ряд был затронут
564 583
       {
565 584
         $record_id = db_insert_id();
585
+      }
566 586
         // Вытаскиваем запись целиком, потому что в $set могли быть "данные по умолчанию"
567 587
         $result = static::db_get_record_by_id($location_type, $record_id);
568 588
         // Очищаем второстепенные кэши - потому что вставленная запись могла повлиять на результаты запросов или локация или еще чего
@@ -600,24 +620,30 @@  discard block
 block discarded – undo
600 620
   public static function db_del_record_by_id($location_type, $safe_record_id)
601 621
   {
602 622
     // if(!($safe_record_id = intval($safe_record_id))) return false;
603
-    if(!($safe_record_id = idval($safe_record_id))) return false;
623
+    if(!($safe_record_id = idval($safe_record_id))) {
624
+      return false;
625
+    }
604 626
 
605 627
     $location_info = &static::$location_info[$location_type];
606 628
     $id_field = $location_info[P_ID];
607 629
     $table_name = $location_info[P_TABLE_NAME];
608 630
     if($result = static::db_query("DELETE FROM `{{{$table_name}}}` WHERE `{$id_field}` = {$safe_record_id}"))
609 631
     {
610
-      if(static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут
632
+      if(static::$db->db_affected_rows()) {
633
+        // Обновляем данные только если ряд был затронут
611 634
       {
612 635
         static::cache_unset($location_type, $safe_record_id);
613 636
       }
637
+      }
614 638
     }
615 639
 
616 640
     return $result;
617 641
   }
618 642
   public static function db_del_record_list($location_type, $condition)
619 643
   {
620
-    if(!($condition = trim($condition))) return false;
644
+    if(!($condition = trim($condition))) {
645
+      return false;
646
+    }
621 647
 
622 648
     $location_info = &static::$location_info[$location_type];
623 649
     $table_name = $location_info[P_TABLE_NAME];
@@ -626,12 +652,14 @@  discard block
 block discarded – undo
626 652
 
627 653
     if($result = static::db_query("DELETE FROM `{{{$table_name}}}` WHERE {$condition}"))
628 654
     {
629
-      if(static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут
655
+      if(static::$db->db_affected_rows()) {
656
+        // Обновляем данные только если ряд был затронут
630 657
       {
631 658
         // Обнуление кэша, потому что непонятно, что поменялось
632 659
         // TODO - когда будет структурированный $condition можно будет делать только cache_unset по нужным записям
633 660
         static::cache_clear($location_type);
634 661
       }
662
+      }
635 663
     }
636 664
 
637 665
     return $result;
@@ -673,11 +701,13 @@  discard block
 block discarded – undo
673 701
   public static function db_get_user_by_username($username_unsafe, $for_update = false, $fields = '*', $player = null, $like = false)
674 702
   {
675 703
     // TODO Проверить, кстати - а везде ли нужно выбирать юзеров или где-то все-таки ищутся Альянсы ?
676
-    if(!($username_unsafe = trim($username_unsafe))) return false;
704
+    if(!($username_unsafe = trim($username_unsafe))) {
705
+      return false;
706
+    }
677 707
 
678 708
     $user = null;
679
-    if(is_array(static::$data[LOC_USER]))
680
-    foreach(static::$data[LOC_USER] as $user_id => $user_data)
709
+    if(is_array(static::$data[LOC_USER])) {
710
+        foreach(static::$data[LOC_USER] as $user_id => $user_data)
681 711
     {
682 712
       if(is_array($user_data) && isset($user_data['username']))
683 713
       {
@@ -687,6 +717,7 @@  discard block
 block discarded – undo
687 717
         {
688 718
           // $user_as_ally = intval($user_data['user_as_ally']);
689 719
           $user_as_ally = idval($user_data['user_as_ally']);
720
+    }
690 721
           if($player === null || ($player === true && !$user_as_ally) || ($player === false && $user_as_ally))
691 722
           {
692 723
             $user = $user_data;
@@ -714,7 +745,9 @@  discard block
 block discarded – undo
714 745
   }
715 746
   // UNUSED
716 747
   public static function db_get_user_by_email($email_unsafe, $use_both = false, $for_update = false, $fields = '*') {
717
-    if(!($email_unsafe = strtolower(trim($email_unsafe)))) return false;
748
+    if(!($email_unsafe = strtolower(trim($email_unsafe)))) {
749
+      return false;
750
+    }
718 751
 
719 752
     $user = null;
720 753
     // TODO переделать на индексы
@@ -794,7 +827,9 @@  discard block
 block discarded – undo
794 827
   public static function db_get_unit_list_by_location($user_id = 0, $location_type, $location_id)
795 828
   {
796 829
     //if(!($location_type = intval($location_type)) || !($location_id = intval($location_id))) return false;
797
-    if(!($location_type = idval($location_type)) || !($location_id = idval($location_id))) return false;
830
+    if(!($location_type = idval($location_type)) || !($location_id = idval($location_id))) {
831
+      return false;
832
+    }
798 833
 
799 834
     $query_cache = &static::$locator[LOC_UNIT][$location_type][$location_id];
800 835
     if(!isset($query_cache))
@@ -861,15 +896,18 @@  discard block
 block discarded – undo
861 896
     $query = array();
862 897
 
863 898
     // if($user_id = intval($user_id))
864
-    if($user_id = idval($user_id))
865
-      $query[] = "`que_player_id` = {$user_id}";
899
+    if($user_id = idval($user_id)) {
900
+          $query[] = "`que_player_id` = {$user_id}";
901
+    }
866 902
 
867
-    if($que_type == QUE_RESEARCH || $planet_id === null)
868
-      $query[] = "`que_planet_id` IS NULL";
869
-    elseif($planet_id)
870
-      $query[] = "(`que_planet_id` = {$planet_id}" . ($que_type ? '' : ' OR que_planet_id IS NULL') . ")";
871
-    if($que_type)
872
-      $query[] = "`que_type` = {$que_type}";
903
+    if($que_type == QUE_RESEARCH || $planet_id === null) {
904
+          $query[] = "`que_planet_id` IS NULL";
905
+    } elseif($planet_id) {
906
+          $query[] = "(`que_planet_id` = {$planet_id}" . ($que_type ? '' : ' OR que_planet_id IS NULL') . ")";
907
+    }
908
+    if($que_type) {
909
+          $query[] = "`que_type` = {$que_type}";
910
+    }
873 911
 
874 912
     /*
875 913
     $sql = '';
@@ -990,8 +1028,7 @@  discard block
 block discarded – undo
990 1028
           ),
991 1029
         ),
992 1030
       );
993
-    }
994
-    else
1031
+    } else
995 1032
     {
996 1033
       $db_changeset = array(
997 1034
         'action' => SQL_OP_INSERT,
@@ -1133,7 +1170,9 @@  discard block
 block discarded – undo
1133 1170
 
1134 1171
   public static function db_changeset_apply($db_changeset, $flush_delayed = false) {
1135 1172
     $result = true;
1136
-    if(!is_array($db_changeset) || empty($db_changeset)) return $result;
1173
+    if(!is_array($db_changeset) || empty($db_changeset)) {
1174
+      return $result;
1175
+    }
1137 1176
 
1138 1177
     foreach($db_changeset as $table_name => &$table_data) {
1139 1178
       // TODO - delayed changeset
@@ -1147,8 +1186,13 @@  discard block
 block discarded – undo
1147 1186
       foreach($table_data as $record_id => &$conditions) {
1148 1187
         static::db_changeset_condition_compile($conditions, $table_name);
1149 1188
 
1150
-        if($conditions['action'] != SQL_OP_DELETE && !$conditions[P_FIELDS_STR]) continue;
1151
-        if($conditions['action'] == SQL_OP_DELETE && !$conditions[P_WHERE_STR]) continue; // Защита от случайного удаления всех данных в таблице
1189
+        if($conditions['action'] != SQL_OP_DELETE && !$conditions[P_FIELDS_STR]) {
1190
+          continue;
1191
+        }
1192
+        if($conditions['action'] == SQL_OP_DELETE && !$conditions[P_WHERE_STR]) {
1193
+          continue;
1194
+        }
1195
+        // Защита от случайного удаления всех данных в таблице
1152 1196
 
1153 1197
         if($conditions[P_LOCATION] != LOC_NONE) {
1154 1198
           //die('spec ops supernova.php line 928 Добавить работу с кэшем юнитов итд');
Please login to merge, or discard this patch.
includes/update_old.php 1 patch
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -197,8 +197,7 @@  discard block
 block discarded – undo
197 197
           if($old_que_item[4] == 'build')
198 198
           {
199 199
             $old_que_item[4] = BUILD_CREATE;
200
-          }
201
-          else
200
+          } else
202 201
           {
203 202
             $old_que_item[4] = BUILD_DESTROY;
204 203
           }
@@ -667,18 +666,15 @@  discard block
 block discarded – undo
667 666
             if(preg_match('/^Using Black Market page (\d+)$/', $comment, $matches2))
668 667
             {
669 668
               $reason = RPG_MARKET;
670
-            }
671
-            elseif(preg_match('/^Spent for officer (.+) ID (\d+)$/', $comment, $matches2))
669
+            } elseif(preg_match('/^Spent for officer (.+) ID (\d+)$/', $comment, $matches2))
672 670
             {
673 671
               $reason = RPG_MERCENARY;
674 672
               $comment = "Spent for mercenary {$matches2[1]} GUID {$matches2[2]}";
675
-            }
676
-            elseif(preg_match('/^Incoming From Referral ID\ ?(\d+)$/', $comment, $matches2))
673
+            } elseif(preg_match('/^Incoming From Referral ID\ ?(\d+)$/', $comment, $matches2))
677 674
             {
678 675
               $reason = RPG_REFERRAL;
679 676
               $comment = "Incoming from referral ID {$matches[1]}";
680
-            }
681
-            elseif(preg_match('/^Through admin interface for user .* ID \d+ (.*)$/', $comment, $matches2))
677
+            } elseif(preg_match('/^Through admin interface for user .* ID \d+ (.*)$/', $comment, $matches2))
682 678
             {
683 679
               $reason = RPG_ADMIN;
684 680
               $comment = $matches2[1];
@@ -1716,8 +1712,7 @@  discard block
 block discarded – undo
1716 1712
         if(!isset($found[$index]))
1717 1713
         {
1718 1714
           $found[$index] = $row['BUDDY_ID'];
1719
-        }
1720
-        else
1715
+        } else
1721 1716
         {
1722 1717
           $lost[] = $row['BUDDY_ID'];
1723 1718
         }
@@ -2169,8 +2164,7 @@  discard block
 block discarded – undo
2169 2164
               $que_data[QI_PLANET_ID] = 'NULL';
2170 2165
             }
2171 2166
           }
2172
-        }
2173
-        else
2167
+        } else
2174 2168
         {
2175 2169
           $que_data[QI_PLANET_ID] = 'NULL';
2176 2170
         }
Please login to merge, or discard this patch.
includes/debug.class.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -140,11 +140,13 @@
 block discarded – undo
140 140
       $error_backtrace['locks'] = classSupernova::$locks;
141 141
       $error_backtrace['cSN_data'] = classSupernova::$data;
142 142
       foreach($error_backtrace['cSN_data'] as &$location) {
143
-        foreach($location as $location_id => &$location_data) //          $location_data = $location_id;
143
+        foreach($location as $location_id => &$location_data) {
144
+          //          $location_data = $location_id;
144 145
         {
145 146
           $location_data = isset($location_data['username']) ? $location_data['username'] :
146 147
             (isset($location_data['name']) ? $location_data['name'] : $location_id);
147 148
         }
149
+        }
148 150
       }
149 151
       $error_backtrace['cSN_queries'] = classSupernova::$queries;
150 152
     }
Please login to merge, or discard this patch.
includes/update.php 1 patch
Braces   +21 added lines, -9 removed lines patch added patch discarded remove patch
@@ -399,7 +399,9 @@  discard block
 block discarded – undo
399 399
         $units_levels = array();
400 400
         foreach($planet_unit_list as $unit_id) {
401 401
           $unit_name = &$units_info[$unit_id][P_NAME];
402
-          if(!isset($row[$unit_name]) || !$row[$unit_name]) continue;
402
+          if(!isset($row[$unit_name]) || !$row[$unit_name]) {
403
+            continue;
404
+          }
403 405
           $units_levels[$unit_id] = $row[$unit_name];
404 406
           $unit_data[] = "({$user_id}," . LOC_PLANET . ",{$planet_id},{$units_info[$unit_id][P_UNIT_TYPE]},{$unit_id},{$units_levels[$unit_id]})";
405 407
           if(count($unit_data) > 30) {
@@ -413,7 +415,9 @@  discard block
 block discarded – undo
413 415
         if($row['que']) {
414 416
           $que = explode(';', $row['que']);
415 417
           foreach($que as $que_item) {
416
-            if(!$que_item) continue;
418
+            if(!$que_item) {
419
+              continue;
420
+            }
417 421
 
418 422
             $que_item = explode(',', $que_item);
419 423
 
@@ -445,9 +449,13 @@  discard block
 block discarded – undo
445 449
           $return_resources = array(RES_METAL => 0, RES_CRYSTAL => 0, RES_DEUTERIUM => 0, );
446 450
           $hangar_units = sys_unit_str2arr($row['b_hangar_id']);
447 451
           foreach($hangar_units as $unit_id => $unit_count) {
448
-            if($unit_count <= 0) continue;
452
+            if($unit_count <= 0) {
453
+              continue;
454
+            }
449 455
             foreach($units_info[$unit_id][P_COST] as $resource_id => $resource_amount) {
450
-              if(!in_array($resource_id, $group_resource_loot)) continue;
456
+              if(!in_array($resource_id, $group_resource_loot)) {
457
+                continue;
458
+              }
451 459
               $return_resources[$resource_id] += $unit_count * $resource_amount;
452 460
             }
453 461
           }
@@ -464,11 +472,13 @@  discard block
 block discarded – undo
464 472
         }
465 473
       }
466 474
 
467
-      if(!empty($unit_data))
468
-        upd_do_query('REPLACE INTO {{unit}} (`unit_player_id`, `unit_location_type`, `unit_location_id`, `unit_type`, `unit_snid`, `unit_level`) VALUES ' . implode(',', $unit_data) . ';');
475
+      if(!empty($unit_data)) {
476
+              upd_do_query('REPLACE INTO {{unit}} (`unit_player_id`, `unit_location_type`, `unit_location_id`, `unit_type`, `unit_snid`, `unit_level`) VALUES ' . implode(',', $unit_data) . ';');
477
+      }
469 478
 
470
-      if(!empty($que_data))
471
-        upd_do_query('INSERT INTO {{que}} (`que_player_id`, `que_planet_id`, `que_planet_id_origin`, `que_type`, `que_time_left`, `que_unit_id`, `que_unit_amount`, `que_unit_mode`, `que_unit_level`, `que_unit_time`, `que_unit_price`) VALUES ' . implode(',', $que_data) . ';');
479
+      if(!empty($que_data)) {
480
+              upd_do_query('INSERT INTO {{que}} (`que_player_id`, `que_planet_id`, `que_planet_id_origin`, `que_type`, `que_time_left`, `que_unit_id`, `que_unit_amount`, `que_unit_mode`, `que_unit_level`, `que_unit_time`, `que_unit_price`) VALUES ' . implode(',', $que_data) . ';');
481
+      }
472 482
 
473 483
       upd_alter_table('planets', $drop, true);
474 484
     }
@@ -761,9 +771,11 @@  discard block
 block discarded – undo
761 771
         !empty($strings) ? doquery($query_string . implode(',', $strings)) : false;
762 772
       }
763 773
 
764
-      if(isset($update_tables['counter']['page'])) // TODO REMOVE
774
+      if(isset($update_tables['counter']['page'])) {
775
+        // TODO REMOVE
765 776
       {
766 777
         update_security_url("SELECT DISTINCT `page` as url FROM {{counter}}");
778
+      }
767 779
         update_security_url("SELECT DISTINCT `url` as url FROM {{counter}}");
768 780
       }
769 781
     }
Please login to merge, or discard this patch.