Completed
Push — work-fleets ( 1735a9...f6000a )
by SuperNova.WS
06:05
created
ajax_version_check.php 2 patches
Switch Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -13,15 +13,15 @@
 block discarded – undo
13 13
   . '&id=' . urlencode(classSupernova::$config->server_updater_id);
14 14
 
15 15
 switch($mode) {
16
-  case SNC_MODE_REGISTER:
17
-    if(classSupernova::$config->server_updater_key || classSupernova::$config->server_updater_id) {
18
-      if($ajax) {
19
-        print(SNC_VER_REGISTER_ERROR_REGISTERED);
16
+    case SNC_MODE_REGISTER:
17
+      if(classSupernova::$config->server_updater_key || classSupernova::$config->server_updater_id) {
18
+        if($ajax) {
19
+          print(SNC_VER_REGISTER_ERROR_REGISTERED);
20
+        }
21
+        die();
20 22
       }
21
-      die();
22
-    }
23
-    $url .= "&name=" . urlencode(classSupernova::$config->game_name) . "&url=" . urlencode(SN_ROOT_VIRTUAL);
24
-  break;
23
+      $url .= "&name=" . urlencode(classSupernova::$config->game_name) . "&url=" . urlencode(SN_ROOT_VIRTUAL);
24
+    break;
25 25
 }
26 26
 
27 27
 $check_result = sn_get_url_contents($url);
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,42 +1,42 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-require_once('includes/init.' . substr(strrchr(__FILE__, '.'), 1));
3
+require_once('includes/init.'.substr(strrchr(__FILE__, '.'), 1));
4 4
 
5 5
 $mode = sys_get_param_int('mode');
6 6
 $ajax = sys_get_param_int('ajax');
7 7
 
8
-$url = 'http://supernova.ws/version_check.php?mode=' . $mode
9
-  . '&db=' . DB_VERSION
10
-  . '&release=' . SN_RELEASE
11
-  . '&version=' . SN_VERSION
12
-  . '&key=' . urlencode(classSupernova::$config->server_updater_key)
13
-  . '&id=' . urlencode(classSupernova::$config->server_updater_id);
8
+$url = 'http://supernova.ws/version_check.php?mode='.$mode
9
+  . '&db='.DB_VERSION
10
+  . '&release='.SN_RELEASE
11
+  . '&version='.SN_VERSION
12
+  . '&key='.urlencode(classSupernova::$config->server_updater_key)
13
+  . '&id='.urlencode(classSupernova::$config->server_updater_id);
14 14
 
15
-switch($mode) {
15
+switch ($mode) {
16 16
   case SNC_MODE_REGISTER:
17
-    if(classSupernova::$config->server_updater_key || classSupernova::$config->server_updater_id) {
18
-      if($ajax) {
17
+    if (classSupernova::$config->server_updater_key || classSupernova::$config->server_updater_id) {
18
+      if ($ajax) {
19 19
         print(SNC_VER_REGISTER_ERROR_REGISTERED);
20 20
       }
21 21
       die();
22 22
     }
23
-    $url .= "&name=" . urlencode(classSupernova::$config->game_name) . "&url=" . urlencode(SN_ROOT_VIRTUAL);
23
+    $url .= "&name=".urlencode(classSupernova::$config->game_name)."&url=".urlencode(SN_ROOT_VIRTUAL);
24 24
   break;
25 25
 }
26 26
 
27 27
 $check_result = sn_get_url_contents($url);
28
-if(!$check_result) {
28
+if (!$check_result) {
29 29
   $version_check = SNC_VER_ERROR_CONNECT;
30
-} elseif(($version_check = intval($check_result)) && $version_check == $check_result) {
30
+} elseif (($version_check = intval($check_result)) && $version_check == $check_result) {
31 31
   $version_check = $check_result;
32 32
 } else {
33 33
   // JSON decode if string
34 34
   $check_result = json_decode($check_result, true);
35 35
   $version_check = $check_result === null ? SNC_VER_UNKNOWN_RESPONSE : $check_result['version_check'];
36 36
 
37
-  switch($mode) {
37
+  switch ($mode) {
38 38
     case SNC_MODE_REGISTER:
39
-      if($check_result['site']['site_key'] && $check_result['site']['site_id'] && $check_result['site']['result'] == SNC_VER_REGISTER_REGISTERED) {
39
+      if ($check_result['site']['site_key'] && $check_result['site']['site_id'] && $check_result['site']['result'] == SNC_VER_REGISTER_REGISTERED) {
40 40
         classSupernova::$config->db_saveItem('server_updater_key', $check_result['site']['site_key']);
41 41
         classSupernova::$config->db_saveItem('server_updater_id', $check_result['site']['site_id']);
42 42
       }
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 classSupernova::$config->db_saveItem('server_updater_check_last', SN_TIME_NOW);
50 50
 classSupernova::$config->db_saveItem('server_updater_check_result', $version_check);
51 51
 
52
-if($ajax) {
52
+if ($ajax) {
53 53
   define('IN_AJAX', true);
54 54
   print($version_check);
55 55
 }
Please login to merge, or discard this patch.
includes/db/db_queries_fleet.php 2 patches
Doc Comments   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,6 +22,10 @@  discard block
 block discarded – undo
22 22
   doquery('DELETE FROM `{{aks}}` WHERE `id` NOT IN (SELECT DISTINCT `fleet_group` FROM `{{fleets}}`);');
23 23
 }
24 24
 
25
+/**
26
+ * @param double $arrival
27
+ * @param integer $target_structure
28
+ */
25 29
 function db_missile_insert($target_coord, $user, $planetrow, $arrival, $fleet_ship_count, $target_structure) {
26 30
   doquery(
27 31
     "INSERT INTO `{{iraks}}` SET
@@ -52,7 +56,7 @@  discard block
 block discarded – undo
52 56
 /**
53 57
  * @param $user
54 58
  * @param $planet_dst
55
- * @param $time_limit
59
+ * @param integer $time_limit
56 60
  *
57 61
  * @return array|bool|mysqli_result|null
58 62
  */
@@ -113,14 +117,14 @@  discard block
 block discarded – undo
113 117
 
114 118
 
115 119
 /**
116
- * @param $fleet_group_id_list
120
+ * @param string $fleet_group_id_list
117 121
  */
118 122
 function db_acs_delete_by_list($fleet_group_id_list) {
119 123
   doquery("DELETE FROM {{aks}} WHERE `id` IN ({$fleet_group_id_list})");
120 124
 }
121 125
 
122 126
 /**
123
- * @param $bashing_list
127
+ * @param string $bashing_list
124 128
  */
125 129
 function db_bashing_insert($bashing_list) {
126 130
   doquery("INSERT INTO {{bashing}} (bashing_user_id, bashing_planet_id, bashing_time) VALUES {$bashing_list};");
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
  * @return array|bool|mysqli_result|null
44 44
  */
45 45
 function db_missile_list_by_arrival() {
46
-  $iraks = doquery("SELECT * FROM {{iraks}} WHERE `fleet_end_time` <= " . SN_TIME_NOW . " FOR UPDATE;");
46
+  $iraks = doquery("SELECT * FROM {{iraks}} WHERE `fleet_end_time` <= ".SN_TIME_NOW." FOR UPDATE;");
47 47
 
48 48
   return $iraks;
49 49
 }
@@ -89,16 +89,16 @@  discard block
 block discarded – undo
89 89
  */
90 90
 function db_acs_insert($fleetid, $user, $objFleet) {
91 91
   doquery("INSERT INTO {{aks}} SET
92
-          `name` = '" . db_escape(classLocale::$lang['flt_acs_prefix'] . $fleetid) . "',
93
-          `teilnehmer` = '" . $user['id'] . "',
94
-          `flotten` = '" . $fleetid . "',
95
-          `ankunft` = '" . $objFleet->time_arrive_to_target . "',
96
-          `galaxy` = '" . $objFleet->fleet_end_galaxy . "',
97
-          `system` = '" . $objFleet->fleet_end_system . "',
98
-          `planet` = '" . $objFleet->fleet_end_planet . "',
99
-          `planet_type` = '" . $objFleet->fleet_end_type . "',
100
-          `eingeladen` = '" . $user['id'] . "',
101
-          `fleet_end_time` = '" . $objFleet->time_return_to_source . "'");
92
+          `name` = '" . db_escape(classLocale::$lang['flt_acs_prefix'].$fleetid)."',
93
+          `teilnehmer` = '" . $user['id']."',
94
+          `flotten` = '" . $fleetid."',
95
+          `ankunft` = '" . $objFleet->time_arrive_to_target."',
96
+          `galaxy` = '" . $objFleet->fleet_end_galaxy."',
97
+          `system` = '" . $objFleet->fleet_end_system."',
98
+          `planet` = '" . $objFleet->fleet_end_planet."',
99
+          `planet_type` = '" . $objFleet->fleet_end_type."',
100
+          `eingeladen` = '" . $user['id']."',
101
+          `fleet_end_time` = '" . $objFleet->time_return_to_source."'");
102 102
 }
103 103
 
104 104
 /**
Please login to merge, or discard this patch.
includes/classes/db_mysql.php 2 patches
Doc Comments   +10 added lines, -3 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
   }
125 125
 
126 126
   /**
127
-   * @param $query
127
+   * @param string $query
128 128
    *
129 129
    * @return mixed
130 130
    */
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
   }
141 141
 
142 142
   /**
143
-   * @param       $query
144
-   * @param       $fetch
143
+   * @param       string $query
144
+   * @param       boolean $fetch
145 145
    */
146 146
   public function logQuery($query, $fetch) {
147 147
     if(!classSupernova::$config->debug) {
@@ -204,6 +204,10 @@  discard block
 block discarded – undo
204 204
 
205 205
 
206 206
   // TODO Заменить это на новый логгер
207
+
208
+  /**
209
+   * @param string $query
210
+   */
207 211
   function security_watch_user_queries($query) {
208 212
     global $user;
209 213
 
@@ -227,6 +231,9 @@  discard block
 block discarded – undo
227 231
   }
228 232
 
229 233
 
234
+  /**
235
+   * @param string $query
236
+   */
230 237
   function security_query_check_bad_words($query) {
231 238
     global $user, $dm_change_legit, $mm_change_legit;
232 239
 
Please login to merge, or discard this patch.
Spacing   +54 added lines, -54 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
   public function load_db_settings() {
66 66
     $dbsettings = array();
67 67
 
68
-    require(SN_ROOT_PHYSICAL . "config" . DOT_PHP_EX);
68
+    require(SN_ROOT_PHYSICAL."config".DOT_PHP_EX);
69 69
 
70 70
     $this->dbsettings = $dbsettings;
71 71
   }
@@ -73,23 +73,23 @@  discard block
 block discarded – undo
73 73
   public function sn_db_connect($external_db_settings = null) {
74 74
     $this->db_disconnect();
75 75
 
76
-    if(!empty($external_db_settings) && is_array($external_db_settings)) {
76
+    if (!empty($external_db_settings) && is_array($external_db_settings)) {
77 77
       $this->dbsettings = $external_db_settings;
78 78
     }
79 79
 
80
-    if(empty($this->dbsettings)) {
80
+    if (empty($this->dbsettings)) {
81 81
       $this->load_db_settings();
82 82
     }
83 83
 
84 84
     // TODO - фатальные (?) ошибки на каждом шагу. Хотя - скорее Эксепшны
85
-    if(!empty($this->dbsettings)) {
85
+    if (!empty($this->dbsettings)) {
86 86
       $driver_name = empty($this->dbsettings['sn_driver']) ? 'db_mysql_v5' : $this->dbsettings['sn_driver'];
87 87
       $this->driver = new $driver_name();
88 88
       $this->db_prefix = $this->dbsettings['prefix'];
89 89
 
90 90
       $this->connected = $this->connected || $this->driver_connect();
91 91
 
92
-      if($this->connected) {
92
+      if ($this->connected) {
93 93
         $this->table_list = $this->db_get_table_list();
94 94
         // TODO Проверка на пустоту
95 95
       }
@@ -101,11 +101,11 @@  discard block
 block discarded – undo
101 101
   }
102 102
 
103 103
   protected function driver_connect() {
104
-    if(!is_object($this->driver)) {
104
+    if (!is_object($this->driver)) {
105 105
       classSupernova::$debug->error_fatal('DB Error - No driver for MySQL found!');
106 106
     }
107 107
 
108
-    if(!method_exists($this->driver, 'mysql_connect')) {
108
+    if (!method_exists($this->driver, 'mysql_connect')) {
109 109
       classSupernova::$debug->error_fatal('DB Error - WRONG MySQL driver!');
110 110
     }
111 111
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
   }
114 114
 
115 115
   public function db_disconnect() {
116
-    if($this->connected) {
116
+    if ($this->connected) {
117 117
       $this->connected = !$this->driver_disconnect();
118 118
       $this->connected = false;
119 119
     }
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
    */
129 129
   public function replaceTablePlaceholders($query) {
130 130
     $sql = $query;
131
-    if(strpos($sql, '{{') !== false) {
132
-      foreach($this->table_list as $tableName) {
133
-        $sql = str_replace("{{{$tableName}}}", $this->db_prefix . $tableName, $sql);
131
+    if (strpos($sql, '{{') !== false) {
132
+      foreach ($this->table_list as $tableName) {
133
+        $sql = str_replace("{{{$tableName}}}", $this->db_prefix.$tableName, $sql);
134 134
       }
135 135
     }
136 136
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
    * @param       $fetch
143 143
    */
144 144
   protected function logQuery($query, $fetch) {
145
-    if(!classSupernova::$config->debug) {
145
+    if (!classSupernova::$config->debug) {
146 146
       return;
147 147
     }
148 148
 
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
     $arr = debug_backtrace();
151 151
     $file = end(explode('/', $arr[0]['file']));
152 152
     $line = $arr[0]['line'];
153
-    classSupernova::$debug->add("<tr><th>Query {$this->queryCount}: </th><th>$query</th><th>{$file} @ {$line}</th><th>&nbsp;</th><th> " . ($fetch ? '+' : '&nbsp;') . " </th></tr>");
153
+    classSupernova::$debug->add("<tr><th>Query {$this->queryCount}: </th><th>$query</th><th>{$file} @ {$line}</th><th>&nbsp;</th><th> ".($fetch ? '+' : '&nbsp;')." </th></tr>");
154 154
   }
155 155
 
156 156
 
@@ -160,18 +160,18 @@  discard block
 block discarded – undo
160 160
    * @return void
161 161
    */
162 162
   protected function commentQuery(&$sql) {
163
-    if(!defined('DEBUG_SQL_COMMENT')) {
163
+    if (!defined('DEBUG_SQL_COMMENT')) {
164 164
       return;
165 165
     }
166 166
     $backtrace = debug_backtrace();
167 167
     $sql_comment = classSupernova::$debug->compact_backtrace($backtrace, defined('DEBUG_SQL_COMMENT_LONG'));
168 168
 
169
-    $sql_commented = '/* ' . implode("<br />", $sql_comment) . '<br /> */ ' . preg_replace("/\s+/", ' ', $sql);
170
-    if(defined('DEBUG_SQL_ONLINE')) {
169
+    $sql_commented = '/* '.implode("<br />", $sql_comment).'<br /> */ '.preg_replace("/\s+/", ' ', $sql);
170
+    if (defined('DEBUG_SQL_ONLINE')) {
171 171
       classSupernova::$debug->warning($sql_commented, 'SQL Debug', LOG_DEBUG_SQL);
172 172
     }
173 173
 
174
-    if(defined('DEBUG_SQL_ERROR')) {
174
+    if (defined('DEBUG_SQL_ERROR')) {
175 175
       array_unshift($sql_comment, preg_replace("/\s+/", ' ', $sql));
176 176
       classSupernova::$debug->add_to_array($sql_comment);
177 177
     }
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
   }
181 181
 
182 182
   public function doquery($query, $table = '', $fetch = false, $skip_query_check = false) {
183
-    if(!is_string($table)) {
183
+    if (!is_string($table)) {
184 184
       $fetch = $table;
185 185
     }
186 186
 
187
-    if(!$this->connected) {
187
+    if (!$this->connected) {
188 188
       $this->sn_db_connect();
189 189
     }
190 190
 
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 
196 196
     $sql = $this->replaceTablePlaceholders($query);
197 197
     $this->commentQuery($sql);
198
-    !($sqlquery = $this->db_sql_query($sql)) ? classSupernova::$debug->error(db_error() . "<br />$sql<br />", 'SQL Error') : false;
198
+    !($sqlquery = $this->db_sql_query($sql)) ? classSupernova::$debug->error(db_error()."<br />$sql<br />", 'SQL Error') : false;
199 199
 
200 200
     return $fetch ? $this->db_fetch($sqlquery) : $sqlquery;
201 201
   }
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
   protected function security_watch_user_queries($query) {
206 206
     global $user;
207 207
 
208
-    if(
208
+    if (
209 209
       !$this->isWatching // Not already watching
210 210
       && !empty(classSupernova::$config->game_watchlist_array) // There is some players in watchlist
211 211
       && in_array($user['id'], classSupernova::$config->game_watchlist_array) // Current player is in watchlist
@@ -213,11 +213,11 @@  discard block
 block discarded – undo
213 213
     ) {
214 214
       $this->isWatching = true;
215 215
       $msg = "\$query = \"{$query}\"\n\r";
216
-      if(!empty($_POST)) {
217
-        $msg .= "\n\r" . dump($_POST, '$_POST');
216
+      if (!empty($_POST)) {
217
+        $msg .= "\n\r".dump($_POST, '$_POST');
218 218
       }
219
-      if(!empty($_GET)) {
220
-        $msg .= "\n\r" . dump($_GET, '$_GET');
219
+      if (!empty($_GET)) {
220
+        $msg .= "\n\r".dump($_GET, '$_GET');
221 221
       }
222 222
       classSupernova::$debug->warning($msg, "Watching user {$user['id']}", 399, array('base_dump' => true));
223 223
       $this->isWatching = false;
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
   public function security_query_check_bad_words($query) {
229 229
     global $user, $dm_change_legit, $mm_change_legit;
230 230
 
231
-    switch(true) {
231
+    switch (true) {
232 232
       case stripos($query, 'RUNCATE TABL') != false:
233 233
       case stripos($query, 'ROP TABL') != false:
234 234
       case stripos($query, 'ENAME TABL') != false:
@@ -239,37 +239,37 @@  discard block
 block discarded – undo
239 239
       case stripos($query, 'RPG_POINTS') != false && stripos(trim($query), 'UPDATE ') === 0 && !$dm_change_legit:
240 240
       case stripos($query, 'METAMATTER') != false && stripos(trim($query), 'UPDATE ') === 0 && !$mm_change_legit:
241 241
       case stripos($query, 'AUTHLEVEL') != false && $user['authlevel'] < 3 && stripos($query, 'SELECT') !== 0:
242
-        $report = "Hacking attempt (" . date("d.m.Y H:i:s") . " - [" . time() . "]):\n";
242
+        $report = "Hacking attempt (".date("d.m.Y H:i:s")." - [".time()."]):\n";
243 243
         $report .= ">Database Inforamation\n";
244
-        $report .= "\tID - " . $user['id'] . "\n";
245
-        $report .= "\tUser - " . $user['username'] . "\n";
246
-        $report .= "\tAuth level - " . $user['authlevel'] . "\n";
247
-        $report .= "\tAdmin Notes - " . $user['adminNotes'] . "\n";
248
-        $report .= "\tCurrent Planet - " . $user['current_planet'] . "\n";
249
-        $report .= "\tUser IP - " . $user['user_lastip'] . "\n";
250
-        $report .= "\tUser IP at Reg - " . $user['ip_at_reg'] . "\n";
251
-        $report .= "\tUser Agent- " . $_SERVER['HTTP_USER_AGENT'] . "\n";
252
-        $report .= "\tCurrent Page - " . $user['current_page'] . "\n";
253
-        $report .= "\tRegister Time - " . $user['register_time'] . "\n";
244
+        $report .= "\tID - ".$user['id']."\n";
245
+        $report .= "\tUser - ".$user['username']."\n";
246
+        $report .= "\tAuth level - ".$user['authlevel']."\n";
247
+        $report .= "\tAdmin Notes - ".$user['adminNotes']."\n";
248
+        $report .= "\tCurrent Planet - ".$user['current_planet']."\n";
249
+        $report .= "\tUser IP - ".$user['user_lastip']."\n";
250
+        $report .= "\tUser IP at Reg - ".$user['ip_at_reg']."\n";
251
+        $report .= "\tUser Agent- ".$_SERVER['HTTP_USER_AGENT']."\n";
252
+        $report .= "\tCurrent Page - ".$user['current_page']."\n";
253
+        $report .= "\tRegister Time - ".$user['register_time']."\n";
254 254
         $report .= "\n";
255 255
 
256 256
         $report .= ">Query Information\n";
257
-        $report .= "\tQuery - " . $query . "\n";
257
+        $report .= "\tQuery - ".$query."\n";
258 258
         $report .= "\n";
259 259
 
260 260
         $report .= ">\$_SERVER Information\n";
261
-        $report .= "\tIP - " . $_SERVER['REMOTE_ADDR'] . "\n";
262
-        $report .= "\tHost Name - " . $_SERVER['HTTP_HOST'] . "\n";
263
-        $report .= "\tUser Agent - " . $_SERVER['HTTP_USER_AGENT'] . "\n";
264
-        $report .= "\tRequest Method - " . $_SERVER['REQUEST_METHOD'] . "\n";
265
-        $report .= "\tCame From - " . $_SERVER['HTTP_REFERER'] . "\n";
266
-        $report .= "\tPage is - " . $_SERVER['SCRIPT_NAME'] . "\n";
267
-        $report .= "\tUses Port - " . $_SERVER['REMOTE_PORT'] . "\n";
268
-        $report .= "\tServer Protocol - " . $_SERVER['SERVER_PROTOCOL'] . "\n";
261
+        $report .= "\tIP - ".$_SERVER['REMOTE_ADDR']."\n";
262
+        $report .= "\tHost Name - ".$_SERVER['HTTP_HOST']."\n";
263
+        $report .= "\tUser Agent - ".$_SERVER['HTTP_USER_AGENT']."\n";
264
+        $report .= "\tRequest Method - ".$_SERVER['REQUEST_METHOD']."\n";
265
+        $report .= "\tCame From - ".$_SERVER['HTTP_REFERER']."\n";
266
+        $report .= "\tPage is - ".$_SERVER['SCRIPT_NAME']."\n";
267
+        $report .= "\tUses Port - ".$_SERVER['REMOTE_PORT']."\n";
268
+        $report .= "\tServer Protocol - ".$_SERVER['SERVER_PROTOCOL']."\n";
269 269
 
270 270
         $report .= "\n--------------------------------------------------------------------------------------------------\n";
271 271
 
272
-        $fp = fopen(SN_ROOT_PHYSICAL . 'badqrys.txt', 'a');
272
+        $fp = fopen(SN_ROOT_PHYSICAL.'badqrys.txt', 'a');
273 273
         fwrite($fp, $report);
274 274
         fclose($fp);
275 275
 
@@ -290,11 +290,11 @@  discard block
 block discarded – undo
290 290
     $prefix_length = strlen($this->db_prefix);
291 291
 
292 292
     $tl = array();
293
-    while($row = $this->db_fetch($query)) {
294
-      foreach($row as $table_name) {
295
-        if(strpos($table_name, $this->db_prefix) === 0) {
293
+    while ($row = $this->db_fetch($query)) {
294
+      foreach ($row as $table_name) {
295
+        if (strpos($table_name, $this->db_prefix) === 0) {
296 296
           $table_name = substr($table_name, $prefix_length);
297
-        } elseif($prefixed_only) {
297
+        } elseif ($prefixed_only) {
298 298
           continue;
299 299
         }
300 300
         // $table_name = str_replace($db_prefix, '', $table_name);
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
     $result = array();
390 390
 
391 391
     $status = explode('  ', $this->driver->mysql_stat());
392
-    foreach($status as $value) {
392
+    foreach ($status as $value) {
393 393
       $row = explode(': ', $value);
394 394
       $result[$row[0]] = $row[1];
395 395
     }
@@ -405,10 +405,10 @@  discard block
 block discarded – undo
405 405
     $result = array();
406 406
 
407 407
     $query = $this->db_sql_query('SHOW STATUS;');
408
-    if(is_bool($query)) {
408
+    if (is_bool($query)) {
409 409
       throw new Exception('Result of SHOW STATUS command is boolean - which should never happen. Connection to DB is lost?');
410 410
     }
411
-    while($row = db_fetch($query)) {
411
+    while ($row = db_fetch($query)) {
412 412
       $result[$row['Variable_name']] = $row['Value'];
413 413
     }
414 414
 
Please login to merge, or discard this patch.
admin/tools.php 2 patches
Switch Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -34,69 +34,69 @@
 block discarded – undo
34 34
 }
35 35
 
36 36
 switch($mode) {
37
-  case ADM_TOOL_CONFIG_RELOAD:
38
-    classSupernova::$config->db_loadAll();
39
-    sys_refresh_tablelist();
40
-
41
-    classSupernova::$config->db_loadItem('game_watchlist');
42
-    if(classSupernova::$config->game_watchlist) {
43
-      classSupernova::$config->game_watchlist_array = explode(';', classSupernova::$config->game_watchlist);
44
-    } else {
45
-      unset(classSupernova::$config->game_watchlist_array);
46
-    }
47
-  break;
48
-
49
-  case ADM_TOOL_MD5:
50
-    $template = gettemplate("admin/md5enc", true);
51
-    $password_seed = sys_get_param_str_unsafe('seed', SN_SYS_SEC_CHARS_ALLOWED);
52
-    $password_length = sys_get_param_int('length', 16);
53
-    $string = ($string = sys_get_param_str_unsafe('string')) ? $string : sys_random_string($password_length, $password_seed);
54
-
55
-    $template->assign_vars(array(
56
-      'SEED'   => $password_seed,
57
-      'LENGTH' => $password_length,
58
-      'STRING' => htmlentities($string),
59
-      'MD5'    => md5($string),
60
-    ));
61
-    display($template, classLocale::$lang['adm_tools_md5_header'], false, '', true);
62
-  break;
63
-
64
-  case ADM_TOOL_FORCE_ALL:
65
-    classSupernova::$config->db_saveItem('db_version', 0);
66
-    require_once('../includes/update.php');
67
-  break;
68
-
69
-  case ADM_TOOL_FORCE_LAST:
70
-    classSupernova::$config->db_saveItem('db_version', floor(classSupernova::$config->db_version - 1));
71
-    require_once('../includes/update.php');
72
-  break;
73
-
74
-  case ADM_TOOL_INFO_PHP:
75
-    phpinfo();
76
-  break;
77
-
78
-  case ADM_TOOL_INFO_SQL:
79
-    $template = gettemplate("simple_table", true);
80
-
81
-    $status = array(
82
-      classLocale::$lang['adm_tool_sql_server_version'] => classSupernova::$db->db_get_server_info(),
83
-      classLocale::$lang['adm_tool_sql_client_version'] => classSupernova::$db->db_get_client_info(),
84
-      classLocale::$lang['adm_tool_sql_host_info']      => classSupernova::$db->db_get_host_info(),
85
-    );
86
-    templateAssignTable($template, 'server', $status);
87
-
88
-    templateAssignTable($template, 'status', classSupernova::$db->db_get_server_stat());
89
-    templateAssignTable($template, 'params', classSupernova::$db->db_core_show_status());
90
-
91
-    $template->assign_vars(array(
92
-      'PAGE_HEADER'   => classLocale::$lang['adm_tool_sql_page_header'],
93
-      'COLUMN_NAME_1' => classLocale::$lang['adm_tool_sql_param_name'],
94
-      'COLUMN_NAME_2' => classLocale::$lang['adm_tool_sql_param_value'],
95
-      'TABLE_FOOTER'  => 'test',
96
-    ));
97
-
98
-    display($template, classLocale::$lang['adm_bn_ttle'], false, '', true);
99
-  break;
37
+    case ADM_TOOL_CONFIG_RELOAD:
38
+      classSupernova::$config->db_loadAll();
39
+      sys_refresh_tablelist();
40
+
41
+      classSupernova::$config->db_loadItem('game_watchlist');
42
+      if(classSupernova::$config->game_watchlist) {
43
+        classSupernova::$config->game_watchlist_array = explode(';', classSupernova::$config->game_watchlist);
44
+      } else {
45
+        unset(classSupernova::$config->game_watchlist_array);
46
+      }
47
+    break;
48
+
49
+    case ADM_TOOL_MD5:
50
+      $template = gettemplate("admin/md5enc", true);
51
+      $password_seed = sys_get_param_str_unsafe('seed', SN_SYS_SEC_CHARS_ALLOWED);
52
+      $password_length = sys_get_param_int('length', 16);
53
+      $string = ($string = sys_get_param_str_unsafe('string')) ? $string : sys_random_string($password_length, $password_seed);
54
+
55
+      $template->assign_vars(array(
56
+        'SEED'   => $password_seed,
57
+        'LENGTH' => $password_length,
58
+        'STRING' => htmlentities($string),
59
+        'MD5'    => md5($string),
60
+      ));
61
+      display($template, classLocale::$lang['adm_tools_md5_header'], false, '', true);
62
+    break;
63
+
64
+    case ADM_TOOL_FORCE_ALL:
65
+      classSupernova::$config->db_saveItem('db_version', 0);
66
+      require_once('../includes/update.php');
67
+    break;
68
+
69
+    case ADM_TOOL_FORCE_LAST:
70
+      classSupernova::$config->db_saveItem('db_version', floor(classSupernova::$config->db_version - 1));
71
+      require_once('../includes/update.php');
72
+    break;
73
+
74
+    case ADM_TOOL_INFO_PHP:
75
+      phpinfo();
76
+    break;
77
+
78
+    case ADM_TOOL_INFO_SQL:
79
+      $template = gettemplate("simple_table", true);
80
+
81
+      $status = array(
82
+        classLocale::$lang['adm_tool_sql_server_version'] => classSupernova::$db->db_get_server_info(),
83
+        classLocale::$lang['adm_tool_sql_client_version'] => classSupernova::$db->db_get_client_info(),
84
+        classLocale::$lang['adm_tool_sql_host_info']      => classSupernova::$db->db_get_host_info(),
85
+      );
86
+      templateAssignTable($template, 'server', $status);
87
+
88
+      templateAssignTable($template, 'status', classSupernova::$db->db_get_server_stat());
89
+      templateAssignTable($template, 'params', classSupernova::$db->db_core_show_status());
90
+
91
+      $template->assign_vars(array(
92
+        'PAGE_HEADER'   => classLocale::$lang['adm_tool_sql_page_header'],
93
+        'COLUMN_NAME_1' => classLocale::$lang['adm_tool_sql_param_name'],
94
+        'COLUMN_NAME_2' => classLocale::$lang['adm_tool_sql_param_value'],
95
+        'TABLE_FOOTER'  => 'test',
96
+      ));
97
+
98
+      display($template, classLocale::$lang['adm_bn_ttle'], false, '', true);
99
+    break;
100 100
 
101 101
 }
102 102
 
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -9,10 +9,10 @@  discard block
 block discarded – undo
9 9
 define('INSIDE', true);
10 10
 define('INSTALL', false);
11 11
 define('IN_ADMIN', true);
12
-require('../common.' . substr(strrchr(__FILE__, '.'), 1));
12
+require('../common.'.substr(strrchr(__FILE__, '.'), 1));
13 13
 
14 14
 // if($user['authlevel'] < 1)
15
-if($user['authlevel'] < 3) {
15
+if ($user['authlevel'] < 3) {
16 16
   AdminMessage(classLocale::$lang['adm_err_denied']);
17 17
 }
18 18
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function templateAssignTable($template, $str, $status) {
27 27
   $template->assign_block_vars('table', classLocale::$lang['adm_tool_sql_table'][$str]);
28
-  foreach($status as $key => $value) {
28
+  foreach ($status as $key => $value) {
29 29
     $template->assign_block_vars('table.row', array(
30 30
       'VALUE_1' => $key,
31 31
       'VALUE_2' => $value,
@@ -33,13 +33,13 @@  discard block
 block discarded – undo
33 33
   }
34 34
 }
35 35
 
36
-switch($mode) {
36
+switch ($mode) {
37 37
   case ADM_TOOL_CONFIG_RELOAD:
38 38
     classSupernova::$config->db_loadAll();
39 39
     sys_refresh_tablelist();
40 40
 
41 41
     classSupernova::$config->db_loadItem('game_watchlist');
42
-    if(classSupernova::$config->game_watchlist) {
42
+    if (classSupernova::$config->game_watchlist) {
43 43
       classSupernova::$config->game_watchlist_array = explode(';', classSupernova::$config->game_watchlist);
44 44
     } else {
45 45
       unset(classSupernova::$config->game_watchlist_array);
Please login to merge, or discard this patch.
includes/classes/Vector.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@
 block discarded – undo
10 10
   /**
11 11
    * UniverseVector constructor.
12 12
    *
13
-   * @param int|string       $galaxy
14
-   * @param int|Vector|array $system
13
+   * @param integer       $galaxy
14
+   * @param integer $system
15 15
    * @param int              $planet
16 16
    * @param int              $type
17 17
    */
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
   public $type = PT_NONE;
14 14
 
15 15
   public static function _staticInit() {
16
-    if(static::$_isStaticInit) {
16
+    if (static::$_isStaticInit) {
17 17
       return;
18 18
     }
19 19
     static::$knownGalaxies = intval(classSupernova::$config->game_maxGalaxy);
@@ -33,9 +33,9 @@  discard block
 block discarded – undo
33 33
   public function __construct($galaxy = 0, $system = 0, $planet = 0, $type = PT_NONE) {
34 34
     // static::_staticInit();
35 35
 
36
-    if(is_string($galaxy) && $galaxy == VECTOR_READ_VECTOR && is_object($system) && $system instanceof Vector) {
36
+    if (is_string($galaxy) && $galaxy == VECTOR_READ_VECTOR && is_object($system) && $system instanceof Vector) {
37 37
       $this->readFromVector($system);
38
-    } elseif(is_string($galaxy) && $galaxy == VECTOR_READ_PARAMS && is_array($system)) {
38
+    } elseif (is_string($galaxy) && $galaxy == VECTOR_READ_PARAMS && is_array($system)) {
39 39
       $this->readFromParamFleets($system);
40 40
     } else {
41 41
       $this->galaxy = intval($galaxy);
@@ -74,11 +74,11 @@  discard block
 block discarded – undo
74 74
    * @param Vector $vector
75 75
    */
76 76
   public function distance($vector) {
77
-    if($this->galaxy != $vector->galaxy) {
77
+    if ($this->galaxy != $vector->galaxy) {
78 78
       $distance = abs($this->galaxy - $vector->galaxy) * classSupernova::$config->uni_galaxy_distance;
79
-    } elseif($this->system != $vector->system) {
79
+    } elseif ($this->system != $vector->system) {
80 80
       $distance = abs($this->system - $vector->system) * 5 * 19 + 2700;
81
-    } elseif($this->planet != $vector->planet) {
81
+    } elseif ($this->planet != $vector->planet) {
82 82
       $distance = abs($this->planet - $vector->planet) * 5 + 1000;
83 83
       // TODO - uncomment
84 84
 //    } elseif($this->type != PT_NONE && $vector->type != PT_NONE && $this->type == $vector->type) {
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
    * @param array $coordinates
102 102
    */
103 103
   public static function convertToVector($coordinates, $prefix = '') {
104
-    $galaxy = !empty($coordinates[$prefix . 'galaxy']) ? intval($coordinates[$prefix . 'galaxy']) : 0;
105
-    $system = !empty($coordinates[$prefix . 'system']) ? intval($coordinates[$prefix . 'system']) : 0;
106
-    $planet = !empty($coordinates[$prefix . 'planet']) ? intval($coordinates[$prefix . 'planet']) : 0;
107
-    $type = !empty($coordinates[$prefix . 'type'])
108
-      ? intval($coordinates[$prefix . 'type'])
109
-      : (!empty($coordinates[$prefix . 'planet_type']) ? intval($coordinates[$prefix . 'planet_type']) : 0);
104
+    $galaxy = !empty($coordinates[$prefix.'galaxy']) ? intval($coordinates[$prefix.'galaxy']) : 0;
105
+    $system = !empty($coordinates[$prefix.'system']) ? intval($coordinates[$prefix.'system']) : 0;
106
+    $planet = !empty($coordinates[$prefix.'planet']) ? intval($coordinates[$prefix.'planet']) : 0;
107
+    $type = !empty($coordinates[$prefix.'type'])
108
+      ? intval($coordinates[$prefix.'type'])
109
+      : (!empty($coordinates[$prefix.'planet_type']) ? intval($coordinates[$prefix.'planet_type']) : 0);
110 110
 
111 111
     return new static($galaxy, $system, $planet, $type);
112 112
   }
Please login to merge, or discard this patch.
includes/classes/Player.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -228,8 +228,8 @@  discard block
 block discarded – undo
228 228
    * @return int|mixed
229 229
    */
230 230
   public function calcColonyMaxCount($astrotech = -1) {
231
-    if($astrotech == -1) {
232
-      if(!isset($this->_dbRow[UNIT_PLAYER_COLONIES_MAX])) {
231
+    if ($astrotech == -1) {
232
+      if (!isset($this->_dbRow[UNIT_PLAYER_COLONIES_MAX])) {
233 233
 
234 234
         $expeditions = get_player_max_expeditons($this->_dbRow);
235 235
         $astrotech = mrc_get_level($this->_dbRow, null, TECH_ASTROTECH);
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 
303 303
 
304 304
   public function expeditionsMax() {
305
-    if($this->expeditionsMax === null) {
305
+    if ($this->expeditionsMax === null) {
306 306
       $this->expeditionsMax = get_player_max_expeditons($this->_dbRow);
307 307
     }
308 308
 
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
   }
311 311
 
312 312
   public function expeditionsFlying() {
313
-    if($this->expeditionsFlying === null) {
313
+    if ($this->expeditionsFlying === null) {
314 314
       $this->expeditionsFlying = FleetList::fleet_count_flying($this->_dbId, MT_EXPLORE);
315 315
     }
316 316
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 
320 320
 
321 321
   public function fleetsMax() {
322
-    if($this->fleetMax === null) {
322
+    if ($this->fleetMax === null) {
323 323
       $this->fleetMax = GetMaxFleets($this->_dbRow);
324 324
     }
325 325
 
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
   }
328 328
 
329 329
   public function fleetsFlying() {
330
-    if($this->fleetFlying === null) {
330
+    if ($this->fleetFlying === null) {
331 331
       $this->fleetFlying = FleetList::fleet_count_flying($this->_dbId);
332 332
     }
333 333
 
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
 
337 337
 
338 338
   public function coloniesMax() {
339
-    if($this->coloniesMax === null) {
339
+    if ($this->coloniesMax === null) {
340 340
       $this->coloniesMax = get_player_max_colonies($this->_dbRow);
341 341
     }
342 342
 
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
   }
345 345
 
346 346
   public function coloniesCurrent() {
347
-    if($this->coloniesCurrent === null) {
347
+    if ($this->coloniesCurrent === null) {
348 348
       $this->coloniesCurrent = get_player_current_colonies($this->_dbRow);
349 349
     }
350 350
 
Please login to merge, or discard this patch.
includes/includes/flt_page5.inc 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 *
13 13
 **/
14 14
 
15
-if(SN_IN_FLEET !== true) {
15
+if (SN_IN_FLEET !== true) {
16 16
   $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403);
17 17
 }
18 18
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 
26 26
   $planet_list = array();
27 27
 
28
-  if(is_array($resources_taken))
28
+  if (is_array($resources_taken))
29 29
   {
30 30
     $query = implode(',', array_keys($resources_taken));
31 31
     $query = " AND `destruyed` = 0 AND `id` IN ({$query})";
@@ -33,16 +33,16 @@  discard block
 block discarded – undo
33 33
     $query = '';
34 34
   }
35 35
 
36
-  foreach(sn_get_groups('flt_transports') as $transport_id) {
36
+  foreach (sn_get_groups('flt_transports') as $transport_id) {
37 37
     $transports[$transport_id] = get_unit_param($transport_id, P_CAPACITY);
38 38
   }
39 39
   arsort($transports);
40 40
 
41 41
   $planets_db_list = db_planet_list_sorted($user, $planetrow['id'], '*', $query);
42 42
   !is_array($planets_db_list) ? $planets_db_list = array() : false;
43
-  foreach($planets_db_list as $planet_db_data) {
43
+  foreach ($planets_db_list as $planet_db_data) {
44 44
   // begin planet loop
45
-    if(!$query) {
45
+    if (!$query) {
46 46
       $resources_taken[$planet_db_data['id']] = 1;
47 47
     }
48 48
     sn_db_transaction_start();
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
     $planet_id = $planet_db_data['id'];
55 55
 
56 56
     $planet_resources = 0;
57
-    foreach(sn_get_groups('resources_loot') as $resource_id) {
58
-      if($resources_taken[$planet_id] == 1 || $resources_taken[$planet_id][$resource_id]) {
57
+    foreach (sn_get_groups('resources_loot') as $resource_id) {
58
+      if ($resources_taken[$planet_id] == 1 || $resources_taken[$planet_id][$resource_id]) {
59 59
         $planet_resources += floor(mrc_get_level($user, $planet_db_data, $resource_id, true, true)); // $planet_db_data[get_unit_param($resource_id, P_NAME)]);
60 60
       }
61 61
     }
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
     $fleet_capacity = 0;
87 87
     $ship_loadout = array();
88 88
     $fleet = array();
89
-    foreach($transports as $ship_id => $ship_capacity) {
90
-      if($ship_count = mrc_get_level($user, $planet_db_data, $ship_id, true, true)) {
89
+    foreach ($transports as $ship_id => $ship_capacity) {
90
+      if ($ship_count = mrc_get_level($user, $planet_db_data, $ship_id, true, true)) {
91 91
         $ship_loadout[$ship_id]['capacity'] = $ship_count * $ship_capacity;
92 92
         $ship_loadout[$ship_id]['taken'] = 0;
93 93
         $fleet_capacity += $ship_loadout[$ship_id]['capacity'];
@@ -98,9 +98,9 @@  discard block
 block discarded – undo
98 98
 
99 99
     $will_take = min($planet_resources, $fleet_capacity);
100 100
 
101
-    foreach($ship_loadout as $ship_id => &$planet_ship) {
101
+    foreach ($ship_loadout as $ship_id => &$planet_ship) {
102 102
       $can_take = min($will_take, $planet_ship['capacity']);
103
-      if($can_take <= 0) {
103
+      if ($can_take <= 0) {
104 104
         continue;
105 105
       }
106 106
       $planet_ship['capacity'] -= $can_take;
@@ -108,23 +108,23 @@  discard block
 block discarded – undo
108 108
       $fleet[$ship_id] = ceil($planet_ship['taken'] / $transports[$ship_id]);
109 109
 
110 110
       $will_take -= $can_take;
111
-      if($will_take <= 0) {
111
+      if ($will_take <= 0) {
112 112
         break;
113 113
       }
114 114
     }
115 115
 
116
-    if(!empty($fleet)) {
116
+    if (!empty($fleet)) {
117 117
       $travel_data = flt_travel_data($user, $planetrow, $planet_db_data, $fleet, 10);
118 118
       $planet_data['FLEET_SPEED'] = $travel_data['fleet_speed'];
119 119
       $planet_data['DISTANCE']    = $travel_data['distance'];
120 120
       $planet_data['DURATION']    = $travel_data['duration'];
121 121
       $planet_data['CONSUMPTION'] = $travel_data['consumption'];
122 122
 
123
-      if(floor(mrc_get_level($user, $planet_db_data, RES_DEUTERIUM, true)) >= $planet_data['CONSUMPTION']) {
123
+      if (floor(mrc_get_level($user, $planet_db_data, RES_DEUTERIUM, true)) >= $planet_data['CONSUMPTION']) {
124 124
         $will_take = min($planet_resources, $fleet_capacity) - $planet_data['CONSUMPTION'];
125 125
 
126
-        foreach(sn_get_groups('resources_loot') as $resource_id) {
127
-          if($resources_taken[$planet_id] != 1 && !$resources_taken[$planet_id][$resource_id]) {
126
+        foreach (sn_get_groups('resources_loot') as $resource_id) {
127
+          if ($resources_taken[$planet_id] != 1 && !$resources_taken[$planet_id][$resource_id]) {
128 128
             continue;
129 129
           }
130 130
 
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
           $fleet[$resource_id] = min($will_take, $resource_amount);
134 134
           $will_take -= $resource_amount;
135 135
 
136
-          if($will_take <= 0) {
136
+          if ($will_take <= 0) {
137 137
             break;
138 138
           }
139 139
         }
@@ -157,19 +157,19 @@  discard block
 block discarded – undo
157 157
 
158 158
 $resources_taken = sys_get_param('resources');
159 159
 
160
-if(!empty($resources_taken))  { // begin processing parameters
160
+if (!empty($resources_taken)) { // begin processing parameters
161 161
   $planet_list = flt_build_gathering($resources_taken);
162 162
 
163
-  foreach($planet_list as $planet_id => $planet_data) {
164
-    if($planet_data['RESULT'] == FLIGHT_ALLOWED) {
163
+  foreach ($planet_list as $planet_id => $planet_data) {
164
+    if ($planet_data['RESULT'] == FLIGHT_ALLOWED) {
165 165
       $planet_data['RESULT'] = flt_t_send_fleet($user, $planet_data['PLANET_DB_DATA'], $planetrow, $planet_data['FLEET'], MT_TRANSPORT);
166 166
     }
167 167
 
168 168
     $planet_data['MESSAGE'] = classLocale::$lang['fl_attack_error'][$planet_data['RESULT']];
169 169
 
170 170
     $template->assign_block_vars('results', $planet_data);
171
-    if(!empty($planet_data['FLEET']) && $planet_data['RESULT'] == FLIGHT_ALLOWED) {
172
-      foreach($planet_data['FLEET'] as $unit_id => $amount) {
171
+    if (!empty($planet_data['FLEET']) && $planet_data['RESULT'] == FLIGHT_ALLOWED) {
172
+      foreach ($planet_data['FLEET'] as $unit_id => $amount) {
173 173
         $template->assign_block_vars('results.units', array(
174 174
           'ID'     => $unit_id,
175 175
           'NAME'   => classLocale::$lang['tech'][$unit_id],
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 
183 183
 // Building list of own planets & moons
184 184
 $planet_list = flt_build_gathering();
185
-foreach($planet_list as $planet_data) {
185
+foreach ($planet_list as $planet_data) {
186 186
   $planet_data['DURATION'] = $planet_data['DURATION'] ? pretty_time($planet_data['DURATION']) : classLocale::$lang['flt_no_fuel'];
187 187
   $template->assign_block_vars('colonies', $planet_data);
188 188
 }
Please login to merge, or discard this patch.
includes/general.php 2 patches
Doc Comments   +27 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 require_once('general_pname.php');
13 13
 
14 14
 /**
15
- * @param       $func_name
15
+ * @param       string $func_name
16 16
  * @param array $func_arg
17 17
  *
18 18
  * @return mixed
@@ -63,6 +63,9 @@  discard block
 block discarded – undo
63 63
 
64 64
 // ----------------------------------------------------------------------------------------------------------------
65 65
 // Fonction de lecture / ecriture / exploitation de templates
66
+/**
67
+ * @param string $filename
68
+ */
66 69
 function sys_file_read($filename) {
67 70
   return @file_get_contents($filename);
68 71
 }
@@ -105,7 +108,7 @@  discard block
 block discarded – undo
105 108
 /**
106 109
  * Получение курса обмены валюты в серверную валюту
107 110
  *
108
- * @param $currency_symbol
111
+ * @param string $currency_symbol
109 112
  *
110 113
  * @return float
111 114
  */
@@ -146,7 +149,7 @@  discard block
 block discarded – undo
146 149
  * @param float     $n
147 150
  * @param int|bool  $floor
148 151
  * @param int|bool  $color
149
- * @param int|bool  $limit
152
+ * @param boolean  $limit
150 153
  * @param bool|null $style
151 154
  *
152 155
  * @return array|float|string
@@ -247,6 +250,9 @@  discard block
 block discarded – undo
247 250
   return preg_replace($ListCensure, '*', $String);
248 251
 }
249 252
 
253
+/**
254
+ * @param string $email
255
+ */
250 256
 function is_email($email) {
251 257
   return (preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i", $email));
252 258
 }
@@ -283,6 +289,9 @@  discard block
 block discarded – undo
283 289
   return floatval(sys_get_param($param_name, $default));
284 290
 }
285 291
 
292
+/**
293
+ * @param string $param_name
294
+ */
286 295
 function sys_get_param_escaped($param_name, $default = '') {
287 296
   return db_escape(sys_get_param($param_name, $default));
288 297
 }
@@ -515,6 +524,9 @@  discard block
 block discarded – undo
515 524
 }
516 525
 
517 526
 // Generates random string of $length symbols from $allowed_chars charset
527
+/**
528
+ * @param string $allowed_chars
529
+ */
518 530
 function sys_random_string($length = 16, $allowed_chars = SN_SYS_SEC_CHARS_ALLOWED) {
519 531
   $allowed_length = strlen($allowed_chars);
520 532
 
@@ -619,6 +631,9 @@  discard block
 block discarded – undo
619 631
   return implode(';', $fleet_string);
620 632
 }
621 633
 
634
+/**
635
+ * @param string $body
636
+ */
622 637
 function mymail($email_unsafe, $title, $body, $from = '', $html = false) {
623 638
   $from = trim($from ? $from : classSupernova::$config->game_adminEmail);
624 639
 
@@ -873,6 +888,9 @@  discard block
 block discarded – undo
873 888
   return serialize($nick_array);
874 889
 }
875 890
 
891
+/**
892
+ * @param string $nick_string
893
+ */
876 894
 function player_nick_uncompact($nick_string) {
877 895
   try {
878 896
     $result = unserialize($nick_string);
@@ -1120,6 +1138,9 @@  discard block
 block discarded – undo
1120 1138
   return $ranks;
1121 1139
 }
1122 1140
 
1141
+/**
1142
+ * @param boolean $planet_id
1143
+ */
1123 1144
 function sys_player_new_adjust($user_id, $planet_id) { return sn_function_call(__FUNCTION__, array($user_id, $planet_id, &$result)); }
1124 1145
 
1125 1146
 function sn_sys_player_new_adjust($user_id, $planet_id, &$result) {
@@ -1430,6 +1451,9 @@  discard block
 block discarded – undo
1430 1451
   return version_compare(sn_version_compare_extra($ver1), sn_version_compare_extra($ver2));
1431 1452
 }
1432 1453
 
1454
+/**
1455
+ * @param string $name
1456
+ */
1433 1457
 function sn_setcookie($name, $value = null, $expire = null, $path = SN_ROOT_RELATIVE, $domain = null, $secure = null, $httponly = null) {
1434 1458
   $_COOKIE[$name] = $value;
1435 1459
 
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     }
37 37
   } else {
38 38
     // TODO: This is left for backward compatibility. Appropriate code should be rewrote!
39
-    $func_name = isset(classSupernova::$functions[$func_name]) && is_callable(classSupernova::$functions[$func_name]) ? classSupernova::$functions[$func_name] : ('sn_' . $func_name);
39
+    $func_name = isset(classSupernova::$functions[$func_name]) && is_callable(classSupernova::$functions[$func_name]) ? classSupernova::$functions[$func_name] : ('sn_'.$func_name);
40 40
     if (is_callable($func_name)) {
41 41
       $result = call_user_func_array($func_name, $func_arg);
42 42
     }
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
  */
112 112
 function get_exchange_rate($currency_symbol) {
113 113
   $currency_symbol = strtolower($currency_symbol);
114
-  $config_field = 'payment_currency_exchange_' . $currency_symbol;
114
+  $config_field = 'payment_currency_exchange_'.$currency_symbol;
115 115
 
116 116
   // Заворачиваем получение стоимости ММ через перекрываемую процедуру
117 117
   $exchange_rate = floatval($currency_symbol == 'mm_' ? get_mm_cost() : classSupernova::$config->$config_field);
@@ -623,8 +623,8 @@  discard block
 block discarded – undo
623 623
   $from = trim($from ? $from : classSupernova::$config->game_adminEmail);
624 624
 
625 625
   $head = '';
626
-  $head .= "Content-Type: text/" . ($html ? 'html' : 'plain') . "; charset=utf-8 \r\n";
627
-  $head .= "Date: " . date('r') . " \r\n";
626
+  $head .= "Content-Type: text/".($html ? 'html' : 'plain')."; charset=utf-8 \r\n";
627
+  $head .= "Date: ".date('r')." \r\n";
628 628
   $classConfig = classSupernova::$config;
629 629
   $head .= "Return-Path: {$classConfig->game_adminEmail} \r\n";
630 630
   $head .= "From: {$from} \r\n";
@@ -637,10 +637,10 @@  discard block
 block discarded – undo
637 637
   $body = str_replace("\n", "\r\n", $body);
638 638
 
639 639
   if ($html) {
640
-    $body = '<html><head><base href="' . SN_ROOT_VIRTUAL . '"></head><body>' . nl2br($body) . '</body></html>';
640
+    $body = '<html><head><base href="'.SN_ROOT_VIRTUAL.'"></head><body>'.nl2br($body).'</body></html>';
641 641
   }
642 642
 
643
-  $title = '=?UTF-8?B?' . base64_encode($title) . '?=';
643
+  $title = '=?UTF-8?B?'.base64_encode($title).'?=';
644 644
 
645 645
   return @mail($email_unsafe, $title, $body, $head);
646 646
 }
@@ -656,14 +656,14 @@  discard block
 block discarded – undo
656 656
   $classLocale = classLocale::$lang;
657 657
 
658 658
   return
659
-    ($full || $time ? "{$time} {$classLocale['sys_day']}&nbsp;" : '') .
660
-    ($full || $hours ? "{$hours} {$classLocale['sys_hrs']}&nbsp;" : '') .
661
-    ($full || $minutes ? "{$minutes} {$classLocale['sys_min']}&nbsp;" : '') .
659
+    ($full || $time ? "{$time} {$classLocale['sys_day']}&nbsp;" : '').
660
+    ($full || $hours ? "{$hours} {$classLocale['sys_hrs']}&nbsp;" : '').
661
+    ($full || $minutes ? "{$minutes} {$classLocale['sys_min']}&nbsp;" : '').
662 662
     ($full || !$time || $seconds ? "{$seconds} {$classLocale['sys_sec']}" : '');
663 663
 }
664 664
 
665 665
 function sys_time_human_system($time) {
666
-  return $time ? date(FMT_DATE_TIME_SQL, $time) . " ({$time}), " . sys_time_human(SN_TIME_NOW - $time) : '{NEVER}';
666
+  return $time ? date(FMT_DATE_TIME_SQL, $time)." ({$time}), ".sys_time_human(SN_TIME_NOW - $time) : '{NEVER}';
667 667
 }
668 668
 
669 669
 function sys_redirect($url) {
@@ -756,13 +756,13 @@  discard block
 block discarded – undo
756 756
       // usw..
757 757
     );
758 758
 
759
-    $rexep = "#" . strtr(preg_quote($format), $masks) . "#";
759
+    $rexep = "#".strtr(preg_quote($format), $masks)."#";
760 760
     if (preg_match($rexep, $date, $out)) {
761 761
       $ret = array(
762
-        "tm_sec"  => (int)$out['S'],
763
-        "tm_min"  => (int)$out['M'],
764
-        "tm_hour" => (int)$out['H'],
765
-        "tm_mday" => (int)$out['d'],
762
+        "tm_sec"  => (int) $out['S'],
763
+        "tm_min"  => (int) $out['M'],
764
+        "tm_hour" => (int) $out['H'],
765
+        "tm_mday" => (int) $out['d'],
766 766
         "tm_mon"  => $out['m'] ? $out['m'] - 1 : 0,
767 767
         "tm_year" => $out['Y'] > 1900 ? $out['Y'] - 1900 : 0,
768 768
       );
@@ -832,7 +832,7 @@  discard block
 block discarded – undo
832 832
         $functions[$function_name] = array();
833 833
       } elseif (!isset($functions[$function_name])) {
834 834
         $functions[$function_name] = array();
835
-        $sn_function_name = 'sn_' . $function_name . ($sub_type ? '_' . $sub_type : '');
835
+        $sn_function_name = 'sn_'.$function_name.($sub_type ? '_'.$sub_type : '');
836 836
         $functions[$function_name][] = $sn_function_name;
837 837
       }
838 838
 
@@ -899,7 +899,7 @@  discard block
 block discarded – undo
899 899
   }
900 900
 
901 901
   if (isset($nick_array[NICK_GENDER])) {
902
-    $result[NICK_GENDER] = '<img src="' . ($user['dpath'] ? $user['dpath'] : DEFAULT_SKINPATH) . 'images/gender_' . $nick_array[NICK_GENDER] . '.png" />';
902
+    $result[NICK_GENDER] = '<img src="'.($user['dpath'] ? $user['dpath'] : DEFAULT_SKINPATH).'images/gender_'.$nick_array[NICK_GENDER].'.png" />';
903 903
   }
904 904
 
905 905
   if (isset($nick_array[NICK_AUTH_LEVEL]) || isset($nick_array[NICK_PREMIUM])) {
@@ -931,14 +931,14 @@  discard block
 block discarded – undo
931 931
   }
932 932
 
933 933
   if (isset($nick_array[NICK_CLASS])) {
934
-    $result[NICK_CLASS] = '<span ' . $nick_array[NICK_CLASS] . '>';
934
+    $result[NICK_CLASS] = '<span '.$nick_array[NICK_CLASS].'>';
935 935
     $result[NICK_CLASS_END] = '</span>';
936 936
   }
937 937
 
938 938
   $result[NICK_NICK] = sys_safe_output($nick_array[NICK_NICK]);
939 939
 
940 940
   if (isset($nick_array[NICK_ALLY])) {
941
-    $result[NICK_ALLY] = '[' . sys_safe_output($nick_array[NICK_ALLY]) . ']';
941
+    $result[NICK_ALLY] = '['.sys_safe_output($nick_array[NICK_ALLY]).']';
942 942
   }
943 943
 
944 944
   $result[NICK_HTML] = true;
@@ -961,7 +961,7 @@  discard block
 block discarded – undo
961 961
   */
962 962
 
963 963
 
964
-  if ($render_user['user_birthday'] && ($options === true || isset($options['icons']) || isset($options['birthday'])) && (date('Y', SN_TIME_NOW) . date('-m-d', strtotime($render_user['user_birthday'])) == date('Y-m-d', SN_TIME_NOW))) {
964
+  if ($render_user['user_birthday'] && ($options === true || isset($options['icons']) || isset($options['birthday'])) && (date('Y', SN_TIME_NOW).date('-m-d', strtotime($render_user['user_birthday'])) == date('Y-m-d', SN_TIME_NOW))) {
965 965
     $result[NICK_BIRTHSDAY] = '';
966 966
   }
967 967
 
@@ -983,7 +983,7 @@  discard block
 block discarded – undo
983 983
   }
984 984
 
985 985
   if ((isset($options['class']) && $options['class'])) {
986
-    $result[NICK_CLASS] = (isset($result_options[NICK_CLASS]) ? ' ' . $result_options[NICK_CLASS] : '') . $options['class'];
986
+    $result[NICK_CLASS] = (isset($result_options[NICK_CLASS]) ? ' '.$result_options[NICK_CLASS] : '').$options['class'];
987 987
   }
988 988
 
989 989
   if ($render_user['ally_tag'] && ($options === true || (isset($options['ally']) && $options['ally']))) {
@@ -1011,7 +1011,7 @@  discard block
 block discarded – undo
1011 1011
     foreach ($temp as $user_id) {
1012 1012
       $user_id = floatval($user_id);
1013 1013
       if ($user_id) {
1014
-        $user_skip_list[] = '`id` = ' . $user_id;
1014
+        $user_skip_list[] = '`id` = '.$user_id;
1015 1015
       }
1016 1016
     }
1017 1017
   }
@@ -1410,7 +1410,7 @@  discard block
 block discarded – undo
1410 1410
     $time_left = min(floor($time_left / PERIOD_DAY), $term_original);
1411 1411
     $cost_left = $term_original > 0 ? ceil($time_left / $term_original * $original_cost) : 0;
1412 1412
 
1413
-    array_walk_recursive($result, function (&$value) use ($cost_left) {
1413
+    array_walk_recursive($result, function(&$value) use ($cost_left) {
1414 1414
       $value -= $cost_left;
1415 1415
     });
1416 1416
   }
@@ -1465,7 +1465,7 @@  discard block
 block discarded – undo
1465 1465
 }
1466 1466
 
1467 1467
 function print_rr($var, $capture = false) {
1468
-  $print = '<pre>' . htmlspecialchars(print_r($var, true)) . '</pre>';
1468
+  $print = '<pre>'.htmlspecialchars(print_r($var, true)).'</pre>';
1469 1469
   if ($capture) {
1470 1470
     return $print;
1471 1471
   } else {
@@ -1567,7 +1567,7 @@  discard block
 block discarded – undo
1567 1567
       break;
1568 1568
     }
1569 1569
     $sort_option_inverse_closure = $sort_option_inverse ? -1 : 1;
1570
-    usort($ListToSort, function ($a, $b) use ($sort_option_field, $sort_option_inverse_closure) {
1570
+    usort($ListToSort, function($a, $b) use ($sort_option_field, $sort_option_inverse_closure) {
1571 1571
       return $a[$sort_option_field] < $b[$sort_option_field] ? -1 * $sort_option_inverse_closure : (
1572 1572
       $a[$sort_option_field] > $b[$sort_option_field] ? 1 * $sort_option_inverse_closure : 0
1573 1573
       );
Please login to merge, or discard this patch.
includes/classes/Fleet.php 2 patches
Doc Comments   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
   /**
973 973
    * Set current resource list from array of units
974 974
    *
975
-   * @param array $resource_list
975
+   * @param integer[] $resource_list
976 976
    */
977 977
   public function resourcesSet($resource_list) {
978 978
     if (!empty($this->propertiesAdjusted['resource_list'])) {
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
   }
1021 1021
 
1022 1022
   /**
1023
-   * @param array $rate
1023
+   * @param integer[] $rate
1024 1024
    *
1025 1025
    * @return float
1026 1026
    */
@@ -1051,7 +1051,6 @@  discard block
 block discarded – undo
1051 1051
    * Restores fleet or resources to planet
1052 1052
    *
1053 1053
    * @param bool $start
1054
-   * @param bool $only_resources
1055 1054
    * @param int  $result
1056 1055
    *
1057 1056
    * @return int
@@ -1205,6 +1204,9 @@  discard block
 block discarded – undo
1205 1204
   }
1206 1205
 
1207 1206
 
1207
+  /**
1208
+   * @param integer $missionStartTimeStamp
1209
+   */
1208 1210
   protected function renderFleetCoordinates($missionStartTimeStamp = SN_TIME_NOW, $timeMissionJob = 0) {
1209 1211
     $timeToReturn = $this->travelData['duration'] * 2 + $timeMissionJob;
1210 1212
 
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -398,31 +398,31 @@  discard block
 block discarded – undo
398 398
 
399 399
     return doquery(
400 400
     // Блокировка самого флота
401
-      "SELECT 1 FROM {{fleets}} AS f " .
401
+      "SELECT 1 FROM {{fleets}} AS f ".
402 402
 
403 403
       // Блокировка всех юнитов, принадлежащих этому флоту
404
-      "LEFT JOIN {{unit}} as unit ON unit.unit_location_type = " . static::$locationType . " AND unit.unit_location_id = f.fleet_id " .
404
+      "LEFT JOIN {{unit}} as unit ON unit.unit_location_type = ".static::$locationType." AND unit.unit_location_id = f.fleet_id ".
405 405
 
406 406
       // Блокировка всех прилетающих и улетающих флотов, если нужно
407 407
       // TODO - lock fleets by COORDINATES
408
-      ($mission_data['dst_fleets'] ? "LEFT JOIN {{fleets}} AS fd ON fd.fleet_end_planet_id = f.fleet_end_planet_id OR fd.fleet_start_planet_id = f.fleet_end_planet_id " : '') .
408
+      ($mission_data['dst_fleets'] ? "LEFT JOIN {{fleets}} AS fd ON fd.fleet_end_planet_id = f.fleet_end_planet_id OR fd.fleet_start_planet_id = f.fleet_end_planet_id " : '').
409 409
       // Блокировка всех юнитов, принадлежащих прилетающим и улетающим флотам - ufd = unit_fleet_destination
410
-      ($mission_data['dst_fleets'] ? "LEFT JOIN {{unit}} AS ufd ON ufd.unit_location_type = " . static::$locationType . " AND ufd.unit_location_id = fd.fleet_id " : '') .
410
+      ($mission_data['dst_fleets'] ? "LEFT JOIN {{unit}} AS ufd ON ufd.unit_location_type = ".static::$locationType." AND ufd.unit_location_id = fd.fleet_id " : '').
411 411
 
412
-      ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{users}} AS ud ON ud.id = f.fleet_target_owner " : '') .
412
+      ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{users}} AS ud ON ud.id = f.fleet_target_owner " : '').
413 413
       // Блокировка всех юнитов, принадлежащих владельцу планеты-цели
414
-      ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS unit_player_dest ON unit_player_dest.unit_player_id = ud.id " : '') .
414
+      ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS unit_player_dest ON unit_player_dest.unit_player_id = ud.id " : '').
415 415
       // Блокировка планеты-цели
416
-      ($mission_data['dst_planet'] ? "LEFT JOIN {{planets}} AS pd ON pd.id = f.fleet_end_planet_id " : '') .
416
+      ($mission_data['dst_planet'] ? "LEFT JOIN {{planets}} AS pd ON pd.id = f.fleet_end_planet_id " : '').
417 417
       // Блокировка всех юнитов, принадлежащих планете-цели - НЕ НУЖНО. Уже залочили ранее, как принадлежащие игроку-цели
418 418
 //      ($mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS upd ON upd.unit_location_type = " . LOC_PLANET . " AND upd.unit_location_id = pd.id " : '') .
419 419
 
420 420
 
421
-      ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{users}} AS us ON us.id = f.fleet_owner " : '') .
421
+      ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{users}} AS us ON us.id = f.fleet_owner " : '').
422 422
       // Блокировка всех юнитов, принадлежащих владельцу флота
423
-      ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS unit_player_src ON unit_player_src.unit_player_id = us.id " : '') .
423
+      ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS unit_player_src ON unit_player_src.unit_player_id = us.id " : '').
424 424
       // Блокировка планеты отправления
425
-      ($mission_data['src_planet'] ? "LEFT JOIN {{planets}} AS ps ON ps.id = f.fleet_start_planet_id " : '') .
425
+      ($mission_data['src_planet'] ? "LEFT JOIN {{planets}} AS ps ON ps.id = f.fleet_start_planet_id " : '').
426 426
       // Блокировка всех юнитов, принадлежащих планете с которой юниты были отправлены - НЕ НУЖНО. Уже залочили ранее, как принадлежащие владельцу флота
427 427
 //      ($mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS ups ON ups.unit_location_type = " . LOC_PLANET . " AND ups.unit_location_id = ps.id " : '') .
428 428
 
@@ -439,11 +439,11 @@  discard block
 block discarded – undo
439 439
   public function dbGetLockById($dbId) {
440 440
     doquery(
441 441
     // Блокировка самого флота
442
-      "SELECT 1 FROM {{fleets}} AS FLEET0 " .
442
+      "SELECT 1 FROM {{fleets}} AS FLEET0 ".
443 443
       // Lock fleet owner
444
-      "LEFT JOIN {{users}} as USER0 on USER0.id = FLEET0.fleet_owner " .
444
+      "LEFT JOIN {{users}} as USER0 on USER0.id = FLEET0.fleet_owner ".
445 445
       // Блокировка всех юнитов, принадлежащих этому флоту
446
-      "LEFT JOIN {{unit}} as UNIT0 ON UNIT0.unit_location_type = " . LOC_FLEET . " AND UNIT0.unit_location_id = FLEET0.fleet_id " .
446
+      "LEFT JOIN {{unit}} as UNIT0 ON UNIT0.unit_location_type = ".LOC_FLEET." AND UNIT0.unit_location_id = FLEET0.fleet_id ".
447 447
 
448 448
       // Без предварительной выборки неизвестно - куда летит этот флот.
449 449
       // Поэтому надо выбирать флоты, чьи координаты прибытия ИЛИ отбытия совпадают с координатами прибытия ИЛИ отбытия текущего флота.
@@ -459,9 +459,9 @@  discard block
 block discarded – undo
459 459
         FLEET1.fleet_end_planet = FLEET0.fleet_end_planet
460 460
       " .
461 461
       // Блокировка всех юнитов, принадлежащих этим флотам
462
-      "LEFT JOIN {{unit}} as UNIT1 ON UNIT1.unit_location_type = " . LOC_FLEET . " AND UNIT1.unit_location_id = FLEET1.fleet_id " .
462
+      "LEFT JOIN {{unit}} as UNIT1 ON UNIT1.unit_location_type = ".LOC_FLEET." AND UNIT1.unit_location_id = FLEET1.fleet_id ".
463 463
       // Lock fleet owner
464
-      "LEFT JOIN {{users}} as USER1 on USER1.id = FLEET1.fleet_owner " .
464
+      "LEFT JOIN {{users}} as USER1 on USER1.id = FLEET1.fleet_owner ".
465 465
 
466 466
       "LEFT JOIN {{fleets}} AS FLEET2 ON
467 467
         FLEET2.fleet_mess = 1   AND FLEET0.fleet_mess = 0 AND
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
       " .
472 472
       // Блокировка всех юнитов, принадлежащих этим флотам
473 473
       "LEFT JOIN {{unit}} as UNIT2 ON
474
-        UNIT2.unit_location_type = " . LOC_FLEET . " AND
474
+        UNIT2.unit_location_type = " . LOC_FLEET." AND
475 475
         UNIT2.unit_location_id = FLEET2.fleet_id
476 476
       " .
477 477
       // Lock fleet owner
@@ -488,11 +488,11 @@  discard block
 block discarded – undo
488 488
       " .
489 489
       // Блокировка всех юнитов, принадлежащих этим флотам
490 490
       "LEFT JOIN {{unit}} as UNIT3 ON
491
-        UNIT3.unit_location_type = " . LOC_FLEET . " AND
491
+        UNIT3.unit_location_type = " . LOC_FLEET." AND
492 492
         UNIT3.unit_location_id = FLEET3.fleet_id
493 493
       " .
494 494
       // Lock fleet owner
495
-      "LEFT JOIN {{users}} as USER3 on USER3.id = FLEET3.fleet_owner " .
495
+      "LEFT JOIN {{users}} as USER3 on USER3.id = FLEET3.fleet_owner ".
496 496
 
497 497
       "LEFT JOIN {{fleets}} AS FLEET4 ON
498 498
         FLEET4.fleet_mess = 1   AND FLEET0.fleet_mess = 1 AND
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
       " .
503 503
       // Блокировка всех юнитов, принадлежащих этим флотам
504 504
       "LEFT JOIN {{unit}} as UNIT4 ON
505
-        UNIT4.unit_location_type = " . LOC_FLEET . " AND
505
+        UNIT4.unit_location_type = " . LOC_FLEET." AND
506 506
         UNIT4.unit_location_id = FLEET4.fleet_id
507 507
       " .
508 508
       // Lock fleet owner
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
       " .
525 525
       // Блокировка всех юнитов, принадлежащих этой планете
526 526
       "LEFT JOIN {{unit}} as UNIT5 ON
527
-        UNIT5.unit_location_type = " . LOC_PLANET . " AND
527
+        UNIT5.unit_location_type = " . LOC_PLANET." AND
528 528
         UNIT5.unit_location_id = PLANETS5.id
529 529
       " .
530 530
 
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
       " .
543 543
       // Блокировка всех юнитов, принадлежащих этой планете
544 544
       "LEFT JOIN {{unit}} as UNIT6 ON
545
-        UNIT6.unit_location_type = " . LOC_PLANET . " AND
545
+        UNIT6.unit_location_type = " . LOC_PLANET." AND
546 546
         UNIT6.unit_location_id = PLANETS6.id
547 547
       " .
548 548
       "WHERE FLEET0.fleet_id = {$dbId} GROUP BY 1 FOR UPDATE"
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
       } elseif ($this->isResource($unit_id)) {
662 662
         $this->resource_list[$unit_id] = $unit_count;
663 663
       } else {
664
-        throw new Exception('Trying to pass to fleet non-resource and non-ship ' . var_export($unit_array, true), ERR_ERROR);
664
+        throw new Exception('Trying to pass to fleet non-resource and non-ship '.var_export($unit_array, true), ERR_ERROR);
665 665
       }
666 666
     }
667 667
   }
@@ -986,7 +986,7 @@  discard block
 block discarded – undo
986 986
    */
987 987
   public function resourcesSet($resource_list) {
988 988
     if (!empty($this->propertiesAdjusted['resource_list'])) {
989
-      throw new PropertyAccessException('Property "resource_list" already was adjusted so no SET is possible until dbSave in ' . get_called_class() . '::unitSetResourceList', ERR_ERROR);
989
+      throw new PropertyAccessException('Property "resource_list" already was adjusted so no SET is possible until dbSave in '.get_called_class().'::unitSetResourceList', ERR_ERROR);
990 990
     }
991 991
     $this->resourcesAdjust($resource_list, true);
992 992
   }
@@ -1020,7 +1020,7 @@  discard block
 block discarded – undo
1020 1020
       // Check for negative unit value
1021 1021
       if ($this->resource_list[$resource_id] < 0) {
1022 1022
         // TODO
1023
-        throw new Exception('Resource ' . $resource_id . ' will become negative in ' . get_called_class() . '::unitAdjustResourceList', ERR_ERROR);
1023
+        throw new Exception('Resource '.$resource_id.' will become negative in '.get_called_class().'::unitAdjustResourceList', ERR_ERROR);
1024 1024
       }
1025 1025
     }
1026 1026
   }
@@ -1193,7 +1193,7 @@  discard block
 block discarded – undo
1193 1193
 
1194 1194
   protected function printErrorIfNoShips() {
1195 1195
     if ($this->unitList->unitsCount() <= 0) {
1196
-      message(classLocale::$lang['fl_err_no_ships'], classLocale::$lang['fl_error'], 'fleet' . DOT_PHP_EX, 5);
1196
+      message(classLocale::$lang['fl_err_no_ships'], classLocale::$lang['fl_error'], 'fleet'.DOT_PHP_EX, 5);
1197 1197
     }
1198 1198
   }
1199 1199
 
@@ -1540,7 +1540,7 @@  discard block
 block discarded – undo
1540 1540
     } catch (Exception $e) {
1541 1541
 
1542 1542
       // TODO - MESSAGE BOX
1543
-      if($e instanceof ExceptionFleetInvalid) {
1543
+      if ($e instanceof ExceptionFleetInvalid) {
1544 1544
         sn_db_transaction_rollback();
1545 1545
         pdie(classLocale::$lang['fl_attack_error'][$e->getCode()]);
1546 1546
       } else {
@@ -1629,7 +1629,7 @@  discard block
 block discarded – undo
1629 1629
       $validator->validate();
1630 1630
     } catch (Exception $e) {
1631 1631
       // TODO - MESSAGE BOX
1632
-      if($e instanceof ExceptionFleetInvalid) {
1632
+      if ($e instanceof ExceptionFleetInvalid) {
1633 1633
         sn_db_transaction_rollback();
1634 1634
         pdie(classLocale::$lang['fl_attack_error'][$e->getCode()]);
1635 1635
       } else {
@@ -1690,7 +1690,7 @@  discard block
 block discarded – undo
1690 1690
 
1691 1691
 
1692 1692
     if (!empty($captain['unit_id'])) {
1693
-      DBStaticUnit::db_unit_set_by_id($captain['unit_id'], "`unit_location_type` = " . LOC_FLEET . ", `unit_location_id` = {$this->_dbId}");
1693
+      DBStaticUnit::db_unit_set_by_id($captain['unit_id'], "`unit_location_type` = ".LOC_FLEET.", `unit_location_id` = {$this->_dbId}");
1694 1694
     }
1695 1695
 
1696 1696
 //    return $this->fleet->acs['ankunft'] - $this->fleet->time_launch >= $this->fleet->travelData['duration'];
@@ -1702,7 +1702,7 @@  discard block
 block discarded – undo
1702 1702
     $template_result['.']['fleets'][] = $this->renderFleet(SN_TIME_NOW, $timeMissionJob);
1703 1703
 
1704 1704
     $template_result += array(
1705
-      'mission'         => classLocale::$lang['type_mission'][$this->_mission_type] . ($this->_mission_type == MT_EXPLORE || $this->_mission_type == MT_HOLD ? ' ' . pretty_time($timeMissionJob) : ''),
1705
+      'mission'         => classLocale::$lang['type_mission'][$this->_mission_type].($this->_mission_type == MT_EXPLORE || $this->_mission_type == MT_HOLD ? ' '.pretty_time($timeMissionJob) : ''),
1706 1706
       'dist'            => pretty_number($this->travelData['distance']),
1707 1707
       'speed'           => pretty_number($this->travelData['fleet_speed']),
1708 1708
       'deute_need'      => pretty_number($this->travelData['consumption']),
Please login to merge, or discard this patch.