diff options
48 files changed, 1520 insertions, 515 deletions
diff --git a/phpBB/common.php b/phpBB/common.php index 37a42c7b8f..4b50280cb0 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -69,11 +69,10 @@ if (!defined('PHPBB_INSTALLED')) // Include files require($phpbb_root_path . 'includes/class_loader.' . $phpEx); -require($phpbb_root_path . 'includes/di/processor/interface.' . $phpEx); -require($phpbb_root_path . 'includes/di/processor/config.' . $phpEx); require($phpbb_root_path . 'includes/functions.' . $phpEx); require($phpbb_root_path . 'includes/functions_content.' . $phpEx); +require($phpbb_root_path . 'includes/functions_container.' . $phpEx); require($phpbb_root_path . 'includes/constants.' . $phpEx); require($phpbb_root_path . 'includes/db/' . ltrim($dbms, 'dbal_') . '.' . $phpEx); @@ -82,16 +81,27 @@ require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); // Set PHP error handler to ours set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); -$phpbb_container = new ContainerBuilder(); -$loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__.'/config')); -$loader->load('services.yml'); - -$processor = new phpbb_di_processor_config($phpbb_root_path . 'config.' . $phpEx, $phpbb_root_path, $phpEx); -$processor->process($phpbb_container); - // Setup class loader first -$phpbb_class_loader = $phpbb_container->get('class_loader'); -$phpbb_class_loader_ext = $phpbb_container->get('class_loader.ext'); +$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", ".$phpEx"); +$phpbb_class_loader->register(); +$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", ".$phpEx"); +$phpbb_class_loader_ext->register(); + +// Set up container +$phpbb_container = phpbb_create_dumped_container_unless_debug( + array( + new phpbb_di_extension_config($phpbb_root_path . 'config.' . $phpEx), + new phpbb_di_extension_core($phpbb_root_path), + ), + array( + new phpbb_di_pass_collection_pass(), + ), + $phpbb_root_path, + $phpEx +); + +$phpbb_class_loader->set_cache($phpbb_container->get('cache.driver')); +$phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver')); // set up caching $cache = $phpbb_container->get('cache'); @@ -120,13 +130,6 @@ $phpbb_style = $phpbb_container->get('style'); $phpbb_notifications = $phpbb_container->get('notification_manager'); -$ids = array_keys($phpbb_container->findTaggedServiceIds('container.processor')); -foreach ($ids as $id) -{ - $processor = $phpbb_container->get($id); - $processor->process($phpbb_container); -} - // Add own hook handler require($phpbb_root_path . 'includes/hooks/index.' . $phpEx); $phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('phpbb_template', 'display'))); diff --git a/phpBB/composer.json b/phpBB/composer.json index 5e88144bc4..380bdc367c 100644 --- a/phpBB/composer.json +++ b/phpBB/composer.json @@ -4,6 +4,7 @@ "symfony/config": "2.1.*", "symfony/dependency-injection": "2.1.*", "symfony/event-dispatcher": "2.1.*", + "symfony/http-kernel": "2.1.*", "symfony/yaml": "2.1.*" }, "require-dev": { diff --git a/phpBB/composer.lock b/phpBB/composer.lock index 6b0d3584d1..69e4a2b4b8 100644 --- a/phpBB/composer.lock +++ b/phpBB/composer.lock @@ -1,67 +1,749 @@ { - "hash": "1632798bc1d5298a4f5bd3087c972a9f", + "hash": "407cc89f4bb0e409146c863dee51b0ae", "packages": [ { - "package": "symfony/config", - "version": "v2.1.0-RC1" + "name": "symfony/config", + "version": "v2.1.3", + "target-dir": "Symfony/Component/Config", + "source": { + "type": "git", + "url": "https://github.com/symfony/Config", + "reference": "v2.1.3" + }, + "dist": { + "type": "zip", + "url": "https://github.com/symfony/Config/zipball/v2.1.3", + "reference": "v2.1.3", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "time": "2012-10-20 00:10:30", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Symfony\\Component\\Config": "" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony Config Component", + "homepage": "http://symfony.com" }, { - "package": "symfony/dependency-injection", - "version": "v2.1.0-RC1" + "name": "symfony/dependency-injection", + "version": "v2.1.3", + "target-dir": "Symfony/Component/DependencyInjection", + "source": { + "type": "git", + "url": "https://github.com/symfony/DependencyInjection", + "reference": "v2.1.3" + }, + "dist": { + "type": "zip", + "url": "https://github.com/symfony/DependencyInjection/zipball/v2.1.3", + "reference": "v2.1.3", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/yaml": "2.1.*", + "symfony/config": "2.1.*" + }, + "suggest": { + "symfony/yaml": "2.1.*", + "symfony/config": "2.1.*" + }, + "time": "2012-10-22 07:37:12", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Symfony\\Component\\DependencyInjection": "" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony DependencyInjection Component", + "homepage": "http://symfony.com" }, { - "package": "symfony/event-dispatcher", - "version": "v2.1.0-RC1" + "name": "symfony/event-dispatcher", + "version": "v2.1.3", + "target-dir": "Symfony/Component/EventDispatcher", + "source": { + "type": "git", + "url": "https://github.com/symfony/EventDispatcher", + "reference": "v2.1.3" + }, + "dist": { + "type": "zip", + "url": "https://github.com/symfony/EventDispatcher/zipball/v2.1.3", + "reference": "v2.1.3", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/dependency-injection": "2.1.*" + }, + "suggest": { + "symfony/dependency-injection": "2.1.*", + "symfony/http-kernel": "2.1.*" + }, + "time": "2012-10-04 08:17:57", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Symfony\\Component\\EventDispatcher": "" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "http://symfony.com" }, { - "package": "symfony/yaml", - "version": "v2.1.0-RC1" + "name": "symfony/http-foundation", + "version": "v2.1.3", + "target-dir": "Symfony/Component/HttpFoundation", + "source": { + "type": "git", + "url": "https://github.com/symfony/HttpFoundation", + "reference": "v2.1.3" + }, + "dist": { + "type": "zip", + "url": "https://github.com/symfony/HttpFoundation/zipball/v2.1.3", + "reference": "v2.1.3", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "time": "2012-10-20 00:10:30", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Symfony\\Component\\HttpFoundation": "", + "SessionHandlerInterface": "Symfony/Component/HttpFoundation/Resources/stubs" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony HttpFoundation Component", + "homepage": "http://symfony.com" + }, + { + "name": "symfony/http-kernel", + "version": "v2.1.3", + "target-dir": "Symfony/Component/HttpKernel", + "source": { + "type": "git", + "url": "https://github.com/symfony/HttpKernel", + "reference": "v2.1.3" + }, + "dist": { + "type": "zip", + "url": "https://github.com/symfony/HttpKernel/zipball/v2.1.3", + "reference": "v2.1.3", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/event-dispatcher": "2.1.*", + "symfony/http-foundation": "2.1.*" + }, + "require-dev": { + "symfony/browser-kit": "2.1.*", + "symfony/class-loader": "2.1.*", + "symfony/config": "2.1.*", + "symfony/console": "2.1.*", + "symfony/dependency-injection": "2.1.*", + "symfony/finder": "2.1.*", + "symfony/process": "2.1.*", + "symfony/routing": "2.1.*" + }, + "suggest": { + "symfony/browser-kit": "2.1.*", + "symfony/class-loader": "2.1.*", + "symfony/config": "2.1.*", + "symfony/console": "2.1.*", + "symfony/dependency-injection": "2.1.*", + "symfony/finder": "2.1.*" + }, + "time": "2012-10-30 01:14:14", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Symfony\\Component\\HttpKernel": "" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony HttpKernel Component", + "homepage": "http://symfony.com" + }, + { + "name": "symfony/yaml", + "version": "v2.1.3", + "target-dir": "Symfony/Component/Yaml", + "source": { + "type": "git", + "url": "https://github.com/symfony/Yaml", + "reference": "v2.1.3" + }, + "dist": { + "type": "zip", + "url": "https://github.com/symfony/Yaml/zipball/v2.1.3", + "reference": "v2.1.3", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "time": "2012-10-29 04:15:41", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Symfony\\Component\\Yaml": "" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "http://symfony.com" } ], "packages-dev": [ { - "package": "fabpot/goutte", - "version": "dev-master", - "alias-pretty-version": "1.0.x-dev", - "alias-version": "1.0.9999999.9999999-dev" - }, - { - "package": "fabpot/goutte", + "name": "fabpot/goutte", "version": "dev-master", - "source-reference": "6d26279344736f6983a969e46afef082ebf30a67", - "commit-date": "1345141401" + "source": { + "type": "git", + "url": "https://github.com/fabpot/Goutte", + "reference": "f2940f9c7c1f409159f5e9f512e575946c5cff48" + }, + "dist": { + "type": "zip", + "url": "https://github.com/fabpot/Goutte/zipball/f2940f9c7c1f409159f5e9f512e575946c5cff48", + "reference": "f2940f9c7c1f409159f5e9f512e575946c5cff48", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "symfony/browser-kit": "2.1.*", + "symfony/css-selector": "2.1.*", + "symfony/dom-crawler": "2.1.*", + "symfony/finder": "2.1.*", + "symfony/process": "2.1.*", + "ext-curl": "*", + "guzzle/http": "2.8.*" + }, + "time": "1351086217", + "type": "application", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "installation-source": "source", + "autoload": { + "psr-0": { + "Goutte": "." + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "A simple PHP Web Scraper", + "homepage": "https://github.com/fabpot/Goutte", + "keywords": [ + "scraper" + ] }, { - "package": "guzzle/common", - "version": "v2.8.4" + "name": "guzzle/common", + "version": "v2.8.8", + "target-dir": "Guzzle/Common", + "source": { + "type": "git", + "url": "git://github.com/guzzle/common.git", + "reference": "v2.8.8" + }, + "dist": { + "type": "zip", + "url": "https://github.com/guzzle/common/zipball/v2.8.8", + "reference": "v2.8.8", + "shasum": "" + }, + "require": { + "php": ">=5.3.2", + "symfony/event-dispatcher": "2.1.*" + }, + "time": "2012-10-15 17:42:47", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "Guzzle\\Common": "" + } + }, + "license": [ + "MIT" + ], + "description": "Common libraries used by Guzzle", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "log", + "event", + "cache", + "validation", + "Socket", + "common", + "batch", + "inflection" + ] }, { - "package": "guzzle/http", - "version": "v2.8.4" + "name": "guzzle/http", + "version": "v2.8.8", + "target-dir": "Guzzle/Http", + "source": { + "type": "git", + "url": "git://github.com/guzzle/http.git", + "reference": "v2.8.8" + }, + "dist": { + "type": "zip", + "url": "https://github.com/guzzle/http/zipball/v2.8.8", + "reference": "v2.8.8", + "shasum": "" + }, + "require": { + "php": ">=5.3.2", + "guzzle/common": "self.version", + "guzzle/parser": "self.version" + }, + "time": "2012-10-15 17:42:47", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "Guzzle\\Http": "" + } + }, + "license": [ + "MIT" + ], + "description": "HTTP libraries used by Guzzle", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "curl", + "http", + "http client", + "client", + "Guzzle" + ] }, { - "package": "guzzle/parser", - "version": "v2.8.4" + "name": "guzzle/parser", + "version": "v2.8.8", + "target-dir": "Guzzle/Parser", + "source": { + "type": "git", + "url": "git://github.com/guzzle/parser.git", + "reference": "v2.8.8" + }, + "dist": { + "type": "zip", + "url": "https://github.com/guzzle/parser/zipball/v2.8.8", + "reference": "v2.8.8", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "time": "2012-09-20 13:28:06", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "Guzzle\\Parser": "" + } + }, + "license": [ + "MIT" + ], + "description": "Interchangeable parsers used by Guzzle", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "http", + "url", + "message", + "cookie", + "URI Template" + ] }, { - "package": "symfony/browser-kit", - "version": "v2.1.0-RC1" + "name": "symfony/browser-kit", + "version": "v2.1.3", + "target-dir": "Symfony/Component/BrowserKit", + "source": { + "type": "git", + "url": "https://github.com/symfony/BrowserKit", + "reference": "v2.1.3" + }, + "dist": { + "type": "zip", + "url": "https://github.com/symfony/BrowserKit/zipball/v2.1.3", + "reference": "v2.1.3", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/dom-crawler": "2.1.*" + }, + "require-dev": { + "symfony/process": "2.1.*", + "symfony/css-selector": "2.1.*" + }, + "suggest": { + "symfony/process": "2.1.*" + }, + "time": "2012-10-25 06:11:50", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Symfony\\Component\\BrowserKit": "" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony BrowserKit Component", + "homepage": "http://symfony.com" }, { - "package": "symfony/css-selector", - "version": "v2.1.0-RC1" + "name": "symfony/css-selector", + "version": "v2.1.3", + "target-dir": "Symfony/Component/CssSelector", + "source": { + "type": "git", + "url": "https://github.com/symfony/CssSelector", + "reference": "v2.1.3" + }, + "dist": { + "type": "zip", + "url": "https://github.com/symfony/CssSelector/zipball/v2.1.3", + "reference": "v2.1.3", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "time": "2012-10-04 08:17:57", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Symfony\\Component\\CssSelector": "" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony CssSelector Component", + "homepage": "http://symfony.com" }, { - "package": "symfony/dom-crawler", - "version": "v2.1.0-RC1" + "name": "symfony/dom-crawler", + "version": "v2.1.3", + "target-dir": "Symfony/Component/DomCrawler", + "source": { + "type": "git", + "url": "https://github.com/symfony/DomCrawler", + "reference": "v2.1.3" + }, + "dist": { + "type": "zip", + "url": "https://github.com/symfony/DomCrawler/zipball/v2.1.3", + "reference": "v2.1.3", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "symfony/css-selector": "2.1.*" + }, + "suggest": { + "symfony/css-selector": "2.1.*" + }, + "time": "2012-10-18 14:16:01", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Symfony\\Component\\DomCrawler": "" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony DomCrawler Component", + "homepage": "http://symfony.com" }, { - "package": "symfony/finder", - "version": "v2.1.0-RC1" + "name": "symfony/finder", + "version": "v2.1.3", + "target-dir": "Symfony/Component/Finder", + "source": { + "type": "git", + "url": "https://github.com/symfony/Finder", + "reference": "v2.1.3" + }, + "dist": { + "type": "zip", + "url": "https://github.com/symfony/Finder/zipball/v2.1.3", + "reference": "v2.1.3", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "time": "2012-10-20 00:10:30", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Symfony\\Component\\Finder": "" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "http://symfony.com" }, { - "package": "symfony/process", - "version": "v2.1.0-RC1" + "name": "symfony/process", + "version": "v2.1.3", + "target-dir": "Symfony/Component/Process", + "source": { + "type": "git", + "url": "https://github.com/symfony/Process", + "reference": "v2.1.3" + }, + "dist": { + "type": "zip", + "url": "https://github.com/symfony/Process/zipball/v2.1.3", + "reference": "v2.1.3", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "time": "2012-10-20 00:10:30", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-0": { + "Symfony\\Component\\Process": "" + } + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "http://symfony.com" } ], "aliases": [ diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index efea1d69a5..af80d28b15 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -45,15 +45,17 @@ services: - @cache.driver - %tables.config% - cron.task_provider: - class: phpbb_cron_task_provider + cron.task_collection: + class: phpbb_di_service_collection arguments: - - @container + - @service_container + tags: + - { name: service_collection, tag: cron.task } cron.manager: class: phpbb_cron_manager arguments: - - @cron.task_provider + - @cron.task_collection - %core.root_path% - %core.php_ext% @@ -66,6 +68,8 @@ services: dispatcher: class: phpbb_event_dispatcher + arguments: + - @service_container dbal.conn: class: %dbal.driver.class% @@ -106,13 +110,6 @@ services: - %tables.notifications% - %tables.user_notifications% - processor.ext: - class: phpbb_di_processor_ext - arguments: - - @ext.manager - tags: - - { name: container.processor } - request: class: phpbb_request diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 7ed53d54b6..79f53245b9 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -48,18 +48,31 @@ if (isset($_GET['avatar'])) require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); require($phpbb_root_path . 'includes/constants.' . $phpEx); require($phpbb_root_path . 'includes/functions.' . $phpEx); + require($phpbb_root_path . 'includes/functions_container.' . $phpEx); require($phpbb_root_path . 'includes/functions_download' . '.' . $phpEx); require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); - $phpbb_container = new ContainerBuilder(); - $loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__.'/../config')); - $loader->load('services.yml'); - - $processor = new phpbb_di_processor_config($phpbb_root_path . 'config.' . $phpEx, $phpbb_root_path, $phpEx); - $processor->process($phpbb_container); - - $phpbb_class_loader = $phpbb_container->get('class_loader'); - $phpbb_class_loader_ext = $phpbb_container->get('class_loader.ext'); + // Setup class loader first + $phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", ".$phpEx"); + $phpbb_class_loader->register(); + $phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", ".$phpEx"); + $phpbb_class_loader_ext->register(); + + // Set up container + $phpbb_container = phpbb_create_dumped_container_unless_debug( + array( + new phpbb_di_extension_config($phpbb_root_path . 'config.' . $phpEx), + new phpbb_di_extension_core($phpbb_root_path), + ), + array( + new phpbb_di_pass_collection_pass(), + ), + $phpbb_root_path, + $phpEx + ); + + $phpbb_class_loader->set_cache($phpbb_container->get('cache.driver')); + $phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver')); // set up caching $cache = $phpbb_container->get('cache'); @@ -85,13 +98,6 @@ if (isset($_GET['avatar'])) $phpbb_extension_manager = $phpbb_container->get('ext.manager'); $phpbb_subscriber_loader = $phpbb_container->get('event.subscriber_loader'); - $ids = array_keys($phpbb_container->findTaggedServiceIds('container.processor')); - foreach ($ids as $id) - { - $processor = $phpbb_container->get($id); - $processor->process($phpbb_container); - } - // worst-case default $browser = strtolower($request->header('User-Agent', 'msie 6.0')); @@ -392,7 +398,7 @@ else $disallowed[$attach['extension']] = $attach['extension']; continue; } - + $prefix = ''; if ($topic_id) { diff --git a/phpBB/feed.php b/phpBB/feed.php index 58ae251089..0dce22fb0c 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -555,12 +555,6 @@ class phpbb_feed_base $forum_ids = array_flip($this->get_moderator_approve_forums()); } - if (!$forum_id) - { - // Global announcement, your a moderator in any forum than it's okay. - return (!empty($forum_ids)) ? true : false; - } - return (isset($forum_ids[$forum_id])) ? true : false; } diff --git a/phpBB/includes/cache/driver/file.php b/phpBB/includes/cache/driver/file.php index f64a9e3ea8..b20c0064ea 100644 --- a/phpBB/includes/cache/driver/file.php +++ b/phpBB/includes/cache/driver/file.php @@ -214,7 +214,11 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base while (($entry = readdir($dir)) !== false) { - if (strpos($entry, 'sql_') !== 0 && strpos($entry, 'data_') !== 0 && strpos($entry, 'ctpl_') !== 0 && strpos($entry, 'tpl_') !== 0) + if (strpos($entry, 'container') !== 0 && + strpos($entry, 'sql_') !== 0 && + strpos($entry, 'data_') !== 0 && + strpos($entry, 'ctpl_') !== 0 && + strpos($entry, 'tpl_') !== 0) { continue; } diff --git a/phpBB/includes/cache/driver/memory.php b/phpBB/includes/cache/driver/memory.php index e0771ab1d3..98ac02b161 100644 --- a/phpBB/includes/cache/driver/memory.php +++ b/phpBB/includes/cache/driver/memory.php @@ -162,7 +162,11 @@ abstract class phpbb_cache_driver_memory extends phpbb_cache_driver_base while (($entry = readdir($dir)) !== false) { - if (strpos($entry, 'sql_') !== 0 && strpos($entry, 'data_') !== 0 && strpos($entry, 'ctpl_') !== 0 && strpos($entry, 'tpl_') !== 0) + if (strpos($entry, 'container') !== 0 && + strpos($entry, 'sql_') !== 0 && + strpos($entry, 'data_') !== 0 && + strpos($entry, 'ctpl_') !== 0 && + strpos($entry, 'tpl_') !== 0) { continue; } diff --git a/phpBB/includes/cron/task/provider.php b/phpBB/includes/cron/task/provider.php deleted file mode 100644 index 134723ebd1..0000000000 --- a/phpBB/includes/cron/task/provider.php +++ /dev/null @@ -1,59 +0,0 @@ -<?php -/** -* -* @package phpBB3 -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -use Symfony\Component\DependencyInjection\TaggedContainerInterface; - -/** -* Provides cron manager with tasks -* -* Finds installed cron tasks and makes them available to the cron manager. -* -* @package phpBB3 -*/ -class phpbb_cron_task_provider implements IteratorAggregate -{ - private $container; - - public function __construct(TaggedContainerInterface $container) - { - $this->container = $container; - } - - /** - * Retrieve an iterator over all items - * - * @return ArrayIterator An iterator for the array of cron tasks - */ - public function getIterator() - { - $definitions = $this->container->findTaggedServiceIds('cron.task'); - - $tasks = array(); - foreach ($definitions as $name => $definition) - { - $task = $this->container->get($name); - if ($task instanceof phpbb_cron_task_base) - { - $task->set_name($name); - } - - $tasks[] = $task; - } - - return new ArrayIterator($tasks); - } -} diff --git a/phpBB/includes/di/processor/config.php b/phpBB/includes/di/extension/config.php index 22b6252a6d..fb5ca90070 100644 --- a/phpBB/includes/di/processor/config.php +++ b/phpBB/includes/di/extension/config.php @@ -16,40 +16,31 @@ if (!defined('IN_PHPBB')) } use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\HttpKernel\DependencyInjection\Extension; +use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; +use Symfony\Component\Config\FileLocator; /** -* Configure the container for phpBB's services though -* user-defined parameters defined in the config.php file. +* Container config extension */ -class phpbb_di_processor_config implements phpbb_di_processor_interface +class phpbb_di_extension_config extends Extension { - private $config_file; - private $phpbb_root_path; - private $php_ext; - - /** - * Constructor. - * - * @param string $config_file The config file - * @param string $phpbb_root_path The root path - * @param string $php_ext The PHP extension - */ - public function __construct($config_file, $phpbb_root_path, $php_ext) + public function __construct($config_file) { $this->config_file = $config_file; - $this->phpbb_root_path = $phpbb_root_path; - $this->php_ext = $php_ext; } /** - * @inheritdoc + * Loads a specific configuration. + * + * @param array $config An array of configuration values + * @param ContainerBuilder $container A ContainerBuilder instance + * + * @throws InvalidArgumentException When provided tag is not defined in this extension */ - public function process(ContainerBuilder $container) + public function load(array $config, ContainerBuilder $container) { - require $this->config_file; - - $container->setParameter('core.root_path', $this->phpbb_root_path); - $container->setParameter('core.php_ext', $this->php_ext); + require($this->config_file); $container->setParameter('core.table_prefix', $table_prefix); $container->setParameter('cache.driver.class', $this->fix_acm_type($acm_type)); @@ -60,10 +51,26 @@ class phpbb_di_processor_config implements phpbb_di_processor_interface $container->setParameter('dbal.dbname', $dbname); $container->setParameter('dbal.dbport', $dbport); $container->setParameter('dbal.new_link', defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK); + } - $container->set('container', $container); + /** + * Returns the recommended alias to use in XML. + * + * This alias is also the mandatory prefix to use when using YAML. + * + * @return string The alias + */ + public function getAlias() + { + return 'config'; } + /** + * Convert old (3.0) values to 3.1 class names + * + * @param style $acm_type ACM type + * @return ACM type class + */ protected function fix_acm_type($acm_type) { if (preg_match('#^[a-z]+$#', $acm_type)) diff --git a/phpBB/includes/di/extension/core.php b/phpBB/includes/di/extension/core.php new file mode 100644 index 0000000000..9c36ba2fc4 --- /dev/null +++ b/phpBB/includes/di/extension/core.php @@ -0,0 +1,69 @@ +<?php +/** +* +* @package phpBB3 +* @copyright (c) 2012 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\HttpKernel\DependencyInjection\Extension; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; +use Symfony\Component\Config\FileLocator; + +/** +* Container core extension +*/ +class phpbb_di_extension_core extends Extension +{ + /** + * phpBB Root path + * @var string + */ + protected $root_path; + + /** + * Constructor + * + * @param string $root_path Root path + */ + public function __construct($root_path) + { + $this->root_path = $root_path; + } + + /** + * Loads a specific configuration. + * + * @param array $config An array of configuration values + * @param ContainerBuilder $container A ContainerBuilder instance + * + * @throws InvalidArgumentException When provided tag is not defined in this extension + */ + public function load(array $config, ContainerBuilder $container) + { + $loader = new YamlFileLoader($container, new FileLocator(phpbb_realpath($this->root_path . 'config'))); + $loader->load('services.yml'); + } + + /** + * Returns the recommended alias to use in XML. + * + * This alias is also the mandatory prefix to use when using YAML. + * + * @return string The alias + */ + public function getAlias() + { + return 'core'; + } +} diff --git a/phpBB/includes/di/extension/ext.php b/phpBB/includes/di/extension/ext.php new file mode 100644 index 0000000000..e76c543ee1 --- /dev/null +++ b/phpBB/includes/di/extension/ext.php @@ -0,0 +1,69 @@ +<?php +/** +* +* @package phpBB3 +* @copyright (c) 2012 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\HttpKernel\DependencyInjection\Extension; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; +use Symfony\Component\Config\FileLocator; + +/** +* Container ext extension +*/ +class phpbb_di_extension_ext extends Extension +{ + protected $paths = array(); + + public function __construct($enabled_extensions) + { + foreach ($enabled_extensions as $ext => $path) + { + $this->paths[] = $path; + } + } + + /** + * Loads a specific configuration. + * + * @param array $config An array of configuration values + * @param ContainerBuilder $container A ContainerBuilder instance + * + * @throws InvalidArgumentException When provided tag is not defined in this extension + */ + public function load(array $config, ContainerBuilder $container) + { + foreach ($this->paths as $path) + { + if (file_exists($path . '/config/services.yml')) + { + $loader = new YamlFileLoader($container, new FileLocator(phpbb_real_path($path . '/config'))); + $loader->load('services.yml'); + } + } + } + + /** + * Returns the recommended alias to use in XML. + * + * This alias is also the mandatory prefix to use when using YAML. + * + * @return string The alias + */ + public function getAlias() + { + return 'ext'; + } +} diff --git a/phpBB/includes/di/pass/collection_pass.php b/phpBB/includes/di/pass/collection_pass.php new file mode 100644 index 0000000000..63a5c7dfc4 --- /dev/null +++ b/phpBB/includes/di/pass/collection_pass.php @@ -0,0 +1,46 @@ +<?php +/** +* +* @package phpBB3 +* @copyright (c) 2012 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; + +/** +* Appends an add method call to the definition of each collection service for +* the services tagged with the appropriate name defined in the collection's +* service_collection tag. +*/ +class phpbb_di_pass_collection_pass implements CompilerPassInterface +{ + /** + * Modify the container before it is passed to the rest of the code + * + * @param ContainerBuilder $container ContainerBuilder object + * @return null + */ + public function process(ContainerBuilder $container) + { + foreach ($container->findTaggedServiceIds('service_collection') as $id => $data) + { + $definition = $container->getDefinition($id); + + foreach ($container->findTaggedServiceIds($data[0]['tag']) as $service_id => $service_data) + { + $definition->addMethodCall('add', array($service_id)); + } + } + } +} diff --git a/phpBB/includes/di/processor/ext.php b/phpBB/includes/di/processor/ext.php deleted file mode 100644 index e69a3d73b3..0000000000 --- a/phpBB/includes/di/processor/ext.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php -/** -* -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -use Symfony\Component\Config\FileLocator; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; - -/** -* Load the service configurations from all extensions into the container. -*/ -class phpbb_di_processor_ext implements phpbb_di_processor_interface -{ - private $extension_manager; - - /** - * Constructor. - * - * @param string $extension_manager The extension manager - */ - public function __construct($extension_manager) - { - $this->extension_manager = $extension_manager; - } - - /** - * @inheritdoc - */ - public function process(ContainerBuilder $container) - { - $enabled_exts = $this->extension_manager->all_enabled(); - foreach ($enabled_exts as $name => $path) - { - if (file_exists($path . '/config/services.yml')) - { - $loader = new YamlFileLoader($container, new FileLocator($path . '/config')); - $loader->load('services.yml'); - } - } - } -} diff --git a/phpBB/includes/di/processor/interface.php b/phpBB/includes/di/processor/interface.php deleted file mode 100644 index b8563791cc..0000000000 --- a/phpBB/includes/di/processor/interface.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php -/** -* -* @package phpBB3 -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -use Symfony\Component\DependencyInjection\ContainerBuilder; - -interface phpbb_di_processor_interface -{ - /** - * Mutate the container. - * - * @param ContainerBuilder $container The container - */ - public function process(ContainerBuilder $container); -} diff --git a/phpBB/includes/di/service_collection.php b/phpBB/includes/di/service_collection.php new file mode 100644 index 0000000000..60323c8dba --- /dev/null +++ b/phpBB/includes/di/service_collection.php @@ -0,0 +1,49 @@ +<?php +/** +* +* @package phpBB3 +* @copyright (c) 2011 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +use Symfony\Component\DependencyInjection\ContainerInterface; + +/** +* Collection of services to be configured at container compile time. +* +* @package phpBB3 +*/ +class phpbb_di_service_collection extends ArrayObject +{ + /** + * Constructor + * + * @param ContainerInterface $container Container object + */ + public function __construct(ContainerInterface $container) + { + $this->container = $container; + } + + /** + * Add a service to the collection + * + * @param string $name The service name + * @return null + */ + public function add($name) + { + $task = $this->container->get($name); + $task->set_name($name); + $this->offsetSet($name, $task); + } +} diff --git a/phpBB/includes/event/dispatcher.php b/phpBB/includes/event/dispatcher.php index 2bf46b9b06..4f637ce3bb 100644 --- a/phpBB/includes/event/dispatcher.php +++ b/phpBB/includes/event/dispatcher.php @@ -15,7 +15,7 @@ if (!defined('IN_PHPBB')) exit; } -use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher; /** * Extension of the Symfony2 EventDispatcher @@ -31,7 +31,7 @@ use Symfony\Component\EventDispatcher\EventDispatcher; * extract($phpbb_dispatcher->trigger_event('core.index', compact($vars))); * */ -class phpbb_event_dispatcher extends EventDispatcher +class phpbb_event_dispatcher extends ContainerAwareEventDispatcher { public function trigger_event($eventName, $data = array()) { diff --git a/phpBB/includes/extension/controller.php b/phpBB/includes/extension/controller.php deleted file mode 100644 index f97b69c7ed..0000000000 --- a/phpBB/includes/extension/controller.php +++ /dev/null @@ -1,84 +0,0 @@ -<?php -/** -* -* @package extension -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** -* Abstract class extended by extension front controller classes -* -* @package extension -*/ -abstract class phpbb_extension_controller implements phpbb_extension_controller_interface -{ - /** - * Request class object - * @var phpbb_request - */ - protected $request; - - /** - * DBAL class object - * @var dbal - */ - protected $db; - - /** - * User class object - * @var phpbb_user - */ - protected $user; - - /** - * Template class object - * @var phpbb_template - */ - protected $template; - - /** - * Config object - * @var phpbb_config - */ - protected $config; - - /** - * PHP Extension - * @var string - */ - protected $php_ext; - - /** - * Relative path to board root - * @var string - */ - protected $phpbb_root_path; - - /** - * Constructor method that provides the common phpBB objects as inherited class - * properties for automatic availability in extension controllers - */ - public function __construct() - { - global $request, $db, $user, $template, $config; - global $phpEx, $phpbb_root_path; - - $this->request = $request; - $this->db = $db; - $this->user = $user; - $this->template = $template; - $this->config = $config; - $this->php_ext = $phpEx; - $this->phpbb_root_path = $phpbb_root_path; - } -} diff --git a/phpBB/includes/extension/controller_interface.php b/phpBB/includes/extension/controller_interface.php deleted file mode 100644 index 2b88925388..0000000000 --- a/phpBB/includes/extension/controller_interface.php +++ /dev/null @@ -1,31 +0,0 @@ -<?php -/** -* -* @package extension -* @copyright (c) 2011 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** -* The interface that extension classes have to implement to run front pages -* -* @package extension -*/ -interface phpbb_extension_controller_interface -{ - /** - * Handle the request to display a page from an extension - * - * @return null - */ - public function handle(); -} diff --git a/phpBB/includes/extension/manager.php b/phpBB/includes/extension/manager.php index cfa6a0e000..bfd4edde93 100644 --- a/phpBB/includes/extension/manager.php +++ b/phpBB/includes/extension/manager.php @@ -195,7 +195,7 @@ class phpbb_extension_manager if ($this->cache) { - $this->cache->destroy($this->cache_name); + $this->cache->purge(); } return !$active; @@ -252,7 +252,7 @@ class phpbb_extension_manager if ($this->cache) { - $this->cache->destroy($this->cache_name); + $this->cache->purge(); } return true; @@ -272,7 +272,7 @@ class phpbb_extension_manager if ($this->cache) { - $this->cache->destroy($this->cache_name); + $this->cache->purge(); } return false; @@ -335,7 +335,7 @@ class phpbb_extension_manager if ($this->cache) { - $this->cache->destroy($this->cache_name); + $this->cache->purge(); } return true; @@ -349,7 +349,7 @@ class phpbb_extension_manager if ($this->cache) { - $this->cache->destroy($this->cache_name); + $this->cache->purge(); } return false; diff --git a/phpBB/includes/functions_container.php b/phpBB/includes/functions_container.php new file mode 100644 index 0000000000..1763d1082a --- /dev/null +++ b/phpBB/includes/functions_container.php @@ -0,0 +1,137 @@ +<?php +/** +* +* @package phpBB3 +* @copyright (c) 2005 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +use Symfony\Component\Config\FileLocator; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Dumper\PhpDumper; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Create the ContainerBuilder object +* +* @param array $extensions Array of Container extension objects +* @param string $phpbb_root_path Root path +* @param string $php_ext PHP Extension +* @return ContainerBuilder object +*/ +function phpbb_create_container(array $extensions, $phpbb_root_path, $php_ext) +{ + $container = new ContainerBuilder(); + + foreach ($extensions as $extension) + { + $container->registerExtension($extension); + $container->loadFromExtension($extension->getAlias()); + } + + $container->setParameter('core.root_path', $phpbb_root_path); + $container->setParameter('core.php_ext', $php_ext); + + return $container; +} + +/** +* Create installer container +* +* @param string $phpbb_root_path Root path +* @param string $php_ext PHP Extension +* @return ContainerBuilder object +*/ +function phpbb_create_install_container($phpbb_root_path, $php_ext) +{ + $core = new phpbb_di_extension_core($phpbb_root_path); + $container = phpbb_create_container(array($core), $phpbb_root_path, $php_ext); + + $container->setParameter('core.root_path', $phpbb_root_path); + $container->setParameter('core.php_ext', $php_ext); + $container->setParameter('core.table_prefix', ''); + + $container->register('dbal.conn')->setSynthetic(true); + + $container->setAlias('cache.driver', 'cache.driver.install'); + + $container->compile(); + + return $container; +} + +/** +* Create a compiled ContainerBuilder object +* +* @param array $extensions Array of Container extension objects +* @param array $passes Array of Compiler Pass objects +* @param string $phpbb_root_path Root path +* @param string $php_ext PHP Extension +* @return ContainerBuilder object (compiled) +*/ +function phpbb_create_compiled_container(array $extensions, array $passes, $phpbb_root_path, $php_ext) +{ + // Create a temporary container for access to the ext.manager service + $tmp_container = phpbb_create_container($extensions, $phpbb_root_path, $php_ext); + $tmp_container->compile(); + + // Now pass the enabled extension paths into the ext compiler extension + $extensions[] = new phpbb_di_extension_ext($tmp_container->get('ext.manager')->all_enabled()); + + // Create the final container to be compiled and cached + $container = phpbb_create_container($extensions, $phpbb_root_path, $php_ext); + + // Compile the container + foreach ($passes as $pass) + { + $container->addCompilerPass($pass); + } + $container->compile(); + + return $container; +} + +function phpbb_create_dumped_container(array $extensions, array $passes, $phpbb_root_path, $php_ext) +{ + // Check for our cached container; if it exists, use it + $container_filename = phpbb_container_filename($phpbb_root_path, $php_ext); + if (file_exists($container_filename)) + { + require($container_filename); + return new phpbb_cache_container(); + } + + $container = phpbb_create_compiled_container($extensions, $passes, $phpbb_root_path, $php_ext); + + // Lastly, we create our cached container class + $dumper = new PhpDumper($container); + $cached_container_dump = $dumper->dump(array( + 'class' => 'phpbb_cache_container', + 'base_class' => 'Symfony\\Component\\DependencyInjection\\ContainerBuilder', + )); + + file_put_contents($container_filename, $cached_container_dump); + + return $container; +} + +function phpbb_create_dumped_container_unless_debug(array $extensions, array $passes, $phpbb_root_path, $php_ext) +{ + $container_factory = defined('DEBUG') ? 'phpbb_create_compiled_container' : 'phpbb_create_dumped_container'; + return $container_factory($extensions, $passes, $phpbb_root_path, $php_ext); +} + +function phpbb_container_filename($phpbb_root_path, $php_ext) +{ + $filename = str_replace(array('/', '.'), array('slash', 'dot'), $phpbb_root_path); + return $phpbb_root_path . 'cache/' . $filename . '_container.' . $php_ext; +} diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 67b781f688..ab48da059d 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -77,6 +77,7 @@ if (!defined('PHPBB_INSTALLED') || empty($dbms) || empty($acm_type)) require($phpbb_root_path . 'includes/class_loader.' . $phpEx); require($phpbb_root_path . 'includes/functions.' . $phpEx); +require($phpbb_root_path . 'includes/functions_container.' . $phpEx); phpbb_require_updated('includes/functions_content.' . $phpEx, true); @@ -98,20 +99,27 @@ if (!defined('EXT_TABLE')) define('EXT_TABLE', $table_prefix . 'ext'); } -$phpbb_container = new ContainerBuilder(); -$loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__.'/../config')); -$loader->load('services.yml'); - -// We must include the DI processor class files because the class loader -// is not yet set up -require($phpbb_root_path . 'includes/di/processor/interface.' . $phpEx); -require($phpbb_root_path . 'includes/di/processor/config.' . $phpEx); -$processor = new phpbb_di_processor_config($phpbb_root_path . 'config.' . $phpEx, $phpbb_root_path, $phpEx); -$processor->process($phpbb_container); - // Setup class loader first -$phpbb_class_loader = $phpbb_container->get('class_loader'); -$phpbb_class_loader_ext = $phpbb_container->get('class_loader.ext'); +$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", ".$phpEx"); +$phpbb_class_loader->register(); +$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", ".$phpEx"); +$phpbb_class_loader_ext->register(); + +// Set up container +$phpbb_container = phpbb_create_dumped_container_unless_debug( + array( + new phpbb_di_extension_config($phpbb_root_path . 'config.' . $phpEx), + new phpbb_di_extension_core($phpbb_root_path), + ), + array( + new phpbb_di_pass_collection_pass(), + ), + $phpbb_root_path, + $phpEx +); + +$phpbb_class_loader->set_cache($phpbb_container->get('cache.driver')); +$phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver')); // set up caching $cache = $phpbb_container->get('cache'); @@ -123,13 +131,6 @@ $user = $phpbb_container->get('user'); $auth = $phpbb_container->get('auth'); $db = $phpbb_container->get('dbal.conn'); -$ids = array_keys($phpbb_container->findTaggedServiceIds('container.processor')); -foreach ($ids as $id) -{ - $processor = $phpbb_container->get($id); - $processor->process($phpbb_container); -} - // make sure request_var uses this request instance request_var('', 0, false, false, $request); // "dependency injection" for a function diff --git a/phpBB/install/index.php b/phpBB/install/index.php index 753e5eb226..09560946a6 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -75,10 +75,9 @@ else // Include essential scripts require($phpbb_root_path . 'includes/class_loader.' . $phpEx); -require($phpbb_root_path . 'includes/di/processor/interface.' . $phpEx); -require($phpbb_root_path . 'includes/di/processor/config.' . $phpEx); require($phpbb_root_path . 'includes/functions.' . $phpEx); +require($phpbb_root_path . 'includes/functions_container.' . $phpEx); phpbb_require_updated('includes/functions_content.' . $phpEx, true); @@ -86,17 +85,17 @@ include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); require($phpbb_root_path . 'includes/functions_install.' . $phpEx); -$phpbb_container = new ContainerBuilder(); -$loader = new YamlFileLoader($phpbb_container, new FileLocator(__DIR__.'/../config')); -$loader->load('services.yml'); +// Setup class loader first +$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}includes/", ".$phpEx"); +$phpbb_class_loader->register(); +$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", ".$phpEx"); +$phpbb_class_loader_ext->register(); -$phpbb_container->setParameter('core.root_path', $phpbb_root_path); -$phpbb_container->setParameter('core.php_ext', $phpEx); +// Set up container +$phpbb_container = phpbb_create_install_container($phpbb_root_path, $phpEx); -$phpbb_container->setAlias('cache.driver', 'cache.driver.install'); - -$phpbb_class_loader = $phpbb_container->get('class_loader'); -$phpbb_class_loader_ext = $phpbb_container->get('class_loader.ext'); +$phpbb_class_loader->set_cache($phpbb_container->get('cache.driver')); +$phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver')); // set up caching $cache = $phpbb_container->get('cache'); diff --git a/phpBB/styles/prosilver/template/jumpbox.html b/phpBB/styles/prosilver/template/jumpbox.html index 0060e83b15..ff234464dc 100644 --- a/phpBB/styles/prosilver/template/jumpbox.html +++ b/phpBB/styles/prosilver/template/jumpbox.html @@ -1,12 +1,12 @@ <!-- IF S_VIEWTOPIC --> - <p></p><p><a href="{U_VIEW_FORUM}" class="left-box {S_CONTENT_FLOW_BEGIN}" accesskey="r">{L_RETURN_TO} {FORUM_NAME}</a></p> + <p></p><p><a href="{U_VIEW_FORUM}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" accesskey="r">{L_RETURN_TO} {FORUM_NAME}</a></p> <!-- ELSEIF S_VIEWFORUM --> - <p></p><p><a href="{U_INDEX}" class="left-box {S_CONTENT_FLOW_BEGIN}" accesskey="r">{L_RETURN_TO} {L_INDEX}</a></p> + <p></p><p><a href="{U_INDEX}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" accesskey="r">{L_RETURN_TO} {L_INDEX}</a></p> <!-- ELSEIF SEARCH_TOPIC --> - <p></p><p><a class="left-box {S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH_TOPIC}" accesskey="r">{L_RETURN_TO}{L_COLON} {SEARCH_TOPIC}</a></p> + <p></p><p><a class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH_TOPIC}" accesskey="r">{L_RETURN_TO}{L_COLON} {SEARCH_TOPIC}</a></p> <!-- ELSEIF S_SEARCH_ACTION --> - <p></p><p><a class="left-box {S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH}" title="{L_SEARCH_ADV}" accesskey="r">{L_RETURN_TO_SEARCH_ADV}</a></p> + <p></p><p><a class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH}" title="{L_SEARCH_ADV}" accesskey="r">{L_RETURN_TO_SEARCH_ADV}</a></p> <!-- ENDIF --> <!-- IF S_DISPLAY_JUMPBOX --> diff --git a/phpBB/styles/prosilver/template/mcp_forum.html b/phpBB/styles/prosilver/template/mcp_forum.html index cd4ae69fe7..e559f178f2 100644 --- a/phpBB/styles/prosilver/template/mcp_forum.html +++ b/phpBB/styles/prosilver/template/mcp_forum.html @@ -80,8 +80,8 @@ <!-- ENDIF --> <fieldset class="display-options"> - <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box {S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> - <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box {S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> + <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> + <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> <label>{L_DISPLAY_TOPICS}{L_COLON} {S_SELECT_SORT_DAYS}</label> <label>{L_SORT_BY} {S_SELECT_SORT_KEY}</label> <label>{S_SELECT_SORT_DIR} <input type="submit" name="sort" value="{L_GO}" class="button2" /></label> diff --git a/phpBB/styles/prosilver/template/mcp_logs.html b/phpBB/styles/prosilver/template/mcp_logs.html index 15974802bc..9e4a6f272e 100644 --- a/phpBB/styles/prosilver/template/mcp_logs.html +++ b/phpBB/styles/prosilver/template/mcp_logs.html @@ -54,8 +54,8 @@ <!-- IF .log --> <fieldset class="display-options"> - <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box {S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> - <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box {S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> + <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> + <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> <label>{L_DISPLAY_POSTS}{L_COLON} {S_SELECT_SORT_DAYS}</label> <label>{L_SORT_BY} {S_SELECT_SORT_KEY}</label> <label>{S_SELECT_SORT_DIR}</label> diff --git a/phpBB/styles/prosilver/template/mcp_notes_user.html b/phpBB/styles/prosilver/template/mcp_notes_user.html index c7c568657c..3bbbd10f12 100644 --- a/phpBB/styles/prosilver/template/mcp_notes_user.html +++ b/phpBB/styles/prosilver/template/mcp_notes_user.html @@ -95,8 +95,8 @@ <hr /> <fieldset class="display-options"> - <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box {S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> - <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box {S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> + <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> + <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> <label>{L_DISPLAY_LOG}{L_COLON} {S_SELECT_SORT_DAYS}</label> <label>{L_SORT_BY} {S_SELECT_SORT_KEY}</label><label>{S_SELECT_SORT_DIR}</label> <input type="submit" name="sort" value="{L_GO}" class="button2" /> diff --git a/phpBB/styles/prosilver/template/mcp_queue.html b/phpBB/styles/prosilver/template/mcp_queue.html index dc8869713d..847151a01e 100644 --- a/phpBB/styles/prosilver/template/mcp_queue.html +++ b/phpBB/styles/prosilver/template/mcp_queue.html @@ -65,8 +65,8 @@ </ul> <fieldset class="display-options"> - <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box {S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> - <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box {S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> + <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> + <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> <label>{L_DISPLAY_POSTS}{L_COLON} {S_SELECT_SORT_DAYS}</label> <label>{L_SORT_BY} {S_SELECT_SORT_KEY}</label><label>{S_SELECT_SORT_DIR}</label> <!-- IF TOPIC_ID --><label><input type="checkbox" class="radio" name="t" value="{TOPIC_ID}" checked="checked" /> <strong>{L_ONLY_TOPIC}</strong></label><!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/mcp_reports.html b/phpBB/styles/prosilver/template/mcp_reports.html index f9a0ec4bd6..ea9a4edd6f 100644 --- a/phpBB/styles/prosilver/template/mcp_reports.html +++ b/phpBB/styles/prosilver/template/mcp_reports.html @@ -68,8 +68,8 @@ </ul> <fieldset class="display-options"> - <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box {S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> - <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box {S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> + <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> + <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> <label>{L_DISPLAY_POSTS}{L_COLON} {S_SELECT_SORT_DAYS}</label> <label>{L_SORT_BY} {S_SELECT_SORT_KEY}</label><label>{S_SELECT_SORT_DIR}</label> <!-- IF TOPIC_ID --><label><input type="checkbox" class="radio" name="t" value="{TOPIC_ID}" checked="checked" /> <strong>{L_ONLY_TOPIC}</strong></label><!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/mcp_whois.html b/phpBB/styles/prosilver/template/mcp_whois.html index 88d3269a71..41a825458d 100644 --- a/phpBB/styles/prosilver/template/mcp_whois.html +++ b/phpBB/styles/prosilver/template/mcp_whois.html @@ -4,11 +4,11 @@ <div class="panel"> <div class="inner"> - <p><a class="{S_CONTENT_FLOW_BEGIN}" href="{U_RETURN_POST}">{L_RETURN_POST}</a></p> + <p><a class="arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_RETURN_POST}">{L_RETURN_POST}</a></p> <div class="postbody"><div class="content"> <pre>{WHOIS}</pre> </div></div> - <p><a class="{S_CONTENT_FLOW_BEGIN}" href="{U_RETURN_POST}">{L_RETURN_POST}</a></p> + <p><a class="arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_RETURN_POST}">{L_RETURN_POST}</a></p> </div> </div> diff --git a/phpBB/styles/prosilver/template/memberlist_body.html b/phpBB/styles/prosilver/template/memberlist_body.html index 273182ec3f..4ba0c5cb2a 100644 --- a/phpBB/styles/prosilver/template/memberlist_body.html +++ b/phpBB/styles/prosilver/template/memberlist_body.html @@ -143,8 +143,8 @@ <!-- IF S_IN_SEARCH_POPUP and not S_SEARCH_USER --> <fieldset class="display-options"> - <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box {S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> - <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box {S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> + <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> + <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> <label for="sk">{L_SELECT_SORT_METHOD}{L_COLON} <select name="sk" id="sk">{S_MODE_SELECT}</select></label> <label for="sd">{L_ORDER} <select name="sd" id="sd">{S_ORDER_SELECT}</select> <input type="submit" name="sort" value="{L_SUBMIT}" class="button2" /></label> </fieldset> diff --git a/phpBB/styles/prosilver/template/message_body.html b/phpBB/styles/prosilver/template/message_body.html index fb6dfce35f..a844246055 100644 --- a/phpBB/styles/prosilver/template/message_body.html +++ b/phpBB/styles/prosilver/template/message_body.html @@ -8,7 +8,7 @@ <div class="inner"> <h2>{MESSAGE_TITLE}</h2> <p>{MESSAGE_TEXT}</p> - <!-- IF SCRIPT_NAME == "search" and not S_BOARD_DISABLED and not S_NO_SEARCH and L_RETURN_TO_SEARCH_ADV --><p><a href="{U_SEARCH}" class="{S_CONTENT_FLOW_BEGIN}">{L_RETURN_TO_SEARCH_ADV}</a></p><!-- ENDIF --> + <!-- IF SCRIPT_NAME == "search" and not S_BOARD_DISABLED and not S_NO_SEARCH and L_RETURN_TO_SEARCH_ADV --><p><a href="{U_SEARCH}" class="arrow-{S_CONTENT_FLOW_BEGIN}">{L_RETURN_TO_SEARCH_ADV}</a></p><!-- ENDIF --> </div> </div> diff --git a/phpBB/styles/prosilver/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html index c206cc3181..be45993cef 100644 --- a/phpBB/styles/prosilver/template/posting_editor.html +++ b/phpBB/styles/prosilver/template/posting_editor.html @@ -165,7 +165,7 @@ <dt><label for="comment_list_{attach_row.ASSOC_INDEX}">{L_FILE_COMMENT}{L_COLON}</label></dt> <dd><textarea name="comment_list[{attach_row.ASSOC_INDEX}]" id="comment_list_{attach_row.ASSOC_INDEX}" rows="1" cols="35" class="inputbox">{attach_row.FILE_COMMENT}</textarea></dd> - <dd><a href="{attach_row.U_VIEW_ATTACHMENT}" class="{S_CONTENT_FLOW_END}">{attach_row.FILENAME}</a></dd> + <dd><a href="{attach_row.U_VIEW_ATTACHMENT}">{attach_row.FILENAME}</a></dd> <dd style="margin-top: 5px;"> <!-- IF S_INLINE_ATTACHMENT_OPTIONS --><input type="button" value="{L_PLACE_INLINE}" onclick="attach_inline({attach_row.ASSOC_INDEX}, '{attach_row.A_FILENAME}');" class="button2" /> <!-- ENDIF --> <input type="submit" name="delete_file[{attach_row.ASSOC_INDEX}]" value="{L_DELETE_FILE}" class="button2" /> diff --git a/phpBB/styles/prosilver/template/search_results.html b/phpBB/styles/prosilver/template/search_results.html index 136ca991b1..62b7c61eb3 100644 --- a/phpBB/styles/prosilver/template/search_results.html +++ b/phpBB/styles/prosilver/template/search_results.html @@ -6,9 +6,9 @@ <!-- IF PHRASE_SEARCH_DISABLED --> <p><strong>{L_PHRASE_SEARCH_DISABLED}</strong></p><!-- ENDIF --> <!-- IF SEARCH_TOPIC --> - <p><a class="{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH_TOPIC}">{L_RETURN_TO}{L_COLON} {SEARCH_TOPIC}</a></p> + <p><a class="arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH_TOPIC}">{L_RETURN_TO}{L_COLON} {SEARCH_TOPIC}</a></p> <!-- ELSE --> - <p><a class="{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH}" title="{L_SEARCH_ADV}">{L_RETURN_TO_SEARCH_ADV}</a></p> + <p><a class="arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH}" title="{L_SEARCH_ADV}">{L_RETURN_TO_SEARCH_ADV}</a></p> <!-- ENDIF --> <!-- IF .pagination or SEARCH_MATCHES or PAGE_NUMBER --> @@ -131,7 +131,7 @@ <!-- IF not searchresults.S_IGNORE_POST --> <ul class="searchresults"> - <li ><a href="{searchresults.U_VIEW_POST}" class="{S_CONTENT_FLOW_END}">{L_JUMP_TO_POST}</a></li> + <li ><a href="{searchresults.U_VIEW_POST}" class="arrow-{S_CONTENT_FLOW_END}">{L_JUMP_TO_POST}</a></li> </ul> <!-- ENDIF --> @@ -150,8 +150,8 @@ <form method="post" action="{S_SEARCH_ACTION}"> <fieldset class="display-options"> - <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box {S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> - <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box {S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> + <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> + <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> <!-- IF S_SELECT_SORT_DAYS or S_SELECT_SORT_KEY --> <label><!-- IF S_SHOW_TOPICS -->{L_DISPLAY_POSTS}<!-- ELSE -->{L_SORT_BY}</label><label><!-- ENDIF --> {S_SELECT_SORT_DAYS}<!-- IF S_SELECT_SORT_KEY --></label> <label>{S_SELECT_SORT_KEY}</label> <label>{S_SELECT_SORT_DIR}<!-- ENDIF --> <input type="submit" name="sort" value="{L_GO}" class="button2" /></label> diff --git a/phpBB/styles/prosilver/template/ucp_attachments.html b/phpBB/styles/prosilver/template/ucp_attachments.html index 8c93547388..478b14ab86 100644 --- a/phpBB/styles/prosilver/template/ucp_attachments.html +++ b/phpBB/styles/prosilver/template/ucp_attachments.html @@ -47,8 +47,8 @@ </ul> <fieldset class="display-options"> - <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box {S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> - <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box {S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> + <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> + <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> <label for="sk">{L_SORT_BY}{L_COLON} <select name="sk" id="sk">{S_SORT_OPTIONS}</select></label> <label><select name="sd" id="sd">{S_ORDER_SELECT}</select></label> <input class="button2" type="submit" name="sort" value="{L_SORT}" /> diff --git a/phpBB/styles/prosilver/template/ucp_pm_message_header.html b/phpBB/styles/prosilver/template/ucp_pm_message_header.html index 29e6a5a46b..c47f93f739 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_message_header.html +++ b/phpBB/styles/prosilver/template/ucp_pm_message_header.html @@ -18,7 +18,7 @@ <!-- IF TOTAL_MESSAGES or S_VIEW_MESSAGE --> <ul class="linklist"> <li class="rightside pagination"> - <!-- IF S_VIEW_MESSAGE --><a class="{S_CONTENT_FLOW_BEGIN}" href="{U_CURRENT_FOLDER}">{L_RETURN_TO} {CUR_FOLDER_NAME}</a><!-- ENDIF --> + <!-- IF S_VIEW_MESSAGE --><a class="arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_CURRENT_FOLDER}">{L_RETURN_TO} {CUR_FOLDER_NAME}</a><!-- ENDIF --> <!-- IF FOLDER_CUR_MESSAGES neq 0 --> <!-- IF TOTAL_MESSAGES -->{TOTAL_MESSAGES} • <!-- ENDIF --> <!-- IF .pagination --> diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html b/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html index cb373dc5b6..96668284eb 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html @@ -119,8 +119,8 @@ <!-- IF FOLDER_CUR_MESSAGES neq 0 --> <fieldset class="display-options"> - <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box {S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> - <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box {S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> + <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> + <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> <label>{L_DISPLAY}{L_COLON} {S_SELECT_SORT_DAYS}</label> <label>{L_SORT_BY} {S_SELECT_SORT_KEY}</label> <label>{S_SELECT_SORT_DIR} <input type="submit" name="sort" value="{L_GO}" class="button2" /></label> diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html index c456be1090..22149c8b80 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html @@ -8,8 +8,8 @@ <!-- IF S_DISPLAY_HISTORY and (U_VIEW_PREVIOUS_HISTORY or U_VIEW_NEXT_HISTORY) --> <fieldset class="display-options clearfix"> - <!-- IF U_VIEW_PREVIOUS_HISTORY --><a href="{U_VIEW_PREVIOUS_HISTORY}" class="left-box {S_CONTENT_FLOW_BEGIN}">{L_VIEW_PREVIOUS_HISTORY}</a><!-- ENDIF --> - <!-- IF U_VIEW_NEXT_HISTORY --><a href="{U_VIEW_NEXT_HISTORY}" class="right-box {S_CONTENT_FLOW_END}">{L_VIEW_NEXT_HISTORY}</a><!-- ENDIF --> + <!-- IF U_VIEW_PREVIOUS_HISTORY --><a href="{U_VIEW_PREVIOUS_HISTORY}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_VIEW_PREVIOUS_HISTORY}</a><!-- ENDIF --> + <!-- IF U_VIEW_NEXT_HISTORY --><a href="{U_VIEW_NEXT_HISTORY}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_VIEW_NEXT_HISTORY}</a><!-- ENDIF --> </fieldset> <!-- ENDIF --> @@ -113,8 +113,8 @@ <!-- IF S_VIEW_MESSAGE --> <fieldset class="display-options"> - <!-- IF U_PREVIOUS_PM --><a href="{U_PREVIOUS_PM}" class="left-box {S_CONTENT_FLOW_BEGIN}">{L_VIEW_PREVIOUS_PM}</a><!-- ENDIF --> - <!-- IF U_NEXT_PM --><a href="{U_NEXT_PM}" class="right-box {S_CONTENT_FLOW_END}">{L_VIEW_NEXT_PM}</a><!-- ENDIF --> + <!-- IF U_PREVIOUS_PM --><a href="{U_PREVIOUS_PM}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_VIEW_PREVIOUS_PM}</a><!-- ENDIF --> + <!-- IF U_NEXT_PM --><a href="{U_NEXT_PM}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_VIEW_NEXT_PM}</a><!-- ENDIF --> <!-- IF S_MARK_OPTIONS --><label for="mark_option"><select name="mark_option" id="mark_option">{S_MARK_OPTIONS}</select></label> <input class="button2" type="submit" name="submit_mark" value="{L_GO}" /><!-- ENDIF --> <!-- IF not S_UNREAD and not S_SPECIAL_FOLDER --><label for="dest_folder"><!-- IF S_VIEW_MESSAGE -->{L_MOVE_TO_FOLDER}{L_COLON} <!-- ELSE -->{L_MOVE_MARKED_TO_FOLDER}<!-- ENDIF --> <select name="dest_folder" id="dest_folder">{S_TO_FOLDER_OPTIONS}</select></label> <input class="button2" type="submit" name="move_pm" value="{L_GO}" /><!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index 0a818e725b..a3239602ae 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -189,8 +189,8 @@ <!-- IF S_SELECT_SORT_DAYS and not S_DISPLAY_ACTIVE --> <form method="post" action="{S_FORUM_ACTION}"> <fieldset class="display-options"> - <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box {S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> - <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box {S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> + <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> + <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> <!-- IF not S_IS_BOT --> <label>{L_DISPLAY_TOPICS}{L_COLON} {S_SELECT_SORT_DAYS}</label> <label>{L_SORT_BY} {S_SELECT_SORT_KEY}</label> diff --git a/phpBB/styles/prosilver/template/viewonline_body.html b/phpBB/styles/prosilver/template/viewonline_body.html index 7ae1b6bc58..cb19a40d8f 100644 --- a/phpBB/styles/prosilver/template/viewonline_body.html +++ b/phpBB/styles/prosilver/template/viewonline_body.html @@ -49,7 +49,7 @@ <!-- IF PREVIOUS_PAGE or NEXT_PAGE --> <fieldset class="display-options right-box"> - <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ELSE -->{L_PREVIOUS}<!-- ENDIF --> • <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ELSE -->{L_NEXT}<!-- ENDIF --> + <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ELSE -->{L_PREVIOUS}<!-- ENDIF --> • <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ELSE -->{L_NEXT}<!-- ENDIF --> </fieldset> <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index 9455d10f72..1b7d78e063 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -249,8 +249,8 @@ <form id="viewtopic" method="post" action="{S_TOPIC_ACTION}"> <fieldset class="display-options" style="margin-top: 0; "> - <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box {S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> - <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box {S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> + <!-- IF PREVIOUS_PAGE --><a href="{PREVIOUS_PAGE}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_PREVIOUS}</a><!-- ENDIF --> + <!-- IF NEXT_PAGE --><a href="{NEXT_PAGE}" class="right-box arrow-{S_CONTENT_FLOW_END}">{L_NEXT}</a><!-- ENDIF --> <!-- IF not S_IS_BOT --> <label>{L_DISPLAY_POSTS}{L_COLON} {S_SELECT_SORT_DAYS}</label> <label>{L_SORT_BY} {S_SELECT_SORT_KEY}</label> <label>{S_SELECT_SORT_DIR} <input type="submit" name="sort" value="{L_GO}" class="button2" /></label> diff --git a/phpBB/styles/prosilver/theme/colours.css b/phpBB/styles/prosilver/theme/colours.css index bebf3566ee..0043e7f5bc 100644 --- a/phpBB/styles/prosilver/theme/colours.css +++ b/phpBB/styles/prosilver/theme/colours.css @@ -331,20 +331,20 @@ a.top2 { } /* Arrow links */ -a.up { background-image: url("./images/arrow_up.gif") } -a.down { background-image: url("./images/arrow_down.gif") } -a.left { background-image: url("./images/arrow_left.gif") } -a.right { background-image: url("./images/arrow_right.gif") } +a.arrow-up { background-image: url("./images/arrow_up.gif") } +a.arrow-down { background-image: url("./images/arrow_down.gif") } +a.arrow-left { background-image: url("./images/arrow_left.gif") } +a.arrow-right { background-image: url("./images/arrow_right.gif") } -a.up:hover { +a.arrow-up:hover { background-color: transparent; } -a.left:hover { +a.arrow-left:hover { color: #368AD2; } -a.right:hover { +a.arrow-right:hover { color: #368AD2; } diff --git a/phpBB/styles/prosilver/theme/links.css b/phpBB/styles/prosilver/theme/links.css index 66c3aed03e..5dc8a13313 100644 --- a/phpBB/styles/prosilver/theme/links.css +++ b/phpBB/styles/prosilver/theme/links.css @@ -145,44 +145,44 @@ a.top2 { } /* Arrow links */ -a.up { background: none no-repeat left center; } -a.down { background: none no-repeat right center; } -a.left { background: none no-repeat 3px 60%; } -a.right { background: none no-repeat 95% 60%; } +a.arrow-up { background: none no-repeat left center; } +a.arrow-down { background: none no-repeat right center; } +a.arrow-left { background: none no-repeat 3px 60%; } +a.arrow-right { background: none no-repeat 95% 60%; } -a.up, a.up:link, a.up:active, a.up:visited { +a.arrow-up, a.arrow-up:link, a.arrow-up:active, a.arrow-up:visited { padding-left: 10px; text-decoration: none; border-bottom-width: 0; } -a.up:hover { +a.arrow-up:hover { background-position: left top; } -a.down, a.down:link, a.down:active, a.down:visited { +a.arrow-down, a.arrow-down:link, a.arrow-down:active, a.arrow-down:visited { padding-right: 10px; } -a.down:hover { +a.arrow-down:hover { background-position: right bottom; text-decoration: none; } -a.left, a.left:active, a.left:visited { +a.arrow-left, a.arrow-left:active, a.arrow-left:visited { padding-left: 12px; } -a.left:hover { +a.arrow-left:hover { text-decoration: none; background-position: 0 60%; } -a.right, a.right:active, a.right:visited { +a.arrow-right, a.arrow-right:active, a.arrow-right:visited { padding-right: 12px; } -a.right:hover { +a.arrow-right:hover { text-decoration: none; background-position: 100% 60%; } diff --git a/tests/cron/task_provider_test.php b/tests/cron/task_provider_test.php deleted file mode 100644 index ec853bb3ba..0000000000 --- a/tests/cron/task_provider_test.php +++ /dev/null @@ -1,50 +0,0 @@ -<?php -/** -* -* @package testing -* @copyright (c) 2010 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 -* -*/ - -class phpbb_cron_task_provider_test extends PHPUnit_Framework_TestCase -{ - public function setUp() - { - $this->tasks = array( - 'phpbb_cron_task_core_dummy_task', - 'phpbb_cron_task_core_second_dummy_task', - 'phpbb_ext_testext_cron_dummy_task', - ); - - $container = $this->getMock('Symfony\Component\DependencyInjection\TaggedContainerInterface'); - $container - ->expects($this->once()) - ->method('findTaggedServiceIds') - ->will($this->returnValue(array_flip($this->tasks))); - $container - ->expects($this->any()) - ->method('get') - ->will($this->returnCallback(function ($name) { - return new $name; - })); - - $this->provider = new phpbb_cron_task_provider($container); - } - - public function test_manager_finds_shipped_tasks() - { - $task_names = array(); - foreach ($this->provider as $task) - { - $task_names[] = $task->get_name(); - } - sort($task_names); - - $this->assertEquals(array( - 'phpbb_cron_task_core_dummy_task', - 'phpbb_cron_task_core_second_dummy_task', - 'phpbb_ext_testext_cron_dummy_task', - ), $task_names); - } -} diff --git a/tests/di/create_container_test.php b/tests/di/create_container_test.php new file mode 100644 index 0000000000..c2b8a0fc0b --- /dev/null +++ b/tests/di/create_container_test.php @@ -0,0 +1,72 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2012 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_container.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/db/dbal.php'; + +class phpbb_di_container_test extends phpbb_test_case +{ + public function test_phpbb_create_container() + { + $phpbb_root_path = __DIR__ . '/../../phpBB/'; + $extensions = array( + new phpbb_di_extension_config(__DIR__ . '/fixtures/config.php'), + new phpbb_di_extension_core($phpbb_root_path), + ); + $container = phpbb_create_container($extensions, $phpbb_root_path, 'php'); + + $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container); + } + + public function test_phpbb_create_install_container() + { + $phpbb_root_path = __DIR__ . '/../../phpBB/'; + $extensions = array( + new phpbb_di_extension_config(__DIR__ . '/fixtures/config.php'), + new phpbb_di_extension_core($phpbb_root_path), + ); + $container = phpbb_create_install_container($phpbb_root_path, 'php'); + + $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container); + $this->assertTrue($container->isFrozen()); + } + + public function test_phpbb_create_compiled_container() + { + $phpbb_root_path = __DIR__ . '/../../phpBB/'; + $extensions = array( + new phpbb_di_extension_config(__DIR__ . '/fixtures/config.php'), + new phpbb_di_extension_core($phpbb_root_path), + ); + $container = phpbb_create_compiled_container($extensions, array(), $phpbb_root_path, 'php'); + + $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container); + $this->assertTrue($container->isFrozen()); + } +} + +class dbal_container_mock extends dbal +{ + public function sql_connect() + { + } + + public function sql_query() + { + } + + public function sql_fetchrow() + { + } + + public function sql_freeresult() + { + } +} diff --git a/tests/di/fixtures/config.php b/tests/di/fixtures/config.php new file mode 100644 index 0000000000..5033d2dc9f --- /dev/null +++ b/tests/di/fixtures/config.php @@ -0,0 +1,11 @@ +<?php +// phpBB 3.1.x auto-generated configuration file +// Do not change anything in this file! +$dbms = 'container_mock'; +$dbhost = '127.0.0.1'; +$dbport = ''; +$dbname = 'phpbb'; +$dbuser = 'root'; +$dbpasswd = ''; +$table_prefix = 'phpbb_'; +$acm_type = 'phpbb_cache_driver_null'; diff --git a/tests/event/dispatcher_test.php b/tests/event/dispatcher_test.php index f8fe060d99..9b9203e06a 100644 --- a/tests/event/dispatcher_test.php +++ b/tests/event/dispatcher_test.php @@ -11,7 +11,7 @@ class phpbb_event_dispatcher_test extends phpbb_test_case { public function test_trigger_event() { - $dispatcher = new phpbb_event_dispatcher(); + $dispatcher = new phpbb_event_dispatcher(new phpbb_mock_container_builder()); $dispatcher->addListener('core.test_event', function (phpbb_event_data $event) { $event['foo'] = $event['foo'] . '2'; diff --git a/tests/mock/container_builder.php b/tests/mock/container_builder.php new file mode 100644 index 0000000000..8a81dd72d1 --- /dev/null +++ b/tests/mock/container_builder.php @@ -0,0 +1,160 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2012 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\ScopeInterface; + +class phpbb_mock_container_builder implements ContainerInterface +{ + /** + * Sets a service. + * + * @param string $id The service identifier + * @param object $service The service instance + * @param string $scope The scope of the service + * + * @api + */ + public function set($id, $service, $scope = self::SCOPE_CONTAINER) + { + } + + /** + * Gets a service. + * + * @param string $id The service identifier + * @param int $invalidBehavior The behavior when the service does not exist + * + * @return object The associated service + * + * @throws InvalidArgumentException if the service is not defined + * @throws ServiceCircularReferenceException When a circular reference is detected + * @throws ServiceNotFoundException When the service is not defined + * + * @see Reference + * + * @api + */ + public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE) + { + } + + /** + * Returns true if the given service is defined. + * + * @param string $id The service identifier + * + * @return Boolean true if the service is defined, false otherwise + * + * @api + */ + public function has($id) + { + } + + /** + * Gets a parameter. + * + * @param string $name The parameter name + * + * @return mixed The parameter value + * + * @throws InvalidArgumentException if the parameter is not defined + * + * @api + */ + public function getParameter($name) + { + } + + /** + * Checks if a parameter exists. + * + * @param string $name The parameter name + * + * @return Boolean The presence of parameter in container + * + * @api + */ + public function hasParameter($name) + { + } + + /** + * Sets a parameter. + * + * @param string $name The parameter name + * @param mixed $value The parameter value + * + * @api + */ + public function setParameter($name, $value) + { + } + + /** + * Enters the given scope + * + * @param string $name + * + * @api + */ + public function enterScope($name) + { + } + + /** + * Leaves the current scope, and re-enters the parent scope + * + * @param string $name + * + * @api + */ + public function leaveScope($name) + { + } + + /** + * Adds a scope to the container + * + * @param ScopeInterface $scope + * + * @api + */ + public function addScope(ScopeInterface $scope) + { + } + + /** + * Whether this container has the given scope + * + * @param string $name + * + * @return Boolean + * + * @api + */ + public function hasScope($name) + { + } + + /** + * Determines whether the given scope is currently active. + * + * It does however not check if the scope actually exists. + * + * @param string $name + * + * @return Boolean + * + * @api + */ + public function isScopeActive($name) + { + } +} |