Completed
Push — trunk ( d06df9...f48ee3 )
by SuperNova.WS
11:23
created
classes/SnTemplate.php 1 patch
Spacing   +6 added lines, -6 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
 
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
       'LANG'     => $language ? $language : '',
662 662
       'referral' => $id_ref ? '&id_ref=' . $id_ref : '',
663 663
 
664
-      'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '',// "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''),
664
+      'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '', // "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''),
665 665
       'FILENAME'       => basename($_SERVER['PHP_SELF']),
666 666
     ));
667 667
 
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
       'QUE_ID'   => QUE_RESEARCH,
889 889
       'QUE_HTML' => 'topnav',
890 890
 
891
-      'RESEARCH_ONGOING' => (boolean)$user['que'],
891
+      'RESEARCH_ONGOING' => (boolean) $user['que'],
892 892
 
893 893
       'TIME_TEXT'       => sprintf($str_date_format, $time_now_parsed['year'], $lang['months'][$time_now_parsed['mon']], $time_now_parsed['mday'],
894 894
         $time_now_parsed['hours'], $time_now_parsed['minutes'], $time_now_parsed['seconds']
@@ -1058,7 +1058,7 @@  discard block
 block discarded – undo
1058 1058
 
1059 1059
     $isRenderGlobal = is_object($page) && isset($template_result['GLOBAL_DISPLAY_HEADER']) ? $template_result['GLOBAL_DISPLAY_HEADER'] : true;
1060 1060
 
1061
-    if(self::getCurrentTemplate()->isRenderWhole()) {
1061
+    if (self::getCurrentTemplate()->isRenderWhole()) {
1062 1062
       ob_start();
1063 1063
     } else {
1064 1064
       // Global header
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
       }
1104 1104
     }
1105 1105
 
1106
-    if(self::getCurrentTemplate()->isRenderWhole()) {
1106
+    if (self::getCurrentTemplate()->isRenderWhole()) {
1107 1107
       $renderedContent = ob_get_clean();
1108 1108
       // Global header
1109 1109
       if ($isRenderGlobal) {
@@ -1122,7 +1122,7 @@  discard block
 block discarded – undo
1122 1122
       SnTemplate::renderFooter($page, $template_result);
1123 1123
     }
1124 1124
 
1125
-    $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false;;
1125
+    $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false; ;
1126 1126
 
1127 1127
     sn_db_disconnect();
1128 1128
 
Please login to merge, or discard this patch.
classes/Unit/DBStaticUnit.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
   }
41 41
 
42 42
   public static function db_unit_count_by_user_and_type_and_snid($user_id, $unit_type = 0, $unit_snid = 0) {
43
-    $query  = doquery(
43
+    $query = doquery(
44 44
       "SELECT unit_snid, sum(unit_level) as `qty`  FROM {{unit}} WHERE `unit_player_id` = {$user_id} " .
45 45
       ($unit_type ? "AND `unit_type` = {$unit_type} " : '') .
46 46
       ($unit_snid ? "AND `unit_snid` = {$unit_snid} " : '') .
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
    * @return bool
190 190
    */
191 191
   protected static function dbAdd($playerId, $planetId, $unitSnId, $amount) {
192
-    if (!in_array($unitSnId, sn_get_groups([UNIT_SHIPS_STR, UNIT_DEFENCE_STR, UNIT_ARTIFACTS_STR, UNIT_STRUCTURES_STR,]))) {
192
+    if (!in_array($unitSnId, sn_get_groups([UNIT_SHIPS_STR, UNIT_DEFENCE_STR, UNIT_ARTIFACTS_STR, UNIT_STRUCTURES_STR, ]))) {
193 193
       return false;
194 194
     }
195 195
 
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 //        'unit_level'         => $level,
223 223
 //      ]);
224 224
 
225
-      $fields     += [
225
+      $fields += [
226 226
         'unit_type'  => get_unit_param($unitSnId, P_UNIT_TYPE),
227 227
         'unit_level' => $amount,
228 228
       ];
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 = SnTemplate::gettemplate('_ajax', true);
26 26
     }
27 27
 
@@ -39,16 +39,16 @@  discard block
 block discarded – undo
39 39
 
40 40
     $mode = sys_get_param_str('mode');
41 41
 
42
-    if(class_exists($className = 'Pages\\Page' . ucfirst($mode))) {
42
+    if (class_exists($className = 'Pages\\Page' . ucfirst($mode))) {
43 43
       /**
44 44
        * @var \Pages\IPage $page
45 45
        */
46 46
       $page = new $className();
47
-      if(method_exists($page, 'loadParams')) {
47
+      if (method_exists($page, 'loadParams')) {
48 48
         $page->loadParams();
49 49
       }
50 50
 
51
-      if(method_exists($page, $action = sys_get_param('action')) && $page->checkAction($action)) {
51
+      if (method_exists($page, $action = sys_get_param('action')) && $page->checkAction($action)) {
52 52
         $result = $page->$action();
53 53
         is_array($result) ? HelperArray::merge($template_result['AJAX'], $result) : false;
54 54
       }
Please login to merge, or discard this patch.
classes/Pages/Deprecated/PageAdminUserView.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -281,7 +281,7 @@
 block discarded – undo
281 281
 //    var_dump($pl);
282 282
 //    var_dump(uni_render_planet_full($pl, '', false, true));
283 283
 
284
-    foreach(DBStaticPlanet::db_planet_list_sorted($user_row) as $planetRow) {
284
+    foreach (DBStaticPlanet::db_planet_list_sorted($user_row) as $planetRow) {
285 285
       $result['.']['planet'][] = [
286 286
         'ID' => $planetRow['id'],
287 287
         'NAME' => $planetRow['name'],
Please login to merge, or discard this patch.
classes/Pages/Deprecated/PageMessage.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -345,7 +345,7 @@
 block discarded – undo
345 345
     $wasIgnored = 0;
346 346
     $template = SnTemplate::gettemplate('msg_message_list', true);
347 347
     foreach ($message_query as $message_row) {
348
-      if(
348
+      if (
349 349
         $message_row['message_type'] == MSG_TYPE_PLAYER
350 350
         &&
351 351
         SN::$gc->ignores->isIgnored(floatval($message_row['message_owner']), floatval($message_row['message_sender']))
Please login to merge, or discard this patch.
classes/HelperArray.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
    * @return array
241 241
    */
242 242
   public static function parseParamStrings($array, $delimiter = '=') {
243
-    !is_array($array) ? $array = array((string)$array) : false;
243
+    !is_array($array) ? $array = array((string) $array) : false;
244 244
 
245 245
     $result = array();
246 246
     foreach ($array as $param) {
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
    * @return float|null
263 263
    */
264 264
   public static function maxValueByField(&$array, $fieldName) {
265
-    return array_reduce($array, function ($carry, $item) use ($fieldName) {
266
-      if(is_array($item) && isset($item[$fieldName]) && (!isset($carry) || $carry < $item[$fieldName])) {
265
+    return array_reduce($array, function($carry, $item) use ($fieldName) {
266
+      if (is_array($item) && isset($item[$fieldName]) && (!isset($carry) || $carry < $item[$fieldName])) {
267 267
         $carry = $item[$fieldName];
268 268
       }
269 269
 
@@ -280,8 +280,8 @@  discard block
 block discarded – undo
280 280
 
281 281
     return
282 282
       array_reduce($array,
283
-        function ($carry, $item) use (&$fieldName, $maxValue) {
284
-          if(is_array($item) && isset($item[$fieldName]) && $item[$fieldName] == $maxValue) {
283
+        function($carry, $item) use (&$fieldName, $maxValue) {
284
+          if (is_array($item) && isset($item[$fieldName]) && $item[$fieldName] == $maxValue) {
285 285
             $carry[] = $item;
286 286
           }
287 287
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
   }
293 293
 
294 294
   public static function intersectByKeys(array &$array1, array &$array2) {
295
-    return array_uintersect_assoc($array1, $array2, function ($a, $b) {return 0;});
295
+    return array_uintersect_assoc($array1, $array2, function($a, $b) {return 0; });
296 296
   }
297 297
 
298 298
   /**
Please login to merge, or discard this patch.
classes/Core/GlobalContainer.php 1 patch
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -105,109 +105,109 @@
 block discarded – undo
105 105
 
106 106
     // Services --------------------------------------------------------------------------------------------------------
107 107
     // Default db
108
-    $gc->db = function (GlobalContainer $c) {
108
+    $gc->db = function(GlobalContainer $c) {
109 109
       SN::$db = new db_mysql($c);
110 110
 
111 111
       return SN::$db;
112 112
     };
113 113
 
114
-    $gc->debug = function (/** @noinspection PhpUnusedParameterInspection */
114
+    $gc->debug = function(/** @noinspection PhpUnusedParameterInspection */
115 115
       GlobalContainer $c) {
116 116
       return new debug();
117 117
     };
118 118
 
119
-    $gc->cache = function (GlobalContainer $gc) {
119
+    $gc->cache = function(GlobalContainer $gc) {
120 120
       return new classCache($gc->cachePrefix);
121 121
     };
122 122
 
123
-    $gc->config = function (GlobalContainer $gc) {
123
+    $gc->config = function(GlobalContainer $gc) {
124 124
       return new classConfig($gc->cachePrefix);
125 125
     };
126 126
 
127 127
 
128
-    $gc->repository = function (GlobalContainer $gc) {
128
+    $gc->repository = function(GlobalContainer $gc) {
129 129
       /** @noinspection PhpDeprecationInspection */
130 130
       return new Repository($gc);
131 131
     };
132 132
 
133
-    $gc->storage = function (GlobalContainer $gc) {
133
+    $gc->storage = function(GlobalContainer $gc) {
134 134
       /** @noinspection PhpDeprecationInspection */
135 135
       return new Storage($gc);
136 136
     };
137 137
 
138
-    $gc->repoV2 = function (GlobalContainer $gc) {
138
+    $gc->repoV2 = function(GlobalContainer $gc) {
139 139
       return new RepoV2($gc);
140 140
     };
141 141
 
142
-    $gc->storageV2 = function (GlobalContainer $gc) {
142
+    $gc->storageV2 = function(GlobalContainer $gc) {
143 143
       return new StorageV2($gc);
144 144
     };
145 145
 
146
-    $gc->storageSqlV2 = function (GlobalContainer $gc) {
146
+    $gc->storageSqlV2 = function(GlobalContainer $gc) {
147 147
       return new StorageSqlV2($gc);
148 148
     };
149 149
 
150
-    $gc->design = function (GlobalContainer $gc) {
150
+    $gc->design = function(GlobalContainer $gc) {
151 151
       return new Design($gc);
152 152
     };
153 153
 
154
-    $gc->bbCodeParser = function (GlobalContainer $gc) {
154
+    $gc->bbCodeParser = function(GlobalContainer $gc) {
155 155
       return new BBCodeParser($gc);
156 156
     };
157 157
 
158
-    $gc->fleetDispatcher = function (GlobalContainer $gc) {
158
+    $gc->fleetDispatcher = function(GlobalContainer $gc) {
159 159
       return new FleetDispatcher($gc);
160 160
     };
161 161
 
162
-    $gc->watchdog = function (GlobalContainer $gc) {
162
+    $gc->watchdog = function(GlobalContainer $gc) {
163 163
       return new Watchdog($gc);
164 164
     };
165 165
 
166
-    $gc->valueStorage = function (/** @noinspection PhpUnusedParameterInspection */ GlobalContainer $gc) {
166
+    $gc->valueStorage = function(/** @noinspection PhpUnusedParameterInspection */ GlobalContainer $gc) {
167 167
       return new ValueStorage([]);
168 168
     };
169 169
 
170
-    $gc->bonusCatalog = function (GlobalContainer $gc) {
170
+    $gc->bonusCatalog = function(GlobalContainer $gc) {
171 171
       return new BonusCatalog($gc);
172 172
     };
173 173
 
174
-    $gc->general = function (GlobalContainer $gc) {
174
+    $gc->general = function(GlobalContainer $gc) {
175 175
       return new General($gc);
176 176
     };
177 177
 
178
-    $gc->economicHelper = function (GlobalContainer $gc) {
178
+    $gc->economicHelper = function(GlobalContainer $gc) {
179 179
       return new EconomicHelper($gc);
180 180
     };
181 181
 
182
-    $gc->playerLevelHelper = function (GlobalContainer $gc) {
182
+    $gc->playerLevelHelper = function(GlobalContainer $gc) {
183 183
       return new PlayerLevelHelper($gc);
184 184
     };
185 185
 
186
-    $gc->pimp = function (GlobalContainer $gc) {
186
+    $gc->pimp = function(GlobalContainer $gc) {
187 187
       return new SnPimp($gc);
188 188
     };
189 189
 
190
-    $gc->modules = function (GlobalContainer $gc) {
190
+    $gc->modules = function(GlobalContainer $gc) {
191 191
       return new ModulesManager($gc);
192 192
     };
193 193
 
194 194
     // Dummy objects ---------------------------------------------------------------------------------------------------
195
-    $gc->theUser = function (GlobalContainer $gc) {
195
+    $gc->theUser = function(GlobalContainer $gc) {
196 196
       return new TheUser($gc);
197 197
     };
198 198
 
199 199
 
200 200
     // Models ----------------------------------------------------------------------------------------------------------
201 201
     $gc->skinEntityClass = SkinV2::class;
202
-    $gc->skinModel       = function (GlobalContainer $gc) {
202
+    $gc->skinModel       = function(GlobalContainer $gc) {
203 203
       return new SkinModel($gc);
204 204
     };
205 205
 
206
-    $gc->textModel = function (GlobalContainer $gc) {
206
+    $gc->textModel = function(GlobalContainer $gc) {
207 207
       return new TextModel($gc);
208 208
     };
209 209
 
210
-    $gc->ignores = function (GlobalContainer $gc) {
210
+    $gc->ignores = function(GlobalContainer $gc) {
211 211
       return new PlayerIgnore($gc);
212 212
     };
213 213
 
Please login to merge, or discard this patch.
fleet.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
 $planet = sys_get_param_int('planet', $planetrow['planet']);
45 45
 
46 46
 $target_mission = sys_get_param_int('target_mission');
47
-if($target_mission == MT_COLONIZE || $target_mission == MT_EXPLORE) {
47
+if ($target_mission == MT_COLONIZE || $target_mission == MT_EXPLORE) {
48 48
   $planet_type = PT_PLANET;
49
-} elseif($target_mission == MT_RECYCLE) {
49
+} elseif ($target_mission == MT_RECYCLE) {
50 50
   $planet_type = PT_DEBRIS;
51
-} elseif($target_mission == MT_DESTROY) {
51
+} elseif ($target_mission == MT_DESTROY) {
52 52
   $planet_type = PT_MOON;
53 53
 } else {
54 54
   $planet_type = sys_get_param_int('planet_type');
@@ -64,15 +64,15 @@  discard block
 block discarded – undo
64 64
 //$FlyingFleets = doquery("SELECT COUNT(fleet_id) as Number FROM {{fleets}} WHERE `fleet_owner`='{$user['id']}'", true);
65 65
 //$FlyingFleets = $FlyingFleets['Number'];
66 66
 $FlyingFleets = DbFleetStatic::fleet_count_flying($user['id']);
67
-if($MaxFleets <= $FlyingFleets && $fleet_page && $fleet_page != 4) {
67
+if ($MaxFleets <= $FlyingFleets && $fleet_page && $fleet_page != 4) {
68 68
   SnTemplate::messageBox($lang['fl_noslotfree'], $lang['fl_error'], "fleet." . PHP_EX, 5);
69 69
 }
70 70
 
71 71
 $MaxExpeditions = get_player_max_expeditons($user);
72
-if($MaxExpeditions) {
72
+if ($MaxExpeditions) {
73 73
 //  $FlyingExpeditions  = doquery("SELECT COUNT(fleet_owner) AS `expedi` FROM {{fleets}} WHERE `fleet_owner` = {$user['id']} AND `fleet_mission` = '" . MT_EXPLORE . "';", '', true);
74 74
 //  $FlyingExpeditions  = $FlyingExpeditions['expedi'];
75
-  $FlyingExpeditions  = DbFleetStatic::fleet_count_flying($user['id'], MT_EXPLORE);
75
+  $FlyingExpeditions = DbFleetStatic::fleet_count_flying($user['id'], MT_EXPLORE);
76 76
 } else {
77 77
   $FlyingExpeditions = 0;
78 78
 }
@@ -85,8 +85,8 @@  discard block
 block discarded – undo
85 85
     $fleetarray     = json_decode(base64_decode(str_rot13(sys_get_param('usedfleet'))), true);
86 86
     $fleetarray = is_array($fleetarray) ? $fleetarray : array();
87 87
 
88
-    foreach($fleetarray as $ship_id => &$ship_amount) {
89
-      if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) {
88
+    foreach ($fleetarray as $ship_id => &$ship_amount) {
89
+      if (!in_array($ship_id, sn_get_groups('fleet')) || (string) floatval($ship_amount) != $ship_amount || $ship_amount < 1) {
90 90
         $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true));
91 91
         die();
92 92
       }
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         }
122 122
       } else {
123 123
         $recyclers = 0;
124
-        foreach(sn_get_groups('flt_recyclers') as $recycler_id) {
124
+        foreach (sn_get_groups('flt_recyclers') as $recycler_id) {
125 125
           $recyclers += $fleetarray[$recycler_id];
126 126
         }
127 127
         if ($recyclers > 0 && $planet_type == PT_DEBRIS) {
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
                 $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD];
148 148
 
149
-                if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) {
149
+                if ($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) {
150 150
                   $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY];
151 151
                 }
152 152
               }
@@ -206,14 +206,14 @@  discard block
 block discarded – undo
206 206
 );
207 207
 
208 208
 $is_transport_missions = false;
209
-if($missiontype) {
209
+if ($missiontype) {
210 210
   $sn_group_missions = sn_get_groups('missions');
211
-  foreach($missiontype as $mission_data_id => $mission_data) {
211
+  foreach ($missiontype as $mission_data_id => $mission_data) {
212 212
     $is_transport_missions = $is_transport_missions || (isset($sn_group_missions[$mission_data_id]['transport']) && $sn_group_missions[$mission_data_id]['transport']);
213 213
   }
214 214
 }
215 215
 
216
-switch($fleet_page) {
216
+switch ($fleet_page) {
217 217
   case 1:
218 218
     require('includes/includes/flt_page1.inc');
219 219
   break;
Please login to merge, or discard this patch.
time_probe.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@
 block discarded – undo
12 12
 $time_server = $time_local  - $time_diff
13 13
 */
14 14
 
15
-if($font_size = sys_get_param_str('font_size')) {
16
-  if(strpos($font_size, '%') !== false) {
15
+if ($font_size = sys_get_param_str('font_size')) {
16
+  if (strpos($font_size, '%') !== false) {
17 17
     // Размер шрифта в процентах
18 18
     $font_size = min(max(floatval($font_size), FONT_SIZE_PERCENT_MIN), FONT_SIZE_PERCENT_MAX) . '%';
19
-  } elseif(strpos($font_size, 'px') !== false) {
19
+  } elseif (strpos($font_size, 'px') !== false) {
20 20
     // Размер шрифта в пикселях
21 21
     $font_size = min(max(floatval($font_size), FONT_SIZE_PIXELS_MIN), FONT_SIZE_PIXELS_MAX) . 'px';
22 22
   } else {
Please login to merge, or discard this patch.