Completed
Push — work-fleets ( 4d76fa...c97fe0 )
by SuperNova.WS
05:17
created
includes/classes/Fleet.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -397,31 +397,31 @@  discard block
 block discarded – undo
397 397
 
398 398
     return doquery(
399 399
     // Блокировка самого флота
400
-      "SELECT 1 FROM {{fleets}} AS f " .
400
+      "SELECT 1 FROM {{fleets}} AS f ".
401 401
 
402 402
       // Блокировка всех юнитов, принадлежащих этому флоту
403
-      "LEFT JOIN {{unit}} as unit ON unit.unit_location_type = " . static::$locationType . " AND unit.unit_location_id = f.fleet_id " .
403
+      "LEFT JOIN {{unit}} as unit ON unit.unit_location_type = ".static::$locationType." AND unit.unit_location_id = f.fleet_id ".
404 404
 
405 405
       // Блокировка всех прилетающих и улетающих флотов, если нужно
406 406
       // TODO - lock fleets by COORDINATES
407
-      ($mission_data['dst_fleets'] ? "LEFT JOIN {{fleets}} AS fd ON fd.fleet_end_planet_id = f.fleet_end_planet_id OR fd.fleet_start_planet_id = f.fleet_end_planet_id " : '') .
407
+      ($mission_data['dst_fleets'] ? "LEFT JOIN {{fleets}} AS fd ON fd.fleet_end_planet_id = f.fleet_end_planet_id OR fd.fleet_start_planet_id = f.fleet_end_planet_id " : '').
408 408
       // Блокировка всех юнитов, принадлежащих прилетающим и улетающим флотам - ufd = unit_fleet_destination
409
-      ($mission_data['dst_fleets'] ? "LEFT JOIN {{unit}} AS ufd ON ufd.unit_location_type = " . static::$locationType . " AND ufd.unit_location_id = fd.fleet_id " : '') .
409
+      ($mission_data['dst_fleets'] ? "LEFT JOIN {{unit}} AS ufd ON ufd.unit_location_type = ".static::$locationType." AND ufd.unit_location_id = fd.fleet_id " : '').
410 410
 
411
-      ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{users}} AS ud ON ud.id = f.fleet_target_owner " : '') .
411
+      ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{users}} AS ud ON ud.id = f.fleet_target_owner " : '').
412 412
       // Блокировка всех юнитов, принадлежащих владельцу планеты-цели
413
-      ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS unit_player_dest ON unit_player_dest.unit_player_id = ud.id " : '') .
413
+      ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS unit_player_dest ON unit_player_dest.unit_player_id = ud.id " : '').
414 414
       // Блокировка планеты-цели
415
-      ($mission_data['dst_planet'] ? "LEFT JOIN {{planets}} AS pd ON pd.id = f.fleet_end_planet_id " : '') .
415
+      ($mission_data['dst_planet'] ? "LEFT JOIN {{planets}} AS pd ON pd.id = f.fleet_end_planet_id " : '').
416 416
       // Блокировка всех юнитов, принадлежащих планете-цели - НЕ НУЖНО. Уже залочили ранее, как принадлежащие игроку-цели
417 417
 //      ($mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS upd ON upd.unit_location_type = " . LOC_PLANET . " AND upd.unit_location_id = pd.id " : '') .
418 418
 
419 419
 
420
-      ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{users}} AS us ON us.id = f.fleet_owner " : '') .
420
+      ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{users}} AS us ON us.id = f.fleet_owner " : '').
421 421
       // Блокировка всех юнитов, принадлежащих владельцу флота
422
-      ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS unit_player_src ON unit_player_src.unit_player_id = us.id " : '') .
422
+      ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS unit_player_src ON unit_player_src.unit_player_id = us.id " : '').
423 423
       // Блокировка планеты отправления
424
-      ($mission_data['src_planet'] ? "LEFT JOIN {{planets}} AS ps ON ps.id = f.fleet_start_planet_id " : '') .
424
+      ($mission_data['src_planet'] ? "LEFT JOIN {{planets}} AS ps ON ps.id = f.fleet_start_planet_id " : '').
425 425
       // Блокировка всех юнитов, принадлежащих планете с которой юниты были отправлены - НЕ НУЖНО. Уже залочили ранее, как принадлежащие владельцу флота
426 426
 //      ($mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS ups ON ups.unit_location_type = " . LOC_PLANET . " AND ups.unit_location_id = ps.id " : '') .
427 427
 
@@ -438,11 +438,11 @@  discard block
 block discarded – undo
438 438
   public function dbGetLockById($dbId) {
439 439
     doquery(
440 440
     // Блокировка самого флота
441
-      "SELECT 1 FROM {{fleets}} AS FLEET0 " .
441
+      "SELECT 1 FROM {{fleets}} AS FLEET0 ".
442 442
       // Lock fleet owner
443
-      "LEFT JOIN {{users}} as USER0 on USER0.id = FLEET0.fleet_owner " .
443
+      "LEFT JOIN {{users}} as USER0 on USER0.id = FLEET0.fleet_owner ".
444 444
       // Блокировка всех юнитов, принадлежащих этому флоту
445
-      "LEFT JOIN {{unit}} as UNIT0 ON UNIT0.unit_location_type = " . LOC_FLEET . " AND UNIT0.unit_location_id = FLEET0.fleet_id " .
445
+      "LEFT JOIN {{unit}} as UNIT0 ON UNIT0.unit_location_type = ".LOC_FLEET." AND UNIT0.unit_location_id = FLEET0.fleet_id ".
446 446
 
447 447
       // Без предварительной выборки неизвестно - куда летит этот флот.
448 448
       // Поэтому надо выбирать флоты, чьи координаты прибытия ИЛИ отбытия совпадают с координатами прибытия ИЛИ отбытия текущего флота.
@@ -458,9 +458,9 @@  discard block
 block discarded – undo
458 458
         FLEET1.fleet_end_planet = FLEET0.fleet_end_planet
459 459
       " .
460 460
       // Блокировка всех юнитов, принадлежащих этим флотам
461
-      "LEFT JOIN {{unit}} as UNIT1 ON UNIT1.unit_location_type = " . LOC_FLEET . " AND UNIT1.unit_location_id = FLEET1.fleet_id " .
461
+      "LEFT JOIN {{unit}} as UNIT1 ON UNIT1.unit_location_type = ".LOC_FLEET." AND UNIT1.unit_location_id = FLEET1.fleet_id ".
462 462
       // Lock fleet owner
463
-      "LEFT JOIN {{users}} as USER1 on USER1.id = FLEET1.fleet_owner " .
463
+      "LEFT JOIN {{users}} as USER1 on USER1.id = FLEET1.fleet_owner ".
464 464
 
465 465
       "LEFT JOIN {{fleets}} AS FLEET2 ON
466 466
         FLEET2.fleet_mess = 1   AND FLEET0.fleet_mess = 0 AND
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
       " .
471 471
       // Блокировка всех юнитов, принадлежащих этим флотам
472 472
       "LEFT JOIN {{unit}} as UNIT2 ON
473
-        UNIT2.unit_location_type = " . LOC_FLEET . " AND
473
+        UNIT2.unit_location_type = " . LOC_FLEET." AND
474 474
         UNIT2.unit_location_id = FLEET2.fleet_id
475 475
       " .
476 476
       // Lock fleet owner
@@ -487,11 +487,11 @@  discard block
 block discarded – undo
487 487
       " .
488 488
       // Блокировка всех юнитов, принадлежащих этим флотам
489 489
       "LEFT JOIN {{unit}} as UNIT3 ON
490
-        UNIT3.unit_location_type = " . LOC_FLEET . " AND
490
+        UNIT3.unit_location_type = " . LOC_FLEET." AND
491 491
         UNIT3.unit_location_id = FLEET3.fleet_id
492 492
       " .
493 493
       // Lock fleet owner
494
-      "LEFT JOIN {{users}} as USER3 on USER3.id = FLEET3.fleet_owner " .
494
+      "LEFT JOIN {{users}} as USER3 on USER3.id = FLEET3.fleet_owner ".
495 495
 
496 496
       "LEFT JOIN {{fleets}} AS FLEET4 ON
497 497
         FLEET4.fleet_mess = 1   AND FLEET0.fleet_mess = 1 AND
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
       " .
502 502
       // Блокировка всех юнитов, принадлежащих этим флотам
503 503
       "LEFT JOIN {{unit}} as UNIT4 ON
504
-        UNIT4.unit_location_type = " . LOC_FLEET . " AND
504
+        UNIT4.unit_location_type = " . LOC_FLEET." AND
505 505
         UNIT4.unit_location_id = FLEET4.fleet_id
506 506
       " .
507 507
       // Lock fleet owner
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
       " .
524 524
       // Блокировка всех юнитов, принадлежащих этой планете
525 525
       "LEFT JOIN {{unit}} as UNIT5 ON
526
-        UNIT5.unit_location_type = " . LOC_PLANET . " AND
526
+        UNIT5.unit_location_type = " . LOC_PLANET." AND
527 527
         UNIT5.unit_location_id = PLANETS5.id
528 528
       " .
529 529
 
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
       " .
542 542
       // Блокировка всех юнитов, принадлежащих этой планете
543 543
       "LEFT JOIN {{unit}} as UNIT6 ON
544
-        UNIT6.unit_location_type = " . LOC_PLANET . " AND
544
+        UNIT6.unit_location_type = " . LOC_PLANET." AND
545 545
         UNIT6.unit_location_id = PLANETS6.id
546 546
       " .
547 547
       "WHERE FLEET0.fleet_id = {$dbId} GROUP BY 1 FOR UPDATE"
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
       } elseif ($this->isResource($unit_id)) {
661 661
         $this->resource_list[$unit_id] = $unit_count;
662 662
       } else {
663
-        throw new Exception('Trying to pass to fleet non-resource and non-ship ' . var_export($unit_array, true), ERR_ERROR);
663
+        throw new Exception('Trying to pass to fleet non-resource and non-ship '.var_export($unit_array, true), ERR_ERROR);
664 664
       }
665 665
     }
666 666
   }
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
    */
986 986
   public function resourcesSet($resource_list) {
987 987
     if (!empty($this->propertiesAdjusted['resource_list'])) {
988
-      throw new PropertyAccessException('Property "resource_list" already was adjusted so no SET is possible until dbSave in ' . get_called_class() . '::unitSetResourceList', ERR_ERROR);
988
+      throw new PropertyAccessException('Property "resource_list" already was adjusted so no SET is possible until dbSave in '.get_called_class().'::unitSetResourceList', ERR_ERROR);
989 989
     }
990 990
     $this->resourcesAdjust($resource_list, true);
991 991
   }
@@ -1019,7 +1019,7 @@  discard block
 block discarded – undo
1019 1019
       // Check for negative unit value
1020 1020
       if ($this->resource_list[$resource_id] < 0) {
1021 1021
         // TODO
1022
-        throw new Exception('Resource ' . $resource_id . ' will become negative in ' . get_called_class() . '::unitAdjustResourceList', ERR_ERROR);
1022
+        throw new Exception('Resource '.$resource_id.' will become negative in '.get_called_class().'::unitAdjustResourceList', ERR_ERROR);
1023 1023
       }
1024 1024
     }
1025 1025
   }
@@ -1190,7 +1190,7 @@  discard block
 block discarded – undo
1190 1190
 
1191 1191
   protected function printErrorIfNoShips() {
1192 1192
     if ($this->unitList->unitsCount() <= 0) {
1193
-      message(classLocale::$lang['fl_err_no_ships'], classLocale::$lang['fl_error'], 'fleet' . DOT_PHP_EX, 5);
1193
+      message(classLocale::$lang['fl_err_no_ships'], classLocale::$lang['fl_error'], 'fleet'.DOT_PHP_EX, 5);
1194 1194
     }
1195 1195
   }
1196 1196
 
@@ -1637,7 +1637,7 @@  discard block
 block discarded – undo
1637 1637
 
1638 1638
     if ($errorlist) {
1639 1639
       sn_db_transaction_rollback();
1640
-      message("<span class='error'><ul>{$errorlist}</ul></span>", classLocale::$lang['fl_error'], 'fleet' . DOT_PHP_EX, false);
1640
+      message("<span class='error'><ul>{$errorlist}</ul></span>", classLocale::$lang['fl_error'], 'fleet'.DOT_PHP_EX, false);
1641 1641
     }
1642 1642
 
1643 1643
     //Normally... unless its acs...
@@ -1669,7 +1669,7 @@  discard block
 block discarded – undo
1669 1669
     if ($this->_mission_type == MT_ACS && $aks) {
1670 1670
       $acsTimeToArrive = $aks['ankunft'] - SN_TIME_NOW;
1671 1671
       if ($acsTimeToArrive < $this->travelData['duration']) {
1672
-        message(classLocale::$lang['fl_aks_too_slow'] . 'Fleet arrival: ' . date(FMT_DATE_TIME, SN_TIME_NOW + $this->travelData['duration']) . " AKS arrival: " . date(FMT_DATE_TIME, $aks['ankunft']), classLocale::$lang['fl_error']);
1672
+        message(classLocale::$lang['fl_aks_too_slow'].'Fleet arrival: '.date(FMT_DATE_TIME, SN_TIME_NOW + $this->travelData['duration'])." AKS arrival: ".date(FMT_DATE_TIME, $aks['ankunft']), classLocale::$lang['fl_error']);
1673 1673
       }
1674 1674
       // Set time to travel to ACS' TTT
1675 1675
       $this->travelData['duration'] = $acsTimeToArrive;
@@ -1711,14 +1711,14 @@  discard block
 block discarded – undo
1711 1711
 
1712 1712
 
1713 1713
     if (!empty($captain['unit_id'])) {
1714
-      db_unit_set_by_id($captain['unit_id'], "`unit_location_type` = " . LOC_FLEET . ", `unit_location_id` = {$this->_dbId}");
1714
+      db_unit_set_by_id($captain['unit_id'], "`unit_location_type` = ".LOC_FLEET.", `unit_location_id` = {$this->_dbId}");
1715 1715
     }
1716 1716
 
1717 1717
 
1718 1718
     $template_result['.']['fleets'][] = $this->renderFleet(SN_TIME_NOW, $timeMissionJob);
1719 1719
 
1720 1720
     $template_result += array(
1721
-      'mission'         => classLocale::$lang['type_mission'][$this->_mission_type] . ($this->_mission_type == MT_EXPLORE || $this->_mission_type == MT_HOLD ? ' ' . pretty_time($timeMissionJob) : ''),
1721
+      'mission'         => classLocale::$lang['type_mission'][$this->_mission_type].($this->_mission_type == MT_EXPLORE || $this->_mission_type == MT_HOLD ? ' '.pretty_time($timeMissionJob) : ''),
1722 1722
       'dist'            => pretty_number($this->travelData['distance']),
1723 1723
       'speed'           => pretty_number($this->travelData['fleet_speed']),
1724 1724
       'deute_need'      => pretty_number($this->travelData['consumption']),
Please login to merge, or discard this patch.
includes/template.php 1 patch
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -10,8 +10,8 @@  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])) {
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;
13
+  if (!isset($template_names[$u_dpath])) {
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
 
17 17
   return $template_names[$u_dpath];
@@ -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;
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
159 159
     'USER_AUTHLEVEL_NAME' => classLocale::$lang['user_level'][$user['authlevel']],
160 160
 //    'USER_IMPERSONATOR'   => $template_result[F_IMPERSONATE_STATUS] != LOGIN_UNDEFINED,
161 161
     'PAYMENT'             => sn_module_get_active_count('payment'),
162
-    'MENU_START_HIDE'     => !empty($_COOKIE[SN_COOKIE . '_menu_hidden']) || defined('SN_GOOGLE'),
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],
@@ -171,12 +171,12 @@  discard block
 block discarded – undo
171 171
       'PLAYER_OPTION_MENU_ITEMS_AS_BUTTONS' => classSupernova::$user_options[PLAYER_OPTION_MENU_ITEMS_AS_BUTTONS],
172 172
       'PLAYER_OPTION_MENU_WHITE_TEXT'       => classSupernova::$user_options[PLAYER_OPTION_MENU_WHITE_TEXT],
173 173
       'PLAYER_OPTION_MENU_OLD'              => classSupernova::$user_options[PLAYER_OPTION_MENU_OLD],
174
-      'PLAYER_OPTION_MENU_HIDE_SHOW_BUTTON' => empty($_COOKIE[SN_COOKIE . '_menu_hidden']) && !defined('SN_GOOGLE')
174
+      'PLAYER_OPTION_MENU_HIDE_SHOW_BUTTON' => empty($_COOKIE[SN_COOKIE.'_menu_hidden']) && !defined('SN_GOOGLE')
175 175
         ? classSupernova::$user_options[PLAYER_OPTION_MENU_HIDE_SHOW_BUTTON] : 1,
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,12 +236,12 @@  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
-    $font_size = min(max(floatval($font_size), FONT_SIZE_PERCENT_MIN), FONT_SIZE_PERCENT_MAX) . '%';
242
-  } elseif(strpos($font_size, 'px') !== false) {
241
+    $font_size = min(max(floatval($font_size), FONT_SIZE_PERCENT_MIN), FONT_SIZE_PERCENT_MAX).'%';
242
+  } elseif (strpos($font_size, 'px') !== false) {
243 243
     // Размер шрифта в пикселях
244
-    $font_size = min(max(floatval($font_size), FONT_SIZE_PIXELS_MIN), FONT_SIZE_PIXELS_MAX) . 'px';
244
+    $font_size = min(max(floatval($font_size), FONT_SIZE_PIXELS_MIN), FONT_SIZE_PIXELS_MAX).'px';
245 245
   } else {
246 246
     // Не мышонка, не лягушка...
247 247
     $font_size = FONT_SIZE_PERCENT_DEFAULT_STRING;
@@ -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,
@@ -272,17 +272,17 @@  discard block
 block discarded – undo
272 272
   $is_login ? $standard_css['design/css/login.min.css'] = '' : false;
273 273
   $standard_css += array(
274 274
 //    'design/css/design/css/global-ie.min.css' => '', // TODO
275
-    TEMPLATE_PATH . '/_template.min.css'                                  => '',
276
-    ($user['dpath'] ? $user['dpath'] : DEFAULT_SKINPATH) . 'skin.min.css' => '',
275
+    TEMPLATE_PATH.'/_template.min.css'                                  => '',
276
+    ($user['dpath'] ? $user['dpath'] : DEFAULT_SKINPATH).'skin.min.css' => '',
277 277
   );
278 278
 
279 279
   // Prepending standard CSS files
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,
@@ -309,7 +309,7 @@  discard block
 block discarded – undo
309 309
     ), // Проводить замер только если не выставлен флаг форсированного замера И (иссяк интервал замера ИЛИ замера еще не было)
310 310
     //'TIME_UTC_OFFSET'          => defined('SN_CLIENT_TIME_UTC_OFFSET') ? SN_CLIENT_TIME_UTC_OFFSET : '',
311 311
 
312
-    'title'                    => ($title ? "{$title} - " : '') . classLocale::$lang['sys_server'] . " {$classConfig->game_name} - " . classLocale::$lang['sys_supernova'],
312
+    'title'                    => ($title ? "{$title} - " : '').classLocale::$lang['sys_server']." {$classConfig->game_name} - ".classLocale::$lang['sys_supernova'],
313 313
     '-meta-'                   => $metatags,
314 314
     'ADV_SEO_META_DESCRIPTION' => classSupernova::$config->adv_seo_meta_description,
315 315
     'ADV_SEO_META_KEYWORDS'    => classSupernova::$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 && classSupernova::$config->debug ? classSupernova::$debug->echo_log() : false;;
369
+  $user['authlevel'] >= 3 && classSupernova::$config->debug ? classSupernova::$debug->echo_log() : false; ;
370 370
 
371 371
   classSupernova::$db->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,12 +433,12 @@  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),
440 440
       'TEXT' => $fleet_flying_count,
441
-      'HINT' => date(FMT_DATE_TIME, $fleet_time + SN_CLIENT_TIME_DIFF) . " - {$classLocale['sys_fleet']} {$fleet_event['TEXT']} {$fleet_event['COORDINATES']} {$classLocale['sys_planet_type_sh'][$fleet_event['COORDINATES_TYPE']]} {$classLocale['type_mission'][$fleet_event['OBJECT']->mission_type]}",
441
+      'HINT' => date(FMT_DATE_TIME, $fleet_time + SN_CLIENT_TIME_DIFF)." - {$classLocale['sys_fleet']} {$fleet_event['TEXT']} {$fleet_event['COORDINATES']} {$classLocale['sys_planet_type_sh'][$fleet_event['COORDINATES_TYPE']]} {$classLocale['type_mission'][$fleet_event['OBJECT']->mission_type]}",
442 442
     ));
443 443
     $fleet_event['DECREASE'] ? $fleet_flying_count-- : false;
444 444
   }
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
   global $template_result;
463 463
   $classLocale = classLocale::$lang;
464 464
 
465
-  if(!is_array($user)) {
465
+  if (!is_array($user)) {
466 466
     return '';
467 467
   }
468 468
 
@@ -483,8 +483,8 @@  discard block
 block discarded – undo
483 483
 
484 484
   $ThisUsersPlanets = db_planet_list_sorted($user);
485 485
   // while ($CurPlanet = db_fetch($ThisUsersPlanets))
486
-  foreach($ThisUsersPlanets as $CurPlanet) {
487
-    if($CurPlanet['destruyed']) {
486
+  foreach ($ThisUsersPlanets as $CurPlanet) {
487
+    if ($CurPlanet['destruyed']) {
488 488
       continue;
489 489
     }
490 490
 
@@ -508,8 +508,8 @@  discard block
 block discarded – undo
508 508
    */
509 509
   $fleet_flying_list = array();
510 510
   $fleet_flying_list[0] = FleetList::dbGetFleetListByOwnerId($user['id']);
511
-  foreach($fleet_flying_list[0]->_container as $fleet_id => $objFleet) {
512
-    if(empty($fleet_flying_list[$objFleet->mission_type])) {
511
+  foreach ($fleet_flying_list[0]->_container as $fleet_id => $objFleet) {
512
+    if (empty($fleet_flying_list[$objFleet->mission_type])) {
513 513
       $fleet_flying_list[$objFleet->mission_type] = new FleetList();
514 514
     }
515 515
     $fleet_flying_list[$objFleet->mission_type][$fleet_id] = $objFleet;
@@ -521,8 +521,8 @@  discard block
 block discarded – undo
521 521
   que_tpl_parse($template, QUE_RESEARCH, $user, array(), null, !classSupernova::$user_options[PLAYER_OPTION_NAVBAR_RESEARCH_WIDE]);
522 522
   que_tpl_parse($template, SUBQUE_FLEET, $user, $planetrow, null, true);
523 523
 
524
-  if(!empty(classSupernova::$sn_mvc['navbar_prefix_button']) && is_array(classSupernova::$sn_mvc['navbar_prefix_button'])) {
525
-    foreach(classSupernova::$sn_mvc['navbar_prefix_button'] as $navbar_button_image => $navbar_button_url) {
524
+  if (!empty(classSupernova::$sn_mvc['navbar_prefix_button']) && is_array(classSupernova::$sn_mvc['navbar_prefix_button'])) {
525
+    foreach (classSupernova::$sn_mvc['navbar_prefix_button'] as $navbar_button_image => $navbar_button_url) {
526 526
       $template->assign_block_vars('navbar_prefix_button', array(
527 527
         'IMAGE'        => $navbar_button_image,
528 528
         'URL_RELATIVE' => $navbar_button_url,
@@ -536,13 +536,13 @@  discard block
 block discarded – undo
536 536
   $time_now_parsed = getdate(SN_TIME_NOW);
537 537
   $time_local_parsed = getdate(defined('SN_CLIENT_TIME_LOCAL') ? SN_CLIENT_TIME_LOCAL : SN_TIME_NOW);
538 538
 
539
-  if(classSupernova::$config->game_news_overview) {
539
+  if (classSupernova::$config->game_news_overview) {
540 540
     $user_last_read_safe = intval($user['news_lastread']);
541 541
     nws_render($template, "WHERE UNIX_TIMESTAMP(`tsTimeStamp`) >= {$user_last_read_safe}", classSupernova::$config->game_news_overview);
542 542
   }
543 543
 
544 544
   $notes_query = db_note_list_by_owner($user['id'], true);
545
-  while($note_row = db_fetch($notes_query)) {
545
+  while ($note_row = db_fetch($notes_query)) {
546 546
     note_assign($template, $note_row);
547 547
   }
548 548
 
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
     'QUE_ID'   => QUE_RESEARCH,
557 557
     'QUE_HTML' => 'topnav',
558 558
 
559
-    'RESEARCH_ONGOING' => (boolean)$user['que'],
559
+    'RESEARCH_ONGOING' => (boolean) $user['que'],
560 560
 
561 561
     'TIME_TEXT'       => sprintf($str_date_format, $time_now_parsed['year'], classLocale::$lang['months'][$time_now_parsed['mon']], $time_now_parsed['mday'],
562 562
       $time_now_parsed['hours'], $time_now_parsed['minutes'], $time_now_parsed['seconds']
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
     'QUE_STRUCTURES' => QUE_STRUCTURES,
634 634
   ));
635 635
 
636
-  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)) {
636
+  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)) {
637 637
     tpl_set_resource_info($template, $planetrow);
638 638
     $template->assign_vars(array(
639 639
       'SN_RENDER_NAVBAR_PLANET' => true,
@@ -648,12 +648,12 @@  discard block
 block discarded – undo
648 648
  * @param template|string $template
649 649
  */
650 650
 function displayP($template) {
651
-  if(is_object($template)) {
652
-    if(empty($template->parsed)) {
651
+  if (is_object($template)) {
652
+    if (empty($template->parsed)) {
653 653
       parsetemplate($template);
654 654
     }
655 655
 
656
-    foreach($template->files as $section => $filename) {
656
+    foreach ($template->files as $section => $filename) {
657 657
       $template->display($section);
658 658
     }
659 659
   } else {
@@ -668,11 +668,11 @@  discard block
 block discarded – undo
668 668
  * @return mixed
669 669
  */
670 670
 function parsetemplate($template, $array = false) {
671
-  if(is_object($template)) {
671
+  if (is_object($template)) {
672 672
     global $user;
673 673
 
674
-    if(!empty($array) && is_array($array)) {
675
-      foreach($array as $key => $data) {
674
+    if (!empty($array) && is_array($array)) {
675
+      foreach ($array as $key => $data) {
676 676
         $template->assign_var($key, $data);
677 677
       }
678 678
     }
@@ -713,8 +713,8 @@  discard block
 block discarded – undo
713 713
 
714 714
   $template_ex = '.tpl.html';
715 715
 
716
-  if($template === false) {
717
-    return sys_file_read(TEMPLATE_DIR . '/' . $files . $template_ex);
716
+  if ($template === false) {
717
+    return sys_file_read(TEMPLATE_DIR.'/'.$files.$template_ex);
718 718
   }
719 719
 
720 720
   is_string($files) ? $files = array(basename($files) => $files) : false;
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
   //$template->set_custom_template($template_path ? $template_path : TEMPLATE_DIR, TEMPLATE_NAME, TEMPLATE_DIR);
724 724
 
725 725
   $tmpl_name = gettemplatename($user['dpath']);
726
-  $template->set_custom_template(($template_path ? $template_path : SN_ROOT_PHYSICAL . 'design/templates/') . $tmpl_name . '/', $tmpl_name, TEMPLATE_DIR);
726
+  $template->set_custom_template(($template_path ? $template_path : SN_ROOT_PHYSICAL.'design/templates/').$tmpl_name.'/', $tmpl_name, TEMPLATE_DIR);
727 727
 
728 728
   // TODO ГРЯЗНЫЙ ХАК! Это нужно, что бы по возможности перезаписать инфу из языковых пакетов модулей там, где она была перезаписана раньше инфой из основного пакета. Почему?
729 729
   //  - сначала грузятся модули и их языковые пакеты
@@ -733,8 +733,8 @@  discard block
 block discarded – undo
733 733
   !empty(classSupernova::$sn_mvc['i18n']['']) ? lng_load_i18n(classSupernova::$sn_mvc['i18n']['']) : false;
734 734
   $sn_page_name ? lng_load_i18n(classSupernova::$sn_mvc['i18n'][$sn_page_name]) : false;
735 735
 
736
-  foreach($files as &$filename) {
737
-    $filename = $filename . $template_ex;
736
+  foreach ($files as &$filename) {
737
+    $filename = $filename.$template_ex;
738 738
   }
739 739
 
740 740
   $template->set_filenames($files);
@@ -756,15 +756,15 @@  discard block
 block discarded – undo
756 756
 
757 757
   $template->assign_vars($q = array(
758 758
     'LANG'     => $language ? $language : '',
759
-    'referral' => $id_ref ? '&id_ref=' . $id_ref : '',
759
+    'referral' => $id_ref ? '&id_ref='.$id_ref : '',
760 760
 
761
-    'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '',// "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''),
761
+    'REQUEST_PARAMS' => !empty($url_params) ? '?'.implode('&', $url_params) : '', // "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''),
762 762
     'FILENAME'       => basename($_SERVER['PHP_SELF']),
763 763
   ));
764 764
 
765
-  foreach(lng_get_list() as $lng_id => $lng_data) {
766
-    if(isset($lng_data['LANG_VARIANTS']) && is_array($lng_data['LANG_VARIANTS'])) {
767
-      foreach($lng_data['LANG_VARIANTS'] as $lang_variant) {
765
+  foreach (lng_get_list() as $lng_id => $lng_data) {
766
+    if (isset($lng_data['LANG_VARIANTS']) && is_array($lng_data['LANG_VARIANTS'])) {
767
+      foreach ($lng_data['LANG_VARIANTS'] as $lang_variant) {
768 768
         $lng_data1 = $lng_data;
769 769
         $lng_data1 = array_merge($lng_data1, $lang_variant);
770 770
         $template->assign_block_vars('language', $lng_data1);
@@ -787,8 +787,8 @@  discard block
 block discarded – undo
787 787
   $que = $que['ques'][$que_type][$planet['id_owner']][$planet['id']];
788 788
 
789 789
   $que_length = 0;
790
-  if(!empty($que)) {
791
-    foreach($que as $que_item) {
790
+  if (!empty($que)) {
791
+    foreach ($que as $que_item) {
792 792
       $template->assign_block_vars('que', que_tpl_parse_element($que_item));
793 793
     }
794 794
     $que_length = count($que);
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
  * @param int      $user_dark_matter
804 804
  */
805 805
 function tpl_planet_density_info(&$template, &$density_price_chart, $user_dark_matter) {
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_info.inc 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,37 +1,37 @@  discard block
 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
   classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
5 5
 }
6 6
 
7 7
 $template = gettemplate('ali_info', true);
8 8
 
9
-if($mode == 'exit') {
10
-  if($ally['ally_owner'] == $user['id']) {
9
+if ($mode == 'exit') {
10
+  if ($ally['ally_owner'] == $user['id']) {
11 11
     message(classLocale::$lang['Owner_cant_go_out'], classLocale::$lang['Alliance']);
12 12
   }
13 13
 
14
-  if(sys_get_param_int('ali_info_leave_confirm')) {
14
+  if (sys_get_param_int('ali_info_leave_confirm')) {
15 15
     sn_db_transaction_start();
16 16
     db_user_set_by_id($user['id'], "`ally_id` = null, `ally_name` = null, `ally_tag` = null, `ally_register_time` = 0, `ally_rank_id` = 0");
17 17
     db_ally_list_recalc_counts();
18 18
     sn_db_transaction_commit();
19 19
     message(sprintf(classLocale::$lang['ali_info_leave_success'], $ally['ally_name']), classLocale::$lang['sys_alliance']);
20 20
   }
21
-} elseif($mode == 'ainfo') {
21
+} elseif ($mode == 'ainfo') {
22 22
   $tag = sys_get_param_str('tag');
23 23
   $id_ally = sys_get_param_id('a');
24
-  if($tag) {
24
+  if ($tag) {
25 25
     $ally = db_ally_get_by_tag($tag);
26
-  } elseif($id_ally) {
26
+  } elseif ($id_ally) {
27 27
     $ally = db_ally_get_by_id($id_ally);
28 28
   }
29 29
 
30
-  if(!$ally) {
30
+  if (!$ally) {
31 31
     message(classLocale::$lang['ali_sys_notFound'], classLocale::$lang['Ally_info_1']);
32 32
   }
33 33
 
34
-  if(!$ally['ally_description']) {
34
+  if (!$ally['ally_description']) {
35 35
     $ally['ally_description'] = classLocale::$lang['Ally_nodescription'];
36 36
   }
37 37
 
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 } else {
44 44
   $page_header = classLocale::$lang['your_alliance'];
45 45
 
46
-  if($ally['ally_owner'] == $user['id']) {
46
+  if ($ally['ally_owner'] == $user['id']) {
47 47
     $range = $ally['ally_owner_range'] ? $ally['ally_owner_range'] : classLocale::$lang['Founder'];
48
-  } elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) {
48
+  } elseif ($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) {
49 49
     $range = $ranks[$user['ally_rank_id']]['name'];
50 50
   } else {
51 51
     $range = classLocale::$lang['member'];
@@ -86,8 +86,8 @@  discard block
 block discarded – undo
86 86
 ));
87 87
 
88 88
 $relations = ali_relations($ally['id']);
89
-foreach($relations as $relation) {
90
-  if($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id']) {
89
+foreach ($relations as $relation) {
90
+  if ($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id']) {
91 91
     $template->assign_block_vars('relation', array(
92 92
       'NAME'     => $relation['alliance_diplomacy_contr_ally_name'],
93 93
       'RELATION' => classLocale::$lang['ali_dip_relations'][$relation['alliance_diplomacy_relation']],
@@ -106,4 +106,4 @@  discard block
 block discarded – undo
106 106
 
107 107
 ali_render();
108 108
 
109
-display($template, classLocale::$lang['your_alliance'] . ' [' . $ally['ally_name'] . ']');
109
+display($template, classLocale::$lang['your_alliance'].' ['.$ally['ally_name'].']');
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin_mail.inc 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@
 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
   classSupernova::$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) {
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", '');
12
+if ($POST_text) {
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
-$r_list = "<option value=\"-1\">" . classLocale::$lang['All_players'] . "</option>";
17
-if($ranks) {
18
-  foreach($ranks as $id => $array) {
19
-    $r_list .= "<option value=\"" . $id . "\">" . $array['name'] . "</option>";
16
+$r_list = "<option value=\"-1\">".classLocale::$lang['All_players']."</option>";
17
+if ($ranks) {
18
+  foreach ($ranks as $id => $array) {
19
+    $r_list .= "<option value=\"".$id."\">".$array['name']."</option>";
20 20
   }
21 21
 }
22 22
 
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin.inc 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 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
   classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
5 5
 }
6 6
 
7
-if(!$user_admin) {
7
+if (!$user_admin) {
8 8
   message(classLocale::$lang['Denied_access'], classLocale::$lang['ally_admin']);
9 9
 }
10 10
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 $allyTextID = ($allyTextID < 1 || $allyTextID > 3) ? 1 : $allyTextID;
21 21
 
22 22
 
23
-if(sys_get_param_str('isSaveOptions')) {
23
+if (sys_get_param_str('isSaveOptions')) {
24 24
   require_once('includes/includes/sys_avatar.php');
25 25
 
26 26
   $new_image = $ally['ally_image'];
@@ -32,46 +32,46 @@  discard block
 block discarded – undo
32 32
 //  $template->assign_block_vars('result', $avatar_upload_result);
33 33
 
34 34
   $ally_changeset = array();
35
-  if(($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) && $new_tag != $ally['ally_tag']) {
35
+  if (($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) && $new_tag != $ally['ally_tag']) {
36 36
     $new_tag = db_escape($new_tag);
37 37
     $ally_changeset[] = "`ally_tag`='{$new_tag}'";
38 38
     db_user_set_by_id($ally['ally_user_id'], "`username`='[{$new_tag}]'");
39 39
   }
40
-  if(($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) && $new_name != $ally['ally_name']) {
40
+  if (($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) && $new_name != $ally['ally_name']) {
41 41
     $new_name = db_escape($new_name);
42 42
     $ally_changeset[] = "`ally_name`='{$new_name}'";
43 43
   }
44 44
 
45
-  if(($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) && $new_owner_rank != $ally['ally_owner_range']) {
45
+  if (($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) && $new_owner_rank != $ally['ally_owner_range']) {
46 46
     $new_owner_rank = db_escape($new_owner_rank);
47 47
     $ally_changeset[] = "`ally_owner_range` = '{$new_owner_rank}'";
48 48
   }
49
-  if(($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) && $new_web != $ally['ally_web']) {
49
+  if (($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) && $new_web != $ally['ally_web']) {
50 50
     $new_web = db_escape($new_web);
51 51
     $ally_changeset[] = "`ally_web` = '{$new_web}'";
52 52
   }
53 53
   $new_request = sys_get_param_int('request_notallow', $ally['ally_request_notallow']);
54 54
   $ally_changeset[] = "`ally_request_notallow` = '{$new_request}'";
55
-  if($new_image != $ally['ally_image']) {
55
+  if ($new_image != $ally['ally_image']) {
56 56
     $new_image = intval($new_image);
57 57
     $ally_changeset[] = "`ally_image` = '{$new_image}'";
58 58
   }
59 59
 
60
-  if(!empty($ally_changeset)) {
60
+  if (!empty($ally_changeset)) {
61 61
     db_ally_update_by_changeset($ally_changeset, $ally);
62 62
     sys_redirect('alliance.php?mode=admin&edit=ally');
63 63
   }
64
-} elseif(sys_get_param_str('isSaveText')) {
64
+} elseif (sys_get_param_str('isSaveText')) {
65 65
   $text = sys_get_param_str_both('text');
66 66
   db_ally_update_texts($text_list, $allyTextID, $text, $ally);
67 67
   $ally[$text_list[$allyTextID]['db_field']] = $text['unsafe'];
68
-} elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) {
69
-  if(!$isAllyOwner) {
68
+} elseif (sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) {
69
+  if (!$isAllyOwner) {
70 70
     message(classLocale::$lang['Denied_access'], classLocale::$lang['ally_admin']);
71 71
   }
72 72
 
73 73
   $newLeader = db_user_by_id($idNewLeader, false, `ally_id`);
74
-  if($newLeader['ally_id'] == $user['ally_id']) {
74
+  if ($newLeader['ally_id'] == $user['ally_id']) {
75 75
     sn_db_transaction_start();
76 76
     db_user_set_by_id($user['id'], "`ally_rank_id`='0'");
77 77
     db_ally_update_owner($idNewLeader, $user);
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
     sn_db_transaction_commit();
80 80
     sys_redirect('alliance.php');
81 81
   }
82
-} elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) {
83
-  if(!$isAllyOwner) {
82
+} elseif (sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) {
83
+  if (!$isAllyOwner) {
84 84
     message(classLocale::$lang['Denied_access'], classLocale::$lang['ally_admin']);
85 85
   }
86 86
   sn_db_transaction_start();
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 $request = db_ally_request_count_by_id($ally);
94 94
 
95 95
 $template->assign_vars(array(
96
-  'request_count'           => $request['request_count'] ? classLocale::$lang['ali_req_requestCount'] . ': ' . intval($request['request_count']) . '. ' . classLocale::$lang['ali_req_check'] : classLocale::$lang['ali_req_emptyList'],
96
+  'request_count'           => $request['request_count'] ? classLocale::$lang['ali_req_requestCount'].': '.intval($request['request_count']).'. '.classLocale::$lang['ali_req_check'] : classLocale::$lang['ali_req_emptyList'],
97 97
   'text'                    => $ally[$text_list[$allyTextID]['db_field']],
98 98
   'request_type'            => classLocale::$lang[$text_list[$allyTextID]['text_type']],
99 99
   't'                       => $allyTextID,
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
   $userAllyAdmins = db_user_list("`ally_id`= {$ally['id']}", false, '`id`, `username`');
127 127
   unset($tmp);
128 128
   // while ($userAllyAdmin = db_fetch($userAllyAdmins))
129
-  foreach($userAllyAdmins as $userAllyAdmin) {
129
+  foreach ($userAllyAdmins as $userAllyAdmin) {
130 130
 // pdump($userAllyAdmin);
131 131
     $tmp .= "<option value={$userAllyAdmin['id']}>{$userAllyAdmin['username']}</option>";
132 132
   }
@@ -134,8 +134,8 @@  discard block
 block discarded – undo
134 134
   $template->assign_var('adminMembers', $tmp);
135 135
 }
136 136
 
137
-foreach($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) {
138
-  if(!$sn_ali_admin_action_locale['title']) {
137
+foreach ($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) {
138
+  if (!$sn_ali_admin_action_locale['title']) {
139 139
     continue;
140 140
   }
141 141
   $template->assign_block_vars('admin_actions', array(
Please login to merge, or discard this patch.
includes/alliance/ali_internal_members.inc 1 patch
Spacing   +30 added lines, -30 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
   classSupernova::$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(
@@ -49,28 +49,28 @@  discard block
 block discarded – undo
49 49
 
50 50
 $template = gettemplate('ali_members', true);
51 51
 
52
-$userList = db_user_list("`ally_id`= {$user['ally_id']} ORDER BY " . sprintf($sort1s[$sort1], $sort2s), false,
52
+$userList = db_user_list("`ally_id`= {$user['ally_id']} ORDER BY ".sprintf($sort1s[$sort1], $sort2s), false,
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) {
66
-      $ally_range = '<select onchange="window.location=\'alliance.php?mode=admin&edit=members&id_user=' . $userRow['id'] . '&id_rank=\' + this.value">';
65
+    if ($user_admin) {
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) {
69
-        $ally_range .= '<option value="' . $rankID . '"';
70
-        if($rankID == $userRow['ally_rank_id']) {
68
+      foreach ($ranks as $rankID => $rankArray) {
69
+        $ally_range .= '<option value="'.$rankID.'"';
70
+        if ($rankID == $userRow['ally_rank_id']) {
71 71
           $ally_range .= " selected";
72 72
         }
73
-        $ally_range .= '>' . $rankArray['name'];
73
+        $ally_range .= '>'.$rankArray['name'];
74 74
         $ally_range .= '</option>';
75 75
       }
76 76
       $ally_range .= '</select>';
@@ -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']}";
@@ -124,21 +124,21 @@  discard block
 block discarded – undo
124 124
     'SYSTEM'        => $userRow['system'],
125 125
     'PLANET'        => $userRow['planet'],
126 126
     'POINTS'        => pretty_number($userRow['total_points']),
127
-    'ONLINE'        => '<font color=' . $tmp . '</font>',
127
+    'ONLINE'        => '<font color='.$tmp.'</font>',
128 128
     'RANK'          => $ally_range,
129 129
     'REGISTER_TIME' => date(FMT_DATE_TIME, $userRow['ally_register_time']),
130 130
     'SHOW_KICK'     => $user['id'] != $userRow['id'] && $ally['ally_owner'] != $userRow['id'],
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
 
138 138
 $template->assign_vars(array(
139
-  'mode'          => $mode . ($edit ? "&edit=" . $edit : ''),
139
+  'mode'          => $mode.($edit ? "&edit=".$edit : ''),
140 140
   'ADMIN_MODE'    => $user_can_kick,
141
-  'dpath'         => SN_ROOT_VIRTUAL . $dpath,
141
+  'dpath'         => SN_ROOT_VIRTUAL.$dpath,
142 142
   'onlineMessage' => $user_admin ? classLocale::$lang['ali_sys_lastActive'] : classLocale::$lang['Online'],
143 143
   'memberCount'   => count($userList),
144 144
   'memberslist'   => $page_list,
Please login to merge, or discard this patch.
includes/alliance/ali_external_create_ally.inc 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 // Pretty Safe
3 3
 // TODO: Add ally_tag to usertable
4 4
 
5
-if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
5
+if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) {
6 6
   classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
7 7
 }
8 8
 
@@ -11,21 +11,21 @@  discard block
 block discarded – undo
11 11
 $ally_name_raw = sys_get_param_str_unsafe('name');
12 12
 $ally_name = db_escape($ally_name_raw);
13 13
 
14
-if($ally_tag) {
15
-  if(!$ally_name_raw || !$ally_tag_raw) {
14
+if ($ally_tag) {
15
+  if (!$ally_name_raw || !$ally_tag_raw) {
16 16
     message(classLocale::$lang['have_not_name'], classLocale::$lang['make_alliance']);
17 17
   }
18 18
 
19 19
   $query = db_ally_get_by_name_or_tag($ally_tag, $ally_name);
20
-  if($query) {
20
+  if ($query) {
21 21
     message(str_replace('%s', $query['ally_tag'] == $ally_tag_raw ? $ally_tag_raw : $ally_name_raw, classLocale::$lang['always_exist']), classLocale::$lang['make_alliance']);
22 22
   }
23 23
 
24 24
   db_ally_insert($ally_name, $ally_tag, $user);
25 25
   $ally_id = db_insert_id();
26
-  db_user_set_by_id($user['id'], "`ally_tag` = '{$ally_tag}', `ally_id`= {$ally_id}, `ally_name`='{$ally_name}', `ally_register_time`= " . SN_TIME_NOW . "");
26
+  db_user_set_by_id($user['id'], "`ally_tag` = '{$ally_tag}', `ally_id`= {$ally_id}, `ally_name`='{$ally_name}', `ally_register_time`= ".SN_TIME_NOW."");
27 27
 
28
-  $ally_user = classSupernova::db_ins_record(LOC_USER, "`username` = '[{$ally_tag}]', `register_time` = " . SN_TIME_NOW . ", `user_as_ally` = {$ally_id}");
28
+  $ally_user = classSupernova::db_ins_record(LOC_USER, "`username` = '[{$ally_tag}]', `register_time` = ".SN_TIME_NOW.", `user_as_ally` = {$ally_id}");
29 29
   // $ally_user_id = db_insert_id();
30 30
   $ally_user_id = is_array($ally_user) ? $ally_user['id'] : 'NULL';
31 31
   db_ally_update_ally_user($ally_user_id, $ally_id);
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin_rights.inc 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 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
 {
5 5
   classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
6 6
 }
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 $new_rank_name = sys_get_param_str('newRankName');
15 15
 if ($new_rank_name)
16 16
 {
17
-  foreach($ally_rights as $fieldName)
17
+  foreach ($ally_rights as $fieldName)
18 18
   {
19 19
     $newRank[$fieldName] = 0;
20 20
   }
@@ -28,9 +28,9 @@  discard block
 block discarded – undo
28 28
 {
29 29
   unset($ranks);
30 30
 
31
-  foreach($rankListInput as $rankID => $rank)
31
+  foreach ($rankListInput as $rankID => $rank)
32 32
   {
33
-    foreach($ally_rights as $rightName)
33
+    foreach ($ally_rights as $rightName)
34 34
     {
35 35
       $ranks[$rankID][$rightName] = $rank[$rightName] ? 1 : 0;
36 36
     }
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 $d = sys_get_param_int('d');
42 42
 if ($d && isset($ranks[$d]))
43 43
 {
44
-  if(count($ranks) == 1)
44
+  if (count($ranks) == 1)
45 45
   {
46 46
     message(classLocale::$lang['ali_adm_lastRank'], classLocale::$lang['ali_adm_rights_title']);
47 47
   }
@@ -53,17 +53,17 @@  discard block
 block discarded – undo
53 53
 
54 54
 if (count($ranks))
55 55
 {
56
-  foreach($ranks as $rankID => $rank)
56
+  foreach ($ranks as $rankID => $rank)
57 57
   {
58 58
     $rank_data = array(
59 59
       'ID'   => $rankID,
60 60
       'NAME' => $rank['name'],
61 61
     );
62 62
 
63
-    for($i = 1; $i < count($rank); $i++)
63
+    for ($i = 1; $i < count($rank); $i++)
64 64
     {
65
-      $rank_data['R' . $i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : '') ;
66
-      $rank_data['N' . $i] = $ally_rights[$i];
65
+      $rank_data['R'.$i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : '');
66
+      $rank_data['N'.$i] = $ally_rights[$i];
67 67
     }
68 68
 
69 69
     $template->assign_block_vars('rank', $rank_data);
Please login to merge, or discard this patch.
includes/alliance/ali_internal_admin_request.inc 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 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
   classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403);
5 5
 }
6 6
 
@@ -10,16 +10,16 @@  discard block
 block discarded – undo
10 10
 
11 11
 $d = sys_get_param_id('d');
12 12
 
13
-if($d) {
13
+if ($d) {
14 14
   db_ally_request_deny($d);
15 15
 }
16 16
 
17 17
 $id_user = sys_get_param_id('id_user');
18 18
 
19
-if($id_user) {
19
+if ($id_user) {
20 20
   $ally_name_safe = db_escape($ally['ally_name']);
21 21
   $ally_tag_safe = db_escape($ally['ally_tag']);
22
-  db_user_set_by_id($id_user, "`ally_id` = '{$ally['id']}', `ally_name` = '{$ally_name_safe}', `ally_tag` = '{$ally_tag_safe}', `ally_register_time` = " . SN_TIME_NOW . ", `ally_rank_id` = 0");
22
+  db_user_set_by_id($id_user, "`ally_id` = '{$ally['id']}', `ally_name` = '{$ally_name_safe}', `ally_tag` = '{$ally_tag_safe}', `ally_register_time` = ".SN_TIME_NOW.", `ally_rank_id` = 0");
23 23
   db_ally_update_member_increase($ally);
24 24
   db_ally_request_delete_by_user_id($id_user);
25 25
 }
Please login to merge, or discard this patch.