@@ -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 |
@@ -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['.'])) |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | |
97 | 97 | for ($Option = 10; $Option >= 0; $Option--) |
98 | 98 | { |
99 | - $template->assign_block_vars('option', array( |
|
100 | - 'VALUE' => $Option * 10, |
|
101 | - )); |
|
99 | + $template->assign_block_vars('option', array( |
|
100 | + 'VALUE' => $Option * 10, |
|
101 | + )); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | $capsObj = new ResourceCalculations(); |
@@ -165,12 +165,12 @@ discard block |
||
165 | 165 | int_calc_storage_bar(RES_DEUTERIUM, $capsObj); |
166 | 166 | |
167 | 167 | $template->assign_vars(array( |
168 | - 'PLANET_NAME' => $planetrow['name'], |
|
169 | - 'PLANET_TYPE' => $planetrow['planet_type'], |
|
168 | + 'PLANET_NAME' => $planetrow['name'], |
|
169 | + 'PLANET_TYPE' => $planetrow['planet_type'], |
|
170 | 170 | |
171 | - 'PRODUCTION_LEVEL' => floor($capsObj->efficiency * 100), |
|
171 | + 'PRODUCTION_LEVEL' => floor($capsObj->efficiency * 100), |
|
172 | 172 | |
173 | - 'PAGE_HINT' => $lang['res_hint'], |
|
173 | + 'PAGE_HINT' => $lang['res_hint'], |
|
174 | 174 | )); |
175 | 175 | |
176 | 176 | display($template, $lang['res_planet_production']); |