Completed
Push — work-fleets ( 808c81...a017ed )
by SuperNova.WS
11:34 queued 05:01
created
includes/classes/DBStaticRecord.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
    * @return array|null
84 84
    */
85 85
   public static function getRecordById($recordId, $fieldList = '*', $forUpdate = false) {
86
-    return static::getRecord(array(static::$_idField . '=' . $recordId), $fieldList, $forUpdate);
86
+    return static::getRecord(array(static::$_idField.'='.$recordId), $fieldList, $forUpdate);
87 87
   }
88 88
 
89 89
   /**
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
    * @return array|bool|mysqli_result|null
93 93
    */
94 94
   protected static function execute($statement) {
95
-    return static::$dbStatic->execute((string)$statement);
95
+    return static::$dbStatic->execute((string) $statement);
96 96
   }
97 97
 
98 98
   /**
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
       $query = static::execute(
121 121
         static::buildSelectAll()
122 122
           ->fields(static::$_idField)
123
-          ->where(array("`" . static::$_idField . "` IN (" . implode(',', $idList) . ")"))
123
+          ->where(array("`".static::$_idField."` IN (".implode(',', $idList).")"))
124 124
       );
125 125
     }
126 126
 
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     $result = array();
141 141
     if (!empty($idList)) {
142 142
       $query = static::queryExistsIdInList($idList);
143
-      while($row = db_fetch($query)) {
143
+      while ($row = db_fetch($query)) {
144 144
         $result[] = $row[static::$_idField];
145 145
       }
146 146
     }
Please login to merge, or discard this patch.
includes/classes/DbSqlLiteral.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
    * @return $this
32 32
    */
33 33
   public function literal($value) {
34
-    $this->literal = (string)$value;
34
+    $this->literal = (string) $value;
35 35
 
36 36
     return $this;
37 37
   }
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
       $alias = $this->aliasFromField($functionName, $field);
65 65
     }
66 66
 
67
-    $this->literal = strtoupper($functionName) . '(' . $this->quoteField($field) . ')';
67
+    $this->literal = strtoupper($functionName).'('.$this->quoteField($field).')';
68 68
 
69 69
     if (self::SQL_LITERAL_ALIAS_NONE !== $alias && !empty($alias)) {
70
-      $this->literal .= ' AS `' . $alias . '`';
70
+      $this->literal .= ' AS `'.$alias.'`';
71 71
     }
72 72
 
73 73
     return $this;
@@ -124,10 +124,10 @@  discard block
 block discarded – undo
124 124
       $alias = $this->aliasFromField($functionName, $field);
125 125
     }
126 126
 
127
-    $this->literal = $this->quoteField($field) . ' IS NULL';
127
+    $this->literal = $this->quoteField($field).' IS NULL';
128 128
 
129 129
     if (!empty($alias)) {
130
-      $this->literal .= ' AS `' . $alias . '`';
130
+      $this->literal .= ' AS `'.$alias.'`';
131 131
     }
132 132
 
133 133
     return $this;
Please login to merge, or discard this patch.
includes/classes/DbSqlStatement.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
     $arguments = func_get_args();
109 109
 
110 110
     // Special case - call method with array of fields
111
-    if(count($arguments) == 1 && is_array($arguments[0])) {
111
+    if (count($arguments) == 1 && is_array($arguments[0])) {
112 112
       $arguments = array_shift($arguments);
113 113
     }
114 114
 
115
-    foreach($arguments as $arg) {
115
+    foreach ($arguments as $arg) {
116 116
       $this->fields[] = $arg;
117 117
     }
118 118
 
@@ -293,9 +293,9 @@  discard block
 block discarded – undo
293 293
   }
294 294
 
295 295
   protected function compileFrom() {
296
-    $this->_compiledQuery[] = 'FROM `{{' . $this->escapeString($this->table) . '}}`';
296
+    $this->_compiledQuery[] = 'FROM `{{'.$this->escapeString($this->table).'}}`';
297 297
     if (!empty($this->alias)) {
298
-      $this->_compiledQuery[] = 'AS `' . $this->escapeString($this->alias) . '`';
298
+      $this->_compiledQuery[] = 'AS `'.$this->escapeString($this->alias).'`';
299 299
     }
300 300
   }
301 301
 
@@ -305,29 +305,29 @@  discard block
 block discarded – undo
305 305
 
306 306
   protected function compileWhere() {
307 307
     // TODO - fields should be escaped !!
308
-    !empty($this->where) ? $this->_compiledQuery[] = 'WHERE ' . implode(' AND ', $this->where) : false;
308
+    !empty($this->where) ? $this->_compiledQuery[] = 'WHERE '.implode(' AND ', $this->where) : false;
309 309
   }
310 310
 
311 311
   protected function compileGroupBy() {
312 312
     // TODO - fields should be escaped !!
313 313
 //    !empty($this->groupBy) ? $this->_compiledQuery[] = 'GROUP BY ' . implode(',', $this->arrayEscape($this->groupBy)) : false;
314
-    !empty($this->groupBy) ? $this->_compiledQuery[] = 'GROUP BY ' . $this->selectFieldsToString($this->groupBy) : false;
314
+    !empty($this->groupBy) ? $this->_compiledQuery[] = 'GROUP BY '.$this->selectFieldsToString($this->groupBy) : false;
315 315
   }
316 316
 
317 317
   protected function compileOrderBy() {
318 318
     // TODO - fields should be escaped !!
319
-    !empty($this->orderBy) ? $this->_compiledQuery[] = 'ORDER BY ' . implode(',', $this->arrayEscape($this->orderBy)) : false;
319
+    !empty($this->orderBy) ? $this->_compiledQuery[] = 'ORDER BY '.implode(',', $this->arrayEscape($this->orderBy)) : false;
320 320
   }
321 321
 
322 322
   protected function compileHaving() {
323 323
     // TODO - fields should be escaped !!
324
-    !empty($this->having) ? $this->_compiledQuery[] = 'HAVING ' . implode(' AND ', $this->having) : false;
324
+    !empty($this->having) ? $this->_compiledQuery[] = 'HAVING '.implode(' AND ', $this->having) : false;
325 325
   }
326 326
 
327 327
   protected function compileLimit() {
328 328
     // TODO - fields should be escaped !!
329 329
     if ($limit = $this->fetchOne ? 1 : $this->limit) {
330
-      $this->_compiledQuery[] = 'LIMIT ' . $limit . (!empty($this->offset) ? ' OFFSET ' . $this->offset : '');
330
+      $this->_compiledQuery[] = 'LIMIT '.$limit.(!empty($this->offset) ? ' OFFSET '.$this->offset : '');
331 331
     }
332 332
   }
333 333
 
@@ -371,14 +371,14 @@  discard block
 block discarded – undo
371 371
    */
372 372
   protected function processField($fieldName) {
373 373
     if (is_bool($fieldName)) {
374
-      $result = (string)intval($fieldName);
374
+      $result = (string) intval($fieldName);
375 375
     } elseif (is_numeric($fieldName)) {
376 376
       $result = $fieldName;
377 377
     } elseif (is_null($fieldName)) {
378 378
       $result = 'NULL';
379 379
     } else {
380 380
       // Field has other type - string or should be convertible to string
381
-      $result = (string)$fieldName;
381
+      $result = (string) $fieldName;
382 382
       if (!$fieldName instanceof DbSqlLiteral) {
383 383
         $result = $this->quoteField($fieldName);
384 384
       }
Please login to merge, or discard this patch.
includes/classes/DbSqlPrepare.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@
 block discarded – undo
149 149
         // Removing comment placeholder from statement
150 150
         $this->queryPrepared = str_replace(static::COMMENT_PLACEHOLDER, DbSqlHelper::quoteComment($this->comment), $this->queryPrepared);
151 151
         // Removing comment value from values list
152
-        $this->paramsPrepared = array_filter($this->paramsPrepared, function ($value) { return $value != DbSqlPrepare::COMMENT_PLACEHOLDER; });
152
+        $this->paramsPrepared = array_filter($this->paramsPrepared, function($value) { return $value != DbSqlPrepare::COMMENT_PLACEHOLDER; });
153 153
         // TODO - Add comment value directly to statement
154 154
       }
155 155
 
Please login to merge, or discard this patch.
includes/classes/DBStaticUser.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
       static::buildSelectAll()
55 55
         ->fields('id')
56 56
         ->where(array(
57
-          "`user_as_ally` IS NULL AND `user_bot` = " . USER_BOT_PLAYER . " FOR UPDATE;"
57
+          "`user_as_ally` IS NULL AND `user_bot` = ".USER_BOT_PLAYER." FOR UPDATE;"
58 58
         ))
59 59
     );
60 60
 
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
   }
226 226
 
227 227
   public static function db_user_list_set_mass_mail(&$owners_list, $set) {
228
-    return classSupernova::db_upd_record_list(LOC_USER, !empty($owners_list) ? '`id` IN (' . implode(',', $owners_list) . ');' : '', $set);
228
+    return classSupernova::db_upd_record_list(LOC_USER, !empty($owners_list) ? '`id` IN ('.implode(',', $owners_list).');' : '', $set);
229 229
   }
230 230
 
231 231
   public static function db_user_list_set_by_ally_and_rank($ally_id, $ally_rank_id, $set) {
Please login to merge, or discard this patch.
includes/classes/DbSqlHelper.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,13 +15,13 @@
 block discarded – undo
15 15
    * @return string
16 16
    */
17 17
   public static function quoteComment($comment) {
18
-    if($comment == '') {
18
+    if ($comment == '') {
19 19
       return '';
20 20
     }
21 21
 
22
-    $comment = str_replace(array('/*', '*/'), '__',$comment);
22
+    $comment = str_replace(array('/*', '*/'), '__', $comment);
23 23
 
24
-    return "\r\n/*" . $comment . "*/";
24
+    return "\r\n/*".$comment."*/";
25 25
   }
26 26
 
27 27
 }
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
@@ -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
   }
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     $sql = $query;
131 131
     if (strpos($sql, '{{') !== false) {
132 132
       foreach ($this->table_list as $tableName) {
133
-        $sql = str_replace("{{{$tableName}}}", $this->db_prefix . $tableName, $sql);
133
+        $sql = str_replace("{{{$tableName}}}", $this->db_prefix.$tableName, $sql);
134 134
       }
135 135
     }
136 136
 
@@ -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
 
@@ -252,13 +252,13 @@  discard block
 block discarded – undo
252 252
           ->execute()
253 253
           ->getResult();
254 254
       } else {
255
-        $queryResult = $this->db_sql_query($stringQuery . DbSqlHelper::quoteComment($queryTrace));
255
+        $queryResult = $this->db_sql_query($stringQuery.DbSqlHelper::quoteComment($queryTrace));
256 256
       }
257 257
       if (!$queryResult) {
258 258
         throw new Exception();
259 259
       }
260 260
     } catch (Exception $e) {
261
-      classSupernova::$debug->error($this->db_error() . "<br />{$query}<br />", 'SQL Error');
261
+      classSupernova::$debug->error($this->db_error()."<br />{$query}<br />", 'SQL Error');
262 262
     }
263 263
 
264 264
     if ($fetch) {
@@ -283,10 +283,10 @@  discard block
 block discarded – undo
283 283
       $this->isWatching = true;
284 284
       $msg = "\$query = \"{$query}\"\n\r";
285 285
       if (!empty($_POST)) {
286
-        $msg .= "\n\r" . dump($_POST, '$_POST');
286
+        $msg .= "\n\r".dump($_POST, '$_POST');
287 287
       }
288 288
       if (!empty($_GET)) {
289
-        $msg .= "\n\r" . dump($_GET, '$_GET');
289
+        $msg .= "\n\r".dump($_GET, '$_GET');
290 290
       }
291 291
       classSupernova::$debug->warning($msg, "Watching user {$user['id']}", 399, array('base_dump' => true));
292 292
       $this->isWatching = false;
@@ -312,37 +312,37 @@  discard block
 block discarded – undo
312 312
       case stripos($query, 'RPG_POINTS') != false && stripos(trim($query), 'UPDATE ') === 0 && !$dm_change_legit:
313 313
       case stripos($query, 'METAMATTER') != false && stripos(trim($query), 'UPDATE ') === 0 && !$mm_change_legit:
314 314
       case stripos($query, 'AUTHLEVEL') != false && $user['authlevel'] < 3 && stripos($query, 'SELECT') !== 0:
315
-        $report = "Hacking attempt (" . date("d.m.Y H:i:s") . " - [" . time() . "]):\n";
315
+        $report = "Hacking attempt (".date("d.m.Y H:i:s")." - [".time()."]):\n";
316 316
         $report .= ">Database Inforamation\n";
317
-        $report .= "\tID - " . $user['id'] . "\n";
318
-        $report .= "\tUser - " . $user['username'] . "\n";
319
-        $report .= "\tAuth level - " . $user['authlevel'] . "\n";
320
-        $report .= "\tAdmin Notes - " . $user['adminNotes'] . "\n";
321
-        $report .= "\tCurrent Planet - " . $user['current_planet'] . "\n";
322
-        $report .= "\tUser IP - " . $user['user_lastip'] . "\n";
323
-        $report .= "\tUser IP at Reg - " . $user['ip_at_reg'] . "\n";
324
-        $report .= "\tUser Agent- " . $_SERVER['HTTP_USER_AGENT'] . "\n";
325
-        $report .= "\tCurrent Page - " . $user['current_page'] . "\n";
326
-        $report .= "\tRegister Time - " . $user['register_time'] . "\n";
317
+        $report .= "\tID - ".$user['id']."\n";
318
+        $report .= "\tUser - ".$user['username']."\n";
319
+        $report .= "\tAuth level - ".$user['authlevel']."\n";
320
+        $report .= "\tAdmin Notes - ".$user['adminNotes']."\n";
321
+        $report .= "\tCurrent Planet - ".$user['current_planet']."\n";
322
+        $report .= "\tUser IP - ".$user['user_lastip']."\n";
323
+        $report .= "\tUser IP at Reg - ".$user['ip_at_reg']."\n";
324
+        $report .= "\tUser Agent- ".$_SERVER['HTTP_USER_AGENT']."\n";
325
+        $report .= "\tCurrent Page - ".$user['current_page']."\n";
326
+        $report .= "\tRegister Time - ".$user['register_time']."\n";
327 327
         $report .= "\n";
328 328
 
329 329
         $report .= ">Query Information\n";
330
-        $report .= "\tQuery - " . $query . "\n";
330
+        $report .= "\tQuery - ".$query."\n";
331 331
         $report .= "\n";
332 332
 
333 333
         $report .= ">\$_SERVER Information\n";
334
-        $report .= "\tIP - " . $_SERVER['REMOTE_ADDR'] . "\n";
335
-        $report .= "\tHost Name - " . $_SERVER['HTTP_HOST'] . "\n";
336
-        $report .= "\tUser Agent - " . $_SERVER['HTTP_USER_AGENT'] . "\n";
337
-        $report .= "\tRequest Method - " . $_SERVER['REQUEST_METHOD'] . "\n";
338
-        $report .= "\tCame From - " . $_SERVER['HTTP_REFERER'] . "\n";
339
-        $report .= "\tPage is - " . $_SERVER['SCRIPT_NAME'] . "\n";
340
-        $report .= "\tUses Port - " . $_SERVER['REMOTE_PORT'] . "\n";
341
-        $report .= "\tServer Protocol - " . $_SERVER['SERVER_PROTOCOL'] . "\n";
334
+        $report .= "\tIP - ".$_SERVER['REMOTE_ADDR']."\n";
335
+        $report .= "\tHost Name - ".$_SERVER['HTTP_HOST']."\n";
336
+        $report .= "\tUser Agent - ".$_SERVER['HTTP_USER_AGENT']."\n";
337
+        $report .= "\tRequest Method - ".$_SERVER['REQUEST_METHOD']."\n";
338
+        $report .= "\tCame From - ".$_SERVER['HTTP_REFERER']."\n";
339
+        $report .= "\tPage is - ".$_SERVER['SCRIPT_NAME']."\n";
340
+        $report .= "\tUses Port - ".$_SERVER['REMOTE_PORT']."\n";
341
+        $report .= "\tServer Protocol - ".$_SERVER['SERVER_PROTOCOL']."\n";
342 342
 
343 343
         $report .= "\n--------------------------------------------------------------------------------------------------\n";
344 344
 
345
-        $fp = fopen(SN_ROOT_PHYSICAL . 'badqrys.txt', 'a');
345
+        $fp = fopen(SN_ROOT_PHYSICAL.'badqrys.txt', 'a');
346 346
         fwrite($fp, $report);
347 347
         fclose($fp);
348 348
 
Please login to merge, or discard this patch.
includes/functions/flt_mission_missile.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -77,8 +77,8 @@  discard block
 block discarded – undo
77 77
     $crystal += $destroyed * $unit_info[P_COST][RES_CRYSTAL] / 4;
78 78
   }
79 79
 
80
-  $return['structures'] = $structures;     // Structures left after attack
81
-  $return['metal'] = floor($metal);   // Metal scraps
80
+  $return['structures'] = $structures; // Structures left after attack
81
+  $return['metal'] = floor($metal); // Metal scraps
82 82
   $return['crystal'] = floor($crystal); // Crystal scraps
83 83
 
84 84
   return $return;
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
         }
149 149
 
150 150
         if (!empty($message)) {
151
-          $message = classLocale::$lang['mip_defense_destroyed'] . $message . "{$classLocale['mip_recycled']}{$classLocale['Metal']}: {$attackResult['metal']}, {$classLocale['Crystal']}: {$attackResult['crystal']}<br>";
151
+          $message = classLocale::$lang['mip_defense_destroyed'].$message."{$classLocale['mip_recycled']}{$classLocale['Metal']}: {$attackResult['metal']}, {$classLocale['Crystal']}: {$attackResult['crystal']}<br>";
152 152
 
153 153
           DBStaticPlanet::db_planet_set_by_id($target_planet_row['id'], "`metal` = `metal` + {$attackResult['metal']}, `crystal` = `crystal` + {$attackResult['crystal']}");
154 154
         }
@@ -165,8 +165,8 @@  discard block
 block discarded – undo
165 165
 
166 166
       empty($message) ? $message = classLocale::$lang['mip_no_defense'] : false;
167 167
 
168
-      DBStaticMessages::msg_send_simple_message($fleetRow['fleet_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['mip_sender_amd'], classLocale::$lang['mip_subject_amd'], $message_vorlage . $message);
169
-      DBStaticMessages::msg_send_simple_message($fleetRow['fleet_target_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['mip_sender_amd'], classLocale::$lang['mip_subject_amd'], $message_vorlage . $message);
168
+      DBStaticMessages::msg_send_simple_message($fleetRow['fleet_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['mip_sender_amd'], classLocale::$lang['mip_subject_amd'], $message_vorlage.$message);
169
+      DBStaticMessages::msg_send_simple_message($fleetRow['fleet_target_owner'], '', SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['mip_sender_amd'], classLocale::$lang['mip_subject_amd'], $message_vorlage.$message);
170 170
     }
171 171
     DBStaticFleetMissile::db_missile_delete($fleetRow);
172 172
   }
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin_mail.inc 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
3
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
4 4
   classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
5 5
 }
6 6
 
7
-if(!$user_can_send_mails) {
7
+if (!$user_can_send_mails) {
8 8
   message(classLocale::$lang['Denied_access'], classLocale::$lang['Send_circular_mail']);
9 9
 }
10 10
 
11 11
 $POST_text = sys_get_param_str('text');
12
-if($POST_text) {
13
-  message(classLocale::$lang['members_who_recived_message'] . DBStaticMessages::msg_ali_send($POST_text, classLocale::$lang['ali_adm_msg_subject'], sys_get_param_int('r')), classLocale::$lang['Circular_sended'], "alliance.php", '');
12
+if ($POST_text) {
13
+  message(classLocale::$lang['members_who_recived_message'].DBStaticMessages::msg_ali_send($POST_text, classLocale::$lang['ali_adm_msg_subject'], sys_get_param_int('r')), classLocale::$lang['Circular_sended'], "alliance.php", '');
14 14
 }
15 15
 
16
-$r_list = "<option value=\"-1\">" . classLocale::$lang['All_players'] . "</option>";
17
-if($ranks) {
18
-  foreach($ranks as $id => $array) {
19
-    $r_list .= "<option value=\"" . $id . "\">" . $array['name'] . "</option>";
16
+$r_list = "<option value=\"-1\">".classLocale::$lang['All_players']."</option>";
17
+if ($ranks) {
18
+  foreach ($ranks as $id => $array) {
19
+    $r_list .= "<option value=\"".$id."\">".$array['name']."</option>";
20 20
   }
21 21
 }
22 22
 
Please login to merge, or discard this patch.