@@ -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; |
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 | } |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | ORDER BY `message_time` DESC;"; |
329 | 329 | } |
330 | 330 | |
331 | - if($this->showAll) { |
|
331 | + if ($this->showAll) { |
|
332 | 332 | $message_query = $this->db->selectIterator($message_query); |
333 | 333 | } else { |
334 | 334 | $message_query = new DbSqlPaging($message_query, PAGING_PAGE_SIZE_DEFAULT_MESSAGES, sys_get_param_int(PagingRenderer::KEYWORD)); |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | $this->mode = sys_get_param_str('msg_delete') ? static::MESSAGES_MODE_DELETE : sys_get_param_str('mode'); |
484 | 484 | } |
485 | 485 | |
486 | - if($this->showAll = sys_get_param_str('msg_show_all') ? true : false) { |
|
486 | + if ($this->showAll = sys_get_param_str('msg_show_all') ? true : false) { |
|
487 | 487 | $this->mode = static::MESSAGES_MODE_MESSAGES; |
488 | 488 | } |
489 | 489 |
@@ -114,7 +114,7 @@ |
||
114 | 114 | $this->addFirstLast(); |
115 | 115 | } |
116 | 116 | |
117 | - if(!empty($this->result)) { |
|
117 | + if (!empty($this->result)) { |
|
118 | 118 | $template = gettemplate('_paging'); |
119 | 119 | $template->assign_recursive([ |
120 | 120 | 'PAGING_ROOT' => $this->rootUrl, |
@@ -19,7 +19,7 @@ |
||
19 | 19 | } |
20 | 20 | } |
21 | 21 | |
22 | - if(!empty($paramList)) { |
|
22 | + if (!empty($paramList)) { |
|
23 | 23 | $strParams = implode('&', $paramList); |
24 | 24 | } |
25 | 25 |
@@ -32,8 +32,7 @@ |
||
32 | 32 | * @author Fabien Potencier |
33 | 33 | * @author Dominik Zogg |
34 | 34 | */ |
35 | -interface ServiceProviderInterface |
|
36 | -{ |
|
35 | +interface ServiceProviderInterface { |
|
37 | 36 | /** |
38 | 37 | * Registers services on the given container. |
39 | 38 | * |
@@ -239,7 +239,7 @@ |
||
239 | 239 | |
240 | 240 | $factory = $this->values[$id]; |
241 | 241 | |
242 | - $extended = function ($c) use ($callable, $factory) { |
|
242 | + $extended = function($c) use ($callable, $factory) { |
|
243 | 243 | return $callable($factory($c), $c); |
244 | 244 | }; |
245 | 245 |
@@ -31,8 +31,7 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @author Fabien Potencier |
33 | 33 | */ |
34 | -class Container implements \ArrayAccess |
|
35 | -{ |
|
34 | +class Container implements \ArrayAccess { |
|
36 | 35 | private $values = array(); |
37 | 36 | private $factories; |
38 | 37 | private $protected; |
@@ -47,8 +46,7 @@ discard block |
||
47 | 46 | * |
48 | 47 | * @param array $values The parameters or objects. |
49 | 48 | */ |
50 | - public function __construct(array $values = array()) |
|
51 | - { |
|
49 | + public function __construct(array $values = array()) { |
|
52 | 50 | $this->factories = new \SplObjectStorage(); |
53 | 51 | $this->protected = new \SplObjectStorage(); |
54 | 52 | |
@@ -71,8 +69,7 @@ discard block |
||
71 | 69 | * |
72 | 70 | * @throws \RuntimeException Prevent override of a frozen service |
73 | 71 | */ |
74 | - public function offsetSet($id, $value) |
|
75 | - { |
|
72 | + public function offsetSet($id, $value) { |
|
76 | 73 | if (isset($this->frozen[$id])) { |
77 | 74 | throw new \RuntimeException(sprintf('Cannot override frozen service "%s".', $id)); |
78 | 75 | } |
@@ -90,8 +87,7 @@ discard block |
||
90 | 87 | * |
91 | 88 | * @throws \InvalidArgumentException if the identifier is not defined |
92 | 89 | */ |
93 | - public function offsetGet($id) |
|
94 | - { |
|
90 | + public function offsetGet($id) { |
|
95 | 91 | if (!isset($this->keys[$id])) { |
96 | 92 | throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); |
97 | 93 | } |
@@ -125,8 +121,7 @@ discard block |
||
125 | 121 | * |
126 | 122 | * @return bool |
127 | 123 | */ |
128 | - public function offsetExists($id) |
|
129 | - { |
|
124 | + public function offsetExists($id) { |
|
130 | 125 | return isset($this->keys[$id]); |
131 | 126 | } |
132 | 127 | |
@@ -135,8 +130,7 @@ discard block |
||
135 | 130 | * |
136 | 131 | * @param string $id The unique identifier for the parameter or object |
137 | 132 | */ |
138 | - public function offsetUnset($id) |
|
139 | - { |
|
133 | + public function offsetUnset($id) { |
|
140 | 134 | if (isset($this->keys[$id])) { |
141 | 135 | if (is_object($this->values[$id])) { |
142 | 136 | unset($this->factories[$this->values[$id]], $this->protected[$this->values[$id]]); |
@@ -155,8 +149,7 @@ discard block |
||
155 | 149 | * |
156 | 150 | * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object |
157 | 151 | */ |
158 | - public function factory($callable) |
|
159 | - { |
|
152 | + public function factory($callable) { |
|
160 | 153 | if (!method_exists($callable, '__invoke')) { |
161 | 154 | throw new \InvalidArgumentException('Service definition is not a Closure or invokable object.'); |
162 | 155 | } |
@@ -177,8 +170,7 @@ discard block |
||
177 | 170 | * |
178 | 171 | * @throws \InvalidArgumentException Service definition has to be a closure of an invokable object |
179 | 172 | */ |
180 | - public function protect($callable) |
|
181 | - { |
|
173 | + public function protect($callable) { |
|
182 | 174 | if (!method_exists($callable, '__invoke')) { |
183 | 175 | throw new \InvalidArgumentException('Callable is not a Closure or invokable object.'); |
184 | 176 | } |
@@ -197,8 +189,7 @@ discard block |
||
197 | 189 | * |
198 | 190 | * @throws \InvalidArgumentException if the identifier is not defined |
199 | 191 | */ |
200 | - public function raw($id) |
|
201 | - { |
|
192 | + public function raw($id) { |
|
202 | 193 | if (!isset($this->keys[$id])) { |
203 | 194 | throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); |
204 | 195 | } |
@@ -223,8 +214,7 @@ discard block |
||
223 | 214 | * |
224 | 215 | * @throws \InvalidArgumentException if the identifier is not defined or not a service definition |
225 | 216 | */ |
226 | - public function extend($id, $callable) |
|
227 | - { |
|
217 | + public function extend($id, $callable) { |
|
228 | 218 | if (!isset($this->keys[$id])) { |
229 | 219 | throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined.', $id)); |
230 | 220 | } |
@@ -256,8 +246,7 @@ discard block |
||
256 | 246 | * |
257 | 247 | * @return array An array of value names |
258 | 248 | */ |
259 | - public function keys() |
|
260 | - { |
|
249 | + public function keys() { |
|
261 | 250 | return array_keys($this->values); |
262 | 251 | } |
263 | 252 | |
@@ -269,8 +258,7 @@ discard block |
||
269 | 258 | * |
270 | 259 | * @return static |
271 | 260 | */ |
272 | - public function register(ServiceProviderInterface $provider, array $values = array()) |
|
273 | - { |
|
261 | + public function register(ServiceProviderInterface $provider, array $values = array()) { |
|
274 | 262 | $provider->register($this); |
275 | 263 | |
276 | 264 | foreach ($values as $key => $value) { |
@@ -89,91 +89,91 @@ |
||
89 | 89 | |
90 | 90 | // Services -------------------------------------------------------------------------------------------------------- |
91 | 91 | // Default db |
92 | - $gc->db = function (GlobalContainer $c) { |
|
92 | + $gc->db = function(GlobalContainer $c) { |
|
93 | 93 | SN::$db = new \DBAL\db_mysql($c); |
94 | 94 | |
95 | 95 | return SN::$db; |
96 | 96 | }; |
97 | 97 | |
98 | - $gc->debug = function (/** @noinspection PhpUnusedParameterInspection */ |
|
98 | + $gc->debug = function(/** @noinspection PhpUnusedParameterInspection */ |
|
99 | 99 | GlobalContainer $c) { |
100 | 100 | return new \debug(); |
101 | 101 | }; |
102 | 102 | |
103 | - $gc->cache = function (GlobalContainer $gc) { |
|
103 | + $gc->cache = function(GlobalContainer $gc) { |
|
104 | 104 | return new \classCache($gc->cachePrefix); |
105 | 105 | }; |
106 | 106 | |
107 | - $gc->config = function (GlobalContainer $gc) { |
|
107 | + $gc->config = function(GlobalContainer $gc) { |
|
108 | 108 | return new \classConfig($gc->cachePrefix); |
109 | 109 | }; |
110 | 110 | |
111 | 111 | |
112 | - $gc->repository = function (GlobalContainer $gc) { |
|
112 | + $gc->repository = function(GlobalContainer $gc) { |
|
113 | 113 | return new Repository($gc); |
114 | 114 | }; |
115 | 115 | |
116 | - $gc->storage = function (GlobalContainer $gc) { |
|
116 | + $gc->storage = function(GlobalContainer $gc) { |
|
117 | 117 | return new \Storage($gc); |
118 | 118 | }; |
119 | 119 | |
120 | - $gc->design = function (GlobalContainer $gc) { |
|
120 | + $gc->design = function(GlobalContainer $gc) { |
|
121 | 121 | return new \Design($gc); |
122 | 122 | }; |
123 | 123 | |
124 | - $gc->bbCodeParser = function (GlobalContainer $gc) { |
|
124 | + $gc->bbCodeParser = function(GlobalContainer $gc) { |
|
125 | 125 | return new \BBCodeParser($gc); |
126 | 126 | }; |
127 | 127 | |
128 | - $gc->fleetDispatcher = function (GlobalContainer $gc) { |
|
128 | + $gc->fleetDispatcher = function(GlobalContainer $gc) { |
|
129 | 129 | return new \Fleet\FleetDispatcher($gc); |
130 | 130 | }; |
131 | 131 | |
132 | - $gc->watchdog = function (GlobalContainer $gc) { |
|
132 | + $gc->watchdog = function(GlobalContainer $gc) { |
|
133 | 133 | return new Watchdog($gc); |
134 | 134 | }; |
135 | 135 | |
136 | - $gc->valueStorage = function (GlobalContainer $gc) { |
|
136 | + $gc->valueStorage = function(GlobalContainer $gc) { |
|
137 | 137 | return new ValueStorage([]); |
138 | 138 | }; |
139 | 139 | |
140 | - $gc->bonusCatalog = function (GlobalContainer $gc) { |
|
140 | + $gc->bonusCatalog = function(GlobalContainer $gc) { |
|
141 | 141 | return new BonusCatalog($gc); |
142 | 142 | }; |
143 | 143 | |
144 | - $gc->general = function (GlobalContainer $gc) { |
|
144 | + $gc->general = function(GlobalContainer $gc) { |
|
145 | 145 | return new General($gc); |
146 | 146 | }; |
147 | 147 | |
148 | - $gc->economicHelper = function (GlobalContainer $gc) { |
|
148 | + $gc->economicHelper = function(GlobalContainer $gc) { |
|
149 | 149 | return new EconomicHelper($gc); |
150 | 150 | }; |
151 | 151 | |
152 | - $gc->playerLevelHelper = function (GlobalContainer $gc) { |
|
152 | + $gc->playerLevelHelper = function(GlobalContainer $gc) { |
|
153 | 153 | return new PlayerLevelHelper($gc); |
154 | 154 | }; |
155 | 155 | |
156 | - $gc->pimp = function (GlobalContainer $gc) { |
|
156 | + $gc->pimp = function(GlobalContainer $gc) { |
|
157 | 157 | return new SnPimp($gc); |
158 | 158 | }; |
159 | 159 | |
160 | - $gc->modules = function (GlobalContainer $gc) { |
|
160 | + $gc->modules = function(GlobalContainer $gc) { |
|
161 | 161 | return new ModulesManager($gc); |
162 | 162 | }; |
163 | 163 | |
164 | 164 | // Dummy objects --------------------------------------------------------------------------------------------------- |
165 | - $gc->theUser = function (GlobalContainer $gc) { |
|
165 | + $gc->theUser = function(GlobalContainer $gc) { |
|
166 | 166 | return new \TheUser($gc); |
167 | 167 | }; |
168 | 168 | |
169 | 169 | |
170 | 170 | // Models ---------------------------------------------------------------------------------------------------------- |
171 | 171 | $gc->skinEntityClass = \SkinV2::class; |
172 | - $gc->skinModel = function (GlobalContainer $gc) { |
|
172 | + $gc->skinModel = function(GlobalContainer $gc) { |
|
173 | 173 | return new \SkinModel($gc); |
174 | 174 | }; |
175 | 175 | |
176 | - $gc->textModel = function (GlobalContainer $gc) { |
|
176 | + $gc->textModel = function(GlobalContainer $gc) { |
|
177 | 177 | return new \TextModel($gc); |
178 | 178 | }; |
179 | 179 |
@@ -77,121 +77,121 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | switch ($fleet_page) { |
80 | - case 3: |
|
80 | + case 3: |
|
81 | 81 | |
82 | - case 2: |
|
83 | - $fleet_group_mr = sys_get_param_id('fleet_group'); |
|
84 | - $fleetarray = json_decode(base64_decode(str_rot13(sys_get_param('usedfleet'))), true); |
|
85 | - $fleetarray = is_array($fleetarray) ? $fleetarray : array(); |
|
82 | + case 2: |
|
83 | + $fleet_group_mr = sys_get_param_id('fleet_group'); |
|
84 | + $fleetarray = json_decode(base64_decode(str_rot13(sys_get_param('usedfleet'))), true); |
|
85 | + $fleetarray = is_array($fleetarray) ? $fleetarray : array(); |
|
86 | 86 | |
87 | - foreach($fleetarray as $ship_id => &$ship_amount) { |
|
88 | - if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) { |
|
89 | - $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true)); |
|
90 | - die(); |
|
91 | - } |
|
92 | - $ship_amount = floatval($ship_amount); |
|
93 | - } |
|
94 | - |
|
95 | - $UsedPlanet = false; |
|
96 | - $YourPlanet = false; |
|
97 | - $missiontype = array(); |
|
98 | - if ($planet > SN::$config->game_maxPlanet) { |
|
99 | - $target_mission = MT_EXPLORE; |
|
100 | - $missiontype[MT_EXPLORE] = $lang['type_mission'][MT_EXPLORE]; |
|
101 | - } elseif ($galaxy && $system && $planet) { |
|
102 | - $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
103 | - |
|
104 | - $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
105 | - |
|
106 | - if ($TargetPlanet['id_owner']) { |
|
107 | - $UsedPlanet = true; |
|
108 | - if ($TargetPlanet['id_owner'] == $user['id']) { |
|
109 | - $YourPlanet = true; |
|
87 | + foreach($fleetarray as $ship_id => &$ship_amount) { |
|
88 | + if(!in_array($ship_id, sn_get_groups('fleet')) || (string)floatval($ship_amount) != $ship_amount || $ship_amount < 1) { |
|
89 | + $debug->warning('Supplying wrong ship in ship list on fleet page', 'Hack attempt', 302, array('base_dump' => true)); |
|
90 | + die(); |
|
110 | 91 | } |
92 | + $ship_amount = floatval($ship_amount); |
|
111 | 93 | } |
112 | 94 | |
113 | - if (!$UsedPlanet) { |
|
114 | - if ($fleetarray[SHIP_COLONIZER]) { |
|
115 | - $missiontype[MT_COLONIZE] = $lang['type_mission'][MT_COLONIZE]; |
|
116 | - $target_mission = MT_COLONIZE; |
|
117 | - $planet_type = PT_PLANET; |
|
118 | - } else { |
|
119 | - messageBox ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']); |
|
120 | - } |
|
121 | - } else { |
|
122 | - $recyclers = 0; |
|
123 | - foreach(sn_get_groups('flt_recyclers') as $recycler_id) { |
|
124 | - $recyclers += $fleetarray[$recycler_id]; |
|
95 | + $UsedPlanet = false; |
|
96 | + $YourPlanet = false; |
|
97 | + $missiontype = array(); |
|
98 | + if ($planet > SN::$config->game_maxPlanet) { |
|
99 | + $target_mission = MT_EXPLORE; |
|
100 | + $missiontype[MT_EXPLORE] = $lang['type_mission'][MT_EXPLORE]; |
|
101 | + } elseif ($galaxy && $system && $planet) { |
|
102 | + $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
103 | + |
|
104 | + $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
105 | + |
|
106 | + if ($TargetPlanet['id_owner']) { |
|
107 | + $UsedPlanet = true; |
|
108 | + if ($TargetPlanet['id_owner'] == $user['id']) { |
|
109 | + $YourPlanet = true; |
|
110 | + } |
|
125 | 111 | } |
126 | - if ($recyclers > 0 && $planet_type == PT_DEBRIS) { |
|
127 | - $target_mission = MT_RECYCLE; |
|
128 | - $missiontype[MT_RECYCLE] = $lang['type_mission'][MT_RECYCLE]; |
|
129 | - } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) { |
|
130 | - if ($YourPlanet) { |
|
131 | - $missiontype[MT_RELOCATE] = $lang['type_mission'][MT_RELOCATE]; |
|
132 | - $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
112 | + |
|
113 | + if (!$UsedPlanet) { |
|
114 | + if ($fleetarray[SHIP_COLONIZER]) { |
|
115 | + $missiontype[MT_COLONIZE] = $lang['type_mission'][MT_COLONIZE]; |
|
116 | + $target_mission = MT_COLONIZE; |
|
117 | + $planet_type = PT_PLANET; |
|
133 | 118 | } else { |
134 | - // Not Your Planet |
|
135 | - if ($fleetarray[SHIP_SPY]) { |
|
136 | - // Only spy missions if any spy |
|
137 | - $missiontype[MT_SPY] = $lang['type_mission'][MT_SPY]; |
|
119 | + messageBox ("<font color=\"red\"><b>". $lang['fl_no_planet_type'] ."</b></font>", $lang['fl_error']); |
|
120 | + } |
|
121 | + } else { |
|
122 | + $recyclers = 0; |
|
123 | + foreach(sn_get_groups('flt_recyclers') as $recycler_id) { |
|
124 | + $recyclers += $fleetarray[$recycler_id]; |
|
125 | + } |
|
126 | + if ($recyclers > 0 && $planet_type == PT_DEBRIS) { |
|
127 | + $target_mission = MT_RECYCLE; |
|
128 | + $missiontype[MT_RECYCLE] = $lang['type_mission'][MT_RECYCLE]; |
|
129 | + } elseif ($planet_type == PT_PLANET || $planet_type == PT_MOON) { |
|
130 | + if ($YourPlanet) { |
|
131 | + $missiontype[MT_RELOCATE] = $lang['type_mission'][MT_RELOCATE]; |
|
132 | + $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
138 | 133 | } else { |
139 | - // If no spies... |
|
140 | - if ($fleet_group_mr) { |
|
141 | - $missiontype[MT_AKS] = $lang['type_mission'][MT_AKS]; |
|
134 | + // Not Your Planet |
|
135 | + if ($fleetarray[SHIP_SPY]) { |
|
136 | + // Only spy missions if any spy |
|
137 | + $missiontype[MT_SPY] = $lang['type_mission'][MT_SPY]; |
|
142 | 138 | } else { |
143 | - $missiontype[MT_ATTACK] = $lang['type_mission'][MT_ATTACK]; |
|
144 | - $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
145 | - |
|
146 | - $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD]; |
|
147 | - |
|
148 | - if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) { |
|
149 | - $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY]; |
|
139 | + // If no spies... |
|
140 | + if ($fleet_group_mr) { |
|
141 | + $missiontype[MT_AKS] = $lang['type_mission'][MT_AKS]; |
|
142 | + } else { |
|
143 | + $missiontype[MT_ATTACK] = $lang['type_mission'][MT_ATTACK]; |
|
144 | + $missiontype[MT_TRANSPORT] = $lang['type_mission'][MT_TRANSPORT]; |
|
145 | + |
|
146 | + $missiontype[MT_HOLD] = $lang['type_mission'][MT_HOLD]; |
|
147 | + |
|
148 | + if($planet_type == PT_MOON && $fleetarray[SHIP_HUGE_DEATH_STAR]) { |
|
149 | + $missiontype[MT_DESTROY] = $lang['type_mission'][MT_DESTROY]; |
|
150 | + } |
|
150 | 151 | } |
151 | 152 | } |
152 | 153 | } |
153 | 154 | } |
154 | 155 | } |
155 | 156 | } |
156 | - } |
|
157 | - |
|
158 | - if (!$target_mission && is_array($missiontype)) { |
|
159 | - $target_mission = MT_ATTACK; |
|
160 | - } |
|
161 | - |
|
162 | -// $sn_group_missions = sn_get_groups('missions'); |
|
163 | -// foreach($sn_group_missions as $mission_id => $cork) { |
|
164 | -// $missiontype[$mission_id] = $lang['type_mission'][$mission_id]; |
|
165 | -// } |
|
166 | -// |
|
167 | -// |
|
168 | - ksort($missiontype); |
|
169 | - |
|
170 | - $speed_percent = sys_get_param_int('speed', 10); |
|
171 | - $travel_data = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent); |
|
172 | - |
|
173 | -// $fleet_speed = flt_fleet_speed($user, $fleetarray); |
|
174 | - $fleet_speed = $travel_data['fleet_speed']; |
|
175 | - $distance = $travel_data['distance']; |
|
176 | - $duration = $travel_data['duration']; |
|
177 | - $consumption = $travel_data['consumption']; |
|
178 | - // No Break |
|
179 | - |
|
180 | - case 1: |
|
181 | - if ($galaxy && $system && $planet) { |
|
182 | - $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
183 | - |
|
184 | - $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
185 | - } |
|
186 | - |
|
187 | - case 0: |
|
188 | - $template_result += array( |
|
189 | - 'thisgalaxy' => $planetrow['galaxy'], |
|
190 | - 'thissystem' => $planetrow['system'], |
|
191 | - 'thisplanet' => $planetrow['planet'], |
|
192 | - 'thisplanet_type' => $planetrow['planet_type'], |
|
193 | - ); |
|
194 | - // no break |
|
157 | + |
|
158 | + if (!$target_mission && is_array($missiontype)) { |
|
159 | + $target_mission = MT_ATTACK; |
|
160 | + } |
|
161 | + |
|
162 | + // $sn_group_missions = sn_get_groups('missions'); |
|
163 | + // foreach($sn_group_missions as $mission_id => $cork) { |
|
164 | + // $missiontype[$mission_id] = $lang['type_mission'][$mission_id]; |
|
165 | + // } |
|
166 | + // |
|
167 | + // |
|
168 | + ksort($missiontype); |
|
169 | + |
|
170 | + $speed_percent = sys_get_param_int('speed', 10); |
|
171 | + $travel_data = flt_travel_data($user, $planetrow, array('galaxy' => $galaxy, 'system' => $system, 'planet' => $planet), $fleetarray, $speed_percent); |
|
172 | + |
|
173 | + // $fleet_speed = flt_fleet_speed($user, $fleetarray); |
|
174 | + $fleet_speed = $travel_data['fleet_speed']; |
|
175 | + $distance = $travel_data['distance']; |
|
176 | + $duration = $travel_data['duration']; |
|
177 | + $consumption = $travel_data['consumption']; |
|
178 | + // No Break |
|
179 | + |
|
180 | + case 1: |
|
181 | + if ($galaxy && $system && $planet) { |
|
182 | + $check_type = $planet_type == PT_MOON ? PT_MOON : PT_PLANET; |
|
183 | + |
|
184 | + $TargetPlanet = DBStaticPlanet::db_planet_by_gspt($galaxy, $system, $planet, $check_type); |
|
185 | + } |
|
186 | + |
|
187 | + case 0: |
|
188 | + $template_result += array( |
|
189 | + 'thisgalaxy' => $planetrow['galaxy'], |
|
190 | + 'thissystem' => $planetrow['system'], |
|
191 | + 'thisplanet' => $planetrow['planet'], |
|
192 | + 'thisplanet_type' => $planetrow['planet_type'], |
|
193 | + ); |
|
194 | + // no break |
|
195 | 195 | |
196 | 196 | } |
197 | 197 | |
@@ -213,35 +213,35 @@ discard block |
||
213 | 213 | } |
214 | 214 | |
215 | 215 | switch($fleet_page) { |
216 | - case 1: |
|
217 | - require('includes/includes/flt_page1.inc'); |
|
218 | - break; |
|
219 | - |
|
220 | - case 2: |
|
221 | - require_once('includes/includes/flt_page2.inc'); |
|
222 | - sn_fleet_page2(); |
|
223 | - break; |
|
224 | - |
|
225 | - case 3: |
|
226 | - require_once('includes/includes/flt_page3.inc'); |
|
227 | - sn_fleet_page3(); |
|
228 | - break; |
|
229 | - |
|
230 | - case 4: |
|
231 | - require('includes/includes/flt_page4.inc'); |
|
232 | - break; |
|
233 | - |
|
234 | - case 5: |
|
235 | - $template = gettemplate('fleet5', true); |
|
236 | - $pageFleet5Gathering = new \Pages\Deprecated\PageFleet5Gathering(); |
|
237 | - $pageFleet5Gathering->modelFleet5Gathering($user, $planetrow, $template); |
|
238 | - // Building list of own planets & moons |
|
239 | - $pageFleet5Gathering->viewPage5Gathering($user, $planetrow, $template); |
|
240 | - break; |
|
241 | - |
|
242 | - default: |
|
243 | - define('SN_RENDER_NAVBAR_PLANET', true); |
|
244 | - |
|
245 | - require('includes/includes/flt_page0.inc'); |
|
246 | - break; |
|
216 | + case 1: |
|
217 | + require('includes/includes/flt_page1.inc'); |
|
218 | + break; |
|
219 | + |
|
220 | + case 2: |
|
221 | + require_once('includes/includes/flt_page2.inc'); |
|
222 | + sn_fleet_page2(); |
|
223 | + break; |
|
224 | + |
|
225 | + case 3: |
|
226 | + require_once('includes/includes/flt_page3.inc'); |
|
227 | + sn_fleet_page3(); |
|
228 | + break; |
|
229 | + |
|
230 | + case 4: |
|
231 | + require('includes/includes/flt_page4.inc'); |
|
232 | + break; |
|
233 | + |
|
234 | + case 5: |
|
235 | + $template = gettemplate('fleet5', true); |
|
236 | + $pageFleet5Gathering = new \Pages\Deprecated\PageFleet5Gathering(); |
|
237 | + $pageFleet5Gathering->modelFleet5Gathering($user, $planetrow, $template); |
|
238 | + // Building list of own planets & moons |
|
239 | + $pageFleet5Gathering->viewPage5Gathering($user, $planetrow, $template); |
|
240 | + break; |
|
241 | + |
|
242 | + default: |
|
243 | + define('SN_RENDER_NAVBAR_PLANET', true); |
|
244 | + |
|
245 | + require('includes/includes/flt_page0.inc'); |
|
246 | + break; |
|
247 | 247 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | use Player\playerTimeDiff; |
5 | 5 | |
6 | 6 | // Защита от двойного инита |
7 | -if(defined('INIT')) { |
|
7 | +if (defined('INIT')) { |
|
8 | 8 | return; |
9 | 9 | } |
10 | 10 | |
@@ -122,47 +122,47 @@ discard block |
||
122 | 122 | // Но нужно, пока у нас есть не MVC-страницы |
123 | 123 | $sn_page_data = $sn_mvc['pages'][$sn_page_name]; |
124 | 124 | $sn_page_name_file = 'includes/pages/' . $sn_page_data['filename'] . DOT_PHP_EX; |
125 | -if($sn_page_name) { |
|
125 | +if ($sn_page_name) { |
|
126 | 126 | // Merging page options to global option pull |
127 | - if(is_array($sn_page_data['options'])) { |
|
127 | + if (is_array($sn_page_data['options'])) { |
|
128 | 128 | SN::$options = array_merge(SN::$options, $sn_page_data['options']); |
129 | 129 | } |
130 | 130 | |
131 | - if(isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
131 | + if (isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
132 | 132 | require_once($sn_page_name_file); |
133 | 133 | } |
134 | 134 | } |
135 | 135 | |
136 | -if((defined('IN_AJAX') && IN_AJAX === true) || (defined('IN_ADMIN') && IN_ADMIN === true) || (!empty(SN::$options[PAGE_OPTION_ADMIN]))) { |
|
136 | +if ((defined('IN_AJAX') && IN_AJAX === true) || (defined('IN_ADMIN') && IN_ADMIN === true) || (!empty(SN::$options[PAGE_OPTION_ADMIN]))) { |
|
137 | 137 | SN::$options[PAGE_OPTION_FLEET_UPDATE_SKIP] = true; |
138 | 138 | } |
139 | 139 | |
140 | 140 | |
141 | 141 | // А теперь проверяем - поддерживают ли у нас загруженный код такую страницу |
142 | 142 | // TODO - костыль, что бы работали старые модули. Убрать! |
143 | -if(is_array($sn_data['pages'])) { |
|
143 | +if (is_array($sn_data['pages'])) { |
|
144 | 144 | $sn_mvc['pages'] = array_merge($sn_mvc['pages'], $sn_data['pages']); |
145 | 145 | } |
146 | -if(!isset($sn_mvc['pages'][$sn_page_name])) { |
|
146 | +if (!isset($sn_mvc['pages'][$sn_page_name])) { |
|
147 | 147 | $sn_page_name = ''; |
148 | 148 | } |
149 | 149 | |
150 | 150 | $lang->lng_switch(sys_get_param_str('lang')); |
151 | 151 | |
152 | 152 | |
153 | -if(SN::$config->server_updater_check_auto && SN::$config->server_updater_check_last + SN::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
153 | +if (SN::$config->server_updater_check_auto && SN::$config->server_updater_check_last + SN::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
154 | 154 | \Common\Tools\VersionCheckerDeprecated::performCheckVersion(); |
155 | 155 | } |
156 | 156 | |
157 | -if(SN::$config->user_birthday_gift && SN_TIME_NOW - SN::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
157 | +if (SN::$config->user_birthday_gift && SN_TIME_NOW - SN::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
158 | 158 | require_once(SN_ROOT_PHYSICAL . 'includes/includes/user_birthday_celebrate.php'); |
159 | 159 | sn_user_birthday_celebrate(); |
160 | 160 | } |
161 | 161 | |
162 | -if(!SN::$config->var_online_user_count || SN::$config->var_online_user_time + 30 < SN_TIME_NOW) { |
|
162 | +if (!SN::$config->var_online_user_count || SN::$config->var_online_user_time + 30 < SN_TIME_NOW) { |
|
163 | 163 | SN::$config->db_saveItem('var_online_user_count', db_user_count(true)); |
164 | 164 | SN::$config->db_saveItem('var_online_user_time', SN_TIME_NOW); |
165 | - if(SN::$config->server_log_online) { |
|
165 | + if (SN::$config->server_log_online) { |
|
166 | 166 | doquery("INSERT IGNORE INTO `{{log_users_online}}` SET online_count = " . SN::$config->var_online_user_count . ";"); |
167 | 167 | } |
168 | 168 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | |
186 | 186 | $template_result[F_ACCOUNT_IS_AUTHORIZED] = $sys_user_logged_in = !empty($user) && isset($user['id']) && $user['id']; |
187 | 187 | |
188 | -if(!empty($user['id'])) { |
|
188 | +if (!empty($user['id'])) { |
|
189 | 189 | SN::$user_options->user_change($user['id']); |
190 | 190 | } |
191 | 191 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | : false |
199 | 199 | ); |
200 | 200 | |
201 | -if($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
201 | +if ($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
202 | 202 | $prohibited_characters = array_map(function($value) { |
203 | 203 | return "'" . htmlentities($value, ENT_QUOTES, 'UTF-8') . "'"; |
204 | 204 | }, str_split(LOGIN_REGISTER_CHARACTERS_PROHIBITED)); |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | } |
207 | 207 | |
208 | 208 | |
209 | -if(defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
209 | +if (defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
210 | 210 | pdump('Отключи отладку перед продакшном!'); |
211 | 211 | } |
212 | 212 | |
@@ -220,17 +220,17 @@ discard block |
||
220 | 220 | |
221 | 221 | StatUpdateLauncher::unlock(); |
222 | 222 | |
223 | -if($template_result[F_GAME_DISABLE] = SN::$config->game_disable) { |
|
223 | +if ($template_result[F_GAME_DISABLE] = SN::$config->game_disable) { |
|
224 | 224 | $template_result[F_GAME_DISABLE_REASON] = HelperString::nl2br( |
225 | 225 | SN::$config->game_disable == GAME_DISABLE_REASON |
226 | 226 | ? SN::$config->game_disable_reason |
227 | 227 | : $lang['sys_game_disable_reason'][SN::$config->game_disable] |
228 | 228 | ); |
229 | - if(defined('IN_API')) { |
|
229 | + if (defined('IN_API')) { |
|
230 | 230 | return; |
231 | 231 | } |
232 | 232 | |
233 | - if( |
|
233 | + if ( |
|
234 | 234 | ($user['authlevel'] < 1 || !(defined('IN_ADMIN') && IN_ADMIN)) |
235 | 235 | && |
236 | 236 | !(defined('INSTALL_MODE') && defined('LOGIN_LOGOUT')) |
@@ -245,8 +245,8 @@ discard block |
||
245 | 245 | |
246 | 246 | // TODO ban |
247 | 247 | // TODO $skip_ban_check |
248 | -if($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
249 | - if(defined('IN_API')) { |
|
248 | +if ($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
249 | + if (defined('IN_API')) { |
|
250 | 250 | return; |
251 | 251 | } |
252 | 252 | |
@@ -260,10 +260,10 @@ discard block |
||
260 | 260 | $allow_anonymous = $allow_anonymous || (isset($sn_page_data['allow_anonymous']) && $sn_page_data['allow_anonymous']); |
261 | 261 | |
262 | 262 | |
263 | -if($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
263 | +if ($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
264 | 264 | sys_redirect(SN_ROOT_VIRTUAL . 'overview.php'); |
265 | -} elseif($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
266 | -} elseif(!$allow_anonymous && !$sys_user_logged_in) { |
|
265 | +} elseif ($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
266 | +} elseif (!$allow_anonymous && !$sys_user_logged_in) { |
|
267 | 267 | sys_redirect(SN_ROOT_VIRTUAL . 'login.php'); |
268 | 268 | } |
269 | 269 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | 'fleet_update_last', |
287 | 287 | SN::$config->fleet_update_interval, |
288 | 288 | // Promise |
289 | - function () {SN::$gc->fleetDispatcher->dispatch();}, |
|
289 | + function() {SN::$gc->fleetDispatcher->dispatch(); }, |
|
290 | 290 | WATCHDOG_TIME_SQL, |
291 | 291 | false |
292 | 292 | ); |