Completed
Push — work-fleets ( 006942...3604bd )
by SuperNova.WS
06:54
created
includes/constants.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
 define('FONT_SIZE_PERCENT_DEFAULT', 68.75);
66 66
 define('FONT_SIZE_PERCENT_MAX', 131.25);
67 67
 define('FONT_SIZE_PERCENT_STEP', 12.5);
68
-define('FONT_SIZE_PERCENT_DEFAULT_STRING', FONT_SIZE_PERCENT_DEFAULT . '%');
68
+define('FONT_SIZE_PERCENT_DEFAULT_STRING', FONT_SIZE_PERCENT_DEFAULT.'%');
69 69
 
70 70
 define('FONT_SIZE_PIXELS_BROWSER_BASE', 16);
71 71
 define('FONT_SIZE_PIXELS_MIN', 9);
72 72
 define('FONT_SIZE_PIXELS_DEFAULT', 11);
73 73
 define('FONT_SIZE_PIXELS_MAX', 21);
74 74
 define('FONT_SIZE_PIXELS_STEP', 1);
75
-define('FONT_SIZE_PIXELS_DEFAULT_STRING', FONT_SIZE_PIXELS_DEFAULT . 'px');
75
+define('FONT_SIZE_PIXELS_DEFAULT_STRING', FONT_SIZE_PIXELS_DEFAULT.'px');
76 76
 
77 77
 define('DEFAULT_PICTURE_EXTENSION_DOTTED', '.jpg');
78 78
 
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 define('SN_PAYMENT_REQUEST_OK', 0);
303 303
 define('SN_PAYMENT_REQUEST_ERROR_UNIT_AMOUNT', 1);
304 304
 define('SN_PAYMENT_REQUEST_ERROR_PAYLINK_UNSUPPORTED', 2);
305
-define('SN_PAYMENT_REQUEST_IP_WRONG', 3);  // Неправильный IP входящей системы - обычно хак
305
+define('SN_PAYMENT_REQUEST_IP_WRONG', 3); // Неправильный IP входящей системы - обычно хак
306 306
 define('SN_PAYMENT_REQUEST_COMMAND_UNSUPPORTED', 4); // Неподдерживаемая команда - обычно хак
307 307
 define('SN_PAYMENT_REQUEST_SIGNATURE_INVALID', 5); // Неправильная подпись или не сошлась контрольная сумма - обычно хак
308 308
 define('SN_MODULE_DISABLED', 6); // Модуль отключен // УНИВЕРСАЛЬНЫЙ ОТВЕТ!
@@ -772,14 +772,14 @@  discard block
 block discarded – undo
772 772
 
773 773
 
774 774
 // *** Mercenary/talent bonus types
775
-define('BONUS_NONE', 0);  // No bonus
776
-define('BONUS_PERCENT', 1);  // Percent on base value
777
-define('BONUS_ADD', 2);  // Add
778
-define('BONUS_ABILITY', 3);  // Some ability
779
-define('BONUS_MULTIPLY', 4);  // Multiply by value
780
-define('BONUS_PERCENT_CUMULATIVE', 5);  // Cumulative percent on base value
781
-define('BONUS_PERCENT_DEGRADED', 6);  // Bonus amount degraded with increase as pow(bonus, level) (?)
782
-define('BONUS_SPEED', 7);  // Speed bonus
775
+define('BONUS_NONE', 0); // No bonus
776
+define('BONUS_PERCENT', 1); // Percent on base value
777
+define('BONUS_ADD', 2); // Add
778
+define('BONUS_ABILITY', 3); // Some ability
779
+define('BONUS_MULTIPLY', 4); // Multiply by value
780
+define('BONUS_PERCENT_CUMULATIVE', 5); // Cumulative percent on base value
781
+define('BONUS_PERCENT_DEGRADED', 6); // Bonus amount degraded with increase as pow(bonus, level) (?)
782
+define('BONUS_SPEED', 7); // Speed bonus
783 783
 
784 784
 // *** Action constant (build should be replaced with ACTION)
785 785
 define('BUILD_CREATE', 1);
@@ -991,10 +991,10 @@  discard block
 block discarded – undo
991 991
 
992 992
 // === Artifacts
993 993
 define('UNIT_ARTIFACTS', 1000);
994
-define('ART_LHC', 1001);      // Additional moon chance
995
-define('ART_RCD_SMALL', 1002);   // Rapid Colony Deployment - Set of buildings up to 10th level - 10/14/ 3/0 -   405 DM
996
-define('ART_RCD_MEDIUM', 1003);  // Rapid Colony Deployment - Set of buildings up to 15th level - 15/20/ 8/0 -  4704 DM
997
-define('ART_RCD_LARGE', 1004);   // Rapid Colony Deployment - Set of buildings up to 20th level - 20/25/10/1 - 39790 DM
994
+define('ART_LHC', 1001); // Additional moon chance
995
+define('ART_RCD_SMALL', 1002); // Rapid Colony Deployment - Set of buildings up to 10th level - 10/14/ 3/0 -   405 DM
996
+define('ART_RCD_MEDIUM', 1003); // Rapid Colony Deployment - Set of buildings up to 15th level - 15/20/ 8/0 -  4704 DM
997
+define('ART_RCD_LARGE', 1004); // Rapid Colony Deployment - Set of buildings up to 20th level - 20/25/10/1 - 39790 DM
998 998
 define('ART_HEURISTIC_CHIP', 1005); // Speed up research
999 999
 define('ART_NANO_BUILDER', 1006); // Speed up building
1000 1000
 define('ART_NANO_CONSTRUCTOR', 1007); // RESERVED Speed up hangar constructions
@@ -1064,18 +1064,18 @@  discard block
 block discarded – undo
1064 1064
 define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE1', 2201); // Блиц-сервер, участник 0-го раунда, 1-е место
1065 1065
 define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE2', 2202); // Блиц-сервер, участник 0-го раунда, 2-е место
1066 1066
 define('UNIT_AWARD_MEDAL_BLITZ_R0_PLACE3', 2203); // Блиц-сервер, участник 0-го раунда, 3-е место
1067
-define('UNIT_AWARD_MEDAL_2016_WOMEN_DAY_BEST', 2204);  // Медаль Лучшему Кавалеру за максимум потраченной ММ/максимум одаренных женщин Женщине от Мужчины во время ивента 8 марта 2016 года
1067
+define('UNIT_AWARD_MEDAL_2016_WOMEN_DAY_BEST', 2204); // Медаль Лучшему Кавалеру за максимум потраченной ММ/максимум одаренных женщин Женщине от Мужчины во время ивента 8 марта 2016 года
1068 1068
 
1069 1069
 define('UNIT_AWARD_MEMORY', 2300); // Памятные знаки за существование и участие - например "4 года в игре". "Был онлайн в новогоднюю ночь 2013". итд
1070
-define('UNIT_AWARD_MEMORY_IMMORTAL', 2301);  // Бессмертный
1071
-define('UNIT_AWARD_MEMORY_2015_WOMEN_DAY', 2302);  // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2015 года
1070
+define('UNIT_AWARD_MEMORY_IMMORTAL', 2301); // Бессмертный
1071
+define('UNIT_AWARD_MEMORY_2015_WOMEN_DAY', 2302); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2015 года
1072 1072
 define('UNIT_AWARD_MEMORY_BLITZ_R0', 2303); // Блиц-сервер, участник 0-го раунда
1073 1073
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_SIMPLE', 2304); // День Рождения СН
1074 1074
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_BRONZE', 2305); // День Рождения СН
1075 1075
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_SILVER', 2306); // День Рождения СН
1076 1076
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_GOLD', 2307); // День Рождения СН
1077 1077
 define('UNIT_AWARD_MEMORY_SUPER_BORN_2015_PLATINUM', 2308); // День Рождения СН
1078
-define('UNIT_AWARD_MEMORY_2016_WOMEN_DAY', 2309);  // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2016 года
1078
+define('UNIT_AWARD_MEMORY_2016_WOMEN_DAY', 2309); // Значек за подарок Женщине от Мужчины во время ивента 8 марта 2016 года
1079 1079
 
1080 1080
 define('UNIT_AWARD_PENNANT', 2400); // Переходящий вымпел - индикация статуса на сервере: "Топ-1", "Топ", "Сабтоп", "Самый большой флот" итд
1081 1081
 define('UNIT_AWARD_BADGE', 2600); // Бейджики/значки за ачивки - например, "Построил 1000 кораблей"
Please login to merge, or discard this patch.
classes/Common/Accessors.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
    * @return bool
41 41
    */
42 42
   public function exists($accessor, $varName) {
43
-    return isset($this->accessors[$accessor . $varName]);
43
+    return isset($this->accessors[$accessor.$varName]);
44 44
   }
45 45
 
46 46
   /**
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     if (empty($callable)) {
61 61
       return;
62 62
     } elseif (!is_callable($callable)) {
63
-      throw new \Exception('Error assigning callable in ' . get_called_class() . '::set()! Callable typed [' . $accessor . '] is not a callable or not accessible in the scope');
63
+      throw new \Exception('Error assigning callable in '.get_called_class().'::set()! Callable typed ['.$accessor.'] is not a callable or not accessible in the scope');
64 64
     }
65 65
 
66 66
     // Converting method array-callable to closure
@@ -70,13 +70,13 @@  discard block
 block discarded – undo
70 70
 //      $method = new \ReflectionMethod($callable[0], $callable[1]);
71 71
 //      $callable = $method->getClosure($callable[0]);
72 72
 //    }
73
-    if(is_array($callable) && ($invoker = Invoker::build($callable))) {
73
+    if (is_array($callable) && ($invoker = Invoker::build($callable))) {
74 74
       $callable = $invoker;
75 75
     }
76 76
 
77
-    $functionName = $accessor . $varName;
77
+    $functionName = $accessor.$varName;
78 78
     $this->accessors[$functionName] = $callable;
79
-    if($shared == ACCESSOR_SHARED) {
79
+    if ($shared == ACCESSOR_SHARED) {
80 80
       $this->shared[$functionName] = true;
81 81
     }
82 82
   }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
    * @return callable|null
92 92
    */
93 93
   public function get($accessor, $varName) {
94
-    return $this->exists($accessor, $varName) ? $this->accessors[$accessor . $varName] : null;
94
+    return $this->exists($accessor, $varName) ? $this->accessors[$accessor.$varName] : null;
95 95
   }
96 96
 
97 97
   /**
@@ -104,11 +104,11 @@  discard block
 block discarded – undo
104 104
    */
105 105
   public function execute($accessor, $varName, $params) {
106 106
     if (!$this->exists($accessor, $varName)) {
107
-      throw new \Exception("No [{$accessor}] accessor found for variable [{$varName}] on " . get_called_class() . "::" . __METHOD__);
107
+      throw new \Exception("No [{$accessor}] accessor found for variable [{$varName}] on ".get_called_class()."::".__METHOD__);
108 108
     }
109 109
 
110
-    $functionName = $accessor . $varName;
111
-    if(!isset($this->shared[$functionName]) || !array_key_exists($functionName, $this->executed)) {
110
+    $functionName = $accessor.$varName;
111
+    if (!isset($this->shared[$functionName]) || !array_key_exists($functionName, $this->executed)) {
112 112
       $this->executed[$functionName] = call_user_func_array($this->accessors[$functionName], $params);
113 113
     }
114 114
 
Please login to merge, or discard this patch.
classes/FleetList.php 2 patches
Doc Comments   +5 added lines patch added patch discarded remove patch
@@ -64,6 +64,10 @@  discard block
 block discarded – undo
64 64
    *
65 65
    */
66 66
   // DEPRECATED
67
+
68
+  /**
69
+   * @param boolean $for_update
70
+   */
67 71
   public static function dbGetFleetList($where_safe = '', $for_update = DB_SELECT_FOR_UPDATE) {
68 72
     $fleetList = new static();
69 73
     $fleetList->dbLoadWhere($where_safe, $for_update);
@@ -246,6 +250,7 @@  discard block
 block discarded – undo
246 250
    * LIST - Get missile attack list by condition
247 251
    *
248 252
    * @param string $where
253
+   * @param boolean $for_update
249 254
    */
250 255
   public function dbMergeMissileList($where, $for_update = DB_SELECT_FOR_UPDATE) {
251 256
     $query = classSupernova::$db->doSelect(
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -33,18 +33,18 @@  discard block
 block discarded – undo
33 33
     $fleets_added = array();
34 34
 
35 35
     $query = classSupernova::$db->doSelect(
36
-      "SELECT * FROM `{{fleets}}`" .
37
-      (!empty($where_safe) ? " WHERE {$where_safe}" : '') .
36
+      "SELECT * FROM `{{fleets}}`".
37
+      (!empty($where_safe) ? " WHERE {$where_safe}" : '').
38 38
       ($for_update == DB_SELECT_FOR_UPDATE ? " FOR UPDATE;" : '')
39 39
     );
40
-    while($row = db_fetch($query)) {
40
+    while ($row = db_fetch($query)) {
41 41
       /**
42 42
        * @var Fleet $fleet
43 43
        */
44 44
       $fleet = $this->_createElement();
45 45
       $fleet->dbRowParse($row);
46 46
 
47
-      if(isset($this[$fleet->dbId])) {
47
+      if (isset($this[$fleet->dbId])) {
48 48
         // Нужно ли ????
49 49
         classSupernova::$debug->error('Fleet list already set');
50 50
       }
@@ -119,11 +119,11 @@  discard block
 block discarded – undo
119 119
   public static function dbGetFleetListCurrentTick() {
120 120
     return static::dbGetFleetList(
121 121
       "
122
-    (`fleet_start_time` <= " . SN_TIME_NOW . " AND `fleet_mess` = 0)
122
+    (`fleet_start_time` <= " . SN_TIME_NOW." AND `fleet_mess` = 0)
123 123
     OR
124
-    (`fleet_end_stay` <= " . SN_TIME_NOW . " AND `fleet_end_stay` > 0 AND `fleet_mess` = 0)
124
+    (`fleet_end_stay` <= " . SN_TIME_NOW." AND `fleet_end_stay` > 0 AND `fleet_mess` = 0)
125 125
     OR
126
-    (`fleet_end_time` <= " . SN_TIME_NOW . ")"
126
+    (`fleet_end_time` <= " . SN_TIME_NOW.")"
127 127
       , DB_SELECT_PLAIN
128 128
     );
129 129
   }
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
     AND `fleet_end_planet` = {$planet_row['planet']}
145 145
     AND `fleet_end_type`   = {$planet_row['planet_type']}
146 146
     AND `fleet_owner` = {$fleet_owner_id}
147
-    AND `fleet_mission` IN (" . MT_ATTACK . "," . MT_ACS . "," . MT_DESTROY . ")
147
+    AND `fleet_mission` IN (".MT_ATTACK.",".MT_ACS.",".MT_DESTROY.")
148 148
     AND `fleet_mess` = 0"
149 149
       , DB_SELECT_FOR_UPDATE
150 150
     );
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
    * @return static|array
171 171
    */
172 172
   public static function dbGetFleetListAndMissileByCoordinates($coordinates, $for_phalanx = false) {
173
-    if(empty($coordinates) || !is_array($coordinates)) {
173
+    if (empty($coordinates) || !is_array($coordinates)) {
174 174
       return array();
175 175
     }
176 176
 
@@ -201,8 +201,8 @@  discard block
 block discarded – undo
201 201
      * @var Fleet[] $array_of_Fleet
202 202
      */
203 203
     $array_of_Fleet = array();
204
-    if(!empty($fleet_db_list) && $fleet_db_list->count()) {
205
-      foreach($fleet_db_list->_container as $fleet_id => $objFleet) {
204
+    if (!empty($fleet_db_list) && $fleet_db_list->count()) {
205
+      foreach ($fleet_db_list->_container as $fleet_id => $objFleet) {
206 206
         $array_of_Fleet[$fleet_id] = $objFleet;
207 207
       }
208 208
       $planet_fleets = flt_get_fleets_to_planet_by_array_of_Fleet($array_of_Fleet);
@@ -227,16 +227,16 @@  discard block
 block discarded – undo
227 227
     return static::dbGetFleetList(
228 228
       "(
229 229
       fleet_start_galaxy = {$galaxy}
230
-      AND fleet_start_system = {$system}" .
231
-      ($planet ? " AND fleet_start_planet = {$planet}" : '') .
232
-      ($planet_type != PT_ALL ? " AND fleet_start_type = {$planet_type}" : '') .
233
-      ($for_phalanx ? '' : " AND fleet_mess = 1") .
230
+      AND fleet_start_system = {$system}".
231
+      ($planet ? " AND fleet_start_planet = {$planet}" : '').
232
+      ($planet_type != PT_ALL ? " AND fleet_start_type = {$planet_type}" : '').
233
+      ($for_phalanx ? '' : " AND fleet_mess = 1").
234 234
       ") OR (
235 235
       fleet_end_galaxy = {$galaxy}
236
-      AND fleet_end_system = {$system}" .
237
-      ($planet ? " AND fleet_end_planet = {$planet}" : '') .
238
-      ($planet_type != PT_ALL ? " AND fleet_end_type = {$planet_type} " : '') .
239
-      ($for_phalanx ? '' : " AND fleet_mess = 0") .
236
+      AND fleet_end_system = {$system}".
237
+      ($planet ? " AND fleet_end_planet = {$planet}" : '').
238
+      ($planet_type != PT_ALL ? " AND fleet_end_type = {$planet_type} " : '').
239
+      ($for_phalanx ? '' : " AND fleet_mess = 0").
240 240
       ")"
241 241
       , DB_SELECT_PLAIN
242 242
     );
@@ -249,11 +249,11 @@  discard block
 block discarded – undo
249 249
    */
250 250
   public function dbMergeMissileList($where, $for_update = DB_SELECT_FOR_UPDATE) {
251 251
     $query = classSupernova::$db->doSelect(
252
-      "SELECT * FROM `{{iraks}}`" .
253
-      (!empty($where) ? " WHERE {$where}" : '') .
252
+      "SELECT * FROM `{{iraks}}`".
253
+      (!empty($where) ? " WHERE {$where}" : '').
254 254
       ($for_update == DB_SELECT_FOR_UPDATE ? " FOR UPDATE;" : '')
255 255
     );
256
-    while($missile_db_row = db_fetch($query)) {
256
+    while ($missile_db_row = db_fetch($query)) {
257 257
       /**
258 258
        * @var Fleet $objFleet
259 259
        */
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
    */
276 276
   public static function dbGetFleetListAndMissileINCOMING($owner_id) {
277 277
     $owner_id_safe = idval($owner_id);
278
-    if(empty($owner_id_safe)) {
278
+    if (empty($owner_id_safe)) {
279 279
       return array();
280 280
     }
281 281
 
@@ -309,10 +309,10 @@  discard block
 block discarded – undo
309 309
    */
310 310
   public static function fleet_count_flying($player_id, $mission_id = 0) {
311 311
     $player_id_safe = idval($player_id);
312
-    if(!empty($player_id_safe)) {
312
+    if (!empty($player_id_safe)) {
313 313
       $mission_id_safe = intval($mission_id);
314 314
       $result = static::db_fleet_count(
315
-        "`fleet_owner` = {$player_id_safe}" .
315
+        "`fleet_owner` = {$player_id_safe}".
316 316
         ($mission_id_safe ? " AND `fleet_mission` = {$mission_id_safe}" : '')
317 317
       );
318 318
     } else {
Please login to merge, or discard this patch.
classes/db_mysql_v5.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -37,19 +37,19 @@
 block discarded – undo
37 37
 
38 38
     $this->link = mysqli_connect($settings['server'], $settings['user'], $settings['pass'], $settings['name']);
39 39
     if (!is_object($this->link) || $this->link->connect_error) {
40
-      classSupernova::$debug->error_fatal('DB Error - cannot connect to server error #' . $this->link->connect_errno, $this->link->connect_error);
40
+      classSupernova::$debug->error_fatal('DB Error - cannot connect to server error #'.$this->link->connect_errno, $this->link->connect_error);
41 41
     }
42 42
 
43 43
 
44 44
     !$this->mysql_query("/*!40101 SET NAMES 'utf8' */")
45
-      ? classSupernova::$debug->error_fatal('DB error - cannot set names 1 error #' . $this->link->errno, $this->link->error)
45
+      ? classSupernova::$debug->error_fatal('DB error - cannot set names 1 error #'.$this->link->errno, $this->link->error)
46 46
       : false;
47 47
     !$this->mysql_query("SET NAMES 'utf8';")
48
-      ? classSupernova::$debug->error_fatal('DB error - cannot set names 2 error #' . $this->link->errno, $this->link->error)
48
+      ? classSupernova::$debug->error_fatal('DB error - cannot set names 2 error #'.$this->link->errno, $this->link->error)
49 49
       : false;
50 50
 
51
-    !$this->mysql_query('SET SESSION TRANSACTION ISOLATION LEVEL ' . self::DB_MYSQL_TRANSACTION_SERIALIZABLE . ';')
52
-      ? classSupernova::$debug->error_fatal('DB error - cannot set desired isolation level error #' . $this->link->errno, $this->link->error)
51
+    !$this->mysql_query('SET SESSION TRANSACTION ISOLATION LEVEL '.self::DB_MYSQL_TRANSACTION_SERIALIZABLE.';')
52
+      ? classSupernova::$debug->error_fatal('DB error - cannot set desired isolation level error #'.$this->link->errno, $this->link->error)
53 53
       : false;
54 54
 
55 55
     $this->connected = true;
Please login to merge, or discard this patch.
includes/init_secondary.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -4,19 +4,19 @@  discard block
 block discarded – undo
4 4
 
5 5
 $classLocale = classLocale::$lang;
6 6
 
7
-if(classSupernova::$config->server_updater_check_auto && classSupernova::$config->server_updater_check_last + classSupernova::$config->server_updater_check_period <= SN_TIME_NOW) {
8
-  include(SN_ROOT_PHYSICAL . 'ajax_version_check' . DOT_PHP_EX);
7
+if (classSupernova::$config->server_updater_check_auto && classSupernova::$config->server_updater_check_last + classSupernova::$config->server_updater_check_period <= SN_TIME_NOW) {
8
+  include(SN_ROOT_PHYSICAL.'ajax_version_check'.DOT_PHP_EX);
9 9
 }
10 10
 
11
-if(classSupernova::$config->user_birthday_gift && SN_TIME_NOW - classSupernova::$config->user_birthday_celebrate > PERIOD_DAY) {
12
-  require_once(SN_ROOT_PHYSICAL . "includes/includes/user_birthday_celebrate" . DOT_PHP_EX);
11
+if (classSupernova::$config->user_birthday_gift && SN_TIME_NOW - classSupernova::$config->user_birthday_celebrate > PERIOD_DAY) {
12
+  require_once(SN_ROOT_PHYSICAL."includes/includes/user_birthday_celebrate".DOT_PHP_EX);
13 13
   sn_user_birthday_celebrate();
14 14
 }
15 15
 
16
-if(!classSupernova::$config->var_online_user_count || classSupernova::$config->var_online_user_time + 30 < SN_TIME_NOW) {
16
+if (!classSupernova::$config->var_online_user_count || classSupernova::$config->var_online_user_time + 30 < SN_TIME_NOW) {
17 17
   classSupernova::$config->db_saveItem('var_online_user_count', DBStaticUser::db_user_count(true));
18 18
   classSupernova::$config->db_saveItem('var_online_user_time', SN_TIME_NOW);
19
-  if(classSupernova::$config->server_log_online) {
19
+  if (classSupernova::$config->server_log_online) {
20 20
     db_log_online_insert();
21 21
   }
22 22
 }
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 $template_result[F_ACCOUNT_IS_AUTHORIZED] = $sys_user_logged_in = !empty($user) && isset($user['id']) && $user['id'];
44 44
 //pdump($template_result[F_ACCOUNT_IS_AUTHORIZED]);die();
45 45
 
46
-if(!empty($user['id'])) {
46
+if (!empty($user['id'])) {
47 47
   classSupernova::$user_options->user_change($user['id']);
48 48
 }
49 49
 
@@ -56,15 +56,15 @@  discard block
 block discarded – undo
56 56
     : false
57 57
   );
58 58
 
59
-if($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) {
60
-  $prohibited_characters = array_map(function ($value) {
61
-    return "'" . htmlentities($value, ENT_QUOTES, 'UTF-8') . "'";
59
+if ($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) {
60
+  $prohibited_characters = array_map(function($value) {
61
+    return "'".htmlentities($value, ENT_QUOTES, 'UTF-8')."'";
62 62
   }, str_split(LOGIN_REGISTER_CHARACTERS_PROHIBITED));
63 63
   $template_result[F_LOGIN_MESSAGE] .= implode(', ', $prohibited_characters);
64 64
 }
65 65
 
66 66
 
67
-if(defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) {
67
+if (defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) {
68 68
   pdump("Отключи отладку перед продакшном!");
69 69
 }
70 70
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
   ? define('INSTALL_MODE', GAME_DISABLE_INSTALL)
79 79
   : false;
80 80
 
81
-if(
81
+if (
82 82
   classSupernova::$config->game_disable == GAME_DISABLE_STAT
83 83
   &&
84 84
   SN_TIME_NOW - strtotime(classSupernova::$config->db_loadItem('var_stat_update_end')) > 600
@@ -91,17 +91,17 @@  discard block
 block discarded – undo
91 91
   classSupernova::$debug->warning('Stat worked too long - watchdog unlocked', 'Stat WARNING');
92 92
 }
93 93
 
94
-if($template_result[F_GAME_DISABLE] = classSupernova::$config->game_disable) {
94
+if ($template_result[F_GAME_DISABLE] = classSupernova::$config->game_disable) {
95 95
   $template_result[F_GAME_DISABLE_REASON] = sys_bbcodeParse(
96 96
     classSupernova::$config->game_disable == GAME_DISABLE_REASON
97 97
       ? classSupernova::$config->game_disable_reason
98 98
       : classLocale::$lang['sys_game_disable_reason'][classSupernova::$config->game_disable]
99 99
   );
100
-  if(defined('IN_API')) {
100
+  if (defined('IN_API')) {
101 101
     return;
102 102
   }
103 103
 
104
-  if(
104
+  if (
105 105
     ($user['authlevel'] < 1 || !(defined('IN_ADMIN') && IN_ADMIN))
106 106
     &&
107 107
     !(defined('INSTALL_MODE') && defined('LOGIN_LOGOUT'))
@@ -115,8 +115,8 @@  discard block
 block discarded – undo
115 115
 
116 116
 // TODO ban
117 117
 // TODO $skip_ban_check
118
-if($template_result[F_BANNED_STATUS] && !$skip_ban_check) {
119
-  if(defined('IN_API')) {
118
+if ($template_result[F_BANNED_STATUS] && !$skip_ban_check) {
119
+  if (defined('IN_API')) {
120 120
     return;
121 121
   }
122 122
 
@@ -134,15 +134,15 @@  discard block
 block discarded – undo
134 134
 // pdump($allow_anonymous, '$allow_anonymous');
135 135
 // pdump($sys_user_logged_in, '$sys_user_logged_in');
136 136
 
137
-if($sys_user_logged_in && INITIAL_PAGE == 'login') {
138
-  sys_redirect(SN_ROOT_VIRTUAL . 'overview.php');
139
-} elseif($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id'])
137
+if ($sys_user_logged_in && INITIAL_PAGE == 'login') {
138
+  sys_redirect(SN_ROOT_VIRTUAL.'overview.php');
139
+} elseif ($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id'])
140 140
 //  pdump($sn_page_name);
141 141
 //  pdump(INITIAL_PAGE);
142 142
 //  die('{Тут должна быть ваша реклама. Точнее - ввод имени игрока}');
143
-} elseif(!$allow_anonymous && !$sys_user_logged_in) {
143
+} elseif (!$allow_anonymous && !$sys_user_logged_in) {
144 144
   // sn_setcookie(SN_COOKIE, '', time() - PERIOD_WEEK, SN_ROOT_RELATIVE);
145
-  sys_redirect(SN_ROOT_VIRTUAL . 'login.php');
145
+  sys_redirect(SN_ROOT_VIRTUAL.'login.php');
146 146
 }
147 147
 
148 148
 $user_time_diff = playerTimeDiff::user_time_diff_get();
@@ -161,16 +161,16 @@  discard block
 block discarded – undo
161 161
 
162 162
 global $skip_fleet_update;
163 163
 $skip_fleet_update = $skip_fleet_update || classSupernova::$options['fleet_update_skip'] || defined('IN_ADMIN');
164
-if(
164
+if (
165 165
   !$skip_fleet_update
166 166
   && !(defined('IN_AJAX') && IN_AJAX === true)
167 167
   && SN_TIME_NOW - strtotime(classSupernova::$config->fleet_update_last) > classSupernova::$config->fleet_update_interval
168 168
 ) {
169
-  require_once(SN_ROOT_PHYSICAL . "includes/includes/flt_flying_fleet_handler2" . DOT_PHP_EX);
169
+  require_once(SN_ROOT_PHYSICAL."includes/includes/flt_flying_fleet_handler2".DOT_PHP_EX);
170 170
   flt_flying_fleet_handler($skip_fleet_update);
171 171
 }
172 172
 
173
-if(!defined('IN_AJAX')) {
173
+if (!defined('IN_AJAX')) {
174 174
   pdump("Scheduled processes is disabled");
175 175
 }
176 176
 // scheduler_process();
Please login to merge, or discard this patch.
includes/functions/scheduler_process.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,19 +9,19 @@  discard block
 block discarded – undo
9 9
   $ts_var_stat_update = strtotime(classSupernova::$config->db_loadItem('var_stat_update'));
10 10
   $ts_scheduled_update = sys_schedule_get_prev_run(classSupernova::$config->db_loadItem('stats_schedule'), classSupernova::$config->var_stat_update);
11 11
 
12
-  if(sys_get_param_int('admin_update')) {
12
+  if (sys_get_param_int('admin_update')) {
13 13
     define('USER_LEVEL', isset($user['authlevel']) ? $user['authlevel'] : -1);
14
-    if(USER_LEVEL > 0) {
14
+    if (USER_LEVEL > 0) {
15 15
       $is_admin_request = true;
16 16
       $ts_scheduled_update = SN_TIME_NOW;
17 17
     }
18 18
   }
19 19
 
20
-  if($ts_scheduled_update > $ts_var_stat_update) {
20
+  if ($ts_scheduled_update > $ts_var_stat_update) {
21 21
     lng_include('admin');
22 22
     sn_db_transaction_start();
23 23
     $ts_var_stat_update_end = strtotime(classSupernova::$config->db_loadItem('var_stat_update_end'));
24
-    if(SN_TIME_NOW > $ts_var_stat_update_end) {
24
+    if (SN_TIME_NOW > $ts_var_stat_update_end) {
25 25
       $old_server_status = classSupernova::$config->db_loadItem('game_disable');
26 26
       classSupernova::$config->db_saveItem('game_disable', GAME_DISABLE_STAT);
27 27
 
@@ -31,14 +31,14 @@  discard block
 block discarded – undo
31 31
 
32 32
       $msg = $is_admin_request ? 'admin request' : 'scheduler';
33 33
       $next_run = date(FMT_DATE_TIME_SQL, sys_schedule_get_prev_run(classSupernova::$config->stats_schedule, classSupernova::$config->var_stat_update, true));
34
-      $msg = "Running stat updates: {$msg}. Config->var_stat_update = " . classSupernova::$config->var_stat_update .
35
-        ', $ts_scheduled_update = ' . date(FMT_DATE_TIME_SQL, $ts_scheduled_update) .
36
-        ', next_stat_update = ' . $next_run;
34
+      $msg = "Running stat updates: {$msg}. Config->var_stat_update = ".classSupernova::$config->var_stat_update.
35
+        ', $ts_scheduled_update = '.date(FMT_DATE_TIME_SQL, $ts_scheduled_update).
36
+        ', next_stat_update = '.$next_run;
37 37
       classSupernova::$debug->warning($msg, 'Stat update', LOG_INFO_STAT_PROCESS);
38 38
       $total_time = microtime(true);
39 39
 
40 40
       // require_once('../includes/sys_stat.php');
41
-      require_once(SN_ROOT_PHYSICAL . 'includes/includes/sys_stat.php');
41
+      require_once(SN_ROOT_PHYSICAL.'includes/includes/sys_stat.php');
42 42
       sys_stat_calculate();
43 43
 
44 44
       $total_time = microtime(true) - $total_time;
@@ -56,17 +56,17 @@  discard block
 block discarded – undo
56 56
       classSupernova::$config->db_saveItem('var_stat_update_admin_forced', SN_TIME_SQL);
57 57
       classSupernova::$config->db_saveItem('var_stat_update_end', SN_TIME_SQL);
58 58
 
59
-      if($old_server_status == GAME_DISABLE_STAT) {
59
+      if ($old_server_status == GAME_DISABLE_STAT) {
60 60
         $old_server_status = GAME_DISABLE_NONE;
61 61
       }
62 62
       classSupernova::$config->db_saveItem('game_disable', $old_server_status);
63
-    } elseif($ts_scheduled_update > $ts_var_stat_update) {
63
+    } elseif ($ts_scheduled_update > $ts_var_stat_update) {
64 64
       $timeout = strtotime(classSupernova::$config->db_loadItem('var_stat_update_end')) - SN_TIME_NOW;
65 65
       $msg = classSupernova::$config->db_loadItem('var_stat_update_msg');
66 66
       $msg = "{$msg} ETA {$timeout} seconds. Please wait...";
67 67
     }
68 68
     sn_db_transaction_rollback();
69
-  } elseif($is_admin_request) {
69
+  } elseif ($is_admin_request) {
70 70
     $msg = 'Stat is up to date';
71 71
   }
72 72
 
Please login to merge, or discard this patch.
classes/Vector/Vector.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -133,12 +133,12 @@  discard block
 block discarded – undo
133 133
    * @return static
134 134
    */
135 135
   public function convertToVectorDynamic($coordinates, $prefix = '') {
136
-    $this->galaxy = isset($coordinates[$prefix . 'galaxy']) ? intval($coordinates[$prefix . 'galaxy']) : 0;
137
-    $this->system = isset($coordinates[$prefix . 'system']) ? intval($coordinates[$prefix . 'system']) : 0;
138
-    $this->planet = isset($coordinates[$prefix . 'planet']) ? intval($coordinates[$prefix . 'planet']) : 0;
139
-    $this->type = isset($coordinates[$prefix . 'type'])
140
-      ? isset($coordinates[$prefix . 'type'])
141
-      : (isset($coordinates[$prefix . 'planet_type']) ? intval($coordinates[$prefix . 'planet_type']) : 0);
136
+    $this->galaxy = isset($coordinates[$prefix.'galaxy']) ? intval($coordinates[$prefix.'galaxy']) : 0;
137
+    $this->system = isset($coordinates[$prefix.'system']) ? intval($coordinates[$prefix.'system']) : 0;
138
+    $this->planet = isset($coordinates[$prefix.'planet']) ? intval($coordinates[$prefix.'planet']) : 0;
139
+    $this->type = isset($coordinates[$prefix.'type'])
140
+      ? isset($coordinates[$prefix.'type'])
141
+      : (isset($coordinates[$prefix.'planet_type']) ? intval($coordinates[$prefix.'planet_type']) : 0);
142 142
 
143 143
     return $this;
144 144
   }
@@ -150,10 +150,10 @@  discard block
 block discarded – undo
150 150
    */
151 151
   public function toArray($prefix = '') {
152 152
     $array = array(
153
-      $prefix . 'galaxy' => $this->galaxy,
154
-      $prefix . 'system' => $this->system,
155
-      $prefix . 'planet' => $this->planet,
156
-      $prefix . 'type'   => $this->type,
153
+      $prefix.'galaxy' => $this->galaxy,
154
+      $prefix.'system' => $this->system,
155
+      $prefix.'planet' => $this->planet,
156
+      $prefix.'type'   => $this->type,
157 157
     );
158 158
 
159 159
     return $array;
Please login to merge, or discard this patch.
overview.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 use DBStatic\DBStaticPlanet;
34 34
 use DBStatic\DBStaticUser;
35 35
 
36
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
36
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
37 37
 
38 38
 //$ccc = 0;
39 39
 //foreach(DBStatic\DBStaticUser::db_user_list_non_bots() as $ip) {
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 
53 53
 $result = array();
54 54
 
55
-switch($mode = sys_get_param_str('mode')) {
55
+switch ($mode = sys_get_param_str('mode')) {
56 56
   case 'manage':
57 57
     sn_sys_sector_buy('overview.php?mode=manage');
58 58
 
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
     $template  = gettemplate('planet_manage', true);
63 63
     $planet_id = sys_get_param_id('planet_id');
64 64
 
65
-    if(sys_get_param_str('rename') && ($new_name_unsafe = sys_get_param_str_unsafe('new_name'))) {
65
+    if (sys_get_param_str('rename') && ($new_name_unsafe = sys_get_param_str_unsafe('new_name'))) {
66 66
       $planetrow['name'] = $new_name_unsafe;
67 67
       DBStaticPlanet::db_planet_update_set_by_id(
68 68
         $planetrow['id'],
@@ -70,21 +70,21 @@  discard block
 block discarded – undo
70 70
           'name' => $new_name_unsafe,
71 71
         )
72 72
       );
73
-    } elseif(sys_get_param_str('action') == 'make_capital') {
73
+    } elseif (sys_get_param_str('action') == 'make_capital') {
74 74
       try {
75 75
         sn_db_transaction_start();
76 76
         $user = DBStaticUser::db_user_by_id($user['id'], true, '*');
77 77
         $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true, '*');
78 78
 
79
-        if($planetrow['planet_type'] != PT_PLANET) {
79
+        if ($planetrow['planet_type'] != PT_PLANET) {
80 80
           throw new exception(classLocale::$lang['ov_capital_err_not_a_planet'], ERR_ERROR);
81 81
         }
82 82
 
83
-        if($planetrow['id'] == $user['id_planet']) {
83
+        if ($planetrow['id'] == $user['id_planet']) {
84 84
           throw new exception(classLocale::$lang['ov_capital_err_capital_already'], ERR_ERROR);
85 85
         }
86 86
 
87
-        if($user_dark_matter < classSupernova::$config->planet_capital_cost) {
87
+        if ($user_dark_matter < classSupernova::$config->planet_capital_cost) {
88 88
           throw new exception(classLocale::$lang['ov_capital_err_no_dark_matter'], ERR_ERROR);
89 89
         }
90 90
 
@@ -109,16 +109,16 @@  discard block
 block discarded – undo
109 109
         );
110 110
         sn_db_transaction_commit();
111 111
         sys_redirect('overview.php?mode=manage');
112
-      } catch(exception $e) {
112
+      } catch (exception $e) {
113 113
         sn_db_transaction_rollback();
114 114
         $result[] = array(
115 115
           'STATUS'  => $e->getCode(),
116 116
           'MESSAGE' => $e->getMessage(),
117 117
         );
118 118
       }
119
-    } elseif(sys_get_param_str('action') == 'planet_teleport') {
119
+    } elseif (sys_get_param_str('action') == 'planet_teleport') {
120 120
       try {
121
-        if(!uni_coordinates_valid($new_coordinates = array(
121
+        if (!uni_coordinates_valid($new_coordinates = array(
122 122
           'galaxy' => sys_get_param_int('new_galaxy'),
123 123
           'system' => sys_get_param_int('new_system'),
124 124
           'planet' => sys_get_param_int('new_planet')))
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 //        $planetrow = $global_data['planet'];
136 136
 
137 137
         $can_teleport = uni_planet_teleport_check($user, $planetrow, $new_coordinates);
138
-        if($can_teleport['result'] != ERR_NONE) {
138
+        if ($can_teleport['result'] != ERR_NONE) {
139 139
           throw new exception($can_teleport['message'], $can_teleport['result']);
140 140
         }
141 141
 
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
           array()
155 155
         );
156 156
 
157
-        if($planetrow['id'] == $user['id_planet']) {
157
+        if ($planetrow['id'] == $user['id_planet']) {
158 158
           DBStaticUser::db_user_set_by_id(
159 159
             $user['id'],
160 160
             array(
@@ -174,17 +174,17 @@  discard block
 block discarded – undo
174 174
           'MESSAGE' => classLocale::$lang['ov_teleport_err_none'],
175 175
         );
176 176
         sys_redirect('overview.php?mode=manage');
177
-      } catch(exception $e) {
177
+      } catch (exception $e) {
178 178
         sn_db_transaction_rollback();
179 179
         $result[] = array(
180 180
           'STATUS'  => $e->getCode(),
181 181
           'MESSAGE' => $e->getMessage(),
182 182
         );
183 183
       }
184
-    } elseif(sys_get_param_str('action') == 'planet_abandon') {
184
+    } elseif (sys_get_param_str('action') == 'planet_abandon') {
185 185
       // if(sec_password_check($user['id'], sys_get_param('abandon_confirm'))) {
186
-      if(classSupernova::$auth->password_check(sys_get_param('abandon_confirm'))) {
187
-        if($user['id_planet'] != $user['current_planet'] && $user['current_planet'] == $planet_id) {
186
+      if (classSupernova::$auth->password_check(sys_get_param('abandon_confirm'))) {
187
+        if ($user['id_planet'] != $user['current_planet'] && $user['current_planet'] == $planet_id) {
188 188
           $destroyed = SN_TIME_NOW + 60 * 60 * 24;
189 189
           DBStaticPlanet::db_planet_update_set_by_id(
190 190
             $user['current_planet'],
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
           message(classLocale::$lang['ov_delete_wrong_planet'], classLocale::$lang['colony_abandon'], 'overview.php?mode=manage');
211 211
         }
212 212
       } else {
213
-        message(classLocale::$lang['ov_delete_wrong_pass'] , classLocale::$lang['colony_abandon'], 'overview.php?mode=manage');
213
+        message(classLocale::$lang['ov_delete_wrong_pass'], classLocale::$lang['colony_abandon'], 'overview.php?mode=manage');
214 214
       }
215
-    } elseif(
215
+    } elseif (
216 216
       ($hire = sys_get_param_int('hire')) && in_array($hire, sn_get_groups('governors'))
217 217
       && (
218 218
         !get_unit_param($hire, P_MAX_STACK) ||
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
       $user = DBStaticUser::db_user_by_id($user['id'], true);
228 228
       $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true);
229 229
       $build_data = eco_get_build_data($user, $planetrow, $hire, $planetrow['PLANET_GOVERNOR_ID'] == $hire ? $planetrow['PLANET_GOVERNOR_LEVEL'] : 0);
230
-      if($build_data['CAN'][BUILD_CREATE]) {
231
-        if($planetrow['PLANET_GOVERNOR_ID'] == $hire) {
230
+      if ($build_data['CAN'][BUILD_CREATE]) {
231
+        if ($planetrow['PLANET_GOVERNOR_ID'] == $hire) {
232 232
           $planetrow['PLANET_GOVERNOR_LEVEL']++;
233 233
         } else {
234 234
           $planetrow['PLANET_GOVERNOR_LEVEL'] = 1;
@@ -260,8 +260,8 @@  discard block
 block discarded – undo
260 260
 
261 261
     lng_include('mrc_mercenary');
262 262
     int_planet_pretemplate($planetrow, $template);
263
-    foreach(sn_get_groups('governors') as $governor_id) {
264
-      if($planetrow['planet_type'] == PT_MOON && $governor_id == MRC_TECHNOLOGIST) {
263
+    foreach (sn_get_groups('governors') as $governor_id) {
264
+      if ($planetrow['planet_type'] == PT_MOON && $governor_id == MRC_TECHNOLOGIST) {
265 265
         continue;
266 266
       }
267 267
 
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
       'PAGE_HINT'   => classLocale::$lang['ov_manage_page_hint'],
314 314
     ));
315 315
 
316
-    foreach($result as &$a_result) {
316
+    foreach ($result as &$a_result) {
317 317
       $template->assign_block_vars('result', $a_result);
318 318
     }
319 319
 
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
   default:
324 324
     sn_sys_sector_buy();
325 325
 
326
-    if(sys_get_param_str('rename') && $new_name_unsafe = sys_get_param_str_unsafe('new_name')) {
326
+    if (sys_get_param_str('rename') && $new_name_unsafe = sys_get_param_str_unsafe('new_name')) {
327 327
       $planetrow['name'] = $new_name_unsafe;
328 328
       DBStaticPlanet::db_planet_update_set_by_id(
329 329
         $planetrow['id'],
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
 
359 359
     $planet_count = 0;
360 360
     $planets_query = DBStaticPlanet::db_planet_list_sorted($user, false, '*');
361
-    foreach($planets_query as $an_id => $UserPlanet) {
361
+    foreach ($planets_query as $an_id => $UserPlanet) {
362 362
       sn_db_transaction_start();
363 363
       $UserPlanet = sys_o_get_updated($user, $UserPlanet['id'], SN_TIME_NOW, false, true);
364 364
       sn_db_transaction_commit();
@@ -369,16 +369,16 @@  discard block
 block discarded – undo
369 369
 
370 370
       $planet_fleet_id = 0;
371 371
       $fleet_list = $template_planet['fleet_list'];
372
-      if($fleet_list['own']['count']) {
372
+      if ($fleet_list['own']['count']) {
373 373
         $planet_fleet_id = "p{$UserPlanet['id']}";
374 374
         $fleets_to_planet[$UserPlanet['id']] = tpl_parse_fleet_sn($fleet_list['own']['total'], $planet_fleet_id);
375 375
 //        $fleet_id++;tpl_parse_fleet_sn
376 376
       }
377
-      if($UserPlanet['planet_type'] == PT_MOON) {
377
+      if ($UserPlanet['planet_type'] == PT_MOON) {
378 378
         continue;
379 379
       }
380 380
       $moon = DBStaticPlanet::db_planet_by_parent($UserPlanet['id']);
381
-      if($moon) {
381
+      if ($moon) {
382 382
         $moon_fill = min(100, floor($moon['field_current'] / eco_planet_fields_max($moon) * 100));
383 383
       } else {
384 384
         $moon_fill = 0;
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
     tpl_assign_fleet($template, $fleets);
419 419
 
420 420
     $lune = $planetrow['planet_type'] == PT_PLANET ? DBStaticPlanet::db_planet_by_parent($planetrow['id']) : DBStaticPlanet::db_planet_by_id($planetrow['parent_planet']);
421
-    if($lune) {
421
+    if ($lune) {
422 422
       $template->assign_vars(array(
423 423
         'MOON_ID' => $lune['id'],
424 424
         'MOON_IMG' => $lune['image'],
@@ -430,15 +430,15 @@  discard block
 block discarded – undo
430 430
     $planet_fill = $planet_fill > 100 ? 100 : $planet_fill;
431 431
 
432 432
     $planet_recyclers_orbiting = 0;
433
-    foreach(classSupernova::$gc->groupRecyclers as $recycler_id) {
433
+    foreach (classSupernova::$gc->groupRecyclers as $recycler_id) {
434 434
       $planet_recyclers_orbiting += mrc_get_level($user, $planetrow, $recycler_id);
435 435
     }
436 436
 
437 437
     int_planet_pretemplate($planetrow, $template);
438 438
 
439 439
     $sn_group_ques = sn_get_groups('ques');
440
-    if(!defined('GAME_STRUCTURES_DISABLED') || !GAME_STRUCTURES_DISABLED) {
441
-      foreach(array(QUE_STRUCTURES => $sn_group_ques[QUE_STRUCTURES]) as $que_id => $que_type_data) {
440
+    if (!defined('GAME_STRUCTURES_DISABLED') || !GAME_STRUCTURES_DISABLED) {
441
+      foreach (array(QUE_STRUCTURES => $sn_group_ques[QUE_STRUCTURES]) as $que_id => $que_type_data) {
442 442
         $this_que = $que['ques'][$que_id][$user['id']][$planetrow['id']];
443 443
         $template->assign_block_vars('ques', array(
444 444
           'ID'     => $que_id,
@@ -446,8 +446,8 @@  discard block
 block discarded – undo
446 446
           'LENGTH' => empty($this_que) ? 0 : count($this_que),
447 447
         ));
448 448
 
449
-        if(!empty($this_que)) {
450
-          foreach($this_que as $que_item) {
449
+        if (!empty($this_que)) {
450
+          foreach ($this_que as $que_item) {
451 451
             $template->assign_block_vars('que', que_tpl_parse_element($que_item));
452 452
           }
453 453
         }
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
       'LENGTH' => $que_hangar_length,
462 462
     ));
463 463
 
464
-    if(!defined('GAME_DEFENSE_DISABLED') || !GAME_DEFENSE_DISABLED) {
464
+    if (!defined('GAME_DEFENSE_DISABLED') || !GAME_DEFENSE_DISABLED) {
465 465
       $que_hangar_length = tpl_assign_hangar($template, $planetrow, SUBQUE_DEFENSE);
466 466
       $template->assign_block_vars('ques', array(
467 467
         'ID'     => SUBQUE_DEFENSE,
@@ -473,12 +473,12 @@  discard block
 block discarded – undo
473 473
     $overview_planet_rows = $user['opt_int_overview_planet_rows'];
474 474
     $overview_planet_columns = $user['opt_int_overview_planet_columns'];
475 475
 
476
-    if($overview_planet_rows <= 0 && $overview_planet_columns <= 0) {
476
+    if ($overview_planet_rows <= 0 && $overview_planet_columns <= 0) {
477 477
       $overview_planet_rows = $user_option_list[OPT_INTERFACE]['opt_int_overview_planet_rows'];
478 478
       $overview_planet_columns = $user_option_list[OPT_INTERFACE]['opt_int_overview_planet_columns'];
479 479
     }
480 480
 
481
-    if($overview_planet_rows > 0 && $overview_planet_columns <= 0) {
481
+    if ($overview_planet_rows > 0 && $overview_planet_columns <= 0) {
482 482
       $overview_planet_columns = ceil($planet_count / $overview_planet_rows);
483 483
     }
484 484
 
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
     ));
536 536
     tpl_set_resource_info($template, $planetrow, $fleets_to_planet, 2);
537 537
 
538
-    foreach($result as &$a_result) {
538
+    foreach ($result as &$a_result) {
539 539
       $template->assign_block_vars('result', $a_result);
540 540
     }
541 541
 
Please login to merge, or discard this patch.
galaxy.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 use DBStatic\DBStaticUser;
12 12
 use Vector\Vector;
13 13
 
14
-include('common.' . substr(strrchr(__FILE__, '.'), 1));
14
+include('common.'.substr(strrchr(__FILE__, '.'), 1));
15 15
 
16 16
 lng_include('universe');
17 17
 lng_include('stat');
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 $uni_system = sys_get_param_int('system', $planetrow['system']);
22 22
 $planet = sys_get_param_int('planet', $planetrow['planet']);
23 23
 
24
-if($mode == 'name') {
24
+if ($mode == 'name') {
25 25
   require_once('includes/includes/uni_rename.php');
26 26
 }
27 27
 
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 
43 43
 $flying_fleet_count = FleetList::fleet_count_flying($user['id']);
44 44
 
45
-if($mode == 1) {
46
-} elseif($mode == 2 || $mode == 3) {
45
+if ($mode == 1) {
46
+} elseif ($mode == 2 || $mode == 3) {
47 47
   $planet = $planetrow['planet'];
48 48
 } else {
49 49
   $uni_galaxy = $planetrow['galaxy'];
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
   $planet = $planetrow['planet'];
52 52
 }
53 53
 
54
-$uni_galaxy = $uni_galaxy < 1 ? 1 : ($uni_galaxy > Vector::$knownGalaxies? Vector::$knownGalaxies: $uni_galaxy);
54
+$uni_galaxy = $uni_galaxy < 1 ? 1 : ($uni_galaxy > Vector::$knownGalaxies ? Vector::$knownGalaxies : $uni_galaxy);
55 55
 $uni_system = $uni_system < 1 ? 1 : ($uni_system > Vector::$knownSystems ? Vector::$knownSystems : $uni_system);
56 56
 $planet = $planet < 1 ? 1 : ($planet > Vector::$knownPlanets + 1 ? Vector::$knownPlanets + 1 : $planet);
57 57
 
@@ -69,8 +69,8 @@  discard block
 block discarded – undo
69 69
 $PhalanxRange = GetPhalanxRange($HavePhalanx);
70 70
 
71 71
 $planet_precache_query = DBStaticPlanet::db_planet_list_in_system($uni_galaxy, $uni_system);
72
-if(!empty($planet_precache_query)) {
73
-  foreach($planet_precache_query as $planet_row) {
72
+if (!empty($planet_precache_query)) {
73
+  foreach ($planet_precache_query as $planet_row) {
74 74
     $planet_list[$planet_row['planet']][$planet_row['planet_type']] = $planet_row;
75 75
   }
76 76
 }
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
  * @var Fleet[][][] $fleet_list
89 89
  */
90 90
 $fleet_list = array();
91
-foreach($system_fleet_list->_container as $objFleetSystem) {
92
-  if(!$objFleetSystem->isReturning()) {
91
+foreach ($system_fleet_list->_container as $objFleetSystem) {
92
+  if (!$objFleetSystem->isReturning()) {
93 93
     $fleet_planet = $objFleetSystem->fleet_end_planet;
94 94
     $fleet_type = $objFleetSystem->fleet_end_type;
95 95
   } else {
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 $recycler_info = array();
105 105
 $planet_recyclers_orbiting = 0;
106 106
 $recyclers_fleet = array();
107
-foreach(classSupernova::$gc->groupRecyclers as $recycler_id) {
107
+foreach (classSupernova::$gc->groupRecyclers as $recycler_id) {
108 108
   $recycler_info[$recycler_id] = get_ship_data($recycler_id, $user);
109 109
   $recyclers_fleet[$recycler_id] = mrc_get_level($user, $planetrow, $recycler_id);
110 110
   $planet_recyclers_orbiting += $recyclers_fleet[$recycler_id];
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 $fleet_id = 1;
115 115
 $fleets = array();
116 116
 $config_game_max_planet = Vector::$knownPlanets + 1;
117
-for($Planet = 1; $Planet < $config_game_max_planet; $Planet++) {
117
+for ($Planet = 1; $Planet < $config_game_max_planet; $Planet++) {
118 118
   unset($uni_galaxyRowPlanet);
119 119
   unset($uni_galaxyRowMoon);
120 120
   unset($uni_galaxyRowUser);
@@ -124,17 +124,17 @@  discard block
 block discarded – undo
124 124
   $uni_galaxyRowPlanet = $planet_list[$Planet][PT_PLANET];
125 125
 
126 126
   $planet_fleet_id = 0;
127
-  if($uni_galaxyRowPlanet['destruyed']) {
127
+  if ($uni_galaxyRowPlanet['destruyed']) {
128 128
     CheckAbandonPlanetState($uni_galaxyRowPlanet);
129
-  } elseif($uni_galaxyRowPlanet['id']) {
130
-    if($cached['users'][$uni_galaxyRowPlanet['id_owner']]) {
129
+  } elseif ($uni_galaxyRowPlanet['id']) {
130
+    if ($cached['users'][$uni_galaxyRowPlanet['id_owner']]) {
131 131
       $uni_galaxyRowUser = $cached['users'][$uni_galaxyRowPlanet['id_owner']];
132 132
     } else {
133 133
       $uni_galaxyRowUser = DBStaticUser::db_user_by_id($uni_galaxyRowPlanet['id_owner']);
134 134
       $cached['users'][$uni_galaxyRowUser['id']] = $uni_galaxyRowUser;
135 135
     }
136 136
 
137
-    if(!$uni_galaxyRowUser['id']) {
137
+    if (!$uni_galaxyRowUser['id']) {
138 138
       classSupernova::$debug->warning("Planet '{$uni_galaxyRowPlanet['name']}' [{$uni_galaxy}:{$uni_system}:{$Planet}] has no owner!", 'Userless planet', 503);
139 139
       $uni_galaxyRowPlanet['destruyed'] = SN_TIME_NOW + 60 * 60 * 24;
140 140
       $uni_galaxyRowPlanet['id_owner'] = 0;
@@ -147,10 +147,10 @@  discard block
 block discarded – undo
147 147
       );
148 148
     }
149 149
 
150
-    if($uni_galaxyRowUser['id']) {
150
+    if ($uni_galaxyRowUser['id']) {
151 151
       $planetcount++;
152
-      if($uni_galaxyRowUser['ally_id']) {
153
-        if($cached['allies'][$uni_galaxyRowUser['ally_id']]) {
152
+      if ($uni_galaxyRowUser['ally_id']) {
153
+        if ($cached['allies'][$uni_galaxyRowUser['ally_id']]) {
154 154
           $allyquery = $cached['allies'][$uni_galaxyRowUser['ally_id']];
155 155
         } else {
156 156
           $allyquery = DBStaticAlly::db_ally_get_by_id($uni_galaxyRowUser['ally_id']);
@@ -159,19 +159,19 @@  discard block
 block discarded – undo
159 159
       }
160 160
 
161 161
       $fleets_to_planet = flt_get_fleets_to_planet_by_array_of_Fleet($fleet_list[$Planet][PT_PLANET]);
162
-      if(!empty($fleets_to_planet['own']['count'])) {
162
+      if (!empty($fleets_to_planet['own']['count'])) {
163 163
         $planet_fleet_id = $fleet_id;
164 164
         $fleets[] = tpl_parse_fleet_sn($fleets_to_planet['own']['total'], $fleet_id);
165 165
         $fleet_id++;
166 166
       }
167 167
 
168 168
       $uni_galaxyRowMoon = $planet_list[$Planet][PT_MOON];
169
-      if($uni_galaxyRowMoon['destruyed']) {
169
+      if ($uni_galaxyRowMoon['destruyed']) {
170 170
         CheckAbandonPlanetState($uni_galaxyRowMoon);
171 171
       } else {
172 172
         $moon_fleet_id = 0;
173 173
         $fleets_to_planet = flt_get_fleets_to_planet_by_array_of_Fleet($fleet_list[$Planet][PT_MOON]);
174
-        if(!empty($fleets_to_planet['own']['count'])) {
174
+        if (!empty($fleets_to_planet['own']['count'])) {
175 175
           $moon_fleet_id = $fleet_id;
176 176
           $fleets[] = tpl_parse_fleet_sn($fleets_to_planet['own']['total'], $fleet_id);
177 177
           $fleet_id++;
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
 
183 183
   $recyclers_incoming_capacity = 0;
184 184
   $uni_galaxyRowPlanet['debris'] = $uni_galaxyRowPlanet['debris_metal'] + $uni_galaxyRowPlanet['debris_crystal'];
185
-  if($uni_galaxyRowPlanet['debris']) {
186
-    if(!empty($fleet_list[$Planet][PT_DEBRIS])) {
187
-      foreach($fleet_list[$Planet][PT_DEBRIS] as $objFleetToDebris) {
188
-        if($objFleetToDebris->playerOwnerId == $user['id']) {
185
+  if ($uni_galaxyRowPlanet['debris']) {
186
+    if (!empty($fleet_list[$Planet][PT_DEBRIS])) {
187
+      foreach ($fleet_list[$Planet][PT_DEBRIS] as $objFleetToDebris) {
188
+        if ($objFleetToDebris->playerOwnerId == $user['id']) {
189 189
           $recyclers_incoming_capacity += $objFleetToDebris->shipsGetCapacityRecyclers($recycler_info);
190 190
         }
191 191
       }
@@ -262,21 +262,21 @@  discard block
 block discarded – undo
262 262
 
263 263
 tpl_assign_fleet($template, $fleets);
264 264
 
265
-foreach(sn_get_groups('defense_active') as $unit_id) {
265
+foreach (sn_get_groups('defense_active') as $unit_id) {
266 266
   $template->assign_block_vars('defense_active', array(
267 267
     'ID'   => $unit_id,
268 268
     'NAME' => classLocale::$lang['tech'][$unit_id],
269 269
   ));
270 270
 }
271 271
 
272
-foreach($cached['users'] as $PlanetUser) {
273
-  if(!$PlanetUser) {
272
+foreach ($cached['users'] as $PlanetUser) {
273
+  if (!$PlanetUser) {
274 274
     continue;
275 275
   }
276 276
 
277 277
   $user_ally = $cached['allies'][$PlanetUser['ally_id']];
278
-  if(isset($user_ally)) {
279
-    if($PlanetUser['id'] == $user_ally['ally_owner']) {
278
+  if (isset($user_ally)) {
279
+    if ($PlanetUser['id'] == $user_ally['ally_owner']) {
280 280
       $user_rank_title = $user_ally['ally_owner_range'];
281 281
     } else {
282 282
       $ally_ranks = explode(';', $user_ally['ranklist']);
@@ -299,8 +299,8 @@  discard block
 block discarded – undo
299 299
   ));
300 300
 }
301 301
 
302
-foreach($cached['allies'] as $PlanetAlly) {
303
-  if($PlanetAlly) {
302
+foreach ($cached['allies'] as $PlanetAlly) {
303
+  if ($PlanetAlly) {
304 304
     $template->assign_block_vars('alliances', array(
305 305
       'ID'      => $PlanetAlly['id'],
306 306
       'NAME_JS' => js_safe_string($PlanetAlly['ally_name']),
Please login to merge, or discard this patch.