@@ -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 | /** |
| 240 | 230 | * @var phpbb_hook $phpbb_hook |
| 241 | 231 | */ |
@@ -264,8 +254,7 @@ discard block |
||
| 264 | 254 | if ($filename = $this->_tpl_load($handle)) |
| 265 | 255 | { |
| 266 | 256 | ($include_once) ? include_once($filename) : include($filename); |
| 267 | - } |
|
| 268 | - else |
|
| 257 | + } else |
|
| 269 | 258 | { |
| 270 | 259 | $this->evaluate($this->compiled_code[$handle]); |
| 271 | 260 | } |
@@ -277,8 +266,7 @@ discard block |
||
| 277 | 266 | * Display the handle and assign the output to a template variable or return the compiled result. |
| 278 | 267 | * @access public |
| 279 | 268 | */ |
| 280 | - function assign_display($handle, $template_var = '', $return_content = true, $include_once = false) |
|
| 281 | - { |
|
| 269 | + function assign_display($handle, $template_var = '', $return_content = true, $include_once = false) { |
|
| 282 | 270 | ob_start(); |
| 283 | 271 | $this->display($handle, $include_once); |
| 284 | 272 | $contents = ob_get_clean(); |
@@ -297,8 +285,7 @@ discard block |
||
| 297 | 285 | * Load a compiled template if possible, if not, recompile it |
| 298 | 286 | * @access private |
| 299 | 287 | */ |
| 300 | - function _tpl_load(&$handle) |
|
| 301 | - { |
|
| 288 | + function _tpl_load(&$handle) { |
|
| 302 | 289 | global $user, $config; |
| 303 | 290 | |
| 304 | 291 | if (!isset($this->filename[$handle])) |
@@ -319,8 +306,7 @@ discard block |
||
| 319 | 306 | if (!file_exists($filename) || @filesize($filename) === 0) |
| 320 | 307 | { |
| 321 | 308 | $recompile = true; |
| 322 | - } |
|
| 323 | - else if ($config->load_tplcompile) |
|
| 309 | + } else if ($config->load_tplcompile) |
|
| 324 | 310 | { |
| 325 | 311 | // No way around it: we need to check inheritance here |
| 326 | 312 | if ($user->theme['template_inherits_id'] && !file_exists($this->files[$handle])) |
@@ -403,15 +389,13 @@ discard block |
||
| 403 | 389 | $this->files[$row['template_filename']] = $file; |
| 404 | 390 | $this->files_inherit[$row['template_filename']] = $file; |
| 405 | 391 | $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id']; |
| 406 | - } |
|
| 407 | - else if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id']) |
|
| 392 | + } else if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id']) |
|
| 408 | 393 | { |
| 409 | 394 | // Ok, we have a situation. There is a file in the subtemplate, but nothing in the DB. We have to fix that. |
| 410 | 395 | $force_reload = true; |
| 411 | 396 | $this->files_template[$row['template_filename']] = $user->theme['template_inherits_id']; |
| 412 | 397 | } |
| 413 | - } |
|
| 414 | - else |
|
| 398 | + } else |
|
| 415 | 399 | { |
| 416 | 400 | $this->files_template[$row['template_filename']] = $user->theme['template_id']; |
| 417 | 401 | } |
@@ -421,8 +405,7 @@ discard block |
||
| 421 | 405 | if ($row['template_filename'] == $this->filename[$handle]) |
| 422 | 406 | { |
| 423 | 407 | $compile->_tpl_load_file($handle, true); |
| 424 | - } |
|
| 425 | - else |
|
| 408 | + } else |
|
| 426 | 409 | { |
| 427 | 410 | $this->files[$row['template_filename']] = $file; |
| 428 | 411 | $this->filename[$row['template_filename']] = $row['template_filename']; |
@@ -437,8 +420,7 @@ discard block |
||
| 437 | 420 | { |
| 438 | 421 | $this->compiled_code[$handle] = $compile->compile(trim($row['template_data'])); |
| 439 | 422 | $compile->compile_write($handle, $this->compiled_code[$handle]); |
| 440 | - } |
|
| 441 | - else |
|
| 423 | + } else |
|
| 442 | 424 | { |
| 443 | 425 | // Only bother compiling if it doesn't already exist |
| 444 | 426 | if (!file_exists($this->cachepath . str_replace('/', '.', $row['template_filename']) . DOT_PHP_EX)) |
@@ -449,8 +431,7 @@ discard block |
||
| 449 | 431 | } |
| 450 | 432 | } |
| 451 | 433 | } |
| 452 | - } |
|
| 453 | - else |
|
| 434 | + } else |
|
| 454 | 435 | { |
| 455 | 436 | $file = $this->root . '/' . $row['template_filename']; |
| 456 | 437 | |
@@ -477,8 +458,7 @@ discard block |
||
| 477 | 458 | * Assign key variable pairs from an array |
| 478 | 459 | * @access public |
| 479 | 460 | */ |
| 480 | - function assign_vars($vararray) |
|
| 481 | - { |
|
| 461 | + function assign_vars($vararray) { |
|
| 482 | 462 | foreach ($vararray as $key => $val) |
| 483 | 463 | { |
| 484 | 464 | $this->_rootref[$key] = $val; |
@@ -491,8 +471,7 @@ discard block |
||
| 491 | 471 | * Assign a single variable to a single key |
| 492 | 472 | * @access public |
| 493 | 473 | */ |
| 494 | - function assign_var($varname, $varval) |
|
| 495 | - { |
|
| 474 | + function assign_var($varname, $varval) { |
|
| 496 | 475 | $this->_rootref[$varname] = $varval; |
| 497 | 476 | |
| 498 | 477 | return true; |
@@ -502,8 +481,7 @@ discard block |
||
| 502 | 481 | * Assign key variable pairs from an array to a specified block |
| 503 | 482 | * @access public |
| 504 | 483 | */ |
| 505 | - function assign_block_vars($blockname, $vararray) |
|
| 506 | - { |
|
| 484 | + function assign_block_vars($blockname, $vararray) { |
|
| 507 | 485 | if (strpos($blockname, '.') !== false) |
| 508 | 486 | { |
| 509 | 487 | // Nested block. |
@@ -538,8 +516,7 @@ discard block |
||
| 538 | 516 | // We're adding a new iteration to this block with the given |
| 539 | 517 | // variable assignments. |
| 540 | 518 | $str[$blocks[$blockcount]][] = $vararray; |
| 541 | - } |
|
| 542 | - else |
|
| 519 | + } else |
|
| 543 | 520 | { |
| 544 | 521 | // Top-level block. |
| 545 | 522 | $s_row_count = (isset($this->_tpldata[$blockname])) ? sizeof($this->_tpldata[$blockname]) : 0; |
@@ -593,8 +570,7 @@ discard block |
||
| 593 | 570 | * @return bool false on error, true on success |
| 594 | 571 | * @access public |
| 595 | 572 | */ |
| 596 | - function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert') |
|
| 597 | - { |
|
| 573 | + function alter_block_array($blockname, $vararray, $key = false, $mode = 'insert') { |
|
| 598 | 574 | if (strpos($blockname, '.') !== false) |
| 599 | 575 | { |
| 600 | 576 | // Nested blocks are not supported |
@@ -639,8 +615,7 @@ discard block |
||
| 639 | 615 | $key = sizeof($this->_tpldata[$blockname]); |
| 640 | 616 | unset($this->_tpldata[$blockname][($key - 1)]['S_LAST_ROW']); |
| 641 | 617 | $vararray['S_LAST_ROW'] = true; |
| 642 | - } |
|
| 643 | - else if ($key === 0) |
|
| 618 | + } else if ($key === 0) |
|
| 644 | 619 | { |
| 645 | 620 | unset($this->_tpldata[$blockname][0]['S_FIRST_ROW']); |
| 646 | 621 | $vararray['S_FIRST_ROW'] = true; |
@@ -679,8 +654,7 @@ discard block |
||
| 679 | 654 | * Include a separate template |
| 680 | 655 | * @access private |
| 681 | 656 | */ |
| 682 | - function _tpl_include($filename, $include = true) |
|
| 683 | - { |
|
| 657 | + function _tpl_include($filename, $include = true) { |
|
| 684 | 658 | // This is used to access global vars |
| 685 | 659 | global $lang, $config, $user; |
| 686 | 660 | |
@@ -710,8 +684,7 @@ discard block |
||
| 710 | 684 | * Include a php-file |
| 711 | 685 | * @access private |
| 712 | 686 | */ |
| 713 | - function _php_include($filename) |
|
| 714 | - { |
|
| 687 | + function _php_include($filename) { |
|
| 715 | 688 | $file = $this->rootPhysical . $filename; |
| 716 | 689 | |
| 717 | 690 | if (!file_exists($file)) |
@@ -727,8 +700,7 @@ discard block |
||
| 727 | 700 | * Assign key variable pairs from an array with block support |
| 728 | 701 | * @access public |
| 729 | 702 | */ |
| 730 | - function assign_recursive($values, $name = '') |
|
| 731 | - { |
|
| 703 | + function assign_recursive($values, $name = '') { |
|
| 732 | 704 | if(isset($values['.'])) |
| 733 | 705 | { |
| 734 | 706 | $values_extra = $values['.']; |
@@ -738,8 +710,7 @@ discard block |
||
| 738 | 710 | if(!$name) |
| 739 | 711 | { |
| 740 | 712 | $this->assign_vars($values); |
| 741 | - } |
|
| 742 | - else |
|
| 713 | + } else |
|
| 743 | 714 | { |
| 744 | 715 | $this->assign_block_vars($name, $values); |
| 745 | 716 | } |
@@ -30,8 +30,7 @@ |
||
| 30 | 30 | * @param $resource_id |
| 31 | 31 | * @param ResourceCalculations $capsObj |
| 32 | 32 | */ |
| 33 | -function int_calc_storage_bar($resource_id, $capsObj) |
|
| 34 | -{ |
|
| 33 | +function int_calc_storage_bar($resource_id, $capsObj) { |
|
| 35 | 34 | global $lang, $template, $planetrow, $user; |
| 36 | 35 | |
| 37 | 36 | $totalProduction = $capsObj->getProduction($resource_id); |
@@ -15,8 +15,7 @@ discard block |
||
| 15 | 15 | 1.5 - copyright (c) 2010-2011 by Gorlum for http://supernova.ws |
| 16 | 16 | [+] SuperMassMailing - authlevel=3 player can send messages to whole server ('*' as $owners) |
| 17 | 17 | */ |
| 18 | -function msg_ali_send($message, $subject, $ally_rank_id = 0, $ally_id = 0) |
|
| 19 | -{ |
|
| 18 | +function msg_ali_send($message, $subject, $ally_rank_id = 0, $ally_id = 0) { |
|
| 20 | 19 | global $user; |
| 21 | 20 | |
| 22 | 21 | $ally_id = $ally_id ? $ally_id : $user['ally_id']; |
@@ -49,8 +48,7 @@ discard block |
||
| 49 | 48 | * @param bool $force |
| 50 | 49 | * @param bool $json |
| 51 | 50 | */ |
| 52 | -function msg_send_simple_message($owners, $sender, $timestamp, $message_type, $from, $subject, $text, $escaped = STRING_NEED_ESCAPING, $force = false, $json = false) |
|
| 53 | -{ |
|
| 51 | +function msg_send_simple_message($owners, $sender, $timestamp, $message_type, $from, $subject, $text, $escaped = STRING_NEED_ESCAPING, $force = false, $json = false) { |
|
| 54 | 52 | global $config, $user, $sn_message_class_list; |
| 55 | 53 | |
| 56 | 54 | if(!$owners) |
@@ -91,8 +89,7 @@ discard block |
||
| 91 | 89 | // TODO Добавить $sender - рассылка может быть и от кого-то |
| 92 | 90 | db_message_insert_all($message_type, $from, $subject, $text); |
| 93 | 91 | $owners = []; |
| 94 | - } |
|
| 95 | - else |
|
| 92 | + } else |
|
| 96 | 93 | { |
| 97 | 94 | $insert_values = []; |
| 98 | 95 | $insert_template = "('%u'," . str_replace('%', '%%', " '{$sender}', '{$timestamp}', '{$message_type}', '{$from}', '{$subject}', '{$text}', '" . intval($json) . "')"); |
@@ -102,8 +99,7 @@ discard block |
||
| 102 | 99 | if($user['id'] != $owner) |
| 103 | 100 | { |
| 104 | 101 | $owner_row = db_user_by_id($owner); |
| 105 | - } |
|
| 106 | - else |
|
| 102 | + } else |
|
| 107 | 103 | { |
| 108 | 104 | $owner_row = $user; |
| 109 | 105 | } |
@@ -139,11 +139,13 @@ |
||
| 139 | 139 | $error_backtrace['locks'] = _SnCacheInternal::$locks; |
| 140 | 140 | $error_backtrace['cSN_data'] = _SnCacheInternal::$data; |
| 141 | 141 | foreach($error_backtrace['cSN_data'] as &$location) { |
| 142 | - foreach($location as $location_id => &$location_data) // $location_data = $location_id; |
|
| 142 | + foreach($location as $location_id => &$location_data) { |
|
| 143 | + // $location_data = $location_id; |
|
| 143 | 144 | { |
| 144 | 145 | $location_data = isset($location_data['username']) ? $location_data['username'] : |
| 145 | 146 | (isset($location_data['name']) ? $location_data['name'] : $location_id); |
| 146 | 147 | } |
| 148 | + } |
|
| 147 | 149 | } |
| 148 | 150 | } |
| 149 | 151 | |
@@ -56,8 +56,7 @@ discard block |
||
| 56 | 56 | sprintf($lang['buddy_msg_accept_text'], $user['username'])); |
| 57 | 57 | sn_db_transaction_commit(); |
| 58 | 58 | throw new exception('buddy_err_accept_none', ERR_NONE); |
| 59 | - } |
|
| 60 | - else |
|
| 59 | + } else |
|
| 61 | 60 | { |
| 62 | 61 | throw new exception('buddy_err_accept_internal', ERR_ERROR); |
| 63 | 62 | } |
@@ -69,9 +68,11 @@ discard block |
||
| 69 | 68 | throw new exception('buddy_err_delete_alien', ERR_ERROR); |
| 70 | 69 | } |
| 71 | 70 | |
| 72 | - if($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) // Existing friendship |
|
| 71 | + if($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) { |
|
| 72 | + // Existing friendship |
|
| 73 | 73 | { |
| 74 | 74 | $ex_friend_id = $buddy_row['BUDDY_SENDER_ID'] == $user['id'] ? $buddy_row['BUDDY_OWNER_ID'] : $buddy_row['BUDDY_SENDER_ID']; |
| 75 | + } |
|
| 75 | 76 | |
| 76 | 77 | msg_send_simple_message($ex_friend_id, $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, $user['username'], $lang['buddy_msg_unfriend_title'], |
| 77 | 78 | sprintf($lang['buddy_msg_unfriend_text'], $user['username'])); |
@@ -79,17 +80,19 @@ discard block |
||
| 79 | 80 | doquery("DELETE FROM {{buddy}} WHERE `BUDDY_ID` = {$buddy_id} LIMIT 1;"); |
| 80 | 81 | sn_db_transaction_commit(); |
| 81 | 82 | throw new exception('buddy_err_unfriend_none', ERR_NONE); |
| 82 | - } |
|
| 83 | - elseif($buddy_row['BUDDY_SENDER_ID'] == $user['id']) // Player's outcoming request - either denied or waiting |
|
| 83 | + } elseif($buddy_row['BUDDY_SENDER_ID'] == $user['id']) { |
|
| 84 | + // Player's outcoming request - either denied or waiting |
|
| 84 | 85 | { |
| 85 | 86 | doquery("DELETE FROM {{buddy}} WHERE `BUDDY_ID` = {$buddy_id} LIMIT 1;"); |
| 87 | + } |
|
| 86 | 88 | sn_db_transaction_commit(); |
| 87 | 89 | throw new exception('buddy_err_delete_own', ERR_NONE); |
| 88 | - } |
|
| 89 | - elseif($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_WAITING) // Deny incoming request |
|
| 90 | + } elseif($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_WAITING) { |
|
| 91 | + // Deny incoming request |
|
| 90 | 92 | { |
| 91 | 93 | msg_send_simple_message($buddy_row['BUDDY_SENDER_ID'], $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, $user['username'], $lang['buddy_msg_deny_title'], |
| 92 | 94 | sprintf($lang['buddy_msg_deny_text'], $user['username'])); |
| 95 | + } |
|
| 93 | 96 | |
| 94 | 97 | doquery("UPDATE {{buddy}} SET `BUDDY_STATUS` = " . BUDDY_REQUEST_DENIED . " WHERE `BUDDY_ID` = {$buddy_id} LIMIT 1;"); |
| 95 | 98 | sn_db_transaction_commit(); |
@@ -104,8 +107,7 @@ discard block |
||
| 104 | 107 | if($new_friend_id = sys_get_param_id('request_user_id')) |
| 105 | 108 | { |
| 106 | 109 | $new_friend_row = db_user_by_id($new_friend_id, true, '`id`, `username`'); |
| 107 | - } |
|
| 108 | - elseif($new_friend_name = sys_get_param_str_unsafe('request_user_name')) |
|
| 110 | + } elseif($new_friend_name = sys_get_param_str_unsafe('request_user_name')) |
|
| 109 | 111 | { |
| 110 | 112 | $new_friend_row = db_user_by_username($new_friend_name); |
| 111 | 113 | $new_friend_name = db_escape($new_friend_name); |
@@ -138,8 +140,7 @@ discard block |
||
| 138 | 140 | sn_db_transaction_commit(); |
| 139 | 141 | throw new exception('buddy_err_adding_none', ERR_NONE); |
| 140 | 142 | } |
| 141 | -} |
|
| 142 | -catch(exception $e) |
|
| 143 | +} catch(exception $e) |
|
| 143 | 144 | { |
| 144 | 145 | $result[] = array( |
| 145 | 146 | 'STATUS' => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR, |
@@ -6,8 +6,7 @@ discard block |
||
| 6 | 6 | require_once('db_queries_fleet.php'); |
| 7 | 7 | |
| 8 | 8 | |
| 9 | -function db_planet_list_admin_list($table_parent_columns, $planet_active, $active_time, $planet_type) |
|
| 10 | -{ |
|
| 9 | +function db_planet_list_admin_list($table_parent_columns, $planet_active, $active_time, $planet_type) { |
|
| 11 | 10 | return doquery( |
| 12 | 11 | "SELECT p.*, u.username" . ($table_parent_columns ? ', p1.name AS parent_name' : '') . |
| 13 | 12 | " FROM {{planets}} AS p |
@@ -16,8 +15,7 @@ discard block |
||
| 16 | 15 | " WHERE " . ($planet_active ? "p.last_update >= {$active_time}" : "p.planet_type = {$planet_type}")); |
| 17 | 16 | } |
| 18 | 17 | |
| 19 | -function db_planet_list_search($searchtext) |
|
| 20 | -{ |
|
| 18 | +function db_planet_list_search($searchtext) { |
|
| 21 | 19 | return doquery( |
| 22 | 20 | "SELECT |
| 23 | 21 | p.galaxy, p.system, p.planet, p.planet_type, p.name as planet_name, |
@@ -37,8 +35,7 @@ discard block |
||
| 37 | 35 | |
| 38 | 36 | |
| 39 | 37 | |
| 40 | -function db_user_list_search($searchtext) |
|
| 41 | -{ |
|
| 38 | +function db_user_list_search($searchtext) { |
|
| 42 | 39 | return doquery( |
| 43 | 40 | "SELECT |
| 44 | 41 | pn.player_name, u.id as uid, u.username, u.ally_id, u.id_planet, u.total_points, u.total_rank, |
@@ -56,8 +53,7 @@ discard block |
||
| 56 | 53 | ); |
| 57 | 54 | } |
| 58 | 55 | |
| 59 | -function db_buddy_list_by_user($user_id) |
|
| 60 | -{ |
|
| 56 | +function db_buddy_list_by_user($user_id) { |
|
| 61 | 57 | // return ($user_id = intval($user_id)) ? doquery( |
| 62 | 58 | return ($user_id = idval($user_id)) ? doquery( |
| 63 | 59 | "SELECT |
@@ -87,8 +83,7 @@ discard block |
||
| 87 | 83 | |
| 88 | 84 | |
| 89 | 85 | |
| 90 | -function db_unit_records_sum($unit_id, $user_skip_list_unit) |
|
| 91 | -{ |
|
| 86 | +function db_unit_records_sum($unit_id, $user_skip_list_unit) { |
|
| 92 | 87 | return doquery ( |
| 93 | 88 | "SELECT unit_player_id, username, sum(unit_level) as unit_level |
| 94 | 89 | FROM {{unit}} JOIN {{users}} AS u ON u.id = unit_player_id |
@@ -99,8 +94,7 @@ discard block |
||
| 99 | 94 | , true); |
| 100 | 95 | } |
| 101 | 96 | |
| 102 | -function db_unit_records_plain($unit_id, $user_skip_list_unit) |
|
| 103 | -{ |
|
| 97 | +function db_unit_records_plain($unit_id, $user_skip_list_unit) { |
|
| 104 | 98 | return doquery ( |
| 105 | 99 | "SELECT unit_player_id, username, unit_level |
| 106 | 100 | FROM {{unit}} JOIN {{users}} AS u ON u.id = unit_player_id |
@@ -184,15 +178,13 @@ discard block |
||
| 184 | 178 | } |
| 185 | 179 | |
| 186 | 180 | |
| 187 | -function db_stat_list_delete_ally_player() |
|
| 188 | -{ |
|
| 181 | +function db_stat_list_delete_ally_player() { |
|
| 189 | 182 | return doquery('DELETE s FROM `{{statpoints}}` AS s JOIN `{{users}}` AS u ON u.id = s.id_owner WHERE s.id_ally IS NULL AND u.user_as_ally IS NOT NULL'); |
| 190 | 183 | } |
| 191 | 184 | |
| 192 | 185 | |
| 193 | 186 | |
| 194 | -function db_chat_player_list_online($chat_refresh_rate, $ally_add) |
|
| 195 | -{ |
|
| 187 | +function db_chat_player_list_online($chat_refresh_rate, $ally_add) { |
|
| 196 | 188 | $sql_date = SN_TIME_NOW - $chat_refresh_rate * 2; |
| 197 | 189 | |
| 198 | 190 | return doquery( |
@@ -206,13 +198,11 @@ discard block |
||
| 206 | 198 | ORDER BY authlevel DESC, `username`"); |
| 207 | 199 | } |
| 208 | 200 | |
| 209 | -function db_referrals_list_by_id($user_id) |
|
| 210 | -{ |
|
| 201 | +function db_referrals_list_by_id($user_id) { |
|
| 211 | 202 | return doquery("SELECT r.*, u.username, u.register_time FROM {{referrals}} AS r LEFT JOIN {{users}} AS u ON u.id = r.id WHERE id_partner = {$user_id}"); |
| 212 | 203 | } |
| 213 | 204 | |
| 214 | -function db_message_list_admin_by_type($int_type_selected, $StartRec) |
|
| 215 | -{ |
|
| 205 | +function db_message_list_admin_by_type($int_type_selected, $StartRec) { |
|
| 216 | 206 | return doquery("SELECT |
| 217 | 207 | message_id as `ID`, |
| 218 | 208 | message_from as `FROM`, |
@@ -231,8 +221,7 @@ discard block |
||
| 231 | 221 | } |
| 232 | 222 | |
| 233 | 223 | |
| 234 | -function db_message_insert_all($message_type, $from, $subject, $text) |
|
| 235 | -{ |
|
| 224 | +function db_message_insert_all($message_type, $from, $subject, $text) { |
|
| 236 | 225 | return doquery($QryInsertMessage = 'INSERT INTO {{messages}} (`message_owner`, `message_sender`, `message_time`, `message_type`, `message_from`, `message_subject`, `message_text`) ' . |
| 237 | 226 | "SELECT `id`, 0, unix_timestamp(now()), {$message_type}, '{$from}', '{$subject}', '{$text}' FROM {{users}}"); |
| 238 | 227 | } |
@@ -37,8 +37,7 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @package phpBB3 |
| 39 | 39 | */ |
| 40 | -class template_compile |
|
| 41 | -{ |
|
| 40 | +class template_compile { |
|
| 42 | 41 | var $template; |
| 43 | 42 | |
| 44 | 43 | // Various storage arrays |
@@ -58,8 +57,7 @@ discard block |
||
| 58 | 57 | * Load template source from file |
| 59 | 58 | * @access private |
| 60 | 59 | */ |
| 61 | - function _tpl_load_file($handle, $store_in_db = false) |
|
| 62 | - { |
|
| 60 | + function _tpl_load_file($handle, $store_in_db = false) { |
|
| 63 | 61 | // Try and open template for read |
| 64 | 62 | if (!file_exists($this->template->files[$handle])) |
| 65 | 63 | { |
@@ -67,8 +65,7 @@ discard block |
||
| 67 | 65 | { |
| 68 | 66 | return; |
| 69 | 67 | trigger_error("template->_tpl_load_file(): File {$this->template->files[$handle]} does not exist or is empty", E_USER_ERROR); |
| 70 | - } |
|
| 71 | - else |
|
| 68 | + } else |
|
| 72 | 69 | { |
| 73 | 70 | $this->template->files[$handle] = $this->template->files_inherit[$handle]; |
| 74 | 71 | } |
@@ -104,8 +101,7 @@ discard block |
||
| 104 | 101 | * the ones that exist in zend_language_scanner.l |
| 105 | 102 | * @access private |
| 106 | 103 | */ |
| 107 | - function remove_php_tags(&$code) |
|
| 108 | - { |
|
| 104 | + function remove_php_tags(&$code) { |
|
| 109 | 105 | // This matches the information gathered from the internal PHP lexer |
| 110 | 106 | $match = array( |
| 111 | 107 | '#<([\?%])=?.*?\1>#s', |
@@ -120,8 +116,7 @@ discard block |
||
| 120 | 116 | * The all seeing all doing compile method. Parts are inspired by or directly from Smarty |
| 121 | 117 | * @access private |
| 122 | 118 | */ |
| 123 | - function compile($code, $no_echo = false, $echo_var = '') |
|
| 124 | - { |
|
| 119 | + function compile($code, $no_echo = false, $echo_var = '') { |
|
| 125 | 120 | global $config; |
| 126 | 121 | |
| 127 | 122 | if ($echo_var) |
@@ -226,15 +221,13 @@ discard block |
||
| 226 | 221 | $var = substr($temp, 2, -1); |
| 227 | 222 | //$file = $this->template->_tpldata['DEFINE']['.'][$var]; |
| 228 | 223 | $temp = "\$this->_tpldata['DEFINE']['.']['$var']"; |
| 229 | - } |
|
| 230 | - else |
|
| 224 | + } else |
|
| 231 | 225 | { |
| 232 | 226 | $var = substr($temp, 1, -1); |
| 233 | 227 | //$file = $this->template->_rootref[$var]; |
| 234 | 228 | $temp = "\$this->_rootref['$var']"; |
| 235 | 229 | } |
| 236 | - } |
|
| 237 | - else |
|
| 230 | + } else |
|
| 238 | 231 | { |
| 239 | 232 | $file = $temp; |
| 240 | 233 | } |
@@ -293,8 +286,7 @@ discard block |
||
| 293 | 286 | * Compile variables |
| 294 | 287 | * @access private |
| 295 | 288 | */ |
| 296 | - function compile_var_tags(&$text_blocks) |
|
| 297 | - { |
|
| 289 | + function compile_var_tags(&$text_blocks) { |
|
| 298 | 290 | // including $lang variable |
| 299 | 291 | global $lang, $config; |
| 300 | 292 | |
@@ -368,8 +360,7 @@ discard block |
||
| 368 | 360 | * Compile blocks |
| 369 | 361 | * @access private |
| 370 | 362 | */ |
| 371 | - function compile_tag_block($tag_args) |
|
| 372 | - { |
|
| 363 | + function compile_tag_block($tag_args) { |
|
| 373 | 364 | $no_nesting = false; |
| 374 | 365 | |
| 375 | 366 | // Is the designer wanting to call another loop in a loop? |
@@ -392,8 +383,7 @@ discard block |
||
| 392 | 383 | if ($match[2] < 0) |
| 393 | 384 | { |
| 394 | 385 | $loop_start = '($_' . $tag_args . '_count ' . $match[2] . ' < 0 ? 0 : $_' . $tag_args . '_count ' . $match[2] . ')'; |
| 395 | - } |
|
| 396 | - else |
|
| 386 | + } else |
|
| 397 | 387 | { |
| 398 | 388 | $loop_start = '($_' . $tag_args . '_count < ' . $match[2] . ' ? $_' . $tag_args . '_count : ' . $match[2] . ')'; |
| 399 | 389 | } |
@@ -401,17 +391,14 @@ discard block |
||
| 401 | 391 | if (strlen($match[3]) < 1 || $match[3] == -1) |
| 402 | 392 | { |
| 403 | 393 | $loop_end = '$_' . $tag_args . '_count'; |
| 404 | - } |
|
| 405 | - else if ($match[3] >= 0) |
|
| 394 | + } else if ($match[3] >= 0) |
|
| 406 | 395 | { |
| 407 | 396 | $loop_end = '(' . ($match[3] + 1) . ' > $_' . $tag_args . '_count ? $_' . $tag_args . '_count : ' . ($match[3] + 1) . ')'; |
| 408 | - } |
|
| 409 | - else //if ($match[3] < -1) |
|
| 397 | + } else //if ($match[3] < -1) |
|
| 410 | 398 | { |
| 411 | 399 | $loop_end = '$_' . $tag_args . '_count' . ($match[3] + 1); |
| 412 | 400 | } |
| 413 | - } |
|
| 414 | - else |
|
| 401 | + } else |
|
| 415 | 402 | { |
| 416 | 403 | $loop_start = 0; |
| 417 | 404 | $loop_end = '$_' . $tag_args . '_count'; |
@@ -424,8 +411,7 @@ discard block |
||
| 424 | 411 | { |
| 425 | 412 | // We need to implode $no_nesting times from the end... |
| 426 | 413 | $block = array_slice($this->block_names, -$no_nesting); |
| 427 | - } |
|
| 428 | - else |
|
| 414 | + } else |
|
| 429 | 415 | { |
| 430 | 416 | $block = $this->block_names; |
| 431 | 417 | } |
@@ -435,8 +421,7 @@ discard block |
||
| 435 | 421 | // Block is not nested. |
| 436 | 422 | $tag_template_php = '$_' . $tag_args . "_count = (isset(\$this->_tpldata['$tag_args'])) ? sizeof(\$this->_tpldata['$tag_args']) : 0;"; |
| 437 | 423 | $varref = "\$this->_tpldata['$tag_args']"; |
| 438 | - } |
|
| 439 | - else |
|
| 424 | + } else |
|
| 440 | 425 | { |
| 441 | 426 | // This block is nested. |
| 442 | 427 | // Generate a namespace string for this block. |
@@ -475,8 +460,7 @@ discard block |
||
| 475 | 460 | * some adaptions for our block level methods |
| 476 | 461 | * @access private |
| 477 | 462 | */ |
| 478 | - function compile_tag_if($tag_args, $elseif) |
|
| 479 | - { |
|
| 463 | + function compile_tag_if($tag_args, $elseif) { |
|
| 480 | 464 | // Tokenize args for 'if' tag. |
| 481 | 465 | preg_match_all('/(?: |
| 482 | 466 | "[^"\\\\]*(?:\\\\.[^"\\\\]*)*" | |
@@ -584,8 +568,7 @@ discard block |
||
| 584 | 568 | if (preg_match('#^((?:[a-z0-9\-_]+\.)+)?(\$)?(?=[A-Za-z])([A-Za-z0-9\-_]+)#s', $token, $varrefs)) |
| 585 | 569 | { |
| 586 | 570 | $token = (!empty($varrefs[1])) ? $this->generate_block_data_ref(substr($varrefs[1], 0, -1), true, $varrefs[2]) . '[\'' . $varrefs[3] . '\']' : (($varrefs[2]) ? '$this->_tpldata[\'DEFINE\'][\'.\'][\'' . $varrefs[3] . '\']' : '$this->_rootref[\'' . $varrefs[3] . '\']'); |
| 587 | - } |
|
| 588 | - else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs)) |
|
| 571 | + } else if (preg_match('#^\.((?:[a-z0-9\-_]+\.?)+)$#s', $token, $varrefs)) |
|
| 589 | 572 | { |
| 590 | 573 | // Allow checking if loops are set with .loopname |
| 591 | 574 | // It is also possible to check the loop count by doing <!-- IF .loopname > 1 --> for example |
@@ -601,8 +584,7 @@ discard block |
||
| 601 | 584 | |
| 602 | 585 | // Add the block reference for the last child. |
| 603 | 586 | $varref .= "['" . $block . "']"; |
| 604 | - } |
|
| 605 | - else |
|
| 587 | + } else |
|
| 606 | 588 | { |
| 607 | 589 | $varref = '$this->_tpldata'; |
| 608 | 590 | |
@@ -610,8 +592,7 @@ discard block |
||
| 610 | 592 | $varref .= "['" . $blocks[0] . "']"; |
| 611 | 593 | } |
| 612 | 594 | $token = "sizeof($varref)"; |
| 613 | - } |
|
| 614 | - else if (!empty($token)) |
|
| 595 | + } else if (!empty($token)) |
|
| 615 | 596 | { |
| 616 | 597 | $token = '(' . $token . ')'; |
| 617 | 598 | } |
@@ -632,8 +613,7 @@ discard block |
||
| 632 | 613 | * Compile DEFINE tags |
| 633 | 614 | * @access private |
| 634 | 615 | */ |
| 635 | - function compile_tag_define($tag_args, $op) |
|
| 636 | - { |
|
| 616 | + function compile_tag_define($tag_args, $op) { |
|
| 637 | 617 | preg_match('#^((?:[a-z0-9\-_]+\.)+)?\$(?=[A-Z])([A-Z0-9_\-]*)(?: = (\'?)([^\']*)(\'?))?$#', $tag_args, $match); |
| 638 | 618 | |
| 639 | 619 | if (empty($match[2]) || (!isset($match[4]) && $op)) |
@@ -656,8 +636,7 @@ discard block |
||
| 656 | 636 | |
| 657 | 637 | // Now replace the php code |
| 658 | 638 | $match[4] = "'" . str_replace(array('<?php echo ', '; ?>'), array("' . ", " . '"), $match[4]) . "'"; |
| 659 | - } |
|
| 660 | - else |
|
| 639 | + } else |
|
| 661 | 640 | { |
| 662 | 641 | preg_match('#true|false|\.#i', $match[4], $type); |
| 663 | 642 | |
@@ -685,8 +664,7 @@ discard block |
||
| 685 | 664 | * Compile INCLUDE tag |
| 686 | 665 | * @access private |
| 687 | 666 | */ |
| 688 | - function compile_tag_include($tag_args) |
|
| 689 | - { |
|
| 667 | + function compile_tag_include($tag_args) { |
|
| 690 | 668 | // Process dynamic includes |
| 691 | 669 | if ($tag_args[0] == '$') |
| 692 | 670 | { |
@@ -700,8 +678,7 @@ discard block |
||
| 700 | 678 | * Compile INCLUDE_PHP tag |
| 701 | 679 | * @access private |
| 702 | 680 | */ |
| 703 | - function compile_tag_include_php($tag_args) |
|
| 704 | - { |
|
| 681 | + function compile_tag_include_php($tag_args) { |
|
| 705 | 682 | return "\$this->_php_include('$tag_args');"; |
| 706 | 683 | } |
| 707 | 684 | |
@@ -710,8 +687,7 @@ discard block |
||
| 710 | 687 | * This is from Smarty |
| 711 | 688 | * @access private |
| 712 | 689 | */ |
| 713 | - function _parse_is_expr($is_arg, $tokens) |
|
| 714 | - { |
|
| 690 | + function _parse_is_expr($is_arg, $tokens) { |
|
| 715 | 691 | $expr_end = 0; |
| 716 | 692 | $negate_expr = false; |
| 717 | 693 | |
@@ -719,8 +695,7 @@ discard block |
||
| 719 | 695 | { |
| 720 | 696 | $negate_expr = true; |
| 721 | 697 | $expr_type = array_shift($tokens); |
| 722 | - } |
|
| 723 | - else |
|
| 698 | + } else |
|
| 724 | 699 | { |
| 725 | 700 | $expr_type = $first_token; |
| 726 | 701 | } |
@@ -733,8 +708,7 @@ discard block |
||
| 733 | 708 | $expr_end++; |
| 734 | 709 | $expr_arg = $tokens[$expr_end++]; |
| 735 | 710 | $expr = "!(($is_arg / $expr_arg) % $expr_arg)"; |
| 736 | - } |
|
| 737 | - else |
|
| 711 | + } else |
|
| 738 | 712 | { |
| 739 | 713 | $expr = "!($is_arg & 1)"; |
| 740 | 714 | } |
@@ -746,8 +720,7 @@ discard block |
||
| 746 | 720 | $expr_end++; |
| 747 | 721 | $expr_arg = $tokens[$expr_end++]; |
| 748 | 722 | $expr = "(($is_arg / $expr_arg) % $expr_arg)"; |
| 749 | - } |
|
| 750 | - else |
|
| 723 | + } else |
|
| 751 | 724 | { |
| 752 | 725 | $expr = "($is_arg & 1)"; |
| 753 | 726 | } |
@@ -786,8 +759,7 @@ discard block |
||
| 786 | 759 | * |
| 787 | 760 | * @return string |
| 788 | 761 | */ |
| 789 | - private function generate_block_varref($namespace, $varname, $defop = false) |
|
| 790 | - { |
|
| 762 | + private function generate_block_varref($namespace, $varname, $defop = false) { |
|
| 791 | 763 | // Strip the trailing period. |
| 792 | 764 | $namespace = substr($namespace, 0, -1); |
| 793 | 765 | |
@@ -810,8 +782,7 @@ discard block |
||
| 810 | 782 | * NOTE: does not expect a trailing "." on the blockname. |
| 811 | 783 | * @access private |
| 812 | 784 | */ |
| 813 | - function generate_block_data_ref($blockname, $include_last_iterator, $defop = false) |
|
| 814 | - { |
|
| 785 | + function generate_block_data_ref($blockname, $include_last_iterator, $defop = false) { |
|
| 815 | 786 | // Get an array of the blocks involved. |
| 816 | 787 | $blocks = explode('.', $blockname); |
| 817 | 788 | $blockcount = sizeof($blocks) - 1; |
@@ -833,12 +804,10 @@ discard block |
||
| 833 | 804 | $varref .= '[$_' . $blocks[$blockcount] . '_i]'; |
| 834 | 805 | } |
| 835 | 806 | return $varref; |
| 836 | - } |
|
| 837 | - else if ($include_last_iterator) |
|
| 807 | + } else if ($include_last_iterator) |
|
| 838 | 808 | { |
| 839 | 809 | return '$_'. $blocks[$blockcount] . '_val'; |
| 840 | - } |
|
| 841 | - else |
|
| 810 | + } else |
|
| 842 | 811 | { |
| 843 | 812 | return '$_'. $blocks[$blockcount - 1] . '_val[\''. $blocks[$blockcount]. '\']'; |
| 844 | 813 | } |
@@ -848,8 +817,7 @@ discard block |
||
| 848 | 817 | * Write compiled file to cache directory |
| 849 | 818 | * @access private |
| 850 | 819 | */ |
| 851 | - function compile_write($handle, $data) |
|
| 852 | - { |
|
| 820 | + function compile_write($handle, $data) { |
|
| 853 | 821 | $filename = $this->template->cachepath . str_replace('/', '.', $this->template->filename[$handle]) . DOT_PHP_EX; |
| 854 | 822 | |
| 855 | 823 | $data = "<?php if (!defined('INSIDE')) exit;" . ((strpos($data, '<?php') === 0) ? substr($data, 5) : ' ?>' . $data); |
@@ -873,8 +841,7 @@ discard block |
||
| 873 | 841 | * Minifies template w/i PHP code by removing extra spaces |
| 874 | 842 | * @access private |
| 875 | 843 | */ |
| 876 | - function minify($html) |
|
| 877 | - { |
|
| 844 | + function minify($html) { |
|
| 878 | 845 | global $config; |
| 879 | 846 | |
| 880 | 847 | if(!$config->tpl_minifier) |
@@ -290,10 +290,12 @@ discard block |
||
| 290 | 290 | } |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - if ($fleet_id) // Не планета |
|
| 293 | + if ($fleet_id) { |
|
| 294 | + // Не планета |
|
| 294 | 295 | { |
| 295 | 296 | if ($fleet_info[UBE_FLEET_TYPE] == UBE_ATTACKERS && $outcome[UBE_MOON_REAPERS] == UBE_MOON_REAPERS_DIED) { |
| 296 | 297 | $new_fleet_count = 0; |
| 298 | + } |
|
| 297 | 299 | } |
| 298 | 300 | |
| 299 | 301 | if ($new_fleet_count) { |
@@ -316,10 +318,12 @@ discard block |
||
| 316 | 318 | } |
| 317 | 319 | DBStaticPlanet::db_planet_set_by_id($planet_id, implode(',', $temp)); |
| 318 | 320 | } |
| 319 | - if (!empty($db_changeset)) // Сохраняем изменения юнитов на планете - если они есть |
|
| 321 | + if (!empty($db_changeset)) { |
|
| 322 | + // Сохраняем изменения юнитов на планете - если они есть |
|
| 320 | 323 | { |
| 321 | 324 | OldDbChangeSet::db_changeset_apply($db_changeset); |
| 322 | 325 | } |
| 326 | + } |
|
| 323 | 327 | } |
| 324 | 328 | } |
| 325 | 329 | |
@@ -236,9 +236,11 @@ |
||
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | // Если новая планета не найдена или было переключения - проверяем текущую выбранную планету |
| 239 | - if (!isset($planet_row['id'])) // || $planet_row['id'] != $user['current_planet'] |
|
| 239 | + if (!isset($planet_row['id'])) { |
|
| 240 | + // || $planet_row['id'] != $user['current_planet'] |
|
| 240 | 241 | { |
| 241 | 242 | $planet_row = DBStaticPlanet::db_planet_by_id_and_owner($user['current_planet'], $user['id'], false, 'id'); |
| 243 | + } |
|
| 242 | 244 | // Если текущей планеты не существует - выставляем Столицу |
| 243 | 245 | if (!isset($planet_row['id'])) { |
| 244 | 246 | $planet_row = DBStaticPlanet::db_planet_by_id_and_owner($user['id_planet'], $user['id'], false, 'id'); |