Completed
Push — work-fleets ( 8474eb...046d2e )
by SuperNova.WS
08:49
created
includes/classes/DBAL/DbTransaction.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
     if (!empty($error_msg)) {
53 53
       // TODO - Убрать позже
54
-      print('<h1>СООБЩИТЕ ЭТО АДМИНУ: sn_db_transaction_check() - ' . $error_msg . '</h1>');
54
+      print('<h1>СООБЩИТЕ ЭТО АДМИНУ: sn_db_transaction_check() - '.$error_msg.'</h1>');
55 55
       $backtrace = debug_backtrace();
56 56
       array_shift($backtrace);
57 57
       pdump($backtrace);
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
   public function start($level = '') {
65 65
     $this->check(null);
66 66
 
67
-    $level ? $this->db->doExecute('SET TRANSACTION ISOLATION LEVEL ' . $level) : false;
67
+    $level ? $this->db->doExecute('SET TRANSACTION ISOLATION LEVEL '.$level) : false;
68 68
 
69 69
     $this->transaction_id++;
70 70
     $this->db->doExecute('START TRANSACTION');
Please login to merge, or discard this patch.
includes/classes/DbRowDirectOperator.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
       ->setIdField($entity->getIdFieldName())
19 19
       ->field('*')
20 20
       ->from($entity->getTableName())
21
-      ->where($entity->getIdFieldName() . ' = "' . $entity->dbId . '"');
21
+      ->where($entity->getIdFieldName().' = "'.$entity->dbId.'"');
22 22
 
23 23
     return $stmt->selectRow();
24 24
   }
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
   public function deleteById($entity) {
30 30
     $db = $entity->getDbStatic();
31 31
 
32
-    $db->doDelete("DELETE FROM `{{" . $entity->getTableName() . "}}` WHERE `{$entity->getIdFieldName()}` = '{$entity->dbId}' LIMIT 1;");
32
+    $db->doDelete("DELETE FROM `{{".$entity->getTableName()."}}` WHERE `{$entity->getIdFieldName()}` = '{$entity->dbId}' LIMIT 1;");
33 33
 
34 34
     return $db->db_affected_rows();
35 35
   }
@@ -43,8 +43,8 @@  discard block
 block discarded – undo
43 43
     $query = array();
44 44
     foreach ($entity->exportRowWithoutId() as $fieldName => $fieldValue) {
45 45
       // TODO: MORE type detection
46
-      if(!is_numeric($fieldValue)) {
47
-        $fieldValue = "'" . $db->db_escape($fieldValue) . "'";
46
+      if (!is_numeric($fieldValue)) {
47
+        $fieldValue = "'".$db->db_escape($fieldValue)."'";
48 48
       }
49 49
       $query[] = "`{$fieldName}` = {$fieldValue}";
50 50
     }
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
       return 0;
56 56
     }
57 57
 
58
-    $db->doInsert("INSERT INTO `{{" . $entity->getTableName() . "}}` SET " . $query);
58
+    $db->doInsert("INSERT INTO `{{".$entity->getTableName()."}}` SET ".$query);
59 59
 
60 60
     // TODO Exceptiion if db_insert_id() is empty
61 61
     return $entity->dbId = $db->db_insert_id();
Please login to merge, or discard this patch.
includes/classes/DBRow.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
    * @param db_mysql|null $db
87 87
    */
88 88
   public static function setDb($db = null) {
89
-    if(empty($db) || !($db instanceof db_mysql)) {
89
+    if (empty($db) || !($db instanceof db_mysql)) {
90 90
       $db = null;
91 91
     }
92 92
     static::$db = !empty($db) || !class_exists('classSupernova', false) ? $db : classSupernova::$db;
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
   public function dbLoad($dbId, $lockSkip = false) {
150 150
     $dbId = idval($dbId);
151 151
     if ($dbId <= 0) {
152
-      classSupernova::$debug->error(get_called_class() . '::' . __METHOD__ . ' $dbId not positive = ' . $dbId);
152
+      classSupernova::$debug->error(get_called_class().'::'.__METHOD__.' $dbId not positive = '.$dbId);
153 153
 
154 154
       return;
155 155
     }
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
       $this->dbGetLockById($this->_dbId);
162 162
     }
163 163
 
164
-    $db_row = classSupernova::$db->doSelectFetch("SELECT * FROM `{{" . static::$_table . "}}` WHERE `" . static::$_dbIdFieldName . "` = " . $this->_dbId . " LIMIT 1 FOR UPDATE;");
164
+    $db_row = classSupernova::$db->doSelectFetch("SELECT * FROM `{{".static::$_table."}}` WHERE `".static::$_dbIdFieldName."` = ".$this->_dbId." LIMIT 1 FOR UPDATE;");
165 165
     if (empty($db_row)) {
166 166
       return;
167 167
     }
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
     if ($this->isNew()) {
194 194
       // No DB_ID - new unit
195 195
       if ($this->isEmpty()) {
196
-        classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - object is empty on ' . get_called_class() . '::dbSave');
196
+        classSupernova::$debug->error(__FILE__.':'.__LINE__.' - object is empty on '.get_called_class().'::dbSave');
197 197
       }
198 198
       $this->dbInsert();
199 199
     } else {
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
         $this->dbDelete();
203 203
       } else {
204 204
         if (!sn_db_transaction_check(false)) {
205
-          classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - transaction should always be started on ' . get_called_class() . '::dbUpdate');
205
+          classSupernova::$debug->error(__FILE__.':'.__LINE__.' - transaction should always be started on '.get_called_class().'::dbUpdate');
206 206
         }
207 207
         $this->dbUpdate();
208 208
       }
@@ -230,12 +230,12 @@  discard block
 block discarded – undo
230 230
   // TODO - protected
231 231
   public function dbInsert() {
232 232
     if (!$this->isNew()) {
233
-      classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - record db_id is not empty on ' . get_called_class() . '::dbInsert');
233
+      classSupernova::$debug->error(__FILE__.':'.__LINE__.' - record db_id is not empty on '.get_called_class().'::dbInsert');
234 234
     }
235 235
     $this->_dbId = $this->db_field_set_create($this->dbMakeFieldSet());
236 236
 
237 237
     if (empty($this->_dbId)) {
238
-      classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - error saving record ' . get_called_class() . '::dbInsert');
238
+      classSupernova::$debug->error(__FILE__.':'.__LINE__.' - error saving record '.get_called_class().'::dbInsert');
239 239
     }
240 240
 
241 241
     return $this->_dbId;
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
   public function dbUpdate() {
249 249
     // TODO - Update
250 250
     if ($this->isNew()) {
251
-      classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - unit db_id is empty on dbUpdate');
251
+      classSupernova::$debug->error(__FILE__.':'.__LINE__.' - unit db_id is empty on dbUpdate');
252 252
     }
253 253
     $this->db_field_update($this->dbMakeFieldSet(true));
254 254
   }
@@ -259,9 +259,9 @@  discard block
 block discarded – undo
259 259
   // TODO - protected
260 260
   public function dbDelete() {
261 261
     if ($this->isNew()) {
262
-      classSupernova::$debug->error(__FILE__ . ':' . __LINE__ . ' - unit db_id is empty on dbDelete');
262
+      classSupernova::$debug->error(__FILE__.':'.__LINE__.' - unit db_id is empty on dbDelete');
263 263
     }
264
-    classSupernova::$db->doDelete("DELETE FROM `{{" . static::$_table . "}}` WHERE `" . static::$_dbIdFieldName . "` = " . $this->_dbId);
264
+    classSupernova::$db->doDelete("DELETE FROM `{{".static::$_table."}}` WHERE `".static::$_dbIdFieldName."` = ".$this->_dbId);
265 265
     $this->_dbId = 0;
266 266
     // Обо всём остальном должен позаботиться контейнер
267 267
   }
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
     $fields = implode(',', array_keys($field_set));
415 415
 
416 416
     $result = 0;
417
-    if (classSupernova::$db->doInsert("INSERT INTO `{{" . static::$_table . "}}` ({$fields}) VALUES ({$values});")) {
417
+    if (classSupernova::$db->doInsert("INSERT INTO `{{".static::$_table."}}` ({$fields}) VALUES ({$values});")) {
418 418
       $result = classSupernova::$db->db_insert_id();
419 419
     }
420 420
 
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 
451 451
     return empty($set_string)
452 452
       ? true
453
-      : classSupernova::$db->doUpdate("UPDATE `{{" . static::$_table . "}}` SET {$set_string} WHERE `" . static::$_dbIdFieldName . "` = " . $this->_dbId);
453
+      : classSupernova::$db->doUpdate("UPDATE `{{".static::$_table."}}` SET {$set_string} WHERE `".static::$_dbIdFieldName."` = ".$this->_dbId);
454 454
   }
455 455
 
456 456
 }
Please login to merge, or discard this patch.
includes/classes/DBStaticAlly.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -66,9 +66,9 @@  discard block
 block discarded – undo
66 66
     `ally_name` = '{$ally_name}',
67 67
     `ally_tag` = '{$ally_tag}',
68 68
     `ally_owner` = '{$user['id']}',
69
-    `ally_owner_range` = '" . classLocale::$lang['ali_leaderRank'] . "',
69
+    `ally_owner_range` = '".classLocale::$lang['ali_leaderRank']."',
70 70
     `ally_members` = 1,
71
-    `ranklist` = '" . classLocale::$lang['ali_defaultRankName'] . ",0,0,0,0,0',
71
+    `ranklist` = '" . classLocale::$lang['ali_defaultRankName'].",0,0,0,0,0',
72 72
     `ally_register_time`= " . SN_TIME_NOW
73 73
     );
74 74
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
    * @param $POST_text
90 90
    */
91 91
   public static function db_ally_request_insert($user, $id_ally, $POST_text) {
92
-    classSupernova::$db->doInsert("INSERT INTO {{alliance_requests}} SET `id_user` = {$user['id']}, `id_ally`='{$id_ally}', request_text ='{$POST_text}', request_time=" . SN_TIME_NOW . ";");
92
+    classSupernova::$db->doInsert("INSERT INTO {{alliance_requests}} SET `id_user` = {$user['id']}, `id_ally`='{$id_ally}', request_text ='{$POST_text}', request_time=".SN_TIME_NOW.";");
93 93
   }
94 94
 
95 95
   /**
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
    * @param $ally
140 140
    */
141 141
   public static function db_ally_update_by_changeset($ally_changeset, $ally) {
142
-    classSupernova::$db->doUpdate("UPDATE {{alliance}} SET " . implode(',', $ally_changeset) . " WHERE `id`='{$ally['id']}' LIMIT 1;");
142
+    classSupernova::$db->doUpdate("UPDATE {{alliance}} SET ".implode(',', $ally_changeset)." WHERE `id`='{$ally['id']}' LIMIT 1;");
143 143
   }
144 144
 
145 145
   /**
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
    * @param $d
251 251
    */
252 252
   public static function db_ally_request_deny($d) {
253
-    classSupernova::$db->doUpdate("UPDATE {{alliance_requests}} SET `request_denied` = 1, `request_text` = '" . classLocale::$lang['ali_req_deny_reason'] . "' WHERE `id_user`= {$d} LIMIT 1;");
253
+    classSupernova::$db->doUpdate("UPDATE {{alliance_requests}} SET `request_denied` = 1, `request_text` = '".classLocale::$lang['ali_req_deny_reason']."' WHERE `id_user`= {$d} LIMIT 1;");
254 254
   }
255 255
 
256 256
   /**
Please login to merge, or discard this patch.
includes/classes/DBStaticChat.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
       JOIN {{users}} AS u ON u.id = cp.chat_player_player_id
13 13
     WHERE
14 14
       `chat_player_refresh_last` >= '{$sql_date}'
15
-      AND (`banaday` IS NULL OR `banaday` <= " . SN_TIME_NOW . ")
15
+      AND (`banaday` IS NULL OR `banaday` <= ".SN_TIME_NOW.")
16 16
       {$ally_add}
17 17
     ORDER BY authlevel DESC, `username`");
18 18
   }
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
           `user` = '{$nick}',
36 36
           `ally_id` = '{$ally_id}',
37 37
           `message` = '{$message}',
38
-          `timestamp` = " . SN_TIME_NOW . ",
38
+          `timestamp` = ".SN_TIME_NOW.",
39 39
           `chat_message_sender_name` = '{$chat_message_sender_name}',
40 40
           `chat_message_recipient_id` = {$chat_message_recipient_id},
41 41
           `chat_message_recipient_name` = '{$chat_message_recipient_name}'"
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
    * @param $user
142 142
    */
143 143
   public static function db_chat_player_update($user) {
144
-    classSupernova::$db->doUpdate("UPDATE {{chat_player}} SET `chat_player_refresh_last` = " . SN_TIME_NOW . " WHERE `chat_player_player_id` = {$user['id']} LIMIT 1;");
144
+    classSupernova::$db->doUpdate("UPDATE {{chat_player}} SET `chat_player_refresh_last` = ".SN_TIME_NOW." WHERE `chat_player_player_id` = {$user['id']} LIMIT 1;");
145 145
   }
146 146
 
147 147
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
    * @param $user
213 213
    */
214 214
   public static function db_chat_player_update_activity($user) {
215
-    classSupernova::$db->doUpdate("UPDATE {{chat_player}} SET `chat_player_activity` = '" . classSupernova::$db->db_escape(SN_TIME_SQL) . "' WHERE `chat_player_player_id` = {$user['id']} LIMIT 1");
215
+    classSupernova::$db->doUpdate("UPDATE {{chat_player}} SET `chat_player_activity` = '".classSupernova::$db->db_escape(SN_TIME_SQL)."' WHERE `chat_player_player_id` = {$user['id']} LIMIT 1");
216 216
   }
217 217
 
218 218
 }
219 219
\ No newline at end of file
Please login to merge, or discard this patch.
includes/classes/DBStaticFleetMissile.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
    * @return array|bool|mysqli_result|null
24 24
    */
25 25
   public static function db_missile_list_by_arrival() {
26
-    $iraks = classSupernova::$db->doSelect("SELECT * FROM `{{iraks}}` WHERE `fleet_end_time` <= " . SN_TIME_NOW . " FOR UPDATE;");
26
+    $iraks = classSupernova::$db->doSelect("SELECT * FROM `{{iraks}}` WHERE `fleet_end_time` <= ".SN_TIME_NOW." FOR UPDATE;");
27 27
 
28 28
     return $iraks;
29 29
   }
Please login to merge, or discard this patch.
includes/classes/classLocale.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
 
36 36
     $this->container = array();
37 37
 
38
-    if(classSupernova::$cache->_MODE != CACHER_NO_CACHE && !classSupernova::$config->locale_cache_disable) {
38
+    if (classSupernova::$cache->_MODE != CACHER_NO_CACHE && !classSupernova::$config->locale_cache_disable) {
39 39
       $this->cache = classSupernova::$cache;
40 40
       classSupernova::log_file('locale.__constructor: Cache is present');
41 41
 //$this->cache->unset_by_prefix($this->cache_prefix); // TODO - remove? 'cause debug!
42 42
     }
43 43
 
44
-    if($enable_stat_usage && empty($this->stat_usage)) {
44
+    if ($enable_stat_usage && empty($this->stat_usage)) {
45 45
       $this->enable_stat_usage = $enable_stat_usage;
46 46
       $this->usage_stat_load();
47 47
       // TODO shutdown function
@@ -67,18 +67,18 @@  discard block
 block discarded – undo
67 67
     unset($fallback[$this->active]);
68 68
 
69 69
     // Проходим по оставшимся локалям
70
-    foreach($fallback as $try_language) {
70
+    foreach ($fallback as $try_language) {
71 71
       // Если нет такой строки - пытаемся вытащить из кэша
72
-      if(!isset($this->container[$try_language][$offset]) && $this->cache) {
73
-        $this->container[$try_language][$offset] = $this->cache->__get($this->cache_prefix . $try_language . '_' . $offset);
72
+      if (!isset($this->container[$try_language][$offset]) && $this->cache) {
73
+        $this->container[$try_language][$offset] = $this->cache->__get($this->cache_prefix.$try_language.'_'.$offset);
74 74
 // Записываем результат работы кэша
75 75
 $locale_cache_statistic['queries']++;
76 76
 isset($this->container[$try_language][$offset]) ? $locale_cache_statistic['hits']++ : $locale_cache_statistic['misses']++;
77
-!isset($this->container[$try_language][$offset]) ? $locale_cache_statistic['missed_str'][] = $this->cache_prefix . $try_language . '_' . $offset : false;
77
+!isset($this->container[$try_language][$offset]) ? $locale_cache_statistic['missed_str'][] = $this->cache_prefix.$try_language.'_'.$offset : false;
78 78
       }
79 79
 
80 80
       // Если мы как-то где-то нашли строку...
81
-      if(isset($this->container[$try_language][$offset])) {
81
+      if (isset($this->container[$try_language][$offset])) {
82 82
         // ...значит она получена в результате фоллбэка и записываем её в кэш и контейнер
83 83
         $this[$offset] = $this->container[$try_language][$offset];
84 84
         $locale_cache_statistic['fallbacks']++;
@@ -94,16 +94,16 @@  discard block
 block discarded – undo
94 94
       $this->container[$this->active][] = $value;
95 95
     } else {
96 96
       $this->container[$this->active][$offset] = $value;
97
-      if($this->cache) {
98
-        $this->cache->__set($this->cache_prefix_lang . $offset, $value);
97
+      if ($this->cache) {
98
+        $this->cache->__set($this->cache_prefix_lang.$offset, $value);
99 99
       }
100 100
     }
101 101
   }
102 102
   public function offsetExists($offset) {
103 103
     // Шорткат если у нас уже есть строка в памяти PHP
104
-    if(!isset($this->container[$this->active][$offset])) {
104
+    if (!isset($this->container[$this->active][$offset])) {
105 105
 //        pdump($this->cache_prefix_lang . $offset);
106
-      if(!$this->cache || !($this->container[$this->active][$offset] = $this->cache->__get($this->cache_prefix_lang . $offset))) {
106
+      if (!$this->cache || !($this->container[$this->active][$offset] = $this->cache->__get($this->cache_prefix_lang.$offset))) {
107 107
 //        pdump($this->cache_prefix_lang . $offset);
108 108
         // Если нету такой строки - делаем фоллбэк
109 109
         $this->locale_string_fallback($offset);
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
   }
120 120
   public function offsetGet($offset) {
121 121
     $value = $this->offsetExists($offset) ? $this->container[$this->active][$offset] : null;
122
-    if($this->enable_stat_usage) {
122
+    if ($this->enable_stat_usage) {
123 123
       $this->usage_stat_log($offset, $value);
124 124
     }
125 125
     return $value;
@@ -134,25 +134,25 @@  discard block
 block discarded – undo
134 134
 
135 135
 
136 136
   public function usage_stat_load() {
137
-    $this->stat_usage = classSupernova::$cache->lng_stat_usage  = array(); // TODO for debug
138
-    if(empty($this->stat_usage)) {
137
+    $this->stat_usage = classSupernova::$cache->lng_stat_usage = array(); // TODO for debug
138
+    if (empty($this->stat_usage)) {
139 139
       $query = classSupernova::$db->doSelect("SELECT * FROM `{{lng_usage_stat}}`");
140
-      while($row = db_fetch($query)) {
141
-        $this->stat_usage[$row['lang_code'] . ':' . $row['string_id'] . ':' . $row['file'] . ':' . $row['line']] = $row['is_empty'];
140
+      while ($row = db_fetch($query)) {
141
+        $this->stat_usage[$row['lang_code'].':'.$row['string_id'].':'.$row['file'].':'.$row['line']] = $row['is_empty'];
142 142
       }
143 143
     }
144 144
   }
145 145
   public function usage_stat_save() {
146
-    if(!empty($this->stat_usage_new)) {
146
+    if (!empty($this->stat_usage_new)) {
147 147
       classSupernova::$cache->lng_stat_usage = $this->stat_usage;
148 148
       classSupernova::$db->doSelect("SELECT 1 FROM `{{lng_usage_stat}}` LIMIT 1");
149
-      foreach($this->stat_usage_new as &$value) {
150
-        foreach($value as &$value2) {
151
-          $value2 = '"' . db_escape($value2) . '"';
149
+      foreach ($this->stat_usage_new as &$value) {
150
+        foreach ($value as &$value2) {
151
+          $value2 = '"'.db_escape($value2).'"';
152 152
         }
153
-        $value = '(' . implode(',', $value) .')';
153
+        $value = '('.implode(',', $value).')';
154 154
       }
155
-      classSupernova::$db->doReplace("REPLACE INTO `{{lng_usage_stat}}` (lang_code,string_id,`file`,line,is_empty,locale) VALUES " . implode(',', $this->stat_usage_new));
155
+      classSupernova::$db->doReplace("REPLACE INTO `{{lng_usage_stat}}` (lang_code,string_id,`file`,line,is_empty,locale) VALUES ".implode(',', $this->stat_usage_new));
156 156
     }
157 157
   }
158 158
   public function usage_stat_log(&$offset, &$value) {
@@ -162,8 +162,8 @@  discard block
 block discarded – undo
162 162
 
163 163
     $file = str_replace('\\', '/', substr($trace[1]['file'], strlen(SN_ROOT_PHYSICAL) - 1));
164 164
 
165
-    $string_id = $this->active . ':' . $offset . ':' . $file . ':' . $trace[1]['line'];
166
-    if(!isset($this->stat_usage[$string_id]) || $this->stat_usage[$string_id] != empty($value)) {
165
+    $string_id = $this->active.':'.$offset.':'.$file.':'.$trace[1]['line'];
166
+    if (!isset($this->stat_usage[$string_id]) || $this->stat_usage[$string_id] != empty($value)) {
167 167
       $this->stat_usage[$string_id] = empty($value);
168 168
       $this->stat_usage_new[] = array(
169 169
         'lang_code' => $this->active,
@@ -171,14 +171,14 @@  discard block
 block discarded – undo
171 171
         'file' => $file,
172 172
         'line' => $trace[1]['line'],
173 173
         'is_empty' => intval(empty($value)),
174
-        'locale' => '' . $value,
174
+        'locale' => ''.$value,
175 175
       );
176 176
     }
177 177
   }
178 178
 
179 179
 
180 180
   protected function lng_try_filepath($path, $file_path_relative) {
181
-    $file_path = SN_ROOT_PHYSICAL . ($path && file_exists(SN_ROOT_PHYSICAL . $path . $file_path_relative) ? $path : '') . $file_path_relative;
181
+    $file_path = SN_ROOT_PHYSICAL.($path && file_exists(SN_ROOT_PHYSICAL.$path.$file_path_relative) ? $path : '').$file_path_relative;
182 182
     return file_exists($file_path) ? $file_path : false;
183 183
   }
184 184
 
@@ -200,14 +200,14 @@  discard block
 block discarded – undo
200 200
 
201 201
     classSupernova::log_file("locale.include: Loading data from domain '{$filename}'", 1);
202 202
 
203
-    $cache_file_key = $this->cache_prefix_lang . '__' . $filename;
203
+    $cache_file_key = $this->cache_prefix_lang.'__'.$filename;
204 204
 
205 205
     // Подключен ли внешний кэш?
206
-    if($this->cache) {
206
+    if ($this->cache) {
207 207
       // Загружен ли уже данный файл?
208 208
       $cache_file_status = $this->cache->__get($cache_file_key);
209
-      classSupernova::log_file("locale.include: Cache - '{$filename}' has key '{$cache_file_key}' and is " . ($cache_file_status ? 'already loaded - EXIT' : 'EMPTY'), $cache_file_status ? -1 : 0);
210
-      if($cache_file_status) {
209
+      classSupernova::log_file("locale.include: Cache - '{$filename}' has key '{$cache_file_key}' and is ".($cache_file_status ? 'already loaded - EXIT' : 'EMPTY'), $cache_file_status ? -1 : 0);
210
+      if ($cache_file_status) {
211 211
         // Если да - повторять загрузку нет смысла
212 212
         return null;
213 213
       }
@@ -221,47 +221,47 @@  discard block
 block discarded – undo
221 221
     $this->make_fallback($language);
222 222
 
223 223
     $file_path = '';
224
-    foreach($this->fallback as $lang_try) {
225
-      if(!$lang_try /* || isset($language_tried[$lang_try]) */) {
224
+    foreach ($this->fallback as $lang_try) {
225
+      if (!$lang_try /* || isset($language_tried[$lang_try]) */) {
226 226
         continue;
227 227
       }
228 228
 
229
-      if($file_path = $this->lng_try_filepath($path, "language/{$lang_try}/{$filename_ext}")) {
229
+      if ($file_path = $this->lng_try_filepath($path, "language/{$lang_try}/{$filename_ext}")) {
230 230
         break;
231 231
       }
232 232
 
233
-      if($file_path = $this->lng_try_filepath($path, "language/{$filename}_{$lang_try}{$ext}")) {
233
+      if ($file_path = $this->lng_try_filepath($path, "language/{$filename}_{$lang_try}{$ext}")) {
234 234
         break;
235 235
       }
236 236
 
237 237
       $file_path = '';
238 238
     }
239 239
 
240
-    if($file_path) {
240
+    if ($file_path) {
241 241
       $a_lang_array = array();
242 242
       include($file_path);
243 243
 
244
-      if(!empty($a_lang_array)) {
244
+      if (!empty($a_lang_array)) {
245 245
         $this->merge($a_lang_array);
246 246
 
247 247
         // Загрузка данных из файла в кэш
248
-        if($this->cache) {
248
+        if ($this->cache) {
249 249
           classSupernova::log_file("Locale: loading '{$filename}' into cache");
250
-          foreach($a_lang_array as $key => $value) {
251
-            $value_cache_key = $this->cache_prefix_lang . $key;
252
-            if($this->cache->__isset($value_cache_key)) {
253
-              if(is_array($value)) {
250
+          foreach ($a_lang_array as $key => $value) {
251
+            $value_cache_key = $this->cache_prefix_lang.$key;
252
+            if ($this->cache->__isset($value_cache_key)) {
253
+              if (is_array($value)) {
254 254
                 $alt_value = $this->cache->__get($value_cache_key);
255 255
                 $value = array_replace_recursive($alt_value, $value);
256 256
                 // pdump($alt_value, $alt_value);
257 257
               }
258 258
             }
259
-            $this->cache->__set($this->cache_prefix_lang . $key, $value);
259
+            $this->cache->__set($this->cache_prefix_lang.$key, $value);
260 260
           }
261 261
         }
262 262
       }
263 263
 
264
-      if($this->cache) {
264
+      if ($this->cache) {
265 265
         $this->cache->__set($cache_file_key, true);
266 266
       }
267 267
 
@@ -274,14 +274,14 @@  discard block
 block discarded – undo
274 274
   }
275 275
 
276 276
   public function lng_load_i18n($i18n) {
277
-    if(!isset($i18n)) {
277
+    if (!isset($i18n)) {
278 278
       return;
279 279
     }
280 280
 
281
-    foreach($i18n as $i18n_data) {
282
-      if(is_string($i18n_data)) {
281
+    foreach ($i18n as $i18n_data) {
282
+      if (is_string($i18n_data)) {
283 283
         $this->lng_include($i18n_data);
284
-      } elseif(is_array($i18n_data)) {
284
+      } elseif (is_array($i18n_data)) {
285 285
         $this->lng_include($i18n_data['file'], $i18n_data['path']);
286 286
       }
287 287
     }
@@ -299,27 +299,27 @@  discard block
 block discarded – undo
299 299
 
300 300
     classSupernova::log_file("locale.switch: Trying to switch language to '{$language_new}'");
301 301
 
302
-    if($language_new == $this->active) {
302
+    if ($language_new == $this->active) {
303 303
       classSupernova::log_file("locale.switch: New language '{$language_new}' is equal to current language '{$this->active}' - EXIT", -1);
304 304
       return false;
305 305
     }
306 306
 
307 307
     $this->active = $language = $language_new;
308
-    $this->cache_prefix_lang = $this->cache_prefix . $this->active . '_';
308
+    $this->cache_prefix_lang = $this->cache_prefix.$this->active.'_';
309 309
 
310 310
     $this['LANG_INFO'] = $this->lng_get_info($this->active);
311 311
     $this->make_fallback($this->active);
312 312
 
313
-    if($this->cache) {
314
-      $cache_lang_init_status = $this->cache->__get($this->cache_prefix_lang . '__INIT');
315
-      classSupernova::log_file("locale.switch: Cache for '{$this->active}' prefixed '{$this->cache_prefix_lang}' is " . ($cache_lang_init_status ? 'already loaded. Doing nothing - EXIT' : 'EMPTY'), $cache_lang_init_status ? -1 : 0);
316
-      if($cache_lang_init_status) {
313
+    if ($this->cache) {
314
+      $cache_lang_init_status = $this->cache->__get($this->cache_prefix_lang.'__INIT');
315
+      classSupernova::log_file("locale.switch: Cache for '{$this->active}' prefixed '{$this->cache_prefix_lang}' is ".($cache_lang_init_status ? 'already loaded. Doing nothing - EXIT' : 'EMPTY'), $cache_lang_init_status ? -1 : 0);
316
+      if ($cache_lang_init_status) {
317 317
         return false;
318 318
       }
319 319
 
320 320
       // Чистим текущие локализации из кэша. Достаточно почистить только флаги инициализации языкового кэша и загрузки файлов - они начинаются с '__'
321 321
       classSupernova::log_file("locale.switch: Cache - invalidating data");
322
-      $this->cache->unset_by_prefix($this->cache_prefix_lang . '__');
322
+      $this->cache->unset_by_prefix($this->cache_prefix_lang.'__');
323 323
     }
324 324
 
325 325
     $this->lng_include('system');
@@ -329,9 +329,9 @@  discard block
 block discarded – undo
329 329
     // Loading global language files
330 330
     $this->lng_load_i18n(classSupernova::$sn_mvc['i18n']['']);
331 331
 
332
-    if($this->cache) {
333
-      classSupernova::log_file("locale.switch: Cache - setting flag " . $this->cache_prefix_lang . '__INIT');
334
-      $this->cache->__set($this->cache_prefix_lang . '__INIT', true);
332
+    if ($this->cache) {
333
+      classSupernova::log_file("locale.switch: Cache - setting flag ".$this->cache_prefix_lang.'__INIT');
334
+      $this->cache->__set($this->cache_prefix_lang.'__INIT', true);
335 335
     }
336 336
 
337 337
     classSupernova::log_file("locale.switch: Complete - EXIT");
@@ -341,9 +341,9 @@  discard block
 block discarded – undo
341 341
 
342 342
 
343 343
   public function lng_get_info($entry) {
344
-    $file_name = SN_ROOT_PHYSICAL . 'language/' . $entry . '/language.mo.php';
344
+    $file_name = SN_ROOT_PHYSICAL.'language/'.$entry.'/language.mo.php';
345 345
     $lang_info = array();
346
-    if(file_exists($file_name)) {
346
+    if (file_exists($file_name)) {
347 347
       include($file_name);
348 348
     }
349 349
 
@@ -351,15 +351,15 @@  discard block
 block discarded – undo
351 351
   }
352 352
 
353 353
   public function lng_get_list() {
354
-    if(empty($this->lang_list)) {
354
+    if (empty($this->lang_list)) {
355 355
       $this->lang_list = array();
356 356
 
357
-      $path = SN_ROOT_PHYSICAL . 'language/';
357
+      $path = SN_ROOT_PHYSICAL.'language/';
358 358
       $dir = dir($path);
359
-      while(false !== ($entry = $dir->read())) {
360
-        if(is_dir($path . $entry) && $entry[0] != '.') {
359
+      while (false !== ($entry = $dir->read())) {
360
+        if (is_dir($path.$entry) && $entry[0] != '.') {
361 361
           $lang_info = $this->lng_get_info($entry);
362
-          if($lang_info['LANG_NAME_ISO2'] == $entry) {
362
+          if ($lang_info['LANG_NAME_ISO2'] == $entry) {
363 363
             $this->lang_list[$lang_info['LANG_NAME_ISO2']] = $lang_info;
364 364
           }
365 365
         }
Please login to merge, or discard this patch.
includes/classes/db_mysql.php 1 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.
includes/classes/UBE/UBEReport.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -13,14 +13,14 @@  discard block
 block discarded – undo
13 13
    */
14 14
   public function sn_ube_report_save($ube) {
15 15
     // Если уже есть ИД репорта - значит репорт был взят из таблицы. С таким мы не работаем
16
-    if($ube->get_cypher()) {
16
+    if ($ube->get_cypher()) {
17 17
       return false;
18 18
     }
19 19
 
20 20
     // Генерируем уникальный секретный ключ и проверяем наличие в базе
21 21
     do {
22 22
       $ube->report_cypher = sys_random_string(32);
23
-    } while(classSupernova::$db->doSelectFetch("SELECT ube_report_cypher FROM {{ube_report}} WHERE ube_report_cypher = '{$ube->report_cypher}' LIMIT 1 FOR UPDATE"));
23
+    } while (classSupernova::$db->doSelectFetch("SELECT ube_report_cypher FROM {{ube_report}} WHERE ube_report_cypher = '{$ube->report_cypher}' LIMIT 1 FOR UPDATE"));
24 24
 
25 25
     // Инициализация таблицы для пакетной вставки информации
26 26
     $sql_perform = array(
@@ -108,24 +108,24 @@  discard block
 block discarded – undo
108 108
     $sql_str = "INSERT INTO `{{ube_report}}`
109 109
     SET
110 110
       `ube_report_cypher` = '{$ube->report_cypher}',
111
-      `ube_report_time_combat` = '" . date(FMT_DATE_TIME_SQL, $ube->combat_timestamp) . "',
111
+      `ube_report_time_combat` = '".date(FMT_DATE_TIME_SQL, $ube->combat_timestamp)."',
112 112
       `ube_report_time_spent` = {$ube->time_spent},
113 113
 
114
-      `ube_report_combat_admin` = " . (int)$ube->is_admin_in_combat . ",
114
+      `ube_report_combat_admin` = ".(int) $ube->is_admin_in_combat.",
115 115
       `ube_report_mission_type` = {$ube->mission_type_id},
116 116
 
117 117
       `ube_report_combat_result` = {$ube->combat_result},
118
-      `ube_report_combat_sfr` = " . (int)$ube->is_small_fleet_recce . ",
118
+      `ube_report_combat_sfr` = ".(int) $ube->is_small_fleet_recce.",
119 119
 
120
-      `ube_report_planet_id`          = " . (int)$ube->ube_planet_info[PLANET_ID] . ",
121
-      `ube_report_planet_name`        = '" . db_escape($ube->ube_planet_info[PLANET_NAME]) . "',
122
-      `ube_report_planet_size`        = " . (int)$ube->ube_planet_info[PLANET_SIZE] . ",
123
-      `ube_report_planet_galaxy`      = " . (int)$ube->ube_planet_info[PLANET_GALAXY] . ",
124
-      `ube_report_planet_system`      = " . (int)$ube->ube_planet_info[PLANET_SYSTEM] . ",
125
-      `ube_report_planet_planet`      = " . (int)$ube->ube_planet_info[PLANET_PLANET] . ",
126
-      `ube_report_planet_planet_type` = " . (int)$ube->ube_planet_info[PLANET_TYPE] . ",
120
+      `ube_report_planet_id`          = " . (int) $ube->ube_planet_info[PLANET_ID].",
121
+      `ube_report_planet_name`        = '" . db_escape($ube->ube_planet_info[PLANET_NAME])."',
122
+      `ube_report_planet_size`        = " . (int) $ube->ube_planet_info[PLANET_SIZE].",
123
+      `ube_report_planet_galaxy`      = " . (int) $ube->ube_planet_info[PLANET_GALAXY].",
124
+      `ube_report_planet_system`      = " . (int) $ube->ube_planet_info[PLANET_SYSTEM].",
125
+      `ube_report_planet_planet`      = " . (int) $ube->ube_planet_info[PLANET_PLANET].",
126
+      `ube_report_planet_planet_type` = " . (int) $ube->ube_planet_info[PLANET_TYPE].",
127 127
 
128
-      `ube_report_capture_result` = " . (int)$ube->capture_result . ", "
128
+      `ube_report_capture_result` = " . (int) $ube->capture_result.", "
129 129
       . $ube->debris->report_generate_sql()
130 130
       . $ube->moon_calculator->report_generate_sql();
131 131
 
@@ -134,22 +134,22 @@  discard block
 block discarded – undo
134 134
 
135 135
     // Сохраняем общую информацию по игрокам
136 136
     $player_sides = $ube->players->get_player_sides();
137
-    foreach($player_sides as $player_id => $player_side) {
137
+    foreach ($player_sides as $player_id => $player_side) {
138 138
       $sql_perform['ube_report_player'][] = array(
139 139
         $ube_report_id,
140 140
         $player_id,
141 141
 
142
-        "'" . db_escape($ube->players[$player_id]->name) . "'",
142
+        "'".db_escape($ube->players[$player_id]->name)."'",
143 143
         $ube->players[$player_id]->getSide() == UBE_PLAYER_IS_ATTACKER ? 1 : 0,
144 144
 
145
-        (float)$ube->players[$player_id]->player_bonus->calcBonus(P_ATTACK),
146
-        (float)$ube->players[$player_id]->player_bonus->calcBonus(P_SHIELD),
147
-        (float)$ube->players[$player_id]->player_bonus->calcBonus(P_ARMOR),
145
+        (float) $ube->players[$player_id]->player_bonus->calcBonus(P_ATTACK),
146
+        (float) $ube->players[$player_id]->player_bonus->calcBonus(P_SHIELD),
147
+        (float) $ube->players[$player_id]->player_bonus->calcBonus(P_ARMOR),
148 148
       );
149 149
     }
150 150
 
151 151
     // Всякая информация по флотам
152
-    foreach($ube->fleet_list->_container as $fleet_id => $UBEFleet) {
152
+    foreach ($ube->fleet_list->_container as $fleet_id => $UBEFleet) {
153 153
       // Сохраняем общую информацию по флотам
154 154
       $sql_perform['ube_report_fleet'][] = $UBEFleet->sql_generate_array($ube_report_id);
155 155
 
@@ -165,16 +165,16 @@  discard block
 block discarded – undo
165 165
     $ube->rounds->sql_generate_unit_array($sql_perform['ube_report_unit'], $ube_report_id, $ube->fleet_list);
166 166
 
167 167
     // Пакетная вставка данных
168
-    foreach($sql_perform as $table_name => $table_data) {
169
-      if(count($table_data) < 2) {
168
+    foreach ($sql_perform as $table_name => $table_data) {
169
+      if (count($table_data) < 2) {
170 170
         continue;
171 171
       }
172
-      foreach($table_data as &$record_data) {
173
-        $record_data = '(' . implode(',', $record_data) . ')';
172
+      foreach ($table_data as &$record_data) {
173
+        $record_data = '('.implode(',', $record_data).')';
174 174
       }
175 175
       $fields = $table_data[0];
176 176
       unset($table_data[0]);
177
-      classSupernova::$db->doInsert("INSERT INTO {{{$table_name}}} {$fields} VALUES " . implode(',', $table_data));
177
+      classSupernova::$db->doInsert("INSERT INTO {{{$table_name}}} {$fields} VALUES ".implode(',', $table_data));
178 178
     }
179 179
 
180 180
     return $ube->report_cypher;
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
     $report_cypher = db_escape($report_cypher);
193 193
 
194 194
     $report_row = classSupernova::$db->doSelectFetch("SELECT * FROM {{ube_report}} WHERE ube_report_cypher = '{$report_cypher}' LIMIT 1");
195
-    if(!$report_row) {
195
+    if (!$report_row) {
196 196
       return UBE_REPORT_NOT_FOUND;
197 197
     }
198 198
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
    * @param     $template_result
209 209
    */
210 210
   public function sn_ube_report_generate(UBE $ube, &$template_result) {
211
-    if(!is_object($ube)) {
211
+    if (!is_object($ube)) {
212 212
       return;
213 213
     }
214 214
 
@@ -223,15 +223,15 @@  discard block
 block discarded – undo
223 223
 
224 224
     // Координаты, тип и название планеты - если есть
225 225
 //R  $planet_owner_id = $combat_data[UBE_FLEETS][0][UBE_OWNER];
226
-    if(isset($ube->ube_planet_info)) {
226
+    if (isset($ube->ube_planet_info)) {
227 227
       $template_result += $ube->ube_planet_info;
228 228
       $template_result[PLANET_NAME] = str_replace(' ', '&nbsp;', htmlentities($template_result[PLANET_NAME], ENT_COMPAT, 'UTF-8'));
229 229
     }
230 230
 
231 231
     // Обломки
232 232
     $debris = array();
233
-    foreach(array(RES_METAL, RES_CRYSTAL) as $resource_id) {
234
-      if($resource_amount = $ube->debris->debris_get_resource($resource_id)) {
233
+    foreach (array(RES_METAL, RES_CRYSTAL) as $resource_id) {
234
+      if ($resource_amount = $ube->debris->debris_get_resource($resource_id)) {
235 235
         $debris[] = array(
236 236
           'NAME'   => classLocale::$lang['tech'][$resource_id],
237 237
           'AMOUNT' => pretty_number($resource_amount),
Please login to merge, or discard this patch.