Completed
Push — work-fleets ( d64c53...5442ac )
by SuperNova.WS
05:10
created
includes/classes/classSupernova.php 1 patch
Spacing   +18 added lines, -20 removed lines patch added patch discarded remove patch
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
   public static function cache_clear($location_type, $hard = true) {
237 237
     if ($hard && !empty(static::$data[$location_type])) {
238 238
       // Здесь нельзя делать unset - надо записывать NULL, что бы это отразилось на зависимых записях
239
-      array_walk(static::$data[$location_type], function (&$item) { $item = null; });
239
+      array_walk(static::$data[$location_type], function(&$item) { $item = null; });
240 240
     }
241 241
     static::$locator[$location_type] = array();
242 242
     static::$queries[$location_type] = array();
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
 
355 355
     if (!empty($error_msg)) {
356 356
       // TODO - Убрать позже
357
-      print('<h1>СООБЩИТЕ ЭТО АДМИНУ: sn_db_transaction_check() - ' . $error_msg . '</h1>');
357
+      print('<h1>СООБЩИТЕ ЭТО АДМИНУ: sn_db_transaction_check() - '.$error_msg.'</h1>');
358 358
       $backtrace = debug_backtrace();
359 359
       array_shift($backtrace);
360 360
       pdump($backtrace);
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
   public static function db_transaction_start($level = '') {
368 368
     static::db_transaction_check(null);
369 369
 
370
-    $level ? doquery('SET TRANSACTION ISOLATION LEVEL ' . $level) : false;
370
+    $level ? doquery('SET TRANSACTION ISOLATION LEVEL '.$level) : false;
371 371
 
372 372
     static::$transaction_id++;
373 373
     doquery('START TRANSACTION');
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
   public static function db_lock_tables($tables) {
428 428
     $tables = is_array($tables) ? $tables : array($tables => '');
429 429
     foreach ($tables as $table_name => $condition) {
430
-      self::$db->doquery("SELECT 1 FROM {{{$table_name}}}" . ($condition ? ' WHERE ' . $condition : ''));
430
+      self::$db->doquery("SELECT 1 FROM {{{$table_name}}}".($condition ? ' WHERE '.$condition : ''));
431 431
     }
432 432
   }
433 433
 
@@ -503,8 +503,8 @@  discard block
 block discarded – undo
503 503
           $query = static::db_query(
504 504
             "SELECT
505 505
               distinct({{{$location_info[P_TABLE_NAME]}}}.{$owner_data[P_OWNER_FIELD]}) AS parent_id
506
-            FROM {{{$location_info[P_TABLE_NAME]}}}" .
507
-            ($filter ? ' WHERE ' . $filter : '') .
506
+            FROM {{{$location_info[P_TABLE_NAME]}}}".
507
+            ($filter ? ' WHERE '.$filter : '').
508 508
             ($fetch ? ' LIMIT 1' : ''), false, true);
509 509
 
510 510
           while ($row = db_fetch($query)) {
@@ -517,13 +517,13 @@  discard block
 block discarded – undo
517 517
           if ($indexes_str = implode(',', $parent_id_list)) {
518 518
             $parent_id_field = static::$location_info[$owner_location_type][P_ID];
519 519
             static::db_get_record_list($owner_location_type,
520
-              $parent_id_field . (count($parent_id_list) > 1 ? " IN ({$indexes_str})" : " = {$indexes_str}"), $fetch, true);
520
+              $parent_id_field.(count($parent_id_list) > 1 ? " IN ({$indexes_str})" : " = {$indexes_str}"), $fetch, true);
521 521
           }
522 522
         }
523 523
       }
524 524
 
525 525
       $query = static::db_query(
526
-        "SELECT * FROM {{{$location_info[P_TABLE_NAME]}}}" .
526
+        "SELECT * FROM {{{$location_info[P_TABLE_NAME]}}}".
527 527
         (($filter = trim($filter)) ? " WHERE {$filter}" : '')
528 528
       );
529 529
       while ($row = db_fetch($query)) {
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
     $condition = trim($condition);
590 590
     $table_name = static::$location_info[$location_type][P_TABLE_NAME];
591 591
 
592
-    if ($result = static::db_query("UPDATE {{{$table_name}}} SET " . $set . ($condition ? ' WHERE ' . $condition : ''))) {
592
+    if ($result = static::db_query("UPDATE {{{$table_name}}} SET ".$set.($condition ? ' WHERE '.$condition : ''))) {
593 593
 
594 594
       if (static::$db->db_affected_rows()) { // Обновляем данные только если ряд был затронут
595 595
         // Поскольку нам неизвестно, что и как обновилось - сбрасываем кэш этого типа полностью
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
       // TODO переписать
752 752
       $user = static::dbFetchOne(
753 753
         DBStaticUser::buildSelect()
754
-          ->where(array("`username` " . ($like ? 'LIKE' : '=') . " '{$username_safe}'"))
754
+          ->where(array("`username` ".($like ? 'LIKE' : '=')." '{$username_safe}'"))
755 755
       );
756 756
 
757 757
 //      $user = static::db_query(
@@ -844,7 +844,7 @@  discard block
 block discarded – undo
844 844
 
845 845
     $query_cache = &static::$locator[LOC_UNIT][$location_type][$location_id];
846 846
     if (!isset($query_cache)) {
847
-      $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());
847
+      $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());
848 848
       if (is_array($got_data)) {
849 849
         foreach ($got_data as $unit_id => $unit_data) {
850 850
           $query_cache[$unit_data['unit_snid']] = &static::$data[LOC_UNIT][$unit_id];
@@ -905,7 +905,7 @@  discard block
 block discarded – undo
905 905
     if ($que_type == QUE_RESEARCH || $planet_id === null) {
906 906
       $query[] = "`que_planet_id` IS NULL";
907 907
     } elseif ($planet_id) {
908
-      $query[] = "(`que_planet_id` = {$planet_id}" . ($que_type ? '' : ' OR que_planet_id IS NULL') . ")";
908
+      $query[] = "(`que_planet_id` = {$planet_id}".($que_type ? '' : ' OR que_planet_id IS NULL').")";
909 909
     }
910 910
     if ($que_type) {
911 911
       $query[] = "`que_type` = {$que_type}";
@@ -1026,13 +1026,13 @@  discard block
 block discarded – undo
1026 1026
         $condition = "`{$field_name}` = ";
1027 1027
         $value = '';
1028 1028
         if ($field_data['delta']) {
1029
-          $value = "`{$field_name}`" . ($field_data['delta'] >= 0 ? '+' : '') . $field_data['delta'];
1029
+          $value = "`{$field_name}`".($field_data['delta'] >= 0 ? '+' : '').$field_data['delta'];
1030 1030
         } elseif ($field_data['set']) {
1031 1031
           $value = (is_string($field_data['set']) ? "'{$field_data['set']}'" : $field_data['set']);
1032 1032
         }
1033 1033
 
1034 1034
         if ($value) {
1035
-          $fields[] = $condition . $value;
1035
+          $fields[] = $condition.$value;
1036 1036
         }
1037 1037
       }
1038 1038
       $conditions[P_FIELDS_STR] = implode(',', $fields);
@@ -1046,9 +1046,7 @@  discard block
 block discarded – undo
1046 1046
           // Простое условие - $field_id = $field_value
1047 1047
           if (is_string($field_id)) {
1048 1048
             $field_value =
1049
-              $field_value === null ? 'NULL' :
1050
-                (is_string($field_value) ? "'" . db_escape($field_value) . "'" :
1051
-                  (is_bool($field_value) ? intval($field_value) : $field_value));
1049
+              $field_value === null ? 'NULL' : (is_string($field_value) ? "'".db_escape($field_value)."'" : (is_bool($field_value) ? intval($field_value) : $field_value));
1052 1050
             $the_conditions[] = "`{$field_id}` = {$field_value}";
1053 1051
           } else {
1054 1052
             die('Неподдерживаемый тип условия');
@@ -1075,7 +1073,7 @@  discard block
 block discarded – undo
1075 1073
         die('Неподдерживаемая операция в classSupernova::db_changeset_condition_compile');
1076 1074
     }
1077 1075
 
1078
-    $conditions[P_QUERY_STR] = $conditions[P_ACTION_STR] . ' ' . $conditions[P_FIELDS_STR] . (' WHERE ' . $conditions[P_WHERE_STR]);
1076
+    $conditions[P_QUERY_STR] = $conditions[P_ACTION_STR].' '.$conditions[P_FIELDS_STR].(' WHERE '.$conditions[P_WHERE_STR]);
1079 1077
   }
1080 1078
 
1081 1079
   public static function db_changeset_apply($db_changeset, $flush_delayed = false) {
@@ -1173,7 +1171,7 @@  discard block
 block discarded – undo
1173 1171
     ini_get('magic_quotes_sybase') ? die('SN is incompatible with \'magic_quotes_sybase\' turned on. Disable it in php.ini or .htaccess...') : false;
1174 1172
     if (@get_magic_quotes_gpc()) {
1175 1173
       $gpcr = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
1176
-      array_walk_recursive($gpcr, function (&$value, $key) {
1174
+      array_walk_recursive($gpcr, function(&$value, $key) {
1177 1175
         $value = stripslashes($value);
1178 1176
       });
1179 1177
     }
@@ -1187,7 +1185,7 @@  discard block
 block discarded – undo
1187 1185
   public static function init_3_load_config_file() {
1188 1186
     $dbsettings = array();
1189 1187
 
1190
-    require(SN_ROOT_PHYSICAL . "config" . DOT_PHP_EX);
1188
+    require(SN_ROOT_PHYSICAL."config".DOT_PHP_EX);
1191 1189
     self::$cache_prefix = !empty($dbsettings['cache_prefix']) ? $dbsettings['cache_prefix'] : $dbsettings['prefix'];
1192 1190
     self::$db_name = $dbsettings['name'];
1193 1191
     self::$sn_secret_word = $dbsettings['secretword'];
Please login to merge, or discard this patch.
includes/classes/DbSqlStatement.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -260,28 +260,28 @@  discard block
 block discarded – undo
260 260
     $result = '';
261 261
     $result .= $this->stringEscape($this->operation);
262 262
 
263
-    $result .= ' ' . $this->selectFieldsToString($this->fields);
263
+    $result .= ' '.$this->selectFieldsToString($this->fields);
264 264
 
265 265
     $result .= ' FROM';
266
-    $result .= ' `{{' . $this->stringEscape($this->table) . '}}`';
267
-    $result .= !empty($this->alias) ? ' AS `' . $this->stringEscape($this->alias) . '`' : '';
266
+    $result .= ' `{{'.$this->stringEscape($this->table).'}}`';
267
+    $result .= !empty($this->alias) ? ' AS `'.$this->stringEscape($this->alias).'`' : '';
268 268
 
269 269
     // TODO - fields should be escaped !!
270
-    $result .= !empty($this->where) ? ' WHERE ' . implode(' AND ', $this->where) : '';
270
+    $result .= !empty($this->where) ? ' WHERE '.implode(' AND ', $this->where) : '';
271 271
 
272 272
     // TODO - fields should be escaped !!
273
-    $result .= !empty($this->group) ? ' GROUP BY ' . implode(',', $this->group) : '';
273
+    $result .= !empty($this->group) ? ' GROUP BY '.implode(',', $this->group) : '';
274 274
 
275 275
     // TODO - fields should be escaped !!
276
-    $result .= !empty($this->order) ? ' ORDER BY ' . implode(',', $this->order) : '';
276
+    $result .= !empty($this->order) ? ' ORDER BY '.implode(',', $this->order) : '';
277 277
 
278 278
     // TODO - fields should be escaped !!
279
-    $result .= !empty($this->having) ? ' HAVING ' . implode(' AND ', $this->having) : '';
279
+    $result .= !empty($this->having) ? ' HAVING '.implode(' AND ', $this->having) : '';
280 280
 
281 281
     // TODO - fields should be escaped !!
282 282
     $limit = $this->fetchOne ? 1 : $this->limit;
283 283
     $result .= !empty($limit)
284
-      ? ' LIMIT ' . $limit . (!empty($this->offset) ? ' OFFSET ' . $this->offset : '')
284
+      ? ' LIMIT '.$limit.(!empty($this->offset) ? ' OFFSET '.$this->offset : '')
285 285
       : '';
286 286
 
287 287
     $result .=
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
    */
328 328
   protected function processField($fieldName) {
329 329
     if (is_bool($fieldName)) {
330
-      $result = (string)intval($fieldName);
330
+      $result = (string) intval($fieldName);
331 331
     } elseif (is_null($fieldName)) {
332 332
       $result = 'NULL';
333 333
     } elseif ($fieldName === '*') {
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
    * @return string
346 346
    */
347 347
   protected function processFieldDefault($fieldName) {
348
-    $result = (string)$fieldName;
348
+    $result = (string) $fieldName;
349 349
     if (
350 350
       $result != ''
351 351
       &&
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
       !is_numeric($fieldName)
357 357
     ) {
358 358
       // Other should be formatted
359
-      $result = '`' . $this->stringEscape($result) . '`';
359
+      $result = '`'.$this->stringEscape($result).'`';
360 360
     }
361 361
 
362 362
     return $result;
Please login to merge, or discard this patch.