Passed
Branch trunk (7dc288)
by SuperNova.WS
06:07
created
includes/includes/flt_mission_destroy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
 function flt_mission_destroy($mission_data) {
9 9
   $fleet_row = $mission_data['fleet'];
10 10
   $destination_planet = $mission_data['dst_planet'];
11
-  if(!$destination_planet || !is_array($destination_planet) || $destination_planet['planet_type'] != PT_MOON) {
11
+  if (!$destination_planet || !is_array($destination_planet) || $destination_planet['planet_type'] != PT_MOON) {
12 12
     fleet_send_back($fleet_row);
13 13
 
14 14
     return CACHE_FLEET;
Please login to merge, or discard this patch.
includes/includes/upd_helpers.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -170,7 +170,7 @@
 block discarded – undo
170 170
 
171 171
 function upd_db_unit_by_location($user_id = 0, $location_type, $location_id, $unit_snid = 0, $for_update = false, $fields = '*') {
172 172
   return db_fetch(upd_do_query(
173
-    "SELECT {$fields}
173
+    "select {$fields}
174 174
     FROM {{unit}}
175 175
     WHERE
176 176
       `unit_location_type` = {$location_type} AND `unit_location_id` = {$location_id} AND " . DBStaticUnit::db_unit_time_restrictions() .
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!defined('IN_UPDATE')) {
3
+if (!defined('IN_UPDATE')) {
4 4
   die('Trying to call update helpers externally!');
5 5
 }
6 6
 
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
   global $update_tables;
9 9
 
10 10
   upd_add_more_time();
11
-  if(!$no_log) {
11
+  if (!$no_log) {
12 12
     upd_log_message("Performing query '{$query}'");
13 13
   }
14 14
 
15
-  if(strpos($query, '{{') !== false) {
16
-    foreach($update_tables as $tableName => $cork) {
15
+  if (strpos($query, '{{') !== false) {
16
+    foreach ($update_tables as $tableName => $cork) {
17 17
       $query = str_replace("{{{$tableName}}}", classSupernova::$db->db_prefix . $tableName, $query);
18 18
     }
19 19
   }
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
   global $config, $sys_log_disabled;
26 26
 
27 27
   $config->db_loadItem($key);
28
-  if($condition || !isset($config->$key)) {
28
+  if ($condition || !isset($config->$key)) {
29 29
     upd_add_more_time();
30
-    if(!$sys_log_disabled) {
30
+    if (!$sys_log_disabled) {
31 31
       upd_log_message("Updating config key '{$key}' with value '{$default_value}'");
32 32
     }
33 33
     $config->db_saveItem($key, $default_value);
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 function upd_log_message($message) {
56 56
   global $sys_log_disabled, $upd_log, $debug;
57 57
 
58
-  if($sys_log_disabled)
58
+  if ($sys_log_disabled)
59 59
   {
60 60
 //    print("{$message}<br />");
61 61
   } else {
@@ -67,15 +67,15 @@  discard block
 block discarded – undo
67 67
 function upd_unset_table_info($table_name) {
68 68
   global $update_tables, $update_indexes, $update_foreigns;
69 69
 
70
-  if(isset($update_tables[$table_name])) {
70
+  if (isset($update_tables[$table_name])) {
71 71
     unset($update_tables[$table_name]);
72 72
   }
73 73
 
74
-  if(isset($update_indexes[$table_name])) {
74
+  if (isset($update_indexes[$table_name])) {
75 75
     unset($update_indexes[$table_name]);
76 76
   }
77 77
 
78
-  if(isset($update_foreigns[$table_name])) {
78
+  if (isset($update_foreigns[$table_name])) {
79 79
     unset($update_foreigns[$table_name]);
80 80
   }
81 81
 }
@@ -89,18 +89,18 @@  discard block
 block discarded – undo
89 89
   upd_unset_table_info($tableName);
90 90
 
91 91
   $q1 = upd_do_query("SHOW FULL COLUMNS FROM {$prefix_table_name};", true);
92
-  while($r1 = db_fetch($q1)) {
92
+  while ($r1 = db_fetch($q1)) {
93 93
     $update_tables[$tableName][$r1['Field']] = $r1;
94 94
   }
95 95
 
96 96
   $q1 = upd_do_query("SHOW INDEX FROM {$prefix_table_name};", true);
97
-  while($r1 = db_fetch($q1)) {
97
+  while ($r1 = db_fetch($q1)) {
98 98
     $update_indexes[$tableName][$r1['Key_name']] .= "{$r1['Column_name']},";
99 99
     $update_indexes_full[$tableName][$r1['Key_name']][$r1['Column_name']] = $r1;
100 100
   }
101 101
 
102
-  $q1 = upd_do_query("SELECT * FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = '" . db_escape(classSupernova::$db_name). "' AND TABLE_NAME = '{$prefix_table_name}' AND REFERENCED_TABLE_NAME is not null;", true);
103
-  while($r1 = db_fetch($q1)) {
102
+  $q1 = upd_do_query("SELECT * FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = '" . db_escape(classSupernova::$db_name) . "' AND TABLE_NAME = '{$prefix_table_name}' AND REFERENCED_TABLE_NAME is not null;", true);
103
+  while ($r1 = db_fetch($q1)) {
104 104
     $table_referenced = str_replace($config->db_prefix, '', $r1['REFERENCED_TABLE_NAME']);
105 105
 
106 106
     $update_foreigns[$tableName][$r1['CONSTRAINT_NAME']] .= "{$r1['COLUMN_NAME']},{$table_referenced},{$r1['REFERENCED_COLUMN_NAME']};";
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 function upd_alter_table($table, $alters, $condition = true) {
111 111
   global $config, $update_tables;
112 112
 
113
-  if(!$condition) {
113
+  if (!$condition) {
114 114
     return;
115 115
   }
116 116
 
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
   $alters_print = is_array($alters) ? dump($alters) : $alters;
119 119
   upd_log_message("Altering table '{$table}' with alterations {$alters_print}");
120 120
 
121
-  if(!is_array($alters)) {
121
+  if (!is_array($alters)) {
122 122
     $alters = array($alters);
123 123
   }
124 124
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 
129 129
   $result = upd_do_query($qry);
130 130
   $error = db_error();
131
-  if($error) {
131
+  if ($error) {
132 132
     die("Altering error for table `{$table}`: {$error}<br />{$alters_print}");
133 133
   }
134 134
 
@@ -155,19 +155,19 @@  discard block
 block discarded – undo
155 155
 function upd_create_table($table_name, $declaration, $tableOptions = '') {
156 156
   global $config, $update_tables;
157 157
 
158
-  if(!$update_tables[$table_name]) {
158
+  if (!$update_tables[$table_name]) {
159 159
     upd_do_query('set foreign_key_checks = 0;', true);
160 160
     $declaration = trim($declaration);
161
-    if(substr($declaration, 0, 1) != '(') {
161
+    if (substr($declaration, 0, 1) != '(') {
162 162
       $declaration = "($declaration)";
163 163
     }
164 164
     $tableOptions = trim($tableOptions);
165
-    if(!empty($tableOptions)) {
165
+    if (!empty($tableOptions)) {
166 166
       $declaration .= $tableOptions;
167 167
     }
168 168
     $result = upd_do_query("CREATE TABLE IF NOT EXISTS `{$config->db_prefix}{$table_name}` {$declaration}");
169 169
     $error = db_error();
170
-    if($error) {
170
+    if ($error) {
171 171
       die("Creating error for table `{$table_name}`: {$error}<br />" . dump($declaration));
172 172
     }
173 173
     upd_do_query('set foreign_key_checks = 1;', true);
@@ -193,14 +193,14 @@  discard block
 block discarded – undo
193 193
 
194 194
 
195 195
 function upd_db_unit_changeset_prepare($unit_id, $unit_value, $user, $planet_id = null) {
196
-  if(!is_array($user)) {
196
+  if (!is_array($user)) {
197 197
     // TODO - remove later
198 198
     print('<h1>СООБЩИТЕ ЭТО АДМИНУ: upd_db_unit_changeset_prepare() - USER is not ARRAY</h1>');
199 199
     pdump(debug_backtrace());
200 200
     die('USER is not ARRAY');
201 201
   }
202 202
 
203
-  if(!isset($user['id']) || !$user['id']) {
203
+  if (!isset($user['id']) || !$user['id']) {
204 204
     // TODO - remove later
205 205
     print('<h1>СООБЩИТЕ ЭТО АДМИНУ: upd_db_unit_changeset_prepare() - USER[id] пустой</h1>');
206 206
     pdump($user);
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 
216 216
   $db_changeset = array();
217 217
   $temp = upd_db_unit_by_location($user['id'], $unit_location, $location_id, $unit_id, true, 'unit_id');
218
-  if($temp['unit_id']) {
218
+  if ($temp['unit_id']) {
219 219
     // update
220 220
     $db_changeset = array(
221 221
       'action' => SQL_OP_UPDATE,
@@ -261,53 +261,53 @@  discard block
 block discarded – undo
261 261
 
262 262
 
263 263
 function upd_db_changeset_apply($db_changeset) {
264
-  if(!is_array($db_changeset) || empty($db_changeset)) {
264
+  if (!is_array($db_changeset) || empty($db_changeset)) {
265 265
     return;
266 266
   }
267 267
 
268
-  foreach($db_changeset as $table_name => $table_data) {
269
-    foreach($table_data as $record_id => $conditions) {
268
+  foreach ($db_changeset as $table_name => $table_data) {
269
+    foreach ($table_data as $record_id => $conditions) {
270 270
       $where = '';
271
-      if(!empty($conditions['where'])) {
271
+      if (!empty($conditions['where'])) {
272 272
         $where = 'WHERE ' . implode(' AND ', $conditions['where']);
273 273
       }
274 274
 
275 275
       $fields = array();
276
-      if($conditions['fields']) {
277
-        foreach($conditions['fields'] as $field_name => $field_data) {
276
+      if ($conditions['fields']) {
277
+        foreach ($conditions['fields'] as $field_name => $field_data) {
278 278
           $condition = "`{$field_name}` = ";
279 279
           $value = '';
280
-          if($field_data['delta']) {
280
+          if ($field_data['delta']) {
281 281
             $value = "`{$field_name}`" . ($field_data['delta'] >= 0 ? '+' : '') . $field_data['delta'];
282
-          } elseif($field_data['set']) {
283
-            $value = (is_string($field_data['set']) ? "'{$field_data['set']}'": $field_data['set']);
282
+          } elseif ($field_data['set']) {
283
+            $value = (is_string($field_data['set']) ? "'{$field_data['set']}'" : $field_data['set']);
284 284
           }
285
-          if($value) {
285
+          if ($value) {
286 286
             $fields[] = $condition . $value;
287 287
           }
288 288
         }
289 289
       }
290 290
       $fields = implode(',', $fields);
291 291
 
292
-      switch($conditions['action']) {
292
+      switch ($conditions['action']) {
293 293
         case SQL_OP_DELETE:
294 294
           upd_do_query("DELETE FROM {{{$table_name}}} {$where}");
295 295
           break;
296 296
 
297 297
         case SQL_OP_UPDATE:
298
-          if($fields) {
298
+          if ($fields) {
299 299
             upd_do_query("UPDATE {{{$table_name}}} SET {$fields} {$where}");
300 300
           }
301 301
           break;
302 302
 
303 303
         case SQL_OP_INSERT:
304
-          if($fields) {
304
+          if ($fields) {
305 305
             upd_do_query("INSERT INTO {{{$table_name}}} SET {$fields}");
306 306
           }
307 307
           break;
308 308
 
309 309
         case SQL_OP_REPLACE:
310
-          if($fields) {
310
+          if ($fields) {
311 311
             upd_do_query("REPLACE INTO {{{$table_name}}} SET {$fields}");
312 312
           }
313 313
           break;
Please login to merge, or discard this patch.
includes/includes/flt_mission_transport.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
   $source_planet      = &$mission_data['src_planet'];
15 15
   $destination_planet = &$mission_data['dst_planet'];
16 16
 
17
-  if(!isset($destination_planet['id']) || !$destination_planet['id_owner'])
17
+  if (!isset($destination_planet['id']) || !$destination_planet['id_owner'])
18 18
   {
19 19
     // doquery("UPDATE {{fleets}} SET `fleet_mess` = 1 WHERE `fleet_id` = {$fleet_row['fleet_id']} LIMIT 1;");
20 20
     fleet_send_back($fleet_row);
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
     $destination_planet['name'], uni_render_coordinates_href($fleet_row, 'fleet_end_', 3, ''),
28 28
     $fleet_row['fleet_resource_metal'], $lang['Metal'],
29 29
     $fleet_row['fleet_resource_crystal'], $lang['Crystal'],
30
-    $fleet_row['fleet_resource_deuterium'], $lang['Deuterium'] );
30
+    $fleet_row['fleet_resource_deuterium'], $lang['Deuterium']);
31 31
   msg_send_simple_message($fleet_row['fleet_target_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_TRANSPORT, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message);
32 32
 
33
-  if($fleet_row['fleet_target_owner'] <> $fleet_row['fleet_owner'])
33
+  if ($fleet_row['fleet_target_owner'] <> $fleet_row['fleet_owner'])
34 34
   {
35 35
     msg_send_simple_message($fleet_row['fleet_owner'], '', $fleet_row['fleet_start_time'], MSG_TYPE_TRANSPORT, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message);
36 36
   }
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,7 @@
 block discarded – undo
8 8
  * @copyright 2008 By Chlorel for XNova
9 9
  */
10 10
 
11
-function flt_mission_transport(&$mission_data)
12
-{
11
+function flt_mission_transport(&$mission_data) {
13 12
   $fleet_row          = &$mission_data['fleet'];
14 13
   $source_planet      = &$mission_data['src_planet'];
15 14
   $destination_planet = &$mission_data['dst_planet'];
Please login to merge, or discard this patch.
index.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,14 +5,14 @@
 block discarded – undo
5 5
  */
6 6
 global $template;
7 7
 
8
-if(isset($sn_page_name) || ($sn_page_name = isset($_GET['page']) ? trim(strip_tags($_GET['page'])) : '')) {
8
+if (isset($sn_page_name) || ($sn_page_name = isset($_GET['page']) ? trim(strip_tags($_GET['page'])) : '')) {
9 9
   require_once('common.' . substr(strrchr(__FILE__, '.'), 1));
10
-  if($sn_page_name) {
10
+  if ($sn_page_name) {
11 11
     // Loading page-specific language files
12 12
 
13 13
     !empty($sn_mvc['model'][$sn_page_name]) and execute_hooks($sn_mvc['model'][$sn_page_name], $template, 'model', $sn_page_name);
14 14
     !empty($sn_mvc['view'][$sn_page_name]) and execute_hooks($sn_mvc['view'][$sn_page_name], $template, 'view', $sn_page_name);
15
-    if(!empty($template_result) && is_object($template)) {
15
+    if (!empty($template_result) && is_object($template)) {
16 16
       $template->assign_recursive($template_result);
17 17
     }
18 18
 
Please login to merge, or discard this patch.
classes/AjaxController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
     define('IN_AJAX', true);
23 23
 
24
-    if(!is_object($template)) {
24
+    if (!is_object($template)) {
25 25
       $template = gettemplate('_ajax', true);
26 26
     }
27 27
 
@@ -37,16 +37,16 @@  discard block
 block discarded – undo
37 37
 
38 38
     $mode = sys_get_param_str('mode');
39 39
 
40
-    if(class_exists($className = 'Pages\\Page' . ucfirst($mode))) {
40
+    if (class_exists($className = 'Pages\\Page' . ucfirst($mode))) {
41 41
       /**
42 42
        * @var \Pages\IPage $page
43 43
        */
44 44
       $page = new $className();
45
-      if(method_exists($page, 'loadParams')) {
45
+      if (method_exists($page, 'loadParams')) {
46 46
         $page->loadParams();
47 47
       }
48 48
 
49
-      if(method_exists($page, $action = sys_get_param('action')) && $page->checkAction($action)) {
49
+      if (method_exists($page, $action = sys_get_param('action')) && $page->checkAction($action)) {
50 50
         $result = $page->$action();
51 51
         is_array($result) ? HelperArray::merge($template_result['AJAX'], $result) : false;
52 52
       }
Please login to merge, or discard this patch.
classes/PTLTag.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
     $this->raw = $stringTag;
50 50
 
51 51
     // Separating params - so there are will be no false-positives for template's variable names
52
-    if(strpos($this->raw, '|') !== false) {
52
+    if (strpos($this->raw, '|') !== false) {
53 53
       $this->params = explode('|', $this->raw);
54 54
       $this->resolved = $this->params[0];
55 55
       unset($this->params[0]);
Please login to merge, or discard this patch.
classes/Pages/PageQuest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
       QUEST_STATUS_COMPLETE => '',
32 32
     );
33 33
 
34
-    if(!isset($statuses[$this->filterQuestStatus])) {
34
+    if (!isset($statuses[$this->filterQuestStatus])) {
35 35
       $this->filterQuestStatus = QUEST_STATUS_ALL;
36 36
     }
37 37
   }
Please login to merge, or discard this patch.
classes/TextModel.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
       }
102 102
     }
103 103
 
104
-    if(!isset($next)) {
104
+    if (!isset($next)) {
105 105
       $next = new TextEntity();
106 106
     }
107 107
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
       $prev = $this->getById($currentText->prev);
120 120
     }
121 121
 
122
-    if(!isset($prev)) {
122
+    if (!isset($prev)) {
123 123
       $prev = new TextEntity();
124 124
     }
125 125
 
Please login to merge, or discard this patch.
classes/DBAL/DbQuery.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
    * @return string
339 339
    */
340 340
   protected function stringValue($value) {
341
-    return "'" . $this->escape((string)$value) . "'";
341
+    return "'" . $this->escape((string) $value) . "'";
342 342
   }
343 343
 
344 344
   /**
@@ -349,7 +349,7 @@  discard block
 block discarded – undo
349 349
    * @return string
350 350
    */
351 351
   public function quote($fieldName) {
352
-    return "`" . $this->escape((string)$fieldName) . "`";
352
+    return "`" . $this->escape((string) $fieldName) . "`";
353 353
   }
354 354
 
355 355
   /**
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
    * @return string
397 397
    */
398 398
   protected function quoteTable($tableName) {
399
-    return "`{{" . $this->escape((string)$tableName) . "}}`";
399
+    return "`{{" . $this->escape((string) $tableName) . "}}`";
400 400
   }
401 401
 
402 402
   /**
Please login to merge, or discard this patch.