@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | |
15 | 15 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
16 | 16 | |
17 | -if($user['authlevel'] < 3) { |
|
17 | +if ($user['authlevel'] < 3) { |
|
18 | 18 | AdminMessage(classLocale::$lang['adm_err_denied']); |
19 | 19 | } |
20 | 20 | |
21 | -if($delete = sys_get_param_str('delete')) { |
|
21 | +if ($delete = sys_get_param_str('delete')) { |
|
22 | 22 | db_chat_message_delete($delete); |
23 | -} elseif(sys_get_param_str('deleteall') == 'yes') { |
|
23 | +} elseif (sys_get_param_str('deleteall') == 'yes') { |
|
24 | 24 | db_chat_message_purge(); |
25 | 25 | } |
26 | 26 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | $query = db_chat_message_get_last_25(); |
30 | 30 | $i = 0; |
31 | -while($e = db_fetch($query)) { |
|
31 | +while ($e = db_fetch($query)) { |
|
32 | 32 | $i++; |
33 | 33 | $template->assign_block_vars('messages', array( |
34 | 34 | 'ID' => $e['messageid'], |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
18 | 18 | |
19 | -if($user['authlevel'] < 1) { |
|
19 | +if ($user['authlevel'] < 1) { |
|
20 | 20 | AdminMessage(classLocale::$lang['adm_err_denied']); |
21 | 21 | } |
22 | 22 | |
@@ -28,8 +28,8 @@ discard block |
||
28 | 28 | $template = gettemplate("admin/admin_ban", true); |
29 | 29 | |
30 | 30 | $player_banned_row = db_user_by_username($name_unsafe); |
31 | -if($mode == 'banit' && $action) { |
|
32 | - if($player_banned_row) { |
|
31 | +if ($mode == 'banit' && $action) { |
|
32 | + if ($player_banned_row) { |
|
33 | 33 | $reas = $_POST['why']; |
34 | 34 | $days = $_POST['days']; |
35 | 35 | $hour = $_POST['hour']; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $adm_bn_thpl = classLocale::$lang['adm_bn_thpl']; |
50 | 50 | $DoneMessage = "{$adm_bn_thpl} {$name_output} {$adm_bn_isbn}"; |
51 | 51 | |
52 | - if($is_vacation) { |
|
52 | + if ($is_vacation) { |
|
53 | 53 | $DoneMessage .= classLocale::$lang['adm_bn_vctn']; |
54 | 54 | } |
55 | 55 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | AdminMessage($DoneMessage, classLocale::$lang['adm_ban_title']); |
62 | -} elseif($mode == 'unbanit' && $action) { |
|
62 | +} elseif ($mode == 'unbanit' && $action) { |
|
63 | 63 | sys_admin_player_ban_unset($user, $player_banned_row, ($reason = sys_get_param_str('why')) ? $reason : classLocale::$lang['sys_unbanned']); |
64 | 64 | |
65 | 65 | $DoneMessage = classLocale::$lang['adm_unbn_thpl'] . " " . $name_output . " " . classLocale::$lang['adm_unbn_isbn']; |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | -define('INSIDE' , true); |
|
3 | -define('INSTALL' , false); |
|
2 | +define('INSIDE', true); |
|
3 | +define('INSTALL', false); |
|
4 | 4 | define('IN_ADMIN', true); |
5 | 5 | |
6 | 6 | require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
7 | 7 | |
8 | -if($user['authlevel'] < 3) |
|
8 | +if ($user['authlevel'] < 3) |
|
9 | 9 | { |
10 | 10 | AdminMessage(classLocale::$lang['adm_err_denied']); |
11 | 11 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $username_unsafe = sys_get_param_str_unsafe('username'); |
26 | 26 | $username = sys_get_param_escaped('username'); |
27 | 27 | |
28 | -if($galaxy_src) |
|
28 | +if ($galaxy_src) |
|
29 | 29 | { |
30 | 30 | sn_db_transaction_start(); |
31 | 31 | $errors = array(); |
@@ -35,41 +35,41 @@ discard block |
||
35 | 35 | $planet = sys_o_get_updated($owner, array('galaxy' => $galaxy_src, 'system' => $system_src, 'planet' => $planet_src, 'planet_type' => 1), SN_TIME_NOW); |
36 | 36 | $que = $planet['que']; |
37 | 37 | $planet = $planet['planet']; |
38 | - if(!$planet) |
|
38 | + if (!$planet) |
|
39 | 39 | { |
40 | 40 | $errors[] = classLocale::$lang['adm_pl_comp_err_0']; |
41 | 41 | } |
42 | 42 | |
43 | - if($planet['destruyed']) |
|
43 | + if ($planet['destruyed']) |
|
44 | 44 | { |
45 | 45 | $errors[] = classLocale::$lang['adm_pl_comp_err_1']; |
46 | 46 | } |
47 | 47 | |
48 | - if($planet['id_owner'] != $owner['id'] || !$username) |
|
48 | + if ($planet['id_owner'] != $owner['id'] || !$username) |
|
49 | 49 | { |
50 | 50 | $errors[] = classLocale::$lang['adm_pl_comp_err_4']; |
51 | 51 | } |
52 | 52 | |
53 | 53 | $destination = sys_o_get_updated($owner, array('galaxy' => $galaxy_dst, 'system' => $system_dst, 'planet' => $planet_dst, 'planet_type' => 1), SN_TIME_NOW); |
54 | 54 | $destination = $destination['planet']; |
55 | - if(!$destination) |
|
55 | + if (!$destination) |
|
56 | 56 | { |
57 | 57 | $errors[] = classLocale::$lang['adm_pl_comp_err_2']; |
58 | 58 | } |
59 | 59 | |
60 | - if($planet['id'] == $destination['id']) |
|
60 | + if ($planet['id'] == $destination['id']) |
|
61 | 61 | { |
62 | 62 | $errors[] = classLocale::$lang['adm_pl_comp_err_5']; |
63 | 63 | } |
64 | 64 | |
65 | - if($planet['id_owner'] != $destination['id_owner']) |
|
65 | + if ($planet['id_owner'] != $destination['id_owner']) |
|
66 | 66 | { |
67 | 67 | $errors[] = classLocale::$lang['adm_pl_comp_err_3']; |
68 | 68 | } |
69 | 69 | |
70 | - if(!empty($errors)) |
|
70 | + if (!empty($errors)) |
|
71 | 71 | { |
72 | - foreach($errors as $error) |
|
72 | + foreach ($errors as $error) |
|
73 | 73 | { |
74 | 74 | $template->assign_block_vars('error', array( |
75 | 75 | 'TEXT' => $error, |
@@ -83,14 +83,14 @@ discard block |
||
83 | 83 | killer_add_planet($planet); |
84 | 84 | |
85 | 85 | $moon = db_planet_by_gspt($galaxy_src, $system_src, $planet_src, PT_MOON, true); |
86 | - if($moon) |
|
86 | + if ($moon) |
|
87 | 87 | { |
88 | 88 | $moon = sys_o_get_updated($owner, $moon, SN_TIME_NOW); |
89 | 89 | $moon = $moon['planet']; |
90 | 90 | killer_add_planet($moon); |
91 | 91 | } |
92 | 92 | |
93 | - foreach(sn_get_groups('resources_loot') as $resource_id) |
|
93 | + foreach (sn_get_groups('resources_loot') as $resource_id) |
|
94 | 94 | { |
95 | 95 | $resource_name = pname_resource_name($resource_id); |
96 | 96 | $template->assign_var("{$resource_name}_cost", $final_cost[$resource_id]); |
@@ -98,13 +98,13 @@ discard block |
||
98 | 98 | $template->assign_var("{$resource_name}_bonus", $final_cost[$resource_id]); |
99 | 99 | } |
100 | 100 | |
101 | - if($_GET['btn_confirm']) |
|
101 | + if ($_GET['btn_confirm']) |
|
102 | 102 | { |
103 | 103 | $time = SN_TIME_NOW + PERIOD_DAY; |
104 | 104 | |
105 | 105 | db_unit_list_delete($planet['id_owner'], LOC_PLANET, $planet['id']); |
106 | 106 | db_planet_set_by_id($planet['id'], "id_owner = 0, destruyed = {$time}"); |
107 | - if($moon) |
|
107 | + if ($moon) |
|
108 | 108 | { |
109 | 109 | db_unit_list_delete($planet['id_owner'], LOC_PLANET, $moon['id']); |
110 | 110 | db_planet_set_by_id($moon['id'], "id_owner = 0, destruyed = {$time}"); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | 'username' => $username, |
132 | 132 | )); |
133 | 133 | |
134 | -display(parsetemplate($template), classLocale::$lang['adm_pl_comp_title'], false, '', true ); |
|
134 | +display(parsetemplate($template), classLocale::$lang['adm_pl_comp_title'], false, '', true); |
|
135 | 135 | |
136 | 136 | function killer_add_planet($planet) |
137 | 137 | { |
@@ -146,34 +146,34 @@ discard block |
||
146 | 146 | } |
147 | 147 | */ |
148 | 148 | |
149 | - foreach(sn_get_groups('structures') as $unit_id) |
|
149 | + foreach (sn_get_groups('structures') as $unit_id) |
|
150 | 150 | { |
151 | 151 | $build_level = mrc_get_level($user, $planet, $unit_id, true, true); |
152 | - if($build_level > 0) |
|
152 | + if ($build_level > 0) |
|
153 | 153 | { |
154 | 154 | $unit_cost = get_unit_param($unit_id, 'cost'); |
155 | 155 | $build_factor = $unit_cost['factor'] != 1 ? (1 - pow($unit_cost['factor'], $build_level)) / (1 - $unit_cost['factor']) : $unit_cost['factor']; |
156 | - foreach($sn_group_resources_loot as $resource_id) |
|
156 | + foreach ($sn_group_resources_loot as $resource_id) |
|
157 | 157 | { |
158 | 158 | $final_cost[$resource_id] += isset($unit_cost[$resource_id]) && $unit_cost[$resource_id] > 0 ? floor($unit_cost[$resource_id] * $build_factor) : 0; |
159 | 159 | } |
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
163 | - foreach(sn_get_groups(array('defense', 'fleet')) as $unit_id) |
|
163 | + foreach (sn_get_groups(array('defense', 'fleet')) as $unit_id) |
|
164 | 164 | { |
165 | 165 | $unit_count = mrc_get_level($user, $planet, $unit_id, true, true); |
166 | - if($unit_count > 0) |
|
166 | + if ($unit_count > 0) |
|
167 | 167 | { |
168 | 168 | $unit_cost = get_unit_param($unit_id, 'cost'); |
169 | - foreach($sn_group_resources_loot as $resource_id) |
|
169 | + foreach ($sn_group_resources_loot as $resource_id) |
|
170 | 170 | { |
171 | 171 | $final_cost[$resource_id] += isset($unit_cost[$resource_id]) && $unit_cost[$resource_id] > 0 ? floor($unit_cost[$resource_id] * $unit_count) : 0; |
172 | 172 | } |
173 | 173 | } |
174 | 174 | } |
175 | 175 | |
176 | - foreach($sn_group_resources_loot as $resource_id) |
|
176 | + foreach ($sn_group_resources_loot as $resource_id) |
|
177 | 177 | { |
178 | 178 | $final_cost[$resource_id] += floor(mrc_get_level($user, $planet, $resource_id, true, true)); |
179 | 179 | } |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | |
31 | 31 | static $need_keys = array('server', 'user', 'pass', 'name', 'prefix'); |
32 | 32 | |
33 | - if($this->connected) { |
|
33 | + if ($this->connected) { |
|
34 | 34 | return true; |
35 | 35 | } |
36 | 36 | |
37 | - if(empty($settings) || !is_array($settings) || array_intersect($need_keys, array_keys($settings)) != $need_keys) { |
|
37 | + if (empty($settings) || !is_array($settings) || array_intersect($need_keys, array_keys($settings)) != $need_keys) { |
|
38 | 38 | $debug->error_fatal('There is missconfiguration in your config.php. Check it again'); |
39 | 39 | } |
40 | 40 | |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | return mysqli_fetch_assoc($query); |
85 | 85 | } |
86 | 86 | function mysql_fetch_row(&$query) { |
87 | -if(is_bool($query)) { |
|
87 | +if (is_bool($query)) { |
|
88 | 88 | pdump(debug_backtrace()); |
89 | 89 | pdie(); |
90 | 90 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | return mysqli_real_escape_string($this->link, $unescaped_string); |
95 | 95 | } |
96 | 96 | function mysql_close_link() { |
97 | - if(is_object($this->link)) { |
|
97 | + if (is_object($this->link)) { |
|
98 | 98 | $this->link->close(); |
99 | 99 | $this->connected = false; |
100 | 100 | unset($this->link); |
@@ -44,17 +44,17 @@ discard block |
||
44 | 44 | var $block_else_level = array(); |
45 | 45 | |
46 | 46 | /** |
47 | - * constuctor |
|
48 | - */ |
|
47 | + * constuctor |
|
48 | + */ |
|
49 | 49 | function template_compile(&$template) |
50 | 50 | { |
51 | 51 | $this->template = &$template; |
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
55 | - * Load template source from file |
|
56 | - * @access private |
|
57 | - */ |
|
55 | + * Load template source from file |
|
56 | + * @access private |
|
57 | + */ |
|
58 | 58 | function _tpl_load_file($handle, $store_in_db = false) |
59 | 59 | { |
60 | 60 | // Try and open template for read |
@@ -97,10 +97,10 @@ discard block |
||
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
100 | - * Remove any PHP tags that do not belong, these regular expressions are derived from |
|
101 | - * the ones that exist in zend_language_scanner.l |
|
102 | - * @access private |
|
103 | - */ |
|
100 | + * Remove any PHP tags that do not belong, these regular expressions are derived from |
|
101 | + * the ones that exist in zend_language_scanner.l |
|
102 | + * @access private |
|
103 | + */ |
|
104 | 104 | function remove_php_tags(&$code) |
105 | 105 | { |
106 | 106 | // This matches the information gathered from the internal PHP lexer |
@@ -114,9 +114,9 @@ discard block |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
117 | - * The all seeing all doing compile method. Parts are inspired by or directly from Smarty |
|
118 | - * @access private |
|
119 | - */ |
|
117 | + * The all seeing all doing compile method. Parts are inspired by or directly from Smarty |
|
118 | + * @access private |
|
119 | + */ |
|
120 | 120 | function compile($code, $no_echo = false, $echo_var = '') |
121 | 121 | { |
122 | 122 | if ($echo_var) |
@@ -285,9 +285,9 @@ discard block |
||
285 | 285 | } |
286 | 286 | |
287 | 287 | /** |
288 | - * Compile variables |
|
289 | - * @access private |
|
290 | - */ |
|
288 | + * Compile variables |
|
289 | + * @access private |
|
290 | + */ |
|
291 | 291 | function compile_var_tags(&$text_blocks) |
292 | 292 | { |
293 | 293 | // change template varrefs into PHP varrefs |
@@ -347,9 +347,9 @@ discard block |
||
347 | 347 | } |
348 | 348 | |
349 | 349 | /** |
350 | - * Compile blocks |
|
351 | - * @access private |
|
352 | - */ |
|
350 | + * Compile blocks |
|
351 | + * @access private |
|
352 | + */ |
|
353 | 353 | function compile_tag_block($tag_args) |
354 | 354 | { |
355 | 355 | $no_nesting = false; |
@@ -435,14 +435,14 @@ discard block |
||
435 | 435 | $tag_template_php .= 'if ($_' . $tag_args . '_count) {'; |
436 | 436 | |
437 | 437 | /** |
438 | - * The following uses foreach for iteration instead of a for loop, foreach is faster but requires PHP to make a copy of the contents of the array which uses more memory |
|
439 | - * <code> |
|
440 | - * if (!$offset) |
|
441 | - * { |
|
442 | - * $tag_template_php .= 'foreach (' . $varref . ' as $_' . $tag_args . '_i => $_' . $tag_args . '_val){'; |
|
443 | - * } |
|
444 | - * </code> |
|
445 | - */ |
|
438 | + * The following uses foreach for iteration instead of a for loop, foreach is faster but requires PHP to make a copy of the contents of the array which uses more memory |
|
439 | + * <code> |
|
440 | + * if (!$offset) |
|
441 | + * { |
|
442 | + * $tag_template_php .= 'foreach (' . $varref . ' as $_' . $tag_args . '_i => $_' . $tag_args . '_val){'; |
|
443 | + * } |
|
444 | + * </code> |
|
445 | + */ |
|
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;'; |
@@ -453,10 +453,10 @@ discard block |
||
453 | 453 | } |
454 | 454 | |
455 | 455 | /** |
456 | - * Compile IF tags - much of this is from Smarty with |
|
457 | - * some adaptions for our block level methods |
|
458 | - * @access private |
|
459 | - */ |
|
456 | + * Compile IF tags - much of this is from Smarty with |
|
457 | + * some adaptions for our block level methods |
|
458 | + * @access private |
|
459 | + */ |
|
460 | 460 | function compile_tag_if($tag_args, $elseif) |
461 | 461 | { |
462 | 462 | // Tokenize args for 'if' tag. |
@@ -611,9 +611,9 @@ discard block |
||
611 | 611 | } |
612 | 612 | |
613 | 613 | /** |
614 | - * Compile DEFINE tags |
|
615 | - * @access private |
|
616 | - */ |
|
614 | + * Compile DEFINE tags |
|
615 | + * @access private |
|
616 | + */ |
|
617 | 617 | function compile_tag_define($tag_args, $op) |
618 | 618 | { |
619 | 619 | preg_match('#^((?:[a-z0-9\-_]+\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (\'?)([^\']*)(\'?))?$#', $tag_args, $match); |
@@ -664,9 +664,9 @@ discard block |
||
664 | 664 | } |
665 | 665 | |
666 | 666 | /** |
667 | - * Compile INCLUDE tag |
|
668 | - * @access private |
|
669 | - */ |
|
667 | + * Compile INCLUDE tag |
|
668 | + * @access private |
|
669 | + */ |
|
670 | 670 | function compile_tag_include($tag_args) |
671 | 671 | { |
672 | 672 | // Process dynamic includes |
@@ -679,19 +679,19 @@ discard block |
||
679 | 679 | } |
680 | 680 | |
681 | 681 | /** |
682 | - * Compile INCLUDE_PHP tag |
|
683 | - * @access private |
|
684 | - */ |
|
682 | + * Compile INCLUDE_PHP tag |
|
683 | + * @access private |
|
684 | + */ |
|
685 | 685 | function compile_tag_include_php($tag_args) |
686 | 686 | { |
687 | 687 | return "\$this->_php_include('$tag_args');"; |
688 | 688 | } |
689 | 689 | |
690 | 690 | /** |
691 | - * parse expression |
|
692 | - * This is from Smarty |
|
693 | - * @access private |
|
694 | - */ |
|
691 | + * parse expression |
|
692 | + * This is from Smarty |
|
693 | + * @access private |
|
694 | + */ |
|
695 | 695 | function _parse_is_expr($is_arg, $tokens) |
696 | 696 | { |
697 | 697 | $expr_end = 0; |
@@ -756,13 +756,13 @@ discard block |
||
756 | 756 | } |
757 | 757 | |
758 | 758 | /** |
759 | - * Generates a reference to the given variable inside the given (possibly nested) |
|
760 | - * block namespace. This is a string of the form: |
|
761 | - * ' . $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['varname'] . ' |
|
762 | - * It's ready to be inserted into an "echo" line in one of the templates. |
|
763 | - * NOTE: expects a trailing "." on the namespace. |
|
764 | - * @access private |
|
765 | - */ |
|
759 | + * Generates a reference to the given variable inside the given (possibly nested) |
|
760 | + * block namespace. This is a string of the form: |
|
761 | + * ' . $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['varname'] . ' |
|
762 | + * It's ready to be inserted into an "echo" line in one of the templates. |
|
763 | + * NOTE: expects a trailing "." on the namespace. |
|
764 | + * @access private |
|
765 | + */ |
|
766 | 766 | function generate_block_varref($namespace, $varname, $echo = true, $defop = false) |
767 | 767 | { |
768 | 768 | // Strip the trailing period. |
@@ -780,14 +780,14 @@ discard block |
||
780 | 780 | } |
781 | 781 | |
782 | 782 | /** |
783 | - * Generates a reference to the array of data values for the given |
|
784 | - * (possibly nested) block namespace. This is a string of the form: |
|
785 | - * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN'] |
|
786 | - * |
|
787 | - * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above. |
|
788 | - * NOTE: does not expect a trailing "." on the blockname. |
|
789 | - * @access private |
|
790 | - */ |
|
783 | + * Generates a reference to the array of data values for the given |
|
784 | + * (possibly nested) block namespace. This is a string of the form: |
|
785 | + * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN'] |
|
786 | + * |
|
787 | + * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above. |
|
788 | + * NOTE: does not expect a trailing "." on the blockname. |
|
789 | + * @access private |
|
790 | + */ |
|
791 | 791 | function generate_block_data_ref($blockname, $include_last_iterator, $defop = false) |
792 | 792 | { |
793 | 793 | // Get an array of the blocks involved. |
@@ -823,9 +823,9 @@ discard block |
||
823 | 823 | } |
824 | 824 | |
825 | 825 | /** |
826 | - * Write compiled file to cache directory |
|
827 | - * @access private |
|
828 | - */ |
|
826 | + * Write compiled file to cache directory |
|
827 | + * @access private |
|
828 | + */ |
|
829 | 829 | function compile_write($handle, $data) |
830 | 830 | { |
831 | 831 | $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . DOT_PHP_EX; |
@@ -848,8 +848,8 @@ discard block |
||
848 | 848 | |
849 | 849 | // Gorlum's minifier BOF |
850 | 850 | /** |
851 | - * Minifies template w/i PHP code by removing extra spaces |
|
852 | - */ |
|
851 | + * Minifies template w/i PHP code by removing extra spaces |
|
852 | + */ |
|
853 | 853 | private function minify($html) |
854 | 854 | { |
855 | 855 | if(!classSupernova::$config->tpl_minifier) |
@@ -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 |
@@ -2,28 +2,28 @@ discard block |
||
2 | 2 | |
3 | 3 | $classLocale = classLocale::$lang; |
4 | 4 | |
5 | -if(SN_IN_FLEET !== true) { |
|
5 | +if (SN_IN_FLEET !== true) { |
|
6 | 6 | $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
7 | 7 | } |
8 | 8 | |
9 | 9 | $fleetid = sys_get_param_id('fleetid'); |
10 | 10 | |
11 | -if(!is_numeric($fleetid) || empty($fleetid)) { |
|
11 | +if (!is_numeric($fleetid) || empty($fleetid)) { |
|
12 | 12 | header("Location: fleet.php"); |
13 | 13 | exit(); |
14 | 14 | } |
15 | 15 | |
16 | 16 | $objFleet = new Fleet(); |
17 | 17 | $objFleet->dbLoad($fleetid); |
18 | -if(!$objFleet->dbId) { |
|
18 | +if (!$objFleet->dbId) { |
|
19 | 19 | message(classLocale::$lang['fl_fleet_not_exists'], classLocale::$lang['fl_error']); |
20 | 20 | } |
21 | 21 | |
22 | -if($objFleet->time_arrive_to_target <= SN_TIME_NOW || $objFleet->time_return_to_source < SN_TIME_NOW || $objFleet->isReturning()) { |
|
22 | +if ($objFleet->time_arrive_to_target <= SN_TIME_NOW || $objFleet->time_return_to_source < SN_TIME_NOW || $objFleet->isReturning()) { |
|
23 | 23 | message(classLocale::$lang['fl_isback'], classLocale::$lang['fl_error']); |
24 | 24 | } |
25 | 25 | |
26 | -if($objFleet->playerOwnerId != $user['id']) { |
|
26 | +if ($objFleet->playerOwnerId != $user['id']) { |
|
27 | 27 | $debug->warning(classLocale::$lang['fl_aks_hack_wrong_fleet'], 'Wrong Fleet Owner', 301); |
28 | 28 | message(classLocale::$lang['fl_aks_hack_wrong_fleet'], classLocale::$lang['fl_error']); |
29 | 29 | } |
@@ -34,19 +34,19 @@ discard block |
||
34 | 34 | |
35 | 35 | !$aks && !$userToAdd_unsafe ? $userToAdd_unsafe = $user['username'] : false; |
36 | 36 | |
37 | -if($userToAdd_unsafe) { |
|
37 | +if ($userToAdd_unsafe) { |
|
38 | 38 | $userToAdd = db_escape($userToAdd_unsafe); |
39 | 39 | $userToAddID = db_user_by_username($userToAdd_unsafe, false, 'id', true, true); |
40 | 40 | $userToAddID = $userToAddID['id']; |
41 | 41 | |
42 | - if($objFleet->target_owner_id == $userToAddID) { |
|
42 | + if ($objFleet->target_owner_id == $userToAddID) { |
|
43 | 43 | message(classLocale::$lang['flt_aks_player_same'], classLocale::$lang['fl_error']); |
44 | 44 | } |
45 | 45 | |
46 | - if($userToAddID) { |
|
47 | - if(!$aks) { |
|
46 | + if ($userToAddID) { |
|
47 | + if (!$aks) { |
|
48 | 48 | // No AСS exists - making one |
49 | - if(!$objFleet->group_id) { |
|
49 | + if (!$objFleet->group_id) { |
|
50 | 50 | db_acs_insert($fleetid, $user, $objFleet); |
51 | 51 | |
52 | 52 | $aks = db_acs_get_by_fleet($fleetid); |
@@ -61,17 +61,17 @@ discard block |
||
61 | 61 | |
62 | 62 | $isUserExists = false; |
63 | 63 | $invited_ar = explode(",", $aks['eingeladen']); |
64 | - foreach($invited_ar as $inv) { |
|
65 | - if($userToAddID == $inv) { |
|
64 | + foreach ($invited_ar as $inv) { |
|
65 | + if ($userToAddID == $inv) { |
|
66 | 66 | $isUserExists = true; |
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | - if(count($invited_ar) >= 5) { |
|
70 | + if (count($invited_ar) >= 5) { |
|
71 | 71 | message(classLocale::$lang['flt_aks_error_too_much_players'], classLocale::$lang['fl_error']); |
72 | 72 | } |
73 | 73 | |
74 | - if($isUserExists) { |
|
74 | + if ($isUserExists) { |
|
75 | 75 | $userToAdd_unsafe != $user['username'] ? $add_user_message_mr = sprintf(classLocale::$lang['fl_aks_player_invited_already'], $userToAdd) : false; |
76 | 76 | } else { |
77 | 77 | $add_user_message_mr = sprintf(classLocale::$lang['fl_aks_player_invited'], $userToAdd); |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | 'MISSION_NAME' => classLocale::$lang['type_mission'][MT_AKS], |
94 | 94 | )); |
95 | 95 | |
96 | -if($aks['eingeladen'] && is_array($members = classSupernova::db_get_record_list(LOC_USER, "`id` in ({$aks['eingeladen']})")) && !empty($members)) { |
|
97 | - foreach($members as $row) { |
|
96 | +if ($aks['eingeladen'] && is_array($members = classSupernova::db_get_record_list(LOC_USER, "`id` in ({$aks['eingeladen']})")) && !empty($members)) { |
|
97 | + foreach ($members as $row) { |
|
98 | 98 | $template->assign_block_vars('invited', array( |
99 | 99 | 'NAME' => $row['username'], |
100 | 100 | )); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $fleet_data = tplParseFleetObject($objFleet, $i, $user); |
120 | 120 | |
121 | 121 | $template->assign_block_vars('fleets', $fleet_data['fleet']); |
122 | -foreach($fleet_data['ships'] as $ship_data) { |
|
122 | +foreach ($fleet_data['ships'] as $ship_data) { |
|
123 | 123 | $template->assign_block_vars('fleets.ships', $ship_data); |
124 | 124 | } |
125 | 125 |