mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Merge pull request #1565 from naderman/ticket/11700
[WIP][ticket/11700] Namespaces
This commit is contained in:
commit
8da3133238
477 changed files with 2985 additions and 2119 deletions
|
@ -47,9 +47,15 @@ if (!defined('PHPBB_INSTALLED'))
|
||||||
|
|
||||||
// Eliminate . and .. from the path
|
// Eliminate . and .. from the path
|
||||||
require($phpbb_root_path . 'phpbb/filesystem.' . $phpEx);
|
require($phpbb_root_path . 'phpbb/filesystem.' . $phpEx);
|
||||||
$phpbb_filesystem = new phpbb_filesystem(
|
require($phpbb_root_path . 'phpbb/symfony_request.' . $phpEx);
|
||||||
new phpbb_symfony_request(
|
require($phpbb_root_path . 'phpbb/request/deactivated_super_global.' . $phpEx);
|
||||||
new phpbb_request()
|
require($phpbb_root_path . 'phpbb/request/type_cast_helper_interface.' . $phpEx);
|
||||||
|
require($phpbb_root_path . 'phpbb/request/type_cast_helper.' . $phpEx);
|
||||||
|
require($phpbb_root_path . 'phpbb/request/request_interface.' . $phpEx);
|
||||||
|
require($phpbb_root_path . 'phpbb/request/request.' . $phpEx);
|
||||||
|
$phpbb_filesystem = new phpbb\filesystem(
|
||||||
|
new phpbb\symfony_request(
|
||||||
|
new phpbb\request\request()
|
||||||
),
|
),
|
||||||
$phpbb_root_path,
|
$phpbb_root_path,
|
||||||
$phpEx
|
$phpEx
|
||||||
|
@ -91,9 +97,9 @@ require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
|
||||||
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
|
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
|
||||||
|
|
||||||
// Setup class loader first
|
// Setup class loader first
|
||||||
$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}phpbb/", $phpEx);
|
$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx);
|
||||||
$phpbb_class_loader->register();
|
$phpbb_class_loader->register();
|
||||||
$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", $phpEx);
|
$phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx);
|
||||||
$phpbb_class_loader_ext->register();
|
$phpbb_class_loader_ext->register();
|
||||||
|
|
||||||
// Set up container
|
// Set up container
|
||||||
|
@ -134,7 +140,7 @@ $template = $phpbb_container->get('template');
|
||||||
|
|
||||||
// Add own hook handler
|
// Add own hook handler
|
||||||
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
|
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')));
|
$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('\phpbb\template\template', 'display')));
|
||||||
$phpbb_hook_finder = $phpbb_container->get('hook_finder');
|
$phpbb_hook_finder = $phpbb_container->get('hook_finder');
|
||||||
|
|
||||||
foreach ($phpbb_hook_finder->find() as $hook)
|
foreach ($phpbb_hook_finder->find() as $hook)
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
services:
|
services:
|
||||||
auth.provider_collection:
|
auth.provider_collection:
|
||||||
class: phpbb_di_service_collection
|
class: phpbb\di\service_collection
|
||||||
arguments:
|
arguments:
|
||||||
- @service_container
|
- @service_container
|
||||||
tags:
|
tags:
|
||||||
- { name: service_collection, tag: auth.provider }
|
- { name: service_collection, tag: auth.provider }
|
||||||
auth.provider.db:
|
auth.provider.db:
|
||||||
class: phpbb_auth_provider_db
|
class: phpbb\auth\provider\db
|
||||||
arguments:
|
arguments:
|
||||||
- @dbal.conn
|
- @dbal.conn
|
||||||
- @config
|
- @config
|
||||||
|
@ -17,7 +17,7 @@ services:
|
||||||
tags:
|
tags:
|
||||||
- { name: auth.provider }
|
- { name: auth.provider }
|
||||||
auth.provider.apache:
|
auth.provider.apache:
|
||||||
class: phpbb_auth_provider_apache
|
class: phpbb\auth\provider\apache
|
||||||
arguments:
|
arguments:
|
||||||
- @dbal.conn
|
- @dbal.conn
|
||||||
- @config
|
- @config
|
||||||
|
@ -28,7 +28,7 @@ services:
|
||||||
tags:
|
tags:
|
||||||
- { name: auth.provider }
|
- { name: auth.provider }
|
||||||
auth.provider.ldap:
|
auth.provider.ldap:
|
||||||
class: phpbb_auth_provider_ldap
|
class: phpbb\auth\provider\ldap
|
||||||
arguments:
|
arguments:
|
||||||
- @dbal.conn
|
- @dbal.conn
|
||||||
- @config
|
- @config
|
||||||
|
@ -36,7 +36,7 @@ services:
|
||||||
tags:
|
tags:
|
||||||
- { name: auth.provider }
|
- { name: auth.provider }
|
||||||
auth.provider.oauth:
|
auth.provider.oauth:
|
||||||
class: phpbb_auth_provider_oauth
|
class: phpbb\auth\provider\oauth\oauth
|
||||||
arguments:
|
arguments:
|
||||||
- @dbal.conn
|
- @dbal.conn
|
||||||
- @config
|
- @config
|
||||||
|
@ -51,27 +51,27 @@ services:
|
||||||
tags:
|
tags:
|
||||||
- { name: auth.provider }
|
- { name: auth.provider }
|
||||||
auth.provider.oauth.service_collection:
|
auth.provider.oauth.service_collection:
|
||||||
class: phpbb_di_service_collection
|
class: phpbb\di\service_collection
|
||||||
arguments:
|
arguments:
|
||||||
- @service_container
|
- @service_container
|
||||||
tags:
|
tags:
|
||||||
- { name: service_collection, tag: auth.provider.oauth.service }
|
- { name: service_collection, tag: auth.provider.oauth.service }
|
||||||
auth.provider.oauth.service.bitly:
|
auth.provider.oauth.service.bitly:
|
||||||
class: phpbb_auth_provider_oauth_service_bitly
|
class: phpbb\auth\provider\oauth\service\bitly
|
||||||
arguments:
|
arguments:
|
||||||
- @config
|
- @config
|
||||||
- @request
|
- @request
|
||||||
tags:
|
tags:
|
||||||
- { name: auth.provider.oauth.service }
|
- { name: auth.provider.oauth.service }
|
||||||
auth.provider.oauth.service.facebook:
|
auth.provider.oauth.service.facebook:
|
||||||
class: phpbb_auth_provider_oauth_service_facebook
|
class: phpbb\auth\provider\oauth\service\facebook
|
||||||
arguments:
|
arguments:
|
||||||
- @config
|
- @config
|
||||||
- @request
|
- @request
|
||||||
tags:
|
tags:
|
||||||
- { name: auth.provider.oauth.service }
|
- { name: auth.provider.oauth.service }
|
||||||
auth.provider.oauth.service.google:
|
auth.provider.oauth.service.google:
|
||||||
class: phpbb_auth_provider_oauth_service_google
|
class: phpbb\auth\provider\oauth\service\google
|
||||||
arguments:
|
arguments:
|
||||||
- @config
|
- @config
|
||||||
- @request
|
- @request
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
services:
|
services:
|
||||||
avatar.driver.gravatar:
|
avatar.driver.gravatar:
|
||||||
class: phpbb_avatar_driver_gravatar
|
class: phpbb\avatar\driver\gravatar
|
||||||
arguments:
|
arguments:
|
||||||
- @config
|
- @config
|
||||||
- %core.root_path%
|
- %core.root_path%
|
||||||
|
@ -12,7 +12,7 @@ services:
|
||||||
- { name: avatar.driver }
|
- { name: avatar.driver }
|
||||||
|
|
||||||
avatar.driver.local:
|
avatar.driver.local:
|
||||||
class: phpbb_avatar_driver_local
|
class: phpbb\avatar\driver\local
|
||||||
arguments:
|
arguments:
|
||||||
- @config
|
- @config
|
||||||
- %core.root_path%
|
- %core.root_path%
|
||||||
|
@ -24,7 +24,7 @@ services:
|
||||||
- { name: avatar.driver }
|
- { name: avatar.driver }
|
||||||
|
|
||||||
avatar.driver.remote:
|
avatar.driver.remote:
|
||||||
class: phpbb_avatar_driver_remote
|
class: phpbb\avatar\driver\remote
|
||||||
arguments:
|
arguments:
|
||||||
- @config
|
- @config
|
||||||
- %core.root_path%
|
- %core.root_path%
|
||||||
|
@ -36,7 +36,7 @@ services:
|
||||||
- { name: avatar.driver }
|
- { name: avatar.driver }
|
||||||
|
|
||||||
avatar.driver.upload:
|
avatar.driver.upload:
|
||||||
class: phpbb_avatar_driver_upload
|
class: phpbb\avatar\driver\upload
|
||||||
arguments:
|
arguments:
|
||||||
- @config
|
- @config
|
||||||
- %core.root_path%
|
- %core.root_path%
|
||||||
|
@ -48,7 +48,7 @@ services:
|
||||||
- { name: avatar.driver }
|
- { name: avatar.driver }
|
||||||
|
|
||||||
avatar.driver_collection:
|
avatar.driver_collection:
|
||||||
class: phpbb_di_service_collection
|
class: phpbb\di\service_collection
|
||||||
arguments:
|
arguments:
|
||||||
- @service_container
|
- @service_container
|
||||||
tags:
|
tags:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
services:
|
services:
|
||||||
cron.task.core.prune_all_forums:
|
cron.task.core.prune_all_forums:
|
||||||
class: phpbb_cron_task_core_prune_all_forums
|
class: phpbb\cron\task\core\prune_all_forums
|
||||||
arguments:
|
arguments:
|
||||||
- %core.root_path%
|
- %core.root_path%
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
|
@ -12,7 +12,7 @@ services:
|
||||||
- { name: cron.task }
|
- { name: cron.task }
|
||||||
|
|
||||||
cron.task.core.prune_forum:
|
cron.task.core.prune_forum:
|
||||||
class: phpbb_cron_task_core_prune_forum
|
class: phpbb\cron\task\core\prune_forum
|
||||||
arguments:
|
arguments:
|
||||||
- %core.root_path%
|
- %core.root_path%
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
|
@ -24,7 +24,7 @@ services:
|
||||||
- { name: cron.task }
|
- { name: cron.task }
|
||||||
|
|
||||||
cron.task.core.queue:
|
cron.task.core.queue:
|
||||||
class: phpbb_cron_task_core_queue
|
class: phpbb\cron\task\core\queue
|
||||||
arguments:
|
arguments:
|
||||||
- %core.root_path%
|
- %core.root_path%
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
|
@ -35,7 +35,7 @@ services:
|
||||||
- { name: cron.task }
|
- { name: cron.task }
|
||||||
|
|
||||||
cron.task.core.tidy_cache:
|
cron.task.core.tidy_cache:
|
||||||
class: phpbb_cron_task_core_tidy_cache
|
class: phpbb\cron\task\core\tidy_cache
|
||||||
arguments:
|
arguments:
|
||||||
- @config
|
- @config
|
||||||
- @cache.driver
|
- @cache.driver
|
||||||
|
@ -45,7 +45,7 @@ services:
|
||||||
- { name: cron.task }
|
- { name: cron.task }
|
||||||
|
|
||||||
cron.task.core.tidy_database:
|
cron.task.core.tidy_database:
|
||||||
class: phpbb_cron_task_core_tidy_database
|
class: phpbb\cron\task\core\tidy_database
|
||||||
arguments:
|
arguments:
|
||||||
- %core.root_path%
|
- %core.root_path%
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
|
@ -56,7 +56,7 @@ services:
|
||||||
- { name: cron.task }
|
- { name: cron.task }
|
||||||
|
|
||||||
cron.task.core.tidy_search:
|
cron.task.core.tidy_search:
|
||||||
class: phpbb_cron_task_core_tidy_search
|
class: phpbb\cron\task\core\tidy_search
|
||||||
arguments:
|
arguments:
|
||||||
- %core.root_path%
|
- %core.root_path%
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
|
@ -70,7 +70,7 @@ services:
|
||||||
- { name: cron.task }
|
- { name: cron.task }
|
||||||
|
|
||||||
cron.task.core.tidy_sessions:
|
cron.task.core.tidy_sessions:
|
||||||
class: phpbb_cron_task_core_tidy_sessions
|
class: phpbb\cron\task\core\tidy_sessions
|
||||||
arguments:
|
arguments:
|
||||||
- @config
|
- @config
|
||||||
- @user
|
- @user
|
||||||
|
@ -80,7 +80,7 @@ services:
|
||||||
- { name: cron.task }
|
- { name: cron.task }
|
||||||
|
|
||||||
cron.task.core.tidy_warnings:
|
cron.task.core.tidy_warnings:
|
||||||
class: phpbb_cron_task_core_tidy_warnings
|
class: phpbb\cron\task\core\tidy_warnings
|
||||||
arguments:
|
arguments:
|
||||||
- %core.root_path%
|
- %core.root_path%
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
services:
|
services:
|
||||||
feed.helper:
|
feed.helper:
|
||||||
class: phpbb_feed_helper
|
class: phpbb\feed\helper
|
||||||
arguments:
|
arguments:
|
||||||
- @config
|
- @config
|
||||||
- @user
|
- @user
|
||||||
- %core.root_path%
|
- %core.root_path%
|
||||||
|
|
||||||
feed.factory:
|
feed.factory:
|
||||||
class: phpbb_feed_factory
|
class: phpbb\feed\factory
|
||||||
arguments:
|
arguments:
|
||||||
- @service_container
|
- @service_container
|
||||||
- @config
|
- @config
|
||||||
- @dbal.conn
|
- @dbal.conn
|
||||||
|
|
||||||
feed.forum:
|
feed.forum:
|
||||||
class: phpbb_feed_forum
|
class: phpbb\feed\forum
|
||||||
scope: prototype
|
scope: prototype
|
||||||
arguments:
|
arguments:
|
||||||
- @feed.helper
|
- @feed.helper
|
||||||
|
@ -27,7 +27,7 @@ services:
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
|
|
||||||
feed.forums:
|
feed.forums:
|
||||||
class: phpbb_feed_forums
|
class: phpbb\feed\forums
|
||||||
scope: prototype
|
scope: prototype
|
||||||
arguments:
|
arguments:
|
||||||
- @feed.helper
|
- @feed.helper
|
||||||
|
@ -40,7 +40,7 @@ services:
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
|
|
||||||
feed.news:
|
feed.news:
|
||||||
class: phpbb_feed_news
|
class: phpbb\feed\news
|
||||||
scope: prototype
|
scope: prototype
|
||||||
arguments:
|
arguments:
|
||||||
- @feed.helper
|
- @feed.helper
|
||||||
|
@ -53,7 +53,7 @@ services:
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
|
|
||||||
feed.overall:
|
feed.overall:
|
||||||
class: phpbb_feed_overall
|
class: phpbb\feed\overall
|
||||||
scope: prototype
|
scope: prototype
|
||||||
arguments:
|
arguments:
|
||||||
- @feed.helper
|
- @feed.helper
|
||||||
|
@ -66,7 +66,7 @@ services:
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
|
|
||||||
feed.topic:
|
feed.topic:
|
||||||
class: phpbb_feed_topic
|
class: phpbb\feed\topic
|
||||||
scope: prototype
|
scope: prototype
|
||||||
arguments:
|
arguments:
|
||||||
- @feed.helper
|
- @feed.helper
|
||||||
|
@ -79,7 +79,7 @@ services:
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
|
|
||||||
feed.topics:
|
feed.topics:
|
||||||
class: phpbb_feed_topics
|
class: phpbb\feed\topics
|
||||||
scope: prototype
|
scope: prototype
|
||||||
arguments:
|
arguments:
|
||||||
- @feed.helper
|
- @feed.helper
|
||||||
|
@ -92,7 +92,7 @@ services:
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
|
|
||||||
feed.topics_active:
|
feed.topics_active:
|
||||||
class: phpbb_feed_topics_active
|
class: phpbb\feed\topics_active
|
||||||
scope: prototype
|
scope: prototype
|
||||||
arguments:
|
arguments:
|
||||||
- @feed.helper
|
- @feed.helper
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
services:
|
services:
|
||||||
migrator:
|
migrator:
|
||||||
class: phpbb_db_migrator
|
class: phpbb\db\migrator
|
||||||
arguments:
|
arguments:
|
||||||
- @config
|
- @config
|
||||||
- @dbal.conn
|
- @dbal.conn
|
||||||
|
@ -12,21 +12,21 @@ services:
|
||||||
- @migrator.tool_collection
|
- @migrator.tool_collection
|
||||||
|
|
||||||
migrator.tool_collection:
|
migrator.tool_collection:
|
||||||
class: phpbb_di_service_collection
|
class: phpbb\di\service_collection
|
||||||
arguments:
|
arguments:
|
||||||
- @service_container
|
- @service_container
|
||||||
tags:
|
tags:
|
||||||
- { name: service_collection, tag: migrator.tool }
|
- { name: service_collection, tag: migrator.tool }
|
||||||
|
|
||||||
migrator.tool.config:
|
migrator.tool.config:
|
||||||
class: phpbb_db_migration_tool_config
|
class: phpbb\db\migration\tool\config
|
||||||
arguments:
|
arguments:
|
||||||
- @config
|
- @config
|
||||||
tags:
|
tags:
|
||||||
- { name: migrator.tool }
|
- { name: migrator.tool }
|
||||||
|
|
||||||
migrator.tool.module:
|
migrator.tool.module:
|
||||||
class: phpbb_db_migration_tool_module
|
class: phpbb\db\migration\tool\module
|
||||||
arguments:
|
arguments:
|
||||||
- @dbal.conn
|
- @dbal.conn
|
||||||
- @cache
|
- @cache
|
||||||
|
@ -38,7 +38,7 @@ services:
|
||||||
- { name: migrator.tool }
|
- { name: migrator.tool }
|
||||||
|
|
||||||
migrator.tool.permission:
|
migrator.tool.permission:
|
||||||
class: phpbb_db_migration_tool_permission
|
class: phpbb\db\migration\tool\permission
|
||||||
arguments:
|
arguments:
|
||||||
- @dbal.conn
|
- @dbal.conn
|
||||||
- @cache
|
- @cache
|
||||||
|
|
|
@ -1,20 +1,20 @@
|
||||||
services:
|
services:
|
||||||
notification.type_collection:
|
notification.type_collection:
|
||||||
class: phpbb_di_service_collection
|
class: phpbb\di\service_collection
|
||||||
arguments:
|
arguments:
|
||||||
- @service_container
|
- @service_container
|
||||||
tags:
|
tags:
|
||||||
- { name: service_collection, tag: notification.type }
|
- { name: service_collection, tag: notification.type }
|
||||||
|
|
||||||
notification.method_collection:
|
notification.method_collection:
|
||||||
class: phpbb_di_service_collection
|
class: phpbb\di\service_collection
|
||||||
arguments:
|
arguments:
|
||||||
- @service_container
|
- @service_container
|
||||||
tags:
|
tags:
|
||||||
- { name: service_collection, tag: notification.method }
|
- { name: service_collection, tag: notification.method }
|
||||||
|
|
||||||
notification.type.approve_post:
|
notification.type.approve_post:
|
||||||
class: phpbb_notification_type_approve_post
|
class: phpbb\notification\type\approve_post
|
||||||
scope: prototype # scope MUST be prototype for this to work! # scope MUST be prototype for this to work!
|
scope: prototype # scope MUST be prototype for this to work! # scope MUST be prototype for this to work!
|
||||||
arguments:
|
arguments:
|
||||||
- @user_loader
|
- @user_loader
|
||||||
|
@ -32,7 +32,7 @@ services:
|
||||||
- { name: notification.type }
|
- { name: notification.type }
|
||||||
|
|
||||||
notification.type.approve_topic:
|
notification.type.approve_topic:
|
||||||
class: phpbb_notification_type_approve_topic
|
class: phpbb\notification\type\approve_topic
|
||||||
scope: prototype # scope MUST be prototype for this to work!
|
scope: prototype # scope MUST be prototype for this to work!
|
||||||
arguments:
|
arguments:
|
||||||
- @user_loader
|
- @user_loader
|
||||||
|
@ -50,7 +50,7 @@ services:
|
||||||
- { name: notification.type }
|
- { name: notification.type }
|
||||||
|
|
||||||
notification.type.bookmark:
|
notification.type.bookmark:
|
||||||
class: phpbb_notification_type_bookmark
|
class: phpbb\notification\type\bookmark
|
||||||
scope: prototype # scope MUST be prototype for this to work!
|
scope: prototype # scope MUST be prototype for this to work!
|
||||||
arguments:
|
arguments:
|
||||||
- @user_loader
|
- @user_loader
|
||||||
|
@ -68,7 +68,7 @@ services:
|
||||||
- { name: notification.type }
|
- { name: notification.type }
|
||||||
|
|
||||||
notification.type.disapprove_post:
|
notification.type.disapprove_post:
|
||||||
class: phpbb_notification_type_disapprove_post
|
class: phpbb\notification\type\disapprove_post
|
||||||
scope: prototype # scope MUST be prototype for this to work!
|
scope: prototype # scope MUST be prototype for this to work!
|
||||||
arguments:
|
arguments:
|
||||||
- @user_loader
|
- @user_loader
|
||||||
|
@ -86,7 +86,7 @@ services:
|
||||||
- { name: notification.type }
|
- { name: notification.type }
|
||||||
|
|
||||||
notification.type.disapprove_topic:
|
notification.type.disapprove_topic:
|
||||||
class: phpbb_notification_type_disapprove_topic
|
class: phpbb\notification\type\disapprove_topic
|
||||||
scope: prototype # scope MUST be prototype for this to work!
|
scope: prototype # scope MUST be prototype for this to work!
|
||||||
arguments:
|
arguments:
|
||||||
- @user_loader
|
- @user_loader
|
||||||
|
@ -104,7 +104,7 @@ services:
|
||||||
- { name: notification.type }
|
- { name: notification.type }
|
||||||
|
|
||||||
notification.type.group_request:
|
notification.type.group_request:
|
||||||
class: phpbb_notification_type_group_request
|
class: phpbb\notification\type\group_request
|
||||||
scope: prototype # scope MUST be prototype for this to work!
|
scope: prototype # scope MUST be prototype for this to work!
|
||||||
arguments:
|
arguments:
|
||||||
- @user_loader
|
- @user_loader
|
||||||
|
@ -122,7 +122,7 @@ services:
|
||||||
- { name: notification.type }
|
- { name: notification.type }
|
||||||
|
|
||||||
notification.type.group_request_approved:
|
notification.type.group_request_approved:
|
||||||
class: phpbb_notification_type_group_request_approved
|
class: phpbb\notification\type\group_request_approved
|
||||||
scope: prototype # scope MUST be prototype for this to work!
|
scope: prototype # scope MUST be prototype for this to work!
|
||||||
arguments:
|
arguments:
|
||||||
- @user_loader
|
- @user_loader
|
||||||
|
@ -140,7 +140,7 @@ services:
|
||||||
- { name: notification.type }
|
- { name: notification.type }
|
||||||
|
|
||||||
notification.type.pm:
|
notification.type.pm:
|
||||||
class: phpbb_notification_type_pm
|
class: phpbb\notification\type\pm
|
||||||
scope: prototype # scope MUST be prototype for this to work!
|
scope: prototype # scope MUST be prototype for this to work!
|
||||||
arguments:
|
arguments:
|
||||||
- @user_loader
|
- @user_loader
|
||||||
|
@ -158,7 +158,7 @@ services:
|
||||||
- { name: notification.type }
|
- { name: notification.type }
|
||||||
|
|
||||||
notification.type.post:
|
notification.type.post:
|
||||||
class: phpbb_notification_type_post
|
class: phpbb\notification\type\post
|
||||||
scope: prototype # scope MUST be prototype for this to work!
|
scope: prototype # scope MUST be prototype for this to work!
|
||||||
arguments:
|
arguments:
|
||||||
- @user_loader
|
- @user_loader
|
||||||
|
@ -176,7 +176,7 @@ services:
|
||||||
- { name: notification.type }
|
- { name: notification.type }
|
||||||
|
|
||||||
notification.type.post_in_queue:
|
notification.type.post_in_queue:
|
||||||
class: phpbb_notification_type_post_in_queue
|
class: phpbb\notification\type\post_in_queue
|
||||||
scope: prototype # scope MUST be prototype for this to work!
|
scope: prototype # scope MUST be prototype for this to work!
|
||||||
arguments:
|
arguments:
|
||||||
- @user_loader
|
- @user_loader
|
||||||
|
@ -194,7 +194,7 @@ services:
|
||||||
- { name: notification.type }
|
- { name: notification.type }
|
||||||
|
|
||||||
notification.type.quote:
|
notification.type.quote:
|
||||||
class: phpbb_notification_type_quote
|
class: phpbb\notification\type\quote
|
||||||
scope: prototype # scope MUST be prototype for this to work!
|
scope: prototype # scope MUST be prototype for this to work!
|
||||||
arguments:
|
arguments:
|
||||||
- @user_loader
|
- @user_loader
|
||||||
|
@ -212,7 +212,7 @@ services:
|
||||||
- { name: notification.type }
|
- { name: notification.type }
|
||||||
|
|
||||||
notification.type.report_pm:
|
notification.type.report_pm:
|
||||||
class: phpbb_notification_type_report_pm
|
class: phpbb\notification\type\report_pm
|
||||||
scope: prototype # scope MUST be prototype for this to work!
|
scope: prototype # scope MUST be prototype for this to work!
|
||||||
arguments:
|
arguments:
|
||||||
- @user_loader
|
- @user_loader
|
||||||
|
@ -230,7 +230,7 @@ services:
|
||||||
- { name: notification.type }
|
- { name: notification.type }
|
||||||
|
|
||||||
notification.type.report_pm_closed:
|
notification.type.report_pm_closed:
|
||||||
class: phpbb_notification_type_report_pm_closed
|
class: phpbb\notification\type\report_pm_closed
|
||||||
scope: prototype # scope MUST be prototype for this to work!
|
scope: prototype # scope MUST be prototype for this to work!
|
||||||
arguments:
|
arguments:
|
||||||
- @user_loader
|
- @user_loader
|
||||||
|
@ -248,7 +248,7 @@ services:
|
||||||
- { name: notification.type }
|
- { name: notification.type }
|
||||||
|
|
||||||
notification.type.report_post:
|
notification.type.report_post:
|
||||||
class: phpbb_notification_type_report_post
|
class: phpbb\notification\type\report_post
|
||||||
scope: prototype # scope MUST be prototype for this to work!
|
scope: prototype # scope MUST be prototype for this to work!
|
||||||
arguments:
|
arguments:
|
||||||
- @user_loader
|
- @user_loader
|
||||||
|
@ -266,7 +266,7 @@ services:
|
||||||
- { name: notification.type }
|
- { name: notification.type }
|
||||||
|
|
||||||
notification.type.report_post_closed:
|
notification.type.report_post_closed:
|
||||||
class: phpbb_notification_type_report_post
|
class: phpbb\notification\type\report_post
|
||||||
scope: prototype # scope MUST be prototype for this to work!
|
scope: prototype # scope MUST be prototype for this to work!
|
||||||
arguments:
|
arguments:
|
||||||
- @user_loader
|
- @user_loader
|
||||||
|
@ -284,7 +284,7 @@ services:
|
||||||
- { name: notification.type }
|
- { name: notification.type }
|
||||||
|
|
||||||
notification.type.topic:
|
notification.type.topic:
|
||||||
class: phpbb_notification_type_topic
|
class: phpbb\notification\type\topic
|
||||||
scope: prototype # scope MUST be prototype for this to work!
|
scope: prototype # scope MUST be prototype for this to work!
|
||||||
arguments:
|
arguments:
|
||||||
- @user_loader
|
- @user_loader
|
||||||
|
@ -302,7 +302,7 @@ services:
|
||||||
- { name: notification.type }
|
- { name: notification.type }
|
||||||
|
|
||||||
notification.type.topic_in_queue:
|
notification.type.topic_in_queue:
|
||||||
class: phpbb_notification_type_topic_in_queue
|
class: phpbb\notification\type\topic_in_queue
|
||||||
scope: prototype # scope MUST be prototype for this to work!
|
scope: prototype # scope MUST be prototype for this to work!
|
||||||
arguments:
|
arguments:
|
||||||
- @user_loader
|
- @user_loader
|
||||||
|
@ -320,7 +320,7 @@ services:
|
||||||
- { name: notification.type }
|
- { name: notification.type }
|
||||||
|
|
||||||
notification.method.email:
|
notification.method.email:
|
||||||
class: phpbb_notification_method_email
|
class: phpbb\notification\method\email
|
||||||
scope: prototype # scope MUST be prototype for this to work!
|
scope: prototype # scope MUST be prototype for this to work!
|
||||||
arguments:
|
arguments:
|
||||||
- @user_loader
|
- @user_loader
|
||||||
|
@ -335,7 +335,7 @@ services:
|
||||||
- { name: notification.method }
|
- { name: notification.method }
|
||||||
|
|
||||||
notification.method.jabber:
|
notification.method.jabber:
|
||||||
class: phpbb_notification_method_jabber
|
class: phpbb\notification\method\jabber
|
||||||
scope: prototype # scope MUST be prototype for this to work!
|
scope: prototype # scope MUST be prototype for this to work!
|
||||||
arguments:
|
arguments:
|
||||||
- @user_loader
|
- @user_loader
|
||||||
|
|
|
@ -9,23 +9,23 @@ imports:
|
||||||
|
|
||||||
services:
|
services:
|
||||||
acl.permissions:
|
acl.permissions:
|
||||||
class: phpbb_permissions
|
class: phpbb\permissions
|
||||||
arguments:
|
arguments:
|
||||||
- @dispatcher
|
- @dispatcher
|
||||||
- @user
|
- @user
|
||||||
|
|
||||||
auth:
|
auth:
|
||||||
class: phpbb_auth
|
class: phpbb\auth\auth
|
||||||
|
|
||||||
avatar.manager:
|
avatar.manager:
|
||||||
class: phpbb_avatar_manager
|
class: phpbb\avatar\manager
|
||||||
arguments:
|
arguments:
|
||||||
- @config
|
- @config
|
||||||
- @avatar.driver_collection
|
- @avatar.driver_collection
|
||||||
- @service_container
|
- @service_container
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
class: phpbb_cache_service
|
class: phpbb\cache\service
|
||||||
arguments:
|
arguments:
|
||||||
- @cache.driver
|
- @cache.driver
|
||||||
- @config
|
- @config
|
||||||
|
@ -37,12 +37,12 @@ services:
|
||||||
class: %cache.driver.class%
|
class: %cache.driver.class%
|
||||||
|
|
||||||
cache.driver.install:
|
cache.driver.install:
|
||||||
class: phpbb_cache_driver_file
|
class: phpbb\cache\driver\file
|
||||||
|
|
||||||
class_loader:
|
class_loader:
|
||||||
class: phpbb_class_loader
|
class: phpbb\class_loader
|
||||||
arguments:
|
arguments:
|
||||||
- phpbb_
|
- phpbb\
|
||||||
- %core.root_path%includes/
|
- %core.root_path%includes/
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
calls:
|
calls:
|
||||||
|
@ -50,9 +50,9 @@ services:
|
||||||
- [set_cache, [@cache.driver]]
|
- [set_cache, [@cache.driver]]
|
||||||
|
|
||||||
class_loader.ext:
|
class_loader.ext:
|
||||||
class: phpbb_class_loader
|
class: phpbb\class_loader
|
||||||
arguments:
|
arguments:
|
||||||
- phpbb_ext_
|
- \
|
||||||
- %core.root_path%ext/
|
- %core.root_path%ext/
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
calls:
|
calls:
|
||||||
|
@ -60,20 +60,20 @@ services:
|
||||||
- [set_cache, [@cache.driver]]
|
- [set_cache, [@cache.driver]]
|
||||||
|
|
||||||
config:
|
config:
|
||||||
class: phpbb_config_db
|
class: phpbb\config\db
|
||||||
arguments:
|
arguments:
|
||||||
- @dbal.conn
|
- @dbal.conn
|
||||||
- @cache.driver
|
- @cache.driver
|
||||||
- %tables.config%
|
- %tables.config%
|
||||||
|
|
||||||
config_text:
|
config_text:
|
||||||
class: phpbb_config_db_text
|
class: phpbb\config\db_text
|
||||||
arguments:
|
arguments:
|
||||||
- @dbal.conn
|
- @dbal.conn
|
||||||
- %tables.config_text%
|
- %tables.config_text%
|
||||||
|
|
||||||
content.visibility:
|
content.visibility:
|
||||||
class: phpbb_content_visibility
|
class: phpbb\content_visibility
|
||||||
arguments:
|
arguments:
|
||||||
- @auth
|
- @auth
|
||||||
- @dbal.conn
|
- @dbal.conn
|
||||||
|
@ -86,7 +86,7 @@ services:
|
||||||
- %tables.users%
|
- %tables.users%
|
||||||
|
|
||||||
controller.helper:
|
controller.helper:
|
||||||
class: phpbb_controller_helper
|
class: phpbb\controller\helper
|
||||||
arguments:
|
arguments:
|
||||||
- @template
|
- @template
|
||||||
- @user
|
- @user
|
||||||
|
@ -95,35 +95,35 @@ services:
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
|
|
||||||
controller.resolver:
|
controller.resolver:
|
||||||
class: phpbb_controller_resolver
|
class: phpbb\controller\resolver
|
||||||
arguments:
|
arguments:
|
||||||
- @user
|
- @user
|
||||||
- @service_container
|
- @service_container
|
||||||
- @template
|
- @template
|
||||||
|
|
||||||
cron.task_collection:
|
cron.task_collection:
|
||||||
class: phpbb_di_service_collection
|
class: phpbb\di\service_collection
|
||||||
arguments:
|
arguments:
|
||||||
- @service_container
|
- @service_container
|
||||||
tags:
|
tags:
|
||||||
- { name: service_collection, tag: cron.task }
|
- { name: service_collection, tag: cron.task }
|
||||||
|
|
||||||
cron.manager:
|
cron.manager:
|
||||||
class: phpbb_cron_manager
|
class: phpbb\cron\manager
|
||||||
arguments:
|
arguments:
|
||||||
- @cron.task_collection
|
- @cron.task_collection
|
||||||
- %core.root_path%
|
- %core.root_path%
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
|
|
||||||
cron.lock_db:
|
cron.lock_db:
|
||||||
class: phpbb_lock_db
|
class: phpbb\lock\db
|
||||||
arguments:
|
arguments:
|
||||||
- cron_lock
|
- cron_lock
|
||||||
- @config
|
- @config
|
||||||
- @dbal.conn
|
- @dbal.conn
|
||||||
|
|
||||||
dispatcher:
|
dispatcher:
|
||||||
class: phpbb_event_dispatcher
|
class: phpbb\event\dispatcher
|
||||||
arguments:
|
arguments:
|
||||||
- @service_container
|
- @service_container
|
||||||
|
|
||||||
|
@ -133,12 +133,12 @@ services:
|
||||||
- [sql_connect, [%dbal.dbhost%, %dbal.dbuser%, %dbal.dbpasswd%, %dbal.dbname%, %dbal.dbport%, false, %dbal.new_link%]]
|
- [sql_connect, [%dbal.dbhost%, %dbal.dbuser%, %dbal.dbpasswd%, %dbal.dbname%, %dbal.dbport%, false, %dbal.new_link%]]
|
||||||
|
|
||||||
dbal.tools:
|
dbal.tools:
|
||||||
class: phpbb_db_tools
|
class: phpbb\db\tools
|
||||||
arguments:
|
arguments:
|
||||||
- @dbal.conn
|
- @dbal.conn
|
||||||
|
|
||||||
event.subscriber_loader:
|
event.subscriber_loader:
|
||||||
class: phpbb_event_extension_subscriber_loader
|
class: phpbb\event\extension_subscriber_loader
|
||||||
arguments:
|
arguments:
|
||||||
- @dispatcher
|
- @dispatcher
|
||||||
- @ext.manager
|
- @ext.manager
|
||||||
|
@ -146,7 +146,7 @@ services:
|
||||||
- [load, []]
|
- [load, []]
|
||||||
|
|
||||||
ext.manager:
|
ext.manager:
|
||||||
class: phpbb_extension_manager
|
class: phpbb\extension\manager
|
||||||
arguments:
|
arguments:
|
||||||
- @service_container
|
- @service_container
|
||||||
- @dbal.conn
|
- @dbal.conn
|
||||||
|
@ -158,7 +158,7 @@ services:
|
||||||
- @cache.driver
|
- @cache.driver
|
||||||
|
|
||||||
ext.finder:
|
ext.finder:
|
||||||
class: phpbb_extension_finder
|
class: phpbb\extension\finder
|
||||||
arguments:
|
arguments:
|
||||||
- @ext.manager
|
- @ext.manager
|
||||||
- @filesystem
|
- @filesystem
|
||||||
|
@ -168,7 +168,7 @@ services:
|
||||||
- _ext_finder
|
- _ext_finder
|
||||||
|
|
||||||
filesystem:
|
filesystem:
|
||||||
class: phpbb_filesystem
|
class: phpbb\filesystem
|
||||||
arguments:
|
arguments:
|
||||||
- @symfony_request
|
- @symfony_request
|
||||||
- %core.root_path%
|
- %core.root_path%
|
||||||
|
@ -176,13 +176,13 @@ services:
|
||||||
- %core.adm_relative_path%
|
- %core.adm_relative_path%
|
||||||
|
|
||||||
groupposition.legend:
|
groupposition.legend:
|
||||||
class: phpbb_groupposition_legend
|
class: phpbb\groupposition\legend
|
||||||
arguments:
|
arguments:
|
||||||
- @dbal.conn
|
- @dbal.conn
|
||||||
- @user
|
- @user
|
||||||
|
|
||||||
groupposition.teampage:
|
groupposition.teampage:
|
||||||
class: phpbb_groupposition_teampage
|
class: phpbb\groupposition\teampage
|
||||||
arguments:
|
arguments:
|
||||||
- @dbal.conn
|
- @dbal.conn
|
||||||
- @user
|
- @user
|
||||||
|
@ -195,14 +195,14 @@ services:
|
||||||
- @controller.resolver
|
- @controller.resolver
|
||||||
|
|
||||||
hook_finder:
|
hook_finder:
|
||||||
class: phpbb_hook_finder
|
class: phpbb\hook\finder
|
||||||
arguments:
|
arguments:
|
||||||
- %core.root_path%
|
- %core.root_path%
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
- @cache.driver
|
- @cache.driver
|
||||||
|
|
||||||
kernel_request_subscriber:
|
kernel_request_subscriber:
|
||||||
class: phpbb_event_kernel_request_subscriber
|
class: phpbb\event\kernel_request_subscriber
|
||||||
arguments:
|
arguments:
|
||||||
- @ext.finder
|
- @ext.finder
|
||||||
- %core.root_path%
|
- %core.root_path%
|
||||||
|
@ -211,7 +211,7 @@ services:
|
||||||
- { name: kernel.event_subscriber }
|
- { name: kernel.event_subscriber }
|
||||||
|
|
||||||
kernel_exception_subscriber:
|
kernel_exception_subscriber:
|
||||||
class: phpbb_event_kernel_exception_subscriber
|
class: phpbb\event\kernel_exception_subscriber
|
||||||
arguments:
|
arguments:
|
||||||
- @template
|
- @template
|
||||||
- @user
|
- @user
|
||||||
|
@ -219,12 +219,12 @@ services:
|
||||||
- { name: kernel.event_subscriber }
|
- { name: kernel.event_subscriber }
|
||||||
|
|
||||||
kernel_terminate_subscriber:
|
kernel_terminate_subscriber:
|
||||||
class: phpbb_event_kernel_terminate_subscriber
|
class: phpbb\event\kernel_terminate_subscriber
|
||||||
tags:
|
tags:
|
||||||
- { name: kernel.event_subscriber }
|
- { name: kernel.event_subscriber }
|
||||||
|
|
||||||
log:
|
log:
|
||||||
class: phpbb_log
|
class: phpbb\log\log
|
||||||
arguments:
|
arguments:
|
||||||
- @dbal.conn
|
- @dbal.conn
|
||||||
- @user
|
- @user
|
||||||
|
@ -236,7 +236,7 @@ services:
|
||||||
- %tables.log%
|
- %tables.log%
|
||||||
|
|
||||||
notification_manager:
|
notification_manager:
|
||||||
class: phpbb_notification_manager
|
class: phpbb\notification\manager
|
||||||
arguments:
|
arguments:
|
||||||
- @notification.type_collection
|
- @notification.type_collection
|
||||||
- @notification.method_collection
|
- @notification.method_collection
|
||||||
|
@ -252,18 +252,18 @@ services:
|
||||||
- %tables.user_notifications%
|
- %tables.user_notifications%
|
||||||
|
|
||||||
php_ini:
|
php_ini:
|
||||||
class: phpbb_php_ini
|
class: phpbb\php\ini
|
||||||
|
|
||||||
request:
|
request:
|
||||||
class: phpbb_request
|
class: phpbb\request\request
|
||||||
|
|
||||||
symfony_request:
|
symfony_request:
|
||||||
class: phpbb_symfony_request
|
class: phpbb\symfony_request
|
||||||
arguments:
|
arguments:
|
||||||
- @request
|
- @request
|
||||||
|
|
||||||
template:
|
template:
|
||||||
class: phpbb_template_twig
|
class: phpbb\template\twig\twig
|
||||||
arguments:
|
arguments:
|
||||||
- @filesystem
|
- @filesystem
|
||||||
- @config
|
- @config
|
||||||
|
@ -272,13 +272,13 @@ services:
|
||||||
- @ext.manager
|
- @ext.manager
|
||||||
|
|
||||||
template_context:
|
template_context:
|
||||||
class: phpbb_template_context
|
class: phpbb\template\context
|
||||||
|
|
||||||
user:
|
user:
|
||||||
class: phpbb_user
|
class: phpbb\user
|
||||||
|
|
||||||
user_loader:
|
user_loader:
|
||||||
class: phpbb_user_loader
|
class: phpbb\user_loader
|
||||||
arguments:
|
arguments:
|
||||||
- @dbal.conn
|
- @dbal.conn
|
||||||
- %core.root_path%
|
- %core.root_path%
|
||||||
|
|
189
phpBB/develop/namespacify.php
Normal file
189
phpBB/develop/namespacify.php
Normal file
|
@ -0,0 +1,189 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @copyright (c) 2012 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
//
|
||||||
|
// Security message:
|
||||||
|
//
|
||||||
|
// This script is potentially dangerous.
|
||||||
|
// Remove or comment the next line (die(".... ) to enable this script.
|
||||||
|
// Do NOT FORGET to either remove this script or disable it after you have used it.
|
||||||
|
//
|
||||||
|
die("Please read the first lines of this script for instructions on how to enable it");
|
||||||
|
|
||||||
|
$namespace_dir = realpath(__DIR__ . '/../phpbb/');
|
||||||
|
$code_dir = realpath(__DIR__ . '/../');
|
||||||
|
$test_dir = realpath(__DIR__ . '/../../tests/');
|
||||||
|
$config_dir = realpath(__DIR__ . '/../config/');
|
||||||
|
|
||||||
|
function map_class_name($old_class_name, $code_dir)
|
||||||
|
{
|
||||||
|
$parts = explode('_', $old_class_name);
|
||||||
|
$cur_dir = array();
|
||||||
|
$cur_name = array();
|
||||||
|
$in_name = false;
|
||||||
|
foreach ($parts as $i => $part)
|
||||||
|
{
|
||||||
|
if (empty($part))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$in_name)
|
||||||
|
{
|
||||||
|
$new_dir = array_merge($cur_dir, array($part));
|
||||||
|
$path = $code_dir . '/' . implode('/', $new_dir);
|
||||||
|
|
||||||
|
if (file_exists($path) && is_dir($path))
|
||||||
|
{
|
||||||
|
$cur_dir = $new_dir;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$in_name = true;
|
||||||
|
$cur_name[] = $part;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$cur_name[] = $part;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($cur_name) && !empty($cur_dir))
|
||||||
|
{
|
||||||
|
$cur_name[] = $cur_dir[count($cur_dir) - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file_exists($code_dir . '/' . implode('/', $cur_dir) . '/' . implode('_', $cur_name) . '.php'))
|
||||||
|
{
|
||||||
|
return implode('\\', $cur_dir) . '\\' . implode('_', $cur_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$iterator = new \AppendIterator();
|
||||||
|
$iterator->append(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($code_dir)));
|
||||||
|
$iterator->append(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($test_dir)));
|
||||||
|
$iterator->append(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($config_dir)));
|
||||||
|
|
||||||
|
foreach ($iterator as $file)
|
||||||
|
{
|
||||||
|
if (substr($file->getPath(), 0, 6) === 'vendor')
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($file->getExtension() == 'php')
|
||||||
|
{
|
||||||
|
$code = file_get_contents($file->getPathname());
|
||||||
|
$namespaced_file = false;
|
||||||
|
|
||||||
|
if (preg_match('#^' . preg_quote($namespace_dir, '#') . '#', $file->getPath()))
|
||||||
|
{
|
||||||
|
if (preg_match('#^(?:interface|(?:abstract )?class) (phpbb_[a-z0-9_]+)#m', $code, $matches))
|
||||||
|
{
|
||||||
|
$old_class_name = $matches[1];
|
||||||
|
$dirs = explode(DIRECTORY_SEPARATOR, preg_replace('#^' . preg_quote(dirname($namespace_dir) . DIRECTORY_SEPARATOR, '#') . '#', '', $file->getPath()));
|
||||||
|
|
||||||
|
$namespace = implode('\\', $dirs);
|
||||||
|
|
||||||
|
if ($dirs[count($dirs) - 1] == substr($file->getFilename(), 0, -4))
|
||||||
|
{
|
||||||
|
$class_name = preg_replace('#^' . preg_quote(implode('_', $dirs), '#') . '#', $dirs[count($dirs) - 1], $old_class_name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$class_name = preg_replace('#^' . preg_quote(implode('_', $dirs), '#') . '_#', '', $old_class_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
$code = preg_replace("#^\*/$#m", "*/\n\nnamespace $namespace;", $code, 1, $count);
|
||||||
|
if ($count != 1)
|
||||||
|
{
|
||||||
|
die("Incorrect replacement count for namespace of $old_class_name");
|
||||||
|
}
|
||||||
|
$code = preg_replace("#^(interface|(?:abstract )?class) $old_class_name#m", "\\1 $class_name", $code, -1, $count);
|
||||||
|
if ($count != 1)
|
||||||
|
{
|
||||||
|
die("Incorrect replacement count for $old_class_name");
|
||||||
|
}
|
||||||
|
|
||||||
|
$namespaced_file = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (preg_match_all('#[^a-z0-9_$](phpbb_[a-z0-9_]+)#', $code, $matches))
|
||||||
|
{
|
||||||
|
foreach ($matches[1] as $old_class_name)
|
||||||
|
{
|
||||||
|
$class_name = map_class_name($old_class_name, $code_dir);
|
||||||
|
if ($class_name)
|
||||||
|
{
|
||||||
|
$code = preg_replace("#([^a-z0-9_\$>])$old_class_name([^a-z0-9_])#", '\\1\\\\' . $class_name . '\\2', $code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($namespaced_file)
|
||||||
|
{
|
||||||
|
$code = preg_replace('#new ([a-zA-Z0-9_][a-zA-Z0-9_\\\\]+)#', 'new \\\\\\1', $code);
|
||||||
|
$code = preg_replace('#([^a-zA-Z0-9_\\\\$])([a-zA-Z0-9_][a-zA-Z0-9_\\\\]+)::#', '\\1\\\\\\2::', $code);
|
||||||
|
$code = preg_replace('#catch \(([a-zA-Z0-9_][a-zA-Z0-9_\\\\]+)#', 'catch (\\\\\\1', $code);
|
||||||
|
$code = preg_replace('#(\(|, )([a-zA-Z0-9_][a-zA-Z0-9_\\\\]+)(\s\$)#', '\\1\\\\\\2\\3', $code);
|
||||||
|
$code = preg_replace('#(implements |extends )([a-zA-Z0-9_][a-zA-Z0-9_\\\\]+)(?=\s*(?:,|\n))#', '\\1\\\\\\2', $code);
|
||||||
|
$abs_classes = array(
|
||||||
|
'Countable',
|
||||||
|
'IteratorAggregate',
|
||||||
|
'ArrayAccess',
|
||||||
|
);
|
||||||
|
$code = preg_replace('#(\s+)(' . implode('|', $abs_classes) . ')#', '\\1\\\\\\2', $code);
|
||||||
|
$rel_classes = array(
|
||||||
|
'ContainerBuilder',
|
||||||
|
'YamlFileLoader',
|
||||||
|
'FileLocator',
|
||||||
|
'Extension',
|
||||||
|
'CompilerPassInterface',
|
||||||
|
'EventSubscriberInterface',
|
||||||
|
'EventDispatcherInterface',
|
||||||
|
'ContainerAwareEventDispatcher',
|
||||||
|
'ContainerInterface',
|
||||||
|
'KernelEvents',
|
||||||
|
'RouteCollection',
|
||||||
|
'ControllerResolverInterface',
|
||||||
|
'Request',
|
||||||
|
'include',
|
||||||
|
'array',
|
||||||
|
'parent',
|
||||||
|
'self',
|
||||||
|
);
|
||||||
|
$code = preg_replace('#([^a-zA-Z0-9_])\\\\((?:' . implode('|', $rel_classes) . ')(?:\s|\(|::|;))#', '\\1\\2', $code);
|
||||||
|
}
|
||||||
|
|
||||||
|
file_put_contents($file->getPathname(), $code);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($file->getExtension() == 'yml')
|
||||||
|
{
|
||||||
|
$code = file_get_contents($file->getPathname());
|
||||||
|
|
||||||
|
if (preg_match_all('#\s*class:\s*(phpbb_[a-z0-9_]+)\s+#', $code, $matches))
|
||||||
|
{
|
||||||
|
foreach ($matches[1] as $old_class_name)
|
||||||
|
{
|
||||||
|
$class_name = map_class_name($old_class_name, $code_dir);
|
||||||
|
if ($class_name)
|
||||||
|
{
|
||||||
|
$code = preg_replace("#(\s*class:\s*)$old_class_name(\s+)#", "\\1$class_name\\2", $code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
file_put_contents($file->getPathname(), $code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
51
phpBB/develop/rename_interfaces.php
Normal file
51
phpBB/develop/rename_interfaces.php
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @copyright (c) 2012 phpBB Group
|
||||||
|
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
//
|
||||||
|
// Security message:
|
||||||
|
//
|
||||||
|
// This script is potentially dangerous.
|
||||||
|
// Remove or comment the next line (die(".... ) to enable this script.
|
||||||
|
// Do NOT FORGET to either remove this script or disable it after you have used it.
|
||||||
|
//
|
||||||
|
die("Please read the first lines of this script for instructions on how to enable it");
|
||||||
|
|
||||||
|
$code_dir = realpath(__DIR__ . '/../');
|
||||||
|
$test_dir = realpath(__DIR__ . '/../../tests/');
|
||||||
|
$iterator = new \AppendIterator();
|
||||||
|
$iterator->append(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($code_dir)));
|
||||||
|
$iterator->append(new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($test_dir)));
|
||||||
|
|
||||||
|
$map = array(
|
||||||
|
'phpbb\request\request_interface' => 'phpbb\request\request_interface',
|
||||||
|
'phpbb\auth\provider\provider_interface' => 'phpbb\auth\provider\provider_interface',
|
||||||
|
'phpbb\avatar\driver\driver_interface' => 'phpbb\avatar\driver\driver_interface',
|
||||||
|
'phpbb\cache\driver\driver_interface' => 'phpbb\cache\driver\driver_interface',
|
||||||
|
'phpbb\db\migration\tool\tool_interface' => 'phpbb\db\migration\tool\tool_interface',
|
||||||
|
'phpbb\extension\extension_interface' => 'phpbb\extension\extension_interface',
|
||||||
|
'phpbb\groupposition\groupposition_interface' => 'phpbb\groupposition\groupposition_interface',
|
||||||
|
'phpbb\log\log_interface' => 'phpbb\log\log_interface',
|
||||||
|
'phpbb\notification\method\method_interface' => 'phpbb\notification\method\method_interface',
|
||||||
|
'phpbb\notification\type\type_interface' => 'phpbb\notification\type\type_interface',
|
||||||
|
'phpbb\request\request_interface' => 'phpbb\request\request_interface',
|
||||||
|
'phpbb\tree\tree_interface' => 'phpbb\tree\tree_interface',
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ($iterator as $file)
|
||||||
|
{
|
||||||
|
if ($file->getExtension() == 'php')
|
||||||
|
{
|
||||||
|
$code = file_get_contents($file->getPathname());
|
||||||
|
|
||||||
|
foreach ($map as $orig => $new)
|
||||||
|
{
|
||||||
|
$code = preg_replace("#([^a-z0-9_\$])$orig([^a-z0-9_])#i", '\\1' . $new . '\\2', $code);
|
||||||
|
}
|
||||||
|
file_put_contents($file->getPathname(), $code);
|
||||||
|
}
|
||||||
|
}
|
|
@ -50,9 +50,9 @@ if (isset($_GET['avatar']))
|
||||||
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
|
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
|
||||||
|
|
||||||
// Setup class loader first
|
// Setup class loader first
|
||||||
$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}phpbb/", $phpEx);
|
$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx);
|
||||||
$phpbb_class_loader->register();
|
$phpbb_class_loader->register();
|
||||||
$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", $phpEx);
|
$phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx);
|
||||||
$phpbb_class_loader_ext->register();
|
$phpbb_class_loader_ext->register();
|
||||||
|
|
||||||
// Set up container
|
// Set up container
|
||||||
|
|
|
@ -1472,7 +1472,7 @@ class acp_attachments
|
||||||
$ip_list = array_unique(explode("\n", $ips));
|
$ip_list = array_unique(explode("\n", $ips));
|
||||||
$ip_list_log = implode(', ', $ip_list);
|
$ip_list_log = implode(', ', $ip_list);
|
||||||
|
|
||||||
$ip_exclude = (int) $request->variable('ipexclude', false, false, phpbb_request_interface::POST);
|
$ip_exclude = (int) $request->variable('ipexclude', false, false, \phpbb\request\request_interface::POST);
|
||||||
|
|
||||||
$iplist = array();
|
$iplist = array();
|
||||||
$hostlist = array();
|
$hostlist = array();
|
||||||
|
|
|
@ -275,7 +275,7 @@ class acp_bbcodes
|
||||||
|
|
||||||
if ($request->is_ajax())
|
if ($request->is_ajax())
|
||||||
{
|
{
|
||||||
$json_response = new phpbb_json_response;
|
$json_response = new \phpbb\json_response;
|
||||||
$json_response->send(array(
|
$json_response->send(array(
|
||||||
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
|
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
|
||||||
'MESSAGE_TEXT' => $user->lang['BBCODE_DELETED'],
|
'MESSAGE_TEXT' => $user->lang['BBCODE_DELETED'],
|
||||||
|
|
|
@ -688,7 +688,7 @@ class acp_board
|
||||||
|
|
||||||
foreach ($auth_providers as $key => $value)
|
foreach ($auth_providers as $key => $value)
|
||||||
{
|
{
|
||||||
if (!($value instanceof phpbb_auth_provider_interface))
|
if (!($value instanceof \phpbb\auth\provider\provider_interface))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -355,7 +355,7 @@ class acp_bots
|
||||||
|
|
||||||
if ($request->is_ajax() && ($action == 'activate' || $action == 'deactivate'))
|
if ($request->is_ajax() && ($action == 'activate' || $action == 'deactivate'))
|
||||||
{
|
{
|
||||||
$json_response = new phpbb_json_response;
|
$json_response = new \phpbb\json_response;
|
||||||
$json_response->send(array(
|
$json_response->send(array(
|
||||||
'text' => $user->lang['BOT_' . (($action == 'activate') ? 'DE' : '') . 'ACTIVATE'],
|
'text' => $user->lang['BOT_' . (($action == 'activate') ? 'DE' : '') . 'ACTIVATE'],
|
||||||
));
|
));
|
||||||
|
|
|
@ -28,7 +28,7 @@ class acp_database
|
||||||
global $cache, $db, $user, $auth, $template, $table_prefix;
|
global $cache, $db, $user, $auth, $template, $table_prefix;
|
||||||
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
|
||||||
|
|
||||||
$this->db_tools = new phpbb_db_tools($db);
|
$this->db_tools = new \phpbb\db\tools($db);
|
||||||
|
|
||||||
$user->add_lang('acp/database');
|
$user->add_lang('acp/database');
|
||||||
|
|
||||||
|
|
|
@ -58,13 +58,13 @@ class acp_extensions
|
||||||
// If they've specified an extension, let's load the metadata manager and validate it.
|
// If they've specified an extension, let's load the metadata manager and validate it.
|
||||||
if ($ext_name)
|
if ($ext_name)
|
||||||
{
|
{
|
||||||
$md_manager = new phpbb_extension_metadata_manager($ext_name, $config, $phpbb_extension_manager, $template, $phpbb_root_path);
|
$md_manager = new \phpbb\extension\metadata_manager($ext_name, $config, $phpbb_extension_manager, $template, $phpbb_root_path);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$md_manager->get_metadata('all');
|
$md_manager->get_metadata('all');
|
||||||
}
|
}
|
||||||
catch(phpbb_extension_exception $e)
|
catch(\phpbb\extension\exception $e)
|
||||||
{
|
{
|
||||||
trigger_error($e);
|
trigger_error($e);
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ class acp_extensions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (phpbb_db_migration_exception $e)
|
catch (\phpbb\db\migration\exception $e)
|
||||||
{
|
{
|
||||||
$template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($user));
|
$template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($user));
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ class acp_extensions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (phpbb_db_migration_exception $e)
|
catch (\phpbb\db\migration\exception $e)
|
||||||
{
|
{
|
||||||
$template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($user));
|
$template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($user));
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,7 @@ class acp_extensions
|
||||||
* @param $phpbb_extension_manager An instance of the extension manager
|
* @param $phpbb_extension_manager An instance of the extension manager
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
public function list_enabled_exts(phpbb_extension_manager $phpbb_extension_manager)
|
public function list_enabled_exts(\phpbb\extension\manager $phpbb_extension_manager)
|
||||||
{
|
{
|
||||||
foreach ($phpbb_extension_manager->all_enabled() as $name => $location)
|
foreach ($phpbb_extension_manager->all_enabled() as $name => $location)
|
||||||
{
|
{
|
||||||
|
@ -236,7 +236,7 @@ class acp_extensions
|
||||||
'PURGE' => $this->u_action . '&action=purge_pre&ext_name=' . urlencode($name),
|
'PURGE' => $this->u_action . '&action=purge_pre&ext_name=' . urlencode($name),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
catch(phpbb_extension_exception $e)
|
catch(\phpbb\extension\exception $e)
|
||||||
{
|
{
|
||||||
$this->template->assign_block_vars('disabled', array(
|
$this->template->assign_block_vars('disabled', array(
|
||||||
'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $e),
|
'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $e),
|
||||||
|
@ -251,7 +251,7 @@ class acp_extensions
|
||||||
* @param $phpbb_extension_manager An instance of the extension manager
|
* @param $phpbb_extension_manager An instance of the extension manager
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
public function list_disabled_exts(phpbb_extension_manager $phpbb_extension_manager)
|
public function list_disabled_exts(\phpbb\extension\manager $phpbb_extension_manager)
|
||||||
{
|
{
|
||||||
foreach ($phpbb_extension_manager->all_disabled() as $name => $location)
|
foreach ($phpbb_extension_manager->all_disabled() as $name => $location)
|
||||||
{
|
{
|
||||||
|
@ -270,7 +270,7 @@ class acp_extensions
|
||||||
'PURGE' => $this->u_action . '&action=purge_pre&ext_name=' . urlencode($name),
|
'PURGE' => $this->u_action . '&action=purge_pre&ext_name=' . urlencode($name),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
catch(phpbb_extension_exception $e)
|
catch(\phpbb\extension\exception $e)
|
||||||
{
|
{
|
||||||
$this->template->assign_block_vars('disabled', array(
|
$this->template->assign_block_vars('disabled', array(
|
||||||
'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $e),
|
'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $e),
|
||||||
|
@ -285,7 +285,7 @@ class acp_extensions
|
||||||
* @param $phpbb_extension_manager An instance of the extension manager
|
* @param $phpbb_extension_manager An instance of the extension manager
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
public function list_available_exts(phpbb_extension_manager $phpbb_extension_manager)
|
public function list_available_exts(\phpbb\extension\manager $phpbb_extension_manager)
|
||||||
{
|
{
|
||||||
$uninstalled = array_diff_key($phpbb_extension_manager->all_available(), $phpbb_extension_manager->all_configured());
|
$uninstalled = array_diff_key($phpbb_extension_manager->all_available(), $phpbb_extension_manager->all_configured());
|
||||||
|
|
||||||
|
@ -305,7 +305,7 @@ class acp_extensions
|
||||||
'ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . urlencode($name),
|
'ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . urlencode($name),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
catch(phpbb_extension_exception $e)
|
catch(\phpbb\extension\exception $e)
|
||||||
{
|
{
|
||||||
$this->template->assign_block_vars('disabled', array(
|
$this->template->assign_block_vars('disabled', array(
|
||||||
'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $e),
|
'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $e),
|
||||||
|
|
|
@ -269,7 +269,7 @@ class acp_forums
|
||||||
|
|
||||||
if ($request->is_ajax())
|
if ($request->is_ajax())
|
||||||
{
|
{
|
||||||
$json_response = new phpbb_json_response;
|
$json_response = new \phpbb\json_response;
|
||||||
$json_response->send(array('success' => ($move_forum_name !== false)));
|
$json_response->send(array('success' => ($move_forum_name !== false)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -324,7 +324,7 @@ class acp_groups
|
||||||
$avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers();
|
$avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers();
|
||||||
|
|
||||||
// This is normalised data, without the group_ prefix
|
// This is normalised data, without the group_ prefix
|
||||||
$avatar_data = phpbb_avatar_manager::clean_row($group_row);
|
$avatar_data = \phpbb\avatar\manager::clean_row($group_row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -891,7 +891,7 @@ class acp_groups
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (phpbb_groupposition_exception $exception)
|
catch (\phpbb\groupposition\exception $exception)
|
||||||
{
|
{
|
||||||
trigger_error($user->lang($exception->getMessage()) . adm_back_link($this->u_action), E_USER_WARNING);
|
trigger_error($user->lang($exception->getMessage()) . adm_back_link($this->u_action), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
@ -919,7 +919,7 @@ class acp_groups
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (phpbb_groupposition_exception $exception)
|
catch (\phpbb\groupposition\exception $exception)
|
||||||
{
|
{
|
||||||
trigger_error($user->lang($exception->getMessage()) . adm_back_link($this->u_action), E_USER_WARNING);
|
trigger_error($user->lang($exception->getMessage()) . adm_back_link($this->u_action), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
@ -943,7 +943,7 @@ class acp_groups
|
||||||
|
|
||||||
if (($action == 'move_up' || $action == 'move_down') && $request->is_ajax())
|
if (($action == 'move_up' || $action == 'move_down') && $request->is_ajax())
|
||||||
{
|
{
|
||||||
$json_response = new phpbb_json_response;
|
$json_response = new \phpbb\json_response;
|
||||||
$json_response->send(array('success' => true));
|
$json_response->send(array('success' => true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -961,7 +961,7 @@ class acp_groups
|
||||||
$template->assign_block_vars('legend', array(
|
$template->assign_block_vars('legend', array(
|
||||||
'GROUP_NAME' => $group_name,
|
'GROUP_NAME' => $group_name,
|
||||||
'GROUP_COLOUR' => ($row['group_colour']) ? '#' . $row['group_colour'] : '',
|
'GROUP_COLOUR' => ($row['group_colour']) ? '#' . $row['group_colour'] : '',
|
||||||
'GROUP_TYPE' => $user->lang[phpbb_groupposition_legend::group_type_language($row['group_type'])],
|
'GROUP_TYPE' => $user->lang[\phpbb\groupposition\legend::group_type_language($row['group_type'])],
|
||||||
|
|
||||||
'U_MOVE_DOWN' => "{$this->u_action}&field=legend&action=move_down&g=" . $row['group_id'],
|
'U_MOVE_DOWN' => "{$this->u_action}&field=legend&action=move_down&g=" . $row['group_id'],
|
||||||
'U_MOVE_UP' => "{$this->u_action}&field=legend&action=move_up&g=" . $row['group_id'],
|
'U_MOVE_UP' => "{$this->u_action}&field=legend&action=move_up&g=" . $row['group_id'],
|
||||||
|
@ -1004,7 +1004,7 @@ class acp_groups
|
||||||
if ($row['group_id'])
|
if ($row['group_id'])
|
||||||
{
|
{
|
||||||
$group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
|
$group_name = ($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name'];
|
||||||
$group_type = $user->lang[phpbb_groupposition_teampage::group_type_language($row['group_type'])];
|
$group_type = $user->lang[\phpbb\groupposition\teampage::group_type_language($row['group_type'])];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -338,7 +338,7 @@ class acp_icons
|
||||||
$image_display_on_posting = (isset($_POST['display_on_posting'])) ? request_var('display_on_posting', array('' => 0)) : array();
|
$image_display_on_posting = (isset($_POST['display_on_posting'])) ? request_var('display_on_posting', array('' => 0)) : array();
|
||||||
|
|
||||||
// Ok, add the relevant bits if we are adding new codes to existing emoticons...
|
// Ok, add the relevant bits if we are adding new codes to existing emoticons...
|
||||||
if ($request->variable('add_additional_code', false, false, phpbb_request_interface::POST))
|
if ($request->variable('add_additional_code', false, false, \phpbb\request\request_interface::POST))
|
||||||
{
|
{
|
||||||
$add_image = request_var('add_image', '');
|
$add_image = request_var('add_image', '');
|
||||||
$add_code = utf8_normalize_nfc(request_var('add_code', '', true));
|
$add_code = utf8_normalize_nfc(request_var('add_code', '', true));
|
||||||
|
@ -354,7 +354,7 @@ class acp_icons
|
||||||
$image_width[$add_image] = request_var('add_width', 0);
|
$image_width[$add_image] = request_var('add_width', 0);
|
||||||
$image_height[$add_image] = request_var('add_height', 0);
|
$image_height[$add_image] = request_var('add_height', 0);
|
||||||
|
|
||||||
if ($request->variable('add_display_on_posting', false, false, phpbb_request_interface::POST))
|
if ($request->variable('add_display_on_posting', false, false, \phpbb\request\request_interface::POST))
|
||||||
{
|
{
|
||||||
$image_display_on_posting[$add_image] = 1;
|
$image_display_on_posting[$add_image] = 1;
|
||||||
}
|
}
|
||||||
|
@ -785,7 +785,7 @@ class acp_icons
|
||||||
|
|
||||||
if ($request->is_ajax())
|
if ($request->is_ajax())
|
||||||
{
|
{
|
||||||
$json_response = new phpbb_json_response;
|
$json_response = new \phpbb\json_response;
|
||||||
$json_response->send(array(
|
$json_response->send(array(
|
||||||
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
|
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
|
||||||
'MESSAGE_TEXT' => $notice,
|
'MESSAGE_TEXT' => $notice,
|
||||||
|
|
|
@ -161,7 +161,7 @@ class acp_language
|
||||||
'method' => $method)
|
'method' => $method)
|
||||||
);
|
);
|
||||||
|
|
||||||
$hidden_data .= build_hidden_fields(array('entry' => $request->variable('entry', $request_default, true, phpbb_request_interface::POST)));
|
$hidden_data .= build_hidden_fields(array('entry' => $request->variable('entry', $request_default, true, \phpbb\request\request_interface::POST)));
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'S_UPLOAD' => true,
|
'S_UPLOAD' => true,
|
||||||
|
@ -218,7 +218,7 @@ class acp_language
|
||||||
trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING);
|
trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
$entry_value = $request->variable('entry', $request_default, true, phpbb_request_interface::POST);
|
$entry_value = $request->variable('entry', $request_default, true, \phpbb\request\request_interface::POST);
|
||||||
|
|
||||||
if (!$lang_id || !$entry_value)
|
if (!$lang_id || !$entry_value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -35,8 +35,8 @@ class acp_logs
|
||||||
$forum_id = request_var('f', 0);
|
$forum_id = request_var('f', 0);
|
||||||
$topic_id = request_var('t', 0);
|
$topic_id = request_var('t', 0);
|
||||||
$start = request_var('start', 0);
|
$start = request_var('start', 0);
|
||||||
$deletemark = $request->variable('delmarked', false, false, phpbb_request_interface::POST);
|
$deletemark = $request->variable('delmarked', false, false, \phpbb\request\request_interface::POST);
|
||||||
$deleteall = $request->variable('delall', false, false, phpbb_request_interface::POST);
|
$deleteall = $request->variable('delall', false, false, \phpbb\request\request_interface::POST);
|
||||||
$marked = request_var('mark', array(0));
|
$marked = request_var('mark', array(0));
|
||||||
|
|
||||||
// Sort keys
|
// Sort keys
|
||||||
|
|
|
@ -375,7 +375,7 @@ class acp_modules
|
||||||
{
|
{
|
||||||
if ($request->is_ajax())
|
if ($request->is_ajax())
|
||||||
{
|
{
|
||||||
$json_response = new phpbb_json_response;
|
$json_response = new \phpbb\json_response;
|
||||||
$json_response->send(array(
|
$json_response->send(array(
|
||||||
'MESSAGE_TITLE' => $user->lang('ERROR'),
|
'MESSAGE_TITLE' => $user->lang('ERROR'),
|
||||||
'MESSAGE_TEXT' => implode('<br />', $errors),
|
'MESSAGE_TEXT' => implode('<br />', $errors),
|
||||||
|
@ -565,7 +565,7 @@ class acp_modules
|
||||||
{
|
{
|
||||||
// Skip entries we do not need if we know the module we are
|
// Skip entries we do not need if we know the module we are
|
||||||
// looking for
|
// looking for
|
||||||
if ($module && strpos($cur_module, $module) === false)
|
if ($module && strpos(str_replace('\\', '_', $cur_module), $module) === false)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -679,7 +679,7 @@ class acp_permissions
|
||||||
list($ug_id, ) = each($psubmit);
|
list($ug_id, ) = each($psubmit);
|
||||||
list($forum_id, ) = each($psubmit[$ug_id]);
|
list($forum_id, ) = each($psubmit[$ug_id]);
|
||||||
|
|
||||||
$settings = $request->variable('setting', array(0 => array(0 => array('' => 0))), false, phpbb_request_interface::POST);
|
$settings = $request->variable('setting', array(0 => array(0 => array('' => 0))), false, \phpbb\request\request_interface::POST);
|
||||||
if (empty($settings) || empty($settings[$ug_id]) || empty($settings[$ug_id][$forum_id]))
|
if (empty($settings) || empty($settings[$ug_id]) || empty($settings[$ug_id][$forum_id]))
|
||||||
{
|
{
|
||||||
trigger_error('WRONG_PERMISSION_SETTING_FORMAT', E_USER_WARNING);
|
trigger_error('WRONG_PERMISSION_SETTING_FORMAT', E_USER_WARNING);
|
||||||
|
@ -688,7 +688,7 @@ class acp_permissions
|
||||||
$auth_settings = $settings[$ug_id][$forum_id];
|
$auth_settings = $settings[$ug_id][$forum_id];
|
||||||
|
|
||||||
// Do we have a role we want to set?
|
// Do we have a role we want to set?
|
||||||
$roles = $request->variable('role', array(0 => array(0 => 0)), false, phpbb_request_interface::POST);
|
$roles = $request->variable('role', array(0 => array(0 => 0)), false, \phpbb\request\request_interface::POST);
|
||||||
$assigned_role = (isset($roles[$ug_id][$forum_id])) ? (int) $roles[$ug_id][$forum_id] : 0;
|
$assigned_role = (isset($roles[$ug_id][$forum_id])) ? (int) $roles[$ug_id][$forum_id] : 0;
|
||||||
|
|
||||||
// Do the admin want to set these permissions to other items too?
|
// Do the admin want to set these permissions to other items too?
|
||||||
|
@ -760,8 +760,8 @@ class acp_permissions
|
||||||
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
|
trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
$auth_settings = $request->variable('setting', array(0 => array(0 => array('' => 0))), false, phpbb_request_interface::POST);
|
$auth_settings = $request->variable('setting', array(0 => array(0 => array('' => 0))), false, \phpbb\request\request_interface::POST);
|
||||||
$auth_roles = $request->variable('role', array(0 => array(0 => 0)), false, phpbb_request_interface::POST);
|
$auth_roles = $request->variable('role', array(0 => array(0 => 0)), false, \phpbb\request\request_interface::POST);
|
||||||
$ug_ids = $forum_ids = array();
|
$ug_ids = $forum_ids = array();
|
||||||
|
|
||||||
// We need to go through the auth settings
|
// We need to go through the auth settings
|
||||||
|
@ -1103,7 +1103,7 @@ class acp_permissions
|
||||||
{
|
{
|
||||||
if ($user_id != $user->data['user_id'])
|
if ($user_id != $user->data['user_id'])
|
||||||
{
|
{
|
||||||
$auth2 = new phpbb_auth();
|
$auth2 = new \phpbb\auth\auth();
|
||||||
$auth2->acl($userdata);
|
$auth2->acl($userdata);
|
||||||
$auth_setting = $auth2->acl_get($permission);
|
$auth_setting = $auth2->acl_get($permission);
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,7 +245,7 @@ class acp_profile
|
||||||
|
|
||||||
if ($request->is_ajax())
|
if ($request->is_ajax())
|
||||||
{
|
{
|
||||||
$json_response = new phpbb_json_response();
|
$json_response = new \phpbb\json_response();
|
||||||
$json_response->send(array(
|
$json_response->send(array(
|
||||||
'text' => $user->lang('DEACTIVATE'),
|
'text' => $user->lang('DEACTIVATE'),
|
||||||
));
|
));
|
||||||
|
@ -277,7 +277,7 @@ class acp_profile
|
||||||
|
|
||||||
if ($request->is_ajax())
|
if ($request->is_ajax())
|
||||||
{
|
{
|
||||||
$json_response = new phpbb_json_response();
|
$json_response = new \phpbb\json_response();
|
||||||
$json_response->send(array(
|
$json_response->send(array(
|
||||||
'text' => $user->lang('ACTIVATE'),
|
'text' => $user->lang('ACTIVATE'),
|
||||||
));
|
));
|
||||||
|
@ -510,7 +510,7 @@ class acp_profile
|
||||||
$cp->vars['field_default_value_month'] = $now['mon'];
|
$cp->vars['field_default_value_month'] = $now['mon'];
|
||||||
$cp->vars['field_default_value_year'] = $now['year'];
|
$cp->vars['field_default_value_year'] = $now['year'];
|
||||||
$var = 'now';
|
$var = 'now';
|
||||||
$request->overwrite('field_default_value', $var, phpbb_request_interface::POST);
|
$request->overwrite('field_default_value', $var, \phpbb\request\request_interface::POST);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -520,7 +520,7 @@ class acp_profile
|
||||||
$cp->vars['field_default_value_month'] = request_var('field_default_value_month', 0);
|
$cp->vars['field_default_value_month'] = request_var('field_default_value_month', 0);
|
||||||
$cp->vars['field_default_value_year'] = request_var('field_default_value_year', 0);
|
$cp->vars['field_default_value_year'] = request_var('field_default_value_year', 0);
|
||||||
$var = sprintf('%2d-%2d-%4d', $cp->vars['field_default_value_day'], $cp->vars['field_default_value_month'], $cp->vars['field_default_value_year']);
|
$var = sprintf('%2d-%2d-%4d', $cp->vars['field_default_value_day'], $cp->vars['field_default_value_month'], $cp->vars['field_default_value_year']);
|
||||||
$request->overwrite('field_default_value', $var, phpbb_request_interface::POST);
|
$request->overwrite('field_default_value', $var, \phpbb\request\request_interface::POST);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -125,7 +125,7 @@ class acp_ranks
|
||||||
|
|
||||||
if ($request->is_ajax())
|
if ($request->is_ajax())
|
||||||
{
|
{
|
||||||
$json_response = new phpbb_json_response;
|
$json_response = new \phpbb\json_response;
|
||||||
$json_response->send(array(
|
$json_response->send(array(
|
||||||
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
|
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
|
||||||
'MESSAGE_TEXT' => $user->lang['RANK_REMOVED'],
|
'MESSAGE_TEXT' => $user->lang['RANK_REMOVED'],
|
||||||
|
|
|
@ -1604,7 +1604,7 @@ class acp_users
|
||||||
|| $user_row['user_allow_viewonline'] && !$sql_ary['user_allow_viewonline'])
|
|| $user_row['user_allow_viewonline'] && !$sql_ary['user_allow_viewonline'])
|
||||||
{
|
{
|
||||||
// We also need to check if the user has the permission to cloak.
|
// We also need to check if the user has the permission to cloak.
|
||||||
$user_auth = new phpbb_auth();
|
$user_auth = new \phpbb\auth\auth();
|
||||||
$user_auth->acl($user_row);
|
$user_auth->acl($user_row);
|
||||||
|
|
||||||
$session_sql_ary = array(
|
$session_sql_ary = array(
|
||||||
|
@ -1742,7 +1742,7 @@ class acp_users
|
||||||
$avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers();
|
$avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers();
|
||||||
|
|
||||||
// This is normalised data, without the user_ prefix
|
// This is normalised data, without the user_ prefix
|
||||||
$avatar_data = phpbb_avatar_manager::clean_row($user_row);
|
$avatar_data = \phpbb\avatar\manager::clean_row($user_row);
|
||||||
|
|
||||||
if ($submit)
|
if ($submit)
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,7 +19,7 @@ if (!defined('IN_PHPBB'))
|
||||||
* ACP Permission/Auth class
|
* ACP Permission/Auth class
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
class auth_admin extends phpbb_auth
|
class auth_admin extends \phpbb\auth\auth
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Init auth settings
|
* Init auth settings
|
||||||
|
@ -130,7 +130,7 @@ class auth_admin extends phpbb_auth
|
||||||
{
|
{
|
||||||
if ($user->data['user_id'] != $userdata['user_id'])
|
if ($user->data['user_id'] != $userdata['user_id'])
|
||||||
{
|
{
|
||||||
$auth2 = new phpbb_auth();
|
$auth2 = new \phpbb\auth\auth();
|
||||||
$auth2->acl($userdata);
|
$auth2->acl($userdata);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -132,7 +132,7 @@ class bbcode
|
||||||
{
|
{
|
||||||
$this->template_bitfield = new bitfield($user->style['bbcode_bitfield']);
|
$this->template_bitfield = new bitfield($user->style['bbcode_bitfield']);
|
||||||
|
|
||||||
$template = new phpbb_template_twig($phpbb_filesystem, $config, $user, new phpbb_template_context(), $phpbb_extension_manager);
|
$template = new phpbb\template\twig\twig($phpbb_filesystem, $config, $user, new phpbb_template_context(), $phpbb_extension_manager);
|
||||||
$template->set_style();
|
$template->set_style();
|
||||||
$template->set_filenames(array('bbcode.html' => 'bbcode.html'));
|
$template->set_filenames(array('bbcode.html' => 'bbcode.html'));
|
||||||
$this->template_filename = $template->get_source_file_for_handle('bbcode.html');
|
$this->template_filename = $template->get_source_file_for_handle('bbcode.html');
|
||||||
|
|
|
@ -140,7 +140,7 @@ class phpbb_captcha_gd extends phpbb_default_captcha
|
||||||
|
|
||||||
$config_old = $config;
|
$config_old = $config;
|
||||||
|
|
||||||
$config = new phpbb_config(array());
|
$config = new \phpbb\config\config(array());
|
||||||
foreach ($config_old as $key => $value)
|
foreach ($config_old as $key => $value)
|
||||||
{
|
{
|
||||||
$config->set($key, $value);
|
$config->set($key, $value);
|
||||||
|
|
|
@ -112,7 +112,7 @@ class phpbb_captcha_qa
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
$db_tool = new phpbb_db_tools($db);
|
$db_tool = new \phpbb\db\tools($db);
|
||||||
|
|
||||||
return $db_tool->sql_table_exists(CAPTCHA_QUESTIONS_TABLE);
|
return $db_tool->sql_table_exists(CAPTCHA_QUESTIONS_TABLE);
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ class phpbb_captcha_qa
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
$db_tool = new phpbb_db_tools($db);
|
$db_tool = new \phpbb\db\tools($db);
|
||||||
|
|
||||||
$tables = array(CAPTCHA_QUESTIONS_TABLE, CAPTCHA_ANSWERS_TABLE, CAPTCHA_QA_CONFIRM_TABLE);
|
$tables = array(CAPTCHA_QUESTIONS_TABLE, CAPTCHA_ANSWERS_TABLE, CAPTCHA_QA_CONFIRM_TABLE);
|
||||||
|
|
||||||
|
|
|
@ -24,13 +24,13 @@ if (!defined('IN_PHPBB'))
|
||||||
function set_var(&$result, $var, $type, $multibyte = false)
|
function set_var(&$result, $var, $type, $multibyte = false)
|
||||||
{
|
{
|
||||||
// no need for dependency injection here, if you have the object, call the method yourself!
|
// no need for dependency injection here, if you have the object, call the method yourself!
|
||||||
$type_cast_helper = new phpbb_request_type_cast_helper();
|
$type_cast_helper = new \phpbb\request\type_cast_helper();
|
||||||
$type_cast_helper->set_var($result, $var, $type, $multibyte);
|
$type_cast_helper->set_var($result, $var, $type, $multibyte);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper function of phpbb_request::variable which exists for backwards compatability.
|
* Wrapper function of \phpbb\request\request::variable which exists for backwards compatability.
|
||||||
* See {@link phpbb_request_interface::variable phpbb_request_interface::variable} for
|
* See {@link \phpbb\request\request_interface::variable \phpbb\request\request_interface::variable} for
|
||||||
* documentation of this function's use.
|
* documentation of this function's use.
|
||||||
*
|
*
|
||||||
* @deprecated
|
* @deprecated
|
||||||
|
@ -38,20 +38,20 @@ function set_var(&$result, $var, $type, $multibyte = false)
|
||||||
* If the value is an array this may be an array of indizes which will give
|
* If the value is an array this may be an array of indizes which will give
|
||||||
* direct access to a value at any depth. E.g. if the value of "var" is array(1 => "a")
|
* direct access to a value at any depth. E.g. if the value of "var" is array(1 => "a")
|
||||||
* then specifying array("var", 1) as the name will return "a".
|
* then specifying array("var", 1) as the name will return "a".
|
||||||
* If you pass an instance of {@link phpbb_request_interface phpbb_request_interface}
|
* If you pass an instance of {@link \phpbb\request\request_interface phpbb_request_interface}
|
||||||
* as this parameter it will overwrite the current request class instance. If you do
|
* as this parameter it will overwrite the current request class instance. If you do
|
||||||
* not do so, it will create its own instance (but leave superglobals enabled).
|
* not do so, it will create its own instance (but leave superglobals enabled).
|
||||||
* @param mixed $default A default value that is returned if the variable was not set.
|
* @param mixed $default A default value that is returned if the variable was not set.
|
||||||
* This function will always return a value of the same type as the default.
|
* This function will always return a value of the same type as the default.
|
||||||
* @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters
|
* @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters
|
||||||
* Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks
|
* Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks
|
||||||
* @param bool $cookie This param is mapped to phpbb_request_interface::COOKIE as the last param for
|
* @param bool $cookie This param is mapped to \phpbb\request\request_interface::COOKIE as the last param for
|
||||||
* phpbb_request_interface::variable for backwards compatability reasons.
|
* \phpbb\request\request_interface::variable for backwards compatability reasons.
|
||||||
* @param phpbb_request_interface|null|false If an instance of phpbb_request_interface is given the instance is stored in
|
* @param \phpbb\request\request_interface|null|false If an instance of \phpbb\request\request_interface is given the instance is stored in
|
||||||
* a static variable and used for all further calls where this parameters is null. Until
|
* a static variable and used for all further calls where this parameters is null. Until
|
||||||
* the function is called with an instance it automatically creates a new phpbb_request
|
* the function is called with an instance it automatically creates a new \phpbb\request\request
|
||||||
* instance on every call. By passing false this per-call instantiation can be restored
|
* instance on every call. By passing false this per-call instantiation can be restored
|
||||||
* after having passed in a phpbb_request_interface instance.
|
* after having passed in a \phpbb\request\request_interface instance.
|
||||||
*
|
*
|
||||||
* @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the
|
* @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the
|
||||||
* the same as that of $default. If the variable is not set $default is returned.
|
* the same as that of $default. If the variable is not set $default is returned.
|
||||||
|
@ -62,7 +62,7 @@ function request_var($var_name, $default, $multibyte = false, $cookie = false, $
|
||||||
// the only real code is the function call which maps this function to a method.
|
// the only real code is the function call which maps this function to a method.
|
||||||
static $static_request = null;
|
static $static_request = null;
|
||||||
|
|
||||||
if ($request instanceof phpbb_request_interface)
|
if ($request instanceof \phpbb\request\request_interface)
|
||||||
{
|
{
|
||||||
$static_request = $request;
|
$static_request = $request;
|
||||||
|
|
||||||
|
@ -88,10 +88,10 @@ function request_var($var_name, $default, $multibyte = false, $cookie = false, $
|
||||||
{
|
{
|
||||||
// false param: enable super globals, so the created request class does not
|
// false param: enable super globals, so the created request class does not
|
||||||
// make super globals inaccessible everywhere outside this function.
|
// make super globals inaccessible everywhere outside this function.
|
||||||
$tmp_request = new phpbb_request(new phpbb_request_type_cast_helper(), false);
|
$tmp_request = new \phpbb\request\request(new \phpbb\request\type_cast_helper(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $tmp_request->variable($var_name, $default, $multibyte, ($cookie) ? phpbb_request_interface::COOKIE : phpbb_request_interface::REQUEST);
|
return $tmp_request->variable($var_name, $default, $multibyte, ($cookie) ? \phpbb\request\request_interface::COOKIE : \phpbb\request\request_interface::REQUEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,7 +110,7 @@ function request_var($var_name, $default, $multibyte = false, $cookie = false, $
|
||||||
*
|
*
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function set_config($config_name, $config_value, $is_dynamic = false, phpbb_config $set_config = null)
|
function set_config($config_name, $config_value, $is_dynamic = false, \phpbb\config\config $set_config = null)
|
||||||
{
|
{
|
||||||
static $config = null;
|
static $config = null;
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ function set_config($config_name, $config_value, $is_dynamic = false, phpbb_conf
|
||||||
*
|
*
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
function set_config_count($config_name, $increment, $is_dynamic = false, phpbb_config $set_config = null)
|
function set_config_count($config_name, $increment, $is_dynamic = false, \phpbb\config\config $set_config = null)
|
||||||
{
|
{
|
||||||
static $config = null;
|
static $config = null;
|
||||||
|
|
||||||
|
@ -1065,15 +1065,15 @@ function phpbb_clean_path($path)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// The container is not yet loaded, use a new instance
|
// The container is not yet loaded, use a new instance
|
||||||
if (!class_exists('phpbb_filesystem'))
|
if (!class_exists('\phpbb\filesystem'))
|
||||||
{
|
{
|
||||||
global $phpbb_root_path, $phpEx;
|
global $phpbb_root_path, $phpEx;
|
||||||
require($phpbb_root_path . 'includes/filesystem.' . $phpEx);
|
require($phpbb_root_path . 'includes/filesystem.' . $phpEx);
|
||||||
}
|
}
|
||||||
|
|
||||||
$phpbb_filesystem = new phpbb_filesystem(
|
$phpbb_filesystem = new phpbb\filesystem(
|
||||||
new phpbb_symfony_request(
|
new phpbb\symfony_request(
|
||||||
new phpbb_request()
|
new phpbb\request\request()
|
||||||
),
|
),
|
||||||
$phpbb_root_path,
|
$phpbb_root_path,
|
||||||
$phpEx
|
$phpEx
|
||||||
|
@ -1258,7 +1258,7 @@ function tz_select($default = '', $truncate = false)
|
||||||
/**
|
/**
|
||||||
* Options to pick a timezone and date/time
|
* Options to pick a timezone and date/time
|
||||||
*
|
*
|
||||||
* @param phpbb_user $user Object of the current user
|
* @param \phpbb\user $user Object of the current user
|
||||||
* @param string $default A timezone to select
|
* @param string $default A timezone to select
|
||||||
* @param boolean $truncate Shall we truncate the options text
|
* @param boolean $truncate Shall we truncate the options text
|
||||||
*
|
*
|
||||||
|
@ -1277,7 +1277,7 @@ function phpbb_timezone_select($user, $default = '', $truncate = false)
|
||||||
foreach ($unsorted_timezones as $timezone)
|
foreach ($unsorted_timezones as $timezone)
|
||||||
{
|
{
|
||||||
$tz = new DateTimeZone($timezone);
|
$tz = new DateTimeZone($timezone);
|
||||||
$dt = new phpbb_datetime($user, 'now', $tz);
|
$dt = new \phpbb\datetime($user, 'now', $tz);
|
||||||
$offset = $dt->getOffset();
|
$offset = $dt->getOffset();
|
||||||
$current_time = $dt->format($user->lang['DATETIME_FORMAT'], true);
|
$current_time = $dt->format($user->lang['DATETIME_FORMAT'], true);
|
||||||
$offset_string = phpbb_format_timezone_offset($offset);
|
$offset_string = phpbb_format_timezone_offset($offset);
|
||||||
|
@ -1396,7 +1396,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
|
||||||
}
|
}
|
||||||
else if ($config['load_anon_lastread'] || $user->data['is_registered'])
|
else if ($config['load_anon_lastread'] || $user->data['is_registered'])
|
||||||
{
|
{
|
||||||
$tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, phpbb_request_interface::COOKIE);
|
$tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE);
|
||||||
$tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array();
|
$tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array();
|
||||||
|
|
||||||
unset($tracking_topics['tf']);
|
unset($tracking_topics['tf']);
|
||||||
|
@ -1405,7 +1405,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
|
||||||
$tracking_topics['l'] = base_convert($post_time - $config['board_startdate'], 10, 36);
|
$tracking_topics['l'] = base_convert($post_time - $config['board_startdate'], 10, 36);
|
||||||
|
|
||||||
$user->set_cookie('track', tracking_serialize($tracking_topics), $post_time + 31536000);
|
$user->set_cookie('track', tracking_serialize($tracking_topics), $post_time + 31536000);
|
||||||
$request->overwrite($config['cookie_name'] . '_track', tracking_serialize($tracking_topics), phpbb_request_interface::COOKIE);
|
$request->overwrite($config['cookie_name'] . '_track', tracking_serialize($tracking_topics), \phpbb\request\request_interface::COOKIE);
|
||||||
|
|
||||||
unset($tracking_topics);
|
unset($tracking_topics);
|
||||||
|
|
||||||
|
@ -1508,7 +1508,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
|
||||||
}
|
}
|
||||||
else if ($config['load_anon_lastread'] || $user->data['is_registered'])
|
else if ($config['load_anon_lastread'] || $user->data['is_registered'])
|
||||||
{
|
{
|
||||||
$tracking = $request->variable($config['cookie_name'] . '_track', '', true, phpbb_request_interface::COOKIE);
|
$tracking = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE);
|
||||||
$tracking = ($tracking) ? tracking_unserialize($tracking) : array();
|
$tracking = ($tracking) ? tracking_unserialize($tracking) : array();
|
||||||
|
|
||||||
foreach ($forum_id as $f_id)
|
foreach ($forum_id as $f_id)
|
||||||
|
@ -1539,7 +1539,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
|
||||||
}
|
}
|
||||||
|
|
||||||
$user->set_cookie('track', tracking_serialize($tracking), $post_time + 31536000);
|
$user->set_cookie('track', tracking_serialize($tracking), $post_time + 31536000);
|
||||||
$request->overwrite($config['cookie_name'] . '_track', tracking_serialize($tracking), phpbb_request_interface::COOKIE);
|
$request->overwrite($config['cookie_name'] . '_track', tracking_serialize($tracking), \phpbb\request\request_interface::COOKIE);
|
||||||
|
|
||||||
unset($tracking);
|
unset($tracking);
|
||||||
}
|
}
|
||||||
|
@ -1596,7 +1596,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
|
||||||
}
|
}
|
||||||
else if ($config['load_anon_lastread'] || $user->data['is_registered'])
|
else if ($config['load_anon_lastread'] || $user->data['is_registered'])
|
||||||
{
|
{
|
||||||
$tracking = $request->variable($config['cookie_name'] . '_track', '', true, phpbb_request_interface::COOKIE);
|
$tracking = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE);
|
||||||
$tracking = ($tracking) ? tracking_unserialize($tracking) : array();
|
$tracking = ($tracking) ? tracking_unserialize($tracking) : array();
|
||||||
|
|
||||||
$topic_id36 = base_convert($topic_id, 10, 36);
|
$topic_id36 = base_convert($topic_id, 10, 36);
|
||||||
|
@ -1610,7 +1610,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
|
||||||
|
|
||||||
// If the cookie grows larger than 10000 characters we will remove the smallest value
|
// If the cookie grows larger than 10000 characters we will remove the smallest value
|
||||||
// This can result in old topics being unread - but most of the time it should be accurate...
|
// This can result in old topics being unread - but most of the time it should be accurate...
|
||||||
if (strlen($request->variable($config['cookie_name'] . '_track', '', true, phpbb_request_interface::COOKIE)) > 10000)
|
if (strlen($request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE)) > 10000)
|
||||||
{
|
{
|
||||||
//echo 'Cookie grown too large' . print_r($tracking, true);
|
//echo 'Cookie grown too large' . print_r($tracking, true);
|
||||||
|
|
||||||
|
@ -1655,7 +1655,7 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
|
||||||
}
|
}
|
||||||
|
|
||||||
$user->set_cookie('track', tracking_serialize($tracking), $post_time + 31536000);
|
$user->set_cookie('track', tracking_serialize($tracking), $post_time + 31536000);
|
||||||
$request->overwrite($config['cookie_name'] . '_track', tracking_serialize($tracking), phpbb_request_interface::COOKIE);
|
$request->overwrite($config['cookie_name'] . '_track', tracking_serialize($tracking), \phpbb\request\request_interface::COOKIE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -1793,7 +1793,7 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis
|
||||||
|
|
||||||
if (!isset($tracking_topics) || !sizeof($tracking_topics))
|
if (!isset($tracking_topics) || !sizeof($tracking_topics))
|
||||||
{
|
{
|
||||||
$tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, phpbb_request_interface::COOKIE);
|
$tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE);
|
||||||
$tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array();
|
$tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1990,7 +1990,7 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti
|
||||||
}
|
}
|
||||||
else if ($config['load_anon_lastread'] || $user->data['is_registered'])
|
else if ($config['load_anon_lastread'] || $user->data['is_registered'])
|
||||||
{
|
{
|
||||||
$tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, phpbb_request_interface::COOKIE);
|
$tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE);
|
||||||
$tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array();
|
$tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array();
|
||||||
|
|
||||||
if (!$user->data['is_registered'])
|
if (!$user->data['is_registered'])
|
||||||
|
@ -2425,7 +2425,7 @@ function append_sid($url, $params = false, $is_amp = true, $session_id = false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the root path with the correct relative web path
|
// Update the root path with the correct relative web path
|
||||||
if ($phpbb_filesystem instanceof phpbb_filesystem)
|
if ($phpbb_filesystem instanceof \phpbb\filesystem)
|
||||||
{
|
{
|
||||||
$url = $phpbb_filesystem->update_web_root_path($url);
|
$url = $phpbb_filesystem->update_web_root_path($url);
|
||||||
}
|
}
|
||||||
|
@ -3106,7 +3106,7 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$confirm = ($user->lang['YES'] === $request->variable('confirm', '', true, phpbb_request_interface::POST));
|
$confirm = ($user->lang['YES'] === $request->variable('confirm', '', true, \phpbb\request\request_interface::POST));
|
||||||
|
|
||||||
if ($check && $confirm)
|
if ($check && $confirm)
|
||||||
{
|
{
|
||||||
|
@ -3183,7 +3183,7 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo
|
||||||
if ($request->is_ajax())
|
if ($request->is_ajax())
|
||||||
{
|
{
|
||||||
$u_action .= '&confirm_uid=' . $user->data['user_id'] . '&sess=' . $user->session_id . '&sid=' . $user->session_id;
|
$u_action .= '&confirm_uid=' . $user->data['user_id'] . '&sess=' . $user->session_id . '&sid=' . $user->session_id;
|
||||||
$json_response = new phpbb_json_response;
|
$json_response = new \phpbb\json_response;
|
||||||
$json_response->send(array(
|
$json_response->send(array(
|
||||||
'MESSAGE_BODY' => $template->assign_display('body'),
|
'MESSAGE_BODY' => $template->assign_display('body'),
|
||||||
'MESSAGE_TITLE' => (!isset($user->lang[$title])) ? $user->lang['CONFIRM'] : $user->lang[$title],
|
'MESSAGE_TITLE' => (!isset($user->lang[$title])) ? $user->lang['CONFIRM'] : $user->lang[$title],
|
||||||
|
@ -4425,7 +4425,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
|
||||||
{
|
{
|
||||||
global $refresh_data;
|
global $refresh_data;
|
||||||
|
|
||||||
$json_response = new phpbb_json_response;
|
$json_response = new \phpbb\json_response;
|
||||||
$json_response->send(array(
|
$json_response->send(array(
|
||||||
'MESSAGE_TITLE' => $msg_title,
|
'MESSAGE_TITLE' => $msg_title,
|
||||||
'MESSAGE_TEXT' => $msg_text,
|
'MESSAGE_TEXT' => $msg_text,
|
||||||
|
@ -4931,7 +4931,7 @@ function phpbb_http_login($param)
|
||||||
$username = null;
|
$username = null;
|
||||||
foreach ($username_keys as $k)
|
foreach ($username_keys as $k)
|
||||||
{
|
{
|
||||||
if ($request->is_set($k, phpbb_request_interface::SERVER))
|
if ($request->is_set($k, \phpbb\request\request_interface::SERVER))
|
||||||
{
|
{
|
||||||
$username = htmlspecialchars_decode($request->server($k));
|
$username = htmlspecialchars_decode($request->server($k));
|
||||||
break;
|
break;
|
||||||
|
@ -4941,7 +4941,7 @@ function phpbb_http_login($param)
|
||||||
$password = null;
|
$password = null;
|
||||||
foreach ($password_keys as $k)
|
foreach ($password_keys as $k)
|
||||||
{
|
{
|
||||||
if ($request->is_set($k, phpbb_request_interface::SERVER))
|
if ($request->is_set($k, \phpbb\request\request_interface::SERVER))
|
||||||
{
|
{
|
||||||
$password = htmlspecialchars_decode($request->server($k));
|
$password = htmlspecialchars_decode($request->server($k));
|
||||||
break;
|
break;
|
||||||
|
@ -5042,13 +5042,13 @@ function phpbb_quoteattr($data, $entities = null)
|
||||||
*
|
*
|
||||||
* sid is always omitted.
|
* sid is always omitted.
|
||||||
*
|
*
|
||||||
* @param phpbb_request $request Request object
|
* @param \phpbb\request\request $request Request object
|
||||||
* @param array $exclude A list of variable names that should not be forwarded
|
* @param array $exclude A list of variable names that should not be forwarded
|
||||||
* @return string HTML with hidden fields
|
* @return string HTML with hidden fields
|
||||||
*/
|
*/
|
||||||
function phpbb_build_hidden_fields_for_query_params($request, $exclude = null)
|
function phpbb_build_hidden_fields_for_query_params($request, $exclude = null)
|
||||||
{
|
{
|
||||||
$names = $request->variable_names(phpbb_request_interface::GET);
|
$names = $request->variable_names(\phpbb\request\request_interface::GET);
|
||||||
$hidden = '';
|
$hidden = '';
|
||||||
foreach ($names as $name)
|
foreach ($names as $name)
|
||||||
{
|
{
|
||||||
|
@ -5070,7 +5070,7 @@ function phpbb_build_hidden_fields_for_query_params($request, $exclude = null)
|
||||||
// here. To avoid exposing cookies, skip variables that are
|
// here. To avoid exposing cookies, skip variables that are
|
||||||
// overwritten somewhere other than GET entirely.
|
// overwritten somewhere other than GET entirely.
|
||||||
$value = $request->variable($name, '', true);
|
$value = $request->variable($name, '', true);
|
||||||
$get_value = $request->variable($name, '', true, phpbb_request_interface::GET);
|
$get_value = $request->variable($name, '', true, \phpbb\request\request_interface::GET);
|
||||||
if ($value === $get_value)
|
if ($value === $get_value)
|
||||||
{
|
{
|
||||||
$escaped_value = phpbb_quoteattr($value);
|
$escaped_value = phpbb_quoteattr($value);
|
||||||
|
@ -5272,7 +5272,7 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$dt = new phpbb_datetime($user, 'now', $user->timezone);
|
$dt = new \phpbb\datetime($user, 'now', $user->timezone);
|
||||||
$timezone_offset = 'GMT' . phpbb_format_timezone_offset($dt->getOffset());
|
$timezone_offset = 'GMT' . phpbb_format_timezone_offset($dt->getOffset());
|
||||||
$timezone_name = $user->timezone->getName();
|
$timezone_name = $user->timezone->getName();
|
||||||
if (isset($user->lang['timezones'][$timezone_name]))
|
if (isset($user->lang['timezones'][$timezone_name]))
|
||||||
|
@ -5620,7 +5620,7 @@ function exit_handler()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler for init calls in phpBB. This function is called in phpbb_user::setup();
|
* Handler for init calls in phpBB. This function is called in \phpbb\user::setup();
|
||||||
* This function supports hooks.
|
* This function supports hooks.
|
||||||
*/
|
*/
|
||||||
function phpbb_user_session_handler()
|
function phpbb_user_session_handler()
|
||||||
|
@ -5684,24 +5684,24 @@ function phpbb_convert_30_dbms_to_31($dbms)
|
||||||
// true for mysqli class.
|
// true for mysqli class.
|
||||||
// However, per the docblock any valid 3.1 driver name should be
|
// However, per the docblock any valid 3.1 driver name should be
|
||||||
// recognized by this function, and have priority over 3.0 dbms.
|
// recognized by this function, and have priority over 3.0 dbms.
|
||||||
if (class_exists('phpbb_db_driver_' . $dbms))
|
if (class_exists('phpbb\db\driver\\' . $dbms))
|
||||||
{
|
{
|
||||||
return 'phpbb_db_driver_' . $dbms;
|
return 'phpbb\db\driver\\' . $dbms;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (class_exists($dbms))
|
if (class_exists($dbms))
|
||||||
{
|
{
|
||||||
// Additionally we could check that $dbms extends phpbb_db_driver.
|
// Additionally we could check that $dbms extends phpbb\db\driver\driver.
|
||||||
// http://php.net/manual/en/class.reflectionclass.php
|
// http://php.net/manual/en/class.reflectionclass.php
|
||||||
// Beware of possible performance issues:
|
// Beware of possible performance issues:
|
||||||
// http://stackoverflow.com/questions/294582/php-5-reflection-api-performance
|
// http://stackoverflow.com/questions/294582/php-5-reflection-api-performance
|
||||||
// We could check for interface implementation in all paths or
|
// We could check for interface implementation in all paths or
|
||||||
// only when we do not prepend phpbb_db_driver_.
|
// only when we do not prepend phpbb\db\driver\.
|
||||||
|
|
||||||
/*
|
/*
|
||||||
$reflection = new \ReflectionClass($dbms);
|
$reflection = new \ReflectionClass($dbms);
|
||||||
|
|
||||||
if ($reflection->isSubclassOf('phpbb_db_driver'))
|
if ($reflection->isSubclassOf('phpbb\db\driver\driver'))
|
||||||
{
|
{
|
||||||
return $dbms;
|
return $dbms;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2348,9 +2348,9 @@ function auto_prune($forum_id, $prune_mode, $prune_flags, $prune_days, $prune_fr
|
||||||
* via admin_permissions. Changes of usernames and group names
|
* via admin_permissions. Changes of usernames and group names
|
||||||
* must be carried through for the moderators table.
|
* must be carried through for the moderators table.
|
||||||
*
|
*
|
||||||
* @param phpbb_db_driver $db Database connection
|
* @param \phpbb\db\driver\driver $db Database connection
|
||||||
* @param phpbb_cache_driver_interface Cache driver
|
* @param \phpbb\cache\driver\driver_interface Cache driver
|
||||||
* @param phpbb_auth $auth Authentication object
|
* @param \phpbb\auth\auth $auth Authentication object
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
function phpbb_cache_moderators($db, $cache, $auth)
|
function phpbb_cache_moderators($db, $cache, $auth)
|
||||||
|
@ -2571,8 +2571,8 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
|
||||||
/**
|
/**
|
||||||
* Removes moderators and administrators from foe lists.
|
* Removes moderators and administrators from foe lists.
|
||||||
*
|
*
|
||||||
* @param phpbb_db_driver $db Database connection
|
* @param \phpbb\db\driver\driver $db Database connection
|
||||||
* @param phpbb_auth $auth Authentication object
|
* @param \phpbb\auth\auth $auth Authentication object
|
||||||
* @param array|bool $group_id If an array, remove all members of this group from foe lists, or false to ignore
|
* @param array|bool $group_id If an array, remove all members of this group from foe lists, or false to ignore
|
||||||
* @param array|bool $user_id If an array, remove this user from foe lists, or false to ignore
|
* @param array|bool $user_id If an array, remove this user from foe lists, or false to ignore
|
||||||
* @return null
|
* @return null
|
||||||
|
|
|
@ -26,7 +26,7 @@ if (!defined('IN_PHPBB'))
|
||||||
* Used to bootstrap the container.
|
* Used to bootstrap the container.
|
||||||
*
|
*
|
||||||
* @param string $config_file
|
* @param string $config_file
|
||||||
* @return phpbb_db_driver
|
* @return \phpbb\db\driver\driver
|
||||||
*/
|
*/
|
||||||
function phpbb_bootstrap_db_connection($config_file)
|
function phpbb_bootstrap_db_connection($config_file)
|
||||||
{
|
{
|
||||||
|
@ -121,7 +121,7 @@ function phpbb_create_install_container($phpbb_root_path, $php_ext)
|
||||||
$other_config_path = $phpbb_root_path . 'install/update/new/config/';
|
$other_config_path = $phpbb_root_path . 'install/update/new/config/';
|
||||||
$config_path = file_exists($other_config_path . 'services.yml') ? $other_config_path : $phpbb_root_path . 'config/';
|
$config_path = file_exists($other_config_path . 'services.yml') ? $other_config_path : $phpbb_root_path . 'config/';
|
||||||
|
|
||||||
$core = new phpbb_di_extension_core($config_path);
|
$core = new \phpbb\di\extension\core($config_path);
|
||||||
$container = phpbb_create_container(array($core), $phpbb_root_path, $php_ext);
|
$container = phpbb_create_container(array($core), $phpbb_root_path, $php_ext);
|
||||||
|
|
||||||
$container->setParameter('core.root_path', $phpbb_root_path);
|
$container->setParameter('core.root_path', $phpbb_root_path);
|
||||||
|
@ -260,13 +260,13 @@ function phpbb_create_default_container($phpbb_root_path, $php_ext)
|
||||||
return phpbb_create_dumped_container_unless_debug(
|
return phpbb_create_dumped_container_unless_debug(
|
||||||
$config_file,
|
$config_file,
|
||||||
array(
|
array(
|
||||||
new phpbb_di_extension_config($config_file),
|
new \phpbb\di\extension\config($config_file),
|
||||||
new phpbb_di_extension_core($phpbb_root_path . 'config'),
|
new \phpbb\di\extension\core($phpbb_root_path . 'config'),
|
||||||
new phpbb_di_extension_ext($installed_exts),
|
new \phpbb\di\extension\ext($installed_exts),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
new phpbb_di_pass_collection_pass(),
|
new \phpbb\di\pass\collection_pass(),
|
||||||
new phpbb_di_pass_kernel_pass(),
|
new \phpbb\di\pass\kernel_pass(),
|
||||||
),
|
),
|
||||||
$phpbb_root_path,
|
$phpbb_root_path,
|
||||||
$php_ext
|
$php_ext
|
||||||
|
|
|
@ -22,14 +22,14 @@ if (!defined('IN_PHPBB'))
|
||||||
*
|
*
|
||||||
* The only supported table is bookmarks.
|
* The only supported table is bookmarks.
|
||||||
*
|
*
|
||||||
* @param phpbb_db_driver $db Database object
|
* @param \phpbb\db\driver\driver $db Database object
|
||||||
* @param string $table Table on which to perform the update
|
* @param string $table Table on which to perform the update
|
||||||
* @param string $column Column whose values to change
|
* @param string $column Column whose values to change
|
||||||
* @param array $from_values An array of values that should be changed
|
* @param array $from_values An array of values that should be changed
|
||||||
* @param int $to_value The new value
|
* @param int $to_value The new value
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
function phpbb_update_rows_avoiding_duplicates(phpbb_db_driver $db, $table, $column, $from_values, $to_value)
|
function phpbb_update_rows_avoiding_duplicates(\phpbb\db\driver\driver $db, $table, $column, $from_values, $to_value)
|
||||||
{
|
{
|
||||||
$sql = "SELECT $column, user_id
|
$sql = "SELECT $column, user_id
|
||||||
FROM $table
|
FROM $table
|
||||||
|
@ -107,14 +107,14 @@ function phpbb_update_rows_avoiding_duplicates(phpbb_db_driver $db, $table, $col
|
||||||
*
|
*
|
||||||
* The only supported table is topics_watch.
|
* The only supported table is topics_watch.
|
||||||
*
|
*
|
||||||
* @param phpbb_db_driver $db Database object
|
* @param \phpbb\db\driver\driver $db Database object
|
||||||
* @param string $table Table on which to perform the update
|
* @param string $table Table on which to perform the update
|
||||||
* @param string $column Column whose values to change
|
* @param string $column Column whose values to change
|
||||||
* @param array $from_values An array of values that should be changed
|
* @param array $from_values An array of values that should be changed
|
||||||
* @param int $to_value The new value
|
* @param int $to_value The new value
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
function phpbb_update_rows_avoiding_duplicates_notify_status(phpbb_db_driver $db, $table, $column, $from_values, $to_value)
|
function phpbb_update_rows_avoiding_duplicates_notify_status(\phpbb\db\driver\driver $db, $table, $column, $from_values, $to_value)
|
||||||
{
|
{
|
||||||
$sql = "SELECT $column, user_id, notify_status
|
$sql = "SELECT $column, user_id, notify_status
|
||||||
FROM $table
|
FROM $table
|
||||||
|
|
|
@ -71,7 +71,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
|
||||||
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
|
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
|
||||||
'MESSAGE_TEXT' => $user->lang['FORUMS_MARKED']
|
'MESSAGE_TEXT' => $user->lang['FORUMS_MARKED']
|
||||||
);
|
);
|
||||||
$json_response = new phpbb_json_response();
|
$json_response = new \phpbb\json_response();
|
||||||
$json_response->send($data);
|
$json_response->send($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
|
||||||
}
|
}
|
||||||
else if ($config['load_anon_lastread'] || $user->data['is_registered'])
|
else if ($config['load_anon_lastread'] || $user->data['is_registered'])
|
||||||
{
|
{
|
||||||
$tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, phpbb_request_interface::COOKIE);
|
$tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE);
|
||||||
$tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array();
|
$tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array();
|
||||||
|
|
||||||
if (!$user->data['is_registered'])
|
if (!$user->data['is_registered'])
|
||||||
|
@ -346,7 +346,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
|
||||||
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
|
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
|
||||||
'MESSAGE_TEXT' => $user->lang['FORUMS_MARKED']
|
'MESSAGE_TEXT' => $user->lang['FORUMS_MARKED']
|
||||||
);
|
);
|
||||||
$json_response = new phpbb_json_response();
|
$json_response = new \phpbb\json_response();
|
||||||
$json_response->send($data);
|
$json_response->send($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1164,7 +1164,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id,
|
||||||
|
|
||||||
if ($token && check_link_hash($token, "{$mode}_$match_id") || confirm_box(true))
|
if ($token && check_link_hash($token, "{$mode}_$match_id") || confirm_box(true))
|
||||||
{
|
{
|
||||||
if ($uid != $user_id || $request->variable('unwatch', '', false, phpbb_request_interface::GET) != $mode)
|
if ($uid != $user_id || $request->variable('unwatch', '', false, \phpbb\request\request_interface::GET) != $mode)
|
||||||
{
|
{
|
||||||
$redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start");
|
$redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start");
|
||||||
$message = $user->lang['ERR_UNWATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');
|
$message = $user->lang['ERR_UNWATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');
|
||||||
|
@ -1229,7 +1229,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id,
|
||||||
|
|
||||||
if ($token && check_link_hash($token, "{$mode}_$match_id") || confirm_box(true))
|
if ($token && check_link_hash($token, "{$mode}_$match_id") || confirm_box(true))
|
||||||
{
|
{
|
||||||
if ($uid != $user_id || $request->variable('watch', '', false, phpbb_request_interface::GET) != $mode)
|
if ($uid != $user_id || $request->variable('watch', '', false, \phpbb\request\request_interface::GET) != $mode)
|
||||||
{
|
{
|
||||||
$redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start");
|
$redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start");
|
||||||
$message = $user->lang['ERR_WATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');
|
$message = $user->lang['ERR_WATCHING'] . '<br /><br />' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '<a href="' . $redirect_url . '">', '</a>');
|
||||||
|
@ -1272,8 +1272,8 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((isset($_GET['unwatch']) && $request->variable('unwatch', '', false, phpbb_request_interface::GET) == $mode) ||
|
if ((isset($_GET['unwatch']) && $request->variable('unwatch', '', false, \phpbb\request\request_interface::GET) == $mode) ||
|
||||||
(isset($_GET['watch']) && $request->variable('watch', '', false, phpbb_request_interface::GET) == $mode))
|
(isset($_GET['watch']) && $request->variable('watch', '', false, \phpbb\request\request_interface::GET) == $mode))
|
||||||
{
|
{
|
||||||
login_box();
|
login_box();
|
||||||
}
|
}
|
||||||
|
@ -1352,7 +1352,7 @@ function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank
|
||||||
*/
|
*/
|
||||||
function phpbb_get_user_avatar($user_row, $alt = 'USER_AVATAR', $ignore_config = false)
|
function phpbb_get_user_avatar($user_row, $alt = 'USER_AVATAR', $ignore_config = false)
|
||||||
{
|
{
|
||||||
$row = phpbb_avatar_manager::clean_row($user_row);
|
$row = \phpbb\avatar\manager::clean_row($user_row);
|
||||||
return phpbb_get_avatar($row, $alt, $ignore_config);
|
return phpbb_get_avatar($row, $alt, $ignore_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1367,14 +1367,14 @@ function phpbb_get_user_avatar($user_row, $alt = 'USER_AVATAR', $ignore_config =
|
||||||
*/
|
*/
|
||||||
function phpbb_get_group_avatar($user_row, $alt = 'GROUP_AVATAR', $ignore_config = false)
|
function phpbb_get_group_avatar($user_row, $alt = 'GROUP_AVATAR', $ignore_config = false)
|
||||||
{
|
{
|
||||||
$row = phpbb_avatar_manager::clean_row($user_row);
|
$row = \phpbb\avatar\manager::clean_row($user_row);
|
||||||
return phpbb_get_avatar($row, $alt, $ignore_config);
|
return phpbb_get_avatar($row, $alt, $ignore_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get avatar
|
* Get avatar
|
||||||
*
|
*
|
||||||
* @param array $row Row cleaned by phpbb_avatar_driver::clean_row
|
* @param array $row Row cleaned by \phpbb\avatar\driver\driver::clean_row
|
||||||
* @param string $alt Optional language string for alt tag within image, can be a language key or text
|
* @param string $alt Optional language string for alt tag within image, can be a language key or text
|
||||||
* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP
|
* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP
|
||||||
*
|
*
|
||||||
|
|
|
@ -596,7 +596,7 @@ function phpbb_parse_range_request($request_array, $filesize)
|
||||||
/**
|
/**
|
||||||
* Increments the download count of all provided attachments
|
* Increments the download count of all provided attachments
|
||||||
*
|
*
|
||||||
* @param phpbb_db_driver $db The database object
|
* @param \phpbb\db\driver\driver $db The database object
|
||||||
* @param array|int $ids The attach_id of each attachment
|
* @param array|int $ids The attach_id of each attachment
|
||||||
*
|
*
|
||||||
* @return null
|
* @return null
|
||||||
|
@ -617,8 +617,8 @@ function phpbb_increment_downloads($db, $ids)
|
||||||
/**
|
/**
|
||||||
* Handles authentication when downloading attachments from a post or topic
|
* Handles authentication when downloading attachments from a post or topic
|
||||||
*
|
*
|
||||||
* @param phpbb_db_driver $db The database object
|
* @param \phpbb\db\driver\driver $db The database object
|
||||||
* @param phpbb_auth $auth The authentication object
|
* @param \phpbb\auth\auth $auth The authentication object
|
||||||
* @param int $topic_id The id of the topic that we are downloading from
|
* @param int $topic_id The id of the topic that we are downloading from
|
||||||
*
|
*
|
||||||
* @return null
|
* @return null
|
||||||
|
@ -651,8 +651,8 @@ function phpbb_download_handle_forum_auth($db, $auth, $topic_id)
|
||||||
/**
|
/**
|
||||||
* Handles authentication when downloading attachments from PMs
|
* Handles authentication when downloading attachments from PMs
|
||||||
*
|
*
|
||||||
* @param phpbb_db_driver $db The database object
|
* @param \phpbb\db\driver\driver $db The database object
|
||||||
* @param phpbb_auth $auth The authentication object
|
* @param \phpbb\auth\auth $auth The authentication object
|
||||||
* @param int $user_id The user id
|
* @param int $user_id The user id
|
||||||
* @param int $msg_id The id of the PM that we are downloading from
|
* @param int $msg_id The id of the PM that we are downloading from
|
||||||
*
|
*
|
||||||
|
@ -678,7 +678,7 @@ function phpbb_download_handle_pm_auth($db, $auth, $user_id, $msg_id)
|
||||||
/**
|
/**
|
||||||
* Checks whether a user can download from a particular PM
|
* Checks whether a user can download from a particular PM
|
||||||
*
|
*
|
||||||
* @param phpbb_db_driver $db The database object
|
* @param \phpbb\db\driver\driver $db The database object
|
||||||
* @param int $user_id The user id
|
* @param int $user_id The user id
|
||||||
* @param int $msg_id The id of the PM that we are downloading from
|
* @param int $msg_id The id of the PM that we are downloading from
|
||||||
*
|
*
|
||||||
|
|
|
@ -28,7 +28,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
|
||||||
'SCHEMA' => 'firebird',
|
'SCHEMA' => 'firebird',
|
||||||
'MODULE' => 'interbase',
|
'MODULE' => 'interbase',
|
||||||
'DELIM' => ';;',
|
'DELIM' => ';;',
|
||||||
'DRIVER' => 'phpbb_db_driver_firebird',
|
'DRIVER' => 'phpbb\db\driver\firebird',
|
||||||
'AVAILABLE' => true,
|
'AVAILABLE' => true,
|
||||||
'2.0.x' => false,
|
'2.0.x' => false,
|
||||||
),
|
),
|
||||||
|
@ -39,7 +39,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
|
||||||
'SCHEMA' => 'mysql_41',
|
'SCHEMA' => 'mysql_41',
|
||||||
'MODULE' => 'mysqli',
|
'MODULE' => 'mysqli',
|
||||||
'DELIM' => ';',
|
'DELIM' => ';',
|
||||||
'DRIVER' => 'phpbb_db_driver_mysqli',
|
'DRIVER' => 'phpbb\db\driver\mysqli',
|
||||||
'AVAILABLE' => true,
|
'AVAILABLE' => true,
|
||||||
'2.0.x' => true,
|
'2.0.x' => true,
|
||||||
),
|
),
|
||||||
|
@ -48,7 +48,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
|
||||||
'SCHEMA' => 'mysql',
|
'SCHEMA' => 'mysql',
|
||||||
'MODULE' => 'mysql',
|
'MODULE' => 'mysql',
|
||||||
'DELIM' => ';',
|
'DELIM' => ';',
|
||||||
'DRIVER' => 'phpbb_db_driver_mysql',
|
'DRIVER' => 'phpbb\db\driver\mysql',
|
||||||
'AVAILABLE' => true,
|
'AVAILABLE' => true,
|
||||||
'2.0.x' => true,
|
'2.0.x' => true,
|
||||||
),
|
),
|
||||||
|
@ -57,7 +57,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
|
||||||
'SCHEMA' => 'mssql',
|
'SCHEMA' => 'mssql',
|
||||||
'MODULE' => 'mssql',
|
'MODULE' => 'mssql',
|
||||||
'DELIM' => 'GO',
|
'DELIM' => 'GO',
|
||||||
'DRIVER' => 'phpbb_db_driver_mssql',
|
'DRIVER' => 'phpbb\db\driver\mssql',
|
||||||
'AVAILABLE' => true,
|
'AVAILABLE' => true,
|
||||||
'2.0.x' => true,
|
'2.0.x' => true,
|
||||||
),
|
),
|
||||||
|
@ -66,7 +66,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
|
||||||
'SCHEMA' => 'mssql',
|
'SCHEMA' => 'mssql',
|
||||||
'MODULE' => 'odbc',
|
'MODULE' => 'odbc',
|
||||||
'DELIM' => 'GO',
|
'DELIM' => 'GO',
|
||||||
'DRIVER' => 'phpbb_db_driver_mssql_odbc',
|
'DRIVER' => 'phpbb\db\driver\mssql_odbc',
|
||||||
'AVAILABLE' => true,
|
'AVAILABLE' => true,
|
||||||
'2.0.x' => true,
|
'2.0.x' => true,
|
||||||
),
|
),
|
||||||
|
@ -75,7 +75,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
|
||||||
'SCHEMA' => 'mssql',
|
'SCHEMA' => 'mssql',
|
||||||
'MODULE' => 'sqlsrv',
|
'MODULE' => 'sqlsrv',
|
||||||
'DELIM' => 'GO',
|
'DELIM' => 'GO',
|
||||||
'DRIVER' => 'phpbb_db_driver_mssqlnative',
|
'DRIVER' => 'phpbb\db\driver\mssqlnative',
|
||||||
'AVAILABLE' => true,
|
'AVAILABLE' => true,
|
||||||
'2.0.x' => false,
|
'2.0.x' => false,
|
||||||
),
|
),
|
||||||
|
@ -84,7 +84,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
|
||||||
'SCHEMA' => 'oracle',
|
'SCHEMA' => 'oracle',
|
||||||
'MODULE' => 'oci8',
|
'MODULE' => 'oci8',
|
||||||
'DELIM' => '/',
|
'DELIM' => '/',
|
||||||
'DRIVER' => 'phpbb_db_driver_oracle',
|
'DRIVER' => 'phpbb\db\driver\oracle',
|
||||||
'AVAILABLE' => true,
|
'AVAILABLE' => true,
|
||||||
'2.0.x' => false,
|
'2.0.x' => false,
|
||||||
),
|
),
|
||||||
|
@ -93,7 +93,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
|
||||||
'SCHEMA' => 'postgres',
|
'SCHEMA' => 'postgres',
|
||||||
'MODULE' => 'pgsql',
|
'MODULE' => 'pgsql',
|
||||||
'DELIM' => ';',
|
'DELIM' => ';',
|
||||||
'DRIVER' => 'phpbb_db_driver_postgres',
|
'DRIVER' => 'phpbb\db\driver\postgres',
|
||||||
'AVAILABLE' => true,
|
'AVAILABLE' => true,
|
||||||
'2.0.x' => true,
|
'2.0.x' => true,
|
||||||
),
|
),
|
||||||
|
@ -102,7 +102,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
|
||||||
'SCHEMA' => 'sqlite',
|
'SCHEMA' => 'sqlite',
|
||||||
'MODULE' => 'sqlite',
|
'MODULE' => 'sqlite',
|
||||||
'DELIM' => ';',
|
'DELIM' => ';',
|
||||||
'DRIVER' => 'phpbb_db_driver_sqlite',
|
'DRIVER' => 'phpbb\db\driver\sqlite',
|
||||||
'AVAILABLE' => true,
|
'AVAILABLE' => true,
|
||||||
'2.0.x' => false,
|
'2.0.x' => false,
|
||||||
),
|
),
|
||||||
|
@ -184,7 +184,7 @@ function dbms_select($default = '', $only_20x_options = false)
|
||||||
*/
|
*/
|
||||||
function get_tables(&$db)
|
function get_tables(&$db)
|
||||||
{
|
{
|
||||||
$db_tools = new phpbb_db_tools($db);
|
$db_tools = new \phpbb\db\tools($db);
|
||||||
|
|
||||||
return $db_tools->sql_list_tables();
|
return $db_tools->sql_list_tables();
|
||||||
}
|
}
|
||||||
|
@ -206,14 +206,14 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
|
||||||
$db->sql_return_on_error(true);
|
$db->sql_return_on_error(true);
|
||||||
|
|
||||||
// Check that we actually have a database name before going any further.....
|
// Check that we actually have a database name before going any further.....
|
||||||
if ($dbms_details['DRIVER'] != 'phpbb_db_driver_sqlite' && $dbms_details['DRIVER'] != 'phpbb_db_driver_oracle' && $dbname === '')
|
if ($dbms_details['DRIVER'] != 'phpbb\db\driver\sqlite' && $dbms_details['DRIVER'] != 'phpbb\db\driver\oracle' && $dbname === '')
|
||||||
{
|
{
|
||||||
$error[] = $lang['INST_ERR_DB_NO_NAME'];
|
$error[] = $lang['INST_ERR_DB_NO_NAME'];
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure we don't have a daft user who thinks having the SQLite database in the forum directory is a good idea
|
// Make sure we don't have a daft user who thinks having the SQLite database in the forum directory is a good idea
|
||||||
if ($dbms_details['DRIVER'] == 'phpbb_db_driver_sqlite' && stripos(phpbb_realpath($dbhost), phpbb_realpath('../')) === 0)
|
if ($dbms_details['DRIVER'] == 'phpbb\db\driver\sqlite' && stripos(phpbb_realpath($dbhost), phpbb_realpath('../')) === 0)
|
||||||
{
|
{
|
||||||
$error[] = $lang['INST_ERR_DB_FORUM_PATH'];
|
$error[] = $lang['INST_ERR_DB_FORUM_PATH'];
|
||||||
return false;
|
return false;
|
||||||
|
@ -222,8 +222,8 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
|
||||||
// Check the prefix length to ensure that index names are not too long and does not contain invalid characters
|
// Check the prefix length to ensure that index names are not too long and does not contain invalid characters
|
||||||
switch ($dbms_details['DRIVER'])
|
switch ($dbms_details['DRIVER'])
|
||||||
{
|
{
|
||||||
case 'phpbb_db_driver_mysql':
|
case 'phpbb\db\driver\mysql':
|
||||||
case 'phpbb_db_driver_mysqli':
|
case 'phpbb\db\driver\mysqli':
|
||||||
if (strspn($table_prefix, '-./\\') !== 0)
|
if (strspn($table_prefix, '-./\\') !== 0)
|
||||||
{
|
{
|
||||||
$error[] = $lang['INST_ERR_PREFIX_INVALID'];
|
$error[] = $lang['INST_ERR_PREFIX_INVALID'];
|
||||||
|
@ -232,22 +232,22 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
|
||||||
|
|
||||||
// no break;
|
// no break;
|
||||||
|
|
||||||
case 'phpbb_db_driver_postgres':
|
case 'phpbb\db\driver\postgres':
|
||||||
$prefix_length = 36;
|
$prefix_length = 36;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'phpbb_db_driver_mssql':
|
case 'phpbb\db\driver\mssql':
|
||||||
case 'phpbb_db_driver_mssql_odbc':
|
case 'phpbb\db\driver\mssql_odbc':
|
||||||
case 'phpbb_db_driver_mssqlnative':
|
case 'phpbb\db\driver\mssqlnative':
|
||||||
$prefix_length = 90;
|
$prefix_length = 90;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'phpbb_db_driver_sqlite':
|
case 'phpbb\db\driver\sqlite':
|
||||||
$prefix_length = 200;
|
$prefix_length = 200;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'phpbb_db_driver_firebird':
|
case 'phpbb\db\driver\firebird':
|
||||||
case 'phpbb_db_driver_oracle':
|
case 'phpbb\db\driver\oracle':
|
||||||
$prefix_length = 6;
|
$prefix_length = 6;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -285,21 +285,21 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
|
||||||
// Make sure that the user has selected a sensible DBAL for the DBMS actually installed
|
// Make sure that the user has selected a sensible DBAL for the DBMS actually installed
|
||||||
switch ($dbms_details['DRIVER'])
|
switch ($dbms_details['DRIVER'])
|
||||||
{
|
{
|
||||||
case 'phpbb_db_driver_mysqli':
|
case 'phpbb\db\driver\mysqli':
|
||||||
if (version_compare(mysqli_get_server_info($db->db_connect_id), '4.1.3', '<'))
|
if (version_compare(mysqli_get_server_info($db->db_connect_id), '4.1.3', '<'))
|
||||||
{
|
{
|
||||||
$error[] = $lang['INST_ERR_DB_NO_MYSQLI'];
|
$error[] = $lang['INST_ERR_DB_NO_MYSQLI'];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'phpbb_db_driver_sqlite':
|
case 'phpbb\db\driver\sqlite':
|
||||||
if (version_compare(sqlite_libversion(), '2.8.2', '<'))
|
if (version_compare(sqlite_libversion(), '2.8.2', '<'))
|
||||||
{
|
{
|
||||||
$error[] = $lang['INST_ERR_DB_NO_SQLITE'];
|
$error[] = $lang['INST_ERR_DB_NO_SQLITE'];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'phpbb_db_driver_firebird':
|
case 'phpbb\db\driver\firebird':
|
||||||
// check the version of FB, use some hackery if we can't get access to the server info
|
// check the version of FB, use some hackery if we can't get access to the server info
|
||||||
if ($db->service_handle !== false && function_exists('ibase_server_info'))
|
if ($db->service_handle !== false && function_exists('ibase_server_info'))
|
||||||
{
|
{
|
||||||
|
@ -380,7 +380,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'phpbb_db_driver_oracle':
|
case 'phpbb\db\driver\oracle':
|
||||||
if ($unicode_check)
|
if ($unicode_check)
|
||||||
{
|
{
|
||||||
$sql = "SELECT *
|
$sql = "SELECT *
|
||||||
|
@ -402,7 +402,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'phpbb_db_driver_postgres':
|
case 'phpbb\db\driver\postgres':
|
||||||
if ($unicode_check)
|
if ($unicode_check)
|
||||||
{
|
{
|
||||||
$sql = "SHOW server_encoding;";
|
$sql = "SHOW server_encoding;";
|
||||||
|
@ -507,7 +507,7 @@ function phpbb_create_config_file_data($data, $dbms, $debug = false, $debug_test
|
||||||
|
|
||||||
'adm_relative_path' => 'adm/',
|
'adm_relative_path' => 'adm/',
|
||||||
|
|
||||||
'acm_type' => 'phpbb_cache_driver_file',
|
'acm_type' => 'phpbb\cache\driver\file',
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($config_data_array as $key => $value)
|
foreach ($config_data_array as $key => $value)
|
||||||
|
|
|
@ -27,7 +27,7 @@ class messenger
|
||||||
var $mail_priority = MAIL_NORMAL_PRIORITY;
|
var $mail_priority = MAIL_NORMAL_PRIORITY;
|
||||||
var $use_queue = true;
|
var $use_queue = true;
|
||||||
|
|
||||||
/** @var phpbb_template */
|
/** @var \phpbb\template\template */
|
||||||
protected $template;
|
protected $template;
|
||||||
|
|
||||||
var $eol = "\n";
|
var $eol = "\n";
|
||||||
|
@ -628,12 +628,12 @@ class messenger
|
||||||
{
|
{
|
||||||
global $config, $phpbb_filesystem, $user, $phpbb_extension_manager;
|
global $config, $phpbb_filesystem, $user, $phpbb_extension_manager;
|
||||||
|
|
||||||
if ($this->template instanceof phpbb_template)
|
if ($this->template instanceof \phpbb\template\template)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->template = new phpbb_template_twig($phpbb_filesystem, $config, $user, new phpbb_template_context(), $phpbb_extension_manager);
|
$this->template = new \phpbb\template\twig\twig($phpbb_filesystem, $config, $user, new \phpbb\template\context(), $phpbb_extension_manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -700,7 +700,7 @@ class queue
|
||||||
{
|
{
|
||||||
global $db, $config, $phpEx, $phpbb_root_path, $user;
|
global $db, $config, $phpEx, $phpbb_root_path, $user;
|
||||||
|
|
||||||
$lock = new phpbb_lock_flock($this->cache_file);
|
$lock = new \phpbb\lock\flock($this->cache_file);
|
||||||
$lock->acquire();
|
$lock->acquire();
|
||||||
|
|
||||||
// avoid races, check file existence once
|
// avoid races, check file existence once
|
||||||
|
@ -870,7 +870,7 @@ class queue
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$lock = new phpbb_lock_flock($this->cache_file);
|
$lock = new \phpbb\lock\flock($this->cache_file);
|
||||||
$lock->acquire();
|
$lock->acquire();
|
||||||
|
|
||||||
if (file_exists($this->cache_file))
|
if (file_exists($this->cache_file))
|
||||||
|
@ -987,12 +987,12 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $headers = false)
|
||||||
$smtp->add_backtrace('Connecting to ' . $config['smtp_host'] . ':' . $config['smtp_port']);
|
$smtp->add_backtrace('Connecting to ' . $config['smtp_host'] . ':' . $config['smtp_port']);
|
||||||
|
|
||||||
// Ok we have error checked as much as we can to this point let's get on it already.
|
// Ok we have error checked as much as we can to this point let's get on it already.
|
||||||
if (!class_exists('phpbb_error_collector'))
|
if (!class_exists('\phpbb\error_collector'))
|
||||||
{
|
{
|
||||||
global $phpbb_root_path, $phpEx;
|
global $phpbb_root_path, $phpEx;
|
||||||
include($phpbb_root_path . 'includes/error_collector.' . $phpEx);
|
include($phpbb_root_path . 'includes/error_collector.' . $phpEx);
|
||||||
}
|
}
|
||||||
$collector = new phpbb_error_collector;
|
$collector = new \phpbb\error_collector;
|
||||||
$collector->install();
|
$collector->install();
|
||||||
$smtp->socket = fsockopen($config['smtp_host'], $config['smtp_port'], $errno, $errstr, 20);
|
$smtp->socket = fsockopen($config['smtp_host'], $config['smtp_port'], $errno, $errstr, 20);
|
||||||
$collector->uninstall();
|
$collector->uninstall();
|
||||||
|
@ -1706,12 +1706,12 @@ function phpbb_mail($to, $subject, $msg, $headers, $eol, &$err_msg)
|
||||||
// Reference: http://bugs.php.net/bug.php?id=15841
|
// Reference: http://bugs.php.net/bug.php?id=15841
|
||||||
$headers = implode($eol, $headers);
|
$headers = implode($eol, $headers);
|
||||||
|
|
||||||
if (!class_exists('phpbb_error_collector'))
|
if (!class_exists('\phpbb\error_collector'))
|
||||||
{
|
{
|
||||||
include($phpbb_root_path . 'includes/error_collector.' . $phpEx);
|
include($phpbb_root_path . 'includes/error_collector.' . $phpEx);
|
||||||
}
|
}
|
||||||
|
|
||||||
$collector = new phpbb_error_collector;
|
$collector = new \phpbb\error_collector;
|
||||||
$collector->install();
|
$collector->install();
|
||||||
|
|
||||||
// On some PHP Versions mail() *may* fail if there are newlines within the subject.
|
// On some PHP Versions mail() *may* fail if there are newlines within the subject.
|
||||||
|
|
|
@ -499,12 +499,12 @@ class p_master
|
||||||
* the style paths for the extension (the ext author can change them
|
* the style paths for the extension (the ext author can change them
|
||||||
* if necessary).
|
* if necessary).
|
||||||
*/
|
*/
|
||||||
$module_dir = explode('_', get_class($this->module));
|
$module_dir = explode('\\', get_class($this->module));
|
||||||
|
|
||||||
// 0 phpbb, 1 ext, 2 vendor, 3 extension name, ...
|
// 0 vendor, 1 extension name, ...
|
||||||
if (isset($module_dir[3]) && $module_dir[1] === 'ext')
|
if (isset($module_dir[1]))
|
||||||
{
|
{
|
||||||
$module_style_dir = $phpbb_root_path . 'ext/' . $module_dir[2] . '/' . $module_dir[3] . '/adm/style';
|
$module_style_dir = $phpbb_root_path . 'ext/' . $module_dir[0] . '/' . $module_dir[1] . '/adm/style';
|
||||||
|
|
||||||
if (is_dir($module_style_dir))
|
if (is_dir($module_style_dir))
|
||||||
{
|
{
|
||||||
|
@ -973,7 +973,7 @@ class p_master
|
||||||
*/
|
*/
|
||||||
protected function get_short_name($basename)
|
protected function get_short_name($basename)
|
||||||
{
|
{
|
||||||
if (substr($basename, 0, 6) === 'phpbb_')
|
if (substr($basename, 0, 6) === 'phpbb\\' || strpos($basename, '\\') !== false)
|
||||||
{
|
{
|
||||||
return $basename;
|
return $basename;
|
||||||
}
|
}
|
||||||
|
@ -990,6 +990,6 @@ class p_master
|
||||||
*/
|
*/
|
||||||
protected function is_full_class($basename)
|
protected function is_full_class($basename)
|
||||||
{
|
{
|
||||||
return (preg_match('/^(phpbb|ucp|mcp|acp)_/', $basename));
|
return (strpos($basename, '\\') !== false || preg_match('/^(ucp|mcp|acp)_/', $basename));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -343,7 +343,7 @@ function check_rule(&$rules, &$rule_row, &$message_row, $user_id)
|
||||||
$userdata = $db->sql_fetchrow($result);
|
$userdata = $db->sql_fetchrow($result);
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
$auth2 = new phpbb_auth();
|
$auth2 = new \phpbb\auth\auth();
|
||||||
$auth2->acl($userdata);
|
$auth2->acl($userdata);
|
||||||
|
|
||||||
if (!$auth2->acl_get('a_') && !$auth2->acl_get('m_') && !$auth2->acl_getf_global('m_'))
|
if (!$auth2->acl_get('a_') && !$auth2->acl_get('m_') && !$auth2->acl_getf_global('m_'))
|
||||||
|
|
|
@ -713,7 +713,7 @@ class fileupload
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->common_checks($file);
|
$this->common_checks($file);
|
||||||
$request->overwrite('local', $upload, phpbb_request_interface::FILES);
|
$request->overwrite('local', $upload, \phpbb\request\request_interface::FILES);
|
||||||
|
|
||||||
return $file;
|
return $file;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,13 +22,13 @@ if (!defined('IN_PHPBB'))
|
||||||
/**
|
/**
|
||||||
* Create a new UrlMatcher class and dump it into the cache file
|
* Create a new UrlMatcher class and dump it into the cache file
|
||||||
*
|
*
|
||||||
* @param phpbb_extension_finder $finder Extension finder
|
* @param \phpbb\extension\finder $finder Extension finder
|
||||||
* @param RequestContext $context Symfony RequestContext object
|
* @param RequestContext $context Symfony RequestContext object
|
||||||
* @param string $root_path Root path
|
* @param string $root_path Root path
|
||||||
* @param string $php_ext PHP extension
|
* @param string $php_ext PHP extension
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
function phpbb_get_url_matcher(phpbb_extension_finder $finder, RequestContext $context, $root_path, $php_ext)
|
function phpbb_get_url_matcher(\phpbb\extension\finder $finder, RequestContext $context, $root_path, $php_ext)
|
||||||
{
|
{
|
||||||
if (defined('DEBUG'))
|
if (defined('DEBUG'))
|
||||||
{
|
{
|
||||||
|
@ -46,14 +46,14 @@ function phpbb_get_url_matcher(phpbb_extension_finder $finder, RequestContext $c
|
||||||
/**
|
/**
|
||||||
* Create a new UrlMatcher class and dump it into the cache file
|
* Create a new UrlMatcher class and dump it into the cache file
|
||||||
*
|
*
|
||||||
* @param phpbb_extension_finder $finder Extension finder
|
* @param \phpbb\extension\finder $finder Extension finder
|
||||||
* @param string $root_path Root path
|
* @param string $root_path Root path
|
||||||
* @param string $php_ext PHP extension
|
* @param string $php_ext PHP extension
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
function phpbb_create_dumped_url_matcher(phpbb_extension_finder $finder, $root_path, $php_ext)
|
function phpbb_create_dumped_url_matcher(\phpbb\extension\finder $finder, $root_path, $php_ext)
|
||||||
{
|
{
|
||||||
$provider = new phpbb_controller_provider();
|
$provider = new \phpbb\controller\provider();
|
||||||
$routes = $provider->import_paths_from_finder($finder)->find();
|
$routes = $provider->import_paths_from_finder($finder)->find();
|
||||||
$dumper = new PhpMatcherDumper($routes);
|
$dumper = new PhpMatcherDumper($routes);
|
||||||
$cached_url_matcher_dump = $dumper->dump(array(
|
$cached_url_matcher_dump = $dumper->dump(array(
|
||||||
|
@ -66,13 +66,13 @@ function phpbb_create_dumped_url_matcher(phpbb_extension_finder $finder, $root_p
|
||||||
/**
|
/**
|
||||||
* Create a non-cached UrlMatcher
|
* Create a non-cached UrlMatcher
|
||||||
*
|
*
|
||||||
* @param phpbb_extension_finder $finder Extension finder
|
* @param \phpbb\extension\finder $finder Extension finder
|
||||||
* @param RequestContext $context Symfony RequestContext object
|
* @param RequestContext $context Symfony RequestContext object
|
||||||
* @return UrlMatcher
|
* @return UrlMatcher
|
||||||
*/
|
*/
|
||||||
function phpbb_create_url_matcher(phpbb_extension_finder $finder, RequestContext $context)
|
function phpbb_create_url_matcher(\phpbb\extension\finder $finder, RequestContext $context)
|
||||||
{
|
{
|
||||||
$provider = new phpbb_controller_provider();
|
$provider = new \phpbb\controller\provider();
|
||||||
$routes = $provider->import_paths_from_finder($finder)->find();
|
$routes = $provider->import_paths_from_finder($finder)->find();
|
||||||
return new UrlMatcher($routes, $context);
|
return new UrlMatcher($routes, $context);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2150,8 +2150,8 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
|
||||||
|
|
||||||
if (!sizeof($error))
|
if (!sizeof($error))
|
||||||
{
|
{
|
||||||
$current_legend = phpbb_groupposition_legend::GROUP_DISABLED;
|
$current_legend = \phpbb\groupposition\legend::GROUP_DISABLED;
|
||||||
$current_teampage = phpbb_groupposition_teampage::GROUP_DISABLED;
|
$current_teampage = \phpbb\groupposition\teampage::GROUP_DISABLED;
|
||||||
|
|
||||||
$legend = $phpbb_container->get('groupposition.legend');
|
$legend = $phpbb_container->get('groupposition.legend');
|
||||||
$teampage = $phpbb_container->get('groupposition.teampage');
|
$teampage = $phpbb_container->get('groupposition.teampage');
|
||||||
|
@ -2162,7 +2162,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
|
||||||
$current_legend = $legend->get_group_value($group_id);
|
$current_legend = $legend->get_group_value($group_id);
|
||||||
$current_teampage = $teampage->get_group_value($group_id);
|
$current_teampage = $teampage->get_group_value($group_id);
|
||||||
}
|
}
|
||||||
catch (phpbb_groupposition_exception $exception)
|
catch (\phpbb\groupposition\exception $exception)
|
||||||
{
|
{
|
||||||
trigger_error($user->lang($exception->getMessage()));
|
trigger_error($user->lang($exception->getMessage()));
|
||||||
}
|
}
|
||||||
|
@ -2170,7 +2170,7 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
|
||||||
|
|
||||||
if (!empty($group_attributes['group_legend']))
|
if (!empty($group_attributes['group_legend']))
|
||||||
{
|
{
|
||||||
if (($group_id && ($current_legend == phpbb_groupposition_legend::GROUP_DISABLED)) || !$group_id)
|
if (($group_id && ($current_legend == \phpbb\groupposition\legend::GROUP_DISABLED)) || !$group_id)
|
||||||
{
|
{
|
||||||
// Old group currently not in the legend or new group, add at the end.
|
// Old group currently not in the legend or new group, add at the end.
|
||||||
$group_attributes['group_legend'] = 1 + $legend->get_group_count();
|
$group_attributes['group_legend'] = 1 + $legend->get_group_count();
|
||||||
|
@ -2181,22 +2181,22 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
|
||||||
$group_attributes['group_legend'] = $current_legend;
|
$group_attributes['group_legend'] = $current_legend;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($group_id && ($current_legend != phpbb_groupposition_legend::GROUP_DISABLED))
|
else if ($group_id && ($current_legend != \phpbb\groupposition\legend::GROUP_DISABLED))
|
||||||
{
|
{
|
||||||
// Group is removed from the legend
|
// Group is removed from the legend
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$legend->delete_group($group_id, true);
|
$legend->delete_group($group_id, true);
|
||||||
}
|
}
|
||||||
catch (phpbb_groupposition_exception $exception)
|
catch (\phpbb\groupposition\exception $exception)
|
||||||
{
|
{
|
||||||
trigger_error($user->lang($exception->getMessage()));
|
trigger_error($user->lang($exception->getMessage()));
|
||||||
}
|
}
|
||||||
$group_attributes['group_legend'] = phpbb_groupposition_legend::GROUP_DISABLED;
|
$group_attributes['group_legend'] = \phpbb\groupposition\legend::GROUP_DISABLED;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$group_attributes['group_legend'] = phpbb_groupposition_legend::GROUP_DISABLED;
|
$group_attributes['group_legend'] = \phpbb\groupposition\legend::GROUP_DISABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unset the objects, we don't need them anymore.
|
// Unset the objects, we don't need them anymore.
|
||||||
|
@ -2296,13 +2296,13 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
|
||||||
|
|
||||||
// Remove the group from the teampage, only if unselected and we are editing a group,
|
// Remove the group from the teampage, only if unselected and we are editing a group,
|
||||||
// which is currently displayed.
|
// which is currently displayed.
|
||||||
if (!$group_teampage && $group_id && $current_teampage != phpbb_groupposition_teampage::GROUP_DISABLED)
|
if (!$group_teampage && $group_id && $current_teampage != \phpbb\groupposition\teampage::GROUP_DISABLED)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$teampage->delete_group($group_id);
|
$teampage->delete_group($group_id);
|
||||||
}
|
}
|
||||||
catch (phpbb_groupposition_exception $exception)
|
catch (\phpbb\groupposition\exception $exception)
|
||||||
{
|
{
|
||||||
trigger_error($user->lang($exception->getMessage()));
|
trigger_error($user->lang($exception->getMessage()));
|
||||||
}
|
}
|
||||||
|
@ -2320,24 +2320,24 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if ($group_teampage && $current_teampage == phpbb_groupposition_teampage::GROUP_DISABLED)
|
if ($group_teampage && $current_teampage == \phpbb\groupposition\teampage::GROUP_DISABLED)
|
||||||
{
|
{
|
||||||
$teampage->add_group($group_id);
|
$teampage->add_group($group_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($group_teampage)
|
if ($group_teampage)
|
||||||
{
|
{
|
||||||
if ($current_teampage == phpbb_groupposition_teampage::GROUP_DISABLED)
|
if ($current_teampage == \phpbb\groupposition\teampage::GROUP_DISABLED)
|
||||||
{
|
{
|
||||||
$teampage->add_group($group_id);
|
$teampage->add_group($group_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($group_id && ($current_teampage != phpbb_groupposition_teampage::GROUP_DISABLED))
|
else if ($group_id && ($current_teampage != \phpbb\groupposition\teampage::GROUP_DISABLED))
|
||||||
{
|
{
|
||||||
$teampage->delete_group($group_id);
|
$teampage->delete_group($group_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (phpbb_groupposition_exception $exception)
|
catch (\phpbb\groupposition\exception $exception)
|
||||||
{
|
{
|
||||||
trigger_error($user->lang($exception->getMessage()));
|
trigger_error($user->lang($exception->getMessage()));
|
||||||
}
|
}
|
||||||
|
@ -2472,7 +2472,7 @@ function group_delete($group_id, $group_name = false)
|
||||||
$legend->delete_group($group_id);
|
$legend->delete_group($group_id);
|
||||||
unset($legend);
|
unset($legend);
|
||||||
}
|
}
|
||||||
catch (phpbb_groupposition_exception $exception)
|
catch (\phpbb\groupposition\exception $exception)
|
||||||
{
|
{
|
||||||
// The group we want to delete does not exist.
|
// The group we want to delete does not exist.
|
||||||
// No reason to worry, we just continue the deleting process.
|
// No reason to worry, we just continue the deleting process.
|
||||||
|
@ -2485,7 +2485,7 @@ function group_delete($group_id, $group_name = false)
|
||||||
$teampage->delete_group($group_id);
|
$teampage->delete_group($group_id);
|
||||||
unset($teampage);
|
unset($teampage);
|
||||||
}
|
}
|
||||||
catch (phpbb_groupposition_exception $exception)
|
catch (\phpbb\groupposition\exception $exception)
|
||||||
{
|
{
|
||||||
// The group we want to delete does not exist.
|
// The group we want to delete does not exist.
|
||||||
// No reason to worry, we just continue the deleting process.
|
// No reason to worry, we just continue the deleting process.
|
||||||
|
|
|
@ -36,8 +36,8 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
|
||||||
// Fixes a "bug" that makes forum_view use the same ordering as topic_view
|
// Fixes a "bug" that makes forum_view use the same ordering as topic_view
|
||||||
$request->overwrite('sk', null);
|
$request->overwrite('sk', null);
|
||||||
$request->overwrite('sd', null);
|
$request->overwrite('sd', null);
|
||||||
$request->overwrite('sk', null, phpbb_request_interface::POST);
|
$request->overwrite('sk', null, \phpbb\request\request_interface::POST);
|
||||||
$request->overwrite('sd', null, phpbb_request_interface::POST);
|
$request->overwrite('sd', null, \phpbb\request\request_interface::POST);
|
||||||
}
|
}
|
||||||
|
|
||||||
$forum_id = $forum_info['forum_id'];
|
$forum_id = $forum_info['forum_id'];
|
||||||
|
|
|
@ -462,7 +462,7 @@ function mcp_move_topic($topic_ids)
|
||||||
|
|
||||||
if (!$to_forum_id || $additional_msg)
|
if (!$to_forum_id || $additional_msg)
|
||||||
{
|
{
|
||||||
$request->overwrite('confirm', null, phpbb_request_interface::POST);
|
$request->overwrite('confirm', null, \phpbb\request\request_interface::POST);
|
||||||
$request->overwrite('confirm_key', null);
|
$request->overwrite('confirm_key', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -694,7 +694,7 @@ function mcp_restore_topic($topic_ids)
|
||||||
}
|
}
|
||||||
|
|
||||||
$topic_id = $request->variable('t', 0);
|
$topic_id = $request->variable('t', 0);
|
||||||
if (!$request->is_set('quickmod', phpbb_request_interface::REQUEST))
|
if (!$request->is_set('quickmod', \phpbb\request\request_interface::REQUEST))
|
||||||
{
|
{
|
||||||
$redirect = $request->variable('redirect', "index.$phpEx");
|
$redirect = $request->variable('redirect', "index.$phpEx");
|
||||||
$redirect = reapply_sid($redirect);
|
$redirect = reapply_sid($redirect);
|
||||||
|
@ -823,7 +823,7 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
$topic_id = $request->variable('t', 0);
|
$topic_id = $request->variable('t', 0);
|
||||||
if (!$request->is_set('quickmod', phpbb_request_interface::REQUEST))
|
if (!$request->is_set('quickmod', \phpbb\request\request_interface::REQUEST))
|
||||||
{
|
{
|
||||||
$redirect = $request->variable('redirect', "index.$phpEx");
|
$redirect = $request->variable('redirect', "index.$phpEx");
|
||||||
$redirect = reapply_sid($redirect);
|
$redirect = reapply_sid($redirect);
|
||||||
|
@ -1136,7 +1136,7 @@ function mcp_fork_topic($topic_ids)
|
||||||
|
|
||||||
if ($additional_msg)
|
if ($additional_msg)
|
||||||
{
|
{
|
||||||
$request->overwrite('confirm', null, phpbb_request_interface::POST);
|
$request->overwrite('confirm', null, \phpbb\request\request_interface::POST);
|
||||||
$request->overwrite('confirm_key', null);
|
$request->overwrite('confirm_key', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -729,7 +729,7 @@ class mcp_queue
|
||||||
|
|
||||||
if ($request->is_ajax())
|
if ($request->is_ajax())
|
||||||
{
|
{
|
||||||
$json_response = new phpbb_json_response;
|
$json_response = new \phpbb\json_response;
|
||||||
$json_response->send(array(
|
$json_response->send(array(
|
||||||
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
|
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
|
||||||
'MESSAGE_TEXT' => $message,
|
'MESSAGE_TEXT' => $message,
|
||||||
|
@ -877,7 +877,7 @@ class mcp_queue
|
||||||
|
|
||||||
if ($request->is_ajax())
|
if ($request->is_ajax())
|
||||||
{
|
{
|
||||||
$json_response = new phpbb_json_response;
|
$json_response = new \phpbb\json_response;
|
||||||
$json_response->send(array(
|
$json_response->send(array(
|
||||||
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
|
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
|
||||||
'MESSAGE_TEXT' => $message,
|
'MESSAGE_TEXT' => $message,
|
||||||
|
@ -937,9 +937,9 @@ class mcp_queue
|
||||||
{
|
{
|
||||||
$additional_msg = $user->lang['NO_REASON_DISAPPROVAL'];
|
$additional_msg = $user->lang['NO_REASON_DISAPPROVAL'];
|
||||||
|
|
||||||
$request->overwrite('confirm', null, phpbb_request_interface::POST);
|
$request->overwrite('confirm', null, \phpbb\request\request_interface::POST);
|
||||||
$request->overwrite('confirm_key', null, phpbb_request_interface::POST);
|
$request->overwrite('confirm_key', null, \phpbb\request\request_interface::POST);
|
||||||
$request->overwrite('confirm_key', null, phpbb_request_interface::REQUEST);
|
$request->overwrite('confirm_key', null, \phpbb\request\request_interface::REQUEST);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1212,7 +1212,7 @@ class mcp_queue
|
||||||
|
|
||||||
if ($request->is_ajax())
|
if ($request->is_ajax())
|
||||||
{
|
{
|
||||||
$json_response = new phpbb_json_response;
|
$json_response = new \phpbb\json_response;
|
||||||
$json_response->send(array(
|
$json_response->send(array(
|
||||||
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
|
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
|
||||||
'MESSAGE_TEXT' => $message,
|
'MESSAGE_TEXT' => $message,
|
||||||
|
|
|
@ -253,7 +253,7 @@ class mcp_warn
|
||||||
// Check if can send a notification
|
// Check if can send a notification
|
||||||
if ($config['allow_privmsg'])
|
if ($config['allow_privmsg'])
|
||||||
{
|
{
|
||||||
$auth2 = new phpbb_auth();
|
$auth2 = new \phpbb\auth\auth();
|
||||||
$auth2->acl($user_row);
|
$auth2->acl($user_row);
|
||||||
$s_can_notify = ($auth2->acl_get('u_readpm')) ? true : false;
|
$s_can_notify = ($auth2->acl_get('u_readpm')) ? true : false;
|
||||||
unset($auth2);
|
unset($auth2);
|
||||||
|
@ -365,7 +365,7 @@ class mcp_warn
|
||||||
// Check if can send a notification
|
// Check if can send a notification
|
||||||
if ($config['allow_privmsg'])
|
if ($config['allow_privmsg'])
|
||||||
{
|
{
|
||||||
$auth2 = new phpbb_auth();
|
$auth2 = new \phpbb\auth\auth();
|
||||||
$auth2->acl($user_row);
|
$auth2->acl($user_row);
|
||||||
$s_can_notify = ($auth2->acl_get('u_readpm')) ? true : false;
|
$s_can_notify = ($auth2->acl_get('u_readpm')) ? true : false;
|
||||||
unset($auth2);
|
unset($auth2);
|
||||||
|
|
|
@ -1545,7 +1545,7 @@ class parse_message extends bbcode_firstpass
|
||||||
global $request;
|
global $request;
|
||||||
|
|
||||||
$this->filename_data['filecomment'] = utf8_normalize_nfc(request_var('filecomment', '', true));
|
$this->filename_data['filecomment'] = utf8_normalize_nfc(request_var('filecomment', '', true));
|
||||||
$attachment_data = $request->variable('attachment_data', array(0 => array('' => '')), true, phpbb_request_interface::POST);
|
$attachment_data = $request->variable('attachment_data', array(0 => array('' => '')), true, \phpbb\request\request_interface::POST);
|
||||||
$this->attachment_data = array();
|
$this->attachment_data = array();
|
||||||
|
|
||||||
$check_user_id = ($check_user_id === false) ? $user->data['user_id'] : $check_user_id;
|
$check_user_id = ($check_user_id === false) ? $user->data['user_id'] : $check_user_id;
|
||||||
|
|
|
@ -46,7 +46,7 @@ class ucp_auth_link
|
||||||
$s_hidden_fields = array();
|
$s_hidden_fields = array();
|
||||||
add_form_key('ucp_auth_link');
|
add_form_key('ucp_auth_link');
|
||||||
|
|
||||||
$submit = $request->variable('submit', false, false, phpbb_request_interface::POST);
|
$submit = $request->variable('submit', false, false, \phpbb\request\request_interface::POST);
|
||||||
|
|
||||||
// This path is only for primary actions
|
// This path is only for primary actions
|
||||||
if (!sizeof($error) && $submit)
|
if (!sizeof($error) && $submit)
|
||||||
|
@ -59,7 +59,7 @@ class ucp_auth_link
|
||||||
if (!sizeof($error))
|
if (!sizeof($error))
|
||||||
{
|
{
|
||||||
// Any post data could be necessary for auth (un)linking
|
// Any post data could be necessary for auth (un)linking
|
||||||
$link_data = $request->get_super_global(phpbb_request_interface::POST);
|
$link_data = $request->get_super_global(\phpbb\request\request_interface::POST);
|
||||||
|
|
||||||
// The current user_id is also necessary
|
// The current user_id is also necessary
|
||||||
$link_data['user_id'] = $user->data['user_id'];
|
$link_data['user_id'] = $user->data['user_id'];
|
||||||
|
@ -67,7 +67,7 @@ class ucp_auth_link
|
||||||
// Tell the provider that the method is auth_link not login_link
|
// Tell the provider that the method is auth_link not login_link
|
||||||
$link_data['link_method'] = 'auth_link';
|
$link_data['link_method'] = 'auth_link';
|
||||||
|
|
||||||
if ($request->variable('link', 0, false, phpbb_request_interface::POST))
|
if ($request->variable('link', 0, false, \phpbb\request\request_interface::POST))
|
||||||
{
|
{
|
||||||
$error[] = $auth_provider->link_account($link_data);
|
$error[] = $auth_provider->link_account($link_data);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,8 +34,8 @@ class ucp_groups
|
||||||
$return_page = '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '">', '</a>');
|
$return_page = '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '">', '</a>');
|
||||||
|
|
||||||
$mark_ary = request_var('mark', array(0));
|
$mark_ary = request_var('mark', array(0));
|
||||||
$submit = $request->variable('submit', false, false, phpbb_request_interface::POST);
|
$submit = $request->variable('submit', false, false, \phpbb\request\request_interface::POST);
|
||||||
$delete = $request->variable('delete', false, false, phpbb_request_interface::POST);
|
$delete = $request->variable('delete', false, false, \phpbb\request\request_interface::POST);
|
||||||
$error = $data = array();
|
$error = $data = array();
|
||||||
|
|
||||||
switch ($mode)
|
switch ($mode)
|
||||||
|
@ -465,7 +465,7 @@ class ucp_groups
|
||||||
$avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers();
|
$avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers();
|
||||||
|
|
||||||
// This is normalised data, without the group_ prefix
|
// This is normalised data, without the group_ prefix
|
||||||
$avatar_data = phpbb_avatar_manager::clean_row($group_row);
|
$avatar_data = \phpbb\avatar\manager::clean_row($group_row);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Did we submit?
|
// Did we submit?
|
||||||
|
|
|
@ -296,7 +296,7 @@ class ucp_main
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, phpbb_request_interface::COOKIE);
|
$tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE);
|
||||||
$tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array();
|
$tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -163,11 +163,11 @@ class ucp_notifications
|
||||||
* Output all the notification types to the template
|
* Output all the notification types to the template
|
||||||
*
|
*
|
||||||
* @param string $block
|
* @param string $block
|
||||||
* @param phpbb_notification_manager $phpbb_notifications
|
* @param \phpbb\notification\manager $phpbb_notifications
|
||||||
* @param phpbb_template $template
|
* @param \phpbb\template\template $template
|
||||||
* @param phpbb_user $user
|
* @param \phpbb\user $user
|
||||||
*/
|
*/
|
||||||
public function output_notification_types($subscriptions, $block = 'notification_types', phpbb_notification_manager $phpbb_notifications, phpbb_template $template, phpbb_user $user)
|
public function output_notification_types($subscriptions, $block = 'notification_types', \phpbb\notification\manager $phpbb_notifications, \phpbb\template\template $template, \phpbb\user $user)
|
||||||
{
|
{
|
||||||
$notification_methods = $phpbb_notifications->get_subscription_methods();
|
$notification_methods = $phpbb_notifications->get_subscription_methods();
|
||||||
|
|
||||||
|
@ -210,11 +210,11 @@ class ucp_notifications
|
||||||
* Output all the notification methods to the template
|
* Output all the notification methods to the template
|
||||||
*
|
*
|
||||||
* @param string $block
|
* @param string $block
|
||||||
* @param phpbb_notification_manager $phpbb_notifications
|
* @param \phpbb\notification\manager $phpbb_notifications
|
||||||
* @param phpbb_template $template
|
* @param \phpbb\template\template $template
|
||||||
* @param phpbb_user $user
|
* @param \phpbb\user $user
|
||||||
*/
|
*/
|
||||||
public function output_notification_methods($block = 'notification_methods', phpbb_notification_manager $phpbb_notifications, phpbb_template $template, phpbb_user $user)
|
public function output_notification_methods($block = 'notification_methods', \phpbb\notification\manager $phpbb_notifications, \phpbb\template\template $template, \phpbb\user $user)
|
||||||
{
|
{
|
||||||
$notification_methods = $phpbb_notifications->get_subscription_methods();
|
$notification_methods = $phpbb_notifications->get_subscription_methods();
|
||||||
|
|
||||||
|
|
|
@ -34,9 +34,9 @@ class ucp_profile
|
||||||
|
|
||||||
$user->add_lang('posting');
|
$user->add_lang('posting');
|
||||||
|
|
||||||
$preview = $request->variable('preview', false, false, phpbb_request_interface::POST);
|
$preview = $request->variable('preview', false, false, \phpbb\request\request_interface::POST);
|
||||||
$submit = $request->variable('submit', false, false, phpbb_request_interface::POST);
|
$submit = $request->variable('submit', false, false, \phpbb\request\request_interface::POST);
|
||||||
$delete = $request->variable('delete', false, false, phpbb_request_interface::POST);
|
$delete = $request->variable('delete', false, false, \phpbb\request\request_interface::POST);
|
||||||
$error = $data = array();
|
$error = $data = array();
|
||||||
$s_hidden_fields = '';
|
$s_hidden_fields = '';
|
||||||
|
|
||||||
|
@ -567,7 +567,7 @@ class ucp_profile
|
||||||
$avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers();
|
$avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers();
|
||||||
|
|
||||||
// This is normalised data, without the user_ prefix
|
// This is normalised data, without the user_ prefix
|
||||||
$avatar_data = phpbb_avatar_manager::clean_row($user->data);
|
$avatar_data = \phpbb\avatar\manager::clean_row($user->data);
|
||||||
|
|
||||||
if ($submit)
|
if ($submit)
|
||||||
{
|
{
|
||||||
|
|
|
@ -71,7 +71,7 @@ class ucp_remind
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check users permissions
|
// Check users permissions
|
||||||
$auth2 = new phpbb_auth();
|
$auth2 = new \phpbb\auth\auth();
|
||||||
$auth2->acl($user_row);
|
$auth2->acl($user_row);
|
||||||
|
|
||||||
if (!$auth2->acl_get('u_chgpasswd'))
|
if (!$auth2->acl_get('u_chgpasswd'))
|
||||||
|
|
|
@ -229,7 +229,7 @@ class ucp_zebra
|
||||||
{
|
{
|
||||||
$message = ($updated) ? $user->lang[$l_mode . '_UPDATED'] : implode('<br />', $error);
|
$message = ($updated) ? $user->lang[$l_mode . '_UPDATED'] : implode('<br />', $error);
|
||||||
|
|
||||||
$json_response = new phpbb_json_response;
|
$json_response = new \phpbb\json_response;
|
||||||
$json_response->send(array(
|
$json_response->send(array(
|
||||||
'success' => $updated,
|
'success' => $updated,
|
||||||
|
|
||||||
|
|
|
@ -77,16 +77,16 @@ require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
|
||||||
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
|
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
|
||||||
|
|
||||||
// Setup class loader first
|
// Setup class loader first
|
||||||
$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}phpbb/", $phpEx);
|
$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx);
|
||||||
$phpbb_class_loader->register();
|
$phpbb_class_loader->register();
|
||||||
|
|
||||||
// Set up container (must be done here because extensions table may not exist)
|
// Set up container (must be done here because extensions table may not exist)
|
||||||
$container_extensions = array(
|
$container_extensions = array(
|
||||||
new phpbb_di_extension_config($phpbb_root_path . 'config.' . $phpEx),
|
new \phpbb\di\extension\config($phpbb_root_path . 'config.' . $phpEx),
|
||||||
new phpbb_di_extension_core($phpbb_root_path . 'config/'),
|
new \phpbb\di\extension\core($phpbb_root_path . 'config/'),
|
||||||
);
|
);
|
||||||
$container_passes = array(
|
$container_passes = array(
|
||||||
new phpbb_di_pass_collection_pass(),
|
new \phpbb\di\pass\collection_pass(),
|
||||||
);
|
);
|
||||||
$phpbb_container = phpbb_create_container($container_extensions, $phpbb_root_path, $phpEx);
|
$phpbb_container = phpbb_create_container($container_extensions, $phpbb_root_path, $phpEx);
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ while (!$migrator->finished())
|
||||||
{
|
{
|
||||||
$migrator->update();
|
$migrator->update();
|
||||||
}
|
}
|
||||||
catch (phpbb_db_migration_exception $e)
|
catch (\phpbb\db\migration\exception $e)
|
||||||
{
|
{
|
||||||
echo $e->getLocalisedMessage($user);
|
echo $e->getLocalisedMessage($user);
|
||||||
|
|
||||||
|
|
|
@ -108,11 +108,11 @@ phpbb_include_updated('includes/utf/utf_tools.' . $phpEx);
|
||||||
phpbb_require_updated('includes/functions_install.' . $phpEx);
|
phpbb_require_updated('includes/functions_install.' . $phpEx);
|
||||||
|
|
||||||
// Setup class loader first
|
// Setup class loader first
|
||||||
$phpbb_class_loader_new = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}install/update/new/phpbb/", $phpEx);
|
$phpbb_class_loader_new = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}install/update/new/phpbb/", $phpEx);
|
||||||
$phpbb_class_loader_new->register();
|
$phpbb_class_loader_new->register();
|
||||||
$phpbb_class_loader = new phpbb_class_loader('phpbb_', "{$phpbb_root_path}phpbb/", $phpEx);
|
$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx);
|
||||||
$phpbb_class_loader->register();
|
$phpbb_class_loader->register();
|
||||||
$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', "{$phpbb_root_path}ext/", $phpEx);
|
$phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx);
|
||||||
$phpbb_class_loader_ext->register();
|
$phpbb_class_loader_ext->register();
|
||||||
|
|
||||||
// Set up container
|
// Set up container
|
||||||
|
@ -219,8 +219,8 @@ $sub = $request->variable('sub', '');
|
||||||
// Set PHP error handler to ours
|
// Set PHP error handler to ours
|
||||||
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
|
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
|
||||||
|
|
||||||
$user = new phpbb_user();
|
$user = new \phpbb\user();
|
||||||
$auth = new phpbb_auth();
|
$auth = new \phpbb\auth\auth();
|
||||||
|
|
||||||
// Add own hook handler, if present. :o
|
// Add own hook handler, if present. :o
|
||||||
if (file_exists($phpbb_root_path . 'includes/hooks/index.' . $phpEx))
|
if (file_exists($phpbb_root_path . 'includes/hooks/index.' . $phpEx))
|
||||||
|
@ -240,12 +240,12 @@ else
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set some standard variables we want to force
|
// Set some standard variables we want to force
|
||||||
$config = new phpbb_config(array(
|
$config = new \phpbb\config\config(array(
|
||||||
'load_tplcompile' => '1'
|
'load_tplcompile' => '1'
|
||||||
));
|
));
|
||||||
|
|
||||||
$phpbb_filesystem = $phpbb_container->get('filesystem');
|
$phpbb_filesystem = $phpbb_container->get('filesystem');
|
||||||
$template = new phpbb_template_twig($phpbb_filesystem, $config, $user, new phpbb_template_context());
|
$template = new \phpbb\template\twig\twig($phpbb_filesystem, $config, $user, new \phpbb\template\context());
|
||||||
$paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style');
|
$paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style');
|
||||||
$paths = array_filter($paths, 'is_dir');
|
$paths = array_filter($paths, 'is_dir');
|
||||||
$template->set_custom_style('adm', $paths);
|
$template->set_custom_style('adm', $paths);
|
||||||
|
|
|
@ -130,7 +130,7 @@ class install_convert extends module
|
||||||
unset($dbpasswd);
|
unset($dbpasswd);
|
||||||
|
|
||||||
// We need to fill the config to let internal functions correctly work
|
// We need to fill the config to let internal functions correctly work
|
||||||
$config = new phpbb_config_db($db, new phpbb_cache_driver_null, CONFIG_TABLE);
|
$config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE);
|
||||||
set_config(null, null, null, $config);
|
set_config(null, null, null, $config);
|
||||||
set_config_count(null, null, null, $config);
|
set_config_count(null, null, null, $config);
|
||||||
|
|
||||||
|
@ -345,7 +345,7 @@ class install_convert extends module
|
||||||
$this->page_title = $lang['STAGE_SETTINGS'];
|
$this->page_title = $lang['STAGE_SETTINGS'];
|
||||||
|
|
||||||
// We need to fill the config to let internal functions correctly work
|
// We need to fill the config to let internal functions correctly work
|
||||||
$config = new phpbb_config_db($db, new phpbb_cache_driver_null, CONFIG_TABLE);
|
$config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE);
|
||||||
set_config(null, null, null, $config);
|
set_config(null, null, null, $config);
|
||||||
set_config_count(null, null, null, $config);
|
set_config_count(null, null, null, $config);
|
||||||
|
|
||||||
|
@ -586,7 +586,7 @@ class install_convert extends module
|
||||||
unset($dbpasswd);
|
unset($dbpasswd);
|
||||||
|
|
||||||
// We need to fill the config to let internal functions correctly work
|
// We need to fill the config to let internal functions correctly work
|
||||||
$config = new phpbb_config_db($db, new phpbb_cache_driver_null, CONFIG_TABLE);
|
$config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE);
|
||||||
set_config(null, null, null, $config);
|
set_config(null, null, null, $config);
|
||||||
set_config_count(null, null, null, $config);
|
set_config_count(null, null, null, $config);
|
||||||
|
|
||||||
|
@ -739,7 +739,7 @@ class install_convert extends module
|
||||||
// For conversions we are a bit less strict and set to a search backend we know exist...
|
// For conversions we are a bit less strict and set to a search backend we know exist...
|
||||||
if (!class_exists($search_type))
|
if (!class_exists($search_type))
|
||||||
{
|
{
|
||||||
$search_type = 'phpbb_search_fulltext_native';
|
$search_type = '\phpbb\search\fulltext_native';
|
||||||
set_config('search_type', $search_type);
|
set_config('search_type', $search_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ class install_install extends module
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'final':
|
case 'final':
|
||||||
// Enable super globals to prevent issues with the new phpbb_request object
|
// Enable super globals to prevent issues with the new \phpbb\request\request object
|
||||||
$request->enable_super_globals();
|
$request->enable_super_globals();
|
||||||
|
|
||||||
// Create a normal container now
|
// Create a normal container now
|
||||||
|
@ -1179,7 +1179,7 @@ class install_install extends module
|
||||||
// Ok tables have been built, let's fill in the basic information
|
// Ok tables have been built, let's fill in the basic information
|
||||||
$sql_query = file_get_contents('schemas/schema_data.sql');
|
$sql_query = file_get_contents('schemas/schema_data.sql');
|
||||||
|
|
||||||
// Deal with any special comments
|
// Deal with any special comments and characters
|
||||||
switch ($data['dbms'])
|
switch ($data['dbms'])
|
||||||
{
|
{
|
||||||
case 'mssql':
|
case 'mssql':
|
||||||
|
@ -1191,6 +1191,11 @@ class install_install extends module
|
||||||
case 'postgres':
|
case 'postgres':
|
||||||
$sql_query = preg_replace('#\# POSTGRES (BEGIN|COMMIT) \##s', '\1; ', $sql_query);
|
$sql_query = preg_replace('#\# POSTGRES (BEGIN|COMMIT) \##s', '\1; ', $sql_query);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'mysql':
|
||||||
|
case 'mysqli':
|
||||||
|
$sql_query = str_replace('\\', '\\\\', $sql_query);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change prefix
|
// Change prefix
|
||||||
|
@ -1438,12 +1443,12 @@ class install_install extends module
|
||||||
include_once($phpbb_root_path . 'phpbb/search/fulltext_native.' . $phpEx);
|
include_once($phpbb_root_path . 'phpbb/search/fulltext_native.' . $phpEx);
|
||||||
|
|
||||||
// We need to fill the config to let internal functions correctly work
|
// We need to fill the config to let internal functions correctly work
|
||||||
$config = new phpbb_config_db($db, new phpbb_cache_driver_null, CONFIG_TABLE);
|
$config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE);
|
||||||
set_config(null, null, null, $config);
|
set_config(null, null, null, $config);
|
||||||
set_config_count(null, null, null, $config);
|
set_config_count(null, null, null, $config);
|
||||||
|
|
||||||
$error = false;
|
$error = false;
|
||||||
$search = new phpbb_search_fulltext_native($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user);
|
$search = new \phpbb\search\fulltext_native($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user);
|
||||||
|
|
||||||
$sql = 'SELECT post_id, post_subject, post_text, poster_id, forum_id
|
$sql = 'SELECT post_id, post_subject, post_text, poster_id, forum_id
|
||||||
FROM ' . POSTS_TABLE;
|
FROM ' . POSTS_TABLE;
|
||||||
|
@ -1753,7 +1758,7 @@ class install_install extends module
|
||||||
$data = $this->get_submitted_data();
|
$data = $this->get_submitted_data();
|
||||||
|
|
||||||
// We need to fill the config to let internal functions correctly work
|
// We need to fill the config to let internal functions correctly work
|
||||||
$config = new phpbb_config_db($db, new phpbb_cache_driver_null, CONFIG_TABLE);
|
$config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE);
|
||||||
set_config(null, null, null, $config);
|
set_config(null, null, null, $config);
|
||||||
set_config_count(null, null, null, $config);
|
set_config_count(null, null, null, $config);
|
||||||
|
|
||||||
|
@ -1827,7 +1832,7 @@ class install_install extends module
|
||||||
$data = $this->get_submitted_data();
|
$data = $this->get_submitted_data();
|
||||||
|
|
||||||
// We need to fill the config to let internal functions correctly work
|
// We need to fill the config to let internal functions correctly work
|
||||||
$config = new phpbb_config_db($db, new phpbb_cache_driver_null, CONFIG_TABLE);
|
$config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE);
|
||||||
set_config(null, null, null, $config);
|
set_config(null, null, null, $config);
|
||||||
set_config_count(null, null, null, $config);
|
set_config_count(null, null, null, $config);
|
||||||
|
|
||||||
|
@ -1892,8 +1897,8 @@ class install_install extends module
|
||||||
* "installs" means it adds all migrations to the migrations table, but does not
|
* "installs" means it adds all migrations to the migrations table, but does not
|
||||||
* perform any of the actions in the migrations.
|
* perform any of the actions in the migrations.
|
||||||
*
|
*
|
||||||
* @param phpbb_extension_manager $extension_manager
|
* @param \phpbb\extension\manager $extension_manager
|
||||||
* @param phpbb_db_migrator $migrator
|
* @param \phpbb\db\migrator $migrator
|
||||||
*/
|
*/
|
||||||
function populate_migrations($extension_manager, $migrator)
|
function populate_migrations($extension_manager, $migrator)
|
||||||
{
|
{
|
||||||
|
|
|
@ -111,7 +111,7 @@ class install_update extends module
|
||||||
unset($dbpasswd);
|
unset($dbpasswd);
|
||||||
|
|
||||||
// We need to fill the config to let internal functions correctly work
|
// We need to fill the config to let internal functions correctly work
|
||||||
$config = new phpbb_config_db($db, new phpbb_cache_driver_null, CONFIG_TABLE);
|
$config = new \phpbb\config\db($db, new \phpbb\cache\driver\null, CONFIG_TABLE);
|
||||||
set_config(null, null, null, $config);
|
set_config(null, null, null, $config);
|
||||||
set_config_count(null, null, null, $config);
|
set_config_count(null, null, null, $config);
|
||||||
|
|
||||||
|
@ -250,7 +250,7 @@ class install_update extends module
|
||||||
$this->include_file('includes/diff/renderer.' . $phpEx);
|
$this->include_file('includes/diff/renderer.' . $phpEx);
|
||||||
|
|
||||||
// Make sure we stay at the file check if checking the files again
|
// Make sure we stay at the file check if checking the files again
|
||||||
if ($request->variable('check_again', false, false, phpbb_request_interface::POST))
|
if ($request->variable('check_again', false, false, \phpbb\request\request_interface::POST))
|
||||||
{
|
{
|
||||||
$sub = $this->p_master->sub = 'file_check';
|
$sub = $this->p_master->sub = 'file_check';
|
||||||
}
|
}
|
||||||
|
@ -338,7 +338,7 @@ class install_update extends module
|
||||||
$action = request_var('action', '');
|
$action = request_var('action', '');
|
||||||
|
|
||||||
// We are directly within an update. To make sure our update list is correct we check its status.
|
// We are directly within an update. To make sure our update list is correct we check its status.
|
||||||
$update_list = ($request->variable('check_again', false, false, phpbb_request_interface::POST)) ? false : $cache->get('_update_list');
|
$update_list = ($request->variable('check_again', false, false, \phpbb\request\request_interface::POST)) ? false : $cache->get('_update_list');
|
||||||
$modified = ($update_list !== false) ? @filemtime($cache->get_driver()->cache_dir . 'data_update_list.' . $phpEx) : 0;
|
$modified = ($update_list !== false) ? @filemtime($cache->get_driver()->cache_dir . 'data_update_list.' . $phpEx) : 0;
|
||||||
|
|
||||||
// Make sure the list is up-to-date
|
// Make sure the list is up-to-date
|
||||||
|
|
|
@ -237,7 +237,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_block_size'
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_gc', '7200');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_gc', '7200');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_interval', '0');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_interval', '0');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_anonymous_interval', '0');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_anonymous_interval', '0');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_type', 'phpbb_search_fulltext_native');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_type', 'phpbb\search\fulltext_native');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_store_results', '1800');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('search_store_results', '1800');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('secure_allow_deny', '1');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('secure_allow_deny', '1');
|
||||||
INSERT INTO phpbb_config (config_name, config_value) VALUES ('secure_allow_empty_referer', '1');
|
INSERT INTO phpbb_config (config_name, config_value) VALUES ('secure_allow_empty_referer', '1');
|
||||||
|
|
|
@ -49,7 +49,7 @@ $action = request_var('action', '');
|
||||||
$action_ary = request_var('action', array('' => 0));
|
$action_ary = request_var('action', array('' => 0));
|
||||||
|
|
||||||
$forum_action = request_var('forum_action', '');
|
$forum_action = request_var('forum_action', '');
|
||||||
if ($forum_action !== '' && $request->variable('sort', false, false, phpbb_request_interface::POST))
|
if ($forum_action !== '' && $request->variable('sort', false, false, \phpbb\request\request_interface::POST))
|
||||||
{
|
{
|
||||||
$action = $forum_action;
|
$action = $forum_action;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1049,7 +1049,7 @@ switch ($mode)
|
||||||
// We validate form and field here, only id/class allowed
|
// We validate form and field here, only id/class allowed
|
||||||
$form = (!preg_match('/^[a-z0-9_-]+$/i', $form)) ? '' : $form;
|
$form = (!preg_match('/^[a-z0-9_-]+$/i', $form)) ? '' : $form;
|
||||||
$field = (!preg_match('/^[a-z0-9_-]+$/i', $field)) ? '' : $field;
|
$field = (!preg_match('/^[a-z0-9_-]+$/i', $field)) ? '' : $field;
|
||||||
if ((($mode == '' || $mode == 'searchuser') || sizeof(array_intersect($request->variable_names(phpbb_request_interface::GET), $search_params)) > 0) && ($config['load_search'] || $auth->acl_get('a_')))
|
if ((($mode == '' || $mode == 'searchuser') || sizeof(array_intersect($request->variable_names(\phpbb\request\request_interface::GET), $search_params)) > 0) && ($config['load_search'] || $auth->acl_get('a_')))
|
||||||
{
|
{
|
||||||
$username = request_var('username', '', true);
|
$username = request_var('username', '', true);
|
||||||
$email = strtolower(request_var('email', ''));
|
$email = strtolower(request_var('email', ''));
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\auth;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
|
||||||
* Permission/Auth class
|
* Permission/Auth class
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
class phpbb_auth
|
class auth
|
||||||
{
|
{
|
||||||
var $acl = array();
|
var $acl = array();
|
||||||
var $cache = array();
|
var $cache = array();
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\auth\provider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -20,19 +22,19 @@ if (!defined('IN_PHPBB'))
|
||||||
*
|
*
|
||||||
* @package auth
|
* @package auth
|
||||||
*/
|
*/
|
||||||
class phpbb_auth_provider_apache extends phpbb_auth_provider_base
|
class apache extends \phpbb\auth\provider\base
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Apache Authentication Constructor
|
* Apache Authentication Constructor
|
||||||
*
|
*
|
||||||
* @param phpbb_db_driver $db
|
* @param \phpbb\db\driver\driver $db
|
||||||
* @param phpbb_config $config
|
* @param \phpbb\config\config $config
|
||||||
* @param phpbb_request $request
|
* @param \phpbb\request\request $request
|
||||||
* @param phpbb_user $user
|
* @param \phpbb\user $user
|
||||||
* @param string $phpbb_root_path
|
* @param string $phpbb_root_path
|
||||||
* @param string $php_ext
|
* @param string $php_ext
|
||||||
*/
|
*/
|
||||||
public function __construct(phpbb_db_driver $db, phpbb_config $config, phpbb_request $request, phpbb_user $user, $phpbb_root_path, $php_ext)
|
public function __construct(\phpbb\db\driver\driver $db, \phpbb\config\config $config, \phpbb\request\request $request, \phpbb\user $user, $phpbb_root_path, $php_ext)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
|
@ -47,7 +49,7 @@ class phpbb_auth_provider_apache extends phpbb_auth_provider_base
|
||||||
*/
|
*/
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
if (!$this->request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER) || $this->user->data['username'] !== htmlspecialchars_decode($this->request->server('PHP_AUTH_USER')))
|
if (!$this->request->is_set('PHP_AUTH_USER', \phpbb\request\request_interface::SERVER) || $this->user->data['username'] !== htmlspecialchars_decode($this->request->server('PHP_AUTH_USER')))
|
||||||
{
|
{
|
||||||
return $this->user->lang['APACHE_SETUP_BEFORE_USE'];
|
return $this->user->lang['APACHE_SETUP_BEFORE_USE'];
|
||||||
}
|
}
|
||||||
|
@ -78,7 +80,7 @@ class phpbb_auth_provider_apache extends phpbb_auth_provider_base
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER))
|
if (!$this->request->is_set('PHP_AUTH_USER', \phpbb\request\request_interface::SERVER))
|
||||||
{
|
{
|
||||||
return array(
|
return array(
|
||||||
'status' => LOGIN_ERROR_EXTERNAL_AUTH,
|
'status' => LOGIN_ERROR_EXTERNAL_AUTH,
|
||||||
|
@ -149,7 +151,7 @@ class phpbb_auth_provider_apache extends phpbb_auth_provider_base
|
||||||
*/
|
*/
|
||||||
public function autologin()
|
public function autologin()
|
||||||
{
|
{
|
||||||
if (!$this->request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER))
|
if (!$this->request->is_set('PHP_AUTH_USER', \phpbb\request\request_interface::SERVER))
|
||||||
{
|
{
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
@ -241,7 +243,7 @@ class phpbb_auth_provider_apache extends phpbb_auth_provider_base
|
||||||
public function validate_session($user)
|
public function validate_session($user)
|
||||||
{
|
{
|
||||||
// Check if PHP_AUTH_USER is set and handle this case
|
// Check if PHP_AUTH_USER is set and handle this case
|
||||||
if ($this->request->is_set('PHP_AUTH_USER', phpbb_request_interface::SERVER))
|
if ($this->request->is_set('PHP_AUTH_USER', \phpbb\request\request_interface::SERVER))
|
||||||
{
|
{
|
||||||
$php_auth_user = $this->request->server('PHP_AUTH_USER');
|
$php_auth_user = $this->request->server('PHP_AUTH_USER');
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\auth\provider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
|
||||||
*
|
*
|
||||||
* @package auth
|
* @package auth
|
||||||
*/
|
*/
|
||||||
abstract class phpbb_auth_provider_base implements phpbb_auth_provider_interface
|
abstract class base implements \phpbb\auth\provider\provider_interface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\auth\provider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -22,20 +24,20 @@ if (!defined('IN_PHPBB'))
|
||||||
*
|
*
|
||||||
* @package auth
|
* @package auth
|
||||||
*/
|
*/
|
||||||
class phpbb_auth_provider_db extends phpbb_auth_provider_base
|
class db extends \phpbb\auth\provider\base
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database Authentication Constructor
|
* Database Authentication Constructor
|
||||||
*
|
*
|
||||||
* @param phpbb_db_driver $db
|
* @param \phpbb\db\driver\driver $db
|
||||||
* @param phpbb_config $config
|
* @param \phpbb\config\config $config
|
||||||
* @param phpbb_request $request
|
* @param \phpbb\request\request $request
|
||||||
* @param phpbb_user $user
|
* @param \phpbb\user $user
|
||||||
* @param string $phpbb_root_path
|
* @param string $phpbb_root_path
|
||||||
* @param string $php_ext
|
* @param string $php_ext
|
||||||
*/
|
*/
|
||||||
public function __construct(phpbb_db_driver $db, phpbb_config $config, phpbb_request $request, phpbb_user $user, $phpbb_root_path, $php_ext)
|
public function __construct(\phpbb\db\driver\driver $db, \phpbb\config\config $config, \phpbb\request\request $request, \phpbb\user $user, $phpbb_root_path, $php_ext)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
|
@ -149,7 +151,7 @@ class phpbb_auth_provider_db extends phpbb_auth_provider_base
|
||||||
include ($this->phpbb_root_path . 'includes/captcha/captcha_factory.' . $this->php_ext);
|
include ($this->phpbb_root_path . 'includes/captcha/captcha_factory.' . $this->php_ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
$captcha = phpbb_captcha_factory::get_instance($this->config['captcha_plugin']);
|
$captcha = \phpbb_captcha_factory::get_instance($this->config['captcha_plugin']);
|
||||||
$captcha->init(CONFIRM_LOGIN);
|
$captcha->init(CONFIRM_LOGIN);
|
||||||
$vc_response = $captcha->validate($row);
|
$vc_response = $captcha->validate($row);
|
||||||
if ($vc_response)
|
if ($vc_response)
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\auth\provider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -22,16 +24,16 @@ if (!defined('IN_PHPBB'))
|
||||||
*
|
*
|
||||||
* @package auth
|
* @package auth
|
||||||
*/
|
*/
|
||||||
class phpbb_auth_provider_ldap extends phpbb_auth_provider_base
|
class ldap extends \phpbb\auth\provider\base
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* LDAP Authentication Constructor
|
* LDAP Authentication Constructor
|
||||||
*
|
*
|
||||||
* @param phpbb_db_driver $db
|
* @param \phpbb\db\driver\driver $db
|
||||||
* @param phpbb_config $config
|
* @param \phpbb\config\config $config
|
||||||
* @param phpbb_user $user
|
* @param \phpbb\user $user
|
||||||
*/
|
*/
|
||||||
public function __construct(phpbb_db_driver $db, phpbb_config $config, phpbb_user $user)
|
public function __construct(\phpbb\db\driver\driver $db, \phpbb\config\config $config, \phpbb\user $user)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\auth\provider\oauth;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -23,33 +25,33 @@ use OAuth\Common\Http\Uri\Uri;
|
||||||
*
|
*
|
||||||
* @package auth
|
* @package auth
|
||||||
*/
|
*/
|
||||||
class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
|
class oauth extends \phpbb\auth\provider\base
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Database driver
|
* Database driver
|
||||||
*
|
*
|
||||||
* @var phpbb_db_driver
|
* @var \phpbb\db\driver\driver
|
||||||
*/
|
*/
|
||||||
protected $db;
|
protected $db;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* phpBB config
|
* phpBB config
|
||||||
*
|
*
|
||||||
* @var phpbb_config
|
* @var \phpbb\config\config
|
||||||
*/
|
*/
|
||||||
protected $config;
|
protected $config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* phpBB request object
|
* phpBB request object
|
||||||
*
|
*
|
||||||
* @var phpbb_request
|
* @var \phpbb\request\request_interface
|
||||||
*/
|
*/
|
||||||
protected $request;
|
protected $request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* phpBB user
|
* phpBB user
|
||||||
*
|
*
|
||||||
* @var phpbb_user
|
* @var \phpbb\user
|
||||||
*/
|
*/
|
||||||
protected $user;
|
protected $user;
|
||||||
|
|
||||||
|
@ -70,7 +72,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
|
||||||
/**
|
/**
|
||||||
* All OAuth service providers
|
* All OAuth service providers
|
||||||
*
|
*
|
||||||
* @var phpbb_di_service_collection Contains phpbb_auth_provider_oauth_service_interface
|
* @var \phpbb\di\service_collection Contains \phpbb\auth\provider\oauth\service_interface
|
||||||
*/
|
*/
|
||||||
protected $service_providers;
|
protected $service_providers;
|
||||||
|
|
||||||
|
@ -105,18 +107,18 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
|
||||||
/**
|
/**
|
||||||
* OAuth Authentication Constructor
|
* OAuth Authentication Constructor
|
||||||
*
|
*
|
||||||
* @param phpbb_db_driver $db
|
* @param \phpbb\db\driver\driver $db
|
||||||
* @param phpbb_config $config
|
* @param \phpbb\config\config $config
|
||||||
* @param phpbb_request $request
|
* @param \phpbb\request\request_interface $request
|
||||||
* @param phpbb_user $user
|
* @param \phpbb\user $user
|
||||||
* @param string $auth_provider_oauth_token_storage_table
|
* @param string $auth_provider_oauth_token_storage_table
|
||||||
* @param string $auth_provider_oauth_token_account_assoc
|
* @param string $auth_provider_oauth_token_account_assoc
|
||||||
* @param phpbb_di_service_collection $service_providers Contains phpbb_auth_provider_oauth_service_interface
|
* @param \phpbb\di\service_collection $service_providers Contains \phpbb\auth\provider\oauth\service_interface
|
||||||
* @param string $users_table
|
* @param string $users_table
|
||||||
* @param string $phpbb_root_path
|
* @param string $phpbb_root_path
|
||||||
* @param string $php_ext
|
* @param string $php_ext
|
||||||
*/
|
*/
|
||||||
public function __construct(phpbb_db_driver $db, phpbb_config $config, phpbb_request $request, phpbb_user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_token_account_assoc, phpbb_di_service_collection $service_providers, $users_table, $phpbb_root_path, $php_ext)
|
public function __construct(\phpbb\db\driver\driver $db, \phpbb\config\config $config, \phpbb\request\request_interface $request, \phpbb\user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_token_account_assoc, \phpbb\di\service_collection $service_providers, $users_table, $phpbb_root_path, $php_ext)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
|
@ -156,7 +158,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
|
||||||
// Temporary workaround for only having one authentication provider available
|
// Temporary workaround for only having one authentication provider available
|
||||||
if (!$this->request->is_set('oauth_service'))
|
if (!$this->request->is_set('oauth_service'))
|
||||||
{
|
{
|
||||||
$provider = new phpbb_auth_provider_db($this->db, $this->config, $this->request, $this->user, $this->phpbb_root_path, $this->php_ext);
|
$provider = new \phpbb\auth\provider\db($this->db, $this->config, $this->request, $this->user, $this->phpbb_root_path, $this->php_ext);
|
||||||
return $provider->login($username, $password);
|
return $provider->login($username, $password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,11 +177,11 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
|
||||||
// Get the service credentials for the given service
|
// Get the service credentials for the given service
|
||||||
$service_credentials = $this->service_providers[$service_name]->get_service_credentials();
|
$service_credentials = $this->service_providers[$service_name]->get_service_credentials();
|
||||||
|
|
||||||
$storage = new phpbb_auth_provider_oauth_token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table);
|
$storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table);
|
||||||
$query = 'mode=login&login=external&oauth_service=' . $service_name_original;
|
$query = 'mode=login&login=external&oauth_service=' . $service_name_original;
|
||||||
$service = $this->get_service($service_name_original, $storage, $service_credentials, $this->service_providers[$service_name]->get_auth_scope(), $query);
|
$service = $this->get_service($service_name_original, $storage, $service_credentials, $this->service_providers[$service_name]->get_auth_scope(), $query);
|
||||||
|
|
||||||
if ($this->request->is_set('code', phpbb_request_interface::GET))
|
if ($this->request->is_set('code', \phpbb\request\request_interface::GET))
|
||||||
{
|
{
|
||||||
$this->service_providers[$service_name]->set_external_service_provider($service);
|
$this->service_providers[$service_name]->set_external_service_provider($service);
|
||||||
$unique_id = $this->service_providers[$service_name]->perform_auth_login();
|
$unique_id = $this->service_providers[$service_name]->perform_auth_login();
|
||||||
|
@ -258,7 +260,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
|
||||||
}
|
}
|
||||||
|
|
||||||
$uri_factory = new \OAuth\Common\Http\Uri\UriFactory();
|
$uri_factory = new \OAuth\Common\Http\Uri\UriFactory();
|
||||||
$current_uri = $uri_factory->createFromSuperGlobalArray($this->request->get_super_global(phpbb_request_interface::SERVER));
|
$current_uri = $uri_factory->createFromSuperGlobalArray($this->request->get_super_global(\phpbb\request\request_interface::SERVER));
|
||||||
$current_uri->setQuery($query);
|
$current_uri->setQuery($query);
|
||||||
|
|
||||||
$this->current_uri = $current_uri;
|
$this->current_uri = $current_uri;
|
||||||
|
@ -269,15 +271,15 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
|
||||||
* Returns a new service object
|
* Returns a new service object
|
||||||
*
|
*
|
||||||
* @param string $service_name The name of the service
|
* @param string $service_name The name of the service
|
||||||
* @param phpbb_auth_oauth_token_storage $storage
|
* @param \phpbb\auth\provider\oauth\token_storage $storage
|
||||||
* @param array $service_credentials {@see phpbb_auth_provider_oauth::get_service_credentials}
|
* @param array $service_credentials {@see \phpbb\auth\provider\oauth\oauth::get_service_credentials}
|
||||||
* @param array $scope The scope of the request against
|
* @param array $scope The scope of the request against
|
||||||
* the api.
|
* the api.
|
||||||
* @param string $query The query string of the
|
* @param string $query The query string of the
|
||||||
* current_uri used in redirection
|
* current_uri used in redirection
|
||||||
* @return \OAuth\Common\Service\ServiceInterface
|
* @return \OAuth\Common\Service\ServiceInterface
|
||||||
*/
|
*/
|
||||||
protected function get_service($service_name, phpbb_auth_provider_oauth_token_storage $storage, array $service_credentials, array $scopes = array(), $query)
|
protected function get_service($service_name, \phpbb\auth\provider\oauth\token_storage $storage, array $service_credentials, array $scopes = array(), $query)
|
||||||
{
|
{
|
||||||
$current_uri = $this->get_current_uri($service_name, $query);
|
$current_uri = $this->get_current_uri($service_name, $query);
|
||||||
|
|
||||||
|
@ -434,7 +436,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
|
||||||
/**
|
/**
|
||||||
* Performs the account linking for login_link
|
* Performs the account linking for login_link
|
||||||
*
|
*
|
||||||
* @param array $link_data The same variable given to {@see phpbb_auth_provider_interface::link_account}
|
* @param array $link_data The same variable given to {@see \phpbb\auth\provider\provider_interface::link_account}
|
||||||
* @param string $service_name The name of the service being used in
|
* @param string $service_name The name of the service being used in
|
||||||
* linking.
|
* linking.
|
||||||
* @return string|null Returns a language constant (string) if an error is
|
* @return string|null Returns a language constant (string) if an error is
|
||||||
|
@ -442,7 +444,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
|
||||||
*/
|
*/
|
||||||
protected function link_account_login_link(array $link_data, $service_name)
|
protected function link_account_login_link(array $link_data, $service_name)
|
||||||
{
|
{
|
||||||
$storage = new phpbb_auth_provider_oauth_token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table);
|
$storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table);
|
||||||
|
|
||||||
// Check for an access token, they should have one
|
// Check for an access token, they should have one
|
||||||
if (!$storage->has_access_token_by_session($service_name))
|
if (!$storage->has_access_token_by_session($service_name))
|
||||||
|
@ -477,7 +479,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
|
||||||
/**
|
/**
|
||||||
* Performs the account linking for auth_link
|
* Performs the account linking for auth_link
|
||||||
*
|
*
|
||||||
* @param array $link_data The same variable given to {@see phpbb_auth_provider_interface::link_account}
|
* @param array $link_data The same variable given to {@see \phpbb\auth\provider\provider_interface::link_account}
|
||||||
* @param string $service_name The name of the service being used in
|
* @param string $service_name The name of the service being used in
|
||||||
* linking.
|
* linking.
|
||||||
* @return string|null Returns a language constant (string) if an error is
|
* @return string|null Returns a language constant (string) if an error is
|
||||||
|
@ -485,13 +487,13 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
|
||||||
*/
|
*/
|
||||||
protected function link_account_auth_link(array $link_data, $service_name)
|
protected function link_account_auth_link(array $link_data, $service_name)
|
||||||
{
|
{
|
||||||
$storage = new phpbb_auth_provider_oauth_token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table);
|
$storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table);
|
||||||
$query = 'i=ucp_auth_link&mode=auth_link&link=1&oauth_service=' . strtolower($link_data['oauth_service']);
|
$query = 'i=ucp_auth_link&mode=auth_link&link=1&oauth_service=' . strtolower($link_data['oauth_service']);
|
||||||
$service_credentials = $this->service_providers[$service_name]->get_service_credentials();
|
$service_credentials = $this->service_providers[$service_name]->get_service_credentials();
|
||||||
$scopes = $this->service_providers[$service_name]->get_auth_scope();
|
$scopes = $this->service_providers[$service_name]->get_auth_scope();
|
||||||
$service = $this->get_service(strtolower($link_data['oauth_service']), $storage, $service_credentials, $scopes, $query);
|
$service = $this->get_service(strtolower($link_data['oauth_service']), $storage, $service_credentials, $scopes, $query);
|
||||||
|
|
||||||
if ($this->request->is_set('code', phpbb_request_interface::GET))
|
if ($this->request->is_set('code', \phpbb\request\request_interface::GET))
|
||||||
{
|
{
|
||||||
$this->service_providers[$service_name]->set_external_service_provider($service);
|
$this->service_providers[$service_name]->set_external_service_provider($service);
|
||||||
$unique_id = $this->service_providers[$service_name]->perform_auth_login();
|
$unique_id = $this->service_providers[$service_name]->perform_auth_login();
|
||||||
|
@ -530,7 +532,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
|
||||||
public function logout($data, $new_session)
|
public function logout($data, $new_session)
|
||||||
{
|
{
|
||||||
// Clear all tokens belonging to the user
|
// Clear all tokens belonging to the user
|
||||||
$storage = new phpbb_auth_provider_oauth_token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table);
|
$storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table);
|
||||||
$storage->clearAllTokens();
|
$storage->clearAllTokens();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -610,7 +612,7 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base
|
||||||
|
|
||||||
// Clear all tokens belonging to the user on this servce
|
// Clear all tokens belonging to the user on this servce
|
||||||
$service_name = 'auth.provider.oauth.service.' . strtolower($link_data['oauth_service']);
|
$service_name = 'auth.provider.oauth.service.' . strtolower($link_data['oauth_service']);
|
||||||
$storage = new phpbb_auth_provider_oauth_token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table);
|
$storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table);
|
||||||
$storage->clearToken($service_name);
|
$storage->clearToken($service_name);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\auth\provider\oauth\service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
|
||||||
*
|
*
|
||||||
* @package auth
|
* @package auth
|
||||||
*/
|
*/
|
||||||
abstract class phpbb_auth_provider_oauth_service_base implements phpbb_auth_provider_oauth_service_interface
|
abstract class base implements \phpbb\auth\provider\oauth\service\service_interface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* External OAuth service provider
|
* External OAuth service provider
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\auth\provider\oauth\service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -20,29 +22,29 @@ if (!defined('IN_PHPBB'))
|
||||||
*
|
*
|
||||||
* @package auth
|
* @package auth
|
||||||
*/
|
*/
|
||||||
class phpbb_auth_provider_oauth_service_bitly extends phpbb_auth_provider_oauth_service_base
|
class bitly extends \phpbb\auth\provider\oauth\service\base
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* phpBB config
|
* phpBB config
|
||||||
*
|
*
|
||||||
* @var phpbb_config
|
* @var \phpbb\config\config
|
||||||
*/
|
*/
|
||||||
protected $config;
|
protected $config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* phpBB request
|
* phpBB request
|
||||||
*
|
*
|
||||||
* @var phpbb_request
|
* @var \phpbb\request\request_interface
|
||||||
*/
|
*/
|
||||||
protected $request;
|
protected $request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param phpbb_config $config
|
* @param \phpbb\config\config $config
|
||||||
* @param phpbb_request $request
|
* @param \phpbb\request\request_interface $request
|
||||||
*/
|
*/
|
||||||
public function __construct(phpbb_config $config, phpbb_request $request)
|
public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request)
|
||||||
{
|
{
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->request = $request;
|
$this->request = $request;
|
||||||
|
@ -66,7 +68,7 @@ class phpbb_auth_provider_oauth_service_bitly extends phpbb_auth_provider_oauth_
|
||||||
{
|
{
|
||||||
if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Bitly))
|
if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Bitly))
|
||||||
{
|
{
|
||||||
throw new phpbb_auth_provider_oauth_service_exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
|
throw new \phpbb\auth\provider\oauth\service\exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
|
||||||
}
|
}
|
||||||
|
|
||||||
// This was a callback request from bitly, get the token
|
// This was a callback request from bitly, get the token
|
||||||
|
@ -86,7 +88,7 @@ class phpbb_auth_provider_oauth_service_bitly extends phpbb_auth_provider_oauth_
|
||||||
{
|
{
|
||||||
if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Bitly))
|
if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Bitly))
|
||||||
{
|
{
|
||||||
throw new phpbb_auth_provider_oauth_service_exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
|
throw new \phpbb\auth\provider\oauth\service\exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send a request with it
|
// Send a request with it
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\auth\provider\oauth\service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -20,29 +22,29 @@ if (!defined('IN_PHPBB'))
|
||||||
*
|
*
|
||||||
* @package auth
|
* @package auth
|
||||||
*/
|
*/
|
||||||
class phpbb_auth_provider_oauth_service_facebook extends phpbb_auth_provider_oauth_service_base
|
class facebook extends base
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* phpBB config
|
* phpBB config
|
||||||
*
|
*
|
||||||
* @var phpbb_config
|
* @var phpbb\config\config
|
||||||
*/
|
*/
|
||||||
protected $config;
|
protected $config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* phpBB request
|
* phpBB request
|
||||||
*
|
*
|
||||||
* @var phpbb_request
|
* @var phpbb\request\request_interface
|
||||||
*/
|
*/
|
||||||
protected $request;
|
protected $request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param phpbb_config $config
|
* @param phpbb\config\config $config
|
||||||
* @param phpbb_request $request
|
* @param phpbb\request\request_interface $request
|
||||||
*/
|
*/
|
||||||
public function __construct(phpbb_config $config, phpbb_request $request)
|
public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request)
|
||||||
{
|
{
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->request = $request;
|
$this->request = $request;
|
||||||
|
@ -66,7 +68,7 @@ class phpbb_auth_provider_oauth_service_facebook extends phpbb_auth_provider_oau
|
||||||
{
|
{
|
||||||
if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Facebook))
|
if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Facebook))
|
||||||
{
|
{
|
||||||
throw new phpbb_auth_provider_oauth_service_exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
|
throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
|
||||||
}
|
}
|
||||||
|
|
||||||
// This was a callback request, get the token
|
// This was a callback request, get the token
|
||||||
|
@ -86,7 +88,7 @@ class phpbb_auth_provider_oauth_service_facebook extends phpbb_auth_provider_oau
|
||||||
{
|
{
|
||||||
if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Facebook))
|
if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Facebook))
|
||||||
{
|
{
|
||||||
throw new phpbb_auth_provider_oauth_service_exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
|
throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send a request with it
|
// Send a request with it
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\auth\provider\oauth\service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -20,29 +22,29 @@ if (!defined('IN_PHPBB'))
|
||||||
*
|
*
|
||||||
* @package auth
|
* @package auth
|
||||||
*/
|
*/
|
||||||
class phpbb_auth_provider_oauth_service_google extends phpbb_auth_provider_oauth_service_base
|
class google extends base
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* phpBB config
|
* phpBB config
|
||||||
*
|
*
|
||||||
* @var phpbb_config
|
* @var phpbb\config\config
|
||||||
*/
|
*/
|
||||||
protected $config;
|
protected $config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* phpBB request
|
* phpBB request
|
||||||
*
|
*
|
||||||
* @var phpbb_request
|
* @var phpbb\request\request_interface
|
||||||
*/
|
*/
|
||||||
protected $request;
|
protected $request;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param phpbb_config $config
|
* @param phpbb\config\config $config
|
||||||
* @param phpbb_request $request
|
* @param phpbb\request\request_interface $request
|
||||||
*/
|
*/
|
||||||
public function __construct(phpbb_config $config, phpbb_request $request)
|
public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request)
|
||||||
{
|
{
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->request = $request;
|
$this->request = $request;
|
||||||
|
@ -77,7 +79,7 @@ class phpbb_auth_provider_oauth_service_google extends phpbb_auth_provider_oauth
|
||||||
{
|
{
|
||||||
if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Google))
|
if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Google))
|
||||||
{
|
{
|
||||||
throw new phpbb_auth_provider_oauth_service_exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
|
throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
|
||||||
}
|
}
|
||||||
|
|
||||||
// This was a callback request, get the token
|
// This was a callback request, get the token
|
||||||
|
@ -97,7 +99,7 @@ class phpbb_auth_provider_oauth_service_google extends phpbb_auth_provider_oauth
|
||||||
{
|
{
|
||||||
if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Google))
|
if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Google))
|
||||||
{
|
{
|
||||||
throw new phpbb_auth_provider_oauth_service_exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
|
throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send a request with it
|
// Send a request with it
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\auth\provider\oauth\service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
|
||||||
*
|
*
|
||||||
* @package auth
|
* @package auth
|
||||||
*/
|
*/
|
||||||
interface phpbb_auth_provider_oauth_service_interface
|
interface service_interface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Returns an array of the scopes necessary for auth
|
* Returns an array of the scopes necessary for auth
|
||||||
|
@ -52,7 +54,7 @@ interface phpbb_auth_provider_oauth_service_interface
|
||||||
/**
|
/**
|
||||||
* Returns the results of the authentication in json format
|
* Returns the results of the authentication in json format
|
||||||
*
|
*
|
||||||
* @throws phpbb_auth_provider_oauth_service_exception
|
* @throws \phpbb\auth\provider\oauth\service\exception
|
||||||
* @return string The unique identifier returned by the service provider
|
* @return string The unique identifier returned by the service provider
|
||||||
* that is used to authenticate the user with phpBB.
|
* that is used to authenticate the user with phpBB.
|
||||||
*/
|
*/
|
||||||
|
@ -62,7 +64,7 @@ interface phpbb_auth_provider_oauth_service_interface
|
||||||
* Returns the results of the authentication in json format
|
* Returns the results of the authentication in json format
|
||||||
* Use this function when the user already has an access token
|
* Use this function when the user already has an access token
|
||||||
*
|
*
|
||||||
* @throws phpbb_auth_provider_oauth_service_exception
|
* @throws \phpbb\auth\provider\oauth\service\exception
|
||||||
* @return string The unique identifier returned by the service provider
|
* @return string The unique identifier returned by the service provider
|
||||||
* that is used to authenticate the user with phpBB.
|
* that is used to authenticate the user with phpBB.
|
||||||
*/
|
*/
|
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\auth\provider\oauth;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -27,19 +29,19 @@ use OAuth\Common\Storage\Exception\TokenNotFoundException;
|
||||||
*
|
*
|
||||||
* @package auth
|
* @package auth
|
||||||
*/
|
*/
|
||||||
class phpbb_auth_provider_oauth_token_storage implements TokenStorageInterface
|
class token_storage implements TokenStorageInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Cache driver.
|
* Cache driver.
|
||||||
*
|
*
|
||||||
* @var phpbb_db_driver
|
* @var \phpbb\db\driver\driver
|
||||||
*/
|
*/
|
||||||
protected $db;
|
protected $db;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* phpBB user
|
* phpBB user
|
||||||
*
|
*
|
||||||
* @var phpbb_user
|
* @var \phpbb\user
|
||||||
*/
|
*/
|
||||||
protected $user;
|
protected $user;
|
||||||
|
|
||||||
|
@ -58,11 +60,11 @@ class phpbb_auth_provider_oauth_token_storage implements TokenStorageInterface
|
||||||
/**
|
/**
|
||||||
* Creates token storage for phpBB.
|
* Creates token storage for phpBB.
|
||||||
*
|
*
|
||||||
* @param phpbb_db_driver $db
|
* @param \phpbb\db\driver\driver $db
|
||||||
* @param phpbb_user $user
|
* @param \phpbb\user $user
|
||||||
* @param string $auth_provider_oauth_table
|
* @param string $auth_provider_oauth_table
|
||||||
*/
|
*/
|
||||||
public function __construct(phpbb_db_driver $db, phpbb_user $user, $auth_provider_oauth_table)
|
public function __construct(\phpbb\db\driver\driver $db, \phpbb\user $user, $auth_provider_oauth_table)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\auth\provider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
|
||||||
*
|
*
|
||||||
* @package auth
|
* @package auth
|
||||||
*/
|
*/
|
||||||
interface phpbb_auth_provider_interface
|
interface provider_interface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Checks whether the user is currently identified to the authentication
|
* Checks whether the user is currently identified to the authentication
|
||||||
|
@ -131,7 +133,7 @@ interface phpbb_auth_provider_interface
|
||||||
* Performs additional actions during logout.
|
* Performs additional actions during logout.
|
||||||
*
|
*
|
||||||
* @param array $data An array corresponding to
|
* @param array $data An array corresponding to
|
||||||
* phpbb_session::data
|
* \phpbb\session::data
|
||||||
* @param boolean $new_session True for a new session, false for no new
|
* @param boolean $new_session True for a new session, false for no new
|
||||||
* session.
|
* session.
|
||||||
*/
|
*/
|
||||||
|
@ -142,7 +144,7 @@ interface phpbb_auth_provider_interface
|
||||||
* into phpBB.
|
* into phpBB.
|
||||||
*
|
*
|
||||||
* @param array $user
|
* @param array $user
|
||||||
* @return boolean true if the given user is authenticated, false if the
|
* @return boolean true if the given user is authenticated, false if the
|
||||||
* session should be closed, or null if not implemented.
|
* session should be closed, or null if not implemented.
|
||||||
*/
|
*/
|
||||||
public function validate_session($user);
|
public function validate_session($user);
|
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\avatar\driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
|
||||||
* Base class for avatar drivers
|
* Base class for avatar drivers
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
abstract class phpbb_avatar_driver implements phpbb_avatar_driver_interface
|
abstract class driver implements \phpbb\avatar\driver\driver_interface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Avatar driver name
|
* Avatar driver name
|
||||||
|
@ -29,7 +31,7 @@ abstract class phpbb_avatar_driver implements phpbb_avatar_driver_interface
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current board configuration
|
* Current board configuration
|
||||||
* @var phpbb_config
|
* @var \phpbb\config\config
|
||||||
*/
|
*/
|
||||||
protected $config;
|
protected $config;
|
||||||
|
|
||||||
|
@ -47,7 +49,7 @@ abstract class phpbb_avatar_driver implements phpbb_avatar_driver_interface
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cache driver
|
* Cache driver
|
||||||
* @var phpbb_cache_driver_interface
|
* @var \phpbb\cache\driver\driver_interface
|
||||||
*/
|
*/
|
||||||
protected $cache;
|
protected $cache;
|
||||||
|
|
||||||
|
@ -69,13 +71,13 @@ abstract class phpbb_avatar_driver implements phpbb_avatar_driver_interface
|
||||||
/**
|
/**
|
||||||
* Construct a driver object
|
* Construct a driver object
|
||||||
*
|
*
|
||||||
* @param phpbb_config $config phpBB configuration
|
* @param \phpbb\config\config $config phpBB configuration
|
||||||
* @param phpbb_request $request Request object
|
* @param \phpbb\request\request $request Request object
|
||||||
* @param string $phpbb_root_path Path to the phpBB root
|
* @param string $phpbb_root_path Path to the phpBB root
|
||||||
* @param string $php_ext PHP file extension
|
* @param string $php_ext PHP file extension
|
||||||
* @param phpbb_cache_driver_interface $cache Cache driver
|
* @param \phpbb\cache\driver\driver_interface $cache Cache driver
|
||||||
*/
|
*/
|
||||||
public function __construct(phpbb_config $config, $phpbb_root_path, $php_ext, phpbb_cache_driver_interface $cache = null)
|
public function __construct(\phpbb\config\config $config, $phpbb_root_path, $php_ext, \phpbb\cache\driver\driver_interface $cache = null)
|
||||||
{
|
{
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->phpbb_root_path = $phpbb_root_path;
|
$this->phpbb_root_path = $phpbb_root_path;
|
||||||
|
@ -112,7 +114,7 @@ abstract class phpbb_avatar_driver implements phpbb_avatar_driver_interface
|
||||||
*/
|
*/
|
||||||
public function get_template_name()
|
public function get_template_name()
|
||||||
{
|
{
|
||||||
$driver = preg_replace('#^phpbb_avatar_driver_#', '', get_class($this));
|
$driver = preg_replace('#^phpbb\\\\avatar\\\\driver\\\\#', '', get_class($this));
|
||||||
$template = "ucp_avatar_options_$driver.html";
|
$template = "ucp_avatar_options_$driver.html";
|
||||||
|
|
||||||
return $template;
|
return $template;
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\avatar\driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
|
||||||
* Interface for avatar drivers
|
* Interface for avatar drivers
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
interface phpbb_avatar_driver_interface
|
interface driver_interface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Returns the name of the driver.
|
* Returns the name of the driver.
|
||||||
|
@ -32,7 +34,7 @@ interface phpbb_avatar_driver_interface
|
||||||
* Get the avatar url and dimensions
|
* Get the avatar url and dimensions
|
||||||
*
|
*
|
||||||
* @param array $row User data or group data that has been cleaned with
|
* @param array $row User data or group data that has been cleaned with
|
||||||
* phpbb_avatar_manager::clean_row
|
* \phpbb\avatar\manager::clean_row
|
||||||
* @return array Avatar data, must have keys src, width and height, e.g.
|
* @return array Avatar data, must have keys src, width and height, e.g.
|
||||||
* ['src' => '', 'width' => 0, 'height' => 0]
|
* ['src' => '', 'width' => 0, 'height' => 0]
|
||||||
*/
|
*/
|
||||||
|
@ -41,9 +43,9 @@ interface phpbb_avatar_driver_interface
|
||||||
/**
|
/**
|
||||||
* Returns custom html if it is needed for displaying this avatar
|
* Returns custom html if it is needed for displaying this avatar
|
||||||
*
|
*
|
||||||
* @param phpbb_user $user phpBB user object
|
* @param \phpbb\user $user phpBB user object
|
||||||
* @param array $row User data or group data that has been cleaned with
|
* @param array $row User data or group data that has been cleaned with
|
||||||
* phpbb_avatar_manager::clean_row
|
* \phpbb\avatar\manager::clean_row
|
||||||
* @param string $alt Alternate text for avatar image
|
* @param string $alt Alternate text for avatar image
|
||||||
*
|
*
|
||||||
* @return string HTML
|
* @return string HTML
|
||||||
|
@ -53,11 +55,11 @@ interface phpbb_avatar_driver_interface
|
||||||
/**
|
/**
|
||||||
* Prepare form for changing the settings of this avatar
|
* Prepare form for changing the settings of this avatar
|
||||||
*
|
*
|
||||||
* @param phpbb_request $request Request object
|
* @param \phpbb\request\request $request Request object
|
||||||
* @param phpbb_template $template Template object
|
* @param \phpbb\template\template $template Template object
|
||||||
* @param phpbb_user $user User object
|
* @param \phpbb\user $user User object
|
||||||
* @param array $row User data or group data that has been cleaned with
|
* @param array $row User data or group data that has been cleaned with
|
||||||
* phpbb_avatar_manager::clean_row
|
* \phpbb\avatar\manager::clean_row
|
||||||
* @param array &$error Reference to an error array that is filled by this
|
* @param array &$error Reference to an error array that is filled by this
|
||||||
* function. Key values can either be a string with a language key or
|
* function. Key values can either be a string with a language key or
|
||||||
* an array that will be passed to vsprintf() with the language key in
|
* an array that will be passed to vsprintf() with the language key in
|
||||||
|
@ -70,7 +72,7 @@ interface phpbb_avatar_driver_interface
|
||||||
/**
|
/**
|
||||||
* Prepare form for changing the acp settings of this avatar
|
* Prepare form for changing the acp settings of this avatar
|
||||||
*
|
*
|
||||||
* @param phpbb_user $user phpBB user object
|
* @param \phpbb\user $user phpBB user object
|
||||||
*
|
*
|
||||||
* @return array Array of configuration options as consumed by acp_board.
|
* @return array Array of configuration options as consumed by acp_board.
|
||||||
* The setting for enabling/disabling the avatar will be handled by
|
* The setting for enabling/disabling the avatar will be handled by
|
||||||
|
@ -81,11 +83,11 @@ interface phpbb_avatar_driver_interface
|
||||||
/**
|
/**
|
||||||
* Process form data
|
* Process form data
|
||||||
*
|
*
|
||||||
* @param phpbb_request $request Request object
|
* @param \phpbb\request\request $request Request object
|
||||||
* @param phpbb_template $template Template object
|
* @param \phpbb\template\template $template Template object
|
||||||
* @param phpbb_user $user User object
|
* @param \phpbb\user $user User object
|
||||||
* @param array $row User data or group data that has been cleaned with
|
* @param array $row User data or group data that has been cleaned with
|
||||||
* phpbb_avatar_manager::clean_row
|
* \phpbb\avatar\manager::clean_row
|
||||||
* @param array &$error Reference to an error array that is filled by this
|
* @param array &$error Reference to an error array that is filled by this
|
||||||
* function. Key values can either be a string with a language key or
|
* function. Key values can either be a string with a language key or
|
||||||
* an array that will be passed to vsprintf() with the language key in
|
* an array that will be passed to vsprintf() with the language key in
|
||||||
|
@ -100,7 +102,7 @@ interface phpbb_avatar_driver_interface
|
||||||
* Delete avatar
|
* Delete avatar
|
||||||
*
|
*
|
||||||
* @param array $row User data or group data that has been cleaned with
|
* @param array $row User data or group data that has been cleaned with
|
||||||
* phpbb_avatar_manager::clean_row
|
* \phpbb\avatar\manager::clean_row
|
||||||
*
|
*
|
||||||
* @return bool True if avatar has been deleted or there is no need to delete,
|
* @return bool True if avatar has been deleted or there is no need to delete,
|
||||||
* i.e. when the avatar is not hosted locally.
|
* i.e. when the avatar is not hosted locally.
|
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\avatar\driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
|
||||||
* Handles avatars hosted at gravatar.com
|
* Handles avatars hosted at gravatar.com
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
class phpbb_avatar_driver_gravatar extends phpbb_avatar_driver
|
class gravatar extends \phpbb\avatar\driver\driver
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The URL for the gravatar service
|
* The URL for the gravatar service
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\avatar\driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
|
||||||
* Handles avatars selected from the board gallery
|
* Handles avatars selected from the board gallery
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
class phpbb_avatar_driver_local extends phpbb_avatar_driver
|
class local extends \phpbb\avatar\driver\driver
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
|
@ -144,7 +146,7 @@ class phpbb_avatar_driver_local extends phpbb_avatar_driver
|
||||||
* Get a list of avatars that are locally available
|
* Get a list of avatars that are locally available
|
||||||
* Results get cached for 24 hours (86400 seconds)
|
* Results get cached for 24 hours (86400 seconds)
|
||||||
*
|
*
|
||||||
* @param phpbb_user $user User object
|
* @param \phpbb\user $user User object
|
||||||
*
|
*
|
||||||
* @return array Array containing the locally available avatars
|
* @return array Array containing the locally available avatars
|
||||||
*/
|
*/
|
||||||
|
@ -157,7 +159,7 @@ class phpbb_avatar_driver_local extends phpbb_avatar_driver
|
||||||
$avatar_list = array();
|
$avatar_list = array();
|
||||||
$path = $this->phpbb_root_path . $this->config['avatar_gallery_path'];
|
$path = $this->phpbb_root_path . $this->config['avatar_gallery_path'];
|
||||||
|
|
||||||
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS | FilesystemIterator::UNIX_PATHS), RecursiveIteratorIterator::SELF_FIRST);
|
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS), \RecursiveIteratorIterator::SELF_FIRST);
|
||||||
foreach ($iterator as $file_info)
|
foreach ($iterator as $file_info)
|
||||||
{
|
{
|
||||||
$file_path = $file_info->getPath();
|
$file_path = $file_info->getPath();
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\avatar\driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
|
||||||
* Handles avatars hosted remotely
|
* Handles avatars hosted remotely
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
class phpbb_avatar_driver_remote extends phpbb_avatar_driver
|
class remote extends \phpbb\avatar\driver\driver
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
|
@ -120,8 +122,8 @@ class phpbb_avatar_driver_remote extends phpbb_avatar_driver
|
||||||
include($this->phpbb_root_path . 'includes/functions_upload.' . $this->php_ext);
|
include($this->phpbb_root_path . 'includes/functions_upload.' . $this->php_ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
$types = fileupload::image_types();
|
$types = \fileupload::image_types();
|
||||||
$extension = strtolower(filespec::get_extension($url));
|
$extension = strtolower(\filespec::get_extension($url));
|
||||||
|
|
||||||
if (!empty($image_data) && (!isset($types[$image_data[2]]) || !in_array($extension, $types[$image_data[2]])))
|
if (!empty($image_data) && (!isset($types[$image_data[2]]) || !in_array($extension, $types[$image_data[2]])))
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\avatar\driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
|
||||||
* Handles avatars uploaded to the board
|
* Handles avatars uploaded to the board
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
class phpbb_avatar_driver_upload extends phpbb_avatar_driver
|
class upload extends \phpbb\avatar\driver\driver
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
|
@ -66,7 +68,7 @@ class phpbb_avatar_driver_upload extends phpbb_avatar_driver
|
||||||
include($this->phpbb_root_path . 'includes/functions_upload.' . $this->php_ext);
|
include($this->phpbb_root_path . 'includes/functions_upload.' . $this->php_ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
$upload = new fileupload('AVATAR_', $this->allowed_extensions, $this->config['avatar_filesize'], $this->config['avatar_min_width'], $this->config['avatar_min_height'], $this->config['avatar_max_width'], $this->config['avatar_max_height'], (isset($this->config['mime_triggers']) ? explode('|', $this->config['mime_triggers']) : false));
|
$upload = new \fileupload('AVATAR_', $this->allowed_extensions, $this->config['avatar_filesize'], $this->config['avatar_min_width'], $this->config['avatar_min_height'], $this->config['avatar_max_width'], $this->config['avatar_max_height'], (isset($this->config['mime_triggers']) ? explode('|', $this->config['mime_triggers']) : false));
|
||||||
|
|
||||||
$url = $request->variable('avatar_upload_url', '');
|
$url = $request->variable('avatar_upload_url', '');
|
||||||
$upload_file = $request->file('avatar_upload_file');
|
$upload_file = $request->file('avatar_upload_file');
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\avatar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -18,11 +20,11 @@ if (!defined('IN_PHPBB'))
|
||||||
/**
|
/**
|
||||||
* @package avatar
|
* @package avatar
|
||||||
*/
|
*/
|
||||||
class phpbb_avatar_manager
|
class manager
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* phpBB configuration
|
* phpBB configuration
|
||||||
* @var phpbb_config
|
* @var \phpbb\config\config
|
||||||
*/
|
*/
|
||||||
protected $config;
|
protected $config;
|
||||||
|
|
||||||
|
@ -59,11 +61,11 @@ class phpbb_avatar_manager
|
||||||
/**
|
/**
|
||||||
* Construct an avatar manager object
|
* Construct an avatar manager object
|
||||||
*
|
*
|
||||||
* @param phpbb_config $config phpBB configuration
|
* @param \phpbb\config\config $config phpBB configuration
|
||||||
* @param array $avatar_drivers Avatar drivers passed via the service container
|
* @param array $avatar_drivers Avatar drivers passed via the service container
|
||||||
* @param object $container Container object
|
* @param object $container Container object
|
||||||
*/
|
*/
|
||||||
public function __construct(phpbb_config $config, $avatar_drivers, $container)
|
public function __construct(\phpbb\config\config $config, $avatar_drivers, $container)
|
||||||
{
|
{
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->avatar_drivers = $avatar_drivers;
|
$this->avatar_drivers = $avatar_drivers;
|
||||||
|
@ -194,7 +196,7 @@ class phpbb_avatar_manager
|
||||||
$keys = array_keys($row);
|
$keys = array_keys($row);
|
||||||
$values = array_values($row);
|
$values = array_values($row);
|
||||||
|
|
||||||
$keys = array_map(array('phpbb_avatar_manager', 'strip_prefix'), $keys);
|
$keys = array_map(array('\phpbb\avatar\manager', 'strip_prefix'), $keys);
|
||||||
|
|
||||||
return array_combine($keys, $values);
|
return array_combine($keys, $values);
|
||||||
}
|
}
|
||||||
|
@ -220,7 +222,7 @@ class phpbb_avatar_manager
|
||||||
*/
|
*/
|
||||||
static public function clean_driver_name($name)
|
static public function clean_driver_name($name)
|
||||||
{
|
{
|
||||||
return str_replace('_', '.', $name);
|
return str_replace(array('\\', '_'), '.', $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -262,7 +264,7 @@ class phpbb_avatar_manager
|
||||||
$config_name = $this->get_driver_config_name($driver);
|
$config_name = $this->get_driver_config_name($driver);
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'allow_avatar_' . $config_name => array('lang' => 'ALLOW_' . strtoupper($config_name), 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
|
'allow_avatar_' . $config_name => array('lang' => 'ALLOW_' . strtoupper(str_replace('\\', '_', $config_name)), 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,13 +277,13 @@ class phpbb_avatar_manager
|
||||||
*/
|
*/
|
||||||
public function get_driver_config_name($driver)
|
public function get_driver_config_name($driver)
|
||||||
{
|
{
|
||||||
return preg_replace('#^phpbb_avatar_driver_#', '', get_class($driver));
|
return preg_replace('#^phpbb\\\\avatar\\\\driver\\\\#', '', get_class($driver));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Replace "error" strings with their real, localized form
|
* Replace "error" strings with their real, localized form
|
||||||
*
|
*
|
||||||
* @param phpbb_user phpBB User object
|
* @param \phpbb\user phpBB User object
|
||||||
* @param array $error Array containing error strings
|
* @param array $error Array containing error strings
|
||||||
* Key values can either be a string with a language key or an array
|
* Key values can either be a string with a language key or an array
|
||||||
* that will be passed to vsprintf() with the language key in the
|
* that will be passed to vsprintf() with the language key in the
|
||||||
|
@ -289,7 +291,7 @@ class phpbb_avatar_manager
|
||||||
*
|
*
|
||||||
* @return array Array containing the localized error strings
|
* @return array Array containing the localized error strings
|
||||||
*/
|
*/
|
||||||
public function localize_errors(phpbb_user $user, $error)
|
public function localize_errors(\phpbb\user $user, $error)
|
||||||
{
|
{
|
||||||
foreach ($error as $key => $lang)
|
foreach ($error as $key => $lang)
|
||||||
{
|
{
|
||||||
|
|
4
phpBB/phpbb/cache/driver/apc.php
vendored
4
phpBB/phpbb/cache/driver/apc.php
vendored
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\cache\driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
|
||||||
* ACM for APC
|
* ACM for APC
|
||||||
* @package acm
|
* @package acm
|
||||||
*/
|
*/
|
||||||
class phpbb_cache_driver_apc extends phpbb_cache_driver_memory
|
class apc extends \phpbb\cache\driver\memory
|
||||||
{
|
{
|
||||||
var $extension = 'apc';
|
var $extension = 'apc';
|
||||||
|
|
||||||
|
|
4
phpBB/phpbb/cache/driver/base.php
vendored
4
phpBB/phpbb/cache/driver/base.php
vendored
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\cache\driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -18,6 +20,6 @@ if (!defined('IN_PHPBB'))
|
||||||
/**
|
/**
|
||||||
* @package acm
|
* @package acm
|
||||||
*/
|
*/
|
||||||
abstract class phpbb_cache_driver_base implements phpbb_cache_driver_interface
|
abstract class base implements \phpbb\cache\driver\driver_interface
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\cache\driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
|
||||||
*
|
*
|
||||||
* @package acm
|
* @package acm
|
||||||
*/
|
*/
|
||||||
interface phpbb_cache_driver_interface
|
interface driver_interface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Load global cache
|
* Load global cache
|
||||||
|
@ -85,10 +87,10 @@ interface phpbb_cache_driver_interface
|
||||||
* result to persistent storage. In other words, there is no need
|
* result to persistent storage. In other words, there is no need
|
||||||
* to call save() afterwards.
|
* to call save() afterwards.
|
||||||
*
|
*
|
||||||
* @param phpbb_db_driver $db Database connection
|
* @param \phpbb\db\driver\driver $db Database connection
|
||||||
* @param string $query SQL query, should be used for generating storage key
|
* @param string $query SQL query, should be used for generating storage key
|
||||||
* @param mixed $query_result The result from dbal::sql_query, to be passed to
|
* @param mixed $query_result The result from \dbal::sql_query, to be passed to
|
||||||
* dbal::sql_fetchrow to get all rows and store them
|
* \dbal::sql_fetchrow to get all rows and store them
|
||||||
* in cache.
|
* in cache.
|
||||||
* @param int $ttl Time to live, after this timeout the query should
|
* @param int $ttl Time to live, after this timeout the query should
|
||||||
* expire from the cache.
|
* expire from the cache.
|
||||||
|
@ -96,7 +98,7 @@ interface phpbb_cache_driver_interface
|
||||||
* representing the query should be returned. Otherwise
|
* representing the query should be returned. Otherwise
|
||||||
* the original $query_result should be returned.
|
* the original $query_result should be returned.
|
||||||
*/
|
*/
|
||||||
public function sql_save(phpbb_db_driver $db, $query, $query_result, $ttl);
|
public function sql_save(\phpbb\db\driver\driver $db, $query, $query_result, $ttl);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if result for a given SQL query exists in cache.
|
* Check if result for a given SQL query exists in cache.
|
4
phpBB/phpbb/cache/driver/eaccelerator.php
vendored
4
phpBB/phpbb/cache/driver/eaccelerator.php
vendored
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\cache\driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
|
||||||
* @package acm
|
* @package acm
|
||||||
* @todo Missing locks from destroy() talk with David
|
* @todo Missing locks from destroy() talk with David
|
||||||
*/
|
*/
|
||||||
class phpbb_cache_driver_eaccelerator extends phpbb_cache_driver_memory
|
class eaccelerator extends \phpbb\cache\driver\memory
|
||||||
{
|
{
|
||||||
var $extension = 'eaccelerator';
|
var $extension = 'eaccelerator';
|
||||||
var $function = 'eaccelerator_get';
|
var $function = 'eaccelerator_get';
|
||||||
|
|
16
phpBB/phpbb/cache/driver/file.php
vendored
16
phpBB/phpbb/cache/driver/file.php
vendored
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\cache\driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
|
||||||
* ACM File Based Caching
|
* ACM File Based Caching
|
||||||
* @package acm
|
* @package acm
|
||||||
*/
|
*/
|
||||||
class phpbb_cache_driver_file extends phpbb_cache_driver_base
|
class file extends \phpbb\cache\driver\base
|
||||||
{
|
{
|
||||||
var $vars = array();
|
var $vars = array();
|
||||||
var $var_expires = array();
|
var $var_expires = array();
|
||||||
|
@ -205,9 +207,9 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
|
||||||
function purge()
|
function purge()
|
||||||
{
|
{
|
||||||
// Purge all phpbb cache files
|
// Purge all phpbb cache files
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$iterator = new DirectoryIterator($this->cache_dir);
|
$iterator = new \DirectoryIterator($this->cache_dir);
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
|
@ -256,9 +258,9 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
|
||||||
*/
|
*/
|
||||||
protected function remove_dir($dir)
|
protected function remove_dir($dir)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$iterator = new DirectoryIterator($dir);
|
$iterator = new \DirectoryIterator($dir);
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
|
@ -413,7 +415,7 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
function sql_save(phpbb_db_driver $db, $query, $query_result, $ttl)
|
function sql_save(\phpbb\db\driver\driver $db, $query, $query_result, $ttl)
|
||||||
{
|
{
|
||||||
// Remove extra spaces and tabs
|
// Remove extra spaces and tabs
|
||||||
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
|
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
|
||||||
|
@ -695,7 +697,7 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
|
||||||
|
|
||||||
$file = "{$this->cache_dir}$filename.$phpEx";
|
$file = "{$this->cache_dir}$filename.$phpEx";
|
||||||
|
|
||||||
$lock = new phpbb_lock_flock($file);
|
$lock = new \phpbb\lock\flock($file);
|
||||||
$lock->acquire();
|
$lock->acquire();
|
||||||
|
|
||||||
if ($handle = @fopen($file, 'wb'))
|
if ($handle = @fopen($file, 'wb'))
|
||||||
|
|
6
phpBB/phpbb/cache/driver/memcache.php
vendored
6
phpBB/phpbb/cache/driver/memcache.php
vendored
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\cache\driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -40,7 +42,7 @@ if (!defined('PHPBB_ACM_MEMCACHE'))
|
||||||
* ACM for Memcached
|
* ACM for Memcached
|
||||||
* @package acm
|
* @package acm
|
||||||
*/
|
*/
|
||||||
class phpbb_cache_driver_memcache extends phpbb_cache_driver_memory
|
class memcache extends \phpbb\cache\driver\memory
|
||||||
{
|
{
|
||||||
var $extension = 'memcache';
|
var $extension = 'memcache';
|
||||||
|
|
||||||
|
@ -52,7 +54,7 @@ class phpbb_cache_driver_memcache extends phpbb_cache_driver_memory
|
||||||
// Call the parent constructor
|
// Call the parent constructor
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->memcache = new Memcache;
|
$this->memcache = new \Memcache;
|
||||||
foreach(explode(',', PHPBB_ACM_MEMCACHE) as $u)
|
foreach(explode(',', PHPBB_ACM_MEMCACHE) as $u)
|
||||||
{
|
{
|
||||||
$parts = explode('/', $u);
|
$parts = explode('/', $u);
|
||||||
|
|
6
phpBB/phpbb/cache/driver/memory.php
vendored
6
phpBB/phpbb/cache/driver/memory.php
vendored
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\cache\driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
|
||||||
* ACM Abstract Memory Class
|
* ACM Abstract Memory Class
|
||||||
* @package acm
|
* @package acm
|
||||||
*/
|
*/
|
||||||
abstract class phpbb_cache_driver_memory extends phpbb_cache_driver_base
|
abstract class memory extends \phpbb\cache\driver\base
|
||||||
{
|
{
|
||||||
var $key_prefix;
|
var $key_prefix;
|
||||||
|
|
||||||
|
@ -285,7 +287,7 @@ abstract class phpbb_cache_driver_memory extends phpbb_cache_driver_base
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
function sql_save(phpbb_db_driver $db, $query, $query_result, $ttl)
|
function sql_save(\phpbb\db\driver\driver $db, $query, $query_result, $ttl)
|
||||||
{
|
{
|
||||||
// Remove extra spaces and tabs
|
// Remove extra spaces and tabs
|
||||||
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
|
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
|
||||||
|
|
6
phpBB/phpbb/cache/driver/null.php
vendored
6
phpBB/phpbb/cache/driver/null.php
vendored
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\cache\driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
|
||||||
* ACM Null Caching
|
* ACM Null Caching
|
||||||
* @package acm
|
* @package acm
|
||||||
*/
|
*/
|
||||||
class phpbb_cache_driver_null extends phpbb_cache_driver_base
|
class null extends \phpbb\cache\driver\base
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Set cache path
|
* Set cache path
|
||||||
|
@ -107,7 +109,7 @@ class phpbb_cache_driver_null extends phpbb_cache_driver_base
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
function sql_save(phpbb_db_driver $db, $query, $query_result, $ttl)
|
function sql_save(\phpbb\db\driver\driver $db, $query, $query_result, $ttl)
|
||||||
{
|
{
|
||||||
return $query_result;
|
return $query_result;
|
||||||
}
|
}
|
||||||
|
|
10
phpBB/phpbb/cache/driver/redis.php
vendored
10
phpBB/phpbb/cache/driver/redis.php
vendored
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\cache\driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -33,7 +35,7 @@ if (!defined('PHPBB_ACM_REDIS_HOST'))
|
||||||
*
|
*
|
||||||
* @package acm
|
* @package acm
|
||||||
*/
|
*/
|
||||||
class phpbb_cache_driver_redis extends phpbb_cache_driver_memory
|
class redis extends \phpbb\cache\driver\memory
|
||||||
{
|
{
|
||||||
var $extension = 'redis';
|
var $extension = 'redis';
|
||||||
|
|
||||||
|
@ -56,7 +58,7 @@ class phpbb_cache_driver_redis extends phpbb_cache_driver_memory
|
||||||
// Call the parent constructor
|
// Call the parent constructor
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->redis = new Redis();
|
$this->redis = new \Redis();
|
||||||
|
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
if (!empty($args))
|
if (!empty($args))
|
||||||
|
@ -83,8 +85,8 @@ class phpbb_cache_driver_redis extends phpbb_cache_driver_memory
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
|
$this->redis->setOption(\Redis::OPT_SERIALIZER, \Redis::SERIALIZER_PHP);
|
||||||
$this->redis->setOption(Redis::OPT_PREFIX, $this->key_prefix);
|
$this->redis->setOption(\Redis::OPT_PREFIX, $this->key_prefix);
|
||||||
|
|
||||||
if (defined('PHPBB_ACM_REDIS_DB'))
|
if (defined('PHPBB_ACM_REDIS_DB'))
|
||||||
{
|
{
|
||||||
|
|
4
phpBB/phpbb/cache/driver/wincache.php
vendored
4
phpBB/phpbb/cache/driver/wincache.php
vendored
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\cache\driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
|
||||||
* ACM for WinCache
|
* ACM for WinCache
|
||||||
* @package acm
|
* @package acm
|
||||||
*/
|
*/
|
||||||
class phpbb_cache_driver_wincache extends phpbb_cache_driver_memory
|
class wincache extends \phpbb\cache\driver\memory
|
||||||
{
|
{
|
||||||
var $extension = 'wincache';
|
var $extension = 'wincache';
|
||||||
|
|
||||||
|
|
4
phpBB/phpbb/cache/driver/xcache.php
vendored
4
phpBB/phpbb/cache/driver/xcache.php
vendored
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\cache\driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -24,7 +26,7 @@ if (!defined('IN_PHPBB'))
|
||||||
* - xcache.admin.enable_auth = off (or xcache.admin.user and xcache.admin.password set)
|
* - xcache.admin.enable_auth = off (or xcache.admin.user and xcache.admin.password set)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class phpbb_cache_driver_xcache extends phpbb_cache_driver_memory
|
class xcache extends \phpbb\cache\driver\memory
|
||||||
{
|
{
|
||||||
var $extension = 'XCache';
|
var $extension = 'XCache';
|
||||||
|
|
||||||
|
|
24
phpBB/phpbb/cache/service.php
vendored
24
phpBB/phpbb/cache/service.php
vendored
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\cache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -19,26 +21,26 @@ if (!defined('IN_PHPBB'))
|
||||||
* Class for grabbing/handling cached entries
|
* Class for grabbing/handling cached entries
|
||||||
* @package acm
|
* @package acm
|
||||||
*/
|
*/
|
||||||
class phpbb_cache_service
|
class service
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Cache driver.
|
* Cache driver.
|
||||||
*
|
*
|
||||||
* @var phpbb_cache_driver_interface
|
* @var \phpbb\cache\driver\driver_interface
|
||||||
*/
|
*/
|
||||||
protected $driver;
|
protected $driver;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The config.
|
* The config.
|
||||||
*
|
*
|
||||||
* @var phpbb_config
|
* @var \phpbb\config\config
|
||||||
*/
|
*/
|
||||||
protected $config;
|
protected $config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database connection.
|
* Database connection.
|
||||||
*
|
*
|
||||||
* @var phpbb_db_driver
|
* @var \phpbb\db\driver\driver
|
||||||
*/
|
*/
|
||||||
protected $db;
|
protected $db;
|
||||||
|
|
||||||
|
@ -59,13 +61,13 @@ class phpbb_cache_service
|
||||||
/**
|
/**
|
||||||
* Creates a cache service around a cache driver
|
* Creates a cache service around a cache driver
|
||||||
*
|
*
|
||||||
* @param phpbb_cache_driver_interface $driver The cache driver
|
* @param \phpbb\cache\driver\driver_interface $driver The cache driver
|
||||||
* @param phpbb_config $config The config
|
* @param \phpbb\config\config $config The config
|
||||||
* @param phpbb_db_driver $db Database connection
|
* @param \phpbb\db\driver\driver $db Database connection
|
||||||
* @param string $phpbb_root_path Root path
|
* @param string $phpbb_root_path Root path
|
||||||
* @param string $php_ext PHP extension
|
* @param string $php_ext PHP extension
|
||||||
*/
|
*/
|
||||||
public function __construct(phpbb_cache_driver_interface $driver, phpbb_config $config, phpbb_db_driver $db, $phpbb_root_path, $php_ext)
|
public function __construct(\phpbb\cache\driver\driver_interface $driver, \phpbb\config\config $config, \phpbb\db\driver\driver $db, $phpbb_root_path, $php_ext)
|
||||||
{
|
{
|
||||||
$this->set_driver($driver);
|
$this->set_driver($driver);
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
|
@ -77,7 +79,7 @@ class phpbb_cache_service
|
||||||
/**
|
/**
|
||||||
* Returns the cache driver used by this cache service.
|
* Returns the cache driver used by this cache service.
|
||||||
*
|
*
|
||||||
* @return phpbb_cache_driver_interface The cache driver
|
* @return \phpbb\cache\driver\driver_interface The cache driver
|
||||||
*/
|
*/
|
||||||
public function get_driver()
|
public function get_driver()
|
||||||
{
|
{
|
||||||
|
@ -87,9 +89,9 @@ class phpbb_cache_service
|
||||||
/**
|
/**
|
||||||
* Replaces the cache driver used by this cache service.
|
* Replaces the cache driver used by this cache service.
|
||||||
*
|
*
|
||||||
* @param phpbb_cache_driver_interface $driver The cache driver
|
* @param \phpbb\cache\driver\driver_interface $driver The cache driver
|
||||||
*/
|
*/
|
||||||
public function set_driver(phpbb_cache_driver_interface $driver)
|
public function set_driver(\phpbb\cache\driver\driver_interface $driver)
|
||||||
{
|
{
|
||||||
$this->driver = $driver;
|
$this->driver = $driver;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -28,9 +30,9 @@ if (!defined('IN_PHPBB'))
|
||||||
*
|
*
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
class phpbb_class_loader
|
class class_loader
|
||||||
{
|
{
|
||||||
private $prefix;
|
private $namespace;
|
||||||
private $path;
|
private $path;
|
||||||
private $php_ext;
|
private $php_ext;
|
||||||
private $cache;
|
private $cache;
|
||||||
|
@ -44,17 +46,22 @@ class phpbb_class_loader
|
||||||
private $cached_paths = array();
|
private $cached_paths = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new phpbb_class_loader, which loads files with the given
|
* Creates a new \phpbb\class_loader, which loads files with the given
|
||||||
* file extension from the given path.
|
* file extension from the given path.
|
||||||
*
|
*
|
||||||
* @param string $prefix Required class name prefix for files to be loaded
|
* @param string $namespace Required namespace for files to be loaded
|
||||||
* @param string $path Directory to load files from
|
* @param string $path Directory to load files from
|
||||||
* @param string $php_ext The file extension for PHP files
|
* @param string $php_ext The file extension for PHP files
|
||||||
* @param phpbb_cache_driver_interface $cache An implementation of the phpBB cache interface.
|
* @param \phpbb\cache\driver\driver_interface $cache An implementation of the phpBB cache interface.
|
||||||
*/
|
*/
|
||||||
public function __construct($prefix, $path, $php_ext = 'php', phpbb_cache_driver_interface $cache = null)
|
public function __construct($namespace, $path, $php_ext = 'php', \phpbb\cache\driver\driver_interface $cache = null)
|
||||||
{
|
{
|
||||||
$this->prefix = $prefix;
|
if ($namespace[0] !== '\\')
|
||||||
|
{
|
||||||
|
$namespace = '\\' . $namespace;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->namespace = $namespace;
|
||||||
$this->path = $path;
|
$this->path = $path;
|
||||||
$this->php_ext = $php_ext;
|
$this->php_ext = $php_ext;
|
||||||
|
|
||||||
|
@ -66,13 +73,13 @@ class phpbb_class_loader
|
||||||
* the class loader will resolve paths by checking for the existance of every
|
* the class loader will resolve paths by checking for the existance of every
|
||||||
* directory in the class name every time.
|
* directory in the class name every time.
|
||||||
*
|
*
|
||||||
* @param phpbb_cache_driver_interface $cache An implementation of the phpBB cache interface.
|
* @param \phpbb\cache\driver\driver_interface $cache An implementation of the phpBB cache interface.
|
||||||
*/
|
*/
|
||||||
public function set_cache(phpbb_cache_driver_interface $cache = null)
|
public function set_cache(\phpbb\cache\driver\driver_interface $cache = null)
|
||||||
{
|
{
|
||||||
if ($cache)
|
if ($cache)
|
||||||
{
|
{
|
||||||
$this->cached_paths = $cache->get('class_loader_' . $this->prefix);
|
$this->cached_paths = $cache->get('class_loader_' . str_replace('\\', '__', $this->namespace));
|
||||||
|
|
||||||
if ($this->cached_paths === false)
|
if ($this->cached_paths === false)
|
||||||
{
|
{
|
||||||
|
@ -102,8 +109,9 @@ class phpbb_class_loader
|
||||||
/**
|
/**
|
||||||
* Resolves a phpBB class name to a relative path which can be included.
|
* Resolves a phpBB class name to a relative path which can be included.
|
||||||
*
|
*
|
||||||
* @param string $class The class name to resolve, must have a phpbb_
|
* @param string $class The class name to resolve, must be in the
|
||||||
* prefix
|
* namespace the loader was constructed with.
|
||||||
|
* Has to begin with \
|
||||||
* @return string|bool A relative path to the file containing the
|
* @return string|bool A relative path to the file containing the
|
||||||
* class or false if looking it up failed.
|
* class or false if looking it up failed.
|
||||||
*/
|
*/
|
||||||
|
@ -114,27 +122,12 @@ class phpbb_class_loader
|
||||||
return $this->path . $this->cached_paths[$class] . '.' . $this->php_ext;
|
return $this->path . $this->cached_paths[$class] . '.' . $this->php_ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!preg_match('/^' . $this->prefix . '[a-zA-Z0-9_]+$/', $class))
|
if (!preg_match('/^' . preg_quote($this->namespace, '/') . '[a-zA-Z0-9_\\\\]+$/', $class))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$parts = explode('_', substr($class, strlen($this->prefix)));
|
$relative_path = str_replace('\\', '/', substr($class, strlen($this->namespace)));
|
||||||
|
|
||||||
$dirs = '';
|
|
||||||
|
|
||||||
for ($i = 0, $n = sizeof($parts); $i < $n && is_dir($this->path . $dirs . $parts[$i]); $i++)
|
|
||||||
{
|
|
||||||
$dirs .= $parts[$i] . '/';
|
|
||||||
}
|
|
||||||
|
|
||||||
// no file name left => use last dir name as file name
|
|
||||||
if ($i == sizeof($parts))
|
|
||||||
{
|
|
||||||
$parts[] = $parts[$i - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
$relative_path = $dirs . implode(array_slice($parts, $i, sizeof($parts) - $i), '_');
|
|
||||||
|
|
||||||
if (!file_exists($this->path . $relative_path . '.' . $this->php_ext))
|
if (!file_exists($this->path . $relative_path . '.' . $this->php_ext))
|
||||||
{
|
{
|
||||||
|
@ -144,7 +137,7 @@ class phpbb_class_loader
|
||||||
if ($this->cache)
|
if ($this->cache)
|
||||||
{
|
{
|
||||||
$this->cached_paths[$class] = $relative_path;
|
$this->cached_paths[$class] = $relative_path;
|
||||||
$this->cache->put('class_loader_' . $this->prefix, $this->cached_paths);
|
$this->cache->put('class_loader_' . str_replace('\\', '__', $this->namespace), $this->cached_paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->path . $relative_path . '.' . $this->php_ext;
|
return $this->path . $relative_path . '.' . $this->php_ext;
|
||||||
|
@ -157,7 +150,8 @@ class phpbb_class_loader
|
||||||
*/
|
*/
|
||||||
public function load_class($class)
|
public function load_class($class)
|
||||||
{
|
{
|
||||||
if (substr($class, 0, strlen($this->prefix)) === $this->prefix)
|
$class = '\\' . $class;
|
||||||
|
if (substr($class, 0, strlen($this->namespace)) === $this->namespace)
|
||||||
{
|
{
|
||||||
$path = $this->resolve_path($class);
|
$path = $this->resolve_path($class);
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
|
||||||
* Configuration container class
|
* Configuration container class
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
class phpbb_config implements ArrayAccess, IteratorAggregate, Countable
|
class config implements \ArrayAccess, \IteratorAggregate, \Countable
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The configuration data
|
* The configuration data
|
||||||
|
@ -44,7 +46,7 @@ class phpbb_config implements ArrayAccess, IteratorAggregate, Countable
|
||||||
*/
|
*/
|
||||||
public function getIterator()
|
public function getIterator()
|
||||||
{
|
{
|
||||||
return new ArrayIterator($this->config);
|
return new \ArrayIterator($this->config);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -90,7 +92,7 @@ class phpbb_config implements ArrayAccess, IteratorAggregate, Countable
|
||||||
*/
|
*/
|
||||||
public function offsetUnset($key)
|
public function offsetUnset($key)
|
||||||
{
|
{
|
||||||
trigger_error('Config values have to be deleted explicitly with the phpbb_config::delete($key) method.', E_USER_ERROR);
|
trigger_error('Config values have to be deleted explicitly with the \phpbb\config\config::delete($key) method.', E_USER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -19,17 +21,17 @@ if (!defined('IN_PHPBB'))
|
||||||
* Configuration container class
|
* Configuration container class
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
class phpbb_config_db extends phpbb_config
|
class db extends \phpbb\config\config
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Cache instance
|
* Cache instance
|
||||||
* @var phpbb_cache_driver_interface
|
* @var \phpbb\cache\driver\driver_interface
|
||||||
*/
|
*/
|
||||||
protected $cache;
|
protected $cache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Database connection
|
* Database connection
|
||||||
* @var phpbb_db_driver
|
* @var \phpbb\db\driver\driver
|
||||||
*/
|
*/
|
||||||
protected $db;
|
protected $db;
|
||||||
|
|
||||||
|
@ -42,11 +44,11 @@ class phpbb_config_db extends phpbb_config
|
||||||
/**
|
/**
|
||||||
* Creates a configuration container with a default set of values
|
* Creates a configuration container with a default set of values
|
||||||
*
|
*
|
||||||
* @param phpbb_db_driver $db Database connection
|
* @param \phpbb\db\driver\driver $db Database connection
|
||||||
* @param phpbb_cache_driver_interface $cache Cache instance
|
* @param \phpbb\cache\driver\driver_interface $cache Cache instance
|
||||||
* @param string $table Configuration table name
|
* @param string $table Configuration table name
|
||||||
*/
|
*/
|
||||||
public function __construct(phpbb_db_driver $db, phpbb_cache_driver_interface $cache, $table)
|
public function __construct(\phpbb\db\driver\driver $db, \phpbb\cache\driver\driver_interface $cache, $table)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->cache = $cache;
|
$this->cache = $cache;
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
namespace phpbb\config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ignore
|
* @ignore
|
||||||
*/
|
*/
|
||||||
|
@ -17,16 +19,16 @@ if (!defined('IN_PHPBB'))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages configuration options with an arbitrary length value stored in a TEXT
|
* Manages configuration options with an arbitrary length value stored in a TEXT
|
||||||
* column. In constrast to class phpbb_config_db, values are never cached and
|
* column. In constrast to class \phpbb\config\db, values are never cached and
|
||||||
* prefetched, but every get operation sends a query to the database.
|
* prefetched, but every get operation sends a query to the database.
|
||||||
*
|
*
|
||||||
* @package phpBB3
|
* @package phpBB3
|
||||||
*/
|
*/
|
||||||
class phpbb_config_db_text
|
class db_text
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Database connection
|
* Database connection
|
||||||
* @var phpbb_db_driver
|
* @var \phpbb\db\driver\driver
|
||||||
*/
|
*/
|
||||||
protected $db;
|
protected $db;
|
||||||
|
|
||||||
|
@ -37,10 +39,10 @@ class phpbb_config_db_text
|
||||||
protected $table;
|
protected $table;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param phpbb_db_driver $db Database connection
|
* @param \phpbb\db\driver\driver $db Database connection
|
||||||
* @param string $table Table name
|
* @param string $table Table name
|
||||||
*/
|
*/
|
||||||
public function __construct(phpbb_db_driver $db, $table)
|
public function __construct(\phpbb\db\driver\driver $db, $table)
|
||||||
{
|
{
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
$this->table = $this->db->sql_escape($table);
|
$this->table = $this->db->sql_escape($table);
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue