@@ -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 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param db_mysql|null $db |
87 | 87 | */ |
88 | 88 | public static function setDb($db = null) { |
89 | - if(empty($db) || !($db instanceof db_mysql)) { |
|
89 | + if (empty($db) || !($db instanceof db_mysql)) { |
|
90 | 90 | $db = null; |
91 | 91 | } |
92 | 92 | static::$db = !empty($db) || !class_exists('classSupernova', false) ? $db : classSupernova::$db; |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | } |
453 | 453 | } |
454 | 454 | |
455 | - if(empty($set)) { |
|
455 | + if (empty($set)) { |
|
456 | 456 | $theResult = true; |
457 | 457 | } else { |
458 | 458 | $theResult = classSupernova::$db->doUpdateRowAdjust( |
@@ -138,9 +138,9 @@ discard block |
||
138 | 138 | |
139 | 139 | preg_match_all('#<!-- INCLUDE (\{\$?[A-Z0-9\-_]+\}|[a-zA-Z0-9\_\-\+\./]+) -->#', $code, $matches); |
140 | 140 | $include_blocks = $matches[1]; |
141 | - if($include_blocks) |
|
141 | + if ($include_blocks) |
|
142 | 142 | { |
143 | - foreach($include_blocks as &$included_file) |
|
143 | + foreach ($include_blocks as &$included_file) |
|
144 | 144 | { |
145 | 145 | $included_file .= '.tpl.html'; |
146 | 146 | } |
@@ -446,8 +446,8 @@ discard block |
||
446 | 446 | |
447 | 447 | $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){'; |
448 | 448 | // $tag_template_php .= '$this->_block_counter["'. $tag_args . '"] = $_' . $tag_args . '_i;'; |
449 | - $tag_template_php .= '$_'. $tag_args . '_val = &' . $varref . '[$_'. $tag_args. '_i];'; |
|
450 | - $tag_template_php .= '$this->_block_value["'. $tag_args . '"] = &' . $varref . '[$_'. $tag_args. '_i];'; |
|
449 | + $tag_template_php .= '$_' . $tag_args . '_val = &' . $varref . '[$_' . $tag_args . '_i];'; |
|
450 | + $tag_template_php .= '$this->_block_value["' . $tag_args . '"] = &' . $varref . '[$_' . $tag_args . '_i];'; |
|
451 | 451 | |
452 | 452 | return $tag_template_php; |
453 | 453 | } |
@@ -551,10 +551,10 @@ discard block |
||
551 | 551 | break; |
552 | 552 | |
553 | 553 | case 'is': |
554 | - $is_arg_start = ($tokens[$i-1] == ')') ? array_pop($is_arg_stack) : $i-1; |
|
554 | + $is_arg_start = ($tokens[$i - 1] == ')') ? array_pop($is_arg_stack) : $i - 1; |
|
555 | 555 | $is_arg = implode(' ', array_slice($tokens, $is_arg_start, $i - $is_arg_start)); |
556 | 556 | |
557 | - $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i+1)); |
|
557 | + $new_tokens = $this->_parse_is_expr($is_arg, array_slice($tokens, $i + 1)); |
|
558 | 558 | |
559 | 559 | array_splice($tokens, $is_arg_start, sizeof($tokens), $new_tokens); |
560 | 560 | |
@@ -814,11 +814,11 @@ discard block |
||
814 | 814 | } |
815 | 815 | else if ($include_last_iterator) |
816 | 816 | { |
817 | - return '$_'. $blocks[$blockcount] . '_val'; |
|
817 | + return '$_' . $blocks[$blockcount] . '_val'; |
|
818 | 818 | } |
819 | 819 | else |
820 | 820 | { |
821 | - return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']'; |
|
821 | + return '$_' . $blocks[$blockcount - 1] . '_val[\'' . $blocks[$blockcount] . '\']'; |
|
822 | 822 | } |
823 | 823 | } |
824 | 824 | |
@@ -835,7 +835,7 @@ discard block |
||
835 | 835 | if ($fp = @fopen($filename, 'wb')) |
836 | 836 | { |
837 | 837 | @flock($fp, LOCK_EX); |
838 | - @fwrite ($fp, $data); |
|
838 | + @fwrite($fp, $data); |
|
839 | 839 | @flock($fp, LOCK_UN); |
840 | 840 | @fclose($fp); |
841 | 841 | |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | */ |
853 | 853 | private function minify($html) |
854 | 854 | { |
855 | - if(!classSupernova::$config->tpl_minifier) |
|
855 | + if (!classSupernova::$config->tpl_minifier) |
|
856 | 856 | { |
857 | 857 | return $html; |
858 | 858 | } |
@@ -862,14 +862,14 @@ discard block |
||
862 | 862 | $html = preg_replace('/(<script[^>]*?>.*?<\/script>)/si', '#pre#', $html); |
863 | 863 | $html = preg_replace('/>[\s]*</', '><', $html); // Strip spacechars between tags |
864 | 864 | $html = preg_replace('/[\s]+/', ' ', $html); // Replace several spacechars with one space |
865 | - if(!empty($pre[0])) |
|
865 | + if (!empty($pre[0])) |
|
866 | 866 | { |
867 | - foreach($pre[0] as $tag) |
|
867 | + foreach ($pre[0] as $tag) |
|
868 | 868 | { |
869 | 869 | $tag = preg_replace('/^\ *\/\/[^\<]*?$/m', ' ', $tag); // Strips comments - except those that contains HTML comment inside |
870 | 870 | $tag = preg_replace('/[\ \t]{2,}/', ' ', $tag); // Replace several spaces by one |
871 | 871 | $tag = preg_replace('/\s{2,}/', "\r\n", $tag); // Replace several linefeeds by one |
872 | - $html = preg_replace('/#pre#/', $tag, $html,1); |
|
872 | + $html = preg_replace('/#pre#/', $tag, $html, 1); |
|
873 | 873 | } |
874 | 874 | } |
875 | 875 |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | 'checkSpeedPercentOld' => FLIGHT_FLEET_SPEED_WRONG, |
17 | 17 | 'checkTargetInUniverse' => FLIGHT_VECTOR_BEYOND_UNIVERSE, |
18 | 18 | 'checkTargetNotSource' => FLIGHT_VECTOR_SAME_SOURCE, |
19 | - 'checkSenderNoVacation' => FLIGHT_PLAYER_VACATION_OWN, // tODO |
|
19 | + 'checkSenderNoVacation' => FLIGHT_PLAYER_VACATION_OWN, // tODO |
|
20 | 20 | 'checkTargetNoVacation' => FLIGHT_PLAYER_VACATION, |
21 | 21 | 'checkFleetNotEmpty' => FLIGHT_SHIPS_NO_SHIPS, |
22 | 22 | // 'checkUnitsPositive' => FLIGHT_SHIPS_NEGATIVE, // Unused - 'cause it's not allowed to put negative units into Unit class |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $this->checkMissionRestrictions($action); |
159 | 159 | } else { |
160 | 160 | // No - then just performing action |
161 | - if($exception) { |
|
161 | + if ($exception) { |
|
162 | 162 | throw new ExceptionFleetInvalid($action, $action); |
163 | 163 | } else { |
164 | 164 | return $action; |
@@ -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 |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | // ------------------------------------------------------------------------------------------------------------------------------ |
4 | 4 | function sn_sys_load_php_files($dir_name, $load_extension = '.php', $modules = false) { |
5 | - if(!file_exists($dir_name) || !is_dir($dir_name)) { |
|
5 | + if (!file_exists($dir_name) || !is_dir($dir_name)) { |
|
6 | 6 | return; |
7 | 7 | } |
8 | 8 | |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | */ |
40 | 40 | function init_update() { |
41 | 41 | $update_file = SN_ROOT_PHYSICAL . "includes/update" . DOT_PHP_EX; |
42 | - if(!file_exists($update_file)) { |
|
42 | + if (!file_exists($update_file)) { |
|
43 | 43 | return; |
44 | 44 | } |
45 | - if( |
|
45 | + if ( |
|
46 | 46 | filemtime($update_file) <= classSupernova::$config->db_loadItem('var_db_update') |
47 | 47 | && |
48 | 48 | classSupernova::$config->db_loadItem('db_version') >= DB_VERSION |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | return; |
51 | 51 | } |
52 | 52 | |
53 | - if(defined('IN_ADMIN')) { |
|
53 | + if (defined('IN_ADMIN')) { |
|
54 | 54 | sn_db_transaction_start(); // Для защиты от двойного запуска апдейта - начинаем транзакцию. Так запись в базе будет блокирована |
55 | - if(SN_TIME_NOW >= classSupernova::$config->db_loadItem('var_db_update_end')) { |
|
55 | + if (SN_TIME_NOW >= classSupernova::$config->db_loadItem('var_db_update_end')) { |
|
56 | 56 | classSupernova::$config->db_saveItem('var_db_update_end', SN_TIME_NOW + (classSupernova::$config->upd_lock_time ? classSupernova::$config->upd_lock_time : 300)); |
57 | 57 | sn_db_transaction_commit(); |
58 | 58 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | $current_time = time(); |
63 | 63 | classSupernova::$config->db_saveItem('var_db_update', $current_time); |
64 | 64 | classSupernova::$config->db_saveItem('var_db_update_end', $current_time); |
65 | - } elseif(filemtime($update_file) > classSupernova::$config->var_db_update) { |
|
65 | + } elseif (filemtime($update_file) > classSupernova::$config->var_db_update) { |
|
66 | 66 | sn_db_transaction_rollback(); |
67 | 67 | $timeout = classSupernova::$config->var_db_update_end - SN_TIME_NOW; |
68 | 68 | die( |
@@ -162,12 +162,12 @@ discard block |
||
162 | 162 | $suffix = ''; |
163 | 163 | if ($limit) { |
164 | 164 | if ($ret > 0) { |
165 | - while($ret > $limit) { |
|
165 | + while ($ret > $limit) { |
|
166 | 166 | $suffix .= 'k'; |
167 | 167 | $ret = round($ret / 1000); |
168 | 168 | } |
169 | 169 | } else { |
170 | - while($ret < -$limit) { |
|
170 | + while ($ret < -$limit) { |
|
171 | 171 | $suffix .= 'k'; |
172 | 172 | $ret = round($ret / 1000); |
173 | 173 | } |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | $mercenary = get_unit_param($mercenary_id); |
413 | 413 | $mercenary_bonus = $mercenary['bonus']; |
414 | 414 | |
415 | - switch($mercenary['bonus_type']) { |
|
415 | + switch ($mercenary['bonus_type']) { |
|
416 | 416 | case BONUS_PERCENT_CUMULATIVE: |
417 | 417 | $value *= 1 + $mercenary_level * $mercenary_bonus / 100; |
418 | 418 | break; |
@@ -685,10 +685,10 @@ discard block |
||
685 | 685 | $rexep = "#" . strtr(preg_quote($format), $masks) . "#"; |
686 | 686 | if (preg_match($rexep, $date, $out)) { |
687 | 687 | $ret = array( |
688 | - "tm_sec" => (int)$out['S'], |
|
689 | - "tm_min" => (int)$out['M'], |
|
690 | - "tm_hour" => (int)$out['H'], |
|
691 | - "tm_mday" => (int)$out['d'], |
|
688 | + "tm_sec" => (int) $out['S'], |
|
689 | + "tm_min" => (int) $out['M'], |
|
690 | + "tm_hour" => (int) $out['H'], |
|
691 | + "tm_mday" => (int) $out['d'], |
|
692 | 692 | "tm_mon" => $out['m'] ? $out['m'] - 1 : 0, |
693 | 693 | "tm_year" => $out['Y'] > 1900 ? $out['Y'] - 1900 : 0, |
694 | 694 | ); |
@@ -837,7 +837,7 @@ discard block |
||
837 | 837 | } |
838 | 838 | |
839 | 839 | if (isset($nick_array[NICK_AUTH_LEVEL]) || isset($nick_array[NICK_PREMIUM])) { |
840 | - switch($nick_array[NICK_AUTH_LEVEL]) { |
|
840 | + switch ($nick_array[NICK_AUTH_LEVEL]) { |
|
841 | 841 | case 4: |
842 | 842 | $highlight = classSupernova::$config->chat_highlight_developer; |
843 | 843 | break; |
@@ -1339,7 +1339,7 @@ discard block |
||
1339 | 1339 | $time_left = min(floor($time_left / PERIOD_DAY), $term_original); |
1340 | 1340 | $cost_left = $term_original > 0 ? ceil($time_left / $term_original * $original_cost) : 0; |
1341 | 1341 | |
1342 | - array_walk_recursive($result, function (&$value) use ($cost_left) { |
|
1342 | + array_walk_recursive($result, function(&$value) use ($cost_left) { |
|
1343 | 1343 | $value -= $cost_left; |
1344 | 1344 | }); |
1345 | 1345 | } |
@@ -1479,7 +1479,7 @@ discard block |
||
1479 | 1479 | */ |
1480 | 1480 | function sortUnitRenderedList(&$ListToSort, $sort_option, $sort_option_inverse) { |
1481 | 1481 | if ($sort_option || $sort_option_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) { |
1482 | - switch($sort_option) { |
|
1482 | + switch ($sort_option) { |
|
1483 | 1483 | case PLAYER_OPTION_SORT_NAME: |
1484 | 1484 | $sort_option_field = 'NAME'; |
1485 | 1485 | break; |
@@ -1500,7 +1500,7 @@ discard block |
||
1500 | 1500 | break; |
1501 | 1501 | } |
1502 | 1502 | $sort_option_inverse_closure = $sort_option_inverse ? -1 : 1; |
1503 | - usort($ListToSort, function ($a, $b) use ($sort_option_field, $sort_option_inverse_closure) { |
|
1503 | + usort($ListToSort, function($a, $b) use ($sort_option_field, $sort_option_inverse_closure) { |
|
1504 | 1504 | return $a[$sort_option_field] < $b[$sort_option_field] ? -1 * $sort_option_inverse_closure : ( |
1505 | 1505 | $a[$sort_option_field] > $b[$sort_option_field] ? 1 * $sort_option_inverse_closure : 0 |
1506 | 1506 | ); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | require SN_ROOT_PHYSICAL . 'config.php'; |
76 | 76 | |
77 | 77 | $module_config_array = get_class($this) . '_config'; |
78 | - if(!empty($$module_config_array) && is_array($$module_config_array)) { |
|
78 | + if (!empty($$module_config_array) && is_array($$module_config_array)) { |
|
79 | 79 | $this->config = $$module_config_array; |
80 | 80 | |
81 | 81 | return true; |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | |
94 | 94 | // TODO: Load configuration from DB. Manifest setting |
95 | 95 | // Trying to load configuration from file |
96 | - if(!$config_exists = $this->loadModuleRootConfig()) { |
|
96 | + if (!$config_exists = $this->loadModuleRootConfig()) { |
|
97 | 97 | // Конфигурация может лежать в config_path в манифеста или в корне модуля |
98 | - if(isset($this->manifest['config_path']) && file_exists($config_filename = $this->manifest['config_path'] . '/config.php')) { |
|
98 | + if (isset($this->manifest['config_path']) && file_exists($config_filename = $this->manifest['config_path'] . '/config.php')) { |
|
99 | 99 | $config_exists = true; |
100 | - } elseif(file_exists($config_filename = dirname($filename) . '/config.php')) { |
|
100 | + } elseif (file_exists($config_filename = dirname($filename) . '/config.php')) { |
|
101 | 101 | $config_exists = true; |
102 | 102 | } |
103 | 103 | |
104 | - if($config_exists) { |
|
104 | + if ($config_exists) { |
|
105 | 105 | include($config_filename); |
106 | 106 | $module_config_array = $class_module_name . '_config'; |
107 | 107 | $this->config = $$module_config_array; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | |
119 | 119 | // Checking module status - is it installed and active |
120 | 120 | $this->check_status(); |
121 | - if(!$this->manifest['active']) { |
|
121 | + if (!$this->manifest['active']) { |
|
122 | 122 | return; |
123 | 123 | } |
124 | 124 | |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | |
139 | 139 | protected function setSystemConstants() { |
140 | 140 | // Setting constants - if any |
141 | - if(empty($this->manifest['constants']) || !is_array($this->manifest['constants'])) { |
|
141 | + if (empty($this->manifest['constants']) || !is_array($this->manifest['constants'])) { |
|
142 | 142 | return; |
143 | 143 | } |
144 | 144 | |
145 | - foreach($this->manifest['constants'] as $constant_name => $constant_value) { |
|
145 | + foreach ($this->manifest['constants'] as $constant_name => $constant_value) { |
|
146 | 146 | !defined($constant_name) ? define($constant_name, $constant_value) : false; |
147 | 147 | } |
148 | 148 | } |
@@ -154,48 +154,48 @@ discard block |
||
154 | 154 | // New values from module variables will overwrite previous values (for root variables) and array elements with corresponding indexes (for arrays) |
155 | 155 | // Constants as array indexes are honored - it's make valid such declarations as 'sn_data[ques][QUE_STRUCTURES]' |
156 | 156 | $this->manifest['vars'] = $this->__assign_vars(); |
157 | - if(empty($this->manifest['vars']) || !is_array($this->manifest['vars'])) { |
|
157 | + if (empty($this->manifest['vars']) || !is_array($this->manifest['vars'])) { |
|
158 | 158 | return; |
159 | 159 | } |
160 | 160 | |
161 | 161 | $vars_assigned = array(); |
162 | - foreach($this->manifest['vars'] as $var_name => $var_value) { |
|
162 | + foreach ($this->manifest['vars'] as $var_name => $var_value) { |
|
163 | 163 | $sub_vars = explode('[', str_replace(']', '', $var_name)); |
164 | 164 | $var_name = $sub_vars[0]; |
165 | 165 | |
166 | - if(!isset($vars_assigned[$var_name])) { |
|
166 | + if (!isset($vars_assigned[$var_name])) { |
|
167 | 167 | $vars_assigned[$var_name] = true; |
168 | 168 | global $$var_name; |
169 | 169 | } |
170 | 170 | |
171 | 171 | $pointer = &$$var_name; |
172 | - if(($n = count($sub_vars)) > 1) { |
|
173 | - for($i = 1; $i < $n; $i++) { |
|
174 | - if(defined($sub_vars[$i])) { |
|
172 | + if (($n = count($sub_vars)) > 1) { |
|
173 | + for ($i = 1; $i < $n; $i++) { |
|
174 | + if (defined($sub_vars[$i])) { |
|
175 | 175 | $sub_vars[$i] = constant($sub_vars[$i]); |
176 | 176 | } |
177 | 177 | |
178 | - if(!isset($pointer[$sub_vars[$i]]) && $i != $n) { |
|
178 | + if (!isset($pointer[$sub_vars[$i]]) && $i != $n) { |
|
179 | 179 | $pointer[$sub_vars[$i]] = array(); |
180 | 180 | } |
181 | 181 | $pointer = &$pointer[$sub_vars[$i]]; |
182 | 182 | } |
183 | 183 | } |
184 | 184 | |
185 | - if(!isset($pointer) || !is_array($pointer)) { |
|
185 | + if (!isset($pointer) || !is_array($pointer)) { |
|
186 | 186 | $pointer = $var_value; |
187 | - } elseif(is_array($$var_name)) { |
|
187 | + } elseif (is_array($$var_name)) { |
|
188 | 188 | $pointer = array_merge_recursive_numeric($pointer, $var_value); |
189 | 189 | } |
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
193 | 193 | protected function mergeMenu(&$sn_menu_extra, &$menu_patch) { |
194 | - if(!is_array($menu_patch)) { |
|
194 | + if (!is_array($menu_patch)) { |
|
195 | 195 | return; |
196 | 196 | } |
197 | 197 | |
198 | - foreach($menu_patch as $menu_item_name => $menu_item_data) { |
|
198 | + foreach ($menu_patch as $menu_item_name => $menu_item_data) { |
|
199 | 199 | $sn_menu_extra[$menu_item_name] = $menu_item_data; |
200 | 200 | } |
201 | 201 | } |
@@ -204,34 +204,34 @@ discard block |
||
204 | 204 | // Overriding function if any |
205 | 205 | sn_sys_handler_add(classSupernova::$functions, $this->manifest['functions'], $this); |
206 | 206 | |
207 | - foreach(classSupernova::$sn_mvc as $handler_type => &$handler_data) { |
|
207 | + foreach (classSupernova::$sn_mvc as $handler_type => &$handler_data) { |
|
208 | 208 | sn_sys_handler_add($handler_data, $this->manifest['mvc'][$handler_type], $this, $handler_type); |
209 | 209 | } |
210 | 210 | } |
211 | 211 | |
212 | 212 | protected function mergeNavbarButton() { |
213 | - if(empty($this->manifest['navbar_prefix_button']) || !is_array($this->manifest['navbar_prefix_button'])) { |
|
213 | + if (empty($this->manifest['navbar_prefix_button']) || !is_array($this->manifest['navbar_prefix_button'])) { |
|
214 | 214 | return; |
215 | 215 | } |
216 | 216 | |
217 | - foreach($this->manifest['navbar_prefix_button'] as $button_image => $button_url_relative) { |
|
217 | + foreach ($this->manifest['navbar_prefix_button'] as $button_image => $button_url_relative) { |
|
218 | 218 | classSupernova::$sn_mvc['navbar_prefix_button'][$button_image] = $button_url_relative; |
219 | 219 | } |
220 | 220 | } |
221 | 221 | |
222 | 222 | protected function mergeI18N() { |
223 | 223 | $arrayName = 'i18n'; |
224 | - if(empty($this->manifest[$arrayName]) || !is_array($this->manifest[$arrayName])) { |
|
224 | + if (empty($this->manifest[$arrayName]) || !is_array($this->manifest[$arrayName])) { |
|
225 | 225 | return; |
226 | 226 | } |
227 | 227 | |
228 | - foreach($this->manifest[$arrayName] as $pageName => &$contentList) { |
|
229 | - foreach($contentList as &$i18n_file_data) { |
|
230 | - if(is_array($i18n_file_data) && !$i18n_file_data['path']) { |
|
228 | + foreach ($this->manifest[$arrayName] as $pageName => &$contentList) { |
|
229 | + foreach ($contentList as &$i18n_file_data) { |
|
230 | + if (is_array($i18n_file_data) && !$i18n_file_data['path']) { |
|
231 | 231 | $i18n_file_data['path'] = $this->manifest['root_relative']; |
232 | 232 | } |
233 | 233 | } |
234 | - if(!isset(classSupernova::$sn_mvc[$arrayName][$pageName])) { |
|
234 | + if (!isset(classSupernova::$sn_mvc[$arrayName][$pageName])) { |
|
235 | 235 | classSupernova::$sn_mvc[$arrayName][$pageName] = array(); |
236 | 236 | } |
237 | 237 | classSupernova::$sn_mvc[$arrayName][$pageName] += $contentList; |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | $load_order[$loaded_module_name] = $level; |
311 | 311 | } |
312 | 312 | } |
313 | - } while($prev_order != $load_order); |
|
313 | + } while ($prev_order != $load_order); |
|
314 | 314 | |
315 | 315 | asort($load_order); |
316 | 316 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | function gettemplatename($u_dpath) { |
13 | 13 | static $template_names = array(); |
14 | 14 | |
15 | - if(!isset($template_names[$u_dpath])) { |
|
15 | + if (!isset($template_names[$u_dpath])) { |
|
16 | 16 | $template_names[$u_dpath] = file_exists(SN_ROOT_PHYSICAL . $u_dpath . 'tmpl.ini') ? sys_file_read(SN_ROOT_PHYSICAL . $u_dpath . 'tmpl.ini') : TEMPLATE_NAME; |
17 | 17 | } |
18 | 18 | |
@@ -54,12 +54,12 @@ discard block |
||
54 | 54 | * @param $sn_menu_extra |
55 | 55 | */ |
56 | 56 | function tpl_menu_merge_extra(&$sn_menu, &$sn_menu_extra) { |
57 | - if(empty($sn_menu) || empty($sn_menu_extra)) { |
|
57 | + if (empty($sn_menu) || empty($sn_menu_extra)) { |
|
58 | 58 | return; |
59 | 59 | } |
60 | 60 | |
61 | - foreach($sn_menu_extra as $menu_item_id => $menu_item) { |
|
62 | - if(empty($menu_item['LOCATION'])) { |
|
61 | + foreach ($sn_menu_extra as $menu_item_id => $menu_item) { |
|
62 | + if (empty($menu_item['LOCATION'])) { |
|
63 | 63 | $sn_menu[$menu_item_id] = $menu_item; |
64 | 64 | continue; |
65 | 65 | } |
@@ -68,16 +68,16 @@ discard block |
||
68 | 68 | unset($menu_item['LOCATION']); |
69 | 69 | |
70 | 70 | $is_positioned = $item_location[0]; |
71 | - if($is_positioned == '+' || $is_positioned == '-') { |
|
71 | + if ($is_positioned == '+' || $is_positioned == '-') { |
|
72 | 72 | $item_location = substr($item_location, 1); |
73 | 73 | } else { |
74 | 74 | $is_positioned = ''; |
75 | 75 | } |
76 | 76 | |
77 | - if($item_location) { |
|
77 | + if ($item_location) { |
|
78 | 78 | $menu_keys = array_keys($sn_menu); |
79 | 79 | $insert_position = array_search($item_location, $menu_keys); |
80 | - if($insert_position === false) { |
|
80 | + if ($insert_position === false) { |
|
81 | 81 | $insert_position = count($sn_menu) - 1; |
82 | 82 | $is_positioned = '+'; |
83 | 83 | $item_location = ''; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | $spliced = array_splice($sn_menu, $insert_position, count($sn_menu) - $insert_position); |
91 | 91 | $sn_menu[$menu_item_id] = $menu_item; |
92 | 92 | |
93 | - if(!$is_positioned && $item_location) { |
|
93 | + if (!$is_positioned && $item_location) { |
|
94 | 94 | unset($spliced[$item_location]); |
95 | 95 | } |
96 | 96 | $sn_menu = array_merge($sn_menu, $spliced); |
@@ -104,24 +104,24 @@ discard block |
||
104 | 104 | * @param template $template |
105 | 105 | */ |
106 | 106 | function tpl_menu_assign_to_template(&$sn_menu, &$template) { |
107 | - if(empty($sn_menu) || !is_array($sn_menu)) { |
|
107 | + if (empty($sn_menu) || !is_array($sn_menu)) { |
|
108 | 108 | return; |
109 | 109 | } |
110 | 110 | |
111 | - foreach($sn_menu as $menu_item_id => $menu_item) { |
|
112 | - if(!$menu_item) { |
|
111 | + foreach ($sn_menu as $menu_item_id => $menu_item) { |
|
112 | + if (!$menu_item) { |
|
113 | 113 | continue; |
114 | 114 | } |
115 | 115 | |
116 | - if(is_string($menu_item_id)) { |
|
116 | + if (is_string($menu_item_id)) { |
|
117 | 117 | $menu_item['ID'] = $menu_item_id; |
118 | 118 | } |
119 | 119 | |
120 | - if($menu_item['TYPE'] == 'lang') { |
|
120 | + if ($menu_item['TYPE'] == 'lang') { |
|
121 | 121 | $lang_string = &classLocale::$lang; |
122 | - if(preg_match('#(\w+)(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?#', $menu_item['ITEM'], $matches) && count($matches) > 1) { |
|
123 | - for($i = 1; $i < count($matches); $i++) { |
|
124 | - if(defined($matches[$i])) { |
|
122 | + if (preg_match('#(\w+)(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?(?:\[(\w+)\])?#', $menu_item['ITEM'], $matches) && count($matches) > 1) { |
|
123 | + for ($i = 1; $i < count($matches); $i++) { |
|
124 | + if (defined($matches[$i])) { |
|
125 | 125 | $matches[$i] = constant($matches[$i]); |
126 | 126 | } |
127 | 127 | $lang_string = &$lang_string[$matches[$i]]; |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | $menu_item['ALT'] = htmlentities($menu_item['ALT']); |
134 | 134 | $menu_item['TITLE'] = htmlentities($menu_item['TITLE']); |
135 | 135 | |
136 | - if(!empty($menu_item['ICON'])) { |
|
137 | - if(is_string($menu_item['ICON'])) { |
|
136 | + if (!empty($menu_item['ICON'])) { |
|
137 | + if (is_string($menu_item['ICON'])) { |
|
138 | 138 | $menu_item['ICON_PATH'] = $menu_item['ICON']; |
139 | 139 | } else { |
140 | 140 | $menu_item['ICON'] = $menu_item_id; |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | 'MENU_START_HIDE' => !empty($_COOKIE[SN_COOKIE . '_menu_hidden']) || defined('SN_GOOGLE'), |
165 | 165 | )); |
166 | 166 | |
167 | - if(isset($template_result['MENU_CUSTOMIZE'])) { |
|
167 | + if (isset($template_result['MENU_CUSTOMIZE'])) { |
|
168 | 168 | $template->assign_vars(array( |
169 | 169 | 'PLAYER_OPTION_MENU_SHOW_ON_BUTTON' => classSupernova::$user_options[PLAYER_OPTION_MENU_SHOW_ON_BUTTON], |
170 | 170 | 'PLAYER_OPTION_MENU_HIDE_ON_BUTTON' => classSupernova::$user_options[PLAYER_OPTION_MENU_HIDE_ON_BUTTON], |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | )); |
179 | 179 | } |
180 | 180 | |
181 | - if(defined('IN_ADMIN') && IN_ADMIN === true && !empty($user['authlevel']) && $user['authlevel'] > 0) { |
|
181 | + if (defined('IN_ADMIN') && IN_ADMIN === true && !empty($user['authlevel']) && $user['authlevel'] > 0) { |
|
182 | 182 | tpl_menu_merge_extra($sn_menu_admin, $sn_menu_admin_extra); |
183 | 183 | tpl_menu_assign_to_template($sn_menu_admin, $template); |
184 | 184 | } else { |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $in_admin = defined('IN_ADMIN') && IN_ADMIN === true; |
219 | 219 | $is_login = defined('LOGIN_LOGOUT') && LOGIN_LOGOUT === true; |
220 | 220 | |
221 | - if(is_object($page)) { |
|
221 | + if (is_object($page)) { |
|
222 | 222 | isset($page->_rootref['MENU']) ? $isDisplayMenu = $page->_rootref['MENU'] : false; |
223 | 223 | isset($page->_rootref['NAVBAR']) ? $isDisplayTopNav = $page->_rootref['NAVBAR'] : false; |
224 | 224 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | !isset($page->_rootref['PAGE_HEADER']) && $title ? $page->assign_var('PAGE_HEADER', $title) : false; |
227 | 227 | } |
228 | 228 | |
229 | - if(empty($user['id']) || !is_numeric($user['id'])) { |
|
229 | + if (empty($user['id']) || !is_numeric($user['id'])) { |
|
230 | 230 | $isDisplayMenu = false; |
231 | 231 | $isDisplayTopNav = false; |
232 | 232 | } |
@@ -313,12 +313,12 @@ discard block |
||
313 | 313 | $template->assign_recursive($template_result); |
314 | 314 | displayP(parsetemplate($template)); |
315 | 315 | |
316 | - if(($isDisplayMenu || $in_admin) && !isset($_COOKIE['menu_disable'])) { |
|
316 | + if (($isDisplayMenu || $in_admin) && !isset($_COOKIE['menu_disable'])) { |
|
317 | 317 | // $AdminPage = $AdminPage ? $user['authlevel'] : 0; |
318 | 318 | displayP(parsetemplate(tpl_render_menu())); |
319 | 319 | } |
320 | 320 | |
321 | - if($isDisplayTopNav && !$in_admin) { |
|
321 | + if ($isDisplayTopNav && !$in_admin) { |
|
322 | 322 | displayP(parsetemplate(tpl_render_topnav($user, $planetrow))); |
323 | 323 | } |
324 | 324 | |
@@ -326,8 +326,8 @@ discard block |
||
326 | 326 | |
327 | 327 | !is_array($page) ? $page = array($page) : false; |
328 | 328 | $result_added = false; |
329 | - foreach($page as $page_item) { |
|
330 | - if(!$result_added && is_object($page_item) && isset($page_item->_tpldata['result'])) { |
|
329 | + foreach ($page as $page_item) { |
|
330 | + if (!$result_added && is_object($page_item) && isset($page_item->_tpldata['result'])) { |
|
331 | 331 | $page_item = gettemplate('_result_message', $page_item); |
332 | 332 | $temp = $page_item->files['_result_message']; |
333 | 333 | unset($page_item->files['_result_message']); |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | )); |
351 | 351 | displayP(parsetemplate($template)); |
352 | 352 | |
353 | - $user['authlevel'] >= 3 && classSupernova::$config->debug ? classSupernova::$debug->echo_log() : false;; |
|
353 | + $user['authlevel'] >= 3 && classSupernova::$config->debug ? classSupernova::$debug->echo_log() : false; ; |
|
354 | 354 | |
355 | 355 | classSupernova::$db->db_disconnect(); |
356 | 356 | |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | * @param string $type |
436 | 436 | */ |
437 | 437 | function tpl_topnav_event_build(&$template, $FleetList, $type = 'fleet') { |
438 | - if(empty($FleetList)) { |
|
438 | + if (empty($FleetList)) { |
|
439 | 439 | return; |
440 | 440 | } |
441 | 441 | |
@@ -444,19 +444,19 @@ discard block |
||
444 | 444 | $fleet_event_count = 0; |
445 | 445 | $fleet_flying_sorter = array(); |
446 | 446 | $fleet_flying_events = array(); |
447 | - foreach($FleetList->_container as $objFleet) { |
|
447 | + foreach ($FleetList->_container as $objFleet) { |
|
448 | 448 | $will_return = true; |
449 | - if(!$objFleet->isReturning()) { |
|
449 | + if (!$objFleet->isReturning()) { |
|
450 | 450 | // cut fleets on Hold and Expedition |
451 | - if($objFleet->time_arrive_to_target >= SN_TIME_NOW) { |
|
451 | + if ($objFleet->time_arrive_to_target >= SN_TIME_NOW) { |
|
452 | 452 | $objFleet->mission_type == MT_RELOCATE ? $will_return = false : false; |
453 | 453 | tpl_topnav_event_build_helper($objFleet->time_arrive_to_target, EVENT_FLEET_ARRIVE, classLocale::$lang['sys_event_arrive'], $objFleet->target_coordinates_typed(), !$will_return, $objFleet, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count); |
454 | 454 | } |
455 | - if($objFleet->time_mission_job_complete) { |
|
455 | + if ($objFleet->time_mission_job_complete) { |
|
456 | 456 | tpl_topnav_event_build_helper($objFleet->time_mission_job_complete, EVENT_FLEET_STAY, classLocale::$lang['sys_event_stay'], $objFleet->target_coordinates_typed(), false, $objFleet, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count); |
457 | 457 | } |
458 | 458 | } |
459 | - if($will_return) { |
|
459 | + if ($will_return) { |
|
460 | 460 | tpl_topnav_event_build_helper($objFleet->time_return_to_source, EVENT_FLEET_RETURN, classLocale::$lang['sys_event_return'], $objFleet->launch_coordinates_typed(), true, $objFleet, $fleet_flying_sorter, $fleet_flying_events, $fleet_event_count); |
461 | 461 | } |
462 | 462 | } |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | asort($fleet_flying_sorter); |
465 | 465 | |
466 | 466 | $fleet_flying_count = $FleetList->count(); |
467 | - foreach($fleet_flying_sorter as $fleet_event_id => $fleet_time) { |
|
467 | + foreach ($fleet_flying_sorter as $fleet_event_id => $fleet_time) { |
|
468 | 468 | $fleet_event = &$fleet_flying_events[$fleet_event_id]; |
469 | 469 | $template->assign_block_vars("flying_{$type}s", array( |
470 | 470 | 'TIME' => max(0, $fleet_time - SN_TIME_NOW), |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | global $template_result; |
494 | 494 | $classLocale = classLocale::$lang; |
495 | 495 | |
496 | - if(!is_array($user)) { |
|
496 | + if (!is_array($user)) { |
|
497 | 497 | return ''; |
498 | 498 | } |
499 | 499 | |
@@ -514,8 +514,8 @@ discard block |
||
514 | 514 | |
515 | 515 | $ThisUsersPlanets = DBStaticPlanet::db_planet_list_sorted($user); |
516 | 516 | // while ($CurPlanet = db_fetch($ThisUsersPlanets)) |
517 | - foreach($ThisUsersPlanets as $CurPlanet) { |
|
518 | - if($CurPlanet['destruyed']) { |
|
517 | + foreach ($ThisUsersPlanets as $CurPlanet) { |
|
518 | + if ($CurPlanet['destruyed']) { |
|
519 | 519 | continue; |
520 | 520 | } |
521 | 521 | |
@@ -539,8 +539,8 @@ discard block |
||
539 | 539 | */ |
540 | 540 | $fleet_flying_list = array(); |
541 | 541 | $fleet_flying_list[0] = FleetList::dbGetFleetListByOwnerId($user['id']); |
542 | - foreach($fleet_flying_list[0]->_container as $fleet_id => $objFleet) { |
|
543 | - if(empty($fleet_flying_list[$objFleet->mission_type])) { |
|
542 | + foreach ($fleet_flying_list[0]->_container as $fleet_id => $objFleet) { |
|
543 | + if (empty($fleet_flying_list[$objFleet->mission_type])) { |
|
544 | 544 | $fleet_flying_list[$objFleet->mission_type] = new FleetList(); |
545 | 545 | } |
546 | 546 | $fleet_flying_list[$objFleet->mission_type][$fleet_id] = $objFleet; |
@@ -552,8 +552,8 @@ discard block |
||
552 | 552 | que_tpl_parse($template, QUE_RESEARCH, $user, array(), null, !classSupernova::$user_options[PLAYER_OPTION_NAVBAR_RESEARCH_WIDE]); |
553 | 553 | que_tpl_parse($template, SUBQUE_FLEET, $user, $planetrow, null, true); |
554 | 554 | |
555 | - if(!empty(classSupernova::$sn_mvc['navbar_prefix_button']) && is_array(classSupernova::$sn_mvc['navbar_prefix_button'])) { |
|
556 | - foreach(classSupernova::$sn_mvc['navbar_prefix_button'] as $navbar_button_image => $navbar_button_url) { |
|
555 | + if (!empty(classSupernova::$sn_mvc['navbar_prefix_button']) && is_array(classSupernova::$sn_mvc['navbar_prefix_button'])) { |
|
556 | + foreach (classSupernova::$sn_mvc['navbar_prefix_button'] as $navbar_button_image => $navbar_button_url) { |
|
557 | 557 | $template->assign_block_vars('navbar_prefix_button', array( |
558 | 558 | 'IMAGE' => $navbar_button_image, |
559 | 559 | 'URL_RELATIVE' => $navbar_button_url, |
@@ -567,13 +567,13 @@ discard block |
||
567 | 567 | $time_now_parsed = getdate(SN_TIME_NOW); |
568 | 568 | $time_local_parsed = getdate(defined('SN_CLIENT_TIME_LOCAL') ? SN_CLIENT_TIME_LOCAL : SN_TIME_NOW); |
569 | 569 | |
570 | - if(classSupernova::$config->game_news_overview) { |
|
570 | + if (classSupernova::$config->game_news_overview) { |
|
571 | 571 | $user_last_read_safe = intval($user['news_lastread']); |
572 | 572 | nws_render($template, "WHERE UNIX_TIMESTAMP(`tsTimeStamp`) >= {$user_last_read_safe}", classSupernova::$config->game_news_overview); |
573 | 573 | } |
574 | 574 | |
575 | 575 | $notes_query = DBStaticNote::db_note_list_by_owner($user['id'], true); |
576 | - while($note_row = db_fetch($notes_query)) { |
|
576 | + while ($note_row = db_fetch($notes_query)) { |
|
577 | 577 | note_assign($template, $note_row); |
578 | 578 | } |
579 | 579 | |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | 'QUE_ID' => QUE_RESEARCH, |
588 | 588 | 'QUE_HTML' => 'topnav', |
589 | 589 | |
590 | - 'RESEARCH_ONGOING' => (boolean)$user['que'], |
|
590 | + 'RESEARCH_ONGOING' => (boolean) $user['que'], |
|
591 | 591 | |
592 | 592 | 'TIME_TEXT' => sprintf($str_date_format, $time_now_parsed['year'], classLocale::$lang['months'][$time_now_parsed['mon']], $time_now_parsed['mday'], |
593 | 593 | $time_now_parsed['hours'], $time_now_parsed['minutes'], $time_now_parsed['seconds'] |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | 'QUE_STRUCTURES' => QUE_STRUCTURES, |
665 | 665 | )); |
666 | 666 | |
667 | - if((defined('SN_RENDER_NAVBAR_PLANET') && SN_RENDER_NAVBAR_PLANET === true) || ($user['option_list'][OPT_INTERFACE]['opt_int_navbar_resource_force'] && SN_RENDER_NAVBAR_PLANET !== false)) { |
|
667 | + if ((defined('SN_RENDER_NAVBAR_PLANET') && SN_RENDER_NAVBAR_PLANET === true) || ($user['option_list'][OPT_INTERFACE]['opt_int_navbar_resource_force'] && SN_RENDER_NAVBAR_PLANET !== false)) { |
|
668 | 668 | tpl_set_resource_info($template, $planetrow); |
669 | 669 | $template->assign_vars(array( |
670 | 670 | 'SN_RENDER_NAVBAR_PLANET' => true, |
@@ -679,12 +679,12 @@ discard block |
||
679 | 679 | * @param template|string $template |
680 | 680 | */ |
681 | 681 | function displayP($template) { |
682 | - if(is_object($template)) { |
|
683 | - if(empty($template->parsed)) { |
|
682 | + if (is_object($template)) { |
|
683 | + if (empty($template->parsed)) { |
|
684 | 684 | parsetemplate($template); |
685 | 685 | } |
686 | 686 | |
687 | - foreach($template->files as $section => $filename) { |
|
687 | + foreach ($template->files as $section => $filename) { |
|
688 | 688 | $template->display($section); |
689 | 689 | } |
690 | 690 | } else { |
@@ -699,11 +699,11 @@ discard block |
||
699 | 699 | * @return mixed |
700 | 700 | */ |
701 | 701 | function parsetemplate($template, $array = false) { |
702 | - if(is_object($template)) { |
|
702 | + if (is_object($template)) { |
|
703 | 703 | global $user; |
704 | 704 | |
705 | - if(!empty($array) && is_array($array)) { |
|
706 | - foreach($array as $key => $data) { |
|
705 | + if (!empty($array) && is_array($array)) { |
|
706 | + foreach ($array as $key => $data) { |
|
707 | 707 | $template->assign_var($key, $data); |
708 | 708 | } |
709 | 709 | } |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | |
745 | 745 | $template_ex = '.tpl.html'; |
746 | 746 | |
747 | - if($template === false) { |
|
747 | + if ($template === false) { |
|
748 | 748 | return sys_file_read(TEMPLATE_DIR . '/' . $files . $template_ex); |
749 | 749 | } |
750 | 750 | |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | !empty(classSupernova::$sn_mvc['i18n']['']) ? lng_load_i18n(classSupernova::$sn_mvc['i18n']['']) : false; |
765 | 765 | $sn_page_name ? lng_load_i18n(classSupernova::$sn_mvc['i18n'][$sn_page_name]) : false; |
766 | 766 | |
767 | - foreach($files as &$filename) { |
|
767 | + foreach ($files as &$filename) { |
|
768 | 768 | $filename = $filename . $template_ex; |
769 | 769 | } |
770 | 770 | |
@@ -789,13 +789,13 @@ discard block |
||
789 | 789 | 'LANG' => $language ? $language : '', |
790 | 790 | 'referral' => $id_ref ? '&id_ref=' . $id_ref : '', |
791 | 791 | |
792 | - 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '',// "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''), |
|
792 | + 'REQUEST_PARAMS' => !empty($url_params) ? '?' . implode('&', $url_params) : '', // "?lang={$language}" . ($id_ref ? "&id_ref={$id_ref}" : ''), |
|
793 | 793 | 'FILENAME' => basename($_SERVER['PHP_SELF']), |
794 | 794 | )); |
795 | 795 | |
796 | - foreach(lng_get_list() as $lng_id => $lng_data) { |
|
797 | - if(isset($lng_data['LANG_VARIANTS']) && is_array($lng_data['LANG_VARIANTS'])) { |
|
798 | - foreach($lng_data['LANG_VARIANTS'] as $lang_variant) { |
|
796 | + foreach (lng_get_list() as $lng_id => $lng_data) { |
|
797 | + if (isset($lng_data['LANG_VARIANTS']) && is_array($lng_data['LANG_VARIANTS'])) { |
|
798 | + foreach ($lng_data['LANG_VARIANTS'] as $lang_variant) { |
|
799 | 799 | $lng_data1 = $lng_data; |
800 | 800 | $lng_data1 = array_merge($lng_data1, $lang_variant); |
801 | 801 | $template->assign_block_vars('language', $lng_data1); |
@@ -818,8 +818,8 @@ discard block |
||
818 | 818 | $que = $que['ques'][$que_type][$planet['id_owner']][$planet['id']]; |
819 | 819 | |
820 | 820 | $que_length = 0; |
821 | - if(!empty($que)) { |
|
822 | - foreach($que as $que_item) { |
|
821 | + if (!empty($que)) { |
|
822 | + foreach ($que as $que_item) { |
|
823 | 823 | $template->assign_block_vars('que', que_tpl_parse_element($que_item)); |
824 | 824 | } |
825 | 825 | $que_length = count($que); |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | * @param int $user_dark_matter |
835 | 835 | */ |
836 | 836 | function tpl_planet_density_info(&$template, &$density_price_chart, $user_dark_matter) { |
837 | - foreach($density_price_chart as $density_price_index => &$density_price_data) { |
|
837 | + foreach ($density_price_chart as $density_price_index => &$density_price_data) { |
|
838 | 838 | $density_cost = $density_price_data; |
839 | 839 | $density_number_style = pretty_number($density_cost, true, $user_dark_matter, false, false); |
840 | 840 | |
@@ -858,7 +858,7 @@ discard block |
||
858 | 858 | function tpl_assign_select(&$template, $name, $values) { |
859 | 859 | !is_array($values) ? $values = array($values => $values) : false; |
860 | 860 | |
861 | - foreach($values as $key => $value) { |
|
861 | + foreach ($values as $key => $value) { |
|
862 | 862 | $template->assign_block_vars($name, array( |
863 | 863 | 'KEY' => htmlentities($key, ENT_COMPAT, 'UTF-8'), |
864 | 864 | 'VALUE' => htmlentities($value, ENT_COMPAT, 'UTF-8'), |