@@ -39,8 +39,8 @@ |
||
39 | 39 | 0 => $row['visit_time'], // start |
40 | 40 | 1 => $row['visit_time'], // end |
41 | 41 | ) |
42 | - //: false |
|
43 | - ; |
|
42 | + //: false |
|
43 | + ; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | $session_list = array(); |
@@ -50,52 +50,52 @@ |
||
50 | 50 | stat_tpl_assign($template, $who, 'subject', $subject_list, $sn_group_stat_common); |
51 | 51 | |
52 | 52 | $stat_types = array( |
53 | - STAT_TOTAL => array( |
|
54 | - 'type' => 'total', |
|
55 | - ), |
|
53 | + STAT_TOTAL => array( |
|
54 | + 'type' => 'total', |
|
55 | + ), |
|
56 | 56 | |
57 | - STAT_FLEET => array( |
|
58 | - 'type' => 'fleet', |
|
59 | - ), |
|
57 | + STAT_FLEET => array( |
|
58 | + 'type' => 'fleet', |
|
59 | + ), |
|
60 | 60 | |
61 | - STAT_TECH => array( |
|
62 | - 'type' => 'tech', |
|
63 | - ), |
|
61 | + STAT_TECH => array( |
|
62 | + 'type' => 'tech', |
|
63 | + ), |
|
64 | 64 | |
65 | - STAT_BUILDING => array( |
|
66 | - 'type' => 'build', |
|
67 | - ), |
|
65 | + STAT_BUILDING => array( |
|
66 | + 'type' => 'build', |
|
67 | + ), |
|
68 | 68 | |
69 | - STAT_DEFENSE => array( |
|
70 | - 'type' => 'defs', |
|
71 | - ), |
|
69 | + STAT_DEFENSE => array( |
|
70 | + 'type' => 'defs', |
|
71 | + ), |
|
72 | 72 | |
73 | - STAT_RESOURCE => array( |
|
74 | - 'type' => 'res', |
|
75 | - ), |
|
73 | + STAT_RESOURCE => array( |
|
74 | + 'type' => 'res', |
|
75 | + ), |
|
76 | 76 | |
77 | - STAT_RAID_TOTAL => array( |
|
78 | - 'type' => 'raids', |
|
79 | - ), |
|
77 | + STAT_RAID_TOTAL => array( |
|
78 | + 'type' => 'raids', |
|
79 | + ), |
|
80 | 80 | |
81 | - STAT_RAID_WON => array( |
|
82 | - 'type' => 'raidswin', |
|
83 | - ), |
|
81 | + STAT_RAID_WON => array( |
|
82 | + 'type' => 'raidswin', |
|
83 | + ), |
|
84 | 84 | |
85 | - STAT_RAID_LOST => array( |
|
86 | - 'type' => 'raidsloose', |
|
87 | - ), |
|
85 | + STAT_RAID_LOST => array( |
|
86 | + 'type' => 'raidsloose', |
|
87 | + ), |
|
88 | 88 | |
89 | 89 | STAT_LVL_BUILDING => array( |
90 | - 'type' => 'lvl_minier', |
|
90 | + 'type' => 'lvl_minier', |
|
91 | 91 | ), |
92 | 92 | |
93 | 93 | STAT_LVL_TECH => array( |
94 | - 'type' => 'player_rpg_tech_level', |
|
94 | + 'type' => 'player_rpg_tech_level', |
|
95 | 95 | ), |
96 | 96 | |
97 | 97 | STAT_LVL_RAID => array( |
98 | - 'type' => 'lvl_raid', |
|
98 | + 'type' => 'lvl_raid', |
|
99 | 99 | ), |
100 | 100 | ); |
101 | 101 | stat_tpl_assign($template, $type, 'type', $stat_types, $sn_group_stat_common); |
@@ -27,7 +27,7 @@ |
||
27 | 27 | */ |
28 | 28 | |
29 | 29 | if (!defined('INSIDE')) { |
30 | - die('Hack attempt!'); |
|
30 | + die('Hack attempt!'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | global $config; |
@@ -28,7 +28,7 @@ |
||
28 | 28 | */ |
29 | 29 | if (!defined('INSIDE')) |
30 | 30 | { |
31 | - die('Hack attempt!'); |
|
31 | + die('Hack attempt!'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | $lang_info = array( |
@@ -689,15 +689,15 @@ discard block |
||
689 | 689 | ), |
690 | 690 | |
691 | 691 | 'months' => array( |
692 | - 1 =>'января', |
|
693 | - 2 =>'февраля', |
|
694 | - 3 =>'марта', |
|
695 | - 4 =>'апреля', |
|
696 | - 5 =>'мая', |
|
697 | - 6 =>'июня', |
|
698 | - 7 =>'июля', |
|
699 | - 8 =>'августа', |
|
700 | - 9 =>'сентября', |
|
692 | + 1 =>'января', |
|
693 | + 2 =>'февраля', |
|
694 | + 3 =>'марта', |
|
695 | + 4 =>'апреля', |
|
696 | + 5 =>'мая', |
|
697 | + 6 =>'июня', |
|
698 | + 7 =>'июля', |
|
699 | + 8 =>'августа', |
|
700 | + 9 =>'сентября', |
|
701 | 701 | 10 =>'октября', |
702 | 702 | 11 =>'ноября', |
703 | 703 | 12 =>'декабря' |
@@ -993,7 +993,7 @@ discard block |
||
993 | 993 | PASSWORD_RESTORE_ERROR_ACCOUNT_NOT_EXISTS => 'Внутренняя ошибка - при смене пароля аккаунт не найден! Сообщите об этой ошибке Администрации!', |
994 | 994 | AUTH_PASSWORD_RESET_INSIDE_ERROR_NO_ACCOUNT_FOR_CONFIRMATION => 'ВНУТРЕННЯЯ ОШИБКА! Нет аккаунтов для сброса пароля при корректном коде подтверждения! Пожалуйста, сообщите об этой ошибке Администрации Вселенной!', |
995 | 995 | LOGIN_ERROR_NO_ACCOUNT_FOR_COOKIE_SET => 'ВНУТРЕННЯЯ ОШИБКА! СООБЩИТЕ АДМИНИСТРАЦИИ! Не установлен аккаунт при cookie_set()! Пожалуйста, сообщите об этой ошибке Администрации Вселенной!', |
996 | - ), |
|
996 | + ), |
|
997 | 997 | |
998 | 998 | 'log_reg_email_title' => "Ваша регистрация на сервере %1\$s игры СуперНова", |
999 | 999 | 'log_reg_email_text' => "Подтверждение регистрации для %3\$s\r\n\r\n |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
58 | - * Load template source from file |
|
59 | - * @access private |
|
60 | - */ |
|
58 | + * Load template source from file |
|
59 | + * @access private |
|
60 | + */ |
|
61 | 61 | function _tpl_load_file($handle, $store_in_db = false) |
62 | 62 | { |
63 | 63 | // Try and open template for read |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
103 | - * Remove any PHP tags that do not belong, these regular expressions are derived from |
|
104 | - * the ones that exist in zend_language_scanner.l |
|
105 | - * @access private |
|
106 | - */ |
|
103 | + * Remove any PHP tags that do not belong, these regular expressions are derived from |
|
104 | + * the ones that exist in zend_language_scanner.l |
|
105 | + * @access private |
|
106 | + */ |
|
107 | 107 | function remove_php_tags(&$code) |
108 | 108 | { |
109 | 109 | // This matches the information gathered from the internal PHP lexer |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
120 | - * The all seeing all doing compile method. Parts are inspired by or directly from Smarty |
|
121 | - * @access private |
|
122 | - */ |
|
120 | + * The all seeing all doing compile method. Parts are inspired by or directly from Smarty |
|
121 | + * @access private |
|
122 | + */ |
|
123 | 123 | function compile($code, $no_echo = false, $echo_var = '') |
124 | 124 | { |
125 | 125 | global $config; |
@@ -290,9 +290,9 @@ discard block |
||
290 | 290 | } |
291 | 291 | |
292 | 292 | /** |
293 | - * Compile variables |
|
294 | - * @access private |
|
295 | - */ |
|
293 | + * Compile variables |
|
294 | + * @access private |
|
295 | + */ |
|
296 | 296 | function compile_var_tags(&$text_blocks) |
297 | 297 | { |
298 | 298 | // including $lang variable |
@@ -359,9 +359,9 @@ discard block |
||
359 | 359 | } |
360 | 360 | |
361 | 361 | /** |
362 | - * Compile blocks |
|
363 | - * @access private |
|
364 | - */ |
|
362 | + * Compile blocks |
|
363 | + * @access private |
|
364 | + */ |
|
365 | 365 | function compile_tag_block($tag_args) |
366 | 366 | { |
367 | 367 | $no_nesting = false; |
@@ -447,14 +447,14 @@ discard block |
||
447 | 447 | $tag_template_php .= 'if ($_' . $tag_args . '_count) {'; |
448 | 448 | |
449 | 449 | /** |
450 | - * 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 |
|
451 | - * <code> |
|
452 | - * if (!$offset) |
|
453 | - * { |
|
454 | - * $tag_template_php .= 'foreach (' . $varref . ' as $_' . $tag_args . '_i => $_' . $tag_args . '_val){'; |
|
455 | - * } |
|
456 | - * </code> |
|
457 | - */ |
|
450 | + * 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 |
|
451 | + * <code> |
|
452 | + * if (!$offset) |
|
453 | + * { |
|
454 | + * $tag_template_php .= 'foreach (' . $varref . ' as $_' . $tag_args . '_i => $_' . $tag_args . '_val){'; |
|
455 | + * } |
|
456 | + * </code> |
|
457 | + */ |
|
458 | 458 | |
459 | 459 | $tag_template_php .= 'for ($_' . $tag_args . '_i = ' . $loop_start . '; $_' . $tag_args . '_i < ' . $loop_end . '; ++$_' . $tag_args . '_i){'; |
460 | 460 | // $tag_template_php .= '$this->_block_counter["'. $tag_args . '"] = $_' . $tag_args . '_i;'; |
@@ -465,10 +465,10 @@ discard block |
||
465 | 465 | } |
466 | 466 | |
467 | 467 | /** |
468 | - * Compile IF tags - much of this is from Smarty with |
|
469 | - * some adaptions for our block level methods |
|
470 | - * @access private |
|
471 | - */ |
|
468 | + * Compile IF tags - much of this is from Smarty with |
|
469 | + * some adaptions for our block level methods |
|
470 | + * @access private |
|
471 | + */ |
|
472 | 472 | function compile_tag_if($tag_args, $elseif) |
473 | 473 | { |
474 | 474 | // Tokenize args for 'if' tag. |
@@ -623,9 +623,9 @@ discard block |
||
623 | 623 | } |
624 | 624 | |
625 | 625 | /** |
626 | - * Compile DEFINE tags |
|
627 | - * @access private |
|
628 | - */ |
|
626 | + * Compile DEFINE tags |
|
627 | + * @access private |
|
628 | + */ |
|
629 | 629 | function compile_tag_define($tag_args, $op) |
630 | 630 | { |
631 | 631 | preg_match('#^((?:[a-z0-9\-_]+\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (\'?)([^\']*)(\'?))?$#', $tag_args, $match); |
@@ -676,9 +676,9 @@ discard block |
||
676 | 676 | } |
677 | 677 | |
678 | 678 | /** |
679 | - * Compile INCLUDE tag |
|
680 | - * @access private |
|
681 | - */ |
|
679 | + * Compile INCLUDE tag |
|
680 | + * @access private |
|
681 | + */ |
|
682 | 682 | function compile_tag_include($tag_args) |
683 | 683 | { |
684 | 684 | // Process dynamic includes |
@@ -691,19 +691,19 @@ discard block |
||
691 | 691 | } |
692 | 692 | |
693 | 693 | /** |
694 | - * Compile INCLUDE_PHP tag |
|
695 | - * @access private |
|
696 | - */ |
|
694 | + * Compile INCLUDE_PHP tag |
|
695 | + * @access private |
|
696 | + */ |
|
697 | 697 | function compile_tag_include_php($tag_args) |
698 | 698 | { |
699 | 699 | return "\$this->_php_include('$tag_args');"; |
700 | 700 | } |
701 | 701 | |
702 | 702 | /** |
703 | - * parse expression |
|
704 | - * This is from Smarty |
|
705 | - * @access private |
|
706 | - */ |
|
703 | + * parse expression |
|
704 | + * This is from Smarty |
|
705 | + * @access private |
|
706 | + */ |
|
707 | 707 | function _parse_is_expr($is_arg, $tokens) |
708 | 708 | { |
709 | 709 | $expr_end = 0; |
@@ -768,13 +768,13 @@ discard block |
||
768 | 768 | } |
769 | 769 | |
770 | 770 | /** |
771 | - * Generates a reference to the given variable inside the given (possibly nested) |
|
772 | - * block namespace. This is a string of the form: |
|
773 | - * ' . $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['varname'] . ' |
|
774 | - * It's ready to be inserted into an "echo" line in one of the templates. |
|
775 | - * NOTE: expects a trailing "." on the namespace. |
|
776 | - * @access private |
|
777 | - */ |
|
771 | + * Generates a reference to the given variable inside the given (possibly nested) |
|
772 | + * block namespace. This is a string of the form: |
|
773 | + * ' . $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['varname'] . ' |
|
774 | + * It's ready to be inserted into an "echo" line in one of the templates. |
|
775 | + * NOTE: expects a trailing "." on the namespace. |
|
776 | + * @access private |
|
777 | + */ |
|
778 | 778 | function generate_block_varref($namespace, $varname, $echo = true, $defop = false) |
779 | 779 | { |
780 | 780 | // Strip the trailing period. |
@@ -792,14 +792,14 @@ discard block |
||
792 | 792 | } |
793 | 793 | |
794 | 794 | /** |
795 | - * Generates a reference to the array of data values for the given |
|
796 | - * (possibly nested) block namespace. This is a string of the form: |
|
797 | - * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN'] |
|
798 | - * |
|
799 | - * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above. |
|
800 | - * NOTE: does not expect a trailing "." on the blockname. |
|
801 | - * @access private |
|
802 | - */ |
|
795 | + * Generates a reference to the array of data values for the given |
|
796 | + * (possibly nested) block namespace. This is a string of the form: |
|
797 | + * $this->_tpldata['parent'][$_parent_i]['$child1'][$_child1_i]['$child2'][$_child2_i]...['$childN'] |
|
798 | + * |
|
799 | + * If $include_last_iterator is true, then [$_childN_i] will be appended to the form shown above. |
|
800 | + * NOTE: does not expect a trailing "." on the blockname. |
|
801 | + * @access private |
|
802 | + */ |
|
803 | 803 | function generate_block_data_ref($blockname, $include_last_iterator, $defop = false) |
804 | 804 | { |
805 | 805 | // Get an array of the blocks involved. |
@@ -835,9 +835,9 @@ discard block |
||
835 | 835 | } |
836 | 836 | |
837 | 837 | /** |
838 | - * Write compiled file to cache directory |
|
839 | - * @access private |
|
840 | - */ |
|
838 | + * Write compiled file to cache directory |
|
839 | + * @access private |
|
840 | + */ |
|
841 | 841 | function compile_write($handle, $data) |
842 | 842 | { |
843 | 843 | $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . DOT_PHP_EX; |
@@ -860,9 +860,9 @@ discard block |
||
860 | 860 | |
861 | 861 | // Gorlum's minifier BOF |
862 | 862 | /** |
863 | - * Minifies template w/i PHP code by removing extra spaces |
|
864 | - * @access private |
|
865 | - */ |
|
863 | + * Minifies template w/i PHP code by removing extra spaces |
|
864 | + * @access private |
|
865 | + */ |
|
866 | 866 | function minify($html) |
867 | 867 | { |
868 | 868 | global $config; |
@@ -29,7 +29,7 @@ |
||
29 | 29 | */ |
30 | 30 | protected $_repository; |
31 | 31 | |
32 | - /** |
|
32 | + /** |
|
33 | 33 | * @var ContainerPlus $_oldRepo |
34 | 34 | */ |
35 | 35 | protected $_oldRepo; |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | */ |
17 | 17 | if (!defined('IN_PHPBB')) |
18 | 18 | { |
19 | - exit; |
|
19 | + exit; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -24,227 +24,227 @@ discard block |
||
24 | 24 | */ |
25 | 25 | class phpbb_hook |
26 | 26 | { |
27 | - /** |
|
28 | - * Registered hooks |
|
29 | - */ |
|
30 | - var $hooks = array(); |
|
31 | - |
|
32 | - /** |
|
33 | - * Results returned by functions called |
|
34 | - */ |
|
35 | - var $hook_result = array(); |
|
36 | - |
|
37 | - /** |
|
38 | - * internal pointer |
|
39 | - */ |
|
40 | - var $current_hook = NULL; |
|
41 | - |
|
42 | - /** |
|
43 | - * Initialize hook class. |
|
44 | - * |
|
45 | - * @param array $valid_hooks array containing the hookable functions/methods |
|
46 | - */ |
|
47 | - function phpbb_hook($valid_hooks) |
|
48 | - { |
|
49 | - foreach ($valid_hooks as $_null => $method) |
|
50 | - { |
|
51 | - $this->add_hook($method); |
|
52 | - } |
|
53 | - |
|
54 | - if (function_exists('phpbb_hook_register')) |
|
55 | - { |
|
56 | - phpbb_hook_register($this); |
|
57 | - } |
|
58 | - } |
|
59 | - |
|
60 | - /** |
|
61 | - * Register function/method to be called within hook |
|
62 | - * This function is normally called by the modification/application to attach/register the functions. |
|
63 | - * |
|
64 | - * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
65 | - * @param mixed $hook The replacement function/method to be called. Passing function name or array with object/class definition |
|
66 | - * @param string $mode Specify the priority/chain mode. 'normal' -> hook gets appended to the chain. 'standalone' -> only the specified hook gets called - later hooks are not able to overwrite this (E_NOTICE is triggered then). 'first' -> hook is called as the first one within the chain. 'last' -> hook is called as the last one within the chain. |
|
67 | - */ |
|
68 | - function register($definition, $hook, $mode = 'normal') |
|
69 | - { |
|
70 | - $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
71 | - $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
72 | - |
|
73 | - // Method able to be hooked? |
|
74 | - if (isset($this->hooks[$class][$function])) |
|
75 | - { |
|
76 | - switch ($mode) |
|
77 | - { |
|
78 | - case 'standalone': |
|
79 | - if (!isset($this->hooks[$class][$function]['standalone'])) |
|
80 | - { |
|
81 | - $this->hooks[$class][$function] = array('standalone' => $hook); |
|
82 | - } |
|
83 | - else |
|
84 | - { |
|
85 | - trigger_error('Hook not able to be called standalone, previous hook already standalone.', E_NOTICE); |
|
86 | - } |
|
87 | - break; |
|
88 | - |
|
89 | - case 'first': |
|
90 | - case 'last': |
|
91 | - $this->hooks[$class][$function][$mode][] = $hook; |
|
92 | - break; |
|
93 | - |
|
94 | - case 'normal': |
|
95 | - default: |
|
96 | - $this->hooks[$class][$function]['normal'][] = $hook; |
|
97 | - break; |
|
98 | - } |
|
99 | - } |
|
100 | - } |
|
101 | - |
|
102 | - /** |
|
103 | - * Calling all functions/methods attached to a specified hook. |
|
104 | - * Called by the function allowing hooks... |
|
105 | - * |
|
106 | - * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
107 | - * @return bool False if no hook got executed, true otherwise |
|
108 | - */ |
|
109 | - function call_hook($definition) |
|
110 | - { |
|
111 | - $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
112 | - $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
113 | - |
|
114 | - if (!empty($this->hooks[$class][$function])) |
|
115 | - { |
|
116 | - // Developer tries to call a hooked function within the hooked function... |
|
117 | - if ($this->current_hook !== NULL && $this->current_hook['class'] === $class && $this->current_hook['function'] === $function) |
|
118 | - { |
|
119 | - return false; |
|
120 | - } |
|
121 | - |
|
122 | - // Call the hook with the arguments attached and store result |
|
123 | - $arguments = func_get_args(); |
|
124 | - $this->current_hook = array('class' => $class, 'function' => $function); |
|
125 | - $arguments[0] = &$this; |
|
126 | - |
|
127 | - // Call the hook chain... |
|
128 | - if (isset($this->hooks[$class][$function]['standalone'])) |
|
129 | - { |
|
130 | - $this->hook_result[$class][$function] = call_user_func_array($this->hooks[$class][$function]['standalone'], $arguments); |
|
131 | - } |
|
132 | - else |
|
133 | - { |
|
134 | - foreach (array('first', 'normal', 'last') as $mode) |
|
135 | - { |
|
136 | - if (!isset($this->hooks[$class][$function][$mode])) |
|
137 | - { |
|
138 | - continue; |
|
139 | - } |
|
140 | - |
|
141 | - foreach ($this->hooks[$class][$function][$mode] as $hook) |
|
142 | - { |
|
143 | - $this->hook_result[$class][$function] = call_user_func_array($hook, $arguments); |
|
144 | - } |
|
145 | - } |
|
146 | - } |
|
147 | - |
|
148 | - $this->current_hook = NULL; |
|
149 | - return true; |
|
150 | - } |
|
151 | - |
|
152 | - $this->current_hook = NULL; |
|
153 | - return false; |
|
154 | - } |
|
155 | - |
|
156 | - /** |
|
157 | - * Get result from previously called functions/methods for the same hook |
|
158 | - * |
|
159 | - * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
160 | - * @return mixed False if nothing returned if there is no result, else array('result' => ... ) |
|
161 | - */ |
|
162 | - function previous_hook_result($definition) |
|
163 | - { |
|
164 | - $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
165 | - $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
166 | - |
|
167 | - if (!empty($this->hooks[$class][$function]) && isset($this->hook_result[$class][$function])) |
|
168 | - { |
|
169 | - return array('result' => $this->hook_result[$class][$function]); |
|
170 | - } |
|
171 | - |
|
172 | - return false; |
|
173 | - } |
|
174 | - |
|
175 | - /** |
|
176 | - * Check if the called functions/methods returned something. |
|
177 | - * |
|
178 | - * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
179 | - * @return bool True if results are there, false if not |
|
180 | - */ |
|
181 | - function hook_return($definition) |
|
182 | - { |
|
183 | - $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
184 | - $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
185 | - |
|
186 | - if (!empty($this->hooks[$class][$function]) && isset($this->hook_result[$class][$function])) |
|
187 | - { |
|
188 | - return true; |
|
189 | - } |
|
190 | - |
|
191 | - return false; |
|
192 | - } |
|
193 | - |
|
194 | - /** |
|
195 | - * Give actual result from called functions/methods back. |
|
196 | - * |
|
197 | - * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
198 | - * @return mixed The result |
|
199 | - */ |
|
200 | - function hook_return_result($definition) |
|
201 | - { |
|
202 | - $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
203 | - $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
204 | - |
|
205 | - if (!empty($this->hooks[$class][$function]) && isset($this->hook_result[$class][$function])) |
|
206 | - { |
|
207 | - $result = $this->hook_result[$class][$function]; |
|
208 | - unset($this->hook_result[$class][$function]); |
|
209 | - return $result; |
|
210 | - } |
|
211 | - |
|
212 | - return; |
|
213 | - } |
|
214 | - |
|
215 | - /** |
|
216 | - * Add new function to the allowed hooks. |
|
217 | - * |
|
218 | - * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
219 | - */ |
|
220 | - function add_hook($definition) |
|
221 | - { |
|
222 | - if (!is_array($definition)) |
|
223 | - { |
|
224 | - $definition = array('__global', $definition); |
|
225 | - } |
|
226 | - |
|
227 | - $this->hooks[$definition[0]][$definition[1]] = array(); |
|
228 | - } |
|
229 | - |
|
230 | - /** |
|
231 | - * Remove function from the allowed hooks. |
|
232 | - * |
|
233 | - * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
234 | - */ |
|
235 | - function remove_hook($definition) |
|
236 | - { |
|
237 | - $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
238 | - $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
239 | - |
|
240 | - if (isset($this->hooks[$class][$function])) |
|
241 | - { |
|
242 | - unset($this->hooks[$class][$function]); |
|
243 | - |
|
244 | - if (isset($this->hook_result[$class][$function])) |
|
245 | - { |
|
246 | - unset($this->hook_result[$class][$function]); |
|
247 | - } |
|
248 | - } |
|
249 | - } |
|
27 | + /** |
|
28 | + * Registered hooks |
|
29 | + */ |
|
30 | + var $hooks = array(); |
|
31 | + |
|
32 | + /** |
|
33 | + * Results returned by functions called |
|
34 | + */ |
|
35 | + var $hook_result = array(); |
|
36 | + |
|
37 | + /** |
|
38 | + * internal pointer |
|
39 | + */ |
|
40 | + var $current_hook = NULL; |
|
41 | + |
|
42 | + /** |
|
43 | + * Initialize hook class. |
|
44 | + * |
|
45 | + * @param array $valid_hooks array containing the hookable functions/methods |
|
46 | + */ |
|
47 | + function phpbb_hook($valid_hooks) |
|
48 | + { |
|
49 | + foreach ($valid_hooks as $_null => $method) |
|
50 | + { |
|
51 | + $this->add_hook($method); |
|
52 | + } |
|
53 | + |
|
54 | + if (function_exists('phpbb_hook_register')) |
|
55 | + { |
|
56 | + phpbb_hook_register($this); |
|
57 | + } |
|
58 | + } |
|
59 | + |
|
60 | + /** |
|
61 | + * Register function/method to be called within hook |
|
62 | + * This function is normally called by the modification/application to attach/register the functions. |
|
63 | + * |
|
64 | + * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
65 | + * @param mixed $hook The replacement function/method to be called. Passing function name or array with object/class definition |
|
66 | + * @param string $mode Specify the priority/chain mode. 'normal' -> hook gets appended to the chain. 'standalone' -> only the specified hook gets called - later hooks are not able to overwrite this (E_NOTICE is triggered then). 'first' -> hook is called as the first one within the chain. 'last' -> hook is called as the last one within the chain. |
|
67 | + */ |
|
68 | + function register($definition, $hook, $mode = 'normal') |
|
69 | + { |
|
70 | + $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
71 | + $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
72 | + |
|
73 | + // Method able to be hooked? |
|
74 | + if (isset($this->hooks[$class][$function])) |
|
75 | + { |
|
76 | + switch ($mode) |
|
77 | + { |
|
78 | + case 'standalone': |
|
79 | + if (!isset($this->hooks[$class][$function]['standalone'])) |
|
80 | + { |
|
81 | + $this->hooks[$class][$function] = array('standalone' => $hook); |
|
82 | + } |
|
83 | + else |
|
84 | + { |
|
85 | + trigger_error('Hook not able to be called standalone, previous hook already standalone.', E_NOTICE); |
|
86 | + } |
|
87 | + break; |
|
88 | + |
|
89 | + case 'first': |
|
90 | + case 'last': |
|
91 | + $this->hooks[$class][$function][$mode][] = $hook; |
|
92 | + break; |
|
93 | + |
|
94 | + case 'normal': |
|
95 | + default: |
|
96 | + $this->hooks[$class][$function]['normal'][] = $hook; |
|
97 | + break; |
|
98 | + } |
|
99 | + } |
|
100 | + } |
|
101 | + |
|
102 | + /** |
|
103 | + * Calling all functions/methods attached to a specified hook. |
|
104 | + * Called by the function allowing hooks... |
|
105 | + * |
|
106 | + * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
107 | + * @return bool False if no hook got executed, true otherwise |
|
108 | + */ |
|
109 | + function call_hook($definition) |
|
110 | + { |
|
111 | + $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
112 | + $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
113 | + |
|
114 | + if (!empty($this->hooks[$class][$function])) |
|
115 | + { |
|
116 | + // Developer tries to call a hooked function within the hooked function... |
|
117 | + if ($this->current_hook !== NULL && $this->current_hook['class'] === $class && $this->current_hook['function'] === $function) |
|
118 | + { |
|
119 | + return false; |
|
120 | + } |
|
121 | + |
|
122 | + // Call the hook with the arguments attached and store result |
|
123 | + $arguments = func_get_args(); |
|
124 | + $this->current_hook = array('class' => $class, 'function' => $function); |
|
125 | + $arguments[0] = &$this; |
|
126 | + |
|
127 | + // Call the hook chain... |
|
128 | + if (isset($this->hooks[$class][$function]['standalone'])) |
|
129 | + { |
|
130 | + $this->hook_result[$class][$function] = call_user_func_array($this->hooks[$class][$function]['standalone'], $arguments); |
|
131 | + } |
|
132 | + else |
|
133 | + { |
|
134 | + foreach (array('first', 'normal', 'last') as $mode) |
|
135 | + { |
|
136 | + if (!isset($this->hooks[$class][$function][$mode])) |
|
137 | + { |
|
138 | + continue; |
|
139 | + } |
|
140 | + |
|
141 | + foreach ($this->hooks[$class][$function][$mode] as $hook) |
|
142 | + { |
|
143 | + $this->hook_result[$class][$function] = call_user_func_array($hook, $arguments); |
|
144 | + } |
|
145 | + } |
|
146 | + } |
|
147 | + |
|
148 | + $this->current_hook = NULL; |
|
149 | + return true; |
|
150 | + } |
|
151 | + |
|
152 | + $this->current_hook = NULL; |
|
153 | + return false; |
|
154 | + } |
|
155 | + |
|
156 | + /** |
|
157 | + * Get result from previously called functions/methods for the same hook |
|
158 | + * |
|
159 | + * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
160 | + * @return mixed False if nothing returned if there is no result, else array('result' => ... ) |
|
161 | + */ |
|
162 | + function previous_hook_result($definition) |
|
163 | + { |
|
164 | + $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
165 | + $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
166 | + |
|
167 | + if (!empty($this->hooks[$class][$function]) && isset($this->hook_result[$class][$function])) |
|
168 | + { |
|
169 | + return array('result' => $this->hook_result[$class][$function]); |
|
170 | + } |
|
171 | + |
|
172 | + return false; |
|
173 | + } |
|
174 | + |
|
175 | + /** |
|
176 | + * Check if the called functions/methods returned something. |
|
177 | + * |
|
178 | + * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
179 | + * @return bool True if results are there, false if not |
|
180 | + */ |
|
181 | + function hook_return($definition) |
|
182 | + { |
|
183 | + $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
184 | + $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
185 | + |
|
186 | + if (!empty($this->hooks[$class][$function]) && isset($this->hook_result[$class][$function])) |
|
187 | + { |
|
188 | + return true; |
|
189 | + } |
|
190 | + |
|
191 | + return false; |
|
192 | + } |
|
193 | + |
|
194 | + /** |
|
195 | + * Give actual result from called functions/methods back. |
|
196 | + * |
|
197 | + * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
198 | + * @return mixed The result |
|
199 | + */ |
|
200 | + function hook_return_result($definition) |
|
201 | + { |
|
202 | + $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
203 | + $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
204 | + |
|
205 | + if (!empty($this->hooks[$class][$function]) && isset($this->hook_result[$class][$function])) |
|
206 | + { |
|
207 | + $result = $this->hook_result[$class][$function]; |
|
208 | + unset($this->hook_result[$class][$function]); |
|
209 | + return $result; |
|
210 | + } |
|
211 | + |
|
212 | + return; |
|
213 | + } |
|
214 | + |
|
215 | + /** |
|
216 | + * Add new function to the allowed hooks. |
|
217 | + * |
|
218 | + * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
219 | + */ |
|
220 | + function add_hook($definition) |
|
221 | + { |
|
222 | + if (!is_array($definition)) |
|
223 | + { |
|
224 | + $definition = array('__global', $definition); |
|
225 | + } |
|
226 | + |
|
227 | + $this->hooks[$definition[0]][$definition[1]] = array(); |
|
228 | + } |
|
229 | + |
|
230 | + /** |
|
231 | + * Remove function from the allowed hooks. |
|
232 | + * |
|
233 | + * @param mixed $definition Declaring function (with __FUNCTION__) or class with array(__CLASS__, __FUNCTION__) |
|
234 | + */ |
|
235 | + function remove_hook($definition) |
|
236 | + { |
|
237 | + $class = (!is_array($definition)) ? '__global' : $definition[0]; |
|
238 | + $function = (!is_array($definition)) ? $definition : $definition[1]; |
|
239 | + |
|
240 | + if (isset($this->hooks[$class][$function])) |
|
241 | + { |
|
242 | + unset($this->hooks[$class][$function]); |
|
243 | + |
|
244 | + if (isset($this->hook_result[$class][$function])) |
|
245 | + { |
|
246 | + unset($this->hook_result[$class][$function]); |
|
247 | + } |
|
248 | + } |
|
249 | + } |
|
250 | 250 | } |
@@ -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 | /** |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
278 | - * Display the handle and assign the output to a template variable or return the compiled result. |
|
279 | - * @access public |
|
280 | - */ |
|
278 | + * Display the handle and assign the output to a template variable or return the compiled result. |
|
279 | + * @access public |
|
280 | + */ |
|
281 | 281 | function assign_display($handle, $template_var = '', $return_content = true, $include_once = false) |
282 | 282 | { |
283 | 283 | ob_start(); |
@@ -295,9 +295,9 @@ discard block |
||
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
298 | - * Load a compiled template if possible, if not, recompile it |
|
299 | - * @access private |
|
300 | - */ |
|
298 | + * Load a compiled template if possible, if not, recompile it |
|
299 | + * @access private |
|
300 | + */ |
|
301 | 301 | function _tpl_load(&$handle) |
302 | 302 | { |
303 | 303 | global $user, $config; |
@@ -475,9 +475,9 @@ discard block |
||
475 | 475 | } |
476 | 476 | |
477 | 477 | /** |
478 | - * Assign key variable pairs from an array |
|
479 | - * @access public |
|
480 | - */ |
|
478 | + * Assign key variable pairs from an array |
|
479 | + * @access public |
|
480 | + */ |
|
481 | 481 | function assign_vars($vararray) |
482 | 482 | { |
483 | 483 | foreach ($vararray as $key => $val) |
@@ -489,9 +489,9 @@ discard block |
||
489 | 489 | } |
490 | 490 | |
491 | 491 | /** |
492 | - * Assign a single variable to a single key |
|
493 | - * @access public |
|
494 | - */ |
|
492 | + * Assign a single variable to a single key |
|
493 | + * @access public |
|
494 | + */ |
|
495 | 495 | function assign_var($varname, $varval) |
496 | 496 | { |
497 | 497 | $this->_rootref[$varname] = $varval; |
@@ -500,9 +500,9 @@ discard block |
||
500 | 500 | } |
501 | 501 | |
502 | 502 | /** |
503 | - * Assign key variable pairs from an array to a specified block |
|
504 | - * @access public |
|
505 | - */ |
|
503 | + * Assign key variable pairs from an array to a specified block |
|
504 | + * @access public |
|
505 | + */ |
|
506 | 506 | function assign_block_vars($blockname, $vararray) |
507 | 507 | { |
508 | 508 | if (strpos($blockname, '.') !== false) |
@@ -567,33 +567,33 @@ discard block |
||
567 | 567 | } |
568 | 568 | |
569 | 569 | /** |
570 | - * Change already assigned key variable pair (one-dimensional - single loop entry) |
|
571 | - * |
|
572 | - * An example of how to use this function: |
|
573 | - * {@example alter_block_array.php} |
|
574 | - * |
|
575 | - * @param string $blockname the blockname, for example 'loop' |
|
576 | - * @param array $vararray the var array to insert/add or merge |
|
577 | - * @param mixed $key Key to search for |
|
578 | - * |
|
579 | - * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position] |
|
580 | - * |
|
581 | - * int: Position [the position to change or insert at directly given] |
|
582 | - * |
|
583 | - * If key is false the position is set to 0 |
|
584 | - * If key is true the position is set to the last entry |
|
585 | - * |
|
586 | - * @param string $mode Mode to execute (valid modes are 'insert' and 'change') |
|
587 | - * |
|
588 | - * If insert, the vararray is inserted at the given position (position counting from zero). |
|
589 | - * 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). |
|
590 | - * |
|
591 | - * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array) |
|
592 | - * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars) |
|
593 | - * |
|
594 | - * @return bool false on error, true on success |
|
595 | - * @access public |
|
596 | - */ |
|
570 | + * Change already assigned key variable pair (one-dimensional - single loop entry) |
|
571 | + * |
|
572 | + * An example of how to use this function: |
|
573 | + * {@example alter_block_array.php} |
|
574 | + * |
|
575 | + * @param string $blockname the blockname, for example 'loop' |
|
576 | + * @param array $vararray the var array to insert/add or merge |
|
577 | + * @param mixed $key Key to search for |
|
578 | + * |
|
579 | + * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position] |
|
580 | + * |
|
581 | + * int: Position [the position to change or insert at directly given] |
|
582 | + * |
|
583 | + * If key is false the position is set to 0 |
|
584 | + * If key is true the position is set to the last entry |
|
585 | + * |
|
586 | + * @param string $mode Mode to execute (valid modes are 'insert' and 'change') |
|
587 | + * |
|
588 | + * If insert, the vararray is inserted at the given position (position counting from zero). |
|
589 | + * 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). |
|
590 | + * |
|
591 | + * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array) |
|
592 | + * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars) |
|
593 | + * |
|
594 | + * @return bool false on error, true on success |
|
595 | + * @access public |
|
596 | + */ |
|
597 | 597 | function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert') |
598 | 598 | { |
599 | 599 | if (strpos($blockname, '.') !== false) |
@@ -677,9 +677,9 @@ discard block |
||
677 | 677 | } |
678 | 678 | |
679 | 679 | /** |
680 | - * Include a separate template |
|
681 | - * @access private |
|
682 | - */ |
|
680 | + * Include a separate template |
|
681 | + * @access private |
|
682 | + */ |
|
683 | 683 | function _tpl_include($filename, $include = true) |
684 | 684 | { |
685 | 685 | // This is used to access global vars |
@@ -709,9 +709,9 @@ discard block |
||
709 | 709 | } |
710 | 710 | |
711 | 711 | /** |
712 | - * Include a php-file |
|
713 | - * @access private |
|
714 | - */ |
|
712 | + * Include a php-file |
|
713 | + * @access private |
|
714 | + */ |
|
715 | 715 | function _php_include($filename) |
716 | 716 | { |
717 | 717 | $file = $this->rootPhysical . $filename; |
@@ -726,9 +726,9 @@ discard block |
||
726 | 726 | } |
727 | 727 | |
728 | 728 | /** |
729 | - * Assign key variable pairs from an array with block support |
|
730 | - * @access public |
|
731 | - */ |
|
729 | + * Assign key variable pairs from an array with block support |
|
730 | + * @access public |
|
731 | + */ |
|
732 | 732 | function assign_recursive($values, $name = '') |
733 | 733 | { |
734 | 734 | if(isset($values['.'])) |