Completed
Push — work-fleets ( 37e31f...21e5a3 )
by SuperNova.WS
05:22
created
includes/classes/sn_module_payment.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * User: Gorlum
4
- * Date: 21.04.2015
5
- * Time: 3:49
6
- */
3
+   * User: Gorlum
4
+   * Date: 21.04.2015
5
+   * Time: 3:49
6
+   */
7 7
 
8 8
 abstract class sn_module_payment extends sn_module {
9 9
   public static $bonus_table = array(
Please login to merge, or discard this patch.
includes/template.php 1 patch
Spacing   +70 added lines, -70 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 function gettemplatename($u_dpath) {
11 11
   static $template_names = array();
12 12
 
13
-  if(!isset($template_names[$u_dpath])) {
13
+  if (!isset($template_names[$u_dpath])) {
14 14
     $template_names[$u_dpath] = file_exists(SN_ROOT_PHYSICAL . $u_dpath . 'tmpl.ini') ? sys_file_read(SN_ROOT_PHYSICAL . $u_dpath . 'tmpl.ini') : TEMPLATE_NAME;
15 15
   }
16 16
 
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
  * @param $sn_menu_extra
53 53
  */
54 54
 function tpl_menu_merge_extra(&$sn_menu, &$sn_menu_extra) {
55
-  if(empty($sn_menu) || empty($sn_menu_extra)) {
55
+  if (empty($sn_menu) || empty($sn_menu_extra)) {
56 56
     return;
57 57
   }
58 58
 
59
-  foreach($sn_menu_extra as $menu_item_id => $menu_item) {
60
-    if(empty($menu_item['LOCATION'])) {
59
+  foreach ($sn_menu_extra as $menu_item_id => $menu_item) {
60
+    if (empty($menu_item['LOCATION'])) {
61 61
       $sn_menu[$menu_item_id] = $menu_item;
62 62
       continue;
63 63
     }
@@ -66,16 +66,16 @@  discard block
 block discarded – undo
66 66
     unset($menu_item['LOCATION']);
67 67
 
68 68
     $is_positioned = $item_location[0];
69
-    if($is_positioned == '+' || $is_positioned == '-') {
69
+    if ($is_positioned == '+' || $is_positioned == '-') {
70 70
       $item_location = substr($item_location, 1);
71 71
     } else {
72 72
       $is_positioned = '';
73 73
     }
74 74
 
75
-    if($item_location) {
75
+    if ($item_location) {
76 76
       $menu_keys = array_keys($sn_menu);
77 77
       $insert_position = array_search($item_location, $menu_keys);
78
-      if($insert_position === false) {
78
+      if ($insert_position === false) {
79 79
         $insert_position = count($sn_menu) - 1;
80 80
         $is_positioned = '+';
81 81
         $item_location = '';
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     $spliced = array_splice($sn_menu, $insert_position, count($sn_menu) - $insert_position);
89 89
     $sn_menu[$menu_item_id] = $menu_item;
90 90
 
91
-    if(!$is_positioned && $item_location) {
91
+    if (!$is_positioned && $item_location) {
92 92
       unset($spliced[$item_location]);
93 93
     }
94 94
     $sn_menu = array_merge($sn_menu, $spliced);
@@ -104,24 +104,24 @@  discard block
 block discarded – undo
104 104
 function tpl_menu_assign_to_template(&$sn_menu, &$template) {
105 105
   global $lang;
106 106
 
107
-  if(empty($sn_menu) || !is_array($sn_menu)) {
107
+  if (empty($sn_menu) || !is_array($sn_menu)) {
108 108
     return;
109 109
   }
110 110
 
111
-  foreach($sn_menu as $menu_item_id => $menu_item) {
112
-    if(!$menu_item) {
111
+  foreach ($sn_menu as $menu_item_id => $menu_item) {
112
+    if (!$menu_item) {
113 113
       continue;
114 114
     }
115 115
 
116
-    if(is_string($menu_item_id)) {
116
+    if (is_string($menu_item_id)) {
117 117
       $menu_item['ID'] = $menu_item_id;
118 118
     }
119 119
 
120
-    if($menu_item['TYPE'] == 'lang') {
120
+    if ($menu_item['TYPE'] == 'lang') {
121 121
       $lang_string = &$lang;
122
-      if(preg_match('#(\w+)(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?#', $menu_item['ITEM'], $matches) && count($matches) > 1) {
123
-        for($i = 1; $i < count($matches); $i++) {
124
-          if(defined($matches[$i])) {
122
+      if (preg_match('#(\w+)(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?#', $menu_item['ITEM'], $matches) && count($matches) > 1) {
123
+        for ($i = 1; $i < count($matches); $i++) {
124
+          if (defined($matches[$i])) {
125 125
             $matches[$i] = constant($matches[$i]);
126 126
           }
127 127
           $lang_string = &$lang_string[$matches[$i]];
@@ -133,8 +133,8 @@  discard block
 block discarded – undo
133 133
     $menu_item['ALT'] = htmlentities($menu_item['ALT']);
134 134
     $menu_item['TITLE'] = htmlentities($menu_item['TITLE']);
135 135
 
136
-    if(!empty($menu_item['ICON'])) {
137
-      if(is_string($menu_item['ICON'])) {
136
+    if (!empty($menu_item['ICON'])) {
137
+      if (is_string($menu_item['ICON'])) {
138 138
         $menu_item['ICON_PATH'] = $menu_item['ICON'];
139 139
       } else {
140 140
         $menu_item['ICON'] = $menu_item_id;
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
     'MENU_START_HIDE'     => !empty($_COOKIE[SN_COOKIE . '_menu_hidden']) || defined('SN_GOOGLE'),
165 165
   ));
166 166
 
167
-  if(isset($template_result['MENU_CUSTOMIZE'])) {
167
+  if (isset($template_result['MENU_CUSTOMIZE'])) {
168 168
     $template->assign_vars(array(
169 169
       'PLAYER_OPTION_MENU_SHOW_ON_BUTTON'   => classSupernova::$user_options[PLAYER_OPTION_MENU_SHOW_ON_BUTTON],
170 170
       'PLAYER_OPTION_MENU_HIDE_ON_BUTTON'   => classSupernova::$user_options[PLAYER_OPTION_MENU_HIDE_ON_BUTTON],
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     ));
179 179
   }
180 180
 
181
-  if(defined('IN_ADMIN') && IN_ADMIN === true && !empty($user['authlevel']) && $user['authlevel'] > 0) {
181
+  if (defined('IN_ADMIN') && IN_ADMIN === true && !empty($user['authlevel']) && $user['authlevel'] > 0) {
182 182
     tpl_menu_merge_extra($sn_menu_admin, $sn_menu_admin_extra);
183 183
     tpl_menu_assign_to_template($sn_menu_admin, $template);
184 184
   } else {
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
   $in_admin = defined('IN_ADMIN') && IN_ADMIN === true;
219 219
   $is_login = defined('LOGIN_LOGOUT') && LOGIN_LOGOUT === true;
220 220
 
221
-  if(is_object($page)) {
221
+  if (is_object($page)) {
222 222
     isset($page->_rootref['MENU']) ? $isDisplayMenu = $page->_rootref['MENU'] : false;
223 223
     isset($page->_rootref['NAVBAR']) ? $isDisplayTopNav = $page->_rootref['NAVBAR'] : false;
224 224
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
     !isset($page->_rootref['PAGE_HEADER']) && $title ? $page->assign_var('PAGE_HEADER', $title) : false;
227 227
   }
228 228
 
229
-  if(empty($user['id']) || !is_numeric($user['id'])) {
229
+  if (empty($user['id']) || !is_numeric($user['id'])) {
230 230
     $isDisplayMenu = false;
231 231
     $isDisplayTopNav = false;
232 232
   }
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
   $user_time_measured_unix = intval(isset($user_time_diff[PLAYER_OPTION_TIME_DIFF_MEASURE_TIME]) ? strtotime($user_time_diff[PLAYER_OPTION_TIME_DIFF_MEASURE_TIME]) : 0);
239 239
 
240 240
   $font_size = !empty($_COOKIE[SN_COOKIE_F]) ? $_COOKIE[SN_COOKIE_F] : classSupernova::$user_options[PLAYER_OPTION_BASE_FONT_SIZE];
241
-  if(strpos($font_size, '%') !== false) {
241
+  if (strpos($font_size, '%') !== false) {
242 242
     // Размер шрифта в процентах
243 243
     $font_size = min(max(floatval($font_size), FONT_SIZE_PERCENT_MIN), FONT_SIZE_PERCENT_MAX) . '%';
244
-  } elseif(strpos($font_size, 'px') !== false) {
244
+  } elseif (strpos($font_size, 'px') !== false) {
245 245
     // Размер шрифта в пикселях
246 246
     $font_size = min(max(floatval($font_size), FONT_SIZE_PIXELS_MIN), FONT_SIZE_PIXELS_MAX) . 'px';
247 247
   } else {
@@ -253,10 +253,10 @@  discard block
 block discarded – undo
253 253
 
254 254
   $template = gettemplate('_global_header', true);
255 255
 
256
-  if(!empty(classSupernova::$sn_mvc['javascript'])) {
257
-    foreach(classSupernova::$sn_mvc['javascript'] as $page_name => $script_list) {
258
-      if(empty($page_name) || $page_name == $sn_page_name) {
259
-        foreach($script_list as $filename => $content) {
256
+  if (!empty(classSupernova::$sn_mvc['javascript'])) {
257
+    foreach (classSupernova::$sn_mvc['javascript'] as $page_name => $script_list) {
258
+      if (empty($page_name) || $page_name == $sn_page_name) {
259
+        foreach ($script_list as $filename => $content) {
260 260
           $template_result['.']['javascript'][] = array(
261 261
             'FILE'    => $filename,
262 262
             'CONTENT' => $content,
@@ -282,9 +282,9 @@  discard block
 block discarded – undo
282 282
   classSupernova::$sn_mvc['css'][''] = array_merge($standard_css, classSupernova::$sn_mvc['css']['']);
283 283
 
284 284
 
285
-  foreach(classSupernova::$sn_mvc['css'] as $page_name => $script_list) {
286
-    if(empty($page_name) || $page_name == $sn_page_name) {
287
-      foreach($script_list as $filename => $content) {
285
+  foreach (classSupernova::$sn_mvc['css'] as $page_name => $script_list) {
286
+    if (empty($page_name) || $page_name == $sn_page_name) {
287
+      foreach ($script_list as $filename => $content) {
288 288
         $template_result['.']['css'][] = array(
289 289
           'FILE'    => $filename,
290 290
           'CONTENT' => $content,
@@ -331,12 +331,12 @@  discard block
 block discarded – undo
331 331
   $template->assign_recursive($template_result);
332 332
   displayP(parsetemplate($template));
333 333
 
334
-  if(($isDisplayMenu || $in_admin) && !isset($_COOKIE['menu_disable'])) {
334
+  if (($isDisplayMenu || $in_admin) && !isset($_COOKIE['menu_disable'])) {
335 335
     // $AdminPage = $AdminPage ? $user['authlevel'] : 0;
336 336
     displayP(parsetemplate(tpl_render_menu()));
337 337
   }
338 338
 
339
-  if($isDisplayTopNav && !$in_admin) {
339
+  if ($isDisplayTopNav && !$in_admin) {
340 340
     displayP(parsetemplate(tpl_render_topnav($user, $planetrow)));
341 341
   }
342 342
 
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
 
345 345
   !is_array($page) ? $page = array($page) : false;
346 346
   $result_added = false;
347
-  foreach($page as $page_item) {
348
-    if(!$result_added && is_object($page_item) && isset($page_item->_tpldata['result'])) {
347
+  foreach ($page as $page_item) {
348
+    if (!$result_added && is_object($page_item) && isset($page_item->_tpldata['result'])) {
349 349
       $page_item = gettemplate('_result_message', $page_item);
350 350
       $temp = $page_item->files['_result_message'];
351 351
       unset($page_item->files['_result_message']);
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
   ));
369 369
   displayP(parsetemplate($template));
370 370
 
371
-  $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false;;
371
+  $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false; ;
372 372
 
373 373
   sn_db_disconnect();
374 374
 
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
  * @param string         $type
407 407
  */
408 408
 function tpl_topnav_event_build(&$template, $FleetList, $type = 'fleet') {
409
-  if(empty($FleetList)) {
409
+  if (empty($FleetList)) {
410 410
     return;
411 411
   }
412 412
 
@@ -415,19 +415,19 @@  discard block
 block discarded – undo
415 415
   $fleet_event_count = 0;
416 416
   $fleet_flying_sorter = array();
417 417
   $fleet_flying_events = array();
418
-  foreach($FleetList->_container as $objFleet) {
418
+  foreach ($FleetList->_container as $objFleet) {
419 419
     $will_return = true;
420
-    if(!$objFleet->isReturning()) {
420
+    if (!$objFleet->isReturning()) {
421 421
       // cut fleets on Hold and Expedition
422
-      if($objFleet->time_arrive_to_target >= SN_TIME_NOW) {
422
+      if ($objFleet->time_arrive_to_target >= SN_TIME_NOW) {
423 423
         $objFleet->mission_type == MT_RELOCATE ? $will_return = false : false;
424 424
         tpl_topnav_event_build_helper($objFleet->time_arrive_to_target, EVENT_FLEET_ARRIVE, $lang['sys_event_arrive'], $objFleet->target_coordinates_typed(), !$will_return, $objFleet, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count);
425 425
       }
426
-      if($objFleet->time_mission_job_complete) {
426
+      if ($objFleet->time_mission_job_complete) {
427 427
         tpl_topnav_event_build_helper($objFleet->time_mission_job_complete, EVENT_FLEET_STAY, $lang['sys_event_stay'], $objFleet->target_coordinates_typed(), false, $objFleet, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count);
428 428
       }
429 429
     }
430
-    if($will_return) {
430
+    if ($will_return) {
431 431
       tpl_topnav_event_build_helper($objFleet->time_return_to_source, EVENT_FLEET_RETURN, $lang['sys_event_return'], $objFleet->launch_coordinates_typed(), true, $objFleet, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count);
432 432
     }
433 433
   }
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
   asort($fleet_flying_sorter);
436 436
 
437 437
   $fleet_flying_count = $FleetList->count();
438
-  foreach($fleet_flying_sorter as $fleet_event_id => $fleet_time) {
438
+  foreach ($fleet_flying_sorter as $fleet_event_id => $fleet_time) {
439 439
     $fleet_event = &$fleet_flying_events[$fleet_event_id];
440 440
     $template->assign_block_vars("flying_{$type}s", array(
441 441
       'TIME' => max(0, $fleet_time - SN_TIME_NOW),
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 function sn_tpl_render_topnav(&$user, $planetrow) {
464 464
   global $lang, $config, $template_result;
465 465
 
466
-  if(!is_array($user)) {
466
+  if (!is_array($user)) {
467 467
     return '';
468 468
   }
469 469
 
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
 
485 485
   $ThisUsersPlanets = db_planet_list_sorted($user);
486 486
   // while ($CurPlanet = db_fetch($ThisUsersPlanets))
487
-  foreach($ThisUsersPlanets as $CurPlanet) {
488
-    if($CurPlanet['destruyed']) {
487
+  foreach ($ThisUsersPlanets as $CurPlanet) {
488
+    if ($CurPlanet['destruyed']) {
489 489
       continue;
490 490
     }
491 491
 
@@ -509,8 +509,8 @@  discard block
 block discarded – undo
509 509
    */
510 510
   $fleet_flying_list = array();
511 511
   $fleet_flying_list[0] = FleetList::dbGetFleetListByOwnerId($user['id']);
512
-  foreach($fleet_flying_list[0]->_container as $fleet_id => $objFleet) {
513
-    if(empty($fleet_flying_list[$objFleet->mission_type])) {
512
+  foreach ($fleet_flying_list[0]->_container as $fleet_id => $objFleet) {
513
+    if (empty($fleet_flying_list[$objFleet->mission_type])) {
514 514
       $fleet_flying_list[$objFleet->mission_type] = new FleetList();
515 515
     }
516 516
     $fleet_flying_list[$objFleet->mission_type][$fleet_id] = $objFleet;
@@ -522,8 +522,8 @@  discard block
 block discarded – undo
522 522
   que_tpl_parse($template, QUE_RESEARCH, $user, array(), null, !classSupernova::$user_options[PLAYER_OPTION_NAVBAR_RESEARCH_WIDE]);
523 523
   que_tpl_parse($template, SUBQUE_FLEET, $user, $planetrow, null, true);
524 524
 
525
-  if(!empty(classSupernova::$sn_mvc['navbar_prefix_button']) && is_array(classSupernova::$sn_mvc['navbar_prefix_button'])) {
526
-    foreach(classSupernova::$sn_mvc['navbar_prefix_button'] as $navbar_button_image => $navbar_button_url) {
525
+  if (!empty(classSupernova::$sn_mvc['navbar_prefix_button']) && is_array(classSupernova::$sn_mvc['navbar_prefix_button'])) {
526
+    foreach (classSupernova::$sn_mvc['navbar_prefix_button'] as $navbar_button_image => $navbar_button_url) {
527 527
       $template->assign_block_vars('navbar_prefix_button', array(
528 528
         'IMAGE'        => $navbar_button_image,
529 529
         'URL_RELATIVE' => $navbar_button_url,
@@ -537,13 +537,13 @@  discard block
 block discarded – undo
537 537
   $time_now_parsed = getdate(SN_TIME_NOW);
538 538
   $time_local_parsed = getdate(defined('SN_CLIENT_TIME_LOCAL') ? SN_CLIENT_TIME_LOCAL : SN_TIME_NOW);
539 539
 
540
-  if($config->game_news_overview) {
540
+  if ($config->game_news_overview) {
541 541
     $user_last_read_safe = intval($user['news_lastread']);
542 542
     nws_render($template, "WHERE UNIX_TIMESTAMP(`tsTimeStamp`) >= {$user_last_read_safe}", $config->game_news_overview);
543 543
   }
544 544
 
545 545
   $notes_query = db_note_list_by_owner($user['id'], true);
546
-  while($note_row = db_fetch($notes_query)) {
546
+  while ($note_row = db_fetch($notes_query)) {
547 547
     note_assign($template, $note_row);
548 548
   }
549 549
 
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
     'QUE_ID'   => QUE_RESEARCH,
555 555
     'QUE_HTML' => 'topnav',
556 556
 
557
-    'RESEARCH_ONGOING' => (boolean)$user['que'],
557
+    'RESEARCH_ONGOING' => (boolean) $user['que'],
558 558
 
559 559
     'TIME_TEXT'       => sprintf($str_date_format, $time_now_parsed['year'], $lang['months'][$time_now_parsed['mon']], $time_now_parsed['mday'],
560 560
       $time_now_parsed['hours'], $time_now_parsed['minutes'], $time_now_parsed['seconds']
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
     'QUE_STRUCTURES' => QUE_STRUCTURES,
632 632
   ));
633 633
 
634
-  if((defined('SN_RENDER_NAVBAR_PLANET') && SN_RENDER_NAVBAR_PLANET === true) || ($user['option_list'][OPT_INTERFACE]['opt_int_navbar_resource_force'] && SN_RENDER_NAVBAR_PLANET !== false)) {
634
+  if ((defined('SN_RENDER_NAVBAR_PLANET') && SN_RENDER_NAVBAR_PLANET === true) || ($user['option_list'][OPT_INTERFACE]['opt_int_navbar_resource_force'] && SN_RENDER_NAVBAR_PLANET !== false)) {
635 635
     tpl_set_resource_info($template, $planetrow);
636 636
     $template->assign_vars(array(
637 637
       'SN_RENDER_NAVBAR_PLANET' => true,
@@ -646,12 +646,12 @@  discard block
 block discarded – undo
646 646
  * @param template|string $template
647 647
  */
648 648
 function displayP($template) {
649
-  if(is_object($template)) {
650
-    if(empty($template->parsed)) {
649
+  if (is_object($template)) {
650
+    if (empty($template->parsed)) {
651 651
       parsetemplate($template);
652 652
     }
653 653
 
654
-    foreach($template->files as $section => $filename) {
654
+    foreach ($template->files as $section => $filename) {
655 655
       $template->display($section);
656 656
     }
657 657
   } else {
@@ -666,11 +666,11 @@  discard block
 block discarded – undo
666 666
  * @return mixed
667 667
  */
668 668
 function parsetemplate($template, $array = false) {
669
-  if(is_object($template)) {
669
+  if (is_object($template)) {
670 670
     global $user;
671 671
 
672
-    if(!empty($array) && is_array($array)) {
673
-      foreach($array as $key => $data) {
672
+    if (!empty($array) && is_array($array)) {
673
+      foreach ($array as $key => $data) {
674 674
         $template->assign_var($key, $data);
675 675
       }
676 676
     }
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
 
712 712
   $template_ex = '.tpl.html';
713 713
 
714
-  if($template === false) {
714
+  if ($template === false) {
715 715
     return sys_file_read(TEMPLATE_DIR . '/' . $files . $template_ex);
716 716
   }
717 717
 
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
   !empty(classSupernova::$sn_mvc['i18n']['']) ? lng_load_i18n(classSupernova::$sn_mvc['i18n']['']) : false;
732 732
   $sn_page_name ? lng_load_i18n(classSupernova::$sn_mvc['i18n'][$sn_page_name]) : false;
733 733
 
734
-  foreach($files as &$filename) {
734
+  foreach ($files as &$filename) {
735 735
     $filename = $filename . $template_ex;
736 736
   }
737 737
 
@@ -756,13 +756,13 @@  discard block
 block discarded – undo
756 756
     'LANG'     => $language ? $language : '',
757 757
     'referral' => $id_ref ? '&id_ref=' . $id_ref : '',
758 758
 
759
-    'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '',// "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''),
759
+    'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '', // "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''),
760 760
     'FILENAME'       => basename($_SERVER['PHP_SELF']),
761 761
   ));
762 762
 
763
-  foreach(lng_get_list() as $lng_id => $lng_data) {
764
-    if(isset($lng_data['LANG_VARIANTS']) && is_array($lng_data['LANG_VARIANTS'])) {
765
-      foreach($lng_data['LANG_VARIANTS'] as $lang_variant) {
763
+  foreach (lng_get_list() as $lng_id => $lng_data) {
764
+    if (isset($lng_data['LANG_VARIANTS']) && is_array($lng_data['LANG_VARIANTS'])) {
765
+      foreach ($lng_data['LANG_VARIANTS'] as $lang_variant) {
766 766
         $lng_data1 = $lng_data;
767 767
         $lng_data1 = array_merge($lng_data1, $lang_variant);
768 768
         $template->assign_block_vars('language', $lng_data1);
@@ -785,8 +785,8 @@  discard block
 block discarded – undo
785 785
   $que = $que['ques'][$que_type][$planet['id_owner']][$planet['id']];
786 786
 
787 787
   $que_length = 0;
788
-  if(!empty($que)) {
789
-    foreach($que as $que_item) {
788
+  if (!empty($que)) {
789
+    foreach ($que as $que_item) {
790 790
       $template->assign_block_vars('que', que_tpl_parse_element($que_item));
791 791
     }
792 792
     $que_length = count($que);
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
 function tpl_planet_density_info(&$template, &$density_price_chart, $user_dark_matter) {
804 804
   global $lang;
805 805
 
806
-  foreach($density_price_chart as $density_price_index => &$density_price_data) {
806
+  foreach ($density_price_chart as $density_price_index => &$density_price_data) {
807 807
     $density_cost = $density_price_data;
808 808
     $density_number_style = pretty_number($density_cost, true, $user_dark_matter, false, false);
809 809
 
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 function tpl_assign_select(&$template, $name, $values) {
828 828
   !is_array($values) ? $values = array($values => $values) : false;
829 829
 
830
-  foreach($values as $key => $value) {
830
+  foreach ($values as $key => $value) {
831 831
     $template->assign_block_vars($name, array(
832 832
       'KEY'   => htmlentities($key, ENT_COMPAT, 'UTF-8'),
833 833
       'VALUE' => htmlentities($value, ENT_COMPAT, 'UTF-8'),
Please login to merge, or discard this patch.
includes/alliance/ali_internal_members.inc 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -2,31 +2,31 @@  discard block
 block discarded – undo
2 2
 
3 3
 $classLocale = classLocale::$lang;
4 4
 
5
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
5
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
6 6
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
7 7
 }
8 8
 
9 9
 // Changing rank for single user
10 10
 $id_user = sys_get_param_id('id_user');
11
-if(isset($_GET['id_rank'])) {
11
+if (isset($_GET['id_rank'])) {
12 12
   $id_rank = sys_get_param_int('id_rank');
13 13
 }
14
-if($id_user && isset($id_rank) && $user_admin) {
14
+if ($id_user && isset($id_rank) && $user_admin) {
15 15
   db_user_set_by_id($id_user, "`ally_rank_id` = {$id_rank}");
16 16
 }
17 17
 
18 18
 $id_kick = sys_get_param_id('kick');
19 19
 
20
-if($id_kick && $user_can_kick) {
20
+if ($id_kick && $user_can_kick) {
21 21
   $u = db_user_by_id($id_kick, true);
22
-  if($u['ally_id'] == $ally['id'] && $u['id'] != $ally['ally_owner']) {
22
+  if ($u['ally_id'] == $ally['id'] && $u['id'] != $ally['ally_owner']) {
23 23
     db_user_set_by_id($id_kick, '`ally_id`= null, `ally_name` = null, `ally_tag` = null, ally_register_time = 0, ally_rank_id = 0');
24 24
     db_ally_update_member_decrease($ally);
25 25
   }
26 26
 }
27 27
 
28 28
 $sort2 = sys_get_param_int('sort2');
29
-if($sort2) {
29
+if ($sort2) {
30 30
   $sort2s = "DESC";
31 31
   $sort2 = 0;
32 32
 } else {
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 }
36 36
 
37 37
 $sort1 = sys_get_param_int('sort1');
38
-if($sort1 > 5 || $sort1 < 0) {
38
+if ($sort1 > 5 || $sort1 < 0) {
39 39
   $sort1 = 0;
40 40
 }
41 41
 $sort1s = array(
@@ -53,21 +53,21 @@  discard block
 block discarded – undo
53 53
   'id, username, galaxy, system, planet, onlinetime, ally_rank_id, ally_register_time, total_points');
54 54
 
55 55
 // while ($userRow = db_fetch($userList))
56
-foreach($userList as $userRow) {
56
+foreach ($userList as $userRow) {
57 57
   $i++;
58
-  if(!isset($ranks[$userRow['ally_rank_id']])) {
58
+  if (!isset($ranks[$userRow['ally_rank_id']])) {
59 59
     $userRow['ally_rank_id'] = 0;
60 60
   }
61 61
 
62
-  if($ally['ally_owner'] == $userRow['id']) {
62
+  if ($ally['ally_owner'] == $userRow['id']) {
63 63
     $ally_range = ($ally['ally_owner_range']) ? $ally['ally_owner_range'] : classLocale::$lang['Founder'];
64 64
   } else {
65
-    if($user_admin) {
65
+    if ($user_admin) {
66 66
       $ally_range = '<select onchange="window.location=\'alliance.php?mode=admin&edit=members&id_user=' . $userRow['id'] . '&id_rank=\' + this.value">';
67 67
 
68
-      foreach($ranks as $rankID => $rankArray) {
68
+      foreach ($ranks as $rankID => $rankArray) {
69 69
         $ally_range .= '<option value="' . $rankID . '"';
70
-        if($rankID == $userRow['ally_rank_id']) {
70
+        if ($rankID == $userRow['ally_rank_id']) {
71 71
           $ally_range .= " selected";
72 72
         }
73 73
         $ally_range .= '>' . $rankArray['name'];
@@ -80,20 +80,20 @@  discard block
 block discarded – undo
80 80
   }
81 81
 
82 82
   $last_active = time() - $userRow["onlinetime"];
83
-  if($user_admin) {
84
-    if($last_active < 60) {
83
+  if ($user_admin) {
84
+    if ($last_active < 60) {
85 85
       $tmp = "lime>{$classLocale['On']}";
86
-    } elseif($last_active < 60 * 60) {
86
+    } elseif ($last_active < 60 * 60) {
87 87
       $last_active = round($last_active / 60);
88 88
       $tmp = "lime>{$last_active} {$classLocale['sys_min_short']}";
89
-    } elseif($last_active < 60 * 60 * 24) {
89
+    } elseif ($last_active < 60 * 60 * 24) {
90 90
       $last_active = round($last_active / (60 * 60));
91 91
       $tmp = "green>{$last_active} {$classLocale['sys_hrs_short']}";
92 92
     } else {
93 93
       $last_active = round($last_active / (60 * 60 * 24));
94
-      if($last_active < 7) {
94
+      if ($last_active < 7) {
95 95
         $tmp = "yellow";
96
-      } elseif($last_active < 30) {
96
+      } elseif ($last_active < 30) {
97 97
         $tmp = "orange";
98 98
       } else {
99 99
         $tmp = "red";
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
       $tmp .= ">{$last_active} {$classLocale['sys_day_short']}";
102 102
     }
103 103
   } else {
104
-    if($user_onlinestatus) {
105
-      if($last_active < 60 * 5) {
104
+    if ($user_onlinestatus) {
105
+      if ($last_active < 60 * 5) {
106 106
         $tmp = "lime>{$classLocale['On']}";
107
-      } elseif($last_active < 60 * 15) {
107
+      } elseif ($last_active < 60 * 15) {
108 108
         $tmp = "yellow>{$classLocale['ali_lessThen15min']}";
109 109
       } else {
110 110
         $tmp = "red>{$classLocale['Off']}";
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
   ));
132 132
 }
133 133
 
134
-if($i != $ally['ally_members']) {
134
+if ($i != $ally['ally_members']) {
135 135
   db_ally_update_member_set($i, $ally);
136 136
 }
137 137
 
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin_mail.inc 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
3
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
4 4
   $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
5 5
 }
6 6
 
7
-if(!$user_can_send_mails) {
7
+if (!$user_can_send_mails) {
8 8
   message(classLocale::$lang['Denied_access'], classLocale::$lang['Send_circular_mail']);
9 9
 }
10 10
 
11 11
 $POST_text = sys_get_param_str('text');
12
-if($POST_text) {
12
+if ($POST_text) {
13 13
   message(classLocale::$lang['members_who_recived_message'] . msg_ali_send($POST_text, classLocale::$lang['ali_adm_msg_subject'], sys_get_param_int('r')), classLocale::$lang['Circular_sended'], "alliance.php", '');
14 14
 }
15 15
 
16 16
 $r_list = "<option value=\"-1\">" . classLocale::$lang['All_players'] . "</option>";
17
-if($ranks) {
18
-  foreach($ranks as $id => $array) {
17
+if ($ranks) {
18
+  foreach ($ranks as $id => $array) {
19 19
     $r_list .= "<option value=\"" . $id . "\">" . $array['name'] . "</option>";
20 20
   }
21 21
 }
Please login to merge, or discard this patch.
fleet.php 1 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.