@@ -52,82 +52,82 @@ |
||
52 | 52 | $gc = $this; |
53 | 53 | |
54 | 54 | // Default db |
55 | - $gc->db = function ($c) { |
|
55 | + $gc->db = function($c) { |
|
56 | 56 | classSupernova::$db = $db = new \db_mysql($c); |
57 | 57 | |
58 | 58 | return $db; |
59 | 59 | }; |
60 | 60 | |
61 | - $gc->debug = function ($c) { |
|
61 | + $gc->debug = function($c) { |
|
62 | 62 | return new \debug(); |
63 | 63 | }; |
64 | 64 | |
65 | - $gc->types = function ($c) { |
|
65 | + $gc->types = function($c) { |
|
66 | 66 | return new \Common\Types(); |
67 | 67 | }; |
68 | 68 | |
69 | - $gc->cache = function ($c) { |
|
69 | + $gc->cache = function($c) { |
|
70 | 70 | return new \classCache(classSupernova::$cache_prefix); |
71 | 71 | }; |
72 | 72 | |
73 | - $gc->config = function ($c) { |
|
73 | + $gc->config = function($c) { |
|
74 | 74 | return new \classConfig(classSupernova::$cache_prefix); |
75 | 75 | }; |
76 | 76 | |
77 | - $gc->localePlayer = function (GlobalContainer $c) { |
|
77 | + $gc->localePlayer = function(GlobalContainer $c) { |
|
78 | 78 | return new \classLocale($c->config->server_locale_log_usage); |
79 | 79 | }; |
80 | 80 | |
81 | - $gc->dbGlobalRowOperator = function (GlobalContainer $c) { |
|
81 | + $gc->dbGlobalRowOperator = function(GlobalContainer $c) { |
|
82 | 82 | return new \DbRowDirectOperator($c->db); |
83 | 83 | }; |
84 | 84 | |
85 | - $gc->query = $gc->factory(function (GlobalContainer $c) { |
|
85 | + $gc->query = $gc->factory(function(GlobalContainer $c) { |
|
86 | 86 | return new \DbQueryConstructor($c->db); |
87 | 87 | }); |
88 | 88 | |
89 | - $gc->cacheOperator = function (GlobalContainer $gc) { |
|
89 | + $gc->cacheOperator = function(GlobalContainer $gc) { |
|
90 | 90 | return new \SnDbCachedOperator($gc); |
91 | 91 | }; |
92 | 92 | |
93 | 93 | $gc->snCacheClass = 'SnCache'; |
94 | - $gc->snCache = function (GlobalContainer $gc) { |
|
94 | + $gc->snCache = function(GlobalContainer $gc) { |
|
95 | 95 | return $gc->db->snCache; |
96 | 96 | }; |
97 | 97 | |
98 | 98 | $gc->buddyClass = 'Buddy\BuddyModel'; |
99 | - $gc->buddyModel = function (GlobalContainer $c) { |
|
99 | + $gc->buddyModel = function(GlobalContainer $c) { |
|
100 | 100 | return new $c->buddyClass($c); |
101 | 101 | }; |
102 | 102 | |
103 | - $gc->unitModel = function (GlobalContainer $c) { |
|
103 | + $gc->unitModel = function(GlobalContainer $c) { |
|
104 | 104 | return new \V2Unit\V2UnitModel($c); |
105 | 105 | }; |
106 | - $gc->unitList = $this->factory(function (GlobalContainer $c) { |
|
106 | + $gc->unitList = $this->factory(function(GlobalContainer $c) { |
|
107 | 107 | return new \V2Unit\V2UnitList($c); |
108 | 108 | }); |
109 | 109 | |
110 | - $gc->fleetModel = function (GlobalContainer $c) { |
|
110 | + $gc->fleetModel = function(GlobalContainer $c) { |
|
111 | 111 | return new V2FleetModel($c); |
112 | 112 | }; |
113 | 113 | |
114 | - $gc->planetRenderer = function (GlobalContainer $c) { |
|
114 | + $gc->planetRenderer = function(GlobalContainer $c) { |
|
115 | 115 | return new PlanetRenderer($c); |
116 | 116 | }; |
117 | 117 | |
118 | - $gc->fleetRenderer = function (GlobalContainer $c) { |
|
118 | + $gc->fleetRenderer = function(GlobalContainer $c) { |
|
119 | 119 | return new \FleetRenderer($c); |
120 | 120 | }; |
121 | 121 | |
122 | - $gc->groupFleet = function (GlobalContainer $c) { |
|
122 | + $gc->groupFleet = function(GlobalContainer $c) { |
|
123 | 123 | return sn_get_groups('fleet'); |
124 | 124 | }; |
125 | 125 | |
126 | - $gc->groupFleetAndMissiles = function (GlobalContainer $c) { |
|
126 | + $gc->groupFleetAndMissiles = function(GlobalContainer $c) { |
|
127 | 127 | return sn_get_groups(array('fleet', GROUP_STR_MISSILES)); |
128 | 128 | }; |
129 | 129 | |
130 | - $gc->groupRecyclers = function (GlobalContainer $c) { |
|
130 | + $gc->groupRecyclers = function(GlobalContainer $c) { |
|
131 | 131 | return sn_get_groups('flt_recyclers'); |
132 | 132 | }; |
133 | 133 |
@@ -171,6 +171,10 @@ discard block |
||
171 | 171 | * @return bool |
172 | 172 | */ |
173 | 173 | // OK v4.5 |
174 | + |
|
175 | + /** |
|
176 | + * @param string $account_name_unsafe |
|
177 | + */ |
|
174 | 178 | public function db_get_by_name($account_name_unsafe) { |
175 | 179 | $this->reset(); |
176 | 180 | |
@@ -207,6 +211,11 @@ discard block |
||
207 | 211 | * |
208 | 212 | */ |
209 | 213 | // OK v4.5 |
214 | + |
|
215 | + /** |
|
216 | + * @param string $account_name_unsafe |
|
217 | + * @param string $email_unsafe |
|
218 | + */ |
|
210 | 219 | public function db_get_by_name_or_email($account_name_unsafe, $email_unsafe) { |
211 | 220 | $this->reset(); |
212 | 221 | |
@@ -223,6 +232,13 @@ discard block |
||
223 | 232 | * @throws Exception |
224 | 233 | */ |
225 | 234 | // OK v4.5 |
235 | + |
|
236 | + /** |
|
237 | + * @param string $account_name_unsafe |
|
238 | + * @param string $password_raw |
|
239 | + * @param string $email_unsafe |
|
240 | + * @param string $language_unsafe |
|
241 | + */ |
|
226 | 242 | public function db_create($account_name_unsafe, $password_raw, $email_unsafe, $language_unsafe = null, $salt_unsafe = null) { |
227 | 243 | $this->reset(); |
228 | 244 | |
@@ -317,6 +333,11 @@ discard block |
||
317 | 333 | * @return int|string |
318 | 334 | */ |
319 | 335 | // OK 4.8 |
336 | + |
|
337 | + /** |
|
338 | + * @param integer $change_type |
|
339 | + * @param double $metamatter |
|
340 | + */ |
|
320 | 341 | protected function db_mm_log_insert($comment, $change_type, $metamatter, $user_id_unsafe) { |
321 | 342 | $provider_id_safe = intval(core_auth::$main_provider->provider_id); |
322 | 343 | //$account_id_safe = $this->db->db_escape($this->account_id); |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | $this->reset(); |
80 | 80 | $this->db = is_object($db) ? $db : classSupernova::$db; |
81 | 81 | |
82 | - foreach($this->table_check as $table_name) { |
|
83 | - if(empty($this->db->table_list[$table_name])) { |
|
82 | + foreach ($this->table_check as $table_name) { |
|
83 | + if (empty($this->db->table_list[$table_name])) { |
|
84 | 84 | die('Если вы видите это сообщение первый раз после обновления релиза - просто перегрузите страницу.<br /> |
85 | 85 | В противном случае - сообщите Администрации сервера об ошибке.<br/> |
86 | 86 | Не хватает таблицы для работы системы авторизации: ' . $table_name); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | */ |
105 | 105 | // OK v4.6 |
106 | 106 | public function password_change($old_password_unsafe, $new_password_unsafe, $salt_unsafe = null) { |
107 | - if(!$this->password_check($old_password_unsafe)) { |
|
107 | + if (!$this->password_check($old_password_unsafe)) { |
|
108 | 108 | return false; |
109 | 109 | } |
110 | 110 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | // OK v4.5 |
126 | 126 | public function assign_from_db_row($row) { |
127 | 127 | $this->reset(); |
128 | - if(empty($row) || !is_array($row)) { |
|
128 | + if (empty($row) || !is_array($row)) { |
|
129 | 129 | return false; |
130 | 130 | } |
131 | 131 | $this->account_id = $row['account_id']; |
@@ -242,11 +242,11 @@ discard block |
||
242 | 242 | `account_email` = LOWER('{$email_safe}'), |
243 | 243 | `account_language` = '{$language_safe}'" |
244 | 244 | ); |
245 | - if(!$result) { |
|
245 | + if (!$result) { |
|
246 | 246 | throw new Exception(REGISTER_ERROR_ACCOUNT_CREATE, ERR_ERROR); |
247 | 247 | } |
248 | 248 | |
249 | - if(!($account_id = $this->db->db_insert_id())) { |
|
249 | + if (!($account_id = $this->db->db_insert_id())) { |
|
250 | 250 | throw new Exception(REGISTER_ERROR_ACCOUNT_CREATE, ERR_ERROR); |
251 | 251 | } |
252 | 252 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | WHERE `account_id` = '{$account_id_safe}'" |
277 | 277 | ) ? true : false; |
278 | 278 | |
279 | - if($result) { |
|
279 | + if ($result) { |
|
280 | 280 | $result = $this->db_get_by_id($this->account_id); |
281 | 281 | } |
282 | 282 | |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | public function metamatter_change($change_type, $metamatter, $comment = '', $already_changed = false) { |
364 | 364 | global $debug, $mm_change_legit; |
365 | 365 | |
366 | - if(!$this->is_exists || !($metamatter = round(floatval($metamatter)))) { |
|
366 | + if (!$this->is_exists || !($metamatter = round(floatval($metamatter)))) { |
|
367 | 367 | $debug->error('Ошибка при попытке манипуляции с ММ'); |
368 | 368 | |
369 | 369 | return false; |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | |
374 | 374 | $mm_change_legit = true; |
375 | 375 | // $sn_data_metamatter_db_name = pname_resource_name(RES_METAMATTER); |
376 | - if($already_changed) { |
|
376 | + if ($already_changed) { |
|
377 | 377 | $metamatter_total_delta = 0; |
378 | 378 | $result = -1; |
379 | 379 | } else { |
@@ -387,13 +387,13 @@ discard block |
||
387 | 387 | ($metamatter_total_delta ? ", `account_immortal` = IF(`account_metamatter_total` + '{$metamatter_total_delta}' >= {$classConfig->player_metamatter_immortal}, NOW(), `account_immortal`), `account_metamatter_total` = `account_metamatter_total` + '{$metamatter_total_delta}'" : '') . |
388 | 388 | " WHERE `account_id` = {$account_id_safe}" |
389 | 389 | ); |
390 | - if(!$result) { |
|
390 | + if (!$result) { |
|
391 | 391 | $debug->error("Error adjusting Metamatter for player ID {$this->account_id} (Player Not Found?) with {$metamatter}. Reason: {$comment}", 'Metamatter Change', 402); |
392 | 392 | } |
393 | 393 | $result = classSupernova::$db->db_affected_rows(); |
394 | 394 | } |
395 | 395 | |
396 | - if(empty(core_auth::$user['id'])) { |
|
396 | + if (empty(core_auth::$user['id'])) { |
|
397 | 397 | $user_list = PlayerToAccountTranslate::db_translate_get_users_from_account_list(core_auth::$main_provider->provider_id, $this->account_id); |
398 | 398 | reset($user_list); |
399 | 399 | $user_id_unsafe = key($user_list); |
@@ -402,30 +402,30 @@ discard block |
||
402 | 402 | } |
403 | 403 | $user_id_safe = $this->db->db_escape($user_id_unsafe); |
404 | 404 | |
405 | - if(!$result) { |
|
405 | + if (!$result) { |
|
406 | 406 | $debug->error("Error adjusting Metamatter for player ID {$this->account_id} (Player Not Found?) with {$metamatter}. Reason: {$comment}", 'Metamatter Change', 402); |
407 | 407 | } |
408 | 408 | |
409 | - if(!$already_changed) { |
|
409 | + if (!$already_changed) { |
|
410 | 410 | $this->account_metamatter += $metamatter; |
411 | 411 | $this->account_metamatter_total += $metamatter_total_delta; |
412 | 412 | } |
413 | 413 | |
414 | - if(is_array($comment)) { |
|
414 | + if (is_array($comment)) { |
|
415 | 415 | $comment = call_user_func_array('sprintf', $comment); |
416 | 416 | } |
417 | 417 | |
418 | 418 | $result = $this->db_mm_log_insert($comment, $change_type, $metamatter, $user_id_unsafe); |
419 | 419 | |
420 | - if($metamatter > 0 && !empty($user_id_safe)) { |
|
420 | + if ($metamatter > 0 && !empty($user_id_safe)) { |
|
421 | 421 | $old_referral = db_referral_get_by_id($user_id_safe); |
422 | - if($old_referral['id']) { |
|
422 | + if ($old_referral['id']) { |
|
423 | 423 | $dark_matter_from_metamatter = $metamatter * AFFILIATE_MM_TO_REFERRAL_DM; |
424 | 424 | db_referral_update_dm($user_id_safe, $dark_matter_from_metamatter); |
425 | 425 | $new_referral = db_referral_get_by_id($user_id_safe); |
426 | 426 | |
427 | 427 | $partner_bonus = floor($new_referral['dark_matter'] / classSupernova::$config->rpg_bonus_divisor) - ($old_referral['dark_matter'] >= classSupernova::$config->rpg_bonus_minimum ? floor($old_referral['dark_matter'] / classSupernova::$config->rpg_bonus_divisor) : 0); |
428 | - if($partner_bonus > 0 && $new_referral['dark_matter'] >= classSupernova::$config->rpg_bonus_minimum) { |
|
428 | + if ($partner_bonus > 0 && $new_referral['dark_matter'] >= classSupernova::$config->rpg_bonus_minimum) { |
|
429 | 429 | rpg_points_change($new_referral['id_partner'], RPG_REFERRAL_BOUGHT_MM, $partner_bonus, "Incoming MM From Referral ID {$user_id_safe}"); |
430 | 430 | } |
431 | 431 | } |
@@ -90,7 +90,7 @@ |
||
90 | 90 | /** |
91 | 91 | * @param KeyedContainer $cEntity |
92 | 92 | */ |
93 | - protected function onSaveUnchanged($cEntity){ |
|
93 | + protected function onSaveUnchanged($cEntity) { |
|
94 | 94 | // TODO - or just save nothing ????? |
95 | 95 | // throw new \Exception('EntityModel isNotEmpty, have dbId and not CHANGED! It can\'t be!'); |
96 | 96 | // Do nothing |
@@ -90,7 +90,7 @@ |
||
90 | 90 | /** |
91 | 91 | * @param KeyedContainer $cEntity |
92 | 92 | */ |
93 | - protected function onSaveUnchanged($cEntity){ |
|
93 | + protected function onSaveUnchanged($cEntity) { |
|
94 | 94 | // TODO - or just save nothing ????? |
95 | 95 | // throw new \Exception('EntityModel isNotEmpty, have dbId and not CHANGED! It can\'t be!'); |
96 | 96 | // Do nothing |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | /** |
165 | 165 | * @param string $query |
166 | 166 | * |
167 | - * @return mixed|string |
|
167 | + * @return string |
|
168 | 168 | */ |
169 | 169 | public function replaceTablePlaceholders($query) { |
170 | 170 | $sql = $query; |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | } |
179 | 179 | |
180 | 180 | /** |
181 | - * @param $query |
|
181 | + * @param string $query |
|
182 | 182 | */ |
183 | 183 | protected function logQuery($query) { |
184 | 184 | if (!classSupernova::$config->debug) { |
@@ -290,6 +290,7 @@ discard block |
||
290 | 290 | * @param array $fields |
291 | 291 | * @param array $where |
292 | 292 | * @param bool $isOneRecord |
293 | + * @param boolean $forUpdate |
|
293 | 294 | * |
294 | 295 | * @return array|bool|mysqli_result|null |
295 | 296 | * |
@@ -332,6 +333,10 @@ discard block |
||
332 | 333 | |
333 | 334 | // |
334 | 335 | // INSERT/REPLACE ---------------------------------------------------------------------------------------------------- |
336 | + |
|
337 | + /** |
|
338 | + * @param string $query |
|
339 | + */ |
|
335 | 340 | public function doInsertComplex($query) { |
336 | 341 | return $this->doSql($query); |
337 | 342 | } |
@@ -408,7 +413,7 @@ discard block |
||
408 | 413 | * Self-contained - means no params used |
409 | 414 | * Such queries usually used to make large amount of in-base calculations |
410 | 415 | * |
411 | - * @param $query |
|
416 | + * @param string $query |
|
412 | 417 | * |
413 | 418 | * @return array|bool|mysqli_result|null |
414 | 419 | */ |
@@ -425,13 +430,16 @@ discard block |
||
425 | 430 | } |
426 | 431 | |
427 | 432 | /** |
428 | - * @param $DbQuery DbQuery |
|
433 | + * @param DbQuery $DbQuery DbQuery |
|
429 | 434 | */ |
430 | 435 | public function doUpdateDbQueryAdjust($DbQuery) { |
431 | 436 | return $this->doUpdateDbQuery($DbQuery); |
432 | 437 | } |
433 | 438 | |
434 | 439 | |
440 | + /** |
|
441 | + * @param boolean $isOneRecord |
|
442 | + */ |
|
435 | 443 | protected function doUpdateWhere($table, $fieldsSet, $fieldsAdjust = array(), $where = array(), $isOneRecord = DB_RECORDS_ALL, $whereDanger = array()) { |
436 | 444 | $query = DbQuery::build($this) |
437 | 445 | ->setTable($table) |
@@ -450,6 +458,9 @@ discard block |
||
450 | 458 | return $this->doUpdateWhere($table, $fieldsAndValues, array(), $where, DB_RECORD_ONE); |
451 | 459 | } |
452 | 460 | |
461 | + /** |
|
462 | + * @param string $table |
|
463 | + */ |
|
453 | 464 | public function doUpdateTableSet($table, $fieldsAndValues, $where = array()) { |
454 | 465 | return $this->doUpdateWhere($table, $fieldsAndValues, array(), $where, DB_RECORDS_ALL); |
455 | 466 | } |
@@ -559,6 +570,10 @@ discard block |
||
559 | 570 | // |
560 | 571 | // OTHER FUNCTIONS ---------------------------------------------------------------------------------------------------------- |
561 | 572 | // TODO Заменить это на новый логгер |
573 | + |
|
574 | + /** |
|
575 | + * @param string $query |
|
576 | + */ |
|
562 | 577 | protected function security_watch_user_queries($query) { |
563 | 578 | global $user; |
564 | 579 | |
@@ -582,6 +597,9 @@ discard block |
||
582 | 597 | } |
583 | 598 | |
584 | 599 | |
600 | + /** |
|
601 | + * @param string $query |
|
602 | + */ |
|
585 | 603 | public function security_query_check_bad_words($query) { |
586 | 604 | if ($this->skipQueryCheck) { |
587 | 605 | return; |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | |
590 | 590 | global $user, $dm_change_legit, $mm_change_legit; |
591 | 591 | |
592 | - switch(true) { |
|
592 | + switch (true) { |
|
593 | 593 | case stripos($query, 'RUNCATE TABL') != false: |
594 | 594 | case stripos($query, 'ROP TABL') != false: |
595 | 595 | case stripos($query, 'ENAME TABL') != false: |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | $prefix_length = strlen($this->db_prefix); |
652 | 652 | |
653 | 653 | $tl = array(); |
654 | - while($row = $this->db_fetch($query)) { |
|
654 | + while ($row = $this->db_fetch($query)) { |
|
655 | 655 | foreach ($row as $table_name) { |
656 | 656 | if (strpos($table_name, $this->db_prefix) === 0) { |
657 | 657 | $table_name = substr($table_name, $prefix_length); |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | if (is_bool($query)) { |
786 | 786 | throw new Exception('Result of SHOW STATUS command is boolean - which should never happen. Connection to DB is lost?'); |
787 | 787 | } |
788 | - while($row = db_fetch($query)) { |
|
788 | + while ($row = db_fetch($query)) { |
|
789 | 789 | $result[$row['Variable_name']] = $row['Value']; |
790 | 790 | } |
791 | 791 |
@@ -20,17 +20,17 @@ discard block |
||
20 | 20 | |
21 | 21 | $sensorLevel = mrc_get_level($user, $planetrow, STRUC_MOON_PHALANX); |
22 | 22 | if (!intval($sensorLevel)) { |
23 | - message (classLocale::$lang['phalanx_nosensoravailable'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
23 | + message(classLocale::$lang['phalanx_nosensoravailable'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | if ($planetrow['planet_type'] != PT_MOON) { |
27 | - message (classLocale::$lang['phalanx_onlyformoons'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
27 | + message(classLocale::$lang['phalanx_onlyformoons'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | $scan_galaxy = sys_get_param_int('galaxy'); |
31 | 31 | $scan_system = sys_get_param_int('system'); |
32 | 32 | $scan_planet = sys_get_param_int('planet'); |
33 | -$scan_planet_type = 1; // sys_get_param_int('planettype'); |
|
33 | +$scan_planet_type = 1; // sys_get_param_int('planettype'); |
|
34 | 34 | $id = sys_get_param_id('id'); |
35 | 35 | |
36 | 36 | $source_galaxy = $planetrow['galaxy']; |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | $sensorRange = GetPhalanxRange($sensorLevel); |
41 | 41 | |
42 | 42 | $system_distance = abs($source_system - $scan_system); |
43 | -if($system_distance > $sensorRange || $scan_galaxy != $source_galaxy) |
|
43 | +if ($system_distance > $sensorRange || $scan_galaxy != $source_galaxy) |
|
44 | 44 | { |
45 | - message (classLocale::$lang['phalanx_rangeerror'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
45 | + message(classLocale::$lang['phalanx_rangeerror'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | $cost = $sensorLevel * 1000; |
@@ -53,20 +53,20 @@ discard block |
||
53 | 53 | } |
54 | 54 | |
55 | 55 | $planet_scanned = DBStaticPlanet::db_planet_by_gspt($scan_galaxy, $scan_system, $scan_planet, $scan_planet_type); |
56 | -if(!$planet_scanned['id']) |
|
56 | +if (!$planet_scanned['id']) |
|
57 | 57 | { |
58 | 58 | message(classLocale::$lang['phalanx_planet_not_exists'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
59 | 59 | } |
60 | 60 | |
61 | -if($planet_scanned['destruyed']) |
|
61 | +if ($planet_scanned['destruyed']) |
|
62 | 62 | { |
63 | - message (classLocale::$lang['phalanx_planet_destroyed'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
63 | + message(classLocale::$lang['phalanx_planet_destroyed'], classLocale::$lang['tech'][STRUC_MOON_PHALANX], '', 3); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | DBStaticPlanet::db_planet_update_adjust_by_id( |
67 | 67 | $user['current_planet'], |
68 | 68 | array( |
69 | - 'deuterium' => - $cost, |
|
69 | + 'deuterium' => -$cost, |
|
70 | 70 | ) |
71 | 71 | ); |
72 | 72 |
@@ -83,7 +83,7 @@ |
||
83 | 83 | } |
84 | 84 | } |
85 | 85 | |
86 | - if(!empty($SubQry)) { |
|
86 | + if (!empty($SubQry)) { |
|
87 | 87 | DBStaticPlanet::db_planet_update_set_by_id( |
88 | 88 | $planetrow['id'], |
89 | 89 | $SubQry |
@@ -8,12 +8,12 @@ discard block |
||
8 | 8 | |
9 | 9 | global $user; |
10 | 10 | |
11 | -if($user['authlevel'] < AUTH_LEVEL_DEVELOPER) { |
|
11 | +if ($user['authlevel'] < AUTH_LEVEL_DEVELOPER) { |
|
12 | 12 | $error_message = classSupernova::$config->game_mode == GAME_BLITZ ? 'sys_blitz_page_disabled' : ( |
13 | 13 | !classSupernova::$config->game_blitz_register ? 'sys_blitz_registration_disabled' : '' |
14 | 14 | ); |
15 | 15 | |
16 | - if($error_message) { |
|
16 | + if ($error_message) { |
|
17 | 17 | message(classLocale::$lang[$error_message], classLocale::$lang['sys_error'], 'overview.php', 10); |
18 | 18 | die(); |
19 | 19 | } |
@@ -22,16 +22,16 @@ discard block |
||
22 | 22 | $current_round = intval(classSupernova::$config->db_loadItem('game_blitz_register_round')); |
23 | 23 | $current_price = intval(classSupernova::$config->db_loadItem('game_blitz_register_price')); |
24 | 24 | |
25 | -if(classSupernova::$config->db_loadItem('game_blitz_register') == BLITZ_REGISTER_OPEN && (sys_get_param_str('register_me') || sys_get_param_str('register_me_not'))) { |
|
25 | +if (classSupernova::$config->db_loadItem('game_blitz_register') == BLITZ_REGISTER_OPEN && (sys_get_param_str('register_me') || sys_get_param_str('register_me_not'))) { |
|
26 | 26 | sn_db_transaction_start(); |
27 | 27 | $user = DBStaticUser::db_user_by_id($user['id'], true); |
28 | 28 | $is_registered = db_blitz_reg_get_id_by_player_and_round($user, $current_round); |
29 | - if(sys_get_param_str('register_me')) { |
|
30 | - if(empty($is_registered) && mrc_get_level($user, null, RES_METAMATTER) >= $current_price) { |
|
29 | + if (sys_get_param_str('register_me')) { |
|
30 | + if (empty($is_registered) && mrc_get_level($user, null, RES_METAMATTER) >= $current_price) { |
|
31 | 31 | db_blitz_reg_insert($user['id'], $current_round); |
32 | 32 | classSupernova::$auth->account->metamatter_change(RPG_BLITZ_REGISTRATION, -$current_price, "Регистрация в раунде {$current_round} Блица"); |
33 | 33 | } |
34 | - } elseif(sys_get_param_str('register_me_not') && !empty($is_registered)) { |
|
34 | + } elseif (sys_get_param_str('register_me_not') && !empty($is_registered)) { |
|
35 | 35 | db_blitz_reg_delete($user['id'], $current_round); |
36 | 36 | classSupernova::$auth->account->metamatter_change(RPG_BLITZ_REGISTRATION_CANCEL, $current_price, "Отмена регистрации в раунде {$current_round} Блица"); |
37 | 37 | } |
@@ -46,17 +46,17 @@ discard block |
||
46 | 46 | $blitz_players = 0; |
47 | 47 | $blitz_prize_dark_matter = 0; |
48 | 48 | $blitz_prize_places = 0; |
49 | -if($user['authlevel'] >= AUTH_LEVEL_DEVELOPER) { |
|
50 | - if(sys_get_param_str('generate')) { |
|
49 | +if ($user['authlevel'] >= AUTH_LEVEL_DEVELOPER) { |
|
50 | + if (sys_get_param_str('generate')) { |
|
51 | 51 | $next_id = 0; |
52 | 52 | $query = db_blitz_reg_get_random_id($current_round); |
53 | - while($row = db_fetch($query)) { |
|
53 | + while ($row = db_fetch($query)) { |
|
54 | 54 | $next_id++; |
55 | 55 | $blitz_name = 'Игрок' . $next_id; |
56 | 56 | $blitz_password = sys_random_string(8); |
57 | 57 | db_blitz_reg_update_with_name_and_password($blitz_name, $blitz_password, $row['id'], $current_round); |
58 | 58 | } |
59 | - } elseif(sys_get_param_str('import_generated')) { |
|
59 | + } elseif (sys_get_param_str('import_generated')) { |
|
60 | 60 | // ЭТО НА БЛИЦЕ!!! |
61 | 61 | DBStaticUser::db_player_list_blitz_delete_players(); |
62 | 62 | DBStaticPlanet::db_planets_purge(); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | $system = $system_step; |
79 | 79 | $planet = round(Vector::$knownPlanets / 2); |
80 | 80 | |
81 | - foreach($imported_string as &$string_data) { |
|
81 | + foreach ($imported_string as &$string_data) { |
|
82 | 82 | $string_data = explode(',', $string_data); |
83 | 83 | $username_safe = $string_data[0]; |
84 | 84 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | $moon_row = uni_create_moon($galaxy, $system, $planet, $user_new['id'], 30, '', false); |
100 | 100 | |
101 | - if(($system += $system_step) >= Vector::$knownSystems) { |
|
101 | + if (($system += $system_step) >= Vector::$knownSystems) { |
|
102 | 102 | $galaxy++; |
103 | 103 | $system = $system_step; |
104 | 104 | } |
@@ -108,27 +108,27 @@ discard block |
||
108 | 108 | classSupernova::$config->db_saveItem('users_amount', classSupernova::$config->users_amount + $new_players); |
109 | 109 | // pdump($imported_string); |
110 | 110 | // generated_string |
111 | - } elseif(sys_get_param_str('import_result') && ($blitz_result_string = sys_get_param_str('blitz_result_string'))) { |
|
111 | + } elseif (sys_get_param_str('import_result') && ($blitz_result_string = sys_get_param_str('blitz_result_string'))) { |
|
112 | 112 | $blitz_result = explode(';', $blitz_result_string); |
113 | 113 | $blitz_last_update = $blitz_result[0]; // Пока не используется |
114 | 114 | unset($blitz_result[0]); |
115 | - foreach($blitz_result as $blitz_result_data) { |
|
115 | + foreach ($blitz_result as $blitz_result_data) { |
|
116 | 116 | $blitz_result_data = explode(',', $blitz_result_data); |
117 | - if(count($blitz_result_data) == 5) { |
|
117 | + if (count($blitz_result_data) == 5) { |
|
118 | 118 | db_blitz_reg_update_results($current_round, $blitz_result_data[1], $blitz_result_data[0], $blitz_result_data[2], $blitz_result_data[3], $blitz_result_data[4]); |
119 | 119 | } |
120 | 120 | } |
121 | 121 | $blitz_result = array(); |
122 | 122 | } |
123 | 123 | |
124 | - if(classSupernova::$config->game_mode == GAME_BLITZ) { |
|
124 | + if (classSupernova::$config->game_mode == GAME_BLITZ) { |
|
125 | 125 | $blitz_result = array(classSupernova::$config->db_loadItem('var_stat_update')); |
126 | - foreach(DBStaticUser::db_player_list_export_blitz_info() as $row) { |
|
126 | + foreach (DBStaticUser::db_player_list_export_blitz_info() as $row) { |
|
127 | 127 | $blitz_result[] = "{$row['id']},{$row['username']},{$row['onlinetime']},{$row['total_rank']},{$row['total_points']}"; |
128 | 128 | } |
129 | 129 | } else { |
130 | 130 | $query = db_blitz_reg_get_player_list($current_round); |
131 | - while($row = db_fetch($query)) { |
|
131 | + while ($row = db_fetch($query)) { |
|
132 | 132 | $blitz_generated[] = "{$row['blitz_name']},{$row['blitz_password']}"; |
133 | 133 | $row['blitz_online'] ? $blitz_prize_players_active++ : false; |
134 | 134 | $blitz_players++; |
@@ -136,13 +136,13 @@ discard block |
||
136 | 136 | $blitz_prize_dark_matter = $blitz_prize_players_active * 20000; |
137 | 137 | $blitz_prize_places = ceil($blitz_prize_players_active / 5); |
138 | 138 | |
139 | - if(sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) { |
|
139 | + if (sys_get_param_str('prize_calculate') && $blitz_prize_players_active && ($blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'))) { |
|
140 | 140 | // $blitz_prize_dark_matter_actual = sys_get_param_int('blitz_prize_dark_matter'); |
141 | 141 | $blitz_prize_places_actual = sys_get_param_int('blitz_prize_places'); |
142 | 142 | sn_db_transaction_start(); |
143 | 143 | $query = db_blitz_reg_get_player_list_order_by_place($current_round); |
144 | - while($row = db_fetch($query)) { |
|
145 | - if(!$row['blitz_place']) { |
|
144 | + while ($row = db_fetch($query)) { |
|
145 | + if (!$row['blitz_place']) { |
|
146 | 146 | continue; |
147 | 147 | } |
148 | 148 | |
@@ -151,14 +151,14 @@ discard block |
||
151 | 151 | |
152 | 152 | $reward = $blitz_prize_dark_matter_actual - $row['blitz_reward_dark_matter']; |
153 | 153 | pdump("{{$row['id']}} {$row['blitz_name']}, Place {$row['blitz_place']}, Prize places {$blitz_prize_places_actual}, Prize {$reward}", $row['id']); |
154 | - if($reward) { |
|
154 | + if ($reward) { |
|
155 | 155 | rpg_points_change($row['user_id'], RPG_BLITZ, $reward, sprintf( |
156 | 156 | classLocale::$lang['sys_blitz_reward_log_message'], $row['blitz_place'], $row['blitz_name'] |
157 | 157 | )); |
158 | 158 | db_blitz_reg_update_apply_results($reward, $row, $current_round); |
159 | 159 | } |
160 | 160 | |
161 | - if(!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) { |
|
161 | + if (!$blitz_prize_places_actual || $blitz_prize_dark_matter_actual < 1000) { |
|
162 | 162 | break; |
163 | 163 | } |
164 | 164 | } |
@@ -173,12 +173,12 @@ discard block |
||
173 | 173 | |
174 | 174 | $player_registered = false; |
175 | 175 | $query = db_blitz_reg_get_player_list_and_users($current_round); |
176 | -while($row = db_fetch($query)) { |
|
176 | +while ($row = db_fetch($query)) { |
|
177 | 177 | $tpl_player_data = array( |
178 | 178 | 'NAME' => player_nick_render_to_html($row, array('icons' => true, 'color' => true, 'ally' => true)), |
179 | 179 | ); |
180 | 180 | |
181 | - if(classSupernova::$config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES) { |
|
181 | + if (classSupernova::$config->game_blitz_register == BLITZ_REGISTER_DISCLOSURE_NAMES) { |
|
182 | 182 | // Вот так хитро, что бы не было не единого шанса попадания на страницу данных об игроках Блиц-сервера до закрытия раунда |
183 | 183 | $tpl_player_data = array_merge($tpl_player_data, array( |
184 | 184 | 'ID' => $row['id'], |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | } |
192 | 192 | |
193 | 193 | $template->assign_block_vars('registrations', $tpl_player_data); |
194 | - if($row['id'] == $user['id']) { |
|
194 | + if ($row['id'] == $user['id']) { |
|
195 | 195 | $player_registered = $row; |
196 | 196 | } |
197 | 197 | } |
@@ -245,7 +245,7 @@ |
||
245 | 245 | // break; |
246 | 246 | } |
247 | 247 | |
248 | - if($exceptionCode !== null) { |
|
248 | + if ($exceptionCode !== null) { |
|
249 | 249 | print('<span style="color: red; font-size: 200%;">FAILED! Expected Exception [' . $exceptionCode . ']: "' . classLocale::$lang['fl_attack_error'][$exceptionCode] . '" - FAILED!</span><br />'); |
250 | 250 | print('<div style="color: red; font-size: 200%;">NO EXCEPTION RAISED</div>'); |
251 | 251 | pdie(); |
@@ -52,7 +52,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |