Completed
Push — work-fleets ( d28adc...7496c9 )
by SuperNova.WS
06:01
created
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.
includes/classes/classSupernova.php 1 patch
Spacing   +26 added lines, -28 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
     }
@@ -996,43 +994,43 @@  discard block
 block discarded – undo
996 994
     static::$gc = new Common\GlobalContainer();
997 995
     $gc = static::$gc;
998 996
 
999
-    $gc->db = function ($c) {
997
+    $gc->db = function($c) {
1000 998
       $db = new db_mysql();
1001 999
       $db->sn_db_connect();
1002 1000
 
1003 1001
       return $db;
1004 1002
     };
1005 1003
 
1006
-    $gc->debug = function ($c) {
1004
+    $gc->debug = function($c) {
1007 1005
       return new debug();
1008 1006
     };
1009 1007
 
1010
-    $gc->cache = function ($c) {
1008
+    $gc->cache = function($c) {
1011 1009
       return new classCache(classSupernova::$cache_prefix);
1012 1010
     };
1013 1011
 
1014
-    $gc->config = function ($c) {
1012
+    $gc->config = function($c) {
1015 1013
       return new classConfig(classSupernova::$cache_prefix);
1016 1014
     };
1017 1015
 
1018
-    $gc->localePlayer = function (Common\GlobalContainer $c) {
1016
+    $gc->localePlayer = function(Common\GlobalContainer $c) {
1019 1017
       return new classLocale($c->config->server_locale_log_usage);
1020 1018
     };
1021 1019
 
1022
-    $gc->dbRowOperator = function ($c) {
1020
+    $gc->dbRowOperator = function($c) {
1023 1021
       return new DbRowDirectOperator($c);
1024 1022
     };
1025 1023
 
1026 1024
     $gc->buddyClass = 'Buddy\BuddyModel';
1027
-    $gc->buddy = $gc->factory(function (Common\GlobalContainer $c) {
1025
+    $gc->buddy = $gc->factory(function(Common\GlobalContainer $c) {
1028 1026
       return new $c->buddyClass($c);
1029 1027
     });
1030 1028
 
1031
-    $gc->query = $gc->factory(function (Common\GlobalContainer $c) {
1029
+    $gc->query = $gc->factory(function(Common\GlobalContainer $c) {
1032 1030
       return new DbQueryConstructor($c->db);
1033 1031
     });
1034 1032
 
1035
-    $gc->unit = $gc->factory(function (Common\GlobalContainer $c) {
1033
+    $gc->unit = $gc->factory(function(Common\GlobalContainer $c) {
1036 1034
       return new \V2Unit\V2UnitModel($c);
1037 1035
     });
1038 1036
 
@@ -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.
includes/classes/V2Unit/V2UnitModel.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -78,12 +78,12 @@  discard block
 block discarded – undo
78 78
     $that = $this;
79 79
 
80 80
     $this->_container->assignAccessor('type', P_CONTAINER_GETTER,
81
-      function () use ($that) {
81
+      function() use ($that) {
82 82
         return $that->type;
83 83
       }
84 84
     );
85 85
     $this->_container->assignAccessor('type', P_CONTAINER_SETTER,
86
-      function ($value) use ($that) {
86
+      function($value) use ($that) {
87 87
         $that->type = $value;
88 88
         $array = get_unit_param($value);
89 89
         $that->unitInfo = $array;
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     $propertyName = 'timeStart';
100 100
     $fieldName = self::$_properties[$propertyName][P_DB_FIELD];
101 101
     $this->_container->assignAccessor($propertyName, P_CONTAINER_IMPORTER,
102
-      function (&$row) use ($that, $fieldName) {
102
+      function(&$row) use ($that, $fieldName) {
103 103
         if (isset($row[$fieldName])) {
104 104
           $dateTime = new \DateTime($row[$fieldName]);
105 105
         } else {
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
       }
110 110
     );
111 111
     $this->_container->assignAccessor($propertyName, P_CONTAINER_EXPORTER,
112
-      function (&$row) use ($that, $fieldName) {
112
+      function(&$row) use ($that, $fieldName) {
113 113
         $dateTime = $that->timeStart;
114 114
         if ($dateTime instanceof \DateTime) {
115 115
           $row[$fieldName] = $dateTime->format(FMT_DATE_TIME_SQL);
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
     $propertyName = 'timeFinish';
123 123
     $fieldName = self::$_properties[$propertyName][P_DB_FIELD];
124 124
     $this->_container->assignAccessor($propertyName, P_CONTAINER_IMPORTER,
125
-      function (&$row) use ($that, $fieldName) {
125
+      function(&$row) use ($that, $fieldName) {
126 126
         if (isset($row[$fieldName])) {
127 127
           $dateTime = new \DateTime($row[$fieldName]);
128 128
         } else {
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
       }
133 133
     );
134 134
     $this->_container->assignAccessor($propertyName, P_CONTAINER_EXPORTER,
135
-      function (&$row) use ($that, $fieldName) {
135
+      function(&$row) use ($that, $fieldName) {
136 136
         $dateTime = $that->timeFinish;
137 137
         if ($dateTime instanceof \DateTime) {
138 138
           $row[$fieldName] = $dateTime->format(FMT_DATE_TIME_SQL);
Please login to merge, or discard this patch.
includes/classes/Buddy/BuddyView.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,14 +31,14 @@
 block discarded – undo
31 31
       $cBuddy->new_request_text_unsafe = sys_get_param_str_unsafe('request_text');
32 32
       $cBuddy->playerArray = $user;
33 33
 
34
-      $cBuddy->playerId = function (BuddyRoutingParams $cBuddy) {
34
+      $cBuddy->playerId = function(BuddyRoutingParams $cBuddy) {
35 35
         return $cBuddy->playerArray['id'];
36 36
       };
37
-      $cBuddy->playerName = function (BuddyRoutingParams $cBuddy) {
37
+      $cBuddy->playerName = function(BuddyRoutingParams $cBuddy) {
38 38
         return $cBuddy->playerArray['username'];
39 39
       };
40
-      $cBuddy->playerNameAndCoordinates = function (BuddyRoutingParams $cBuddy) {
41
-        return "{$cBuddy->playerArray['username']} " . uni_render_coordinates($cBuddy->playerArray);
40
+      $cBuddy->playerNameAndCoordinates = function(BuddyRoutingParams $cBuddy) {
41
+        return "{$cBuddy->playerArray['username']} ".uni_render_coordinates($cBuddy->playerArray);
42 42
       };
43 43
 
44 44
       $gc->buddy->route($cBuddy);
Please login to merge, or discard this patch.