diff options
Diffstat (limited to 'phpBB')
29 files changed, 284 insertions, 127 deletions
diff --git a/phpBB/composer.lock b/phpBB/composer.lock index 872509884c..dc7608b37e 100644 --- a/phpBB/composer.lock +++ b/phpBB/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "d5368b75d221b5573b30307cb2f25f3b", + "hash": "c14bcbf5a6c4fd121492568aa3654c07", "packages": [ { "name": "lusitanian/oauth", @@ -220,12 +220,12 @@ "source": { "type": "git", "url": "https://github.com/s9e/TextFormatter.git", - "reference": "31fe627a4a82d41098a2db8036287c0693c79f13" + "reference": "29c5959f4425934a53b6fdb42760d719b95a6e82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/s9e/TextFormatter/zipball/31fe627a4a82d41098a2db8036287c0693c79f13", - "reference": "31fe627a4a82d41098a2db8036287c0693c79f13", + "url": "https://api.github.com/repos/s9e/TextFormatter/zipball/29c5959f4425934a53b6fdb42760d719b95a6e82", + "reference": "29c5959f4425934a53b6fdb42760d719b95a6e82", "shasum": "" }, "require": { @@ -270,7 +270,7 @@ "parser", "shortcodes" ], - "time": "2015-04-25 20:58:33" + "time": "2015-05-18 04:48:32" }, { "name": "symfony/config", @@ -613,6 +613,56 @@ "time": "2015-04-10 08:56:33" }, { + "name": "symfony/finder", + "version": "2.8.x-dev", + "target-dir": "Symfony/Component/Finder", + "source": { + "type": "git", + "url": "https://github.com/symfony/Finder.git", + "reference": "ad159e0da47e9ffe719bafdc004159ad6e395567" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Finder/zipball/ad159e0da47e9ffe719bafdc004159ad6e395567", + "reference": "ad159e0da47e9ffe719bafdc004159ad6e395567", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "require-dev": { + "symfony/phpunit-bridge": "~2.7|~3.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Finder\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Symfony Finder Component", + "homepage": "http://symfony.com", + "time": "2015-04-10 08:56:33" + }, + { "name": "symfony/http-foundation", "version": "2.8.x-dev", "target-dir": "Symfony/Component/HttpFoundation", @@ -2572,56 +2622,6 @@ "time": "2015-04-10 08:56:33" }, { - "name": "symfony/finder", - "version": "2.8.x-dev", - "target-dir": "Symfony/Component/Finder", - "source": { - "type": "git", - "url": "https://github.com/symfony/Finder.git", - "reference": "ad159e0da47e9ffe719bafdc004159ad6e395567" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Finder/zipball/ad159e0da47e9ffe719bafdc004159ad6e395567", - "reference": "ad159e0da47e9ffe719bafdc004159ad6e395567", - "shasum": "" - }, - "require": { - "php": ">=5.3.9" - }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7|~3.0.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.8-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Finder\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Symfony Finder Component", - "homepage": "http://symfony.com", - "time": "2015-04-10 08:56:33" - }, - { "name": "symfony/process", "version": "2.8.x-dev", "target-dir": "Symfony/Component/Process", @@ -2681,6 +2681,7 @@ "symfony/dependency-injection": 20, "symfony/event-dispatcher": 20, "symfony/filesystem": 20, + "symfony/finder": 20, "symfony/http-kernel": 20, "symfony/routing": 20, "symfony/security-core": 20, @@ -2691,7 +2692,6 @@ "symfony/css-selector": 20, "symfony/debug": 20, "symfony/dom-crawler": 20, - "symfony/finder": 20, "symfony/http-foundation": 20, "symfony/process": 20 }, diff --git a/phpBB/config/default/container/services.yml b/phpBB/config/default/container/services.yml index 670ea3bd61..6577a44195 100644 --- a/phpBB/config/default/container/services.yml +++ b/phpBB/config/default/container/services.yml @@ -15,6 +15,7 @@ imports: - { resource: services_password.yml } - { resource: services_profilefield.yml } - { resource: services_report.yml } + - { resource: services_routing.yml } - { resource: services_text_formatter.yml } - { resource: services_twig.yml } - { resource: services_user.yml } @@ -157,25 +158,6 @@ services: - null - %core.disable_super_globals% - router: - class: phpbb\routing\router - arguments: - - @filesystem - - @ext.manager - - %core.root_path% - - %core.php_ext% - - %core.environment% - - router.listener: - class: Symfony\Component\HttpKernel\EventListener\RouterListener - arguments: - - @router - - null - - null - - @request_stack - tags: - - { name: kernel.event_subscriber } - # WARNING: The Symfony request does not escape the input and should be used very carefully # prefer the phpbb request (service @request) as possible symfony_request: @@ -186,21 +168,6 @@ services: request_stack: class: Symfony\Component\HttpFoundation\RequestStack - template: - class: phpbb\template\twig\twig - arguments: - - @path_helper - - @config - - @user - - @template_context - - @template.twig.environment - - %core.template.cache_path% - - @template.twig.extensions.collection - - @ext.manager - - template_context: - class: phpbb\template\context - upload_imagesize: class: fastImageSize\fastImageSize diff --git a/phpBB/config/default/container/services_routing.yml b/phpBB/config/default/container/services_routing.yml new file mode 100644 index 0000000000..6749202c0d --- /dev/null +++ b/phpBB/config/default/container/services_routing.yml @@ -0,0 +1,19 @@ +services: + router: + class: phpbb\routing\router + arguments: + - @filesystem + - %core.root_path% + - %core.php_ext% + - %core.environment% + - @ext.manager + + router.listener: + class: Symfony\Component\HttpKernel\EventListener\RouterListener + arguments: + - @router + - null + - null + - @request_stack + tags: + - { name: kernel.event_subscriber } diff --git a/phpBB/config/default/container/services_twig.yml b/phpBB/config/default/container/services_twig.yml index 9ab004731e..2799892376 100644 --- a/phpBB/config/default/container/services_twig.yml +++ b/phpBB/config/default/container/services_twig.yml @@ -12,6 +12,7 @@ services: - %core.template.cache_path% - @ext.manager - @template.twig.loader + - [] template.twig.lexer: class: phpbb\template\twig\lexer @@ -47,3 +48,18 @@ services: template.twig.extensions.debug: class: Twig_Extension_Debug + + template: + class: phpbb\template\twig\twig + arguments: + - @path_helper + - @config + - @template_context + - @template.twig.environment + - %core.template.cache_path% + - @user + - @template.twig.extensions.collection + - @ext.manager + + template_context: + class: phpbb\template\context diff --git a/phpBB/config/development/config.yml b/phpBB/config/development/config.yml index f451eebe13..93ae07fb3f 100644 --- a/phpBB/config/development/config.yml +++ b/phpBB/config/development/config.yml @@ -5,4 +5,6 @@ core: require_dev_dependencies: true twig: + debug: true + auto_reload: true enable_debug_extension: true diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index a7bcd9f978..b7b5e7de61 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -1385,6 +1385,20 @@ viewforum_forum_name_prepend * Since: 3.1.0-b3 * Purpose: Add content directly before the forum name link on the View forum screen +viewforum_forum_title_after +=== +* Locations: + + styles/prosilver/template/viewforum_body.html +* Since: 3.1.5-RC1 +* Purpose: Add content directly after the forum title on the View forum screen + +viewforum_forum_title_before +=== +* Locations: + + styles/prosilver/template/viewforum_body.html +* Since: 3.1.5-RC1 +* Purpose: Add content directly before the forum title on the View forum screen + viewtopic_print_head_append === * Locations: @@ -1497,6 +1511,22 @@ viewtopic_body_post_buttons_before * Purpose: Add post button to posts (next to edit, quote etc), at the start of the list. +viewtopic_body_post_buttons_list_after +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.5-RC1 +* Purpose: Add post button custom list to posts (next to edit, quote etc), +after the original list. + +viewtopic_body_post_buttons_list_before +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html +* Since: 3.1.5-RC1 +* Purpose: Add post button custom list to posts (next to edit, quote etc), +before the original list. + viewtopic_body_postrow_custom_fields_after === * Locations: diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 965f1a6f70..ff3b50174b 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -515,7 +515,8 @@ class acp_board if ($config_name == 'guest_style') { - if (isset($cfg_array[$config_name])) { + if (isset($cfg_array[$config_name])) + { $this->guest_style_set($cfg_array[$config_name]); } continue; diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index 150157e275..24eaddf067 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -138,7 +138,6 @@ class bbcode $template = new \phpbb\template\twig\twig( $phpbb_container->get('path_helper'), $phpbb_container->get('config'), - $phpbb_container->get('user'), new \phpbb\template\context(), new \phpbb\template\twig\environment( $phpbb_container->get('config'), @@ -152,6 +151,7 @@ class bbcode ) ), $phpbb_container->getParameter('core.root_path') . 'cache/', + $phpbb_container->get('user'), $phpbb_container->get('template.twig.extensions.collection'), $phpbb_extension_manager ); diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 60511d89a4..5cebc54eb2 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -560,10 +560,14 @@ function generate_text_for_display($text, $uid, $bitfield, $flags, $censor_text * @param bool $allow_bbcode If BBCode is allowed (i.e. if BBCode is parsed) * @param bool $allow_urls If urls is allowed * @param bool $allow_smilies If smilies are allowed +* @param bool $allow_img_bbcode +* @param bool $allow_flash_bbcode +* @param bool $allow_quote_bbcode +* @param bool $allow_url_bbcode * * @return array An array of string with the errors that occurred while parsing */ -function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bbcode = false, $allow_urls = false, $allow_smilies = false) +function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bbcode = false, $allow_urls = false, $allow_smilies = false, $allow_img_bbcode = true, $allow_flash_bbcode = true, $allow_quote_bbcode = true, $allow_url_bbcode = true) { global $phpbb_root_path, $phpEx, $phpbb_dispatcher; @@ -578,6 +582,10 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb * @var bool allow_bbcode Whether or not to parse BBCode * @var bool allow_urls Whether or not to parse URLs * @var bool allow_smilies Whether or not to parse Smilies + * @var bool allow_img_bbcode Whether or not to parse the [img] BBCode + * @var bool allow_flash_bbcode Whether or not to parse the [flash] BBCode + * @var bool allow_quote_bbcode Whether or not to parse the [quote] BBCode + * @var bool allow_url_bbcode Whether or not to parse the [url] BBCode * @since 3.1.0-a1 */ $vars = array( @@ -588,6 +596,10 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb 'allow_bbcode', 'allow_urls', 'allow_smilies', + 'allow_img_bbcode', + 'allow_flash_bbcode', + 'allow_quote_bbcode', + 'allow_url_bbcode', ); extract($phpbb_dispatcher->trigger_event('core.modify_text_for_storage_before', compact($vars))); @@ -600,7 +612,7 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb } $message_parser = new parse_message($text); - $message_parser->parse($allow_bbcode, $allow_urls, $allow_smilies); + $message_parser->parse($allow_bbcode, $allow_urls, $allow_smilies, $allow_img_bbcode, $allow_flash_bbcode, $allow_quote_bbcode, $allow_url_bbcode); $text = $message_parser->message; $uid = $message_parser->bbcode_uid; diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 4cbe1eb425..6abfb40b01 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -633,7 +633,6 @@ class messenger $this->template = new \phpbb\template\twig\twig( $phpbb_container->get('path_helper'), $phpbb_container->get('config'), - $phpbb_container->get('user'), new \phpbb\template\context(), new \phpbb\template\twig\environment( $phpbb_container->get('config'), @@ -647,6 +646,7 @@ class messenger ) ), $phpbb_container->getParameter('core.root_path') . 'cache/', + $phpbb_container->get('user'), $phpbb_container->get('template.twig.extensions.collection'), $phpbb_extension_manager ); diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 9fe598d7fb..f018d735a7 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -1250,6 +1250,16 @@ class parse_message extends bbcode_firstpass return (!$update_this_message) ? $return_message : $this->warn_msg; } + // Remove quotes that are nested too deep + if ($config['max_quote_depth'] > 0) + { + $this->message = $phpbb_container->get('text_formatter.utils')->remove_bbcode( + $this->message, + 'quote', + $config['max_quote_depth'] + ); + } + // Check for errors $errors = $parser->get_errors(); if ($errors) diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 657825ca39..056c827669 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -138,6 +138,7 @@ $phpbb_container_builder->set_custom_parameters(array( $phpbb_container = $phpbb_container_builder->get_container(); $phpbb_container->register('dbal.conn.driver')->setSynthetic(true); $phpbb_container->register('template.twig.environment')->setSynthetic(true); +$phpbb_container->register('language.loader')->setSynthetic(true); $phpbb_container->compile(); $phpbb_class_loader->set_cache($phpbb_container->get('cache.driver')); @@ -288,16 +289,18 @@ $twig_environment = new \phpbb\template\twig\environment( $phpbb_container->get('template.twig.loader') ); +$language_loader = new \phpbb\language\language_file_loader($phpbb_root_path, $phpEx); $phpbb_container->set('template.twig.environment', $twig_environment); +$phpbb_container->set('language.loader', $language_loader); $twig_context = new \phpbb\template\context(); $template = new \phpbb\template\twig\twig( $phpbb_path_helper, $config, - $user, $twig_context, $twig_environment, $cache_path, - array(new \phpbb\template\twig\extension($twig_context, $user)) + $user, + array($phpbb_container->get('template.twig.extensions.phpbb')) ); $paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style'); diff --git a/phpBB/phpbb/auth/provider/oauth/token_storage.php b/phpBB/phpbb/auth/provider/oauth/token_storage.php index 023cf402ca..f488c2022d 100644 --- a/phpBB/phpbb/auth/provider/oauth/token_storage.php +++ b/phpBB/phpbb/auth/provider/oauth/token_storage.php @@ -117,7 +117,8 @@ class token_storage implements TokenStorageInterface { $service = $this->get_service_name_for_db($service); - if ($this->cachedToken) { + if ($this->cachedToken) + { return true; } @@ -232,7 +233,8 @@ class token_storage implements TokenStorageInterface { $service = $this->get_service_name_for_db($service); - if ($this->cachedToken instanceof TokenInterface) { + if ($this->cachedToken instanceof TokenInterface) + { return $this->cachedToken; } diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php index 1518169458..3782512fa4 100644 --- a/phpBB/phpbb/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php @@ -13,6 +13,7 @@ namespace phpbb\controller; +use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\RequestContext; @@ -215,12 +216,31 @@ class helper public function message($message, array $parameters = array(), $title = 'INFORMATION', $code = 200) { array_unshift($parameters, $message); + $message_text = call_user_func_array(array($this->user, 'lang'), $parameters); + $message_title = $this->user->lang($title); + + if ($this->request->is_ajax()) + { + global $refresh_data; + + return new JsonResponse( + array( + 'MESSAGE_TITLE' => $message_title, + 'MESSAGE_TEXT' => $message_text, + 'S_USER_WARNING' => false, + 'S_USER_NOTICE' => false, + 'REFRESH_DATA' => (!empty($refresh_data)) ? $refresh_data : null + ), + $code + ); + } + $this->template->assign_vars(array( - 'MESSAGE_TEXT' => call_user_func_array(array($this->user, 'lang'), $parameters), - 'MESSAGE_TITLE' => $this->user->lang($title), + 'MESSAGE_TEXT' => $message_text, + 'MESSAGE_TITLE' => $message_title, )); - return $this->render('message_body.html', $this->user->lang($title), $code); + return $this->render('message_body.html', $message_title, $code); } /** diff --git a/phpBB/phpbb/di/extension/container_configuration.php b/phpBB/phpbb/di/extension/container_configuration.php index ee58ec2b74..4cc7c7c0d1 100644 --- a/phpBB/phpbb/di/extension/container_configuration.php +++ b/phpBB/phpbb/di/extension/container_configuration.php @@ -34,6 +34,8 @@ class container_configuration implements ConfigurationInterface ->arrayNode('twig') ->addDefaultsIfNotSet() ->children() + ->booleanNode('debug')->defaultValue(null)->end() + ->booleanNode('auto_reload')->defaultValue(null)->end() ->booleanNode('enable_debug_extension')->defaultValue(false)->end() ->end() ->end() diff --git a/phpBB/phpbb/di/extension/core.php b/phpBB/phpbb/di/extension/core.php index c71dc61280..c9e2d4dc5b 100644 --- a/phpBB/phpbb/di/extension/core.php +++ b/phpBB/phpbb/di/extension/core.php @@ -69,6 +69,20 @@ class core extends Extension } } + // Set the Twig options if defined in the environment + $definition = $container->getDefinition('template.twig.environment'); + $twig_environment_options = $definition->getArgument(6); + if ($config['twig']['debug']) + { + $twig_environment_options['debug'] = true; + } + if ($config['twig']['auto_reload']) + { + $twig_environment_options['auto_reload'] = true; + } + // Replace the 6th argument, the options passed to the environment + $definition->replaceArgument(6, $twig_environment_options); + if ($config['twig']['enable_debug_extension']) { $definition = $container->getDefinition('template.twig.extensions.debug'); diff --git a/phpBB/phpbb/routing/router.php b/phpBB/phpbb/routing/router.php index 7444f06253..dd5bffe22b 100644 --- a/phpBB/phpbb/routing/router.php +++ b/phpBB/phpbb/routing/router.php @@ -94,13 +94,14 @@ class router implements RouterInterface * Construct method * * @param \phpbb\filesystem\filesystem_interface $filesystem Filesystem helper - * @param manager $extension_manager Extension manager - * @param string $phpbb_root_path phpBB root path - * @param string $php_ext PHP file extension - * @param string $environment Name of the current environment - * @param array $routing_files Array of strings containing paths to YAML files holding route information + * @param string $phpbb_root_path phpBB root path + * @param string $php_ext PHP file extension + * @param string $environment Name of the current environment + * @param manager|null $extension_manager Extension manager + * @param array $routing_files Array of strings containing paths to YAML files + * holding route information */ - public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, manager $extension_manager, $phpbb_root_path, $php_ext, $environment, $routing_files = array()) + public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, $phpbb_root_path, $php_ext, $environment, manager $extension_manager = null, $routing_files = array()) { $this->filesystem = $filesystem; $this->extension_manager = $extension_manager; @@ -172,7 +173,9 @@ class router implements RouterInterface { if ($this->route_collection == null || empty($this->routing_files)) { - $this->find_routing_files($this->extension_manager->all_enabled(false)) + $this->find_routing_files( + ($this->extension_manager !== null) ? $this->extension_manager->all_enabled(false) : array() + ) ->find($this->phpbb_root_path); } diff --git a/phpBB/phpbb/template/exception/user_object_not_available.php b/phpBB/phpbb/template/exception/user_object_not_available.php new file mode 100644 index 0000000000..62fd2743c1 --- /dev/null +++ b/phpBB/phpbb/template/exception/user_object_not_available.php @@ -0,0 +1,22 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\template\exception; + +/** + * This exception is thrown when the user object was not set but it is required by the called method + */ +class user_object_not_available extends \phpbb\exception\runtime_exception +{ + +} diff --git a/phpBB/phpbb/template/twig/environment.php b/phpBB/phpbb/template/twig/environment.php index e7b8aeab89..6e75403159 100644 --- a/phpBB/phpbb/template/twig/environment.php +++ b/phpBB/phpbb/template/twig/environment.php @@ -65,7 +65,7 @@ class environment extends \Twig_Environment $options = array_merge(array( 'cache' => (defined('IN_INSTALL')) ? false : $cache_path, - 'debug' => defined('DEBUG'), + 'debug' => false, 'auto_reload' => (bool) $this->phpbb_config['load_tplcompile'], 'autoescape' => false, ), $options); diff --git a/phpBB/phpbb/template/twig/loader.php b/phpBB/phpbb/template/twig/loader.php index df8183c019..8b12188a77 100644 --- a/phpBB/phpbb/template/twig/loader.php +++ b/phpBB/phpbb/template/twig/loader.php @@ -115,7 +115,8 @@ class loader extends \Twig_Loader_Filesystem // If this is in the cache we can skip the entire process below // as it should have already been validated - if (isset($this->cache[$name])) { + if (isset($this->cache[$name])) + { return $this->cache[$name]; } diff --git a/phpBB/phpbb/template/twig/node/definenode.php b/phpBB/phpbb/template/twig/node/definenode.php index 695ec4281f..c110785c4b 100644 --- a/phpBB/phpbb/template/twig/node/definenode.php +++ b/phpBB/phpbb/template/twig/node/definenode.php @@ -31,7 +31,8 @@ class definenode extends \Twig_Node { $compiler->addDebugInfo($this); - if ($this->getAttribute('capture')) { + if ($this->getAttribute('capture')) + { $compiler ->write("ob_start();\n") ->subcompile($this->getNode('value')) diff --git a/phpBB/phpbb/template/twig/node/includephp.php b/phpBB/phpbb/template/twig/node/includephp.php index 826617e8e8..659495fd9e 100644 --- a/phpBB/phpbb/template/twig/node/includephp.php +++ b/phpBB/phpbb/template/twig/node/includephp.php @@ -47,7 +47,8 @@ class includephp extends \Twig_Node return; } - if ($this->getAttribute('ignore_missing')) { + if ($this->getAttribute('ignore_missing')) + { $compiler ->write("try {\n") ->indent() @@ -76,7 +77,8 @@ class includephp extends \Twig_Node ->write("}\n") ; - if ($this->getAttribute('ignore_missing')) { + if ($this->getAttribute('ignore_missing')) + { $compiler ->outdent() ->write("} catch (\Twig_Error_Loader \$e) {\n") diff --git a/phpBB/phpbb/template/twig/tokenparser/defineparser.php b/phpBB/phpbb/template/twig/tokenparser/defineparser.php index cfee84a363..2b88d61118 100644 --- a/phpBB/phpbb/template/twig/tokenparser/defineparser.php +++ b/phpBB/phpbb/template/twig/tokenparser/defineparser.php @@ -33,7 +33,8 @@ class defineparser extends \Twig_TokenParser $name = $this->parser->getExpressionParser()->parseExpression(); $capture = false; - if ($stream->test(\Twig_Token::OPERATOR_TYPE, '=')) { + if ($stream->test(\Twig_Token::OPERATOR_TYPE, '=')) + { $stream->next(); $value = $this->parser->getExpressionParser()->parseExpression(); @@ -45,7 +46,9 @@ class defineparser extends \Twig_TokenParser } $stream->expect(\Twig_Token::BLOCK_END_TYPE); - } else { + } + else + { $capture = true; $stream->expect(\Twig_Token::BLOCK_END_TYPE); diff --git a/phpBB/phpbb/template/twig/tokenparser/includephp.php b/phpBB/phpbb/template/twig/tokenparser/includephp.php index 38196c5290..c09f7729b0 100644 --- a/phpBB/phpbb/template/twig/tokenparser/includephp.php +++ b/phpBB/phpbb/template/twig/tokenparser/includephp.php @@ -31,7 +31,8 @@ class includephp extends \Twig_TokenParser $stream = $this->parser->getStream(); $ignoreMissing = false; - if ($stream->test(\Twig_Token::NAME_TYPE, 'ignore')) { + if ($stream->test(\Twig_Token::NAME_TYPE, 'ignore')) + { $stream->next(); $stream->expect(\Twig_Token::NAME_TYPE, 'missing'); diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php index 0e4c619029..6b3cf32bc8 100644 --- a/phpBB/phpbb/template/twig/twig.php +++ b/phpBB/phpbb/template/twig/twig.php @@ -13,6 +13,8 @@ namespace phpbb\template\twig; +use phpbb\template\exception\user_object_not_available; + /** * Twig Template class. */ @@ -76,14 +78,14 @@ class twig extends \phpbb\template\base * * @param \phpbb\path_helper $path_helper * @param \phpbb\config\config $config - * @param \phpbb\user $user * @param \phpbb\template\context $context template context * @param \phpbb\template\twig\environment $twig_environment * @param string $cache_path + * @param \phpbb\user|null $user * @param array|\ArrayAccess $extensions * @param \phpbb\extension\manager $extension_manager extension manager, if null then template events will not be invoked */ - public function __construct(\phpbb\path_helper $path_helper, $config, $user, \phpbb\template\context $context, \phpbb\template\twig\environment $twig_environment, $cache_path, $extensions = array(), \phpbb\extension\manager $extension_manager = null) + public function __construct(\phpbb\path_helper $path_helper, $config, \phpbb\template\context $context, \phpbb\template\twig\environment $twig_environment, $cache_path, \phpbb\user $user = null, $extensions = array(), \phpbb\extension\manager $extension_manager = null) { $this->path_helper = $path_helper; $this->phpbb_root_path = $path_helper->get_phpbb_root_path(); @@ -126,9 +128,16 @@ class twig extends \phpbb\template\base * Get the style tree of the style preferred by the current user * * @return array Style tree, most specific first + * + * @throws \phpbb\template\exception\user_object_not_available When user service was not set */ public function get_user_style() { + if ($this->user === null) + { + throw new user_object_not_available(); + } + $style_list = array( $this->user->style['style_path'], ); @@ -344,11 +353,15 @@ class twig extends \phpbb\template\base $context_vars['.'][0], // To get normal vars array( 'definition' => new \phpbb\template\twig\definition(), - 'user' => $this->user, 'loops' => $context_vars, // To get loops ) ); + if ($this->user instanceof \phpbb\user) + { + $vars['user'] = $this->user; + } + // cleanup unset($vars['loops']['.']); diff --git a/phpBB/posting.php b/phpBB/posting.php index 2d01922c80..a4fb4d7a8d 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1578,11 +1578,22 @@ if (!sizeof($error) && $preview) } } +// Remove quotes that would become nested too deep before decoding the text +$generate_quote = ($mode == 'quote' && !$submit && !$preview && !$refresh); +if ($generate_quote && $config['max_quote_depth'] > 0 && preg_match('#^<[rt][ >]#', $message_parser->message)) +{ + $message_parser->message = $phpbb_container->get('text_formatter.utils')->remove_bbcode( + $message_parser->message, + 'quote', + $config['max_quote_depth'] - 1 + ); +} + // Decode text for message display $post_data['bbcode_uid'] = ($mode == 'quote' && !$preview && !$refresh && !sizeof($error)) ? $post_data['bbcode_uid'] : $message_parser->bbcode_uid; $message_parser->decode_message($post_data['bbcode_uid']); -if ($mode == 'quote' && !$submit && !$preview && !$refresh) +if ($generate_quote) { if ($config['allow_bbcode']) { diff --git a/phpBB/styles/prosilver/template/index_body.html b/phpBB/styles/prosilver/template/index_body.html index f620b6e966..5ac2d2aca3 100644 --- a/phpBB/styles/prosilver/template/index_body.html +++ b/phpBB/styles/prosilver/template/index_body.html @@ -19,15 +19,15 @@ <form method="post" action="{S_LOGIN_ACTION}" class="headerspace"> <h3><a href="{U_LOGIN_LOGOUT}">{L_LOGIN_LOGOUT}</a><!-- IF S_REGISTER_ENABLED --> • <a href="{U_REGISTER}">{L_REGISTER}</a><!-- ENDIF --></h3> <fieldset class="quick-login"> - <label for="username"><span>{L_USERNAME}{L_COLON}</span> <input type="text" name="username" id="username" size="10" class="inputbox" title="{L_USERNAME}" /></label> - <label for="password"><span>{L_PASSWORD}{L_COLON}</span> <input type="password" name="password" id="password" size="10" class="inputbox" title="{L_PASSWORD}" /></label> + <label for="username"><span>{L_USERNAME}{L_COLON}</span> <input type="text" tabindex="1" name="username" id="username" size="10" class="inputbox" title="{L_USERNAME}" /></label> + <label for="password"><span>{L_PASSWORD}{L_COLON}</span> <input type="password" tabindex="2" name="password" id="password" size="10" class="inputbox" title="{L_PASSWORD}" /></label> <!-- IF U_SEND_PASSWORD --> <a href="{U_SEND_PASSWORD}">{L_FORGOT_PASS}</a> <!-- ENDIF --> <!-- IF S_AUTOLOGIN_ENABLED --> - <span class="responsive-hide">|</span> <label for="autologin">{L_LOG_ME_IN} <input type="checkbox" name="autologin" id="autologin" /></label> + <span class="responsive-hide">|</span> <label for="autologin">{L_LOG_ME_IN} <input type="checkbox" tabindex="4" name="autologin" id="autologin" /></label> <!-- ENDIF --> - <input type="submit" name="login" value="{L_LOGIN}" class="button2" /> + <input type="submit" tabindex="5" name="login" value="{L_LOGIN}" class="button2" /> {S_LOGIN_REDIRECT} </fieldset> </form> diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index a0a0cd547a..b1e9d1be2c 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -1,7 +1,7 @@ <!-- INCLUDE overall_header.html --> - +<!-- EVENT viewforum_forum_title_before --> <h2 class="forum-title"><!-- EVENT viewforum_forum_name_prepend --><a href="{U_VIEW_FORUM}">{FORUM_NAME}</a><!-- EVENT viewforum_forum_name_append --></h2> - +<!-- EVENT viewforum_forum_title_after --> <!-- IF FORUM_DESC or MODERATORS or U_MCP --> <div> <!-- NOTE: remove the style="display: none" when you want to have the forum description on the forum body --> diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index 5b8078877e..e976c36f7b 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -210,6 +210,7 @@ <h3 <!-- IF postrow.S_FIRST_ROW -->class="first"<!-- ENDIF -->><!-- IF postrow.POST_ICON_IMG --><img src="{T_ICONS_PATH}{postrow.POST_ICON_IMG}" width="{postrow.POST_ICON_IMG_WIDTH}" height="{postrow.POST_ICON_IMG_HEIGHT}" alt="" /> <!-- ENDIF --><a href="#p{postrow.POST_ID}">{postrow.POST_SUBJECT}</a></h3> + <!-- EVENT viewtopic_body_post_buttons_list_before --> <!-- IF not S_IS_BOT --> <!-- IF postrow.U_EDIT or postrow.U_DELETE or postrow.U_REPORT or postrow.U_WARN or postrow.U_INFO or postrow.U_QUOTE --> <ul class="post-buttons"> @@ -248,6 +249,7 @@ </ul> <!-- ENDIF --> <!-- ENDIF --> + <!-- EVENT viewtopic_body_post_buttons_list_after --> <!-- EVENT viewtopic_body_postrow_post_details_before --> <p class="author"><!-- IF S_IS_BOT -->{postrow.MINI_POST_IMG}<!-- ELSE --><a href="{postrow.U_MINI_POST}">{postrow.MINI_POST_IMG}</a><!-- ENDIF --><span class="responsive-hide">{L_POST_BY_AUTHOR} <strong>{postrow.POST_AUTHOR_FULL}</strong> » </span>{postrow.POST_DATE} </p> |