Test Failed
Push — trunk ( cc4c01...dc8fe4 )
by SuperNova.WS
13:09
created
classes/Template/TemplateMeta.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@
 block discarded – undo
136 136
 //    var_dump($fallBackPath);
137 137
 //    var_dump($template);
138 138
 
139
-    if(empty($fallBackPath)) {
139
+    if (empty($fallBackPath)) {
140 140
       if (!$this->parent || empty($fallbackName = $this->parent->getName()) || !$this->isTemplateExists()) {
141 141
         // If no parent template - then using default template as fallback one
142 142
         $fallbackName = SnTemplate::SN_TEMPLATE_NAME_DEFAULT;
Please login to merge, or discard this patch.
classes/classPersistent.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     $this->sql_index_field = "{$table_name}_name";
41 41
     $this->sql_value_field = "{$table_name}_value";
42 42
 
43
-    if(!$this->_DB_LOADED) {
43
+    if (!$this->_DB_LOADED) {
44 44
       $this->db_loadAll();
45 45
     }
46 46
   }
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
    */
61 61
   public function db_loadItem($index) {
62 62
     $result = null;
63
-    if($index) {
63
+    if ($index) {
64 64
       $index_safe = SN::$db->db_escape($index);
65 65
       $queryResult = doquery("SELECT `{$this->sql_value_field}` FROM `{{{$this->table_name}}}` WHERE `{$this->sql_index_field}` = '{$index_safe}' FOR UPDATE", true);
66
-      if(is_array($queryResult) && !empty($queryResult)) {
66
+      if (is_array($queryResult) && !empty($queryResult)) {
67 67
         $this->$index = $result = $queryResult[$this->sql_value_field];
68 68
       }
69 69
     }
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
     $this->loadDefaults();
76 76
 
77 77
     $query = doquery("SELECT * FROM {{{$this->table_name}}} FOR UPDATE;");
78
-    while($row = db_fetch($query)) {
78
+    while ($row = db_fetch($query)) {
79 79
       $this[$row[$this->sql_index_field]] = $row[$this->sql_value_field];
80 80
     }
81 81
 
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
   }
84 84
 
85 85
   public function loadDefaults() {
86
-    foreach($this->defaults as $defName => $defValue) {
86
+    foreach ($this->defaults as $defName => $defValue) {
87 87
       $this->$defName = $defValue;
88 88
     }
89 89
   }
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
   }
94 94
 
95 95
   public function db_saveItem($item_list, $value = NULL) {
96
-    if(empty($item_list)) {
96
+    if (empty($item_list)) {
97 97
       return;
98 98
     }
99 99
 
@@ -101,8 +101,8 @@  discard block
 block discarded – undo
101 101
 
102 102
     // Сначала записываем данные в базу - что бы поймать все блокировки
103 103
     $qry = array();
104
-    foreach($item_list as $item_name => $item_value) {
105
-      if($item_name) {
104
+    foreach ($item_list as $item_name => $item_value) {
105
+      if ($item_name) {
106 106
         $item_value = SN::$db->db_escape($item_value === NULL ? $this->$item_name : $item_value);
107 107
         $item_name = SN::$db->db_escape($item_name);
108 108
         $qry[] = "('{$item_name}', '{$item_value}')";
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
     doquery("REPLACE INTO `{{" . $this->table_name . "}}` (`{$this->sql_index_field}`, `{$this->sql_value_field}`) VALUES " . implode(',', $qry) . ";");
112 112
 
113 113
     // И только после взятия блокировок - меняем значения в кэше
114
-    foreach($item_list as $item_name => $item_value) {
115
-      if($item_name && $item_value !== null) {
114
+    foreach ($item_list as $item_name => $item_value) {
115
+      if ($item_name && $item_value !== null) {
116 116
         $this->__set($item_name, $item_value);
117 117
       }
118 118
     }
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
   }
141 141
 
142 142
   public function __get($name) {
143
-    if($this->force) {
143
+    if ($this->force) {
144 144
       $this->force = false;
145 145
       $value = $this->db_loadItem($name);
146 146
     } else {
147 147
       $value = parent::__get($name);
148 148
     }
149 149
 
150
-    if(isset($this->notEmptyFields[$name]) && empty($value) && isset($this->defaults[$name])) {
150
+    if (isset($this->notEmptyFields[$name]) && empty($value) && isset($this->defaults[$name])) {
151 151
       $value = $this->defaults[$name];
152 152
     }
153 153
 
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
   }
156 156
 
157 157
   public function __set($name, $value) {
158
-    if($this->force) {
158
+    if ($this->force) {
159 159
       $this->force = false;
160 160
       $this->db_saveItem($name, $value);
161 161
     }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     $this->db_saveItem(array_combine(array_keys($this->defaults), array_fill(0, count($this->defaults), null)));
93 93
   }
94 94
 
95
-  public function db_saveItem($item_list, $value = NULL) {
95
+  public function db_saveItem($item_list, $value = null) {
96 96
     if(empty($item_list)) {
97 97
       return;
98 98
     }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
     $qry = array();
104 104
     foreach($item_list as $item_name => $item_value) {
105 105
       if($item_name) {
106
-        $item_value = SN::$db->db_escape($item_value === NULL ? $this->$item_name : $item_value);
106
+        $item_value = SN::$db->db_escape($item_value === null ? $this->$item_name : $item_value);
107 107
         $item_name = SN::$db->db_escape($item_name);
108 108
         $qry[] = "('{$item_name}', '{$item_value}')";
109 109
       }
Please login to merge, or discard this patch.
classes/DBAL/OldDbChangeSet.php 1 patch
Spacing   +1 added lines, -3 removed lines patch added patch discarded remove patch
@@ -142,9 +142,7 @@
 block discarded – undo
142 142
           // Простое условие - $field_id = $field_value
143 143
           if (is_string($field_id)) {
144 144
             $field_value =
145
-              $field_value === null ? 'NULL' :
146
-                (is_string($field_value) ? "'" . SN::$db->db_escape($field_value) . "'" :
147
-                  (is_bool($field_value) ? intval($field_value) : $field_value));
145
+              $field_value === null ? 'NULL' : (is_string($field_value) ? "'" . SN::$db->db_escape($field_value) . "'" : (is_bool($field_value) ? intval($field_value) : $field_value));
148 146
             $the_conditions[] = "`{$field_id}` = {$field_value}";
149 147
           } else {
150 148
             die('Неподдерживаемый тип условия');
Please login to merge, or discard this patch.
classes/DBAL/db_mysql.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 
225 225
     set_error_handler([$this, 'handlerQueryWarning']);
226 226
     $sqlquery = $this->db_sql_query($sql);
227
-    if(!$sqlquery) {
227
+    if (!$sqlquery) {
228 228
       $debug->error(SN::$db->db_error() . "<br />$sql<br />", 'SQL Error');
229 229
     }
230 230
     restore_error_handler();
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
     $q1 = $this->db_sql_query("SHOW INDEX FROM {$prefixedTableName_safe};");
397 397
     while ($r1 = db_fetch($q1)) {
398 398
       $indexName = $r1['Key_name'];
399
-      if(empty($result[$indexName])) {
399
+      if (empty($result[$indexName])) {
400 400
         $result[$indexName] = new DbIndexDescription();
401 401
       }
402 402
       $result[$indexName]->addField($r1);
Please login to merge, or discard this patch.
classes/StatUpdateLauncher.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@
 block discarded – undo
56 56
         $config->pass()->game_disable = GAME_DISABLE_STAT;
57 57
 
58 58
         $statMinimalInterval = intval($config->pass()->stats_minimal_interval);
59
-        $config->pass()->var_stat_update_end= date(FMT_DATE_TIME_SQL, SN_TIME_NOW + ($statMinimalInterval ? $statMinimalInterval : STATS_RUN_INTERVAL_MINIMUM));
59
+        $config->pass()->var_stat_update_end = date(FMT_DATE_TIME_SQL, SN_TIME_NOW + ($statMinimalInterval ? $statMinimalInterval : STATS_RUN_INTERVAL_MINIMUM));
60 60
         $config->pass()->var_stat_update_msg = 'Update started';
61 61
         SN::db_transaction_commit();
62 62
 
Please login to merge, or discard this patch.
classes/SnTemplate.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
         $insert_position = $is_positioned == '-' ? 0 : count($menu);
129 129
       }
130 130
 
131
-      $insert_position     += $is_positioned == '+' ? 1 : 0;
131
+      $insert_position += $is_positioned == '+' ? 1 : 0;
132 132
       $spliced             = array_splice($menu, $insert_position, count($menu) - $insert_position);
133 133
       $menu[$menu_item_id] = $menu_item;
134 134
 
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
       'LANG'     => $language ? $language : '',
649 649
       'referral' => $id_ref ? '&id_ref=' . $id_ref : '',
650 650
 
651
-      'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '',// "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''),
651
+      'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '', // "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''),
652 652
       'FILENAME'       => basename($_SERVER['PHP_SELF']),
653 653
     ));
654 654
 
@@ -836,7 +836,7 @@  discard block
 block discarded – undo
836 836
       }
837 837
 
838 838
       $fleet_listx = flt_get_fleets_to_planet($CurPlanet);
839
-      if($CurPlanet['planet_type'] == PT_MOON) {
839
+      if ($CurPlanet['planet_type'] == PT_MOON) {
840 840
         $parentPlanet = DBStaticPlanet::db_planet_by_id($CurPlanet['parent_planet']);
841 841
       } else {
842 842
         $parentPlanet = $CurPlanet;
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
       'QUE_ID'   => QUE_RESEARCH,
882 882
       'QUE_HTML' => 'topnav',
883 883
 
884
-      'RESEARCH_ONGOING' => (boolean)$user['que'],
884
+      'RESEARCH_ONGOING' => (boolean) $user['que'],
885 885
 
886 886
       'TIME_TEXT'       => sprintf($str_date_format, $time_now_parsed['year'], $lang['months'][$time_now_parsed['mon']], $time_now_parsed['mday'],
887 887
         $time_now_parsed['hours'], $time_now_parsed['minutes'], $time_now_parsed['seconds']
@@ -1171,7 +1171,7 @@  discard block
 block discarded – undo
1171 1171
       SnTemplate::renderFooter($page, $template_result);
1172 1172
     }
1173 1173
 
1174
-    $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false;;
1174
+    $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false; ;
1175 1175
 
1176 1176
     SN::$db->db_disconnect();
1177 1177
 
Please login to merge, or discard this patch.
galaxy.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
   $planet = $planetrow['planet'];
66 66
 }
67 67
 
68
-$uni_galaxy = (int)$uni_galaxy;
69
-$uni_system = (int)$uni_system;
68
+$uni_galaxy = (int) $uni_galaxy;
69
+$uni_system = (int) $uni_system;
70 70
 
71 71
 $uni_galaxy = $uni_galaxy < 1 ? 1 : ($uni_galaxy > SN::$config->game_maxGalaxy ? SN::$config->game_maxGalaxy : $uni_galaxy);
72 72
 $uni_system = $uni_system < 1 ? 1 : ($uni_system > SN::$config->game_maxSystem ? SN::$config->game_maxSystem : $uni_system);
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     ||
132 132
     (!empty($uni_galaxyRowPlanet['destruyed']) && CheckAbandonPlanetState($uni_galaxyRowPlanet))
133 133
   ) {
134
-    $template->assign_block_vars('galaxyrow', ['PLANET_NUM' => $Planet,]);
134
+    $template->assign_block_vars('galaxyrow', ['PLANET_NUM' => $Planet, ]);
135 135
     continue;
136 136
   }
137 137
 
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
     'IS_CAPITAL'      => $uni_galaxyRowUser['id_planet'] == $uni_galaxyRowPlanet['id'],
250 250
 
251 251
     'USER_ID'         => $uni_galaxyRowUser['id'],
252
-    'USER_NAME'       => $renderedNick = player_nick_render_to_html($uni_galaxyRowUser, ['icons' => true,]),
252
+    'USER_NAME'       => $renderedNick = player_nick_render_to_html($uni_galaxyRowUser, ['icons' => true, ]),
253 253
     'USER_NAME_JS'    => js_safe_string($renderedNick),
254 254
     'USER_RANK'       => in_array($uni_galaxyRowUser['id'], $user_skip_list) ? '-' : $uni_galaxyRowUser['total_rank'],
255 255
     'USER_BANNED'     => $uni_galaxyRowUser['banaday'],
Please login to merge, or discard this patch.
includes/db/db_helpers.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,19 +29,19 @@  discard block
 block discarded – undo
29 29
  */
30 30
 function db_set_make_safe_string($set, $delta = false) {
31 31
   $set_safe = array();
32
-  foreach($set as $field => $value) {
33
-    if(empty($field)) {
32
+  foreach ($set as $field => $value) {
33
+    if (empty($field)) {
34 34
       continue;
35 35
     }
36 36
 
37 37
     $field = '`' . SN::$db->db_escape($field) . '`';
38 38
     $new_value = $value;
39
-    if($value === null) {
39
+    if ($value === null) {
40 40
       $new_value = 'NULL';
41
-    } elseif(is_string($value) && (string)($new_value = floatval($value)) != (string)$value) {
41
+    } elseif (is_string($value) && (string) ($new_value = floatval($value)) != (string) $value) {
42 42
       // non-float
43 43
       $new_value = '"' . SN::$db->db_escape($value) . '"';
44
-    } elseif($delta) {
44
+    } elseif ($delta) {
45 45
       // float and DELTA-set
46 46
       $new_value = "{$field} + ({$new_value})";
47 47
     }
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
  */
62 62
 function missile_list_convert_to_fleet(&$missile_db_list, &$fleet_db_list) {
63 63
   // Missile attack
64
-  foreach($missile_db_list as $irak) {
65
-    if($irak['fleet_end_time'] >= SN_TIME_NOW) {
64
+  foreach ($missile_db_list as $irak) {
65
+    if ($irak['fleet_end_time'] >= SN_TIME_NOW) {
66 66
       $irak['fleet_start_type'] = PT_PLANET;
67 67
       $planet_start = DBStaticPlanet::db_planet_by_vector($irak, 'fleet_start_', false, 'name');
68 68
       $irak['fleet_id'] = -$irak['id'];
Please login to merge, or discard this patch.
includes/functions/sys_user.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 function sys_user_vacation($user) {
13 13
   global $config;
14 14
 
15
-  if(sys_get_param_str('vacation') == 'leave') {
15
+  if (sys_get_param_str('vacation') == 'leave') {
16 16
     if ($user['vacation'] < SN_TIME_NOW) {
17 17
       $user['vacation'] = 0;
18 18
       $user['vacation_next'] = SN_TIME_NOW + $config->player_vacation_timeout;
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
     }
21 21
   }
22 22
 
23
-  if($user['vacation']) {
23
+  if ($user['vacation']) {
24 24
     // sn_sys_logout(false, true);
25 25
     // core_auth::logout(false, true);
26 26
 
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
   \DBAL\DbQuery::build()->setTable('users')->setValues($field_set)->doInsert();
164 164
   $user_new = db_user_by_id(SN::$db->db_insert_id());
165 165
 
166
-  if(!($options['galaxy'] && $options['system'] && $options['planet'])) {
166
+  if (!($options['galaxy'] && $options['system'] && $options['planet'])) {
167 167
     $options['galaxy'] = SN::$config->LastSettedGalaxyPos;
168 168
     $options['system'] = SN::$config->LastSettedSystemPos;
169 169
     $segment_size = floor(SN::$config->game_maxPlanet / 3);
@@ -171,19 +171,19 @@  discard block
 block discarded – undo
171 171
     $segment++;
172 172
     $options['planet'] = mt_rand(1 + $segment * $segment_size, ($segment + 1) * $segment_size);
173 173
 
174
-    while(true) {
175
-      if($options['planet'] > SN::$config->game_maxPlanet) {
174
+    while (true) {
175
+      if ($options['planet'] > SN::$config->game_maxPlanet) {
176 176
         $options['planet'] = mt_rand(0, $segment_size - 1) + 1;
177 177
         $options['system']++;
178 178
       }
179
-      if($options['system'] > SN::$config->game_maxSystem) {
179
+      if ($options['system'] > SN::$config->game_maxSystem) {
180 180
         $options['system'] = 1;
181 181
         $options['galaxy']++;
182 182
       }
183 183
       $options['galaxy'] > SN::$config->game_maxGalaxy ? $options['galaxy'] = 1 : false;
184 184
 
185 185
       $galaxy_row = DBStaticPlanet::db_planet_by_gspt($options['galaxy'], $options['system'], $options['planet'], PT_PLANET, true, 'id');
186
-      if(!$galaxy_row['id']) {
186
+      if (!$galaxy_row['id']) {
187 187
         SN::$config->db_saveItem(array(
188 188
           'LastSettedGalaxyPos' => $options['galaxy'],
189 189
           'LastSettedSystemPos' => $options['system'],
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
   $username_safe = SN::$db->db_escape($username_unsafe);
205 205
   doquery("REPLACE INTO `{{player_name_history}}` SET `player_id` = {$user_new['id']}, `player_name` = '{$username_safe}'");
206 206
 
207
-  if(!empty($options['partner_id']) && ($referral_row = db_user_by_id($options['partner_id'], true))) {
207
+  if (!empty($options['partner_id']) && ($referral_row = db_user_by_id($options['partner_id'], true))) {
208 208
     doquery("INSERT INTO `{{referrals}}` SET `id` = {$user_new['id']}, `id_partner` = {$options['partner_id']}");
209 209
   }
210 210
 
Please login to merge, or discard this patch.