Completed
Push — work-fleets ( b19a67...de8005 )
by SuperNova.WS
06:26
created
includes/classes/Buddy/BuddyModel.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,6 @@
 block discarded – undo
9 9
 use DBStaticMessages;
10 10
 use DBStaticUser;
11 11
 use Entity;
12
-use Pimple\GlobalContainer;
13 12
 
14 13
 /**
15 14
  * Class BuddyModel
Please login to merge, or discard this patch.
includes/classes/DbRowSimple.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
       ->setIdField($object::$idField)
14 14
       ->field('*')
15 15
       ->from($object::$tableName)
16
-      ->where($object::$idField . ' = "' . $rowId . '"');
16
+      ->where($object::$idField.' = "'.$rowId.'"');
17 17
 
18 18
     $object->setRow($stmt->selectRow());
19 19
 
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
   public function deleteById($object) {
27 27
     $db = classSupernova::$gc->db;
28 28
 
29
-    $db->doquery("DELETE FROM `{{" . $object::$tableName . "}}` WHERE `{$object::$idField}` = '{$object->getDbId()}' LIMIT 1;");
29
+    $db->doquery("DELETE FROM `{{".$object::$tableName."}}` WHERE `{$object::$idField}` = '{$object->getDbId()}' LIMIT 1;");
30 30
 
31 31
     return $db->db_affected_rows();
32 32
   }
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
       return 0;
50 50
     }
51 51
 
52
-    $db->doquery("INSERT INTO `{{" . $object::$tableName . "}}` SET " . $query);
52
+    $db->doquery("INSERT INTO `{{".$object::$tableName."}}` SET ".$query);
53 53
 
54 54
     // TODO Exceptiion if db_insert_id() is empty
55 55
     $dbId = $db->db_insert_id();
Please login to merge, or discard this patch.
includes/classes/classSupernova.php 1 patch
Spacing   +25 added lines, -27 removed lines patch added patch discarded remove patch
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
 
229 229
     if (!empty($error_msg)) {
230 230
       // TODO - Убрать позже
231
-      print('<h1>СООБЩИТЕ ЭТО АДМИНУ: sn_db_transaction_check() - ' . $error_msg . '</h1>');
231
+      print('<h1>СООБЩИТЕ ЭТО АДМИНУ: sn_db_transaction_check() - '.$error_msg.'</h1>');
232 232
       $backtrace = debug_backtrace();
233 233
       array_shift($backtrace);
234 234
       pdump($backtrace);
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
   public static function db_transaction_start($level = '') {
242 242
     static::db_transaction_check(null);
243 243
 
244
-    $level ? doquery('SET TRANSACTION ISOLATION LEVEL ' . $level) : false;
244
+    $level ? doquery('SET TRANSACTION ISOLATION LEVEL '.$level) : false;
245 245
 
246 246
     static::$transaction_id++;
247 247
     doquery('START TRANSACTION');
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
   public static function db_lock_tables($tables) {
306 306
     $tables = is_array($tables) ? $tables : array($tables => '');
307 307
     foreach ($tables as $table_name => $condition) {
308
-      self::$db->doquery("SELECT 1 FROM {{{$table_name}}}" . ($condition ? ' WHERE ' . $condition : ''));
308
+      self::$db->doquery("SELECT 1 FROM {{{$table_name}}}".($condition ? ' WHERE '.$condition : ''));
309 309
     }
310 310
   }
311 311
 
@@ -365,8 +365,8 @@  discard block
 block discarded – undo
365 365
           $query = static::db_query(
366 366
             "SELECT
367 367
               distinct({{{$location_info[P_TABLE_NAME]}}}.{$owner_data[P_OWNER_FIELD]}) AS parent_id
368
-            FROM {{{$location_info[P_TABLE_NAME]}}}" .
369
-            ($filter ? ' WHERE ' . $filter : '') .
368
+            FROM {{{$location_info[P_TABLE_NAME]}}}".
369
+            ($filter ? ' WHERE '.$filter : '').
370 370
             ($fetch ? ' LIMIT 1' : ''), false, true);
371 371
 
372 372
           while ($row = db_fetch($query)) {
@@ -379,13 +379,13 @@  discard block
 block discarded – undo
379 379
           if ($indexes_str = implode(',', $parent_id_list)) {
380 380
             $parent_id_field = static::$location_info[$owner_location_type][P_ID];
381 381
             static::db_get_record_list($owner_location_type,
382
-              $parent_id_field . (count($parent_id_list) > 1 ? " IN ({$indexes_str})" : " = {$indexes_str}"), $fetch, true);
382
+              $parent_id_field.(count($parent_id_list) > 1 ? " IN ({$indexes_str})" : " = {$indexes_str}"), $fetch, true);
383 383
           }
384 384
         }
385 385
       }
386 386
 
387 387
       $query = static::db_query(
388
-        "SELECT * FROM {{{$location_info[P_TABLE_NAME]}}}" .
388
+        "SELECT * FROM {{{$location_info[P_TABLE_NAME]}}}".
389 389
         (($filter = trim($filter)) ? " WHERE {$filter}" : '')
390 390
       );
391 391
       while ($row = db_fetch($query)) {
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
     $condition = trim($condition);
457 457
     $table_name = static::$location_info[$location_type][P_TABLE_NAME];
458 458
 
459
-    if ($result = static::db_query("UPDATE {{{$table_name}}} SET " . $set . ($condition ? ' WHERE ' . $condition : ''))) {
459
+    if ($result = static::db_query("UPDATE {{{$table_name}}} SET ".$set.($condition ? ' WHERE '.$condition : ''))) {
460 460
 
461 461
       if (static::$db->db_affected_rows()) { // Обновляем данные только если ряд был затронут
462 462
         // Поскольку нам неизвестно, что и как обновилось - сбрасываем кэш этого типа полностью
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
       $username_safe = db_escape($like ? strtolower($username_unsafe) : $username_unsafe); // тут на самом деле strtolower() лишняя, но пусть будет
615 615
 
616 616
       $user = static::db_query(
617
-        "SELECT * FROM {{users}} WHERE `username` " . ($like ? 'LIKE' : '=') . " '{$username_safe}'"
617
+        "SELECT * FROM {{users}} WHERE `username` ".($like ? 'LIKE' : '=')." '{$username_safe}'"
618 618
         , true);
619 619
       SnCache::cache_set(LOC_USER, $user); // В кэш-юзер так же заполнять индексы
620 620
     }
@@ -671,7 +671,7 @@  discard block
 block discarded – undo
671 671
     }
672 672
 
673 673
     if (SnCache::isUnitLocatorNotSet($location_type, $location_id)) {
674
-      $got_data = static::db_get_record_list(LOC_UNIT, "unit_location_type = {$location_type} AND unit_location_id = {$location_id} AND " . static::db_unit_time_restrictions());
674
+      $got_data = static::db_get_record_list(LOC_UNIT, "unit_location_type = {$location_type} AND unit_location_id = {$location_id} AND ".static::db_unit_time_restrictions());
675 675
       if (!empty($got_data) && is_array($got_data)) {
676 676
         foreach ($got_data as $unit_id => $unit_data) {
677 677
           SnCache::setUnitLocatorByLocationAndIDs($location_type, $location_id, $unit_data);
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
     if ($que_type == QUE_RESEARCH || $planet_id === null) {
731 731
       $query[] = "`que_planet_id` IS NULL";
732 732
     } elseif ($planet_id) {
733
-      $query[] = "(`que_planet_id` = {$planet_id}" . ($que_type ? '' : ' OR que_planet_id IS NULL') . ")";
733
+      $query[] = "(`que_planet_id` = {$planet_id}".($que_type ? '' : ' OR que_planet_id IS NULL').")";
734 734
     }
735 735
     if ($que_type) {
736 736
       $query[] = "`que_type` = {$que_type}";
@@ -844,13 +844,13 @@  discard block
 block discarded – undo
844 844
         $condition = "`{$field_name}` = ";
845 845
         $value = '';
846 846
         if ($field_data['delta']) {
847
-          $value = "`{$field_name}`" . ($field_data['delta'] >= 0 ? '+' : '') . $field_data['delta'];
847
+          $value = "`{$field_name}`".($field_data['delta'] >= 0 ? '+' : '').$field_data['delta'];
848 848
         } elseif ($field_data['set']) {
849 849
           $value = (is_string($field_data['set']) ? "'{$field_data['set']}'" : $field_data['set']);
850 850
         }
851 851
 
852 852
         if ($value) {
853
-          $fields[] = $condition . $value;
853
+          $fields[] = $condition.$value;
854 854
         }
855 855
       }
856 856
       $conditions[P_FIELDS_STR] = implode(',', $fields);
@@ -864,9 +864,7 @@  discard block
 block discarded – undo
864 864
           // Простое условие - $field_id = $field_value
865 865
           if (is_string($field_id)) {
866 866
             $field_value =
867
-              $field_value === null ? 'NULL' :
868
-                (is_string($field_value) ? "'" . db_escape($field_value) . "'" :
869
-                  (is_bool($field_value) ? intval($field_value) : $field_value));
867
+              $field_value === null ? 'NULL' : (is_string($field_value) ? "'".db_escape($field_value)."'" : (is_bool($field_value) ? intval($field_value) : $field_value));
870 868
             $the_conditions[] = "`{$field_id}` = {$field_value}";
871 869
           } else {
872 870
             die('Неподдерживаемый тип условия');
@@ -893,7 +891,7 @@  discard block
 block discarded – undo
893 891
         die('Неподдерживаемая операция в classSupernova::db_changeset_condition_compile');
894 892
     }
895 893
 
896
-    $conditions[P_QUERY_STR] = $conditions[P_ACTION_STR] . ' ' . $conditions[P_FIELDS_STR] . (' WHERE ' . $conditions[P_WHERE_STR]);
894
+    $conditions[P_QUERY_STR] = $conditions[P_ACTION_STR].' '.$conditions[P_FIELDS_STR].(' WHERE '.$conditions[P_WHERE_STR]);
897 895
   }
898 896
 
899 897
   public static function db_changeset_apply($db_changeset, $flush_delayed = false) {
@@ -981,7 +979,7 @@  discard block
 block discarded – undo
981 979
     ini_get('magic_quotes_sybase') ? die('SN is incompatible with \'magic_quotes_sybase\' turned on. Disable it in php.ini or .htaccess...') : false;
982 980
     if (@get_magic_quotes_gpc()) {
983 981
       $gpcr = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
984
-      array_walk_recursive($gpcr, function (&$value, $key) {
982
+      array_walk_recursive($gpcr, function(&$value, $key) {
985 983
         $value = stripslashes($value);
986 984
       });
987 985
     }
@@ -998,39 +996,39 @@  discard block
 block discarded – undo
998 996
       'buddyClass' => 'Buddy\BuddyModel',
999 997
     ));
1000 998
 
1001
-    $container->db = function ($c) {};
999
+    $container->db = function($c) {};
1002 1000
 
1003
-      $container->db = function ($c) {
1001
+      $container->db = function($c) {
1004 1002
       $db = new db_mysql();
1005 1003
       $db->sn_db_connect();
1006 1004
 
1007 1005
       return $db;
1008 1006
     };
1009 1007
 
1010
-    $container->debug = function ($c) {
1008
+    $container->debug = function($c) {
1011 1009
       return new debug();
1012 1010
     };
1013 1011
 
1014
-    $container->cache = function ($c) {
1012
+    $container->cache = function($c) {
1015 1013
       return new classCache(classSupernova::$cache_prefix);
1016 1014
     };
1017 1015
 
1018
-    $container->config = function ($c) {
1016
+    $container->config = function($c) {
1019 1017
       return new classConfig(classSupernova::$cache_prefix);
1020 1018
     };
1021 1019
 
1022
-    $container->dbRowOperator = function ($c) {
1020
+    $container->dbRowOperator = function($c) {
1023 1021
       return new DbRowSimple($c);
1024 1022
     };
1025 1023
 
1026
-    $container->buddy = $container->factory(function ($c) {
1024
+    $container->buddy = $container->factory(function($c) {
1027 1025
       return new $c->buddyClass($c);
1028 1026
     });
1029 1027
 //    $container->buddy = $container->factory(function ($c) {
1030 1028
 //      return new Buddy\Buddy($c);
1031 1029
 //    });
1032 1030
 
1033
-    $container->query = $container->factory(function (Pimple\GlobalContainer $c) {
1031
+    $container->query = $container->factory(function(Pimple\GlobalContainer $c) {
1034 1032
       return new DbQueryConstructor($c->db);
1035 1033
     });
1036 1034
 
@@ -1045,7 +1043,7 @@  discard block
 block discarded – undo
1045 1043
   public static function init_3_load_config_file() {
1046 1044
     $dbsettings = array();
1047 1045
 
1048
-    require(SN_ROOT_PHYSICAL . "config" . DOT_PHP_EX);
1046
+    require(SN_ROOT_PHYSICAL."config".DOT_PHP_EX);
1049 1047
     self::$cache_prefix = !empty($dbsettings['cache_prefix']) ? $dbsettings['cache_prefix'] : $dbsettings['prefix'];
1050 1048
     self::$db_name = $dbsettings['name'];
1051 1049
     self::$sn_secret_word = $dbsettings['secretword'];
Please login to merge, or discard this patch.
buddy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
3
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
4 4
 
5 5
 $template = gettemplate('viewreport', true);
6 6
 $template->assign_var('PAGE_HINT', classLocale::$lang['cr_view_hint']);
Please login to merge, or discard this patch.