Completed
Push — work-fleets ( 21e5a3...e0f70d )
by SuperNova.WS
05:07
created
infos.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -12,16 +12,16 @@  discard block
 block discarded – undo
12 12
 include('common.' . substr(strrchr(__FILE__, '.'), 1));
13 13
 
14 14
 $unit_id = sys_get_param_id('gid');
15
-if($unit_id == RES_DARK_MATTER) {
15
+if ($unit_id == RES_DARK_MATTER) {
16 16
   sys_redirect('dark_matter.php');
17 17
 }
18 18
 
19
-if($unit_id == RES_METAMATTER) {
19
+if ($unit_id == RES_METAMATTER) {
20 20
   sys_redirect('metamatter.php');
21 21
 }
22 22
 
23 23
 lng_include('infos');
24
-if(!$unit_id || (!get_unit_param($unit_id) && !isset(classLocale::$lang['info'][$unit_id]))) {
24
+if (!$unit_id || (!get_unit_param($unit_id) && !isset(classLocale::$lang['info'][$unit_id]))) {
25 25
   sys_redirect('index.php?page=techtree');
26 26
 }
27 27
 
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 $unit_data = get_unit_param($unit_id);
31 31
 $unit_type = $unit_data['type'];
32 32
 
33
-if($unit_type == UNIT_SHIPS) {
33
+if ($unit_type == UNIT_SHIPS) {
34 34
   $template_result['UNIT_IS_SHIP'] = true;
35 35
 
36 36
   $ship_data = get_ship_data($unit_id, $user);
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
   );
47 47
 
48 48
   $engine_template_info = array();
49
-  foreach($unit_data['engine'] as $unit_engine_data) {
49
+  foreach ($unit_data['engine'] as $unit_engine_data) {
50 50
     $unit_engine_data = get_engine_data($user, $unit_engine_data);
51 51
 
52 52
     $engine_template_info[] = array(
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 
66 66
 
67 67
 $sn_data_group_combat = sn_get_groups('combat');
68
-if(in_array($unit_id, $sn_data_group_combat)) {
68
+if (in_array($unit_id, $sn_data_group_combat)) {
69 69
   $template_result['UNIT_IS_COMBAT'] = true;
70 70
 
71 71
   $unit_durability = $unit_data['shield'] + $unit_data['armor'];
@@ -73,21 +73,21 @@  discard block
 block discarded – undo
73 73
   $volley_arr = $rapid_to = $rapid_from = array();
74 74
   $str_rapid_from = '';
75 75
   $str_rapid_to = '';
76
-  foreach($sn_data_group_combat as $enemy_id) {
76
+  foreach ($sn_data_group_combat as $enemy_id) {
77 77
     $enemy_data = get_unit_param($enemy_id);
78 78
     $enemy_durability = $enemy_data['shield'] + $enemy_data['armor'];
79 79
 
80 80
     $rapid = $unit_data['attack'] * (isset($unit_data['amplify'][$enemy_id]) ? $unit_data['amplify'][$enemy_id] : 1) / $enemy_durability;
81
-    if($rapid >= 1) {
81
+    if ($rapid >= 1) {
82 82
       $volley_arr[$enemy_id]['TO'] = floor($rapid);
83 83
     }
84 84
 
85 85
     $rapid = $enemy_data['attack'] * (isset($enemy_data['amplify'][$unit_id]) ? $enemy_data['amplify'][$unit_id] : 1) / $unit_durability;
86
-    if($rapid >= 1) {
86
+    if ($rapid >= 1) {
87 87
       $volley_arr[$enemy_id]['FROM'] = floor($rapid);
88 88
     }
89 89
   }
90
-  foreach($volley_arr as $enemy_id => &$rapid) {
90
+  foreach ($volley_arr as $enemy_id => &$rapid) {
91 91
     $rapid['ENEMY_ID'] = $enemy_id;
92 92
     $rapid['ENEMY_NAME'] = classLocale::$lang['tech'][$enemy_id];
93 93
   }
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
 
106 106
 }
107 107
 
108
-if(classLocale::$lang['info'][$unit_id]['effect']) {
108
+if (classLocale::$lang['info'][$unit_id]['effect']) {
109 109
   $template_result['UNIT_EFFECT'] = classLocale::$lang['info'][$unit_id]['effect'];
110 110
 }
111 111
 
112
-if($unit_data['bonus']) {
112
+if ($unit_data['bonus']) {
113 113
   $unit_bonus = !$unit_data['bonus'] || $unit_data['bonus_type'] == BONUS_ABILITY ? '' : (
114 114
     ($unit_data['bonus'] >= 0 ? '+' : '') . $unit_data['bonus'] . ($unit_data['bonus_type'] == BONUS_PERCENT ? '%' : '')
115 115
   );
@@ -174,20 +174,20 @@  discard block
 block discarded – undo
174 174
   ));
175 175
 
176 176
   $ActualProd = floor($Prod[$BuildID]);
177
-  if($BuildID != STRUC_MINE_FUSION) {
177
+  if ($BuildID != STRUC_MINE_FUSION) {
178 178
     $ActualNeed = floor($Prod[STRUC_MINE_SOLAR]);
179 179
   } else {
180 180
     $ActualNeed = floor($Prod[STRUC_MINE_DEUTERIUM]);
181 181
   }
182 182
 
183 183
   $BuildStartLvl = $CurrentBuildtLvl - 2;
184
-  if($BuildStartLvl < 1) {
184
+  if ($BuildStartLvl < 1) {
185 185
     $BuildStartLvl = 1;
186 186
   }
187 187
   $Table = '';
188 188
   $ProdFirst = 0;
189
-  for($BuildLevel = $BuildStartLvl; $BuildLevel < $BuildStartLvl + 10; $BuildLevel++) {
190
-    if($BuildID != STRUC_MOON_PHALANX) {
189
+  for ($BuildLevel = $BuildStartLvl; $BuildLevel < $BuildStartLvl + 10; $BuildLevel++) {
190
+    if ($BuildID != STRUC_MOON_PHALANX) {
191 191
       $Prod[STRUC_MINE_METAL] = floor(mrc_modify_value(
192 192
         $CurrentUser,
193 193
         $CurrentPlanet,
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
       ));
215 215
 
216 216
       $bloc['build_lvl'] = ($CurrentBuildtLvl == $BuildLevel) ? "<font color=\"#ff0000\">" . $BuildLevel . "</font>" : $BuildLevel;
217
-      if($ProdFirst > 0) {
218
-        if($BuildID != STRUC_MINE_FUSION) {
217
+      if ($ProdFirst > 0) {
218
+        if ($BuildID != STRUC_MINE_FUSION) {
219 219
           $bloc['build_gain'] = "<font color=\"lime\">(" . pretty_number(floor($Prod[$BuildID] - $ProdFirst)) . ")</font>";
220 220
         } else {
221 221
           $bloc['build_gain'] = "<font color=\"lime\">(" . pretty_number(floor($Prod[STRUC_MINE_SOLAR] - $ProdFirst)) . ")</font>";
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
       } else {
224 224
         $bloc['build_gain'] = '';
225 225
       }
226
-      if($BuildID != STRUC_MINE_FUSION) {
226
+      if ($BuildID != STRUC_MINE_FUSION) {
227 227
         $bloc['build_prod'] = pretty_number(floor($Prod[$BuildID]));
228 228
         $bloc['build_prod_diff'] = pretty_number(floor($Prod[$BuildID] - $ActualProd), true, true);
229 229
         $bloc['build_need'] = pretty_number(floor($Prod[STRUC_MINE_SOLAR]), true, true);
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
         $bloc['build_need'] = pretty_number(floor($Prod[STRUC_MINE_DEUTERIUM]), true, true);
235 235
         $bloc['build_need_diff'] = pretty_number(floor($Prod[STRUC_MINE_DEUTERIUM] - $ActualNeed), true, true);
236 236
       }
237
-      if($ProdFirst == 0) {
238
-        if($BuildID != STRUC_MINE_FUSION) {
237
+      if ($ProdFirst == 0) {
238
+        if ($BuildID != STRUC_MINE_FUSION) {
239 239
           $ProdFirst = floor($Prod[$BuildID]);
240 240
         } else {
241 241
           $ProdFirst = floor($Prod[STRUC_MINE_SOLAR]);
@@ -260,22 +260,22 @@  discard block
 block discarded – undo
260 260
 
261 261
   $str_rapid_from = '';
262 262
   $str_rapid_to = '';
263
-  foreach(sn_get_groups(array('fleet', 'defense_active')) as $enemy_id) {
263
+  foreach (sn_get_groups(array('fleet', 'defense_active')) as $enemy_id) {
264 264
     $enemy_data = get_unit_param($enemy_id);
265 265
     $enemy_durability = $enemy_data['shield'] + $enemy_data['armor'];
266 266
 
267 267
     $rapid = floor($unit_data['attack'] * (isset($unit_data['amplify'][$enemy_id]) ? $unit_data['amplify'][$enemy_id] : 1) / $enemy_durability);
268
-    if($rapid >= 1) {
268
+    if ($rapid >= 1) {
269 269
       $str_rapid_to .= "{$lang['nfo_rf_again']} {$lang['tech'][$enemy_id]} <font color=\"#00ff00\">{$rapid}</font><br>";
270 270
     }
271 271
 
272 272
     $rapid = floor($enemy_data['attack'] * (isset($enemy_data['amplify'][$unit_id]) ? $enemy_data['amplify'][$unit_id] : 1) / $unit_durability);
273
-    if($rapid >= 1) {
273
+    if ($rapid >= 1) {
274 274
       $str_rapid_from .= "{$lang['tech'][$enemy_id]} {$lang['nfo_rf_from']} <font color=\"#ff0000\">{$rapid}</font><br>";
275 275
     }
276 276
   }
277 277
 
278
-  if($str_rapid_to && $str_rapid_from) {
278
+  if ($str_rapid_to && $str_rapid_from) {
279 279
     $str_rapid_to .= '<hr>';
280 280
   }
281 281
 
@@ -304,75 +304,75 @@  discard block
 block discarded – undo
304 304
 
305 305
 $unit_info = get_unit_param($unit_id);
306 306
 
307
-if($unit_id >= 1 && $unit_id <= 3) {
307
+if ($unit_id >= 1 && $unit_id <= 3) {
308 308
   // Cas des mines
309 309
   $PageTPL = gettemplate('info_buildings_table');
310 310
   $DestroyTPL = gettemplate('info_buildings_destroy');
311 311
   $TableHeadTPL = "<tr><td class=\"c\">{nfo_level}</td><td class=\"c\">{nfo_prod_p_hour}</td><td class=\"c\">{nfo_difference}</td><td class=\"c\">{nfo_used_energy}</td><td class=\"c\">{nfo_difference}</td></tr>";
312 312
   $TableTPL = "<tr><th>{build_lvl}</th><th>{build_prod} {build_gain}</th><th>{build_prod_diff}</th><th>{build_need}</th><th>{build_need_diff}</th></tr>";
313
-} elseif($unit_id == 4) {
313
+} elseif ($unit_id == 4) {
314 314
   // Centrale Solaire
315 315
   $PageTPL = gettemplate('info_buildings_table');
316 316
   $DestroyTPL = gettemplate('info_buildings_destroy');
317 317
   $TableHeadTPL = "<tr><td class=\"c\">{nfo_level}</td><td class=\"c\">{nfo_prod_energy}</td><td class=\"c\">{nfo_difference}</td></tr>";
318 318
   $TableTPL = "<tr><th>{build_lvl}</th><th>{build_prod} {build_gain}</th><th>{build_prod_diff}</th></tr>";
319
-} elseif($unit_id == STRUC_MINE_FUSION) {
319
+} elseif ($unit_id == STRUC_MINE_FUSION) {
320 320
   // Centrale Fusion
321 321
   $PageTPL = gettemplate('info_buildings_table');
322 322
   $DestroyTPL = gettemplate('info_buildings_destroy');
323 323
   $TableHeadTPL = "<tr><td class=\"c\">{nfo_level}</td><td class=\"c\">{nfo_prod_energy}</td><td class=\"c\">{nfo_difference}</td><td class=\"c\">{nfo_used_deuter}</td><td class=\"c\">{nfo_difference}</td></tr>";
324 324
   $TableTPL = "<tr><th>{build_lvl}</th><th>{build_prod} {build_gain}</th><th>{build_prod_diff}</th><th>{build_need}</th><th>{build_need_diff}</th></tr>";
325
-} elseif($unit_id >= STRUC_FACTORY_ROBOT && $unit_id <= 32) {
325
+} elseif ($unit_id >= STRUC_FACTORY_ROBOT && $unit_id <= 32) {
326 326
   // Batiments Generaux
327 327
   $PageTPL = gettemplate('info_buildings_general');
328 328
   $DestroyTPL = gettemplate('info_buildings_destroy');
329
-} elseif($unit_id == STRUC_TERRAFORMER) {
329
+} elseif ($unit_id == STRUC_TERRAFORMER) {
330 330
   // Batiments Terraformer
331 331
   $PageTPL = gettemplate('info_buildings_general');
332
-} elseif($unit_id == STRUC_ALLY_DEPOSIT) {
332
+} elseif ($unit_id == STRUC_ALLY_DEPOSIT) {
333 333
   // Dépot d'alliance
334 334
   $PageTPL = gettemplate('info_buildings_general');
335 335
   $DestroyTPL = gettemplate('info_buildings_destroy');
336
-} elseif($unit_id == STRUC_LABORATORY_NANO) {
336
+} elseif ($unit_id == STRUC_LABORATORY_NANO) {
337 337
   // nano
338 338
   $PageTPL = gettemplate('info_buildings_general');
339 339
   $DestroyTPL = gettemplate('info_buildings_destroy');
340
-} elseif($unit_id == STRUC_SILO) {
340
+} elseif ($unit_id == STRUC_SILO) {
341 341
   // Silo de missiles
342 342
   $PageTPL = gettemplate('info_buildings_general');
343 343
   $DestroyTPL = gettemplate('info_buildings_destroy');
344
-} elseif($unit_id == STRUC_MOON_STATION) {
344
+} elseif ($unit_id == STRUC_MOON_STATION) {
345 345
   // Batiments lunaires
346 346
   $PageTPL = gettemplate('info_buildings_general');
347
-} elseif($unit_id == STRUC_MOON_PHALANX) {
347
+} elseif ($unit_id == STRUC_MOON_PHALANX) {
348 348
   // Phalange
349 349
   $PageTPL = gettemplate('info_buildings_table');
350 350
   $TableHeadTPL = "<tr><td class=\"c\">{nfo_level}</td><td class=\"c\">{nfo_range}</td></tr>";
351 351
   $TableTPL = "<tr><th>{build_lvl}</th><th>{build_range}</th></tr>";
352 352
   $DestroyTPL = gettemplate('info_buildings_destroy');
353
-} elseif($unit_id == STRUC_MOON_GATE) {
353
+} elseif ($unit_id == STRUC_MOON_GATE) {
354 354
   // Porte de Saut
355 355
   $PageTPL = gettemplate('info_buildings_general');
356 356
   $DestroyTPL = gettemplate('info_buildings_destroy');
357
-} elseif(in_array($unit_id, sn_get_groups('tech'))) {
357
+} elseif (in_array($unit_id, sn_get_groups('tech'))) {
358 358
   // Laboratoire
359 359
   $PageTPL = gettemplate('info_buildings_general');
360
-} elseif(in_array($unit_id, sn_get_groups('fleet'))) {
360
+} elseif (in_array($unit_id, sn_get_groups('fleet'))) {
361 361
   // Flotte
362 362
 
363 363
   $PageTPL = gettemplate('info_buildings_fleet');
364 364
 
365 365
   $parse['element_typ'] = classLocale::$lang['tech'][UNIT_SHIPS];
366 366
   $rapid_fire = eco_render_rapid_fire($unit_id);
367
-  $parse['rf_info_to'] = $rapid_fire['to'];   // Rapid Fire vers
367
+  $parse['rf_info_to'] = $rapid_fire['to']; // Rapid Fire vers
368 368
   $parse['rf_info_fr'] = $rapid_fire['from']; // Rapid Fire de
369 369
 
370 370
   $parse['hull_pt'] = pretty_number(($unit_info['metal'] + $unit_info['crystal']) / 10); // Points de Structure
371
-  $parse['shield_pt'] = pretty_number($unit_info['shield']);  // Points de Bouclier
372
-  $parse['attack_pt'] = pretty_number($unit_info['attack']);  // Points d'Attaque
371
+  $parse['shield_pt'] = pretty_number($unit_info['shield']); // Points de Bouclier
372
+  $parse['attack_pt'] = pretty_number($unit_info['attack']); // Points d'Attaque
373 373
   $parse['capacity_pt'] = pretty_number($unit_info['capacity']); // Capacitée de fret
374
-  $parse['base_speed'] = pretty_number($unit_info['engine'][0]['speed']);    // Vitesse de base
375
-  $parse['base_conso'] = pretty_number($unit_info['engine'][0]['consumption']);  // Consommation de base
374
+  $parse['base_speed'] = pretty_number($unit_info['engine'][0]['speed']); // Vitesse de base
375
+  $parse['base_conso'] = pretty_number($unit_info['engine'][0]['consumption']); // Consommation de base
376 376
 
377 377
   $parse['ACTUAL_ARMOR'] = pretty_number(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_ARMOR), ($unit_info['metal'] + $unit_info['crystal']) / 10));
378 378
   $parse['ACTUAL_SHIELD'] = pretty_number(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_SHIELD), $unit_info['shield']));
@@ -382,37 +382,37 @@  discard block
 block discarded – undo
382 382
   $parse['ACTUAL_CAPACITY'] = pretty_number($ship_data['capacity']);
383 383
   $parse['ACTUAL_SPEED'] = pretty_number($ship_data['speed']);
384 384
   $parse['ACTUAL_CONSUMPTION'] = pretty_number($ship_data['consumption']);
385
-  if(count($unit_info['engine']) > 1) {
386
-    $parse['upd_speed'] = "<font color=\"yellow\">(" . pretty_number($unit_info['engine'][1]['speed']) . ")</font>";       // Vitesse rééquipée
385
+  if (count($unit_info['engine']) > 1) {
386
+    $parse['upd_speed'] = "<font color=\"yellow\">(" . pretty_number($unit_info['engine'][1]['speed']) . ")</font>"; // Vitesse rééquipée
387 387
     $parse['upd_conso'] = "<font color=\"yellow\">(" . pretty_number($unit_info['engine'][1]['consumption']) . ")</font>"; // Consommation apres rééquipement
388 388
   }
389
-} elseif(in_array($unit_id, sn_get_groups('defense_active'))) {
389
+} elseif (in_array($unit_id, sn_get_groups('defense_active'))) {
390 390
   // Defenses
391 391
   $PageTPL = gettemplate('info_buildings_defense');
392 392
   $parse['element_typ'] = classLocale::$lang['tech'][UNIT_DEFENCE];
393 393
 
394 394
   $rapid_fire = eco_render_rapid_fire($unit_id);
395
-  $parse['rf_info_to'] = $rapid_fire['to'];   // Rapid Fire vers
395
+  $parse['rf_info_to'] = $rapid_fire['to']; // Rapid Fire vers
396 396
   $parse['rf_info_fr'] = $rapid_fire['from']; // Rapid Fire de
397 397
 
398 398
   $parse['hull_pt'] = pretty_number(($unit_info['metal'] + $unit_info['crystal']) / 10); // Points de Structure
399
-  $parse['shield_pt'] = pretty_number($unit_info['shield']);  // Points de Bouclier
400
-  $parse['attack_pt'] = pretty_number($unit_info['attack']);  // Points d'Attaque
401
-} elseif(in_array($unit_id, sn_get_groups('missile'))) {
399
+  $parse['shield_pt'] = pretty_number($unit_info['shield']); // Points de Bouclier
400
+  $parse['attack_pt'] = pretty_number($unit_info['attack']); // Points d'Attaque
401
+} elseif (in_array($unit_id, sn_get_groups('missile'))) {
402 402
   // Misilles
403 403
   $PageTPL = gettemplate('info_buildings_defense');
404 404
   $parse['element_typ'] = classLocale::$lang['tech'][UNIT_DEFENCE];
405 405
   $parse['hull_pt'] = pretty_number($unit_info['metal'] + $unit_info['crystal']); // Points de Structure
406
-  $parse['shield_pt'] = pretty_number($unit_info['shield']);  // Points de Bouclier
407
-  $parse['attack_pt'] = pretty_number($unit_info['attack']);  // Points d'Attaque
408
-} elseif(in_array($unit_id, sn_get_groups(array('mercenaries', 'governors', 'artifacts', 'resources_all')))) {
406
+  $parse['shield_pt'] = pretty_number($unit_info['shield']); // Points de Bouclier
407
+  $parse['attack_pt'] = pretty_number($unit_info['attack']); // Points d'Attaque
408
+} elseif (in_array($unit_id, sn_get_groups(array('mercenaries', 'governors', 'artifacts', 'resources_all')))) {
409 409
   // Officiers
410 410
   $PageTPL = gettemplate('info_officiers_general');
411 411
 
412 412
   $mercenary = $unit_info;
413 413
   $mercenary_bonus = $mercenary['bonus'];
414 414
   $mercenary_bonus = $mercenary_bonus >= 0 ? "+{$mercenary_bonus}" : "{$mercenary_bonus}";
415
-  switch($mercenary['bonus_type']) {
415
+  switch ($mercenary['bonus_type']) {
416 416
     case BONUS_PERCENT:
417 417
       $mercenary_bonus = "{$mercenary_bonus}%";
418 418
       break;
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
 
431 431
   $parse['EFFECT'] = classLocale::$lang['info'][$unit_id]['effect'];
432 432
   $parse['mercenary_bonus'] = $mercenary_bonus;
433
-  if(!in_array($unit_id, sn_get_groups(array('artifacts', 'resources_all')))) {
433
+  if (!in_array($unit_id, sn_get_groups(array('artifacts', 'resources_all')))) {
434 434
     $parse['max_level'] = classLocale::$lang['sys_level'] . ' ' .
435 435
       (in_array($unit_id, sn_get_groups('mercenaries')) ? mrc_get_level($user, $planetrow, $unit_id) : ($mercenary['location'] == LOC_USER ? mrc_get_level($user, null, $unit_id) : ($planetrow['PLANET_GOVERNOR_ID'] == $unit_id ? $planetrow['PLANET_GOVERNOR_LEVEL'] : 0)))
436 436
       . (isset($mercenary['max']) ? "/{$mercenary['max']}" : '');
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 }
439 439
 
440 440
 // ---- Tableau d'evolution
441
-if($TableHeadTPL != '') {
441
+if ($TableHeadTPL != '') {
442 442
   $parse['table_head'] = parsetemplate($TableHeadTPL, classLocale::$lang);
443 443
   $parse['table_data'] = ShowProductionTable($user, $planetrow, $unit_id, $TableTPL);
444 444
 }
Please login to merge, or discard this patch.
messages.php 2 patches
Switch Indentation   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -48,106 +48,106 @@  discard block
 block discarded – undo
48 48
 }
49 49
 
50 50
 switch($mode) {
51
-  case 'write':
52
-    $error_list = array();
53
-    $template = gettemplate('msg_message_compose', true);
51
+    case 'write':
52
+      $error_list = array();
53
+      $template = gettemplate('msg_message_compose', true);
54 54
 
55
-    $recipient_name = sys_get_param_str_unsafe('recipient_name');
56
-    if($recipient_name) {
57
-      $recipient_row = db_user_by_username($recipient_name);
58
-    }
55
+      $recipient_name = sys_get_param_str_unsafe('recipient_name');
56
+      if($recipient_name) {
57
+        $recipient_row = db_user_by_username($recipient_name);
58
+      }
59 59
 
60
-    if(!$recipient_row) {
61
-      $recipient_id = sys_get_param_id('id');
62
-      $recipient_row = db_user_by_id($recipient_id);
63 60
       if(!$recipient_row) {
64
-        $recipient_id = 0;
61
+        $recipient_id = sys_get_param_id('id');
62
+        $recipient_row = db_user_by_id($recipient_id);
63
+        if(!$recipient_row) {
64
+          $recipient_id = 0;
65
+        }
65 66
       }
66
-    }
67
-
68
-    if($recipient_row) {
69
-      $recipient_id = $recipient_row['id'];
70
-      $recipient_name = $recipient_row['username'];
71
-    }
72
-
73
-    if($recipient_id == $user['id']) {
74
-      $error_list[] = array('MESSAGE' => classLocale::$lang['msg_err_self_send'], 'STATUS' => ERR_ERROR);
75
-    }
76
-
77
-    $re = 0;
78
-    $subject = sys_get_param_str('subject');
79
-    while(strpos($subject, classLocale::$lang['msg_answer_prefix']) !== false) {
80
-      $subject = substr($subject, strlen(classLocale::$lang['msg_answer_prefix']));
81
-      $re++;
82
-    }
83
-    $re ? $subject = classLocale::$lang['msg_answer_prefix'] . $subject : false;
84 67
 
85
-    if(sys_get_param_str('msg_send')) {
86
-      $subject = $subject ? $subject : classLocale::$lang['msg_subject_default'];
68
+      if($recipient_row) {
69
+        $recipient_id = $recipient_row['id'];
70
+        $recipient_name = $recipient_row['username'];
71
+      }
87 72
 
88
-      if(!$recipient_id) {
89
-        $error_list[] = array('MESSAGE' => classLocale::$lang['msg_err_player_not_found'], 'STATUS' => ERR_ERROR);
73
+      if($recipient_id == $user['id']) {
74
+        $error_list[] = array('MESSAGE' => classLocale::$lang['msg_err_self_send'], 'STATUS' => ERR_ERROR);
90 75
       }
91 76
 
92
-      $text = sys_get_param_str('text');
93
-      if(!$text) {
94
-        $error_list[] = array('MESSAGE' => classLocale::$lang['msg_err_no_text'], 'STATUS' => ERR_ERROR);
77
+      $re = 0;
78
+      $subject = sys_get_param_str('subject');
79
+      while(strpos($subject, classLocale::$lang['msg_answer_prefix']) !== false) {
80
+        $subject = substr($subject, strlen(classLocale::$lang['msg_answer_prefix']));
81
+        $re++;
95 82
       }
83
+      $re ? $subject = classLocale::$lang['msg_answer_prefix'] . $subject : false;
96 84
 
97
-      if(empty($error_list)) {
98
-        $error_list[] = array('MESSAGE' => classLocale::$lang['msg_not_message_sent'], 'STATUS' => ERR_NONE);
85
+      if(sys_get_param_str('msg_send')) {
86
+        $subject = $subject ? $subject : classLocale::$lang['msg_subject_default'];
99 87
 
100
-        $user_safe_name = db_escape($user['username']);
101
-        $recipient_name = db_escape($recipient_name);
102
-        msg_send_simple_message($recipient_id, $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, "{$user_safe_name} [{$user['galaxy']}:{$user['system']}:{$user['planet']}]", $subject, $text, true);
88
+        if(!$recipient_id) {
89
+          $error_list[] = array('MESSAGE' => classLocale::$lang['msg_err_player_not_found'], 'STATUS' => ERR_ERROR);
90
+        }
103 91
 
104
-        //$recipient_id = 0;
105
-        //$recipient_name = '';
106
-        //$subject = '';
107
-        $text = '';
92
+        $text = sys_get_param_str('text');
93
+        if(!$text) {
94
+          $error_list[] = array('MESSAGE' => classLocale::$lang['msg_err_no_text'], 'STATUS' => ERR_ERROR);
95
+        }
108 96
 
109
-        $msg_sent = true;
110
-      } else {
111
-        $subject = sys_get_param_str_unsafe('subject');
112
-        $text = sys_get_param_str_unsafe('text');
113
-      }
114
-      $recipient_name = sys_get_param_str_unsafe('recipient_name');
115
-    }
97
+        if(empty($error_list)) {
98
+          $error_list[] = array('MESSAGE' => classLocale::$lang['msg_not_message_sent'], 'STATUS' => ERR_NONE);
116 99
 
117
-    $subject = $subject ? $subject : classLocale::$lang['msg_subject_default'];
100
+          $user_safe_name = db_escape($user['username']);
101
+          $recipient_name = db_escape($recipient_name);
102
+          msg_send_simple_message($recipient_id, $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, "{$user_safe_name} [{$user['galaxy']}:{$user['system']}:{$user['planet']}]", $subject, $text, true);
118 103
 
119
-    $template->assign_vars(array(
120
-      'RECIPIENT_ID'   => $recipient_id,
121
-      'RECIPIENT_NAME' => htmlspecialchars($recipient_name),
122
-      'SUBJECT'        => htmlspecialchars($subject),
123
-      'TEXT'           => htmlspecialchars($text),
124
-    ));
104
+          //$recipient_id = 0;
105
+          //$recipient_name = '';
106
+          //$subject = '';
107
+          $text = '';
125 108
 
126
-    foreach($error_list as $error_message) {
127
-      $template->assign_block_vars('result', $error_message);
128
-    }
109
+          $msg_sent = true;
110
+        } else {
111
+          $subject = sys_get_param_str_unsafe('subject');
112
+          $text = sys_get_param_str_unsafe('text');
113
+        }
114
+        $recipient_name = sys_get_param_str_unsafe('recipient_name');
115
+      }
129 116
 
130
-    $message_query = db_message_list_get_last_20($user, $recipient_id);
131
-    while($message_row = db_fetch($message_query)) {
132
-      $template->assign_block_vars('messages', array(
133
-        'ID'   => $message_row['message_id'],
134
-        'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF),
135
-        'FROM' => htmlspecialchars($message_row['message_from']),
136
-        'SUBJ' => htmlspecialchars($message_row['message_subject']),
137
-        'TEXT' => in_array($message_row['message_type'], array(MSG_TYPE_PLAYER, MSG_TYPE_ALLIANCE)) && $message_row['message_sender'] ? nl2br(htmlspecialchars($message_row['message_text'])) : nl2br($message_row['message_text']),
117
+      $subject = $subject ? $subject : classLocale::$lang['msg_subject_default'];
138 118
 
139
-        'FROM_ID' => $message_row['message_sender'],
119
+      $template->assign_vars(array(
120
+        'RECIPIENT_ID'   => $recipient_id,
121
+        'RECIPIENT_NAME' => htmlspecialchars($recipient_name),
122
+        'SUBJECT'        => htmlspecialchars($subject),
123
+        'TEXT'           => htmlspecialchars($text),
140 124
       ));
141
-    }
142 125
 
143
-  break;
126
+      foreach($error_list as $error_message) {
127
+        $template->assign_block_vars('result', $error_message);
128
+      }
129
+
130
+      $message_query = db_message_list_get_last_20($user, $recipient_id);
131
+      while($message_row = db_fetch($message_query)) {
132
+        $template->assign_block_vars('messages', array(
133
+          'ID'   => $message_row['message_id'],
134
+          'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF),
135
+          'FROM' => htmlspecialchars($message_row['message_from']),
136
+          'SUBJ' => htmlspecialchars($message_row['message_subject']),
137
+          'TEXT' => in_array($message_row['message_type'], array(MSG_TYPE_PLAYER, MSG_TYPE_ALLIANCE)) && $message_row['message_sender'] ? nl2br(htmlspecialchars($message_row['message_text'])) : nl2br($message_row['message_text']),
138
+
139
+          'FROM_ID' => $message_row['message_sender'],
140
+        ));
141
+      }
144 142
 
145
-  case 'delete':
146
-    $query_add = '';
143
+    break;
147 144
 
148
-    $message_range = sys_get_param_str('message_range');
145
+    case 'delete':
146
+      $query_add = '';
149 147
 
150
-    switch($message_range) {
148
+      $message_range = sys_get_param_str('message_range');
149
+
150
+      switch($message_range) {
151 151
       case 'unchecked':
152 152
       case 'checked':
153 153
         $marked_message_list = sys_get_param('mark', array());
@@ -171,65 +171,65 @@  discard block
 block discarded – undo
171 171
       case 'all':
172 172
         $query_add = $query_add ? $query_add : true;
173 173
       break;
174
-    }
174
+      }
175 175
 
176 176
     if($query_add) {
177 177
       $query_add = $query_add === true ? '' : $query_add;
178 178
       db_message_list_delete($user, $query_add);
179 179
     }
180 180
 
181
-  case 'show':
182
-    if($current_class == MSG_TYPE_OUTBOX) {
183
-      $message_query = db_message_list_outbox_by_user_id($user['id']);
184
-    } else {
185
-      if($current_class == MSG_TYPE_NEW) {
186
-        $SubUpdateQry = array();
187
-        foreach($sn_message_class_list as $message_class_id => $message_class) {
188
-          if($message_class_id != MSG_TYPE_OUTBOX) {
189
-            $SubUpdateQry[] = "`{$message_class['name']}` = '0'";
190
-            $user[$message_class['name']] = 0;
181
+    case 'show':
182
+      if($current_class == MSG_TYPE_OUTBOX) {
183
+        $message_query = db_message_list_outbox_by_user_id($user['id']);
184
+      } else {
185
+        if($current_class == MSG_TYPE_NEW) {
186
+          $SubUpdateQry = array();
187
+          foreach($sn_message_class_list as $message_class_id => $message_class) {
188
+            if($message_class_id != MSG_TYPE_OUTBOX) {
189
+              $SubUpdateQry[] = "`{$message_class['name']}` = '0'";
190
+              $user[$message_class['name']] = 0;
191
+            }
191 192
           }
193
+          $SubUpdateQry = implode(',', $SubUpdateQry);
194
+        } else {
195
+          $SubUpdateQry = "`{$sn_message_class_list[$current_class]['name']}` = '0', `{$sn_message_class_list[MSG_TYPE_NEW]['name']}` = `{$sn_message_class_list[MSG_TYPE_NEW]['name']}` - '{$user[$sn_message_class_list[$current_class]['name']]}'";
196
+          $SubSelectQry = "AND `message_type` = '{$current_class}'";
197
+
198
+          $user[$sn_message_class_list[MSG_TYPE_NEW]['name']] -= $user[$sn_message_class_list[$current_class]['name']];
199
+          $user[$sn_message_class_list[$current_class]['name']] = 0;
192 200
         }
193
-        $SubUpdateQry = implode(',', $SubUpdateQry);
194
-      } else {
195
-        $SubUpdateQry = "`{$sn_message_class_list[$current_class]['name']}` = '0', `{$sn_message_class_list[MSG_TYPE_NEW]['name']}` = `{$sn_message_class_list[MSG_TYPE_NEW]['name']}` - '{$user[$sn_message_class_list[$current_class]['name']]}'";
196
-        $SubSelectQry = "AND `message_type` = '{$current_class}'";
197 201
 
198
-        $user[$sn_message_class_list[MSG_TYPE_NEW]['name']] -= $user[$sn_message_class_list[$current_class]['name']];
199
-        $user[$sn_message_class_list[$current_class]['name']] = 0;
202
+        db_user_set_by_id($user['id'], $SubUpdateQry);
203
+        $message_query = db_message_list_by_owner_and_string($user, $SubSelectQry);
200 204
       }
201 205
 
202
-      db_user_set_by_id($user['id'], $SubUpdateQry);
203
-      $message_query = db_message_list_by_owner_and_string($user, $SubSelectQry);
204
-    }
205
-
206
-    if(sys_get_param_int('return')) {
207
-      header('Location: messages.php');
208
-      die();
209
-    }
206
+      if(sys_get_param_int('return')) {
207
+        header('Location: messages.php');
208
+        die();
209
+      }
210 210
 
211
-    $template = gettemplate('msg_message_list', true);
212
-    while($message_row = db_fetch($message_query)) {
213
-      $template->assign_block_vars('messages', array(
214
-        'ID'   => $message_row['message_id'],
215
-        'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF),
216
-        'FROM' => htmlspecialchars($message_row['message_from']),
217
-        'SUBJ' => htmlspecialchars($message_row['message_subject']),
218
-        'TEXT' => in_array($message_row['message_type'], array(MSG_TYPE_PLAYER, MSG_TYPE_ALLIANCE)) && $message_row['message_sender'] ? nl2br(htmlspecialchars($message_row['message_text'])) : nl2br($message_row['message_text']),
219
-
220
-        'FROM_ID'        => $message_row['message_sender'],
221
-        'SUBJ_SANITIZED' => htmlspecialchars($message_row['message_subject']),
222
-        'STYLE'          => $current_class == MSG_TYPE_OUTBOX ? $sn_message_class_list[MSG_TYPE_OUTBOX]['name'] : $sn_message_class_list[$message_row['message_type']]['name'],
223
-      ));
224
-    }
211
+      $template = gettemplate('msg_message_list', true);
212
+      while($message_row = db_fetch($message_query)) {
213
+        $template->assign_block_vars('messages', array(
214
+          'ID'   => $message_row['message_id'],
215
+          'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF),
216
+          'FROM' => htmlspecialchars($message_row['message_from']),
217
+          'SUBJ' => htmlspecialchars($message_row['message_subject']),
218
+          'TEXT' => in_array($message_row['message_type'], array(MSG_TYPE_PLAYER, MSG_TYPE_ALLIANCE)) && $message_row['message_sender'] ? nl2br(htmlspecialchars($message_row['message_text'])) : nl2br($message_row['message_text']),
219
+
220
+          'FROM_ID'        => $message_row['message_sender'],
221
+          'SUBJ_SANITIZED' => htmlspecialchars($message_row['message_subject']),
222
+          'STYLE'          => $current_class == MSG_TYPE_OUTBOX ? $sn_message_class_list[MSG_TYPE_OUTBOX]['name'] : $sn_message_class_list[$message_row['message_type']]['name'],
223
+        ));
224
+      }
225 225
 
226
-    $current_class_text = classLocale::$lang['msg_class'][$current_class];
226
+      $current_class_text = classLocale::$lang['msg_class'][$current_class];
227 227
 
228
-    $template->assign_vars(array(
229
-      "MESSAGE_CLASS"      => $current_class,
230
-      "MESSAGE_CLASS_TEXT" => $current_class_text,
231
-    ));
232
-  break;
228
+      $template->assign_vars(array(
229
+        "MESSAGE_CLASS"      => $current_class,
230
+        "MESSAGE_CLASS_TEXT" => $current_class_text,
231
+      ));
232
+    break;
233 233
 }
234 234
 
235 235
 if(!$template) {
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -42,59 +42,59 @@  discard block
 block discarded – undo
42 42
 
43 43
 $mode = sys_get_param_str('msg_delete') ? 'delete' : sys_get_param_str('mode');
44 44
 $current_class = sys_get_param_int('message_class');
45
-if(!isset($sn_message_class_list[$current_class])) {
45
+if (!isset($sn_message_class_list[$current_class])) {
46 46
   $current_class = 0;
47 47
   $mode = '';
48 48
 }
49 49
 
50
-switch($mode) {
50
+switch ($mode) {
51 51
   case 'write':
52 52
     $error_list = array();
53 53
     $template = gettemplate('msg_message_compose', true);
54 54
 
55 55
     $recipient_name = sys_get_param_str_unsafe('recipient_name');
56
-    if($recipient_name) {
56
+    if ($recipient_name) {
57 57
       $recipient_row = db_user_by_username($recipient_name);
58 58
     }
59 59
 
60
-    if(!$recipient_row) {
60
+    if (!$recipient_row) {
61 61
       $recipient_id = sys_get_param_id('id');
62 62
       $recipient_row = db_user_by_id($recipient_id);
63
-      if(!$recipient_row) {
63
+      if (!$recipient_row) {
64 64
         $recipient_id = 0;
65 65
       }
66 66
     }
67 67
 
68
-    if($recipient_row) {
68
+    if ($recipient_row) {
69 69
       $recipient_id = $recipient_row['id'];
70 70
       $recipient_name = $recipient_row['username'];
71 71
     }
72 72
 
73
-    if($recipient_id == $user['id']) {
73
+    if ($recipient_id == $user['id']) {
74 74
       $error_list[] = array('MESSAGE' => classLocale::$lang['msg_err_self_send'], 'STATUS' => ERR_ERROR);
75 75
     }
76 76
 
77 77
     $re = 0;
78 78
     $subject = sys_get_param_str('subject');
79
-    while(strpos($subject, classLocale::$lang['msg_answer_prefix']) !== false) {
79
+    while (strpos($subject, classLocale::$lang['msg_answer_prefix']) !== false) {
80 80
       $subject = substr($subject, strlen(classLocale::$lang['msg_answer_prefix']));
81 81
       $re++;
82 82
     }
83 83
     $re ? $subject = classLocale::$lang['msg_answer_prefix'] . $subject : false;
84 84
 
85
-    if(sys_get_param_str('msg_send')) {
85
+    if (sys_get_param_str('msg_send')) {
86 86
       $subject = $subject ? $subject : classLocale::$lang['msg_subject_default'];
87 87
 
88
-      if(!$recipient_id) {
88
+      if (!$recipient_id) {
89 89
         $error_list[] = array('MESSAGE' => classLocale::$lang['msg_err_player_not_found'], 'STATUS' => ERR_ERROR);
90 90
       }
91 91
 
92 92
       $text = sys_get_param_str('text');
93
-      if(!$text) {
93
+      if (!$text) {
94 94
         $error_list[] = array('MESSAGE' => classLocale::$lang['msg_err_no_text'], 'STATUS' => ERR_ERROR);
95 95
       }
96 96
 
97
-      if(empty($error_list)) {
97
+      if (empty($error_list)) {
98 98
         $error_list[] = array('MESSAGE' => classLocale::$lang['msg_not_message_sent'], 'STATUS' => ERR_NONE);
99 99
 
100 100
         $user_safe_name = db_escape($user['username']);
@@ -123,12 +123,12 @@  discard block
 block discarded – undo
123 123
       'TEXT'           => htmlspecialchars($text),
124 124
     ));
125 125
 
126
-    foreach($error_list as $error_message) {
126
+    foreach ($error_list as $error_message) {
127 127
       $template->assign_block_vars('result', $error_message);
128 128
     }
129 129
 
130 130
     $message_query = db_message_list_get_last_20($user, $recipient_id);
131
-    while($message_row = db_fetch($message_query)) {
131
+    while ($message_row = db_fetch($message_query)) {
132 132
       $template->assign_block_vars('messages', array(
133 133
         'ID'   => $message_row['message_id'],
134 134
         'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF),
@@ -147,25 +147,25 @@  discard block
 block discarded – undo
147 147
 
148 148
     $message_range = sys_get_param_str('message_range');
149 149
 
150
-    switch($message_range) {
150
+    switch ($message_range) {
151 151
       case 'unchecked':
152 152
       case 'checked':
153 153
         $marked_message_list = sys_get_param('mark', array());
154
-        if($message_range == 'checked' && empty($marked_message_list)) {
154
+        if ($message_range == 'checked' && empty($marked_message_list)) {
155 155
           break;
156 156
         }
157 157
 
158 158
         $query_add = implode(',', $marked_message_list);
159
-        if($query_add) {
159
+        if ($query_add) {
160 160
           $query_add = "IN ({$query_add})";
161
-          if($message_range == 'unchecked') {
161
+          if ($message_range == 'unchecked') {
162 162
             $query_add = "NOT {$query_add}";
163 163
           }
164 164
           $query_add = " AND `message_id` {$query_add}";
165 165
         }
166 166
 
167 167
       case 'class':
168
-        if($current_class != MSG_TYPE_OUTBOX && $current_class != MSG_TYPE_NEW) {
168
+        if ($current_class != MSG_TYPE_OUTBOX && $current_class != MSG_TYPE_NEW) {
169 169
           $query_add .= " AND `message_type` = {$current_class}";
170 170
         }
171 171
       case 'all':
@@ -173,19 +173,19 @@  discard block
 block discarded – undo
173 173
       break;
174 174
     }
175 175
 
176
-    if($query_add) {
176
+    if ($query_add) {
177 177
       $query_add = $query_add === true ? '' : $query_add;
178 178
       db_message_list_delete($user, $query_add);
179 179
     }
180 180
 
181 181
   case 'show':
182
-    if($current_class == MSG_TYPE_OUTBOX) {
182
+    if ($current_class == MSG_TYPE_OUTBOX) {
183 183
       $message_query = db_message_list_outbox_by_user_id($user['id']);
184 184
     } else {
185
-      if($current_class == MSG_TYPE_NEW) {
185
+      if ($current_class == MSG_TYPE_NEW) {
186 186
         $SubUpdateQry = array();
187
-        foreach($sn_message_class_list as $message_class_id => $message_class) {
188
-          if($message_class_id != MSG_TYPE_OUTBOX) {
187
+        foreach ($sn_message_class_list as $message_class_id => $message_class) {
188
+          if ($message_class_id != MSG_TYPE_OUTBOX) {
189 189
             $SubUpdateQry[] = "`{$message_class['name']}` = '0'";
190 190
             $user[$message_class['name']] = 0;
191 191
           }
@@ -203,13 +203,13 @@  discard block
 block discarded – undo
203 203
       $message_query = db_message_list_by_owner_and_string($user, $SubSelectQry);
204 204
     }
205 205
 
206
-    if(sys_get_param_int('return')) {
206
+    if (sys_get_param_int('return')) {
207 207
       header('Location: messages.php');
208 208
       die();
209 209
     }
210 210
 
211 211
     $template = gettemplate('msg_message_list', true);
212
-    while($message_row = db_fetch($message_query)) {
212
+    while ($message_row = db_fetch($message_query)) {
213 213
       $template->assign_block_vars('messages', array(
214 214
         'ID'   => $message_row['message_id'],
215 215
         'DATE' => date(FMT_DATE_TIME, $message_row['message_time'] + SN_CLIENT_TIME_DIFF),
@@ -232,18 +232,18 @@  discard block
 block discarded – undo
232 232
   break;
233 233
 }
234 234
 
235
-if(!$template) {
235
+if (!$template) {
236 236
   $template = gettemplate('msg_message_class', true);
237 237
 
238 238
   $query = db_message_count_by_owner_and_type($user);
239
-  while($message_row = db_fetch($query)) {
239
+  while ($message_row = db_fetch($query)) {
240 240
     $messages_total[$message_row['message_type']] = $message_row['message_count'];
241 241
     $messages_total[MSG_TYPE_NEW] += $message_row['message_count'];
242 242
   }
243 243
 
244 244
   $messages_total[MSG_TYPE_OUTBOX] = db_message_count_outbox($user);
245 245
 
246
-  foreach($sn_message_class_list as $message_class_id => $message_class) {
246
+  foreach ($sn_message_class_list as $message_class_id => $message_class) {
247 247
     $template->assign_block_vars('message_class', array(
248 248
       'ID'     => $message_class_id,
249 249
       'STYLE'  => $message_class['name'],
Please login to merge, or discard this patch.
fleet.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 $planet = sys_get_param_int('planet', $planetrow['planet']);
40 40
 
41 41
 $target_mission = sys_get_param_int('target_mission');
42
-if($target_mission == MT_COLONIZE || $target_mission == MT_EXPLORE) {
42
+if ($target_mission == MT_COLONIZE || $target_mission == MT_EXPLORE) {
43 43
   $planet_type = PT_PLANET;
44
-} elseif($target_mission == MT_RECYCLE) {
44
+} elseif ($target_mission == MT_RECYCLE) {
45 45
   $planet_type = PT_DEBRIS;
46
-} elseif($target_mission == MT_DESTROY) {
46
+} elseif ($target_mission == MT_DESTROY) {
47 47
   $planet_type = PT_MOON;
48 48
 } else {
49 49
   $planet_type = sys_get_param_int('planet_type');
@@ -57,13 +57,13 @@  discard block
 block discarded – undo
57 57
 
58 58
 $MaxFleets = GetMaxFleets($user);
59 59
 $FlyingFleets = FleetList::fleet_count_flying($user['id']);
60
-if($MaxFleets <= $FlyingFleets && $fleet_page && $fleet_page != 4) {
60
+if ($MaxFleets <= $FlyingFleets && $fleet_page && $fleet_page != 4) {
61 61
   message(classLocale::$lang['fl_noslotfree'], classLocale::$lang['fl_error'], "fleet." . PHP_EX, 5);
62 62
 }
63 63
 
64 64
 $MaxExpeditions = get_player_max_expeditons($user);
65
-if($MaxExpeditions) {
66
-  $FlyingExpeditions  = FleetList::fleet_count_flying($user['id'], MT_EXPLORE);
65
+if ($MaxExpeditions) {
66
+  $FlyingExpeditions = FleetList::fleet_count_flying($user['id'], MT_EXPLORE);
67 67
 } else {
68 68
   $FlyingExpeditions = 0;
69 69
 }
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
     $fleetarray     = unserialize(base64_decode(str_rot13(sys_get_param('usedfleet'))));
77 77
     $fleetarray = is_array($fleetarray) ? $fleetarray : array();
78 78
 
79
-    foreach($fleetarray as $ship_id => &$ship_amount) {
80
-      if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) {
79
+    foreach ($fleetarray as $ship_id => &$ship_amount) {
80
+      if (!in_array($ship_id, sn_get_groups('fleet')) || (string) floatval($ship_amount) != $ship_amount || $ship_amount < 1) {
81 81
         $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true));
82 82
         die();
83 83
       }
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
           $target_mission = MT_COLONIZE;
109 109
           $planet_type = PT_PLANET;
110 110
         } else {
111
-          message ("<font color=\"red\"><b>". classLocale::$lang['fl_no_planet_type'] ."</b></font>", classLocale::$lang['fl_error']);
111
+          message("<font color=\"red\"><b>" . classLocale::$lang['fl_no_planet_type'] . "</b></font>", classLocale::$lang['fl_error']);
112 112
         }
113 113
       } else {
114 114
         $recyclers = 0;
115
-        foreach(sn_get_groups('flt_recyclers') as $recycler_id) {
115
+        foreach (sn_get_groups('flt_recyclers') as $recycler_id) {
116 116
           $recyclers += $fleetarray[$recycler_id];
117 117
         }
118 118
         if ($recyclers > 0 && $planet_type == PT_DEBRIS) {
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 
138 138
                 $missiontype[MT_HOLD] = classLocale::$lang['type_mission'][MT_HOLD];
139 139
 
140
-                if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) {
140
+                if ($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) {
141 141
                   $missiontype[MT_DESTROY] = classLocale::$lang['type_mission'][MT_DESTROY];
142 142
                 }
143 143
               }
@@ -197,14 +197,14 @@  discard block
 block discarded – undo
197 197
 );
198 198
 
199 199
 $is_transport_missions = false;
200
-if($missiontype) {
200
+if ($missiontype) {
201 201
   $sn_group_missions = sn_get_groups('missions');
202
-  foreach($missiontype as $mission_data_id => $mission_data) {
202
+  foreach ($missiontype as $mission_data_id => $mission_data) {
203 203
     $is_transport_missions = $is_transport_missions || (isset($sn_group_missions[$mission_data_id]['transport']) && $sn_group_missions[$mission_data_id]['transport']);
204 204
   }
205 205
 }
206 206
 
207
-switch($fleet_page) {
207
+switch ($fleet_page) {
208 208
   case 1:
209 209
     require('includes/includes/flt_page1.inc');
210 210
   break;
Please login to merge, or discard this patch.
Switch Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -69,114 +69,114 @@  discard block
 block discarded – undo
69 69
 }
70 70
 
71 71
 switch ($fleet_page) {
72
-  case 3:
72
+    case 3:
73 73
 
74
-  case 2:
75
-    $fleet_group_mr = sys_get_param_id('fleet_group');
76
-    $fleetarray     = unserialize(base64_decode(str_rot13(sys_get_param('usedfleet'))));
77
-    $fleetarray = is_array($fleetarray) ? $fleetarray : array();
74
+    case 2:
75
+      $fleet_group_mr = sys_get_param_id('fleet_group');
76
+      $fleetarray     = unserialize(base64_decode(str_rot13(sys_get_param('usedfleet'))));
77
+      $fleetarray = is_array($fleetarray) ? $fleetarray : array();
78 78
 
79
-    foreach($fleetarray as $ship_id => &$ship_amount) {
80
-      if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) {
81
-        $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true));
82
-        die();
83
-      }
84
-      $ship_amount = floatval($ship_amount);
85
-    }
86
-
87
-    $UsedPlanet = false;
88
-    $YourPlanet = false;
89
-    $missiontype = array();
90
-    if ($planet > $config->game_maxPlanet) {
91
-      $target_mission = MT_EXPLORE;
92
-      $missiontype[MT_EXPLORE] = classLocale::$lang['type_mission'][MT_EXPLORE];
93
-    } elseif ($galaxy && $system && $planet) {
94
-      $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET;
95
-
96
-      $TargetPlanet = db_planet_by_gspt($galaxy, $system, $planet, $check_type);
97
-
98
-      if ($TargetPlanet['id_owner']) {
99
-        $UsedPlanet = true;
100
-        if ($TargetPlanet['id_owner'] == $user['id']) {
101
-          $YourPlanet = true;
79
+      foreach($fleetarray as $ship_id => &$ship_amount) {
80
+        if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) {
81
+          $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true));
82
+          die();
102 83
         }
84
+        $ship_amount = floatval($ship_amount);
103 85
       }
104 86
 
105
-      if (!$UsedPlanet) {
106
-        if ($fleetarray[SHIP_COLONIZER]) {
107
-          $missiontype[MT_COLONIZE] = classLocale::$lang['type_mission'][MT_COLONIZE];
108
-          $target_mission = MT_COLONIZE;
109
-          $planet_type = PT_PLANET;
110
-        } else {
111
-          message ("<font color=\"red\"><b>". classLocale::$lang['fl_no_planet_type'] ."</b></font>", classLocale::$lang['fl_error']);
112
-        }
113
-      } else {
114
-        $recyclers = 0;
115
-        foreach(sn_get_groups('flt_recyclers') as $recycler_id) {
116
-          $recyclers += $fleetarray[$recycler_id];
87
+      $UsedPlanet = false;
88
+      $YourPlanet = false;
89
+      $missiontype = array();
90
+      if ($planet > $config->game_maxPlanet) {
91
+        $target_mission = MT_EXPLORE;
92
+        $missiontype[MT_EXPLORE] = classLocale::$lang['type_mission'][MT_EXPLORE];
93
+      } elseif ($galaxy && $system && $planet) {
94
+        $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET;
95
+
96
+        $TargetPlanet = db_planet_by_gspt($galaxy, $system, $planet, $check_type);
97
+
98
+        if ($TargetPlanet['id_owner']) {
99
+          $UsedPlanet = true;
100
+          if ($TargetPlanet['id_owner'] == $user['id']) {
101
+            $YourPlanet = true;
102
+          }
117 103
         }
118
-        if ($recyclers > 0 && $planet_type == PT_DEBRIS) {
119
-          $target_mission = MT_RECYCLE;
120
-          $missiontype[MT_RECYCLE] = classLocale::$lang['type_mission'][MT_RECYCLE];
121
-        } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) {
122
-          if ($YourPlanet) {
123
-            $missiontype[MT_RELOCATE] = classLocale::$lang['type_mission'][MT_RELOCATE];
124
-            $missiontype[MT_TRANSPORT] = classLocale::$lang['type_mission'][MT_TRANSPORT];
104
+
105
+        if (!$UsedPlanet) {
106
+          if ($fleetarray[SHIP_COLONIZER]) {
107
+            $missiontype[MT_COLONIZE] = classLocale::$lang['type_mission'][MT_COLONIZE];
108
+            $target_mission = MT_COLONIZE;
109
+            $planet_type = PT_PLANET;
125 110
           } else {
126
-            // Not Your Planet
127
-            if ($fleetarray[SHIP_SPY]) {
128
-              // Only spy missions if any spy
129
-              $missiontype[MT_SPY] = classLocale::$lang['type_mission'][MT_SPY];
111
+            message ("<font color=\"red\"><b>". classLocale::$lang['fl_no_planet_type'] ."</b></font>", classLocale::$lang['fl_error']);
112
+          }
113
+        } else {
114
+          $recyclers = 0;
115
+          foreach(sn_get_groups('flt_recyclers') as $recycler_id) {
116
+            $recyclers += $fleetarray[$recycler_id];
117
+          }
118
+          if ($recyclers > 0 && $planet_type == PT_DEBRIS) {
119
+            $target_mission = MT_RECYCLE;
120
+            $missiontype[MT_RECYCLE] = classLocale::$lang['type_mission'][MT_RECYCLE];
121
+          } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) {
122
+            if ($YourPlanet) {
123
+              $missiontype[MT_RELOCATE] = classLocale::$lang['type_mission'][MT_RELOCATE];
124
+              $missiontype[MT_TRANSPORT] = classLocale::$lang['type_mission'][MT_TRANSPORT];
130 125
             } else {
131
-              // If no spies...
132
-              if ($fleet_group_mr) {
133
-                $missiontype[MT_AKS] = classLocale::$lang['type_mission'][MT_AKS];
126
+              // Not Your Planet
127
+              if ($fleetarray[SHIP_SPY]) {
128
+                // Only spy missions if any spy
129
+                $missiontype[MT_SPY] = classLocale::$lang['type_mission'][MT_SPY];
134 130
               } else {
135
-                $missiontype[MT_ATTACK] = classLocale::$lang['type_mission'][MT_ATTACK];
136
-                $missiontype[MT_TRANSPORT] = classLocale::$lang['type_mission'][MT_TRANSPORT];
137
-
138
-                $missiontype[MT_HOLD] = classLocale::$lang['type_mission'][MT_HOLD];
139
-
140
-                if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) {
141
-                  $missiontype[MT_DESTROY] = classLocale::$lang['type_mission'][MT_DESTROY];
131
+                // If no spies...
132
+                if ($fleet_group_mr) {
133
+                  $missiontype[MT_AKS] = classLocale::$lang['type_mission'][MT_AKS];
134
+                } else {
135
+                  $missiontype[MT_ATTACK] = classLocale::$lang['type_mission'][MT_ATTACK];
136
+                  $missiontype[MT_TRANSPORT] = classLocale::$lang['type_mission'][MT_TRANSPORT];
137
+
138
+                  $missiontype[MT_HOLD] = classLocale::$lang['type_mission'][MT_HOLD];
139
+
140
+                  if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) {
141
+                    $missiontype[MT_DESTROY] = classLocale::$lang['type_mission'][MT_DESTROY];
142
+                  }
142 143
                 }
143 144
               }
144 145
             }
145 146
           }
146 147
         }
147 148
       }
148
-    }
149 149
 
150
-    if (!$target_mission && is_array($missiontype)) {
151
-      $target_mission = MT_ATTACK;
152
-    }
150
+      if (!$target_mission && is_array($missiontype)) {
151
+        $target_mission = MT_ATTACK;
152
+      }
153 153
 
154
-    ksort($missiontype);
154
+      ksort($missiontype);
155 155
 
156
-    $speed_percent = sys_get_param_int('speed', 10);
157
-    $travel_data   = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent);
156
+      $speed_percent = sys_get_param_int('speed', 10);
157
+      $travel_data   = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent);
158 158
 
159
-    $fleet_speed   = $travel_data['fleet_speed'];
160
-    $distance      = $travel_data['distance'];
161
-    $duration      = $travel_data['duration'];
162
-    $consumption   = $travel_data['consumption'];
163
-  // No Break
159
+      $fleet_speed   = $travel_data['fleet_speed'];
160
+      $distance      = $travel_data['distance'];
161
+      $duration      = $travel_data['duration'];
162
+      $consumption   = $travel_data['consumption'];
163
+    // No Break
164 164
 
165
-  case 1:
166
-    if ($galaxy && $system && $planet) {
167
-      $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET;
165
+    case 1:
166
+      if ($galaxy && $system && $planet) {
167
+        $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET;
168 168
 
169
-      $TargetPlanet = db_planet_by_gspt($galaxy, $system, $planet, $check_type);
170
-    }
169
+        $TargetPlanet = db_planet_by_gspt($galaxy, $system, $planet, $check_type);
170
+      }
171 171
 
172
-  case 0:
173
-    $template_result += array(
174
-      'thisgalaxy'      => $planetrow['galaxy'],
175
-      'thissystem'      => $planetrow['system'],
176
-      'thisplanet'      => $planetrow['planet'],
177
-      'thisplanet_type' => $planetrow['planet_type'],
178
-    );
179
-  // no break
172
+    case 0:
173
+      $template_result += array(
174
+        'thisgalaxy'      => $planetrow['galaxy'],
175
+        'thissystem'      => $planetrow['system'],
176
+        'thisplanet'      => $planetrow['planet'],
177
+        'thisplanet_type' => $planetrow['planet_type'],
178
+      );
179
+    // no break
180 180
 
181 181
 }
182 182
 
@@ -198,31 +198,31 @@  discard block
 block discarded – undo
198 198
 }
199 199
 
200 200
 switch($fleet_page) {
201
-  case 1:
202
-    require('includes/includes/flt_page1.inc');
203
-  break;
201
+    case 1:
202
+      require('includes/includes/flt_page1.inc');
203
+    break;
204 204
 
205
-  case 2:
206
-    require_once('includes/includes/flt_page2.inc');
207
-    sn_fleet_page2();
208
-  break;
205
+    case 2:
206
+      require_once('includes/includes/flt_page2.inc');
207
+      sn_fleet_page2();
208
+    break;
209 209
 
210
-  case 3:
211
-    require_once('includes/includes/flt_page3.inc');
212
-    sn_fleet_page3($duration);
213
-  break;
210
+    case 3:
211
+      require_once('includes/includes/flt_page3.inc');
212
+      sn_fleet_page3($duration);
213
+    break;
214 214
 
215
-  case 4:
216
-    require('includes/includes/flt_page4.inc');
217
-  break;
215
+    case 4:
216
+      require('includes/includes/flt_page4.inc');
217
+    break;
218 218
 
219
-  case 5:
220
-    require('includes/includes/flt_page5.inc');
221
-  break;
219
+    case 5:
220
+      require('includes/includes/flt_page5.inc');
221
+    break;
222 222
 
223
-  default:
224
-    define('SN_RENDER_NAVBAR_PLANET', true);
223
+    default:
224
+      define('SN_RENDER_NAVBAR_PLANET', true);
225 225
 
226
-    require('includes/includes/flt_page0.inc');
227
-  break;
226
+      require('includes/includes/flt_page0.inc');
227
+    break;
228 228
 }
Please login to merge, or discard this patch.
buildings.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,8 +21,8 @@
 block discarded – undo
21 21
 $mode = sys_get_param_escaped('mode');
22 22
 $mode = (!$mode || $mode == 'buildings') ? QUE_STRUCTURES : ($mode == 'fleet' ? SUBQUE_FLEET : ($mode == 'defense' ? SUBQUE_DEFENSE : ($mode == 'research' ? QUE_RESEARCH : $mode)));
23 23
 
24
-if($building_sort = sys_get_param_id('sort_elements')) {
25
-  if(!empty(classLocale::$lang['player_option_building_sort'][$building_sort])) {
24
+if ($building_sort = sys_get_param_id('sort_elements')) {
25
+  if (!empty(classLocale::$lang['player_option_building_sort'][$building_sort])) {
26 26
     classSupernova::$user_options[array(PLAYER_OPTION_BUILDING_SORT, $mode)] = $building_sort;
27 27
     classSupernova::$user_options[array(PLAYER_OPTION_BUILDING_SORT_INVERSE, $mode)] = sys_get_param_id('sort_elements_inverse', 0);
28 28
   }
Please login to merge, or discard this patch.
admin/includes/admin_planet_edit.inc.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
 
22 22
 function sn_admin_planet_edit_template(&$template, $edit_planet_row, $mode) {
23 23
   $unit_list = sn_get_groups($mode);
24
-  if(empty($unit_list)) {
24
+  if (empty($unit_list)) {
25 25
     return;
26 26
   }
27 27
   $name_list = classLocale::$lang['tech'];
28 28
 
29
-  foreach($unit_list as $unit_id) {
29
+  foreach ($unit_list as $unit_id) {
30 30
     $template->assign_block_vars('unit', array(
31 31
       'ID'    => $unit_id,
32 32
       'NAME'  => $name_list[$unit_id],
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 function admin_planet_edit_query_string($unit_id, $unit_amount, $mode) { return sn_function_call(__FUNCTION__, array($unit_id, $unit_amount, $mode)); }
40 40
 
41 41
 function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode) {
42
-  if($unit_amount && in_array($unit_id, sn_get_groups($mode))) {
42
+  if ($unit_amount && in_array($unit_id, sn_get_groups($mode))) {
43 43
     $unit_amount = round($unit_amount);
44 44
     $unit_name = get_unit_param($unit_id, P_NAME);
45 45
     $result = "{$unit_name} = GREATEST(0, {$unit_name} + ({$unit_amount}))";
Please login to merge, or discard this patch.
includes/includes/art_artifact.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 function art_use(&$user, &$planetrow, $unit_id) {
4 4
   global $lang;
5 5
 
6
-  if(!in_array($unit_id, sn_get_groups('artifacts'))) {
6
+  if (!in_array($unit_id, sn_get_groups('artifacts'))) {
7 7
     return;
8 8
   }
9 9
 
@@ -11,21 +11,21 @@  discard block
 block discarded – undo
11 11
   $user = db_user_by_id($user['id'], true);
12 12
 
13 13
   $unit_level = $artifact_level_old = mrc_get_level($user, array(), $unit_id, true);
14
-  if($unit_level > 0) {
14
+  if ($unit_level > 0) {
15 15
     $db_changeset = array();
16
-    switch($unit_id) {
16
+    switch ($unit_id) {
17 17
       case ART_LHC:
18 18
       case ART_HOOK_SMALL:
19 19
       case ART_HOOK_MEDIUM:
20 20
       case ART_HOOK_LARGE:
21 21
         $has_moon = db_planet_by_parent($planetrow['id'], true, '`id`');
22
-        if($planetrow['planet_type'] == PT_PLANET && !$has_moon['id']) {
22
+        if ($planetrow['planet_type'] == PT_PLANET && !$has_moon['id']) {
23 23
           $unit_level--;
24 24
           $moon_chance = $unit_id == ART_LHC ? uni_calculate_moon_chance($planetrow['debris_metal'] + $planetrow['debris_crystal']) : (
25 25
           $unit_id == ART_HOOK_MEDIUM ? mt_rand(1100, 8999) : ($unit_id == ART_HOOK_SMALL ? 1100 : 8999)
26 26
           );
27 27
           $random = $unit_id == ART_LHC ? mt_rand(1, 100) : $moon_chance;
28
-          if($random <= $moon_chance) {
28
+          if ($random <= $moon_chance) {
29 29
             $new_moon_row = uni_create_moon($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'], $user['id'], $moon_chance);
30 30
             $message = sprintf(classLocale::$lang['art_moon_create'][$unit_id], $new_moon_row['name'], uni_render_coordinates($planetrow), pretty_number($moon_chance));
31 31
           } else {
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
       case ART_RCD_MEDIUM:
42 42
       case ART_RCD_LARGE:
43 43
         $planetrow = db_planet_by_id($planetrow['id'], true);
44
-        if($planetrow['planet_type'] != PT_PLANET) {
44
+        if ($planetrow['planet_type'] != PT_PLANET) {
45 45
           $message = classLocale::$lang['art_rcd_err_moon'];
46 46
           break;
47 47
         }
48 48
 
49 49
         $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, false);
50
-        if(!empty($que['items'])) {
50
+        if (!empty($que['items'])) {
51 51
           $message = classLocale::$lang['art_rcd_err_que'];
52 52
           break;
53 53
         }
@@ -56,8 +56,8 @@  discard block
 block discarded – undo
56 56
 
57 57
         // $deployment_str = '';
58 58
         $sectors_used = 0;
59
-        foreach($artifact_deploy as $deploy_unit_id => $deploy_unit_level) {
60
-          if(!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) {
59
+        foreach ($artifact_deploy as $deploy_unit_id => $deploy_unit_level) {
60
+          if (!($levels_deployed = max(0, $deploy_unit_level - mrc_get_level($user, $planetrow, $deploy_unit_id, true, true)))) {
61 61
             continue;
62 62
           }
63 63
           $sectors_used += $levels_deployed;
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
           //$deployment_str .= ",`{$deploy_unit_name}` = GREATEST(`{$deploy_unit_name}`, {$deploy_unit_level})";
67 67
         }
68 68
 
69
-        if($sectors_used == 0) {
69
+        if ($sectors_used == 0) {
70 70
           $message = classLocale::$lang['art_rcd_err_no_sense'];
71 71
           break;
72 72
         }
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
         $que_item = null;
81 81
         $que = que_get($user['id'], $planetrow['id'], QUE_RESEARCH, true);
82 82
         $current_que = &$que['ques'][QUE_RESEARCH][$user['id']][0];
83
-        if(!empty($current_que)) {
83
+        if (!empty($current_que)) {
84 84
           reset($current_que);
85 85
           $que_item = &$que['ques'][QUE_RESEARCH][$user['id']][0][key($current_que)];
86 86
         }
87 87
 
88
-        if(!empty($que_item) && $que_item['que_time_left'] > 60) {
88
+        if (!empty($que_item) && $que_item['que_time_left'] > 60) {
89 89
           $unit_level--;
90 90
           $old_time = $que_item['que_time_left'];
91 91
           $que_item['que_time_left'] = $que_item['que_time_left'] > PERIOD_HOUR ? ceil($que_item['que_time_left'] / 2) : 0;
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
         $que = que_get($user['id'], $planetrow['id'], QUE_STRUCTURES, true);
104 104
         $current_que = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']];
105 105
         // $que_item = &$que['que'][QUE_STRUCTURES][0];
106
-        if(!empty($current_que)) {
106
+        if (!empty($current_que)) {
107 107
           reset($current_que);
108 108
           $que_item = &$que['ques'][QUE_STRUCTURES][$user['id']][$planetrow['id']][key($current_que)];
109 109
         }
110 110
 
111
-        if(isset($que_item) && $que_item['que_time_left'] > 60) {
111
+        if (isset($que_item) && $que_item['que_time_left'] > 60) {
112 112
           $unit_level--;
113 113
           $old_time = $que_item['que_time_left'];
114 114
           $que_item['que_time_left'] = $que_item['que_time_left'] > PERIOD_HOUR ? ceil($que_item['que_time_left'] / 2) : 0;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
       break;
124 124
 
125 125
     }
126
-    if($unit_level != $artifact_level_old) {
126
+    if ($unit_level != $artifact_level_old) {
127 127
       $db_changeset['unit'][] = sn_db_unit_changeset_prepare($unit_id, $unit_level - $artifact_level_old, $user);
128 128
       db_changeset_apply($db_changeset);
129 129
     }
Please login to merge, or discard this patch.
includes/includes/flt_page0.inc 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,9 +5,9 @@  discard block
 block discarded – undo
5 5
 // @version 1.0
6 6
 // @copyright 2008 by Chlorel for XNova
7 7
 
8
-if($fleet_ship_sort = sys_get_param_id('sort_elements')) {
8
+if ($fleet_ship_sort = sys_get_param_id('sort_elements')) {
9 9
   define('IN_AJAX', true);
10
-  if(!empty(classLocale::$lang['player_option_fleet_ship_sort'][$fleet_ship_sort])) {
10
+  if (!empty(classLocale::$lang['player_option_fleet_ship_sort'][$fleet_ship_sort])) {
11 11
     // player_save_option($user, PLAYER_OPTION_FLEET_SHIP_SORT, $fleet_ship_sort);
12 12
     // player_save_option($user, PLAYER_OPTION_FLEET_SHIP_SORT_INVERSE, sys_get_param_id('fleet_ship_sort_inverse', 0));
13 13
     classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT] = $fleet_ship_sort;
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
   die();
17 17
 }
18 18
 
19
-if(SN_IN_FLEET !== true) {
19
+if (SN_IN_FLEET !== true) {
20 20
   $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403);
21 21
 }
22 22
 
23 23
 lng_include('overview');
24 24
 
25
-if(!$planetrow) {
25
+if (!$planetrow) {
26 26
   message(classLocale::$lang['fl_noplanetrow'], classLocale::$lang['fl_error']);
27 27
 }
28 28
 
@@ -30,9 +30,9 @@  discard block
 block discarded – undo
30 30
 
31 31
 $record_index = 0;
32 32
 $ship_list = array();
33
-foreach(sn_get_groups('fleet') as $n => $unit_id) {
33
+foreach (sn_get_groups('fleet') as $n => $unit_id) {
34 34
   $unit_level = mrc_get_level($user, $planetrow, $unit_id, false, true);
35
-  if($unit_level > 0) {
35
+  if ($unit_level > 0) {
36 36
     $ship_data = get_ship_data($unit_id, $user);
37 37
     $ship_list[$unit_id] = array(
38 38
       '__INDEX'     => $record_index++,
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 
53 53
 $fleet_ship_sort = classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT];
54 54
 $fleet_ship_sort_inverse = classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT_INVERSE];
55
-if($fleet_ship_sort || $fleet_ship_sort_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) {
56
-  switch($fleet_ship_sort) {
55
+if ($fleet_ship_sort || $fleet_ship_sort_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) {
56
+  switch ($fleet_ship_sort) {
57 57
     case PLAYER_OPTION_SORT_NAME: $fleet_ship_sort_field = 'NAME'; break;
58 58
     case PLAYER_OPTION_SORT_SPEED: $fleet_ship_sort_field = 'SPEED'; break;
59 59
     case PLAYER_OPTION_SORT_COUNT: $fleet_ship_sort_field = 'AMOUNT'; break;
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
   });
69 69
 }
70 70
 
71
-foreach($ship_list as $ship_data) {
71
+foreach ($ship_list as $ship_data) {
72 72
   $template->assign_block_vars('ships', $ship_data);
73 73
 }
74 74
 
75
-foreach(classLocale::$lang['player_option_fleet_ship_sort'] as $sort_id => $sort_text) {
75
+foreach (classLocale::$lang['player_option_fleet_ship_sort'] as $sort_id => $sort_text) {
76 76
   $template->assign_block_vars('ship_sort_list', array(
77 77
     'VALUE' => $sort_id,
78 78
     'TEXT' => $sort_text,
Please login to merge, or discard this patch.
includes/includes/eco_bld_structures.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 function sn_eco_build($que_type, &$auser, &$planet) {
19 19
   global $lang, $config, $template_result;
20 20
 
21
-  if($ally_id = sys_get_param_id('ally_id')) {
21
+  if ($ally_id = sys_get_param_id('ally_id')) {
22 22
     define('SN_IN_ALLY', true);
23 23
     $ranks = ally_get_ranks($auser['ally']);
24
-    if($ranks[$auser['ally_rank_id']]['admin'] || $auser['ally']['ally_owner'] == $auser['id']) {
24
+    if ($ranks[$auser['ally_rank_id']]['admin'] || $auser['ally']['ally_owner'] == $auser['id']) {
25 25
       $user = &$auser['ally']['player'];
26 26
       $planet = array(
27 27
         'metal'     => $user['metal'],
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
     }
32 32
   }
33 33
 
34
-  if(!$user) {
34
+  if (!$user) {
35 35
     $user = &$auser;
36 36
   }
37 37
 
38
-  switch($action = sys_get_param_escaped('action')) {
38
+  switch ($action = sys_get_param_escaped('action')) {
39 39
     case 'create': // Add unit to que for build
40 40
     case 'create_autoconvert': // Add unit to que for build
41 41
     case 'destroy': // Add unit to que for remove
@@ -52,23 +52,23 @@  discard block
 block discarded – undo
52 52
 
53 53
   $group_missile = sn_get_groups('missile');
54 54
   $silo_capacity_free = 0;
55
-  if($que_type == QUE_STRUCTURES) {
55
+  if ($que_type == QUE_STRUCTURES) {
56 56
     $build_unit_list = sn_get_groups('build_allow');
57 57
     $build_unit_list = $build_unit_list[$planet['planet_type']];
58 58
     $artifact_id = ART_NANO_BUILDER;
59 59
     $page_header = classLocale::$lang['tech'][UNIT_STRUCTURES];
60
-  } elseif($que_type == QUE_RESEARCH) {
61
-    if(!mrc_get_level($user, $planet, STRUC_LABORATORY)) {
60
+  } elseif ($que_type == QUE_RESEARCH) {
61
+    if (!mrc_get_level($user, $planet, STRUC_LABORATORY)) {
62 62
       message(classLocale::$lang['no_laboratory'], classLocale::$lang['tech'][UNIT_TECHNOLOGIES]);
63 63
     }
64 64
 
65
-    if(eco_unit_busy($user, $planet, UNIT_TECHNOLOGIES)) {
65
+    if (eco_unit_busy($user, $planet, UNIT_TECHNOLOGIES)) {
66 66
       message(classLocale::$lang['eco_bld_msg_err_laboratory_upgrading'], classLocale::$lang['tech'][UNIT_TECHNOLOGIES]);
67 67
     }
68 68
     $build_unit_list = sn_get_groups('tech');
69 69
     $artifact_id = ART_HEURISTIC_CHIP;
70 70
     $page_header = classLocale::$lang['tech'][UNIT_TECHNOLOGIES] . ($user['user_as_ally'] ? "&nbsp;{$lang['sys_of_ally']}&nbsp;{$user['username']}" : '');
71
-  } elseif($que_type == QUE_MERCENARY) {
71
+  } elseif ($que_type == QUE_MERCENARY) {
72 72
 //    if(!mrc_get_level($user, $planet, STRUC_LABORATORY)) {
73 73
 //      message($lang['no_laboratory'], $lang['tech'][UNIT_TECHNOLOGIES]);
74 74
 //    }
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
     $artifact_id = 0;
81 81
     $page_header = classLocale::$lang['tech'][UNIT_MERCENARIES] . ($user['user_as_ally'] ? "&nbsp;{$lang['sys_of_ally']}&nbsp;{$user['username']}" : '');
82 82
   } else {
83
-    if(mrc_get_level($user, $planet, STRUC_FACTORY_HANGAR) == 0) {
83
+    if (mrc_get_level($user, $planet, STRUC_FACTORY_HANGAR) == 0) {
84 84
       message(classLocale::$lang['need_hangar'], classLocale::$lang['tech'][STRUC_FACTORY_HANGAR]);
85 85
     }
86 86
 
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     $artifact_id = 0;
90 90
 
91 91
     $silo_capacity_free = mrc_get_level($user, $planet, STRUC_SILO) * get_unit_param(STRUC_SILO, P_CAPACITY);
92
-    foreach($group_missile as $unit_id) {
92
+    foreach ($group_missile as $unit_id) {
93 93
       $silo_capacity_free -= (mrc_get_level($user, $planet, $unit_id, false, true) + (isset($in_que[$unit_id]) && $in_que[$unit_id] ? $in_que[$unit_id] : 0)) * get_unit_param($unit_id, P_UNIT_SIZE);
94 94
     }
95 95
     $silo_capacity_free = max(0, $silo_capacity_free);
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
   */
107 107
 
108 108
   $template = gettemplate('buildings_builds', true);
109
-  if(!empty($operation_result)) {
109
+  if (!empty($operation_result)) {
110 110
     $template_result['.']['result'][] = $operation_result;
111 111
   }
112 112
 
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
 
138 138
   $record_index = 0;
139 139
 
140
-  foreach($build_unit_list as $unit_id) {
140
+  foreach ($build_unit_list as $unit_id) {
141 141
     $level_base = mrc_get_level($user, $planet, $unit_id, false, true);
142 142
     $level_effective = mrc_get_level($user, $planet, $unit_id);
143 143
     $level_in_que = $in_que[$unit_id];
@@ -160,12 +160,12 @@  discard block
 block discarded – undo
160 160
     $can_build = $unit_info[P_MAX_STACK] ? max(0, $unit_info[P_MAX_STACK] - $level_in_que - $level_effective) : $build_data['CAN'][BUILD_CREATE];
161 161
     // Restricting $can_build by free silo capacity
162 162
     $can_build = ($unit_is_missile = in_array($unit_id, $group_missile)) ? min($can_build, floor($silo_capacity_free / $unit_info[P_UNIT_SIZE])) : $can_build;
163
-    if(!$can_build) {
164
-      if(!$build_data['CAN'][BUILD_CREATE]) {
163
+    if (!$can_build) {
164
+      if (!$build_data['CAN'][BUILD_CREATE]) {
165 165
         $build_data['RESULT'][BUILD_CREATE] = BUILD_NO_RESOURCES;
166
-      } elseif($unit_is_missile && $silo_capacity_free < $unit_info[P_UNIT_SIZE]) {
166
+      } elseif ($unit_is_missile && $silo_capacity_free < $unit_info[P_UNIT_SIZE]) {
167 167
         $build_data['RESULT'][BUILD_CREATE] = BUILD_SILO_FULL;
168
-      } elseif($unit_info[P_MAX_STACK]) {
168
+      } elseif ($unit_info[P_MAX_STACK]) {
169 169
         $build_data['RESULT'][BUILD_CREATE] = BUILD_MAX_REACHED;
170 170
       }
171 171
     }
@@ -232,14 +232,14 @@  discard block
 block discarded – undo
232 232
       'MAP_IS_RESOURCE' => !empty($unit_info[P_UNIT_PRODUCTION]),
233 233
     );
234 234
 
235
-    if($unit_stackable) {
235
+    if ($unit_stackable) {
236 236
       $level_production_base = array(
237 237
         'ACTUAL_SHIELD' => pretty_number(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_SHIELD), $unit_info['shield'])),
238 238
         'ACTUAL_ARMOR'  => pretty_number(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_ARMOR), $unit_info['armor'])),
239 239
         'ACTUAL_WEAPON' => pretty_number(mrc_modify_value($user, false, array(MRC_ADMIRAL, TECH_WEAPON), $unit_info['attack'])),
240 240
       );
241 241
 
242
-      if($unit_info[P_UNIT_TYPE] == UNIT_SHIPS) {
242
+      if ($unit_info[P_UNIT_TYPE] == UNIT_SHIPS) {
243 243
         $ship_data = get_ship_data($unit_id, $user);
244 244
 
245 245
         $level_production_base += array(
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
         );
250 250
       }
251 251
 
252
-      if($unit_info[P_UNIT_PRODUCTION]) {
253
-        foreach($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) {
254
-          if($resource_income =
252
+      if ($unit_info[P_UNIT_PRODUCTION]) {
253
+        foreach ($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) {
254
+          if ($resource_income =
255 255
             floor(mrc_modify_value($user, $planet, $sn_modifiers_resource, $resource_calc(1, 10, $user, $planet)
256 256
               * ($resource_id == RES_ENERGY ? $config_resource_multiplier_plain : $config_resource_multiplier)
257 257
               * (isset($density_info[$resource_id]) ? $density_info[$resource_id] : 1)))
@@ -261,11 +261,11 @@  discard block
 block discarded – undo
261 261
         }
262 262
       }
263 263
       $production['.']['resource'][] = $level_production_base;
264
-    } elseif($unit_info[P_UNIT_PRODUCTION]) {
264
+    } elseif ($unit_info[P_UNIT_PRODUCTION]) {
265 265
       $level_production_base = array();
266 266
       $element_level_start = $level_effective + $in_que[$unit_id];
267
-      foreach($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) {
268
-        if($resource_income =
267
+      foreach ($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) {
268
+        if ($resource_income =
269 269
           floor(mrc_modify_value($user, $planet, $sn_modifiers_resource, $resource_calc($element_level_start, 10, $user, $planet)
270 270
             * ($resource_id == RES_ENERGY ? $config_resource_multiplier_plain : $config_resource_multiplier)
271 271
             * (isset($density_info[$resource_id]) ? $density_info[$resource_id] : 1)))
@@ -275,10 +275,10 @@  discard block
 block discarded – undo
275 275
       }
276 276
 
277 277
       $level_start = $level_base_and_que > 1 ? $level_effective + $level_in_que - 1 : 1;
278
-      for($i = 0; $i < 6; $i++) {
278
+      for ($i = 0; $i < 6; $i++) {
279 279
         $level_production = array('LEVEL' => $level_start + $i);
280
-        foreach($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) {
281
-          if(
280
+        foreach ($unit_info[P_UNIT_PRODUCTION] as $resource_id => $resource_calc) {
281
+          if (
282 282
           $resource_income = floor(mrc_modify_value($user, $planet, $sn_modifiers_resource, $resource_calc($level_start + $i, 10, $user, $planet)
283 283
             * ($resource_id == RES_ENERGY ? $config_resource_multiplier_plain : $config_resource_multiplier)
284 284
             * (isset($density_info[$resource_id]) ? $density_info[$resource_id] : 1)))
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
         }
290 290
         $production['.']['resource'][] = $level_production;
291 291
       }
292
-    } elseif($unit_id == TECH_ASTROTECH) {
292
+    } elseif ($unit_id == TECH_ASTROTECH) {
293 293
       $element_level_start = $level_effective + $in_que[$unit_id];
294 294
       $level_production_base = array(
295 295
         UNIT_PLAYER_EXPEDITIONS_MAX => get_player_max_expeditons($user, $element_level_start),
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
       );
298 298
 
299 299
       $level_start = $level_base_and_que > 1 ? $level_effective + $level_in_que - 1 : 1;
300
-      for($i = 0; $i < 6; $i++) {
300
+      for ($i = 0; $i < 6; $i++) {
301 301
         $level_production = array('LEVEL' => $level_start + $i);
302 302
         $level_production['R' . UNIT_PLAYER_EXPEDITIONS_MAX] = get_player_max_expeditons($user, $level_start + $i);
303 303
         $level_production['D' . UNIT_PLAYER_EXPEDITIONS_MAX] = $level_production['R' . UNIT_PLAYER_EXPEDITIONS_MAX] - $level_production_base[UNIT_PLAYER_EXPEDITIONS_MAX];
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
     $template_result['.']['production'][] = $production;
319 319
   }
320 320
 
321
-  foreach(classLocale::$lang['player_option_building_sort'] as $sort_id => $sort_text) {
321
+  foreach (classLocale::$lang['player_option_building_sort'] as $sort_id => $sort_text) {
322 322
     $template->assign_block_vars('sort_values', array(
323 323
       'VALUE' => $sort_id,
324 324
       'TEXT'  => $sort_text,
@@ -327,8 +327,8 @@  discard block
 block discarded – undo
327 327
 
328 328
   $sort_option = classSupernova::$user_options[array(PLAYER_OPTION_BUILDING_SORT, $que_type)];
329 329
   $sort_option_inverse = classSupernova::$user_options[array(PLAYER_OPTION_BUILDING_SORT_INVERSE, $que_type)];
330
-  if($sort_option || $sort_option_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) {
331
-    switch($sort_option) {
330
+  if ($sort_option || $sort_option_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) {
331
+    switch ($sort_option) {
332 332
       case PLAYER_OPTION_SORT_NAME:
333 333
         $sort_option_field = 'NAME';
334 334
       break;
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
       break;
344 344
     }
345 345
     $sort_option_inverse_closure = $sort_option_inverse ? -1 : 1;
346
-    usort($template_result['.']['production'], function ($a, $b) use ($sort_option_field, $sort_option_inverse_closure) {
346
+    usort($template_result['.']['production'], function($a, $b) use ($sort_option_field, $sort_option_inverse_closure) {
347 347
       return $a[$sort_option_field] < $b[$sort_option_field] ? -1 * $sort_option_inverse_closure : (
348 348
       $a[$sort_option_field] > $b[$sort_option_field] ? 1 * $sort_option_inverse_closure : 0
349 349
       );
Please login to merge, or discard this patch.
includes/pages/options.php 1 patch
Spacing   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
   $language_new = sys_get_param_str('langer', $user['lang']);
14 14
 
15
-  if($language_new != $user['lang']) {
15
+  if ($language_new != $user['lang']) {
16 16
     classLocale::$lang->lng_switch($language_new);
17 17
   }
18 18
 
@@ -21,35 +21,35 @@  discard block
 block discarded – undo
21 21
 
22 22
   $FMT_DATE = preg_replace(array('/d/', '/m/', '/Y/'), array('DD', 'MM', 'YYYY'), FMT_DATE);
23 23
 
24
-  if(sys_get_param_str('mode') == 'change') {
25
-    if($user['authlevel'] > 0) {
24
+  if (sys_get_param_str('mode') == 'change') {
25
+    if ($user['authlevel'] > 0) {
26 26
       $planet_protection = sys_get_param_int('adm_pl_prot') ? $user['authlevel'] : 0;
27 27
       db_planet_set_by_owner($user['id'], "`id_level` = '{$planet_protection}'");
28 28
       db_user_set_by_id($user['id'], "`admin_protection` = '{$planet_protection}'");
29 29
       $user['admin_protection'] = $planet_protection;
30 30
     }
31 31
 
32
-    if(sys_get_param_int('vacation') && !$config->user_vacation_disable) {
32
+    if (sys_get_param_int('vacation') && !$config->user_vacation_disable) {
33 33
       sn_db_transaction_start();
34
-      if($user['authlevel'] < 3) {
35
-        if($user['vacation_next'] > SN_TIME_NOW) {
34
+      if ($user['authlevel'] < 3) {
35
+        if ($user['vacation_next'] > SN_TIME_NOW) {
36 36
           message(classLocale::$lang['opt_vacation_err_timeout'], classLocale::$lang['Error'], 'index.php?page=options', 5);
37 37
           die();
38 38
         }
39 39
 
40
-        if(FleetList::fleet_count_flying($user['id'])) {
40
+        if (FleetList::fleet_count_flying($user['id'])) {
41 41
           message(classLocale::$lang['opt_vacation_err_your_fleet'], classLocale::$lang['Error'], 'index.php?page=options', 5);
42 42
           die();
43 43
         }
44 44
 
45 45
         $que = que_get($user['id'], false);
46
-        if(!empty($que)) {
46
+        if (!empty($que)) {
47 47
           message(classLocale::$lang['opt_vacation_err_que'], classLocale::$lang['Error'], 'index.php?page=options', 5);
48 48
           die();
49 49
         }
50 50
 
51 51
         $query = classSupernova::db_get_record_list(LOC_PLANET, "`id_owner` = {$user['id']}");
52
-        foreach($query as $planet) {
52
+        foreach ($query as $planet) {
53 53
           // $planet = sys_o_get_updated($user, $planet, SN_TIME_NOW);
54 54
           // $planet = $planet['planet'];
55 55
 
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
       sn_db_transaction_commit();
68 68
     }
69 69
 
70
-    foreach($user_option_list as $option_group_id => $option_group) {
71
-      foreach($option_group as $option_name => $option_value) {
72
-        if($user[$option_name] !== null) {
70
+    foreach ($user_option_list as $option_group_id => $option_group) {
71
+      foreach ($option_group as $option_name => $option_value) {
72
+        if ($user[$option_name] !== null) {
73 73
           $user[$option_name] = sys_get_param_str($option_name);
74 74
         } else {
75 75
           $user[$option_name] = $option_value;
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
 
81 81
 
82 82
     $player_options = sys_get_param('options');
83
-    if(!empty($player_options)) {
84
-      array_walk($player_options, function (&$value) {
83
+    if (!empty($player_options)) {
84
+      array_walk($player_options, function(&$value) {
85 85
         // TODO - Когда будет больше параметров - сделать больше проверок
86 86
         $value = intval($value);
87 87
       });
@@ -92,15 +92,15 @@  discard block
 block discarded – undo
92 92
 
93 93
     $username = substr(sys_get_param_str_unsafe('username'), 0, 32);
94 94
     $username_safe = db_escape($username);
95
-    if($username && $user['username'] != $username && $config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_NONE && sys_get_param_int('username_confirm') && !strpbrk($username, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) {
95
+    if ($username && $user['username'] != $username && $config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_NONE && sys_get_param_int('username_confirm') && !strpbrk($username, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) {
96 96
       // проверка на корректность
97 97
       sn_db_transaction_start();
98 98
       $name_check = db_player_name_history_get_name_by_name($username_safe);
99
-      if(!$name_check || $name_check['player_id'] == $user['id']) {
99
+      if (!$name_check || $name_check['player_id'] == $user['id']) {
100 100
         $user = db_user_by_id($user['id'], true);
101
-        switch($config->game_user_changename) {
101
+        switch ($config->game_user_changename) {
102 102
           case SERVER_PLAYER_NAME_CHANGE_PAY:
103
-            if(mrc_get_level($user, $planetrow, RES_DARK_MATTER) < $config->game_user_changename_cost) {
103
+            if (mrc_get_level($user, $planetrow, RES_DARK_MATTER) < $config->game_user_changename_cost) {
104 104
               $template_result['.']['result'][] = array(
105 105
                 'STATUS'  => ERR_ERROR,
106 106
                 'MESSAGE' => classLocale::$lang['opt_msg_name_change_err_no_dm'],
@@ -130,18 +130,18 @@  discard block
 block discarded – undo
130 130
       sn_db_transaction_commit();
131 131
     }
132 132
 
133
-    if($new_password = sys_get_param('newpass1')) {
133
+    if ($new_password = sys_get_param('newpass1')) {
134 134
       try {
135
-        if($new_password != sys_get_param('newpass2')) {
135
+        if ($new_password != sys_get_param('newpass2')) {
136 136
           throw new Exception(classLocale::$lang['opt_err_pass_unmatched'], ERR_WARNING);
137 137
         }
138 138
 
139
-        if(!classSupernova::$auth->password_change(sys_get_param('db_password'), $new_password)) {
139
+        if (!classSupernova::$auth->password_change(sys_get_param('db_password'), $new_password)) {
140 140
           throw new Exception(classLocale::$lang['opt_err_pass_wrong'], ERR_WARNING);
141 141
         }
142 142
 
143 143
         throw new Exception(classLocale::$lang['opt_msg_pass_changed'], ERR_NONE);
144
-      } catch(Exception $e) {
144
+      } catch (Exception $e) {
145 145
         $template_result['.']['result'][] = array(
146 146
           'STATUS'  => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR,
147 147
           'MESSAGE' => $e->getMessage()
@@ -182,12 +182,12 @@  discard block
 block discarded – undo
182 182
     $user['gender'] = $user['gender'] == GENDER_UNKNOWN ? $gender : $user['gender'];
183 183
 
184 184
     try {
185
-      if($user['birthday']) {
185
+      if ($user['birthday']) {
186 186
         throw new exception();
187 187
       }
188 188
 
189 189
       $user_birthday = sys_get_param_str_unsafe('user_birthday');
190
-      if(!$user_birthday || $user_birthday == $FMT_DATE) {
190
+      if (!$user_birthday || $user_birthday == $FMT_DATE) {
191 191
         throw new exception();
192 192
       }
193 193
 
@@ -197,16 +197,16 @@  discard block
 block discarded – undo
197 197
       $pos['Y'] = strpos(FMT_DATE, 'Y');
198 198
       asort($pos);
199 199
       $i = 0;
200
-      foreach($pos as &$position) {
200
+      foreach ($pos as &$position) {
201 201
         $position = ++$i;
202 202
       }
203 203
 
204 204
       $regexp = "/" . preg_replace(array('/\\\\/', '/\//', '/\./', '/\-/', '/d/', '/m/', '/Y/'), array('\\\\\\', '\/', '\.', '\-', '(\d?\d)', '(\d?\d)', '(\d{4})'), FMT_DATE) . "/";
205
-      if(!preg_match($regexp, $user_birthday, $match)) {
205
+      if (!preg_match($regexp, $user_birthday, $match)) {
206 206
         throw new exception();
207 207
       }
208 208
 
209
-      if(!checkdate($match[$pos['m']], $match[$pos['d']], $match[$pos['Y']])) {
209
+      if (!checkdate($match[$pos['m']], $match[$pos['d']], $match[$pos['Y']])) {
210 210
         throw new exception();
211 211
       }
212 212
 
@@ -214,13 +214,13 @@  discard block
 block discarded – undo
214 214
       // EOF black magic! Now we have valid SQL date in $user['user_birthday'] - independent of date format
215 215
 
216 216
       $year = date('Y', SN_TIME_NOW);
217
-      if(mktime(0, 0, 0, $match[$pos['m']], $match[$pos['d']], $year) > SN_TIME_NOW) {
217
+      if (mktime(0, 0, 0, $match[$pos['m']], $match[$pos['d']], $year) > SN_TIME_NOW) {
218 218
         $year--;
219 219
       }
220 220
       $user['user_birthday_celebrated'] = db_escape("{$year}-{$match[$pos['m']]}-{$match[$pos['d']]}");
221 221
 
222 222
       $user_birthday = ", `user_birthday` = '{$user['user_birthday']}', `user_birthday_celebrated` = '{$user['user_birthday_celebrated']}'";
223
-    } catch(exception $e) {
223
+    } catch (exception $e) {
224 224
       $user_birthday = '';
225 225
     }
226 226
 
@@ -230,14 +230,14 @@  discard block
 block discarded – undo
230 230
     $template_result['.']['result'][] = $avatar_upload_result;
231 231
 
232 232
     $user_time_diff = playerTimeDiff::user_time_diff_get();
233
-    if(sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED')) {
233
+    if (sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED')) {
234 234
       playerTimeDiff::user_time_diff_set(array(
235 235
         PLAYER_OPTION_TIME_DIFF              => sys_get_param_int('PLAYER_OPTION_TIME_DIFF'),
236 236
         PLAYER_OPTION_TIME_DIFF_UTC_OFFSET   => 0,
237 237
         PLAYER_OPTION_TIME_DIFF_FORCED       => 1,
238 238
         PLAYER_OPTION_TIME_DIFF_MEASURE_TIME => SN_TIME_SQL,
239 239
       ));
240
-    } elseif(sys_get_param_int('opt_time_diff_clear') || $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) {
240
+    } elseif (sys_get_param_int('opt_time_diff_clear') || $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) {
241 241
       playerTimeDiff::user_time_diff_set(array(
242 242
         PLAYER_OPTION_TIME_DIFF              => '',
243 243
         PLAYER_OPTION_TIME_DIFF_UTC_OFFSET   => 0,
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
       'STATUS'  => ERR_NONE,
258 258
       'MESSAGE' => classLocale::$lang['opt_msg_saved']
259 259
     );
260
-  } elseif(sys_get_param_str('result') == 'ok') {
260
+  } elseif (sys_get_param_str('result') == 'ok') {
261 261
     $template_result['.']['result'][] = array(
262 262
       'STATUS'  => ERR_NONE,
263 263
       'MESSAGE' => classLocale::$lang['opt_msg_saved']
@@ -285,8 +285,8 @@  discard block
 block discarded – undo
285 285
 //  );
286 286
 
287 287
   $dir = dir(SN_ROOT_PHYSICAL . 'skins');
288
-  while(($entry = $dir->read()) !== false) {
289
-    if(is_dir("skins/{$entry}") && $entry[0] != '.') {
288
+  while (($entry = $dir->read()) !== false) {
289
+    if (is_dir("skins/{$entry}") && $entry[0] != '.') {
290 290
       $template_result['.']['skin_list'][] = array(
291 291
         'VALUE'    => $entry,
292 292
         'NAME'     => $entry,
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
   }
297 297
   $dir->close();
298 298
 
299
-  foreach(classLocale::$lang['opt_planet_sort_options'] as $key => &$value) {
299
+  foreach (classLocale::$lang['opt_planet_sort_options'] as $key => &$value) {
300 300
     $template_result['.']['planet_sort_options'][] = array(
301 301
       'VALUE'    => $key,
302 302
       'NAME'     => $value,
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
       );
313 313
     }
314 314
   */
315
-  foreach(classLocale::$lang['sys_gender_list'] as $key => $value) {
315
+  foreach (classLocale::$lang['sys_gender_list'] as $key => $value) {
316 316
     $template_result['.']['gender_list'][] = array(
317 317
       'VALUE'    => $key,
318 318
       'NAME'     => $value,
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
   }
322 322
 
323 323
   $lang_list = lng_get_list();
324
-  foreach($lang_list as $lang_id => $lang_data) {
324
+  foreach ($lang_list as $lang_id => $lang_data) {
325 325
     $template_result['.']['languages'][] = array(
326 326
       'VALUE'    => $lang_id,
327 327
       'NAME'     => $lang_data['LANG_NAME_NATIVE'],
@@ -330,8 +330,8 @@  discard block
 block discarded – undo
330 330
   }
331 331
 
332 332
 
333
-  if(isset(classLocale::$lang['menu_customize_show_hide_button_state'])) {
334
-    foreach(classLocale::$lang['menu_customize_show_hide_button_state'] as $key => $value) {
333
+  if (isset(classLocale::$lang['menu_customize_show_hide_button_state'])) {
334
+    foreach (classLocale::$lang['menu_customize_show_hide_button_state'] as $key => $value) {
335 335
       $template->assign_block_vars('menu_customize_show_hide_button_state', array(
336 336
         'ID'   => $key,
337 337
         'NAME' => $value,
@@ -441,10 +441,10 @@  discard block
 block discarded – undo
441 441
     'PAGE_HEADER' => classLocale::$lang['opt_header'],
442 442
   ));
443 443
 
444
-  foreach($user_option_list as $option_group_id => $option_group) {
445
-    if($option_group_id == OPT_MESSAGE) {
446
-      foreach($sn_message_class_list as $message_class_id => $message_class_data) {
447
-        if($message_class_data['switchable'] || ($message_class_data['email'] && $config->game_email_pm)) {
444
+  foreach ($user_option_list as $option_group_id => $option_group) {
445
+    if ($option_group_id == OPT_MESSAGE) {
446
+      foreach ($sn_message_class_list as $message_class_id => $message_class_data) {
447
+        if ($message_class_data['switchable'] || ($message_class_data['email'] && $config->game_email_pm)) {
448 448
           $option_name = $message_class_data['name'];
449 449
 
450 450
           $template->assign_block_vars("options_{$option_group_id}", array(
@@ -456,8 +456,8 @@  discard block
 block discarded – undo
456 456
         }
457 457
       }
458 458
     } else {
459
-      foreach($option_group as $option_name => $option_value) {
460
-        if(array_key_exists($option_name, $user_option_types)) {
459
+      foreach ($option_group as $option_name => $option_value) {
460
+        if (array_key_exists($option_name, $user_option_types)) {
461 461
           $option_type = $user_option_types[$option_name];
462 462
         } else {
463 463
           $option_type = 'switch';
Please login to merge, or discard this patch.