Completed
Push — work-fleets ( 47d5d4...77ad6e )
by SuperNova.WS
06:45
created
includes/classes/PropertyHiderInObject.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@
 block discarded – undo
2 2
 
3 3
 class PropertyHiderInObject extends PropertyHider {
4 4
   private function getPhysicalPropertyName($name) {
5
-    return '_' . $name;
5
+    return '_'.$name;
6 6
   }
7 7
 
8 8
   /**
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.
includes/classes/PropertyHider.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -76,13 +76,13 @@  discard block
 block discarded – undo
76 76
 
77 77
   protected function checkPropertyExists($name) {
78 78
     if (!array_key_exists($name, $this->_properties)) {
79
-      throw new ExceptionPropertyNotExists('Property [' . get_called_class() . '::' . $name . '] not exists', ERR_ERROR);
79
+      throw new ExceptionPropertyNotExists('Property ['.get_called_class().'::'.$name.'] not exists', ERR_ERROR);
80 80
     }
81 81
   }
82 82
 
83 83
   protected function checkOverwriteAdjusted($name) {
84 84
     if (array_key_exists($name, $this->propertiesAdjusted)) {
85
-      throw new PropertyAccessException('Property [' . get_called_class() . '::' . $name . '] already was adjusted so no SET is possible until dbSave', ERR_ERROR);
85
+      throw new PropertyAccessException('Property ['.get_called_class().'::'.$name.'] already was adjusted so no SET is possible until dbSave', ERR_ERROR);
86 86
     }
87 87
   }
88 88
 
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
    * @return boolean
132 132
    */
133 133
   public function isContainerEmpty() {
134
-    throw new Exception('PropertyHider::isContainerEmpty() is not implemented. You should implement it in class ' . get_called_class());
134
+    throw new Exception('PropertyHider::isContainerEmpty() is not implemented. You should implement it in class '.get_called_class());
135 135
   }
136 136
 
137 137
 
@@ -175,15 +175,15 @@  discard block
 block discarded – undo
175 175
     $result = null;
176 176
     // Now deciding - will we call a protected setter or will we work with protected property
177 177
     // Todo - on init recalc all method_exists
178
-    if (method_exists($this, $methodName = $action . ucfirst($name))) {
178
+    if (method_exists($this, $methodName = $action.ucfirst($name))) {
179 179
       // If method exists - just calling it
180 180
       // TODO - should return TRUE if value changed or FALSE otherwise
181 181
       $result = call_user_func_array(array($this, $methodName), array($value));
182 182
     } elseif ($this->isPropertyActionAvailable($name, $action)) {
183 183
       // No setter exists - works directly with protected property
184
-      $result = $this->{$action . 'Property'}($name, $value);
184
+      $result = $this->{$action.'Property'}($name, $value);
185 185
     } else {
186
-      throw new ExceptionPropertyNotExists('Property [' . get_called_class() . '::' . $name . '] does not have ' . $action . 'ter/property to ' . $action, ERR_ERROR);
186
+      throw new ExceptionPropertyNotExists('Property ['.get_called_class().'::'.$name.'] does not have '.$action.'ter/property to '.$action, ERR_ERROR);
187 187
     }
188 188
 
189 189
     return $result;
@@ -274,7 +274,7 @@  discard block
 block discarded – undo
274 274
    * @return string
275 275
    */
276 276
   protected function adjustPropertyString($name, $diff) {
277
-    return (string)$this->$name . (string)$diff;
277
+    return (string) $this->$name.(string) $diff;
278 278
   }
279 279
 
280 280
   /**
@@ -284,8 +284,8 @@  discard block
 block discarded – undo
284 284
    * @return array
285 285
    */
286 286
   protected function adjustPropertyArray($name, $diff) {
287
-    $copy = (array)$this->$name;
288
-    HelperArray::merge($copy, (array)$diff, HelperArray::MERGE_PHP);
287
+    $copy = (array) $this->$name;
288
+    HelperArray::merge($copy, (array) $diff, HelperArray::MERGE_PHP);
289 289
 
290 290
     return $copy;
291 291
   }
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
    * @return int
298 298
    */
299 299
   protected function deltaInteger($name, $diff) {
300
-    return (int)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0) + (int)$diff;
300
+    return (int) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0) + (int) $diff;
301 301
   }
302 302
 
303 303
   /**
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
    * @return float
308 308
    */
309 309
   protected function deltaDouble($name, $diff) {
310
-    return (float)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0.0) + (float)$diff;
310
+    return (float) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, 0.0) + (float) $diff;
311 311
   }
312 312
 
313 313
   /**
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
    * @return string
318 318
    */
319 319
   protected function deltaString($name, $diff) {
320
-    return (string)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, '') . (string)$diff;
320
+    return (string) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, '').(string) $diff;
321 321
   }
322 322
 
323 323
   /**
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
    * @return array
328 328
    */
329 329
   protected function deltaArray($name, $diff) {
330
-    $copy = (array)HelperArray::keyExistsOr($this->propertiesAdjusted, $name, array());
330
+    $copy = (array) HelperArray::keyExistsOr($this->propertiesAdjusted, $name, array());
331 331
     HelperArray::merge($copy, $diff, HelperArray::MERGE_PHP);
332 332
 
333 333
     return $copy;
@@ -350,10 +350,10 @@  discard block
 block discarded – undo
350 350
     // Capitalizing type name
351 351
     $methodName = explode(' ', $type);
352 352
     array_walk($methodName, 'DbSqlHelper::UCFirstByRef');
353
-    $methodName = $prefix . implode('', $methodName);
353
+    $methodName = $prefix.implode('', $methodName);
354 354
 
355 355
     if (!method_exists($this, $methodName)) {
356
-      throw new ExceptionTypeUnsupported('Type "' . $type . '" is unsupported in PropertyHider::propertyMethodResult');
356
+      throw new ExceptionTypeUnsupported('Type "'.$type.'" is unsupported in PropertyHider::propertyMethodResult');
357 357
     }
358 358
 
359 359
     return call_user_func(array($this, $methodName), $name, $diff);
Please login to merge, or discard this patch.
includes/classes/Common/Types.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
       break;
31 31
 
32 32
       case TYPE_ARRAY:
33
-        $value = (array)$value;
33
+        $value = (array) $value;
34 34
       break;
35 35
 
36 36
       case TYPE_STRING:
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
       case TYPE_EMPTY:
39 39
         // No-type defaults to string
40 40
       default:
41
-        $value = (string)$value;
41
+        $value = (string) $value;
42 42
       break;
43 43
     }
44 44
 
Please login to merge, or discard this patch.
includes/classes/V2PropertyContainer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
     if (is_callable($callable)) {
53 53
       $this->accessors[$type][$varName] = $callable;
54 54
     } else {
55
-      throw new Exception('Error assigning callable in ' . get_called_class() . '! Callable typed [' . $type . '] is not a callable or not accessible in the scope');
55
+      throw new Exception('Error assigning callable in '.get_called_class().'! Callable typed ['.$type.'] is not a callable or not accessible in the scope');
56 56
     }
57 57
   }
58 58
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
   }
74 74
 
75 75
   public function importRow($row) {
76
-    if(empty($row)) {
76
+    if (empty($row)) {
77 77
       return;
78 78
     }
79 79
 
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
@@ -27,14 +27,14 @@
 block discarded – undo
27 27
     $cBuddy->new_request_text_unsafe = sys_get_param_str_unsafe('request_text');
28 28
     $cBuddy->playerArray = $user;
29 29
 
30
-    $cBuddy->playerId = function (BuddyRoutingParams $cBuddy) {
30
+    $cBuddy->playerId = function(BuddyRoutingParams $cBuddy) {
31 31
       return $cBuddy->playerArray['id'];
32 32
     };
33
-    $cBuddy->playerName = function (BuddyRoutingParams $cBuddy) {
33
+    $cBuddy->playerName = function(BuddyRoutingParams $cBuddy) {
34 34
       return $cBuddy->playerArray['username'];
35 35
     };
36
-    $cBuddy->playerNameAndCoordinates = function (BuddyRoutingParams $cBuddy) {
37
-      return "{$cBuddy->playerArray['username']} " . uni_render_coordinates($cBuddy->playerArray);
36
+    $cBuddy->playerNameAndCoordinates = function(BuddyRoutingParams $cBuddy) {
37
+      return "{$cBuddy->playerArray['username']} ".uni_render_coordinates($cBuddy->playerArray);
38 38
     };
39 39
 
40 40
     $result = array();
Please login to merge, or discard this patch.
includes/classes/classSupernova.php 4 patches
Doc Comments   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
   /**
201 201
    * Блокирует указанные таблицу/список таблиц
202 202
    *
203
-   * @param string|array $tables Таблица/список таблиц для блокировки. Названия таблиц - без префиксов
203
+   * @param string $tables Таблица/список таблиц для блокировки. Названия таблиц - без префиксов
204 204
    * <p>string - название таблицы для блокировки</p>
205 205
    * <p>array - массив, где ключ - имя таблицы, а значение - условия блокировки элементов</p>
206 206
    */
@@ -377,6 +377,9 @@  discard block
 block discarded – undo
377 377
     return $result;
378 378
   }
379 379
 
380
+  /**
381
+   * @param integer $location_type
382
+   */
380 383
   public static function db_ins_field_set($location_type, $field_set, $serialize = false) {
381 384
     // TODO multiinsert
382 385
     !sn_db_field_set_is_safe($field_set) ? $field_set = sn_db_field_set_make_safe($field_set, $serialize) : false;
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -1,7 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 use Vector\Vector;
4
-
5 4
 use Common\GlobalContainer;
6 5
 
7 6
 class classSupernova {
Please login to merge, or discard this patch.
Spacing   +25 added lines, -27 removed lines patch added patch discarded remove patch
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
   public static function db_lock_tables($tables) {
208 208
     $tables = is_array($tables) ? $tables : array($tables => '');
209 209
     foreach ($tables as $table_name => $condition) {
210
-      self::$db->doSelect("SELECT 1 FROM {{{$table_name}}}" . ($condition ? ' WHERE ' . $condition : ''));
210
+      self::$db->doSelect("SELECT 1 FROM {{{$table_name}}}".($condition ? ' WHERE '.$condition : ''));
211 211
     }
212 212
   }
213 213
 
@@ -249,8 +249,8 @@  discard block
 block discarded – undo
249 249
           $query = static::$db->doSelect(
250 250
             "SELECT
251 251
               distinct({{{$location_info[P_TABLE_NAME]}}}.{$owner_data[P_OWNER_FIELD]}) AS parent_id
252
-            FROM {{{$location_info[P_TABLE_NAME]}}}" .
253
-            ($filter ? ' WHERE ' . $filter : '') .
252
+            FROM {{{$location_info[P_TABLE_NAME]}}}".
253
+            ($filter ? ' WHERE '.$filter : '').
254 254
             ($fetch ? ' LIMIT 1' : ''));
255 255
           while ($row = db_fetch($query)) {
256 256
             // Исключаем из списка родительских ИД уже заблокированные записи
@@ -263,13 +263,13 @@  discard block
 block discarded – undo
263 263
           if ($indexes_str = implode(',', $parent_id_list)) {
264 264
             $parent_id_field = static::$location_info[$owner_location_type][P_ID];
265 265
             static::db_get_record_list($owner_location_type,
266
-              $parent_id_field . (count($parent_id_list) > 1 ? " IN ({$indexes_str})" : " = {$indexes_str}"), $fetch, true);
266
+              $parent_id_field.(count($parent_id_list) > 1 ? " IN ({$indexes_str})" : " = {$indexes_str}"), $fetch, true);
267 267
           }
268 268
         }
269 269
       }
270 270
 
271 271
       $query = static::$db->doSelect(
272
-        "SELECT * FROM {{{$location_info[P_TABLE_NAME]}}}" .
272
+        "SELECT * FROM {{{$location_info[P_TABLE_NAME]}}}".
273 273
         (($filter = trim($filter)) ? " WHERE {$filter}" : '')
274 274
         . " FOR UPDATE"
275 275
       );
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
     $condition = trim($condition);
342 342
     $table_name = static::$location_info[$location_type][P_TABLE_NAME];
343 343
 
344
-    if ($result = static::$db->doUpdate("UPDATE {{{$table_name}}} SET " . $set . ($condition ? ' WHERE ' . $condition : ''))) {
344
+    if ($result = static::$db->doUpdate("UPDATE {{{$table_name}}} SET ".$set.($condition ? ' WHERE '.$condition : ''))) {
345 345
 
346 346
       if (static::$db->db_affected_rows()) { // Обновляем данные только если ряд был затронут
347 347
         // Поскольку нам неизвестно, что и как обновилось - сбрасываем кэш этого типа полностью
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
       $username_safe = db_escape($like ? strtolower($username_unsafe) : $username_unsafe); // тут на самом деле strtolower() лишняя, но пусть будет
500 500
 
501 501
       $user = static::$db->doSelectFetch(
502
-        "SELECT * FROM {{users}} WHERE `username` " . ($like ? 'LIKE' : '=') . " '{$username_safe}'"
502
+        "SELECT * FROM {{users}} WHERE `username` ".($like ? 'LIKE' : '=')." '{$username_safe}'"
503 503
         . " FOR UPDATE"
504 504
       );
505 505
       SnCache::cache_set(LOC_USER, $user); // В кэш-юзер так же заполнять индексы
@@ -515,7 +515,7 @@  discard block
 block discarded – undo
515 515
 
516 516
     if ($user === null && !empty($where_safe)) {
517 517
       // Вытаскиваем запись
518
-      $user = static::$db->doSelectFetch("SELECT * FROM {{users}} WHERE {$where_safe}" . " FOR UPDATE");
518
+      $user = static::$db->doSelectFetch("SELECT * FROM {{users}} WHERE {$where_safe}"." FOR UPDATE");
519 519
 
520 520
       SnCache::cache_set(LOC_USER, $user); // В кэш-юзер так же заполнять индексы
521 521
     }
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
     }
558 558
 
559 559
     if (SnCache::isUnitLocatorNotSet($location_type, $location_id)) {
560
-      $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());
560
+      $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());
561 561
       if (!empty($got_data) && is_array($got_data)) {
562 562
         foreach ($got_data as $unit_id => $unit_data) {
563 563
           SnCache::setUnitLocatorByLocationAndIDs($location_type, $location_id, $unit_data);
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
     if ($que_type == QUE_RESEARCH || $planet_id === null) {
617 617
       $query[] = "`que_planet_id` IS NULL";
618 618
     } elseif ($planet_id) {
619
-      $query[] = "(`que_planet_id` = {$planet_id}" . ($que_type ? '' : ' OR que_planet_id IS NULL') . ")";
619
+      $query[] = "(`que_planet_id` = {$planet_id}".($que_type ? '' : ' OR que_planet_id IS NULL').")";
620 620
     }
621 621
     if ($que_type) {
622 622
       $query[] = "`que_type` = {$que_type}";
@@ -730,13 +730,13 @@  discard block
 block discarded – undo
730 730
         $condition = "`{$field_name}` = ";
731 731
         $value = '';
732 732
         if ($field_data['delta']) {
733
-          $value = "`{$field_name}`" . ($field_data['delta'] >= 0 ? '+' : '') . $field_data['delta'];
733
+          $value = "`{$field_name}`".($field_data['delta'] >= 0 ? '+' : '').$field_data['delta'];
734 734
         } elseif ($field_data['set']) {
735 735
           $value = (is_string($field_data['set']) ? "'{$field_data['set']}'" : $field_data['set']);
736 736
         }
737 737
 
738 738
         if ($value) {
739
-          $fields[] = $condition . $value;
739
+          $fields[] = $condition.$value;
740 740
         }
741 741
       }
742 742
       $conditions[P_FIELDS_STR] = implode(',', $fields);
@@ -750,9 +750,7 @@  discard block
 block discarded – undo
750 750
           // Простое условие - $field_id = $field_value
751 751
           if (is_string($field_id)) {
752 752
             $field_value =
753
-              $field_value === null ? 'NULL' :
754
-                (is_string($field_value) ? "'" . db_escape($field_value) . "'" :
755
-                  (is_bool($field_value) ? intval($field_value) : $field_value));
753
+              $field_value === null ? 'NULL' : (is_string($field_value) ? "'".db_escape($field_value)."'" : (is_bool($field_value) ? intval($field_value) : $field_value));
756 754
             $the_conditions[] = "`{$field_id}` = {$field_value}";
757 755
           } else {
758 756
             die('Неподдерживаемый тип условия');
@@ -779,7 +777,7 @@  discard block
 block discarded – undo
779 777
         die('Неподдерживаемая операция в classSupernova::db_changeset_condition_compile');
780 778
     }
781 779
 
782
-    $conditions[P_QUERY_STR] = $conditions[P_ACTION_STR] . ' ' . $conditions[P_FIELDS_STR] . (' WHERE ' . $conditions[P_WHERE_STR]);
780
+    $conditions[P_QUERY_STR] = $conditions[P_ACTION_STR].' '.$conditions[P_FIELDS_STR].(' WHERE '.$conditions[P_WHERE_STR]);
783 781
   }
784 782
 
785 783
   public static function db_changeset_apply($db_changeset, $flush_delayed = false) {
@@ -866,7 +864,7 @@  discard block
 block discarded – undo
866 864
     ini_get('magic_quotes_sybase') ? die('SN is incompatible with \'magic_quotes_sybase\' turned on. Disable it in php.ini or .htaccess...') : false;
867 865
     if (@get_magic_quotes_gpc()) {
868 866
       $gpcr = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
869
-      array_walk_recursive($gpcr, function (&$value, $key) {
867
+      array_walk_recursive($gpcr, function(&$value, $key) {
870 868
         $value = stripslashes($value);
871 869
       });
872 870
     }
@@ -882,43 +880,43 @@  discard block
 block discarded – undo
882 880
     $gc = static::$gc;
883 881
 
884 882
     // Default db
885
-    $gc->db = function ($c) {
883
+    $gc->db = function($c) {
886 884
       $db = new db_mysql($c);
887 885
       $db->sn_db_connect();
888 886
 
889 887
       return $db;
890 888
     };
891 889
 
892
-    $gc->debug = function ($c) {
890
+    $gc->debug = function($c) {
893 891
       return new debug();
894 892
     };
895 893
 
896
-    $gc->cache = function ($c) {
894
+    $gc->cache = function($c) {
897 895
       return new classCache(classSupernova::$cache_prefix);
898 896
     };
899 897
 
900
-    $gc->config = function ($c) {
898
+    $gc->config = function($c) {
901 899
       return new classConfig(classSupernova::$cache_prefix);
902 900
     };
903 901
 
904
-    $gc->localePlayer = function (GlobalContainer $c) {
902
+    $gc->localePlayer = function(GlobalContainer $c) {
905 903
       return new classLocale($c->config->server_locale_log_usage);
906 904
     };
907 905
 
908
-    $gc->dbRowOperator = function ($c) {
906
+    $gc->dbRowOperator = function($c) {
909 907
       return new DbRowDirectOperator($c);
910 908
     };
911 909
 
912 910
     $gc->buddyClass = 'Buddy\BuddyModel';
913
-    $gc->buddy = $gc->factory(function (GlobalContainer $c) {
911
+    $gc->buddy = $gc->factory(function(GlobalContainer $c) {
914 912
       return new $c->buddyClass($c);
915 913
     });
916 914
 
917
-    $gc->query = $gc->factory(function (GlobalContainer $c) {
915
+    $gc->query = $gc->factory(function(GlobalContainer $c) {
918 916
       return new DbQueryConstructor($c->db);
919 917
     });
920 918
 
921
-    $gc->unit = $gc->factory(function (GlobalContainer $c) {
919
+    $gc->unit = $gc->factory(function(GlobalContainer $c) {
922 920
       return new \V2Unit\V2UnitModel($c);
923 921
     });
924 922
 
@@ -931,7 +929,7 @@  discard block
 block discarded – undo
931 929
   public static function init_3_load_config_file() {
932 930
     $dbsettings = array();
933 931
 
934
-    require(SN_ROOT_PHYSICAL . "config" . DOT_PHP_EX);
932
+    require(SN_ROOT_PHYSICAL."config".DOT_PHP_EX);
935 933
     self::$cache_prefix = !empty($dbsettings['cache_prefix']) ? $dbsettings['cache_prefix'] : $dbsettings['prefix'];
936 934
     self::$db_name = $dbsettings['name'];
937 935
     self::$sn_secret_word = $dbsettings['secretword'];
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -363,9 +363,11 @@
 block discarded – undo
363 363
     $set = trim($set);
364 364
     $table_name = static::$location_info[$location_type][P_TABLE_NAME];
365 365
     if ($result = static::$db->doInsert("INSERT INTO `{{{$table_name}}}` SET {$set}")) {
366
-      if (static::$db->db_affected_rows()) // Обновляем данные только если ряд был затронут
366
+      if (static::$db->db_affected_rows()) {
367
+        // Обновляем данные только если ряд был затронут
367 368
       {
368 369
         $record_id = classSupernova::$db->db_insert_id();
370
+      }
369 371
         // Вытаскиваем запись целиком, потому что в $set могли быть "данные по умолчанию"
370 372
         $result = static::db_get_record_by_id($location_type, $record_id);
371 373
         // Очищаем второстепенные кэши - потому что вставленная запись могла повлиять на результаты запросов или локация или еще чего
Please login to merge, or discard this patch.
includes/classes/db_mysql.php 2 patches
Doc Comments   +9 added lines, -2 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
   /**
150 150
    * @param string $query
151 151
    *
152
-   * @return mixed|string
152
+   * @return string
153 153
    */
154 154
   public function replaceTablePlaceholders($query) {
155 155
     $sql = $query;
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
   }
164 164
 
165 165
   /**
166
-   * @param $query
166
+   * @param string $query
167 167
    */
168 168
   protected function logQuery($query) {
169 169
     if (!classSupernova::$config->debug) {
@@ -352,6 +352,10 @@  discard block
 block discarded – undo
352 352
   }
353 353
 
354 354
   // TODO Заменить это на новый логгер
355
+
356
+  /**
357
+   * @param string $query
358
+   */
355 359
   protected function security_watch_user_queries($query) {
356 360
     global $user;
357 361
 
@@ -375,6 +379,9 @@  discard block
 block discarded – undo
375 379
   }
376 380
 
377 381
 
382
+  /**
383
+   * @param string $query
384
+   */
378 385
   public function security_query_check_bad_words($query) {
379 386
     if ($this->skipQueryCheck) {
380 387
       return;
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
   public function load_db_settings($configFile = '') {
84 84
     $dbsettings = array();
85 85
 
86
-    empty($configFile) ? $configFile = SN_ROOT_PHYSICAL . "config" . DOT_PHP_EX : false;
86
+    empty($configFile) ? $configFile = SN_ROOT_PHYSICAL."config".DOT_PHP_EX : false;
87 87
 
88 88
     require $configFile;
89 89
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     }
104 104
 
105 105
     if (empty($this->dbsettings)) {
106
-      $this->load_db_settings(SN_ROOT_PHYSICAL . "config" . DOT_PHP_EX);
106
+      $this->load_db_settings(SN_ROOT_PHYSICAL."config".DOT_PHP_EX);
107 107
     }
108 108
 
109 109
     // TODO - фатальные (?) ошибки на каждом шагу. Хотя - скорее Эксепшны
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
     $sql = $query;
156 156
     if (strpos($sql, '{{') !== false) {
157 157
       foreach ($this->table_list as $tableName) {
158
-        $sql = str_replace("{{{$tableName}}}", $this->db_prefix . $tableName, $sql);
158
+        $sql = str_replace("{{{$tableName}}}", $this->db_prefix.$tableName, $sql);
159 159
       }
160 160
     }
161 161
 
@@ -228,12 +228,12 @@  discard block
 block discarded – undo
228 228
 
229 229
     $queryResult = null;
230 230
     try {
231
-      $queryResult = $this->db_sql_query($stringQuery . DbSqlHelper::quoteComment($queryTrace));
231
+      $queryResult = $this->db_sql_query($stringQuery.DbSqlHelper::quoteComment($queryTrace));
232 232
       if (!$queryResult) {
233 233
         throw new Exception();
234 234
       }
235 235
     } catch (Exception $e) {
236
-      classSupernova::$debug->error($this->db_error() . "<br />{$query}<br />", 'SQL Error');
236
+      classSupernova::$debug->error($this->db_error()."<br />{$query}<br />", 'SQL Error');
237 237
     }
238 238
 
239 239
     return $queryResult;
@@ -364,10 +364,10 @@  discard block
 block discarded – undo
364 364
       $this->isWatching = true;
365 365
       $msg = "\$query = \"{$query}\"\n\r";
366 366
       if (!empty($_POST)) {
367
-        $msg .= "\n\r" . dump($_POST, '$_POST');
367
+        $msg .= "\n\r".dump($_POST, '$_POST');
368 368
       }
369 369
       if (!empty($_GET)) {
370
-        $msg .= "\n\r" . dump($_GET, '$_GET');
370
+        $msg .= "\n\r".dump($_GET, '$_GET');
371 371
       }
372 372
       classSupernova::$debug->warning($msg, "Watching user {$user['id']}", 399, array('base_dump' => true));
373 373
       $this->isWatching = false;
@@ -393,37 +393,37 @@  discard block
 block discarded – undo
393 393
       case stripos($query, 'RPG_POINTS') != false && stripos(trim($query), 'UPDATE ') === 0 && !$dm_change_legit:
394 394
       case stripos($query, 'METAMATTER') != false && stripos(trim($query), 'UPDATE ') === 0 && !$mm_change_legit:
395 395
       case stripos($query, 'AUTHLEVEL') != false && $user['authlevel'] < 3 && stripos($query, 'SELECT') !== 0:
396
-        $report = "Hacking attempt (" . date("d.m.Y H:i:s") . " - [" . time() . "]):\n";
396
+        $report = "Hacking attempt (".date("d.m.Y H:i:s")." - [".time()."]):\n";
397 397
         $report .= ">Database Inforamation\n";
398
-        $report .= "\tID - " . $user['id'] . "\n";
399
-        $report .= "\tUser - " . $user['username'] . "\n";
400
-        $report .= "\tAuth level - " . $user['authlevel'] . "\n";
401
-        $report .= "\tAdmin Notes - " . $user['adminNotes'] . "\n";
402
-        $report .= "\tCurrent Planet - " . $user['current_planet'] . "\n";
403
-        $report .= "\tUser IP - " . $user['user_lastip'] . "\n";
404
-        $report .= "\tUser IP at Reg - " . $user['ip_at_reg'] . "\n";
405
-        $report .= "\tUser Agent- " . $_SERVER['HTTP_USER_AGENT'] . "\n";
406
-        $report .= "\tCurrent Page - " . $user['current_page'] . "\n";
407
-        $report .= "\tRegister Time - " . $user['register_time'] . "\n";
398
+        $report .= "\tID - ".$user['id']."\n";
399
+        $report .= "\tUser - ".$user['username']."\n";
400
+        $report .= "\tAuth level - ".$user['authlevel']."\n";
401
+        $report .= "\tAdmin Notes - ".$user['adminNotes']."\n";
402
+        $report .= "\tCurrent Planet - ".$user['current_planet']."\n";
403
+        $report .= "\tUser IP - ".$user['user_lastip']."\n";
404
+        $report .= "\tUser IP at Reg - ".$user['ip_at_reg']."\n";
405
+        $report .= "\tUser Agent- ".$_SERVER['HTTP_USER_AGENT']."\n";
406
+        $report .= "\tCurrent Page - ".$user['current_page']."\n";
407
+        $report .= "\tRegister Time - ".$user['register_time']."\n";
408 408
         $report .= "\n";
409 409
 
410 410
         $report .= ">Query Information\n";
411
-        $report .= "\tQuery - " . $query . "\n";
411
+        $report .= "\tQuery - ".$query."\n";
412 412
         $report .= "\n";
413 413
 
414 414
         $report .= ">\$_SERVER Information\n";
415
-        $report .= "\tIP - " . $_SERVER['REMOTE_ADDR'] . "\n";
416
-        $report .= "\tHost Name - " . $_SERVER['HTTP_HOST'] . "\n";
417
-        $report .= "\tUser Agent - " . $_SERVER['HTTP_USER_AGENT'] . "\n";
418
-        $report .= "\tRequest Method - " . $_SERVER['REQUEST_METHOD'] . "\n";
419
-        $report .= "\tCame From - " . $_SERVER['HTTP_REFERER'] . "\n";
420
-        $report .= "\tPage is - " . $_SERVER['SCRIPT_NAME'] . "\n";
421
-        $report .= "\tUses Port - " . $_SERVER['REMOTE_PORT'] . "\n";
422
-        $report .= "\tServer Protocol - " . $_SERVER['SERVER_PROTOCOL'] . "\n";
415
+        $report .= "\tIP - ".$_SERVER['REMOTE_ADDR']."\n";
416
+        $report .= "\tHost Name - ".$_SERVER['HTTP_HOST']."\n";
417
+        $report .= "\tUser Agent - ".$_SERVER['HTTP_USER_AGENT']."\n";
418
+        $report .= "\tRequest Method - ".$_SERVER['REQUEST_METHOD']."\n";
419
+        $report .= "\tCame From - ".$_SERVER['HTTP_REFERER']."\n";
420
+        $report .= "\tPage is - ".$_SERVER['SCRIPT_NAME']."\n";
421
+        $report .= "\tUses Port - ".$_SERVER['REMOTE_PORT']."\n";
422
+        $report .= "\tServer Protocol - ".$_SERVER['SERVER_PROTOCOL']."\n";
423 423
 
424 424
         $report .= "\n--------------------------------------------------------------------------------------------------\n";
425 425
 
426
-        $fp = fopen(SN_ROOT_PHYSICAL . 'badqrys.txt', 'a');
426
+        $fp = fopen(SN_ROOT_PHYSICAL.'badqrys.txt', 'a');
427 427
         fwrite($fp, $report);
428 428
         fclose($fp);
429 429
 
Please login to merge, or discard this patch.