Completed
Push — work-fleets ( 680ce4...35627b )
by SuperNova.WS
05:25
created
includes/template.php 2 patches
Doc Comments   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
  * @param string    $title
35 35
  * @param string    $dest
36 36
  * @param int       $time
37
- * @param bool|true $show_header
37
+ * @param boolean $show_header
38 38
  */
39 39
 function message($mes, $title = 'Error', $dest = '', $time = 5, $show_header = true) {
40 40
   $template = gettemplate('message_body', true);
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
  * @param bool|true       $isDisplayTopNav
196 196
  * @param string          $metatags
197 197
  * @param bool|false      $AdminPage
198
- * @param bool|true       $isDisplayMenu
198
+ * @param boolean       $isDisplayMenu
199 199
  *
200 200
  * @return mixed
201 201
  */
@@ -208,7 +208,6 @@  discard block
 block discarded – undo
208 208
  * @param string          $title
209 209
  * @param bool|true       $isDisplayTopNav
210 210
  * @param string          $metatags
211
- * @param bool|false      $AdminPage
212 211
  * @param bool|true       $isDisplayMenu
213 212
  * @param bool|int|string $exitStatus - Код или сообщение выхода
214 213
  */
@@ -385,10 +384,10 @@  discard block
 block discarded – undo
385 384
 
386 385
 /**
387 386
  * @param       $time
388
- * @param       $event
387
+ * @param       integer $event
389 388
  * @param       $msg
390 389
  * @param       $coordinates
391
- * @param       $is_decrease
390
+ * @param       boolean $is_decrease
392 391
  * @param Fleet $objFleet
393 392
  * @param       $fleet_flying_sorter
394 393
  * @param       $fleet_flying_events
@@ -708,7 +707,7 @@  discard block
 block discarded – undo
708 707
 }
709 708
 
710 709
 /**
711
- * @param array|string  $files
710
+ * @param string  $files
712 711
  * @param template|bool $template
713 712
  * @param string|bool   $template_path
714 713
  *
Please login to merge, or discard this patch.
Spacing   +71 added lines, -71 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);
@@ -102,24 +102,24 @@  discard block
 block discarded – undo
102 102
  * @param template $template
103 103
  */
104 104
 function tpl_menu_assign_to_template(&$sn_menu, &$template) {
105
-  if(empty($sn_menu) || !is_array($sn_menu)) {
105
+  if (empty($sn_menu) || !is_array($sn_menu)) {
106 106
     return;
107 107
   }
108 108
 
109
-  foreach($sn_menu as $menu_item_id => $menu_item) {
110
-    if(!$menu_item) {
109
+  foreach ($sn_menu as $menu_item_id => $menu_item) {
110
+    if (!$menu_item) {
111 111
       continue;
112 112
     }
113 113
 
114
-    if(is_string($menu_item_id)) {
114
+    if (is_string($menu_item_id)) {
115 115
       $menu_item['ID'] = $menu_item_id;
116 116
     }
117 117
 
118
-    if($menu_item['TYPE'] == 'lang') {
118
+    if ($menu_item['TYPE'] == 'lang') {
119 119
       $lang_string = &classLocale::$lang;
120
-      if(preg_match('#(\w+)(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?#', $menu_item['ITEM'], $matches) && count($matches) > 1) {
121
-        for($i = 1; $i < count($matches); $i++) {
122
-          if(defined($matches[$i])) {
120
+      if (preg_match('#(\w+)(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?#', $menu_item['ITEM'], $matches) && count($matches) > 1) {
121
+        for ($i = 1; $i < count($matches); $i++) {
122
+          if (defined($matches[$i])) {
123 123
             $matches[$i] = constant($matches[$i]);
124 124
           }
125 125
           $lang_string = &$lang_string[$matches[$i]];
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
     $menu_item['ALT'] = htmlentities($menu_item['ALT']);
132 132
     $menu_item['TITLE'] = htmlentities($menu_item['TITLE']);
133 133
 
134
-    if(!empty($menu_item['ICON'])) {
135
-      if(is_string($menu_item['ICON'])) {
134
+    if (!empty($menu_item['ICON'])) {
135
+      if (is_string($menu_item['ICON'])) {
136 136
         $menu_item['ICON_PATH'] = $menu_item['ICON'];
137 137
       } else {
138 138
         $menu_item['ICON'] = $menu_item_id;
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
     'MENU_START_HIDE'     => !empty($_COOKIE[SN_COOKIE . '_menu_hidden']) || defined('SN_GOOGLE'),
163 163
   ));
164 164
 
165
-  if(isset($template_result['MENU_CUSTOMIZE'])) {
165
+  if (isset($template_result['MENU_CUSTOMIZE'])) {
166 166
     $template->assign_vars(array(
167 167
       'PLAYER_OPTION_MENU_SHOW_ON_BUTTON'   => classSupernova::$user_options[PLAYER_OPTION_MENU_SHOW_ON_BUTTON],
168 168
       'PLAYER_OPTION_MENU_HIDE_ON_BUTTON'   => classSupernova::$user_options[PLAYER_OPTION_MENU_HIDE_ON_BUTTON],
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
     ));
177 177
   }
178 178
 
179
-  if(defined('IN_ADMIN') && IN_ADMIN === true && !empty($user['authlevel']) && $user['authlevel'] > 0) {
179
+  if (defined('IN_ADMIN') && IN_ADMIN === true && !empty($user['authlevel']) && $user['authlevel'] > 0) {
180 180
     tpl_menu_merge_extra($sn_menu_admin, $sn_menu_admin_extra);
181 181
     tpl_menu_assign_to_template($sn_menu_admin, $template);
182 182
   } else {
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
   $in_admin = defined('IN_ADMIN') && IN_ADMIN === true;
217 217
   $is_login = defined('LOGIN_LOGOUT') && LOGIN_LOGOUT === true;
218 218
 
219
-  if(is_object($page)) {
219
+  if (is_object($page)) {
220 220
     isset($page->_rootref['MENU']) ? $isDisplayMenu = $page->_rootref['MENU'] : false;
221 221
     isset($page->_rootref['NAVBAR']) ? $isDisplayTopNav = $page->_rootref['NAVBAR'] : false;
222 222
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
     !isset($page->_rootref['PAGE_HEADER']) && $title ? $page->assign_var('PAGE_HEADER', $title) : false;
225 225
   }
226 226
 
227
-  if(empty($user['id']) || !is_numeric($user['id'])) {
227
+  if (empty($user['id']) || !is_numeric($user['id'])) {
228 228
     $isDisplayMenu = false;
229 229
     $isDisplayTopNav = false;
230 230
   }
@@ -236,10 +236,10 @@  discard block
 block discarded – undo
236 236
   $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);
237 237
 
238 238
   $font_size = !empty($_COOKIE[SN_COOKIE_F]) ? $_COOKIE[SN_COOKIE_F] : classSupernova::$user_options[PLAYER_OPTION_BASE_FONT_SIZE];
239
-  if(strpos($font_size, '%') !== false) {
239
+  if (strpos($font_size, '%') !== false) {
240 240
     // Размер шрифта в процентах
241 241
     $font_size = min(max(floatval($font_size), FONT_SIZE_PERCENT_MIN), FONT_SIZE_PERCENT_MAX) . '%';
242
-  } elseif(strpos($font_size, 'px') !== false) {
242
+  } elseif (strpos($font_size, 'px') !== false) {
243 243
     // Размер шрифта в пикселях
244 244
     $font_size = min(max(floatval($font_size), FONT_SIZE_PIXELS_MIN), FONT_SIZE_PIXELS_MAX) . 'px';
245 245
   } else {
@@ -251,10 +251,10 @@  discard block
 block discarded – undo
251 251
 
252 252
   $template = gettemplate('_global_header', true);
253 253
 
254
-  if(!empty(classSupernova::$sn_mvc['javascript'])) {
255
-    foreach(classSupernova::$sn_mvc['javascript'] as $page_name => $script_list) {
256
-      if(empty($page_name) || $page_name == $sn_page_name) {
257
-        foreach($script_list as $filename => $content) {
254
+  if (!empty(classSupernova::$sn_mvc['javascript'])) {
255
+    foreach (classSupernova::$sn_mvc['javascript'] as $page_name => $script_list) {
256
+      if (empty($page_name) || $page_name == $sn_page_name) {
257
+        foreach ($script_list as $filename => $content) {
258 258
           $template_result['.']['javascript'][] = array(
259 259
             'FILE'    => $filename,
260 260
             'CONTENT' => $content,
@@ -280,9 +280,9 @@  discard block
 block discarded – undo
280 280
   classSupernova::$sn_mvc['css'][''] = array_merge($standard_css, classSupernova::$sn_mvc['css']['']);
281 281
 
282 282
 
283
-  foreach(classSupernova::$sn_mvc['css'] as $page_name => $script_list) {
284
-    if(empty($page_name) || $page_name == $sn_page_name) {
285
-      foreach($script_list as $filename => $content) {
283
+  foreach (classSupernova::$sn_mvc['css'] as $page_name => $script_list) {
284
+    if (empty($page_name) || $page_name == $sn_page_name) {
285
+      foreach ($script_list as $filename => $content) {
286 286
         $template_result['.']['css'][] = array(
287 287
           'FILE'    => $filename,
288 288
           'CONTENT' => $content,
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
     ), // Проводить замер только если не выставлен флаг форсированного замера И (иссяк интервал замера ИЛИ замера еще не было)
309 309
     //'TIME_UTC_OFFSET'          => defined('SN_CLIENT_TIME_UTC_OFFSET') ? SN_CLIENT_TIME_UTC_OFFSET : '',
310 310
 
311
-    'title'                    => ($title ? "{$title} - " : '') . classLocale::$lang['sys_server'] . " {$config->game_name} - " . classLocale::$lang['sys_supernova'] ,
311
+    'title'                    => ($title ? "{$title} - " : '') . classLocale::$lang['sys_server'] . " {$config->game_name} - " . classLocale::$lang['sys_supernova'],
312 312
     '-meta-'                   => $metatags,
313 313
     'ADV_SEO_META_DESCRIPTION' => $config->adv_seo_meta_description,
314 314
     'ADV_SEO_META_KEYWORDS'    => $config->adv_seo_meta_keywords,
@@ -329,12 +329,12 @@  discard block
 block discarded – undo
329 329
   $template->assign_recursive($template_result);
330 330
   displayP(parsetemplate($template));
331 331
 
332
-  if(($isDisplayMenu || $in_admin) && !isset($_COOKIE['menu_disable'])) {
332
+  if (($isDisplayMenu || $in_admin) && !isset($_COOKIE['menu_disable'])) {
333 333
     // $AdminPage = $AdminPage ? $user['authlevel'] : 0;
334 334
     displayP(parsetemplate(tpl_render_menu()));
335 335
   }
336 336
 
337
-  if($isDisplayTopNav && !$in_admin) {
337
+  if ($isDisplayTopNav && !$in_admin) {
338 338
     displayP(parsetemplate(tpl_render_topnav($user, $planetrow)));
339 339
   }
340 340
 
@@ -342,8 +342,8 @@  discard block
 block discarded – undo
342 342
 
343 343
   !is_array($page) ? $page = array($page) : false;
344 344
   $result_added = false;
345
-  foreach($page as $page_item) {
346
-    if(!$result_added && is_object($page_item) && isset($page_item->_tpldata['result'])) {
345
+  foreach ($page as $page_item) {
346
+    if (!$result_added && is_object($page_item) && isset($page_item->_tpldata['result'])) {
347 347
       $page_item = gettemplate('_result_message', $page_item);
348 348
       $temp = $page_item->files['_result_message'];
349 349
       unset($page_item->files['_result_message']);
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
   ));
367 367
   displayP(parsetemplate($template));
368 368
 
369
-  $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false;;
369
+  $user['authlevel'] >= 3 && $config->debug ? $debug->echo_log() : false; ;
370 370
 
371 371
   sn_db_disconnect();
372 372
 
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
  * @param string         $type
405 405
  */
406 406
 function tpl_topnav_event_build(&$template, $FleetList, $type = 'fleet') {
407
-  if(empty($FleetList)) {
407
+  if (empty($FleetList)) {
408 408
     return;
409 409
   }
410 410
 
@@ -413,19 +413,19 @@  discard block
 block discarded – undo
413 413
   $fleet_event_count = 0;
414 414
   $fleet_flying_sorter = array();
415 415
   $fleet_flying_events = array();
416
-  foreach($FleetList->_container as $objFleet) {
416
+  foreach ($FleetList->_container as $objFleet) {
417 417
     $will_return = true;
418
-    if(!$objFleet->isReturning()) {
418
+    if (!$objFleet->isReturning()) {
419 419
       // cut fleets on Hold and Expedition
420
-      if($objFleet->time_arrive_to_target >= SN_TIME_NOW) {
420
+      if ($objFleet->time_arrive_to_target >= SN_TIME_NOW) {
421 421
         $objFleet->mission_type == MT_RELOCATE ? $will_return = false : false;
422 422
         tpl_topnav_event_build_helper($objFleet->time_arrive_to_target, EVENT_FLEET_ARRIVE, classLocale::$lang['sys_event_arrive'], $objFleet->target_coordinates_typed(), !$will_return, $objFleet, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count);
423 423
       }
424
-      if($objFleet->time_mission_job_complete) {
424
+      if ($objFleet->time_mission_job_complete) {
425 425
         tpl_topnav_event_build_helper($objFleet->time_mission_job_complete, EVENT_FLEET_STAY, classLocale::$lang['sys_event_stay'], $objFleet->target_coordinates_typed(), false, $objFleet, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count);
426 426
       }
427 427
     }
428
-    if($will_return) {
428
+    if ($will_return) {
429 429
       tpl_topnav_event_build_helper($objFleet->time_return_to_source, EVENT_FLEET_RETURN, classLocale::$lang['sys_event_return'], $objFleet->launch_coordinates_typed(), true, $objFleet, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count);
430 430
     }
431 431
   }
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
   asort($fleet_flying_sorter);
434 434
 
435 435
   $fleet_flying_count = $FleetList->count();
436
-  foreach($fleet_flying_sorter as $fleet_event_id => $fleet_time) {
436
+  foreach ($fleet_flying_sorter as $fleet_event_id => $fleet_time) {
437 437
     $fleet_event = &$fleet_flying_events[$fleet_event_id];
438 438
     $template->assign_block_vars("flying_{$type}s", array(
439 439
       'TIME' => max(0, $fleet_time - SN_TIME_NOW),
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
 function sn_tpl_render_topnav(&$user, $planetrow) {
462 462
   global $lang, $config, $template_result;
463 463
 
464
-  if(!is_array($user)) {
464
+  if (!is_array($user)) {
465 465
     return '';
466 466
   }
467 467
 
@@ -482,8 +482,8 @@  discard block
 block discarded – undo
482 482
 
483 483
   $ThisUsersPlanets = db_planet_list_sorted($user);
484 484
   // while ($CurPlanet = db_fetch($ThisUsersPlanets))
485
-  foreach($ThisUsersPlanets as $CurPlanet) {
486
-    if($CurPlanet['destruyed']) {
485
+  foreach ($ThisUsersPlanets as $CurPlanet) {
486
+    if ($CurPlanet['destruyed']) {
487 487
       continue;
488 488
     }
489 489
 
@@ -507,8 +507,8 @@  discard block
 block discarded – undo
507 507
    */
508 508
   $fleet_flying_list = array();
509 509
   $fleet_flying_list[0] = FleetList::dbGetFleetListByOwnerId($user['id']);
510
-  foreach($fleet_flying_list[0]->_container as $fleet_id => $objFleet) {
511
-    if(empty($fleet_flying_list[$objFleet->mission_type])) {
510
+  foreach ($fleet_flying_list[0]->_container as $fleet_id => $objFleet) {
511
+    if (empty($fleet_flying_list[$objFleet->mission_type])) {
512 512
       $fleet_flying_list[$objFleet->mission_type] = new FleetList();
513 513
     }
514 514
     $fleet_flying_list[$objFleet->mission_type][$fleet_id] = $objFleet;
@@ -520,8 +520,8 @@  discard block
 block discarded – undo
520 520
   que_tpl_parse($template, QUE_RESEARCH, $user, array(), null, !classSupernova::$user_options[PLAYER_OPTION_NAVBAR_RESEARCH_WIDE]);
521 521
   que_tpl_parse($template, SUBQUE_FLEET, $user, $planetrow, null, true);
522 522
 
523
-  if(!empty(classSupernova::$sn_mvc['navbar_prefix_button']) && is_array(classSupernova::$sn_mvc['navbar_prefix_button'])) {
524
-    foreach(classSupernova::$sn_mvc['navbar_prefix_button'] as $navbar_button_image => $navbar_button_url) {
523
+  if (!empty(classSupernova::$sn_mvc['navbar_prefix_button']) && is_array(classSupernova::$sn_mvc['navbar_prefix_button'])) {
524
+    foreach (classSupernova::$sn_mvc['navbar_prefix_button'] as $navbar_button_image => $navbar_button_url) {
525 525
       $template->assign_block_vars('navbar_prefix_button', array(
526 526
         'IMAGE'        => $navbar_button_image,
527 527
         'URL_RELATIVE' => $navbar_button_url,
@@ -535,13 +535,13 @@  discard block
 block discarded – undo
535 535
   $time_now_parsed = getdate(SN_TIME_NOW);
536 536
   $time_local_parsed = getdate(defined('SN_CLIENT_TIME_LOCAL') ? SN_CLIENT_TIME_LOCAL : SN_TIME_NOW);
537 537
 
538
-  if($config->game_news_overview) {
538
+  if ($config->game_news_overview) {
539 539
     $user_last_read_safe = intval($user['news_lastread']);
540 540
     nws_render($template, "WHERE UNIX_TIMESTAMP(`tsTimeStamp`) >= {$user_last_read_safe}", $config->game_news_overview);
541 541
   }
542 542
 
543 543
   $notes_query = db_note_list_by_owner($user['id'], true);
544
-  while($note_row = db_fetch($notes_query)) {
544
+  while ($note_row = db_fetch($notes_query)) {
545 545
     note_assign($template, $note_row);
546 546
   }
547 547
 
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
     'QUE_ID'   => QUE_RESEARCH,
553 553
     'QUE_HTML' => 'topnav',
554 554
 
555
-    'RESEARCH_ONGOING' => (boolean)$user['que'],
555
+    'RESEARCH_ONGOING' => (boolean) $user['que'],
556 556
 
557 557
     'TIME_TEXT'       => sprintf($str_date_format, $time_now_parsed['year'], classLocale::$lang['months'][$time_now_parsed['mon']], $time_now_parsed['mday'],
558 558
       $time_now_parsed['hours'], $time_now_parsed['minutes'], $time_now_parsed['seconds']
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
     'QUE_STRUCTURES' => QUE_STRUCTURES,
630 630
   ));
631 631
 
632
-  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)) {
632
+  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)) {
633 633
     tpl_set_resource_info($template, $planetrow);
634 634
     $template->assign_vars(array(
635 635
       'SN_RENDER_NAVBAR_PLANET' => true,
@@ -644,12 +644,12 @@  discard block
 block discarded – undo
644 644
  * @param template|string $template
645 645
  */
646 646
 function displayP($template) {
647
-  if(is_object($template)) {
648
-    if(empty($template->parsed)) {
647
+  if (is_object($template)) {
648
+    if (empty($template->parsed)) {
649 649
       parsetemplate($template);
650 650
     }
651 651
 
652
-    foreach($template->files as $section => $filename) {
652
+    foreach ($template->files as $section => $filename) {
653 653
       $template->display($section);
654 654
     }
655 655
   } else {
@@ -664,11 +664,11 @@  discard block
 block discarded – undo
664 664
  * @return mixed
665 665
  */
666 666
 function parsetemplate($template, $array = false) {
667
-  if(is_object($template)) {
667
+  if (is_object($template)) {
668 668
     global $user;
669 669
 
670
-    if(!empty($array) && is_array($array)) {
671
-      foreach($array as $key => $data) {
670
+    if (!empty($array) && is_array($array)) {
671
+      foreach ($array as $key => $data) {
672 672
         $template->assign_var($key, $data);
673 673
       }
674 674
     }
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
 
710 710
   $template_ex = '.tpl.html';
711 711
 
712
-  if($template === false) {
712
+  if ($template === false) {
713 713
     return sys_file_read(TEMPLATE_DIR . '/' . $files . $template_ex);
714 714
   }
715 715
 
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
   !empty(classSupernova::$sn_mvc['i18n']['']) ? lng_load_i18n(classSupernova::$sn_mvc['i18n']['']) : false;
730 730
   $sn_page_name ? lng_load_i18n(classSupernova::$sn_mvc['i18n'][$sn_page_name]) : false;
731 731
 
732
-  foreach($files as &$filename) {
732
+  foreach ($files as &$filename) {
733 733
     $filename = $filename . $template_ex;
734 734
   }
735 735
 
@@ -754,13 +754,13 @@  discard block
 block discarded – undo
754 754
     'LANG'     => $language ? $language : '',
755 755
     'referral' => $id_ref ? '&id_ref=' . $id_ref : '',
756 756
 
757
-    'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '',// "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''),
757
+    'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '', // "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''),
758 758
     'FILENAME'       => basename($_SERVER['PHP_SELF']),
759 759
   ));
760 760
 
761
-  foreach(lng_get_list() as $lng_id => $lng_data) {
762
-    if(isset($lng_data['LANG_VARIANTS']) && is_array($lng_data['LANG_VARIANTS'])) {
763
-      foreach($lng_data['LANG_VARIANTS'] as $lang_variant) {
761
+  foreach (lng_get_list() as $lng_id => $lng_data) {
762
+    if (isset($lng_data['LANG_VARIANTS']) && is_array($lng_data['LANG_VARIANTS'])) {
763
+      foreach ($lng_data['LANG_VARIANTS'] as $lang_variant) {
764 764
         $lng_data1 = $lng_data;
765 765
         $lng_data1 = array_merge($lng_data1, $lang_variant);
766 766
         $template->assign_block_vars('language', $lng_data1);
@@ -783,8 +783,8 @@  discard block
 block discarded – undo
783 783
   $que = $que['ques'][$que_type][$planet['id_owner']][$planet['id']];
784 784
 
785 785
   $que_length = 0;
786
-  if(!empty($que)) {
787
-    foreach($que as $que_item) {
786
+  if (!empty($que)) {
787
+    foreach ($que as $que_item) {
788 788
       $template->assign_block_vars('que', que_tpl_parse_element($que_item));
789 789
     }
790 790
     $que_length = count($que);
@@ -799,7 +799,7 @@  discard block
 block discarded – undo
799 799
  * @param int      $user_dark_matter
800 800
  */
801 801
 function tpl_planet_density_info(&$template, &$density_price_chart, $user_dark_matter) {
802
-  foreach($density_price_chart as $density_price_index => &$density_price_data) {
802
+  foreach ($density_price_chart as $density_price_index => &$density_price_data) {
803 803
     $density_cost = $density_price_data;
804 804
     $density_number_style = pretty_number($density_cost, true, $user_dark_matter, false, false);
805 805
 
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
 function tpl_assign_select(&$template, $name, $values) {
824 824
   !is_array($values) ? $values = array($values => $values) : false;
825 825
 
826
-  foreach($values as $key => $value) {
826
+  foreach ($values as $key => $value) {
827 827
     $template->assign_block_vars($name, array(
828 828
       'KEY'   => htmlentities($key, ENT_COMPAT, 'UTF-8'),
829 829
       'VALUE' => htmlentities($value, ENT_COMPAT, 'UTF-8'),
Please login to merge, or discard this patch.
search.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 
13 13
 include('common.' . substr(strrchr(__FILE__, '.'), 1));
14 14
 
15
-if($config->game_mode == GAME_BLITZ) {
15
+if ($config->game_mode == GAME_BLITZ) {
16 16
   message($lang['sys_blitz_page_disabled'], $lang['sys_error'], 'overview.php', 10);
17 17
   die();
18 18
 }
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 
26 26
 $template = gettemplate('search', true);
27 27
 
28
-if($searchtext && $type) {
29
-  switch($type) {
28
+if ($searchtext && $type) {
29
+  switch ($type) {
30 30
     case "planetname":
31 31
       // $search = db_planet_list_search($searchtext);
32 32
     break;
@@ -41,8 +41,8 @@  discard block
 block discarded – undo
41 41
     break;
42 42
   }
43 43
 
44
-  while($row = db_fetch($search)) {
45
-    if($type == 'playername' || $type == 'planetname') {
44
+  while ($row = db_fetch($search)) {
45
+    if ($type == 'playername' || $type == 'planetname') {
46 46
       $template->assign_block_vars('search_result', array(
47 47
         'PLAYER_ID'       => $row['uid'],
48 48
         'PLAYER_NAME'     => htmlentities($row['username'], ENT_COMPAT, 'UTF-8'),
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
         'ALLY_NAME'       => htmlentities($row['ally_name'], ENT_COMPAT, 'UTF-8'),
58 58
         'ALLY_TAG'        => htmlentities($row['ally_tag'], ENT_COMPAT, 'UTF-8'),
59 59
       ));
60
-    } elseif($type == 'ally') {
60
+    } elseif ($type == 'ally') {
61 61
       $template->assign_block_vars('search_result', array(
62 62
         'ALLY_NAME'     => htmlentities($row['ally_name'], ENT_COMPAT, 'UTF-8'),
63 63
         'ALLY_TAG'      => htmlentities($row['ally_tag'], ENT_COMPAT, 'UTF-8'),
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
   'ally'       => 'sys_alliance',
76 76
 );
77 77
 
78
-foreach($search_type as $type_id => $type_lang) {
78
+foreach ($search_type as $type_id => $type_lang) {
79 79
   $template->assign_block_vars('type', array(
80 80
     'ID'       => $type_id,
81 81
     'TEXT'     => $lang[$type_lang],
Please login to merge, or discard this patch.
common.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,25 +12,25 @@  discard block
 block discarded – undo
12 12
 global $debug, $sn_mvc, $template_result, $user;
13 13
 
14 14
 // Напоминание для Администрации, что игра отключена
15
-if($template_result[F_GAME_DISABLE]) {
15
+if ($template_result[F_GAME_DISABLE]) {
16 16
   // $disable_reason = sys_bbcodeParse($config->game_disable_reason); // Должна быть инициализирована выше по коду - в init.php
17 17
   echo '<div class="global_admin_warning">', $template_result[F_GAME_DISABLE_REASON], '</div>';
18 18
 }
19 19
 unset($disable_reason);
20 20
 
21 21
 
22
-if(defined('IN_ADMIN') && IN_ADMIN === true) {
22
+if (defined('IN_ADMIN') && IN_ADMIN === true) {
23 23
   lng_include('admin');
24
-} elseif($sys_user_logged_in) {
24
+} elseif ($sys_user_logged_in) {
25 25
   sys_user_vacation($user);
26 26
 
27 27
   $planet_id = SetSelectedPlanet($user);
28 28
 
29 29
   // TODO НЕ НУЖНО АЛЬЯНС КАЖДЫЙ РАЗ ОБНОВЛЯТЬ!!!
30
-  if($user['ally_id']) {
30
+  if ($user['ally_id']) {
31 31
     sn_db_transaction_start();
32 32
     sn_ali_fill_user_ally($user);
33
-    if(!$user['ally']['player']['id']) {
33
+    if (!$user['ally']['player']['id']) {
34 34
       // sn_sys_logout(false, true);
35 35
       // core_auth::logout(false);
36 36
       classSupernova::$auth->logout(false);
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
   sn_db_transaction_commit();
50 50
 
51 51
   $planetrow = $global_data['planet'];
52
-  if(!($planetrow && isset($planetrow['id']) && $planetrow['id'])) {
52
+  if (!($planetrow && isset($planetrow['id']) && $planetrow['id'])) {
53 53
     // sn_sys_logout(false, true);
54 54
     // core_auth::logout(false);
55 55
     classSupernova::$auth->logout(false);
Please login to merge, or discard this patch.
banned.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
 
21 21
 $query = db_banned_list_select();
22 22
 $i = 0;
23
-while($ban_row = db_fetch($query)) {
23
+while ($ban_row = db_fetch($query)) {
24 24
   $template->assign_block_vars('banlist', array(
25 25
     'USER_NAME'   => $ban_row['ban_user_name'],
26 26
     'REASON'      => $ban_row['ban_reason'],
Please login to merge, or discard this patch.
buddy.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -17,32 +17,32 @@  discard block
 block discarded – undo
17 17
 try {
18 18
   sn_db_transaction_start();
19 19
 
20
-  if($buddy_id = sys_get_param_id('buddy_id')) {
20
+  if ($buddy_id = sys_get_param_id('buddy_id')) {
21 21
     $buddy_row = db_buddy_get_row($buddy_id);
22
-    if(!is_array($buddy_row)) {
22
+    if (!is_array($buddy_row)) {
23 23
       throw new exception('buddy_err_not_exist', ERR_ERROR);
24 24
     }
25 25
 
26
-    switch($mode = sys_get_param_str('mode')) {
26
+    switch ($mode = sys_get_param_str('mode')) {
27 27
       case 'accept':
28
-        if($buddy_row['BUDDY_SENDER_ID'] == $user['id']) {
28
+        if ($buddy_row['BUDDY_SENDER_ID'] == $user['id']) {
29 29
           throw new exception('buddy_err_accept_own', ERR_ERROR);
30 30
         }
31 31
 
32
-        if($buddy_row['BUDDY_OWNER_ID'] != $user['id']) {
32
+        if ($buddy_row['BUDDY_OWNER_ID'] != $user['id']) {
33 33
           throw new exception('buddy_err_accept_alien', ERR_ERROR);
34 34
         }
35 35
 
36
-        if($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) {
36
+        if ($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) {
37 37
           throw new exception('buddy_err_accept_already', ERR_WARNING);
38 38
         }
39 39
 
40
-        if($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_DENIED) {
40
+        if ($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_DENIED) {
41 41
           throw new exception('buddy_err_accept_denied', ERR_ERROR);
42 42
         }
43 43
 
44 44
         db_buddy_update_status($buddy_id, BUDDY_REQUEST_ACTIVE);
45
-        if(classSupernova::$db->db_affected_rows()) {
45
+        if (classSupernova::$db->db_affected_rows()) {
46 46
           msg_send_simple_message($buddy_row['BUDDY_SENDER_ID'], $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, $user['username'], $lang['buddy_msg_accept_title'],
47 47
             sprintf($lang['buddy_msg_accept_text'], $user['username']));
48 48
           sn_db_transaction_commit();
@@ -53,11 +53,11 @@  discard block
 block discarded – undo
53 53
       break;
54 54
 
55 55
       case 'delete':
56
-        if($buddy_row['BUDDY_SENDER_ID'] != $user['id'] && $buddy_row['BUDDY_OWNER_ID'] != $user['id']) {
56
+        if ($buddy_row['BUDDY_SENDER_ID'] != $user['id'] && $buddy_row['BUDDY_OWNER_ID'] != $user['id']) {
57 57
           throw new exception('buddy_err_delete_alien', ERR_ERROR);
58 58
         }
59 59
 
60
-        if($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) // Existing friendship
60
+        if ($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) // Existing friendship
61 61
         {
62 62
           $ex_friend_id = $buddy_row['BUDDY_SENDER_ID'] == $user['id'] ? $buddy_row['BUDDY_OWNER_ID'] : $buddy_row['BUDDY_SENDER_ID'];
63 63
 
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
           db_buddy_delete($buddy_id);
68 68
           sn_db_transaction_commit();
69 69
           throw new exception('buddy_err_unfriend_none', ERR_NONE);
70
-        } elseif($buddy_row['BUDDY_SENDER_ID'] == $user['id']) // Player's outcoming request - either denied or waiting
70
+        } elseif ($buddy_row['BUDDY_SENDER_ID'] == $user['id']) // Player's outcoming request - either denied or waiting
71 71
         {
72 72
           db_buddy_delete($buddy_id);
73 73
           sn_db_transaction_commit();
74 74
           throw new exception('buddy_err_delete_own', ERR_NONE);
75
-        } elseif($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_WAITING) // Deny incoming request
75
+        } elseif ($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_WAITING) // Deny incoming request
76 76
         {
77 77
           msg_send_simple_message($buddy_row['BUDDY_SENDER_ID'], $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, $user['username'], $lang['buddy_msg_deny_title'],
78 78
             sprintf($lang['buddy_msg_deny_text'], $user['username']));
@@ -87,22 +87,22 @@  discard block
 block discarded – undo
87 87
 
88 88
   // New request?
89 89
   // Checking for user ID - in case if it was request from outside buddy system
90
-  if($new_friend_id = sys_get_param_id('request_user_id')) {
90
+  if ($new_friend_id = sys_get_param_id('request_user_id')) {
91 91
     $new_friend_row = db_user_by_id($new_friend_id, true, '`id`, `username`');
92
-  } elseif($new_friend_name = sys_get_param_str_unsafe('request_user_name')) {
92
+  } elseif ($new_friend_name = sys_get_param_str_unsafe('request_user_name')) {
93 93
     $new_friend_row = db_user_by_username($new_friend_name, true, '`id`, `username`');
94 94
     $new_friend_name = db_escape($new_friend_name);
95 95
   }
96 96
 
97
-  if($new_friend_row['id'] == $user['id']) {
97
+  if ($new_friend_row['id'] == $user['id']) {
98 98
     unset($new_friend_row);
99 99
     throw new exception('buddy_err_adding_self', ERR_ERROR);
100 100
   }
101 101
 
102 102
   // Checking for user name & request text - in case if it was request to adding new request
103
-  if(isset($new_friend_row['id']) && ($new_request_text = sys_get_param_str('request_text'))) {
103
+  if (isset($new_friend_row['id']) && ($new_request_text = sys_get_param_str('request_text'))) {
104 104
     $check_relation = db_buddy_check_relation($user, $new_friend_row);
105
-    if(isset($check_relation['BUDDY_ID'])) {
105
+    if (isset($check_relation['BUDDY_ID'])) {
106 106
       throw new exception('buddy_err_adding_exists', ERR_WARNING);
107 107
     }
108 108
 
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
     sn_db_transaction_commit();
114 114
     throw new exception('buddy_err_adding_none', ERR_NONE);
115 115
   }
116
-} catch(Exception $e) {
116
+} catch (Exception $e) {
117 117
   $result[] = array(
118 118
     'STATUS'  => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR,
119 119
     'MESSAGE' => $lang[$e->getMessage()],
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 sn_db_transaction_rollback();
124 124
 
125 125
 $query = db_buddy_list_by_user($user['id']);
126
-while($row = db_fetch($query)) {
126
+while ($row = db_fetch($query)) {
127 127
   $row['BUDDY_REQUEST'] = sys_bbcodeParse($row['BUDDY_REQUEST']);
128 128
 
129 129
   $row['BUDDY_ACTIVE'] = $row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE;
Please login to merge, or discard this patch.
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -57,9 +57,11 @@  discard block
 block discarded – undo
57 57
           throw new exception('buddy_err_delete_alien', ERR_ERROR);
58 58
         }
59 59
 
60
-        if($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) // Existing friendship
60
+        if($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) {
61
+          // Existing friendship
61 62
         {
62 63
           $ex_friend_id = $buddy_row['BUDDY_SENDER_ID'] == $user['id'] ? $buddy_row['BUDDY_OWNER_ID'] : $buddy_row['BUDDY_SENDER_ID'];
64
+        }
63 65
 
64 66
           msg_send_simple_message($ex_friend_id, $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, $user['username'], $lang['buddy_msg_unfriend_title'],
65 67
             sprintf($lang['buddy_msg_unfriend_text'], $user['username']));
@@ -67,15 +69,19 @@  discard block
 block discarded – undo
67 69
           db_buddy_delete($buddy_id);
68 70
           sn_db_transaction_commit();
69 71
           throw new exception('buddy_err_unfriend_none', ERR_NONE);
70
-        } elseif($buddy_row['BUDDY_SENDER_ID'] == $user['id']) // Player's outcoming request - either denied or waiting
72
+        } elseif($buddy_row['BUDDY_SENDER_ID'] == $user['id']) {
73
+          // Player's outcoming request - either denied or waiting
71 74
         {
72 75
           db_buddy_delete($buddy_id);
76
+        }
73 77
           sn_db_transaction_commit();
74 78
           throw new exception('buddy_err_delete_own', ERR_NONE);
75
-        } elseif($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_WAITING) // Deny incoming request
79
+        } elseif($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_WAITING) {
80
+          // Deny incoming request
76 81
         {
77 82
           msg_send_simple_message($buddy_row['BUDDY_SENDER_ID'], $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, $user['username'], $lang['buddy_msg_deny_title'],
78 83
             sprintf($lang['buddy_msg_deny_text'], $user['username']));
84
+        }
79 85
 
80 86
           db_buddy_update_status($buddy_id, BUDDY_REQUEST_DENIED);
81 87
           sn_db_transaction_commit();
Please login to merge, or discard this patch.
alliance.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 
3 3
 include('common.' . substr(strrchr(__FILE__, '.'), 1));
4 4
 
5
-if($config->game_mode == GAME_BLITZ) {
5
+if ($config->game_mode == GAME_BLITZ) {
6 6
   message($lang['sys_blitz_page_disabled'], $lang['sys_error'], 'overview.php', 10);
7 7
   die();
8 8
 }
@@ -14,16 +14,16 @@  discard block
 block discarded – undo
14 14
 
15 15
 $mode = sys_get_param_str('mode');
16 16
 
17
-if($mode == 'ainfo') {
17
+if ($mode == 'ainfo') {
18 18
   include('includes/alliance/ali_info.inc');
19 19
 }
20 20
 
21
-if(!$user['ally_id']) {
21
+if (!$user['ally_id']) {
22 22
   $user_request = db_ally_request_get_by_user_id($user['id']);
23
-  if($user_request['id_user']) {
23
+  if ($user_request['id_user']) {
24 24
     require('includes/alliance/ali_external_request.inc');
25 25
   } else {
26
-    switch($mode) {
26
+    switch ($mode) {
27 27
       case 'search':
28 28
         require('includes/alliance/ali_external_search.inc');
29 29
       break;
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 }
45 45
 
46 46
 sn_ali_fill_user_ally($user);
47
-if(!isset($user['ally'])) {
47
+if (!isset($user['ally'])) {
48 48
   db_user_set_by_id($user['id'], "`ally_id` = null, `ally_name` = null, `ally_register_time` = 0, `ally_rank_id` = 0");
49 49
   message($lang['ali_sys_notFound'], $lang['your_alliance'], 'alliance.php');
50 50
 }
@@ -72,18 +72,18 @@  discard block
 block discarded – undo
72 72
 
73 73
 // This piece converting old ally data to new one
74 74
 //  unset($ally['ranklist']);
75
-if(!$ally['ranklist'] && $ally['ally_ranks']) {
75
+if (!$ally['ranklist'] && $ally['ally_ranks']) {
76 76
   $ally_ranks = unserialize($ally['ally_ranks']);
77 77
   $i = 0;
78
-  foreach($ally_ranks as $rank_id => $rank) {
79
-    foreach($ally_rights as $key => $value) {
78
+  foreach ($ally_ranks as $rank_id => $rank) {
79
+    foreach ($ally_rights as $key => $value) {
80 80
       $ranks[$i][$value] = $rank[$rights_old[$key]];
81 81
     }
82 82
     db_user_list_set_ally_deprecated_convert_ranks($user['ally_id'], $i, $rank_id);
83 83
     $i++;
84 84
   }
85 85
 
86
-  if(!empty($ranks)) {
86
+  if (!empty($ranks)) {
87 87
     ali_rank_list_save($ranks);
88 88
   }
89 89
 }
@@ -101,15 +101,15 @@  discard block
 block discarded – undo
101 101
 
102 102
 $edit = sys_get_param_str('edit');
103 103
 ally_pre_call();
104
-switch($mode) {
104
+switch ($mode) {
105 105
   case 'admin':
106
-    if(!array_key_exists($edit, $sn_ali_admin_internal)) {
106
+    if (!array_key_exists($edit, $sn_ali_admin_internal)) {
107 107
       $edit = 'default';
108 108
     }
109
-    if($sn_ali_admin_internal[$edit]['include']) {
109
+    if ($sn_ali_admin_internal[$edit]['include']) {
110 110
       require("includes/{$sn_ali_admin_internal[$edit]['include']}");
111 111
     }
112
-    if(isset($sn_ali_admin_internal[$edit]['function']) && is_callable($sn_ali_admin_internal[$edit]['function'])) {
112
+    if (isset($sn_ali_admin_internal[$edit]['function']) && is_callable($sn_ali_admin_internal[$edit]['function'])) {
113 113
       call_user_func($sn_ali_admin_internal[$edit]['function']);
114 114
     }
115 115
   break;
Please login to merge, or discard this patch.
flying_fleets.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@  discard block
 block discarded – undo
4 4
 
5 5
 global $debug, $lang, $user, $planetrow;
6 6
 
7
-if(!empty($_POST['return']) && is_array($_POST['return'])) {
8
-  foreach($_POST['return'] as $fleet_id) {
9
-    if($fleet_id = idval($fleet_id)) {
7
+if (!empty($_POST['return']) && is_array($_POST['return'])) {
8
+  foreach ($_POST['return'] as $fleet_id) {
9
+    if ($fleet_id = idval($fleet_id)) {
10 10
       sn_db_transaction_start();
11 11
       $objFleet = new Fleet();
12 12
       $objFleet->dbLoad($fleet_id);
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 lng_include('overview');
31 31
 lng_include('fleet');
32 32
 
33
-if(!$planetrow) {
33
+if (!$planetrow) {
34 34
   message($lang['fl_noplanetrow'], $lang['fl_error']);
35 35
 }
36 36
 
@@ -38,14 +38,14 @@  discard block
 block discarded – undo
38 38
 
39 39
 $i = 0;
40 40
 $objFleetList = FleetList::dbGetFleetListByOwnerId($user['id']);
41
-if(!empty($objFleetList)) {
42
-  foreach($objFleetList->_container as $fleet_id => $objFleet) {
41
+if (!empty($objFleetList)) {
42
+  foreach ($objFleetList->_container as $fleet_id => $objFleet) {
43 43
     $i++;
44 44
     $fleet_data = tplParseFleetObject($objFleet, $i, $user);
45 45
 
46 46
     $template->assign_block_vars('fleets', $fleet_data['fleet']);
47 47
 
48
-    foreach($fleet_data['ships'] as $ship_data) {
48
+    foreach ($fleet_data['ships'] as $ship_data) {
49 49
       $template->assign_block_vars('fleets.ships', $ship_data);
50 50
     }
51 51
   }
Please login to merge, or discard this patch.
admin/adm_message_list.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 
15 15
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
16 16
 
17
-if($user['authlevel'] < 3) {
17
+if ($user['authlevel'] < 3) {
18 18
   AdminMessage($lang['adm_err_denied']);
19 19
 }
20 20
 
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
   ),
29 29
 );
30 30
 $template->assign_block_vars('int_type_selected', $allowed_types[-1]);
31
-foreach($sn_message_class_list as $key => $value) {
32
-  if($key == MSG_TYPE_NEW || $key == MSG_TYPE_OUTBOX) {
31
+foreach ($sn_message_class_list as $key => $value) {
32
+  if ($key == MSG_TYPE_NEW || $key == MSG_TYPE_OUTBOX) {
33 33
     continue;
34 34
   }
35 35
 
@@ -41,17 +41,17 @@  discard block
 block discarded – undo
41 41
 
42 42
 
43 43
 $message_delete = sys_get_param_id('msg_del');
44
-if(sys_get_param('str_delete_selected') && is_array($message_delete = sys_get_param('selected')) && !empty($message_delete)) {
44
+if (sys_get_param('str_delete_selected') && is_array($message_delete = sys_get_param('selected')) && !empty($message_delete)) {
45 45
   $message_delete = implode(', ', $message_delete);
46 46
 }
47 47
 
48
-if($message_delete) {
48
+if ($message_delete) {
49 49
   db_message_list_delete_set($message_delete);
50 50
   $template->assign_block_vars('result', array('MESSAGE' => sprintf($lang['mlst_messages_deleted'], $message_delete)));
51 51
 }
52 52
 
53 53
 
54
-if(sys_get_param('str_delete_date') && checkdate($month = sys_get_param_id('delete_month'), $day = sys_get_param_id('delete_day'), $year = sys_get_param_id('delete_year'))) {
54
+if (sys_get_param('str_delete_date') && checkdate($month = sys_get_param_id('delete_month'), $day = sys_get_param_id('delete_day'), $year = sys_get_param_id('delete_year'))) {
55 55
   $delete_date = "{$year}-{$month}-{$day}";
56 56
   db_message_list_delete_by_date($delete_date, $int_type_selected);
57 57
   $template->assign_block_vars('result', array('MESSAGE' => sprintf($lang['mlst_messages_deleted_date'], $allowed_types[$int_type_selected]['TEXT'], $delete_date)));
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 
64 64
 $int_page_current = min(sys_get_param_id('int_page_current', 1), $page_max);
65 65
 
66
-if(sys_get_param('page_prev') && $int_page_current > 1) {
66
+if (sys_get_param('page_prev') && $int_page_current > 1) {
67 67
   $int_page_current--;
68
-} elseif(sys_get_param('page_next') && $int_page_current < $page_max) {
68
+} elseif (sys_get_param('page_next') && $int_page_current < $page_max) {
69 69
   $int_page_current++;
70 70
 }
71 71
 
72
-for($i = 1; $i <= $page_max; $i++) {
72
+for ($i = 1; $i <= $page_max; $i++) {
73 73
   $template->assign_block_vars('page', array('NUMBER' => $i));
74 74
 }
75 75
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 $StartRec = ($int_page_current - 1) * 25;
78 78
 
79 79
 $Messages = db_message_list_admin_by_type($int_type_selected, $StartRec);
80
-while($row = db_fetch($Messages)) {
80
+while ($row = db_fetch($Messages)) {
81 81
   $row['FROM'] = htmlentities($row['FROM'], ENT_COMPAT, 'UTF-8');
82 82
   $row['OWNER_NAME'] = htmlentities($row['OWNER_NAME'], ENT_COMPAT, 'UTF-8');
83 83
   $row['TEXT'] = nl2br($row['TEXT']);
Please login to merge, or discard this patch.
admin/adm_flying_fleets.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 require('../common.' . substr(strrchr(__FILE__, '.'), 1));
13 13
 
14 14
 // if ($user['authlevel'] < 2)
15
-if($user['authlevel'] < 3) {
15
+if ($user['authlevel'] < 3) {
16 16
   AdminMessage($lang['adm_err_denied']);
17 17
 }
18 18
 
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 //while($CurrentFleet = db_fetch($FlyingFleets))
23 23
 
24 24
 $all_flying_fleets = FleetList::dbGetFleetList();
25
-foreach($all_flying_fleets->_container as $fleet_id => $objFleet) {
25
+foreach ($all_flying_fleets->_container as $fleet_id => $objFleet) {
26 26
   $FleetOwner = db_user_by_id($objFleet->playerOwnerId);
27 27
   $TargetOwner = db_user_by_id($objFleet->target_owner_id);
28 28
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
   $fleet_data['fleet']['STAY_TIME_INT'] = $objFleet->time_mission_job_complete;
34 34
 
35 35
   $template->assign_block_vars('fleets', $fleet_data['fleet']);
36
-  foreach($fleet_data['ships'] as $ship_data) {
36
+  foreach ($fleet_data['ships'] as $ship_data) {
37 37
     $template->assign_block_vars('fleets.ships', $ship_data);
38 38
   }
39 39
 }
Please login to merge, or discard this patch.