@@ -15,7 +15,7 @@ |
||
15 | 15 | |
16 | 16 | $combat_data = sn_ube_report_load(sys_get_param_str('cypher')); |
17 | 17 | |
18 | - if($combat_data != UBE_REPORT_NOT_FOUND) { |
|
18 | + if ($combat_data != UBE_REPORT_NOT_FOUND) { |
|
19 | 19 | sn_ube_report_generate($combat_data, $template_result); |
20 | 20 | $template = gettemplate('ube_combat_report', $template); |
21 | 21 | $template->assign_vars(array( |
@@ -14,14 +14,14 @@ |
||
14 | 14 | global $lang, $user, $planetrow; |
15 | 15 | |
16 | 16 | $tech_tree = array(); |
17 | - foreach(get_unit_param('techtree') as $unit_group_id => $unit_list) |
|
17 | + foreach (get_unit_param('techtree') as $unit_group_id => $unit_list) |
|
18 | 18 | { |
19 | 19 | $tech_tree[] = array( |
20 | 20 | 'NAME' => $lang['tech'][$unit_group_id], |
21 | 21 | 'GROUP_ID' => $unit_group_id, |
22 | 22 | ); |
23 | 23 | |
24 | - foreach($unit_list as $unit_id) |
|
24 | + foreach ($unit_list as $unit_id) |
|
25 | 25 | { |
26 | 26 | $sn_data_unit = get_unit_param($unit_id); |
27 | 27 | $level_basic = $sn_data_unit[P_STACKABLE] ? 0 : mrc_get_level($user, $planetrow, $unit_id, false, true); |
@@ -6,8 +6,7 @@ |
||
6 | 6 | * version 2.0 copyright (c) 2012 by Gorlum for http://supernova.ws |
7 | 7 | */ |
8 | 8 | |
9 | -function sn_techtree_view($template = null) |
|
10 | -{ |
|
9 | +function sn_techtree_view($template = null) { |
|
11 | 10 | global $lang, $user, $planetrow; |
12 | 11 | |
13 | 12 | $tech_tree = array(); |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -function geoip_status(){return sn_function_call('geoip_status', array(&$result));} |
|
3 | +function geoip_status() {return sn_function_call('geoip_status', array(&$result)); } |
|
4 | 4 | function sn_geoip_status(&$result) { |
5 | 5 | return $result = false; |
6 | 6 | } |
7 | 7 | |
8 | -function geoip_ip_info($ip){return sn_function_call('geoip_ip_info', array($ip, &$result));} |
|
8 | +function geoip_ip_info($ip) {return sn_function_call('geoip_ip_info', array($ip, &$result)); } |
|
9 | 9 | function sn_geoip_ip_info($ip, &$result) { |
10 | 10 | return $result = false; |
11 | 11 | } |
@@ -61,8 +61,7 @@ |
||
61 | 61 | 'ALLY_NAME' => htmlentities($row['ally_name'], ENT_COMPAT, 'UTF-8'), |
62 | 62 | 'ALLY_TAG' => htmlentities($row['ally_tag'], ENT_COMPAT, 'UTF-8'), |
63 | 63 | )); |
64 | - } |
|
65 | - elseif($type=='ally') |
|
64 | + } elseif($type=='ally') |
|
66 | 65 | { |
67 | 66 | $template->assign_block_vars('search_result', array( |
68 | 67 | 'ALLY_NAME' => htmlentities($row['ally_name'], ENT_COMPAT, 'UTF-8'), |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
14 | 14 | |
15 | -if(SN::$config->game_mode == GAME_BLITZ) { |
|
15 | +if (SN::$config->game_mode == GAME_BLITZ) { |
|
16 | 16 | messageBox($lang['sys_blitz_page_disabled'], $lang['sys_error'], 'overview.php', 10); |
17 | 17 | die(); |
18 | 18 | } |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | |
26 | 26 | $template = gettemplate('search', true); |
27 | 27 | |
28 | -if($searchtext && $type) |
|
28 | +if ($searchtext && $type) |
|
29 | 29 | { |
30 | - switch($type) |
|
30 | + switch ($type) |
|
31 | 31 | { |
32 | 32 | case "planetname": |
33 | 33 | // $search = db_planet_list_search($searchtext); |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | break; |
44 | 44 | } |
45 | 45 | |
46 | - while($row = db_fetch($search)) |
|
46 | + while ($row = db_fetch($search)) |
|
47 | 47 | { |
48 | - if($type=='playername' || $type=='planetname') |
|
48 | + if ($type == 'playername' || $type == 'planetname') |
|
49 | 49 | { |
50 | 50 | $template->assign_block_vars('search_result', array( |
51 | 51 | 'PLAYER_ID' => $row['uid'], |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | 'ALLY_TAG' => htmlentities($row['ally_tag'], ENT_COMPAT, 'UTF-8'), |
63 | 63 | )); |
64 | 64 | } |
65 | - elseif($type=='ally') |
|
65 | + elseif ($type == 'ally') |
|
66 | 66 | { |
67 | 67 | $template->assign_block_vars('search_result', array( |
68 | 68 | 'ALLY_NAME' => htmlentities($row['ally_name'], ENT_COMPAT, 'UTF-8'), |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | 'ally' => 'sys_alliance', |
82 | 82 | ); |
83 | 83 | |
84 | -foreach($search_type as $type_id => $type_lang) |
|
84 | +foreach ($search_type as $type_id => $type_lang) |
|
85 | 85 | { |
86 | 86 | $template->assign_block_vars('type', array( |
87 | 87 | 'ID' => $type_id, |
@@ -7,8 +7,8 @@ |
||
7 | 7 | * |
8 | 8 | */ |
9 | 9 | |
10 | -define('INSIDE' , true); |
|
11 | -define('INSTALL' , false); |
|
10 | +define('INSIDE', true); |
|
11 | +define('INSTALL', false); |
|
12 | 12 | |
13 | 13 | require('common.' . substr(strrchr(__FILE__, '.'), 1)); |
14 | 14 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | |
16 | 16 | include('includes/init.' . substr(strrchr(__FILE__, '.'), 1)); |
17 | 17 | // die(); |
18 | -if($template_result[F_USER_IS_AUTHORIZED]) { |
|
18 | +if ($template_result[F_USER_IS_AUTHORIZED]) { |
|
19 | 19 | sys_redirect('index' . DOT_PHP_EX); |
20 | 20 | } |
21 | 21 | lng_include('login'); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $newstock = $stock; |
27 | 27 | $intError = MARKET_DEAL; |
28 | 28 | |
29 | -switch($mode) |
|
29 | +switch ($mode) |
|
30 | 30 | { |
31 | 31 | case MARKET_RESOURCES: // Resource trader |
32 | 32 | require('includes/includes/market_trader.inc'); |
@@ -82,12 +82,12 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | $message_id = sys_get_param_int('message'); |
85 | -if($message_id != MARKET_NOTHING) |
|
85 | +if ($message_id != MARKET_NOTHING) |
|
86 | 86 | { |
87 | 87 | $template->assign_block_vars('result', array('MESSAGE' => $lang['eco_mrk_errors'][$message_id])); |
88 | 88 | } |
89 | 89 | |
90 | -if($message) |
|
90 | +if ($message) |
|
91 | 91 | { |
92 | 92 | $template->assign_block_vars('result', array('MESSAGE' => $message)); |
93 | 93 | } |
@@ -41,7 +41,7 @@ |
||
41 | 41 | // $query = static::$db->doquery("SELECT `id` FROM {{confirmations}} WHERE `code` = '{$confirm_code_safe}' AND `type` = {$confirmation_type_safe} FOR UPDATE", true); |
42 | 42 | // Тип не нужен для проверки - код подтверждения должен быть уникален от слова "совсем" |
43 | 43 | $query = $this->db->doquery("SELECT `id` FROM {{confirmations}} WHERE `code` = '{$confirm_code_safe}' FOR UPDATE", true); |
44 | - } while($query); |
|
44 | + } while ($query); |
|
45 | 45 | |
46 | 46 | $this->db->doquery( |
47 | 47 | "REPLACE INTO {{confirmations}} |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | // Search array to get correct position |
587 | 587 | list($search_key, $search_value) = @each($key); |
588 | 588 | |
589 | - $key = NULL; |
|
589 | + $key = null; |
|
590 | 590 | foreach ($this->_tpldata[$blockname] as $i => $val_ary) |
591 | 591 | { |
592 | 592 | if ($val_ary[$search_key] === $search_value) |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | } |
598 | 598 | |
599 | 599 | // key/value pair not found |
600 | - if ($key === NULL) |
|
600 | + if ($key === null) |
|
601 | 601 | { |
602 | 602 | return false; |
603 | 603 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | { |
87 | 87 | global $user; |
88 | 88 | |
89 | - if (file_exists($this->rootPhysical. 'styles/' . $user->theme['template_path'] . '/template')) |
|
89 | + if (file_exists($this->rootPhysical . 'styles/' . $user->theme['template_path'] . '/template')) |
|
90 | 90 | { |
91 | 91 | $this->root = $this->rootPhysical . 'styles/' . $user->theme['template_path'] . '/template'; |
92 | 92 | $this->cachepath = $this->rootPhysical . 'cache/tpl_' . str_replace('_', '-', $user->theme['template_path']) . '_'; |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | // Re-position template blocks |
646 | 646 | for ($i = sizeof($this->_tpldata[$blockname]); $i > $key; $i--) |
647 | 647 | { |
648 | - $this->_tpldata[$blockname][$i] = $this->_tpldata[$blockname][$i-1]; |
|
648 | + $this->_tpldata[$blockname][$i] = $this->_tpldata[$blockname][$i - 1]; |
|
649 | 649 | $this->_tpldata[$blockname][$i]['S_ROW_COUNT'] = $i; |
650 | 650 | } |
651 | 651 | |
@@ -725,13 +725,13 @@ discard block |
||
725 | 725 | */ |
726 | 726 | function assign_recursive($values, $name = '') |
727 | 727 | { |
728 | - if(isset($values['.'])) |
|
728 | + if (isset($values['.'])) |
|
729 | 729 | { |
730 | 730 | $values_extra = $values['.']; |
731 | 731 | unset($values['.']); |
732 | 732 | } |
733 | 733 | |
734 | - if(!$name) |
|
734 | + if (!$name) |
|
735 | 735 | { |
736 | 736 | $this->assign_vars($values); |
737 | 737 | } |
@@ -740,12 +740,12 @@ discard block |
||
740 | 740 | $this->assign_block_vars($name, $values); |
741 | 741 | } |
742 | 742 | |
743 | - if(isset($values_extra)) |
|
743 | + if (isset($values_extra)) |
|
744 | 744 | { |
745 | - foreach($values_extra as $sub_array_name => $sub_array) |
|
745 | + foreach ($values_extra as $sub_array_name => $sub_array) |
|
746 | 746 | { |
747 | 747 | $new_name = $name . ($name ? '.' : '') . $sub_array_name; |
748 | - foreach($sub_array as $sub_element) |
|
748 | + foreach ($sub_array as $sub_element) |
|
749 | 749 | { |
750 | 750 | $this->assign_recursive($sub_element, $new_name); |
751 | 751 | } |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | class template |
26 | 26 | { |
27 | 27 | /** variable that holds all the data we'll be substituting into |
28 | - * the compiled templates. Takes form: |
|
29 | - * --> $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value |
|
30 | - * if it's a root-level variable, it'll be like this: |
|
31 | - * --> $this->_tpldata[.][0][varname] == value |
|
32 | - */ |
|
28 | + * the compiled templates. Takes form: |
|
29 | + * --> $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value |
|
30 | + * if it's a root-level variable, it'll be like this: |
|
31 | + * --> $this->_tpldata[.][0][varname] == value |
|
32 | + */ |
|
33 | 33 | var $_tpldata = array('.' => array(0 => array())); |
34 | 34 | var $_rootref; |
35 | 35 | // var $_block_counter = array(); |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
82 | - * Set template location |
|
83 | - * @access public |
|
84 | - */ |
|
82 | + * Set template location |
|
83 | + * @access public |
|
84 | + */ |
|
85 | 85 | function set_template() |
86 | 86 | { |
87 | 87 | global $user; |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | } |
121 | 121 | |
122 | 122 | /** |
123 | - * Set custom template location (able to use directory outside of phpBB) |
|
124 | - * @access public |
|
125 | - */ |
|
123 | + * Set custom template location (able to use directory outside of phpBB) |
|
124 | + * @access public |
|
125 | + */ |
|
126 | 126 | function set_custom_template($template_path, $template_name, $fallback_template_path = false) |
127 | 127 | { |
128 | 128 | global $user; |
@@ -161,10 +161,10 @@ discard block |
||
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
164 | - * Sets the template filenames for handles. $filename_array |
|
165 | - * should be a hash of handle => filename pairs. |
|
166 | - * @access public |
|
167 | - */ |
|
164 | + * Sets the template filenames for handles. $filename_array |
|
165 | + * should be a hash of handle => filename pairs. |
|
166 | + * @access public |
|
167 | + */ |
|
168 | 168 | function set_filenames($filename_array) |
169 | 169 | { |
170 | 170 | if (!is_array($filename_array)) |
@@ -191,9 +191,9 @@ discard block |
||
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
194 | - * Destroy template data set |
|
195 | - * @access public |
|
196 | - */ |
|
194 | + * Destroy template data set |
|
195 | + * @access public |
|
196 | + */ |
|
197 | 197 | function destroy() |
198 | 198 | { |
199 | 199 | $this->_tpldata = array('.' => array(0 => array())); |
@@ -201,9 +201,9 @@ discard block |
||
201 | 201 | } |
202 | 202 | |
203 | 203 | /** |
204 | - * Reset/empty complete block |
|
205 | - * @access public |
|
206 | - */ |
|
204 | + * Reset/empty complete block |
|
205 | + * @access public |
|
206 | + */ |
|
207 | 207 | function destroy_block_vars($blockname) |
208 | 208 | { |
209 | 209 | if (strpos($blockname, '.') !== false) |
@@ -231,9 +231,9 @@ discard block |
||
231 | 231 | } |
232 | 232 | |
233 | 233 | /** |
234 | - * Display handle |
|
235 | - * @access public |
|
236 | - */ |
|
234 | + * Display handle |
|
235 | + * @access public |
|
236 | + */ |
|
237 | 237 | function display($handle, $include_once = true) |
238 | 238 | { |
239 | 239 | if (defined('IN_ERROR_HANDLER')) |
@@ -258,9 +258,9 @@ discard block |
||
258 | 258 | } |
259 | 259 | |
260 | 260 | /** |
261 | - * Display the handle and assign the output to a template variable or return the compiled result. |
|
262 | - * @access public |
|
263 | - */ |
|
261 | + * Display the handle and assign the output to a template variable or return the compiled result. |
|
262 | + * @access public |
|
263 | + */ |
|
264 | 264 | function assign_display($handle, $template_var = '', $return_content = true, $include_once = false) |
265 | 265 | { |
266 | 266 | ob_start(); |
@@ -278,9 +278,9 @@ discard block |
||
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
281 | - * Load a compiled template if possible, if not, recompile it |
|
282 | - * @access private |
|
283 | - */ |
|
281 | + * Load a compiled template if possible, if not, recompile it |
|
282 | + * @access private |
|
283 | + */ |
|
284 | 284 | function _tpl_load(&$handle) |
285 | 285 | { |
286 | 286 | global $user, $config; |
@@ -458,9 +458,9 @@ discard block |
||
458 | 458 | } |
459 | 459 | |
460 | 460 | /** |
461 | - * Assign key variable pairs from an array |
|
462 | - * @access public |
|
463 | - */ |
|
461 | + * Assign key variable pairs from an array |
|
462 | + * @access public |
|
463 | + */ |
|
464 | 464 | function assign_vars($vararray) |
465 | 465 | { |
466 | 466 | foreach ($vararray as $key => $val) |
@@ -472,9 +472,9 @@ discard block |
||
472 | 472 | } |
473 | 473 | |
474 | 474 | /** |
475 | - * Assign a single variable to a single key |
|
476 | - * @access public |
|
477 | - */ |
|
475 | + * Assign a single variable to a single key |
|
476 | + * @access public |
|
477 | + */ |
|
478 | 478 | function assign_var($varname, $varval) |
479 | 479 | { |
480 | 480 | $this->_rootref[$varname] = $varval; |
@@ -483,9 +483,9 @@ discard block |
||
483 | 483 | } |
484 | 484 | |
485 | 485 | /** |
486 | - * Assign key variable pairs from an array to a specified block |
|
487 | - * @access public |
|
488 | - */ |
|
486 | + * Assign key variable pairs from an array to a specified block |
|
487 | + * @access public |
|
488 | + */ |
|
489 | 489 | function assign_block_vars($blockname, $vararray) |
490 | 490 | { |
491 | 491 | if (strpos($blockname, '.') !== false) |
@@ -550,33 +550,33 @@ discard block |
||
550 | 550 | } |
551 | 551 | |
552 | 552 | /** |
553 | - * Change already assigned key variable pair (one-dimensional - single loop entry) |
|
554 | - * |
|
555 | - * An example of how to use this function: |
|
556 | - * {@example alter_block_array.php} |
|
557 | - * |
|
558 | - * @param string $blockname the blockname, for example 'loop' |
|
559 | - * @param array $vararray the var array to insert/add or merge |
|
560 | - * @param mixed $key Key to search for |
|
561 | - * |
|
562 | - * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position] |
|
563 | - * |
|
564 | - * int: Position [the position to change or insert at directly given] |
|
565 | - * |
|
566 | - * If key is false the position is set to 0 |
|
567 | - * If key is true the position is set to the last entry |
|
568 | - * |
|
569 | - * @param string $mode Mode to execute (valid modes are 'insert' and 'change') |
|
570 | - * |
|
571 | - * If insert, the vararray is inserted at the given position (position counting from zero). |
|
572 | - * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value). |
|
573 | - * |
|
574 | - * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array) |
|
575 | - * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars) |
|
576 | - * |
|
577 | - * @return bool false on error, true on success |
|
578 | - * @access public |
|
579 | - */ |
|
553 | + * Change already assigned key variable pair (one-dimensional - single loop entry) |
|
554 | + * |
|
555 | + * An example of how to use this function: |
|
556 | + * {@example alter_block_array.php} |
|
557 | + * |
|
558 | + * @param string $blockname the blockname, for example 'loop' |
|
559 | + * @param array $vararray the var array to insert/add or merge |
|
560 | + * @param mixed $key Key to search for |
|
561 | + * |
|
562 | + * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position] |
|
563 | + * |
|
564 | + * int: Position [the position to change or insert at directly given] |
|
565 | + * |
|
566 | + * If key is false the position is set to 0 |
|
567 | + * If key is true the position is set to the last entry |
|
568 | + * |
|
569 | + * @param string $mode Mode to execute (valid modes are 'insert' and 'change') |
|
570 | + * |
|
571 | + * If insert, the vararray is inserted at the given position (position counting from zero). |
|
572 | + * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value). |
|
573 | + * |
|
574 | + * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array) |
|
575 | + * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars) |
|
576 | + * |
|
577 | + * @return bool false on error, true on success |
|
578 | + * @access public |
|
579 | + */ |
|
580 | 580 | function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert') |
581 | 581 | { |
582 | 582 | if (strpos($blockname, '.') !== false) |
@@ -660,9 +660,9 @@ discard block |
||
660 | 660 | } |
661 | 661 | |
662 | 662 | /** |
663 | - * Include a separate template |
|
664 | - * @access private |
|
665 | - */ |
|
663 | + * Include a separate template |
|
664 | + * @access private |
|
665 | + */ |
|
666 | 666 | function _tpl_include($filename, $include = true) |
667 | 667 | { |
668 | 668 | // This is used to access global vars |
@@ -691,9 +691,9 @@ discard block |
||
691 | 691 | } |
692 | 692 | |
693 | 693 | /** |
694 | - * Include a php-file |
|
695 | - * @access private |
|
696 | - */ |
|
694 | + * Include a php-file |
|
695 | + * @access private |
|
696 | + */ |
|
697 | 697 | function _php_include($filename) |
698 | 698 | { |
699 | 699 | $file = $this->rootPhysical . $filename; |
@@ -708,9 +708,9 @@ discard block |
||
708 | 708 | } |
709 | 709 | |
710 | 710 | /** |
711 | - * Assign key variable pairs from an array with block support |
|
712 | - * @access public |
|
713 | - */ |
|
711 | + * Assign key variable pairs from an array with block support |
|
712 | + * @access public |
|
713 | + */ |
|
714 | 714 | function assign_recursive($values, $name = '') |
715 | 715 | { |
716 | 716 | if(isset($values['.'])) |
@@ -22,8 +22,7 @@ discard block |
||
22 | 22 | * Base Template class. |
23 | 23 | * @package phpBB3 |
24 | 24 | */ |
25 | -class template |
|
26 | -{ |
|
25 | +class template { |
|
27 | 26 | /** variable that holds all the data we'll be substituting into |
28 | 27 | * the compiled templates. Takes form: |
29 | 28 | * --> $this->_tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value |
@@ -82,8 +81,7 @@ discard block |
||
82 | 81 | * Set template location |
83 | 82 | * @access public |
84 | 83 | */ |
85 | - function set_template() |
|
86 | - { |
|
84 | + function set_template() { |
|
87 | 85 | global $user; |
88 | 86 | |
89 | 87 | if (file_exists($this->rootPhysical. 'styles/' . $user->theme['template_path'] . '/template')) |
@@ -108,8 +106,7 @@ discard block |
||
108 | 106 | { |
109 | 107 | $this->inherit_root = $this->rootPhysical . 'styles/' . $user->theme['template_inherit_path'] . '/template'; |
110 | 108 | } |
111 | - } |
|
112 | - else |
|
109 | + } else |
|
113 | 110 | { |
114 | 111 | trigger_error('Template path could not be found: styles/' . $user->theme['template_path'] . '/template', E_USER_ERROR); |
115 | 112 | } |
@@ -123,8 +120,7 @@ discard block |
||
123 | 120 | * Set custom template location (able to use directory outside of phpBB) |
124 | 121 | * @access public |
125 | 122 | */ |
126 | - function set_custom_template($template_path, $template_name, $fallback_template_path = false) |
|
127 | - { |
|
123 | + function set_custom_template($template_path, $template_name, $fallback_template_path = false) { |
|
128 | 124 | global $user; |
129 | 125 | |
130 | 126 | // Make sure $template_path has no ending slash |
@@ -145,8 +141,7 @@ discard block |
||
145 | 141 | |
146 | 142 | $this->inherit_root = $fallback_template_path; |
147 | 143 | $this->orig_tpl_inherits_id = true; |
148 | - } |
|
149 | - else |
|
144 | + } else |
|
150 | 145 | { |
151 | 146 | $this->orig_tpl_inherits_id = false; |
152 | 147 | } |
@@ -165,8 +160,7 @@ discard block |
||
165 | 160 | * should be a hash of handle => filename pairs. |
166 | 161 | * @access public |
167 | 162 | */ |
168 | - function set_filenames($filename_array) |
|
169 | - { |
|
163 | + function set_filenames($filename_array) { |
|
170 | 164 | if (!is_array($filename_array)) |
171 | 165 | { |
172 | 166 | return false; |
@@ -194,8 +188,7 @@ discard block |
||
194 | 188 | * Destroy template data set |
195 | 189 | * @access public |
196 | 190 | */ |
197 | - function destroy() |
|
198 | - { |
|
191 | + function destroy() { |
|
199 | 192 | $this->_tpldata = array('.' => array(0 => array())); |
200 | 193 | $this->_rootref = &$this->_tpldata['.'][0]; |
201 | 194 | } |
@@ -204,8 +197,7 @@ discard block |
||
204 | 197 | * Reset/empty complete block |
205 | 198 | * @access public |
206 | 199 | */ |
207 | - function destroy_block_vars($blockname) |
|
208 | - { |
|
200 | + function destroy_block_vars($blockname) { |
|
209 | 201 | if (strpos($blockname, '.') !== false) |
210 | 202 | { |
211 | 203 | // Nested block. |
@@ -220,8 +212,7 @@ discard block |
||
220 | 212 | } |
221 | 213 | |
222 | 214 | unset($str[$blocks[$blockcount]]); |
223 | - } |
|
224 | - else |
|
215 | + } else |
|
225 | 216 | { |
226 | 217 | // Top-level block. |
227 | 218 | unset($this->_tpldata[$blockname]); |
@@ -234,8 +225,7 @@ discard block |
||
234 | 225 | * Display handle |
235 | 226 | * @access public |
236 | 227 | */ |
237 | - function display($handle, $include_once = true) |
|
238 | - { |
|
228 | + function display($handle, $include_once = true) { |
|
239 | 229 | if (defined('IN_ERROR_HANDLER')) |
240 | 230 | { |
241 | 231 | $is_enotice = error_reporting(); |
@@ -248,8 +238,7 @@ discard block |
||
248 | 238 | if ($filename = $this->_tpl_load($handle)) |
249 | 239 | { |
250 | 240 | ($include_once) ? include_once($filename) : include($filename); |
251 | - } |
|
252 | - else |
|
241 | + } else |
|
253 | 242 | { |
254 | 243 | $this->evaluate($this->compiled_code[$handle]); |
255 | 244 | } |
@@ -261,8 +250,7 @@ discard block |
||
261 | 250 | * Display the handle and assign the output to a template variable or return the compiled result. |
262 | 251 | * @access public |
263 | 252 | */ |
264 | - function assign_display($handle, $template_var = '', $return_content = true, $include_once = false) |
|
265 | - { |
|
253 | + function assign_display($handle, $template_var = '', $return_content = true, $include_once = false) { |
|
266 | 254 | ob_start(); |
267 | 255 | $this->display($handle, $include_once); |
268 | 256 | $contents = ob_get_clean(); |
@@ -281,8 +269,7 @@ discard block |
||
281 | 269 | * Load a compiled template if possible, if not, recompile it |
282 | 270 | * @access private |
283 | 271 | */ |
284 | - function _tpl_load(&$handle) |
|
285 | - { |
|
272 | + function _tpl_load(&$handle) { |
|
286 | 273 | global $user, $config; |
287 | 274 | |
288 | 275 | if (!isset($this->filename[$handle])) |
@@ -303,8 +290,7 @@ discard block |
||
303 | 290 | if (!file_exists($filename) || @filesize($filename) === 0) |
304 | 291 | { |
305 | 292 | $recompile = true; |
306 | - } |
|
307 | - else if ($config->load_tplcompile) |
|
293 | + } else if ($config->load_tplcompile) |
|
308 | 294 | { |
309 | 295 | // No way around it: we need to check inheritance here |
310 | 296 | if ($user->theme['template_inherits_id'] && !file_exists($this->files[$handle])) |
@@ -387,15 +373,13 @@ discard block |
||
387 | 373 | $this->files[$row['template_filename']] = $file; |
388 | 374 | $this->files_inherit[$row['template_filename']] = $file; |
389 | 375 | $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id']; |
390 | - } |
|
391 | - else if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id']) |
|
376 | + } else if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id']) |
|
392 | 377 | { |
393 | 378 | // Ok, we have a situation. There is a file in the subtemplate, but nothing in the DB. We have to fix that. |
394 | 379 | $force_reload = true; |
395 | 380 | $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id']; |
396 | 381 | } |
397 | - } |
|
398 | - else |
|
382 | + } else |
|
399 | 383 | { |
400 | 384 | $this->files_template[$row['template_filename']] = $user->theme['template_id']; |
401 | 385 | } |
@@ -405,8 +389,7 @@ discard block |
||
405 | 389 | if ($row['template_filename'] == $this->filename[$handle]) |
406 | 390 | { |
407 | 391 | $compile->_tpl_load_file($handle, true); |
408 | - } |
|
409 | - else |
|
392 | + } else |
|
410 | 393 | { |
411 | 394 | $this->files[$row['template_filename']] = $file; |
412 | 395 | $this->filename[$row['template_filename']] = $row['template_filename']; |
@@ -421,8 +404,7 @@ discard block |
||
421 | 404 | { |
422 | 405 | $this->compiled_code[$handle] = $compile->compile(trim($row['template_data'])); |
423 | 406 | $compile->compile_write($handle, $this->compiled_code[$handle]); |
424 | - } |
|
425 | - else |
|
407 | + } else |
|
426 | 408 | { |
427 | 409 | // Only bother compiling if it doesn't already exist |
428 | 410 | if (!file_exists($this->cachepath . str_replace('/', '.', $row['template_filename']) . DOT_PHP_EX)) |
@@ -433,8 +415,7 @@ discard block |
||
433 | 415 | } |
434 | 416 | } |
435 | 417 | } |
436 | - } |
|
437 | - else |
|
418 | + } else |
|
438 | 419 | { |
439 | 420 | $file = $this->root . '/' . $row['template_filename']; |
440 | 421 | |
@@ -461,8 +442,7 @@ discard block |
||
461 | 442 | * Assign key variable pairs from an array |
462 | 443 | * @access public |
463 | 444 | */ |
464 | - function assign_vars($vararray) |
|
465 | - { |
|
445 | + function assign_vars($vararray) { |
|
466 | 446 | foreach ($vararray as $key => $val) |
467 | 447 | { |
468 | 448 | $this->_rootref[$key] = $val; |
@@ -475,8 +455,7 @@ discard block |
||
475 | 455 | * Assign a single variable to a single key |
476 | 456 | * @access public |
477 | 457 | */ |
478 | - function assign_var($varname, $varval) |
|
479 | - { |
|
458 | + function assign_var($varname, $varval) { |
|
480 | 459 | $this->_rootref[$varname] = $varval; |
481 | 460 | |
482 | 461 | return true; |
@@ -486,8 +465,7 @@ discard block |
||
486 | 465 | * Assign key variable pairs from an array to a specified block |
487 | 466 | * @access public |
488 | 467 | */ |
489 | - function assign_block_vars($blockname, $vararray) |
|
490 | - { |
|
468 | + function assign_block_vars($blockname, $vararray) { |
|
491 | 469 | if (strpos($blockname, '.') !== false) |
492 | 470 | { |
493 | 471 | // Nested block. |
@@ -522,8 +500,7 @@ discard block |
||
522 | 500 | // We're adding a new iteration to this block with the given |
523 | 501 | // variable assignments. |
524 | 502 | $str[$blocks[$blockcount]][] = $vararray; |
525 | - } |
|
526 | - else |
|
503 | + } else |
|
527 | 504 | { |
528 | 505 | // Top-level block. |
529 | 506 | $s_row_count = (isset($this->_tpldata[$blockname])) ? sizeof($this->_tpldata[$blockname]) : 0; |
@@ -577,8 +554,7 @@ discard block |
||
577 | 554 | * @return bool false on error, true on success |
578 | 555 | * @access public |
579 | 556 | */ |
580 | - function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert') |
|
581 | - { |
|
557 | + function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert') { |
|
582 | 558 | if (strpos($blockname, '.') !== false) |
583 | 559 | { |
584 | 560 | // Nested blocks are not supported |
@@ -623,8 +599,7 @@ discard block |
||
623 | 599 | $key = sizeof($this->_tpldata[$blockname]); |
624 | 600 | unset($this->_tpldata[$blockname][($key - 1)]['S_LAST_ROW']); |
625 | 601 | $vararray['S_LAST_ROW'] = true; |
626 | - } |
|
627 | - else if ($key === 0) |
|
602 | + } else if ($key === 0) |
|
628 | 603 | { |
629 | 604 | unset($this->_tpldata[$blockname][0]['S_FIRST_ROW']); |
630 | 605 | $vararray['S_FIRST_ROW'] = true; |
@@ -663,8 +638,7 @@ discard block |
||
663 | 638 | * Include a separate template |
664 | 639 | * @access private |
665 | 640 | */ |
666 | - function _tpl_include($filename, $include = true) |
|
667 | - { |
|
641 | + function _tpl_include($filename, $include = true) { |
|
668 | 642 | // This is used to access global vars |
669 | 643 | // global $lang, $config, $user; // Not needed! |
670 | 644 | |
@@ -694,8 +668,7 @@ discard block |
||
694 | 668 | * Include a php-file |
695 | 669 | * @access private |
696 | 670 | */ |
697 | - function _php_include($filename) |
|
698 | - { |
|
671 | + function _php_include($filename) { |
|
699 | 672 | $file = $this->rootPhysical . $filename; |
700 | 673 | |
701 | 674 | if (!file_exists($file)) |
@@ -711,8 +684,7 @@ discard block |
||
711 | 684 | * Assign key variable pairs from an array with block support |
712 | 685 | * @access public |
713 | 686 | */ |
714 | - function assign_recursive($values, $name = '') |
|
715 | - { |
|
687 | + function assign_recursive($values, $name = '') { |
|
716 | 688 | if(isset($values['.'])) |
717 | 689 | { |
718 | 690 | $values_extra = $values['.']; |
@@ -722,8 +694,7 @@ discard block |
||
722 | 694 | if(!$name) |
723 | 695 | { |
724 | 696 | $this->assign_vars($values); |
725 | - } |
|
726 | - else |
|
697 | + } else |
|
727 | 698 | { |
728 | 699 | $this->assign_block_vars($name, $values); |
729 | 700 | } |