aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2013-09-27 10:47:10 +0200
committerMarc Alexander <admin@m-a-styles.de>2013-09-27 10:47:10 +0200
commit663b4b2eb74e8edb076c962662ff5124e94353ea (patch)
tree0ff449c776397b2b66fc7d567f93bbb7d62ea2e3
parent01512104b5823d15eed64d362b41b9594f870f0c (diff)
parent8db820be634cfce0fdb079fdbaee2c49661a7870 (diff)
downloadforums-663b4b2eb74e8edb076c962662ff5124e94353ea.tar
forums-663b4b2eb74e8edb076c962662ff5124e94353ea.tar.gz
forums-663b4b2eb74e8edb076c962662ff5124e94353ea.tar.bz2
forums-663b4b2eb74e8edb076c962662ff5124e94353ea.tar.xz
forums-663b4b2eb74e8edb076c962662ff5124e94353ea.zip
Merge branch 'develop' of https://github.com/phpbb/phpbb3 into feature/passwords
Conflicts: phpBB/develop/create_schema_files.php
-rw-r--r--build/build.xml4
-rw-r--r--phpBB/.htaccess24
-rw-r--r--phpBB/adm/index.php2
-rw-r--r--phpBB/adm/style/admin.css10
-rw-r--r--phpBB/adm/style/auth_provider_oauth.html17
-rw-r--r--phpBB/adm/style/overall_header.html2
-rw-r--r--phpBB/adm/style/simple_header.html2
-rw-r--r--phpBB/adm/swatch.php2
-rw-r--r--phpBB/app.php1
-rw-r--r--phpBB/common.php25
-rw-r--r--phpBB/composer.json15
-rw-r--r--phpBB/composer.lock855
-rw-r--r--phpBB/config/auth_providers.yml50
-rw-r--r--phpBB/config/avatars.yml10
-rw-r--r--phpBB/config/cron_tasks.yml16
-rw-r--r--phpBB/config/feed.yml18
-rw-r--r--phpBB/config/migrator.yml10
-rw-r--r--phpBB/config/notifications.yml74
-rw-r--r--phpBB/config/services.yml111
-rw-r--r--phpBB/config/tables.yml2
-rw-r--r--phpBB/develop/compile_template.php24
-rw-r--r--phpBB/develop/create_schema_files.php1403
-rw-r--r--phpBB/develop/mysql_upgrader.php1151
-rw-r--r--phpBB/develop/namespacify.php189
-rw-r--r--phpBB/develop/rename_interfaces.php51
-rw-r--r--phpBB/docs/CHANGELOG.html4
-rw-r--r--phpBB/docs/auth_api.html2
-rw-r--r--phpBB/docs/events.md60
-rw-r--r--phpBB/download/file.php4
-rw-r--r--phpBB/includes/acp/acp_attachments.php2
-rw-r--r--phpBB/includes/acp/acp_bbcodes.php2
-rw-r--r--phpBB/includes/acp/acp_board.php58
-rw-r--r--phpBB/includes/acp/acp_bots.php2
-rw-r--r--phpBB/includes/acp/acp_database.php2
-rw-r--r--phpBB/includes/acp/acp_extensions.php20
-rw-r--r--phpBB/includes/acp/acp_forums.php3
-rw-r--r--phpBB/includes/acp/acp_groups.php12
-rw-r--r--phpBB/includes/acp/acp_icons.php6
-rw-r--r--phpBB/includes/acp/acp_language.php4
-rw-r--r--phpBB/includes/acp/acp_logs.php4
-rw-r--r--phpBB/includes/acp/acp_modules.php4
-rw-r--r--phpBB/includes/acp/acp_permissions.php10
-rw-r--r--phpBB/includes/acp/acp_profile.php8
-rw-r--r--phpBB/includes/acp/acp_ranks.php2
-rw-r--r--phpBB/includes/acp/acp_users.php4
-rw-r--r--phpBB/includes/acp/auth.php4
-rw-r--r--phpBB/includes/bbcode.php9
-rw-r--r--phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php2
-rw-r--r--phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php4
-rw-r--r--phpBB/includes/constants.php1
-rw-r--r--phpBB/includes/db/schema_data.php1219
-rw-r--r--phpBB/includes/functions.php273
-rw-r--r--phpBB/includes/functions_admin.php10
-rw-r--r--phpBB/includes/functions_container.php22
-rw-r--r--phpBB/includes/functions_content.php53
-rw-r--r--phpBB/includes/functions_database_helper.php8
-rw-r--r--phpBB/includes/functions_display.php20
-rw-r--r--phpBB/includes/functions_download.php12
-rw-r--r--phpBB/includes/functions_install.php54
-rw-r--r--phpBB/includes/functions_messenger.php53
-rw-r--r--phpBB/includes/functions_module.php18
-rw-r--r--phpBB/includes/functions_posting.php5
-rw-r--r--phpBB/includes/functions_privmsgs.php2
-rw-r--r--phpBB/includes/functions_upload.php2
-rw-r--r--phpBB/includes/functions_url_matcher.php16
-rw-r--r--phpBB/includes/functions_user.php85
-rw-r--r--phpBB/includes/mcp/mcp_forum.php4
-rw-r--r--phpBB/includes/mcp/mcp_main.php8
-rw-r--r--phpBB/includes/mcp/mcp_pm_reports.php1
-rw-r--r--phpBB/includes/mcp/mcp_queue.php12
-rw-r--r--phpBB/includes/mcp/mcp_reports.php1
-rw-r--r--phpBB/includes/mcp/mcp_warn.php4
-rw-r--r--phpBB/includes/message_parser.php2
-rw-r--r--phpBB/includes/ucp/info/ucp_auth_link.php34
-rw-r--r--phpBB/includes/ucp/ucp_auth_link.php142
-rw-r--r--phpBB/includes/ucp/ucp_groups.php37
-rw-r--r--phpBB/includes/ucp/ucp_login_link.php243
-rw-r--r--phpBB/includes/ucp/ucp_main.php2
-rw-r--r--phpBB/includes/ucp/ucp_notifications.php16
-rw-r--r--phpBB/includes/ucp/ucp_prefs.php77
-rw-r--r--phpBB/includes/ucp/ucp_profile.php8
-rw-r--r--phpBB/includes/ucp/ucp_register.php88
-rw-r--r--phpBB/includes/ucp/ucp_remind.php4
-rw-r--r--phpBB/includes/ucp/ucp_zebra.php2
-rw-r--r--phpBB/install/database_update.php10
-rw-r--r--phpBB/install/index.php22
-rw-r--r--phpBB/install/install_convert.php8
-rw-r--r--phpBB/install/install_install.php21
-rw-r--r--phpBB/install/install_update.php10
-rw-r--r--phpBB/install/schemas/firebird_schema.sql21
-rw-r--r--phpBB/install/schemas/mssql_schema.sql37
-rw-r--r--phpBB/install/schemas/mysql_40_schema.sql20
-rw-r--r--phpBB/install/schemas/mysql_41_schema.sql20
-rw-r--r--phpBB/install/schemas/oracle_schema.sql28
-rw-r--r--phpBB/install/schemas/postgres_schema.sql24
-rw-r--r--phpBB/install/schemas/schema_data.sql3
-rw-r--r--phpBB/install/schemas/sqlite_schema.sql20
-rw-r--r--phpBB/language/en/acp/board.php14
-rw-r--r--phpBB/language/en/common.php11
-rw-r--r--phpBB/language/en/email/forum_notify.txt2
-rw-r--r--phpBB/language/en/email/group_approved.txt10
-rw-r--r--phpBB/language/en/email/newtopic_notify.txt2
-rw-r--r--phpBB/language/en/email/topic_notify.txt2
-rw-r--r--phpBB/language/en/ucp.php14
-rw-r--r--phpBB/mcp.php2
-rw-r--r--phpBB/memberlist.php2
-rw-r--r--phpBB/phpbb/auth/auth.php16
-rw-r--r--phpBB/phpbb/auth/provider/apache.php22
-rw-r--r--phpBB/phpbb/auth/provider/base.php44
-rw-r--r--phpBB/phpbb/auth/provider/db.php16
-rw-r--r--phpBB/phpbb/auth/provider/interface.php105
-rw-r--r--phpBB/phpbb/auth/provider/ldap.php12
-rw-r--r--phpBB/phpbb/auth/provider/oauth/oauth.php620
-rw-r--r--phpBB/phpbb/auth/provider/oauth/service/base.php57
-rw-r--r--phpBB/phpbb/auth/provider/oauth/service/bitly.php100
-rw-r--r--phpBB/phpbb/auth/provider/oauth/service/exception.php25
-rw-r--r--phpBB/phpbb/auth/provider/oauth/service/facebook.php100
-rw-r--r--phpBB/phpbb/auth/provider/oauth/service/google.php111
-rw-r--r--phpBB/phpbb/auth/provider/oauth/service/service_interface.php79
-rw-r--r--phpBB/phpbb/auth/provider/oauth/token_storage.php368
-rw-r--r--phpBB/phpbb/auth/provider/provider_interface.php199
-rw-r--r--phpBB/phpbb/avatar/driver/driver.php18
-rw-r--r--phpBB/phpbb/avatar/driver/driver_interface.php (renamed from phpBB/phpbb/avatar/driver/interface.php)30
-rw-r--r--phpBB/phpbb/avatar/driver/gravatar.php4
-rw-r--r--phpBB/phpbb/avatar/driver/local.php8
-rw-r--r--phpBB/phpbb/avatar/driver/remote.php8
-rw-r--r--phpBB/phpbb/avatar/driver/upload.php6
-rw-r--r--phpBB/phpbb/avatar/manager.php22
-rw-r--r--phpBB/phpbb/cache/driver/apc.php4
-rw-r--r--phpBB/phpbb/cache/driver/base.php4
-rw-r--r--phpBB/phpbb/cache/driver/driver_interface.php (renamed from phpBB/phpbb/cache/driver/interface.php)12
-rw-r--r--phpBB/phpbb/cache/driver/eaccelerator.php4
-rw-r--r--phpBB/phpbb/cache/driver/file.php16
-rw-r--r--phpBB/phpbb/cache/driver/memcache.php6
-rw-r--r--phpBB/phpbb/cache/driver/memory.php6
-rw-r--r--phpBB/phpbb/cache/driver/null.php6
-rw-r--r--phpBB/phpbb/cache/driver/redis.php10
-rw-r--r--phpBB/phpbb/cache/driver/wincache.php4
-rw-r--r--phpBB/phpbb/cache/driver/xcache.php4
-rw-r--r--phpBB/phpbb/cache/service.php24
-rw-r--r--phpBB/phpbb/class_loader.php58
-rw-r--r--phpBB/phpbb/config/config.php8
-rw-r--r--phpBB/phpbb/config/db.php14
-rw-r--r--phpBB/phpbb/config/db_text.php12
-rw-r--r--phpBB/phpbb/content_visibility.php18
-rw-r--r--phpBB/phpbb/controller/exception.php4
-rw-r--r--phpBB/phpbb/controller/helper.php40
-rw-r--r--phpBB/phpbb/controller/provider.php6
-rw-r--r--phpBB/phpbb/controller/resolver.php44
-rw-r--r--phpBB/phpbb/cron/manager.php24
-rw-r--r--phpBB/phpbb/cron/task/base.php4
-rw-r--r--phpBB/phpbb/cron/task/core/prune_all_forums.php10
-rw-r--r--phpBB/phpbb/cron/task/core/prune_forum.php16
-rw-r--r--phpBB/phpbb/cron/task/core/prune_notifications.php65
-rw-r--r--phpBB/phpbb/cron/task/core/queue.php10
-rw-r--r--phpBB/phpbb/cron/task/core/tidy_cache.php10
-rw-r--r--phpBB/phpbb/cron/task/core/tidy_database.php8
-rw-r--r--phpBB/phpbb/cron/task/core/tidy_search.php14
-rw-r--r--phpBB/phpbb/cron/task/core/tidy_sessions.php10
-rw-r--r--phpBB/phpbb/cron/task/core/tidy_warnings.php8
-rw-r--r--phpBB/phpbb/cron/task/parametrized.php10
-rw-r--r--phpBB/phpbb/cron/task/task.php4
-rw-r--r--phpBB/phpbb/cron/task/wrapper.php10
-rw-r--r--phpBB/phpbb/datetime.php8
-rw-r--r--phpBB/phpbb/db/driver/driver.php6
-rw-r--r--phpBB/phpbb/db/driver/firebird.php4
-rw-r--r--phpBB/phpbb/db/driver/mssql.php4
-rw-r--r--phpBB/phpbb/db/driver/mssql_base.php4
-rw-r--r--phpBB/phpbb/db/driver/mssql_odbc.php4
-rw-r--r--phpBB/phpbb/db/driver/mssqlnative.php6
-rw-r--r--phpBB/phpbb/db/driver/mysql.php4
-rw-r--r--phpBB/phpbb/db/driver/mysql_base.php4
-rw-r--r--phpBB/phpbb/db/driver/mysqli.php4
-rw-r--r--phpBB/phpbb/db/driver/oracle.php4
-rw-r--r--phpBB/phpbb/db/driver/postgres.php8
-rw-r--r--phpBB/phpbb/db/driver/sqlite.php4
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php (renamed from phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_1.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_10.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_10.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc2.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc3.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_11.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_11.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc2.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_1_rc1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php)4
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_2.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_2.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc2.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_3.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_3.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_3_rc1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_4.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_4.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_5.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_5.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1part2.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_6.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_6.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc2.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc3.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc4.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_7.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_7.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_7_pl1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc2.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_8.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_8.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_9.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_9.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc2.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc3.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc4.php (renamed from phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v310/auth_provider_oauth.php73
-rw-r--r--phpBB/phpbb/db/migration/data/v310/avatars.php (renamed from phpBB/phpbb/db/migration/data/310/avatars.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v310/boardindex.php (renamed from phpBB/phpbb/db/migration/data/310/boardindex.php)4
-rw-r--r--phpBB/phpbb/db/migration/data/v310/config_db_text.php (renamed from phpBB/phpbb/db/migration/data/310/config_db_text.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v310/dev.php (renamed from phpBB/phpbb/db/migration/data/310/dev.php)14
-rw-r--r--phpBB/phpbb/db/migration/data/v310/extensions.php (renamed from phpBB/phpbb/db/migration/data/310/extensions.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v310/forgot_password.php (renamed from phpBB/phpbb/db/migration/data/310/forgot_password.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v310/jquery_update.php (renamed from phpBB/phpbb/db/migration/data/310/jquery_update.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v310/mod_rewrite.php27
-rw-r--r--phpBB/phpbb/db/migration/data/v310/namespaces.php30
-rw-r--r--phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php (renamed from phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php)16
-rw-r--r--phpBB/phpbb/db/migration/data/v310/notifications.php (renamed from phpBB/phpbb/db/migration/data/310/notifications.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v310/notifications_cron.php27
-rw-r--r--phpBB/phpbb/db/migration/data/v310/notifications_schema_fix.php (renamed from phpBB/phpbb/db/migration/data/310/notifications_schema_fix.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v310/reported_posts_display.php (renamed from phpBB/phpbb/db/migration/data/310/reported_posts_display.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v310/signature_module_auth.php (renamed from phpBB/phpbb/db/migration/data/310/signature_module_auth.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v310/softdelete_mcp_modules.php (renamed from phpBB/phpbb/db/migration/data/310/softdelete_mcp_modules.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v310/softdelete_p1.php (renamed from phpBB/phpbb/db/migration/data/310/softdelete_p1.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v310/softdelete_p2.php (renamed from phpBB/phpbb/db/migration/data/310/softdelete_p2.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v310/style_update_p1.php (renamed from phpBB/phpbb/db/migration/data/310/style_update_p1.php)8
-rw-r--r--phpBB/phpbb/db/migration/data/v310/style_update_p2.php (renamed from phpBB/phpbb/db/migration/data/310/style_update_p2.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v310/teampage.php (renamed from phpBB/phpbb/db/migration/data/310/teampage.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v310/timezone.php (renamed from phpBB/phpbb/db/migration/data/310/timezone.php)6
-rw-r--r--phpBB/phpbb/db/migration/data/v310/timezone_p2.php (renamed from phpBB/phpbb/db/migration/data/310/timezone_p2.php)6
-rw-r--r--phpBB/phpbb/db/migration/exception.php12
-rw-r--r--phpBB/phpbb/db/migration/migration.php18
-rw-r--r--phpBB/phpbb/db/migration/tool/config.php14
-rw-r--r--phpBB/phpbb/db/migration/tool/module.php34
-rw-r--r--phpBB/phpbb/db/migration/tool/permission.php26
-rw-r--r--phpBB/phpbb/db/migration/tool/tool_interface.php (renamed from phpBB/phpbb/db/migration/tool/interface.php)4
-rw-r--r--phpBB/phpbb/db/migrator.php38
-rw-r--r--phpBB/phpbb/db/sql_insert_buffer.php12
-rw-r--r--phpBB/phpbb/db/tools.php502
-rw-r--r--phpBB/phpbb/di/extension/config.php6
-rw-r--r--phpBB/phpbb/di/extension/core.php4
-rw-r--r--phpBB/phpbb/di/extension/ext.php4
-rw-r--r--phpBB/phpbb/di/pass/collection_pass.php4
-rw-r--r--phpBB/phpbb/di/pass/kernel_pass.php12
-rw-r--r--phpBB/phpbb/di/service_collection.php4
-rw-r--r--phpBB/phpbb/error_collector.php6
-rw-r--r--phpBB/phpbb/event/data.php4
-rw-r--r--phpBB/phpbb/event/dispatcher.php6
-rw-r--r--phpBB/phpbb/event/extension_subscriber_loader.php6
-rw-r--r--phpBB/phpbb/event/kernel_exception_subscriber.php14
-rw-r--r--phpBB/phpbb/event/kernel_request_subscriber.php10
-rw-r--r--phpBB/phpbb/event/kernel_terminate_subscriber.php4
-rw-r--r--phpBB/phpbb/extension/base.php12
-rw-r--r--phpBB/phpbb/extension/exception.php4
-rw-r--r--phpBB/phpbb/extension/extension_interface.php (renamed from phpBB/phpbb/extension/interface.php)4
-rw-r--r--phpBB/phpbb/extension/finder.php48
-rw-r--r--phpBB/phpbb/extension/manager.php40
-rw-r--r--phpBB/phpbb/extension/metadata_manager.php34
-rw-r--r--phpBB/phpbb/extension/provider.php12
-rw-r--r--phpBB/phpbb/feed/base.php32
-rw-r--r--phpBB/phpbb/feed/factory.php14
-rw-r--r--phpBB/phpbb/feed/forum.php6
-rw-r--r--phpBB/phpbb/feed/forums.php4
-rw-r--r--phpBB/phpbb/feed/helper.php14
-rw-r--r--phpBB/phpbb/feed/news.php4
-rw-r--r--phpBB/phpbb/feed/overall.php4
-rw-r--r--phpBB/phpbb/feed/post_base.php4
-rw-r--r--phpBB/phpbb/feed/topic.php6
-rw-r--r--phpBB/phpbb/feed/topic_base.php4
-rw-r--r--phpBB/phpbb/feed/topics.php4
-rw-r--r--phpBB/phpbb/feed/topics_active.php4
-rw-r--r--phpBB/phpbb/filesystem.php150
-rw-r--r--phpBB/phpbb/groupposition/exception.php4
-rw-r--r--phpBB/phpbb/groupposition/groupposition_interface.php (renamed from phpBB/phpbb/groupposition/interface.php)6
-rw-r--r--phpBB/phpbb/groupposition/legend.php16
-rw-r--r--phpBB/phpbb/groupposition/teampage.php26
-rw-r--r--phpBB/phpbb/hook/finder.php8
-rw-r--r--phpBB/phpbb/json_response.php4
-rw-r--r--phpBB/phpbb/lock/db.php12
-rw-r--r--phpBB/phpbb/lock/flock.php4
-rw-r--r--phpBB/phpbb/log/log.php22
-rw-r--r--phpBB/phpbb/log/log_interface.php (renamed from phpBB/phpbb/log/interface.php)8
-rw-r--r--phpBB/phpbb/log/null.php80
-rw-r--r--phpBB/phpbb/notification/exception.php4
-rw-r--r--phpBB/phpbb/notification/manager.php51
-rw-r--r--phpBB/phpbb/notification/method/base.php46
-rw-r--r--phpBB/phpbb/notification/method/email.php4
-rw-r--r--phpBB/phpbb/notification/method/jabber.php4
-rw-r--r--phpBB/phpbb/notification/method/messenger_base.php6
-rw-r--r--phpBB/phpbb/notification/method/method_interface.php (renamed from phpBB/phpbb/notification/method/interface.php)8
-rw-r--r--phpBB/phpbb/notification/type/approve_post.php4
-rw-r--r--phpBB/phpbb/notification/type/approve_topic.php4
-rw-r--r--phpBB/phpbb/notification/type/base.php62
-rw-r--r--phpBB/phpbb/notification/type/bookmark.php4
-rw-r--r--phpBB/phpbb/notification/type/disapprove_post.php4
-rw-r--r--phpBB/phpbb/notification/type/disapprove_topic.php4
-rw-r--r--phpBB/phpbb/notification/type/group_request.php165
-rw-r--r--phpBB/phpbb/notification/type/group_request_approved.php120
-rw-r--r--phpBB/phpbb/notification/type/pm.php4
-rw-r--r--phpBB/phpbb/notification/type/post.php4
-rw-r--r--phpBB/phpbb/notification/type/post_in_queue.php4
-rw-r--r--phpBB/phpbb/notification/type/quote.php4
-rw-r--r--phpBB/phpbb/notification/type/report_pm.php4
-rw-r--r--phpBB/phpbb/notification/type/report_pm_closed.php4
-rw-r--r--phpBB/phpbb/notification/type/report_post.php4
-rw-r--r--phpBB/phpbb/notification/type/report_post_closed.php4
-rw-r--r--phpBB/phpbb/notification/type/topic.php4
-rw-r--r--phpBB/phpbb/notification/type/topic_in_queue.php4
-rw-r--r--phpBB/phpbb/notification/type/type_interface.php (renamed from phpBB/phpbb/notification/type/interface.php)6
-rw-r--r--phpBB/phpbb/permissions.php28
-rw-r--r--phpBB/phpbb/php/ini.php4
-rw-r--r--phpBB/phpbb/request/deactivated_super_global.php22
-rw-r--r--phpBB/phpbb/request/request.php82
-rw-r--r--phpBB/phpbb/request/request_interface.php (renamed from phpBB/phpbb/request/interface.php)40
-rw-r--r--phpBB/phpbb/request/type_cast_helper.php8
-rw-r--r--phpBB/phpbb/request/type_cast_helper_interface.php8
-rw-r--r--phpBB/phpbb/search/base.php6
-rw-r--r--phpBB/phpbb/search/fulltext_mysql.php16
-rw-r--r--phpBB/phpbb/search/fulltext_native.php14
-rw-r--r--phpBB/phpbb/search/fulltext_postgres.php12
-rw-r--r--phpBB/phpbb/search/fulltext_sphinx.php24
-rw-r--r--phpBB/phpbb/search/sphinx/config.php34
-rw-r--r--phpBB/phpbb/search/sphinx/config_comment.php6
-rw-r--r--phpBB/phpbb/search/sphinx/config_section.php18
-rw-r--r--phpBB/phpbb/search/sphinx/config_variable.php6
-rw-r--r--phpBB/phpbb/session.php12
-rw-r--r--phpBB/phpbb/style/extension_path_provider.php137
-rw-r--r--phpBB/phpbb/style/path_provider.php62
-rw-r--r--phpBB/phpbb/style/path_provider_interface.php42
-rw-r--r--phpBB/phpbb/style/resource_locator.php348
-rw-r--r--phpBB/phpbb/style/style.php241
-rw-r--r--phpBB/phpbb/symfony_request.php48
-rw-r--r--phpBB/phpbb/template/asset.php13
-rw-r--r--phpBB/phpbb/template/base.php150
-rw-r--r--phpBB/phpbb/template/context.php8
-rw-r--r--phpBB/phpbb/template/locator.php163
-rw-r--r--phpBB/phpbb/template/template.php56
-rw-r--r--phpBB/phpbb/template/twig/definition.php8
-rw-r--r--phpBB/phpbb/template/twig/environment.php81
-rw-r--r--phpBB/phpbb/template/twig/extension.php68
-rw-r--r--phpBB/phpbb/template/twig/lexer.php35
-rw-r--r--phpBB/phpbb/template/twig/loader.php152
-rw-r--r--phpBB/phpbb/template/twig/node/definenode.php (renamed from phpBB/phpbb/template/twig/node/define.php)10
-rw-r--r--phpBB/phpbb/template/twig/node/event.php10
-rw-r--r--phpBB/phpbb/template/twig/node/expression/binary/equalequal.php6
-rw-r--r--phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php6
-rw-r--r--phpBB/phpbb/template/twig/node/includeasset.php16
-rw-r--r--phpBB/phpbb/template/twig/node/includecss.php6
-rw-r--r--phpBB/phpbb/template/twig/node/includejs.php6
-rw-r--r--phpBB/phpbb/template/twig/node/includenode.php (renamed from phpBB/phpbb/template/twig/node/include.php)6
-rw-r--r--phpBB/phpbb/template/twig/node/includephp.php10
-rw-r--r--phpBB/phpbb/template/twig/node/php.php8
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/defineparser.php (renamed from phpBB/phpbb/template/twig/tokenparser/define.php)18
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/event.php10
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/includecss.php10
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/includejs.php10
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/includeparser.php (renamed from phpBB/phpbb/template/twig/tokenparser/include.php)8
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/includephp.php14
-rw-r--r--phpBB/phpbb/template/twig/tokenparser/php.php14
-rw-r--r--phpBB/phpbb/template/twig/twig.php348
-rw-r--r--phpBB/phpbb/tree/nestedset.php38
-rw-r--r--phpBB/phpbb/tree/nestedset_forum.php10
-rw-r--r--phpBB/phpbb/tree/tree_interface.php (renamed from phpBB/phpbb/tree/interface.php)6
-rw-r--r--phpBB/phpbb/user.php30
-rw-r--r--phpBB/phpbb/user_loader.php10
-rw-r--r--phpBB/posting.php10
-rw-r--r--phpBB/search.php12
-rw-r--r--phpBB/styles/prosilver/template/forum_fn.js287
-rw-r--r--phpBB/styles/prosilver/template/jumpbox.html8
-rw-r--r--phpBB/styles/prosilver/template/login_body.html14
-rw-r--r--phpBB/styles/prosilver/template/login_body_oauth.html8
-rw-r--r--phpBB/styles/prosilver/template/mcp_notes_user.html2
-rw-r--r--phpBB/styles/prosilver/template/mcp_post.html12
-rw-r--r--phpBB/styles/prosilver/template/mcp_topic.html20
-rw-r--r--phpBB/styles/prosilver/template/memberlist_body.html4
-rw-r--r--phpBB/styles/prosilver/template/memberlist_im.html72
-rw-r--r--phpBB/styles/prosilver/template/memberlist_search.html40
-rw-r--r--phpBB/styles/prosilver/template/overall_footer.html2
-rw-r--r--phpBB/styles/prosilver/template/overall_header.html36
-rw-r--r--phpBB/styles/prosilver/template/pagination.html3
-rw-r--r--phpBB/styles/prosilver/template/posting_poll_body.html2
-rw-r--r--phpBB/styles/prosilver/template/search_body.html10
-rw-r--r--phpBB/styles/prosilver/template/simple_header.html32
-rw-r--r--phpBB/styles/prosilver/template/ucp_auth_link.html15
-rw-r--r--phpBB/styles/prosilver/template/ucp_auth_link_oauth.html29
-rw-r--r--phpBB/styles/prosilver/template/ucp_avatar_options_gravatar.html16
-rw-r--r--phpBB/styles/prosilver/template/ucp_avatar_options_remote.html16
-rw-r--r--phpBB/styles/prosilver/template/ucp_login_link.html58
-rw-r--r--phpBB/styles/prosilver/template/ucp_notifications.html2
-rw-r--r--phpBB/styles/prosilver/template/ucp_pm_viewmessage.html2
-rw-r--r--phpBB/styles/prosilver/template/ucp_prefs_personal.html2
-rw-r--r--phpBB/styles/prosilver/template/ucp_prefs_post.html2
-rw-r--r--phpBB/styles/prosilver/template/ucp_prefs_view.html4
-rw-r--r--phpBB/styles/prosilver/template/viewtopic_body.html43
-rw-r--r--phpBB/styles/prosilver/theme/bidi.css7
-rw-r--r--phpBB/styles/prosilver/theme/colours.css15
-rw-r--r--phpBB/styles/prosilver/theme/common.css33
-rw-r--r--phpBB/styles/prosilver/theme/forms.css10
-rw-r--r--phpBB/styles/subsilver2/template/login_body.html3
-rw-r--r--phpBB/styles/subsilver2/template/login_body_oauth.html7
-rw-r--r--phpBB/styles/subsilver2/template/mcp_post.html2
-rw-r--r--phpBB/styles/subsilver2/template/overall_footer.html2
-rw-r--r--phpBB/styles/subsilver2/template/overall_header.html5
-rw-r--r--phpBB/styles/subsilver2/template/ucp_auth_link.html19
-rw-r--r--phpBB/styles/subsilver2/template/ucp_auth_link_oauth.html34
-rw-r--r--phpBB/styles/subsilver2/template/ucp_login_link.html74
-rw-r--r--phpBB/styles/subsilver2/template/ucp_notifications.html2
-rw-r--r--phpBB/styles/subsilver2/template/ucp_prefs_personal.html2
-rw-r--r--phpBB/styles/subsilver2/template/ucp_prefs_post.html2
-rw-r--r--phpBB/styles/subsilver2/template/ucp_prefs_view.html4
-rw-r--r--phpBB/styles/subsilver2/theme/stylesheet.css3
-rw-r--r--phpBB/ucp.php16
-rw-r--r--phpBB/viewforum.php2
-rw-r--r--phpBB/viewtopic.php19
-rw-r--r--tests/RUNNING_TESTS.md2
-rw-r--r--tests/acp_board/auth_provider/invalid.php4
-rw-r--r--tests/acp_board/auth_provider/valid.php4
-rw-r--r--tests/acp_board/select_auth_method_test.php4
-rw-r--r--tests/auth/fixtures/oauth_tokens.xml10
-rw-r--r--tests/auth/provider_apache_test.php16
-rw-r--r--tests/auth/provider_db_test.php8
-rw-r--r--tests/auth/provider_oauth_token_storage_test.php207
-rw-r--r--tests/avatar/driver/barfoo.php4
-rw-r--r--tests/avatar/driver/foobar.php4
-rw-r--r--tests/avatar/manager_test.php18
-rw-r--r--tests/bootstrap.php6
-rw-r--r--tests/cache/apc_driver_test.php4
-rw-r--r--tests/cache/common_test_case.php4
-rw-r--r--tests/cache/file_driver_test.php2
-rw-r--r--tests/cache/null_driver_test.php6
-rw-r--r--tests/cache/redis_driver_test.php2
-rw-r--r--tests/class_loader/class_loader_test.php38
-rw-r--r--tests/class_loader/phpbb/class_name.php4
-rw-r--r--tests/class_loader/phpbb/dir.php6
-rw-r--r--tests/class_loader/phpbb/dir/class_name.php4
-rw-r--r--tests/class_loader/phpbb/dir/subdir/class_name.php4
-rw-r--r--tests/class_loader/phpbb/dir2/dir2.php4
-rw-r--r--tests/config/config_test.php28
-rw-r--r--tests/config/db_test.php20
-rw-r--r--tests/config/db_text_test.php2
-rw-r--r--tests/content_visibility/delete_post_test.php8
-rw-r--r--tests/content_visibility/get_forums_visibility_sql_test.php6
-rw-r--r--tests/content_visibility/get_global_visibility_sql_test.php6
-rw-r--r--tests/content_visibility/get_visibility_sql_test.php6
-rw-r--r--tests/content_visibility/set_post_visibility_test.php6
-rw-r--r--tests/content_visibility/set_topic_visibility_test.php6
-rw-r--r--tests/controller/config/services.yml2
-rw-r--r--tests/controller/controller_test.php12
-rw-r--r--tests/controller/ext/foo/config/services.yml2
-rw-r--r--tests/controller/ext/foo/controller.php4
-rw-r--r--tests/controller/helper_url_test.php106
-rw-r--r--tests/controller/phpbb/controller/foo.php4
-rw-r--r--tests/cron/ext/testext/cron/dummy_task.php2
-rw-r--r--tests/cron/includes/cron/task/core/dummy_task.php2
-rw-r--r--tests/cron/includes/cron/task/core/second_dummy_task.php2
-rw-r--r--tests/cron/manager_test.php6
-rw-r--r--tests/cron/tasks/simple_not_runnable.php2
-rw-r--r--tests/cron/tasks/simple_ready.php2
-rw-r--r--tests/cron/tasks/simple_should_not_run.php2
-rw-r--r--tests/datetime/from_format_test.php2
-rw-r--r--tests/dbal/auto_increment_test.php2
-rw-r--r--tests/dbal/db_tools_test.php6
-rw-r--r--tests/dbal/migration/dummy.php2
-rw-r--r--tests/dbal/migration/fail.php2
-rw-r--r--tests/dbal/migration/if.php2
-rw-r--r--tests/dbal/migration/installed.php2
-rw-r--r--tests/dbal/migration/recall.php2
-rw-r--r--tests/dbal/migration/revert.php2
-rw-r--r--tests/dbal/migration/revert_with_dependency.php2
-rw-r--r--tests/dbal/migration/unfulfillable.php2
-rw-r--r--tests/dbal/migrator_test.php20
-rw-r--r--tests/dbal/migrator_tool_config_test.php4
-rw-r--r--tests/dbal/migrator_tool_module_test.php10
-rw-r--r--tests/dbal/migrator_tool_permission_test.php6
-rw-r--r--tests/dbal/sql_insert_buffer_test.php2
-rw-r--r--tests/dbal/write_test.php2
-rw-r--r--tests/di/create_container_test.php106
-rw-r--r--tests/di/fixtures/config.php2
-rw-r--r--tests/error_collector_test.php2
-rw-r--r--tests/event/dispatcher_test.php4
-rw-r--r--tests/extension/ext/bar/ext.php4
-rw-r--r--tests/extension/ext/bar/my/hidden_class.php4
-rw-r--r--tests/extension/ext/barfoo/acp/a_info.php6
-rw-r--r--tests/extension/ext/barfoo/acp/a_module.php4
-rw-r--r--tests/extension/ext/barfoo/ext.php4
-rw-r--r--tests/extension/ext/foo/a_class.php4
-rw-r--r--tests/extension/ext/foo/acp/a_info.php6
-rw-r--r--tests/extension/ext/foo/acp/a_module.php4
-rw-r--r--tests/extension/ext/foo/acp/fail_info.php7
-rw-r--r--tests/extension/ext/foo/acp/fail_module.php5
-rw-r--r--tests/extension/ext/foo/b_class.php4
-rw-r--r--tests/extension/ext/foo/ext.php4
-rw-r--r--tests/extension/ext/foo/mcp/a_info.php6
-rw-r--r--tests/extension/ext/foo/mcp/a_module.php4
-rw-r--r--tests/extension/ext/foo/sub/type/alternative.php4
-rw-r--r--tests/extension/ext/foo/type/alternative.php4
-rw-r--r--tests/extension/ext/foo/typewrong/error.php4
-rw-r--r--tests/extension/ext/vendor/moo/ext.php4
-rw-r--r--tests/extension/ext/vendor/moo/feature_class.php4
-rw-r--r--tests/extension/finder_test.php36
-rw-r--r--tests/extension/manager_test.php28
-rw-r--r--tests/extension/metadata_manager_test.php71
-rw-r--r--tests/extension/modules_test.php38
-rw-r--r--tests/extension/style_path_provider_test.php50
-rw-r--r--tests/extension/subdir/style_path_provider_test.php18
-rw-r--r--tests/filesystem/clean_path_test.php8
-rw-r--r--tests/filesystem/web_root_path_test.php142
-rw-r--r--tests/functional/acp_permissions_test.php6
-rw-r--r--tests/functional/common_avatar_test.php2
-rw-r--r--tests/functional/common_groups_test.php2
-rw-r--r--tests/functional/extension_controller_test.php12
-rw-r--r--tests/functional/extension_module_test.php4
-rw-r--r--tests/functional/fixtures/ext/foo/bar/acp/main_info.php6
-rw-r--r--tests/functional/fixtures/ext/foo/bar/acp/main_module.php4
-rw-r--r--tests/functional/fixtures/ext/foo/bar/config/services.yml2
-rw-r--r--tests/functional/fixtures/ext/foo/bar/controller/controller.php9
-rw-r--r--tests/functional/fixtures/ext/foo/bar/event/permission.php4
-rw-r--r--tests/functional/fixtures/ext/foo/bar/event/user_setup.php4
-rw-r--r--tests/functional/fixtures/ext/foo/bar/ext.php4
-rw-r--r--tests/functional/posting_test.php4
-rw-r--r--tests/functional/registration_test.php52
-rw-r--r--tests/functions/convert_30_dbms_to_31_test.php2
-rw-r--r--tests/functions/obtain_online_test.php2
-rw-r--r--tests/functions_user/group_user_attributes_test.php6
-rw-r--r--tests/groupposition/legend_test.php30
-rw-r--r--tests/groupposition/teampage_test.php34
-rw-r--r--tests/lock/db_test.php10
-rw-r--r--tests/lock/flock_test.php12
-rw-r--r--tests/log/add_test.php12
-rw-r--r--tests/log/function_add_log_test.php6
-rw-r--r--tests/log/function_view_log_test.php4
-rw-r--r--tests/mock/auth_provider.php34
-rw-r--r--tests/mock/cache.php4
-rw-r--r--tests/mock/extension_manager.php10
-rw-r--r--tests/mock/metadata_manager.php2
-rw-r--r--tests/mock/notifications_auth.php2
-rw-r--r--tests/mock/request.php37
-rw-r--r--tests/mock/session_testable.php2
-rw-r--r--tests/mock/sql_insert_buffer.php2
-rw-r--r--tests/notification/base.php131
-rw-r--r--tests/notification/convert_test.php6
-rw-r--r--tests/notification/ext/test/notification/type/test.php4
-rw-r--r--tests/notification/fixtures/group_request.xml30
-rw-r--r--tests/notification/group_request_test.php109
-rw-r--r--tests/notification/manager_helper.php6
-rw-r--r--tests/notification/notification_test.php367
-rw-r--r--tests/notification/submit_post_base.php22
-rw-r--r--tests/pagination/generate_template_test.php111
-rw-r--r--tests/pagination/templates/pagination.html12
-rw-r--r--tests/request/deactivated_super_global_test.php2
-rw-r--r--tests/request/request_test.php8
-rw-r--r--tests/request/request_var_test.php2
-rw-r--r--tests/request/type_cast_helper_test.php2
-rw-r--r--tests/search/mysql_test.php2
-rw-r--r--tests/search/native_test.php2
-rw-r--r--tests/search/postgres_test.php2
-rw-r--r--tests/security/base.php4
-rw-r--r--tests/security/extract_current_page_test.php8
-rw-r--r--tests/session/check_ban_test.php4
-rw-r--r--tests/session/testable_facade.php24
-rw-r--r--tests/session/testable_factory.php6
-rw-r--r--tests/template/includephp_test.php2
-rw-r--r--tests/template/template_events_test.php16
-rw-r--r--tests/template/template_includecss_test.php4
-rw-r--r--tests/template/template_includejs_test.php28
-rw-r--r--tests/template/template_test.php13
-rw-r--r--tests/template/template_test_case.php22
-rw-r--r--tests/template/template_test_case_with_tree.php17
-rw-r--r--tests/template/templates/define.html15
-rw-r--r--tests/template/templates/if.html2
-rw-r--r--tests/template/templates/include_define_variable.html6
-rw-r--r--tests/test_framework/phpbb_database_test_case.php2
-rw-r--r--tests/test_framework/phpbb_database_test_connection_manager.php76
-rw-r--r--tests/test_framework/phpbb_functional_test_case.php57
-rw-r--r--tests/test_framework/phpbb_search_test_case.php2
-rw-r--r--tests/test_framework/phpbb_test_case_helpers.php2
-rw-r--r--tests/tree/nestedset_forum_base.php8
-rw-r--r--tests/user/lang_test.php4
-rw-r--r--tests/user/user_loader_test.php2
-rw-r--r--tests/wrapper/phpbb_php_ini_fake.php2
-rw-r--r--travis/phpunit-mysql-travis.xml2
-rw-r--r--travis/phpunit-postgres-travis.xml2
-rwxr-xr-xtravis/setup-webserver.sh2
590 files changed, 10910 insertions, 7499 deletions
diff --git a/build/build.xml b/build/build.xml
index f8181160c1..f29be5326d 100644
--- a/build/build.xml
+++ b/build/build.xml
@@ -3,8 +3,8 @@
<project name="phpBB" description="The phpBB forum software" default="all" basedir="../">
<!-- a few settings for the build -->
<property name="newversion" value="3.1.0-dev" />
- <property name="prevversion" value="3.0.11" />
- <property name="olderversions" value="3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.0.7-PL1, 3.0.8, 3.0.9, 3.0.10" />
+ <property name="prevversion" value="3.0.12-RC3" />
+ <property name="olderversions" value="3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.0.6, 3.0.7, 3.0.7-PL1, 3.0.8, 3.0.9, 3.0.10, 3.0.11" />
<!-- no configuration should be needed beyond this point -->
<property name="oldversions" value="${olderversions}, ${prevversion}" />
diff --git a/phpBB/.htaccess b/phpBB/.htaccess
index 474f9774c2..6f33916775 100644
--- a/phpBB/.htaccess
+++ b/phpBB/.htaccess
@@ -1,12 +1,30 @@
+<IfModule mod_rewrite.c>
+RewriteEngine on
+
#
# Uncomment the statement below if you want to make use of
# HTTP authentication and it does not already work.
# This could be required if you are for example using PHP via Apache CGI.
#
-#<IfModule mod_rewrite.c>
-#RewriteEngine on
#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
-#</IfModule>
+
+#
+# The following 3 lines will rewrite URLs passed through the front controller
+# to not require app.php in the actual URL. In other words, a controller is
+# by default accessed at /app.php/my/controller, but can also be accessed at
+# /my/controller
+#
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteCond %{REQUEST_FILENAME} !-d
+RewriteRule ^(.*)$ app.php [QSA,L]
+
+#
+# If symbolic links are not already being followed,
+# uncomment the line below.
+# http://anothersysadmin.wordpress.com/2008/06/10/mod_rewrite-forbidden-403-with-apache-228/
+#
+#Options +FollowSymLinks
+</IfModule>
<Files "config.php">
Order Allow,Deny
diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php
index 8cd1967c75..c1e8edbd03 100644
--- a/phpBB/adm/index.php
+++ b/phpBB/adm/index.php
@@ -50,7 +50,7 @@ $module_id = request_var('i', '');
$mode = request_var('mode', '');
// Set custom style for admin area
-$phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), '');
+$template->set_custom_style('adm', $phpbb_admin_path . 'style');
$template->assign_var('T_ASSETS_PATH', $phpbb_root_path . 'assets');
$template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style');
diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css
index f7a7f9f9bf..ca15338133 100644
--- a/phpBB/adm/style/admin.css
+++ b/phpBB/adm/style/admin.css
@@ -752,6 +752,10 @@ optgroup, select {
color: #000;
}
+select:focus {
+ outline-style: none;
+}
+
optgroup {
font-size: 1.00em;
font-weight: bold;
@@ -997,6 +1001,7 @@ input:focus, textarea:focus {
border: 1px solid #BC2A4D;
background-color: #E9E9E2;
color: #BC2A4D;
+ outline-style: none;
}
/* Submit button fieldset or paragraph
@@ -1091,6 +1096,11 @@ input.disabled {
color: #666666;
}
+/* Focus states */
+input.button1:focus, input.button2:focus, input.button3:focus {
+ outline-style: none;
+}
+
/* jQuery popups
---------------------------------------- */
.phpbb_alert {
diff --git a/phpBB/adm/style/auth_provider_oauth.html b/phpBB/adm/style/auth_provider_oauth.html
new file mode 100644
index 0000000000..25e40ff596
--- /dev/null
+++ b/phpBB/adm/style/auth_provider_oauth.html
@@ -0,0 +1,17 @@
+<h2>{L_AUTH_PROVIDER_OAUTH_TITLE}</h2>
+
+<p>{L_AUTH_PROVIDER_OAUTH_EXPLAIN}</p>
+
+<!-- BEGIN oauth_services -->
+<fieldset>
+ <legend>{oauth_services.ACTUAL_NAME}</legend>
+ <dl>
+ <dt><label for="oauth_service_{oauth_services.NAME}_key">{L_AUTH_PROVIDER_OAUTH_KEY}{L_COLON}</label></dt>
+ <dd><input type="text" id="oauth_service_{oauth_services.NAME}_key" size="40" name="config[auth_oauth_{oauth_services.NAME}_key]" value="{oauth_services.KEY}" /></dd>
+ </dl>
+ <dl>
+ <dt><label for="oauth_service_{oauth_services.NAME}_secret">{L_AUTH_PROVIDER_OAUTH_SECRET}{L_COLON}</label></dt>
+ <dd><input type="text" id="oauth_service_{oauth_services.NAME}_secret" size="40" name="config[auth_oauth_{oauth_services.NAME}_secret]" value="{oauth_services.SECRET}" /></dd>
+ </dl>
+</fieldset>
+<!-- END oauth_services -->
diff --git a/phpBB/adm/style/overall_header.html b/phpBB/adm/style/overall_header.html
index 8170931221..3a9b6db2a3 100644
--- a/phpBB/adm/style/overall_header.html
+++ b/phpBB/adm/style/overall_header.html
@@ -12,7 +12,7 @@
var jump_page = '{LA_JUMP_PAGE}{L_COLON}';
var on_page = '{ON_PAGE}';
var per_page = '{PER_PAGE}';
-var base_url = '{A_BASE_URL}';
+var base_url = '{BASE_URL|e('js')}';
var menu_state = 'shown';
diff --git a/phpBB/adm/style/simple_header.html b/phpBB/adm/style/simple_header.html
index 6e0c360600..9c4c8a2960 100644
--- a/phpBB/adm/style/simple_header.html
+++ b/phpBB/adm/style/simple_header.html
@@ -12,7 +12,7 @@
var jump_page = '{LA_JUMP_PAGE}{L_COLON}';
var on_page = '{ON_PAGE}';
var per_page = '{PER_PAGE}';
-var base_url = '{A_BASE_URL}';
+var base_url = '{BASE_URL|e('js')}';
/**
* Window popup
diff --git a/phpBB/adm/swatch.php b/phpBB/adm/swatch.php
index 3ae38d0d8b..e9d46d65b5 100644
--- a/phpBB/adm/swatch.php
+++ b/phpBB/adm/swatch.php
@@ -22,7 +22,7 @@ $auth->acl($user->data);
$user->setup();
// Set custom template for admin area
-$phpbb_style->set_custom_style('admin', $phpbb_admin_path . 'style', array(), '');
+$template->set_custom_style('adm', $phpbb_admin_path . 'style');
$template->set_filenames(array(
'body' => 'colour_swatch.html')
diff --git a/phpBB/app.php b/phpBB/app.php
index d93208d585..f1023ff1b5 100644
--- a/phpBB/app.php
+++ b/phpBB/app.php
@@ -24,7 +24,6 @@ $user->session_begin();
$auth->acl($user->data);
$user->setup('app');
-$symfony_request = phpbb_create_symfony_request($request);
$http_kernel = $phpbb_container->get('http_kernel');
$response = $http_kernel->handle($symfony_request);
$response->send();
diff --git a/phpBB/common.php b/phpBB/common.php
index 962a1f951f..80375f7a9c 100644
--- a/phpBB/common.php
+++ b/phpBB/common.php
@@ -47,7 +47,19 @@ if (!defined('PHPBB_INSTALLED'))
// Eliminate . and .. from the path
require($phpbb_root_path . 'phpbb/filesystem.' . $phpEx);
- $phpbb_filesystem = new phpbb_filesystem();
+ require($phpbb_root_path . 'phpbb/symfony_request.' . $phpEx);
+ require($phpbb_root_path . 'phpbb/request/deactivated_super_global.' . $phpEx);
+ 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,
+ $phpEx
+ );
$script_path = $phpbb_filesystem->clean_path($script_path);
$url = (($secure) ? 'https://' : 'http://') . $server_name;
@@ -85,9 +97,9 @@ require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
// 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_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();
// Set up container
@@ -109,6 +121,10 @@ $db = $phpbb_container->get('dbal.conn');
// make sure request_var uses this request instance
request_var('', 0, false, false, $request); // "dependency injection" for a function
+// Create a Symfony Request object from our phpbb_request object
+$symfony_request = $phpbb_container->get('symfony_request');
+$phpbb_filesystem = $phpbb_container->get('filesystem');
+
// Grab global variables, re-cache if necessary
$config = $phpbb_container->get('config');
set_config(null, null, null, $config);
@@ -121,11 +137,10 @@ $phpbb_extension_manager = $phpbb_container->get('ext.manager');
$phpbb_subscriber_loader = $phpbb_container->get('event.subscriber_loader');
$template = $phpbb_container->get('template');
-$phpbb_style = $phpbb_container->get('style');
// Add own hook handler
require($phpbb_root_path . 'includes/hooks/index.' . $phpEx);
-$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('phpbb_template', 'display')));
+$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');
foreach ($phpbb_hook_finder->find() as $hook)
diff --git a/phpBB/composer.json b/phpBB/composer.json
index bf693d1950..455ad49aac 100644
--- a/phpBB/composer.json
+++ b/phpBB/composer.json
@@ -1,16 +1,17 @@
{
"minimum-stability": "beta",
"require": {
- "symfony/config": "2.1.*",
- "symfony/dependency-injection": "2.1.*",
- "symfony/event-dispatcher": "2.1.*",
- "symfony/http-kernel": "2.1.*",
- "symfony/routing": "2.1.*",
- "symfony/yaml": "2.1.*",
+ "lusitanian/oauth": "0.2.*",
+ "symfony/config": "2.3.*",
+ "symfony/dependency-injection": "2.3.*",
+ "symfony/event-dispatcher": "2.3.*",
+ "symfony/http-kernel": "2.3.*",
+ "symfony/routing": "2.3.*",
+ "symfony/yaml": "2.3.*",
"twig/twig": "1.13.*"
},
"require-dev": {
- "fabpot/goutte": "v0.1.0",
+ "fabpot/goutte": "1.0.*",
"phpunit/dbunit": "1.2.*",
"phpunit/phpunit": "3.7.*",
"phing/phing": "2.4.*"
diff --git a/phpBB/composer.lock b/phpBB/composer.lock
index 1ba6cb6f83..eb57ddb4d9 100644
--- a/phpBB/composer.lock
+++ b/phpBB/composer.lock
@@ -3,33 +3,140 @@
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
- "hash": "6e6125b88160e28568edcb9fd007abed",
+ "hash": "0bc0fd0d784720629ae0ba6d4be6a577",
"packages": [
{
+ "name": "lusitanian/oauth",
+ "version": "v0.2.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Lusitanian/PHPoAuthLib.git",
+ "reference": "00c667d93058e983fc1b7d3d1cebdb1bc03fb043"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Lusitanian/PHPoAuthLib/zipball/00c667d93058e983fc1b7d3d1cebdb1bc03fb043",
+ "reference": "00c667d93058e983fc1b7d3d1cebdb1bc03fb043",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "3.7.*",
+ "predis/predis": "0.8.*@dev",
+ "symfony/http-foundation": "~2.1"
+ },
+ "suggest": {
+ "predis/predis": "Allows using the Redis storage backend.",
+ "symfony/http-foundation": "Allows using the Symfony Session storage backend."
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "0.1-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "OAuth": "src",
+ "OAuth\\Unit": "tests"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "David Desberg",
+ "email": "david@daviddesberg.com"
+ },
+ {
+ "name": "Pieter Hordijk",
+ "email": "info@pieterhordijk.com",
+ "homepage": "https://pieterhordijk.com",
+ "role": "developer"
+ }
+ ],
+ "description": "PHP 5.3+ oAuth 1/2 Library",
+ "keywords": [
+ "Authentication",
+ "authorization",
+ "oauth",
+ "security"
+ ],
+ "time": "2013-08-29 21:40:04"
+ },
+ {
+ "name": "psr/log",
+ "version": "1.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/log.git",
+ "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b",
+ "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b",
+ "shasum": ""
+ },
+ "type": "library",
+ "autoload": {
+ "psr-0": {
+ "Psr\\Log\\": ""
+ }
+ },
+ "notification-url": "http://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for logging libraries",
+ "keywords": [
+ "log",
+ "psr",
+ "psr-3"
+ ],
+ "time": "2012-12-21 11:40:51"
+ },
+ {
"name": "symfony/config",
- "version": "v2.1.11",
+ "version": "v2.3.4",
"target-dir": "Symfony/Component/Config",
"source": {
"type": "git",
"url": "https://github.com/symfony/Config.git",
- "reference": "v2.1.11"
+ "reference": "65a927c15ca5a911ba2fa277a5457fa8129505b0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Config/zipball/v2.1.11",
- "reference": "v2.1.11",
+ "url": "https://api.github.com/repos/symfony/Config/zipball/65a927c15ca5a911ba2fa277a5457fa8129505b0",
+ "reference": "65a927c15ca5a911ba2fa277a5457fa8129505b0",
"shasum": ""
},
"require": {
- "php": ">=5.3.3"
+ "php": ">=5.3.3",
+ "symfony/filesystem": "~2.3"
},
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.3-dev"
+ }
+ },
"autoload": {
"psr-0": {
- "Symfony\\Component\\Config": ""
+ "Symfony\\Component\\Config\\": ""
}
},
- "notification-url": "https://packagist.org/downloads/",
+ "notification-url": "http://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -45,41 +152,103 @@
],
"description": "Symfony Config Component",
"homepage": "http://symfony.com",
- "time": "2013-05-09 15:22:40"
+ "time": "2013-08-06 05:49:23"
+ },
+ {
+ "name": "symfony/debug",
+ "version": "v2.3.4",
+ "target-dir": "Symfony/Component/Debug",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/Debug.git",
+ "reference": "729f6d19cfc401c4942e43fcc1059103bd6df130"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/Debug/zipball/729f6d19cfc401c4942e43fcc1059103bd6df130",
+ "reference": "729f6d19cfc401c4942e43fcc1059103bd6df130",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "require-dev": {
+ "symfony/http-foundation": "~2.1",
+ "symfony/http-kernel": "~2.1"
+ },
+ "suggest": {
+ "symfony/class-loader": "",
+ "symfony/http-foundation": "",
+ "symfony/http-kernel": ""
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.3-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Symfony\\Component\\Debug\\": ""
+ }
+ },
+ "notification-url": "http://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "http://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Debug Component",
+ "homepage": "http://symfony.com",
+ "time": "2013-08-08 14:16:10"
},
{
"name": "symfony/dependency-injection",
- "version": "v2.1.11",
+ "version": "v2.3.4",
"target-dir": "Symfony/Component/DependencyInjection",
"source": {
"type": "git",
"url": "https://github.com/symfony/DependencyInjection.git",
- "reference": "v2.1.11"
+ "reference": "3678aa969e5bfeb8515a1f3047c63e8104723f5c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/v2.1.11",
- "reference": "v2.1.11",
+ "url": "https://api.github.com/repos/symfony/DependencyInjection/zipball/3678aa969e5bfeb8515a1f3047c63e8104723f5c",
+ "reference": "3678aa969e5bfeb8515a1f3047c63e8104723f5c",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
- "symfony/config": "2.1.*",
- "symfony/yaml": "2.1.*"
+ "symfony/config": "~2.2",
+ "symfony/yaml": "~2.0"
},
"suggest": {
- "symfony/config": "2.1.*",
- "symfony/yaml": "2.1.*"
+ "symfony/config": "",
+ "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them",
+ "symfony/yaml": ""
},
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.3-dev"
+ }
+ },
"autoload": {
"psr-0": {
- "Symfony\\Component\\DependencyInjection": ""
+ "Symfony\\Component\\DependencyInjection\\": ""
}
},
- "notification-url": "https://packagist.org/downloads/",
+ "notification-url": "http://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -95,40 +264,45 @@
],
"description": "Symfony DependencyInjection Component",
"homepage": "http://symfony.com",
- "time": "2013-05-03 05:08:13"
+ "time": "2013-07-25 17:13:25"
},
{
"name": "symfony/event-dispatcher",
- "version": "v2.1.11",
+ "version": "v2.3.4",
"target-dir": "Symfony/Component/EventDispatcher",
"source": {
"type": "git",
"url": "https://github.com/symfony/EventDispatcher.git",
- "reference": "v2.1.11"
+ "reference": "41c9826457c65fa3cf746f214985b7ca9cba42f8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/v2.1.11",
- "reference": "v2.1.11",
+ "url": "https://api.github.com/repos/symfony/EventDispatcher/zipball/41c9826457c65fa3cf746f214985b7ca9cba42f8",
+ "reference": "41c9826457c65fa3cf746f214985b7ca9cba42f8",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
- "symfony/dependency-injection": "2.1.*"
+ "symfony/dependency-injection": "~2.0"
},
"suggest": {
- "symfony/dependency-injection": "2.1.*",
- "symfony/http-kernel": "2.1.*"
+ "symfony/dependency-injection": "",
+ "symfony/http-kernel": ""
},
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.3-dev"
+ }
+ },
"autoload": {
"psr-0": {
- "Symfony\\Component\\EventDispatcher": ""
+ "Symfony\\Component\\EventDispatcher\\": ""
}
},
- "notification-url": "https://packagist.org/downloads/",
+ "notification-url": "http://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -144,34 +318,88 @@
],
"description": "Symfony EventDispatcher Component",
"homepage": "http://symfony.com",
- "time": "2013-02-11 11:26:14"
+ "time": "2013-07-21 12:12:18"
+ },
+ {
+ "name": "symfony/filesystem",
+ "version": "v2.3.4",
+ "target-dir": "Symfony/Component/Filesystem",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/Filesystem.git",
+ "reference": "87acbbef6d35ba649f96f09cc572c45119b360c3"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/Filesystem/zipball/87acbbef6d35ba649f96f09cc572c45119b360c3",
+ "reference": "87acbbef6d35ba649f96f09cc572c45119b360c3",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.3"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.3-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Symfony\\Component\\Filesystem\\": ""
+ }
+ },
+ "notification-url": "http://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Potencier",
+ "email": "fabien@symfony.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "http://symfony.com/contributors"
+ }
+ ],
+ "description": "Symfony Filesystem Component",
+ "homepage": "http://symfony.com",
+ "time": "2013-07-21 12:12:18"
},
{
"name": "symfony/http-foundation",
- "version": "v2.1.11",
+ "version": "v2.3.4",
"target-dir": "Symfony/Component/HttpFoundation",
"source": {
"type": "git",
"url": "https://github.com/symfony/HttpFoundation.git",
- "reference": "v2.1.11"
+ "reference": "fdf130fe65457aedbc4639a22f4ef9d3be5c002c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/v2.1.11",
- "reference": "v2.1.11",
+ "url": "https://api.github.com/repos/symfony/HttpFoundation/zipball/fdf130fe65457aedbc4639a22f4ef9d3be5c002c",
+ "reference": "fdf130fe65457aedbc4639a22f4ef9d3be5c002c",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.3-dev"
+ }
+ },
"autoload": {
"psr-0": {
- "Symfony\\Component\\HttpFoundation": "",
- "SessionHandlerInterface": "Symfony/Component/HttpFoundation/Resources/stubs"
- }
+ "Symfony\\Component\\HttpFoundation\\": ""
+ },
+ "classmap": [
+ "Symfony/Component/HttpFoundation/Resources/stubs"
+ ]
},
- "notification-url": "https://packagist.org/downloads/",
+ "notification-url": "http://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -187,53 +415,62 @@
],
"description": "Symfony HttpFoundation Component",
"homepage": "http://symfony.com",
- "time": "2013-05-26 18:42:07"
+ "time": "2013-08-26 05:49:51"
},
{
"name": "symfony/http-kernel",
- "version": "v2.1.11",
+ "version": "v2.3.4",
"target-dir": "Symfony/Component/HttpKernel",
"source": {
"type": "git",
"url": "https://github.com/symfony/HttpKernel.git",
- "reference": "v2.1.11"
+ "reference": "9d35da40f07bbe7a4f8dfbc41555d2b69de674bf"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/v2.1.11",
- "reference": "v2.1.11",
+ "url": "https://api.github.com/repos/symfony/HttpKernel/zipball/9d35da40f07bbe7a4f8dfbc41555d2b69de674bf",
+ "reference": "9d35da40f07bbe7a4f8dfbc41555d2b69de674bf",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
- "symfony/event-dispatcher": "2.1.*",
- "symfony/http-foundation": "2.1.*"
+ "psr/log": "~1.0",
+ "symfony/debug": "~2.3",
+ "symfony/event-dispatcher": "~2.1",
+ "symfony/http-foundation": "~2.2"
},
"require-dev": {
- "symfony/browser-kit": "2.1.*",
- "symfony/class-loader": "2.1.*",
- "symfony/config": "2.1.*",
- "symfony/console": "2.1.*",
- "symfony/dependency-injection": "2.1.*",
- "symfony/finder": "2.1.*",
- "symfony/process": "2.1.*",
- "symfony/routing": "2.1.*"
+ "symfony/browser-kit": "~2.2",
+ "symfony/class-loader": "~2.1",
+ "symfony/config": "~2.0",
+ "symfony/console": "~2.2",
+ "symfony/dependency-injection": "~2.0",
+ "symfony/finder": "~2.0",
+ "symfony/process": "~2.0",
+ "symfony/routing": "~2.2",
+ "symfony/stopwatch": "~2.2",
+ "symfony/templating": "~2.2"
},
"suggest": {
- "symfony/browser-kit": "2.1.*",
- "symfony/class-loader": "2.1.*",
- "symfony/config": "2.1.*",
- "symfony/console": "2.1.*",
- "symfony/dependency-injection": "2.1.*",
- "symfony/finder": "2.1.*"
+ "symfony/browser-kit": "",
+ "symfony/class-loader": "",
+ "symfony/config": "",
+ "symfony/console": "",
+ "symfony/dependency-injection": "",
+ "symfony/finder": ""
},
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.3-dev"
+ }
+ },
"autoload": {
"psr-0": {
- "Symfony\\Component\\HttpKernel": ""
+ "Symfony\\Component\\HttpKernel\\": ""
}
},
- "notification-url": "https://packagist.org/downloads/",
+ "notification-url": "http://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -249,44 +486,49 @@
],
"description": "Symfony HttpKernel Component",
"homepage": "http://symfony.com",
- "time": "2013-06-02 12:29:05"
+ "time": "2013-08-27 08:58:24"
},
{
"name": "symfony/routing",
- "version": "v2.1.11",
+ "version": "v2.3.4",
"target-dir": "Symfony/Component/Routing",
"source": {
"type": "git",
"url": "https://github.com/symfony/Routing.git",
- "reference": "v2.1.11"
+ "reference": "69af3f07dbf3ae93dd513dbc373f561cb2e7f143"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Routing/zipball/v2.1.11",
- "reference": "v2.1.11",
+ "url": "https://api.github.com/repos/symfony/Routing/zipball/69af3f07dbf3ae93dd513dbc373f561cb2e7f143",
+ "reference": "69af3f07dbf3ae93dd513dbc373f561cb2e7f143",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
- "doctrine/common": ">=2.2,<3.0",
- "symfony/config": "2.1.*",
- "symfony/http-kernel": "2.1.*",
- "symfony/yaml": "2.1.*"
+ "doctrine/common": "~2.2",
+ "psr/log": "~1.0",
+ "symfony/config": "~2.2",
+ "symfony/yaml": "~2.0"
},
"suggest": {
- "doctrine/common": "~2.2",
- "symfony/config": "2.1.*",
- "symfony/yaml": "2.1.*"
+ "doctrine/common": "",
+ "symfony/config": "",
+ "symfony/yaml": ""
},
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.3-dev"
+ }
+ },
"autoload": {
"psr-0": {
- "Symfony\\Component\\Routing": ""
+ "Symfony\\Component\\Routing\\": ""
}
},
- "notification-url": "https://packagist.org/downloads/",
+ "notification-url": "http://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -302,30 +544,35 @@
],
"description": "Symfony Routing Component",
"homepage": "http://symfony.com",
- "time": "2013-05-06 10:48:41"
+ "time": "2013-08-23 15:14:07"
},
{
"name": "symfony/yaml",
- "version": "v2.1.11",
+ "version": "v2.3.4",
"target-dir": "Symfony/Component/Yaml",
"source": {
"type": "git",
"url": "https://github.com/symfony/Yaml.git",
- "reference": "v2.1.11"
+ "reference": "5a279f1b5f5e1045a6c432354d9ea727ff3a9847"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Yaml/zipball/v2.1.11",
- "reference": "v2.1.11",
+ "url": "https://api.github.com/repos/symfony/Yaml/zipball/5a279f1b5f5e1045a6c432354d9ea727ff3a9847",
+ "reference": "5a279f1b5f5e1045a6c432354d9ea727ff3a9847",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.3-dev"
+ }
+ },
"autoload": {
"psr-0": {
- "Symfony\\Component\\Yaml": ""
+ "Symfony\\Component\\Yaml\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -344,20 +591,20 @@
],
"description": "Symfony Yaml Component",
"homepage": "http://symfony.com",
- "time": "2013-05-10 00:09:46"
+ "time": "2013-08-24 15:26:22"
},
{
"name": "twig/twig",
- "version": "v1.13.1",
+ "version": "v1.13.2",
"source": {
"type": "git",
"url": "https://github.com/fabpot/Twig.git",
- "reference": "v1.13.1"
+ "reference": "6d6a1009427d1f398c9d40904147bf9f723d5755"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/fabpot/Twig/zipball/v1.13.1",
- "reference": "v1.13.1",
+ "url": "https://api.github.com/repos/fabpot/Twig/zipball/6d6a1009427d1f398c9d40904147bf9f723d5755",
+ "reference": "6d6a1009427d1f398c9d40904147bf9f723d5755",
"shasum": ""
},
"require": {
@@ -374,9 +621,9 @@
"Twig_": "lib/"
}
},
- "notification-url": "https://packagist.org/downloads/",
+ "notification-url": "http://packagist.org/downloads/",
"license": [
- "BSD-3"
+ "BSD-3-Clause"
],
"authors": [
{
@@ -393,33 +640,37 @@
"keywords": [
"templating"
],
- "time": "2013-06-06 06:06:01"
+ "time": "2013-08-03 15:35:31"
}
],
"packages-dev": [
{
"name": "fabpot/goutte",
- "version": "v0.1.0",
+ "version": "v1.0.3",
"source": {
"type": "git",
- "url": "https://github.com/fabpot/Goutte",
- "reference": "v0.1.0"
+ "url": "https://github.com/fabpot/Goutte.git",
+ "reference": "75c9f23c4122caf4ea3e87a42a00b471366e707f"
},
"dist": {
"type": "zip",
- "url": "https://github.com/fabpot/Goutte/archive/v0.1.0.zip",
- "reference": "v0.1.0",
+ "url": "https://api.github.com/repos/fabpot/Goutte/zipball/75c9f23c4122caf4ea3e87a42a00b471366e707f",
+ "reference": "75c9f23c4122caf4ea3e87a42a00b471366e707f",
"shasum": ""
},
"require": {
"ext-curl": "*",
- "guzzle/guzzle": "3.0.*",
+ "guzzle/http": ">=3.0.5,<3.8-dev",
"php": ">=5.3.0",
- "symfony/browser-kit": "2.1.*",
- "symfony/css-selector": "2.1.*",
- "symfony/dom-crawler": "2.1.*",
- "symfony/finder": "2.1.*",
- "symfony/process": "2.1.*"
+ "symfony/browser-kit": "~2.1",
+ "symfony/css-selector": "~2.1",
+ "symfony/dom-crawler": "~2.1",
+ "symfony/finder": "~2.1",
+ "symfony/process": "~2.1"
+ },
+ "require-dev": {
+ "guzzle/plugin-history": ">=3.0.5,<3.8-dev",
+ "guzzle/plugin-mock": ">=3.0.5,<3.8-dev"
},
"type": "application",
"extra": {
@@ -447,70 +698,85 @@
"keywords": [
"scraper"
],
- "time": "2012-12-02 13:44:35"
+ "time": "2013-08-16 06:03:22"
},
{
- "name": "guzzle/guzzle",
- "version": "v3.0.7",
+ "name": "guzzle/common",
+ "version": "v3.7.3",
+ "target-dir": "Guzzle/Common",
"source": {
"type": "git",
- "url": "https://github.com/guzzle/guzzle",
- "reference": "v3.0.7"
+ "url": "https://github.com/guzzle/common.git",
+ "reference": "bf73c87375f60861f8c7ccc7b95878023ade5306"
},
"dist": {
"type": "zip",
- "url": "https://github.com/guzzle/guzzle/archive/v3.0.7.zip",
- "reference": "v3.0.7",
+ "url": "https://api.github.com/repos/guzzle/common/zipball/bf73c87375f60861f8c7ccc7b95878023ade5306",
+ "reference": "bf73c87375f60861f8c7ccc7b95878023ade5306",
"shasum": ""
},
"require": {
- "ext-curl": "*",
"php": ">=5.3.2",
"symfony/event-dispatcher": ">=2.1"
},
- "replace": {
- "guzzle/batch": "self.version",
- "guzzle/cache": "self.version",
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.7-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Guzzle\\Common": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "Common libraries used by Guzzle",
+ "homepage": "http://guzzlephp.org/",
+ "keywords": [
+ "collection",
+ "common",
+ "event",
+ "exception"
+ ],
+ "time": "2013-09-08 21:09:18"
+ },
+ {
+ "name": "guzzle/http",
+ "version": "v3.7.3",
+ "target-dir": "Guzzle/Http",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/http.git",
+ "reference": "1034125dfd906b73119e535f03153a62fccb1989"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/http/zipball/1034125dfd906b73119e535f03153a62fccb1989",
+ "reference": "1034125dfd906b73119e535f03153a62fccb1989",
+ "shasum": ""
+ },
+ "require": {
"guzzle/common": "self.version",
- "guzzle/http": "self.version",
- "guzzle/inflection": "self.version",
- "guzzle/iterator": "self.version",
- "guzzle/log": "self.version",
"guzzle/parser": "self.version",
- "guzzle/plugin": "self.version",
- "guzzle/plugin-async": "self.version",
- "guzzle/plugin-backoff": "self.version",
- "guzzle/plugin-cache": "self.version",
- "guzzle/plugin-cookie": "self.version",
- "guzzle/plugin-curlauth": "self.version",
- "guzzle/plugin-history": "self.version",
- "guzzle/plugin-log": "self.version",
- "guzzle/plugin-md5": "self.version",
- "guzzle/plugin-mock": "self.version",
- "guzzle/plugin-oauth": "self.version",
- "guzzle/service": "self.version",
- "guzzle/stream": "self.version"
+ "guzzle/stream": "self.version",
+ "php": ">=5.3.2"
},
- "require-dev": {
- "doctrine/common": "*",
- "monolog/monolog": "1.*",
- "phpunit/phpunit": "3.7.*",
- "symfony/class-loader": "*",
- "zend/zend-cache1": "1.12",
- "zend/zend-log1": "1.12",
- "zendframework/zend-cache": "2.0.*",
- "zendframework/zend-log": "2.0.*"
+ "suggest": {
+ "ext-curl": "*"
},
"type": "library",
"extra": {
"branch-alias": {
- "dev-master": "3.0-dev"
+ "dev-master": "3.7-dev"
}
},
"autoload": {
"psr-0": {
- "Guzzle\\Tests": "tests/",
- "Guzzle": "src/"
+ "Guzzle\\Http": ""
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -522,37 +788,128 @@
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
- },
- {
- "name": "Guzzle Community",
- "homepage": "https://github.com/guzzle/guzzle/contributors"
}
],
- "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients",
+ "description": "HTTP libraries used by Guzzle",
"homepage": "http://guzzlephp.org/",
"keywords": [
+ "Guzzle",
"client",
"curl",
- "framework",
"http",
- "http client",
- "rest",
- "web service"
+ "http client"
],
- "time": "2012-12-19 23:06:35"
+ "time": "2013-09-06 11:34:26"
+ },
+ {
+ "name": "guzzle/parser",
+ "version": "v3.7.3",
+ "target-dir": "Guzzle/Parser",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/parser.git",
+ "reference": "a25c2ddda1c52fb69a4ee56eb530b13ddd9573c2"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/parser/zipball/a25c2ddda1c52fb69a4ee56eb530b13ddd9573c2",
+ "reference": "a25c2ddda1c52fb69a4ee56eb530b13ddd9573c2",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.2"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.7-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Guzzle\\Parser": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "Interchangeable parsers used by Guzzle",
+ "homepage": "http://guzzlephp.org/",
+ "keywords": [
+ "URI Template",
+ "cookie",
+ "http",
+ "message",
+ "url"
+ ],
+ "time": "2013-07-11 22:46:03"
+ },
+ {
+ "name": "guzzle/stream",
+ "version": "v3.7.3",
+ "target-dir": "Guzzle/Stream",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/stream.git",
+ "reference": "a86111d9ac7db31d65a053c825869409fe8fc83f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/stream/zipball/a86111d9ac7db31d65a053c825869409fe8fc83f",
+ "reference": "a86111d9ac7db31d65a053c825869409fe8fc83f",
+ "shasum": ""
+ },
+ "require": {
+ "guzzle/common": "self.version",
+ "php": ">=5.3.2"
+ },
+ "suggest": {
+ "guzzle/http": "To convert Guzzle request objects to PHP streams"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.7-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "Guzzle\\Stream": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ }
+ ],
+ "description": "Guzzle stream wrapper component",
+ "homepage": "http://guzzlephp.org/",
+ "keywords": [
+ "Guzzle",
+ "component",
+ "stream"
+ ],
+ "time": "2013-07-30 22:07:23"
},
{
"name": "phing/phing",
"version": "2.4.14",
"source": {
"type": "git",
- "url": "https://github.com/phingofficial/phing",
- "reference": "2.4.14"
+ "url": "https://github.com/phingofficial/phing.git",
+ "reference": "41075d93ca254f1c90c79ec7ce81be2b2629e138"
},
"dist": {
"type": "zip",
- "url": "https://github.com/phingofficial/phing/archive/2.4.14.zip",
- "reference": "2.4.14",
+ "url": "https://api.github.com/repos/phingofficial/phing/zipball/41075d93ca254f1c90c79ec7ce81be2b2629e138",
+ "reference": "41075d93ca254f1c90c79ec7ce81be2b2629e138",
"shasum": ""
},
"require": {
@@ -599,12 +956,12 @@
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/dbunit.git",
- "reference": "1.2.3"
+ "reference": "8386782a2d55153e44a06eb1a9d13d6ed35d9c2d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/dbunit/zipball/1.2.3",
- "reference": "1.2.3",
+ "url": "https://api.github.com/repos/sebastianbergmann/dbunit/zipball/8386782a2d55153e44a06eb1a9d13d6ed35d9c2d",
+ "reference": "8386782a2d55153e44a06eb1a9d13d6ed35d9c2d",
"shasum": ""
},
"require": {
@@ -653,16 +1010,16 @@
},
{
"name": "phpunit/php-code-coverage",
- "version": "1.2.12",
+ "version": "1.2.13",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
- "reference": "1.2.12"
+ "reference": "466e7cd2554b4e264c9e3f31216d25ac0e5f3d94"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/1.2.12",
- "reference": "1.2.12",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/466e7cd2554b4e264c9e3f31216d25ac0e5f3d94",
+ "reference": "466e7cd2554b4e264c9e3f31216d25ac0e5f3d94",
"shasum": ""
},
"require": {
@@ -710,20 +1067,20 @@
"testing",
"xunit"
],
- "time": "2013-07-06 06:26:16"
+ "time": "2013-09-10 08:14:32"
},
{
"name": "phpunit/php-file-iterator",
"version": "1.3.3",
"source": {
"type": "git",
- "url": "git://github.com/sebastianbergmann/php-file-iterator.git",
- "reference": "1.3.3"
+ "url": "https://github.com/sebastianbergmann/php-file-iterator.git",
+ "reference": "16a78140ed2fc01b945cfa539665fadc6a038029"
},
"dist": {
"type": "zip",
- "url": "https://github.com/sebastianbergmann/php-file-iterator/zipball/1.3.3",
- "reference": "1.3.3",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/16a78140ed2fc01b945cfa539665fadc6a038029",
+ "reference": "16a78140ed2fc01b945cfa539665fadc6a038029",
"shasum": ""
},
"require": {
@@ -755,20 +1112,20 @@
"filesystem",
"iterator"
],
- "time": "2012-10-11 04:44:38"
+ "time": "2012-10-11 11:44:38"
},
{
"name": "phpunit/php-text-template",
"version": "1.1.4",
"source": {
"type": "git",
- "url": "git://github.com/sebastianbergmann/php-text-template.git",
- "reference": "1.1.4"
+ "url": "https://github.com/sebastianbergmann/php-text-template.git",
+ "reference": "5180896f51c5b3648ac946b05f9ec02be78a0b23"
},
"dist": {
"type": "zip",
- "url": "https://github.com/sebastianbergmann/php-text-template/zipball/1.1.4",
- "reference": "1.1.4",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5180896f51c5b3648ac946b05f9ec02be78a0b23",
+ "reference": "5180896f51c5b3648ac946b05f9ec02be78a0b23",
"shasum": ""
},
"require": {
@@ -799,20 +1156,20 @@
"keywords": [
"template"
],
- "time": "2012-10-31 11:15:28"
+ "time": "2012-10-31 18:15:28"
},
{
"name": "phpunit/php-timer",
- "version": "1.0.4",
+ "version": "1.0.5",
"source": {
"type": "git",
- "url": "git://github.com/sebastianbergmann/php-timer.git",
- "reference": "1.0.4"
+ "url": "https://github.com/sebastianbergmann/php-timer.git",
+ "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c"
},
"dist": {
"type": "zip",
- "url": "https://github.com/sebastianbergmann/php-timer/zipball/1.0.4",
- "reference": "1.0.4",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c",
+ "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c",
"shasum": ""
},
"require": {
@@ -839,24 +1196,24 @@
}
],
"description": "Utility class for timing",
- "homepage": "http://www.phpunit.de/",
+ "homepage": "https://github.com/sebastianbergmann/php-timer/",
"keywords": [
"timer"
],
- "time": "2012-10-11 04:45:58"
+ "time": "2013-08-02 07:42:54"
},
{
"name": "phpunit/php-token-stream",
- "version": "1.1.5",
+ "version": "1.2.1",
"source": {
"type": "git",
- "url": "git://github.com/sebastianbergmann/php-token-stream.git",
- "reference": "1.1.5"
+ "url": "https://github.com/sebastianbergmann/php-token-stream.git",
+ "reference": "5220af2a7929aa35cf663d97c89ad3d50cf5fa3e"
},
"dist": {
"type": "zip",
- "url": "https://github.com/sebastianbergmann/php-token-stream/zipball/1.1.5",
- "reference": "1.1.5",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/5220af2a7929aa35cf663d97c89ad3d50cf5fa3e",
+ "reference": "5220af2a7929aa35cf663d97c89ad3d50cf5fa3e",
"shasum": ""
},
"require": {
@@ -864,6 +1221,11 @@
"php": ">=5.3.3"
},
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.2-dev"
+ }
+ },
"autoload": {
"classmap": [
"PHP/"
@@ -884,24 +1246,24 @@
}
],
"description": "Wrapper around PHP's tokenizer extension.",
- "homepage": "http://www.phpunit.de/",
+ "homepage": "https://github.com/sebastianbergmann/php-token-stream/",
"keywords": [
"tokenizer"
],
- "time": "2012-10-11 04:47:14"
+ "time": "2013-09-13 04:58:23"
},
{
"name": "phpunit/phpunit",
- "version": "3.7.22",
+ "version": "3.7.24",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
- "reference": "3.7.22"
+ "reference": "af7b77ccb5c64458bdfca95665d29558d1df7d08"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3.7.22",
- "reference": "3.7.22",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/af7b77ccb5c64458bdfca95665d29558d1df7d08",
+ "reference": "af7b77ccb5c64458bdfca95665d29558d1df7d08",
"shasum": ""
},
"require": {
@@ -913,7 +1275,7 @@
"phpunit/php-code-coverage": "~1.2.1",
"phpunit/php-file-iterator": ">=1.3.1",
"phpunit/php-text-template": ">=1.1.1",
- "phpunit/php-timer": "~1.0.2",
+ "phpunit/php-timer": ">=1.0.4",
"phpunit/phpunit-mock-objects": "~1.2.0",
"symfony/yaml": "~2.0"
},
@@ -962,20 +1324,20 @@
"testing",
"xunit"
],
- "time": "2013-07-06 06:29:15"
+ "time": "2013-08-09 06:58:24"
},
{
"name": "phpunit/phpunit-mock-objects",
"version": "1.2.3",
"source": {
"type": "git",
- "url": "git://github.com/sebastianbergmann/phpunit-mock-objects.git",
- "reference": "1.2.3"
+ "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
+ "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875"
},
"dist": {
"type": "zip",
- "url": "https://github.com/sebastianbergmann/phpunit-mock-objects/archive/1.2.3.zip",
- "reference": "1.2.3",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5794e3c5c5ba0fb037b11d8151add2a07fa82875",
+ "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875",
"shasum": ""
},
"require": {
@@ -1015,34 +1377,39 @@
},
{
"name": "symfony/browser-kit",
- "version": "v2.1.11",
+ "version": "v2.3.4",
"target-dir": "Symfony/Component/BrowserKit",
"source": {
"type": "git",
"url": "https://github.com/symfony/BrowserKit.git",
- "reference": "v2.1.11"
+ "reference": "2639dc4eec81f92760e05396a93bb78000b4f5ca"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/BrowserKit/zipball/v2.1.11",
- "reference": "v2.1.11",
+ "url": "https://api.github.com/repos/symfony/BrowserKit/zipball/2639dc4eec81f92760e05396a93bb78000b4f5ca",
+ "reference": "2639dc4eec81f92760e05396a93bb78000b4f5ca",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
- "symfony/dom-crawler": "2.1.*"
+ "symfony/dom-crawler": "~2.0"
},
"require-dev": {
- "symfony/css-selector": "2.1.*",
- "symfony/process": "2.1.*"
+ "symfony/css-selector": "~2.0",
+ "symfony/process": "~2.0"
},
"suggest": {
- "symfony/process": "2.1.*"
+ "symfony/process": ""
},
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.3-dev"
+ }
+ },
"autoload": {
"psr-0": {
- "Symfony\\Component\\BrowserKit": ""
+ "Symfony\\Component\\BrowserKit\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -1061,30 +1428,35 @@
],
"description": "Symfony BrowserKit Component",
"homepage": "http://symfony.com",
- "time": "2013-04-29 20:22:06"
+ "time": "2013-07-21 12:12:18"
},
{
"name": "symfony/css-selector",
- "version": "v2.1.11",
+ "version": "v2.3.4",
"target-dir": "Symfony/Component/CssSelector",
"source": {
"type": "git",
"url": "https://github.com/symfony/CssSelector.git",
- "reference": "v2.1.11"
+ "reference": "885544201cb24e79754da1dbd61bd779c2e4353e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/CssSelector/zipball/v2.1.11",
- "reference": "v2.1.11",
+ "url": "https://api.github.com/repos/symfony/CssSelector/zipball/885544201cb24e79754da1dbd61bd779c2e4353e",
+ "reference": "885544201cb24e79754da1dbd61bd779c2e4353e",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.3-dev"
+ }
+ },
"autoload": {
"psr-0": {
- "Symfony\\Component\\CssSelector": ""
+ "Symfony\\Component\\CssSelector\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -1099,40 +1471,49 @@
{
"name": "Symfony Community",
"homepage": "http://symfony.com/contributors"
+ },
+ {
+ "name": "Jean-François Simon",
+ "email": "jeanfrancois.simon@sensiolabs.com"
}
],
"description": "Symfony CssSelector Component",
"homepage": "http://symfony.com",
- "time": "2013-05-17 00:31:34"
+ "time": "2013-07-21 12:12:18"
},
{
"name": "symfony/dom-crawler",
- "version": "v2.1.11",
+ "version": "v2.3.4",
"target-dir": "Symfony/Component/DomCrawler",
"source": {
"type": "git",
"url": "https://github.com/symfony/DomCrawler.git",
- "reference": "v2.1.11"
+ "reference": "e05e07fe8958a304b5e135f8e65d4ae6148cf59b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/DomCrawler/zipball/v2.1.11",
- "reference": "v2.1.11",
+ "url": "https://api.github.com/repos/symfony/DomCrawler/zipball/e05e07fe8958a304b5e135f8e65d4ae6148cf59b",
+ "reference": "e05e07fe8958a304b5e135f8e65d4ae6148cf59b",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"require-dev": {
- "symfony/css-selector": "2.1.*"
+ "symfony/css-selector": "~2.0"
},
"suggest": {
- "symfony/css-selector": "2.1.*"
+ "symfony/css-selector": ""
},
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.3-dev"
+ }
+ },
"autoload": {
"psr-0": {
- "Symfony\\Component\\DomCrawler": ""
+ "Symfony\\Component\\DomCrawler\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -1151,30 +1532,35 @@
],
"description": "Symfony DomCrawler Component",
"homepage": "http://symfony.com",
- "time": "2013-05-16 00:06:15"
+ "time": "2013-07-21 12:12:18"
},
{
"name": "symfony/finder",
- "version": "v2.1.11",
+ "version": "v2.3.4",
"target-dir": "Symfony/Component/Finder",
"source": {
"type": "git",
"url": "https://github.com/symfony/Finder.git",
- "reference": "v2.1.11"
+ "reference": "4a0fee5b86f5bbd9dfdc11ec124eba2915737ce1"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Finder/zipball/v2.1.11",
- "reference": "v2.1.11",
+ "url": "https://api.github.com/repos/symfony/Finder/zipball/4a0fee5b86f5bbd9dfdc11ec124eba2915737ce1",
+ "reference": "4a0fee5b86f5bbd9dfdc11ec124eba2915737ce1",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.3-dev"
+ }
+ },
"autoload": {
"psr-0": {
- "Symfony\\Component\\Finder": ""
+ "Symfony\\Component\\Finder\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -1193,30 +1579,35 @@
],
"description": "Symfony Finder Component",
"homepage": "http://symfony.com",
- "time": "2013-05-25 15:47:15"
+ "time": "2013-08-13 20:18:00"
},
{
"name": "symfony/process",
- "version": "v2.1.11",
+ "version": "v2.3.4",
"target-dir": "Symfony/Component/Process",
"source": {
"type": "git",
"url": "https://github.com/symfony/Process.git",
- "reference": "v2.1.11"
+ "reference": "1e91553e1cedd0b8fb1da6ea4f89b02e21713d5b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/Process/zipball/v2.1.11",
- "reference": "v2.1.11",
+ "url": "https://api.github.com/repos/symfony/Process/zipball/1e91553e1cedd0b8fb1da6ea4f89b02e21713d5b",
+ "reference": "1e91553e1cedd0b8fb1da6ea4f89b02e21713d5b",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.3-dev"
+ }
+ },
"autoload": {
"psr-0": {
- "Symfony\\Component\\Process": ""
+ "Symfony\\Component\\Process\\": ""
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -1235,7 +1626,7 @@
],
"description": "Symfony Process Component",
"homepage": "http://symfony.com",
- "time": "2013-05-06 10:21:56"
+ "time": "2013-08-22 06:42:25"
}
],
"aliases": [
diff --git a/phpBB/config/auth_providers.yml b/phpBB/config/auth_providers.yml
index bcc448e4d7..e1c289334e 100644
--- a/phpBB/config/auth_providers.yml
+++ b/phpBB/config/auth_providers.yml
@@ -1,12 +1,12 @@
services:
auth.provider_collection:
- class: phpbb_di_service_collection
+ class: phpbb\di\service_collection
arguments:
- @service_container
tags:
- { name: service_collection, tag: auth.provider }
auth.provider.db:
- class: phpbb_auth_provider_db
+ class: phpbb\auth\provider\db
arguments:
- @dbal.conn
- @config
@@ -17,7 +17,7 @@ services:
tags:
- { name: auth.provider }
auth.provider.apache:
- class: phpbb_auth_provider_apache
+ class: phpbb\auth\provider\apache
arguments:
- @dbal.conn
- @config
@@ -28,10 +28,52 @@ services:
tags:
- { name: auth.provider }
auth.provider.ldap:
- class: phpbb_auth_provider_ldap
+ class: phpbb\auth\provider\ldap
arguments:
- @dbal.conn
- @config
- @user
tags:
- { name: auth.provider }
+ auth.provider.oauth:
+ class: phpbb\auth\provider\oauth\oauth
+ arguments:
+ - @dbal.conn
+ - @config
+ - @request
+ - @user
+ - %tables.auth_provider_oauth_token_storage%
+ - %tables.auth_provider_oauth_account_assoc%
+ - @auth.provider.oauth.service_collection
+ - %tables.users%
+ - %core.root_path%
+ - %core.php_ext%
+ tags:
+ - { name: auth.provider }
+ auth.provider.oauth.service_collection:
+ class: phpbb\di\service_collection
+ arguments:
+ - @service_container
+ tags:
+ - { name: service_collection, tag: auth.provider.oauth.service }
+ auth.provider.oauth.service.bitly:
+ class: phpbb\auth\provider\oauth\service\bitly
+ arguments:
+ - @config
+ - @request
+ tags:
+ - { name: auth.provider.oauth.service }
+ auth.provider.oauth.service.facebook:
+ class: phpbb\auth\provider\oauth\service\facebook
+ arguments:
+ - @config
+ - @request
+ tags:
+ - { name: auth.provider.oauth.service }
+ auth.provider.oauth.service.google:
+ class: phpbb\auth\provider\oauth\service\google
+ arguments:
+ - @config
+ - @request
+ tags:
+ - { name: auth.provider.oauth.service }
diff --git a/phpBB/config/avatars.yml b/phpBB/config/avatars.yml
index 0aad08bac9..31ae1ecef9 100644
--- a/phpBB/config/avatars.yml
+++ b/phpBB/config/avatars.yml
@@ -1,6 +1,6 @@
services:
avatar.driver.gravatar:
- class: phpbb_avatar_driver_gravatar
+ class: phpbb\avatar\driver\gravatar
arguments:
- @config
- %core.root_path%
@@ -12,7 +12,7 @@ services:
- { name: avatar.driver }
avatar.driver.local:
- class: phpbb_avatar_driver_local
+ class: phpbb\avatar\driver\local
arguments:
- @config
- %core.root_path%
@@ -24,7 +24,7 @@ services:
- { name: avatar.driver }
avatar.driver.remote:
- class: phpbb_avatar_driver_remote
+ class: phpbb\avatar\driver\remote
arguments:
- @config
- %core.root_path%
@@ -36,7 +36,7 @@ services:
- { name: avatar.driver }
avatar.driver.upload:
- class: phpbb_avatar_driver_upload
+ class: phpbb\avatar\driver\upload
arguments:
- @config
- %core.root_path%
@@ -48,7 +48,7 @@ services:
- { name: avatar.driver }
avatar.driver_collection:
- class: phpbb_di_service_collection
+ class: phpbb\di\service_collection
arguments:
- @service_container
tags:
diff --git a/phpBB/config/cron_tasks.yml b/phpBB/config/cron_tasks.yml
index d1954b1877..0c9795c0bd 100644
--- a/phpBB/config/cron_tasks.yml
+++ b/phpBB/config/cron_tasks.yml
@@ -1,6 +1,6 @@
services:
cron.task.core.prune_all_forums:
- class: phpbb_cron_task_core_prune_all_forums
+ class: phpbb\cron\task\core\prune_all_forums
arguments:
- %core.root_path%
- %core.php_ext%
@@ -12,7 +12,7 @@ services:
- { name: cron.task }
cron.task.core.prune_forum:
- class: phpbb_cron_task_core_prune_forum
+ class: phpbb\cron\task\core\prune_forum
arguments:
- %core.root_path%
- %core.php_ext%
@@ -24,7 +24,7 @@ services:
- { name: cron.task }
cron.task.core.queue:
- class: phpbb_cron_task_core_queue
+ class: phpbb\cron\task\core\queue
arguments:
- %core.root_path%
- %core.php_ext%
@@ -35,7 +35,7 @@ services:
- { name: cron.task }
cron.task.core.tidy_cache:
- class: phpbb_cron_task_core_tidy_cache
+ class: phpbb\cron\task\core\tidy_cache
arguments:
- @config
- @cache.driver
@@ -45,7 +45,7 @@ services:
- { name: cron.task }
cron.task.core.tidy_database:
- class: phpbb_cron_task_core_tidy_database
+ class: phpbb\cron\task\core\tidy_database
arguments:
- %core.root_path%
- %core.php_ext%
@@ -56,7 +56,7 @@ services:
- { name: cron.task }
cron.task.core.tidy_search:
- class: phpbb_cron_task_core_tidy_search
+ class: phpbb\cron\task\core\tidy_search
arguments:
- %core.root_path%
- %core.php_ext%
@@ -70,7 +70,7 @@ services:
- { name: cron.task }
cron.task.core.tidy_sessions:
- class: phpbb_cron_task_core_tidy_sessions
+ class: phpbb\cron\task\core\tidy_sessions
arguments:
- @config
- @user
@@ -80,7 +80,7 @@ services:
- { name: cron.task }
cron.task.core.tidy_warnings:
- class: phpbb_cron_task_core_tidy_warnings
+ class: phpbb\cron\task\core\tidy_warnings
arguments:
- %core.root_path%
- %core.php_ext%
diff --git a/phpBB/config/feed.yml b/phpBB/config/feed.yml
index 5a4cdae815..7712a832f3 100644
--- a/phpBB/config/feed.yml
+++ b/phpBB/config/feed.yml
@@ -1,20 +1,20 @@
services:
feed.helper:
- class: phpbb_feed_helper
+ class: phpbb\feed\helper
arguments:
- @config
- @user
- %core.root_path%
feed.factory:
- class: phpbb_feed_factory
+ class: phpbb\feed\factory
arguments:
- @service_container
- @config
- @dbal.conn
feed.forum:
- class: phpbb_feed_forum
+ class: phpbb\feed\forum
scope: prototype
arguments:
- @feed.helper
@@ -27,7 +27,7 @@ services:
- %core.php_ext%
feed.forums:
- class: phpbb_feed_forums
+ class: phpbb\feed\forums
scope: prototype
arguments:
- @feed.helper
@@ -40,7 +40,7 @@ services:
- %core.php_ext%
feed.news:
- class: phpbb_feed_news
+ class: phpbb\feed\news
scope: prototype
arguments:
- @feed.helper
@@ -53,7 +53,7 @@ services:
- %core.php_ext%
feed.overall:
- class: phpbb_feed_overall
+ class: phpbb\feed\overall
scope: prototype
arguments:
- @feed.helper
@@ -66,7 +66,7 @@ services:
- %core.php_ext%
feed.topic:
- class: phpbb_feed_topic
+ class: phpbb\feed\topic
scope: prototype
arguments:
- @feed.helper
@@ -79,7 +79,7 @@ services:
- %core.php_ext%
feed.topics:
- class: phpbb_feed_topics
+ class: phpbb\feed\topics
scope: prototype
arguments:
- @feed.helper
@@ -92,7 +92,7 @@ services:
- %core.php_ext%
feed.topics_active:
- class: phpbb_feed_topics_active
+ class: phpbb\feed\topics_active
scope: prototype
arguments:
- @feed.helper
diff --git a/phpBB/config/migrator.yml b/phpBB/config/migrator.yml
index 999a2d41a3..a94609418f 100644
--- a/phpBB/config/migrator.yml
+++ b/phpBB/config/migrator.yml
@@ -1,6 +1,6 @@
services:
migrator:
- class: phpbb_db_migrator
+ class: phpbb\db\migrator
arguments:
- @config
- @dbal.conn
@@ -12,21 +12,21 @@ services:
- @migrator.tool_collection
migrator.tool_collection:
- class: phpbb_di_service_collection
+ class: phpbb\di\service_collection
arguments:
- @service_container
tags:
- { name: service_collection, tag: migrator.tool }
migrator.tool.config:
- class: phpbb_db_migration_tool_config
+ class: phpbb\db\migration\tool\config
arguments:
- @config
tags:
- { name: migrator.tool }
migrator.tool.module:
- class: phpbb_db_migration_tool_module
+ class: phpbb\db\migration\tool\module
arguments:
- @dbal.conn
- @cache
@@ -38,7 +38,7 @@ services:
- { name: migrator.tool }
migrator.tool.permission:
- class: phpbb_db_migration_tool_permission
+ class: phpbb\db\migration\tool\permission
arguments:
- @dbal.conn
- @cache
diff --git a/phpBB/config/notifications.yml b/phpBB/config/notifications.yml
index 60aa63a854..6fecae2aeb 100644
--- a/phpBB/config/notifications.yml
+++ b/phpBB/config/notifications.yml
@@ -1,20 +1,20 @@
services:
notification.type_collection:
- class: phpbb_di_service_collection
+ class: phpbb\di\service_collection
arguments:
- @service_container
tags:
- { name: service_collection, tag: notification.type }
notification.method_collection:
- class: phpbb_di_service_collection
+ class: phpbb\di\service_collection
arguments:
- @service_container
tags:
- { name: service_collection, tag: notification.method }
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!
arguments:
- @user_loader
@@ -32,7 +32,7 @@ services:
- { name: notification.type }
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!
arguments:
- @user_loader
@@ -50,7 +50,7 @@ services:
- { name: notification.type }
notification.type.bookmark:
- class: phpbb_notification_type_bookmark
+ class: phpbb\notification\type\bookmark
scope: prototype # scope MUST be prototype for this to work!
arguments:
- @user_loader
@@ -68,7 +68,7 @@ services:
- { name: notification.type }
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!
arguments:
- @user_loader
@@ -86,7 +86,43 @@ services:
- { name: notification.type }
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!
+ arguments:
+ - @user_loader
+ - @dbal.conn
+ - @cache.driver
+ - @user
+ - @auth
+ - @config
+ - %core.root_path%
+ - %core.php_ext%
+ - %tables.notification_types%
+ - %tables.notifications%
+ - %tables.user_notifications%
+ tags:
+ - { name: notification.type }
+
+ notification.type.group_request:
+ class: phpbb\notification\type\group_request
+ scope: prototype # scope MUST be prototype for this to work!
+ arguments:
+ - @user_loader
+ - @dbal.conn
+ - @cache.driver
+ - @user
+ - @auth
+ - @config
+ - %core.root_path%
+ - %core.php_ext%
+ - %tables.notification_types%
+ - %tables.notifications%
+ - %tables.user_notifications%
+ tags:
+ - { name: notification.type }
+
+ notification.type.group_request_approved:
+ class: phpbb\notification\type\group_request_approved
scope: prototype # scope MUST be prototype for this to work!
arguments:
- @user_loader
@@ -104,7 +140,7 @@ services:
- { name: notification.type }
notification.type.pm:
- class: phpbb_notification_type_pm
+ class: phpbb\notification\type\pm
scope: prototype # scope MUST be prototype for this to work!
arguments:
- @user_loader
@@ -122,7 +158,7 @@ services:
- { name: notification.type }
notification.type.post:
- class: phpbb_notification_type_post
+ class: phpbb\notification\type\post
scope: prototype # scope MUST be prototype for this to work!
arguments:
- @user_loader
@@ -140,7 +176,7 @@ services:
- { name: notification.type }
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!
arguments:
- @user_loader
@@ -158,7 +194,7 @@ services:
- { name: notification.type }
notification.type.quote:
- class: phpbb_notification_type_quote
+ class: phpbb\notification\type\quote
scope: prototype # scope MUST be prototype for this to work!
arguments:
- @user_loader
@@ -176,7 +212,7 @@ services:
- { name: notification.type }
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!
arguments:
- @user_loader
@@ -194,7 +230,7 @@ services:
- { name: notification.type }
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!
arguments:
- @user_loader
@@ -212,7 +248,7 @@ services:
- { name: notification.type }
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!
arguments:
- @user_loader
@@ -230,7 +266,7 @@ services:
- { name: notification.type }
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!
arguments:
- @user_loader
@@ -248,7 +284,7 @@ services:
- { name: notification.type }
notification.type.topic:
- class: phpbb_notification_type_topic
+ class: phpbb\notification\type\topic
scope: prototype # scope MUST be prototype for this to work!
arguments:
- @user_loader
@@ -266,7 +302,7 @@ services:
- { name: notification.type }
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!
arguments:
- @user_loader
@@ -284,7 +320,7 @@ services:
- { name: notification.type }
notification.method.email:
- class: phpbb_notification_method_email
+ class: phpbb\notification\method\email
scope: prototype # scope MUST be prototype for this to work!
arguments:
- @user_loader
@@ -299,7 +335,7 @@ services:
- { name: notification.method }
notification.method.jabber:
- class: phpbb_notification_method_jabber
+ class: phpbb\notification\method\jabber
scope: prototype # scope MUST be prototype for this to work!
arguments:
- @user_loader
diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml
index 576e16d5d4..7a0a215262 100644
--- a/phpBB/config/services.yml
+++ b/phpBB/config/services.yml
@@ -10,23 +10,23 @@ imports:
services:
acl.permissions:
- class: phpbb_permissions
+ class: phpbb\permissions
arguments:
- @dispatcher
- @user
auth:
- class: phpbb_auth
+ class: phpbb\auth\auth
avatar.manager:
- class: phpbb_avatar_manager
+ class: phpbb\avatar\manager
arguments:
- @config
- @avatar.driver_collection
- @service_container
cache:
- class: phpbb_cache_service
+ class: phpbb\cache\service
arguments:
- @cache.driver
- @config
@@ -38,12 +38,12 @@ services:
class: %cache.driver.class%
cache.driver.install:
- class: phpbb_cache_driver_file
+ class: phpbb\cache\driver\file
class_loader:
- class: phpbb_class_loader
+ class: phpbb\class_loader
arguments:
- - phpbb_
+ - phpbb\
- %core.root_path%includes/
- %core.php_ext%
calls:
@@ -51,9 +51,9 @@ services:
- [set_cache, [@cache.driver]]
class_loader.ext:
- class: phpbb_class_loader
+ class: phpbb\class_loader
arguments:
- - phpbb_ext_
+ - \
- %core.root_path%ext/
- %core.php_ext%
calls:
@@ -61,20 +61,20 @@ services:
- [set_cache, [@cache.driver]]
config:
- class: phpbb_config_db
+ class: phpbb\config\db
arguments:
- @dbal.conn
- @cache.driver
- %tables.config%
config_text:
- class: phpbb_config_db_text
+ class: phpbb\config\db_text
arguments:
- @dbal.conn
- %tables.config_text%
content.visibility:
- class: phpbb_content_visibility
+ class: phpbb\content_visibility
arguments:
- @auth
- @dbal.conn
@@ -87,43 +87,44 @@ services:
- %tables.users%
controller.helper:
- class: phpbb_controller_helper
+ class: phpbb\controller\helper
arguments:
- @template
- @user
+ - @config
- %core.root_path%
- %core.php_ext%
controller.resolver:
- class: phpbb_controller_resolver
+ class: phpbb\controller\resolver
arguments:
- @user
- @service_container
- - @style
+ - @template
cron.task_collection:
- class: phpbb_di_service_collection
+ class: phpbb\di\service_collection
arguments:
- @service_container
tags:
- { name: service_collection, tag: cron.task }
cron.manager:
- class: phpbb_cron_manager
+ class: phpbb\cron\manager
arguments:
- @cron.task_collection
- %core.root_path%
- %core.php_ext%
cron.lock_db:
- class: phpbb_lock_db
+ class: phpbb\lock\db
arguments:
- cron_lock
- @config
- @dbal.conn
dispatcher:
- class: phpbb_event_dispatcher
+ class: phpbb\event\dispatcher
arguments:
- @service_container
@@ -133,12 +134,12 @@ services:
- [sql_connect, [%dbal.dbhost%, %dbal.dbuser%, %dbal.dbpasswd%, %dbal.dbname%, %dbal.dbport%, false, %dbal.new_link%]]
dbal.tools:
- class: phpbb_db_tools
+ class: phpbb\db\tools
arguments:
- @dbal.conn
event.subscriber_loader:
- class: phpbb_event_extension_subscriber_loader
+ class: phpbb\event\extension_subscriber_loader
arguments:
- @dispatcher
- @ext.manager
@@ -146,7 +147,7 @@ services:
- [load, []]
ext.manager:
- class: phpbb_extension_manager
+ class: phpbb\extension\manager
arguments:
- @service_container
- @dbal.conn
@@ -158,7 +159,7 @@ services:
- @cache.driver
ext.finder:
- class: phpbb_extension_finder
+ class: phpbb\extension\finder
arguments:
- @ext.manager
- @filesystem
@@ -168,16 +169,21 @@ services:
- _ext_finder
filesystem:
- class: phpbb_filesystem
+ class: phpbb\filesystem
+ arguments:
+ - @symfony_request
+ - %core.root_path%
+ - %core.php_ext%
+ - %core.adm_relative_path%
groupposition.legend:
- class: phpbb_groupposition_legend
+ class: phpbb\groupposition\legend
arguments:
- @dbal.conn
- @user
groupposition.teampage:
- class: phpbb_groupposition_teampage
+ class: phpbb\groupposition\teampage
arguments:
- @dbal.conn
- @user
@@ -190,14 +196,14 @@ services:
- @controller.resolver
hook_finder:
- class: phpbb_hook_finder
+ class: phpbb\hook\finder
arguments:
- %core.root_path%
- %core.php_ext%
- @cache.driver
kernel_request_subscriber:
- class: phpbb_event_kernel_request_subscriber
+ class: phpbb\event\kernel_request_subscriber
arguments:
- @ext.finder
- %core.root_path%
@@ -206,7 +212,7 @@ services:
- { name: kernel.event_subscriber }
kernel_exception_subscriber:
- class: phpbb_event_kernel_exception_subscriber
+ class: phpbb\event\kernel_exception_subscriber
arguments:
- @template
- @user
@@ -214,12 +220,12 @@ services:
- { name: kernel.event_subscriber }
kernel_terminate_subscriber:
- class: phpbb_event_kernel_terminate_subscriber
+ class: phpbb\event\kernel_terminate_subscriber
tags:
- { name: kernel.event_subscriber }
log:
- class: phpbb_log
+ class: phpbb\log\log
arguments:
- @dbal.conn
- @user
@@ -231,7 +237,7 @@ services:
- %tables.log%
notification_manager:
- class: phpbb_notification_manager
+ class: phpbb\notification\manager
arguments:
- @notification.type_collection
- @notification.method_collection
@@ -247,54 +253,33 @@ services:
- %tables.user_notifications%
php_ini:
- class: phpbb_php_ini
+ class: phpbb\php\ini
request:
- class: phpbb_request
+ class: phpbb\request\request
- style:
- class: phpbb_style
+ symfony_request:
+ class: phpbb\symfony_request
arguments:
- - %core.root_path%
- - %core.php_ext%
- - @config
- - @user
- - @style.resource_locator
- - @style.path_provider_ext
- - @template
-
- style.resource_locator:
- class: phpbb_style_resource_locator
-
- style.path_provider_ext:
- class: phpbb_style_extension_path_provider
- arguments:
- - @ext.manager
- - @style.path_provider
- - %core.root_path%
-
- style.path_provider:
- class: phpbb_style_path_provider
+ - @request
template:
- class: phpbb_template_twig
+ class: phpbb\template\twig\twig
arguments:
- - %core.root_path%
- - %core.php_ext%
+ - @filesystem
- @config
- @user
- @template_context
- @ext.manager
- - %core.adm_relative_path%
template_context:
- class: phpbb_template_context
+ class: phpbb\template\context
user:
- class: phpbb_user
+ class: phpbb\user
user_loader:
- class: phpbb_user_loader
+ class: phpbb\user_loader
arguments:
- @dbal.conn
- %core.root_path%
diff --git a/phpBB/config/tables.yml b/phpBB/config/tables.yml
index fdb448f4e0..0d364eb6b0 100644
--- a/phpBB/config/tables.yml
+++ b/phpBB/config/tables.yml
@@ -1,4 +1,6 @@
parameters:
+ tables.auth_provider_oauth_token_storage: %core.table_prefix%oauth_tokens
+ tables.auth_provider_oauth_account_assoc: %core.table_prefix%oauth_accounts
tables.config: %core.table_prefix%config
tables.config_text: %core.table_prefix%config_text
tables.ext: %core.table_prefix%ext
diff --git a/phpBB/develop/compile_template.php b/phpBB/develop/compile_template.php
deleted file mode 100644
index 32d1d321f1..0000000000
--- a/phpBB/develop/compile_template.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-// -------------------------------------------------------------
-//
-// $Id$
-//
-// FILENAME : compile_template.php
-// STARTED : Sun Apr 24, 2011
-// COPYRIGHT : © 2011 phpBB Group
-// WWW : http://www.phpbb.com/
-// LICENCE : GPL vs2.0 [ see /docs/COPYING ]
-//
-// -------------------------------------------------------------
-
-define('IN_PHPBB', 1);
-define('ANONYMOUS', 1);
-$phpEx = substr(strrchr(__FILE__, '.'), 1);
-$phpbb_root_path = './../';
-
-include($phpbb_root_path . 'includes/template_compile.'.$phpEx);
-
-$file = $argv[1];
-
-$compile = new phpbb_template_compile(false);
-echo $compile->compile_file($file);
diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php
index 91201e7a9d..5ef278d493 100644
--- a/phpBB/develop/create_schema_files.php
+++ b/phpBB/develop/create_schema_files.php
@@ -18,218 +18,12 @@ if (!is_writable($schema_path))
die('Schema path not writable');
}
-$schema_data = get_schema_struct();
-$dbms_type_map = array(
- 'mysql_41' => array(
- 'INT:' => 'int(%d)',
- 'BINT' => 'bigint(20)',
- 'UINT' => 'mediumint(8) UNSIGNED',
- 'UINT:' => 'int(%d) UNSIGNED',
- 'TINT:' => 'tinyint(%d)',
- 'USINT' => 'smallint(4) UNSIGNED',
- 'BOOL' => 'tinyint(1) UNSIGNED',
- 'VCHAR' => 'varchar(255)',
- 'VCHAR:' => 'varchar(%d)',
- 'CHAR:' => 'char(%d)',
- 'XSTEXT' => 'text',
- 'XSTEXT_UNI'=> 'varchar(100)',
- 'STEXT' => 'text',
- 'STEXT_UNI' => 'varchar(255)',
- 'TEXT' => 'text',
- 'TEXT_UNI' => 'text',
- 'MTEXT' => 'mediumtext',
- 'MTEXT_UNI' => 'mediumtext',
- 'TIMESTAMP' => 'int(11) UNSIGNED',
- 'DECIMAL' => 'decimal(5,2)',
- 'DECIMAL:' => 'decimal(%d,2)',
- 'PDECIMAL' => 'decimal(6,3)',
- 'PDECIMAL:' => 'decimal(%d,3)',
- 'VCHAR_UNI' => 'varchar(255)',
- 'VCHAR_UNI:'=> 'varchar(%d)',
- 'VCHAR_CI' => 'varchar(255)',
- 'VARBINARY' => 'varbinary(255)',
- ),
-
- 'mysql_40' => array(
- 'INT:' => 'int(%d)',
- 'BINT' => 'bigint(20)',
- 'UINT' => 'mediumint(8) UNSIGNED',
- 'UINT:' => 'int(%d) UNSIGNED',
- 'TINT:' => 'tinyint(%d)',
- 'USINT' => 'smallint(4) UNSIGNED',
- 'BOOL' => 'tinyint(1) UNSIGNED',
- 'VCHAR' => 'varbinary(255)',
- 'VCHAR:' => 'varbinary(%d)',
- 'CHAR:' => 'binary(%d)',
- 'XSTEXT' => 'blob',
- 'XSTEXT_UNI'=> 'blob',
- 'STEXT' => 'blob',
- 'STEXT_UNI' => 'blob',
- 'TEXT' => 'blob',
- 'TEXT_UNI' => 'blob',
- 'MTEXT' => 'mediumblob',
- 'MTEXT_UNI' => 'mediumblob',
- 'TIMESTAMP' => 'int(11) UNSIGNED',
- 'DECIMAL' => 'decimal(5,2)',
- 'DECIMAL:' => 'decimal(%d,2)',
- 'PDECIMAL' => 'decimal(6,3)',
- 'PDECIMAL:' => 'decimal(%d,3)',
- 'VCHAR_UNI' => 'blob',
- 'VCHAR_UNI:'=> array('varbinary(%d)', 'limit' => array('mult', 3, 255, 'blob')),
- 'VCHAR_CI' => 'blob',
- 'VARBINARY' => 'varbinary(255)',
- ),
-
- 'firebird' => array(
- 'INT:' => 'INTEGER',
- 'BINT' => 'DOUBLE PRECISION',
- 'UINT' => 'INTEGER',
- 'UINT:' => 'INTEGER',
- 'TINT:' => 'INTEGER',
- 'USINT' => 'INTEGER',
- 'BOOL' => 'INTEGER',
- 'VCHAR' => 'VARCHAR(255) CHARACTER SET NONE',
- 'VCHAR:' => 'VARCHAR(%d) CHARACTER SET NONE',
- 'CHAR:' => 'CHAR(%d) CHARACTER SET NONE',
- 'XSTEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE',
- 'STEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE',
- 'TEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE',
- 'MTEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE',
- 'XSTEXT_UNI'=> 'VARCHAR(100) CHARACTER SET UTF8',
- 'STEXT_UNI' => 'VARCHAR(255) CHARACTER SET UTF8',
- 'TEXT_UNI' => 'BLOB SUB_TYPE TEXT CHARACTER SET UTF8',
- 'MTEXT_UNI' => 'BLOB SUB_TYPE TEXT CHARACTER SET UTF8',
- 'TIMESTAMP' => 'INTEGER',
- 'DECIMAL' => 'DOUBLE PRECISION',
- 'DECIMAL:' => 'DOUBLE PRECISION',
- 'PDECIMAL' => 'DOUBLE PRECISION',
- 'PDECIMAL:' => 'DOUBLE PRECISION',
- 'VCHAR_UNI' => 'VARCHAR(255) CHARACTER SET UTF8',
- 'VCHAR_UNI:'=> 'VARCHAR(%d) CHARACTER SET UTF8',
- 'VCHAR_CI' => 'VARCHAR(255) CHARACTER SET UTF8',
- 'VARBINARY' => 'CHAR(255) CHARACTER SET NONE',
- ),
-
- 'mssql' => array(
- 'INT:' => '[int]',
- 'BINT' => '[float]',
- 'UINT' => '[int]',
- 'UINT:' => '[int]',
- 'TINT:' => '[int]',
- 'USINT' => '[int]',
- 'BOOL' => '[int]',
- 'VCHAR' => '[varchar] (255)',
- 'VCHAR:' => '[varchar] (%d)',
- 'CHAR:' => '[char] (%d)',
- 'XSTEXT' => '[varchar] (1000)',
- 'STEXT' => '[varchar] (3000)',
- 'TEXT' => '[varchar] (8000)',
- 'MTEXT' => '[text]',
- 'XSTEXT_UNI'=> '[varchar] (100)',
- 'STEXT_UNI' => '[varchar] (255)',
- 'TEXT_UNI' => '[varchar] (4000)',
- 'MTEXT_UNI' => '[text]',
- 'TIMESTAMP' => '[int]',
- 'DECIMAL' => '[float]',
- 'DECIMAL:' => '[float]',
- 'PDECIMAL' => '[float]',
- 'PDECIMAL:' => '[float]',
- 'VCHAR_UNI' => '[varchar] (255)',
- 'VCHAR_UNI:'=> '[varchar] (%d)',
- 'VCHAR_CI' => '[varchar] (255)',
- 'VARBINARY' => '[varchar] (255)',
- ),
-
- 'oracle' => array(
- 'INT:' => 'number(%d)',
- 'BINT' => 'number(20)',
- 'UINT' => 'number(8)',
- 'UINT:' => 'number(%d)',
- 'TINT:' => 'number(%d)',
- 'USINT' => 'number(4)',
- 'BOOL' => 'number(1)',
- 'VCHAR' => 'varchar2(255)',
- 'VCHAR:' => 'varchar2(%d)',
- 'CHAR:' => 'char(%d)',
- 'XSTEXT' => 'varchar2(1000)',
- 'STEXT' => 'varchar2(3000)',
- 'TEXT' => 'clob',
- 'MTEXT' => 'clob',
- 'XSTEXT_UNI'=> 'varchar2(300)',
- 'STEXT_UNI' => 'varchar2(765)',
- 'TEXT_UNI' => 'clob',
- 'MTEXT_UNI' => 'clob',
- 'TIMESTAMP' => 'number(11)',
- 'DECIMAL' => 'number(5, 2)',
- 'DECIMAL:' => 'number(%d, 2)',
- 'PDECIMAL' => 'number(6, 3)',
- 'PDECIMAL:' => 'number(%d, 3)',
- 'VCHAR_UNI' => 'varchar2(765)',
- 'VCHAR_UNI:'=> array('varchar2(%d)', 'limit' => array('mult', 3, 765, 'clob')),
- 'VCHAR_CI' => 'varchar2(255)',
- 'VARBINARY' => 'raw(255)',
- ),
-
- 'sqlite' => array(
- 'INT:' => 'int(%d)',
- 'BINT' => 'bigint(20)',
- 'UINT' => 'INTEGER UNSIGNED', //'mediumint(8) UNSIGNED',
- 'UINT:' => 'INTEGER UNSIGNED', // 'int(%d) UNSIGNED',
- 'TINT:' => 'tinyint(%d)',
- 'USINT' => 'INTEGER UNSIGNED', //'mediumint(4) UNSIGNED',
- 'BOOL' => 'INTEGER UNSIGNED', //'tinyint(1) UNSIGNED',
- 'VCHAR' => 'varchar(255)',
- 'VCHAR:' => 'varchar(%d)',
- 'CHAR:' => 'char(%d)',
- 'XSTEXT' => 'text(65535)',
- 'STEXT' => 'text(65535)',
- 'TEXT' => 'text(65535)',
- 'MTEXT' => 'mediumtext(16777215)',
- 'XSTEXT_UNI'=> 'text(65535)',
- 'STEXT_UNI' => 'text(65535)',
- 'TEXT_UNI' => 'text(65535)',
- 'MTEXT_UNI' => 'mediumtext(16777215)',
- 'TIMESTAMP' => 'INTEGER UNSIGNED', //'int(11) UNSIGNED',
- 'DECIMAL' => 'decimal(5,2)',
- 'DECIMAL:' => 'decimal(%d,2)',
- 'PDECIMAL' => 'decimal(6,3)',
- 'PDECIMAL:' => 'decimal(%d,3)',
- 'VCHAR_UNI' => 'varchar(255)',
- 'VCHAR_UNI:'=> 'varchar(%d)',
- 'VCHAR_CI' => 'varchar(255)',
- 'VARBINARY' => 'blob',
- ),
-
- 'postgres' => array(
- 'INT:' => 'INT4',
- 'BINT' => 'INT8',
- 'UINT' => 'INT4', // unsigned
- 'UINT:' => 'INT4', // unsigned
- 'USINT' => 'INT2', // unsigned
- 'BOOL' => 'INT2', // unsigned
- 'TINT:' => 'INT2',
- 'VCHAR' => 'varchar(255)',
- 'VCHAR:' => 'varchar(%d)',
- 'CHAR:' => 'char(%d)',
- 'XSTEXT' => 'varchar(1000)',
- 'STEXT' => 'varchar(3000)',
- 'TEXT' => 'varchar(8000)',
- 'MTEXT' => 'TEXT',
- 'XSTEXT_UNI'=> 'varchar(100)',
- 'STEXT_UNI' => 'varchar(255)',
- 'TEXT_UNI' => 'varchar(4000)',
- 'MTEXT_UNI' => 'TEXT',
- 'TIMESTAMP' => 'INT4', // unsigned
- 'DECIMAL' => 'decimal(5,2)',
- 'DECIMAL:' => 'decimal(%d,2)',
- 'PDECIMAL' => 'decimal(6,3)',
- 'PDECIMAL:' => 'decimal(%d,3)',
- 'VCHAR_UNI' => 'varchar(255)',
- 'VCHAR_UNI:'=> 'varchar(%d)',
- 'VCHAR_CI' => 'varchar_ci',
- 'VARBINARY' => 'bytea',
- ),
-);
+define('IN_PHPBB', true);
+
+require(dirname(__FILE__) . '/../includes/db/schema_data.php');
+require(dirname(__FILE__) . '/../phpbb/db/tools.php');
+
+$dbms_type_map = phpbb\db\tools::get_dbms_type_map();
// A list of types being unsigned for better reference in some db's
$unsigned_types = array('UINT', 'UINT:', 'USINT', 'BOOL', 'TIMESTAMP');
@@ -787,1191 +581,6 @@ foreach ($supported_dbms as $dbms)
fclose($fp);
}
-
-/**
-* Define the basic structure
-* The format:
-* array('{TABLE_NAME}' => {TABLE_DATA})
-* {TABLE_DATA}:
-* COLUMNS = array({column_name} = array({column_type}, {default}, {auto_increment}))
-* PRIMARY_KEY = {column_name(s)}
-* KEYS = array({key_name} = array({key_type}, {column_name(s)})),
-*
-* Column Types:
-* INT:x => SIGNED int(x)
-* BINT => BIGINT
-* UINT => mediumint(8) UNSIGNED
-* UINT:x => int(x) UNSIGNED
-* TINT:x => tinyint(x)
-* USINT => smallint(4) UNSIGNED (for _order columns)
-* BOOL => tinyint(1) UNSIGNED
-* VCHAR => varchar(255)
-* CHAR:x => char(x)
-* XSTEXT_UNI => text for storing 100 characters (topic_title for example)
-* STEXT_UNI => text for storing 255 characters (normal input field with a max of 255 single-byte chars) - same as VCHAR_UNI
-* TEXT_UNI => text for storing 3000 characters (short text, descriptions, comments, etc.)
-* MTEXT_UNI => mediumtext (post text, large text)
-* VCHAR:x => varchar(x)
-* TIMESTAMP => int(11) UNSIGNED
-* DECIMAL => decimal number (5,2)
-* DECIMAL: => decimal number (x,2)
-* PDECIMAL => precision decimal number (6,3)
-* PDECIMAL: => precision decimal number (x,3)
-* VCHAR_UNI => varchar(255) BINARY
-* VCHAR_CI => varchar_ci for postgresql, others VCHAR
-*/
-function get_schema_struct()
-{
- $schema_data = array();
-
- $schema_data['phpbb_attachments'] = array(
- 'COLUMNS' => array(
- 'attach_id' => array('UINT', NULL, 'auto_increment'),
- 'post_msg_id' => array('UINT', 0),
- 'topic_id' => array('UINT', 0),
- 'in_message' => array('BOOL', 0),
- 'poster_id' => array('UINT', 0),
- 'is_orphan' => array('BOOL', 1),
- 'physical_filename' => array('VCHAR', ''),
- 'real_filename' => array('VCHAR', ''),
- 'download_count' => array('UINT', 0),
- 'attach_comment' => array('TEXT_UNI', ''),
- 'extension' => array('VCHAR:100', ''),
- 'mimetype' => array('VCHAR:100', ''),
- 'filesize' => array('UINT:20', 0),
- 'filetime' => array('TIMESTAMP', 0),
- 'thumbnail' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => 'attach_id',
- 'KEYS' => array(
- 'filetime' => array('INDEX', 'filetime'),
- 'post_msg_id' => array('INDEX', 'post_msg_id'),
- 'topic_id' => array('INDEX', 'topic_id'),
- 'poster_id' => array('INDEX', 'poster_id'),
- 'is_orphan' => array('INDEX', 'is_orphan'),
- ),
- );
-
- $schema_data['phpbb_acl_groups'] = array(
- 'COLUMNS' => array(
- 'group_id' => array('UINT', 0),
- 'forum_id' => array('UINT', 0),
- 'auth_option_id' => array('UINT', 0),
- 'auth_role_id' => array('UINT', 0),
- 'auth_setting' => array('TINT:2', 0),
- ),
- 'KEYS' => array(
- 'group_id' => array('INDEX', 'group_id'),
- 'auth_opt_id' => array('INDEX', 'auth_option_id'),
- 'auth_role_id' => array('INDEX', 'auth_role_id'),
- ),
- );
-
- $schema_data['phpbb_acl_options'] = array(
- 'COLUMNS' => array(
- 'auth_option_id' => array('UINT', NULL, 'auto_increment'),
- 'auth_option' => array('VCHAR:50', ''),
- 'is_global' => array('BOOL', 0),
- 'is_local' => array('BOOL', 0),
- 'founder_only' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => 'auth_option_id',
- 'KEYS' => array(
- 'auth_option' => array('UNIQUE', 'auth_option'),
- ),
- );
-
- $schema_data['phpbb_acl_roles'] = array(
- 'COLUMNS' => array(
- 'role_id' => array('UINT', NULL, 'auto_increment'),
- 'role_name' => array('VCHAR_UNI', ''),
- 'role_description' => array('TEXT_UNI', ''),
- 'role_type' => array('VCHAR:10', ''),
- 'role_order' => array('USINT', 0),
- ),
- 'PRIMARY_KEY' => 'role_id',
- 'KEYS' => array(
- 'role_type' => array('INDEX', 'role_type'),
- 'role_order' => array('INDEX', 'role_order'),
- ),
- );
-
- $schema_data['phpbb_acl_roles_data'] = array(
- 'COLUMNS' => array(
- 'role_id' => array('UINT', 0),
- 'auth_option_id' => array('UINT', 0),
- 'auth_setting' => array('TINT:2', 0),
- ),
- 'PRIMARY_KEY' => array('role_id', 'auth_option_id'),
- 'KEYS' => array(
- 'ath_op_id' => array('INDEX', 'auth_option_id'),
- ),
- );
-
- $schema_data['phpbb_acl_users'] = array(
- 'COLUMNS' => array(
- 'user_id' => array('UINT', 0),
- 'forum_id' => array('UINT', 0),
- 'auth_option_id' => array('UINT', 0),
- 'auth_role_id' => array('UINT', 0),
- 'auth_setting' => array('TINT:2', 0),
- ),
- 'KEYS' => array(
- 'user_id' => array('INDEX', 'user_id'),
- 'auth_option_id' => array('INDEX', 'auth_option_id'),
- 'auth_role_id' => array('INDEX', 'auth_role_id'),
- ),
- );
-
- $schema_data['phpbb_banlist'] = array(
- 'COLUMNS' => array(
- 'ban_id' => array('UINT', NULL, 'auto_increment'),
- 'ban_userid' => array('UINT', 0),
- 'ban_ip' => array('VCHAR:40', ''),
- 'ban_email' => array('VCHAR_UNI:100', ''),
- 'ban_start' => array('TIMESTAMP', 0),
- 'ban_end' => array('TIMESTAMP', 0),
- 'ban_exclude' => array('BOOL', 0),
- 'ban_reason' => array('VCHAR_UNI', ''),
- 'ban_give_reason' => array('VCHAR_UNI', ''),
- ),
- 'PRIMARY_KEY' => 'ban_id',
- 'KEYS' => array(
- 'ban_end' => array('INDEX', 'ban_end'),
- 'ban_user' => array('INDEX', array('ban_userid', 'ban_exclude')),
- 'ban_email' => array('INDEX', array('ban_email', 'ban_exclude')),
- 'ban_ip' => array('INDEX', array('ban_ip', 'ban_exclude')),
- ),
- );
-
- $schema_data['phpbb_bbcodes'] = array(
- 'COLUMNS' => array(
- 'bbcode_id' => array('USINT', 0),
- 'bbcode_tag' => array('VCHAR:16', ''),
- 'bbcode_helpline' => array('VCHAR_UNI', ''),
- 'display_on_posting' => array('BOOL', 0),
- 'bbcode_match' => array('TEXT_UNI', ''),
- 'bbcode_tpl' => array('MTEXT_UNI', ''),
- 'first_pass_match' => array('MTEXT_UNI', ''),
- 'first_pass_replace' => array('MTEXT_UNI', ''),
- 'second_pass_match' => array('MTEXT_UNI', ''),
- 'second_pass_replace' => array('MTEXT_UNI', ''),
- ),
- 'PRIMARY_KEY' => 'bbcode_id',
- 'KEYS' => array(
- 'display_on_post' => array('INDEX', 'display_on_posting'),
- ),
- );
-
- $schema_data['phpbb_bookmarks'] = array(
- 'COLUMNS' => array(
- 'topic_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => array('topic_id', 'user_id'),
- );
-
- $schema_data['phpbb_bots'] = array(
- 'COLUMNS' => array(
- 'bot_id' => array('UINT', NULL, 'auto_increment'),
- 'bot_active' => array('BOOL', 1),
- 'bot_name' => array('STEXT_UNI', ''),
- 'user_id' => array('UINT', 0),
- 'bot_agent' => array('VCHAR', ''),
- 'bot_ip' => array('VCHAR', ''),
- ),
- 'PRIMARY_KEY' => 'bot_id',
- 'KEYS' => array(
- 'bot_active' => array('INDEX', 'bot_active'),
- ),
- );
-
- $schema_data['phpbb_config'] = array(
- 'COLUMNS' => array(
- 'config_name' => array('VCHAR', ''),
- 'config_value' => array('VCHAR_UNI', ''),
- 'is_dynamic' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => 'config_name',
- 'KEYS' => array(
- 'is_dynamic' => array('INDEX', 'is_dynamic'),
- ),
- );
-
- $schema_data['phpbb_config_text'] = array(
- 'COLUMNS' => array(
- 'config_name' => array('VCHAR', ''),
- 'config_value' => array('MTEXT', ''),
- ),
- 'PRIMARY_KEY' => 'config_name',
- );
-
- $schema_data['phpbb_confirm'] = array(
- 'COLUMNS' => array(
- 'confirm_id' => array('CHAR:32', ''),
- 'session_id' => array('CHAR:32', ''),
- 'confirm_type' => array('TINT:3', 0),
- 'code' => array('VCHAR:8', ''),
- 'seed' => array('UINT:10', 0),
- 'attempts' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => array('session_id', 'confirm_id'),
- 'KEYS' => array(
- 'confirm_type' => array('INDEX', 'confirm_type'),
- ),
- );
-
- $schema_data['phpbb_disallow'] = array(
- 'COLUMNS' => array(
- 'disallow_id' => array('UINT', NULL, 'auto_increment'),
- 'disallow_username' => array('VCHAR_UNI:255', ''),
- ),
- 'PRIMARY_KEY' => 'disallow_id',
- );
-
- $schema_data['phpbb_drafts'] = array(
- 'COLUMNS' => array(
- 'draft_id' => array('UINT', NULL, 'auto_increment'),
- 'user_id' => array('UINT', 0),
- 'topic_id' => array('UINT', 0),
- 'forum_id' => array('UINT', 0),
- 'save_time' => array('TIMESTAMP', 0),
- 'draft_subject' => array('STEXT_UNI', ''),
- 'draft_message' => array('MTEXT_UNI', ''),
- ),
- 'PRIMARY_KEY' => 'draft_id',
- 'KEYS' => array(
- 'save_time' => array('INDEX', 'save_time'),
- ),
- );
-
- $schema_data['phpbb_ext'] = array(
- 'COLUMNS' => array(
- 'ext_name' => array('VCHAR', ''),
- 'ext_active' => array('BOOL', 0),
- 'ext_state' => array('TEXT', ''),
- ),
- 'KEYS' => array(
- 'ext_name' => array('UNIQUE', 'ext_name'),
- ),
- );
-
- $schema_data['phpbb_extensions'] = array(
- 'COLUMNS' => array(
- 'extension_id' => array('UINT', NULL, 'auto_increment'),
- 'group_id' => array('UINT', 0),
- 'extension' => array('VCHAR:100', ''),
- ),
- 'PRIMARY_KEY' => 'extension_id',
- );
-
- $schema_data['phpbb_extension_groups'] = array(
- 'COLUMNS' => array(
- 'group_id' => array('UINT', NULL, 'auto_increment'),
- 'group_name' => array('VCHAR_UNI', ''),
- 'cat_id' => array('TINT:2', 0),
- 'allow_group' => array('BOOL', 0),
- 'download_mode' => array('BOOL', 1),
- 'upload_icon' => array('VCHAR', ''),
- 'max_filesize' => array('UINT:20', 0),
- 'allowed_forums' => array('TEXT', ''),
- 'allow_in_pm' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => 'group_id',
- );
-
- $schema_data['phpbb_forums'] = array(
- 'COLUMNS' => array(
- 'forum_id' => array('UINT', NULL, 'auto_increment'),
- 'parent_id' => array('UINT', 0),
- 'left_id' => array('UINT', 0),
- 'right_id' => array('UINT', 0),
- 'forum_parents' => array('MTEXT', ''),
- 'forum_name' => array('STEXT_UNI', ''),
- 'forum_desc' => array('TEXT_UNI', ''),
- 'forum_desc_bitfield' => array('VCHAR:255', ''),
- 'forum_desc_options' => array('UINT:11', 7),
- 'forum_desc_uid' => array('VCHAR:8', ''),
- 'forum_link' => array('VCHAR_UNI', ''),
- 'forum_password' => array('VCHAR_UNI:40', ''),
- 'forum_style' => array('UINT', 0),
- 'forum_image' => array('VCHAR', ''),
- 'forum_rules' => array('TEXT_UNI', ''),
- 'forum_rules_link' => array('VCHAR_UNI', ''),
- 'forum_rules_bitfield' => array('VCHAR:255', ''),
- 'forum_rules_options' => array('UINT:11', 7),
- 'forum_rules_uid' => array('VCHAR:8', ''),
- 'forum_topics_per_page' => array('TINT:4', 0),
- 'forum_type' => array('TINT:4', 0),
- 'forum_status' => array('TINT:4', 0),
- 'forum_posts_approved' => array('UINT', 0),
- 'forum_posts_unapproved' => array('UINT', 0),
- 'forum_posts_softdeleted' => array('UINT', 0),
- 'forum_topics_approved' => array('UINT', 0),
- 'forum_topics_unapproved' => array('UINT', 0),
- 'forum_topics_softdeleted' => array('UINT', 0),
- 'forum_last_post_id' => array('UINT', 0),
- 'forum_last_poster_id' => array('UINT', 0),
- 'forum_last_post_subject' => array('STEXT_UNI', ''),
- 'forum_last_post_time' => array('TIMESTAMP', 0),
- 'forum_last_poster_name'=> array('VCHAR_UNI', ''),
- 'forum_last_poster_colour'=> array('VCHAR:6', ''),
- 'forum_flags' => array('TINT:4', 32),
- 'forum_options' => array('UINT:20', 0),
- 'display_subforum_list' => array('BOOL', 1),
- 'display_on_index' => array('BOOL', 1),
- 'enable_indexing' => array('BOOL', 1),
- 'enable_icons' => array('BOOL', 1),
- 'enable_prune' => array('BOOL', 0),
- 'prune_next' => array('TIMESTAMP', 0),
- 'prune_days' => array('UINT', 0),
- 'prune_viewed' => array('UINT', 0),
- 'prune_freq' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => 'forum_id',
- 'KEYS' => array(
- 'left_right_id' => array('INDEX', array('left_id', 'right_id')),
- 'forum_lastpost_id' => array('INDEX', 'forum_last_post_id'),
- ),
- );
-
- $schema_data['phpbb_forums_access'] = array(
- 'COLUMNS' => array(
- 'forum_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- 'session_id' => array('CHAR:32', ''),
- ),
- 'PRIMARY_KEY' => array('forum_id', 'user_id', 'session_id'),
- );
-
- $schema_data['phpbb_forums_track'] = array(
- 'COLUMNS' => array(
- 'user_id' => array('UINT', 0),
- 'forum_id' => array('UINT', 0),
- 'mark_time' => array('TIMESTAMP', 0),
- ),
- 'PRIMARY_KEY' => array('user_id', 'forum_id'),
- );
-
- $schema_data['phpbb_forums_watch'] = array(
- 'COLUMNS' => array(
- 'forum_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- 'notify_status' => array('BOOL', 0),
- ),
- 'KEYS' => array(
- 'forum_id' => array('INDEX', 'forum_id'),
- 'user_id' => array('INDEX', 'user_id'),
- 'notify_stat' => array('INDEX', 'notify_status'),
- ),
- );
-
- $schema_data['phpbb_groups'] = array(
- 'COLUMNS' => array(
- 'group_id' => array('UINT', NULL, 'auto_increment'),
- 'group_type' => array('TINT:4', 1),
- 'group_founder_manage' => array('BOOL', 0),
- 'group_skip_auth' => array('BOOL', 0),
- 'group_name' => array('VCHAR_CI', ''),
- 'group_desc' => array('TEXT_UNI', ''),
- 'group_desc_bitfield' => array('VCHAR:255', ''),
- 'group_desc_options' => array('UINT:11', 7),
- 'group_desc_uid' => array('VCHAR:8', ''),
- 'group_display' => array('BOOL', 0),
- 'group_avatar' => array('VCHAR', ''),
- 'group_avatar_type' => array('VCHAR:255', ''),
- 'group_avatar_width' => array('USINT', 0),
- 'group_avatar_height' => array('USINT', 0),
- 'group_rank' => array('UINT', 0),
- 'group_colour' => array('VCHAR:6', ''),
- 'group_sig_chars' => array('UINT', 0),
- 'group_receive_pm' => array('BOOL', 0),
- 'group_message_limit' => array('UINT', 0),
- 'group_max_recipients' => array('UINT', 0),
- 'group_legend' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => 'group_id',
- 'KEYS' => array(
- 'group_legend_name' => array('INDEX', array('group_legend', 'group_name')),
- ),
- );
-
- $schema_data['phpbb_icons'] = array(
- 'COLUMNS' => array(
- 'icons_id' => array('UINT', NULL, 'auto_increment'),
- 'icons_url' => array('VCHAR', ''),
- 'icons_width' => array('TINT:4', 0),
- 'icons_height' => array('TINT:4', 0),
- 'icons_order' => array('UINT', 0),
- 'display_on_posting' => array('BOOL', 1),
- ),
- 'PRIMARY_KEY' => 'icons_id',
- 'KEYS' => array(
- 'display_on_posting' => array('INDEX', 'display_on_posting'),
- ),
- );
-
- $schema_data['phpbb_lang'] = array(
- 'COLUMNS' => array(
- 'lang_id' => array('TINT:4', NULL, 'auto_increment'),
- 'lang_iso' => array('VCHAR:30', ''),
- 'lang_dir' => array('VCHAR:30', ''),
- 'lang_english_name' => array('VCHAR_UNI:100', ''),
- 'lang_local_name' => array('VCHAR_UNI:255', ''),
- 'lang_author' => array('VCHAR_UNI:255', ''),
- ),
- 'PRIMARY_KEY' => 'lang_id',
- 'KEYS' => array(
- 'lang_iso' => array('INDEX', 'lang_iso'),
- ),
- );
-
- $schema_data['phpbb_log'] = array(
- 'COLUMNS' => array(
- 'log_id' => array('UINT', NULL, 'auto_increment'),
- 'log_type' => array('TINT:4', 0),
- 'user_id' => array('UINT', 0),
- 'forum_id' => array('UINT', 0),
- 'topic_id' => array('UINT', 0),
- 'reportee_id' => array('UINT', 0),
- 'log_ip' => array('VCHAR:40', ''),
- 'log_time' => array('TIMESTAMP', 0),
- 'log_operation' => array('TEXT_UNI', ''),
- 'log_data' => array('MTEXT_UNI', ''),
- ),
- 'PRIMARY_KEY' => 'log_id',
- 'KEYS' => array(
- 'log_type' => array('INDEX', 'log_type'),
- 'log_time' => array('INDEX', 'log_time'),
- 'forum_id' => array('INDEX', 'forum_id'),
- 'topic_id' => array('INDEX', 'topic_id'),
- 'reportee_id' => array('INDEX', 'reportee_id'),
- 'user_id' => array('INDEX', 'user_id'),
- ),
- );
-
- $schema_data['phpbb_login_attempts'] = array(
- 'COLUMNS' => array(
- 'attempt_ip' => array('VCHAR:40', ''),
- 'attempt_browser' => array('VCHAR:150', ''),
- 'attempt_forwarded_for' => array('VCHAR:255', ''),
- 'attempt_time' => array('TIMESTAMP', 0),
- 'user_id' => array('UINT', 0),
- 'username' => array('VCHAR_UNI:255', 0),
- 'username_clean' => array('VCHAR_CI', 0),
- ),
- 'KEYS' => array(
- 'att_ip' => array('INDEX', array('attempt_ip', 'attempt_time')),
- 'att_for' => array('INDEX', array('attempt_forwarded_for', 'attempt_time')),
- 'att_time' => array('INDEX', array('attempt_time')),
- 'user_id' => array('INDEX', 'user_id'),
- ),
- );
-
- $schema_data['phpbb_moderator_cache'] = array(
- 'COLUMNS' => array(
- 'forum_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- 'username' => array('VCHAR_UNI:255', ''),
- 'group_id' => array('UINT', 0),
- 'group_name' => array('VCHAR_UNI', ''),
- 'display_on_index' => array('BOOL', 1),
- ),
- 'KEYS' => array(
- 'disp_idx' => array('INDEX', 'display_on_index'),
- 'forum_id' => array('INDEX', 'forum_id'),
- ),
- );
-
- $schema_data['phpbb_migrations'] = array(
- 'COLUMNS' => array(
- 'migration_name' => array('VCHAR', ''),
- 'migration_depends_on' => array('TEXT', ''),
- 'migration_schema_done' => array('BOOL', 0),
- 'migration_data_done' => array('BOOL', 0),
- 'migration_data_state' => array('TEXT', ''),
- 'migration_start_time' => array('TIMESTAMP', 0),
- 'migration_end_time' => array('TIMESTAMP', 0),
- ),
- 'PRIMARY_KEY' => 'migration_name',
- );
-
- $schema_data['phpbb_modules'] = array(
- 'COLUMNS' => array(
- 'module_id' => array('UINT', NULL, 'auto_increment'),
- 'module_enabled' => array('BOOL', 1),
- 'module_display' => array('BOOL', 1),
- 'module_basename' => array('VCHAR', ''),
- 'module_class' => array('VCHAR:10', ''),
- 'parent_id' => array('UINT', 0),
- 'left_id' => array('UINT', 0),
- 'right_id' => array('UINT', 0),
- 'module_langname' => array('VCHAR', ''),
- 'module_mode' => array('VCHAR', ''),
- 'module_auth' => array('VCHAR', ''),
- ),
- 'PRIMARY_KEY' => 'module_id',
- 'KEYS' => array(
- 'left_right_id' => array('INDEX', array('left_id', 'right_id')),
- 'module_enabled' => array('INDEX', 'module_enabled'),
- 'class_left_id' => array('INDEX', array('module_class', 'left_id')),
- ),
- );
-
- $schema_data['phpbb_notification_types'] = array(
- 'COLUMNS' => array(
- 'notification_type_id' => array('USINT', NULL, 'auto_increment'),
- 'notification_type_name' => array('VCHAR:255', ''),
- 'notification_type_enabled' => array('BOOL', 1),
- ),
- 'PRIMARY_KEY' => array('notification_type_id'),
- 'KEYS' => array(
- 'type' => array('UNIQUE', array('notification_type_name')),
- ),
- );
-
- $schema_data['phpbb_notifications'] = array(
- 'COLUMNS' => array(
- 'notification_id' => array('UINT:10', NULL, 'auto_increment'),
- 'notification_type_id' => array('USINT', 0),
- 'item_id' => array('UINT', 0),
- 'item_parent_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- 'notification_read' => array('BOOL', 0),
- 'notification_time' => array('TIMESTAMP', 1),
- 'notification_data' => array('TEXT_UNI', ''),
- ),
- 'PRIMARY_KEY' => 'notification_id',
- 'KEYS' => array(
- 'item_ident' => array('INDEX', array('notification_type_id', 'item_id')),
- 'user' => array('INDEX', array('user_id', 'notification_read')),
- ),
- );
-
- $schema_data['phpbb_poll_options'] = array(
- 'COLUMNS' => array(
- 'poll_option_id' => array('TINT:4', 0),
- 'topic_id' => array('UINT', 0),
- 'poll_option_text' => array('TEXT_UNI', ''),
- 'poll_option_total' => array('UINT', 0),
- ),
- 'KEYS' => array(
- 'poll_opt_id' => array('INDEX', 'poll_option_id'),
- 'topic_id' => array('INDEX', 'topic_id'),
- ),
- );
-
- $schema_data['phpbb_poll_votes'] = array(
- 'COLUMNS' => array(
- 'topic_id' => array('UINT', 0),
- 'poll_option_id' => array('TINT:4', 0),
- 'vote_user_id' => array('UINT', 0),
- 'vote_user_ip' => array('VCHAR:40', ''),
- ),
- 'KEYS' => array(
- 'topic_id' => array('INDEX', 'topic_id'),
- 'vote_user_id' => array('INDEX', 'vote_user_id'),
- 'vote_user_ip' => array('INDEX', 'vote_user_ip'),
- ),
- );
-
- $schema_data['phpbb_posts'] = array(
- 'COLUMNS' => array(
- 'post_id' => array('UINT', NULL, 'auto_increment'),
- 'topic_id' => array('UINT', 0),
- 'forum_id' => array('UINT', 0),
- 'poster_id' => array('UINT', 0),
- 'icon_id' => array('UINT', 0),
- 'poster_ip' => array('VCHAR:40', ''),
- 'post_time' => array('TIMESTAMP', 0),
- 'post_visibility' => array('TINT:3', 0),
- 'post_reported' => array('BOOL', 0),
- 'enable_bbcode' => array('BOOL', 1),
- 'enable_smilies' => array('BOOL', 1),
- 'enable_magic_url' => array('BOOL', 1),
- 'enable_sig' => array('BOOL', 1),
- 'post_username' => array('VCHAR_UNI:255', ''),
- 'post_subject' => array('STEXT_UNI', '', 'true_sort'),
- 'post_text' => array('MTEXT_UNI', ''),
- 'post_checksum' => array('VCHAR:32', ''),
- 'post_attachment' => array('BOOL', 0),
- 'bbcode_bitfield' => array('VCHAR:255', ''),
- 'bbcode_uid' => array('VCHAR:8', ''),
- 'post_postcount' => array('BOOL', 1),
- 'post_edit_time' => array('TIMESTAMP', 0),
- 'post_edit_reason' => array('STEXT_UNI', ''),
- 'post_edit_user' => array('UINT', 0),
- 'post_edit_count' => array('USINT', 0),
- 'post_edit_locked' => array('BOOL', 0),
- 'post_delete_time' => array('TIMESTAMP', 0),
- 'post_delete_reason' => array('STEXT_UNI', ''),
- 'post_delete_user' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => 'post_id',
- 'KEYS' => array(
- 'forum_id' => array('INDEX', 'forum_id'),
- 'topic_id' => array('INDEX', 'topic_id'),
- 'poster_ip' => array('INDEX', 'poster_ip'),
- 'poster_id' => array('INDEX', 'poster_id'),
- 'post_visibility' => array('INDEX', 'post_visibility'),
- 'post_username' => array('INDEX', 'post_username'),
- 'tid_post_time' => array('INDEX', array('topic_id', 'post_time')),
- ),
- );
-
- $schema_data['phpbb_privmsgs'] = array(
- 'COLUMNS' => array(
- 'msg_id' => array('UINT', NULL, 'auto_increment'),
- 'root_level' => array('UINT', 0),
- 'author_id' => array('UINT', 0),
- 'icon_id' => array('UINT', 0),
- 'author_ip' => array('VCHAR:40', ''),
- 'message_time' => array('TIMESTAMP', 0),
- 'enable_bbcode' => array('BOOL', 1),
- 'enable_smilies' => array('BOOL', 1),
- 'enable_magic_url' => array('BOOL', 1),
- 'enable_sig' => array('BOOL', 1),
- 'message_subject' => array('STEXT_UNI', ''),
- 'message_text' => array('MTEXT_UNI', ''),
- 'message_edit_reason' => array('STEXT_UNI', ''),
- 'message_edit_user' => array('UINT', 0),
- 'message_attachment' => array('BOOL', 0),
- 'bbcode_bitfield' => array('VCHAR:255', ''),
- 'bbcode_uid' => array('VCHAR:8', ''),
- 'message_edit_time' => array('TIMESTAMP', 0),
- 'message_edit_count' => array('USINT', 0),
- 'to_address' => array('TEXT_UNI', ''),
- 'bcc_address' => array('TEXT_UNI', ''),
- 'message_reported' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => 'msg_id',
- 'KEYS' => array(
- 'author_ip' => array('INDEX', 'author_ip'),
- 'message_time' => array('INDEX', 'message_time'),
- 'author_id' => array('INDEX', 'author_id'),
- 'root_level' => array('INDEX', 'root_level'),
- ),
- );
-
- $schema_data['phpbb_privmsgs_folder'] = array(
- 'COLUMNS' => array(
- 'folder_id' => array('UINT', NULL, 'auto_increment'),
- 'user_id' => array('UINT', 0),
- 'folder_name' => array('VCHAR_UNI', ''),
- 'pm_count' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => 'folder_id',
- 'KEYS' => array(
- 'user_id' => array('INDEX', 'user_id'),
- ),
- );
-
- $schema_data['phpbb_privmsgs_rules'] = array(
- 'COLUMNS' => array(
- 'rule_id' => array('UINT', NULL, 'auto_increment'),
- 'user_id' => array('UINT', 0),
- 'rule_check' => array('UINT', 0),
- 'rule_connection' => array('UINT', 0),
- 'rule_string' => array('VCHAR_UNI', ''),
- 'rule_user_id' => array('UINT', 0),
- 'rule_group_id' => array('UINT', 0),
- 'rule_action' => array('UINT', 0),
- 'rule_folder_id' => array('INT:11', 0),
- ),
- 'PRIMARY_KEY' => 'rule_id',
- 'KEYS' => array(
- 'user_id' => array('INDEX', 'user_id'),
- ),
- );
-
- $schema_data['phpbb_privmsgs_to'] = array(
- 'COLUMNS' => array(
- 'msg_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- 'author_id' => array('UINT', 0),
- 'pm_deleted' => array('BOOL', 0),
- 'pm_new' => array('BOOL', 1),
- 'pm_unread' => array('BOOL', 1),
- 'pm_replied' => array('BOOL', 0),
- 'pm_marked' => array('BOOL', 0),
- 'pm_forwarded' => array('BOOL', 0),
- 'folder_id' => array('INT:11', 0),
- ),
- 'KEYS' => array(
- 'msg_id' => array('INDEX', 'msg_id'),
- 'author_id' => array('INDEX', 'author_id'),
- 'usr_flder_id' => array('INDEX', array('user_id', 'folder_id')),
- ),
- );
-
- $schema_data['phpbb_profile_fields'] = array(
- 'COLUMNS' => array(
- 'field_id' => array('UINT', NULL, 'auto_increment'),
- 'field_name' => array('VCHAR_UNI', ''),
- 'field_type' => array('TINT:4', 0),
- 'field_ident' => array('VCHAR:20', ''),
- 'field_length' => array('VCHAR:20', ''),
- 'field_minlen' => array('VCHAR', ''),
- 'field_maxlen' => array('VCHAR', ''),
- 'field_novalue' => array('VCHAR_UNI', ''),
- 'field_default_value' => array('VCHAR_UNI', ''),
- 'field_validation' => array('VCHAR_UNI:20', ''),
- 'field_required' => array('BOOL', 0),
- 'field_show_novalue' => array('BOOL', 0),
- 'field_show_on_reg' => array('BOOL', 0),
- 'field_show_on_pm' => array('BOOL', 0),
- 'field_show_on_vt' => array('BOOL', 0),
- 'field_show_profile' => array('BOOL', 0),
- 'field_hide' => array('BOOL', 0),
- 'field_no_view' => array('BOOL', 0),
- 'field_active' => array('BOOL', 0),
- 'field_order' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => 'field_id',
- 'KEYS' => array(
- 'fld_type' => array('INDEX', 'field_type'),
- 'fld_ordr' => array('INDEX', 'field_order'),
- ),
- );
-
- $schema_data['phpbb_profile_fields_data'] = array(
- 'COLUMNS' => array(
- 'user_id' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => 'user_id',
- );
-
- $schema_data['phpbb_profile_fields_lang'] = array(
- 'COLUMNS' => array(
- 'field_id' => array('UINT', 0),
- 'lang_id' => array('UINT', 0),
- 'option_id' => array('UINT', 0),
- 'field_type' => array('TINT:4', 0),
- 'lang_value' => array('VCHAR_UNI', ''),
- ),
- 'PRIMARY_KEY' => array('field_id', 'lang_id', 'option_id'),
- );
-
- $schema_data['phpbb_profile_lang'] = array(
- 'COLUMNS' => array(
- 'field_id' => array('UINT', 0),
- 'lang_id' => array('UINT', 0),
- 'lang_name' => array('VCHAR_UNI', ''),
- 'lang_explain' => array('TEXT_UNI', ''),
- 'lang_default_value' => array('VCHAR_UNI', ''),
- ),
- 'PRIMARY_KEY' => array('field_id', 'lang_id'),
- );
-
- $schema_data['phpbb_ranks'] = array(
- 'COLUMNS' => array(
- 'rank_id' => array('UINT', NULL, 'auto_increment'),
- 'rank_title' => array('VCHAR_UNI', ''),
- 'rank_min' => array('UINT', 0),
- 'rank_special' => array('BOOL', 0),
- 'rank_image' => array('VCHAR', ''),
- ),
- 'PRIMARY_KEY' => 'rank_id',
- );
-
- $schema_data['phpbb_reports'] = array(
- 'COLUMNS' => array(
- 'report_id' => array('UINT', NULL, 'auto_increment'),
- 'reason_id' => array('USINT', 0),
- 'post_id' => array('UINT', 0),
- 'pm_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- 'user_notify' => array('BOOL', 0),
- 'report_closed' => array('BOOL', 0),
- 'report_time' => array('TIMESTAMP', 0),
- 'report_text' => array('MTEXT_UNI', ''),
- 'reported_post_text' => array('MTEXT_UNI', ''),
- 'reported_post_uid' => array('VCHAR:8', ''),
- 'reported_post_bitfield' => array('VCHAR:255', ''),
- 'reported_post_enable_magic_url' => array('BOOL', 1),
- 'reported_post_enable_smilies' => array('BOOL', 1),
- 'reported_post_enable_bbcode' => array('BOOL', 1)
- ),
- 'PRIMARY_KEY' => 'report_id',
- 'KEYS' => array(
- 'post_id' => array('INDEX', 'post_id'),
- 'pm_id' => array('INDEX', 'pm_id'),
- ),
- );
-
- $schema_data['phpbb_reports_reasons'] = array(
- 'COLUMNS' => array(
- 'reason_id' => array('USINT', NULL, 'auto_increment'),
- 'reason_title' => array('VCHAR_UNI', ''),
- 'reason_description' => array('MTEXT_UNI', ''),
- 'reason_order' => array('USINT', 0),
- ),
- 'PRIMARY_KEY' => 'reason_id',
- );
-
- $schema_data['phpbb_search_results'] = array(
- 'COLUMNS' => array(
- 'search_key' => array('VCHAR:32', ''),
- 'search_time' => array('TIMESTAMP', 0),
- 'search_keywords' => array('MTEXT_UNI', ''),
- 'search_authors' => array('MTEXT', ''),
- ),
- 'PRIMARY_KEY' => 'search_key',
- );
-
- $schema_data['phpbb_search_wordlist'] = array(
- 'COLUMNS' => array(
- 'word_id' => array('UINT', NULL, 'auto_increment'),
- 'word_text' => array('VCHAR_UNI', ''),
- 'word_common' => array('BOOL', 0),
- 'word_count' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => 'word_id',
- 'KEYS' => array(
- 'wrd_txt' => array('UNIQUE', 'word_text'),
- 'wrd_cnt' => array('INDEX', 'word_count'),
- ),
- );
-
- $schema_data['phpbb_search_wordmatch'] = array(
- 'COLUMNS' => array(
- 'post_id' => array('UINT', 0),
- 'word_id' => array('UINT', 0),
- 'title_match' => array('BOOL', 0),
- ),
- 'KEYS' => array(
- 'unq_mtch' => array('UNIQUE', array('word_id', 'post_id', 'title_match')),
- 'word_id' => array('INDEX', 'word_id'),
- 'post_id' => array('INDEX', 'post_id'),
- ),
- );
-
- $schema_data['phpbb_sessions'] = array(
- 'COLUMNS' => array(
- 'session_id' => array('CHAR:32', ''),
- 'session_user_id' => array('UINT', 0),
- 'session_forum_id' => array('UINT', 0),
- 'session_last_visit' => array('TIMESTAMP', 0),
- 'session_start' => array('TIMESTAMP', 0),
- 'session_time' => array('TIMESTAMP', 0),
- 'session_ip' => array('VCHAR:40', ''),
- 'session_browser' => array('VCHAR:150', ''),
- 'session_forwarded_for' => array('VCHAR:255', ''),
- 'session_page' => array('VCHAR_UNI', ''),
- 'session_viewonline' => array('BOOL', 1),
- 'session_autologin' => array('BOOL', 0),
- 'session_admin' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => 'session_id',
- 'KEYS' => array(
- 'session_time' => array('INDEX', 'session_time'),
- 'session_user_id' => array('INDEX', 'session_user_id'),
- 'session_fid' => array('INDEX', 'session_forum_id'),
- ),
- );
-
- $schema_data['phpbb_sessions_keys'] = array(
- 'COLUMNS' => array(
- 'key_id' => array('CHAR:32', ''),
- 'user_id' => array('UINT', 0),
- 'last_ip' => array('VCHAR:40', ''),
- 'last_login' => array('TIMESTAMP', 0),
- ),
- 'PRIMARY_KEY' => array('key_id', 'user_id'),
- 'KEYS' => array(
- 'last_login' => array('INDEX', 'last_login'),
- ),
- );
-
- $schema_data['phpbb_sitelist'] = array(
- 'COLUMNS' => array(
- 'site_id' => array('UINT', NULL, 'auto_increment'),
- 'site_ip' => array('VCHAR:40', ''),
- 'site_hostname' => array('VCHAR', ''),
- 'ip_exclude' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => 'site_id',
- );
-
- $schema_data['phpbb_smilies'] = array(
- 'COLUMNS' => array(
- 'smiley_id' => array('UINT', NULL, 'auto_increment'),
- // We may want to set 'code' to VCHAR:50 or check if unicode support is possible... at the moment only ASCII characters are allowed.
- 'code' => array('VCHAR_UNI:50', ''),
- 'emotion' => array('VCHAR_UNI:50', ''),
- 'smiley_url' => array('VCHAR:50', ''),
- 'smiley_width' => array('USINT', 0),
- 'smiley_height' => array('USINT', 0),
- 'smiley_order' => array('UINT', 0),
- 'display_on_posting'=> array('BOOL', 1),
- ),
- 'PRIMARY_KEY' => 'smiley_id',
- 'KEYS' => array(
- 'display_on_post' => array('INDEX', 'display_on_posting'),
- ),
- );
-
- $schema_data['phpbb_styles'] = array(
- 'COLUMNS' => array(
- 'style_id' => array('UINT', NULL, 'auto_increment'),
- 'style_name' => array('VCHAR_UNI:255', ''),
- 'style_copyright' => array('VCHAR_UNI', ''),
- 'style_active' => array('BOOL', 1),
- 'style_path' => array('VCHAR:100', ''),
- 'bbcode_bitfield' => array('VCHAR:255', 'kNg='),
- 'style_parent_id' => array('UINT:4', 0),
- 'style_parent_tree' => array('TEXT', ''),
- ),
- 'PRIMARY_KEY' => 'style_id',
- 'KEYS' => array(
- 'style_name' => array('UNIQUE', 'style_name'),
- ),
- );
-
- $schema_data['phpbb_teampage'] = array(
- 'COLUMNS' => array(
- 'teampage_id' => array('UINT', NULL, 'auto_increment'),
- 'group_id' => array('UINT', 0),
- 'teampage_name' => array('VCHAR_UNI:255', ''),
- 'teampage_position' => array('UINT', 0),
- 'teampage_parent' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => 'teampage_id',
- );
-
- $schema_data['phpbb_topics'] = array(
- 'COLUMNS' => array(
- 'topic_id' => array('UINT', NULL, 'auto_increment'),
- 'forum_id' => array('UINT', 0),
- 'icon_id' => array('UINT', 0),
- 'topic_attachment' => array('BOOL', 0),
- 'topic_visibility' => array('TINT:3', 0),
- 'topic_reported' => array('BOOL', 0),
- 'topic_title' => array('STEXT_UNI', '', 'true_sort'),
- 'topic_poster' => array('UINT', 0),
- 'topic_time' => array('TIMESTAMP', 0),
- 'topic_time_limit' => array('TIMESTAMP', 0),
- 'topic_views' => array('UINT', 0),
- 'topic_posts_approved' => array('UINT', 0),
- 'topic_posts_unapproved' => array('UINT', 0),
- 'topic_posts_softdeleted' => array('UINT', 0),
- 'topic_status' => array('TINT:3', 0),
- 'topic_type' => array('TINT:3', 0),
- 'topic_first_post_id' => array('UINT', 0),
- 'topic_first_poster_name' => array('VCHAR_UNI', ''),
- 'topic_first_poster_colour' => array('VCHAR:6', ''),
- 'topic_last_post_id' => array('UINT', 0),
- 'topic_last_poster_id' => array('UINT', 0),
- 'topic_last_poster_name' => array('VCHAR_UNI', ''),
- 'topic_last_poster_colour' => array('VCHAR:6', ''),
- 'topic_last_post_subject' => array('STEXT_UNI', ''),
- 'topic_last_post_time' => array('TIMESTAMP', 0),
- 'topic_last_view_time' => array('TIMESTAMP', 0),
- 'topic_moved_id' => array('UINT', 0),
- 'topic_bumped' => array('BOOL', 0),
- 'topic_bumper' => array('UINT', 0),
- 'poll_title' => array('STEXT_UNI', ''),
- 'poll_start' => array('TIMESTAMP', 0),
- 'poll_length' => array('TIMESTAMP', 0),
- 'poll_max_options' => array('TINT:4', 1),
- 'poll_last_vote' => array('TIMESTAMP', 0),
- 'poll_vote_change' => array('BOOL', 0),
- 'topic_delete_time' => array('TIMESTAMP', 0),
- 'topic_delete_reason' => array('STEXT_UNI', ''),
- 'topic_delete_user' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => 'topic_id',
- 'KEYS' => array(
- 'forum_id' => array('INDEX', 'forum_id'),
- 'forum_id_type' => array('INDEX', array('forum_id', 'topic_type')),
- 'last_post_time' => array('INDEX', 'topic_last_post_time'),
- 'topic_visibility' => array('INDEX', 'topic_visibility'),
- 'forum_appr_last' => array('INDEX', array('forum_id', 'topic_visibility', 'topic_last_post_id')),
- 'fid_time_moved' => array('INDEX', array('forum_id', 'topic_last_post_time', 'topic_moved_id')),
- ),
- );
-
- $schema_data['phpbb_topics_track'] = array(
- 'COLUMNS' => array(
- 'user_id' => array('UINT', 0),
- 'topic_id' => array('UINT', 0),
- 'forum_id' => array('UINT', 0),
- 'mark_time' => array('TIMESTAMP', 0),
- ),
- 'PRIMARY_KEY' => array('user_id', 'topic_id'),
- 'KEYS' => array(
- 'topic_id' => array('INDEX', 'topic_id'),
- 'forum_id' => array('INDEX', 'forum_id'),
- ),
- );
-
- $schema_data['phpbb_topics_posted'] = array(
- 'COLUMNS' => array(
- 'user_id' => array('UINT', 0),
- 'topic_id' => array('UINT', 0),
- 'topic_posted' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => array('user_id', 'topic_id'),
- );
-
- $schema_data['phpbb_topics_watch'] = array(
- 'COLUMNS' => array(
- 'topic_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- 'notify_status' => array('BOOL', 0),
- ),
- 'KEYS' => array(
- 'topic_id' => array('INDEX', 'topic_id'),
- 'user_id' => array('INDEX', 'user_id'),
- 'notify_stat' => array('INDEX', 'notify_status'),
- ),
- );
-
- $schema_data['phpbb_user_notifications'] = array(
- 'COLUMNS' => array(
- 'item_type' => array('VCHAR:255', ''),
- 'item_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- 'method' => array('VCHAR:255', ''),
- 'notify' => array('BOOL', 1),
- ),
- );
-
- $schema_data['phpbb_user_group'] = array(
- 'COLUMNS' => array(
- 'group_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- 'group_leader' => array('BOOL', 0),
- 'user_pending' => array('BOOL', 1),
- ),
- 'KEYS' => array(
- 'group_id' => array('INDEX', 'group_id'),
- 'user_id' => array('INDEX', 'user_id'),
- 'group_leader' => array('INDEX', 'group_leader'),
- ),
- );
-
- $schema_data['phpbb_users'] = array(
- 'COLUMNS' => array(
- 'user_id' => array('UINT', NULL, 'auto_increment'),
- 'user_type' => array('TINT:2', 0),
- 'group_id' => array('UINT', 3),
- 'user_permissions' => array('MTEXT', ''),
- 'user_perm_from' => array('UINT', 0),
- 'user_ip' => array('VCHAR:40', ''),
- 'user_regdate' => array('TIMESTAMP', 0),
- 'username' => array('VCHAR_CI', ''),
- 'username_clean' => array('VCHAR_CI', ''),
- 'user_password' => array('VCHAR_CI', ''),
- 'user_passchg' => array('TIMESTAMP', 0),
- 'user_pass_convert' => array('BOOL', 0),
- 'user_email' => array('VCHAR_UNI:100', ''),
- 'user_email_hash' => array('BINT', 0),
- 'user_birthday' => array('VCHAR:10', ''),
- 'user_lastvisit' => array('TIMESTAMP', 0),
- 'user_lastmark' => array('TIMESTAMP', 0),
- 'user_lastpost_time' => array('TIMESTAMP', 0),
- 'user_lastpage' => array('VCHAR_UNI:200', ''),
- 'user_last_confirm_key' => array('VCHAR:10', ''),
- 'user_last_search' => array('TIMESTAMP', 0),
- 'user_warnings' => array('TINT:4', 0),
- 'user_last_warning' => array('TIMESTAMP', 0),
- 'user_login_attempts' => array('TINT:4', 0),
- 'user_inactive_reason' => array('TINT:2', 0),
- 'user_inactive_time' => array('TIMESTAMP', 0),
- 'user_posts' => array('UINT', 0),
- 'user_lang' => array('VCHAR:30', ''),
- 'user_timezone' => array('VCHAR:100', 'UTC'),
- 'user_dateformat' => array('VCHAR_UNI:30', 'd M Y H:i'),
- 'user_style' => array('UINT', 0),
- 'user_rank' => array('UINT', 0),
- 'user_colour' => array('VCHAR:6', ''),
- 'user_new_privmsg' => array('INT:4', 0),
- 'user_unread_privmsg' => array('INT:4', 0),
- 'user_last_privmsg' => array('TIMESTAMP', 0),
- 'user_message_rules' => array('BOOL', 0),
- 'user_full_folder' => array('INT:11', -3),
- 'user_emailtime' => array('TIMESTAMP', 0),
- 'user_topic_show_days' => array('USINT', 0),
- 'user_topic_sortby_type' => array('VCHAR:1', 't'),
- 'user_topic_sortby_dir' => array('VCHAR:1', 'd'),
- 'user_post_show_days' => array('USINT', 0),
- 'user_post_sortby_type' => array('VCHAR:1', 't'),
- 'user_post_sortby_dir' => array('VCHAR:1', 'a'),
- 'user_notify' => array('BOOL', 0),
- 'user_notify_pm' => array('BOOL', 1),
- 'user_notify_type' => array('TINT:4', 0),
- 'user_allow_pm' => array('BOOL', 1),
- 'user_allow_viewonline' => array('BOOL', 1),
- 'user_allow_viewemail' => array('BOOL', 1),
- 'user_allow_massemail' => array('BOOL', 1),
- 'user_options' => array('UINT:11', 230271),
- 'user_avatar' => array('VCHAR', ''),
- 'user_avatar_type' => array('VCHAR:255', ''),
- 'user_avatar_width' => array('USINT', 0),
- 'user_avatar_height' => array('USINT', 0),
- 'user_sig' => array('MTEXT_UNI', ''),
- 'user_sig_bbcode_uid' => array('VCHAR:8', ''),
- 'user_sig_bbcode_bitfield' => array('VCHAR:255', ''),
- 'user_from' => array('VCHAR_UNI:100', ''),
- 'user_icq' => array('VCHAR:15', ''),
- 'user_aim' => array('VCHAR_UNI', ''),
- 'user_yim' => array('VCHAR_UNI', ''),
- 'user_msnm' => array('VCHAR_UNI', ''),
- 'user_jabber' => array('VCHAR_UNI', ''),
- 'user_website' => array('VCHAR_UNI:200', ''),
- 'user_occ' => array('TEXT_UNI', ''),
- 'user_interests' => array('TEXT_UNI', ''),
- 'user_actkey' => array('VCHAR:32', ''),
- 'user_newpasswd' => array('VCHAR_UNI:40', ''),
- 'user_form_salt' => array('VCHAR_UNI:32', ''),
- 'user_new' => array('BOOL', 1),
- 'user_reminded' => array('TINT:4', 0),
- 'user_reminded_time' => array('TIMESTAMP', 0),
- ),
- 'PRIMARY_KEY' => 'user_id',
- 'KEYS' => array(
- 'user_birthday' => array('INDEX', 'user_birthday'),
- 'user_email_hash' => array('INDEX', 'user_email_hash'),
- 'user_type' => array('INDEX', 'user_type'),
- 'username_clean' => array('UNIQUE', 'username_clean'),
- ),
- );
-
- $schema_data['phpbb_warnings'] = array(
- 'COLUMNS' => array(
- 'warning_id' => array('UINT', NULL, 'auto_increment'),
- 'user_id' => array('UINT', 0),
- 'post_id' => array('UINT', 0),
- 'log_id' => array('UINT', 0),
- 'warning_time' => array('TIMESTAMP', 0),
- ),
- 'PRIMARY_KEY' => 'warning_id',
- );
-
- $schema_data['phpbb_words'] = array(
- 'COLUMNS' => array(
- 'word_id' => array('UINT', NULL, 'auto_increment'),
- 'word' => array('VCHAR_UNI', ''),
- 'replacement' => array('VCHAR_UNI', ''),
- ),
- 'PRIMARY_KEY' => 'word_id',
- );
-
- $schema_data['phpbb_zebra'] = array(
- 'COLUMNS' => array(
- 'user_id' => array('UINT', 0),
- 'zebra_id' => array('UINT', 0),
- 'friend' => array('BOOL', 0),
- 'foe' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => array('user_id', 'zebra_id'),
- );
-
- return $schema_data;
-}
-
-
/**
* Data put into the header for various dbms
*/
diff --git a/phpBB/develop/mysql_upgrader.php b/phpBB/develop/mysql_upgrader.php
index f5e7e97400..eb34034826 100644
--- a/phpBB/develop/mysql_upgrader.php
+++ b/phpBB/develop/mysql_upgrader.php
@@ -56,68 +56,10 @@ echo "USE $dbname;$newline$newline";
@set_time_limit(0);
-$schema_data = get_schema_struct();
-$dbms_type_map = array(
- 'mysql_41' => array(
- 'INT:' => 'int(%d)',
- 'BINT' => 'bigint(20)',
- 'UINT' => 'mediumint(8) UNSIGNED',
- 'UINT:' => 'int(%d) UNSIGNED',
- 'TINT:' => 'tinyint(%d)',
- 'USINT' => 'smallint(4) UNSIGNED',
- 'BOOL' => 'tinyint(1) UNSIGNED',
- 'VCHAR' => 'varchar(255)',
- 'VCHAR:' => 'varchar(%d)',
- 'CHAR:' => 'char(%d)',
- 'XSTEXT' => 'text',
- 'XSTEXT_UNI'=> 'varchar(100)',
- 'STEXT' => 'text',
- 'STEXT_UNI' => 'varchar(255)',
- 'TEXT' => 'text',
- 'TEXT_UNI' => 'text',
- 'MTEXT' => 'mediumtext',
- 'MTEXT_UNI' => 'mediumtext',
- 'TIMESTAMP' => 'int(11) UNSIGNED',
- 'DECIMAL' => 'decimal(5,2)',
- 'DECIMAL:' => 'decimal(%d,2)',
- 'PDECIMAL' => 'decimal(6,3)',
- 'PDECIMAL:' => 'decimal(%d,3)',
- 'VCHAR_UNI' => 'varchar(255)',
- 'VCHAR_UNI:'=> 'varchar(%d)',
- 'VCHAR_CI' => 'varchar(255)',
- 'VARBINARY' => 'varbinary(255)',
- ),
+require($phpbb_root_path . 'includes/db/schema_data.' . $phpEx);
+require($phpbb_root_path . 'phpbb/db/tools.' . $phpEx);
- 'mysql_40' => array(
- 'INT:' => 'int(%d)',
- 'BINT' => 'bigint(20)',
- 'UINT' => 'mediumint(8) UNSIGNED',
- 'UINT:' => 'int(%d) UNSIGNED',
- 'TINT:' => 'tinyint(%d)',
- 'USINT' => 'smallint(4) UNSIGNED',
- 'BOOL' => 'tinyint(1) UNSIGNED',
- 'VCHAR' => 'varbinary(255)',
- 'VCHAR:' => 'varbinary(%d)',
- 'CHAR:' => 'binary(%d)',
- 'XSTEXT' => 'blob',
- 'XSTEXT_UNI'=> 'blob',
- 'STEXT' => 'blob',
- 'STEXT_UNI' => 'blob',
- 'TEXT' => 'blob',
- 'TEXT_UNI' => 'blob',
- 'MTEXT' => 'mediumblob',
- 'MTEXT_UNI' => 'mediumblob',
- 'TIMESTAMP' => 'int(11) UNSIGNED',
- 'DECIMAL' => 'decimal(5,2)',
- 'DECIMAL:' => 'decimal(%d,2)',
- 'PDECIMAL' => 'decimal(6,3)',
- 'PDECIMAL:' => 'decimal(%d,3)',
- 'VCHAR_UNI' => 'blob',
- 'VCHAR_UNI:'=> array('varbinary(%d)', 'limit' => array('mult', 3, 255, 'blob')),
- 'VCHAR_CI' => 'blob',
- 'VARBINARY' => 'varbinary(255)',
- ),
-);
+$dbms_type_map = phpbb\db\tools::get_dbms_type_map();
foreach ($schema_data as $table_name => $table_data)
{
@@ -255,1090 +197,3 @@ foreach ($schema_data as $table_name => $table_data)
echo "ALTER TABLE $table_name ADD FULLTEXT (post_subject), ADD FULLTEXT (post_text), ADD FULLTEXT post_content (post_subject, post_text);{$newline}";
}
}
-
-/**
-* Define the basic structure
-* The format:
-* array('{TABLE_NAME}' => {TABLE_DATA})
-* {TABLE_DATA}:
-* COLUMNS = array({column_name} = array({column_type}, {default}, {auto_increment}))
-* PRIMARY_KEY = {column_name(s)}
-* KEYS = array({key_name} = array({key_type}, {column_name(s)})),
-*
-* Column Types:
-* INT:x => SIGNED int(x)
-* BINT => BIGINT
-* UINT => mediumint(8) UNSIGNED
-* UINT:x => int(x) UNSIGNED
-* TINT:x => tinyint(x)
-* USINT => smallint(4) UNSIGNED (for _order columns)
-* BOOL => tinyint(1) UNSIGNED
-* VCHAR => varchar(255)
-* CHAR:x => char(x)
-* XSTEXT_UNI => text for storing 100 characters (topic_title for example)
-* STEXT_UNI => text for storing 255 characters (normal input field with a max of 255 single-byte chars) - same as VCHAR_UNI
-* TEXT_UNI => text for storing 3000 characters (short text, descriptions, comments, etc.)
-* MTEXT_UNI => mediumtext (post text, large text)
-* VCHAR:x => varchar(x)
-* TIMESTAMP => int(11) UNSIGNED
-* DECIMAL => decimal number (5,2)
-* DECIMAL: => decimal number (x,2)
-* PDECIMAL => precision decimal number (6,3)
-* PDECIMAL: => precision decimal number (x,3)
-* VCHAR_UNI => varchar(255) BINARY
-* VCHAR_CI => varchar_ci for postgresql, others VCHAR
-*/
-function get_schema_struct()
-{
- $schema_data = array();
-
- $schema_data['phpbb_attachments'] = array(
- 'COLUMNS' => array(
- 'attach_id' => array('UINT', NULL, 'auto_increment'),
- 'post_msg_id' => array('UINT', 0),
- 'topic_id' => array('UINT', 0),
- 'in_message' => array('BOOL', 0),
- 'poster_id' => array('UINT', 0),
- 'is_orphan' => array('BOOL', 1),
- 'physical_filename' => array('VCHAR', ''),
- 'real_filename' => array('VCHAR', ''),
- 'download_count' => array('UINT', 0),
- 'attach_comment' => array('TEXT_UNI', ''),
- 'extension' => array('VCHAR:100', ''),
- 'mimetype' => array('VCHAR:100', ''),
- 'filesize' => array('UINT:20', 0),
- 'filetime' => array('TIMESTAMP', 0),
- 'thumbnail' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => 'attach_id',
- 'KEYS' => array(
- 'filetime' => array('INDEX', 'filetime'),
- 'post_msg_id' => array('INDEX', 'post_msg_id'),
- 'topic_id' => array('INDEX', 'topic_id'),
- 'poster_id' => array('INDEX', 'poster_id'),
- 'is_orphan' => array('INDEX', 'is_orphan'),
- ),
- );
-
- $schema_data['phpbb_acl_groups'] = array(
- 'COLUMNS' => array(
- 'group_id' => array('UINT', 0),
- 'forum_id' => array('UINT', 0),
- 'auth_option_id' => array('UINT', 0),
- 'auth_role_id' => array('UINT', 0),
- 'auth_setting' => array('TINT:2', 0),
- ),
- 'KEYS' => array(
- 'group_id' => array('INDEX', 'group_id'),
- 'auth_opt_id' => array('INDEX', 'auth_option_id'),
- 'auth_role_id' => array('INDEX', 'auth_role_id'),
- ),
- );
-
- $schema_data['phpbb_acl_options'] = array(
- 'COLUMNS' => array(
- 'auth_option_id' => array('UINT', NULL, 'auto_increment'),
- 'auth_option' => array('VCHAR:50', ''),
- 'is_global' => array('BOOL', 0),
- 'is_local' => array('BOOL', 0),
- 'founder_only' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => 'auth_option_id',
- 'KEYS' => array(
- 'auth_option' => array('UNIQUE', 'auth_option'),
- ),
- );
-
- $schema_data['phpbb_acl_roles'] = array(
- 'COLUMNS' => array(
- 'role_id' => array('UINT', NULL, 'auto_increment'),
- 'role_name' => array('VCHAR_UNI', ''),
- 'role_description' => array('TEXT_UNI', ''),
- 'role_type' => array('VCHAR:10', ''),
- 'role_order' => array('USINT', 0),
- ),
- 'PRIMARY_KEY' => 'role_id',
- 'KEYS' => array(
- 'role_type' => array('INDEX', 'role_type'),
- 'role_order' => array('INDEX', 'role_order'),
- ),
- );
-
- $schema_data['phpbb_acl_roles_data'] = array(
- 'COLUMNS' => array(
- 'role_id' => array('UINT', 0),
- 'auth_option_id' => array('UINT', 0),
- 'auth_setting' => array('TINT:2', 0),
- ),
- 'PRIMARY_KEY' => array('role_id', 'auth_option_id'),
- 'KEYS' => array(
- 'ath_op_id' => array('INDEX', 'auth_option_id'),
- ),
- );
-
- $schema_data['phpbb_acl_users'] = array(
- 'COLUMNS' => array(
- 'user_id' => array('UINT', 0),
- 'forum_id' => array('UINT', 0),
- 'auth_option_id' => array('UINT', 0),
- 'auth_role_id' => array('UINT', 0),
- 'auth_setting' => array('TINT:2', 0),
- ),
- 'KEYS' => array(
- 'user_id' => array('INDEX', 'user_id'),
- 'auth_option_id' => array('INDEX', 'auth_option_id'),
- 'auth_role_id' => array('INDEX', 'auth_role_id'),
- ),
- );
-
- $schema_data['phpbb_banlist'] = array(
- 'COLUMNS' => array(
- 'ban_id' => array('UINT', NULL, 'auto_increment'),
- 'ban_userid' => array('UINT', 0),
- 'ban_ip' => array('VCHAR:40', ''),
- 'ban_email' => array('VCHAR_UNI:100', ''),
- 'ban_start' => array('TIMESTAMP', 0),
- 'ban_end' => array('TIMESTAMP', 0),
- 'ban_exclude' => array('BOOL', 0),
- 'ban_reason' => array('VCHAR_UNI', ''),
- 'ban_give_reason' => array('VCHAR_UNI', ''),
- ),
- 'PRIMARY_KEY' => 'ban_id',
- 'KEYS' => array(
- 'ban_end' => array('INDEX', 'ban_end'),
- 'ban_user' => array('INDEX', array('ban_userid', 'ban_exclude')),
- 'ban_email' => array('INDEX', array('ban_email', 'ban_exclude')),
- 'ban_ip' => array('INDEX', array('ban_ip', 'ban_exclude')),
- ),
- );
-
- $schema_data['phpbb_bbcodes'] = array(
- 'COLUMNS' => array(
- 'bbcode_id' => array('USINT', 0),
- 'bbcode_tag' => array('VCHAR:16', ''),
- 'bbcode_helpline' => array('VCHAR_UNI', ''),
- 'display_on_posting' => array('BOOL', 0),
- 'bbcode_match' => array('TEXT_UNI', ''),
- 'bbcode_tpl' => array('MTEXT_UNI', ''),
- 'first_pass_match' => array('MTEXT_UNI', ''),
- 'first_pass_replace' => array('MTEXT_UNI', ''),
- 'second_pass_match' => array('MTEXT_UNI', ''),
- 'second_pass_replace' => array('MTEXT_UNI', ''),
- ),
- 'PRIMARY_KEY' => 'bbcode_id',
- 'KEYS' => array(
- 'display_on_post' => array('INDEX', 'display_on_posting'),
- ),
- );
-
- $schema_data['phpbb_bookmarks'] = array(
- 'COLUMNS' => array(
- 'topic_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => array('topic_id', 'user_id'),
- );
-
- $schema_data['phpbb_bots'] = array(
- 'COLUMNS' => array(
- 'bot_id' => array('UINT', NULL, 'auto_increment'),
- 'bot_active' => array('BOOL', 1),
- 'bot_name' => array('STEXT_UNI', ''),
- 'user_id' => array('UINT', 0),
- 'bot_agent' => array('VCHAR', ''),
- 'bot_ip' => array('VCHAR', ''),
- ),
- 'PRIMARY_KEY' => 'bot_id',
- 'KEYS' => array(
- 'bot_active' => array('INDEX', 'bot_active'),
- ),
- );
-
- $schema_data['phpbb_config'] = array(
- 'COLUMNS' => array(
- 'config_name' => array('VCHAR', ''),
- 'config_value' => array('VCHAR_UNI', ''),
- 'is_dynamic' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => 'config_name',
- 'KEYS' => array(
- 'is_dynamic' => array('INDEX', 'is_dynamic'),
- ),
- );
-
- $schema_data['phpbb_confirm'] = array(
- 'COLUMNS' => array(
- 'confirm_id' => array('CHAR:32', ''),
- 'session_id' => array('CHAR:32', ''),
- 'confirm_type' => array('TINT:3', 0),
- 'code' => array('VCHAR:8', ''),
- 'seed' => array('UINT:10', 0),
- 'attempts' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => array('session_id', 'confirm_id'),
- 'KEYS' => array(
- 'confirm_type' => array('INDEX', 'confirm_type'),
- ),
- );
-
- $schema_data['phpbb_disallow'] = array(
- 'COLUMNS' => array(
- 'disallow_id' => array('UINT', NULL, 'auto_increment'),
- 'disallow_username' => array('VCHAR_UNI:255', ''),
- ),
- 'PRIMARY_KEY' => 'disallow_id',
- );
-
- $schema_data['phpbb_drafts'] = array(
- 'COLUMNS' => array(
- 'draft_id' => array('UINT', NULL, 'auto_increment'),
- 'user_id' => array('UINT', 0),
- 'topic_id' => array('UINT', 0),
- 'forum_id' => array('UINT', 0),
- 'save_time' => array('TIMESTAMP', 0),
- 'draft_subject' => array('STEXT_UNI', ''),
- 'draft_message' => array('MTEXT_UNI', ''),
- ),
- 'PRIMARY_KEY' => 'draft_id',
- 'KEYS' => array(
- 'save_time' => array('INDEX', 'save_time'),
- ),
- );
-
- $schema_data['phpbb_extensions'] = array(
- 'COLUMNS' => array(
- 'extension_id' => array('UINT', NULL, 'auto_increment'),
- 'group_id' => array('UINT', 0),
- 'extension' => array('VCHAR:100', ''),
- ),
- 'PRIMARY_KEY' => 'extension_id',
- );
-
- $schema_data['phpbb_extension_groups'] = array(
- 'COLUMNS' => array(
- 'group_id' => array('UINT', NULL, 'auto_increment'),
- 'group_name' => array('VCHAR_UNI', ''),
- 'cat_id' => array('TINT:2', 0),
- 'allow_group' => array('BOOL', 0),
- 'download_mode' => array('BOOL', 1),
- 'upload_icon' => array('VCHAR', ''),
- 'max_filesize' => array('UINT:20', 0),
- 'allowed_forums' => array('TEXT', ''),
- 'allow_in_pm' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => 'group_id',
- );
-
- $schema_data['phpbb_forums'] = array(
- 'COLUMNS' => array(
- 'forum_id' => array('UINT', NULL, 'auto_increment'),
- 'parent_id' => array('UINT', 0),
- 'left_id' => array('UINT', 0),
- 'right_id' => array('UINT', 0),
- 'forum_parents' => array('MTEXT', ''),
- 'forum_name' => array('STEXT_UNI', ''),
- 'forum_desc' => array('TEXT_UNI', ''),
- 'forum_desc_bitfield' => array('VCHAR:255', ''),
- 'forum_desc_options' => array('UINT:11', 7),
- 'forum_desc_uid' => array('VCHAR:8', ''),
- 'forum_link' => array('VCHAR_UNI', ''),
- 'forum_password' => array('VCHAR_UNI:40', ''),
- 'forum_style' => array('UINT', 0),
- 'forum_image' => array('VCHAR', ''),
- 'forum_rules' => array('TEXT_UNI', ''),
- 'forum_rules_link' => array('VCHAR_UNI', ''),
- 'forum_rules_bitfield' => array('VCHAR:255', ''),
- 'forum_rules_options' => array('UINT:11', 7),
- 'forum_rules_uid' => array('VCHAR:8', ''),
- 'forum_topics_per_page' => array('TINT:4', 0),
- 'forum_type' => array('TINT:4', 0),
- 'forum_status' => array('TINT:4', 0),
- 'forum_posts_approved' => array('UINT', 0),
- 'forum_posts_unapproved' => array('UINT', 0),
- 'forum_posts_softdeleted' => array('UINT', 0),
- 'forum_topics_approved' => array('UINT', 0),
- 'forum_topics_unapproved' => array('UINT', 0),
- 'forum_topics_softdeleted' => array('UINT', 0),
- 'forum_last_post_id' => array('UINT', 0),
- 'forum_last_poster_id' => array('UINT', 0),
- 'forum_last_post_subject' => array('STEXT_UNI', ''),
- 'forum_last_post_time' => array('TIMESTAMP', 0),
- 'forum_last_poster_name'=> array('VCHAR_UNI', ''),
- 'forum_last_poster_colour'=> array('VCHAR:6', ''),
- 'forum_flags' => array('TINT:4', 32),
- 'forum_options' => array('UINT:20', 0),
- 'display_subforum_list' => array('BOOL', 1),
- 'display_on_index' => array('BOOL', 1),
- 'enable_indexing' => array('BOOL', 1),
- 'enable_icons' => array('BOOL', 1),
- 'enable_prune' => array('BOOL', 0),
- 'prune_next' => array('TIMESTAMP', 0),
- 'prune_days' => array('UINT', 0),
- 'prune_viewed' => array('UINT', 0),
- 'prune_freq' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => 'forum_id',
- 'KEYS' => array(
- 'left_right_id' => array('INDEX', array('left_id', 'right_id')),
- 'forum_lastpost_id' => array('INDEX', 'forum_last_post_id'),
- ),
- );
-
- $schema_data['phpbb_forums_access'] = array(
- 'COLUMNS' => array(
- 'forum_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- 'session_id' => array('CHAR:32', ''),
- ),
- 'PRIMARY_KEY' => array('forum_id', 'user_id', 'session_id'),
- );
-
- $schema_data['phpbb_forums_track'] = array(
- 'COLUMNS' => array(
- 'user_id' => array('UINT', 0),
- 'forum_id' => array('UINT', 0),
- 'mark_time' => array('TIMESTAMP', 0),
- ),
- 'PRIMARY_KEY' => array('user_id', 'forum_id'),
- );
-
- $schema_data['phpbb_forums_watch'] = array(
- 'COLUMNS' => array(
- 'forum_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- 'notify_status' => array('BOOL', 0),
- ),
- 'KEYS' => array(
- 'forum_id' => array('INDEX', 'forum_id'),
- 'user_id' => array('INDEX', 'user_id'),
- 'notify_stat' => array('INDEX', 'notify_status'),
- ),
- );
-
- $schema_data['phpbb_groups'] = array(
- 'COLUMNS' => array(
- 'group_id' => array('UINT', NULL, 'auto_increment'),
- 'group_type' => array('TINT:4', 1),
- 'group_founder_manage' => array('BOOL', 0),
- 'group_skip_auth' => array('BOOL', 0),
- 'group_name' => array('VCHAR_CI', ''),
- 'group_desc' => array('TEXT_UNI', ''),
- 'group_desc_bitfield' => array('VCHAR:255', ''),
- 'group_desc_options' => array('UINT:11', 7),
- 'group_desc_uid' => array('VCHAR:8', ''),
- 'group_display' => array('BOOL', 0),
- 'group_avatar' => array('VCHAR', ''),
- 'group_avatar_type' => array('TINT:2', 0),
- 'group_avatar_width' => array('USINT', 0),
- 'group_avatar_height' => array('USINT', 0),
- 'group_rank' => array('UINT', 0),
- 'group_colour' => array('VCHAR:6', ''),
- 'group_sig_chars' => array('UINT', 0),
- 'group_receive_pm' => array('BOOL', 0),
- 'group_message_limit' => array('UINT', 0),
- 'group_max_recipients' => array('UINT', 0),
- 'group_legend' => array('BOOL', 1),
- ),
- 'PRIMARY_KEY' => 'group_id',
- 'KEYS' => array(
- 'group_legend_name' => array('INDEX', array('group_legend', 'group_name')),
- ),
- );
-
- $schema_data['phpbb_icons'] = array(
- 'COLUMNS' => array(
- 'icons_id' => array('UINT', NULL, 'auto_increment'),
- 'icons_url' => array('VCHAR', ''),
- 'icons_width' => array('TINT:4', 0),
- 'icons_height' => array('TINT:4', 0),
- 'icons_order' => array('UINT', 0),
- 'display_on_posting' => array('BOOL', 1),
- ),
- 'PRIMARY_KEY' => 'icons_id',
- 'KEYS' => array(
- 'display_on_posting' => array('INDEX', 'display_on_posting'),
- ),
- );
-
- $schema_data['phpbb_lang'] = array(
- 'COLUMNS' => array(
- 'lang_id' => array('TINT:4', NULL, 'auto_increment'),
- 'lang_iso' => array('VCHAR:30', ''),
- 'lang_dir' => array('VCHAR:30', ''),
- 'lang_english_name' => array('VCHAR_UNI:100', ''),
- 'lang_local_name' => array('VCHAR_UNI:255', ''),
- 'lang_author' => array('VCHAR_UNI:255', ''),
- ),
- 'PRIMARY_KEY' => 'lang_id',
- 'KEYS' => array(
- 'lang_iso' => array('INDEX', 'lang_iso'),
- ),
- );
-
- $schema_data['phpbb_log'] = array(
- 'COLUMNS' => array(
- 'log_id' => array('UINT', NULL, 'auto_increment'),
- 'log_type' => array('TINT:4', 0),
- 'user_id' => array('UINT', 0),
- 'forum_id' => array('UINT', 0),
- 'topic_id' => array('UINT', 0),
- 'reportee_id' => array('UINT', 0),
- 'log_ip' => array('VCHAR:40', ''),
- 'log_time' => array('TIMESTAMP', 0),
- 'log_operation' => array('TEXT_UNI', ''),
- 'log_data' => array('MTEXT_UNI', ''),
- ),
- 'PRIMARY_KEY' => 'log_id',
- 'KEYS' => array(
- 'log_type' => array('INDEX', 'log_type'),
- 'log_time' => array('INDEX', 'log_time'),
- 'forum_id' => array('INDEX', 'forum_id'),
- 'topic_id' => array('INDEX', 'topic_id'),
- 'reportee_id' => array('INDEX', 'reportee_id'),
- 'user_id' => array('INDEX', 'user_id'),
- ),
- );
-
- $schema_data['phpbb_login_attempts'] = array(
- 'COLUMNS' => array(
- 'attempt_ip' => array('VCHAR:40', ''),
- 'attempt_browser' => array('VCHAR:150', ''),
- 'attempt_forwarded_for' => array('VCHAR:255', ''),
- 'attempt_time' => array('TIMESTAMP', 0),
- 'user_id' => array('UINT', 0),
- 'username' => array('VCHAR_UNI:255', 0),
- 'username_clean' => array('VCHAR_CI', 0),
- ),
- 'KEYS' => array(
- 'att_ip' => array('INDEX', array('attempt_ip', 'attempt_time')),
- 'att_for' => array('INDEX', array('attempt_forwarded_for', 'attempt_time')),
- 'att_time' => array('INDEX', array('attempt_time')),
- 'user_id' => array('INDEX', 'user_id'),
- ),
- );
-
- $schema_data['phpbb_moderator_cache'] = array(
- 'COLUMNS' => array(
- 'forum_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- 'username' => array('VCHAR_UNI:255', ''),
- 'group_id' => array('UINT', 0),
- 'group_name' => array('VCHAR_UNI', ''),
- 'display_on_index' => array('BOOL', 1),
- ),
- 'KEYS' => array(
- 'disp_idx' => array('INDEX', 'display_on_index'),
- 'forum_id' => array('INDEX', 'forum_id'),
- ),
- );
-
- $schema_data['phpbb_modules'] = array(
- 'COLUMNS' => array(
- 'module_id' => array('UINT', NULL, 'auto_increment'),
- 'module_enabled' => array('BOOL', 1),
- 'module_display' => array('BOOL', 1),
- 'module_basename' => array('VCHAR', ''),
- 'module_class' => array('VCHAR:10', ''),
- 'parent_id' => array('UINT', 0),
- 'left_id' => array('UINT', 0),
- 'right_id' => array('UINT', 0),
- 'module_langname' => array('VCHAR', ''),
- 'module_mode' => array('VCHAR', ''),
- 'module_auth' => array('VCHAR', ''),
- ),
- 'PRIMARY_KEY' => 'module_id',
- 'KEYS' => array(
- 'left_right_id' => array('INDEX', array('left_id', 'right_id')),
- 'module_enabled' => array('INDEX', 'module_enabled'),
- 'class_left_id' => array('INDEX', array('module_class', 'left_id')),
- ),
- );
-
- $schema_data['phpbb_poll_options'] = array(
- 'COLUMNS' => array(
- 'poll_option_id' => array('TINT:4', 0),
- 'topic_id' => array('UINT', 0),
- 'poll_option_text' => array('TEXT_UNI', ''),
- 'poll_option_total' => array('UINT', 0),
- ),
- 'KEYS' => array(
- 'poll_opt_id' => array('INDEX', 'poll_option_id'),
- 'topic_id' => array('INDEX', 'topic_id'),
- ),
- );
-
- $schema_data['phpbb_poll_votes'] = array(
- 'COLUMNS' => array(
- 'topic_id' => array('UINT', 0),
- 'poll_option_id' => array('TINT:4', 0),
- 'vote_user_id' => array('UINT', 0),
- 'vote_user_ip' => array('VCHAR:40', ''),
- ),
- 'KEYS' => array(
- 'topic_id' => array('INDEX', 'topic_id'),
- 'vote_user_id' => array('INDEX', 'vote_user_id'),
- 'vote_user_ip' => array('INDEX', 'vote_user_ip'),
- ),
- );
-
- $schema_data['phpbb_posts'] = array(
- 'COLUMNS' => array(
- 'post_id' => array('UINT', NULL, 'auto_increment'),
- 'topic_id' => array('UINT', 0),
- 'forum_id' => array('UINT', 0),
- 'poster_id' => array('UINT', 0),
- 'icon_id' => array('UINT', 0),
- 'poster_ip' => array('VCHAR:40', ''),
- 'post_time' => array('TIMESTAMP', 0),
- 'post_visibility' => array('TINT:3', 0),
- 'post_reported' => array('BOOL', 0),
- 'enable_bbcode' => array('BOOL', 1),
- 'enable_smilies' => array('BOOL', 1),
- 'enable_magic_url' => array('BOOL', 1),
- 'enable_sig' => array('BOOL', 1),
- 'post_username' => array('VCHAR_UNI:255', ''),
- 'post_subject' => array('STEXT_UNI', '', 'true_sort'),
- 'post_text' => array('MTEXT_UNI', ''),
- 'post_checksum' => array('VCHAR:32', ''),
- 'post_attachment' => array('BOOL', 0),
- 'bbcode_bitfield' => array('VCHAR:255', ''),
- 'bbcode_uid' => array('VCHAR:8', ''),
- 'post_postcount' => array('BOOL', 1),
- 'post_edit_time' => array('TIMESTAMP', 0),
- 'post_edit_reason' => array('STEXT_UNI', ''),
- 'post_edit_user' => array('UINT', 0),
- 'post_edit_count' => array('USINT', 0),
- 'post_edit_locked' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => 'post_id',
- 'KEYS' => array(
- 'forum_id' => array('INDEX', 'forum_id'),
- 'topic_id' => array('INDEX', 'topic_id'),
- 'poster_ip' => array('INDEX', 'poster_ip'),
- 'poster_id' => array('INDEX', 'poster_id'),
- 'post_visibility' => array('INDEX', 'post_visibility'),
- 'post_username' => array('INDEX', 'post_username'),
- 'tid_post_time' => array('INDEX', array('topic_id', 'post_time')),
- ),
- );
-
- $schema_data['phpbb_privmsgs'] = array(
- 'COLUMNS' => array(
- 'msg_id' => array('UINT', NULL, 'auto_increment'),
- 'root_level' => array('UINT', 0),
- 'author_id' => array('UINT', 0),
- 'icon_id' => array('UINT', 0),
- 'author_ip' => array('VCHAR:40', ''),
- 'message_time' => array('TIMESTAMP', 0),
- 'enable_bbcode' => array('BOOL', 1),
- 'enable_smilies' => array('BOOL', 1),
- 'enable_magic_url' => array('BOOL', 1),
- 'enable_sig' => array('BOOL', 1),
- 'message_subject' => array('STEXT_UNI', ''),
- 'message_text' => array('MTEXT_UNI', ''),
- 'message_edit_reason' => array('STEXT_UNI', ''),
- 'message_edit_user' => array('UINT', 0),
- 'message_attachment' => array('BOOL', 0),
- 'bbcode_bitfield' => array('VCHAR:255', ''),
- 'bbcode_uid' => array('VCHAR:8', ''),
- 'message_edit_time' => array('TIMESTAMP', 0),
- 'message_edit_count' => array('USINT', 0),
- 'to_address' => array('TEXT_UNI', ''),
- 'bcc_address' => array('TEXT_UNI', ''),
- 'message_reported' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => 'msg_id',
- 'KEYS' => array(
- 'author_ip' => array('INDEX', 'author_ip'),
- 'message_time' => array('INDEX', 'message_time'),
- 'author_id' => array('INDEX', 'author_id'),
- 'root_level' => array('INDEX', 'root_level'),
- ),
- );
-
- $schema_data['phpbb_privmsgs_folder'] = array(
- 'COLUMNS' => array(
- 'folder_id' => array('UINT', NULL, 'auto_increment'),
- 'user_id' => array('UINT', 0),
- 'folder_name' => array('VCHAR_UNI', ''),
- 'pm_count' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => 'folder_id',
- 'KEYS' => array(
- 'user_id' => array('INDEX', 'user_id'),
- ),
- );
-
- $schema_data['phpbb_privmsgs_rules'] = array(
- 'COLUMNS' => array(
- 'rule_id' => array('UINT', NULL, 'auto_increment'),
- 'user_id' => array('UINT', 0),
- 'rule_check' => array('UINT', 0),
- 'rule_connection' => array('UINT', 0),
- 'rule_string' => array('VCHAR_UNI', ''),
- 'rule_user_id' => array('UINT', 0),
- 'rule_group_id' => array('UINT', 0),
- 'rule_action' => array('UINT', 0),
- 'rule_folder_id' => array('INT:11', 0),
- ),
- 'PRIMARY_KEY' => 'rule_id',
- 'KEYS' => array(
- 'user_id' => array('INDEX', 'user_id'),
- ),
- );
-
- $schema_data['phpbb_privmsgs_to'] = array(
- 'COLUMNS' => array(
- 'msg_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- 'author_id' => array('UINT', 0),
- 'pm_deleted' => array('BOOL', 0),
- 'pm_new' => array('BOOL', 1),
- 'pm_unread' => array('BOOL', 1),
- 'pm_replied' => array('BOOL', 0),
- 'pm_marked' => array('BOOL', 0),
- 'pm_forwarded' => array('BOOL', 0),
- 'folder_id' => array('INT:11', 0),
- ),
- 'KEYS' => array(
- 'msg_id' => array('INDEX', 'msg_id'),
- 'author_id' => array('INDEX', 'author_id'),
- 'usr_flder_id' => array('INDEX', array('user_id', 'folder_id')),
- ),
- );
-
- $schema_data['phpbb_profile_fields'] = array(
- 'COLUMNS' => array(
- 'field_id' => array('UINT', NULL, 'auto_increment'),
- 'field_name' => array('VCHAR_UNI', ''),
- 'field_type' => array('TINT:4', 0),
- 'field_ident' => array('VCHAR:20', ''),
- 'field_length' => array('VCHAR:20', ''),
- 'field_minlen' => array('VCHAR', ''),
- 'field_maxlen' => array('VCHAR', ''),
- 'field_novalue' => array('VCHAR_UNI', ''),
- 'field_default_value' => array('VCHAR_UNI', ''),
- 'field_validation' => array('VCHAR_UNI:20', ''),
- 'field_required' => array('BOOL', 0),
- 'field_show_novalue' => array('BOOL', 0),
- 'field_show_on_reg' => array('BOOL', 0),
- 'field_show_on_vt' => array('BOOL', 0),
- 'field_show_profile' => array('BOOL', 0),
- 'field_hide' => array('BOOL', 0),
- 'field_no_view' => array('BOOL', 0),
- 'field_active' => array('BOOL', 0),
- 'field_order' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => 'field_id',
- 'KEYS' => array(
- 'fld_type' => array('INDEX', 'field_type'),
- 'fld_ordr' => array('INDEX', 'field_order'),
- ),
- );
-
- $schema_data['phpbb_profile_fields_data'] = array(
- 'COLUMNS' => array(
- 'user_id' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => 'user_id',
- );
-
- $schema_data['phpbb_profile_fields_lang'] = array(
- 'COLUMNS' => array(
- 'field_id' => array('UINT', 0),
- 'lang_id' => array('UINT', 0),
- 'option_id' => array('UINT', 0),
- 'field_type' => array('TINT:4', 0),
- 'lang_value' => array('VCHAR_UNI', ''),
- ),
- 'PRIMARY_KEY' => array('field_id', 'lang_id', 'option_id'),
- );
-
- $schema_data['phpbb_profile_lang'] = array(
- 'COLUMNS' => array(
- 'field_id' => array('UINT', 0),
- 'lang_id' => array('UINT', 0),
- 'lang_name' => array('VCHAR_UNI', ''),
- 'lang_explain' => array('TEXT_UNI', ''),
- 'lang_default_value' => array('VCHAR_UNI', ''),
- ),
- 'PRIMARY_KEY' => array('field_id', 'lang_id'),
- );
-
- $schema_data['phpbb_ranks'] = array(
- 'COLUMNS' => array(
- 'rank_id' => array('UINT', NULL, 'auto_increment'),
- 'rank_title' => array('VCHAR_UNI', ''),
- 'rank_min' => array('UINT', 0),
- 'rank_special' => array('BOOL', 0),
- 'rank_image' => array('VCHAR', ''),
- ),
- 'PRIMARY_KEY' => 'rank_id',
- );
-
- $schema_data['phpbb_reports'] = array(
- 'COLUMNS' => array(
- 'report_id' => array('UINT', NULL, 'auto_increment'),
- 'reason_id' => array('USINT', 0),
- 'post_id' => array('UINT', 0),
- 'pm_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- 'user_notify' => array('BOOL', 0),
- 'report_closed' => array('BOOL', 0),
- 'report_time' => array('TIMESTAMP', 0),
- 'report_text' => array('MTEXT_UNI', ''),
- ),
- 'PRIMARY_KEY' => 'report_id',
- 'KEYS' => array(
- 'post_id' => array('INDEX', 'post_id'),
- 'pm_id' => array('INDEX', 'pm_id'),
- ),
- );
-
- $schema_data['phpbb_reports_reasons'] = array(
- 'COLUMNS' => array(
- 'reason_id' => array('USINT', NULL, 'auto_increment'),
- 'reason_title' => array('VCHAR_UNI', ''),
- 'reason_description' => array('MTEXT_UNI', ''),
- 'reason_order' => array('USINT', 0),
- ),
- 'PRIMARY_KEY' => 'reason_id',
- );
-
- $schema_data['phpbb_search_results'] = array(
- 'COLUMNS' => array(
- 'search_key' => array('VCHAR:32', ''),
- 'search_time' => array('TIMESTAMP', 0),
- 'search_keywords' => array('MTEXT_UNI', ''),
- 'search_authors' => array('MTEXT', ''),
- ),
- 'PRIMARY_KEY' => 'search_key',
- );
-
- $schema_data['phpbb_search_wordlist'] = array(
- 'COLUMNS' => array(
- 'word_id' => array('UINT', NULL, 'auto_increment'),
- 'word_text' => array('VCHAR_UNI', ''),
- 'word_common' => array('BOOL', 0),
- 'word_count' => array('UINT', 0),
- ),
- 'PRIMARY_KEY' => 'word_id',
- 'KEYS' => array(
- 'wrd_txt' => array('UNIQUE', 'word_text'),
- 'wrd_cnt' => array('INDEX', 'word_count'),
- ),
- );
-
- $schema_data['phpbb_search_wordmatch'] = array(
- 'COLUMNS' => array(
- 'post_id' => array('UINT', 0),
- 'word_id' => array('UINT', 0),
- 'title_match' => array('BOOL', 0),
- ),
- 'KEYS' => array(
- 'unq_mtch' => array('UNIQUE', array('word_id', 'post_id', 'title_match')),
- 'word_id' => array('INDEX', 'word_id'),
- 'post_id' => array('INDEX', 'post_id'),
- ),
- );
-
- $schema_data['phpbb_sessions'] = array(
- 'COLUMNS' => array(
- 'session_id' => array('CHAR:32', ''),
- 'session_user_id' => array('UINT', 0),
- 'session_forum_id' => array('UINT', 0),
- 'session_last_visit' => array('TIMESTAMP', 0),
- 'session_start' => array('TIMESTAMP', 0),
- 'session_time' => array('TIMESTAMP', 0),
- 'session_ip' => array('VCHAR:40', ''),
- 'session_browser' => array('VCHAR:150', ''),
- 'session_forwarded_for' => array('VCHAR:255', ''),
- 'session_page' => array('VCHAR_UNI', ''),
- 'session_viewonline' => array('BOOL', 1),
- 'session_autologin' => array('BOOL', 0),
- 'session_admin' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => 'session_id',
- 'KEYS' => array(
- 'session_time' => array('INDEX', 'session_time'),
- 'session_user_id' => array('INDEX', 'session_user_id'),
- 'session_fid' => array('INDEX', 'session_forum_id'),
- ),
- );
-
- $schema_data['phpbb_sessions_keys'] = array(
- 'COLUMNS' => array(
- 'key_id' => array('CHAR:32', ''),
- 'user_id' => array('UINT', 0),
- 'last_ip' => array('VCHAR:40', ''),
- 'last_login' => array('TIMESTAMP', 0),
- ),
- 'PRIMARY_KEY' => array('key_id', 'user_id'),
- 'KEYS' => array(
- 'last_login' => array('INDEX', 'last_login'),
- ),
- );
-
- $schema_data['phpbb_sitelist'] = array(
- 'COLUMNS' => array(
- 'site_id' => array('UINT', NULL, 'auto_increment'),
- 'site_ip' => array('VCHAR:40', ''),
- 'site_hostname' => array('VCHAR', ''),
- 'ip_exclude' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => 'site_id',
- );
-
- $schema_data['phpbb_smilies'] = array(
- 'COLUMNS' => array(
- 'smiley_id' => array('UINT', NULL, 'auto_increment'),
- // We may want to set 'code' to VCHAR:50 or check if unicode support is possible... at the moment only ASCII characters are allowed.
- 'code' => array('VCHAR_UNI:50', ''),
- 'emotion' => array('VCHAR_UNI:50', ''),
- 'smiley_url' => array('VCHAR:50', ''),
- 'smiley_width' => array('USINT', 0),
- 'smiley_height' => array('USINT', 0),
- 'smiley_order' => array('UINT', 0),
- 'display_on_posting'=> array('BOOL', 1),
- ),
- 'PRIMARY_KEY' => 'smiley_id',
- 'KEYS' => array(
- 'display_on_post' => array('INDEX', 'display_on_posting'),
- ),
- );
-
- $schema_data['phpbb_styles'] = array(
- 'COLUMNS' => array(
- 'style_id' => array('UINT', NULL, 'auto_increment'),
- 'style_name' => array('VCHAR_UNI:255', ''),
- 'style_copyright' => array('VCHAR_UNI', ''),
- 'style_active' => array('BOOL', 1),
- 'style_path' => array('VCHAR:100', ''),
- 'bbcode_bitfield' => array('VCHAR:255', 'kNg='),
- 'style_parent_id' => array('UINT:4', 0),
- 'style_parent_tree' => array('TEXT', ''),
- ),
- 'PRIMARY_KEY' => 'style_id',
- 'KEYS' => array(
- 'style_name' => array('UNIQUE', 'style_name'),
- ),
- );
-
- $schema_data['phpbb_topics'] = array(
- 'COLUMNS' => array(
- 'topic_id' => array('UINT', NULL, 'auto_increment'),
- 'forum_id' => array('UINT', 0),
- 'icon_id' => array('UINT', 0),
- 'topic_attachment' => array('BOOL', 0),
- 'topic_visibility' => array('TINT:3', 0),
- 'topic_reported' => array('BOOL', 0),
- 'topic_title' => array('STEXT_UNI', '', 'true_sort'),
- 'topic_poster' => array('UINT', 0),
- 'topic_time' => array('TIMESTAMP', 0),
- 'topic_time_limit' => array('TIMESTAMP', 0),
- 'topic_views' => array('UINT', 0),
- 'topic_posts_approved' => array('UINT', 0),
- 'topic_posts_unapproved' => array('UINT', 0),
- 'topic_posts_softdeleted' => array('UINT', 0),
- 'topic_status' => array('TINT:3', 0),
- 'topic_type' => array('TINT:3', 0),
- 'topic_first_post_id' => array('UINT', 0),
- 'topic_first_poster_name' => array('VCHAR_UNI', ''),
- 'topic_first_poster_colour' => array('VCHAR:6', ''),
- 'topic_last_post_id' => array('UINT', 0),
- 'topic_last_poster_id' => array('UINT', 0),
- 'topic_last_poster_name' => array('VCHAR_UNI', ''),
- 'topic_last_poster_colour' => array('VCHAR:6', ''),
- 'topic_last_post_subject' => array('STEXT_UNI', ''),
- 'topic_last_post_time' => array('TIMESTAMP', 0),
- 'topic_last_view_time' => array('TIMESTAMP', 0),
- 'topic_moved_id' => array('UINT', 0),
- 'topic_bumped' => array('BOOL', 0),
- 'topic_bumper' => array('UINT', 0),
- 'poll_title' => array('STEXT_UNI', ''),
- 'poll_start' => array('TIMESTAMP', 0),
- 'poll_length' => array('TIMESTAMP', 0),
- 'poll_max_options' => array('TINT:4', 1),
- 'poll_last_vote' => array('TIMESTAMP', 0),
- 'poll_vote_change' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => 'topic_id',
- 'KEYS' => array(
- 'forum_id' => array('INDEX', 'forum_id'),
- 'forum_id_type' => array('INDEX', array('forum_id', 'topic_type')),
- 'last_post_time' => array('INDEX', 'topic_last_post_time'),
- 'topic_visibility' => array('INDEX', 'topic_visibility'),
- 'forum_appr_last' => array('INDEX', array('forum_id', 'topic_visibility', 'topic_last_post_id')),
- 'fid_time_moved' => array('INDEX', array('forum_id', 'topic_last_post_time', 'topic_moved_id')),
- ),
- );
-
- $schema_data['phpbb_topics_track'] = array(
- 'COLUMNS' => array(
- 'user_id' => array('UINT', 0),
- 'topic_id' => array('UINT', 0),
- 'forum_id' => array('UINT', 0),
- 'mark_time' => array('TIMESTAMP', 0),
- ),
- 'PRIMARY_KEY' => array('user_id', 'topic_id'),
- 'KEYS' => array(
- 'topic_id' => array('INDEX', 'topic_id'),
- 'forum_id' => array('INDEX', 'forum_id'),
- ),
- );
-
- $schema_data['phpbb_topics_posted'] = array(
- 'COLUMNS' => array(
- 'user_id' => array('UINT', 0),
- 'topic_id' => array('UINT', 0),
- 'topic_posted' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => array('user_id', 'topic_id'),
- );
-
- $schema_data['phpbb_topics_watch'] = array(
- 'COLUMNS' => array(
- 'topic_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- 'notify_status' => array('BOOL', 0),
- ),
- 'KEYS' => array(
- 'topic_id' => array('INDEX', 'topic_id'),
- 'user_id' => array('INDEX', 'user_id'),
- 'notify_stat' => array('INDEX', 'notify_status'),
- ),
- );
-
- $schema_data['phpbb_user_group'] = array(
- 'COLUMNS' => array(
- 'group_id' => array('UINT', 0),
- 'user_id' => array('UINT', 0),
- 'group_leader' => array('BOOL', 0),
- 'user_pending' => array('BOOL', 1),
- ),
- 'KEYS' => array(
- 'group_id' => array('INDEX', 'group_id'),
- 'user_id' => array('INDEX', 'user_id'),
- 'group_leader' => array('INDEX', 'group_leader'),
- ),
- );
-
- $schema_data['phpbb_users'] = array(
- 'COLUMNS' => array(
- 'user_id' => array('UINT', NULL, 'auto_increment'),
- 'user_type' => array('TINT:2', 0),
- 'group_id' => array('UINT', 3),
- 'user_permissions' => array('MTEXT', ''),
- 'user_perm_from' => array('UINT', 0),
- 'user_ip' => array('VCHAR:40', ''),
- 'user_regdate' => array('TIMESTAMP', 0),
- 'username' => array('VCHAR_CI', ''),
- 'username_clean' => array('VCHAR_CI', ''),
- 'user_password' => array('VCHAR_UNI:40', ''),
- 'user_passchg' => array('TIMESTAMP', 0),
- 'user_pass_convert' => array('BOOL', 0),
- 'user_email' => array('VCHAR_UNI:100', ''),
- 'user_email_hash' => array('BINT', 0),
- 'user_birthday' => array('VCHAR:10', ''),
- 'user_lastvisit' => array('TIMESTAMP', 0),
- 'user_lastmark' => array('TIMESTAMP', 0),
- 'user_lastpost_time' => array('TIMESTAMP', 0),
- 'user_lastpage' => array('VCHAR_UNI:200', ''),
- 'user_last_confirm_key' => array('VCHAR:10', ''),
- 'user_last_search' => array('TIMESTAMP', 0),
- 'user_warnings' => array('TINT:4', 0),
- 'user_last_warning' => array('TIMESTAMP', 0),
- 'user_login_attempts' => array('TINT:4', 0),
- 'user_inactive_reason' => array('TINT:2', 0),
- 'user_inactive_time' => array('TIMESTAMP', 0),
- 'user_posts' => array('UINT', 0),
- 'user_lang' => array('VCHAR:30', ''),
- 'user_timezone' => array('VCHAR:100', 'UTC'),
- 'user_dateformat' => array('VCHAR_UNI:30', 'd M Y H:i'),
- 'user_style' => array('UINT', 0),
- 'user_rank' => array('UINT', 0),
- 'user_colour' => array('VCHAR:6', ''),
- 'user_new_privmsg' => array('INT:4', 0),
- 'user_unread_privmsg' => array('INT:4', 0),
- 'user_last_privmsg' => array('TIMESTAMP', 0),
- 'user_message_rules' => array('BOOL', 0),
- 'user_full_folder' => array('INT:11', -3),
- 'user_emailtime' => array('TIMESTAMP', 0),
- 'user_topic_show_days' => array('USINT', 0),
- 'user_topic_sortby_type' => array('VCHAR:1', 't'),
- 'user_topic_sortby_dir' => array('VCHAR:1', 'd'),
- 'user_post_show_days' => array('USINT', 0),
- 'user_post_sortby_type' => array('VCHAR:1', 't'),
- 'user_post_sortby_dir' => array('VCHAR:1', 'a'),
- 'user_notify' => array('BOOL', 0),
- 'user_notify_pm' => array('BOOL', 1),
- 'user_notify_type' => array('TINT:4', 0),
- 'user_allow_pm' => array('BOOL', 1),
- 'user_allow_viewonline' => array('BOOL', 1),
- 'user_allow_viewemail' => array('BOOL', 1),
- 'user_allow_massemail' => array('BOOL', 1),
- 'user_options' => array('UINT:11', 230271),
- 'user_avatar' => array('VCHAR', ''),
- 'user_avatar_type' => array('TINT:2', 0),
- 'user_avatar_width' => array('USINT', 0),
- 'user_avatar_height' => array('USINT', 0),
- 'user_sig' => array('MTEXT_UNI', ''),
- 'user_sig_bbcode_uid' => array('VCHAR:8', ''),
- 'user_sig_bbcode_bitfield' => array('VCHAR:255', ''),
- 'user_from' => array('VCHAR_UNI:100', ''),
- 'user_icq' => array('VCHAR:15', ''),
- 'user_aim' => array('VCHAR_UNI', ''),
- 'user_yim' => array('VCHAR_UNI', ''),
- 'user_msnm' => array('VCHAR_UNI', ''),
- 'user_jabber' => array('VCHAR_UNI', ''),
- 'user_website' => array('VCHAR_UNI:200', ''),
- 'user_occ' => array('TEXT_UNI', ''),
- 'user_interests' => array('TEXT_UNI', ''),
- 'user_actkey' => array('VCHAR:32', ''),
- 'user_newpasswd' => array('VCHAR_UNI:40', ''),
- 'user_form_salt' => array('VCHAR_UNI:32', ''),
- 'user_new' => array('BOOL', 1),
- 'user_reminded' => array('TINT:4', 0),
- 'user_reminded_time' => array('TIMESTAMP', 0),
- ),
- 'PRIMARY_KEY' => 'user_id',
- 'KEYS' => array(
- 'user_birthday' => array('INDEX', 'user_birthday'),
- 'user_email_hash' => array('INDEX', 'user_email_hash'),
- 'user_type' => array('INDEX', 'user_type'),
- 'username_clean' => array('UNIQUE', 'username_clean'),
- ),
- );
-
- $schema_data['phpbb_warnings'] = array(
- 'COLUMNS' => array(
- 'warning_id' => array('UINT', NULL, 'auto_increment'),
- 'user_id' => array('UINT', 0),
- 'post_id' => array('UINT', 0),
- 'log_id' => array('UINT', 0),
- 'warning_time' => array('TIMESTAMP', 0),
- ),
- 'PRIMARY_KEY' => 'warning_id',
- );
-
- $schema_data['phpbb_words'] = array(
- 'COLUMNS' => array(
- 'word_id' => array('UINT', NULL, 'auto_increment'),
- 'word' => array('VCHAR_UNI', ''),
- 'replacement' => array('VCHAR_UNI', ''),
- ),
- 'PRIMARY_KEY' => 'word_id',
- );
-
- $schema_data['phpbb_zebra'] = array(
- 'COLUMNS' => array(
- 'user_id' => array('UINT', 0),
- 'zebra_id' => array('UINT', 0),
- 'friend' => array('BOOL', 0),
- 'foe' => array('BOOL', 0),
- ),
- 'PRIMARY_KEY' => array('user_id', 'zebra_id'),
- );
-
- return $schema_data;
-}
diff --git a/phpBB/develop/namespacify.php b/phpBB/develop/namespacify.php
new file mode 100644
index 0000000000..4e460eead8
--- /dev/null
+++ b/phpBB/develop/namespacify.php
@@ -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);
+ }
+}
+
diff --git a/phpBB/develop/rename_interfaces.php b/phpBB/develop/rename_interfaces.php
new file mode 100644
index 0000000000..11989350bb
--- /dev/null
+++ b/phpBB/develop/rename_interfaces.php
@@ -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);
+ }
+}
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index bb42736daf..c2eb48137a 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -145,7 +145,6 @@
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11265">PHPBB3-11265</a>] - Functional tests do not assert that board installation succeeded</li>
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11269">PHPBB3-11269</a>] - Travis functional test case errors</li>
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11278">PHPBB3-11278</a>] - Firebird tables are not removed correctly on 3.0.9-rc1 update</li>
-<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11288">PHPBB3-11288</a>] - Search fooled by hyphens</li>
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11291">PHPBB3-11291</a>] - &quot;Could not open input file: ../composer.phar&quot; error during phing's create-package</li>
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11292">PHPBB3-11292</a>] - Newlines removed in display of PM reports, no clickable links in PM reports</li>
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11301">PHPBB3-11301</a>] - &quot;String offset cast occured&quot; error on PHP 5.4</li>
@@ -185,6 +184,9 @@
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11674">PHPBB3-11674</a>] - Do not include vendor folder if there are no dependencies.</li>
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11524">PHPBB3-11524</a>] - MySQL Upgrader throws warnings on PHP 5.4</li>
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11720">PHPBB3-11720</a>] - Reporting posts leads to white page error</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11769">PHPBB3-11769</a>] - Wrong poster in subscription email when poster is using the Quote button</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11775">PHPBB3-11775</a>] - Error while moving posts to a new topic</li>
+<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11802">PHPBB3-11802</a>] - Undefined variable $browser in /download/file.php</li>
</ul>
<h4>Improvement</h4>
<ul>
diff --git a/phpBB/docs/auth_api.html b/phpBB/docs/auth_api.html
index f45ea5e5c8..c68ae7821f 100644
--- a/phpBB/docs/auth_api.html
+++ b/phpBB/docs/auth_api.html
@@ -86,7 +86,7 @@
<p>To use any methods contained with the <code>auth</code> class it first needs to be instantiated. This is best achieved early in the execution of the script in the following manner:</p>
<div class="codebox"><pre>
-$auth = new phpbb_auth();
+$auth = new phpbb\auth\auth();
</pre></div>
<p>Once an instance of the class has been created you are free to call the various methods it contains. Please note that should you wish to use the <code>auth_admin</code> methods you will need to instantiate this separately but in the same way.</p>
diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md
index af6e6bdb1c..bef4727149 100644
--- a/phpBB/docs/events.md
+++ b/phpBB/docs/events.md
@@ -179,6 +179,66 @@ ucp_pm_viewmessage_print_head_append
* Location: styles/prosilver/template/ucp_pm_viewmessage_print.html
* Purpose: Add asset calls directly before the `</head>` tag of the Print PM screen
+ucp_prefs_personal_prepend
+===
+* Locations:
+ + styles/prosilver/template/ucp_prefs_personal.html
+ + styles/subsilver2/template/ucp_prefs_personal.html
+* Purpose: Add user options to the top of the Edit Global Settings block
+
+ucp_prefs_personal_append
+===
+* Locations:
+ + styles/prosilver/template/ucp_prefs_personal.html
+ + styles/subsilver2/template/ucp_prefs_personal.html
+* Purpose: Add user options to the bottom of the Edit Global Settings block
+
+ucp_prefs_post_prepend
+===
+* Locations:
+ + styles/prosilver/template/ucp_prefs_post.html
+ + styles/subsilver2/template/ucp_prefs_post.html
+* Purpose: Add user options to the top of the Edit Posting Defaults block
+
+ucp_prefs_post_append
+===
+* Locations:
+ + styles/prosilver/template/ucp_prefs_post.html
+ + styles/subsilver2/template/ucp_prefs_post.html
+* Purpose: Add user options to the bottom of the Edit Posting Defaults block
+
+ucp_prefs_view_radio_buttons_prepend
+===
+* Locations:
+ + styles/prosilver/template/ucp_prefs_view.html
+ + styles/subsilver2/template/ucp_prefs_view.html
+* Purpose: Add options to the top of the radio buttons block of the Edit
+Display Options screen
+
+ucp_prefs_view_radio_buttons_append
+===
+* Locations:
+ + styles/prosilver/template/ucp_prefs_view.html
+ + styles/subsilver2/template/ucp_prefs_view.html
+* Purpose: Add options to the bottom of the radio buttons block of the Edit
+Display Options screen
+
+ucp_prefs_view_select_menu_prepend
+===
+* Locations:
+ + styles/prosilver/template/ucp_prefs_view.html
+ + styles/subsilver2/template/ucp_prefs_view.html
+* Purpose: Add options to the top of the drop-down lists block of the Edit
+Display Options screen
+
+ucp_prefs_view_select_menu_append
+===
+* Locations:
+ + styles/prosilver/template/ucp_prefs_view.html
+ + styles/subsilver2/template/ucp_prefs_view.html
+* Purpose: Add options to the bottom of the drop-down lists block of the Edit
+Display Options screen
+
viewtopic_print_head_append
===
* Location: styles/prosilver/template/viewtopic_print.html
diff --git a/phpBB/download/file.php b/phpBB/download/file.php
index 5a091db7c7..04d68f6a48 100644
--- a/phpBB/download/file.php
+++ b/phpBB/download/file.php
@@ -50,9 +50,9 @@ if (isset($_GET['avatar']))
require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
// 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_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();
// Set up container
diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php
index d0e8ff3882..55459739ca 100644
--- a/phpBB/includes/acp/acp_attachments.php
+++ b/phpBB/includes/acp/acp_attachments.php
@@ -1472,7 +1472,7 @@ class acp_attachments
$ip_list = array_unique(explode("\n", $ips));
$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();
$hostlist = array();
diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php
index 9c430b5a0b..dca39df38c 100644
--- a/phpBB/includes/acp/acp_bbcodes.php
+++ b/phpBB/includes/acp/acp_bbcodes.php
@@ -275,7 +275,7 @@ class acp_bbcodes
if ($request->is_ajax())
{
- $json_response = new phpbb_json_response;
+ $json_response = new \phpbb\json_response;
$json_response->send(array(
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
'MESSAGE_TEXT' => $user->lang['BBCODE_DELETED'],
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index 12e2a1bf72..8f2548166b 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -328,6 +328,7 @@ class acp_board
'session_length' => array('lang' => 'SESSION_LENGTH', 'validate' => 'int:60:9999999999', 'type' => 'number:60:9999999999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']),
'active_sessions' => array('lang' => 'LIMIT_SESSIONS', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true),
'load_online_time' => array('lang' => 'ONLINE_LENGTH', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']),
+ 'read_notification_expire_days' => array('lang' => 'READ_NOTIFICATION_EXPIRE_DAYS', 'validate' => 'int:0', 'type' => 'number:0', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']),
'legend2' => 'GENERAL_OPTIONS',
'load_notifications' => array('lang' => 'LOAD_NOTIFICATIONS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
@@ -375,6 +376,7 @@ class acp_board
'use_system_cron' => array('lang' => 'USE_SYSTEM_CRON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'legend2' => 'PATH_SETTINGS',
+ 'enable_mod_rewrite' => array('lang' => 'MOD_REWRITE_ENABLE', 'validate' => 'bool', 'type' => 'custom', 'method' => 'enable_mod_rewrite', 'explain' => true),
'smilies_path' => array('lang' => 'SMILIES_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true),
'icons_path' => array('lang' => 'ICONS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true),
'upload_icons_path' => array('lang' => 'UPLOAD_ICONS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true),
@@ -658,6 +660,13 @@ class acp_board
$auth_tpl = $provider->get_acp_template($this->new_config);
if ($auth_tpl)
{
+ if (array_key_exists('BLOCK_VAR_NAME', $auth_tpl))
+ {
+ foreach ($auth_tpl['BLOCK_VARS'] as $block_vars)
+ {
+ $template->assign_block_vars($auth_tpl['BLOCK_VAR_NAME'], $block_vars);
+ }
+ }
$template->assign_vars($auth_tpl['TEMPLATE_VARS']);
$template->assign_block_vars('auth_tpl', array(
'TEMPLATE_FILE' => $auth_tpl['TEMPLATE_FILE'],
@@ -679,7 +688,7 @@ class acp_board
foreach ($auth_providers as $key => $value)
{
- if (!($value instanceof phpbb_auth_provider_interface))
+ if (!($value instanceof \phpbb\auth\provider\provider_interface))
{
continue;
}
@@ -994,4 +1003,51 @@ class acp_board
$cache->destroy('sql', FORUMS_TABLE);
}
+ /**
+ * Option to enable/disable removal of 'app.php' from URLs
+ *
+ * Note that if mod_rewrite is on, URLs without app.php will still work,
+ * but any paths generated by the controller helper url() method will not
+ * contain app.php.
+ *
+ * @param int $value The current config value
+ * @param string $key The config key
+ * @return string The HTML for the form field
+ */
+ function enable_mod_rewrite($value, $key)
+ {
+ global $user, $config;
+
+ // Determine whether mod_rewrite is enabled on the server
+ // NOTE: This only works on Apache servers on which PHP is NOT
+ // installed as CGI. In that case, there is no way for PHP to
+ // determine whether or not the Apache module is enabled.
+ //
+ // To be clear on the value of $mod_rewite:
+ // null = Cannot determine whether or not the server has mod_rewrite
+ // enabled
+ // false = Can determine that the server does NOT have mod_rewrite
+ // enabled
+ // true = Can determine that the server DOES have mod_rewrite_enabled
+ $mod_rewrite = null;
+ if (function_exists('apache_get_modules'))
+ {
+ $mod_rewrite = (bool) in_array('mod_rewrite', apache_get_modules());
+ }
+
+ // If $message is false, mod_rewrite is enabled.
+ // Otherwise, it is not and we need to:
+ // 1) disable the form field
+ // 2) make sure the config value is set to 0
+ // 3) append the message to the return
+ $value = ($mod_rewrite === false) ? 0 : $value;
+ $message = $mod_rewrite === null ? 'MOD_REWRITE_INFORMATION_UNAVAILABLE' : ($mod_rewrite === false ? 'MOD_REWRITE_DISABLED' : false);
+
+ // Let's do some friendly HTML injection if we want to disable the
+ // form field because h_radio() has no pretty way of doing so
+ $field_name = 'config[enable_mod_rewrite]' . ($message === 'MOD_REWRITE_DISABLED' ? '" disabled="disabled' : '');
+
+ return h_radio($field_name, array(1 => 'YES', 0 => 'NO'), $value) .
+ ($message !== false ? '<br /><span>' . $user->lang($message) . '</span>' : '');
+ }
}
diff --git a/phpBB/includes/acp/acp_bots.php b/phpBB/includes/acp/acp_bots.php
index b9dd6664f4..e28a8d6451 100644
--- a/phpBB/includes/acp/acp_bots.php
+++ b/phpBB/includes/acp/acp_bots.php
@@ -355,7 +355,7 @@ class acp_bots
if ($request->is_ajax() && ($action == 'activate' || $action == 'deactivate'))
{
- $json_response = new phpbb_json_response;
+ $json_response = new \phpbb\json_response;
$json_response->send(array(
'text' => $user->lang['BOT_' . (($action == 'activate') ? 'DE' : '') . 'ACTIVATE'],
));
diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php
index 5d191b3d0f..fc08a5fb94 100644
--- a/phpBB/includes/acp/acp_database.php
+++ b/phpBB/includes/acp/acp_database.php
@@ -28,7 +28,7 @@ class acp_database
global $cache, $db, $user, $auth, $template, $table_prefix;
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');
diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php
index 379e779c2c..b41f4d4e81 100644
--- a/phpBB/includes/acp/acp_extensions.php
+++ b/phpBB/includes/acp/acp_extensions.php
@@ -58,13 +58,13 @@ class acp_extensions
// If they've specified an extension, let's load the metadata manager and validate it.
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
{
$md_manager->get_metadata('all');
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $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));
}
@@ -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));
}
@@ -217,7 +217,7 @@ class acp_extensions
* @param $phpbb_extension_manager An instance of the extension manager
* @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)
{
@@ -236,7 +236,7 @@ class acp_extensions
'PURGE' => $this->u_action . '&amp;action=purge_pre&amp;ext_name=' . urlencode($name),
));
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->template->assign_block_vars('disabled', array(
'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
* @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)
{
@@ -270,7 +270,7 @@ class acp_extensions
'PURGE' => $this->u_action . '&amp;action=purge_pre&amp;ext_name=' . urlencode($name),
));
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->template->assign_block_vars('disabled', array(
'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
* @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());
@@ -305,7 +305,7 @@ class acp_extensions
'ENABLE' => $this->u_action . '&amp;action=enable_pre&amp;ext_name=' . urlencode($name),
));
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->template->assign_block_vars('disabled', array(
'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $e),
diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php
index 970b033995..258aabcc0d 100644
--- a/phpBB/includes/acp/acp_forums.php
+++ b/phpBB/includes/acp/acp_forums.php
@@ -55,7 +55,6 @@ class acp_forums
$total = request_var('total', 0);
$this->display_progress_bar($start, $total);
- exit;
break;
case 'delete':
@@ -269,7 +268,7 @@ class acp_forums
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)));
}
diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php
index e6a36c97a8..ad29a5521b 100644
--- a/phpBB/includes/acp/acp_groups.php
+++ b/phpBB/includes/acp/acp_groups.php
@@ -324,7 +324,7 @@ class acp_groups
$avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers();
// 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;
}
}
- 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);
}
@@ -919,7 +919,7 @@ class acp_groups
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);
}
@@ -943,7 +943,7 @@ class acp_groups
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));
}
@@ -961,7 +961,7 @@ class acp_groups
$template->assign_block_vars('legend', array(
'GROUP_NAME' => $group_name,
'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}&amp;field=legend&amp;action=move_down&amp;g=" . $row['group_id'],
'U_MOVE_UP' => "{$this->u_action}&amp;field=legend&amp;action=move_up&amp;g=" . $row['group_id'],
@@ -1004,7 +1004,7 @@ class acp_groups
if ($row['group_id'])
{
$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
{
diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php
index db4b4263b0..5b23f9c3a0 100644
--- a/phpBB/includes/acp/acp_icons.php
+++ b/phpBB/includes/acp/acp_icons.php
@@ -338,7 +338,7 @@ class acp_icons
$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...
- 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_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_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;
}
@@ -785,7 +785,7 @@ class acp_icons
if ($request->is_ajax())
{
- $json_response = new phpbb_json_response;
+ $json_response = new \phpbb\json_response;
$json_response->send(array(
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
'MESSAGE_TEXT' => $notice,
diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php
index 2be1ccfc41..013aab670f 100644
--- a/phpBB/includes/acp/acp_language.php
+++ b/phpBB/includes/acp/acp_language.php
@@ -161,7 +161,7 @@ class acp_language
'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(
'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);
}
- $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)
{
diff --git a/phpBB/includes/acp/acp_logs.php b/phpBB/includes/acp/acp_logs.php
index d86521532c..229bf135ff 100644
--- a/phpBB/includes/acp/acp_logs.php
+++ b/phpBB/includes/acp/acp_logs.php
@@ -35,8 +35,8 @@ class acp_logs
$forum_id = request_var('f', 0);
$topic_id = request_var('t', 0);
$start = request_var('start', 0);
- $deletemark = $request->variable('delmarked', false, false, phpbb_request_interface::POST);
- $deleteall = $request->variable('delall', 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\request_interface::POST);
$marked = request_var('mark', array(0));
// Sort keys
diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php
index 7a1d30196d..6792886d2a 100644
--- a/phpBB/includes/acp/acp_modules.php
+++ b/phpBB/includes/acp/acp_modules.php
@@ -375,7 +375,7 @@ class acp_modules
{
if ($request->is_ajax())
{
- $json_response = new phpbb_json_response;
+ $json_response = new \phpbb\json_response;
$json_response->send(array(
'MESSAGE_TITLE' => $user->lang('ERROR'),
'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
// looking for
- if ($module && strpos($cur_module, $module) === false)
+ if ($module && strpos(str_replace('\\', '_', $cur_module), $module) === false)
{
continue;
}
diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php
index ed7159996a..e7dc03db5c 100644
--- a/phpBB/includes/acp/acp_permissions.php
+++ b/phpBB/includes/acp/acp_permissions.php
@@ -679,7 +679,7 @@ class acp_permissions
list($ug_id, ) = each($psubmit);
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]))
{
trigger_error('WRONG_PERMISSION_SETTING_FORMAT', E_USER_WARNING);
@@ -688,7 +688,7 @@ class acp_permissions
$auth_settings = $settings[$ug_id][$forum_id];
// 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;
// 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);
}
- $auth_settings = $request->variable('setting', array(0 => array(0 => array('' => 0))), false, phpbb_request_interface::POST);
- $auth_roles = $request->variable('role', array(0 => array(0 => 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\request_interface::POST);
$ug_ids = $forum_ids = array();
// We need to go through the auth settings
@@ -1103,7 +1103,7 @@ class acp_permissions
{
if ($user_id != $user->data['user_id'])
{
- $auth2 = new phpbb_auth();
+ $auth2 = new \phpbb\auth\auth();
$auth2->acl($userdata);
$auth_setting = $auth2->acl_get($permission);
}
diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php
index 849160f1fa..4e8145009f 100644
--- a/phpBB/includes/acp/acp_profile.php
+++ b/phpBB/includes/acp/acp_profile.php
@@ -245,7 +245,7 @@ class acp_profile
if ($request->is_ajax())
{
- $json_response = new phpbb_json_response();
+ $json_response = new \phpbb\json_response();
$json_response->send(array(
'text' => $user->lang('DEACTIVATE'),
));
@@ -277,7 +277,7 @@ class acp_profile
if ($request->is_ajax())
{
- $json_response = new phpbb_json_response();
+ $json_response = new \phpbb\json_response();
$json_response->send(array(
'text' => $user->lang('ACTIVATE'),
));
@@ -510,7 +510,7 @@ class acp_profile
$cp->vars['field_default_value_month'] = $now['mon'];
$cp->vars['field_default_value_year'] = $now['year'];
$var = 'now';
- $request->overwrite('field_default_value', $var, phpbb_request_interface::POST);
+ $request->overwrite('field_default_value', $var, \phpbb\request\request_interface::POST);
}
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_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']);
- $request->overwrite('field_default_value', $var, phpbb_request_interface::POST);
+ $request->overwrite('field_default_value', $var, \phpbb\request\request_interface::POST);
}
else
{
diff --git a/phpBB/includes/acp/acp_ranks.php b/phpBB/includes/acp/acp_ranks.php
index 6b06d03f52..73e1de44d9 100644
--- a/phpBB/includes/acp/acp_ranks.php
+++ b/phpBB/includes/acp/acp_ranks.php
@@ -125,7 +125,7 @@ class acp_ranks
if ($request->is_ajax())
{
- $json_response = new phpbb_json_response;
+ $json_response = new \phpbb\json_response;
$json_response->send(array(
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
'MESSAGE_TEXT' => $user->lang['RANK_REMOVED'],
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index cbfd578d87..8853200ddc 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -1604,7 +1604,7 @@ class acp_users
|| $user_row['user_allow_viewonline'] && !$sql_ary['user_allow_viewonline'])
{
// 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);
$session_sql_ary = array(
@@ -1742,7 +1742,7 @@ class acp_users
$avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers();
// 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)
{
diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php
index 4ade9cab13..f5f90fb5b8 100644
--- a/phpBB/includes/acp/auth.php
+++ b/phpBB/includes/acp/auth.php
@@ -19,7 +19,7 @@ if (!defined('IN_PHPBB'))
* ACP Permission/Auth class
* @package phpBB3
*/
-class auth_admin extends phpbb_auth
+class auth_admin extends \phpbb\auth\auth
{
/**
* Init auth settings
@@ -130,7 +130,7 @@ class auth_admin extends phpbb_auth
{
if ($user->data['user_id'] != $userdata['user_id'])
{
- $auth2 = new phpbb_auth();
+ $auth2 = new \phpbb\auth\auth();
$auth2->acl($userdata);
}
else
diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php
index fd00728510..cd2ca7ffce 100644
--- a/phpBB/includes/bbcode.php
+++ b/phpBB/includes/bbcode.php
@@ -126,17 +126,14 @@ class bbcode
*/
function bbcode_cache_init()
{
- global $phpbb_root_path, $phpEx, $config, $user, $phpbb_extension_manager;
+ global $phpbb_root_path, $phpEx, $config, $user, $phpbb_extension_manager, $phpbb_filesystem;
if (empty($this->template_filename))
{
$this->template_bitfield = new bitfield($user->style['bbcode_bitfield']);
- $style_resource_locator = new phpbb_style_resource_locator();
- $style_path_provider = new phpbb_style_extension_path_provider($phpbb_extension_manager, new phpbb_style_path_provider(), $phpbb_root_path);
- $template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context(), $phpbb_extension_manager);
- $style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $style_resource_locator, $style_path_provider, $template);
- $style->set_style();
+ $template = new phpbb\template\twig\twig($phpbb_filesystem, $config, $user, new phpbb\template\context(), $phpbb_extension_manager);
+ $template->set_style();
$template->set_filenames(array('bbcode.html' => 'bbcode.html'));
$this->template_filename = $template->get_source_file_for_handle('bbcode.html');
}
diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php
index c0c355f33b..80f5b65967 100644
--- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php
+++ b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php
@@ -140,7 +140,7 @@ class phpbb_captcha_gd extends phpbb_default_captcha
$config_old = $config;
- $config = new phpbb_config(array());
+ $config = new \phpbb\config\config(array());
foreach ($config_old as $key => $value)
{
$config->set($key, $value);
diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php
index 6843f25d72..82333f739e 100644
--- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php
+++ b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php
@@ -112,7 +112,7 @@ class phpbb_captcha_qa
{
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);
}
@@ -295,7 +295,7 @@ class phpbb_captcha_qa
{
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);
diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php
index c1f4c6ac0e..ae55a71e50 100644
--- a/phpBB/includes/constants.php
+++ b/phpBB/includes/constants.php
@@ -61,6 +61,7 @@ define('LOGIN_CONTINUE', 1);
define('LOGIN_BREAK', 2);
define('LOGIN_SUCCESS', 3);
define('LOGIN_SUCCESS_CREATE_PROFILE', 20);
+define('LOGIN_SUCCESS_LINK_PROFILE', 21);
define('LOGIN_ERROR_USERNAME', 10);
define('LOGIN_ERROR_PASSWORD', 11);
define('LOGIN_ERROR_ACTIVE', 12);
diff --git a/phpBB/includes/db/schema_data.php b/phpBB/includes/db/schema_data.php
new file mode 100644
index 0000000000..69d39e0f8c
--- /dev/null
+++ b/phpBB/includes/db/schema_data.php
@@ -0,0 +1,1219 @@
+<?php
+/**
+*
+* @package dbal
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+$schema_data = array();
+
+/**
+* Define the basic structure
+* The format:
+* array('{TABLE_NAME}' => {TABLE_DATA})
+* {TABLE_DATA}:
+* COLUMNS = array({column_name} = array({column_type}, {default}, {auto_increment}))
+* PRIMARY_KEY = {column_name(s)}
+* KEYS = array({key_name} = array({key_type}, {column_name(s)})),
+*
+* Column Types:
+* INT:x => SIGNED int(x)
+* BINT => BIGINT
+* UINT => mediumint(8) UNSIGNED
+* UINT:x => int(x) UNSIGNED
+* TINT:x => tinyint(x)
+* USINT => smallint(4) UNSIGNED (for _order columns)
+* BOOL => tinyint(1) UNSIGNED
+* VCHAR => varchar(255)
+* CHAR:x => char(x)
+* XSTEXT_UNI => text for storing 100 characters (topic_title for example)
+* STEXT_UNI => text for storing 255 characters (normal input field with a max of 255 single-byte chars) - same as VCHAR_UNI
+* TEXT_UNI => text for storing 3000 characters (short text, descriptions, comments, etc.)
+* MTEXT_UNI => mediumtext (post text, large text)
+* VCHAR:x => varchar(x)
+* TIMESTAMP => int(11) UNSIGNED
+* DECIMAL => decimal number (5,2)
+* DECIMAL: => decimal number (x,2)
+* PDECIMAL => precision decimal number (6,3)
+* PDECIMAL: => precision decimal number (x,3)
+* VCHAR_UNI => varchar(255) BINARY
+* VCHAR_CI => varchar_ci for postgresql, others VCHAR
+*/
+$schema_data['phpbb_attachments'] = array(
+ 'COLUMNS' => array(
+ 'attach_id' => array('UINT', NULL, 'auto_increment'),
+ 'post_msg_id' => array('UINT', 0),
+ 'topic_id' => array('UINT', 0),
+ 'in_message' => array('BOOL', 0),
+ 'poster_id' => array('UINT', 0),
+ 'is_orphan' => array('BOOL', 1),
+ 'physical_filename' => array('VCHAR', ''),
+ 'real_filename' => array('VCHAR', ''),
+ 'download_count' => array('UINT', 0),
+ 'attach_comment' => array('TEXT_UNI', ''),
+ 'extension' => array('VCHAR:100', ''),
+ 'mimetype' => array('VCHAR:100', ''),
+ 'filesize' => array('UINT:20', 0),
+ 'filetime' => array('TIMESTAMP', 0),
+ 'thumbnail' => array('BOOL', 0),
+ ),
+ 'PRIMARY_KEY' => 'attach_id',
+ 'KEYS' => array(
+ 'filetime' => array('INDEX', 'filetime'),
+ 'post_msg_id' => array('INDEX', 'post_msg_id'),
+ 'topic_id' => array('INDEX', 'topic_id'),
+ 'poster_id' => array('INDEX', 'poster_id'),
+ 'is_orphan' => array('INDEX', 'is_orphan'),
+ ),
+);
+
+$schema_data['phpbb_acl_groups'] = array(
+ 'COLUMNS' => array(
+ 'group_id' => array('UINT', 0),
+ 'forum_id' => array('UINT', 0),
+ 'auth_option_id' => array('UINT', 0),
+ 'auth_role_id' => array('UINT', 0),
+ 'auth_setting' => array('TINT:2', 0),
+ ),
+ 'KEYS' => array(
+ 'group_id' => array('INDEX', 'group_id'),
+ 'auth_opt_id' => array('INDEX', 'auth_option_id'),
+ 'auth_role_id' => array('INDEX', 'auth_role_id'),
+ ),
+);
+
+$schema_data['phpbb_acl_options'] = array(
+ 'COLUMNS' => array(
+ 'auth_option_id' => array('UINT', NULL, 'auto_increment'),
+ 'auth_option' => array('VCHAR:50', ''),
+ 'is_global' => array('BOOL', 0),
+ 'is_local' => array('BOOL', 0),
+ 'founder_only' => array('BOOL', 0),
+ ),
+ 'PRIMARY_KEY' => 'auth_option_id',
+ 'KEYS' => array(
+ 'auth_option' => array('UNIQUE', 'auth_option'),
+ ),
+);
+
+$schema_data['phpbb_acl_roles'] = array(
+ 'COLUMNS' => array(
+ 'role_id' => array('UINT', NULL, 'auto_increment'),
+ 'role_name' => array('VCHAR_UNI', ''),
+ 'role_description' => array('TEXT_UNI', ''),
+ 'role_type' => array('VCHAR:10', ''),
+ 'role_order' => array('USINT', 0),
+ ),
+ 'PRIMARY_KEY' => 'role_id',
+ 'KEYS' => array(
+ 'role_type' => array('INDEX', 'role_type'),
+ 'role_order' => array('INDEX', 'role_order'),
+ ),
+);
+
+$schema_data['phpbb_acl_roles_data'] = array(
+ 'COLUMNS' => array(
+ 'role_id' => array('UINT', 0),
+ 'auth_option_id' => array('UINT', 0),
+ 'auth_setting' => array('TINT:2', 0),
+ ),
+ 'PRIMARY_KEY' => array('role_id', 'auth_option_id'),
+ 'KEYS' => array(
+ 'ath_op_id' => array('INDEX', 'auth_option_id'),
+ ),
+);
+
+$schema_data['phpbb_acl_users'] = array(
+ 'COLUMNS' => array(
+ 'user_id' => array('UINT', 0),
+ 'forum_id' => array('UINT', 0),
+ 'auth_option_id' => array('UINT', 0),
+ 'auth_role_id' => array('UINT', 0),
+ 'auth_setting' => array('TINT:2', 0),
+ ),
+ 'KEYS' => array(
+ 'user_id' => array('INDEX', 'user_id'),
+ 'auth_option_id' => array('INDEX', 'auth_option_id'),
+ 'auth_role_id' => array('INDEX', 'auth_role_id'),
+ ),
+);
+
+$schema_data['phpbb_banlist'] = array(
+ 'COLUMNS' => array(
+ 'ban_id' => array('UINT', NULL, 'auto_increment'),
+ 'ban_userid' => array('UINT', 0),
+ 'ban_ip' => array('VCHAR:40', ''),
+ 'ban_email' => array('VCHAR_UNI:100', ''),
+ 'ban_start' => array('TIMESTAMP', 0),
+ 'ban_end' => array('TIMESTAMP', 0),
+ 'ban_exclude' => array('BOOL', 0),
+ 'ban_reason' => array('VCHAR_UNI', ''),
+ 'ban_give_reason' => array('VCHAR_UNI', ''),
+ ),
+ 'PRIMARY_KEY' => 'ban_id',
+ 'KEYS' => array(
+ 'ban_end' => array('INDEX', 'ban_end'),
+ 'ban_user' => array('INDEX', array('ban_userid', 'ban_exclude')),
+ 'ban_email' => array('INDEX', array('ban_email', 'ban_exclude')),
+ 'ban_ip' => array('INDEX', array('ban_ip', 'ban_exclude')),
+ ),
+);
+
+$schema_data['phpbb_bbcodes'] = array(
+ 'COLUMNS' => array(
+ 'bbcode_id' => array('USINT', 0),
+ 'bbcode_tag' => array('VCHAR:16', ''),
+ 'bbcode_helpline' => array('VCHAR_UNI', ''),
+ 'display_on_posting' => array('BOOL', 0),
+ 'bbcode_match' => array('TEXT_UNI', ''),
+ 'bbcode_tpl' => array('MTEXT_UNI', ''),
+ 'first_pass_match' => array('MTEXT_UNI', ''),
+ 'first_pass_replace' => array('MTEXT_UNI', ''),
+ 'second_pass_match' => array('MTEXT_UNI', ''),
+ 'second_pass_replace' => array('MTEXT_UNI', ''),
+ ),
+ 'PRIMARY_KEY' => 'bbcode_id',
+ 'KEYS' => array(
+ 'display_on_post' => array('INDEX', 'display_on_posting'),
+ ),
+);
+
+$schema_data['phpbb_bookmarks'] = array(
+ 'COLUMNS' => array(
+ 'topic_id' => array('UINT', 0),
+ 'user_id' => array('UINT', 0),
+ ),
+ 'PRIMARY_KEY' => array('topic_id', 'user_id'),
+);
+
+$schema_data['phpbb_bots'] = array(
+ 'COLUMNS' => array(
+ 'bot_id' => array('UINT', NULL, 'auto_increment'),
+ 'bot_active' => array('BOOL', 1),
+ 'bot_name' => array('STEXT_UNI', ''),
+ 'user_id' => array('UINT', 0),
+ 'bot_agent' => array('VCHAR', ''),
+ 'bot_ip' => array('VCHAR', ''),
+ ),
+ 'PRIMARY_KEY' => 'bot_id',
+ 'KEYS' => array(
+ 'bot_active' => array('INDEX', 'bot_active'),
+ ),
+);
+
+$schema_data['phpbb_config'] = array(
+ 'COLUMNS' => array(
+ 'config_name' => array('VCHAR', ''),
+ 'config_value' => array('VCHAR_UNI', ''),
+ 'is_dynamic' => array('BOOL', 0),
+ ),
+ 'PRIMARY_KEY' => 'config_name',
+ 'KEYS' => array(
+ 'is_dynamic' => array('INDEX', 'is_dynamic'),
+ ),
+);
+
+$schema_data['phpbb_config_text'] = array(
+ 'COLUMNS' => array(
+ 'config_name' => array('VCHAR', ''),
+ 'config_value' => array('MTEXT', ''),
+ ),
+ 'PRIMARY_KEY' => 'config_name',
+);
+
+$schema_data['phpbb_confirm'] = array(
+ 'COLUMNS' => array(
+ 'confirm_id' => array('CHAR:32', ''),
+ 'session_id' => array('CHAR:32', ''),
+ 'confirm_type' => array('TINT:3', 0),
+ 'code' => array('VCHAR:8', ''),
+ 'seed' => array('UINT:10', 0),
+ 'attempts' => array('UINT', 0),
+ ),
+ 'PRIMARY_KEY' => array('session_id', 'confirm_id'),
+ 'KEYS' => array(
+ 'confirm_type' => array('INDEX', 'confirm_type'),
+ ),
+);
+
+$schema_data['phpbb_disallow'] = array(
+ 'COLUMNS' => array(
+ 'disallow_id' => array('UINT', NULL, 'auto_increment'),
+ 'disallow_username' => array('VCHAR_UNI:255', ''),
+ ),
+ 'PRIMARY_KEY' => 'disallow_id',
+);
+
+$schema_data['phpbb_drafts'] = array(
+ 'COLUMNS' => array(
+ 'draft_id' => array('UINT', NULL, 'auto_increment'),
+ 'user_id' => array('UINT', 0),
+ 'topic_id' => array('UINT', 0),
+ 'forum_id' => array('UINT', 0),
+ 'save_time' => array('TIMESTAMP', 0),
+ 'draft_subject' => array('STEXT_UNI', ''),
+ 'draft_message' => array('MTEXT_UNI', ''),
+ ),
+ 'PRIMARY_KEY' => 'draft_id',
+ 'KEYS' => array(
+ 'save_time' => array('INDEX', 'save_time'),
+ ),
+);
+
+$schema_data['phpbb_ext'] = array(
+ 'COLUMNS' => array(
+ 'ext_name' => array('VCHAR', ''),
+ 'ext_active' => array('BOOL', 0),
+ 'ext_state' => array('TEXT', ''),
+ ),
+ 'KEYS' => array(
+ 'ext_name' => array('UNIQUE', 'ext_name'),
+ ),
+);
+
+$schema_data['phpbb_extensions'] = array(
+ 'COLUMNS' => array(
+ 'extension_id' => array('UINT', NULL, 'auto_increment'),
+ 'group_id' => array('UINT', 0),
+ 'extension' => array('VCHAR:100', ''),
+ ),
+ 'PRIMARY_KEY' => 'extension_id',
+);
+
+$schema_data['phpbb_extension_groups'] = array(
+ 'COLUMNS' => array(
+ 'group_id' => array('UINT', NULL, 'auto_increment'),
+ 'group_name' => array('VCHAR_UNI', ''),
+ 'cat_id' => array('TINT:2', 0),
+ 'allow_group' => array('BOOL', 0),
+ 'download_mode' => array('BOOL', 1),
+ 'upload_icon' => array('VCHAR', ''),
+ 'max_filesize' => array('UINT:20', 0),
+ 'allowed_forums' => array('TEXT', ''),
+ 'allow_in_pm' => array('BOOL', 0),
+ ),
+ 'PRIMARY_KEY' => 'group_id',
+);
+
+$schema_data['phpbb_forums'] = array(
+ 'COLUMNS' => array(
+ 'forum_id' => array('UINT', NULL, 'auto_increment'),
+ 'parent_id' => array('UINT', 0),
+ 'left_id' => array('UINT', 0),
+ 'right_id' => array('UINT', 0),
+ 'forum_parents' => array('MTEXT', ''),
+ 'forum_name' => array('STEXT_UNI', ''),
+ 'forum_desc' => array('TEXT_UNI', ''),
+ 'forum_desc_bitfield' => array('VCHAR:255', ''),
+ 'forum_desc_options' => array('UINT:11', 7),
+ 'forum_desc_uid' => array('VCHAR:8', ''),
+ 'forum_link' => array('VCHAR_UNI', ''),
+ 'forum_password' => array('VCHAR_UNI:40', ''),
+ 'forum_style' => array('UINT', 0),
+ 'forum_image' => array('VCHAR', ''),
+ 'forum_rules' => array('TEXT_UNI', ''),
+ 'forum_rules_link' => array('VCHAR_UNI', ''),
+ 'forum_rules_bitfield' => array('VCHAR:255', ''),
+ 'forum_rules_options' => array('UINT:11', 7),
+ 'forum_rules_uid' => array('VCHAR:8', ''),
+ 'forum_topics_per_page' => array('TINT:4', 0),
+ 'forum_type' => array('TINT:4', 0),
+ 'forum_status' => array('TINT:4', 0),
+ 'forum_posts_approved' => array('UINT', 0),
+ 'forum_posts_unapproved' => array('UINT', 0),
+ 'forum_posts_softdeleted' => array('UINT', 0),
+ 'forum_topics_approved' => array('UINT', 0),
+ 'forum_topics_unapproved' => array('UINT', 0),
+ 'forum_topics_softdeleted' => array('UINT', 0),
+ 'forum_last_post_id' => array('UINT', 0),
+ 'forum_last_poster_id' => array('UINT', 0),
+ 'forum_last_post_subject' => array('STEXT_UNI', ''),
+ 'forum_last_post_time' => array('TIMESTAMP', 0),
+ 'forum_last_poster_name'=> array('VCHAR_UNI', ''),
+ 'forum_last_poster_colour'=> array('VCHAR:6', ''),
+ 'forum_flags' => array('TINT:4', 32),
+ 'forum_options' => array('UINT:20', 0),
+ 'display_subforum_list' => array('BOOL', 1),
+ 'display_on_index' => array('BOOL', 1),
+ 'enable_indexing' => array('BOOL', 1),
+ 'enable_icons' => array('BOOL', 1),
+ 'enable_prune' => array('BOOL', 0),
+ 'prune_next' => array('TIMESTAMP', 0),
+ 'prune_days' => array('UINT', 0),
+ 'prune_viewed' => array('UINT', 0),
+ 'prune_freq' => array('UINT', 0),
+ ),
+ 'PRIMARY_KEY' => 'forum_id',
+ 'KEYS' => array(
+ 'left_right_id' => array('INDEX', array('left_id', 'right_id')),
+ 'forum_lastpost_id' => array('INDEX', 'forum_last_post_id'),
+ ),
+);
+
+$schema_data['phpbb_forums_access'] = array(
+ 'COLUMNS' => array(
+ 'forum_id' => array('UINT', 0),
+ 'user_id' => array('UINT', 0),
+ 'session_id' => array('CHAR:32', ''),
+ ),
+ 'PRIMARY_KEY' => array('forum_id', 'user_id', 'session_id'),
+);
+
+$schema_data['phpbb_forums_track'] = array(
+ 'COLUMNS' => array(
+ 'user_id' => array('UINT', 0),
+ 'forum_id' => array('UINT', 0),
+ 'mark_time' => array('TIMESTAMP', 0),
+ ),
+ 'PRIMARY_KEY' => array('user_id', 'forum_id'),
+);
+
+$schema_data['phpbb_forums_watch'] = array(
+ 'COLUMNS' => array(
+ 'forum_id' => array('UINT', 0),
+ 'user_id' => array('UINT', 0),
+ 'notify_status' => array('BOOL', 0),
+ ),
+ 'KEYS' => array(
+ 'forum_id' => array('INDEX', 'forum_id'),
+ 'user_id' => array('INDEX', 'user_id'),
+ 'notify_stat' => array('INDEX', 'notify_status'),
+ ),
+);
+
+$schema_data['phpbb_groups'] = array(
+ 'COLUMNS' => array(
+ 'group_id' => array('UINT', NULL, 'auto_increment'),
+ 'group_type' => array('TINT:4', 1),
+ 'group_founder_manage' => array('BOOL', 0),
+ 'group_skip_auth' => array('BOOL', 0),
+ 'group_name' => array('VCHAR_CI', ''),
+ 'group_desc' => array('TEXT_UNI', ''),
+ 'group_desc_bitfield' => array('VCHAR:255', ''),
+ 'group_desc_options' => array('UINT:11', 7),
+ 'group_desc_uid' => array('VCHAR:8', ''),
+ 'group_display' => array('BOOL', 0),
+ 'group_avatar' => array('VCHAR', ''),
+ 'group_avatar_type' => array('VCHAR:255', ''),
+ 'group_avatar_width' => array('USINT', 0),
+ 'group_avatar_height' => array('USINT', 0),
+ 'group_rank' => array('UINT', 0),
+ 'group_colour' => array('VCHAR:6', ''),
+ 'group_sig_chars' => array('UINT', 0),
+ 'group_receive_pm' => array('BOOL', 0),
+ 'group_message_limit' => array('UINT', 0),
+ 'group_max_recipients' => array('UINT', 0),
+ 'group_legend' => array('UINT', 0),
+ ),
+ 'PRIMARY_KEY' => 'group_id',
+ 'KEYS' => array(
+ 'group_legend_name' => array('INDEX', array('group_legend', 'group_name')),
+ ),
+);
+
+$schema_data['phpbb_icons'] = array(
+ 'COLUMNS' => array(
+ 'icons_id' => array('UINT', NULL, 'auto_increment'),
+ 'icons_url' => array('VCHAR', ''),
+ 'icons_width' => array('TINT:4', 0),
+ 'icons_height' => array('TINT:4', 0),
+ 'icons_order' => array('UINT', 0),
+ 'display_on_posting' => array('BOOL', 1),
+ ),
+ 'PRIMARY_KEY' => 'icons_id',
+ 'KEYS' => array(
+ 'display_on_posting' => array('INDEX', 'display_on_posting'),
+ ),
+);
+
+$schema_data['phpbb_lang'] = array(
+ 'COLUMNS' => array(
+ 'lang_id' => array('TINT:4', NULL, 'auto_increment'),
+ 'lang_iso' => array('VCHAR:30', ''),
+ 'lang_dir' => array('VCHAR:30', ''),
+ 'lang_english_name' => array('VCHAR_UNI:100', ''),
+ 'lang_local_name' => array('VCHAR_UNI:255', ''),
+ 'lang_author' => array('VCHAR_UNI:255', ''),
+ ),
+ 'PRIMARY_KEY' => 'lang_id',
+ 'KEYS' => array(
+ 'lang_iso' => array('INDEX', 'lang_iso'),
+ ),
+);
+
+$schema_data['phpbb_log'] = array(
+ 'COLUMNS' => array(
+ 'log_id' => array('UINT', NULL, 'auto_increment'),
+ 'log_type' => array('TINT:4', 0),
+ 'user_id' => array('UINT', 0),
+ 'forum_id' => array('UINT', 0),
+ 'topic_id' => array('UINT', 0),
+ 'reportee_id' => array('UINT', 0),
+ 'log_ip' => array('VCHAR:40', ''),
+ 'log_time' => array('TIMESTAMP', 0),
+ 'log_operation' => array('TEXT_UNI', ''),
+ 'log_data' => array('MTEXT_UNI', ''),
+ ),
+ 'PRIMARY_KEY' => 'log_id',
+ 'KEYS' => array(
+ 'log_type' => array('INDEX', 'log_type'),
+ 'log_time' => array('INDEX', 'log_time'),
+ 'forum_id' => array('INDEX', 'forum_id'),
+ 'topic_id' => array('INDEX', 'topic_id'),
+ 'reportee_id' => array('INDEX', 'reportee_id'),
+ 'user_id' => array('INDEX', 'user_id'),
+ ),
+);
+
+$schema_data['phpbb_login_attempts'] = array(
+ 'COLUMNS' => array(
+ 'attempt_ip' => array('VCHAR:40', ''),
+ 'attempt_browser' => array('VCHAR:150', ''),
+ 'attempt_forwarded_for' => array('VCHAR:255', ''),
+ 'attempt_time' => array('TIMESTAMP', 0),
+ 'user_id' => array('UINT', 0),
+ 'username' => array('VCHAR_UNI:255', 0),
+ 'username_clean' => array('VCHAR_CI', 0),
+ ),
+ 'KEYS' => array(
+ 'att_ip' => array('INDEX', array('attempt_ip', 'attempt_time')),
+ 'att_for' => array('INDEX', array('attempt_forwarded_for', 'attempt_time')),
+ 'att_time' => array('INDEX', array('attempt_time')),
+ 'user_id' => array('INDEX', 'user_id'),
+ ),
+);
+
+$schema_data['phpbb_moderator_cache'] = array(
+ 'COLUMNS' => array(
+ 'forum_id' => array('UINT', 0),
+ 'user_id' => array('UINT', 0),
+ 'username' => array('VCHAR_UNI:255', ''),
+ 'group_id' => array('UINT', 0),
+ 'group_name' => array('VCHAR_UNI', ''),
+ 'display_on_index' => array('BOOL', 1),
+ ),
+ 'KEYS' => array(
+ 'disp_idx' => array('INDEX', 'display_on_index'),
+ 'forum_id' => array('INDEX', 'forum_id'),
+ ),
+);
+
+$schema_data['phpbb_migrations'] = array(
+ 'COLUMNS' => array(
+ 'migration_name' => array('VCHAR', ''),
+ 'migration_depends_on' => array('TEXT', ''),
+ 'migration_schema_done' => array('BOOL', 0),
+ 'migration_data_done' => array('BOOL', 0),
+ 'migration_data_state' => array('TEXT', ''),
+ 'migration_start_time' => array('TIMESTAMP', 0),
+ 'migration_end_time' => array('TIMESTAMP', 0),
+ ),
+ 'PRIMARY_KEY' => 'migration_name',
+);
+
+$schema_data['phpbb_modules'] = array(
+ 'COLUMNS' => array(
+ 'module_id' => array('UINT', NULL, 'auto_increment'),
+ 'module_enabled' => array('BOOL', 1),
+ 'module_display' => array('BOOL', 1),
+ 'module_basename' => array('VCHAR', ''),
+ 'module_class' => array('VCHAR:10', ''),
+ 'parent_id' => array('UINT', 0),
+ 'left_id' => array('UINT', 0),
+ 'right_id' => array('UINT', 0),
+ 'module_langname' => array('VCHAR', ''),
+ 'module_mode' => array('VCHAR', ''),
+ 'module_auth' => array('VCHAR', ''),
+ ),
+ 'PRIMARY_KEY' => 'module_id',
+ 'KEYS' => array(
+ 'left_right_id' => array('INDEX', array('left_id', 'right_id')),
+ 'module_enabled' => array('INDEX', 'module_enabled'),
+ 'class_left_id' => array('INDEX', array('module_class', 'left_id')),
+ ),
+);
+
+$schema_data['phpbb_notification_types'] = array(
+ 'COLUMNS' => array(
+ 'notification_type_id' => array('USINT', NULL, 'auto_increment'),
+ 'notification_type_name' => array('VCHAR:255', ''),
+ 'notification_type_enabled' => array('BOOL', 1),
+ ),
+ 'PRIMARY_KEY' => array('notification_type_id'),
+ 'KEYS' => array(
+ 'type' => array('UNIQUE', array('notification_type_name')),
+ ),
+);
+
+$schema_data['phpbb_notifications'] = array(
+ 'COLUMNS' => array(
+ 'notification_id' => array('UINT:10', NULL, 'auto_increment'),
+ 'notification_type_id' => array('USINT', 0),
+ 'item_id' => array('UINT', 0),
+ 'item_parent_id' => array('UINT', 0),
+ 'user_id' => array('UINT', 0),
+ 'notification_read' => array('BOOL', 0),
+ 'notification_time' => array('TIMESTAMP', 1),
+ 'notification_data' => array('TEXT_UNI', ''),
+ ),
+ 'PRIMARY_KEY' => 'notification_id',
+ 'KEYS' => array(
+ 'item_ident' => array('INDEX', array('notification_type_id', 'item_id')),
+ 'user' => array('INDEX', array('user_id', 'notification_read')),
+ ),
+);
+
+$schema_data['phpbb_oauth_accounts'] = array(
+ 'COLUMNS' => array(
+ 'user_id' => array('UINT', 0),
+ 'provider' => array('VCHAR', ''),
+ 'oauth_provider_id' => array('TEXT_UNI', ''),
+ ),
+ 'PRIMARY_KEY' => array(
+ 'user_id',
+ 'provider',
+ ),
+);
+
+$schema_data['phpbb_oauth_tokens'] = array(
+ 'COLUMNS' => array(
+ 'user_id' => array('UINT', 0), // phpbb_users.user_id
+ 'session_id' => array('CHAR:32', ''), // phpbb_sessions.session_id used only when user_id not set
+ 'provider' => array('VCHAR', ''), // Name of the OAuth provider
+ 'oauth_token' => array('MTEXT', ''), // Serialized token
+ ),
+ 'KEYS' => array(
+ 'user_id' => array('INDEX', 'user_id'),
+ 'provider' => array('INDEX', 'provider'),
+ ),
+);
+
+$schema_data['phpbb_poll_options'] = array(
+ 'COLUMNS' => array(
+ 'poll_option_id' => array('TINT:4', 0),
+ 'topic_id' => array('UINT', 0),
+ 'poll_option_text' => array('TEXT_UNI', ''),
+ 'poll_option_total' => array('UINT', 0),
+ ),
+ 'KEYS' => array(
+ 'poll_opt_id' => array('INDEX', 'poll_option_id'),
+ 'topic_id' => array('INDEX', 'topic_id'),
+ ),
+);
+
+$schema_data['phpbb_poll_votes'] = array(
+ 'COLUMNS' => array(
+ 'topic_id' => array('UINT', 0),
+ 'poll_option_id' => array('TINT:4', 0),
+ 'vote_user_id' => array('UINT', 0),
+ 'vote_user_ip' => array('VCHAR:40', ''),
+ ),
+ 'KEYS' => array(
+ 'topic_id' => array('INDEX', 'topic_id'),
+ 'vote_user_id' => array('INDEX', 'vote_user_id'),
+ 'vote_user_ip' => array('INDEX', 'vote_user_ip'),
+ ),
+);
+
+$schema_data['phpbb_posts'] = array(
+ 'COLUMNS' => array(
+ 'post_id' => array('UINT', NULL, 'auto_increment'),
+ 'topic_id' => array('UINT', 0),
+ 'forum_id' => array('UINT', 0),
+ 'poster_id' => array('UINT', 0),
+ 'icon_id' => array('UINT', 0),
+ 'poster_ip' => array('VCHAR:40', ''),
+ 'post_time' => array('TIMESTAMP', 0),
+ 'post_visibility' => array('TINT:3', 0),
+ 'post_reported' => array('BOOL', 0),
+ 'enable_bbcode' => array('BOOL', 1),
+ 'enable_smilies' => array('BOOL', 1),
+ 'enable_magic_url' => array('BOOL', 1),
+ 'enable_sig' => array('BOOL', 1),
+ 'post_username' => array('VCHAR_UNI:255', ''),
+ 'post_subject' => array('STEXT_UNI', '', 'true_sort'),
+ 'post_text' => array('MTEXT_UNI', ''),
+ 'post_checksum' => array('VCHAR:32', ''),
+ 'post_attachment' => array('BOOL', 0),
+ 'bbcode_bitfield' => array('VCHAR:255', ''),
+ 'bbcode_uid' => array('VCHAR:8', ''),
+ 'post_postcount' => array('BOOL', 1),
+ 'post_edit_time' => array('TIMESTAMP', 0),
+ 'post_edit_reason' => array('STEXT_UNI', ''),
+ 'post_edit_user' => array('UINT', 0),
+ 'post_edit_count' => array('USINT', 0),
+ 'post_edit_locked' => array('BOOL', 0),
+ 'post_delete_time' => array('TIMESTAMP', 0),
+ 'post_delete_reason' => array('STEXT_UNI', ''),
+ 'post_delete_user' => array('UINT', 0),
+ ),
+ 'PRIMARY_KEY' => 'post_id',
+ 'KEYS' => array(
+ 'forum_id' => array('INDEX', 'forum_id'),
+ 'topic_id' => array('INDEX', 'topic_id'),
+ 'poster_ip' => array('INDEX', 'poster_ip'),
+ 'poster_id' => array('INDEX', 'poster_id'),
+ 'post_visibility' => array('INDEX', 'post_visibility'),
+ 'post_username' => array('INDEX', 'post_username'),
+ 'tid_post_time' => array('INDEX', array('topic_id', 'post_time')),
+ ),
+);
+
+$schema_data['phpbb_privmsgs'] = array(
+ 'COLUMNS' => array(
+ 'msg_id' => array('UINT', NULL, 'auto_increment'),
+ 'root_level' => array('UINT', 0),
+ 'author_id' => array('UINT', 0),
+ 'icon_id' => array('UINT', 0),
+ 'author_ip' => array('VCHAR:40', ''),
+ 'message_time' => array('TIMESTAMP', 0),
+ 'enable_bbcode' => array('BOOL', 1),
+ 'enable_smilies' => array('BOOL', 1),
+ 'enable_magic_url' => array('BOOL', 1),
+ 'enable_sig' => array('BOOL', 1),
+ 'message_subject' => array('STEXT_UNI', ''),
+ 'message_text' => array('MTEXT_UNI', ''),
+ 'message_edit_reason' => array('STEXT_UNI', ''),
+ 'message_edit_user' => array('UINT', 0),
+ 'message_attachment' => array('BOOL', 0),
+ 'bbcode_bitfield' => array('VCHAR:255', ''),
+ 'bbcode_uid' => array('VCHAR:8', ''),
+ 'message_edit_time' => array('TIMESTAMP', 0),
+ 'message_edit_count' => array('USINT', 0),
+ 'to_address' => array('TEXT_UNI', ''),
+ 'bcc_address' => array('TEXT_UNI', ''),
+ 'message_reported' => array('BOOL', 0),
+ ),
+ 'PRIMARY_KEY' => 'msg_id',
+ 'KEYS' => array(
+ 'author_ip' => array('INDEX', 'author_ip'),
+ 'message_time' => array('INDEX', 'message_time'),
+ 'author_id' => array('INDEX', 'author_id'),
+ 'root_level' => array('INDEX', 'root_level'),
+ ),
+);
+
+$schema_data['phpbb_privmsgs_folder'] = array(
+ 'COLUMNS' => array(
+ 'folder_id' => array('UINT', NULL, 'auto_increment'),
+ 'user_id' => array('UINT', 0),
+ 'folder_name' => array('VCHAR_UNI', ''),
+ 'pm_count' => array('UINT', 0),
+ ),
+ 'PRIMARY_KEY' => 'folder_id',
+ 'KEYS' => array(
+ 'user_id' => array('INDEX', 'user_id'),
+ ),
+);
+
+$schema_data['phpbb_privmsgs_rules'] = array(
+ 'COLUMNS' => array(
+ 'rule_id' => array('UINT', NULL, 'auto_increment'),
+ 'user_id' => array('UINT', 0),
+ 'rule_check' => array('UINT', 0),
+ 'rule_connection' => array('UINT', 0),
+ 'rule_string' => array('VCHAR_UNI', ''),
+ 'rule_user_id' => array('UINT', 0),
+ 'rule_group_id' => array('UINT', 0),
+ 'rule_action' => array('UINT', 0),
+ 'rule_folder_id' => array('INT:11', 0),
+ ),
+ 'PRIMARY_KEY' => 'rule_id',
+ 'KEYS' => array(
+ 'user_id' => array('INDEX', 'user_id'),
+ ),
+);
+
+$schema_data['phpbb_privmsgs_to'] = array(
+ 'COLUMNS' => array(
+ 'msg_id' => array('UINT', 0),
+ 'user_id' => array('UINT', 0),
+ 'author_id' => array('UINT', 0),
+ 'pm_deleted' => array('BOOL', 0),
+ 'pm_new' => array('BOOL', 1),
+ 'pm_unread' => array('BOOL', 1),
+ 'pm_replied' => array('BOOL', 0),
+ 'pm_marked' => array('BOOL', 0),
+ 'pm_forwarded' => array('BOOL', 0),
+ 'folder_id' => array('INT:11', 0),
+ ),
+ 'KEYS' => array(
+ 'msg_id' => array('INDEX', 'msg_id'),
+ 'author_id' => array('INDEX', 'author_id'),
+ 'usr_flder_id' => array('INDEX', array('user_id', 'folder_id')),
+ ),
+);
+
+$schema_data['phpbb_profile_fields'] = array(
+ 'COLUMNS' => array(
+ 'field_id' => array('UINT', NULL, 'auto_increment'),
+ 'field_name' => array('VCHAR_UNI', ''),
+ 'field_type' => array('TINT:4', 0),
+ 'field_ident' => array('VCHAR:20', ''),
+ 'field_length' => array('VCHAR:20', ''),
+ 'field_minlen' => array('VCHAR', ''),
+ 'field_maxlen' => array('VCHAR', ''),
+ 'field_novalue' => array('VCHAR_UNI', ''),
+ 'field_default_value' => array('VCHAR_UNI', ''),
+ 'field_validation' => array('VCHAR_UNI:20', ''),
+ 'field_required' => array('BOOL', 0),
+ 'field_show_novalue' => array('BOOL', 0),
+ 'field_show_on_reg' => array('BOOL', 0),
+ 'field_show_on_pm' => array('BOOL', 0),
+ 'field_show_on_vt' => array('BOOL', 0),
+ 'field_show_profile' => array('BOOL', 0),
+ 'field_hide' => array('BOOL', 0),
+ 'field_no_view' => array('BOOL', 0),
+ 'field_active' => array('BOOL', 0),
+ 'field_order' => array('UINT', 0),
+ ),
+ 'PRIMARY_KEY' => 'field_id',
+ 'KEYS' => array(
+ 'fld_type' => array('INDEX', 'field_type'),
+ 'fld_ordr' => array('INDEX', 'field_order'),
+ ),
+);
+
+$schema_data['phpbb_profile_fields_data'] = array(
+ 'COLUMNS' => array(
+ 'user_id' => array('UINT', 0),
+ ),
+ 'PRIMARY_KEY' => 'user_id',
+);
+
+$schema_data['phpbb_profile_fields_lang'] = array(
+ 'COLUMNS' => array(
+ 'field_id' => array('UINT', 0),
+ 'lang_id' => array('UINT', 0),
+ 'option_id' => array('UINT', 0),
+ 'field_type' => array('TINT:4', 0),
+ 'lang_value' => array('VCHAR_UNI', ''),
+ ),
+ 'PRIMARY_KEY' => array('field_id', 'lang_id', 'option_id'),
+);
+
+$schema_data['phpbb_profile_lang'] = array(
+ 'COLUMNS' => array(
+ 'field_id' => array('UINT', 0),
+ 'lang_id' => array('UINT', 0),
+ 'lang_name' => array('VCHAR_UNI', ''),
+ 'lang_explain' => array('TEXT_UNI', ''),
+ 'lang_default_value' => array('VCHAR_UNI', ''),
+ ),
+ 'PRIMARY_KEY' => array('field_id', 'lang_id'),
+);
+
+$schema_data['phpbb_ranks'] = array(
+ 'COLUMNS' => array(
+ 'rank_id' => array('UINT', NULL, 'auto_increment'),
+ 'rank_title' => array('VCHAR_UNI', ''),
+ 'rank_min' => array('UINT', 0),
+ 'rank_special' => array('BOOL', 0),
+ 'rank_image' => array('VCHAR', ''),
+ ),
+ 'PRIMARY_KEY' => 'rank_id',
+);
+
+$schema_data['phpbb_reports'] = array(
+ 'COLUMNS' => array(
+ 'report_id' => array('UINT', NULL, 'auto_increment'),
+ 'reason_id' => array('USINT', 0),
+ 'post_id' => array('UINT', 0),
+ 'pm_id' => array('UINT', 0),
+ 'user_id' => array('UINT', 0),
+ 'user_notify' => array('BOOL', 0),
+ 'report_closed' => array('BOOL', 0),
+ 'report_time' => array('TIMESTAMP', 0),
+ 'report_text' => array('MTEXT_UNI', ''),
+ 'reported_post_text' => array('MTEXT_UNI', ''),
+ 'reported_post_uid' => array('VCHAR:8', ''),
+ 'reported_post_bitfield' => array('VCHAR:255', ''),
+ 'reported_post_enable_magic_url' => array('BOOL', 1),
+ 'reported_post_enable_smilies' => array('BOOL', 1),
+ 'reported_post_enable_bbcode' => array('BOOL', 1)
+ ),
+ 'PRIMARY_KEY' => 'report_id',
+ 'KEYS' => array(
+ 'post_id' => array('INDEX', 'post_id'),
+ 'pm_id' => array('INDEX', 'pm_id'),
+ ),
+);
+
+$schema_data['phpbb_reports_reasons'] = array(
+ 'COLUMNS' => array(
+ 'reason_id' => array('USINT', NULL, 'auto_increment'),
+ 'reason_title' => array('VCHAR_UNI', ''),
+ 'reason_description' => array('MTEXT_UNI', ''),
+ 'reason_order' => array('USINT', 0),
+ ),
+ 'PRIMARY_KEY' => 'reason_id',
+);
+
+$schema_data['phpbb_search_results'] = array(
+ 'COLUMNS' => array(
+ 'search_key' => array('VCHAR:32', ''),
+ 'search_time' => array('TIMESTAMP', 0),
+ 'search_keywords' => array('MTEXT_UNI', ''),
+ 'search_authors' => array('MTEXT', ''),
+ ),
+ 'PRIMARY_KEY' => 'search_key',
+);
+
+$schema_data['phpbb_search_wordlist'] = array(
+ 'COLUMNS' => array(
+ 'word_id' => array('UINT', NULL, 'auto_increment'),
+ 'word_text' => array('VCHAR_UNI', ''),
+ 'word_common' => array('BOOL', 0),
+ 'word_count' => array('UINT', 0),
+ ),
+ 'PRIMARY_KEY' => 'word_id',
+ 'KEYS' => array(
+ 'wrd_txt' => array('UNIQUE', 'word_text'),
+ 'wrd_cnt' => array('INDEX', 'word_count'),
+ ),
+);
+
+$schema_data['phpbb_search_wordmatch'] = array(
+ 'COLUMNS' => array(
+ 'post_id' => array('UINT', 0),
+ 'word_id' => array('UINT', 0),
+ 'title_match' => array('BOOL', 0),
+ ),
+ 'KEYS' => array(
+ 'unq_mtch' => array('UNIQUE', array('word_id', 'post_id', 'title_match')),
+ 'word_id' => array('INDEX', 'word_id'),
+ 'post_id' => array('INDEX', 'post_id'),
+ ),
+);
+
+$schema_data['phpbb_sessions'] = array(
+ 'COLUMNS' => array(
+ 'session_id' => array('CHAR:32', ''),
+ 'session_user_id' => array('UINT', 0),
+ 'session_forum_id' => array('UINT', 0),
+ 'session_last_visit' => array('TIMESTAMP', 0),
+ 'session_start' => array('TIMESTAMP', 0),
+ 'session_time' => array('TIMESTAMP', 0),
+ 'session_ip' => array('VCHAR:40', ''),
+ 'session_browser' => array('VCHAR:150', ''),
+ 'session_forwarded_for' => array('VCHAR:255', ''),
+ 'session_page' => array('VCHAR_UNI', ''),
+ 'session_viewonline' => array('BOOL', 1),
+ 'session_autologin' => array('BOOL', 0),
+ 'session_admin' => array('BOOL', 0),
+ ),
+ 'PRIMARY_KEY' => 'session_id',
+ 'KEYS' => array(
+ 'session_time' => array('INDEX', 'session_time'),
+ 'session_user_id' => array('INDEX', 'session_user_id'),
+ 'session_fid' => array('INDEX', 'session_forum_id'),
+ ),
+);
+
+$schema_data['phpbb_sessions_keys'] = array(
+ 'COLUMNS' => array(
+ 'key_id' => array('CHAR:32', ''),
+ 'user_id' => array('UINT', 0),
+ 'last_ip' => array('VCHAR:40', ''),
+ 'last_login' => array('TIMESTAMP', 0),
+ ),
+ 'PRIMARY_KEY' => array('key_id', 'user_id'),
+ 'KEYS' => array(
+ 'last_login' => array('INDEX', 'last_login'),
+ ),
+);
+
+$schema_data['phpbb_sitelist'] = array(
+ 'COLUMNS' => array(
+ 'site_id' => array('UINT', NULL, 'auto_increment'),
+ 'site_ip' => array('VCHAR:40', ''),
+ 'site_hostname' => array('VCHAR', ''),
+ 'ip_exclude' => array('BOOL', 0),
+ ),
+ 'PRIMARY_KEY' => 'site_id',
+);
+
+$schema_data['phpbb_smilies'] = array(
+ 'COLUMNS' => array(
+ 'smiley_id' => array('UINT', NULL, 'auto_increment'),
+ // We may want to set 'code' to VCHAR:50 or check if unicode support is possible... at the moment only ASCII characters are allowed.
+ 'code' => array('VCHAR_UNI:50', ''),
+ 'emotion' => array('VCHAR_UNI:50', ''),
+ 'smiley_url' => array('VCHAR:50', ''),
+ 'smiley_width' => array('USINT', 0),
+ 'smiley_height' => array('USINT', 0),
+ 'smiley_order' => array('UINT', 0),
+ 'display_on_posting'=> array('BOOL', 1),
+ ),
+ 'PRIMARY_KEY' => 'smiley_id',
+ 'KEYS' => array(
+ 'display_on_post' => array('INDEX', 'display_on_posting'),
+ ),
+);
+
+$schema_data['phpbb_styles'] = array(
+ 'COLUMNS' => array(
+ 'style_id' => array('UINT', NULL, 'auto_increment'),
+ 'style_name' => array('VCHAR_UNI:255', ''),
+ 'style_copyright' => array('VCHAR_UNI', ''),
+ 'style_active' => array('BOOL', 1),
+ 'style_path' => array('VCHAR:100', ''),
+ 'bbcode_bitfield' => array('VCHAR:255', 'kNg='),
+ 'style_parent_id' => array('UINT:4', 0),
+ 'style_parent_tree' => array('TEXT', ''),
+ ),
+ 'PRIMARY_KEY' => 'style_id',
+ 'KEYS' => array(
+ 'style_name' => array('UNIQUE', 'style_name'),
+ ),
+);
+
+$schema_data['phpbb_teampage'] = array(
+ 'COLUMNS' => array(
+ 'teampage_id' => array('UINT', NULL, 'auto_increment'),
+ 'group_id' => array('UINT', 0),
+ 'teampage_name' => array('VCHAR_UNI:255', ''),
+ 'teampage_position' => array('UINT', 0),
+ 'teampage_parent' => array('UINT', 0),
+ ),
+ 'PRIMARY_KEY' => 'teampage_id',
+);
+
+$schema_data['phpbb_topics'] = array(
+ 'COLUMNS' => array(
+ 'topic_id' => array('UINT', NULL, 'auto_increment'),
+ 'forum_id' => array('UINT', 0),
+ 'icon_id' => array('UINT', 0),
+ 'topic_attachment' => array('BOOL', 0),
+ 'topic_visibility' => array('TINT:3', 0),
+ 'topic_reported' => array('BOOL', 0),
+ 'topic_title' => array('STEXT_UNI', '', 'true_sort'),
+ 'topic_poster' => array('UINT', 0),
+ 'topic_time' => array('TIMESTAMP', 0),
+ 'topic_time_limit' => array('TIMESTAMP', 0),
+ 'topic_views' => array('UINT', 0),
+ 'topic_posts_approved' => array('UINT', 0),
+ 'topic_posts_unapproved' => array('UINT', 0),
+ 'topic_posts_softdeleted' => array('UINT', 0),
+ 'topic_status' => array('TINT:3', 0),
+ 'topic_type' => array('TINT:3', 0),
+ 'topic_first_post_id' => array('UINT', 0),
+ 'topic_first_poster_name' => array('VCHAR_UNI', ''),
+ 'topic_first_poster_colour' => array('VCHAR:6', ''),
+ 'topic_last_post_id' => array('UINT', 0),
+ 'topic_last_poster_id' => array('UINT', 0),
+ 'topic_last_poster_name' => array('VCHAR_UNI', ''),
+ 'topic_last_poster_colour' => array('VCHAR:6', ''),
+ 'topic_last_post_subject' => array('STEXT_UNI', ''),
+ 'topic_last_post_time' => array('TIMESTAMP', 0),
+ 'topic_last_view_time' => array('TIMESTAMP', 0),
+ 'topic_moved_id' => array('UINT', 0),
+ 'topic_bumped' => array('BOOL', 0),
+ 'topic_bumper' => array('UINT', 0),
+ 'poll_title' => array('STEXT_UNI', ''),
+ 'poll_start' => array('TIMESTAMP', 0),
+ 'poll_length' => array('TIMESTAMP', 0),
+ 'poll_max_options' => array('TINT:4', 1),
+ 'poll_last_vote' => array('TIMESTAMP', 0),
+ 'poll_vote_change' => array('BOOL', 0),
+ 'topic_delete_time' => array('TIMESTAMP', 0),
+ 'topic_delete_reason' => array('STEXT_UNI', ''),
+ 'topic_delete_user' => array('UINT', 0),
+ ),
+ 'PRIMARY_KEY' => 'topic_id',
+ 'KEYS' => array(
+ 'forum_id' => array('INDEX', 'forum_id'),
+ 'forum_id_type' => array('INDEX', array('forum_id', 'topic_type')),
+ 'last_post_time' => array('INDEX', 'topic_last_post_time'),
+ 'topic_visibility' => array('INDEX', 'topic_visibility'),
+ 'forum_appr_last' => array('INDEX', array('forum_id', 'topic_visibility', 'topic_last_post_id')),
+ 'fid_time_moved' => array('INDEX', array('forum_id', 'topic_last_post_time', 'topic_moved_id')),
+ ),
+);
+
+$schema_data['phpbb_topics_track'] = array(
+ 'COLUMNS' => array(
+ 'user_id' => array('UINT', 0),
+ 'topic_id' => array('UINT', 0),
+ 'forum_id' => array('UINT', 0),
+ 'mark_time' => array('TIMESTAMP', 0),
+ ),
+ 'PRIMARY_KEY' => array('user_id', 'topic_id'),
+ 'KEYS' => array(
+ 'topic_id' => array('INDEX', 'topic_id'),
+ 'forum_id' => array('INDEX', 'forum_id'),
+ ),
+);
+
+$schema_data['phpbb_topics_posted'] = array(
+ 'COLUMNS' => array(
+ 'user_id' => array('UINT', 0),
+ 'topic_id' => array('UINT', 0),
+ 'topic_posted' => array('BOOL', 0),
+ ),
+ 'PRIMARY_KEY' => array('user_id', 'topic_id'),
+);
+
+$schema_data['phpbb_topics_watch'] = array(
+ 'COLUMNS' => array(
+ 'topic_id' => array('UINT', 0),
+ 'user_id' => array('UINT', 0),
+ 'notify_status' => array('BOOL', 0),
+ ),
+ 'KEYS' => array(
+ 'topic_id' => array('INDEX', 'topic_id'),
+ 'user_id' => array('INDEX', 'user_id'),
+ 'notify_stat' => array('INDEX', 'notify_status'),
+ ),
+);
+
+$schema_data['phpbb_user_notifications'] = array(
+ 'COLUMNS' => array(
+ 'item_type' => array('VCHAR:255', ''),
+ 'item_id' => array('UINT', 0),
+ 'user_id' => array('UINT', 0),
+ 'method' => array('VCHAR:255', ''),
+ 'notify' => array('BOOL', 1),
+ ),
+);
+
+$schema_data['phpbb_user_group'] = array(
+ 'COLUMNS' => array(
+ 'group_id' => array('UINT', 0),
+ 'user_id' => array('UINT', 0),
+ 'group_leader' => array('BOOL', 0),
+ 'user_pending' => array('BOOL', 1),
+ ),
+ 'KEYS' => array(
+ 'group_id' => array('INDEX', 'group_id'),
+ 'user_id' => array('INDEX', 'user_id'),
+ 'group_leader' => array('INDEX', 'group_leader'),
+ ),
+);
+
+$schema_data['phpbb_users'] = array(
+ 'COLUMNS' => array(
+ 'user_id' => array('UINT', NULL, 'auto_increment'),
+ 'user_type' => array('TINT:2', 0),
+ 'group_id' => array('UINT', 3),
+ 'user_permissions' => array('MTEXT', ''),
+ 'user_perm_from' => array('UINT', 0),
+ 'user_ip' => array('VCHAR:40', ''),
+ 'user_regdate' => array('TIMESTAMP', 0),
+ 'username' => array('VCHAR_CI', ''),
+ 'username_clean' => array('VCHAR_CI', ''),
+ 'user_password' => array('VCHAR_UNI:40', ''),
+ 'user_passchg' => array('TIMESTAMP', 0),
+ 'user_pass_convert' => array('BOOL', 0),
+ 'user_email' => array('VCHAR_UNI:100', ''),
+ 'user_email_hash' => array('BINT', 0),
+ 'user_birthday' => array('VCHAR:10', ''),
+ 'user_lastvisit' => array('TIMESTAMP', 0),
+ 'user_lastmark' => array('TIMESTAMP', 0),
+ 'user_lastpost_time' => array('TIMESTAMP', 0),
+ 'user_lastpage' => array('VCHAR_UNI:200', ''),
+ 'user_last_confirm_key' => array('VCHAR:10', ''),
+ 'user_last_search' => array('TIMESTAMP', 0),
+ 'user_warnings' => array('TINT:4', 0),
+ 'user_last_warning' => array('TIMESTAMP', 0),
+ 'user_login_attempts' => array('TINT:4', 0),
+ 'user_inactive_reason' => array('TINT:2', 0),
+ 'user_inactive_time' => array('TIMESTAMP', 0),
+ 'user_posts' => array('UINT', 0),
+ 'user_lang' => array('VCHAR:30', ''),
+ 'user_timezone' => array('VCHAR:100', 'UTC'),
+ 'user_dateformat' => array('VCHAR_UNI:30', 'd M Y H:i'),
+ 'user_style' => array('UINT', 0),
+ 'user_rank' => array('UINT', 0),
+ 'user_colour' => array('VCHAR:6', ''),
+ 'user_new_privmsg' => array('INT:4', 0),
+ 'user_unread_privmsg' => array('INT:4', 0),
+ 'user_last_privmsg' => array('TIMESTAMP', 0),
+ 'user_message_rules' => array('BOOL', 0),
+ 'user_full_folder' => array('INT:11', -3),
+ 'user_emailtime' => array('TIMESTAMP', 0),
+ 'user_topic_show_days' => array('USINT', 0),
+ 'user_topic_sortby_type' => array('VCHAR:1', 't'),
+ 'user_topic_sortby_dir' => array('VCHAR:1', 'd'),
+ 'user_post_show_days' => array('USINT', 0),
+ 'user_post_sortby_type' => array('VCHAR:1', 't'),
+ 'user_post_sortby_dir' => array('VCHAR:1', 'a'),
+ 'user_notify' => array('BOOL', 0),
+ 'user_notify_pm' => array('BOOL', 1),
+ 'user_notify_type' => array('TINT:4', 0),
+ 'user_allow_pm' => array('BOOL', 1),
+ 'user_allow_viewonline' => array('BOOL', 1),
+ 'user_allow_viewemail' => array('BOOL', 1),
+ 'user_allow_massemail' => array('BOOL', 1),
+ 'user_options' => array('UINT:11', 230271),
+ 'user_avatar' => array('VCHAR', ''),
+ 'user_avatar_type' => array('VCHAR:255', ''),
+ 'user_avatar_width' => array('USINT', 0),
+ 'user_avatar_height' => array('USINT', 0),
+ 'user_sig' => array('MTEXT_UNI', ''),
+ 'user_sig_bbcode_uid' => array('VCHAR:8', ''),
+ 'user_sig_bbcode_bitfield' => array('VCHAR:255', ''),
+ 'user_from' => array('VCHAR_UNI:100', ''),
+ 'user_icq' => array('VCHAR:15', ''),
+ 'user_aim' => array('VCHAR_UNI', ''),
+ 'user_yim' => array('VCHAR_UNI', ''),
+ 'user_msnm' => array('VCHAR_UNI', ''),
+ 'user_jabber' => array('VCHAR_UNI', ''),
+ 'user_website' => array('VCHAR_UNI:200', ''),
+ 'user_occ' => array('TEXT_UNI', ''),
+ 'user_interests' => array('TEXT_UNI', ''),
+ 'user_actkey' => array('VCHAR:32', ''),
+ 'user_newpasswd' => array('VCHAR_UNI:40', ''),
+ 'user_form_salt' => array('VCHAR_UNI:32', ''),
+ 'user_new' => array('BOOL', 1),
+ 'user_reminded' => array('TINT:4', 0),
+ 'user_reminded_time' => array('TIMESTAMP', 0),
+ ),
+ 'PRIMARY_KEY' => 'user_id',
+ 'KEYS' => array(
+ 'user_birthday' => array('INDEX', 'user_birthday'),
+ 'user_email_hash' => array('INDEX', 'user_email_hash'),
+ 'user_type' => array('INDEX', 'user_type'),
+ 'username_clean' => array('UNIQUE', 'username_clean'),
+ ),
+);
+
+$schema_data['phpbb_warnings'] = array(
+ 'COLUMNS' => array(
+ 'warning_id' => array('UINT', NULL, 'auto_increment'),
+ 'user_id' => array('UINT', 0),
+ 'post_id' => array('UINT', 0),
+ 'log_id' => array('UINT', 0),
+ 'warning_time' => array('TIMESTAMP', 0),
+ ),
+ 'PRIMARY_KEY' => 'warning_id',
+);
+
+$schema_data['phpbb_words'] = array(
+ 'COLUMNS' => array(
+ 'word_id' => array('UINT', NULL, 'auto_increment'),
+ 'word' => array('VCHAR_UNI', ''),
+ 'replacement' => array('VCHAR_UNI', ''),
+ ),
+ 'PRIMARY_KEY' => 'word_id',
+);
+
+$schema_data['phpbb_zebra'] = array(
+ 'COLUMNS' => array(
+ 'user_id' => array('UINT', 0),
+ 'zebra_id' => array('UINT', 0),
+ 'friend' => array('BOOL', 0),
+ 'foe' => array('BOOL', 0),
+ ),
+ 'PRIMARY_KEY' => array('user_id', 'zebra_id'),
+);
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 3db843ffd1..b3e50847fd 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -7,8 +7,6 @@
*
*/
-use Symfony\Component\HttpFoundation\Request;
-
/**
* @ignore
*/
@@ -26,13 +24,13 @@ if (!defined('IN_PHPBB'))
function set_var(&$result, $var, $type, $multibyte = false)
{
// 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);
}
/**
-* Wrapper function of phpbb_request::variable which exists for backwards compatability.
-* See {@link phpbb_request_interface::variable phpbb_request_interface::variable} for
+* Wrapper function of \phpbb\request\request::variable which exists for backwards compatability.
+* See {@link \phpbb\request\request_interface::variable \phpbb\request\request_interface::variable} for
* documentation of this function's use.
*
* @deprecated
@@ -40,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
* 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".
-* 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
* 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.
* 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
* 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
-* phpbb_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 bool $cookie This param is mapped to \phpbb\request\request_interface::COOKIE as the last param for
+* \phpbb\request\request_interface::variable for backwards compatability reasons.
+* @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
-* 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
-* 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
* the same as that of $default. If the variable is not set $default is returned.
@@ -64,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.
static $static_request = null;
- if ($request instanceof phpbb_request_interface)
+ if ($request instanceof \phpbb\request\request_interface)
{
$static_request = $request;
@@ -90,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
// 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);
}
/**
@@ -112,7 +110,7 @@ function request_var($var_name, $default, $multibyte = false, $cookie = false, $
*
* @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;
@@ -142,7 +140,7 @@ function set_config($config_name, $config_value, $is_dynamic = false, phpbb_conf
*
* @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;
@@ -1067,12 +1065,19 @@ function phpbb_clean_path($path)
else
{
// 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;
require($phpbb_root_path . 'includes/filesystem.' . $phpEx);
}
- $phpbb_filesystem = new phpbb_filesystem();
+
+ $phpbb_filesystem = new phpbb\filesystem(
+ new phpbb\symfony_request(
+ new phpbb\request\request()
+ ),
+ $phpbb_root_path,
+ $phpEx
+ );
}
return $phpbb_filesystem->clean_path($path);
@@ -1253,7 +1258,7 @@ function tz_select($default = '', $truncate = false)
/**
* 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 boolean $truncate Shall we truncate the options text
*
@@ -1272,7 +1277,7 @@ function phpbb_timezone_select($user, $default = '', $truncate = false)
foreach ($unsorted_timezones as $timezone)
{
$tz = new DateTimeZone($timezone);
- $dt = new phpbb_datetime($user, 'now', $tz);
+ $dt = new \phpbb\datetime($user, 'now', $tz);
$offset = $dt->getOffset();
$current_time = $dt->format($user->lang['DATETIME_FORMAT'], true);
$offset_string = phpbb_format_timezone_offset($offset);
@@ -1391,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'])
{
- $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();
unset($tracking_topics['tf']);
@@ -1400,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);
$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);
@@ -1503,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'])
{
- $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();
foreach ($forum_id as $f_id)
@@ -1534,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);
- $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);
}
@@ -1591,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'])
{
- $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();
$topic_id36 = base_convert($topic_id, 10, 36);
@@ -1605,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
// 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);
@@ -1650,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);
- $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;
@@ -1788,7 +1793,7 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis
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();
}
@@ -1985,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'])
{
- $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();
if (!$user->data['is_registered'])
@@ -2200,6 +2205,32 @@ function tracking_unserialize($string, $max_depth = 3)
}
// Pagination functions
+/**
+* Generate a pagination link based on the url and the page information
+*
+* @param string $base_url is url prepended to all links generated within the function
+* If you use page numbers inside your controller route, base_url should contains a placeholder (%d)
+* for the page. Also be sure to specify the pagination path information into the start_name argument
+* @param string $on_page is the page for which we want to generate the link
+* @param string $start_name is the name of the parameter containing the first item of the given page (example: start=20)
+* If you use page numbers inside your controller route, start name should be the string
+* that should be removed for the first page (example: /page/%d)
+* @param int $per_page the number of items, posts, etc. to display per page, used to determine the number of pages to produce
+* @return URL for the requested page
+*/
+function phpbb_generate_page_link($base_url, $on_page, $start_name, $per_page)
+{
+
+ if (strpos($start_name, '%d') !== false)
+ {
+ return ($on_page > 1) ? sprintf($base_url, (int) $on_page) : str_replace($start_name, '', $base_url);
+ }
+ else
+ {
+ $url_delim = (strpos($base_url, '?') === false) ? '?' : ((strpos($base_url, '?') === strlen($base_url) - 1) ? '' : '&amp;');
+ return ($on_page > 1) ? $base_url . $url_delim . $start_name . '=' . (($on_page - 1) * $per_page) : $base_url;
+ }
+}
/**
* Generate template rendered pagination
@@ -2207,8 +2238,12 @@ function tracking_unserialize($string, $max_depth = 3)
*
* @param object $template the template object
* @param string $base_url is url prepended to all links generated within the function
+* If you use page numbers inside your controller route, base_url should contains a placeholder (%d)
+* for the page. Also be sure to specify the pagination path information into the start_name argument
* @param string $block_var_name is the name assigned to the pagination data block within the template (example: <!-- BEGIN pagination -->)
* @param string $start_name is the name of the parameter containing the first item of the given page (example: start=20)
+* If you use page numbers inside your controller route, start name should be the string
+* that should be removed for the first page (example: /page/%d)
* @param int $num_items the total number of items, posts, etc., used to determine the number of pages to produce
* @param int $per_page the number of items, posts, etc. to display per page, used to determine the number of pages to produce
* @param int $start_item the item which should be considered currently active, used to determine the page we're on
@@ -2228,7 +2263,6 @@ function phpbb_generate_template_pagination($template, $base_url, $block_var_nam
}
$on_page = floor($start_item / $per_page) + 1;
- $url_delim = (strpos($base_url, '?') === false) ? '?' : ((strpos($base_url, '?') === strlen($base_url) - 1) ? '' : '&amp;');
if ($reverse_count)
{
@@ -2256,11 +2290,14 @@ function phpbb_generate_template_pagination($template, $base_url, $block_var_nam
$end_page = ($total_pages > 5) ? max(min($total_pages, $on_page + 3), 5) : $total_pages;
}
+ $u_previous_page = $u_next_page = '';
if ($on_page != 1)
{
+ $u_previous_page = phpbb_generate_page_link($base_url, $on_page - 1, $start_name, $per_page);
+
$template->assign_block_vars($block_var_name, array(
'PAGE_NUMBER' => '',
- 'PAGE_URL' => $base_url . $url_delim . $start_name . '=' . (($on_page - 2) * $per_page),
+ 'PAGE_URL' => $u_previous_page,
'S_IS_CURRENT' => false,
'S_IS_PREV' => true,
'S_IS_NEXT' => false,
@@ -2274,15 +2311,13 @@ function phpbb_generate_template_pagination($template, $base_url, $block_var_nam
$at_page = 1;
do
{
- $page_url = $base_url . (($at_page == 1) ? '' : $url_delim . $start_name . '=' . (($at_page - 1) * $per_page));
-
// We decide whether to display the ellipsis during the loop. The ellipsis is always
// displayed as either the second or penultimate item in the list. So are we at either
// of those points and of course do we even need to display it, i.e. is the list starting
// on at least page 3 and ending three pages before the final item.
$template->assign_block_vars($block_var_name, array(
'PAGE_NUMBER' => $at_page,
- 'PAGE_URL' => $page_url,
+ 'PAGE_URL' => phpbb_generate_page_link($base_url, $at_page, $start_name, $per_page),
'S_IS_CURRENT' => (!$ignore_on_page && $at_page == $on_page),
'S_IS_NEXT' => false,
'S_IS_PREV' => false,
@@ -2312,9 +2347,11 @@ function phpbb_generate_template_pagination($template, $base_url, $block_var_nam
if ($on_page != $total_pages)
{
+ $u_next_page = phpbb_generate_page_link($base_url, $on_page + 1, $start_name, $per_page);
+
$template->assign_block_vars($block_var_name, array(
'PAGE_NUMBER' => '',
- 'PAGE_URL' => $base_url . $url_delim . $start_name . '=' . ($on_page * $per_page),
+ 'PAGE_URL' => $u_next_page,
'S_IS_CURRENT' => false,
'S_IS_PREV' => false,
'S_IS_NEXT' => true,
@@ -2339,14 +2376,11 @@ function phpbb_generate_template_pagination($template, $base_url, $block_var_nam
}
$tpl_prefix = ($tpl_prefix == 'PAGINATION') ? '' : $tpl_prefix . '_';
- $previous_page = ($on_page != 1) ? $base_url . $url_delim . $start_name . '=' . (($on_page - 2) * $per_page) : '';
-
$template_array = array(
$tpl_prefix . 'BASE_URL' => $base_url,
- 'A_' . $tpl_prefix . 'BASE_URL' => addslashes($base_url),
$tpl_prefix . 'PER_PAGE' => $per_page,
- 'U_' . $tpl_prefix . 'PREVIOUS_PAGE' => $previous_page,
- 'U_' . $tpl_prefix . 'NEXT_PAGE' => ($on_page != $total_pages) ? $base_url . $url_delim . $start_name . '=' . ($on_page * $per_page) : '',
+ 'U_' . $tpl_prefix . 'PREVIOUS_PAGE' => ($on_page != 1) ? $u_previous_page : '',
+ 'U_' . $tpl_prefix . 'NEXT_PAGE' => ($on_page != $total_pages) ? $u_next_page : '',
$tpl_prefix . 'TOTAL_PAGES' => $total_pages,
$tpl_prefix . 'CURRENT_PAGE' => $on_page,
);
@@ -2383,7 +2417,7 @@ function phpbb_on_page($template, $user, $base_url, $num_items, $per_page, $star
$template->assign_vars(array(
'PER_PAGE' => $per_page,
'ON_PAGE' => $on_page,
- 'A_BASE_URL' => addslashes($base_url),
+ 'BASE_URL' => $base_url,
));
return sprintf($user->lang['PAGE_OF'], $on_page, max(ceil($num_items / $per_page), 1));
@@ -2411,7 +2445,7 @@ function phpbb_on_page($template, $user, $base_url, $num_items, $per_page, $star
*/
function append_sid($url, $params = false, $is_amp = true, $session_id = false)
{
- global $_SID, $_EXTRA_URL, $phpbb_hook;
+ global $_SID, $_EXTRA_URL, $phpbb_hook, $phpbb_filesystem;
global $phpbb_dispatcher;
if ($params === '' || (is_array($params) && empty($params)))
@@ -2420,6 +2454,12 @@ function append_sid($url, $params = false, $is_amp = true, $session_id = false)
$params = false;
}
+ // Update the root path with the correct relative web path
+ if ($phpbb_filesystem instanceof \phpbb\filesystem)
+ {
+ $url = $phpbb_filesystem->update_web_root_path($url);
+ }
+
$append_sid_overwrite = false;
/**
@@ -2809,8 +2849,22 @@ function build_url($strip_vars = false)
{
global $user, $phpbb_root_path;
+ $page = $user->page['page'];
+
+ // We need to be cautious here.
+ // On some situations, the redirect path is an absolute URL, sometimes a relative path
+ // For a relative path, let's prefix it with $phpbb_root_path to point to the correct location,
+ // else we use the URL directly.
+ $url_parts = parse_url($page);
+
+ // URL
+ if ($url_parts !== false && !empty($url_parts['scheme']) && !empty($url_parts['host']))
+ {
+ $page = $phpbb_root_path . $page;
+ }
+
// Append SID
- $redirect = append_sid($user->page['page'], false, false);
+ $redirect = append_sid($page, false, false);
// Add delimiter if not there...
if (strpos($redirect, '?') === false)
@@ -2865,19 +2919,7 @@ function build_url($strip_vars = false)
$redirect .= ($query) ? '?' . $query : '';
}
- // We need to be cautious here.
- // On some situations, the redirect path is an absolute URL, sometimes a relative path
- // For a relative path, let's prefix it with $phpbb_root_path to point to the correct location,
- // else we use the URL directly.
- $url_parts = @parse_url($redirect);
-
- // URL
- if ($url_parts !== false && !empty($url_parts['scheme']) && !empty($url_parts['host']))
- {
- return str_replace('&', '&amp;', $redirect);
- }
-
- return $phpbb_root_path . str_replace('&', '&amp;', $redirect);
+ return str_replace('&', '&amp;', $redirect);
}
/**
@@ -3094,7 +3136,7 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo
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)
{
@@ -3171,7 +3213,7 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo
if ($request->is_ajax())
{
$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(
'MESSAGE_BODY' => $template->assign_display('body'),
'MESSAGE_TITLE' => (!isset($user->lang[$title])) ? $user->lang['CONFIRM'] : $user->lang[$title],
@@ -3199,7 +3241,7 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo
function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = false, $s_display = true)
{
global $db, $user, $template, $auth, $phpEx, $phpbb_root_path, $config;
- global $request;
+ global $request, $phpbb_container;
if (!class_exists('phpbb_captcha_factory', false))
{
@@ -3226,7 +3268,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa
trigger_error('NO_AUTH_ADMIN');
}
- if (isset($_POST['login']))
+ if ($request->is_set_post('login') || ($request->is_set('login') && $request->variable('login', '') == 'external'))
{
// Get credential
if ($admin)
@@ -3367,6 +3409,29 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa
$s_hidden_fields['credential'] = $credential;
}
+ $auth_provider = $phpbb_container->get('auth.provider.' . $config['auth_method']);
+
+ $auth_provider_data = $auth_provider->get_login_data();
+ if ($auth_provider_data)
+ {
+ if (isset($auth_provider_data['VARS']))
+ {
+ $template->assign_vars($auth_provider_data['VARS']);
+ }
+
+ if (isset($auth_provider_data['BLOCK_VAR_NAME']))
+ {
+ foreach ($auth_provider_data['BLOCK_VARS'] as $block_vars)
+ {
+ $template->assign_block_vars($auth_provider_data['BLOCK_VAR_NAME'], $block_vars);
+ }
+ }
+
+ $template->assign_vars(array(
+ 'PROVIDER_TEMPLATE_FILE' => $auth_provider_data['TEMPLATE_FILE'],
+ ));
+ }
+
$s_hidden_fields = build_hidden_fields($s_hidden_fields);
$template->assign_vars(array(
@@ -4390,7 +4455,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
{
global $refresh_data;
- $json_response = new phpbb_json_response;
+ $json_response = new \phpbb\json_response;
$json_response->send(array(
'MESSAGE_TITLE' => $msg_title,
'MESSAGE_TEXT' => $msg_text,
@@ -4896,7 +4961,7 @@ function phpbb_http_login($param)
$username = null;
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));
break;
@@ -4906,7 +4971,7 @@ function phpbb_http_login($param)
$password = null;
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));
break;
@@ -5007,13 +5072,13 @@ function phpbb_quoteattr($data, $entities = null)
*
* 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
* @return string HTML with hidden fields
*/
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 = '';
foreach ($names as $name)
{
@@ -5035,7 +5100,7 @@ function phpbb_build_hidden_fields_for_query_params($request, $exclude = null)
// here. To avoid exposing cookies, skip variables that are
// overwritten somewhere other than GET entirely.
$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)
{
$escaped_value = phpbb_quoteattr($value);
@@ -5051,7 +5116,7 @@ function phpbb_build_hidden_fields_for_query_params($request, $exclude = null)
function page_header($page_title = '', $display_online_list = true, $item_id = 0, $item = 'forum')
{
global $db, $config, $template, $SID, $_SID, $_EXTRA_URL, $user, $auth, $phpEx, $phpbb_root_path;
- global $phpbb_dispatcher, $request, $phpbb_container;
+ global $phpbb_dispatcher, $request, $phpbb_container, $adm_relative_path;
if (defined('HEADER_INC'))
{
@@ -5208,7 +5273,12 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
// Determine board url - we may need it later
$board_url = generate_board_url() . '/';
- $web_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? $board_url : $phpbb_root_path;
+ // This path is sent with the base template paths in the assign_vars()
+ // call below. We need to correct it in case we are accessing from a
+ // controller because the web paths will be incorrect otherwise.
+ $phpbb_filesystem = $phpbb_container->get('filesystem');
+ $corrected_path = $phpbb_filesystem->get_web_root_path();
+ $web_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? $board_url : $corrected_path;
// Send a proper content-language to the output
$user_lang = $user->lang['USER_LANG'];
@@ -5232,7 +5302,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_name = $user->timezone->getName();
if (isset($user->lang['timezones'][$timezone_name]))
@@ -5289,7 +5359,7 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
'SID' => $SID,
'_SID' => $_SID,
'SESSION_ID' => $user->session_id,
- 'ROOT_PATH' => $phpbb_root_path,
+ 'ROOT_PATH' => $web_path,
'BOARD_URL' => $board_url,
'L_LOGIN_LOGOUT' => $l_login_logout,
@@ -5300,7 +5370,6 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
'U_PRIVATEMSGS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;folder=inbox'),
'U_RETURN_INBOX' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;folder=inbox'),
'U_POPUP_PM' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;mode=popup'),
- 'UA_POPUP_PM' => addslashes(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&amp;mode=popup')),
'U_MEMBERLIST' => append_sid("{$phpbb_root_path}memberlist.$phpEx"),
'U_VIEWONLINE' => ($auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) ? append_sid("{$phpbb_root_path}viewonline.$phpEx") : '',
'U_LOGIN_LOGOUT' => $u_login_logout,
@@ -5346,7 +5415,7 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
'S_FORUM_ID' => $forum_id,
'S_TOPIC_ID' => $topic_id,
- 'S_LOGIN_ACTION' => ((!defined('ADMIN_START')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login') : append_sid("index.$phpEx", false, true, $user->session_id)),
+ 'S_LOGIN_ACTION' => ((!defined('ADMIN_START')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login') : append_sid("{$phpbb_root_path}{$adm_relative_path}index.$phpEx", false, true, $user->session_id)),
'S_LOGIN_REDIRECT' => build_hidden_fields(array('redirect' => build_url())),
'S_ENABLE_FEEDS' => ($config['feed_enable']) ? true : false,
@@ -5581,7 +5650,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.
*/
function phpbb_user_session_handler()
@@ -5632,7 +5701,7 @@ function phpbb_to_numeric($input)
* Convert either 3.0 dbms or 3.1 db driver class name to 3.1 db driver class name.
*
* If $dbms is a valid 3.1 db driver class name, returns it unchanged.
-* Otherwise prepends phpbb_db_driver_ to the dbms to convert a 3.0 dbms
+* Otherwise prepends phpbb\db\driver\ to the dbms to convert a 3.0 dbms
* to 3.1 db driver class name.
*
* @param string $dbms dbms parameter
@@ -5645,24 +5714,24 @@ function phpbb_convert_30_dbms_to_31($dbms)
// true for mysqli class.
// However, per the docblock any valid 3.1 driver name should be
// 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))
{
- // 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
// Beware of possible performance issues:
// http://stackoverflow.com/questions/294582/php-5-reflection-api-performance
// 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);
- if ($reflection->isSubclassOf('phpbb_db_driver'))
+ if ($reflection->isSubclassOf('phpbb\db\driver\driver'))
{
return $dbms;
}
@@ -5673,49 +5742,3 @@ function phpbb_convert_30_dbms_to_31($dbms)
throw new \RuntimeException("You have specified an invalid dbms driver: $dbms");
}
-
-/**
-* Create a Symfony Request object from phpbb_request object
-*
-* @param phpbb_request $request Request object
-* @return Request A Symfony Request object
-*/
-function phpbb_create_symfony_request(phpbb_request $request)
-{
- // This function is meant to sanitize the global input arrays
- $sanitizer = function(&$value, $key) {
- $type_cast_helper = new phpbb_request_type_cast_helper();
- $type_cast_helper->set_var($value, $value, gettype($value), true);
- };
-
- // We need to re-enable the super globals so we can access them here
- $request->enable_super_globals();
- $get_parameters = $_GET;
- $post_parameters = $_POST;
- $server_parameters = $_SERVER;
- $files_parameters = $_FILES;
- $cookie_parameters = $_COOKIE;
- // And now disable them again for security
- $request->disable_super_globals();
-
- array_walk_recursive($get_parameters, $sanitizer);
- array_walk_recursive($post_parameters, $sanitizer);
-
- // Until we fix the issue with relative paths, we have to fake path info
- // to allow urls like app.php?controller=foo/bar
- $controller = $request->variable('controller', '');
- $path_info = '/' . $controller;
- $request_uri = $server_parameters['REQUEST_URI'];
-
- // Remove the query string from REQUEST_URI
- if ($pos = strpos($request_uri, '?'))
- {
- $request_uri = substr($request_uri, 0, $pos);
- }
-
- // Add the path info (i.e. controller route) to the REQUEST_URI
- $server_parameters['REQUEST_URI'] = $request_uri . $path_info;
- $server_parameters['SCRIPT_NAME'] = '';
-
- return new Request($get_parameters, $post_parameters, array(), $cookie_parameters, $files_parameters, $server_parameters);
-}
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index fc29492ac1..722d3c9c67 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -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
* must be carried through for the moderators table.
*
-* @param phpbb_db_driver $db Database connection
-* @param phpbb_cache_driver_interface Cache driver
-* @param phpbb_auth $auth Authentication object
+* @param \phpbb\db\driver\driver $db Database connection
+* @param \phpbb\cache\driver\driver_interface Cache driver
+* @param \phpbb\auth\auth $auth Authentication object
* @return null
*/
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.
*
-* @param phpbb_db_driver $db Database connection
-* @param phpbb_auth $auth Authentication object
+* @param \phpbb\db\driver\driver $db Database connection
+* @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 $user_id If an array, remove this user from foe lists, or false to ignore
* @return null
diff --git a/phpBB/includes/functions_container.php b/phpBB/includes/functions_container.php
index 7cbfa17a0e..667d27fd20 100644
--- a/phpBB/includes/functions_container.php
+++ b/phpBB/includes/functions_container.php
@@ -26,7 +26,7 @@ if (!defined('IN_PHPBB'))
* Used to bootstrap the container.
*
* @param string $config_file
-* @return phpbb_db_driver
+* @return \phpbb\db\driver\driver
*/
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/';
$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->setParameter('core.root_path', $phpbb_root_path);
@@ -152,12 +152,12 @@ function phpbb_create_update_container($phpbb_root_path, $php_ext, $config_path)
return phpbb_create_compiled_container(
$config_file,
array(
- new phpbb_di_extension_config($config_file),
- new phpbb_di_extension_core($config_path),
+ new phpbb\di\extension\config($config_file),
+ new phpbb\di\extension\core($config_path),
),
array(
- new phpbb_di_pass_collection_pass(),
- new phpbb_di_pass_kernel_pass(),
+ new phpbb\di\pass\collection_pass(),
+ new phpbb\di\pass\kernel_pass(),
),
$phpbb_root_path,
$php_ext
@@ -260,13 +260,13 @@ function phpbb_create_default_container($phpbb_root_path, $php_ext)
return phpbb_create_dumped_container_unless_debug(
$config_file,
array(
- new phpbb_di_extension_config($config_file),
- new phpbb_di_extension_core($phpbb_root_path . 'config'),
- new phpbb_di_extension_ext($installed_exts),
+ new \phpbb\di\extension\config($config_file),
+ new \phpbb\di\extension\core($phpbb_root_path . 'config'),
+ new \phpbb\di\extension\ext($installed_exts),
),
array(
- new phpbb_di_pass_collection_pass(),
- new phpbb_di_pass_kernel_pass(),
+ new \phpbb\di\pass\collection_pass(),
+ new \phpbb\di\pass\kernel_pass(),
),
$phpbb_root_path,
$php_ext
diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php
index 05d3c5fde2..7ecc99b39c 100644
--- a/phpBB/includes/functions_content.php
+++ b/phpBB/includes/functions_content.php
@@ -727,37 +727,58 @@ function make_clickable($text, $server_url = false, $class = 'postlink')
$server_url = generate_board_url();
}
- static $magic_url_match;
- static $magic_url_replace;
static $static_class;
+ static $magic_url_match_args;
- if (!is_array($magic_url_match) || $static_class != $class)
+ if (!is_array($magic_url_match_args) || $static_class != $class)
{
$static_class = $class;
$class = ($static_class) ? ' class="' . $static_class . '"' : '';
$local_class = ($static_class) ? ' class="' . $static_class . '-local"' : '';
- $magic_url_match = $magic_url_replace = array();
- // Be sure to not let the matches cross over. ;)
+ $magic_url_match_args = array();
// relative urls for this board
- $magic_url_match[] = '#(^|[\n\t (>.])(' . preg_quote($server_url, '#') . ')/(' . get_preg_expression('relative_url_inline') . ')#ie';
- $magic_url_replace[] = "make_clickable_callback(MAGIC_URL_LOCAL, '\$1', '\$2', '\$3', '$local_class')";
+ $magic_url_match_args[] = array(
+ '#(^|[\n\t (>.])(' . preg_quote($server_url, '#') . ')/(' . get_preg_expression('relative_url_inline') . ')#i',
+ MAGIC_URL_LOCAL,
+ $local_class,
+ );
// matches a xxxx://aaaaa.bbb.cccc. ...
- $magic_url_match[] = '#(^|[\n\t (>.])(' . get_preg_expression('url_inline') . ')#ie';
- $magic_url_replace[] = "make_clickable_callback(MAGIC_URL_FULL, '\$1', '\$2', '', '$class')";
+ $magic_url_match_args[] = array(
+ '#(^|[\n\t (>.])(' . get_preg_expression('url_inline') . ')#i',
+ MAGIC_URL_FULL,
+ $class,
+ );
// matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing
- $magic_url_match[] = '#(^|[\n\t (>])(' . get_preg_expression('www_url_inline') . ')#ie';
- $magic_url_replace[] = "make_clickable_callback(MAGIC_URL_WWW, '\$1', '\$2', '', '$class')";
+ $magic_url_match_args[] = array(
+ '#(^|[\n\t (>])(' . get_preg_expression('www_url_inline') . ')#i',
+ MAGIC_URL_WWW,
+ $class,
+ );
// matches an email@domain type address at the start of a line, or after a space or after what might be a BBCode.
- $magic_url_match[] = '/(^|[\n\t (>])(' . get_preg_expression('email') . ')/ie';
- $magic_url_replace[] = "make_clickable_callback(MAGIC_URL_EMAIL, '\$1', '\$2', '', '')";
+ $magic_url_match_args[] = array(
+ '/(^|[\n\t (>])(' . get_preg_expression('email') . ')/i',
+ MAGIC_URL_EMAIL,
+ '',
+ );
}
- return preg_replace($magic_url_match, $magic_url_replace, $text);
+ foreach ($magic_url_match_args as $magic_args)
+ {
+ if (preg_match($magic_args[0], $text, $matches))
+ {
+ $text = preg_replace_callback($magic_args[0], function($matches) use ($magic_args)
+ {
+ return make_clickable_callback($magic_args[1], $matches[1], $matches[2], $matches[3], $magic_args[2]);
+ }, $text);
+ }
+ }
+
+ return $text;
}
/**
@@ -813,7 +834,7 @@ function bbcode_nl2br($text)
*/
function smiley_text($text, $force_option = false)
{
- global $config, $user, $phpbb_root_path;
+ global $config, $user, $phpbb_filesystem;
if ($force_option || !$config['allow_smilies'] || !$user->optionget('viewsmilies'))
{
@@ -821,7 +842,7 @@ function smiley_text($text, $force_option = false)
}
else
{
- $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_root_path;
+ $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_filesystem->get_web_root_path();
return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img class="smilies" src="' . $root_path . $config['smilies_path'] . '/\2 />', $text);
}
}
diff --git a/phpBB/includes/functions_database_helper.php b/phpBB/includes/functions_database_helper.php
index 1b508e6a02..923e542690 100644
--- a/phpBB/includes/functions_database_helper.php
+++ b/phpBB/includes/functions_database_helper.php
@@ -22,14 +22,14 @@ if (!defined('IN_PHPBB'))
*
* 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 $column Column whose values to change
* @param array $from_values An array of values that should be changed
* @param int $to_value The new value
* @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
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.
*
-* @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 $column Column whose values to change
* @param array $from_values An array of values that should be changed
* @param int $to_value The new value
* @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
FROM $table
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index b1dac64bec..c6ab5df90f 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -71,7 +71,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
'MESSAGE_TEXT' => $user->lang['FORUMS_MARKED']
);
- $json_response = new phpbb_json_response();
+ $json_response = new \phpbb\json_response();
$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'])
{
- $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();
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_TEXT' => $user->lang['FORUMS_MARKED']
);
- $json_response = new phpbb_json_response();
+ $json_response = new \phpbb\json_response();
$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 ($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&amp;start=$start");
$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 ($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&amp;start=$start");
$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
{
- if ((isset($_GET['unwatch']) && $request->variable('unwatch', '', false, phpbb_request_interface::GET) == $mode) ||
- (isset($_GET['watch']) && $request->variable('watch', '', 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\request_interface::GET) == $mode))
{
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)
{
- $row = phpbb_avatar_manager::clean_row($user_row);
+ $row = \phpbb\avatar\manager::clean_row($user_row);
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)
{
- $row = phpbb_avatar_manager::clean_row($user_row);
+ $row = \phpbb\avatar\manager::clean_row($user_row);
return phpbb_get_avatar($row, $alt, $ignore_config);
}
/**
* 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 bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP
*
diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php
index 0a8000ea3d..e7a1d2bff5 100644
--- a/phpBB/includes/functions_download.php
+++ b/phpBB/includes/functions_download.php
@@ -596,7 +596,7 @@ function phpbb_parse_range_request($request_array, $filesize)
/**
* 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
*
* @return null
@@ -617,8 +617,8 @@ function phpbb_increment_downloads($db, $ids)
/**
* Handles authentication when downloading attachments from a post or topic
*
-* @param phpbb_db_driver $db The database object
-* @param phpbb_auth $auth The authentication object
+* @param \phpbb\db\driver\driver $db The database object
+* @param \phpbb\auth\auth $auth The authentication object
* @param int $topic_id The id of the topic that we are downloading from
*
* @return null
@@ -651,8 +651,8 @@ function phpbb_download_handle_forum_auth($db, $auth, $topic_id)
/**
* Handles authentication when downloading attachments from PMs
*
-* @param phpbb_db_driver $db The database object
-* @param phpbb_auth $auth The authentication object
+* @param \phpbb\db\driver\driver $db The database object
+* @param \phpbb\auth\auth $auth The authentication object
* @param int $user_id The user id
* @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
*
-* @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 $msg_id The id of the PM that we are downloading from
*
diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php
index bd0ffaaf00..bfd669fdfa 100644
--- a/phpBB/includes/functions_install.php
+++ b/phpBB/includes/functions_install.php
@@ -28,7 +28,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'firebird',
'MODULE' => 'interbase',
'DELIM' => ';;',
- 'DRIVER' => 'phpbb_db_driver_firebird',
+ 'DRIVER' => 'phpbb\db\driver\firebird',
'AVAILABLE' => true,
'2.0.x' => false,
),
@@ -39,7 +39,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'mysql_41',
'MODULE' => 'mysqli',
'DELIM' => ';',
- 'DRIVER' => 'phpbb_db_driver_mysqli',
+ 'DRIVER' => 'phpbb\db\driver\mysqli',
'AVAILABLE' => true,
'2.0.x' => true,
),
@@ -48,7 +48,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'mysql',
'MODULE' => 'mysql',
'DELIM' => ';',
- 'DRIVER' => 'phpbb_db_driver_mysql',
+ 'DRIVER' => 'phpbb\db\driver\mysql',
'AVAILABLE' => true,
'2.0.x' => true,
),
@@ -57,7 +57,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'mssql',
'MODULE' => 'mssql',
'DELIM' => 'GO',
- 'DRIVER' => 'phpbb_db_driver_mssql',
+ 'DRIVER' => 'phpbb\db\driver\mssql',
'AVAILABLE' => true,
'2.0.x' => true,
),
@@ -66,7 +66,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'mssql',
'MODULE' => 'odbc',
'DELIM' => 'GO',
- 'DRIVER' => 'phpbb_db_driver_mssql_odbc',
+ 'DRIVER' => 'phpbb\db\driver\mssql_odbc',
'AVAILABLE' => true,
'2.0.x' => true,
),
@@ -75,7 +75,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'mssql',
'MODULE' => 'sqlsrv',
'DELIM' => 'GO',
- 'DRIVER' => 'phpbb_db_driver_mssqlnative',
+ 'DRIVER' => 'phpbb\db\driver\mssqlnative',
'AVAILABLE' => true,
'2.0.x' => false,
),
@@ -84,7 +84,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'oracle',
'MODULE' => 'oci8',
'DELIM' => '/',
- 'DRIVER' => 'phpbb_db_driver_oracle',
+ 'DRIVER' => 'phpbb\db\driver\oracle',
'AVAILABLE' => true,
'2.0.x' => false,
),
@@ -93,7 +93,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'postgres',
'MODULE' => 'pgsql',
'DELIM' => ';',
- 'DRIVER' => 'phpbb_db_driver_postgres',
+ 'DRIVER' => 'phpbb\db\driver\postgres',
'AVAILABLE' => true,
'2.0.x' => true,
),
@@ -102,7 +102,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
'SCHEMA' => 'sqlite',
'MODULE' => 'sqlite',
'DELIM' => ';',
- 'DRIVER' => 'phpbb_db_driver_sqlite',
+ 'DRIVER' => 'phpbb\db\driver\sqlite',
'AVAILABLE' => true,
'2.0.x' => false,
),
@@ -184,7 +184,7 @@ function dbms_select($default = '', $only_20x_options = false)
*/
function get_tables(&$db)
{
- $db_tools = new phpbb_db_tools($db);
+ $db_tools = new \phpbb\db\tools($db);
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);
// 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'];
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
- 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'];
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
switch ($dbms_details['DRIVER'])
{
- case 'phpbb_db_driver_mysql':
- case 'phpbb_db_driver_mysqli':
+ case 'phpbb\db\driver\mysql':
+ case 'phpbb\db\driver\mysqli':
if (strspn($table_prefix, '-./\\') !== 0)
{
$error[] = $lang['INST_ERR_PREFIX_INVALID'];
@@ -232,22 +232,22 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
// no break;
- case 'phpbb_db_driver_postgres':
+ case 'phpbb\db\driver\postgres':
$prefix_length = 36;
break;
- case 'phpbb_db_driver_mssql':
- case 'phpbb_db_driver_mssql_odbc':
- case 'phpbb_db_driver_mssqlnative':
+ case 'phpbb\db\driver\mssql':
+ case 'phpbb\db\driver\mssql_odbc':
+ case 'phpbb\db\driver\mssqlnative':
$prefix_length = 90;
break;
- case 'phpbb_db_driver_sqlite':
+ case 'phpbb\db\driver\sqlite':
$prefix_length = 200;
break;
- case 'phpbb_db_driver_firebird':
- case 'phpbb_db_driver_oracle':
+ case 'phpbb\db\driver\firebird':
+ case 'phpbb\db\driver\oracle':
$prefix_length = 6;
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
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', '<'))
{
$error[] = $lang['INST_ERR_DB_NO_MYSQLI'];
}
break;
- case 'phpbb_db_driver_sqlite':
+ case 'phpbb\db\driver\sqlite':
if (version_compare(sqlite_libversion(), '2.8.2', '<'))
{
$error[] = $lang['INST_ERR_DB_NO_SQLITE'];
}
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
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;
- case 'phpbb_db_driver_oracle':
+ case 'phpbb\db\driver\oracle':
if ($unicode_check)
{
$sql = "SELECT *
@@ -402,7 +402,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
}
break;
- case 'phpbb_db_driver_postgres':
+ case 'phpbb\db\driver\postgres':
if ($unicode_check)
{
$sql = "SHOW server_encoding;";
@@ -507,7 +507,7 @@ function phpbb_create_config_file_data($data, $dbms, $debug = false, $debug_test
'adm_relative_path' => 'adm/',
- 'acm_type' => 'phpbb_cache_driver_file',
+ 'acm_type' => 'phpbb\cache\driver\file',
);
foreach ($config_data_array as $key => $value)
diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php
index 0222a57bcc..f8b01bc770 100644
--- a/phpBB/includes/functions_messenger.php
+++ b/phpBB/includes/functions_messenger.php
@@ -21,13 +21,13 @@ if (!defined('IN_PHPBB'))
*/
class messenger
{
- var $vars, $msg, $extra_headers, $replyto, $from, $subject;
+ var $msg, $extra_headers, $replyto, $from, $subject;
var $addresses = array();
var $mail_priority = MAIL_NORMAL_PRIORITY;
var $use_queue = true;
- /** @var phpbb_template */
+ /** @var \phpbb\template\template */
protected $template;
var $eol = "\n";
@@ -53,7 +53,7 @@ class messenger
function reset()
{
$this->addresses = $this->extra_headers = array();
- $this->vars = $this->msg = $this->replyto = $this->from = '';
+ $this->msg = $this->replyto = $this->from = '';
$this->mail_priority = MAIL_NORMAL_PRIORITY;
}
@@ -258,8 +258,6 @@ class messenger
'body' => $template_file . '.txt',
));
- $this->vars = $this->template->get_template_vars();
-
return true;
}
@@ -288,26 +286,11 @@ class messenger
global $config, $user;
// We add some standard variables we always use, no need to specify them always
- if (!isset($this->vars['U_BOARD']))
- {
- $this->assign_vars(array(
- 'U_BOARD' => generate_board_url(),
- ));
- }
-
- if (!isset($this->vars['EMAIL_SIG']))
- {
- $this->assign_vars(array(
- 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . htmlspecialchars_decode($config['board_email_sig'])),
- ));
- }
-
- if (!isset($this->vars['SITENAME']))
- {
- $this->assign_vars(array(
- 'SITENAME' => htmlspecialchars_decode($config['sitename']),
- ));
- }
+ $this->assign_vars(array(
+ 'U_BOARD' => generate_board_url(),
+ 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . htmlspecialchars_decode($config['board_email_sig'])),
+ 'SITENAME' => htmlspecialchars_decode($config['sitename']),
+ ));
// Parse message through template
$this->msg = trim($this->template->assign_display('body'));
@@ -643,14 +626,14 @@ class messenger
*/
protected function setup_template()
{
- global $config, $phpbb_root_path, $phpEx, $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;
}
- $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $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);
}
/**
@@ -660,7 +643,7 @@ class messenger
{
$this->setup_template();
- $this->template->set_style_names(array($path_name), $paths);
+ $this->template->set_custom_style($path_name, $paths);
}
}
@@ -717,7 +700,7 @@ class queue
{
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();
// avoid races, check file existence once
@@ -887,7 +870,7 @@ class queue
return;
}
- $lock = new phpbb_lock_flock($this->cache_file);
+ $lock = new \phpbb\lock\flock($this->cache_file);
$lock->acquire();
if (file_exists($this->cache_file))
@@ -1004,12 +987,12 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $headers = false)
$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.
- if (!class_exists('phpbb_error_collector'))
+ if (!class_exists('\phpbb\error_collector'))
{
global $phpbb_root_path, $phpEx;
include($phpbb_root_path . 'includes/error_collector.' . $phpEx);
}
- $collector = new phpbb_error_collector;
+ $collector = new \phpbb\error_collector;
$collector->install();
$smtp->socket = fsockopen($config['smtp_host'], $config['smtp_port'], $errno, $errstr, 20);
$collector->uninstall();
@@ -1723,12 +1706,12 @@ function phpbb_mail($to, $subject, $msg, $headers, $eol, &$err_msg)
// Reference: http://bugs.php.net/bug.php?id=15841
$headers = implode($eol, $headers);
- if (!class_exists('phpbb_error_collector'))
+ if (!class_exists('\phpbb\error_collector'))
{
include($phpbb_root_path . 'includes/error_collector.' . $phpEx);
}
- $collector = new phpbb_error_collector;
+ $collector = new \phpbb\error_collector;
$collector->install();
// On some PHP Versions mail() *may* fail if there are newlines within the subject.
diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php
index 99c24fcb19..b33f3d6866 100644
--- a/phpBB/includes/functions_module.php
+++ b/phpBB/includes/functions_module.php
@@ -455,7 +455,7 @@ class p_master
*/
function load_active($mode = false, $module_url = false, $execute_module = true)
{
- global $phpbb_root_path, $phpbb_admin_path, $phpEx, $user, $phpbb_style;
+ global $phpbb_root_path, $phpbb_admin_path, $phpEx, $user, $template;
$module_path = $this->include_path . $this->p_class;
$icat = request_var('icat', '');
@@ -499,16 +499,16 @@ class p_master
* the style paths for the extension (the ext author can change them
* 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, ...
- if (isset($module_dir[3]) && $module_dir[1] === 'ext')
+ // 0 vendor, 1 extension name, ...
+ 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))
{
- $phpbb_style->set_custom_style('admin', array($module_style_dir, $phpbb_admin_path . 'style'), array(), '');
+ $template->set_custom_style('adm', array($module_style_dir, $phpbb_admin_path . 'style'));
}
}
@@ -537,7 +537,7 @@ class p_master
if (is_dir($phpbb_root_path . $module_style_dir))
{
- $phpbb_style->set_style(array($module_style_dir, 'styles'));
+ $template->set_style(array($module_style_dir, 'styles'));
}
}
@@ -973,7 +973,7 @@ class p_master
*/
protected function get_short_name($basename)
{
- if (substr($basename, 0, 6) === 'phpbb_')
+ if (substr($basename, 0, 6) === 'phpbb\\' || strpos($basename, '\\') !== false)
{
return $basename;
}
@@ -990,6 +990,6 @@ class p_master
*/
protected function is_full_class($basename)
{
- return (preg_match('/^(phpbb|ucp|mcp|acp)_/', $basename));
+ return (strpos($basename, '\\') !== false || preg_match('/^(ucp|mcp|acp)_/', $basename));
}
}
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 6e62c0c6e4..ce1238d8e0 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -2166,6 +2166,11 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
update_forum_tracking_info($data['forum_id'], $forum_last_post_time, $f_mark_time, false);
}
+ // If a username was supplied or the poster is a guest, we will use the supplied username.
+ // Doing it this way we can use "...post by guest-username..." in notifications when
+ // "guest-username" is supplied or ommit the username if it is not.
+ $username = ($username !== '' || !$user->data['is_registered']) ? $username : $user->data['username'];
+
// Send Notifications
$notification_data = array_merge($data, array(
'topic_title' => (isset($data['topic_title'])) ? $data['topic_title'] : $subject,
diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php
index 5fc6de8e02..a2a79e032f 100644
--- a/phpBB/includes/functions_privmsgs.php
+++ b/phpBB/includes/functions_privmsgs.php
@@ -343,7 +343,7 @@ function check_rule(&$rules, &$rule_row, &$message_row, $user_id)
$userdata = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
- $auth2 = new phpbb_auth();
+ $auth2 = new \phpbb\auth\auth();
$auth2->acl($userdata);
if (!$auth2->acl_get('a_') && !$auth2->acl_get('m_') && !$auth2->acl_getf_global('m_'))
diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php
index 4f31a85e83..4181896eca 100644
--- a/phpBB/includes/functions_upload.php
+++ b/phpBB/includes/functions_upload.php
@@ -713,7 +713,7 @@ class fileupload
}
$this->common_checks($file);
- $request->overwrite('local', $upload, phpbb_request_interface::FILES);
+ $request->overwrite('local', $upload, \phpbb\request\request_interface::FILES);
return $file;
}
diff --git a/phpBB/includes/functions_url_matcher.php b/phpBB/includes/functions_url_matcher.php
index a89ab7b126..fdde302e3b 100644
--- a/phpBB/includes/functions_url_matcher.php
+++ b/phpBB/includes/functions_url_matcher.php
@@ -22,13 +22,13 @@ if (!defined('IN_PHPBB'))
/**
* 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 string $root_path Root path
* @param string $php_ext PHP extension
* @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'))
{
@@ -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
*
-* @param phpbb_extension_finder $finder Extension finder
+* @param \phpbb\extension\finder $finder Extension finder
* @param string $root_path Root path
* @param string $php_ext PHP extension
* @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();
$dumper = new PhpMatcherDumper($routes);
$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
*
-* @param phpbb_extension_finder $finder Extension finder
+* @param \phpbb\extension\finder $finder Extension finder
* @param RequestContext $context Symfony RequestContext object
* @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();
return new UrlMatcher($routes, $context);
}
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index 1b598f7bf7..c248be0864 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -2150,8 +2150,8 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
if (!sizeof($error))
{
- $current_legend = phpbb_groupposition_legend::GROUP_DISABLED;
- $current_teampage = phpbb_groupposition_teampage::GROUP_DISABLED;
+ $current_legend = \phpbb\groupposition\legend::GROUP_DISABLED;
+ $current_teampage = \phpbb\groupposition\teampage::GROUP_DISABLED;
$legend = $phpbb_container->get('groupposition.legend');
$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_teampage = $teampage->get_group_value($group_id);
}
- catch (phpbb_groupposition_exception $exception)
+ catch (\phpbb\groupposition\exception $exception)
{
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 (($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.
$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;
}
}
- 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
try
{
$legend->delete_group($group_id, true);
}
- catch (phpbb_groupposition_exception $exception)
+ catch (\phpbb\groupposition\exception $exception)
{
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
{
- $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.
@@ -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,
// 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
{
$teampage->delete_group($group_id);
}
- catch (phpbb_groupposition_exception $exception)
+ catch (\phpbb\groupposition\exception $exception)
{
trigger_error($user->lang($exception->getMessage()));
}
@@ -2320,24 +2320,24 @@ function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow
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);
}
if ($group_teampage)
{
- if ($current_teampage == phpbb_groupposition_teampage::GROUP_DISABLED)
+ if ($current_teampage == \phpbb\groupposition\teampage::GROUP_DISABLED)
{
$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);
}
}
- catch (phpbb_groupposition_exception $exception)
+ catch (\phpbb\groupposition\exception $exception)
{
trigger_error($user->lang($exception->getMessage()));
}
@@ -2472,7 +2472,7 @@ function group_delete($group_id, $group_name = false)
$legend->delete_group($group_id);
unset($legend);
}
- catch (phpbb_groupposition_exception $exception)
+ catch (\phpbb\groupposition\exception $exception)
{
// The group we want to delete does not exist.
// 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);
unset($teampage);
}
- catch (phpbb_groupposition_exception $exception)
+ catch (\phpbb\groupposition\exception $exception)
{
// The group we want to delete does not exist.
// No reason to worry, we just continue the deleting process.
@@ -2534,7 +2534,7 @@ function group_delete($group_id, $group_name = false)
*/
function group_user_add($group_id, $user_id_ary = false, $username_ary = false, $group_name = false, $default = false, $leader = 0, $pending = 0, $group_attributes = false)
{
- global $db, $auth;
+ global $db, $auth, $phpbb_container;
// We need both username and user_id info
$result = user_get_id_name($user_id_ary, $username_ary);
@@ -2622,6 +2622,20 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false,
group_update_listings($group_id);
+ if ($pending)
+ {
+ $phpbb_notifications = $phpbb_container->get('notification_manager');
+
+ foreach ($add_id_ary as $user_id)
+ {
+ $phpbb_notifications->add_notifications('group_request', array(
+ 'group_id' => $group_id,
+ 'user_id' => $user_id,
+ 'group_name' => $group_name,
+ ));
+ }
+ }
+
// Return false - no error
return false;
}
@@ -2635,7 +2649,7 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false,
*/
function group_user_del($group_id, $user_id_ary = false, $username_ary = false, $group_name = false)
{
- global $db, $auth, $config, $phpbb_dispatcher;
+ global $db, $auth, $config, $phpbb_dispatcher, $phpbb_container;
if ($config['coppa_enable'])
{
@@ -2769,6 +2783,10 @@ function group_user_del($group_id, $user_id_ary = false, $username_ary = false,
group_update_listings($group_id);
+ $phpbb_notifications = $phpbb_container->get('notification_manager');
+
+ $phpbb_notifications->delete_notifications('group_request', $user_id_ary, $group_id);
+
// Return false - no error
return false;
}
@@ -2858,7 +2876,7 @@ function remove_default_rank($group_id, $user_ids)
*/
function group_user_attributes($action, $group_id, $user_id_ary = false, $username_ary = false, $group_name = false, $group_attributes = false)
{
- global $db, $auth, $phpbb_root_path, $phpEx, $config;
+ global $db, $auth, $phpbb_root_path, $phpEx, $config, $phpbb_container;
// We need both username and user_id info
$result = user_get_id_name($user_id_ary, $username_ary);
@@ -2911,11 +2929,10 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna
AND ' . $db->sql_in_set('ug.user_id', $user_id_ary);
$result = $db->sql_query($sql);
- $user_id_ary = $email_users = array();
+ $user_id_ary = array();
while ($row = $db->sql_fetchrow($result))
{
$user_id_ary[] = $row['user_id'];
- $email_users[] = $row;
}
$db->sql_freeresult($result);
@@ -2930,26 +2947,14 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna
AND " . $db->sql_in_set('user_id', $user_id_ary);
$db->sql_query($sql);
- // Send approved email to users...
- include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
- $messenger = new messenger();
-
- foreach ($email_users as $row)
- {
- $messenger->template('group_approved', $row['user_lang']);
-
- $messenger->set_addresses($row);
-
- $messenger->assign_vars(array(
- 'USERNAME' => htmlspecialchars_decode($row['username']),
- 'GROUP_NAME' => htmlspecialchars_decode($group_name),
- 'U_GROUP' => generate_board_url() . "/ucp.$phpEx?i=groups&mode=membership")
- );
-
- $messenger->send($row['user_notify_type']);
- }
+ $phpbb_notifications = $phpbb_container->get('notification_manager');
- $messenger->save_queue();
+ $phpbb_notifications->add_notifications('group_request_approved', array(
+ 'user_ids' => $user_id_ary,
+ 'group_id' => $group_id,
+ 'group_name' => $group_name,
+ ));
+ $phpbb_notifications->delete_notifications('group_request', $user_id_ary, $group_id);
$log = 'LOG_USERS_APPROVED';
break;
diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php
index 841a0afddb..6df3320a97 100644
--- a/phpBB/includes/mcp/mcp_forum.php
+++ b/phpBB/includes/mcp/mcp_forum.php
@@ -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
$request->overwrite('sk', null);
$request->overwrite('sd', null);
- $request->overwrite('sk', null, phpbb_request_interface::POST);
- $request->overwrite('sd', null, phpbb_request_interface::POST);
+ $request->overwrite('sk', null, \phpbb\request\request_interface::POST);
+ $request->overwrite('sd', null, \phpbb\request\request_interface::POST);
}
$forum_id = $forum_info['forum_id'];
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php
index 275edbe55a..4f27d32a5a 100644
--- a/phpBB/includes/mcp/mcp_main.php
+++ b/phpBB/includes/mcp/mcp_main.php
@@ -462,7 +462,7 @@ function mcp_move_topic($topic_ids)
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);
}
@@ -694,7 +694,7 @@ function mcp_restore_topic($topic_ids)
}
$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 = 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);
- 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 = reapply_sid($redirect);
@@ -1136,7 +1136,7 @@ function mcp_fork_topic($topic_ids)
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);
}
diff --git a/phpBB/includes/mcp/mcp_pm_reports.php b/phpBB/includes/mcp/mcp_pm_reports.php
index cb61b25174..f0452b37a5 100644
--- a/phpBB/includes/mcp/mcp_pm_reports.php
+++ b/phpBB/includes/mcp/mcp_pm_reports.php
@@ -161,6 +161,7 @@ class mcp_pm_reports
'S_CLOSE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=pm_reports&amp;mode=pm_report_details&amp;r=' . $report_id),
'S_CAN_VIEWIP' => $auth->acl_getf_global('m_info'),
'S_POST_REPORTED' => $pm_info['message_reported'],
+ 'S_REPORT_CLOSED' => $report['report_closed'],
'S_USER_NOTES' => true,
'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=pm_reports&amp;mode=pm_report_details&amp;r=' . $report_id),
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index 1fa89af8e1..db461d07fa 100644
--- a/phpBB/includes/mcp/mcp_queue.php
+++ b/phpBB/includes/mcp/mcp_queue.php
@@ -729,7 +729,7 @@ class mcp_queue
if ($request->is_ajax())
{
- $json_response = new phpbb_json_response;
+ $json_response = new \phpbb\json_response;
$json_response->send(array(
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
'MESSAGE_TEXT' => $message,
@@ -877,7 +877,7 @@ class mcp_queue
if ($request->is_ajax())
{
- $json_response = new phpbb_json_response;
+ $json_response = new \phpbb\json_response;
$json_response->send(array(
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
'MESSAGE_TEXT' => $message,
@@ -937,9 +937,9 @@ class mcp_queue
{
$additional_msg = $user->lang['NO_REASON_DISAPPROVAL'];
- $request->overwrite('confirm', null, phpbb_request_interface::POST);
- $request->overwrite('confirm_key', null, phpbb_request_interface::POST);
- $request->overwrite('confirm_key', null, phpbb_request_interface::REQUEST);
+ $request->overwrite('confirm', null, \phpbb\request\request_interface::POST);
+ $request->overwrite('confirm_key', null, \phpbb\request\request_interface::POST);
+ $request->overwrite('confirm_key', null, \phpbb\request\request_interface::REQUEST);
}
else
{
@@ -1212,7 +1212,7 @@ class mcp_queue
if ($request->is_ajax())
{
- $json_response = new phpbb_json_response;
+ $json_response = new \phpbb\json_response;
$json_response->send(array(
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
'MESSAGE_TEXT' => $message,
diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php
index 3f48c58073..8db5bb9727 100644
--- a/phpBB/includes/mcp/mcp_reports.php
+++ b/phpBB/includes/mcp/mcp_reports.php
@@ -189,6 +189,7 @@ class mcp_reports
'S_POST_REPORTED' => $post_info['post_reported'],
'S_POST_UNAPPROVED' => ($post_info['post_visibility'] == ITEM_UNAPPROVED),
'S_POST_LOCKED' => $post_info['post_edit_locked'],
+ 'S_REPORT_CLOSED' => $report['report_closed'],
'S_USER_NOTES' => true,
'U_EDIT' => ($auth->acl_get('m_edit', $post_info['forum_id'])) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&amp;f={$post_info['forum_id']}&amp;p={$post_info['post_id']}") : '',
diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php
index bb21d3d377..3ffd75ac78 100644
--- a/phpBB/includes/mcp/mcp_warn.php
+++ b/phpBB/includes/mcp/mcp_warn.php
@@ -253,7 +253,7 @@ class mcp_warn
// Check if can send a notification
if ($config['allow_privmsg'])
{
- $auth2 = new phpbb_auth();
+ $auth2 = new \phpbb\auth\auth();
$auth2->acl($user_row);
$s_can_notify = ($auth2->acl_get('u_readpm')) ? true : false;
unset($auth2);
@@ -365,7 +365,7 @@ class mcp_warn
// Check if can send a notification
if ($config['allow_privmsg'])
{
- $auth2 = new phpbb_auth();
+ $auth2 = new \phpbb\auth\auth();
$auth2->acl($user_row);
$s_can_notify = ($auth2->acl_get('u_readpm')) ? true : false;
unset($auth2);
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index 44960dd78d..3e348801c7 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -1545,7 +1545,7 @@ class parse_message extends bbcode_firstpass
global $request;
$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();
$check_user_id = ($check_user_id === false) ? $user->data['user_id'] : $check_user_id;
diff --git a/phpBB/includes/ucp/info/ucp_auth_link.php b/phpBB/includes/ucp/info/ucp_auth_link.php
new file mode 100644
index 0000000000..ee88b15ea8
--- /dev/null
+++ b/phpBB/includes/ucp/info/ucp_auth_link.php
@@ -0,0 +1,34 @@
+<?php
+/**
+*
+* @package ucp
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @package module_install
+*/
+class ucp_auth_link_info
+{
+ function module()
+ {
+ return array(
+ 'filename' => 'ucp_auth_link',
+ 'title' => 'UCP_AUTH_LINK',
+ 'version' => '1.0.0',
+ 'modes' => array(
+ 'auth_link' => array('title' => 'UCP_AUTH_LINK_MANAGE', 'auth' => '', 'cat' => array('UCP_PROFILE')),
+ ),
+ );
+ }
+
+ function install()
+ {
+ }
+
+ function uninstall()
+ {
+ }
+}
diff --git a/phpBB/includes/ucp/ucp_auth_link.php b/phpBB/includes/ucp/ucp_auth_link.php
new file mode 100644
index 0000000000..b86c4c8d52
--- /dev/null
+++ b/phpBB/includes/ucp/ucp_auth_link.php
@@ -0,0 +1,142 @@
+<?php
+/**
+*
+* @package ucp
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+class ucp_auth_link
+{
+ /**
+ * @var string
+ */
+ public $u_action;
+
+ /**
+ * Generates the ucp_auth_link page and handles the auth link process
+ *
+ * @param int $id
+ * @param string $mode
+ */
+ public function main($id, $mode)
+ {
+ global $config, $request, $template, $phpbb_container, $user;
+
+ $error = array();
+
+ $auth_provider = $phpbb_container->get('auth.provider.' . $config['auth_method']);
+
+ // confirm that the auth provider supports this page
+ $provider_data = $auth_provider->get_auth_link_data();
+ if ($provider_data === null)
+ {
+ $error[] = 'UCP_AUTH_LINK_NOT_SUPPORTED';
+ }
+
+ $s_hidden_fields = array();
+ add_form_key('ucp_auth_link');
+
+ $submit = $request->variable('submit', false, false, \phpbb\request\request_interface::POST);
+
+ // This path is only for primary actions
+ if (!sizeof($error) && $submit)
+ {
+ if (!check_form_key('ucp_auth_link'))
+ {
+ $error[] = 'FORM_INVALID';
+ }
+
+ if (!sizeof($error))
+ {
+ // Any post data could be necessary for auth (un)linking
+ $link_data = $request->get_super_global(\phpbb\request\request_interface::POST);
+
+ // The current user_id is also necessary
+ $link_data['user_id'] = $user->data['user_id'];
+
+ // Tell the provider that the method is auth_link not login_link
+ $link_data['link_method'] = 'auth_link';
+
+ if ($request->variable('link', 0, false, \phpbb\request\request_interface::POST))
+ {
+ $error[] = $auth_provider->link_account($link_data);
+ }
+ else
+ {
+ $error[] = $auth_provider->unlink_account($link_data);
+ }
+
+ // Template data may have changed, get new data
+ $provider_data = $auth_provider->get_auth_link_data();
+ }
+ }
+
+ // In some cases, a request to an external server may be required. In
+ // these cases, the GET parameter 'link' should exist and should be true
+ if ($request->variable('link', false))
+ {
+ // In this case the link data should only be populated with the
+ // link_method as the provider dictates how data is returned to it.
+ $link_data = array('link_method' => 'auth_link');
+
+ $error[] = $auth_provider->link_account($link_data);
+
+ // Template data may have changed, get new data
+ $provider_data = $auth_provider->get_auth_link_data();
+ }
+
+ if (isset($provider_data['VARS']))
+ {
+ // Handle hidden fields separately
+ if (isset($provider_data['VARS']['HIDDEN_FIELDS']))
+ {
+ $s_hidden_fields = array_merge($s_hidden_fields, $provider_data['VARS']['HIDDEN_FIELDS']);
+ unset($provider_data['VARS']['HIDDEN_FIELDS']);
+ }
+
+ $template->assign_vars($provider_data['VARS']);
+ }
+
+ if (isset($provider_data['BLOCK_VAR_NAME']))
+ {
+ foreach ($provider_data['BLOCK_VARS'] as $block_vars)
+ {
+ // See if there are additional hidden fields. This should be an associative array
+ if (isset($block_vars['HIDDEN_FIELDS']))
+ {
+ $block_vars['HIDDEN_FIELDS'] = build_hidden_fields($block_vars['HIDDEN_FIELDS']);
+ }
+
+ $template->assign_block_vars($provider_data['BLOCK_VAR_NAME'], $block_vars);
+ }
+ }
+
+ $s_hidden_fields = build_hidden_fields($s_hidden_fields);
+
+ // Replace "error" strings with their real, localised form
+ $error = array_map(array($user, 'lang'), $error);
+ $error = implode('<br />', $error);
+
+ $template->assign_vars(array(
+ 'ERROR' => $error,
+
+ 'PROVIDER_TEMPLATE_FILE' => $provider_data['TEMPLATE_FILE'],
+
+ 'S_HIDDEN_FIELDS' => $s_hidden_fields,
+ 'S_UCP_ACTION' => $this->u_action,
+ ));
+
+ $this->tpl_name = 'ucp_auth_link';
+ $this->page_title = 'UCP_AUTH_LINK';
+ }
+}
diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php
index 8620e33e47..a75d2e9bfc 100644
--- a/phpBB/includes/ucp/ucp_groups.php
+++ b/phpBB/includes/ucp/ucp_groups.php
@@ -34,8 +34,8 @@ class ucp_groups
$return_page = '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $this->u_action . '">', '</a>');
$mark_ary = request_var('mark', array(0));
- $submit = $request->variable('submit', false, false, phpbb_request_interface::POST);
- $delete = $request->variable('delete', 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\request_interface::POST);
$error = $data = array();
switch ($mode)
@@ -197,37 +197,6 @@ class ucp_groups
else
{
group_user_add($group_id, $user->data['user_id'], false, false, false, 0, 1);
-
- include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
- $messenger = new messenger();
-
- $sql = 'SELECT u.username, u.username_clean, u.user_email, u.user_notify_type, u.user_jabber, u.user_lang
- FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . " u
- WHERE ug.user_id = u.user_id
- AND ug.group_leader = 1
- AND ug.group_id = $group_id";
- $result = $db->sql_query($sql);
-
- while ($row = $db->sql_fetchrow($result))
- {
- $messenger->template('group_request', $row['user_lang']);
-
- $messenger->set_addresses($row);
-
- $messenger->assign_vars(array(
- 'USERNAME' => htmlspecialchars_decode($row['username']),
- 'GROUP_NAME' => htmlspecialchars_decode($group_row[$group_id]['group_name']),
- 'REQUEST_USERNAME' => $user->data['username'],
-
- 'U_PENDING' => generate_board_url() . "/ucp.$phpEx?i=groups&mode=manage&action=list&g=$group_id",
- 'U_GROUP' => generate_board_url() . "/memberlist.$phpEx?mode=group&g=$group_id")
- );
-
- $messenger->send($row['user_notify_type']);
- }
- $db->sql_freeresult($result);
-
- $messenger->save_queue();
}
add_log('user', $user->data['user_id'], 'LOG_USER_GROUP_JOIN' . (($group_row[$group_id]['group_type'] == GROUP_FREE) ? '' : '_PENDING'), $group_row[$group_id]['group_name']);
@@ -496,7 +465,7 @@ class ucp_groups
$avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers();
// 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?
diff --git a/phpBB/includes/ucp/ucp_login_link.php b/phpBB/includes/ucp/ucp_login_link.php
new file mode 100644
index 0000000000..80a553953d
--- /dev/null
+++ b/phpBB/includes/ucp/ucp_login_link.php
@@ -0,0 +1,243 @@
+<?php
+/**
+*
+* @package ucp
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+/**
+* ucp_login_link
+* Allows users of external accounts link those accounts to their phpBB accounts
+* during an attempted login.
+* @package ucp
+*/
+class ucp_login_link
+{
+ /**
+ * @var string
+ */
+ public $u_action;
+
+ /**
+ * Generates the ucp_login_link page and handles login link process
+ *
+ * @param int $id
+ * @param string $mode
+ */
+ function main($id, $mode)
+ {
+ global $config, $phpbb_container, $request, $template, $user;
+ global $phpbb_root_path, $phpEx;
+
+ // Initialize necessary variables
+ $login_error = null;
+ $login_link_error = null;
+ $login_username = null;
+
+ // Build the data array
+ $data = $this->get_login_link_data_array();
+
+ // Ensure the person was sent here with login_link data
+ if (empty($data))
+ {
+ $login_link_error = $user->lang['LOGIN_LINK_NO_DATA_PROVIDED'];
+ }
+
+ // Use the auth_provider requested even if different from configured
+ $auth_provider = 'auth.provider.' . $request->variable('auth_provider', $config['auth_method']);
+ $auth_provider = $phpbb_container->get($auth_provider);
+
+ // Set the link_method to login_link
+ $data['link_method'] = 'login_link';
+
+ // Have the authentication provider check that all necessary data is available
+ $result = $auth_provider->login_link_has_necessary_data($data);
+ if ($result !== null)
+ {
+ $login_link_error = $user->lang[$result];
+ }
+
+ // Perform link action if there is no error
+ if (!$login_link_error)
+ {
+ if ($request->is_set_post('login'))
+ {
+ $login_username = $request->variable('login_username', '', false, \phpbb\request\request_interface::POST);
+ $login_password = $request->untrimmed_variable('login_password', '', true, \phpbb\request\request_interface::POST);
+
+ $login_result = $auth_provider->login($login_username, $login_password);
+
+ // We only care if there is or is not an error
+ $login_error = $this->process_login_result($login_result);
+
+ if (!$login_error)
+ {
+ // Give the user_id to the data
+ $data['user_id'] = $login_result['user_row']['user_id'];
+
+ // The user is now logged in, attempt to link the user to the external account
+ $result = $auth_provider->link_account($data);
+
+ if ($result)
+ {
+ $login_link_error = $user->lang[$result];
+ }
+ else
+ {
+ // Finish login
+ $result = $user->session_create($login_result['user_row']['user_id'], false, false, true);
+
+ // Perform a redirect as the account has been linked
+ $this->perform_redirect();
+ }
+ }
+ }
+ }
+
+ $template->assign_vars(array(
+ // Common template elements
+ 'LOGIN_LINK_ERROR' => $login_link_error,
+ 'PASSWORD_CREDENTIAL' => 'login_password',
+ 'USERNAME_CREDENTIAL' => 'login_username',
+ 'S_HIDDEN_FIELDS' => $this->get_hidden_fields($data),
+
+ // Registration elements
+ 'REGISTER_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'),
+
+ // Login elements
+ 'LOGIN_ERROR' => $login_error,
+ 'LOGIN_USERNAME' => $login_username,
+ ));
+
+ $this->tpl_name = 'ucp_login_link';
+ $this->page_title = 'UCP_LOGIN_LINK';
+ }
+
+ /**
+ * Builds the hidden fields string from the data array.
+ *
+ * @param array $data This function only includes data in the array
+ * that has a key that begins with 'login_link_'
+ * @return string A string of hidden fields that can be included in the
+ * template
+ */
+ protected function get_hidden_fields($data)
+ {
+ $fields = array();
+
+ foreach ($data as $key => $value)
+ {
+ $fields['login_link_' . $key] = $value;
+ }
+
+ return build_hidden_fields($fields);
+ }
+
+ /**
+ * Builds the login_link data array
+ *
+ * @return array All login_link data. This is all GET data whose names
+ * begin with 'login_link_'
+ */
+ protected function get_login_link_data_array()
+ {
+ global $request;
+
+ $var_names = $request->variable_names(\phpbb\request\request_interface::GET);
+ $login_link_data = array();
+ $string_start_length = strlen('login_link_');
+
+ foreach ($var_names as $var_name)
+ {
+ if (strpos($var_name, 'login_link_') === 0)
+ {
+ $key_name = substr($var_name, $string_start_length);
+ $login_link_data[$key_name] = $request->variable($var_name, '', false, \phpbb\request\request_interface::GET);
+ }
+ }
+
+ return $login_link_data;
+ }
+
+ /**
+ * Processes the result array from the login process
+ * @param array $result The login result array
+ * @return string|null If there was an error in the process, a string is
+ * returned. If the login was successful, then null is
+ * returned.
+ */
+ protected function process_login_result($result)
+ {
+ global $config, $request, $template, $user;
+
+ $login_error = null;
+
+ if ($result['status'] != LOGIN_SUCCESS)
+ {
+ // Handle all errors first
+ if ($result['status'] == LOGIN_BREAK)
+ {
+ trigger_error($result['error_msg']);
+ }
+
+ switch ($result['status'])
+ {
+ case LOGIN_ERROR_ATTEMPTS:
+
+ $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']);
+ $captcha->init(CONFIRM_LOGIN);
+
+ $template->assign_vars(array(
+ 'CAPTCHA_TEMPLATE' => $captcha->get_template(),
+ ));
+
+ $login_error = $user->lang[$result['error_msg']];
+ break;
+
+ case LOGIN_ERROR_PASSWORD_CONVERT:
+ $login_error = sprintf(
+ $user->lang[$result['error_msg']],
+ ($config['email_enable']) ? '<a href="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=sendpassword') . '">' : '',
+ ($config['email_enable']) ? '</a>' : '',
+ ($config['board_contact']) ? '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">' : '',
+ ($config['board_contact']) ? '</a>' : ''
+ );
+ break;
+
+ // Username, password, etc...
+ default:
+ $login_error = $user->lang[$result['error_msg']];
+
+ // Assign admin contact to some error messages
+ if ($result['error_msg'] == 'LOGIN_ERROR_USERNAME' || $result['error_msg'] == 'LOGIN_ERROR_PASSWORD')
+ {
+ $login_error = (!$config['board_contact']) ? sprintf($user->lang[$result['error_msg']], '', '') : sprintf($user->lang[$result['error_msg']], '<a href="mailto:' . htmlspecialchars($config['board_contact']) . '">', '</a>');
+ }
+
+ break;
+ }
+ }
+
+ return $login_error;
+ }
+
+ /**
+ * Performs a post login redirect
+ */
+ protected function perform_redirect()
+ {
+ global $phpbb_root_path, $phpEx;
+ $url = append_sid($phpbb_root_path . 'index.' . $phpEx);
+ redirect($url);
+ }
+}
diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php
index 615b567134..b859413d92 100644
--- a/phpBB/includes/ucp/ucp_main.php
+++ b/phpBB/includes/ucp/ucp_main.php
@@ -296,7 +296,7 @@ class ucp_main
}
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();
}
diff --git a/phpBB/includes/ucp/ucp_notifications.php b/phpBB/includes/ucp/ucp_notifications.php
index 72c41776b3..2f22f6cf9c 100644
--- a/phpBB/includes/ucp/ucp_notifications.php
+++ b/phpBB/includes/ucp/ucp_notifications.php
@@ -163,11 +163,11 @@ class ucp_notifications
* Output all the notification types to the template
*
* @param string $block
- * @param phpbb_notification_manager $phpbb_notifications
- * @param phpbb_template $template
- * @param phpbb_user $user
+ * @param \phpbb\notification\manager $phpbb_notifications
+ * @param \phpbb\template\template $template
+ * @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();
@@ -210,11 +210,11 @@ class ucp_notifications
* Output all the notification methods to the template
*
* @param string $block
- * @param phpbb_notification_manager $phpbb_notifications
- * @param phpbb_template $template
- * @param phpbb_user $user
+ * @param \phpbb\notification\manager $phpbb_notifications
+ * @param \phpbb\template\template $template
+ * @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();
diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php
index f24578da84..e80cc2dce3 100644
--- a/phpBB/includes/ucp/ucp_prefs.php
+++ b/phpBB/includes/ucp/ucp_prefs.php
@@ -26,7 +26,7 @@ class ucp_prefs
function main($id, $mode)
{
- global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
+ global $config, $db, $user, $auth, $template, $phpbb_dispatcher, $phpbb_root_path, $phpEx;
$submit = (isset($_POST['submit'])) ? true : false;
$error = $data = array();
@@ -55,6 +55,20 @@ class ucp_prefs
$data['notifymethod'] = NOTIFY_BOTH;
}
+ /**
+ * Add UCP edit global settings data before they are assigned to the template or submitted
+ *
+ * To assign data to the template, use $template->assign_vars()
+ *
+ * @event core.ucp_prefs_personal_data
+ * @var bool submit Do we display the form only
+ * or did the user press submit
+ * @var array data Array with current ucp options data
+ * @since 3.1-A1
+ */
+ $vars = array('submit', 'data');
+ extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_personal_data', compact($vars)));
+
if ($submit)
{
if ($config['override_user_style'])
@@ -93,6 +107,17 @@ class ucp_prefs
'user_style' => $data['style'],
);
+ /**
+ * Update UCP edit global settings data on form submit
+ *
+ * @event core.ucp_prefs_personal_update_data
+ * @var array data Submitted display options data
+ * @var array sql_ary Display options data we udpate
+ * @since 3.1-A1
+ */
+ $vars = array('data', 'sql_ary');
+ extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_personal_update_data', compact($vars)));
+
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $user->data['user_id'];
@@ -209,6 +234,20 @@ class ucp_prefs
'wordcensor' => request_var('wordcensor', (bool) $user->optionget('viewcensors')),
);
+ /**
+ * Add UCP edit display options data before they are assigned to the template or submitted
+ *
+ * To assign data to the template, use $template->assign_vars()
+ *
+ * @event core.ucp_prefs_view_data
+ * @var bool submit Do we display the form only
+ * or did the user press submit
+ * @var array data Array with current ucp options data
+ * @since 3.1-A1
+ */
+ $vars = array('submit', 'data');
+ extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_view_data', compact($vars)));
+
if ($submit)
{
$error = validate_data($data, array(
@@ -247,6 +286,17 @@ class ucp_prefs
'user_post_show_days' => $data['post_st'],
);
+ /**
+ * Update UCP edit display options data on form submit
+ *
+ * @event core.ucp_prefs_view_update_data
+ * @var array data Submitted display options data
+ * @var array sql_ary Display options data we udpate
+ * @since 3.1-A1
+ */
+ $vars = array('data', 'sql_ary');
+ extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_view_update_data', compact($vars)));
+
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $user->data['user_id'];
@@ -335,6 +385,20 @@ class ucp_prefs
);
add_form_key('ucp_prefs_post');
+ /**
+ * Add UCP edit posting defaults data before they are assigned to the template or submitted
+ *
+ * To assign data to the template, use $template->assign_vars()
+ *
+ * @event core.ucp_prefs_post_data
+ * @var bool submit Do we display the form only
+ * or did the user press submit
+ * @var array data Array with current ucp options data
+ * @since 3.1-A1
+ */
+ $vars = array('submit', 'data');
+ extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_post_data', compact($vars)));
+
if ($submit)
{
if (check_form_key('ucp_prefs_post'))
@@ -348,6 +412,17 @@ class ucp_prefs
'user_notify' => $data['notify'],
);
+ /**
+ * Update UCP edit posting defaults data on form submit
+ *
+ * @event core.ucp_prefs_post_update_data
+ * @var array data Submitted display options data
+ * @var array sql_ary Display options data we udpate
+ * @since 3.1-A1
+ */
+ $vars = array('data', 'sql_ary');
+ extract($phpbb_dispatcher->trigger_event('core.ucp_prefs_post_update_data', compact($vars)));
+
$sql = 'UPDATE ' . USERS_TABLE . '
SET ' . $db->sql_build_array('UPDATE', $sql_ary) . '
WHERE user_id = ' . $user->data['user_id'];
diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php
index e55569fdd5..8ae7acaa11 100644
--- a/phpBB/includes/ucp/ucp_profile.php
+++ b/phpBB/includes/ucp/ucp_profile.php
@@ -34,9 +34,9 @@ class ucp_profile
$user->add_lang('posting');
- $preview = $request->variable('preview', false, false, phpbb_request_interface::POST);
- $submit = $request->variable('submit', false, false, phpbb_request_interface::POST);
- $delete = $request->variable('delete', 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\request_interface::POST);
+ $delete = $request->variable('delete', false, false, \phpbb\request\request_interface::POST);
$error = $data = array();
$s_hidden_fields = '';
@@ -567,7 +567,7 @@ class ucp_profile
$avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers();
// 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)
{
diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php
index 7bc7ac8191..1f9ab23326 100644
--- a/phpBB/includes/ucp/ucp_register.php
+++ b/phpBB/includes/ucp/ucp_register.php
@@ -27,7 +27,7 @@ class ucp_register
function main($id, $mode)
{
global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx;
- global $request;
+ global $request, $phpbb_container;
//
if ($config['require_activation'] == USER_ACTIVATION_DISABLE)
@@ -78,19 +78,37 @@ class ucp_register
}
}
-
$cp = new custom_profile();
$error = $cp_data = $cp_error = array();
+ $s_hidden_fields = array();
+
+ // Handle login_link data added to $_hidden_fields
+ $login_link_data = $this->get_login_link_data_array();
+
+ if (!empty($login_link_data))
+ {
+ // Confirm that we have all necessary data
+ $auth_provider = 'auth.provider.' . $request->variable('auth_provider', $config['auth_method']);
+ $auth_provider = $phpbb_container->get($auth_provider);
+
+ $result = $auth_provider->login_link_has_necessary_data($login_link_data);
+ if ($result !== null)
+ {
+ $error[] = $user->lang[$result];
+ }
+
+ $s_hidden_fields = array_merge($s_hidden_fields, $this->get_login_link_data_for_hidden_fields($login_link_data));
+ }
if (!$agreed || ($coppa === false && $config['coppa_enable']) || ($coppa && !$config['coppa_enable']))
{
$add_lang = ($change_lang) ? '&amp;change_lang=' . urlencode($change_lang) : '';
$add_coppa = ($coppa !== false) ? '&amp;coppa=' . $coppa : '';
- $s_hidden_fields = array(
+ $s_hidden_fields = array_merge($s_hidden_fields, array(
'change_lang' => '',
- );
+ ));
// If we change the language, we want to pass on some more possible parameter.
if ($change_lang)
@@ -398,15 +416,28 @@ class ucp_register
}
}
+ // Perform account linking if necessary
+ if (!empty($login_link_data))
+ {
+ $login_link_data['user_id'] = $user_id;
+
+ $result = $auth_provider->link_account($login_link_data);
+
+ if ($result)
+ {
+ $message = $message . '<br /><br />' . $user->lang[$result];
+ }
+ }
+
$message = $message . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>');
trigger_error($message);
}
}
- $s_hidden_fields = array(
+ $s_hidden_fields = array_merge($s_hidden_fields, array(
'agreed' => 'true',
'change_lang' => 0,
- );
+ ));
if ($config['coppa_enable'])
{
@@ -474,4 +505,49 @@ class ucp_register
$this->tpl_name = 'ucp_register';
$this->page_title = 'UCP_REGISTRATION';
}
+
+ /**
+ * Creates the login_link data array
+ *
+ * @return array Returns an array of all POST paramaters whose names
+ * begin with 'login_link_'
+ */
+ protected function get_login_link_data_array()
+ {
+ global $request;
+
+ $var_names = $request->variable_names(\phpbb\request\request_interface::POST);
+ $login_link_data = array();
+ $string_start_length = strlen('login_link_');
+
+ foreach ($var_names as $var_name)
+ {
+ if (strpos($var_name, 'login_link_') === 0)
+ {
+ $key_name = substr($var_name, $string_start_length);
+ $login_link_data[$key_name] = $request->variable($var_name, '', false, \phpbb\request\request_interface::POST);
+ }
+ }
+
+ return $login_link_data;
+ }
+
+ /**
+ * Prepends they key names of an associative array with 'login_link_' for
+ * inclusion on the page as hidden fields.
+ *
+ * @param array $data The array to be modified
+ * @return array The modified array
+ */
+ protected function get_login_link_data_for_hidden_fields($data)
+ {
+ $new_data = array();
+
+ foreach ($data as $key => $value)
+ {
+ $new_data['login_link_' . $key] = $value;
+ }
+
+ return $new_data;
+ }
}
diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php
index ff7ab53736..b3def63896 100644
--- a/phpBB/includes/ucp/ucp_remind.php
+++ b/phpBB/includes/ucp/ucp_remind.php
@@ -71,7 +71,7 @@ class ucp_remind
}
// Check users permissions
- $auth2 = new phpbb_auth();
+ $auth2 = new \phpbb\auth\auth();
$auth2->acl($user_row);
if (!$auth2->acl_get('u_chgpasswd'))
@@ -101,6 +101,8 @@ class ucp_remind
$messenger->set_addresses($user_row);
+ $messenger->anti_abuse_headers($config, $user);
+
$messenger->assign_vars(array(
'USERNAME' => htmlspecialchars_decode($user_row['username']),
'PASSWORD' => htmlspecialchars_decode($user_password),
diff --git a/phpBB/includes/ucp/ucp_zebra.php b/phpBB/includes/ucp/ucp_zebra.php
index a669c450a4..6bb3cdc145 100644
--- a/phpBB/includes/ucp/ucp_zebra.php
+++ b/phpBB/includes/ucp/ucp_zebra.php
@@ -229,7 +229,7 @@ class ucp_zebra
{
$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(
'success' => $updated,
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 3be5ea659c..fa8ec6b6ce 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -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');
// 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();
// Set up container (must be done here because extensions table may not exist)
$container_extensions = array(
- new phpbb_di_extension_config($phpbb_root_path . 'config.' . $phpEx),
- new phpbb_di_extension_core($phpbb_root_path . 'config/'),
+ new \phpbb\di\extension\config($phpbb_root_path . 'config.' . $phpEx),
+ new \phpbb\di\extension\core($phpbb_root_path . 'config/'),
);
$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);
@@ -211,7 +211,7 @@ while (!$migrator->finished())
{
$migrator->update();
}
- catch (phpbb_db_migration_exception $e)
+ catch (\phpbb\db\migration\exception $e)
{
echo $e->getLocalisedMessage($user);
diff --git a/phpBB/install/index.php b/phpBB/install/index.php
index bd39e231f4..2a3bb36bf6 100644
--- a/phpBB/install/index.php
+++ b/phpBB/install/index.php
@@ -108,11 +108,11 @@ phpbb_include_updated('includes/utf/utf_tools.' . $phpEx);
phpbb_require_updated('includes/functions_install.' . $phpEx);
// 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 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_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();
// Set up container
@@ -219,8 +219,8 @@ $sub = $request->variable('sub', '');
// Set PHP error handler to ours
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
-$user = new phpbb_user();
-$auth = new phpbb_auth();
+$user = new \phpbb\user();
+$auth = new \phpbb\auth\auth();
// Add own hook handler, if present. :o
if (file_exists($phpbb_root_path . 'includes/hooks/index.' . $phpEx))
@@ -240,19 +240,15 @@ else
}
// Set some standard variables we want to force
-$config = new phpbb_config(array(
+$config = new \phpbb\config\config(array(
'load_tplcompile' => '1'
));
-$phpbb_style_resource_locator = new phpbb_style_resource_locator();
-$phpbb_style_path_provider = new phpbb_style_path_provider();
-$template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context());
-$phpbb_style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $phpbb_style_resource_locator, $phpbb_style_path_provider, $template);
-$phpbb_style->set_ext_dir_prefix('adm/');
-
+$phpbb_filesystem = $phpbb_container->get('filesystem');
+$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_filter($paths, 'is_dir');
-$phpbb_style->set_custom_style('admin', $paths, array(), '');
+$template->set_custom_style('adm', $paths);
$template->assign_var('T_ASSETS_PATH', '../assets');
$template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style');
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index 8a8c440036..4d3e1d3d4a 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -130,7 +130,7 @@ class install_convert extends module
unset($dbpasswd);
// 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_count(null, null, null, $config);
@@ -345,7 +345,7 @@ class install_convert extends module
$this->page_title = $lang['STAGE_SETTINGS'];
// 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_count(null, null, null, $config);
@@ -586,7 +586,7 @@ class install_convert extends module
unset($dbpasswd);
// 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_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...
if (!class_exists($search_type))
{
- $search_type = 'phpbb_search_fulltext_native';
+ $search_type = '\phpbb\search\fulltext_native';
set_config('search_type', $search_type);
}
diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php
index ea23c318e3..c273660d08 100644
--- a/phpBB/install/install_install.php
+++ b/phpBB/install/install_install.php
@@ -102,7 +102,7 @@ class install_install extends module
break;
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();
// 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
$sql_query = file_get_contents('schemas/schema_data.sql');
- // Deal with any special comments
+ // Deal with any special comments and characters
switch ($data['dbms'])
{
case 'mssql':
@@ -1191,6 +1191,11 @@ class install_install extends module
case 'postgres':
$sql_query = preg_replace('#\# POSTGRES (BEGIN|COMMIT) \##s', '\1; ', $sql_query);
break;
+
+ case 'mysql':
+ case 'mysqli':
+ $sql_query = str_replace('\\', '\\\\', $sql_query);
+ break;
}
// Change prefix
@@ -1438,12 +1443,12 @@ class install_install extends module
include_once($phpbb_root_path . 'phpbb/search/fulltext_native.' . $phpEx);
// 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_count(null, null, null, $config);
$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
FROM ' . POSTS_TABLE;
@@ -1753,7 +1758,7 @@ class install_install extends module
$data = $this->get_submitted_data();
// 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_count(null, null, null, $config);
@@ -1827,7 +1832,7 @@ class install_install extends module
$data = $this->get_submitted_data();
// 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_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
* perform any of the actions in the migrations.
*
- * @param phpbb_extension_manager $extension_manager
- * @param phpbb_db_migrator $migrator
+ * @param \phpbb\extension\manager $extension_manager
+ * @param \phpbb\db\migrator $migrator
*/
function populate_migrations($extension_manager, $migrator)
{
diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php
index 4ae39f202f..b7b358ab2f 100644
--- a/phpBB/install/install_update.php
+++ b/phpBB/install/install_update.php
@@ -70,7 +70,7 @@ class install_update extends module
function main($mode, $sub)
{
- global $phpbb_style, $template, $phpEx, $phpbb_root_path, $user, $db, $config, $cache, $auth, $language;
+ global $template, $phpEx, $phpbb_root_path, $user, $db, $config, $cache, $auth, $language;
global $request, $phpbb_admin_path, $phpbb_adm_relative_path, $phpbb_container;
// We must enable super globals, otherwise creating a new instance of the request class,
@@ -111,7 +111,7 @@ class install_update extends module
unset($dbpasswd);
// 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_count(null, null, null, $config);
@@ -143,7 +143,7 @@ class install_update extends module
// Set custom template again. ;)
$paths = array($phpbb_root_path . 'install/update/new/adm/style', $phpbb_admin_path . 'style');
$paths = array_filter($paths, 'is_dir');
- $phpbb_style->set_custom_style('admin', $paths, array(), '');
+ $template->set_custom_style('adm', $paths);
$template->assign_vars(array(
'S_USER_LANG' => $user->lang['USER_LANG'],
@@ -250,7 +250,7 @@ class install_update extends module
$this->include_file('includes/diff/renderer.' . $phpEx);
// 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';
}
@@ -338,7 +338,7 @@ class install_update extends module
$action = request_var('action', '');
// 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;
// Make sure the list is up-to-date
diff --git a/phpBB/install/schemas/firebird_schema.sql b/phpBB/install/schemas/firebird_schema.sql
index 73bdfe777c..a9b7f58099 100644
--- a/phpBB/install/schemas/firebird_schema.sql
+++ b/phpBB/install/schemas/firebird_schema.sql
@@ -128,6 +128,27 @@ CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users(user_id);;
CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users(auth_option_id);;
CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users(auth_role_id);;
+# Table: 'phpbb_oauth_tokens'
+CREATE TABLE phpbb_oauth_tokens (
+ user_id INTEGER DEFAULT 0 NOT NULL,
+ session_id CHAR(32) CHARACTER SET NONE DEFAULT '' NOT NULL,
+ provider VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL,
+ oauth_token BLOB SUB_TYPE TEXT CHARACTER SET NONE DEFAULT '' NOT NULL
+);;
+
+CREATE INDEX phpbb_oauth_tokens_user_id ON phpbb_oauth_tokens(user_id);;
+CREATE INDEX phpbb_oauth_tokens_provider ON phpbb_oauth_tokens(provider);;
+
+# Table: 'phpbb_oauth_accounts'
+CREATE TABLE phpbb_oauth_accounts (
+ user_id INTEGER DEFAULT 0 NOT NULL,
+ provider VARCHAR(255) CHARACTER SET NONE DEFAULT '' NOT NULL,
+ oauth_provider_id BLOB SUB_TYPE TEXT CHARACTER SET UTF8 DEFAULT '' NOT NULL
+);;
+
+ALTER TABLE phpbb_oauth_accounts ADD PRIMARY KEY (user_id, provider);;
+
+
# Table: 'phpbb_banlist'
CREATE TABLE phpbb_banlist (
ban_id INTEGER NOT NULL,
diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql
index cbf824ce8d..bea116b7d6 100644
--- a/phpBB/install/schemas/mssql_schema.sql
+++ b/phpBB/install/schemas/mssql_schema.sql
@@ -167,6 +167,43 @@ GO
/*
+ Table: 'phpbb_oauth_tokens'
+*/
+CREATE TABLE [phpbb_oauth_tokens] (
+ [user_id] [int] DEFAULT (0) NOT NULL ,
+ [session_id] [char] (32) DEFAULT ('') NOT NULL ,
+ [provider] [varchar] (255) DEFAULT ('') NOT NULL ,
+ [oauth_token] [text] DEFAULT ('') NOT NULL
+) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
+GO
+
+CREATE INDEX [user_id] ON [phpbb_oauth_tokens]([user_id]) ON [PRIMARY]
+GO
+
+CREATE INDEX [provider] ON [phpbb_oauth_tokens]([provider]) ON [PRIMARY]
+GO
+
+
+/*
+ Table: 'phpbb_oauth_accounts'
+*/
+CREATE TABLE [phpbb_oauth_accounts] (
+ [user_id] [int] DEFAULT (0) NOT NULL ,
+ [provider] [varchar] (255) DEFAULT ('') NOT NULL ,
+ [oauth_provider_id] [varchar] (4000) DEFAULT ('') NOT NULL
+) ON [PRIMARY]
+GO
+
+ALTER TABLE [phpbb_oauth_accounts] WITH NOCHECK ADD
+ CONSTRAINT [PK_phpbb_oauth_accounts] PRIMARY KEY CLUSTERED
+ (
+ [user_id],
+ [provider]
+ ) ON [PRIMARY]
+GO
+
+
+/*
Table: 'phpbb_banlist'
*/
CREATE TABLE [phpbb_banlist] (
diff --git a/phpBB/install/schemas/mysql_40_schema.sql b/phpBB/install/schemas/mysql_40_schema.sql
index 6d487335bb..da464f3ae7 100644
--- a/phpBB/install/schemas/mysql_40_schema.sql
+++ b/phpBB/install/schemas/mysql_40_schema.sql
@@ -90,6 +90,26 @@ CREATE TABLE phpbb_acl_users (
);
+# Table: 'phpbb_oauth_tokens'
+CREATE TABLE phpbb_oauth_tokens (
+ user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
+ session_id binary(32) DEFAULT '' NOT NULL,
+ provider varbinary(255) DEFAULT '' NOT NULL,
+ oauth_token mediumblob NOT NULL,
+ KEY user_id (user_id),
+ KEY provider (provider)
+);
+
+
+# Table: 'phpbb_oauth_accounts'
+CREATE TABLE phpbb_oauth_accounts (
+ user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
+ provider varbinary(255) DEFAULT '' NOT NULL,
+ oauth_provider_id blob NOT NULL,
+ PRIMARY KEY (user_id, provider)
+);
+
+
# Table: 'phpbb_banlist'
CREATE TABLE phpbb_banlist (
ban_id mediumint(8) UNSIGNED NOT NULL auto_increment,
diff --git a/phpBB/install/schemas/mysql_41_schema.sql b/phpBB/install/schemas/mysql_41_schema.sql
index 5b64027d4e..fa8929d860 100644
--- a/phpBB/install/schemas/mysql_41_schema.sql
+++ b/phpBB/install/schemas/mysql_41_schema.sql
@@ -90,6 +90,26 @@ CREATE TABLE phpbb_acl_users (
) CHARACTER SET `utf8` COLLATE `utf8_bin`;
+# Table: 'phpbb_oauth_tokens'
+CREATE TABLE phpbb_oauth_tokens (
+ user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
+ session_id char(32) DEFAULT '' NOT NULL,
+ provider varchar(255) DEFAULT '' NOT NULL,
+ oauth_token mediumtext NOT NULL,
+ KEY user_id (user_id),
+ KEY provider (provider)
+) CHARACTER SET `utf8` COLLATE `utf8_bin`;
+
+
+# Table: 'phpbb_oauth_accounts'
+CREATE TABLE phpbb_oauth_accounts (
+ user_id mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
+ provider varchar(255) DEFAULT '' NOT NULL,
+ oauth_provider_id text NOT NULL,
+ PRIMARY KEY (user_id, provider)
+) CHARACTER SET `utf8` COLLATE `utf8_bin`;
+
+
# Table: 'phpbb_banlist'
CREATE TABLE phpbb_banlist (
ban_id mediumint(8) UNSIGNED NOT NULL auto_increment,
diff --git a/phpBB/install/schemas/oracle_schema.sql b/phpBB/install/schemas/oracle_schema.sql
index 598910c143..a2e9780b9f 100644
--- a/phpBB/install/schemas/oracle_schema.sql
+++ b/phpBB/install/schemas/oracle_schema.sql
@@ -211,6 +211,34 @@ CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users (auth_role_id)
/
/*
+ Table: 'phpbb_oauth_tokens'
+*/
+CREATE TABLE phpbb_oauth_tokens (
+ user_id number(8) DEFAULT '0' NOT NULL,
+ session_id char(32) DEFAULT '' ,
+ provider varchar2(255) DEFAULT '' ,
+ oauth_token clob DEFAULT ''
+)
+/
+
+CREATE INDEX phpbb_oauth_tokens_user_id ON phpbb_oauth_tokens (user_id)
+/
+CREATE INDEX phpbb_oauth_tokens_provider ON phpbb_oauth_tokens (provider)
+/
+
+/*
+ Table: 'phpbb_oauth_accounts'
+*/
+CREATE TABLE phpbb_oauth_accounts (
+ user_id number(8) DEFAULT '0' NOT NULL,
+ provider varchar2(255) DEFAULT '' ,
+ oauth_provider_id clob DEFAULT '' ,
+ CONSTRAINT pk_phpbb_oauth_accounts PRIMARY KEY (user_id, provider)
+)
+/
+
+
+/*
Table: 'phpbb_banlist'
*/
CREATE TABLE phpbb_banlist (
diff --git a/phpBB/install/schemas/postgres_schema.sql b/phpBB/install/schemas/postgres_schema.sql
index fe90befb72..ecafe8f43f 100644
--- a/phpBB/install/schemas/postgres_schema.sql
+++ b/phpBB/install/schemas/postgres_schema.sql
@@ -189,6 +189,30 @@ CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users (auth_option_id);
CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users (auth_role_id);
/*
+ Table: 'phpbb_oauth_tokens'
+*/
+CREATE TABLE phpbb_oauth_tokens (
+ user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+ session_id char(32) DEFAULT '' NOT NULL,
+ provider varchar(255) DEFAULT '' NOT NULL,
+ oauth_token TEXT DEFAULT '' NOT NULL
+);
+
+CREATE INDEX phpbb_oauth_tokens_user_id ON phpbb_oauth_tokens (user_id);
+CREATE INDEX phpbb_oauth_tokens_provider ON phpbb_oauth_tokens (provider);
+
+/*
+ Table: 'phpbb_oauth_accounts'
+*/
+CREATE TABLE phpbb_oauth_accounts (
+ user_id INT4 DEFAULT '0' NOT NULL CHECK (user_id >= 0),
+ provider varchar(255) DEFAULT '' NOT NULL,
+ oauth_provider_id varchar(4000) DEFAULT '' NOT NULL,
+ PRIMARY KEY (user_id, provider)
+);
+
+
+/*
Table: 'phpbb_banlist'
*/
CREATE SEQUENCE phpbb_banlist_seq;
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index 0a31b89aab..70138f35fd 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -101,6 +101,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_function_nam
INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_max_chunk_size', '50');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_package_size', '20');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_confirm', '1');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_mod_rewrite', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_pm_icons', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_post_confirm', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('feed_enable', '1');
@@ -236,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_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 ('secure_allow_deny', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('secure_allow_empty_referer', '1');
diff --git a/phpBB/install/schemas/sqlite_schema.sql b/phpBB/install/schemas/sqlite_schema.sql
index 6224a37df4..d076b9823b 100644
--- a/phpBB/install/schemas/sqlite_schema.sql
+++ b/phpBB/install/schemas/sqlite_schema.sql
@@ -89,6 +89,26 @@ CREATE INDEX phpbb_acl_users_user_id ON phpbb_acl_users (user_id);
CREATE INDEX phpbb_acl_users_auth_option_id ON phpbb_acl_users (auth_option_id);
CREATE INDEX phpbb_acl_users_auth_role_id ON phpbb_acl_users (auth_role_id);
+# Table: 'phpbb_oauth_tokens'
+CREATE TABLE phpbb_oauth_tokens (
+ user_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
+ session_id char(32) NOT NULL DEFAULT '',
+ provider varchar(255) NOT NULL DEFAULT '',
+ oauth_token mediumtext(16777215) NOT NULL DEFAULT ''
+);
+
+CREATE INDEX phpbb_oauth_tokens_user_id ON phpbb_oauth_tokens (user_id);
+CREATE INDEX phpbb_oauth_tokens_provider ON phpbb_oauth_tokens (provider);
+
+# Table: 'phpbb_oauth_accounts'
+CREATE TABLE phpbb_oauth_accounts (
+ user_id INTEGER UNSIGNED NOT NULL DEFAULT '0',
+ provider varchar(255) NOT NULL DEFAULT '',
+ oauth_provider_id text(65535) NOT NULL DEFAULT '',
+ PRIMARY KEY (user_id, provider)
+);
+
+
# Table: 'phpbb_banlist'
CREATE TABLE phpbb_banlist (
ban_id INTEGER PRIMARY KEY NOT NULL ,
diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php
index ce15dfefb4..f786374ba6 100644
--- a/phpBB/language/en/acp/board.php
+++ b/phpBB/language/en/acp/board.php
@@ -367,6 +367,8 @@ $lang = array_merge($lang, array(
'LOAD_JQUERY_CDN_EXPLAIN' => 'If this setting is enabled, jQuery will be served from Google’s AJAX API CDN instead of the copy included with phpBB on your server. If the CDN fails, phpBB will attempt to fall back to the copy included with phpBB.',
'LOAD_USER_ACTIVITY' => 'Show user’s activity',
'LOAD_USER_ACTIVITY_EXPLAIN' => 'Displays active topic/forum in user profiles and user control panel. It is recommended to disable this on boards with more than one million posts.',
+ 'READ_NOTIFICATION_EXPIRE_DAYS' => 'Read Notification Expiration',
+ 'READ_NOTIFICATION_EXPIRE_DAYS_EXPLAIN' => 'Number of days that will elapse before a read notification will automatically be deleted. Set this value to 0 to make notifications permanent.',
'RECOMPILE_STYLES' => 'Recompile stale style components',
'RECOMPILE_STYLES_EXPLAIN' => 'Check for updated style components on filesystem and recompile.',
'YES_ANON_READ_MARKING' => 'Enable topic marking for guests',
@@ -390,10 +392,16 @@ $lang = array_merge($lang, array(
// Auth settings
$lang = array_merge($lang, array(
- 'ACP_AUTH_SETTINGS_EXPLAIN' => 'phpBB supports authentication plug-ins, or modules. These allow you determine how users are authenticated when they log into the board. By default three plug-ins are provided; DB, LDAP and Apache. Not all methods require additional information so only fill out fields if they are relevant to the selected method.',
+ 'ACP_AUTH_SETTINGS_EXPLAIN' => 'phpBB supports authentication plug-ins, or modules. These allow you determine how users are authenticated when they log into the board. By default four plug-ins are provided: DB, LDAP, Apache, and OAuth. Not all methods require additional information so only fill out fields if they are relevant to the selected method.',
'AUTH_METHOD' => 'Select an authentication method',
+ 'AUTH_PROVIDER_OAUTH_ERROR_ELEMENT_MISSING' => 'Both the key and secret of each enabled OAuth service provider must be provided. Only one was provided for an OAuth service provider.',
+ 'AUTH_PROVIDER_OAUTH_EXPLAIN' => 'Each OAuth provider requires a unique secret and key in order to authenticate with the external server.<br />These should be supplied by the OAuth service when you register your website with them and should be entered exactly as provided to you.<br />Any service that does not have both a key and a secret entered here will not be available for use by the forum users.',
+ 'AUTH_PROVIDER_OAUTH_KEY' => 'Key',
+ 'AUTH_PROVIDER_OAUTH_TITLE' => 'OAuth',
+ 'AUTH_PROVIDER_OAUTH_SECRET' => 'Secret',
+
'APACHE_SETUP_BEFORE_USE' => 'You have to setup apache authentication before you switch phpBB to this authentication method. Keep in mind that the username you use for apache authentication has to be the same as your phpBB username. Apache authentication can only be used with mod_php (not with a CGI version) and safe_mode disabled.',
'LDAP_DN' => 'LDAP base <var>dn</var>',
@@ -427,6 +435,10 @@ $lang = array_merge($lang, array(
'FORCE_SERVER_VARS_EXPLAIN' => 'If set to yes the server settings defined here will be used in favour of the automatically determined values.',
'ICONS_PATH' => 'Post icons storage path',
'ICONS_PATH_EXPLAIN' => 'Path under your phpBB root directory, e.g. <samp>images/icons</samp>.',
+ 'MOD_REWRITE_ENABLE' => 'Enable URL Rewriting',
+ 'MOD_REWRITE_ENABLE_EXPLAIN' => 'When enabled, URLs containing ’app.php’ will be rewritten to remove the filename (i.e. app.php/foo will become /foo). <strong>Apache server’s mod_rewrite module is required for this functionality to work; if this option is enabled without mod_rewrite support, URLs on your board may be broken.</strong>',
+ 'MOD_REWRITE_DISABLED' => 'The <strong>mod_rewrite</strong> module on your Apache web server is disabled. Enable the module or contact your web hosting provider if you wish to enable this feature.',
+ 'MOD_REWRITE_INFORMATION_UNAVAILABLE' => 'We are unable to determine whether or not this server supports URL rewriting. This setting may be enabled but if URL rewriting is not available, paths generated by this board (such as for use in links) may be broken. Contact your web hosting provider if you are unsure whether or not you can safely enable this feature.',
'PATH_SETTINGS' => 'Path settings',
'RANKS_PATH' => 'Rank image storage path',
'RANKS_PATH_EXPLAIN' => 'Path under your phpBB root directory, e.g. <samp>images/ranks</samp>.',
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index b188d90f3a..e5c0478d98 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -88,6 +88,14 @@ $lang = array_merge($lang, array(
'ATTACHED_IMAGE_NOT_IMAGE' => 'The image file you tried to attach is invalid.',
'AUTHOR' => 'Author',
'AUTH_NO_PROFILE_CREATED' => 'The creation of a user profile was unsuccessful.',
+ 'AUTH_PROVIDER_OAUTH_ERROR_INVALID_ENTRY' => 'Invalid database entry.',
+ 'AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE' => 'Invalid service type provided to OAuth service handler.',
+ 'AUTH_PROVIDER_OAUTH_ERROR_SERVICE_NOT_CREATED' => 'OAuth service not created',
+ 'AUTH_PROVIDER_OAUTH_SERVICE_BITLY' => 'Bitly',
+ 'AUTH_PROVIDER_OAUTH_SERVICE_FACEBOOK' => 'Facebook',
+ 'AUTH_PROVIDER_OAUTH_SERVICE_GOOGLE' => 'Google',
+ 'AUTH_PROVIDER_OAUTH_TOKEN_ERROR_NOT_STORED' => 'OAuth token not stored.',
+ 'AUTH_PROVIDER_OAUTH_TOKEN_ERROR_INCORRECTLY_STORED' => 'OAuth token incorrectly stored.',
'AVATAR_DISALLOWED_CONTENT' => 'The upload was rejected because the uploaded file was identified as a possible attack vector.',
'AVATAR_DISALLOWED_EXTENSION' => 'This file cannot be displayed because the extension <strong>%s</strong> is not allowed.',
'AVATAR_EMPTY_REMOTE_DATA' => 'The specified avatar could not be uploaded because the remote data appears to be invalid or corrupted.',
@@ -351,6 +359,7 @@ $lang = array_merge($lang, array(
'LOGIN_CONFIRM_EXPLAIN' => 'To prevent brute forcing accounts the board requires you to enter a confirmation code after a maximum amount of failed logins. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.', // unused
'LOGIN_ERROR_ATTEMPTS' => 'You exceeded the maximum allowed number of login attempts. In addition to your username and password you now also have to solve the CAPTCHA below.',
'LOGIN_ERROR_EXTERNAL_AUTH_APACHE' => 'You have not been authenticated by Apache.',
+ 'LOGIN_ERROR_OAUTH_SERVICE_DOES_NOT_EXIST' => 'A non-existant OAuth service has been requested.',
'LOGIN_ERROR_PASSWORD' => 'You have specified an incorrect password. Please check your password and try again. If you continue to have problems please contact the %sBoard Administrator%s.',
'LOGIN_ERROR_PASSWORD_CONVERT' => 'It was not possible to convert your password when updating this bulletin board’s software. Please %srequest a new password%s. If you continue to have problems please contact the %sBoard Administrator%s.',
'LOGIN_ERROR_USERNAME' => 'You have specified an incorrect username. Please check your username and try again. If you continue to have problems please contact the %sBoard Administrator%s.',
@@ -414,6 +423,8 @@ $lang = array_merge($lang, array(
2 => '<strong>%d</strong> Notifications',
),
'NOTIFICATION_BOOKMARK' => '%1$s replied to the topic "%2$s" you have bookmarked.',
+ 'NOTIFICATION_GROUP_REQUEST' => '%1$s is requesting to join the group %2$s.',
+ 'NOTIFICATION_GROUP_REQUEST_APPROVED' => 'Your request to join the group %1$s has been approved.',
'NOTIFICATION_PM' => '%1$s sent you a Private Message "%2$s".',
'NOTIFICATION_POST' => '%1$s replied to the topic "%2$s".',
'NOTIFICATION_POST_APPROVED' => 'Your post was approved "%2$s".',
diff --git a/phpBB/language/en/email/forum_notify.txt b/phpBB/language/en/email/forum_notify.txt
index 66f3a68689..a05be5fd96 100644
--- a/phpBB/language/en/email/forum_notify.txt
+++ b/phpBB/language/en/email/forum_notify.txt
@@ -2,7 +2,7 @@ Subject: Forum post notification - "{FORUM_NAME}"
Hello {USERNAME},
-You are receiving this notification because you are watching the forum "{FORUM_NAME}" at "{SITENAME}". This forum has received a new reply to the topic "{TOPIC_TITLE}"<!-- IF AUTHOR_NAME --> by {AUTHOR_NAME}<!-- ENDIF --> since your last visit. You can use the following link to view the last unread reply, no more notifications will be sent until you visit the topic.
+You are receiving this notification because you are watching the forum "{FORUM_NAME}" at "{SITENAME}". This forum has received a new reply to the topic "{TOPIC_TITLE}"<!-- IF AUTHOR_NAME !== '' --> by {AUTHOR_NAME}<!-- ENDIF --> since your last visit. You can use the following link to view the last unread reply, no more notifications will be sent until you visit the topic.
{U_NEWEST_POST}
diff --git a/phpBB/language/en/email/group_approved.txt b/phpBB/language/en/email/group_approved.txt
deleted file mode 100644
index 24afefcd07..0000000000
--- a/phpBB/language/en/email/group_approved.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-Subject: Your request has been approved
-
-Congratulations,
-
-Your request to join the "{GROUP_NAME}" group on "{SITENAME}" has been approved.
-Click on the following link to see your group membership.
-
-{U_GROUP}
-
-{EMAIL_SIG}
diff --git a/phpBB/language/en/email/newtopic_notify.txt b/phpBB/language/en/email/newtopic_notify.txt
index bf6799e5be..5089e7dcb8 100644
--- a/phpBB/language/en/email/newtopic_notify.txt
+++ b/phpBB/language/en/email/newtopic_notify.txt
@@ -2,7 +2,7 @@ Subject: New topic notification - "{FORUM_NAME}"
Hello {USERNAME},
-You are receiving this notification because you are watching the forum "{FORUM_NAME}" at "{SITENAME}". This forum has received a new topic<!-- IF AUTHOR_NAME --> by {AUTHOR_NAME}<!-- ENDIF --> since your last visit, "{TOPIC_TITLE}". You can use the following link to view the forum, no more notifications will be sent until you visit the forum.
+You are receiving this notification because you are watching the forum "{FORUM_NAME}" at "{SITENAME}". This forum has received a new topic<!-- IF AUTHOR_NAME !== '' --> by {AUTHOR_NAME}<!-- ENDIF --> since your last visit, "{TOPIC_TITLE}". You can use the following link to view the forum, no more notifications will be sent until you visit the forum.
{U_FORUM}
diff --git a/phpBB/language/en/email/topic_notify.txt b/phpBB/language/en/email/topic_notify.txt
index 472375fb22..529478eae2 100644
--- a/phpBB/language/en/email/topic_notify.txt
+++ b/phpBB/language/en/email/topic_notify.txt
@@ -2,7 +2,7 @@ Subject: Topic reply notification - "{TOPIC_TITLE}"
Hello {USERNAME},
-You are receiving this notification because you are watching the topic "{TOPIC_TITLE}" at "{SITENAME}". This topic has received a reply<!-- IF AUTHOR_NAME --> by {AUTHOR_NAME}<!-- ENDIF --> since your last visit. You can use the following link to view the replies made, no more notifications will be sent until you visit the topic.
+You are receiving this notification because you are watching the topic "{TOPIC_TITLE}" at "{SITENAME}". This topic has received a reply<!-- IF AUTHOR_NAME !== '' --> by {AUTHOR_NAME}<!-- ENDIF --> since your last visit. You can use the following link to view the replies made, no more notifications will be sent until you visit the topic.
If you want to view the newest post made since your last visit, click the following link:
{U_NEWEST_POST}
diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php
index 51823ddb12..e2d5dc5ad1 100644
--- a/phpBB/language/en/ucp.php
+++ b/phpBB/language/en/ucp.php
@@ -270,6 +270,10 @@ $lang = array_merge($lang, array(
'LINK_REMOTE_SIZE' => 'Avatar dimensions',
'LINK_REMOTE_SIZE_EXPLAIN' => 'Specify the width and height of the avatar, leave blank to attempt automatic verification.',
'LOGIN_EXPLAIN_UCP' => 'Please login in order to access the User Control Panel.',
+ 'LOGIN_LINK' => 'Link or register your account on an external service with your board account',
+ 'LOGIN_LINK_EXPLAIN' => 'You have attempted to login with an external service that is not yet connected to an account on this board. You must now either link this account to an existing account or create a new account.',
+ 'LOGIN_LINK_MISSING_DATA' => 'Data that is necessary to link your account with an external service is not available. Please restart the login process.',
+ 'LOGIN_LINK_NO_DATA_PROVIDED' => 'No data has been provided to this page to link an external account to a forum account. Please contact the board administrator if you continue to experience problems.',
'LOGIN_KEY' => 'Login Key',
'LOGIN_TIME' => 'Login Time',
'LOGIN_REDIRECT' => 'You have been successfully logged in.',
@@ -313,6 +317,7 @@ $lang = array_merge($lang, array(
'NOTIFICATION_METHOD_JABBER' => 'Jabber',
'NOTIFICATION_TYPE' => 'Notification type',
'NOTIFICATION_TYPE_BOOKMARK' => 'Someone replies to a topic you have bookmarked',
+ 'NOTIFICATION_TYPE_GROUP_REQUEST' => 'Someone requests to join a group you lead',
'NOTIFICATION_TYPE_IN_MODERATION_QUEUE' => 'A post or topic needs approval',
'NOTIFICATION_TYPE_MODERATION_QUEUE' => 'Your topics/posts are approved or disapproved by a moderator',
'NOTIFICATION_TYPE_PM' => 'Someone sends you a private message',
@@ -475,11 +480,20 @@ $lang = array_merge($lang, array(
'UCP_ADMIN_ACTIVATE' => 'Please note that you will need to enter a valid email address before your account is activated. The administrator will review your account and if approved you will receive an email at the address you specified.',
'UCP_AIM' => 'AOL Instant Messenger',
'UCP_ATTACHMENTS' => 'Attachments',
+ 'UCP_AUTH_LINK' => 'External accounts',
+ 'UCP_AUTH_LINK_ASK' => 'You currently have no account associated with this external service. Click the button below to link your board account to an account with this external service.',
+ 'UCP_AUTH_LINK_ID' => 'Unique identifier',
+ 'UCP_AUTH_LINK_LINK' => 'Link',
+ 'UCP_AUTH_LINK_MANAGE' => 'Manage external account associations',
+ 'UCP_AUTH_LINK_NOT_SUPPORTED' => 'Linking board accounts to external services is not supported by this board’s current authentication method.',
+ 'UCP_AUTH_LINK_TITLE' => 'Manage your external account associations',
+ 'UCP_AUTH_LINK_UNLINK' => 'Unlink',
'UCP_COPPA_BEFORE' => 'Before %s',
'UCP_COPPA_ON_AFTER' => 'On or after %s',
'UCP_EMAIL_ACTIVATE' => 'Please note that you will need to enter a valid email address before your account is activated. You will receive an email at the address you provide that contains an account activation link.',
'UCP_ICQ' => 'ICQ number',
'UCP_JABBER' => 'Jabber address',
+ 'UCP_LOGIN_LINK' => 'Set up an external account association',
'UCP_MAIN' => 'Overview',
'UCP_MAIN_ATTACHMENTS' => 'Manage attachments',
diff --git a/phpBB/mcp.php b/phpBB/mcp.php
index 5beea45c7d..e2915cad78 100644
--- a/phpBB/mcp.php
+++ b/phpBB/mcp.php
@@ -49,7 +49,7 @@ $action = request_var('action', '');
$action_ary = request_var('action', array('' => 0));
$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;
}
diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php
index 26f920fe5a..ead7179732 100644
--- a/phpBB/memberlist.php
+++ b/phpBB/memberlist.php
@@ -1049,7 +1049,7 @@ switch ($mode)
// We validate form and field here, only id/class allowed
$form = (!preg_match('/^[a-z0-9_-]+$/i', $form)) ? '' : $form;
$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);
$email = strtolower(request_var('email', ''));
diff --git a/phpBB/phpbb/auth/auth.php b/phpBB/phpbb/auth/auth.php
index 279959974d..b5cc675838 100644
--- a/phpBB/phpbb/auth/auth.php
+++ b/phpBB/phpbb/auth/auth.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\auth;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* Permission/Auth class
* @package phpBB3
*/
-class phpbb_auth
+class auth
{
var $acl = array();
var $cache = array();
@@ -970,6 +972,18 @@ class phpbb_auth
);
}
+ // If the auth provider wants us to link an empty account do so and redirect
+ if ($login['status'] == LOGIN_SUCCESS_LINK_PROFILE)
+ {
+ // If this status exists a fourth field is in the $login array called 'redirect_data'
+ // This data is passed along as GET data to the next page allow the account to be linked
+
+ $params = array('mode' => 'login_link');
+ $url = append_sid($phpbb_root_path . 'ucp.' . $phpEx, array_merge($params, $login['redirect_data']));
+
+ redirect($url);
+ }
+
// If login succeeded, we will log the user in... else we pass the login array through...
if ($login['status'] == LOGIN_SUCCESS)
{
diff --git a/phpBB/phpbb/auth/provider/apache.php b/phpBB/phpbb/auth/provider/apache.php
index 2e80436f78..5cbb63c4fc 100644
--- a/phpBB/phpbb/auth/provider/apache.php
+++ b/phpBB/phpbb/auth/provider/apache.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\auth\provider;
+
/**
* @ignore
*/
@@ -20,19 +22,19 @@ if (!defined('IN_PHPBB'))
*
* @package auth
*/
-class phpbb_auth_provider_apache extends phpbb_auth_provider_base
+class apache extends \phpbb\auth\provider\base
{
/**
* Apache Authentication Constructor
*
- * @param phpbb_db_driver $db
- * @param phpbb_config $config
- * @param phpbb_request $request
- * @param phpbb_user $user
+ * @param \phpbb\db\driver\driver $db
+ * @param \phpbb\config\config $config
+ * @param \phpbb\request\request $request
+ * @param \phpbb\user $user
* @param string $phpbb_root_path
* @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->config = $config;
@@ -47,7 +49,7 @@ class phpbb_auth_provider_apache extends phpbb_auth_provider_base
*/
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'];
}
@@ -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(
'status' => LOGIN_ERROR_EXTERNAL_AUTH,
@@ -149,7 +151,7 @@ class phpbb_auth_provider_apache extends phpbb_auth_provider_base
*/
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();
}
@@ -241,7 +243,7 @@ class phpbb_auth_provider_apache extends phpbb_auth_provider_base
public function validate_session($user)
{
// 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');
diff --git a/phpBB/phpbb/auth/provider/base.php b/phpBB/phpbb/auth/provider/base.php
index 7eaf8bb2d3..2222d8c1b6 100644
--- a/phpBB/phpbb/auth/provider/base.php
+++ b/phpBB/phpbb/auth/provider/base.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\auth\provider;
+
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
*
* @package auth
*/
-abstract class phpbb_auth_provider_base implements phpbb_auth_provider_interface
+abstract class base implements \phpbb\auth\provider\provider_interface
{
/**
* {@inheritdoc}
@@ -57,6 +59,22 @@ abstract class phpbb_auth_provider_base implements phpbb_auth_provider_interface
/**
* {@inheritdoc}
*/
+ public function get_login_data()
+ {
+ return;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_auth_link_data()
+ {
+ return;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
public function logout($data, $new_session)
{
return;
@@ -69,4 +87,28 @@ abstract class phpbb_auth_provider_base implements phpbb_auth_provider_interface
{
return;
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function login_link_has_necessary_data($login_link_data)
+ {
+ return;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function link_account(array $link_data)
+ {
+ return;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function unlink_account(array $link_data)
+ {
+ return;
+ }
}
diff --git a/phpBB/phpbb/auth/provider/db.php b/phpBB/phpbb/auth/provider/db.php
index 0934c56d9b..4654e49fb5 100644
--- a/phpBB/phpbb/auth/provider/db.php
+++ b/phpBB/phpbb/auth/provider/db.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\auth\provider;
+
/**
* @ignore
*/
@@ -22,20 +24,20 @@ if (!defined('IN_PHPBB'))
*
* @package auth
*/
-class phpbb_auth_provider_db extends phpbb_auth_provider_base
+class db extends \phpbb\auth\provider\base
{
/**
* Database Authentication Constructor
*
- * @param phpbb_db_driver $db
- * @param phpbb_config $config
- * @param phpbb_request $request
- * @param phpbb_user $user
+ * @param \phpbb\db\driver\driver $db
+ * @param \phpbb\config\config $config
+ * @param \phpbb\request\request $request
+ * @param \phpbb\user $user
* @param string $phpbb_root_path
* @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->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);
}
- $captcha = phpbb_captcha_factory::get_instance($this->config['captcha_plugin']);
+ $captcha = \phpbb_captcha_factory::get_instance($this->config['captcha_plugin']);
$captcha->init(CONFIRM_LOGIN);
$vc_response = $captcha->validate($row);
if ($vc_response)
diff --git a/phpBB/phpbb/auth/provider/interface.php b/phpBB/phpbb/auth/provider/interface.php
deleted file mode 100644
index 47043bc107..0000000000
--- a/phpBB/phpbb/auth/provider/interface.php
+++ /dev/null
@@ -1,105 +0,0 @@
-<?php
-/**
-*
-* @package auth
-* @copyright (c) 2013 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
- * The interface authentication provider classes have to implement.
- *
- * @package auth
- */
-interface phpbb_auth_provider_interface
-{
- /**
- * Checks whether the user is currently identified to the authentication
- * provider.
- * Called in acp_board while setting authentication plugins.
- * Changing to an authentication provider will not be permitted in acp_board
- * if there is an error.
- *
- * @return boolean|string False if the user is identified, otherwise an
- * error message, or null if not implemented.
- */
- public function init();
-
- /**
- * Performs login.
- *
- * @param string $username The name of the user being authenticated.
- * @param string $password The password of the user.
- * @return array An associative array of the format:
- * array(
- * 'status' => status constant
- * 'error_msg' => string
- * 'user_row' => array
- * )
- */
- public function login($username, $password);
-
- /**
- * Autologin function
- *
- * @return array|null containing the user row, empty if no auto login
- * should take place, or null if not impletmented.
- */
- public function autologin();
-
- /**
- * This function is used to output any required fields in the authentication
- * admin panel. It also defines any required configuration table fields.
- *
- * @return array|null Returns null if not implemented or an array of the
- * configuration fields of the provider.
- */
- public function acp();
-
- /**
- * This function updates the template with variables related to the acp
- * options with whatever configuraton values are passed to it as an array.
- * It then returns the name of the acp file related to this authentication
- * provider.
- * @param array $new_config Contains the new configuration values that
- * have been set in acp_board.
- * @return array|null Returns null if not implemented or an array with
- * the template file name and an array of the vars
- * that the template needs that must conform to the
- * following example:
- * array(
- * 'TEMPLATE_FILE' => string,
- * 'TEMPLATE_VARS' => array(...),
- * )
- */
- public function get_acp_template($new_config);
-
- /**
- * Performs additional actions during logout.
- *
- * @param array $data An array corresponding to
- * phpbb_session::data
- * @param boolean $new_session True for a new session, false for no new
- * session.
- */
- public function logout($data, $new_session);
-
- /**
- * The session validation function checks whether the user is still logged
- * into phpBB.
- *
- * @param array $user
- * @return boolean true if the given user is authenticated, false if the
- * session should be closed, or null if not implemented.
- */
- public function validate_session($user);
-}
diff --git a/phpBB/phpbb/auth/provider/ldap.php b/phpBB/phpbb/auth/provider/ldap.php
index 0196529408..9d29789567 100644
--- a/phpBB/phpbb/auth/provider/ldap.php
+++ b/phpBB/phpbb/auth/provider/ldap.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\auth\provider;
+
/**
* @ignore
*/
@@ -22,16 +24,16 @@ if (!defined('IN_PHPBB'))
*
* @package auth
*/
-class phpbb_auth_provider_ldap extends phpbb_auth_provider_base
+class ldap extends \phpbb\auth\provider\base
{
/**
* LDAP Authentication Constructor
*
- * @param phpbb_db_driver $db
- * @param phpbb_config $config
- * @param phpbb_user $user
+ * @param \phpbb\db\driver\driver $db
+ * @param \phpbb\config\config $config
+ * @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->config = $config;
diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php
new file mode 100644
index 0000000000..de81ac0d04
--- /dev/null
+++ b/phpBB/phpbb/auth/provider/oauth/oauth.php
@@ -0,0 +1,620 @@
+<?php
+/**
+*
+* @package auth
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+namespace phpbb\auth\provider\oauth;
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+use OAuth\Common\Consumer\Credentials;
+use OAuth\Common\Http\Uri\Uri;
+
+/**
+* OAuth authentication provider for phpBB3
+*
+* @package auth
+*/
+class oauth extends \phpbb\auth\provider\base
+{
+ /**
+ * Database driver
+ *
+ * @var \phpbb\db\driver\driver
+ */
+ protected $db;
+
+ /**
+ * phpBB config
+ *
+ * @var \phpbb\config\config
+ */
+ protected $config;
+
+ /**
+ * phpBB request object
+ *
+ * @var \phpbb\request\request_interface
+ */
+ protected $request;
+
+ /**
+ * phpBB user
+ *
+ * @var \phpbb\user
+ */
+ protected $user;
+
+ /**
+ * OAuth token table
+ *
+ * @var string
+ */
+ protected $auth_provider_oauth_token_storage_table;
+
+ /**
+ * OAuth account association table
+ *
+ * @var string
+ */
+ protected $auth_provider_oauth_token_account_assoc;
+
+ /**
+ * All OAuth service providers
+ *
+ * @var \phpbb\di\service_collection Contains \phpbb\auth\provider\oauth\service_interface
+ */
+ protected $service_providers;
+
+ /**
+ * Users table
+ *
+ * @var string
+ */
+ protected $users_table;
+
+ /**
+ * Cached current uri object
+ *
+ * @var \OAuth\Common\Http\Uri\UriInterface|null
+ */
+ protected $current_uri;
+
+ /**
+ * phpBB root path
+ *
+ * @var string
+ */
+ protected $phpbb_root_path;
+
+ /**
+ * PHP extenstion
+ *
+ * @var string
+ */
+ protected $php_ext;
+
+ /**
+ * OAuth Authentication Constructor
+ *
+ * @param \phpbb\db\driver\driver $db
+ * @param \phpbb\config\config $config
+ * @param \phpbb\request\request_interface $request
+ * @param \phpbb\user $user
+ * @param string $auth_provider_oauth_token_storage_table
+ * @param string $auth_provider_oauth_token_account_assoc
+ * @param \phpbb\di\service_collection $service_providers Contains \phpbb\auth\provider\oauth\service_interface
+ * @param string $users_table
+ * @param string $phpbb_root_path
+ * @param string $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->config = $config;
+ $this->request = $request;
+ $this->user = $user;
+ $this->auth_provider_oauth_token_storage_table = $auth_provider_oauth_token_storage_table;
+ $this->auth_provider_oauth_token_account_assoc = $auth_provider_oauth_token_account_assoc;
+ $this->service_providers = $service_providers;
+ $this->users_table = $users_table;
+ $this->phpbb_root_path = $phpbb_root_path;
+ $this->php_ext = $php_ext;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function init()
+ {
+ // This does not test whether or not the key and secret provided are valid.
+ foreach ($this->service_providers as $service_provider)
+ {
+ $credentials = $service_provider->get_service_credentials();
+
+ if (($credentials['key'] && !$credentials['secret']) || (!$credentials['key'] && $credentials['secret']))
+ {
+ return $this->user->lang['AUTH_PROVIDER_OAUTH_ERROR_ELEMENT_MISSING'];
+ }
+ }
+ return false;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function login($username, $password)
+ {
+ // Temporary workaround for only having one authentication provider available
+ 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);
+ return $provider->login($username, $password);
+ }
+
+ // Requst the name of the OAuth service
+ $service_name_original = $this->request->variable('oauth_service', '', false);
+ $service_name = 'auth.provider.oauth.service.' . strtolower($service_name_original);
+ if ($service_name_original === '' || !array_key_exists($service_name, $this->service_providers))
+ {
+ return array(
+ 'status' => LOGIN_ERROR_EXTERNAL_AUTH,
+ 'error_msg' => 'LOGIN_ERROR_OAUTH_SERVICE_DOES_NOT_EXIST',
+ 'user_row' => array('user_id' => ANONYMOUS),
+ );
+ }
+
+ // Get the service credentials for the given service
+ $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);
+ $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);
+
+ if ($this->request->is_set('code', \phpbb\request\request_interface::GET))
+ {
+ $this->service_providers[$service_name]->set_external_service_provider($service);
+ $unique_id = $this->service_providers[$service_name]->perform_auth_login();
+
+ // Check to see if this provider is already assosciated with an account
+ $data = array(
+ 'provider' => $service_name_original,
+ 'oauth_provider_id' => $unique_id
+ );
+ $sql = 'SELECT user_id FROM ' . $this->auth_provider_oauth_token_account_assoc . '
+ WHERE ' . $this->db->sql_build_array('SELECT', $data);
+ $result = $this->db->sql_query($sql);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ if (!$row)
+ {
+ // The user does not yet exist, ask to link or create profile
+ return array(
+ 'status' => LOGIN_SUCCESS_LINK_PROFILE,
+ 'error_msg' => 'LOGIN_OAUTH_ACCOUNT_NOT_LINKED',
+ 'user_row' => array(),
+ 'redirect_data' => array(
+ 'auth_provider' => 'oauth',
+ 'login_link_oauth_service' => $service_name_original,
+ ),
+ );
+ }
+
+ // Retrieve the user's account
+ $sql = 'SELECT user_id, username, user_password, user_passchg, user_pass_convert, user_email, user_type, user_login_attempts
+ FROM ' . $this->users_table . '
+ WHERE user_id = ' . (int) $row['user_id'];
+ $result = $this->db->sql_query($sql);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ if (!$row)
+ {
+ throw new Exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_ENTRY');
+ }
+
+ // Update token storage to store the user_id
+ $storage->set_user_id($row['user_id']);
+
+ // The user is now authenticated and can be logged in
+ return array(
+ 'status' => LOGIN_SUCCESS,
+ 'error_msg' => false,
+ 'user_row' => $row,
+ );
+ }
+ else
+ {
+ $url = $service->getAuthorizationUri();
+ header('Location: ' . $url);
+ }
+ }
+
+ /**
+ * Returns the cached current_uri object or creates and caches it if it is
+ * not already created. In each case the query string is updated based on
+ * the $query parameter.
+ *
+ * @param string $service_name The name of the service
+ * @param string $query The query string of the current_uri
+ * used in redirects
+ * @return \OAuth\Common\Http\Uri\UriInterface
+ */
+ protected function get_current_uri($service_name, $query)
+ {
+ if ($this->current_uri)
+ {
+ $this->current_uri->setQuery($query);
+ return $this->current_uri;
+ }
+
+ $uri_factory = new \OAuth\Common\Http\Uri\UriFactory();
+ $current_uri = $uri_factory->createFromSuperGlobalArray($this->request->get_super_global(\phpbb\request\request_interface::SERVER));
+ $current_uri->setQuery($query);
+
+ $this->current_uri = $current_uri;
+ return $current_uri;
+ }
+
+ /**
+ * Returns a new service object
+ *
+ * @param string $service_name The name of the service
+ * @param \phpbb\auth\provider\oauth\token_storage $storage
+ * @param array $service_credentials {@see \phpbb\auth\provider\oauth\oauth::get_service_credentials}
+ * @param array $scope The scope of the request against
+ * the api.
+ * @param string $query The query string of the
+ * current_uri used in redirection
+ * @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)
+ {
+ $current_uri = $this->get_current_uri($service_name, $query);
+
+ // Setup the credentials for the requests
+ $credentials = new Credentials(
+ $service_credentials['key'],
+ $service_credentials['secret'],
+ $current_uri->getAbsoluteUri()
+ );
+
+ $service_factory = new \OAuth\ServiceFactory();
+ $service = $service_factory->createService($service_name, $credentials, $storage, $scopes);
+
+ if (!$service)
+ {
+ throw new Exception('AUTH_PROVIDER_OAUTH_ERROR_SERVICE_NOT_CREATED');
+ }
+
+ return $service;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_login_data()
+ {
+ $login_data = array(
+ 'TEMPLATE_FILE' => 'login_body_oauth.html',
+ 'BLOCK_VAR_NAME' => 'oauth',
+ 'BLOCK_VARS' => array(),
+ );
+
+ foreach ($this->service_providers as $service_name => $service_provider)
+ {
+ // Only include data if the credentials are set
+ $credentials = $service_provider->get_service_credentials();
+ if ($credentials['key'] && $credentials['secret'])
+ {
+ $actual_name = str_replace('auth.provider.oauth.service.', '', $service_name);
+ $redirect_url = build_url(false) . '&login=external&oauth_service=' . $actual_name;
+ $login_data['BLOCK_VARS'][$service_name] = array(
+ 'REDIRECT_URL' => redirect($redirect_url, true),
+ 'SERVICE_NAME' => $this->user->lang['AUTH_PROVIDER_OAUTH_SERVICE_' . strtoupper($actual_name)],
+ );
+ }
+ }
+
+ return $login_data;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function acp()
+ {
+ $ret = array();
+
+ foreach ($this->service_providers as $service_name => $service_provider)
+ {
+ $actual_name = str_replace('auth.provider.oauth.service.', '', $service_name);
+ $ret[] = 'auth_oauth_' . $actual_name . '_key';
+ $ret[] = 'auth_oauth_' . $actual_name . '_secret';
+ }
+
+ return $ret;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_acp_template($new_config)
+ {
+ $ret = array(
+ 'BLOCK_VAR_NAME' => 'oauth_services',
+ 'BLOCK_VARS' => array(),
+ 'TEMPLATE_FILE' => 'auth_provider_oauth.html',
+ 'TEMPLATE_VARS' => array(),
+ );
+
+ foreach ($this->service_providers as $service_name => $service_provider)
+ {
+ $actual_name = str_replace('auth.provider.oauth.service.', '', $service_name);
+ $ret['BLOCK_VARS'][$actual_name] = array(
+ 'ACTUAL_NAME' => $this->user->lang['AUTH_PROVIDER_OAUTH_SERVICE_' . strtoupper($actual_name)],
+ 'KEY' => $new_config['auth_oauth_' . $actual_name . '_key'],
+ 'NAME' => $actual_name,
+ 'SECRET' => $new_config['auth_oauth_' . $actual_name . '_secret'],
+ );
+ }
+
+ return $ret;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function login_link_has_necessary_data($login_link_data)
+ {
+ if (empty($login_link_data))
+ {
+ return 'LOGIN_LINK_NO_DATA_PROVIDED';
+ }
+
+ if (!array_key_exists('oauth_service', $login_link_data) || !$login_link_data['oauth_service'] ||
+ !array_key_exists('link_method', $login_link_data) || !$login_link_data['link_method'])
+ {
+ return 'LOGIN_LINK_MISSING_DATA';
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function link_account(array $link_data)
+ {
+ // Check for a valid link method (auth_link or login_link)
+ if (!array_key_exists('link_method', $link_data) ||
+ !in_array($link_data['link_method'], array(
+ 'auth_link',
+ 'login_link',
+ )))
+ {
+ return 'LOGIN_LINK_MISSING_DATA';
+ }
+
+ // We must have an oauth_service listed, check for it two ways
+ if (!array_key_exists('oauth_service', $link_data) || !$link_data['oauth_service'])
+ {
+ $link_data['oauth_service'] = $this->request->variable('oauth_service', '');
+
+ if (!$link_data['oauth_service'])
+ {
+ return 'LOGIN_LINK_MISSING_DATA';
+ }
+ }
+
+ $service_name = 'auth.provider.oauth.service.' . strtolower($link_data['oauth_service']);
+ if (!array_key_exists($service_name, $this->service_providers))
+ {
+ return 'LOGIN_ERROR_OAUTH_SERVICE_DOES_NOT_EXIST';
+ }
+
+ switch ($link_data['link_method'])
+ {
+ case 'auth_link':
+ return $this->link_account_auth_link($link_data, $service_name);
+ case 'login_link':
+ return $this->link_account_login_link($link_data, $service_name);
+ }
+ }
+
+ /**
+ * Performs the account linking for login_link
+ *
+ * @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
+ * linking.
+ * @return string|null Returns a language constant (string) if an error is
+ * encountered, or null on success.
+ */
+ 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);
+
+ // Check for an access token, they should have one
+ if (!$storage->has_access_token_by_session($service_name))
+ {
+ return 'LOGIN_LINK_ERROR_OAUTH_NO_ACCESS_TOKEN';
+ }
+
+ // Prepare the query string
+ $query = 'mode=login_link&login_link_oauth_service=' . strtolower($link_data['oauth_service']);
+
+ // Prepare for an authentication request
+ $service_credentials = $this->service_providers[$service_name]->get_service_credentials();
+ $scopes = $this->service_providers[$service_name]->get_auth_scope();
+ $service = $this->get_service(strtolower($link_data['oauth_service']), $storage, $service_credentials, $scopes, $query);
+ $this->service_providers[$service_name]->set_external_service_provider($service);
+
+ // The user has already authenticated successfully, request to authenticate again
+ $unique_id = $this->service_providers[$service_name]->perform_token_auth();
+
+ // Insert into table, they will be able to log in after this
+ $data = array(
+ 'user_id' => $link_data['user_id'],
+ 'provider' => strtolower($link_data['oauth_service']),
+ 'oauth_provider_id' => $unique_id,
+ );
+
+ $this->link_account_perform_link($data);
+ // Update token storage to store the user_id
+ $storage->set_user_id($link_data['user_id']);
+ }
+
+ /**
+ * Performs the account linking for auth_link
+ *
+ * @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
+ * linking.
+ * @return string|null Returns a language constant (string) if an error is
+ * encountered, or null on success.
+ */
+ 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);
+ $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();
+ $scopes = $this->service_providers[$service_name]->get_auth_scope();
+ $service = $this->get_service(strtolower($link_data['oauth_service']), $storage, $service_credentials, $scopes, $query);
+
+ if ($this->request->is_set('code', \phpbb\request\request_interface::GET))
+ {
+ $this->service_providers[$service_name]->set_external_service_provider($service);
+ $unique_id = $this->service_providers[$service_name]->perform_auth_login();
+
+ // Insert into table, they will be able to log in after this
+ $data = array(
+ 'user_id' => $this->user->data['user_id'],
+ 'provider' => strtolower($link_data['oauth_service']),
+ 'oauth_provider_id' => $unique_id,
+ );
+
+ $this->link_account_perform_link($data);
+ }
+ else
+ {
+ $url = $service->getAuthorizationUri();
+ header('Location: ' . $url);
+ }
+ }
+
+ /**
+ * Performs the query that inserts an account link
+ *
+ * @param array $data This array is passed to db->sql_build_array
+ */
+ protected function link_account_perform_link(array $data)
+ {
+ $sql = 'INSERT INTO ' . $this->auth_provider_oauth_token_account_assoc . '
+ ' . $this->db->sql_build_array('INSERT', $data);
+ $this->db->sql_query($sql);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function logout($data, $new_session)
+ {
+ // 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->clearAllTokens();
+
+ return;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_auth_link_data()
+ {
+ $block_vars = array();
+
+ // Get all external accounts tied to the current user
+ $data = array(
+ 'user_id' => (int) $this->user->data['user_id'],
+ );
+ $sql = 'SELECT oauth_provider_id, provider FROM ' . $this->auth_provider_oauth_token_account_assoc . '
+ WHERE ' . $this->db->sql_build_array('SELECT', $data);
+ $result = $this->db->sql_query($sql);
+ $rows = $this->db->sql_fetchrowset($result);
+ $this->db->sql_freeresult($result);
+
+ $oauth_user_ids = array();
+
+ if ($rows !== false && sizeof($rows))
+ {
+ foreach ($rows as $row)
+ {
+ $oauth_user_ids[$row['provider']] = $row['oauth_provider_id'];
+ }
+ }
+ unset($rows);
+
+ foreach ($this->service_providers as $service_name => $service_provider)
+ {
+ // Only include data if the credentials are set
+ $credentials = $service_provider->get_service_credentials();
+ if ($credentials['key'] && $credentials['secret'])
+ {
+ $actual_name = str_replace('auth.provider.oauth.service.', '', $service_name);
+
+ $block_vars[$service_name] = array(
+ 'HIDDEN_FIELDS' => array(
+ 'link' => (!isset($oauth_user_ids[$actual_name])),
+ 'oauth_service' => $actual_name,
+ ),
+
+ 'SERVICE_NAME' => $this->user->lang['AUTH_PROVIDER_OAUTH_SERVICE_' . strtoupper($actual_name)],
+ 'UNIQUE_ID' => (isset($oauth_user_ids[$actual_name])) ? $oauth_user_ids[$actual_name] : null,
+ );
+ }
+ }
+
+ return array(
+ 'BLOCK_VAR_NAME' => 'oauth',
+ 'BLOCK_VARS' => $block_vars,
+
+ 'TEMPLATE_FILE' => 'ucp_auth_link_oauth.html',
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function unlink_account(array $link_data)
+ {
+ if (!array_key_exists('oauth_service', $link_data) || !$link_data['oauth_service'])
+ {
+ return 'LOGIN_LINK_MISSING_DATA';
+ }
+
+ // Remove the link
+ $sql = 'DELETE FROM ' . $this->auth_provider_oauth_token_account_assoc . "
+ WHERE provider = '" . $this->db->sql_escape($link_data['oauth_service']) . "'
+ AND user_id = " . (int) $this->user->data['user_id'];
+ $this->db->sql_query($sql);
+
+ // Clear all tokens belonging to the user on this servce
+ $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->clearToken($service_name);
+
+ return;
+ }
+}
diff --git a/phpBB/phpbb/auth/provider/oauth/service/base.php b/phpBB/phpbb/auth/provider/oauth/service/base.php
new file mode 100644
index 0000000000..61deb48695
--- /dev/null
+++ b/phpBB/phpbb/auth/provider/oauth/service/base.php
@@ -0,0 +1,57 @@
+<?php
+/**
+*
+* @package auth
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+namespace phpbb\auth\provider\oauth\service;
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+/**
+* Base OAuth abstract class that all OAuth services should implement
+*
+* @package auth
+*/
+abstract class base implements \phpbb\auth\provider\oauth\service\service_interface
+{
+ /**
+ * External OAuth service provider
+ *
+ * @var \OAuth\Common\Service\ServiceInterface
+ */
+ protected $service_provider;
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_external_service_provider()
+ {
+ return $this->service_provider;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_auth_scope()
+ {
+ return array();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function set_external_service_provider(\OAuth\Common\Service\ServiceInterface $service_provider)
+ {
+ $this->service_provider = $service_provider;
+ }
+}
diff --git a/phpBB/phpbb/auth/provider/oauth/service/bitly.php b/phpBB/phpbb/auth/provider/oauth/service/bitly.php
new file mode 100644
index 0000000000..47cf7ee380
--- /dev/null
+++ b/phpBB/phpbb/auth/provider/oauth/service/bitly.php
@@ -0,0 +1,100 @@
+<?php
+/**
+*
+* @package auth
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+namespace phpbb\auth\provider\oauth\service;
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+/**
+* Bitly OAuth service
+*
+* @package auth
+*/
+class bitly extends \phpbb\auth\provider\oauth\service\base
+{
+ /**
+ * phpBB config
+ *
+ * @var \phpbb\config\config
+ */
+ protected $config;
+
+ /**
+ * phpBB request
+ *
+ * @var \phpbb\request\request_interface
+ */
+ protected $request;
+
+ /**
+ * Constructor
+ *
+ * @param \phpbb\config\config $config
+ * @param \phpbb\request\request_interface $request
+ */
+ public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request)
+ {
+ $this->config = $config;
+ $this->request = $request;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_service_credentials()
+ {
+ return array(
+ 'key' => $this->config['auth_oauth_bitly_key'],
+ 'secret' => $this->config['auth_oauth_bitly_secret'],
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function perform_auth_login()
+ {
+ if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Bitly))
+ {
+ 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->service_provider->requestAccessToken($this->request->variable('code', ''));
+
+ // Send a request with it
+ $result = json_decode($this->service_provider->request('user/info'), true);
+
+ // Return the unique identifier returned from bitly
+ return $result['data']['login'];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function perform_token_auth()
+ {
+ if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Bitly))
+ {
+ throw new \phpbb\auth\provider\oauth\service\exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
+ }
+
+ // Send a request with it
+ $result = json_decode($this->service_provider->request('user/info'), true);
+
+ // Return the unique identifier returned from bitly
+ return $result['data']['login'];
+ }
+}
diff --git a/phpBB/phpbb/auth/provider/oauth/service/exception.php b/phpBB/phpbb/auth/provider/oauth/service/exception.php
new file mode 100644
index 0000000000..23d3387951
--- /dev/null
+++ b/phpBB/phpbb/auth/provider/oauth/service/exception.php
@@ -0,0 +1,25 @@
+<?php
+/**
+*
+* @package auth
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+/**
+* OAuth service exception class
+*
+* @package auth
+*/
+class phpbb_auth_provider_oauth_service_exception extends RuntimeException
+{
+}
diff --git a/phpBB/phpbb/auth/provider/oauth/service/facebook.php b/phpBB/phpbb/auth/provider/oauth/service/facebook.php
new file mode 100644
index 0000000000..4a4eeba6d5
--- /dev/null
+++ b/phpBB/phpbb/auth/provider/oauth/service/facebook.php
@@ -0,0 +1,100 @@
+<?php
+/**
+*
+* @package auth
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+namespace phpbb\auth\provider\oauth\service;
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+/**
+* Facebook OAuth service
+*
+* @package auth
+*/
+class facebook extends base
+{
+ /**
+ * phpBB config
+ *
+ * @var phpbb\config\config
+ */
+ protected $config;
+
+ /**
+ * phpBB request
+ *
+ * @var phpbb\request\request_interface
+ */
+ protected $request;
+
+ /**
+ * Constructor
+ *
+ * @param phpbb\config\config $config
+ * @param phpbb\request\request_interface $request
+ */
+ public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request)
+ {
+ $this->config = $config;
+ $this->request = $request;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_service_credentials()
+ {
+ return array(
+ 'key' => $this->config['auth_oauth_facebook_key'],
+ 'secret' => $this->config['auth_oauth_facebook_secret'],
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function perform_auth_login()
+ {
+ if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Facebook))
+ {
+ throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
+ }
+
+ // This was a callback request, get the token
+ $this->service_provider->requestAccessToken($this->request->variable('code', ''));
+
+ // Send a request with it
+ $result = json_decode($this->service_provider->request('/me'), true);
+
+ // Return the unique identifier
+ return $result['id'];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function perform_token_auth()
+ {
+ if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Facebook))
+ {
+ throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
+ }
+
+ // Send a request with it
+ $result = json_decode($this->service_provider->request('/me'), true);
+
+ // Return the unique identifier
+ return $result['id'];
+ }
+}
diff --git a/phpBB/phpbb/auth/provider/oauth/service/google.php b/phpBB/phpbb/auth/provider/oauth/service/google.php
new file mode 100644
index 0000000000..2449bbf523
--- /dev/null
+++ b/phpBB/phpbb/auth/provider/oauth/service/google.php
@@ -0,0 +1,111 @@
+<?php
+/**
+*
+* @package auth
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+namespace phpbb\auth\provider\oauth\service;
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+/**
+* Google OAuth service
+*
+* @package auth
+*/
+class google extends base
+{
+ /**
+ * phpBB config
+ *
+ * @var phpbb\config\config
+ */
+ protected $config;
+
+ /**
+ * phpBB request
+ *
+ * @var phpbb\request\request_interface
+ */
+ protected $request;
+
+ /**
+ * Constructor
+ *
+ * @param phpbb\config\config $config
+ * @param phpbb\request\request_interface $request
+ */
+ public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request)
+ {
+ $this->config = $config;
+ $this->request = $request;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_auth_scope()
+ {
+ return array(
+ 'userinfo_email',
+ 'userinfo_profile',
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_service_credentials()
+ {
+ return array(
+ 'key' => $this->config['auth_oauth_google_key'],
+ 'secret' => $this->config['auth_oauth_google_secret'],
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function perform_auth_login()
+ {
+ if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Google))
+ {
+ throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
+ }
+
+ // This was a callback request, get the token
+ $this->service_provider->requestAccessToken($this->request->variable('code', ''));
+
+ // Send a request with it
+ $result = json_decode($this->service_provider->request('https://www.googleapis.com/oauth2/v1/userinfo'), true);
+
+ // Return the unique identifier
+ return $result['id'];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function perform_token_auth()
+ {
+ if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Google))
+ {
+ throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
+ }
+
+ // Send a request with it
+ $result = json_decode($this->service_provider->request('https://www.googleapis.com/oauth2/v1/userinfo'), true);
+
+ // Return the unique identifier
+ return $result['id'];
+ }
+}
diff --git a/phpBB/phpbb/auth/provider/oauth/service/service_interface.php b/phpBB/phpbb/auth/provider/oauth/service/service_interface.php
new file mode 100644
index 0000000000..ab69fe6ef3
--- /dev/null
+++ b/phpBB/phpbb/auth/provider/oauth/service/service_interface.php
@@ -0,0 +1,79 @@
+<?php
+/**
+*
+* @package auth
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+namespace phpbb\auth\provider\oauth\service;
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+/**
+* OAuth service interface
+*
+* @package auth
+*/
+interface service_interface
+{
+ /**
+ * Returns an array of the scopes necessary for auth
+ *
+ * @return array An array of the required scopes
+ */
+ public function get_auth_scope();
+
+ /**
+ * Returns the external library service provider once it has been set
+ *
+ * @param \OAuth\Common\Service\ServiceInterface|null
+ */
+ public function get_external_service_provider();
+
+ /**
+ * Returns an array containing the service credentials belonging to requested
+ * service.
+ *
+ * @return array An array containing the 'key' and the 'secret' of the
+ * service in the form:
+ * array(
+ * 'key' => string
+ * 'secret' => string
+ * )
+ */
+ public function get_service_credentials();
+
+ /**
+ * Returns the results of the authentication in json format
+ *
+ * @throws \phpbb\auth\provider\oauth\service\exception
+ * @return string The unique identifier returned by the service provider
+ * that is used to authenticate the user with phpBB.
+ */
+ public function perform_auth_login();
+
+ /**
+ * Returns the results of the authentication in json format
+ * Use this function when the user already has an access token
+ *
+ * @throws \phpbb\auth\provider\oauth\service\exception
+ * @return string The unique identifier returned by the service provider
+ * that is used to authenticate the user with phpBB.
+ */
+ public function perform_token_auth();
+
+ /**
+ * Sets the external library service provider
+ *
+ * @param \OAuth\Common\Service\ServiceInterface $service
+ */
+ public function set_external_service_provider(\OAuth\Common\Service\ServiceInterface $service_provider);
+}
diff --git a/phpBB/phpbb/auth/provider/oauth/token_storage.php b/phpBB/phpbb/auth/provider/oauth/token_storage.php
new file mode 100644
index 0000000000..2ce0e32da3
--- /dev/null
+++ b/phpBB/phpbb/auth/provider/oauth/token_storage.php
@@ -0,0 +1,368 @@
+<?php
+/**
+*
+* @package auth
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+namespace phpbb\auth\provider\oauth;
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+
+use OAuth\OAuth1\Token\StdOAuth1Token;
+use OAuth\Common\Token\TokenInterface;
+use OAuth\Common\Storage\TokenStorageInterface;
+use OAuth\Common\Storage\Exception\StorageException;
+use OAuth\Common\Storage\Exception\TokenNotFoundException;
+
+/**
+* OAuth storage wrapper for phpbb's cache
+*
+* @package auth
+*/
+class token_storage implements TokenStorageInterface
+{
+ /**
+ * Cache driver.
+ *
+ * @var \phpbb\db\driver\driver
+ */
+ protected $db;
+
+ /**
+ * phpBB user
+ *
+ * @var \phpbb\user
+ */
+ protected $user;
+
+ /**
+ * OAuth token table
+ *
+ * @var string
+ */
+ protected $auth_provider_oauth_table;
+
+ /**
+ * @var object|TokenInterface
+ */
+ protected $cachedToken;
+
+ /**
+ * Creates token storage for phpBB.
+ *
+ * @param \phpbb\db\driver\driver $db
+ * @param \phpbb\user $user
+ * @param string $auth_provider_oauth_table
+ */
+ public function __construct(\phpbb\db\driver\driver $db, \phpbb\user $user, $auth_provider_oauth_table)
+ {
+ $this->db = $db;
+ $this->user = $user;
+ $this->auth_provider_oauth_table = $auth_provider_oauth_table;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function retrieveAccessToken($service)
+ {
+ $service = $this->get_service_name_for_db($service);
+
+ if ($this->cachedToken instanceOf TokenInterface)
+ {
+ return $this->cachedToken;
+ }
+
+ $data = array(
+ 'user_id' => (int) $this->user->data['user_id'],
+ 'provider' => $service,
+ );
+
+ if ((int) $this->user->data['user_id'] === ANONYMOUS)
+ {
+ $data['session_id'] = $this->user->data['session_id'];
+ }
+
+ return $this->_retrieve_access_token($data);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function storeAccessToken($service, TokenInterface $token)
+ {
+ $service = $this->get_service_name_for_db($service);
+
+ $this->cachedToken = $token;
+
+ $data = array(
+ 'user_id' => (int) $this->user->data['user_id'],
+ 'provider' => $service,
+ 'oauth_token' => $this->json_encode_token($token),
+ 'session_id' => $this->user->data['session_id'],
+ );
+
+ $sql = 'INSERT INTO ' . $this->auth_provider_oauth_table . '
+ ' . $this->db->sql_build_array('INSERT', $data);
+ $this->db->sql_query($sql);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function hasAccessToken($service)
+ {
+ $service = $this->get_service_name_for_db($service);
+
+ if ($this->cachedToken) {
+ return true;
+ }
+
+ $data = array(
+ 'user_id' => (int) $this->user->data['user_id'],
+ 'provider' => $service,
+ );
+
+ if ((int) $this->user->data['user_id'] === ANONYMOUS)
+ {
+ $data['session_id'] = $this->user->data['session_id'];
+ }
+
+ return $this->_has_acess_token($data);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function clearToken($service)
+ {
+ $service = $this->get_service_name_for_db($service);
+
+ $this->cachedToken = null;
+
+ $sql = 'DELETE FROM ' . $this->auth_provider_oauth_table . '
+ WHERE user_id = ' . (int) $this->user->data['user_id'] . "
+ AND provider = '" . $this->db->sql_escape($service) . "'";
+
+ if ((int) $this->user->data['user_id'] === ANONYMOUS)
+ {
+ $sql .= " AND session_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "'";
+ }
+
+ $this->db->sql_query($sql);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function clearAllTokens()
+ {
+ $this->cachedToken = null;
+
+ $sql = 'DELETE FROM ' . $this->auth_provider_oauth_table . '
+ WHERE user_id = ' . (int) $this->user->data['user_id'];
+
+ if ((int) $this->user->data['user_id'] === ANONYMOUS)
+ {
+ $sql .= " AND session_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "'";
+ }
+
+ $this->db->sql_query($sql);
+ }
+
+ /**
+ * Updates the user_id field in the database assosciated with the token
+ *
+ * @param int $user_id
+ */
+ public function set_user_id($user_id)
+ {
+ if (!$this->cachedToken)
+ {
+ return;
+ }
+
+ $sql = 'UPDATE ' . $this->auth_provider_oauth_table . '
+ SET ' . $this->db->sql_build_array('UPDATE', array(
+ 'user_id' => (int) $user_id
+ )) . '
+ WHERE user_id = ' . (int) $this->user->data['user_id'] . "
+ AND session_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "'";
+ $this->db->sql_query($sql);
+ }
+
+ /**
+ * Checks to see if an access token exists solely by the session_id of the user
+ *
+ * @return bool true if they have token, false if they don't
+ */
+ public function has_access_token_by_session($service)
+ {
+ $service = $this->get_service_name_for_db($service);
+
+ if ($this->cachedToken)
+ {
+ return true;
+ }
+
+ $data = array(
+ 'session_id' => $this->user->data['session_id'],
+ 'provider' => $service,
+ );
+
+ return $this->_has_acess_token($data);
+ }
+
+ /**
+ * A helper function that performs the query for has access token functions
+ *
+ * @param array $data
+ * @return bool
+ */
+ protected function _has_acess_token($data)
+ {
+ return (bool) $this->get_access_token_row($data);
+ }
+
+ public function retrieve_access_token_by_session($service)
+ {
+ $service = $this->get_service_name_for_db($service);
+
+ if ($this->cachedToken instanceOf TokenInterface) {
+ return $this->cachedToken;
+ }
+
+ $data = array(
+ 'session_id' => $this->user->data['session_id'],
+ 'provider' => $service,
+ );
+
+ return $this->_retrieve_access_token($data);
+ }
+
+ /**
+ * A helper function that performs the query for retrieve access token functions
+ * Also checks if the token is a valid token
+ *
+ * @param array $data
+ * @return mixed
+ */
+ protected function _retrieve_access_token($data)
+ {
+ $row = $this->get_access_token_row($data);
+
+ if (!$row)
+ {
+ throw new TokenNotFoundException('AUTH_PROVIDER_OAUTH_TOKEN_ERROR_NOT_STORED');
+ }
+
+ $token = $this->json_decode_token($row['oauth_token']);
+
+ // Ensure that the token was serialized/unserialized correctly
+ if (!($token instanceof TokenInterface))
+ {
+ $this->clearToken();
+ throw new TokenNotFoundException('AUTH_PROVIDER_OAUTH_TOKEN_ERROR_INCORRECTLY_STORED');
+ }
+
+ $this->cachedToken = $token;
+ return $token;
+ }
+
+ /**
+ * A helper function that performs the query for retrieving an access token
+ *
+ * @param array $data
+ * @return mixed
+ */
+ protected function get_access_token_row($data)
+ {
+ $sql = 'SELECT oauth_token FROM ' . $this->auth_provider_oauth_table . '
+ WHERE ' . $this->db->sql_build_array('SELECT', $data);
+ $result = $this->db->sql_query($sql);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ return $row;
+ }
+
+ public function json_encode_token(TokenInterface $token)
+ {
+ $members = array(
+ 'accessToken' => $token->getAccessToken(),
+ 'endOfLife' => $token->getEndOfLife(),
+ 'extraParams' => $token->getExtraParams(),
+ 'refreshToken' => $token->getRefreshToken(),
+
+ 'token_class' => get_class($token),
+ );
+
+ // Handle additional data needed for OAuth1 tokens
+ if ($token instanceof StdOAuth1Token)
+ {
+ $members['requestToken'] = $token->getRequestToken();
+ $members['requestTokenSecret'] = $token->getRequestTokenSecret();
+ $members['accessTokenSecret'] = $token->getAccessTokenSecret();
+ }
+
+ return json_encode($members);
+ }
+
+ public function json_decode_token($json)
+ {
+ $token_data = json_decode($json, true);
+
+ if ($token_data === null)
+ {
+ throw new TokenNotFoundException('AUTH_PROVIDER_OAUTH_TOKEN_ERROR_INCORRECTLY_STORED');
+ }
+
+ $token_class = $token_data['token_class'];
+ $access_token = $token_data['accessToken'];
+ $refresh_token = $token_data['refreshToken'];
+ $endOfLife = $token_data['endOfLife'];
+ $extra_params = $token_data['extraParams'];
+
+ // Create the token
+ $token = new $token_class($access_token, $refresh_token, TokenInterface::EOL_NEVER_EXPIRES, $extra_params);
+ $token->setEndOfLife($endOfLife);
+
+ // Handle OAuth 1.0 specific elements
+ if ($token instanceof StdOAuth1Token)
+ {
+ $token->setRequestToken($token_data['requestToken']);
+ $token->setRequestTokenSecret($token_data['requestTokenSecret']);
+ $token->setAccessTokenSecret($token_data['accessTokenSecret']);
+ }
+
+ return $token;
+ }
+
+ /**
+ * Returns the name of the service as it must be stored in the database.
+ *
+ * @param string $service The name of the OAuth service
+ * @return string The name of the OAuth service as it needs to be stored
+ * in the database.
+ */
+ protected function get_service_name_for_db($service)
+ {
+ // Enforce the naming convention for oauth services
+ if (strpos($service, 'auth.provider.oauth.service.') !== 0)
+ {
+ $service = 'auth.provider.oauth.service.' . strtolower($service);
+ }
+
+ return $service;
+ }
+}
diff --git a/phpBB/phpbb/auth/provider/provider_interface.php b/phpBB/phpbb/auth/provider/provider_interface.php
new file mode 100644
index 0000000000..1bb209c821
--- /dev/null
+++ b/phpBB/phpbb/auth/provider/provider_interface.php
@@ -0,0 +1,199 @@
+<?php
+/**
+*
+* @package auth
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+namespace phpbb\auth\provider;
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+/**
+ * The interface authentication provider classes have to implement.
+ *
+ * @package auth
+ */
+interface provider_interface
+{
+ /**
+ * Checks whether the user is currently identified to the authentication
+ * provider.
+ * Called in acp_board while setting authentication plugins.
+ * Changing to an authentication provider will not be permitted in acp_board
+ * if there is an error.
+ *
+ * @return boolean|string False if the user is identified, otherwise an
+ * error message, or null if not implemented.
+ */
+ public function init();
+
+ /**
+ * Performs login.
+ *
+ * @param string $username The name of the user being authenticated.
+ * @param string $password The password of the user.
+ * @return array An associative array of the format:
+ * array(
+ * 'status' => status constant
+ * 'error_msg' => string
+ * 'user_row' => array
+ * )
+ * A fourth key of the array may be present:
+ * 'redirect_data' This key is only used when 'status' is
+ * equal to LOGIN_SUCCESS_LINK_PROFILE and its value is an
+ * associative array that is turned into GET variables on
+ * the redirect url.
+ */
+ public function login($username, $password);
+
+ /**
+ * Autologin function
+ *
+ * @return array|null containing the user row, empty if no auto login
+ * should take place, or null if not impletmented.
+ */
+ public function autologin();
+
+ /**
+ * This function is used to output any required fields in the authentication
+ * admin panel. It also defines any required configuration table fields.
+ *
+ * @return array|null Returns null if not implemented or an array of the
+ * configuration fields of the provider.
+ */
+ public function acp();
+
+ /**
+ * This function updates the template with variables related to the acp
+ * options with whatever configuraton values are passed to it as an array.
+ * It then returns the name of the acp file related to this authentication
+ * provider.
+ * @param array $new_config Contains the new configuration values that
+ * have been set in acp_board.
+ * @return array|null Returns null if not implemented or an array with
+ * the template file name and an array of the vars
+ * that the template needs that must conform to the
+ * following example:
+ * array(
+ * 'TEMPLATE_FILE' => string,
+ * 'TEMPLATE_VARS' => array(...),
+ * )
+ * An optional third element may be added to this
+ * array: 'BLOCK_VAR_NAME'. If this is present,
+ * then its value should be a string that is used
+ * to designate the name of the loop used in the
+ * ACP template file. When this is present, an
+ * additional key named 'BLOCK_VARS' is required.
+ * This must be an array containing at least one
+ * array of variables that will be assigned during
+ * the loop in the template. An example of this is
+ * presented below:
+ * array(
+ * 'BLOCK_VAR_NAME' => string,
+ * 'BLOCK_VARS' => array(
+ * 'KEY IS UNIMPORTANT' => array(...),
+ * ),
+ * 'TEMPLATE_FILE' => string,
+ * 'TEMPLATE_VARS' => array(...),
+ * )
+ */
+ public function get_acp_template($new_config);
+
+ /**
+ * Returns an array of data necessary to build custom elements on the login
+ * form.
+ *
+ * @return array|null If this function is not implemented on an auth
+ * provider then it returns null. If it is implemented
+ * it will return an array of up to four elements of
+ * which only 'TEMPLATE_FILE'. If 'BLOCK_VAR_NAME' is
+ * present then 'BLOCK_VARS' must also be present in
+ * the array. The fourth element 'VARS' is also
+ * optional. The array, with all four elements present
+ * looks like the following:
+ * array(
+ * 'TEMPLATE_FILE' => string,
+ * 'BLOCK_VAR_NAME' => string,
+ * 'BLOCK_VARS' => array(...),
+ * 'VARS' => array(...),
+ * )
+ */
+ public function get_login_data();
+
+ /**
+ * Performs additional actions during logout.
+ *
+ * @param array $data An array corresponding to
+ * \phpbb\session::data
+ * @param boolean $new_session True for a new session, false for no new
+ * session.
+ */
+ public function logout($data, $new_session);
+
+ /**
+ * The session validation function checks whether the user is still logged
+ * into phpBB.
+ *
+ * @param array $user
+ * @return boolean true if the given user is authenticated, false if the
+ * session should be closed, or null if not implemented.
+ */
+ public function validate_session($user);
+
+ /**
+ * Checks to see if $login_link_data contains all information except for the
+ * user_id of an account needed to successfully link an external account to
+ * a forum account.
+ *
+ * @param array $link_data Any data needed to link a phpBB account to
+ * an external account.
+ * @return string|null Returns a string with a language constant if there
+ * is data missing or null if there is no error.
+ */
+ public function login_link_has_necessary_data($login_link_data);
+
+ /**
+ * Links an external account to a phpBB account.
+ *
+ * @param array $link_data Any data needed to link a phpBB account to
+ * an external account.
+ */
+ public function link_account(array $link_data);
+
+ /**
+ * Returns an array of data necessary to build the ucp_auth_link page
+ *
+ * @return array|null If this function is not implemented on an auth
+ * provider then it returns null. If it is implemented
+ * it will return an array of up to four elements of
+ * which only 'TEMPLATE_FILE'. If 'BLOCK_VAR_NAME' is
+ * present then 'BLOCK_VARS' must also be present in
+ * the array. The fourth element 'VARS' is also
+ * optional. The array, with all four elements present
+ * looks like the following:
+ * array(
+ * 'TEMPLATE_FILE' => string,
+ * 'BLOCK_VAR_NAME' => string,
+ * 'BLOCK_VARS' => array(...),
+ * 'VARS' => array(...),
+ * )
+ */
+ public function get_auth_link_data();
+
+ /**
+ * Unlinks an external account from a phpBB account.
+ *
+ * @param array $link_data Any data needed to unlink a phpBB account
+ * from a phpbb account.
+ */
+ public function unlink_account(array $link_data);
+}
diff --git a/phpBB/phpbb/avatar/driver/driver.php b/phpBB/phpbb/avatar/driver/driver.php
index 29c58d4e62..0c54951cbd 100644
--- a/phpBB/phpbb/avatar/driver/driver.php
+++ b/phpBB/phpbb/avatar/driver/driver.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\avatar\driver;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* Base class for avatar drivers
* @package phpBB3
*/
-abstract class phpbb_avatar_driver implements phpbb_avatar_driver_interface
+abstract class driver implements \phpbb\avatar\driver\driver_interface
{
/**
* Avatar driver name
@@ -29,7 +31,7 @@ abstract class phpbb_avatar_driver implements phpbb_avatar_driver_interface
/**
* Current board configuration
- * @var phpbb_config
+ * @var \phpbb\config\config
*/
protected $config;
@@ -47,7 +49,7 @@ abstract class phpbb_avatar_driver implements phpbb_avatar_driver_interface
/**
* Cache driver
- * @var phpbb_cache_driver_interface
+ * @var \phpbb\cache\driver\driver_interface
*/
protected $cache;
@@ -69,13 +71,13 @@ abstract class phpbb_avatar_driver implements phpbb_avatar_driver_interface
/**
* Construct a driver object
*
- * @param phpbb_config $config phpBB configuration
- * @param phpbb_request $request Request object
+ * @param \phpbb\config\config $config phpBB configuration
+ * @param \phpbb\request\request $request Request object
* @param string $phpbb_root_path Path to the phpBB root
* @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->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()
{
- $driver = preg_replace('#^phpbb_avatar_driver_#', '', get_class($this));
+ $driver = preg_replace('#^phpbb\\\\avatar\\\\driver\\\\#', '', get_class($this));
$template = "ucp_avatar_options_$driver.html";
return $template;
diff --git a/phpBB/phpbb/avatar/driver/interface.php b/phpBB/phpbb/avatar/driver/driver_interface.php
index 3d62969aef..d9540c19db 100644
--- a/phpBB/phpbb/avatar/driver/interface.php
+++ b/phpBB/phpbb/avatar/driver/driver_interface.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\avatar\driver;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* Interface for avatar drivers
* @package phpBB3
*/
-interface phpbb_avatar_driver_interface
+interface driver_interface
{
/**
* Returns the name of the driver.
@@ -32,7 +34,7 @@ interface phpbb_avatar_driver_interface
* Get the avatar url and dimensions
*
* @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.
* ['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
*
- * @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
- * phpbb_avatar_manager::clean_row
+ * \phpbb\avatar\manager::clean_row
* @param string $alt Alternate text for avatar image
*
* @return string HTML
@@ -53,11 +55,11 @@ interface phpbb_avatar_driver_interface
/**
* Prepare form for changing the settings of this avatar
*
- * @param phpbb_request $request Request object
- * @param phpbb_template $template Template object
- * @param phpbb_user $user User object
+ * @param \phpbb\request\request $request Request object
+ * @param \phpbb\template\template $template Template object
+ * @param \phpbb\user $user User object
* @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
* 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
@@ -70,7 +72,7 @@ interface phpbb_avatar_driver_interface
/**
* 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.
* The setting for enabling/disabling the avatar will be handled by
@@ -81,11 +83,11 @@ interface phpbb_avatar_driver_interface
/**
* Process form data
*
- * @param phpbb_request $request Request object
- * @param phpbb_template $template Template object
- * @param phpbb_user $user User object
+ * @param \phpbb\request\request $request Request object
+ * @param \phpbb\template\template $template Template object
+ * @param \phpbb\user $user User object
* @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
* 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
@@ -100,7 +102,7 @@ interface phpbb_avatar_driver_interface
* Delete avatar
*
* @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,
* i.e. when the avatar is not hosted locally.
diff --git a/phpBB/phpbb/avatar/driver/gravatar.php b/phpBB/phpbb/avatar/driver/gravatar.php
index d559da1c0d..3ad783932e 100644
--- a/phpBB/phpbb/avatar/driver/gravatar.php
+++ b/phpBB/phpbb/avatar/driver/gravatar.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\avatar\driver;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* Handles avatars hosted at gravatar.com
* @package phpBB3
*/
-class phpbb_avatar_driver_gravatar extends phpbb_avatar_driver
+class gravatar extends \phpbb\avatar\driver\driver
{
/**
* The URL for the gravatar service
diff --git a/phpBB/phpbb/avatar/driver/local.php b/phpBB/phpbb/avatar/driver/local.php
index f4bcd4ce74..d779099c46 100644
--- a/phpBB/phpbb/avatar/driver/local.php
+++ b/phpBB/phpbb/avatar/driver/local.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\avatar\driver;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* Handles avatars selected from the board gallery
* @package phpBB3
*/
-class phpbb_avatar_driver_local extends phpbb_avatar_driver
+class local extends \phpbb\avatar\driver\driver
{
/**
* @inheritdoc
@@ -144,7 +146,7 @@ class phpbb_avatar_driver_local extends phpbb_avatar_driver
* Get a list of avatars that are locally available
* 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
*/
@@ -157,7 +159,7 @@ class phpbb_avatar_driver_local extends phpbb_avatar_driver
$avatar_list = array();
$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)
{
$file_path = $file_info->getPath();
diff --git a/phpBB/phpbb/avatar/driver/remote.php b/phpBB/phpbb/avatar/driver/remote.php
index d629a490fd..1aa638dfe5 100644
--- a/phpBB/phpbb/avatar/driver/remote.php
+++ b/phpBB/phpbb/avatar/driver/remote.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\avatar\driver;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* Handles avatars hosted remotely
* @package phpBB3
*/
-class phpbb_avatar_driver_remote extends phpbb_avatar_driver
+class remote extends \phpbb\avatar\driver\driver
{
/**
* @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);
}
- $types = fileupload::image_types();
- $extension = strtolower(filespec::get_extension($url));
+ $types = \fileupload::image_types();
+ $extension = strtolower(\filespec::get_extension($url));
if (!empty($image_data) && (!isset($types[$image_data[2]]) || !in_array($extension, $types[$image_data[2]])))
{
diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php
index 685ac4f349..377c9a0b04 100644
--- a/phpBB/phpbb/avatar/driver/upload.php
+++ b/phpBB/phpbb/avatar/driver/upload.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\avatar\driver;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* Handles avatars uploaded to the board
* @package phpBB3
*/
-class phpbb_avatar_driver_upload extends phpbb_avatar_driver
+class upload extends \phpbb\avatar\driver\driver
{
/**
* @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);
}
- $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', '');
$upload_file = $request->file('avatar_upload_file');
diff --git a/phpBB/phpbb/avatar/manager.php b/phpBB/phpbb/avatar/manager.php
index 58d994c3c0..c28380a401 100644
--- a/phpBB/phpbb/avatar/manager.php
+++ b/phpBB/phpbb/avatar/manager.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\avatar;
+
/**
* @ignore
*/
@@ -18,11 +20,11 @@ if (!defined('IN_PHPBB'))
/**
* @package avatar
*/
-class phpbb_avatar_manager
+class manager
{
/**
* phpBB configuration
- * @var phpbb_config
+ * @var \phpbb\config\config
*/
protected $config;
@@ -59,11 +61,11 @@ class phpbb_avatar_manager
/**
* 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 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->avatar_drivers = $avatar_drivers;
@@ -194,7 +196,7 @@ class phpbb_avatar_manager
$keys = array_keys($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);
}
@@ -220,7 +222,7 @@ class phpbb_avatar_manager
*/
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);
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)
{
- 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
*
- * @param phpbb_user phpBB User object
+ * @param \phpbb\user phpBB User object
* @param array $error Array containing error strings
* 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
@@ -289,7 +291,7 @@ class phpbb_avatar_manager
*
* @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)
{
diff --git a/phpBB/phpbb/cache/driver/apc.php b/phpBB/phpbb/cache/driver/apc.php
index 0516b669c8..ce72ec6134 100644
--- a/phpBB/phpbb/cache/driver/apc.php
+++ b/phpBB/phpbb/cache/driver/apc.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\cache\driver;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* ACM for APC
* @package acm
*/
-class phpbb_cache_driver_apc extends phpbb_cache_driver_memory
+class apc extends \phpbb\cache\driver\memory
{
var $extension = 'apc';
diff --git a/phpBB/phpbb/cache/driver/base.php b/phpBB/phpbb/cache/driver/base.php
index 32e04f813a..90185a00d2 100644
--- a/phpBB/phpbb/cache/driver/base.php
+++ b/phpBB/phpbb/cache/driver/base.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\cache\driver;
+
/**
* @ignore
*/
@@ -18,6 +20,6 @@ if (!defined('IN_PHPBB'))
/**
* @package acm
*/
-abstract class phpbb_cache_driver_base implements phpbb_cache_driver_interface
+abstract class base implements \phpbb\cache\driver\driver_interface
{
}
diff --git a/phpBB/phpbb/cache/driver/interface.php b/phpBB/phpbb/cache/driver/driver_interface.php
index 53f684d1c8..34c60b5935 100644
--- a/phpBB/phpbb/cache/driver/interface.php
+++ b/phpBB/phpbb/cache/driver/driver_interface.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\cache\driver;
+
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
*
* @package acm
*/
-interface phpbb_cache_driver_interface
+interface driver_interface
{
/**
* Load global cache
@@ -85,10 +87,10 @@ interface phpbb_cache_driver_interface
* result to persistent storage. In other words, there is no need
* 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 mixed $query_result The result from dbal::sql_query, to be passed to
- * dbal::sql_fetchrow to get all rows and store them
+ * @param mixed $query_result The result from \dbal::sql_query, to be passed to
+ * \dbal::sql_fetchrow to get all rows and store them
* in cache.
* @param int $ttl Time to live, after this timeout the query should
* expire from the cache.
@@ -96,7 +98,7 @@ interface phpbb_cache_driver_interface
* representing the query should be returned. Otherwise
* 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.
diff --git a/phpBB/phpbb/cache/driver/eaccelerator.php b/phpBB/phpbb/cache/driver/eaccelerator.php
index 257b90c76e..72c0d77d02 100644
--- a/phpBB/phpbb/cache/driver/eaccelerator.php
+++ b/phpBB/phpbb/cache/driver/eaccelerator.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\cache\driver;
+
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
* @package acm
* @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 $function = 'eaccelerator_get';
diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php
index 944dfd6541..a64232400b 100644
--- a/phpBB/phpbb/cache/driver/file.php
+++ b/phpBB/phpbb/cache/driver/file.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\cache\driver;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* ACM File Based Caching
* @package acm
*/
-class phpbb_cache_driver_file extends phpbb_cache_driver_base
+class file extends \phpbb\cache\driver\base
{
var $vars = array();
var $var_expires = array();
@@ -205,9 +207,9 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
function purge()
{
// Purge all phpbb cache files
- try
+ try
{
- $iterator = new DirectoryIterator($this->cache_dir);
+ $iterator = new \DirectoryIterator($this->cache_dir);
}
catch (Exception $e)
{
@@ -256,9 +258,9 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
*/
protected function remove_dir($dir)
{
- try
+ try
{
- $iterator = new DirectoryIterator($dir);
+ $iterator = new \DirectoryIterator($dir);
}
catch (Exception $e)
{
@@ -413,7 +415,7 @@ class phpbb_cache_driver_file extends phpbb_cache_driver_base
/**
* {@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
$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";
- $lock = new phpbb_lock_flock($file);
+ $lock = new \phpbb\lock\flock($file);
$lock->acquire();
if ($handle = @fopen($file, 'wb'))
diff --git a/phpBB/phpbb/cache/driver/memcache.php b/phpBB/phpbb/cache/driver/memcache.php
index 3fd16b23b0..84fe68ae49 100644
--- a/phpBB/phpbb/cache/driver/memcache.php
+++ b/phpBB/phpbb/cache/driver/memcache.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\cache\driver;
+
/**
* @ignore
*/
@@ -40,7 +42,7 @@ if (!defined('PHPBB_ACM_MEMCACHE'))
* ACM for Memcached
* @package acm
*/
-class phpbb_cache_driver_memcache extends phpbb_cache_driver_memory
+class memcache extends \phpbb\cache\driver\memory
{
var $extension = 'memcache';
@@ -52,7 +54,7 @@ class phpbb_cache_driver_memcache extends phpbb_cache_driver_memory
// Call the parent constructor
parent::__construct();
- $this->memcache = new Memcache;
+ $this->memcache = new \Memcache;
foreach(explode(',', PHPBB_ACM_MEMCACHE) as $u)
{
$parts = explode('/', $u);
diff --git a/phpBB/phpbb/cache/driver/memory.php b/phpBB/phpbb/cache/driver/memory.php
index f77a1df316..5a9861913f 100644
--- a/phpBB/phpbb/cache/driver/memory.php
+++ b/phpBB/phpbb/cache/driver/memory.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\cache\driver;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* ACM Abstract Memory Class
* @package acm
*/
-abstract class phpbb_cache_driver_memory extends phpbb_cache_driver_base
+abstract class memory extends \phpbb\cache\driver\base
{
var $key_prefix;
@@ -285,7 +287,7 @@ abstract class phpbb_cache_driver_memory extends phpbb_cache_driver_base
/**
* {@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
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
diff --git a/phpBB/phpbb/cache/driver/null.php b/phpBB/phpbb/cache/driver/null.php
index 2fadc27ba3..c03319ad61 100644
--- a/phpBB/phpbb/cache/driver/null.php
+++ b/phpBB/phpbb/cache/driver/null.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\cache\driver;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* ACM Null Caching
* @package acm
*/
-class phpbb_cache_driver_null extends phpbb_cache_driver_base
+class null extends \phpbb\cache\driver\base
{
/**
* Set cache path
@@ -107,7 +109,7 @@ class phpbb_cache_driver_null extends phpbb_cache_driver_base
/**
* {@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;
}
diff --git a/phpBB/phpbb/cache/driver/redis.php b/phpBB/phpbb/cache/driver/redis.php
index 960735b673..317d07428a 100644
--- a/phpBB/phpbb/cache/driver/redis.php
+++ b/phpBB/phpbb/cache/driver/redis.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\cache\driver;
+
/**
* @ignore
*/
@@ -33,7 +35,7 @@ if (!defined('PHPBB_ACM_REDIS_HOST'))
*
* @package acm
*/
-class phpbb_cache_driver_redis extends phpbb_cache_driver_memory
+class redis extends \phpbb\cache\driver\memory
{
var $extension = 'redis';
@@ -56,7 +58,7 @@ class phpbb_cache_driver_redis extends phpbb_cache_driver_memory
// Call the parent constructor
parent::__construct();
- $this->redis = new Redis();
+ $this->redis = new \Redis();
$args = func_get_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_PREFIX, $this->key_prefix);
+ $this->redis->setOption(\Redis::OPT_SERIALIZER, \Redis::SERIALIZER_PHP);
+ $this->redis->setOption(\Redis::OPT_PREFIX, $this->key_prefix);
if (defined('PHPBB_ACM_REDIS_DB'))
{
diff --git a/phpBB/phpbb/cache/driver/wincache.php b/phpBB/phpbb/cache/driver/wincache.php
index 58f3b4a581..a0b24e4a1f 100644
--- a/phpBB/phpbb/cache/driver/wincache.php
+++ b/phpBB/phpbb/cache/driver/wincache.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\cache\driver;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* ACM for WinCache
* @package acm
*/
-class phpbb_cache_driver_wincache extends phpbb_cache_driver_memory
+class wincache extends \phpbb\cache\driver\memory
{
var $extension = 'wincache';
diff --git a/phpBB/phpbb/cache/driver/xcache.php b/phpBB/phpbb/cache/driver/xcache.php
index 06c5fafd97..fdcbf7e4b5 100644
--- a/phpBB/phpbb/cache/driver/xcache.php
+++ b/phpBB/phpbb/cache/driver/xcache.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\cache\driver;
+
/**
* @ignore
*/
@@ -24,7 +26,7 @@ if (!defined('IN_PHPBB'))
* - 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';
diff --git a/phpBB/phpbb/cache/service.php b/phpBB/phpbb/cache/service.php
index 69c5e0fdd0..da8f4eb8d8 100644
--- a/phpBB/phpbb/cache/service.php
+++ b/phpBB/phpbb/cache/service.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\cache;
+
/**
* @ignore
*/
@@ -19,26 +21,26 @@ if (!defined('IN_PHPBB'))
* Class for grabbing/handling cached entries
* @package acm
*/
-class phpbb_cache_service
+class service
{
/**
* Cache driver.
*
- * @var phpbb_cache_driver_interface
+ * @var \phpbb\cache\driver\driver_interface
*/
protected $driver;
/**
* The config.
*
- * @var phpbb_config
+ * @var \phpbb\config\config
*/
protected $config;
/**
* Database connection.
*
- * @var phpbb_db_driver
+ * @var \phpbb\db\driver\driver
*/
protected $db;
@@ -59,13 +61,13 @@ class phpbb_cache_service
/**
* Creates a cache service around a cache driver
*
- * @param phpbb_cache_driver_interface $driver The cache driver
- * @param phpbb_config $config The config
- * @param phpbb_db_driver $db Database connection
+ * @param \phpbb\cache\driver\driver_interface $driver The cache driver
+ * @param \phpbb\config\config $config The config
+ * @param \phpbb\db\driver\driver $db Database connection
* @param string $phpbb_root_path Root path
* @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->config = $config;
@@ -77,7 +79,7 @@ class phpbb_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()
{
@@ -87,9 +89,9 @@ class phpbb_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;
}
diff --git a/phpBB/phpbb/class_loader.php b/phpBB/phpbb/class_loader.php
index 02a2d584dc..769f28b4f1 100644
--- a/phpBB/phpbb/class_loader.php
+++ b/phpBB/phpbb/class_loader.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb;
+
/**
* @ignore
*/
@@ -28,9 +30,9 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-class phpbb_class_loader
+class class_loader
{
- private $prefix;
+ private $namespace;
private $path;
private $php_ext;
private $cache;
@@ -44,17 +46,22 @@ class phpbb_class_loader
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.
*
- * @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 $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)
- {
- $this->prefix = $prefix;
+ public function __construct($namespace, $path, $php_ext = 'php', \phpbb\cache\driver\driver_interface $cache = null)
+ {
+ if ($namespace[0] !== '\\')
+ {
+ $namespace = '\\' . $namespace;
+ }
+
+ $this->namespace = $namespace;
$this->path = $path;
$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
* 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)
{
- $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)
{
@@ -102,8 +109,9 @@ class phpbb_class_loader
/**
* 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_
- * prefix
+ * @param string $class The class name to resolve, must be in the
+ * namespace the loader was constructed with.
+ * Has to begin with \
* @return string|bool A relative path to the file containing the
* 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;
}
- if (!preg_match('/^' . $this->prefix . '[a-zA-Z0-9_]+$/', $class))
+ if (!preg_match('/^' . preg_quote($this->namespace, '/') . '[a-zA-Z0-9_\\\\]+$/', $class))
{
return false;
}
- $parts = explode('_', substr($class, strlen($this->prefix)));
-
- $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), '_');
+ $relative_path = str_replace('\\', '/', substr($class, strlen($this->namespace)));
if (!file_exists($this->path . $relative_path . '.' . $this->php_ext))
{
@@ -144,7 +137,7 @@ class phpbb_class_loader
if ($this->cache)
{
$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;
@@ -157,7 +150,8 @@ class phpbb_class_loader
*/
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);
diff --git a/phpBB/phpbb/config/config.php b/phpBB/phpbb/config/config.php
index 4b533dd55c..dc865df707 100644
--- a/phpBB/phpbb/config/config.php
+++ b/phpBB/phpbb/config/config.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\config;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* Configuration container class
* @package phpBB3
*/
-class phpbb_config implements ArrayAccess, IteratorAggregate, Countable
+class config implements \ArrayAccess, \IteratorAggregate, \Countable
{
/**
* The configuration data
@@ -44,7 +46,7 @@ class phpbb_config implements ArrayAccess, IteratorAggregate, Countable
*/
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)
{
- 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);
}
/**
diff --git a/phpBB/phpbb/config/db.php b/phpBB/phpbb/config/db.php
index b18369a479..0a490af14f 100644
--- a/phpBB/phpbb/config/db.php
+++ b/phpBB/phpbb/config/db.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\config;
+
/**
* @ignore
*/
@@ -19,17 +21,17 @@ if (!defined('IN_PHPBB'))
* Configuration container class
* @package phpBB3
*/
-class phpbb_config_db extends phpbb_config
+class db extends \phpbb\config\config
{
/**
* Cache instance
- * @var phpbb_cache_driver_interface
+ * @var \phpbb\cache\driver\driver_interface
*/
protected $cache;
/**
* Database connection
- * @var phpbb_db_driver
+ * @var \phpbb\db\driver\driver
*/
protected $db;
@@ -42,11 +44,11 @@ class phpbb_config_db extends phpbb_config
/**
* Creates a configuration container with a default set of values
*
- * @param phpbb_db_driver $db Database connection
- * @param phpbb_cache_driver_interface $cache Cache instance
+ * @param \phpbb\db\driver\driver $db Database connection
+ * @param \phpbb\cache\driver\driver_interface $cache Cache instance
* @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->cache = $cache;
diff --git a/phpBB/phpbb/config/db_text.php b/phpBB/phpbb/config/db_text.php
index b365cb5c77..3ee3351e19 100644
--- a/phpBB/phpbb/config/db_text.php
+++ b/phpBB/phpbb/config/db_text.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\config;
+
/**
* @ignore
*/
@@ -17,16 +19,16 @@ if (!defined('IN_PHPBB'))
/**
* 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.
*
* @package phpBB3
*/
-class phpbb_config_db_text
+class db_text
{
/**
* Database connection
- * @var phpbb_db_driver
+ * @var \phpbb\db\driver\driver
*/
protected $db;
@@ -37,10 +39,10 @@ class phpbb_config_db_text
protected $table;
/**
- * @param phpbb_db_driver $db Database connection
+ * @param \phpbb\db\driver\driver $db Database connection
* @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->table = $this->db->sql_escape($table);
diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php
index fb8ece0e8c..bf720957bc 100644
--- a/phpBB/phpbb/content_visibility.php
+++ b/phpBB/phpbb/content_visibility.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb;
+
/**
* @ignore
*/
@@ -20,23 +22,23 @@ if (!defined('IN_PHPBB'))
* Handle fetching and setting the visibility for topics and posts
* @package phpbb
*/
-class phpbb_content_visibility
+class content_visibility
{
/**
* Database object
- * @var phpbb_db_driver
+ * @var \phpbb\db\driver\driver
*/
protected $db;
/**
* User object
- * @var phpbb_user
+ * @var \phpbb\user
*/
protected $user;
/**
* Auth object
- * @var phpbb_auth
+ * @var \phpbb\auth\auth
*/
protected $auth;
@@ -55,14 +57,14 @@ class phpbb_content_visibility
/**
* Constructor
*
- * @param phpbb_auth $auth Auth object
- * @param phpbb_db_driver $db Database object
- * @param phpbb_user $user User object
+ * @param \phpbb\auth\auth $auth Auth object
+ * @param \phpbb\db\driver\driver $db Database object
+ * @param \phpbb\user $user User object
* @param string $phpbb_root_path Root path
* @param string $php_ext PHP Extension
* @return null
*/
- public function __construct(phpbb_auth $auth, phpbb_db_driver $db, phpbb_user $user, $phpbb_root_path, $php_ext, $forums_table, $posts_table, $topics_table, $users_table)
+ public function __construct(\phpbb\auth\auth $auth, \phpbb\db\driver\driver $db, \phpbb\user $user, $phpbb_root_path, $php_ext, $forums_table, $posts_table, $topics_table, $users_table)
{
$this->auth = $auth;
$this->db = $db;
diff --git a/phpBB/phpbb/controller/exception.php b/phpBB/phpbb/controller/exception.php
index faa8b6b584..e8694b8bcf 100644
--- a/phpBB/phpbb/controller/exception.php
+++ b/phpBB/phpbb/controller/exception.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\controller;
+
/**
* @ignore
*/
@@ -19,6 +21,6 @@ if (!defined('IN_PHPBB'))
* Controller exception class
* @package phpBB3
*/
-class phpbb_controller_exception extends RuntimeException
+class exception extends \RuntimeException
{
}
diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php
index 74410ddfd1..07483a91eb 100644
--- a/phpBB/phpbb/controller/helper.php
+++ b/phpBB/phpbb/controller/helper.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\controller;
+
/**
* @ignore
*/
@@ -21,21 +23,27 @@ use Symfony\Component\HttpFoundation\Response;
* Controller helper class, contains methods that do things for controllers
* @package phpBB3
*/
-class phpbb_controller_helper
+class helper
{
/**
* Template object
- * @var phpbb_template
+ * @var \phpbb\template\template
*/
protected $template;
/**
* User object
- * @var phpbb_user
+ * @var \phpbb\user
*/
protected $user;
/**
+ * config object
+ * @var \phpbb\config\config
+ */
+ protected $config;
+
+ /**
* phpBB root path
* @var string
*/
@@ -50,15 +58,17 @@ class phpbb_controller_helper
/**
* Constructor
*
- * @param phpbb_template $template Template object
- * @param phpbb_user $user User object
+ * @param \phpbb\template\template $template Template object
+ * @param \phpbb\user $user User object
+ * @param \phpbb\config\config $config Config object
* @param string $phpbb_root_path phpBB root path
* @param string $php_ext PHP extension
*/
- public function __construct(phpbb_template $template, phpbb_user $user, $phpbb_root_path, $php_ext)
+ public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\config\config $config, $phpbb_root_path, $php_ext)
{
$this->template = $template;
$this->user = $user;
+ $this->config = $config;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
}
@@ -102,22 +112,14 @@ class phpbb_controller_helper
$route = substr($route, 0, $route_delim);
}
- if (is_array($params) && !empty($params))
- {
- $params = array_merge(array(
- 'controller' => $route,
- ), $params);
- }
- else if (is_string($params) && $params)
- {
- $params = 'controller=' . $route . (($is_amp) ? '&amp;' : '&') . $params;
- }
- else
+ // If enable_mod_rewrite is false, we need to include app.php
+ $route_prefix = $this->phpbb_root_path;
+ if (empty($this->config['enable_mod_rewrite']))
{
- $params = array('controller' => $route);
+ $route_prefix .= 'app.' . $this->php_ext . '/';
}
- return append_sid($this->phpbb_root_path . 'app.' . $this->php_ext . $route_params, $params, $is_amp, $session_id);
+ return append_sid($route_prefix . "$route" . $route_params, $params, $is_amp, $session_id);
}
/**
diff --git a/phpBB/phpbb/controller/provider.php b/phpBB/phpbb/controller/provider.php
index b2a5b9f6b2..3aad08e3aa 100644
--- a/phpBB/phpbb/controller/provider.php
+++ b/phpBB/phpbb/controller/provider.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\controller;
+
/**
* @ignore
*/
@@ -23,7 +25,7 @@ use Symfony\Component\Config\FileLocator;
* Controller interface
* @package phpBB3
*/
-class phpbb_controller_provider
+class provider
{
/**
* YAML file(s) containing route information
@@ -48,7 +50,7 @@ class phpbb_controller_provider
*
* @return The current instance of this object for method chaining
*/
- public function import_paths_from_finder(phpbb_extension_finder $finder)
+ public function import_paths_from_finder(\phpbb\extension\finder $finder)
{
// We hardcode the path to the core config directory
// because the finder cannot find it
diff --git a/phpBB/phpbb/controller/resolver.php b/phpBB/phpbb/controller/resolver.php
index 95dfc8da8e..1cc8981105 100644
--- a/phpBB/phpbb/controller/resolver.php
+++ b/phpBB/phpbb/controller/resolver.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\controller;
+
/**
* @ignore
*/
@@ -23,11 +25,11 @@ use Symfony\Component\HttpFoundation\Request;
* Controller manager class
* @package phpBB3
*/
-class phpbb_controller_resolver implements ControllerResolverInterface
+class resolver implements ControllerResolverInterface
{
/**
* User object
- * @var phpbb_user
+ * @var \phpbb\user
*/
protected $user;
@@ -38,23 +40,23 @@ class phpbb_controller_resolver implements ControllerResolverInterface
protected $container;
/**
- * phpbb_style object
- * @var phpbb_style
+ * phpbb\template\template object
+ * @var phpbb\template\template
*/
- protected $style;
+ protected $template;
/**
* Construct method
*
- * @param phpbb_user $user User Object
+ * @param \phpbb\user $user User Object
* @param ContainerInterface $container ContainerInterface object
- * @param phpbb_style $style
+ * @param \phpbb\template\template $template
*/
- public function __construct(phpbb_user $user, ContainerInterface $container, phpbb_style $style = null)
+ public function __construct(\phpbb\user $user, ContainerInterface $container, \phpbb\template\template $template = null)
{
$this->user = $user;
$this->container = $container;
- $this->style = $style;
+ $this->template = $template;
}
/**
@@ -62,7 +64,7 @@ class phpbb_controller_resolver implements ControllerResolverInterface
*
* @param Symfony\Component\HttpFoundation\Request $request Symfony Request object
* @return bool|Callable Callable or false
- * @throws phpbb_controller_exception
+ * @throws \phpbb\controller\exception
*/
public function getController(Request $request)
{
@@ -70,20 +72,20 @@ class phpbb_controller_resolver implements ControllerResolverInterface
if (!$controller)
{
- throw new phpbb_controller_exception($this->user->lang['CONTROLLER_NOT_SPECIFIED']);
+ throw new \phpbb\controller\exception($this->user->lang['CONTROLLER_NOT_SPECIFIED']);
}
// Require a method name along with the service name
if (stripos($controller, ':') === false)
{
- throw new phpbb_controller_exception($this->user->lang['CONTROLLER_METHOD_NOT_SPECIFIED']);
+ throw new \phpbb\controller\exception($this->user->lang['CONTROLLER_METHOD_NOT_SPECIFIED']);
}
list($service, $method) = explode(':', $controller);
if (!$this->container->has($service))
{
- throw new phpbb_controller_exception($this->user->lang('CONTROLLER_SERVICE_UNDEFINED', $service));
+ throw new \phpbb\controller\exception($this->user->lang('CONTROLLER_SERVICE_UNDEFINED', $service));
}
$controller_object = $this->container->get($service);
@@ -93,16 +95,16 @@ class phpbb_controller_resolver implements ControllerResolverInterface
* the style paths for the extension (the ext author can change them
* if necessary).
*/
- $controller_dir = explode('_', get_class($controller_object));
+ $controller_dir = explode('\\', get_class($controller_object));
- // 0 phpbb, 1 ext, 2 vendor, 3 extension name, ...
- if (!is_null($this->style) && isset($controller_dir[3]) && $controller_dir[1] === 'ext')
+ // 0 vendor, 1 extension name, ...
+ if (!is_null($this->template) && isset($controller_dir[1]))
{
- $controller_style_dir = 'ext/' . $controller_dir[2] . '/' . $controller_dir[3] . '/styles';
+ $controller_style_dir = 'ext/' . $controller_dir[0] . '/' . $controller_dir[1] . '/styles';
if (is_dir($controller_style_dir))
{
- $this->style->set_style(array($controller_style_dir, 'styles'));
+ $this->template->set_style(array($controller_style_dir, 'styles'));
}
}
@@ -118,13 +120,13 @@ class phpbb_controller_resolver implements ControllerResolverInterface
* @param Symfony\Component\HttpFoundation\Request $request Symfony Request object
* @param mixed $controller A callable (controller class, method)
* @return bool False
- * @throws phpbb_controller_exception
+ * @throws \phpbb\controller\exception
*/
public function getArguments(Request $request, $controller)
{
// At this point, $controller contains the object and method name
list($object, $method) = $controller;
- $mirror = new ReflectionMethod($object, $method);
+ $mirror = new \ReflectionMethod($object, $method);
$arguments = array();
$parameters = $mirror->getParameters();
@@ -145,7 +147,7 @@ class phpbb_controller_resolver implements ControllerResolverInterface
}
else
{
- throw new phpbb_controller_exception($this->user->lang('CONTROLLER_ARGUMENT_VALUE_MISSING', $param->getPosition() + 1, get_class($object) . ':' . $method, $param->name));
+ throw new \phpbb\controller\exception($this->user->lang('CONTROLLER_ARGUMENT_VALUE_MISSING', $param->getPosition() + 1, get_class($object) . ':' . $method, $param->name));
}
}
diff --git a/phpBB/phpbb/cron/manager.php b/phpBB/phpbb/cron/manager.php
index 84c9650830..f58ba64a3d 100644
--- a/phpBB/phpbb/cron/manager.php
+++ b/phpBB/phpbb/cron/manager.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\cron;
+
/**
* @ignore
*/
@@ -22,10 +24,10 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-class phpbb_cron_manager
+class manager
{
/**
- * Set of phpbb_cron_task_wrapper objects.
+ * Set of \phpbb\cron\task\wrapper objects.
* Array holding all tasks that have been found.
*
* @var array
@@ -52,7 +54,7 @@ class phpbb_cron_manager
* Loads tasks given by name, wraps them
* and puts them into $this->tasks.
*
- * @param array|Traversable $tasks Array of instances of phpbb_cron_task
+ * @param array|Traversable $tasks Array of instances of \phpbb\cron\task\task
*
* @return null
*/
@@ -71,7 +73,7 @@ class phpbb_cron_manager
*
* If no tasks are ready, null is returned.
*
- * @return phpbb_cron_task_wrapper|null
+ * @return \phpbb\cron\task\wrapper|null
*/
public function find_one_ready_task()
{
@@ -88,7 +90,7 @@ class phpbb_cron_manager
/**
* Finds all tasks that are ready to run.
*
- * @return array List of tasks which are ready to run (wrapped in phpbb_cron_task_wrapper).
+ * @return array List of tasks which are ready to run (wrapped in \phpbb\cron\task\wrapper).
*/
public function find_all_ready_tasks()
{
@@ -111,7 +113,7 @@ class phpbb_cron_manager
* Web runner uses this method to resolve names to tasks.
*
* @param string $name Name of the task to look up.
- * @return phpbb_cron_task A task corresponding to the given name, or null.
+ * @return \phpbb\cron\task\task A task corresponding to the given name, or null.
*/
public function find_task($name)
{
@@ -126,13 +128,13 @@ class phpbb_cron_manager
}
/**
- * Wraps a task inside an instance of phpbb_cron_task_wrapper.
+ * Wraps a task inside an instance of \phpbb\cron\task\wrapper.
*
- * @param phpbb_cron_task $task The task.
- * @return phpbb_cron_task_wrapper The wrapped task.
+ * @param \phpbb\cron\task\task $task The task.
+ * @return \phpbb\cron\task\wrapper The wrapped task.
*/
- public function wrap_task(phpbb_cron_task $task)
+ public function wrap_task(\phpbb\cron\task\task $task)
{
- return new phpbb_cron_task_wrapper($task, $this->phpbb_root_path, $this->php_ext);
+ return new \phpbb\cron\task\wrapper($task, $this->phpbb_root_path, $this->php_ext);
}
}
diff --git a/phpBB/phpbb/cron/task/base.php b/phpBB/phpbb/cron/task/base.php
index 94a2f267b4..f30c9daf1b 100644
--- a/phpBB/phpbb/cron/task/base.php
+++ b/phpBB/phpbb/cron/task/base.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\cron\task;
+
/**
* @ignore
*/
@@ -26,7 +28,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-abstract class phpbb_cron_task_base implements phpbb_cron_task
+abstract class base implements \phpbb\cron\task\task
{
private $name;
diff --git a/phpBB/phpbb/cron/task/core/prune_all_forums.php b/phpBB/phpbb/cron/task/core/prune_all_forums.php
index 2c5d38cec0..8e3ef25ce6 100644
--- a/phpBB/phpbb/cron/task/core/prune_all_forums.php
+++ b/phpBB/phpbb/cron/task/core/prune_all_forums.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\cron\task\core;
+
/**
* @ignore
*/
@@ -24,7 +26,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-class phpbb_cron_task_core_prune_all_forums extends phpbb_cron_task_base
+class prune_all_forums extends \phpbb\cron\task\base
{
protected $phpbb_root_path;
protected $php_ext;
@@ -36,10 +38,10 @@ class phpbb_cron_task_core_prune_all_forums extends phpbb_cron_task_base
*
* @param string $phpbb_root_path The root path
* @param string $php_ext The PHP extension
- * @param phpbb_config $config The config
- * @param phpbb_db_driver $db The db connection
+ * @param \phpbb\config\config $config The config
+ * @param \phpbb\db\driver\driver $db The db connection
*/
- public function __construct($phpbb_root_path, $php_ext, phpbb_config $config, phpbb_db_driver $db)
+ public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config, \phpbb\db\driver\driver $db)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
diff --git a/phpBB/phpbb/cron/task/core/prune_forum.php b/phpBB/phpbb/cron/task/core/prune_forum.php
index e3c497f072..f14ab7b702 100644
--- a/phpBB/phpbb/cron/task/core/prune_forum.php
+++ b/phpBB/phpbb/cron/task/core/prune_forum.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\cron\task\core;
+
/**
* @ignore
*/
@@ -24,7 +26,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements phpbb_cron_task_parametrized
+class prune_forum extends \phpbb\cron\task\base implements \phpbb\cron\task\parametrized
{
protected $phpbb_root_path;
protected $php_ext;
@@ -46,10 +48,10 @@ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements p
*
* @param string $phpbb_root_path The root path
* @param string $php_ext The PHP extension
- * @param phpbb_config $config The config
- * @param phpbb_db_driver $db The db connection
+ * @param \phpbb\config\config $config The config
+ * @param \phpbb\db\driver\driver $db The db connection
*/
- public function __construct($phpbb_root_path, $php_ext, phpbb_config $config, phpbb_db_driver $db)
+ public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config, \phpbb\db\driver\driver $db)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
@@ -132,15 +134,15 @@ class phpbb_cron_task_core_prune_forum extends phpbb_cron_task_base implements p
/**
* Parses parameters found in $request, which is an instance of
- * phpbb_request_interface.
+ * \phpbb\request\request_interface.
*
* It is expected to have a key f whose value is id of the forum to be pruned.
*
- * @param phpbb_request_interface $request Request object.
+ * @param \phpbb\request\request_interface $request Request object.
*
* @return null
*/
- public function parse_parameters(phpbb_request_interface $request)
+ public function parse_parameters(\phpbb\request\request_interface $request)
{
$this->forum_data = null;
if ($request->is_set('f'))
diff --git a/phpBB/phpbb/cron/task/core/prune_notifications.php b/phpBB/phpbb/cron/task/core/prune_notifications.php
new file mode 100644
index 0000000000..296c0ae64f
--- /dev/null
+++ b/phpBB/phpbb/cron/task/core/prune_notifications.php
@@ -0,0 +1,65 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+/**
+* Prune notifications cron task.
+*
+* @package phpBB3
+*/
+class phpbb_cron_task_core_prune_notifications extends phpbb_cron_task_base
+{
+ protected $config;
+ protected $notification_manager;
+
+ /**
+ * Constructor.
+ *
+ * @param phpbb_config $config The config
+ * @param phpbb_notification_manager $notification_manager Notification manager
+ */
+ public function __construct(phpbb_config $config, phpbb_notification_manager $notification_manager)
+ {
+ $this->config = $config;
+ $this->notification_manager = $notification_manager;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function run()
+ {
+ // time minus expire days in seconds
+ $timestamp = time() - ($this->config['read_notification_expire_days'] * 60 * 60 * 24);
+ $this->notification_manager->prune_notifications($timestamp);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function is_runnable()
+ {
+ return (bool) $this->config['read_notification_expire_days'];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function should_run()
+ {
+ return $this->config['read_notification_last_gc'] < time() - $this->config['read_notification_gc'];
+ }
+}
diff --git a/phpBB/phpbb/cron/task/core/queue.php b/phpBB/phpbb/cron/task/core/queue.php
index 732f9c6bea..cb13df86df 100644
--- a/phpBB/phpbb/cron/task/core/queue.php
+++ b/phpBB/phpbb/cron/task/core/queue.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\cron\task\core;
+
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-class phpbb_cron_task_core_queue extends phpbb_cron_task_base
+class queue extends \phpbb\cron\task\base
{
protected $phpbb_root_path;
protected $php_ext;
@@ -31,9 +33,9 @@ class phpbb_cron_task_core_queue extends phpbb_cron_task_base
*
* @param string $phpbb_root_path The root path
* @param string $php_ext The PHP extension
- * @param phpbb_config $config The config
+ * @param \phpbb\config\config $config The config
*/
- public function __construct($phpbb_root_path, $php_ext, phpbb_config $config)
+ public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
@@ -51,7 +53,7 @@ class phpbb_cron_task_core_queue extends phpbb_cron_task_base
{
include($this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext);
}
- $queue = new queue();
+ $queue = new \queue();
$queue->process();
}
diff --git a/phpBB/phpbb/cron/task/core/tidy_cache.php b/phpBB/phpbb/cron/task/core/tidy_cache.php
index 16a45dae7c..021d5fd8a3 100644
--- a/phpBB/phpbb/cron/task/core/tidy_cache.php
+++ b/phpBB/phpbb/cron/task/core/tidy_cache.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\cron\task\core;
+
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-class phpbb_cron_task_core_tidy_cache extends phpbb_cron_task_base
+class tidy_cache extends \phpbb\cron\task\base
{
protected $config;
protected $cache;
@@ -28,10 +30,10 @@ class phpbb_cron_task_core_tidy_cache extends phpbb_cron_task_base
/**
* Constructor.
*
- * @param phpbb_config $config The config
- * @param phpbb_cache_driver_interface $cache The cache driver
+ * @param \phpbb\config\config $config The config
+ * @param \phpbb\cache\driver\driver_interface $cache The cache driver
*/
- public function __construct(phpbb_config $config, phpbb_cache_driver_interface $cache)
+ public function __construct(\phpbb\config\config $config, \phpbb\cache\driver\driver_interface $cache)
{
$this->config = $config;
$this->cache = $cache;
diff --git a/phpBB/phpbb/cron/task/core/tidy_database.php b/phpBB/phpbb/cron/task/core/tidy_database.php
index b882e7b500..d03cba1d86 100644
--- a/phpBB/phpbb/cron/task/core/tidy_database.php
+++ b/phpBB/phpbb/cron/task/core/tidy_database.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\cron\task\core;
+
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-class phpbb_cron_task_core_tidy_database extends phpbb_cron_task_base
+class tidy_database extends \phpbb\cron\task\base
{
protected $phpbb_root_path;
protected $php_ext;
@@ -31,9 +33,9 @@ class phpbb_cron_task_core_tidy_database extends phpbb_cron_task_base
*
* @param string $phpbb_root_path The root path
* @param string $php_ext The PHP extension
- * @param phpbb_config $config The config
+ * @param \phpbb\config\config $config The config
*/
- public function __construct($phpbb_root_path, $php_ext, phpbb_config $config)
+ public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
diff --git a/phpBB/phpbb/cron/task/core/tidy_search.php b/phpBB/phpbb/cron/task/core/tidy_search.php
index a3d5b7dbd2..ebd0d86cbc 100644
--- a/phpBB/phpbb/cron/task/core/tidy_search.php
+++ b/phpBB/phpbb/cron/task/core/tidy_search.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\cron\task\core;
+
/**
* @ignore
*/
@@ -22,7 +24,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base
+class tidy_search extends \phpbb\cron\task\base
{
protected $phpbb_root_path;
protected $php_ext;
@@ -36,12 +38,12 @@ class phpbb_cron_task_core_tidy_search extends phpbb_cron_task_base
*
* @param string $phpbb_root_path The root path
* @param string $php_ext The PHP extension
- * @param phpbb_auth $auth The auth
- * @param phpbb_config $config The config
- * @param phpbb_db_driver $db The db connection
- * @param phpbb_user $user The user
+ * @param \phpbb\auth\auth $auth The auth
+ * @param \phpbb\config\config $config The config
+ * @param \phpbb\db\driver\driver $db The db connection
+ * @param \phpbb\user $user The user
*/
- public function __construct($phpbb_root_path, $php_ext, phpbb_auth $auth, phpbb_config $config, phpbb_db_driver $db, phpbb_user $user)
+ public function __construct($phpbb_root_path, $php_ext, \phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\user $user)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
diff --git a/phpBB/phpbb/cron/task/core/tidy_sessions.php b/phpBB/phpbb/cron/task/core/tidy_sessions.php
index 95f55235c9..5df019ae46 100644
--- a/phpBB/phpbb/cron/task/core/tidy_sessions.php
+++ b/phpBB/phpbb/cron/task/core/tidy_sessions.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\cron\task\core;
+
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-class phpbb_cron_task_core_tidy_sessions extends phpbb_cron_task_base
+class tidy_sessions extends \phpbb\cron\task\base
{
protected $config;
protected $user;
@@ -28,10 +30,10 @@ class phpbb_cron_task_core_tidy_sessions extends phpbb_cron_task_base
/**
* Constructor.
*
- * @param phpbb_config $config The config
- * @param phpbb_user $user The user
+ * @param \phpbb\config\config $config The config
+ * @param \phpbb\user $user The user
*/
- public function __construct(phpbb_config $config, phpbb_user $user)
+ public function __construct(\phpbb\config\config $config, \phpbb\user $user)
{
$this->config = $config;
$this->user = $user;
diff --git a/phpBB/phpbb/cron/task/core/tidy_warnings.php b/phpBB/phpbb/cron/task/core/tidy_warnings.php
index 2a7798e56e..1cc0abbe88 100644
--- a/phpBB/phpbb/cron/task/core/tidy_warnings.php
+++ b/phpBB/phpbb/cron/task/core/tidy_warnings.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\cron\task\core;
+
/**
* @ignore
*/
@@ -22,7 +24,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-class phpbb_cron_task_core_tidy_warnings extends phpbb_cron_task_base
+class tidy_warnings extends \phpbb\cron\task\base
{
protected $phpbb_root_path;
protected $php_ext;
@@ -33,9 +35,9 @@ class phpbb_cron_task_core_tidy_warnings extends phpbb_cron_task_base
*
* @param string $phpbb_root_path The root path
* @param string $php_ext The PHP extension
- * @param phpbb_config $config The config
+ * @param \phpbb\config\config $config The config
*/
- public function __construct($phpbb_root_path, $php_ext, phpbb_config $config)
+ public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
diff --git a/phpBB/phpbb/cron/task/parametrized.php b/phpBB/phpbb/cron/task/parametrized.php
index 5f0e46eafc..1d2f449c58 100644
--- a/phpBB/phpbb/cron/task/parametrized.php
+++ b/phpBB/phpbb/cron/task/parametrized.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\cron\task;
+
/**
* @ignore
*/
@@ -26,7 +28,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-interface phpbb_cron_task_parametrized extends phpbb_cron_task
+interface parametrized extends \phpbb\cron\task\task
{
/**
* Returns parameters of this cron task as an array.
@@ -39,14 +41,14 @@ interface phpbb_cron_task_parametrized extends phpbb_cron_task
/**
* Parses parameters found in $request, which is an instance of
- * phpbb_request_interface.
+ * \phpbb\request\request_interface.
*
* $request contains user input and must not be trusted.
* Cron task must validate all data before using it.
*
- * @param phpbb_request_interface $request Request object.
+ * @param \phpbb\request\request_interface $request Request object.
*
* @return null
*/
- public function parse_parameters(phpbb_request_interface $request);
+ public function parse_parameters(\phpbb\request\request_interface $request);
}
diff --git a/phpBB/phpbb/cron/task/task.php b/phpBB/phpbb/cron/task/task.php
index 2d585df96d..84218c4fc9 100644
--- a/phpBB/phpbb/cron/task/task.php
+++ b/phpBB/phpbb/cron/task/task.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\cron\task;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* Cron task interface
* @package phpBB3
*/
-interface phpbb_cron_task
+interface task
{
/**
* Returns the name of the task.
diff --git a/phpBB/phpbb/cron/task/wrapper.php b/phpBB/phpbb/cron/task/wrapper.php
index 386fb5b383..aa015966c6 100644
--- a/phpBB/phpbb/cron/task/wrapper.php
+++ b/phpBB/phpbb/cron/task/wrapper.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\cron\task;
+
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-class phpbb_cron_task_wrapper
+class wrapper
{
protected $task;
protected $phpbb_root_path;
@@ -32,9 +34,9 @@ class phpbb_cron_task_wrapper
*
* Wraps a task $task, which must implement cron_task interface.
*
- * @param phpbb_cron_task $task The cron task to wrap.
+ * @param \phpbb\cron\task\task $task The cron task to wrap.
*/
- public function __construct(phpbb_cron_task $task, $phpbb_root_path, $php_ext)
+ public function __construct(\phpbb\cron\task\task $task, $phpbb_root_path, $php_ext)
{
$this->task = $task;
$this->phpbb_root_path = $phpbb_root_path;
@@ -51,7 +53,7 @@ class phpbb_cron_task_wrapper
*/
public function is_parametrized()
{
- return $this->task instanceof phpbb_cron_task_parametrized;
+ return $this->task instanceof \phpbb\cron\task\parametrized;
}
/**
diff --git a/phpBB/phpbb/datetime.php b/phpBB/phpbb/datetime.php
index 3c6d4971b9..84b13202af 100644
--- a/phpBB/phpbb/datetime.php
+++ b/phpBB/phpbb/datetime.php
@@ -6,11 +6,13 @@
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*/
+namespace phpbb;
+
/**
* phpBB custom extensions to the PHP DateTime class
* This handles the relative formats phpBB employs
*/
-class phpbb_datetime extends DateTime
+class datetime extends \DateTime
{
/**
* String used to wrap the date segment which should be replaced by today/tomorrow/yesterday
@@ -28,14 +30,14 @@ class phpbb_datetime extends DateTime
static protected $format_cache = array();
/**
- * Constructs a new instance of phpbb_datetime, expanded to include an argument to inject
+ * Constructs a new instance of \phpbb\datetime, expanded to include an argument to inject
* the user context and modify the timezone to the users selected timezone if one is not set.
*
* @param string $time String in a format accepted by strtotime().
* @param DateTimeZone $timezone Time zone of the time.
* @param user User object for context.
*/
- public function __construct($user, $time = 'now', DateTimeZone $timezone = null)
+ public function __construct($user, $time = 'now', \DateTimeZone $timezone = null)
{
$this->user = $user;
$timezone = $timezone ?: $this->user->timezone;
diff --git a/phpBB/phpbb/db/driver/driver.php b/phpBB/phpbb/db/driver/driver.php
index 08c966c07a..53d39e9127 100644
--- a/phpBB/phpbb/db/driver/driver.php
+++ b/phpBB/phpbb/db/driver/driver.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\db\driver;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* Database Abstraction Layer
* @package dbal
*/
-class phpbb_db_driver
+class driver
{
var $db_connect_id;
var $query_result;
@@ -82,7 +84,7 @@ class phpbb_db_driver
// Fill default sql layer based on the class being called.
// This can be changed by the specified layer itself later if needed.
- $this->sql_layer = substr(get_class($this), strlen('phpbb_db_driver_'));
+ $this->sql_layer = substr(get_class($this), strlen('phpbb\db\driver\\'));
// Do not change this please! This variable is used to easy the use of it - and is hardcoded.
$this->any_char = chr(0) . '%';
diff --git a/phpBB/phpbb/db/driver/firebird.php b/phpBB/phpbb/db/driver/firebird.php
index 787c28b812..2df5eaf369 100644
--- a/phpBB/phpbb/db/driver/firebird.php
+++ b/phpBB/phpbb/db/driver/firebird.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\db\driver;
+
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
* Minimum Requirement is Firebird 2.1
* @package dbal
*/
-class phpbb_db_driver_firebird extends phpbb_db_driver
+class firebird extends \phpbb\db\driver\driver
{
var $last_query_text = '';
var $service_handle = false;
diff --git a/phpBB/phpbb/db/driver/mssql.php b/phpBB/phpbb/db/driver/mssql.php
index 89c2c2351b..4d2cd287da 100644
--- a/phpBB/phpbb/db/driver/mssql.php
+++ b/phpBB/phpbb/db/driver/mssql.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\db\driver;
+
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
* Minimum Requirement is MSSQL 2000+
* @package dbal
*/
-class phpbb_db_driver_mssql extends phpbb_db_driver
+class mssql extends \phpbb\db\driver\driver
{
var $connect_error = '';
diff --git a/phpBB/phpbb/db/driver/mssql_base.php b/phpBB/phpbb/db/driver/mssql_base.php
index 56c111c871..57c4e0f1fd 100644
--- a/phpBB/phpbb/db/driver/mssql_base.php
+++ b/phpBB/phpbb/db/driver/mssql_base.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\db\driver;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* MSSQL Database Base Abstraction Layer
* @package dbal
*/
-abstract class phpbb_db_driver_mssql_base extends phpbb_db_driver
+abstract class mssql_base extends \phpbb\db\driver\driver
{
/**
* {@inheritDoc}
diff --git a/phpBB/phpbb/db/driver/mssql_odbc.php b/phpBB/phpbb/db/driver/mssql_odbc.php
index a1d1a5d5dd..9db34a69fb 100644
--- a/phpBB/phpbb/db/driver/mssql_odbc.php
+++ b/phpBB/phpbb/db/driver/mssql_odbc.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\db\driver;
+
/**
* @ignore
*/
@@ -26,7 +28,7 @@ if (!defined('IN_PHPBB'))
*
* @package dbal
*/
-class phpbb_db_driver_mssql_odbc extends phpbb_db_driver_mssql_base
+class mssql_odbc extends \phpbb\db\driver\mssql_base
{
var $last_query_text = '';
var $connect_error = '';
diff --git a/phpBB/phpbb/db/driver/mssqlnative.php b/phpBB/phpbb/db/driver/mssqlnative.php
index 28fc88298a..e6002fe1a3 100644
--- a/phpBB/phpbb/db/driver/mssqlnative.php
+++ b/phpBB/phpbb/db/driver/mssqlnative.php
@@ -11,6 +11,8 @@
*
*/
+namespace phpbb\db\driver;
+
/**
* @ignore
*/
@@ -56,7 +58,7 @@ class result_mssqlnative
{
if (is_array($value))
{
- $obj->$key = new stdClass();
+ $obj->$key = new \stdClass();
array_to_obj($value, $obj->$key);
}
else
@@ -191,7 +193,7 @@ class result_mssqlnative
/**
* @package dbal
*/
-class phpbb_db_driver_mssqlnative extends phpbb_db_driver_mssql_base
+class mssqlnative extends \phpbb\db\driver\mssql_base
{
var $m_insert_id = NULL;
var $last_query_text = '';
diff --git a/phpBB/phpbb/db/driver/mysql.php b/phpBB/phpbb/db/driver/mysql.php
index f3744ac09d..c76126763d 100644
--- a/phpBB/phpbb/db/driver/mysql.php
+++ b/phpBB/phpbb/db/driver/mysql.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\db\driver;
+
/**
* @ignore
*/
@@ -24,7 +26,7 @@ if (!defined('IN_PHPBB'))
* MySQL 5.0+
* @package dbal
*/
-class phpbb_db_driver_mysql extends phpbb_db_driver_mysql_base
+class mysql extends \phpbb\db\driver\mysql_base
{
var $multi_insert = true;
var $connect_error = '';
diff --git a/phpBB/phpbb/db/driver/mysql_base.php b/phpBB/phpbb/db/driver/mysql_base.php
index ba44ea61aa..8f2f66674b 100644
--- a/phpBB/phpbb/db/driver/mysql_base.php
+++ b/phpBB/phpbb/db/driver/mysql_base.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\db\driver;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* Abstract MySQL Database Base Abstraction Layer
* @package dbal
*/
-abstract class phpbb_db_driver_mysql_base extends phpbb_db_driver
+abstract class mysql_base extends \phpbb\db\driver\driver
{
/**
* {@inheritDoc}
diff --git a/phpBB/phpbb/db/driver/mysqli.php b/phpBB/phpbb/db/driver/mysqli.php
index 0f7a73ee6e..4d0e43b464 100644
--- a/phpBB/phpbb/db/driver/mysqli.php
+++ b/phpBB/phpbb/db/driver/mysqli.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\db\driver;
+
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
* MySQL 4.1+ or MySQL 5.0+
* @package dbal
*/
-class phpbb_db_driver_mysqli extends phpbb_db_driver_mysql_base
+class mysqli extends \phpbb\db\driver\mysql_base
{
var $multi_insert = true;
var $connect_error = '';
diff --git a/phpBB/phpbb/db/driver/oracle.php b/phpBB/phpbb/db/driver/oracle.php
index e21e07055d..5dfab21455 100644
--- a/phpBB/phpbb/db/driver/oracle.php
+++ b/phpBB/phpbb/db/driver/oracle.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\db\driver;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* Oracle Database Abstraction Layer
* @package dbal
*/
-class phpbb_db_driver_oracle extends phpbb_db_driver
+class oracle extends \phpbb\db\driver\driver
{
var $last_query_text = '';
var $connect_error = '';
diff --git a/phpBB/phpbb/db/driver/postgres.php b/phpBB/phpbb/db/driver/postgres.php
index 14854d179d..7a98b90c73 100644
--- a/phpBB/phpbb/db/driver/postgres.php
+++ b/phpBB/phpbb/db/driver/postgres.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\db\driver;
+
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
* Minimum Requirement is Version 7.3+
* @package dbal
*/
-class phpbb_db_driver_postgres extends phpbb_db_driver
+class postgres extends \phpbb\db\driver\driver
{
var $last_query_text = '';
var $connect_error = '';
@@ -84,7 +86,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver
$this->connect_error = 'pg_pconnect function does not exist, is pgsql extension installed?';
return $this->sql_error('');
}
- $collector = new phpbb_error_collector;
+ $collector = new \phpbb\error_collector;
$collector->install();
$this->db_connect_id = (!$new_link) ? @pg_pconnect($connect_string) : @pg_pconnect($connect_string, PGSQL_CONNECT_FORCE_NEW);
}
@@ -95,7 +97,7 @@ class phpbb_db_driver_postgres extends phpbb_db_driver
$this->connect_error = 'pg_connect function does not exist, is pgsql extension installed?';
return $this->sql_error('');
}
- $collector = new phpbb_error_collector;
+ $collector = new \phpbb\error_collector;
$collector->install();
$this->db_connect_id = (!$new_link) ? @pg_connect($connect_string) : @pg_connect($connect_string, PGSQL_CONNECT_FORCE_NEW);
}
diff --git a/phpBB/phpbb/db/driver/sqlite.php b/phpBB/phpbb/db/driver/sqlite.php
index 7188f0daa2..a548fd2618 100644
--- a/phpBB/phpbb/db/driver/sqlite.php
+++ b/phpBB/phpbb/db/driver/sqlite.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\db\driver;
+
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
* Minimum Requirement: 2.8.2+
* @package dbal
*/
-class phpbb_db_driver_sqlite extends phpbb_db_driver
+class sqlite extends \phpbb\db\driver\driver
{
var $connect_error = '';
diff --git a/phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php b/phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php
index f324b8880d..5e6ba90336 100644
--- a/phpBB/phpbb/db/migration/data/30x/local_url_bbcode.php
+++ b/phpBB/phpbb/db/migration/data/v30x/local_url_bbcode.php
@@ -7,11 +7,13 @@
*
*/
-class phpbb_db_migration_data_30x_local_url_bbcode extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class local_url_bbcode extends \phpbb\db\migration\migration
{
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_12_rc1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_12_rc1');
}
public function update_data()
@@ -44,7 +46,7 @@ class phpbb_db_migration_data_30x_local_url_bbcode extends phpbb_db_migration
$bbcode_match = $row['bbcode_match'];
$bbcode_tpl = $row['bbcode_tpl'];
- $acp_bbcodes = new acp_bbcodes();
+ $acp_bbcodes = new \acp_bbcodes();
$sql_ary = $acp_bbcodes->build_regexp($bbcode_match, $bbcode_tpl);
$sql = 'UPDATE ' . BBCODES_TABLE . '
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_1.php
index c5b1681d96..aed0f2784b 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_1.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_1 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_1_rc1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_1_rc1');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_10.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10.php
index 640fcbc16f..305309c3bd 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_10.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_10 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_10 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_10 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_10_rc3');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_10_rc3');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc1.php
index e0aca09c3a..fb50d67fb5 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc1.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_10_rc1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_10_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_10_rc1 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_9');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_9');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc2.php
index 394e030acf..63ba1e8fc2 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc2.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc2.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_10_rc2 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_10_rc2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_10_rc2 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_10_rc1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_10_rc1');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc3.php
index 92900e3aed..7055063032 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_10_rc3.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_10_rc3.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_10_rc3 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_10_rc3 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_10_rc3 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_10_rc2');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_10_rc2');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_11.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11.php
index 3be03cec40..1246597efb 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_11.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_11 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_11 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_11 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_11_rc2');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_11_rc2');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc1.php
index f7b0247fdb..7e284235e1 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_11_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc1.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_11_rc1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_11_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_11_rc1 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_10');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_10');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc2.php
index 204aa314ac..017038855d 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_11_rc2.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_11_rc2.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_11_rc2 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_11_rc2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_11_rc2 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_11_rc1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_11_rc1');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc1.php
index 31d37afa48..35a3015959 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_12_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_12_rc1.php
@@ -7,18 +7,20 @@
*
*/
+namespace phpbb\db\migration\data\v30x;
+
/** @todo DROP LOGIN_ATTEMPT_TABLE.attempt_id in 3.0.12-RC1 **/
-class phpbb_db_migration_data_30x_3_0_12_rc1 extends phpbb_db_migration
+class release_3_0_12_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
return phpbb_version_compare($this->config['version'], '3.0.12-RC1', '>=');
}
- static public function depends_on()
+ static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_11');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_11');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_1_rc1.php
index 984b8fb37e..862276528d 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_1_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_1_rc1.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_1_rc1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_1_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2.php
index 6e11e5a145..7e2a08590e 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_2.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_2 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_2 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_2_rc2');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_2_rc2');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc1.php
index 9a25628f25..7a856383e2 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_2_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc1.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_2_rc1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_2_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_2_rc1 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_1');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc2.php
index 6c37d6701b..61562575eb 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_2_rc2.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_2_rc2.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_2_rc2 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_2_rc2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_2_rc2 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_2_rc1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_2_rc1');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_3.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_3.php
index 11fd2a2e80..b2adbeaa43 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_3.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_3.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_3 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_3 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_3 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_3_rc1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_3_rc1');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_3_rc1.php
index cbeb00499a..57bd59bba3 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_3_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_3_rc1.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_3_rc1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_3_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_3_rc1 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_2');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_2');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_4.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4.php
index 4375a96dac..5d6140393b 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_4.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_4 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_4 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_4 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_4_rc1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_4_rc1');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php
index 73334dcc6f..a8af4dd76c 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_4_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_4_rc1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_4_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_4_rc1 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_3');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_3');
}
public function update_schema()
@@ -82,7 +84,7 @@ class phpbb_db_migration_data_30x_3_0_4_rc1 extends phpbb_db_migration
public function update_custom_profile_fields()
{
- // Update the Custom Profile Fields based on previous settings to the new format
+ // Update the Custom Profile Fields based on previous settings to the new \format
$sql = 'SELECT field_id, field_required, field_show_on_reg, field_hide
FROM ' . PROFILE_FIELDS_TABLE;
$result = $this->db->sql_query($sql);
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_5.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5.php
index 2700274f35..7bbe7ffed9 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_5.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_5 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_5 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_5 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_5_rc1part2');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_5_rc1part2');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php
index 90c6b3b46a..ffe2c6a44d 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_5_rc1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_5_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_5_rc1 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_4');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_4');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1part2.php
index 2d1e5cfed8..04b14b5189 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_5_rc1part2.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_5_rc1part2.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_5_rc1part2 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_5_rc1part2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_5_rc1part2 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_5_rc1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_5_rc1');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6.php
index 1877b0c5a1..85ea2e9d20 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_6.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_6 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_6 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_6 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_6_rc4');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_6_rc4');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php
index 3e2a9544c7..87d5e490f8 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc1.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_6_rc1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_6_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc1 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_5');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_5');
}
public function update_schema()
@@ -318,7 +320,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc1 extends phpbb_db_migration
// Clear permissions...
include_once($this->phpbb_root_path . 'includes/acp/auth.' . $this->php_ext);
- $auth_admin = new auth_admin();
+ $auth_admin = new \auth_admin();
$auth_admin->acl_clear_prefetch();
}
}
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc2.php
index 439e25b100..7a0ef28601 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc2.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc2.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_6_rc2 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_6_rc2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc2 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_6_rc1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_6_rc1');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc3.php
index 77b62d7fc7..73a1fe9e6a 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc3.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc3.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_6_rc3 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_6_rc3 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc3 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_6_rc2');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_6_rc2');
}
public function update_data()
@@ -30,7 +32,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc3 extends phpbb_db_migration
public function update_cp_fields()
{
- // Update the Custom Profile Fields based on previous settings to the new format
+ // Update the Custom Profile Fields based on previous settings to the new \format
$sql = 'UPDATE ' . PROFILE_FIELDS_TABLE . '
SET field_show_on_vt = 1
WHERE field_hide = 0
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc4.php
index 61a31d09e6..b6e5be2c2f 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_6_rc4.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_6_rc4.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_6_rc4 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_6_rc4 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_6_rc4 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_6_rc3');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_6_rc3');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_7.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7.php
index 3eb1caddbc..2b0da30bc6 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_7.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_7 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_7 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_7 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_7_rc2');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_7_rc2');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_pl1.php
index c7b5c584ac..3547ee77e1 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_7_pl1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_pl1.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_7_pl1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_7_pl1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_7_pl1 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_7');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_7');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc1.php
index e0fd313834..de4d772808 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_7_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc1.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_7_rc1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_7_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_7_rc1 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_6');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_6');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc2.php
index f4f3327385..800803a753 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_7_rc2.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_7_rc2.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_7_rc2 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_7_rc2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_7_rc2 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_7_rc1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_7_rc1');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_8.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_8.php
index 77771a9acd..6c8b1df6fc 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_8.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_8.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_8 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_8 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_8 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_8_rc1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_8_rc1');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php
index c534cabb6c..1a14e5c961 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_8_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_8_rc1.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_8_rc1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_8_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_8_rc1 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_7_pl1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_7_pl1');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9.php
index 6a38793269..9af2fce971 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_9.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_9 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_9 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_9 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_9_rc4');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_9_rc4');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php
index 81c67550bd..3fb790bc0d 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc1.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc1.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_9_rc1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_9_rc1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc1 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_8');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_8');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc2.php
index 1531f408b7..cd79d24ade 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc2.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc2.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_9_rc2 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_9_rc2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc2 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_9_rc1');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_9_rc1');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc3.php
index 851680b093..7e59b8f9e8 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc3.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc3.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_9_rc3 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_9_rc3 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc3 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_9_rc2');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_9_rc2');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc4.php
index 879538c341..e71d9defa6 100644
--- a/phpBB/phpbb/db/migration/data/30x/3_0_9_rc4.php
+++ b/phpBB/phpbb/db/migration/data/v30x/release_3_0_9_rc4.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_30x_3_0_9_rc4 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v30x;
+
+class release_3_0_9_rc4 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_30x_3_0_9_rc4 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_9_rc3');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_9_rc3');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/v310/auth_provider_oauth.php b/phpBB/phpbb/db/migration/data/v310/auth_provider_oauth.php
new file mode 100644
index 0000000000..971a7e8504
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/auth_provider_oauth.php
@@ -0,0 +1,73 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+namespace phpbb\db\migration\data\v310;
+
+class auth_provider_oauth extends \phpbb\db\migration\migration
+{
+ public function effectively_installed()
+ {
+ return $this->db_tools->sql_table_exists($this->table_prefix . 'auth_provider_oauth');
+ }
+
+ public function update_schema()
+ {
+ return array(
+ 'add_tables' => array(
+ $this->table_prefix . 'oauth_tokens' => array(
+ 'COLUMNS' => array(
+ 'user_id' => array('UINT', 0), // phpbb_users.user_id
+ 'session_id' => array('CHAR:32', ''), // phpbb_sessions.session_id used only when user_id not set
+ 'provider' => array('VCHAR', ''), // Name of the OAuth provider
+ 'oauth_token' => array('MTEXT', ''), // Serialized token
+ ),
+ 'KEYS' => array(
+ 'user_id' => array('INDEX', 'user_id'),
+ 'provider' => array('INDEX', 'provider'),
+ ),
+ ),
+ $this->table_prefix . 'oauth_accounts' => array(
+ 'COLUMNS' => array(
+ 'user_id' => array('UINT', 0),
+ 'provider' => array('VCHAR', ''),
+ 'oauth_provider_id' => array('TEXT_UNI', ''),
+ ),
+ 'PRIMARY_KEY' => array(
+ 'user_id',
+ 'provider',
+ ),
+ ),
+ ),
+ );
+ }
+
+ public function revert_schema()
+ {
+ return array(
+ 'drop_tables' => array(
+ $this->table_prefix . 'oauth_tokens',
+ $this->table_prefix . 'oauth_accounts',
+ ),
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('module.add', array(
+ 'ucp',
+ 'UCP_PROFILE',
+ array(
+ 'module_basename' => 'ucp_auth_link',
+ 'modes' => array('auth_link'),
+ ),
+ )),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/310/avatars.php b/phpBB/phpbb/db/migration/data/v310/avatars.php
index 79547337f7..80ce606f29 100644
--- a/phpBB/phpbb/db/migration/data/310/avatars.php
+++ b/phpBB/phpbb/db/migration/data/v310/avatars.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_avatars extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class avatars extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_avatars extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_11');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_11');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/310/boardindex.php b/phpBB/phpbb/db/migration/data/v310/boardindex.php
index 965e32c15c..27492f2d0d 100644
--- a/phpBB/phpbb/db/migration/data/310/boardindex.php
+++ b/phpBB/phpbb/db/migration/data/v310/boardindex.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_boardindex extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class boardindex extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
diff --git a/phpBB/phpbb/db/migration/data/310/config_db_text.php b/phpBB/phpbb/db/migration/data/v310/config_db_text.php
index 89f211adda..1a7ee7a9a6 100644
--- a/phpBB/phpbb/db/migration/data/310/config_db_text.php
+++ b/phpBB/phpbb/db/migration/data/v310/config_db_text.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_config_db_text extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class config_db_text extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_config_db_text extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_11');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_11');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/310/dev.php b/phpBB/phpbb/db/migration/data/v310/dev.php
index 0fc2950987..c1db883616 100644
--- a/phpBB/phpbb/db/migration/data/310/dev.php
+++ b/phpBB/phpbb/db/migration/data/v310/dev.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_dev extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class dev extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -17,10 +19,10 @@ class phpbb_db_migration_data_310_dev extends phpbb_db_migration
static public function depends_on()
{
return array(
- 'phpbb_db_migration_data_310_extensions',
- 'phpbb_db_migration_data_310_style_update_p2',
- 'phpbb_db_migration_data_310_timezone_p2',
- 'phpbb_db_migration_data_310_reported_posts_display',
+ '\phpbb\db\migration\data\v310\extensions',
+ '\phpbb\db\migration\data\v310\style_update_p2',
+ '\phpbb\db\migration\data\v310\timezone_p2',
+ '\phpbb\db\migration\data\v310\reported_posts_display',
);
}
@@ -206,7 +208,7 @@ class phpbb_db_migration_data_310_dev extends phpbb_db_migration
{
include($this->phpbb_root_path . 'includes/functions_acp.' . $this->php_ext);
}
- $module_manager = new acp_modules();
+ $module_manager = new \acp_modules();
$module_manager->module_class = 'acp';
$module_manager->move_module($language_module_id, $language_management_module_id);
}
diff --git a/phpBB/phpbb/db/migration/data/310/extensions.php b/phpBB/phpbb/db/migration/data/v310/extensions.php
index 6a9caa1cfc..d8b38dbc9e 100644
--- a/phpBB/phpbb/db/migration/data/310/extensions.php
+++ b/phpBB/phpbb/db/migration/data/v310/extensions.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_extensions extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class extensions extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_extensions extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_11');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_11');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/310/forgot_password.php b/phpBB/phpbb/db/migration/data/v310/forgot_password.php
index a553e51f35..814093caa9 100644
--- a/phpBB/phpbb/db/migration/data/310/forgot_password.php
+++ b/phpBB/phpbb/db/migration/data/v310/forgot_password.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_forgot_password extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class forgot_password extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_forgot_password extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_11');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_11');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/310/jquery_update.php b/phpBB/phpbb/db/migration/data/v310/jquery_update.php
index dc49f74fcb..bd2de2b4d4 100644
--- a/phpBB/phpbb/db/migration/data/310/jquery_update.php
+++ b/phpBB/phpbb/db/migration/data/v310/jquery_update.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_jquery_update extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class jquery_update extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -17,7 +19,7 @@ class phpbb_db_migration_data_310_jquery_update extends phpbb_db_migration
static public function depends_on()
{
return array(
- 'phpbb_db_migration_data_310_dev',
+ '\phpbb\db\migration\data\v310\dev',
);
}
diff --git a/phpBB/phpbb/db/migration/data/v310/mod_rewrite.php b/phpBB/phpbb/db/migration/data/v310/mod_rewrite.php
new file mode 100644
index 0000000000..ffb790b135
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/mod_rewrite.php
@@ -0,0 +1,27 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+namespace phpbb\db\migration\data\v310;
+
+class mod_rewrite extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v310\dev',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.add', array('enable_mod_rewrite', '0')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v310/namespaces.php b/phpBB/phpbb/db/migration/data/v310/namespaces.php
new file mode 100644
index 0000000000..9b182f88b8
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/namespaces.php
@@ -0,0 +1,30 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2012 phpBB Group
+* @license http://opensource.org/licenses/gpl-license.php GNU Public License v2
+*
+*/
+
+namespace phpbb\db\migration\data\v310;
+
+class namespaces extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v310\dev',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('if', array(
+ (preg_match('#^phpbb_search_#', $this->config['search_type'])),
+ array('config.update', array('search_type', str_replace('phpbb_search_', 'phpbb\\search\\', $this->config['search_type']))),
+ )),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php b/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php
index d994d7ec5f..bd7614e1c2 100644
--- a/phpBB/phpbb/db/migration/data/310/notification_options_reconvert.php
+++ b/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php
@@ -7,11 +7,13 @@
*
*/
-class phpbb_db_migration_data_310_notification_options_reconvert extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class notification_options_reconvert extends \phpbb\db\migration\migration
{
static public function depends_on()
{
- return array('phpbb_db_migration_data_310_notifications_schema_fix');
+ return array('\phpbb\db\migration\data\v310\notifications_schema_fix');
}
public function update_data()
@@ -24,7 +26,7 @@ class phpbb_db_migration_data_310_notification_options_reconvert extends phpbb_d
public function convert_notifications()
{
$insert_table = $this->table_prefix . 'user_notifications';
- $insert_buffer = new phpbb_db_sql_insert_buffer($this->db, $insert_table);
+ $insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, $insert_table);
$this->perform_conversion($insert_buffer, $insert_table);
}
@@ -32,10 +34,10 @@ class phpbb_db_migration_data_310_notification_options_reconvert extends phpbb_d
/**
* Perform the conversion (separate for testability)
*
- * @param phpbb_db_sql_insert_buffer $insert_buffer
+ * @param \phpbb\db\sql_insert_buffer $insert_buffer
* @param string $insert_table
*/
- public function perform_conversion(phpbb_db_sql_insert_buffer $insert_buffer, $insert_table)
+ public function perform_conversion(\phpbb\db\sql_insert_buffer $insert_buffer, $insert_table)
{
$sql = 'DELETE FROM ' . $insert_table;
$this->db->sql_query($sql);
@@ -94,13 +96,13 @@ class phpbb_db_migration_data_310_notification_options_reconvert extends phpbb_d
/**
* Insert method rows to DB
*
- * @param phpbb_db_sql_insert_buffer $insert_buffer
+ * @param \phpbb\db\sql_insert_buffer $insert_buffer
* @param string $item_type
* @param int $item_id
* @param int $user_id
* @param string $methods
*/
- protected function add_method_rows(phpbb_db_sql_insert_buffer $insert_buffer, $item_type, $item_id, $user_id, array $methods)
+ protected function add_method_rows(\phpbb\db\sql_insert_buffer $insert_buffer, $item_type, $item_id, $user_id, array $methods)
{
$row_base = array(
'item_type' => $item_type,
diff --git a/phpBB/phpbb/db/migration/data/310/notifications.php b/phpBB/phpbb/db/migration/data/v310/notifications.php
index 17c939d95a..10f1392094 100644
--- a/phpBB/phpbb/db/migration/data/310/notifications.php
+++ b/phpBB/phpbb/db/migration/data/v310/notifications.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_notifications extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class notifications extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_notifications extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_310_dev');
+ return array('\phpbb\db\migration\data\v310\dev');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/v310/notifications_cron.php b/phpBB/phpbb/db/migration/data/v310/notifications_cron.php
new file mode 100644
index 0000000000..d5fa9c58a5
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/notifications_cron.php
@@ -0,0 +1,27 @@
+<?php
+/**
+*
+* @package migration
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+namespace phpbb\db\migration\data\v310;
+
+class notifications_cron extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array('\phpbb\db\migration\data\v310\notifications');
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.add', array('read_notification_expire_days', 30)),
+ array('config.add', array('read_notification_last_gc', 0)), // last run
+ array('config.add', array('read_notification_gc', (60 * 60 * 24))), // seconds between run; 1 day
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/310/notifications_schema_fix.php b/phpBB/phpbb/db/migration/data/v310/notifications_schema_fix.php
index 27e63e10d0..8ed626d8a6 100644
--- a/phpBB/phpbb/db/migration/data/310/notifications_schema_fix.php
+++ b/phpBB/phpbb/db/migration/data/v310/notifications_schema_fix.php
@@ -7,11 +7,13 @@
*
*/
-class phpbb_db_migration_data_310_notifications_schema_fix extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class notifications_schema_fix extends \phpbb\db\migration\migration
{
static public function depends_on()
{
- return array('phpbb_db_migration_data_310_notifications');
+ return array('\phpbb\db\migration\data\v310\notifications');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/310/reported_posts_display.php b/phpBB/phpbb/db/migration/data/v310/reported_posts_display.php
index 80a0a0e43f..56b7a0916c 100644
--- a/phpBB/phpbb/db/migration/data/310/reported_posts_display.php
+++ b/phpBB/phpbb/db/migration/data/v310/reported_posts_display.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_reported_posts_display extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class reported_posts_display extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_reported_posts_display extends phpbb_db_migrat
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_11');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_11');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/310/signature_module_auth.php b/phpBB/phpbb/db/migration/data/v310/signature_module_auth.php
index 02cd70059a..a85e0be01c 100644
--- a/phpBB/phpbb/db/migration/data/310/signature_module_auth.php
+++ b/phpBB/phpbb/db/migration/data/v310/signature_module_auth.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_signature_module_auth extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class signature_module_auth extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -25,7 +27,7 @@ class phpbb_db_migration_data_310_signature_module_auth extends phpbb_db_migrati
static public function depends_on()
{
- return array('phpbb_db_migration_data_31x_dev');
+ return array('\phpbb\db\migration\data\v31x\dev');
}
public function update_data()
diff --git a/phpBB/phpbb/db/migration/data/310/softdelete_mcp_modules.php b/phpBB/phpbb/db/migration/data/v310/softdelete_mcp_modules.php
index f80f55d19a..2db9780601 100644
--- a/phpBB/phpbb/db/migration/data/310/softdelete_mcp_modules.php
+++ b/phpBB/phpbb/db/migration/data/v310/softdelete_mcp_modules.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_softdelete_mcp_modules extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class softdelete_mcp_modules extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -26,8 +28,8 @@ class phpbb_db_migration_data_310_softdelete_mcp_modules extends phpbb_db_migrat
static public function depends_on()
{
return array(
- 'phpbb_db_migration_data_310_dev',
- 'phpbb_db_migration_data_310_softdelete_p2',
+ 'phpbb\db\migration\data\v310\dev',
+ 'phpbb\db\migration\data\v310\softdelete_p2',
);
}
diff --git a/phpBB/phpbb/db/migration/data/310/softdelete_p1.php b/phpBB/phpbb/db/migration/data/v310/softdelete_p1.php
index 84f8eebd4a..0418d5cc2b 100644
--- a/phpBB/phpbb/db/migration/data/310/softdelete_p1.php
+++ b/phpBB/phpbb/db/migration/data/v310/softdelete_p1.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_softdelete_p1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class softdelete_p1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_softdelete_p1 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_310_dev');
+ return array('\phpbb\db\migration\data\v310\dev');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/310/softdelete_p2.php b/phpBB/phpbb/db/migration/data/v310/softdelete_p2.php
index 7320a2c2bf..0c32e474f4 100644
--- a/phpBB/phpbb/db/migration/data/310/softdelete_p2.php
+++ b/phpBB/phpbb/db/migration/data/v310/softdelete_p2.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_softdelete_p2 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class softdelete_p2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -17,8 +19,8 @@ class phpbb_db_migration_data_310_softdelete_p2 extends phpbb_db_migration
static public function depends_on()
{
return array(
- 'phpbb_db_migration_data_310_dev',
- 'phpbb_db_migration_data_310_softdelete_p1',
+ '\phpbb\db\migration\data\v310\dev',
+ '\phpbb\db\migration\data\v310\softdelete_p1',
);
}
diff --git a/phpBB/phpbb/db/migration/data/310/style_update_p1.php b/phpBB/phpbb/db/migration/data/v310/style_update_p1.php
index d43537559d..26f1046287 100644
--- a/phpBB/phpbb/db/migration/data/310/style_update_p1.php
+++ b/phpBB/phpbb/db/migration/data/v310/style_update_p1.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_style_update_p1 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class style_update_p1 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_style_update_p1 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_11');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_11');
}
public function update_schema()
@@ -59,7 +61,7 @@ class phpbb_db_migration_data_310_style_update_p1 extends phpbb_db_migration
// Get list of valid 3.1 styles
$available_styles = array('prosilver');
- $iterator = new DirectoryIterator($this->phpbb_root_path . 'styles');
+ $iterator = new \DirectoryIterator($this->phpbb_root_path . 'styles');
$skip_dirs = array('.', '..', 'prosilver');
foreach ($iterator as $fileinfo)
{
diff --git a/phpBB/phpbb/db/migration/data/310/style_update_p2.php b/phpBB/phpbb/db/migration/data/v310/style_update_p2.php
index 7b10518a66..202a8409fb 100644
--- a/phpBB/phpbb/db/migration/data/310/style_update_p2.php
+++ b/phpBB/phpbb/db/migration/data/v310/style_update_p2.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_style_update_p2 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class style_update_p2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_style_update_p2 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_310_style_update_p1');
+ return array('\phpbb\db\migration\data\v310\style_update_p1');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/310/teampage.php b/phpBB/phpbb/db/migration/data/v310/teampage.php
index 4e77da17b7..80cc4be1c0 100644
--- a/phpBB/phpbb/db/migration/data/310/teampage.php
+++ b/phpBB/phpbb/db/migration/data/v310/teampage.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_teampage extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class teampage extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_teampage extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_310_dev');
+ return array('\phpbb\db\migration\data\v310\dev');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/310/timezone.php b/phpBB/phpbb/db/migration/data/v310/timezone.php
index 6e50cbe45f..dd0c6a2093 100644
--- a/phpBB/phpbb/db/migration/data/310/timezone.php
+++ b/phpBB/phpbb/db/migration/data/v310/timezone.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_timezone extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class timezone extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_timezone extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_30x_3_0_11');
+ return array('\phpbb\db\migration\data\v30x\release_3_0_11');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/data/310/timezone_p2.php b/phpBB/phpbb/db/migration/data/v310/timezone_p2.php
index 113b979e4f..1066ab8571 100644
--- a/phpBB/phpbb/db/migration/data/310/timezone_p2.php
+++ b/phpBB/phpbb/db/migration/data/v310/timezone_p2.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_db_migration_data_310_timezone_p2 extends phpbb_db_migration
+namespace phpbb\db\migration\data\v310;
+
+class timezone_p2 extends \phpbb\db\migration\migration
{
public function effectively_installed()
{
@@ -16,7 +18,7 @@ class phpbb_db_migration_data_310_timezone_p2 extends phpbb_db_migration
static public function depends_on()
{
- return array('phpbb_db_migration_data_310_timezone');
+ return array('\phpbb\db\migration\data\v310\timezone');
}
public function update_schema()
diff --git a/phpBB/phpbb/db/migration/exception.php b/phpBB/phpbb/db/migration/exception.php
index e84330dd71..58e29b5218 100644
--- a/phpBB/phpbb/db/migration/exception.php
+++ b/phpBB/phpbb/db/migration/exception.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\db\migration;
+
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
*
* @package db
*/
-class phpbb_db_migration_exception extends \Exception
+class exception extends \Exception
{
/**
* Extra parameters sent to exception to aid in debugging
@@ -64,12 +66,12 @@ class phpbb_db_migration_exception extends \Exception
}
/**
- * Get localised message (with $user->lang())
- *
- * @param phpbb_user $user
+ * Get localised message (with $user->lang())
+ *
+ * @param \phpbb\user $user
* @return string
*/
- public function getLocalisedMessage(phpbb_user $user)
+ public function getLocalisedMessage(\phpbb\user $user)
{
$parameters = $this->getParameters();
array_unshift($parameters, $this->getMessage());
diff --git a/phpBB/phpbb/db/migration/migration.php b/phpBB/phpbb/db/migration/migration.php
index 0ffa96fd14..aff3837279 100644
--- a/phpBB/phpbb/db/migration/migration.php
+++ b/phpBB/phpbb/db/migration/migration.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\db\migration;
+
/**
* @ignore
*/
@@ -24,15 +26,15 @@ if (!defined('IN_PHPBB'))
*
* @package db
*/
-abstract class phpbb_db_migration
+abstract class migration
{
- /** @var phpbb_config */
+ /** @var \phpbb\config\config */
protected $config;
- /** @var phpbb_db_driver */
+ /** @var \phpbb\db\driver\driver */
protected $db;
- /** @var phpbb_db_tools */
+ /** @var \phpbb\db\tools */
protected $db_tools;
/** @var string */
@@ -53,14 +55,14 @@ abstract class phpbb_db_migration
/**
* Constructor
*
- * @param phpbb_config $config
- * @param phpbb_db_driver $db
- * @param phpbb_db_tools $db_tools
+ * @param \phpbb\config\config $config
+ * @param \phpbb\db\driver\driver $db
+ * @param \phpbb\db\tools $db_tools
* @param string $phpbb_root_path
* @param string $php_ext
* @param string $table_prefix
*/
- public function __construct(phpbb_config $config, phpbb_db_driver $db, phpbb_db_tools $db_tools, $phpbb_root_path, $php_ext, $table_prefix)
+ public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\db\tools $db_tools, $phpbb_root_path, $php_ext, $table_prefix)
{
$this->config = $config;
$this->db = $db;
diff --git a/phpBB/phpbb/db/migration/tool/config.php b/phpBB/phpbb/db/migration/tool/config.php
index 0b626bf455..f2149dc59a 100644
--- a/phpBB/phpbb/db/migration/tool/config.php
+++ b/phpBB/phpbb/db/migration/tool/config.php
@@ -7,22 +7,24 @@
*
*/
+namespace phpbb\db\migration\tool;
+
/**
* Migration config tool
*
* @package db
*/
-class phpbb_db_migration_tool_config implements phpbb_db_migration_tool_interface
+class config implements \phpbb\db\migration\tool\tool_interface
{
- /** @var phpbb_config */
+ /** @var \phpbb\config\config */
protected $config;
/**
* Constructor
*
- * @param phpbb_config $config
+ * @param \phpbb\config\config $config
*/
- public function __construct(phpbb_config $config)
+ public function __construct(\phpbb\config\config $config)
{
$this->config = $config;
}
@@ -67,7 +69,7 @@ class phpbb_db_migration_tool_config implements phpbb_db_migration_tool_interfac
{
if (!isset($this->config[$config_name]))
{
- throw new phpbb_db_migration_exception('CONFIG_NOT_EXIST', $config_name);
+ throw new \phpbb\db\migration\exception('CONFIG_NOT_EXIST', $config_name);
}
$this->config->set($config_name, $config_value);
@@ -88,7 +90,7 @@ class phpbb_db_migration_tool_config implements phpbb_db_migration_tool_interfac
{
if (!isset($this->config[$config_name]))
{
- throw new phpbb_db_migration_exception('CONFIG_NOT_EXIST', $config_name);
+ throw new \phpbb\db\migration\exception('CONFIG_NOT_EXIST', $config_name);
}
$this->config->set_atomic($config_name, $compare, $config_value);
diff --git a/phpBB/phpbb/db/migration/tool/module.php b/phpBB/phpbb/db/migration/tool/module.php
index ac4d2c9bd7..9869dd4230 100644
--- a/phpBB/phpbb/db/migration/tool/module.php
+++ b/phpBB/phpbb/db/migration/tool/module.php
@@ -7,20 +7,22 @@
*
*/
+namespace phpbb\db\migration\tool;
+
/**
* Migration module management tool
*
* @package db
*/
-class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interface
+class module implements \phpbb\db\migration\tool\tool_interface
{
- /** @var phpbb_cache_service */
+ /** @var \phpbb\cache\service */
protected $cache;
/** @var dbal */
protected $db;
- /** @var phpbb_user */
+ /** @var \phpbb\user */
protected $user;
/** @var string */
@@ -35,14 +37,14 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
/**
* Constructor
*
- * @param phpbb_db_driver $db
+ * @param \phpbb\db\driver\driver $db
* @param mixed $cache
- * @param phpbb_user $user
+ * @param \phpbb\user $user
* @param string $phpbb_root_path
* @param string $php_ext
* @param string $modules_table
*/
- public function __construct(phpbb_db_driver $db, phpbb_cache_service $cache, phpbb_user $user, $phpbb_root_path, $php_ext, $modules_table)
+ public function __construct(\phpbb\db\driver\driver $db, \phpbb\cache\service $cache, \phpbb\user $user, $phpbb_root_path, $php_ext, $modules_table)
{
$this->db = $db;
$this->cache = $cache;
@@ -133,7 +135,7 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
*
* @param string $class The module class(acp|mcp|ucp)
* @param int|string $parent The parent module_id|module_langname (0 for no parent)
- * @param array $data an array of the data on the new module.
+ * @param array $data an array of the data on the new \module.
* This can be setup in two different ways.
* 1. The "manual" way. For inserting a category or one at a time.
* It will be merged with the base array shown a bit below,
@@ -221,14 +223,14 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
if (!$module_id)
{
- throw new phpbb_db_migration_exception('MODULE_NOT_EXIST', $parent);
+ throw new \phpbb\db\migration\exception('MODULE_NOT_EXIST', $parent);
}
$parent = $data['parent_id'] = $module_id;
}
else if (!$this->exists($class, false, $parent))
{
- throw new phpbb_db_migration_exception('MODULE_NOT_EXIST', $parent);
+ throw new \phpbb\db\migration\exception('MODULE_NOT_EXIST', $parent);
}
if ($this->exists($class, $parent, $data['module_langname']))
@@ -241,7 +243,7 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->php_ext);
$this->user->add_lang('acp/modules');
}
- $acp_modules = new acp_modules();
+ $acp_modules = new \acp_modules();
$module_data = array(
'module_enabled' => (isset($data['module_enabled'])) ? $data['module_enabled'] : 1,
@@ -259,7 +261,7 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
if (is_string($result))
{
// Error
- throw new phpbb_db_migration_exception('MODULE_ERROR', $result);
+ throw new \phpbb\db\migration\exception('MODULE_ERROR', $result);
}
else
{
@@ -347,7 +349,7 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
// Failed.
if (!isset($module['module_basename']))
{
- throw new phpbb_db_migration_exception('MODULE_NOT_EXIST');
+ throw new \phpbb\db\migration\exception('MODULE_NOT_EXIST');
}
// Automatic method
@@ -433,7 +435,7 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->php_ext);
$this->user->add_lang('acp/modules');
}
- $acp_modules = new acp_modules();
+ $acp_modules = new \acp_modules();
$acp_modules->module_class = $class;
foreach ($module_ids as $module_id)
@@ -476,7 +478,7 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
}
/**
- * Wrapper for acp_modules::get_module_infos()
+ * Wrapper for \acp_modules::get_module_infos()
*
* @param string $class Module Class
* @param string $basename Module Basename
@@ -488,12 +490,12 @@ class phpbb_db_migration_tool_module implements phpbb_db_migration_tool_interfac
{
include($this->phpbb_root_path . 'includes/acp/acp_modules.' . $this->php_ext);
}
- $acp_modules = new acp_modules();
+ $acp_modules = new \acp_modules();
$module = $acp_modules->get_module_infos($basename, $class, true);
if (empty($module))
{
- throw new phpbb_db_migration_exception('MODULE_INFO_FILE_NOT_EXIST', $class, $basename);
+ throw new \phpbb\db\migration\exception('MODULE_INFO_FILE_NOT_EXIST', $class, $basename);
}
return array_pop($module);
diff --git a/phpBB/phpbb/db/migration/tool/permission.php b/phpBB/phpbb/db/migration/tool/permission.php
index 2f09c0ac72..fd2de9c8fb 100644
--- a/phpBB/phpbb/db/migration/tool/permission.php
+++ b/phpBB/phpbb/db/migration/tool/permission.php
@@ -7,17 +7,19 @@
*
*/
+namespace phpbb\db\migration\tool;
+
/**
* Migration permission management tool
*
* @package db
*/
-class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_interface
+class permission implements \phpbb\db\migration\tool\tool_interface
{
- /** @var phpbb_auth */
+ /** @var \phpbb\auth\auth */
protected $auth;
- /** @var phpbb_cache_service */
+ /** @var \phpbb\cache\service */
protected $cache;
/** @var dbal */
@@ -32,13 +34,13 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte
/**
* Constructor
*
- * @param phpbb_db_driver $db
+ * @param \phpbb\db\driver\driver $db
* @param mixed $cache
- * @param phpbb_auth $auth
+ * @param \phpbb\auth\auth $auth
* @param string $phpbb_root_path
* @param string $php_ext
*/
- public function __construct(phpbb_db_driver $db, phpbb_cache_service $cache, phpbb_auth $auth, $phpbb_root_path, $php_ext)
+ public function __construct(\phpbb\db\driver\driver $db, \phpbb\cache\service $cache, \phpbb\auth\auth $auth, $phpbb_root_path, $php_ext)
{
$this->db = $db;
$this->cache = $cache;
@@ -117,7 +119,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte
{
include($this->phpbb_root_path . 'includes/acp/auth.' . $this->php_ext);
}
- $auth_admin = new auth_admin();
+ $auth_admin = new \auth_admin();
// We have to add a check to see if the !$global (if global, local, and if local, global) permission already exists. If it does, acl_add_option currently has a bug which would break the ACL system, so we are having a work-around here.
if ($this->exists($auth_option, !$global))
@@ -290,7 +292,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte
if (!$role_id)
{
- throw new phpbb_db_migration_exception('ROLE_NOT_EXIST', $old_role_name);
+ throw new \phpbb\db\migration\exception('ROLE_NOT_EXIST', $old_role_name);
}
$sql = 'UPDATE ' . ACL_ROLES_TABLE . "
@@ -380,7 +382,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte
if (!$role_id)
{
- throw new phpbb_db_migration_exception('ROLE_NOT_EXIST', $name);
+ throw new \phpbb\db\migration\exception('ROLE_NOT_EXIST', $name);
}
$sql = 'SELECT auth_option_id, auth_setting
@@ -403,7 +405,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte
if (!$group_id)
{
- throw new phpbb_db_migration_exception('GROUP_NOT_EXIST', $name);
+ throw new \phpbb\db\migration\exception('GROUP_NOT_EXIST', $name);
}
// If the group has a role set for them we will add the requested permissions to that role.
@@ -523,7 +525,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte
if (!$role_id)
{
- throw new phpbb_db_migration_exception('ROLE_NOT_EXIST', $name);
+ throw new \phpbb\db\migration\exception('ROLE_NOT_EXIST', $name);
}
$sql = 'DELETE FROM ' . ACL_ROLES_DATA_TABLE . '
@@ -540,7 +542,7 @@ class phpbb_db_migration_tool_permission implements phpbb_db_migration_tool_inte
if (!$group_id)
{
- throw new phpbb_db_migration_exception('GROUP_NOT_EXIST', $name);
+ throw new \phpbb\db\migration\exception('GROUP_NOT_EXIST', $name);
}
// If the group has a role set for them we will remove the requested permissions from that role.
diff --git a/phpBB/phpbb/db/migration/tool/interface.php b/phpBB/phpbb/db/migration/tool/tool_interface.php
index ced53b2023..e7b89d8858 100644
--- a/phpBB/phpbb/db/migration/tool/interface.php
+++ b/phpBB/phpbb/db/migration/tool/tool_interface.php
@@ -7,12 +7,14 @@
*
*/
+namespace phpbb\db\migration\tool;
+
/**
* Migration tool interface
*
* @package db
*/
-interface phpbb_db_migration_tool_interface
+interface tool_interface
{
/**
* Retrieve a short name used for commands in migrations.
diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php
index ca3ffc8043..d7d2b3df59 100644
--- a/phpBB/phpbb/db/migrator.php
+++ b/phpBB/phpbb/db/migrator.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\db;
+
/**
* @ignore
*/
@@ -20,15 +22,15 @@ if (!defined('IN_PHPBB'))
*
* @package db
*/
-class phpbb_db_migrator
+class migrator
{
- /** @var phpbb_config */
+ /** @var \phpbb\config\config */
protected $config;
- /** @var phpbb_db_driver */
+ /** @var \phpbb\db\driver\driver */
protected $db;
- /** @var phpbb_db_tools */
+ /** @var \phpbb\db\tools */
protected $db_tools;
/** @var string */
@@ -71,7 +73,7 @@ class phpbb_db_migrator
/**
* Constructor of the database migrator
*/
- public function __construct(phpbb_config $config, phpbb_db_driver $db, phpbb_db_tools $db_tools, $migrations_table, $phpbb_root_path, $php_ext, $table_prefix, $tools)
+ public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\db\tools $db_tools, $migrations_table, $phpbb_root_path, $php_ext, $table_prefix, $tools)
{
$this->config = $config;
$this->db = $db;
@@ -240,7 +242,7 @@ class phpbb_db_migrator
$state['migration_data_done'] = ($result === true);
$state['migration_end_time'] = ($result === true) ? time() : 0;
}
- catch (phpbb_db_migration_exception $e)
+ catch (\phpbb\db\migration\exception $e)
{
// Revert the schema changes
$this->revert($name);
@@ -398,7 +400,7 @@ class phpbb_db_migrator
));
}
}
- catch (phpbb_db_migration_exception $e)
+ catch (\phpbb\db\migration\exception $e)
{
// We should try rolling back here
foreach ($steps as $reverse_step_identifier => $reverse_step)
@@ -474,12 +476,12 @@ class phpbb_db_migrator
case 'if':
if (!isset($parameters[0]))
{
- throw new phpbb_db_migration_exception('MIGRATION_INVALID_DATA_MISSING_CONDITION', $step);
+ throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_MISSING_CONDITION', $step);
}
if (!isset($parameters[1]))
{
- throw new phpbb_db_migration_exception('MIGRATION_INVALID_DATA_MISSING_STEP', $step);
+ throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_MISSING_STEP', $step);
}
$condition = $parameters[0];
@@ -496,7 +498,7 @@ class phpbb_db_migrator
case 'custom':
if (!is_callable($parameters[0]))
{
- throw new phpbb_db_migration_exception('MIGRATION_INVALID_DATA_CUSTOM_NOT_CALLABLE', $step);
+ throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_CUSTOM_NOT_CALLABLE', $step);
}
return array(
@@ -508,17 +510,17 @@ class phpbb_db_migrator
default:
if (!$method)
{
- throw new phpbb_db_migration_exception('MIGRATION_INVALID_DATA_UNKNOWN_TYPE', $step);
+ throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_UNKNOWN_TYPE', $step);
}
if (!isset($this->tools[$class]))
{
- throw new phpbb_db_migration_exception('MIGRATION_INVALID_DATA_UNDEFINED_TOOL', $step);
+ throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_UNDEFINED_TOOL', $step);
}
if (!method_exists(get_class($this->tools[$class]), $method))
{
- throw new phpbb_db_migration_exception('MIGRATION_INVALID_DATA_UNDEFINED_METHOD', $step);
+ throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_UNDEFINED_METHOD', $step);
}
// Attempt to reverse operations
@@ -656,7 +658,7 @@ class phpbb_db_migrator
* Helper to get a migration
*
* @param string $name Name of the migration
- * @return phpbb_db_migration
+ * @return \phpbb\db\migration\migration
*/
protected function get_migration($name)
{
@@ -694,7 +696,7 @@ class phpbb_db_migrator
/**
* Load migration data files from a directory
*
- * @param phpbb_extension_finder $finder
+ * @param \phpbb\extension\finder $finder
* @param string $path Path to migration data files
* @param bool $check_fulfillable If TRUE (default), we will check
* if all of the migrations are fulfillable after loading them.
@@ -703,11 +705,11 @@ class phpbb_db_migrator
* with the last call to prevent throwing errors unnecessarily).
* @return array Array of migration names
*/
- public function load_migrations(phpbb_extension_finder $finder, $path, $check_fulfillable = true)
+ public function load_migrations(\phpbb\extension\finder $finder, $path, $check_fulfillable = true)
{
if (!is_dir($path))
{
- throw new phpbb_db_migration_exception('DIRECTORY INVALID', $path);
+ throw new \phpbb\db\migration\exception('DIRECTORY INVALID', $path);
}
$migrations = array();
@@ -736,7 +738,7 @@ class phpbb_db_migrator
$unfulfillable = $this->unfulfillable($name);
if ($unfulfillable !== false)
{
- throw new phpbb_db_migration_exception('MIGRATION_NOT_FULFILLABLE', $name, $unfulfillable);
+ throw new \phpbb\db\migration\exception('MIGRATION_NOT_FULFILLABLE', $name, $unfulfillable);
}
}
}
diff --git a/phpBB/phpbb/db/sql_insert_buffer.php b/phpBB/phpbb/db/sql_insert_buffer.php
index c18f908429..7bbd213bdc 100644
--- a/phpBB/phpbb/db/sql_insert_buffer.php
+++ b/phpBB/phpbb/db/sql_insert_buffer.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\db;
+
/**
* @ignore
*/
@@ -38,7 +40,7 @@ if (!defined('IN_PHPBB'))
*
* Usage:
* <code>
-* $buffer = new phpbb_db_sql_insert_buffer($db, 'test_table', 1234);
+* $buffer = new \phpbb\db\sql_insert_buffer($db, 'test_table', 1234);
*
* while (do_stuff())
* {
@@ -53,9 +55,9 @@ if (!defined('IN_PHPBB'))
*
* @package dbal
*/
-class phpbb_db_sql_insert_buffer
+class sql_insert_buffer
{
- /** @var phpbb_db_driver */
+ /** @var \phpbb\db\driver\driver */
protected $db;
/** @var string */
@@ -68,11 +70,11 @@ class phpbb_db_sql_insert_buffer
protected $buffer = array();
/**
- * @param phpbb_db_driver $db
+ * @param \phpbb\db\driver\driver $db
* @param string $table_name
* @param int $max_buffered_rows
*/
- public function __construct(phpbb_db_driver $db, $table_name, $max_buffered_rows = 500)
+ public function __construct(\phpbb\db\driver\driver $db, $table_name, $max_buffered_rows = 500)
{
$this->db = $db;
$this->table_name = $table_name;
diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php
index 492284ffcd..1f156fbb04 100644
--- a/phpBB/phpbb/db/tools.php
+++ b/phpBB/phpbb/db/tools.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\db;
+
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package dbal
*/
-class phpbb_db_tools
+class tools
{
/**
* Current sql layer
@@ -37,247 +39,257 @@ class phpbb_db_tools
* The Column types for every database we support
* @var array
*/
- var $dbms_type_map = array(
- 'mysql_41' => array(
- 'INT:' => 'int(%d)',
- 'BINT' => 'bigint(20)',
- 'UINT' => 'mediumint(8) UNSIGNED',
- 'UINT:' => 'int(%d) UNSIGNED',
- 'TINT:' => 'tinyint(%d)',
- 'USINT' => 'smallint(4) UNSIGNED',
- 'BOOL' => 'tinyint(1) UNSIGNED',
- 'VCHAR' => 'varchar(255)',
- 'VCHAR:' => 'varchar(%d)',
- 'CHAR:' => 'char(%d)',
- 'XSTEXT' => 'text',
- 'XSTEXT_UNI'=> 'varchar(100)',
- 'STEXT' => 'text',
- 'STEXT_UNI' => 'varchar(255)',
- 'TEXT' => 'text',
- 'TEXT_UNI' => 'text',
- 'MTEXT' => 'mediumtext',
- 'MTEXT_UNI' => 'mediumtext',
- 'TIMESTAMP' => 'int(11) UNSIGNED',
- 'DECIMAL' => 'decimal(5,2)',
- 'DECIMAL:' => 'decimal(%d,2)',
- 'PDECIMAL' => 'decimal(6,3)',
- 'PDECIMAL:' => 'decimal(%d,3)',
- 'VCHAR_UNI' => 'varchar(255)',
- 'VCHAR_UNI:'=> 'varchar(%d)',
- 'VCHAR_CI' => 'varchar(255)',
- 'VARBINARY' => 'varbinary(255)',
- ),
-
- 'mysql_40' => array(
- 'INT:' => 'int(%d)',
- 'BINT' => 'bigint(20)',
- 'UINT' => 'mediumint(8) UNSIGNED',
- 'UINT:' => 'int(%d) UNSIGNED',
- 'TINT:' => 'tinyint(%d)',
- 'USINT' => 'smallint(4) UNSIGNED',
- 'BOOL' => 'tinyint(1) UNSIGNED',
- 'VCHAR' => 'varbinary(255)',
- 'VCHAR:' => 'varbinary(%d)',
- 'CHAR:' => 'binary(%d)',
- 'XSTEXT' => 'blob',
- 'XSTEXT_UNI'=> 'blob',
- 'STEXT' => 'blob',
- 'STEXT_UNI' => 'blob',
- 'TEXT' => 'blob',
- 'TEXT_UNI' => 'blob',
- 'MTEXT' => 'mediumblob',
- 'MTEXT_UNI' => 'mediumblob',
- 'TIMESTAMP' => 'int(11) UNSIGNED',
- 'DECIMAL' => 'decimal(5,2)',
- 'DECIMAL:' => 'decimal(%d,2)',
- 'PDECIMAL' => 'decimal(6,3)',
- 'PDECIMAL:' => 'decimal(%d,3)',
- 'VCHAR_UNI' => 'blob',
- 'VCHAR_UNI:'=> array('varbinary(%d)', 'limit' => array('mult', 3, 255, 'blob')),
- 'VCHAR_CI' => 'blob',
- 'VARBINARY' => 'varbinary(255)',
- ),
-
- 'firebird' => array(
- 'INT:' => 'INTEGER',
- 'BINT' => 'DOUBLE PRECISION',
- 'UINT' => 'INTEGER',
- 'UINT:' => 'INTEGER',
- 'TINT:' => 'INTEGER',
- 'USINT' => 'INTEGER',
- 'BOOL' => 'INTEGER',
- 'VCHAR' => 'VARCHAR(255) CHARACTER SET NONE',
- 'VCHAR:' => 'VARCHAR(%d) CHARACTER SET NONE',
- 'CHAR:' => 'CHAR(%d) CHARACTER SET NONE',
- 'XSTEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE',
- 'STEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE',
- 'TEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE',
- 'MTEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE',
- 'XSTEXT_UNI'=> 'VARCHAR(100) CHARACTER SET UTF8',
- 'STEXT_UNI' => 'VARCHAR(255) CHARACTER SET UTF8',
- 'TEXT_UNI' => 'BLOB SUB_TYPE TEXT CHARACTER SET UTF8',
- 'MTEXT_UNI' => 'BLOB SUB_TYPE TEXT CHARACTER SET UTF8',
- 'TIMESTAMP' => 'INTEGER',
- 'DECIMAL' => 'DOUBLE PRECISION',
- 'DECIMAL:' => 'DOUBLE PRECISION',
- 'PDECIMAL' => 'DOUBLE PRECISION',
- 'PDECIMAL:' => 'DOUBLE PRECISION',
- 'VCHAR_UNI' => 'VARCHAR(255) CHARACTER SET UTF8',
- 'VCHAR_UNI:'=> 'VARCHAR(%d) CHARACTER SET UTF8',
- 'VCHAR_CI' => 'VARCHAR(255) CHARACTER SET UTF8',
- 'VARBINARY' => 'CHAR(255) CHARACTER SET NONE',
- ),
-
- 'mssql' => array(
- 'INT:' => '[int]',
- 'BINT' => '[float]',
- 'UINT' => '[int]',
- 'UINT:' => '[int]',
- 'TINT:' => '[int]',
- 'USINT' => '[int]',
- 'BOOL' => '[int]',
- 'VCHAR' => '[varchar] (255)',
- 'VCHAR:' => '[varchar] (%d)',
- 'CHAR:' => '[char] (%d)',
- 'XSTEXT' => '[varchar] (1000)',
- 'STEXT' => '[varchar] (3000)',
- 'TEXT' => '[varchar] (8000)',
- 'MTEXT' => '[text]',
- 'XSTEXT_UNI'=> '[varchar] (100)',
- 'STEXT_UNI' => '[varchar] (255)',
- 'TEXT_UNI' => '[varchar] (4000)',
- 'MTEXT_UNI' => '[text]',
- 'TIMESTAMP' => '[int]',
- 'DECIMAL' => '[float]',
- 'DECIMAL:' => '[float]',
- 'PDECIMAL' => '[float]',
- 'PDECIMAL:' => '[float]',
- 'VCHAR_UNI' => '[varchar] (255)',
- 'VCHAR_UNI:'=> '[varchar] (%d)',
- 'VCHAR_CI' => '[varchar] (255)',
- 'VARBINARY' => '[varchar] (255)',
- ),
-
- 'mssqlnative' => array(
- 'INT:' => '[int]',
- 'BINT' => '[float]',
- 'UINT' => '[int]',
- 'UINT:' => '[int]',
- 'TINT:' => '[int]',
- 'USINT' => '[int]',
- 'BOOL' => '[int]',
- 'VCHAR' => '[varchar] (255)',
- 'VCHAR:' => '[varchar] (%d)',
- 'CHAR:' => '[char] (%d)',
- 'XSTEXT' => '[varchar] (1000)',
- 'STEXT' => '[varchar] (3000)',
- 'TEXT' => '[varchar] (8000)',
- 'MTEXT' => '[text]',
- 'XSTEXT_UNI'=> '[varchar] (100)',
- 'STEXT_UNI' => '[varchar] (255)',
- 'TEXT_UNI' => '[varchar] (4000)',
- 'MTEXT_UNI' => '[text]',
- 'TIMESTAMP' => '[int]',
- 'DECIMAL' => '[float]',
- 'DECIMAL:' => '[float]',
- 'PDECIMAL' => '[float]',
- 'PDECIMAL:' => '[float]',
- 'VCHAR_UNI' => '[varchar] (255)',
- 'VCHAR_UNI:'=> '[varchar] (%d)',
- 'VCHAR_CI' => '[varchar] (255)',
- 'VARBINARY' => '[varchar] (255)',
- ),
-
- 'oracle' => array(
- 'INT:' => 'number(%d)',
- 'BINT' => 'number(20)',
- 'UINT' => 'number(8)',
- 'UINT:' => 'number(%d)',
- 'TINT:' => 'number(%d)',
- 'USINT' => 'number(4)',
- 'BOOL' => 'number(1)',
- 'VCHAR' => 'varchar2(255)',
- 'VCHAR:' => 'varchar2(%d)',
- 'CHAR:' => 'char(%d)',
- 'XSTEXT' => 'varchar2(1000)',
- 'STEXT' => 'varchar2(3000)',
- 'TEXT' => 'clob',
- 'MTEXT' => 'clob',
- 'XSTEXT_UNI'=> 'varchar2(300)',
- 'STEXT_UNI' => 'varchar2(765)',
- 'TEXT_UNI' => 'clob',
- 'MTEXT_UNI' => 'clob',
- 'TIMESTAMP' => 'number(11)',
- 'DECIMAL' => 'number(5, 2)',
- 'DECIMAL:' => 'number(%d, 2)',
- 'PDECIMAL' => 'number(6, 3)',
- 'PDECIMAL:' => 'number(%d, 3)',
- 'VCHAR_UNI' => 'varchar2(765)',
- 'VCHAR_UNI:'=> array('varchar2(%d)', 'limit' => array('mult', 3, 765, 'clob')),
- 'VCHAR_CI' => 'varchar2(255)',
- 'VARBINARY' => 'raw(255)',
- ),
-
- 'sqlite' => array(
- 'INT:' => 'int(%d)',
- 'BINT' => 'bigint(20)',
- 'UINT' => 'INTEGER UNSIGNED', //'mediumint(8) UNSIGNED',
- 'UINT:' => 'INTEGER UNSIGNED', // 'int(%d) UNSIGNED',
- 'TINT:' => 'tinyint(%d)',
- 'USINT' => 'INTEGER UNSIGNED', //'mediumint(4) UNSIGNED',
- 'BOOL' => 'INTEGER UNSIGNED', //'tinyint(1) UNSIGNED',
- 'VCHAR' => 'varchar(255)',
- 'VCHAR:' => 'varchar(%d)',
- 'CHAR:' => 'char(%d)',
- 'XSTEXT' => 'text(65535)',
- 'STEXT' => 'text(65535)',
- 'TEXT' => 'text(65535)',
- 'MTEXT' => 'mediumtext(16777215)',
- 'XSTEXT_UNI'=> 'text(65535)',
- 'STEXT_UNI' => 'text(65535)',
- 'TEXT_UNI' => 'text(65535)',
- 'MTEXT_UNI' => 'mediumtext(16777215)',
- 'TIMESTAMP' => 'INTEGER UNSIGNED', //'int(11) UNSIGNED',
- 'DECIMAL' => 'decimal(5,2)',
- 'DECIMAL:' => 'decimal(%d,2)',
- 'PDECIMAL' => 'decimal(6,3)',
- 'PDECIMAL:' => 'decimal(%d,3)',
- 'VCHAR_UNI' => 'varchar(255)',
- 'VCHAR_UNI:'=> 'varchar(%d)',
- 'VCHAR_CI' => 'varchar(255)',
- 'VARBINARY' => 'blob',
- ),
-
- 'postgres' => array(
- 'INT:' => 'INT4',
- 'BINT' => 'INT8',
- 'UINT' => 'INT4', // unsigned
- 'UINT:' => 'INT4', // unsigned
- 'USINT' => 'INT2', // unsigned
- 'BOOL' => 'INT2', // unsigned
- 'TINT:' => 'INT2',
- 'VCHAR' => 'varchar(255)',
- 'VCHAR:' => 'varchar(%d)',
- 'CHAR:' => 'char(%d)',
- 'XSTEXT' => 'varchar(1000)',
- 'STEXT' => 'varchar(3000)',
- 'TEXT' => 'varchar(8000)',
- 'MTEXT' => 'TEXT',
- 'XSTEXT_UNI'=> 'varchar(100)',
- 'STEXT_UNI' => 'varchar(255)',
- 'TEXT_UNI' => 'varchar(4000)',
- 'MTEXT_UNI' => 'TEXT',
- 'TIMESTAMP' => 'INT4', // unsigned
- 'DECIMAL' => 'decimal(5,2)',
- 'DECIMAL:' => 'decimal(%d,2)',
- 'PDECIMAL' => 'decimal(6,3)',
- 'PDECIMAL:' => 'decimal(%d,3)',
- 'VCHAR_UNI' => 'varchar(255)',
- 'VCHAR_UNI:'=> 'varchar(%d)',
- 'VCHAR_CI' => 'varchar_ci',
- 'VARBINARY' => 'bytea',
- ),
- );
+ var $dbms_type_map = array();
+
+ /**
+ * Get the column types for every database we support
+ *
+ * @return array
+ */
+ public static function get_dbms_type_map()
+ {
+ return array(
+ 'mysql_41' => array(
+ 'INT:' => 'int(%d)',
+ 'BINT' => 'bigint(20)',
+ 'UINT' => 'mediumint(8) UNSIGNED',
+ 'UINT:' => 'int(%d) UNSIGNED',
+ 'TINT:' => 'tinyint(%d)',
+ 'USINT' => 'smallint(4) UNSIGNED',
+ 'BOOL' => 'tinyint(1) UNSIGNED',
+ 'VCHAR' => 'varchar(255)',
+ 'VCHAR:' => 'varchar(%d)',
+ 'CHAR:' => 'char(%d)',
+ 'XSTEXT' => 'text',
+ 'XSTEXT_UNI'=> 'varchar(100)',
+ 'STEXT' => 'text',
+ 'STEXT_UNI' => 'varchar(255)',
+ 'TEXT' => 'text',
+ 'TEXT_UNI' => 'text',
+ 'MTEXT' => 'mediumtext',
+ 'MTEXT_UNI' => 'mediumtext',
+ 'TIMESTAMP' => 'int(11) UNSIGNED',
+ 'DECIMAL' => 'decimal(5,2)',
+ 'DECIMAL:' => 'decimal(%d,2)',
+ 'PDECIMAL' => 'decimal(6,3)',
+ 'PDECIMAL:' => 'decimal(%d,3)',
+ 'VCHAR_UNI' => 'varchar(255)',
+ 'VCHAR_UNI:'=> 'varchar(%d)',
+ 'VCHAR_CI' => 'varchar(255)',
+ 'VARBINARY' => 'varbinary(255)',
+ ),
+
+ 'mysql_40' => array(
+ 'INT:' => 'int(%d)',
+ 'BINT' => 'bigint(20)',
+ 'UINT' => 'mediumint(8) UNSIGNED',
+ 'UINT:' => 'int(%d) UNSIGNED',
+ 'TINT:' => 'tinyint(%d)',
+ 'USINT' => 'smallint(4) UNSIGNED',
+ 'BOOL' => 'tinyint(1) UNSIGNED',
+ 'VCHAR' => 'varbinary(255)',
+ 'VCHAR:' => 'varbinary(%d)',
+ 'CHAR:' => 'binary(%d)',
+ 'XSTEXT' => 'blob',
+ 'XSTEXT_UNI'=> 'blob',
+ 'STEXT' => 'blob',
+ 'STEXT_UNI' => 'blob',
+ 'TEXT' => 'blob',
+ 'TEXT_UNI' => 'blob',
+ 'MTEXT' => 'mediumblob',
+ 'MTEXT_UNI' => 'mediumblob',
+ 'TIMESTAMP' => 'int(11) UNSIGNED',
+ 'DECIMAL' => 'decimal(5,2)',
+ 'DECIMAL:' => 'decimal(%d,2)',
+ 'PDECIMAL' => 'decimal(6,3)',
+ 'PDECIMAL:' => 'decimal(%d,3)',
+ 'VCHAR_UNI' => 'blob',
+ 'VCHAR_UNI:'=> array('varbinary(%d)', 'limit' => array('mult', 3, 255, 'blob')),
+ 'VCHAR_CI' => 'blob',
+ 'VARBINARY' => 'varbinary(255)',
+ ),
+
+ 'firebird' => array(
+ 'INT:' => 'INTEGER',
+ 'BINT' => 'DOUBLE PRECISION',
+ 'UINT' => 'INTEGER',
+ 'UINT:' => 'INTEGER',
+ 'TINT:' => 'INTEGER',
+ 'USINT' => 'INTEGER',
+ 'BOOL' => 'INTEGER',
+ 'VCHAR' => 'VARCHAR(255) CHARACTER SET NONE',
+ 'VCHAR:' => 'VARCHAR(%d) CHARACTER SET NONE',
+ 'CHAR:' => 'CHAR(%d) CHARACTER SET NONE',
+ 'XSTEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE',
+ 'STEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE',
+ 'TEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE',
+ 'MTEXT' => 'BLOB SUB_TYPE TEXT CHARACTER SET NONE',
+ 'XSTEXT_UNI'=> 'VARCHAR(100) CHARACTER SET UTF8',
+ 'STEXT_UNI' => 'VARCHAR(255) CHARACTER SET UTF8',
+ 'TEXT_UNI' => 'BLOB SUB_TYPE TEXT CHARACTER SET UTF8',
+ 'MTEXT_UNI' => 'BLOB SUB_TYPE TEXT CHARACTER SET UTF8',
+ 'TIMESTAMP' => 'INTEGER',
+ 'DECIMAL' => 'DOUBLE PRECISION',
+ 'DECIMAL:' => 'DOUBLE PRECISION',
+ 'PDECIMAL' => 'DOUBLE PRECISION',
+ 'PDECIMAL:' => 'DOUBLE PRECISION',
+ 'VCHAR_UNI' => 'VARCHAR(255) CHARACTER SET UTF8',
+ 'VCHAR_UNI:'=> 'VARCHAR(%d) CHARACTER SET UTF8',
+ 'VCHAR_CI' => 'VARCHAR(255) CHARACTER SET UTF8',
+ 'VARBINARY' => 'CHAR(255) CHARACTER SET NONE',
+ ),
+
+ 'mssql' => array(
+ 'INT:' => '[int]',
+ 'BINT' => '[float]',
+ 'UINT' => '[int]',
+ 'UINT:' => '[int]',
+ 'TINT:' => '[int]',
+ 'USINT' => '[int]',
+ 'BOOL' => '[int]',
+ 'VCHAR' => '[varchar] (255)',
+ 'VCHAR:' => '[varchar] (%d)',
+ 'CHAR:' => '[char] (%d)',
+ 'XSTEXT' => '[varchar] (1000)',
+ 'STEXT' => '[varchar] (3000)',
+ 'TEXT' => '[varchar] (8000)',
+ 'MTEXT' => '[text]',
+ 'XSTEXT_UNI'=> '[varchar] (100)',
+ 'STEXT_UNI' => '[varchar] (255)',
+ 'TEXT_UNI' => '[varchar] (4000)',
+ 'MTEXT_UNI' => '[text]',
+ 'TIMESTAMP' => '[int]',
+ 'DECIMAL' => '[float]',
+ 'DECIMAL:' => '[float]',
+ 'PDECIMAL' => '[float]',
+ 'PDECIMAL:' => '[float]',
+ 'VCHAR_UNI' => '[varchar] (255)',
+ 'VCHAR_UNI:'=> '[varchar] (%d)',
+ 'VCHAR_CI' => '[varchar] (255)',
+ 'VARBINARY' => '[varchar] (255)',
+ ),
+
+ 'mssqlnative' => array(
+ 'INT:' => '[int]',
+ 'BINT' => '[float]',
+ 'UINT' => '[int]',
+ 'UINT:' => '[int]',
+ 'TINT:' => '[int]',
+ 'USINT' => '[int]',
+ 'BOOL' => '[int]',
+ 'VCHAR' => '[varchar] (255)',
+ 'VCHAR:' => '[varchar] (%d)',
+ 'CHAR:' => '[char] (%d)',
+ 'XSTEXT' => '[varchar] (1000)',
+ 'STEXT' => '[varchar] (3000)',
+ 'TEXT' => '[varchar] (8000)',
+ 'MTEXT' => '[text]',
+ 'XSTEXT_UNI'=> '[varchar] (100)',
+ 'STEXT_UNI' => '[varchar] (255)',
+ 'TEXT_UNI' => '[varchar] (4000)',
+ 'MTEXT_UNI' => '[text]',
+ 'TIMESTAMP' => '[int]',
+ 'DECIMAL' => '[float]',
+ 'DECIMAL:' => '[float]',
+ 'PDECIMAL' => '[float]',
+ 'PDECIMAL:' => '[float]',
+ 'VCHAR_UNI' => '[varchar] (255)',
+ 'VCHAR_UNI:'=> '[varchar] (%d)',
+ 'VCHAR_CI' => '[varchar] (255)',
+ 'VARBINARY' => '[varchar] (255)',
+ ),
+
+ 'oracle' => array(
+ 'INT:' => 'number(%d)',
+ 'BINT' => 'number(20)',
+ 'UINT' => 'number(8)',
+ 'UINT:' => 'number(%d)',
+ 'TINT:' => 'number(%d)',
+ 'USINT' => 'number(4)',
+ 'BOOL' => 'number(1)',
+ 'VCHAR' => 'varchar2(255)',
+ 'VCHAR:' => 'varchar2(%d)',
+ 'CHAR:' => 'char(%d)',
+ 'XSTEXT' => 'varchar2(1000)',
+ 'STEXT' => 'varchar2(3000)',
+ 'TEXT' => 'clob',
+ 'MTEXT' => 'clob',
+ 'XSTEXT_UNI'=> 'varchar2(300)',
+ 'STEXT_UNI' => 'varchar2(765)',
+ 'TEXT_UNI' => 'clob',
+ 'MTEXT_UNI' => 'clob',
+ 'TIMESTAMP' => 'number(11)',
+ 'DECIMAL' => 'number(5, 2)',
+ 'DECIMAL:' => 'number(%d, 2)',
+ 'PDECIMAL' => 'number(6, 3)',
+ 'PDECIMAL:' => 'number(%d, 3)',
+ 'VCHAR_UNI' => 'varchar2(765)',
+ 'VCHAR_UNI:'=> array('varchar2(%d)', 'limit' => array('mult', 3, 765, 'clob')),
+ 'VCHAR_CI' => 'varchar2(255)',
+ 'VARBINARY' => 'raw(255)',
+ ),
+
+ 'sqlite' => array(
+ 'INT:' => 'int(%d)',
+ 'BINT' => 'bigint(20)',
+ 'UINT' => 'INTEGER UNSIGNED', //'mediumint(8) UNSIGNED',
+ 'UINT:' => 'INTEGER UNSIGNED', // 'int(%d) UNSIGNED',
+ 'TINT:' => 'tinyint(%d)',
+ 'USINT' => 'INTEGER UNSIGNED', //'mediumint(4) UNSIGNED',
+ 'BOOL' => 'INTEGER UNSIGNED', //'tinyint(1) UNSIGNED',
+ 'VCHAR' => 'varchar(255)',
+ 'VCHAR:' => 'varchar(%d)',
+ 'CHAR:' => 'char(%d)',
+ 'XSTEXT' => 'text(65535)',
+ 'STEXT' => 'text(65535)',
+ 'TEXT' => 'text(65535)',
+ 'MTEXT' => 'mediumtext(16777215)',
+ 'XSTEXT_UNI'=> 'text(65535)',
+ 'STEXT_UNI' => 'text(65535)',
+ 'TEXT_UNI' => 'text(65535)',
+ 'MTEXT_UNI' => 'mediumtext(16777215)',
+ 'TIMESTAMP' => 'INTEGER UNSIGNED', //'int(11) UNSIGNED',
+ 'DECIMAL' => 'decimal(5,2)',
+ 'DECIMAL:' => 'decimal(%d,2)',
+ 'PDECIMAL' => 'decimal(6,3)',
+ 'PDECIMAL:' => 'decimal(%d,3)',
+ 'VCHAR_UNI' => 'varchar(255)',
+ 'VCHAR_UNI:'=> 'varchar(%d)',
+ 'VCHAR_CI' => 'varchar(255)',
+ 'VARBINARY' => 'blob',
+ ),
+
+ 'postgres' => array(
+ 'INT:' => 'INT4',
+ 'BINT' => 'INT8',
+ 'UINT' => 'INT4', // unsigned
+ 'UINT:' => 'INT4', // unsigned
+ 'USINT' => 'INT2', // unsigned
+ 'BOOL' => 'INT2', // unsigned
+ 'TINT:' => 'INT2',
+ 'VCHAR' => 'varchar(255)',
+ 'VCHAR:' => 'varchar(%d)',
+ 'CHAR:' => 'char(%d)',
+ 'XSTEXT' => 'varchar(1000)',
+ 'STEXT' => 'varchar(3000)',
+ 'TEXT' => 'varchar(8000)',
+ 'MTEXT' => 'TEXT',
+ 'XSTEXT_UNI'=> 'varchar(100)',
+ 'STEXT_UNI' => 'varchar(255)',
+ 'TEXT_UNI' => 'varchar(4000)',
+ 'MTEXT_UNI' => 'TEXT',
+ 'TIMESTAMP' => 'INT4', // unsigned
+ 'DECIMAL' => 'decimal(5,2)',
+ 'DECIMAL:' => 'decimal(%d,2)',
+ 'PDECIMAL' => 'decimal(6,3)',
+ 'PDECIMAL:' => 'decimal(%d,3)',
+ 'VCHAR_UNI' => 'varchar(255)',
+ 'VCHAR_UNI:'=> 'varchar(%d)',
+ 'VCHAR_CI' => 'varchar_ci',
+ 'VARBINARY' => 'bytea',
+ ),
+ );
+ }
/**
* A list of types being unsigned for better reference in some db's
@@ -300,14 +312,16 @@ class phpbb_db_tools
/**
* Constructor. Set DB Object and set {@link $return_statements return_statements}.
*
- * @param phpbb_db_driver $db Database connection
+ * @param \phpbb\db\driver\driver $db Database connection
* @param bool $return_statements True if only statements should be returned and no SQL being executed
*/
- public function __construct(phpbb_db_driver $db, $return_statements = false)
+ public function __construct(\phpbb\db\driver\driver $db, $return_statements = false)
{
$this->db = $db;
$this->return_statements = $return_statements;
+ $this->dbms_type_map = self::get_dbms_type_map();
+
// Determine mapping database type
switch ($this->db->sql_layer)
{
diff --git a/phpBB/phpbb/di/extension/config.php b/phpBB/phpbb/di/extension/config.php
index 6c272a6588..85b374a3ca 100644
--- a/phpBB/phpbb/di/extension/config.php
+++ b/phpBB/phpbb/di/extension/config.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\di\extension;
+
/**
* @ignore
*/
@@ -23,7 +25,7 @@ use Symfony\Component\Config\FileLocator;
/**
* Container config extension
*/
-class phpbb_di_extension_config extends Extension
+class config extends Extension
{
public function __construct($config_file)
{
@@ -76,7 +78,7 @@ class phpbb_di_extension_config extends Extension
{
if (preg_match('#^[a-z]+$#', $acm_type))
{
- return 'phpbb_cache_driver_'.$acm_type;
+ return '\\phpbb\cache\driver\\'.$acm_type;
}
return $acm_type;
diff --git a/phpBB/phpbb/di/extension/core.php b/phpBB/phpbb/di/extension/core.php
index 9d59a24b7e..1f6b700973 100644
--- a/phpBB/phpbb/di/extension/core.php
+++ b/phpBB/phpbb/di/extension/core.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\di\extension;
+
/**
* @ignore
*/
@@ -23,7 +25,7 @@ use Symfony\Component\Config\FileLocator;
/**
* Container core extension
*/
-class phpbb_di_extension_core extends Extension
+class core extends Extension
{
/**
* Config path
diff --git a/phpBB/phpbb/di/extension/ext.php b/phpBB/phpbb/di/extension/ext.php
index 7d9b433751..cf623a7c87 100644
--- a/phpBB/phpbb/di/extension/ext.php
+++ b/phpBB/phpbb/di/extension/ext.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\di\extension;
+
/**
* @ignore
*/
@@ -23,7 +25,7 @@ use Symfony\Component\Config\FileLocator;
/**
* Container ext extension
*/
-class phpbb_di_extension_ext extends Extension
+class ext extends Extension
{
protected $paths = array();
diff --git a/phpBB/phpbb/di/pass/collection_pass.php b/phpBB/phpbb/di/pass/collection_pass.php
index 63a5c7dfc4..ffc5a41f6d 100644
--- a/phpBB/phpbb/di/pass/collection_pass.php
+++ b/phpBB/phpbb/di/pass/collection_pass.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\di\pass;
+
/**
* @ignore
*/
@@ -23,7 +25,7 @@ use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
* the services tagged with the appropriate name defined in the collection's
* service_collection tag.
*/
-class phpbb_di_pass_collection_pass implements CompilerPassInterface
+class collection_pass implements CompilerPassInterface
{
/**
* Modify the container before it is passed to the rest of the code
diff --git a/phpBB/phpbb/di/pass/kernel_pass.php b/phpBB/phpbb/di/pass/kernel_pass.php
index a701ebcfa6..6a9124ad78 100644
--- a/phpBB/phpbb/di/pass/kernel_pass.php
+++ b/phpBB/phpbb/di/pass/kernel_pass.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\di\pass;
+
/**
* @ignore
*/
@@ -18,7 +20,7 @@ if (!defined('IN_PHPBB'))
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
-class phpbb_di_pass_kernel_pass implements CompilerPassInterface
+class kernel_pass implements CompilerPassInterface
{
/**
* Modify the container before it is passed to the rest of the code
@@ -38,12 +40,12 @@ class phpbb_di_pass_kernel_pass implements CompilerPassInterface
if (!isset($event['event']))
{
- throw new InvalidArgumentException(sprintf('Service "%1$s" must define the "event" attribute on "kernel.event_listener" tags.', $id));
+ throw new \InvalidArgumentException(sprintf('Service "%1$s" must define the "event" attribute on "kernel.event_listener" tags.', $id));
}
if (!isset($event['method']))
{
- throw new InvalidArgumentException(sprintf('Service "%1$s" must define the "method" attribute on "kernel.event_listener" tags.', $id));
+ throw new \InvalidArgumentException(sprintf('Service "%1$s" must define the "method" attribute on "kernel.event_listener" tags.', $id));
}
$definition->addMethodCall('addListenerService', array($event['event'], array($id, $event['method']), $priority));
@@ -55,11 +57,11 @@ class phpbb_di_pass_kernel_pass implements CompilerPassInterface
// We must assume that the class value has been correctly filled, even if the service is created by a factory
$class = $container->getDefinition($id)->getClass();
- $refClass = new ReflectionClass($class);
+ $refClass = new \ReflectionClass($class);
$interface = 'Symfony\Component\EventDispatcher\EventSubscriberInterface';
if (!$refClass->implementsInterface($interface))
{
- throw new InvalidArgumentException(sprintf('Service "%1$s" must implement interface "%2$s".', $id, $interface));
+ throw new \InvalidArgumentException(sprintf('Service "%1$s" must implement interface "%2$s".', $id, $interface));
}
$definition->addMethodCall('addSubscriberService', array($id, $class));
diff --git a/phpBB/phpbb/di/service_collection.php b/phpBB/phpbb/di/service_collection.php
index 880cb46d4d..fccdd77071 100644
--- a/phpBB/phpbb/di/service_collection.php
+++ b/phpBB/phpbb/di/service_collection.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\di;
+
/**
* @ignore
*/
@@ -22,7 +24,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*
* @package phpBB3
*/
-class phpbb_di_service_collection extends ArrayObject
+class service_collection extends \ArrayObject
{
/**
* Constructor
diff --git a/phpBB/phpbb/error_collector.php b/phpBB/phpbb/error_collector.php
index 358da747b8..9b3216e32f 100644
--- a/phpBB/phpbb/error_collector.php
+++ b/phpBB/phpbb/error_collector.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb;
+
/**
* @ignore
*/
@@ -15,11 +17,11 @@ if (!defined('IN_PHPBB'))
exit;
}
-class phpbb_error_collector
+class error_collector
{
var $errors;
- function phpbb_error_collector()
+ function __construct()
{
$this->errors = array();
}
diff --git a/phpBB/phpbb/event/data.php b/phpBB/phpbb/event/data.php
index 70718ff0ae..3481023b74 100644
--- a/phpBB/phpbb/event/data.php
+++ b/phpBB/phpbb/event/data.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\event;
+
/**
* @ignore
*/
@@ -17,7 +19,7 @@ if (!defined('IN_PHPBB'))
use Symfony\Component\EventDispatcher\Event;
-class phpbb_event_data extends Event implements ArrayAccess
+class data extends Event implements \ArrayAccess
{
private $data;
diff --git a/phpBB/phpbb/event/dispatcher.php b/phpBB/phpbb/event/dispatcher.php
index 4f637ce3bb..cc3733692e 100644
--- a/phpBB/phpbb/event/dispatcher.php
+++ b/phpBB/phpbb/event/dispatcher.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\event;
+
/**
* @ignore
*/
@@ -31,11 +33,11 @@ use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher;
* extract($phpbb_dispatcher->trigger_event('core.index', compact($vars)));
*
*/
-class phpbb_event_dispatcher extends ContainerAwareEventDispatcher
+class dispatcher extends ContainerAwareEventDispatcher
{
public function trigger_event($eventName, $data = array())
{
- $event = new phpbb_event_data($data);
+ $event = new \phpbb\event\data($data);
$this->dispatch($eventName, $event);
return $event->get_data_filtered(array_keys($data));
}
diff --git a/phpBB/phpbb/event/extension_subscriber_loader.php b/phpBB/phpbb/event/extension_subscriber_loader.php
index d6284a52fb..ab50a589fe 100644
--- a/phpBB/phpbb/event/extension_subscriber_loader.php
+++ b/phpBB/phpbb/event/extension_subscriber_loader.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\event;
+
/**
* @ignore
*/
@@ -17,12 +19,12 @@ if (!defined('IN_PHPBB'))
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
-class phpbb_event_extension_subscriber_loader
+class extension_subscriber_loader
{
private $dispatcher;
private $extension_manager;
- public function __construct(EventDispatcherInterface $dispatcher, phpbb_extension_manager $extension_manager)
+ public function __construct(EventDispatcherInterface $dispatcher, \phpbb\extension\manager $extension_manager)
{
$this->dispatcher = $dispatcher;
$this->extension_manager = $extension_manager;
diff --git a/phpBB/phpbb/event/kernel_exception_subscriber.php b/phpBB/phpbb/event/kernel_exception_subscriber.php
index f90989a74c..09103680e8 100644
--- a/phpBB/phpbb/event/kernel_exception_subscriber.php
+++ b/phpBB/phpbb/event/kernel_exception_subscriber.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\event;
+
/**
* @ignore
*/
@@ -21,27 +23,27 @@ use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\HttpFoundation\Response;
-class phpbb_event_kernel_exception_subscriber implements EventSubscriberInterface
+class kernel_exception_subscriber implements EventSubscriberInterface
{
/**
* Template object
- * @var phpbb_template
+ * @var \phpbb\template\template
*/
protected $template;
/**
* User object
- * @var phpbb_user
+ * @var \phpbb\user
*/
protected $user;
/**
* Construct method
*
- * @param phpbb_template $template Template object
- * @param phpbb_user $user User object
+ * @param \phpbb\template\template $template Template object
+ * @param \phpbb\user $user User object
*/
- public function __construct(phpbb_template $template, phpbb_user $user)
+ public function __construct(\phpbb\template\template $template, \phpbb\user $user)
{
$this->template = $template;
$this->user = $user;
diff --git a/phpBB/phpbb/event/kernel_request_subscriber.php b/phpBB/phpbb/event/kernel_request_subscriber.php
index afb8464f80..a629dd8440 100644
--- a/phpBB/phpbb/event/kernel_request_subscriber.php
+++ b/phpBB/phpbb/event/kernel_request_subscriber.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\event;
+
/**
* @ignore
*/
@@ -21,11 +23,11 @@ use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\EventListener\RouterListener;
use Symfony\Component\Routing\RequestContext;
-class phpbb_event_kernel_request_subscriber implements EventSubscriberInterface
+class kernel_request_subscriber implements EventSubscriberInterface
{
/**
* Extension finder object
- * @var phpbb_extension_finder
+ * @var \phpbb\extension\finder
*/
protected $finder;
@@ -44,11 +46,11 @@ class phpbb_event_kernel_request_subscriber implements EventSubscriberInterface
/**
* Construct method
*
- * @param phpbb_extension_finder $finder Extension finder object
+ * @param \phpbb\extension\finder $finder Extension finder object
* @param string $root_path Root path
* @param string $php_ext PHP extension
*/
- public function __construct(phpbb_extension_finder $finder, $root_path, $php_ext)
+ public function __construct(\phpbb\extension\finder $finder, $root_path, $php_ext)
{
$this->finder = $finder;
$this->root_path = $root_path;
diff --git a/phpBB/phpbb/event/kernel_terminate_subscriber.php b/phpBB/phpbb/event/kernel_terminate_subscriber.php
index 1eaf890e42..de441da102 100644
--- a/phpBB/phpbb/event/kernel_terminate_subscriber.php
+++ b/phpBB/phpbb/event/kernel_terminate_subscriber.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\event;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Event\PostResponseEvent;
-class phpbb_event_kernel_terminate_subscriber implements EventSubscriberInterface
+class kernel_terminate_subscriber implements EventSubscriberInterface
{
/**
* This listener is run when the KernelEvents::TERMINATE event is triggered
diff --git a/phpBB/phpbb/extension/base.php b/phpBB/phpbb/extension/base.php
index c4462b64d8..a529cc7961 100644
--- a/phpBB/phpbb/extension/base.php
+++ b/phpBB/phpbb/extension/base.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\extension;
+
/**
* @ignore
*/
@@ -22,15 +24,15 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*
* @package extension
*/
-class phpbb_extension_base implements phpbb_extension_interface
+class base implements \phpbb\extension\extension_interface
{
/** @var ContainerInterface */
protected $container;
- /** @var phpbb_extension_finder */
+ /** @var \phpbb\extension\finder */
protected $finder;
- /** @var phpbb_db_migrator */
+ /** @var \phpbb\db\migrator */
protected $migrator;
/** @var string */
@@ -43,11 +45,11 @@ class phpbb_extension_base implements phpbb_extension_interface
* Constructor
*
* @param ContainerInterface $container Container object
- * @param phpbb_extension_finder $extension_finder
+ * @param \phpbb\extension\finder $extension_finder
* @param string $extension_name Name of this extension (from ext.manager)
* @param string $extension_path Relative path to this extension
*/
- public function __construct(ContainerInterface $container, phpbb_extension_finder $extension_finder, phpbb_db_migrator $migrator, $extension_name, $extension_path)
+ public function __construct(ContainerInterface $container, \phpbb\extension\finder $extension_finder, \phpbb\db\migrator $migrator, $extension_name, $extension_path)
{
$this->container = $container;
$this->extension_finder = $extension_finder;
diff --git a/phpBB/phpbb/extension/exception.php b/phpBB/phpbb/extension/exception.php
index e08a8912ea..e2ba647878 100644
--- a/phpBB/phpbb/extension/exception.php
+++ b/phpBB/phpbb/extension/exception.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\extension;
+
/**
* @ignore
*/
@@ -18,7 +20,7 @@ if (!defined('IN_PHPBB'))
/**
* Exception class for metadata
*/
-class phpbb_extension_exception extends UnexpectedValueException
+class exception extends \UnexpectedValueException
{
public function __toString()
{
diff --git a/phpBB/phpbb/extension/interface.php b/phpBB/phpbb/extension/extension_interface.php
index 7b36a12bf6..1e5f546dc5 100644
--- a/phpBB/phpbb/extension/interface.php
+++ b/phpBB/phpbb/extension/extension_interface.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\extension;
+
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package extension
*/
-interface phpbb_extension_interface
+interface extension_interface
{
/**
* enable_step is executed on enabling an extension until it returns false.
diff --git a/phpBB/phpbb/extension/finder.php b/phpBB/phpbb/extension/finder.php
index 155a41cda5..e787919588 100644
--- a/phpBB/phpbb/extension/finder.php
+++ b/phpBB/phpbb/extension/finder.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\extension;
+
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
*
* @package extension
*/
-class phpbb_extension_finder
+class finder
{
protected $extension_manager;
protected $filesystem;
@@ -52,17 +54,17 @@ class phpbb_extension_finder
/**
* Creates a new finder instance with its dependencies
*
- * @param phpbb_extension_manager $extension_manager An extension manager
+ * @param \phpbb\extension\manager $extension_manager An extension manager
* instance that provides the finder with a list of active
* extensions and their locations
- * @param phpbb_filesystem $filesystem Filesystem instance
+ * @param \phpbb\filesystem $filesystem Filesystem instance
* @param string $phpbb_root_path Path to the phpbb root directory
- * @param phpbb_cache_driver_interface $cache A cache instance or null
+ * @param \phpbb\cache\driver\driver_interface $cache A cache instance or null
* @param string $php_ext php file extension
* @param string $cache_name The name of the cache variable, defaults to
* _ext_finder
*/
- public function __construct(phpbb_extension_manager $extension_manager, phpbb_filesystem $filesystem, $phpbb_root_path = '', phpbb_cache_driver_interface $cache = null, $php_ext = 'php', $cache_name = '_ext_finder')
+ public function __construct(\phpbb\extension\manager $extension_manager, \phpbb\filesystem $filesystem, $phpbb_root_path = '', \phpbb\cache\driver\driver_interface $cache = null, $php_ext = 'php', $cache_name = '_ext_finder')
{
$this->extension_manager = $extension_manager;
$this->filesystem = $filesystem;
@@ -88,7 +90,7 @@ class phpbb_extension_finder
* Sets a core path to be searched in addition to extensions
*
* @param string $core_path The path relative to phpbb_root_path
- * @return phpbb_extension_finder This object for chaining calls
+ * @return \phpbb\extension\finder This object for chaining calls
*/
public function core_path($core_path)
{
@@ -104,7 +106,7 @@ class phpbb_extension_finder
* file extension is automatically added to suffixes.
*
* @param string $suffix A filename suffix
- * @return phpbb_extension_finder This object for chaining calls
+ * @return \phpbb\extension\finder This object for chaining calls
*/
public function suffix($suffix)
{
@@ -121,7 +123,7 @@ class phpbb_extension_finder
* file extension is automatically added to suffixes.
*
* @param string $extension_suffix A filename suffix
- * @return phpbb_extension_finder This object for chaining calls
+ * @return \phpbb\extension\finder This object for chaining calls
*/
public function extension_suffix($extension_suffix)
{
@@ -137,7 +139,7 @@ class phpbb_extension_finder
* file extension is automatically added to suffixes.
*
* @param string $core_suffix A filename suffix
- * @return phpbb_extension_finder This object for chaining calls
+ * @return \phpbb\extension\finder This object for chaining calls
*/
public function core_suffix($core_suffix)
{
@@ -149,7 +151,7 @@ class phpbb_extension_finder
* Sets the prefix all files found in extensions and core must match
*
* @param string $prefix A filename prefix
- * @return phpbb_extension_finder This object for chaining calls
+ * @return \phpbb\extension\finder This object for chaining calls
*/
public function prefix($prefix)
{
@@ -162,7 +164,7 @@ class phpbb_extension_finder
* Sets a prefix all files found in extensions must match
*
* @param string $extension_prefix A filename prefix
- * @return phpbb_extension_finder This object for chaining calls
+ * @return \phpbb\extension\finder This object for chaining calls
*/
public function extension_prefix($extension_prefix)
{
@@ -174,7 +176,7 @@ class phpbb_extension_finder
* Sets a prefix all files found in the core path must match
*
* @param string $core_prefix A filename prefix
- * @return phpbb_extension_finder This object for chaining calls
+ * @return \phpbb\extension\finder This object for chaining calls
*/
public function core_prefix($core_prefix)
{
@@ -189,7 +191,7 @@ class phpbb_extension_finder
* the current directory.
*
* @param string $directory
- * @return phpbb_extension_finder This object for chaining calls
+ * @return \phpbb\extension\finder This object for chaining calls
*/
public function directory($directory)
{
@@ -202,7 +204,7 @@ class phpbb_extension_finder
* Sets a directory all files found in extensions must be contained in
*
* @param string $extension_directory
- * @return phpbb_extension_finder This object for chaining calls
+ * @return \phpbb\extension\finder This object for chaining calls
*/
public function extension_directory($extension_directory)
{
@@ -214,7 +216,7 @@ class phpbb_extension_finder
* Sets a directory all files found in the core path must be contained in
*
* @param string $core_directory
- * @return phpbb_extension_finder This object for chaining calls
+ * @return \phpbb\extension\finder This object for chaining calls
*/
public function core_directory($core_directory)
{
@@ -275,9 +277,17 @@ class phpbb_extension_finder
$classes = array();
foreach ($files as $file => $ext_name)
{
- $file = preg_replace('#^(phpbb|includes)/#', '', $file);
-
- $classes[] = 'phpbb_' . str_replace('/', '_', substr($file, 0, -strlen('.' . $this->php_ext)));
+ $class = substr($file, 0, -strlen('.' . $this->php_ext));
+ if ($ext_name === '/' && preg_match('#^includes/#', $file))
+ {
+ $class = preg_replace('#^includes/#', '', $class);
+ $classes[] = 'phpbb_' . str_replace('/', '_', $class);
+ }
+ else
+ {
+ $class = preg_replace('#^ext/#', '', $class);
+ $classes[] = '\\' . str_replace('/', '\\', $class);
+ }
}
return $classes;
}
@@ -473,7 +483,7 @@ class phpbb_extension_finder
}
$directory_pattern = '#' . $directory_pattern . '#';
- $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST);
+ $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path), \RecursiveIteratorIterator::SELF_FIRST);
foreach ($iterator as $file_info)
{
$filename = $file_info->getFilename();
diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php
index 4451049d04..ce6d7e05c8 100644
--- a/phpBB/phpbb/extension/manager.php
+++ b/phpBB/phpbb/extension/manager.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\extension;
+
/**
* @ignore
*/
@@ -22,7 +24,7 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*
* @package extension
*/
-class phpbb_extension_manager
+class manager
{
/** @var ContainerInterface */
protected $container;
@@ -40,16 +42,16 @@ class phpbb_extension_manager
* Creates a manager and loads information from database
*
* @param ContainerInterface $container A container
- * @param phpbb_db_driver $db A database connection
- * @param phpbb_config $config phpbb_config
- * @param phpbb_filesystem $filesystem
+ * @param \phpbb\db\driver\driver $db A database connection
+ * @param \phpbb\config\config $config \phpbb\config\config
+ * @param \phpbb\filesystem $filesystem
* @param string $extension_table The name of the table holding extensions
* @param string $phpbb_root_path Path to the phpbb includes directory.
* @param string $php_ext php file extension
- * @param phpbb_cache_driver_interface $cache A cache instance or null
+ * @param \phpbb\cache\driver\driver_interface $cache A cache instance or null
* @param string $cache_name The name of the cache variable, defaults to _ext
*/
- public function __construct(ContainerInterface $container, phpbb_db_driver $db, phpbb_config $config, phpbb_filesystem $filesystem, $extension_table, $phpbb_root_path, $php_ext = 'php', phpbb_cache_driver_interface $cache = null, $cache_name = '_ext')
+ public function __construct(ContainerInterface $container, \phpbb\db\driver\driver $db, \phpbb\config\config $config, \phpbb\filesystem $filesystem, $extension_table, $phpbb_root_path, $php_ext = 'php', \phpbb\cache\driver\driver_interface $cache = null, $cache_name = '_ext')
{
$this->container = $container;
$this->phpbb_root_path = $phpbb_root_path;
@@ -126,12 +128,12 @@ class phpbb_extension_manager
* Instantiates the extension meta class for the extension with the given name
*
* @param string $name The extension name
- * @return phpbb_extension_interface Instance of the extension meta class or
- * phpbb_extension_base if the class does not exist
+ * @return \phpbb\extension\extension_interface Instance of the extension meta class or
+ * \phpbb\extension\base if the class does not exist
*/
public function get_extension($name)
{
- $extension_class_name = 'phpbb_ext_' . str_replace('/', '_', $name) . '_ext';
+ $extension_class_name = str_replace('/', '\\', $name) . '\\ext';
$migrator = $this->container->get('migrator');
@@ -141,7 +143,7 @@ class phpbb_extension_manager
}
else
{
- return new phpbb_extension_base($this->container, $this->get_finder(), $migrator, $name, $this->get_extension_path($name, true));
+ return new \phpbb\extension\base($this->container, $this->get_finder(), $migrator, $name, $this->get_extension_path($name, true));
}
}
@@ -150,11 +152,11 @@ class phpbb_extension_manager
*
* @param string $name The extension name
* @param string $template The template manager
- * @return phpbb_extension_metadata_manager Instance of the metadata manager
+ * @return \phpbb\extension\metadata_manager Instance of the metadata manager
*/
- public function create_extension_metadata_manager($name, phpbb_template $template)
+ public function create_extension_metadata_manager($name, \phpbb\template\template $template)
{
- return new phpbb_extension_metadata_manager($name, $this->config, $this, $template, $this->phpbb_root_path);
+ return new \phpbb\extension\metadata_manager($name, $this->config, $this, $template, $this->phpbb_root_path);
}
/**
@@ -403,9 +405,9 @@ class phpbb_extension_manager
return $available;
}
- $iterator = new RecursiveIteratorIterator(
- new RecursiveDirectoryIterator($this->phpbb_root_path . 'ext/', FilesystemIterator::NEW_CURRENT_AND_KEY | FilesystemIterator::FOLLOW_SYMLINKS),
- RecursiveIteratorIterator::SELF_FIRST);
+ $iterator = new \RecursiveIteratorIterator(
+ new \RecursiveDirectoryIterator($this->phpbb_root_path . 'ext/', \FilesystemIterator::NEW_CURRENT_AND_KEY | \FilesystemIterator::FOLLOW_SYMLINKS),
+ \RecursiveIteratorIterator::SELF_FIRST);
foreach ($iterator as $file_info)
{
if ($file_info->isFile() && $file_info->getFilename() == 'ext.' . $this->php_ext)
@@ -502,12 +504,12 @@ class phpbb_extension_manager
}
/**
- * Instantiates a phpbb_extension_finder.
+ * Instantiates a \phpbb\extension\finder.
*
- * @return phpbb_extension_finder An extension finder instance
+ * @return \phpbb\extension\finder An extension finder instance
*/
public function get_finder()
{
- return new phpbb_extension_finder($this, $this->filesystem, $this->phpbb_root_path, $this->cache, $this->php_ext, $this->cache_name . '_finder');
+ return new \phpbb\extension\finder($this, $this->filesystem, $this->phpbb_root_path, $this->cache, $this->php_ext, $this->cache_name . '_finder');
}
}
diff --git a/phpBB/phpbb/extension/metadata_manager.php b/phpBB/phpbb/extension/metadata_manager.php
index 14b77c085b..a77f3a2c6e 100644
--- a/phpBB/phpbb/extension/metadata_manager.php
+++ b/phpBB/phpbb/extension/metadata_manager.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\extension;
+
/**
* @ignore
*/
@@ -20,23 +22,23 @@ if (!defined('IN_PHPBB'))
*
* @package extension
*/
-class phpbb_extension_metadata_manager
+class metadata_manager
{
/**
* phpBB Config instance
- * @var phpbb_config
+ * @var \phpbb\config\config
*/
protected $config;
/**
* phpBB Extension Manager
- * @var phpbb_extension_manager
+ * @var \phpbb\extension\manager
*/
protected $extension_manager;
/**
* phpBB Template instance
- * @var phpbb_template
+ * @var \phpbb\template\template
*/
protected $template;
@@ -68,12 +70,12 @@ class phpbb_extension_metadata_manager
* Creates the metadata manager
*
* @param string $ext_name Name (including vendor) of the extension
- * @param phpbb_config $config phpBB Config instance
- * @param phpbb_extension_manager $extension_manager An instance of the phpBBb extension manager
- * @param phpbb_template $template phpBB Template instance
+ * @param \phpbb\config\config $config phpBB Config instance
+ * @param \phpbb\extension\manager $extension_manager An instance of the phpBBb extension manager
+ * @param \phpbb\template\template $template phpBB Template instance
* @param string $phpbb_root_path Path to the phpbb includes directory.
*/
- public function __construct($ext_name, phpbb_config $config, phpbb_extension_manager $extension_manager, phpbb_template $template, $phpbb_root_path)
+ public function __construct($ext_name, \phpbb\config\config $config, \phpbb\extension\manager $extension_manager, \phpbb\template\template $template, $phpbb_root_path)
{
$this->config = $config;
$this->extension_manager = $extension_manager;
@@ -145,7 +147,7 @@ class phpbb_extension_metadata_manager
if (!file_exists($this->metadata_file))
{
- throw new phpbb_extension_exception('The required file does not exist: ' . $this->metadata_file);
+ throw new \phpbb\extension\exception('The required file does not exist: ' . $this->metadata_file);
}
}
@@ -158,18 +160,18 @@ class phpbb_extension_metadata_manager
{
if (!file_exists($this->metadata_file))
{
- throw new phpbb_extension_exception('The required file does not exist: ' . $this->metadata_file);
+ throw new \phpbb\extension\exception('The required file does not exist: ' . $this->metadata_file);
}
else
{
if (!($file_contents = file_get_contents($this->metadata_file)))
{
- throw new phpbb_extension_exception('file_get_contents failed on ' . $this->metadata_file);
+ throw new \phpbb\extension\exception('file_get_contents failed on ' . $this->metadata_file);
}
if (($metadata = json_decode($file_contents, true)) === NULL)
{
- throw new phpbb_extension_exception('json_decode failed on ' . $this->metadata_file);
+ throw new \phpbb\extension\exception('json_decode failed on ' . $this->metadata_file);
}
$this->metadata = $metadata;
@@ -228,12 +230,12 @@ class phpbb_extension_metadata_manager
{
if (!isset($this->metadata[$name]))
{
- throw new phpbb_extension_exception("Required meta field '$name' has not been set.");
+ throw new \phpbb\extension\exception("Required meta field '$name' has not been set.");
}
if (!preg_match($fields[$name], $this->metadata[$name]))
{
- throw new phpbb_extension_exception("Meta field '$name' is invalid.");
+ throw new \phpbb\extension\exception("Meta field '$name' is invalid.");
}
}
break;
@@ -251,14 +253,14 @@ class phpbb_extension_metadata_manager
{
if (empty($this->metadata['authors']))
{
- throw new phpbb_extension_exception("Required meta field 'authors' has not been set.");
+ throw new \phpbb\extension\exception("Required meta field 'authors' has not been set.");
}
foreach ($this->metadata['authors'] as $author)
{
if (!isset($author['name']))
{
- throw new phpbb_extension_exception("Required meta field 'author name' has not been set.");
+ throw new \phpbb\extension\exception("Required meta field 'author name' has not been set.");
}
}
diff --git a/phpBB/phpbb/extension/provider.php b/phpBB/phpbb/extension/provider.php
index 45b55e5cab..c2a264d311 100644
--- a/phpBB/phpbb/extension/provider.php
+++ b/phpBB/phpbb/extension/provider.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\extension;
+
/**
* @ignore
*/
@@ -28,7 +30,7 @@ if (!defined('IN_PHPBB'))
*
* @package extension
*/
-abstract class phpbb_extension_provider implements IteratorAggregate
+abstract class provider implements \IteratorAggregate
{
/**
* Array holding all found items
@@ -38,16 +40,16 @@ abstract class phpbb_extension_provider implements IteratorAggregate
/**
* An extension manager to search for items in extensions
- * @var phpbb_extension_manager
+ * @var \phpbb\extension\manager
*/
protected $extension_manager;
/**
* Constructor. Loads all available items.
*
- * @param phpbb_extension_manager $extension_manager phpBB extension manager
+ * @param \phpbb\extension\manager $extension_manager phpBB extension manager
*/
- public function __construct(phpbb_extension_manager $extension_manager)
+ public function __construct(\phpbb\extension\manager $extension_manager)
{
$this->extension_manager = $extension_manager;
}
@@ -71,6 +73,6 @@ abstract class phpbb_extension_provider implements IteratorAggregate
$this->items = $this->find();
}
- return new ArrayIterator($this->items);
+ return new \ArrayIterator($this->items);
}
}
diff --git a/phpBB/phpbb/feed/base.php b/phpBB/phpbb/feed/base.php
index 296d830932..de7dd41df4 100644
--- a/phpBB/phpbb/feed/base.php
+++ b/phpBB/phpbb/feed/base.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\feed;
+
/**
* @ignore
*/
@@ -20,27 +22,27 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-abstract class phpbb_feed_base
+abstract class base
{
/**
* Feed helper object
- * @var phpbb_feed_helper
+ * @var \phpbb\feed\helper
*/
protected $helper;
- /** @var phpbb_config */
+ /** @var \phpbb\config\config */
protected $config;
- /** @var phpbb_db_driver */
+ /** @var \phpbb\db\driver\driver */
protected $db;
- /** @var phpbb_cache_driver_interface */
+ /** @var \phpbb\cache\driver\driver_interface */
protected $cache;
- /** @var phpbb_user */
+ /** @var \phpbb\user */
protected $user;
- /** @var phpbb_auth */
+ /** @var \phpbb\auth\auth */
protected $auth;
/** @var string */
@@ -74,17 +76,17 @@ abstract class phpbb_feed_base
/**
* Constructor
*
- * @param phpbb_feed_helper $helper Feed helper
- * @param phpbb_config $config Config object
- * @param phpbb_db_driver $db Database connection
- * @param phpbb_cache_driver_interface $cache Cache object
- * @param phpbb_user $user User object
- * @param phpbb_auth $auth Auth object
- * @param phpbb_content_visibility $content_visibility Auth object
+ * @param \phpbb\feed\helper $helper Feed helper
+ * @param \phpbb\config\config $config Config object
+ * @param \phpbb\db\driver\driver $db Database connection
+ * @param \phpbb\cache\driver\driver_interface $cache Cache object
+ * @param \phpbb\user $user User object
+ * @param \phpbb\auth\auth $auth Auth object
+ * @param \phpbb\content_visibility $content_visibility Auth object
* @param string $phpEx php file extension
* @return null
*/
- function __construct(phpbb_feed_helper $helper, phpbb_config $config, phpbb_db_driver $db, phpbb_cache_driver_interface $cache, phpbb_user $user, phpbb_auth $auth, phpbb_content_visibility $content_visibility, $phpEx)
+ function __construct(\phpbb\feed\helper $helper, \phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\cache\driver\driver_interface $cache, \phpbb\user $user, \phpbb\auth\auth $auth, \phpbb\content_visibility $content_visibility, $phpEx)
{
$this->config = $config;
$this->helper = $helper;
diff --git a/phpBB/phpbb/feed/factory.php b/phpBB/phpbb/feed/factory.php
index 63a1eb8ef0..e011b0e3a9 100644
--- a/phpBB/phpbb/feed/factory.php
+++ b/phpBB/phpbb/feed/factory.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\feed;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* Factory class to return correct object
* @package phpBB3
*/
-class phpbb_feed_factory
+class factory
{
/**
* Service container object
@@ -27,21 +29,21 @@ class phpbb_feed_factory
*/
protected $container;
- /** @var phpbb_config */
+ /** @var \phpbb\config\config */
protected $config;
- /** @var phpbb_db_driver */
+ /** @var \phpbb\db\driver\driver */
protected $db;
/**
* Constructor
*
* @param objec $container Container object
- * @param phpbb_config $config Config object
- * @param phpbb_db_driver $db Database connection
+ * @param \phpbb\config\config $config Config object
+ * @param \phpbb\db\driver\driver $db Database connection
* @return null
*/
- public function __construct($container, phpbb_config $config, phpbb_db_driver $db)
+ public function __construct($container, \phpbb\config\config $config, \phpbb\db\driver\driver $db)
{
$this->container = $container;
$this->config = $config;
diff --git a/phpBB/phpbb/feed/forum.php b/phpBB/phpbb/feed/forum.php
index b5f0dd0f8f..5f64d85625 100644
--- a/phpBB/phpbb/feed/forum.php
+++ b/phpBB/phpbb/feed/forum.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\feed;
+
/**
* @ignore
*/
@@ -23,7 +25,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-class phpbb_feed_forum extends phpbb_feed_post_base
+class forum extends \phpbb\feed\post_base
{
var $forum_id = 0;
var $forum_data = array();
@@ -32,7 +34,7 @@ class phpbb_feed_forum extends phpbb_feed_post_base
* Set the Forum ID
*
* @param int $forum_id Forum ID
- * @return phpbb_feed_forum
+ * @return \phpbb\feed\forum
*/
public function set_forum_id($topic_id)
{
diff --git a/phpBB/phpbb/feed/forums.php b/phpBB/phpbb/feed/forums.php
index 409097a9f3..6be1c68da8 100644
--- a/phpBB/phpbb/feed/forums.php
+++ b/phpBB/phpbb/feed/forums.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\feed;
+
/**
* @ignore
*/
@@ -23,7 +25,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-class phpbb_feed_forums extends phpbb_feed_base
+class forums extends \phpbb\feed\base
{
var $num_items = 0;
diff --git a/phpBB/phpbb/feed/helper.php b/phpBB/phpbb/feed/helper.php
index 93330aa2ad..cf8328bd5e 100644
--- a/phpBB/phpbb/feed/helper.php
+++ b/phpBB/phpbb/feed/helper.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\feed;
+
/**
* @ignore
*/
@@ -19,12 +21,12 @@ if (!defined('IN_PHPBB'))
* Class with some helpful functions used in feeds
* @package phpBB3
*/
-class phpbb_feed_helper
+class helper
{
- /** @var phpbb_config */
+ /** @var \phpbb\config\config */
protected $config;
- /** @var phpbb_user */
+ /** @var \phpbb\user */
protected $user;
/** @var string */
@@ -33,12 +35,12 @@ class phpbb_feed_helper
/**
* Constructor
*
- * @param phpbb_config $config Config object
- * @param phpbb_user $user User object
+ * @param \phpbb\config\config $config Config object
+ * @param \phpbb\user $user User object
* @param string $phpbb_root_path Root path
* @return null
*/
- public function __construct(phpbb_config $config, phpbb_user $user, $phpbb_root_path)
+ public function __construct(\phpbb\config\config $config, \phpbb\user $user, $phpbb_root_path)
{
$this->config = $config;
$this->user = $user;
diff --git a/phpBB/phpbb/feed/news.php b/phpBB/phpbb/feed/news.php
index f2d45b5165..20017a3248 100644
--- a/phpBB/phpbb/feed/news.php
+++ b/phpBB/phpbb/feed/news.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\feed;
+
/**
* @ignore
*/
@@ -23,7 +25,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-class phpbb_feed_news extends phpbb_feed_topic_base
+class news extends \phpbb\feed\topic_base
{
function get_news_forums()
{
diff --git a/phpBB/phpbb/feed/overall.php b/phpBB/phpbb/feed/overall.php
index 224d97ec03..8ee1f092ab 100644
--- a/phpBB/phpbb/feed/overall.php
+++ b/phpBB/phpbb/feed/overall.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\feed;
+
/**
* @ignore
*/
@@ -23,7 +25,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-class phpbb_feed_overall extends phpbb_feed_post_base
+class overall extends \phpbb\feed\post_base
{
function get_sql()
{
diff --git a/phpBB/phpbb/feed/post_base.php b/phpBB/phpbb/feed/post_base.php
index 1f4cb4b5ef..5588ecadb0 100644
--- a/phpBB/phpbb/feed/post_base.php
+++ b/phpBB/phpbb/feed/post_base.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\feed;
+
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-abstract class phpbb_feed_post_base extends phpbb_feed_base
+abstract class post_base extends \phpbb\feed\base
{
var $num_items = 'feed_limit_post';
diff --git a/phpBB/phpbb/feed/topic.php b/phpBB/phpbb/feed/topic.php
index bb1753d823..1eeb4fbe94 100644
--- a/phpBB/phpbb/feed/topic.php
+++ b/phpBB/phpbb/feed/topic.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\feed;
+
/**
* @ignore
*/
@@ -22,7 +24,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-class phpbb_feed_topic extends phpbb_feed_post_base
+class topic extends \phpbb\feed\post_base
{
var $topic_id = 0;
var $forum_id = 0;
@@ -32,7 +34,7 @@ class phpbb_feed_topic extends phpbb_feed_post_base
* Set the Topic ID
*
* @param int $topic_id Topic ID
- * @return phpbb_feed_topic
+ * @return \phpbb\feed\topic
*/
public function set_topic_id($topic_id)
{
diff --git a/phpBB/phpbb/feed/topic_base.php b/phpBB/phpbb/feed/topic_base.php
index b104a46631..f05be9223e 100644
--- a/phpBB/phpbb/feed/topic_base.php
+++ b/phpBB/phpbb/feed/topic_base.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\feed;
+
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-abstract class phpbb_feed_topic_base extends phpbb_feed_base
+abstract class topic_base extends \phpbb\feed\base
{
var $num_items = 'feed_limit_topic';
diff --git a/phpBB/phpbb/feed/topics.php b/phpBB/phpbb/feed/topics.php
index 31f5177773..d70195c87b 100644
--- a/phpBB/phpbb/feed/topics.php
+++ b/phpBB/phpbb/feed/topics.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\feed;
+
/**
* @ignore
*/
@@ -23,7 +25,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-class phpbb_feed_topics extends phpbb_feed_topic_base
+class topics extends \phpbb\feed\topic_base
{
function get_sql()
{
diff --git a/phpBB/phpbb/feed/topics_active.php b/phpBB/phpbb/feed/topics_active.php
index 249dd1d66a..c6f46d67e6 100644
--- a/phpBB/phpbb/feed/topics_active.php
+++ b/phpBB/phpbb/feed/topics_active.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\feed;
+
/**
* @ignore
*/
@@ -24,7 +26,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-class phpbb_feed_topics_active extends phpbb_feed_topic_base
+class topics_active extends \phpbb\feed\topic_base
{
var $sort_days = 7;
diff --git a/phpBB/phpbb/filesystem.php b/phpBB/phpbb/filesystem.php
index 27cab48fb0..662b6b866e 100644
--- a/phpBB/phpbb/filesystem.php
+++ b/phpBB/phpbb/filesystem.php
@@ -6,6 +6,9 @@
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
+
+namespace phpbb;
+
/**
* @ignore
*/
@@ -18,8 +21,153 @@ if (!defined('IN_PHPBB'))
* A class with various functions that are related to paths, files and the filesystem
* @package phpBB3
*/
-class phpbb_filesystem
+class filesystem
{
+ /** @var \phpbb\symfony_request */
+ protected $symfony_request;
+
+ /** @var string */
+ protected $phpbb_root_path;
+
+ /** @var string */
+ protected $adm_relative_path;
+
+ /** @var string */
+ protected $php_ext;
+
+ /** @var string */
+ protected $web_root_path;
+
+ /**
+ * Constructor
+ *
+ * @param \phpbb\symfony_request $symfony_request
+ * @param string $phpbb_root_path Relative path to phpBB root
+ * @param string $php_ext PHP extension (php)
+ */
+ public function __construct(\phpbb\symfony_request $symfony_request, $phpbb_root_path, $php_ext, $adm_relative_path = null)
+ {
+ $this->symfony_request = $symfony_request;
+ $this->phpbb_root_path = $phpbb_root_path;
+ $this->php_ext = $php_ext;
+ $this->adm_relative_path = $adm_relative_path;
+ }
+
+ /**
+ * Get the phpBB root path
+ *
+ * @return string
+ */
+ public function get_phpbb_root_path()
+ {
+ return $this->phpbb_root_path;
+ }
+
+ /**
+ * Get the adm root path
+ *
+ * @return string
+ */
+ public function get_adm_relative_path()
+ {
+ return $this->adm_relative_path;
+ }
+
+ /**
+ * Get the php extension
+ *
+ * @return string
+ */
+ public function get_php_ext()
+ {
+ return $this->php_ext;
+ }
+
+ /**
+ * Update a path to the correct relative root path
+ *
+ * This replaces $phpbb_root_path . some_url with
+ * get_web_root_path() . some_url OR if $phpbb_root_path
+ * is not at the beginning of $path, just prepends the
+ * web root path
+ *
+ * @param string $path The path to be updated
+ * @return string
+ */
+ public function update_web_root_path($path)
+ {
+ $web_root_path = $this->get_web_root_path($this->symfony_request);
+
+ if (strpos($path, $this->phpbb_root_path) === 0)
+ {
+ $path = substr($path, strlen($this->phpbb_root_path));
+ }
+
+ return $web_root_path . $path;
+ }
+
+ /**
+ * Get a relative root path from the current URL
+ *
+ * @return string
+ */
+ public function get_web_root_path()
+ {
+ if ($this->symfony_request === null)
+ {
+ return $this->phpbb_root_path;
+ }
+
+ if (null !== $this->web_root_path)
+ {
+ return $this->web_root_path;
+ }
+
+ // Path info (e.g. /foo/bar)
+ $path_info = $this->clean_path($this->symfony_request->getPathInfo());
+
+ // Full request URI (e.g. phpBB/app.php/foo/bar)
+ $request_uri = $this->symfony_request->getRequestUri();
+
+ // Script name URI (e.g. phpBB/app.php)
+ $script_name = $this->symfony_request->getScriptName();
+
+ /*
+ * If the path info is empty (single /), then we're not using
+ * a route like app.php/foo/bar
+ */
+ if ($path_info === '/')
+ {
+ return $this->web_root_path = $this->phpbb_root_path;
+ }
+
+ // How many corrections might we need?
+ $corrections = substr_count($path_info, '/');
+
+ /*
+ * If the script name (e.g. phpBB/app.php) exists in the
+ * requestUri (e.g. phpBB/app.php/foo/template), then we
+ * are have a non-rewritten URL.
+ */
+ if (strpos($request_uri, $script_name) === 0)
+ {
+ /*
+ * Append ../ to the end of the phpbb_root_path as many times
+ * as / exists in path_info
+ */
+ return $this->web_root_path = $this->phpbb_root_path . str_repeat('../', $corrections);
+ }
+
+ /*
+ * If we're here it means we're at a re-written path, so we must
+ * correct the relative path for web URLs. We must append ../
+ * to the end of the root path as many times as / exists in path_info
+ * less one time (because the script, e.g. /app.php, doesn't exist in
+ * the URL)
+ */
+ return $this->web_root_path = $this->phpbb_root_path . str_repeat('../', $corrections - 1);
+ }
+
/**
* Eliminates useless . and .. components from specified path.
*
diff --git a/phpBB/phpbb/groupposition/exception.php b/phpBB/phpbb/groupposition/exception.php
index e4ff09c703..3a8d92dbc7 100644
--- a/phpBB/phpbb/groupposition/exception.php
+++ b/phpBB/phpbb/groupposition/exception.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\groupposition;
+
/**
* @ignore
*/
@@ -18,6 +20,6 @@ if (!defined('IN_PHPBB'))
/**
* @package groupposition
*/
-class phpbb_groupposition_exception extends \Exception
+class exception extends \Exception
{
}
diff --git a/phpBB/phpbb/groupposition/interface.php b/phpBB/phpbb/groupposition/groupposition_interface.php
index eacc04e1a4..a568785185 100644
--- a/phpBB/phpbb/groupposition/interface.php
+++ b/phpBB/phpbb/groupposition/groupposition_interface.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\groupposition;
+
/**
* @ignore
*/
@@ -22,7 +24,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-interface phpbb_groupposition_interface
+interface groupposition_interface
{
/**
* Returns the value for a given group, if the group exists.
@@ -32,7 +34,7 @@ interface phpbb_groupposition_interface
public function get_group_value($group_id);
/**
- * Get number of groups displayed
+ * Get number of groups displayed
*
* @return int value of the last item displayed
*/
diff --git a/phpBB/phpbb/groupposition/legend.php b/phpBB/phpbb/groupposition/legend.php
index 7fddadde99..9a1ef3d1d0 100644
--- a/phpBB/phpbb/groupposition/legend.php
+++ b/phpBB/phpbb/groupposition/legend.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\groupposition;
+
/**
* @ignore
*/
@@ -23,7 +25,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-class phpbb_groupposition_legend implements phpbb_groupposition_interface
+class legend implements \phpbb\groupposition\groupposition_interface
{
/**
* Group is not displayed
@@ -32,23 +34,23 @@ class phpbb_groupposition_legend implements phpbb_groupposition_interface
/**
* Database object
- * @var phpbb_db_driver
+ * @var \phpbb\db\driver\driver
*/
protected $db;
/**
* User object
- * @var phpbb_user
+ * @var \phpbb\user
*/
protected $user;
/**
* Constructor
*
- * @param phpbb_db_driver $db Database object
- * @param phpbb_user $user User object
+ * @param \phpbb\db\driver\driver $db Database object
+ * @param \phpbb\user $user User object
*/
- public function __construct(phpbb_db_driver $db, phpbb_user $user)
+ public function __construct(\phpbb\db\driver\driver $db, \phpbb\user $user)
{
$this->db = $db;
$this->user = $user;
@@ -71,7 +73,7 @@ class phpbb_groupposition_legend implements phpbb_groupposition_interface
if ($current_value === false)
{
// Group not found.
- throw new phpbb_groupposition_exception('NO_GROUP');
+ throw new \phpbb\groupposition\exception('NO_GROUP');
}
return (int) $current_value;
diff --git a/phpBB/phpbb/groupposition/teampage.php b/phpBB/phpbb/groupposition/teampage.php
index 7c758199e7..4e8228eb58 100644
--- a/phpBB/phpbb/groupposition/teampage.php
+++ b/phpBB/phpbb/groupposition/teampage.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\groupposition;
+
/**
* @ignore
*/
@@ -22,7 +24,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-class phpbb_groupposition_teampage implements phpbb_groupposition_interface
+class teampage implements \phpbb\groupposition\groupposition_interface
{
/**
* Group is not displayed
@@ -36,30 +38,30 @@ class phpbb_groupposition_teampage implements phpbb_groupposition_interface
/**
* Database object
- * @var phpbb_db_driver
+ * @var \phpbb\db\driver\driver
*/
protected $db;
/**
* User object
- * @var phpbb_user
+ * @var \phpbb\user
*/
protected $user;
/**
* Cache object
- * @var phpbb_cache_driver_interface
+ * @var \phpbb\cache\driver\driver_interface
*/
protected $cache;
/**
* Constructor
*
- * @param phpbb_db_driver $db Database object
- * @param phpbb_user $user User object
- * @param phpbb_cache_driver_interface $cache Cache object
+ * @param \phpbb\db\driver\driver $db Database object
+ * @param \phpbb\user $user User object
+ * @param \phpbb\cache\driver\driver_interface $cache Cache object
*/
- public function __construct(phpbb_db_driver $db, phpbb_user $user, phpbb_cache_driver_interface $cache)
+ public function __construct(\phpbb\db\driver\driver $db, \phpbb\user $user, \phpbb\cache\driver\driver_interface $cache)
{
$this->db = $db;
$this->user = $user;
@@ -86,7 +88,7 @@ class phpbb_groupposition_teampage implements phpbb_groupposition_interface
if ($row === false)
{
// Group not found.
- throw new phpbb_groupposition_exception('NO_GROUP');
+ throw new \phpbb\groupposition\exception('NO_GROUP');
}
return (int) $row['teampage_position'];
@@ -113,7 +115,7 @@ class phpbb_groupposition_teampage implements phpbb_groupposition_interface
if ($row === false)
{
// Group not found.
- throw new phpbb_groupposition_exception('NO_GROUP');
+ throw new \phpbb\groupposition\exception('NO_GROUP');
}
return $row;
@@ -137,7 +139,7 @@ class phpbb_groupposition_teampage implements phpbb_groupposition_interface
if ($current_value === false)
{
// Group not found.
- throw new phpbb_groupposition_exception('NO_GROUP');
+ throw new \phpbb\groupposition\exception('NO_GROUP');
}
return (int) $current_value;
@@ -161,7 +163,7 @@ class phpbb_groupposition_teampage implements phpbb_groupposition_interface
if ($row === false)
{
// Group not found.
- throw new phpbb_groupposition_exception('NO_GROUP');
+ throw new \phpbb\groupposition\exception('NO_GROUP');
}
return $row;
diff --git a/phpBB/phpbb/hook/finder.php b/phpBB/phpbb/hook/finder.php
index 7b0412f733..d5eb1f8186 100644
--- a/phpBB/phpbb/hook/finder.php
+++ b/phpBB/phpbb/hook/finder.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\hook;
+
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-class phpbb_hook_finder
+class finder
{
protected $phpbb_root_path;
protected $cache;
@@ -31,9 +33,9 @@ class phpbb_hook_finder
*
* @param string $phpbb_root_path Path to the phpbb root directory
* @param string $php_ext php file extension
- * @param phpbb_cache_driver_interface $cache A cache instance or null
+ * @param \phpbb\cache\driver\driver_interface $cache A cache instance or null
*/
- public function __construct($phpbb_root_path, $php_ext, phpbb_cache_driver_interface $cache = null)
+ public function __construct($phpbb_root_path, $php_ext, \phpbb\cache\driver\driver_interface $cache = null)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->cache = $cache;
diff --git a/phpBB/phpbb/json_response.php b/phpBB/phpbb/json_response.php
index 5dd904da09..fe532fc9d4 100644
--- a/phpBB/phpbb/json_response.php
+++ b/phpBB/phpbb/json_response.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* JSON class
* @package phpBB3
*/
-class phpbb_json_response
+class json_response
{
/**
* Send the data to the client and exit the script.
diff --git a/phpBB/phpbb/lock/db.php b/phpBB/phpbb/lock/db.php
index 5cc0821aa0..3e15727c12 100644
--- a/phpBB/phpbb/lock/db.php
+++ b/phpBB/phpbb/lock/db.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\lock;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* Database locking class
* @package phpBB3
*/
-class phpbb_lock_db
+class db
{
/**
* Name of the config variable this lock uses
@@ -42,13 +44,13 @@ class phpbb_lock_db
/**
* The phpBB configuration
- * @var phpbb_config
+ * @var \phpbb\config\config
*/
private $config;
/**
* A database connection
- * @var phpbb_db_driver
+ * @var \phpbb\db\driver\driver
*/
private $db;
@@ -59,9 +61,9 @@ class phpbb_lock_db
*
* @param string $config_name A config variable to be used for locking
* @param array $config The phpBB configuration
- * @param phpbb_db_driver $db A database connection
+ * @param \phpbb\db\driver\driver $db A database connection
*/
- public function __construct($config_name, phpbb_config $config, phpbb_db_driver $db)
+ public function __construct($config_name, \phpbb\config\config $config, \phpbb\db\driver\driver $db)
{
$this->config_name = $config_name;
$this->config = $config;
diff --git a/phpBB/phpbb/lock/flock.php b/phpBB/phpbb/lock/flock.php
index 17de0847c0..2a36a853ee 100644
--- a/phpBB/phpbb/lock/flock.php
+++ b/phpBB/phpbb/lock/flock.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\lock;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* File locking class
* @package phpBB3
*/
-class phpbb_lock_flock
+class flock
{
/**
* Path to the file to which access is controlled
diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php
index 7a26858348..7f4e52ed39 100644
--- a/phpBB/phpbb/log/log.php
+++ b/phpBB/phpbb/log/log.php
@@ -1,12 +1,14 @@
<?php
/**
*
-* @package phpbb_log
+* @package \phpbb\log\log
* @copyright (c) 2012 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
+namespace phpbb\log;
+
/**
* @ignore
*/
@@ -18,9 +20,9 @@ if (!defined('IN_PHPBB'))
/**
* This class is used to add entries into the log table.
*
-* @package phpbb_log
+* @package \phpbb\log\log
*/
-class phpbb_log implements phpbb_log_interface
+class log implements \phpbb\log\log_interface
{
/**
* If set, administrative user profile links will be returned and messages
@@ -56,19 +58,19 @@ class phpbb_log implements phpbb_log_interface
/**
* Database object
- * @var phpbb_db_driver
+ * @var \phpbb\db\driver\driver
*/
protected $db;
/**
* User object
- * @var phpbb_user
+ * @var \phpbb\user
*/
protected $user;
/**
* Auth object
- * @var phpbb_auth
+ * @var \phpbb\auth\auth
*/
protected $auth;
@@ -99,9 +101,9 @@ class phpbb_log implements phpbb_log_interface
/**
* Constructor
*
- * @param phpbb_db_driver $db Database object
- * @param phpbb_user $user User object
- * @param phpbb_auth $auth Auth object
+ * @param \phpbb\db\driver\driver $db Database object
+ * @param \phpbb\user $user User object
+ * @param \phpbb\auth\auth $auth Auth object
* @param phpbb_dispatcher $phpbb_dispatcher Event dispatcher
* @param string $phpbb_root_path Root path
* @param string $relative_admin_path Relative admin root path
@@ -123,7 +125,7 @@ class phpbb_log implements phpbb_log_interface
/*
* IN_ADMIN is set after the session is created,
* so we need to take ADMIN_START into account as well, otherwise
- * it will not work for the phpbb_log object we create in common.php
+ * it will not work for the \phpbb\log\log object we create in common.php
*/
$this->set_is_admin((defined('ADMIN_START') && ADMIN_START) || (defined('IN_ADMIN') && IN_ADMIN));
$this->enable();
diff --git a/phpBB/phpbb/log/interface.php b/phpBB/phpbb/log/log_interface.php
index 3b459c9bdf..427d30015d 100644
--- a/phpBB/phpbb/log/interface.php
+++ b/phpBB/phpbb/log/log_interface.php
@@ -1,12 +1,14 @@
<?php
/**
*
-* @package phpbb_log
+* @package \phpbb\log\log
* @copyright (c) 2012 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
+namespace phpbb\log;
+
/**
* @ignore
*/
@@ -18,9 +20,9 @@ if (!defined('IN_PHPBB'))
/**
* The interface for the log-system.
*
-* @package phpbb_log
+* @package \phpbb\log\log
*/
-interface phpbb_log_interface
+interface log_interface
{
/**
* This function returns the state of the log system.
diff --git a/phpBB/phpbb/log/null.php b/phpBB/phpbb/log/null.php
new file mode 100644
index 0000000000..2ef69926ee
--- /dev/null
+++ b/phpBB/phpbb/log/null.php
@@ -0,0 +1,80 @@
+<?php
+/**
+*
+* @package phpbb_log
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+namespace phpbb\log;
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+/**
+* Null logger
+*
+* @package phpbb_log
+*/
+class null implements log_interface
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function is_enabled($type = '')
+ {
+ return false;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function disable($type = '')
+ {
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function enable($type = '')
+ {
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function add($mode, $user_id, $log_ip, $log_operation, $log_time = false, $additional_data = array())
+ {
+ return false;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_logs($mode, $count_logs = true, $limit = 0, $offset = 0, $forum_id = 0, $topic_id = 0, $user_id = 0, $log_time = 0, $sort_by = 'l.log_time DESC', $keywords = '')
+ {
+ return array();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_log_count()
+ {
+ return 0;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_valid_offset()
+ {
+ return 0;
+ }
+}
diff --git a/phpBB/phpbb/notification/exception.php b/phpBB/phpbb/notification/exception.php
index a52d6fdc57..275fb3b542 100644
--- a/phpBB/phpbb/notification/exception.php
+++ b/phpBB/phpbb/notification/exception.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\notification;
+
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
-class phpbb_notification_exception extends \Exception
+class exception extends \Exception
{
public function __toString()
{
diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php
index 97833710c0..c42c84fb1f 100644
--- a/phpBB/phpbb/notification/manager.php
+++ b/phpBB/phpbb/notification/manager.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\notification;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* Notifications service class
* @package notifications
*/
-class phpbb_notification_manager
+class manager
{
/** @var array */
protected $notification_types;
@@ -30,16 +32,16 @@ class phpbb_notification_manager
/** @var ContainerBuilder */
protected $phpbb_container;
- /** @var phpbb_user_loader */
+ /** @var \phpbb\user_loader */
protected $user_loader;
- /** @var phpbb_db_driver */
+ /** @var \phpbb\db\driver\driver */
protected $db;
- /** @var phpbb_cache_service */
+ /** @var \phpbb\cache\service */
protected $cache;
- /** @var phpbb_user */
+ /** @var \phpbb\user */
protected $user;
/** @var string */
@@ -59,21 +61,21 @@ class phpbb_notification_manager
/**
* Notification Constructor
- *
+ *
* @param array $notification_types
* @param array $notification_methods
* @param ContainerBuilder $phpbb_container
- * @param phpbb_user_loader $user_loader
- * @param phpbb_db_driver $db
- * @param phpbb_user $user
+ * @param \phpbb\user_loader $user_loader
+ * @param \phpbb\db\driver\driver $db
+ * @param \phpbb\user $user
* @param string $phpbb_root_path
* @param string $php_ext
* @param string $notification_types_table
* @param string $notifications_table
* @param string $user_notifications_table
- * @return phpbb_notification_manager
+ * @return \phpbb\notification\manager
*/
- public function __construct($notification_types, $notification_methods, $phpbb_container, phpbb_user_loader $user_loader, phpbb_db_driver $db, phpbb_cache_service $cache, $user, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table)
+ public function __construct($notification_types, $notification_methods, $phpbb_container, \phpbb\user_loader $user_loader, \phpbb\db\driver\driver $db, \phpbb\cache\service $cache, $user, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table)
{
$this->notification_types = $notification_types;
$this->notification_methods = $notification_methods;
@@ -402,7 +404,7 @@ class phpbb_notification_manager
$pre_create_data = $notification->pre_create_insert_array($data, $notify_users);
unset($notification);
- $insert_buffer = new phpbb_db_sql_insert_buffer($this->db, $this->notifications_table);
+ $insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, $this->notifications_table);
// Go through each user so we can insert a row in the DB and then notify them by their desired means
foreach ($notify_users as $user => $methods)
@@ -490,15 +492,15 @@ class phpbb_notification_manager
*
* @param string|array $notification_type_name Type identifier or array of item types (only acceptable if the $item_id is identical for the specified types)
* @param int|array $item_id Identifier within the type (or array of ids)
- * @param array $data Data specific for this type that will be updated
+ * @param mixed $parent_id Parent identifier within the type (or array of ids), used in combination with item_id if specified (Default: false; not checked)
*/
- public function delete_notifications($notification_type_name, $item_id)
+ public function delete_notifications($notification_type_name, $item_id, $parent_id = false)
{
if (is_array($notification_type_name))
{
foreach ($notification_type_name as $type)
{
- $this->delete_notifications($type, $item_id);
+ $this->delete_notifications($type, $item_id, $parent_id);
}
return;
@@ -508,7 +510,8 @@ class phpbb_notification_manager
$sql = 'DELETE FROM ' . $this->notifications_table . '
WHERE notification_type_id = ' . (int) $notification_type_id . '
- AND ' . (is_array($item_id) ? $this->db->sql_in_set('item_id', $item_id) : 'item_id = ' . (int) $item_id);
+ AND ' . (is_array($item_id) ? $this->db->sql_in_set('item_id', $item_id) : 'item_id = ' . (int) $item_id) .
+ (($parent_id !== false) ? ' AND ' . ((is_array($parent_id) ? $this->db->sql_in_set('item_parent_id', $parent_id) : 'item_parent_id = ' . (int) $parent_id)) : '');
$this->db->sql_query($sql);
}
@@ -525,7 +528,7 @@ class phpbb_notification_manager
{
$type = $this->get_item_type_class($type_name);
- if ($type instanceof phpbb_notification_type_interface && $type->is_available())
+ if ($type instanceof \phpbb\notification\type\type_interface && $type->is_available())
{
$options = array_merge(array(
'id' => $type->get_type(),
@@ -561,7 +564,7 @@ class phpbb_notification_manager
{
$method = $this->get_method_class($method_name);
- if ($method instanceof phpbb_notification_method_interface && $method->is_available())
+ if ($method instanceof \phpbb\notification\method\method_interface && $method->is_available())
{
$subscription_methods[$method_name] = array(
'id' => $method->get_type(),
@@ -796,11 +799,13 @@ class phpbb_notification_manager
* Delete all notifications older than a certain time
*
* @param int $timestamp Unix timestamp to delete all notifications that were created before
+ * @param bool $only_unread True (default) to only prune read notifications
*/
- public function prune_notifications($timestamp)
+ public function prune_notifications($timestamp, $only_read = true)
{
$sql = 'DELETE FROM ' . $this->notifications_table . '
- WHERE notification_time < ' . (int) $timestamp;
+ WHERE notification_time < ' . (int) $timestamp .
+ (($only_read) ? ' AND notification_read = 1' : '');
$this->db->sql_query($sql);
}
@@ -834,12 +839,12 @@ class phpbb_notification_manager
protected function load_object($object_name)
{
$object = $this->phpbb_container->get($object_name);
-
+
if (method_exists($object, 'set_notification_manager'))
{
$object->set_notification_manager($this);
}
-
+
return $object;
}
@@ -873,7 +878,7 @@ class phpbb_notification_manager
{
if (!isset($this->notification_types[$notification_type_name]) && !isset($this->notification_types['notification.type.' . $notification_type_name]))
{
- throw new phpbb_notification_exception($this->user->lang('NOTIFICATION_TYPE_NOT_EXIST', $notification_type_name));
+ throw new \phpbb\notification\exception($this->user->lang('NOTIFICATION_TYPE_NOT_EXIST', $notification_type_name));
}
$sql = 'INSERT INTO ' . $this->notification_types_table . ' ' . $this->db->sql_build_array('INSERT', array(
diff --git a/phpBB/phpbb/notification/method/base.php b/phpBB/phpbb/notification/method/base.php
index b633956d01..327f964424 100644
--- a/phpBB/phpbb/notification/method/base.php
+++ b/phpBB/phpbb/notification/method/base.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\notification\method;
+
/**
* @ignore
*/
@@ -19,33 +21,33 @@ if (!defined('IN_PHPBB'))
* Base notifications method class
* @package notifications
*/
-abstract class phpbb_notification_method_base implements phpbb_notification_method_interface
+abstract class base implements \phpbb\notification\method\method_interface
{
- /** @var phpbb_notification_manager */
+ /** @var \phpbb\notification\manager */
protected $notification_manager;
- /** @var phpbb_user_loader */
+ /** @var \phpbb\user_loader */
protected $user_loader;
- /** @var phpbb_db_driver */
+ /** @var \phpbb\db\driver\driver */
protected $db;
- /** @var phpbb_cache_driver_interface */
+ /** @var \phpbb\cache\driver\driver_interface */
protected $cache;
- /** @var phpbb_template */
+ /** @var \phpbb\template\template */
protected $template;
- /** @var phpbb_extension_manager */
+ /** @var \phpbb\extension\manager */
protected $extension_manager;
- /** @var phpbb_user */
+ /** @var \phpbb\user */
protected $user;
- /** @var phpbb_auth */
+ /** @var \phpbb\auth\auth */
protected $auth;
- /** @var phpbb_config */
+ /** @var \phpbb\config\config */
protected $config;
/** @var string */
@@ -64,17 +66,17 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth
/**
* Notification Method Base Constructor
*
- * @param phpbb_user_loader $user_loader
- * @param phpbb_db_driver $db
- * @param phpbb_cache_driver_interface $cache
- * @param phpbb_user $user
- * @param phpbb_auth $auth
- * @param phpbb_config $config
+ * @param \phpbb\user_loader $user_loader
+ * @param \phpbb\db\driver\driver $db
+ * @param \phpbb\cache\driver\driver_interface $cache
+ * @param \phpbb\user $user
+ * @param \phpbb\auth\auth $auth
+ * @param \phpbb\config\config $config
* @param string $phpbb_root_path
* @param string $php_ext
- * @return phpbb_notification_method_base
+ * @return \phpbb\notification\method\base
*/
- public function __construct(phpbb_user_loader $user_loader, phpbb_db_driver $db, phpbb_cache_driver_interface $cache, $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext)
+ public function __construct(\phpbb\user_loader $user_loader, \phpbb\db\driver\driver $db, \phpbb\cache\driver\driver_interface $cache, $user, \phpbb\auth\auth $auth, \phpbb\config\config $config, $phpbb_root_path, $php_ext)
{
$this->user_loader = $user_loader;
$this->db = $db;
@@ -89,9 +91,9 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth
/**
* Set notification manager (required)
*
- * @param phpbb_notification_manager $notification_manager
+ * @param \phpbb\notification\manager $notification_manager
*/
- public function set_notification_manager(phpbb_notification_manager $notification_manager)
+ public function set_notification_manager(\phpbb\notification\manager $notification_manager)
{
$this->notification_manager = $notification_manager;
}
@@ -99,9 +101,9 @@ abstract class phpbb_notification_method_base implements phpbb_notification_meth
/**
* Add a notification to the queue
*
- * @param phpbb_notification_type_interface $notification
+ * @param \phpbb\notification\type\type_interface $notification
*/
- public function add_to_queue(phpbb_notification_type_interface $notification)
+ public function add_to_queue(\phpbb\notification\type\type_interface $notification)
{
$this->queue[] = $notification;
}
diff --git a/phpBB/phpbb/notification/method/email.php b/phpBB/phpbb/notification/method/email.php
index 571b0ec656..b761eb5a28 100644
--- a/phpBB/phpbb/notification/method/email.php
+++ b/phpBB/phpbb/notification/method/email.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\notification\method;
+
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
-class phpbb_notification_method_email extends phpbb_notification_method_messenger_base
+class email extends \phpbb\notification\method\messenger_base
{
/**
* Get notification method name
diff --git a/phpBB/phpbb/notification/method/jabber.php b/phpBB/phpbb/notification/method/jabber.php
index d3b756d020..6ec21bb735 100644
--- a/phpBB/phpbb/notification/method/jabber.php
+++ b/phpBB/phpbb/notification/method/jabber.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\notification\method;
+
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
-class phpbb_notification_method_jabber extends phpbb_notification_method_messenger_base
+class jabber extends \phpbb\notification\method\messenger_base
{
/**
* Get notification method name
diff --git a/phpBB/phpbb/notification/method/messenger_base.php b/phpBB/phpbb/notification/method/messenger_base.php
index 4966aa94bc..b1b30f29b7 100644
--- a/phpBB/phpbb/notification/method/messenger_base.php
+++ b/phpBB/phpbb/notification/method/messenger_base.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\notification\method;
+
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
-abstract class phpbb_notification_method_messenger_base extends phpbb_notification_method_base
+abstract class messenger_base extends \phpbb\notification\method\base
{
/**
* Notify using phpBB messenger
@@ -60,7 +62,7 @@ abstract class phpbb_notification_method_messenger_base extends phpbb_notificati
{
include($this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext);
}
- $messenger = new messenger();
+ $messenger = new \messenger();
$board_url = generate_board_url();
// Time to go through the queue and send emails
diff --git a/phpBB/phpbb/notification/method/interface.php b/phpBB/phpbb/notification/method/method_interface.php
index ef875942cc..0131a8bde0 100644
--- a/phpBB/phpbb/notification/method/interface.php
+++ b/phpBB/phpbb/notification/method/method_interface.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\notification\method;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* Base notifications method interface
* @package notifications
*/
-interface phpbb_notification_method_interface
+interface method_interface
{
/**
* Get notification method name
@@ -37,9 +39,9 @@ interface phpbb_notification_method_interface
/**
* Add a notification to the queue
*
- * @param phpbb_notification_type_interface $notification
+ * @param \phpbb\notification\type\type_interface $notification
*/
- public function add_to_queue(phpbb_notification_type_interface $notification);
+ public function add_to_queue(\phpbb\notification\type\type_interface $notification);
/**
* Parse the queue and notify the users
diff --git a/phpBB/phpbb/notification/type/approve_post.php b/phpBB/phpbb/notification/type/approve_post.php
index 1a30781c35..cf4ec57989 100644
--- a/phpBB/phpbb/notification/type/approve_post.php
+++ b/phpBB/phpbb/notification/type/approve_post.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\notification\type;
+
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
-class phpbb_notification_type_approve_post extends phpbb_notification_type_post
+class approve_post extends \phpbb\notification\type\post
{
/**
* Get notification type name
diff --git a/phpBB/phpbb/notification/type/approve_topic.php b/phpBB/phpbb/notification/type/approve_topic.php
index e728e9ac30..ca5bb67754 100644
--- a/phpBB/phpbb/notification/type/approve_topic.php
+++ b/phpBB/phpbb/notification/type/approve_topic.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\notification\type;
+
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
-class phpbb_notification_type_approve_topic extends phpbb_notification_type_topic
+class approve_topic extends \phpbb\notification\type\topic
{
/**
* Get notification type name
diff --git a/phpBB/phpbb/notification/type/base.php b/phpBB/phpbb/notification/type/base.php
index 46517f1c9b..3c44468bb8 100644
--- a/phpBB/phpbb/notification/type/base.php
+++ b/phpBB/phpbb/notification/type/base.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\notification\type;
+
/**
* @ignore
*/
@@ -19,30 +21,30 @@ if (!defined('IN_PHPBB'))
* Base notifications class
* @package notifications
*/
-abstract class phpbb_notification_type_base implements phpbb_notification_type_interface
+abstract class base implements \phpbb\notification\type\type_interface
{
- /** @var phpbb_notification_manager */
+ /** @var \phpbb\notification\manager */
protected $notification_manager;
- /** @var phpbb_user_loader */
+ /** @var \phpbb\user_loader */
protected $user_loader;
- /** @var phpbb_db_driver */
+ /** @var \phpbb\db\driver\driver */
protected $db;
- /** @var phpbb_cache_driver_interface */
+ /** @var \phpbb\cache\driver\driver_interface */
protected $cache;
- /** @var phpbb_template */
+ /** @var \phpbb\template\template */
protected $template;
- /** @var phpbb_user */
+ /** @var \phpbb\user */
protected $user;
- /** @var phpbb_auth */
+ /** @var \phpbb\auth\auth */
protected $auth;
- /** @var phpbb_config */
+ /** @var \phpbb\config\config */
protected $config;
/** @var string */
@@ -93,21 +95,21 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
/**
* Notification Type Base Constructor
- *
- * @param phpbb_user_loader $user_loader
- * @param phpbb_db_driver $db
- * @param phpbb_cache_driver_interface $cache
- * @param phpbb_user $user
- * @param phpbb_auth $auth
- * @param phpbb_config $config
+ *
+ * @param \phpbb\user_loader $user_loader
+ * @param \phpbb\db\driver\driver $db
+ * @param \phpbb\cache\driver\driver_interface $cache
+ * @param \phpbb\user $user
+ * @param \phpbb\auth\auth $auth
+ * @param \phpbb\config\config $config
* @param string $phpbb_root_path
* @param string $php_ext
* @param string $notification_types_table
* @param string $notifications_table
* @param string $user_notifications_table
- * @return phpbb_notification_type_base
+ * @return \phpbb\notification\type\base
*/
- public function __construct(phpbb_user_loader $user_loader, phpbb_db_driver $db, phpbb_cache_driver_interface $cache, $user, phpbb_auth $auth, phpbb_config $config, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table)
+ public function __construct(\phpbb\user_loader $user_loader, \phpbb\db\driver\driver $db, \phpbb\cache\driver\driver_interface $cache, $user, \phpbb\auth\auth $auth, \phpbb\config\config $config, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table)
{
$this->user_loader = $user_loader;
$this->db = $db;
@@ -126,10 +128,10 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
/**
* Set notification manager (required)
- *
- * @param phpbb_notification_manager $notification_manager
+ *
+ * @param \phpbb\notification\manager $notification_manager
*/
- public function set_notification_manager(phpbb_notification_manager $notification_manager)
+ public function set_notification_manager(\phpbb\notification\manager $notification_manager)
{
$this->notification_manager = $notification_manager;
@@ -150,7 +152,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
/**
* Magic method to get data from this notification
- *
+ *
* @param mixed $name
* @return mixed
*/
@@ -162,7 +164,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
/**
* Magic method to set data on this notification
- *
+ *
* @param mixed $name
* @return null
*/
@@ -174,9 +176,9 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
/**
* Magic method to get a string of this notification
- *
+ *
* Primarily for testing
- *
+ *
* @param string $name
* @return mixed
*/
@@ -283,7 +285,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
/**
* Prepare to output the notification to the template
- *
+ *
* @return array Template variables
*/
public function prepare_for_display()
@@ -331,7 +333,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
/**
* Get the user's avatar (fall back)
- *
+ *
* @return string
*/
public function get_avatar()
@@ -341,7 +343,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
/**
* Get the special items to load (fall back)
- *
+ *
* @return array
*/
public function get_load_special()
@@ -359,7 +361,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
/**
* Is available (fall back)
- *
+ *
* @return bool
*/
public function is_available()
@@ -369,7 +371,7 @@ abstract class phpbb_notification_type_base implements phpbb_notification_type_i
/**
* Pre create insert array function (fall back)
- *
+ *
* @return array
*/
public function pre_create_insert_array($type_data, $notify_users)
diff --git a/phpBB/phpbb/notification/type/bookmark.php b/phpBB/phpbb/notification/type/bookmark.php
index ae2e75d3eb..50ea7380af 100644
--- a/phpBB/phpbb/notification/type/bookmark.php
+++ b/phpBB/phpbb/notification/type/bookmark.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\notification\type;
+
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
-class phpbb_notification_type_bookmark extends phpbb_notification_type_post
+class bookmark extends \phpbb\notification\type\post
{
/**
* Get notification type name
diff --git a/phpBB/phpbb/notification/type/disapprove_post.php b/phpBB/phpbb/notification/type/disapprove_post.php
index 951c7e0254..0c9162ec5c 100644
--- a/phpBB/phpbb/notification/type/disapprove_post.php
+++ b/phpBB/phpbb/notification/type/disapprove_post.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\notification\type;
+
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
-class phpbb_notification_type_disapprove_post extends phpbb_notification_type_approve_post
+class disapprove_post extends \phpbb\notification\type\approve_post
{
/**
* Get notification type name
diff --git a/phpBB/phpbb/notification/type/disapprove_topic.php b/phpBB/phpbb/notification/type/disapprove_topic.php
index 038e528797..dde6f83ec4 100644
--- a/phpBB/phpbb/notification/type/disapprove_topic.php
+++ b/phpBB/phpbb/notification/type/disapprove_topic.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\notification\type;
+
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
-class phpbb_notification_type_disapprove_topic extends phpbb_notification_type_approve_topic
+class disapprove_topic extends \phpbb\notification\type\approve_topic
{
/**
* Get notification type name
diff --git a/phpBB/phpbb/notification/type/group_request.php b/phpBB/phpbb/notification/type/group_request.php
new file mode 100644
index 0000000000..1768a8fffa
--- /dev/null
+++ b/phpBB/phpbb/notification/type/group_request.php
@@ -0,0 +1,165 @@
+<?php
+/**
+*
+* @package notifications
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+namespace phpbb\notification\type;
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+class group_request extends \phpbb\notification\type\base
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function get_type()
+ {
+ return 'group_request';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static $notification_option = array(
+ 'lang' => 'NOTIFICATION_TYPE_GROUP_REQUEST',
+ );
+
+ /**
+ * {@inheritdoc}
+ */
+ public function is_available()
+ {
+ // Leader of any groups?
+ $sql = 'SELECT group_id
+ FROM ' . USER_GROUP_TABLE . '
+ WHERE user_id = ' . (int) $this->user->data['user_id'] . '
+ AND group_leader = 1';
+ $result = $this->db->sql_query_limit($sql, 1);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ return (!empty($row)) ? true : false;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function get_item_id($group)
+ {
+ return (int) $group['user_id'];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function get_item_parent_id($group)
+ {
+ // Group id is the parent
+ return (int) $group['group_id'];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function find_users_for_notification($group, $options = array())
+ {
+ $options = array_merge(array(
+ 'ignore_users' => array(),
+ ), $options);
+
+ $sql = 'SELECT user_id
+ FROM ' . USER_GROUP_TABLE . '
+ WHERE group_leader = 1
+ AND group_id = ' . (int) $group['group_id'];
+ $result = $this->db->sql_query($sql);
+
+ $user_ids = array();
+ while ($row = $this->db->sql_fetchrow($result))
+ {
+ $user_ids[] = (int) $row['user_id'];
+ }
+ $this->db->sql_freeresult($result);
+
+ $this->user_loader->load_users($user_ids);
+
+ return $this->check_user_notification_options($user_ids, $options);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_avatar()
+ {
+ return $this->user_loader->get_avatar($this->item_id);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_title()
+ {
+ $username = $this->user_loader->get_username($this->item_id, 'no_profile');
+
+ return $this->user->lang('NOTIFICATION_GROUP_REQUEST', $username, $this->get_data('group_name'));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_email_template()
+ {
+ return 'group_request';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_email_template_variables()
+ {
+ $user_data = $this->user_loader->get_user($this->item_id);
+
+ return array(
+ 'GROUP_NAME' => htmlspecialchars_decode($this->get_data('group_name')),
+ 'REQUEST_USERNAME' => htmlspecialchars_decode($user_data['username']),
+
+ 'U_PENDING' => generate_board_url() . "/ucp.{$this->php_ext}?i=groups&mode=manage&action=list&g={$this->item_parent_id}",
+ 'U_GROUP' => generate_board_url() . "/memberlist.{$this->php_ext}?mode=group&g={$this->item_parent_id}",
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_url()
+ {
+ return append_sid($this->phpbb_root_path . 'ucp.' . $this->php_ext, "i=groups&mode=manage&action=list&g={$this->item_parent_id}");
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function users_to_query()
+ {
+ return array($this->item_id);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function create_insert_array($group, $pre_create_data = array())
+ {
+ $this->set_data('group_name', $group['group_name']);
+
+ return parent::create_insert_array($group, $pre_create_data);
+ }
+}
diff --git a/phpBB/phpbb/notification/type/group_request_approved.php b/phpBB/phpbb/notification/type/group_request_approved.php
new file mode 100644
index 0000000000..be4a902acd
--- /dev/null
+++ b/phpBB/phpbb/notification/type/group_request_approved.php
@@ -0,0 +1,120 @@
+<?php
+/**
+*
+* @package notifications
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+namespace phpbb\notification\type;
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+class group_request_approved extends \phpbb\notification\type\base
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function get_type()
+ {
+ return 'group_request_approved';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function is_available()
+ {
+ return false;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function get_item_id($group)
+ {
+ return (int) $group['group_id'];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public static function get_item_parent_id($group)
+ {
+ return 0;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function find_users_for_notification($group, $options = array())
+ {
+ $users = array();
+
+ $group['user_ids'] = (!is_array($group['user_ids'])) ? array($group['user_ids']) : $group['user_ids'];
+
+ foreach ($group['user_ids'] as $user_id)
+ {
+ $users[$user_id] = array('');
+ }
+
+ return $users;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_title()
+ {
+ return $this->user->lang('NOTIFICATION_GROUP_REQUEST_APPROVED', $this->get_data('group_name'));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_url()
+ {
+ return append_sid($this->phpbb_root_path . 'memberlist.' . $this->php_ext, "mode=group&g={$this->item_id}");
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function create_insert_array($group, $pre_create_data = array())
+ {
+ $this->set_data('group_name', $group['group_name']);
+
+ return parent::create_insert_array($group, $pre_create_data);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function users_to_query()
+ {
+ return array();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_email_template()
+ {
+ return false;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_email_template_variables()
+ {
+ return array();
+ }
+}
diff --git a/phpBB/phpbb/notification/type/pm.php b/phpBB/phpbb/notification/type/pm.php
index b3db7ad5ad..bed0807b0f 100644
--- a/phpBB/phpbb/notification/type/pm.php
+++ b/phpBB/phpbb/notification/type/pm.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\notification\type;
+
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
-class phpbb_notification_type_pm extends phpbb_notification_type_base
+class pm extends \phpbb\notification\type\base
{
/**
* Get notification type name
diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php
index 9207fd866e..fe50e7f172 100644
--- a/phpBB/phpbb/notification/type/post.php
+++ b/phpBB/phpbb/notification/type/post.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\notification\type;
+
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
-class phpbb_notification_type_post extends phpbb_notification_type_base
+class post extends \phpbb\notification\type\base
{
/**
* Get notification type name
diff --git a/phpBB/phpbb/notification/type/post_in_queue.php b/phpBB/phpbb/notification/type/post_in_queue.php
index bc4b15cdc3..f05ed1ce9a 100644
--- a/phpBB/phpbb/notification/type/post_in_queue.php
+++ b/phpBB/phpbb/notification/type/post_in_queue.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\notification\type;
+
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
-class phpbb_notification_type_post_in_queue extends phpbb_notification_type_post
+class post_in_queue extends \phpbb\notification\type\post
{
/**
* Get notification type name
diff --git a/phpBB/phpbb/notification/type/quote.php b/phpBB/phpbb/notification/type/quote.php
index 0ed13f36fb..56cfbc9364 100644
--- a/phpBB/phpbb/notification/type/quote.php
+++ b/phpBB/phpbb/notification/type/quote.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\notification\type;
+
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
-class phpbb_notification_type_quote extends phpbb_notification_type_post
+class quote extends \phpbb\notification\type\post
{
/**
* Get notification type name
diff --git a/phpBB/phpbb/notification/type/report_pm.php b/phpBB/phpbb/notification/type/report_pm.php
index 3fa73bab41..fd3f754f8a 100644
--- a/phpBB/phpbb/notification/type/report_pm.php
+++ b/phpBB/phpbb/notification/type/report_pm.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\notification\type;
+
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
-class phpbb_notification_type_report_pm extends phpbb_notification_type_pm
+class report_pm extends \phpbb\notification\type\pm
{
/**
* Get notification type name
diff --git a/phpBB/phpbb/notification/type/report_pm_closed.php b/phpBB/phpbb/notification/type/report_pm_closed.php
index 63dfa92064..2e4a1ceb30 100644
--- a/phpBB/phpbb/notification/type/report_pm_closed.php
+++ b/phpBB/phpbb/notification/type/report_pm_closed.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\notification\type;
+
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
-class phpbb_notification_type_report_pm_closed extends phpbb_notification_type_pm
+class report_pm_closed extends \phpbb\notification\type\pm
{
/**
* Get notification type name
diff --git a/phpBB/phpbb/notification/type/report_post.php b/phpBB/phpbb/notification/type/report_post.php
index de5c54a291..c2dad6f1bb 100644
--- a/phpBB/phpbb/notification/type/report_post.php
+++ b/phpBB/phpbb/notification/type/report_post.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\notification\type;
+
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
-class phpbb_notification_type_report_post extends phpbb_notification_type_post_in_queue
+class report_post extends \phpbb\notification\type\post_in_queue
{
/**
* Get notification type name
diff --git a/phpBB/phpbb/notification/type/report_post_closed.php b/phpBB/phpbb/notification/type/report_post_closed.php
index 3916cd8db7..270ccf0a1a 100644
--- a/phpBB/phpbb/notification/type/report_post_closed.php
+++ b/phpBB/phpbb/notification/type/report_post_closed.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\notification\type;
+
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
-class phpbb_notification_type_report_post_closed extends phpbb_notification_type_post
+class report_post_closed extends \phpbb\notification\type\post
{
/**
* Get notification type name
diff --git a/phpBB/phpbb/notification/type/topic.php b/phpBB/phpbb/notification/type/topic.php
index 22436d3fb1..8db02f610b 100644
--- a/phpBB/phpbb/notification/type/topic.php
+++ b/phpBB/phpbb/notification/type/topic.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\notification\type;
+
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
-class phpbb_notification_type_topic extends phpbb_notification_type_base
+class topic extends \phpbb\notification\type\base
{
/**
* Get notification type name
diff --git a/phpBB/phpbb/notification/type/topic_in_queue.php b/phpBB/phpbb/notification/type/topic_in_queue.php
index f735e10c00..056651bc53 100644
--- a/phpBB/phpbb/notification/type/topic_in_queue.php
+++ b/phpBB/phpbb/notification/type/topic_in_queue.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\notification\type;
+
/**
* @ignore
*/
@@ -21,7 +23,7 @@ if (!defined('IN_PHPBB'))
*
* @package notifications
*/
-class phpbb_notification_type_topic_in_queue extends phpbb_notification_type_topic
+class topic_in_queue extends \phpbb\notification\type\topic
{
/**
* Get notification type name
diff --git a/phpBB/phpbb/notification/type/interface.php b/phpBB/phpbb/notification/type/type_interface.php
index a40fdafd09..cfc6cd461e 100644
--- a/phpBB/phpbb/notification/type/interface.php
+++ b/phpBB/phpbb/notification/type/type_interface.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\notification\type;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* Base notifications interface
* @package notifications
*/
-interface phpbb_notification_type_interface
+interface type_interface
{
/**
* Get notification type name
@@ -27,7 +29,7 @@ interface phpbb_notification_type_interface
* @return string
*/
public function get_type();
-
+
/**
* Set initial data from the database
*
diff --git a/phpBB/phpbb/permissions.php b/phpBB/phpbb/permissions.php
index 0fbacdad8a..d0405471bc 100644
--- a/phpBB/phpbb/permissions.php
+++ b/phpBB/phpbb/permissions.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb;
+
/**
* DO NOT CHANGE
*/
@@ -15,28 +17,28 @@ if (!defined('IN_PHPBB'))
exit;
}
-class phpbb_permissions
+class permissions
{
/**
* Event dispatcher object
- * @var phpbb_event_dispatcher
+ * @var \phpbb\event\dispatcher
*/
protected $dispatcher;
/**
* User object
- * @var phpbb_user
+ * @var \phpbb\user
*/
protected $user;
/**
* Constructor
*
- * @param phpbb_event_dispatcher $phpbb_dispatcher Event dispatcher
- * @param phpbb_user $user User Object
+ * @param \phpbb\event\dispatcher $phpbb_dispatcher Event dispatcher
+ * @param \phpbb\user $user User Object
* @return null
*/
- public function __construct(phpbb_event_dispatcher $phpbb_dispatcher, phpbb_user $user)
+ public function __construct(\phpbb\event\dispatcher $phpbb_dispatcher, \phpbb\user $user)
{
$this->dispatcher = $phpbb_dispatcher;
$this->user = $user;
@@ -241,14 +243,14 @@ class phpbb_permissions
// Forum Permissions
'f_list' => array('lang' => 'ACL_F_LIST', 'cat' => 'actions'),
- 'f_read' => array('lang' => 'ACL_F_READ', 'cat' => 'actions'),
+ 'f_read' => array('lang' => 'ACL_F_READ', 'cat' => 'actions'),
'f_search' => array('lang' => 'ACL_F_SEARCH', 'cat' => 'actions'),
'f_subscribe' => array('lang' => 'ACL_F_SUBSCRIBE', 'cat' => 'actions'),
- 'f_print' => array('lang' => 'ACL_F_PRINT', 'cat' => 'actions'),
- 'f_email' => array('lang' => 'ACL_F_EMAIL', 'cat' => 'actions'),
+ 'f_print' => array('lang' => 'ACL_F_PRINT', 'cat' => 'actions'),
+ 'f_email' => array('lang' => 'ACL_F_EMAIL', 'cat' => 'actions'),
'f_bump' => array('lang' => 'ACL_F_BUMP', 'cat' => 'actions'),
'f_user_lock' => array('lang' => 'ACL_F_USER_LOCK', 'cat' => 'actions'),
- 'f_download' => array('lang' => 'ACL_F_DOWNLOAD', 'cat' => 'actions'),
+ 'f_download' => array('lang' => 'ACL_F_DOWNLOAD', 'cat' => 'actions'),
'f_report' => array('lang' => 'ACL_F_REPORT', 'cat' => 'actions'),
'f_post' => array('lang' => 'ACL_F_POST', 'cat' => 'post'),
@@ -259,11 +261,11 @@ class phpbb_permissions
'f_delete' => array('lang' => 'ACL_F_DELETE', 'cat' => 'post'),
'f_ignoreflood' => array('lang' => 'ACL_F_IGNOREFLOOD', 'cat' => 'post'),
'f_postcount' => array('lang' => 'ACL_F_POSTCOUNT', 'cat' => 'post'),
- 'f_noapprove' => array('lang' => 'ACL_F_NOAPPROVE', 'cat' => 'post'),
+ 'f_noapprove' => array('lang' => 'ACL_F_NOAPPROVE', 'cat' => 'post'),
- 'f_attach' => array('lang' => 'ACL_F_ATTACH', 'cat' => 'content'),
+ 'f_attach' => array('lang' => 'ACL_F_ATTACH', 'cat' => 'content'),
'f_icons' => array('lang' => 'ACL_F_ICONS', 'cat' => 'content'),
- 'f_bbcode' => array('lang' => 'ACL_F_BBCODE', 'cat' => 'content'),
+ 'f_bbcode' => array('lang' => 'ACL_F_BBCODE', 'cat' => 'content'),
'f_flash' => array('lang' => 'ACL_F_FLASH', 'cat' => 'content'),
'f_img' => array('lang' => 'ACL_F_IMG', 'cat' => 'content'),
'f_sigs' => array('lang' => 'ACL_F_SIGS', 'cat' => 'content'),
diff --git a/phpBB/phpbb/php/ini.php b/phpBB/phpbb/php/ini.php
index 17e8c54a57..8767091aba 100644
--- a/phpBB/phpbb/php/ini.php
+++ b/phpBB/phpbb/php/ini.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\php;
+
/**
* @ignore
*/
@@ -22,7 +24,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB
*/
-class phpbb_php_ini
+class ini
{
/**
* Simple wrapper for ini_get()
diff --git a/phpBB/phpbb/request/deactivated_super_global.php b/phpBB/phpbb/request/deactivated_super_global.php
index cc05847ec7..8f39960477 100644
--- a/phpBB/phpbb/request/deactivated_super_global.php
+++ b/phpBB/phpbb/request/deactivated_super_global.php
@@ -1,12 +1,14 @@
<?php
/**
*
-* @package phpbb_request
+* @package \phpbb\request\request
* @copyright (c) 2010 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
+namespace phpbb\request;
+
/**
* @ignore
*/
@@ -19,9 +21,9 @@ if (!defined('IN_PHPBB'))
* Replacement for a superglobal (like $_GET or $_POST) which calls
* trigger_error on all operations but isset, overloads the [] operator with SPL.
*
-* @package phpbb_request
+* @package \phpbb\request\request
*/
-class phpbb_request_deactivated_super_global implements ArrayAccess, Countable, IteratorAggregate
+class deactivated_super_global implements \ArrayAccess, \Countable, \IteratorAggregate
{
/**
* @var string Holds the name of the superglobal this is replacing.
@@ -29,23 +31,23 @@ class phpbb_request_deactivated_super_global implements ArrayAccess, Countable,
private $name;
/**
- * @var phpbb_request_interface::POST|GET|REQUEST|COOKIE Super global constant.
+ * @var \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE Super global constant.
*/
private $super_global;
/**
- * @var phpbb_request_interface The request class instance holding the actual request data.
+ * @var \phpbb\request\request_interface The request class instance holding the actual request data.
*/
private $request;
/**
* Constructor generates an error message fitting the super global to be used within the other functions.
*
- * @param phpbb_request_interface $request A request class instance holding the real super global data.
+ * @param \phpbb\request\request_interface $request A request class instance holding the real super global data.
* @param string $name Name of the super global this is a replacement for - e.g. '_GET'.
- * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global The variable's super global constant.
+ * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global The variable's super global constant.
*/
- public function __construct(phpbb_request_interface $request, $name, $super_global)
+ public function __construct(\phpbb\request\request_interface $request, $name, $super_global)
{
$this->request = $request;
$this->name = $name;
@@ -84,7 +86,7 @@ class phpbb_request_deactivated_super_global implements ArrayAccess, Countable,
}
/**#@+
- * Part of the ArrayAccess implementation, will always result in a FATAL error.
+ * Part of the \ArrayAccess implementation, will always result in a FATAL error.
*/
public function offsetGet($offset)
{
@@ -103,7 +105,7 @@ class phpbb_request_deactivated_super_global implements ArrayAccess, Countable,
/**#@-*/
/**
- * Part of the Countable implementation, will always result in a FATAL error
+ * Part of the \Countable implementation, will always result in a FATAL error
*/
public function count()
{
diff --git a/phpBB/phpbb/request/request.php b/phpBB/phpbb/request/request.php
index ae3c526d89..1c388b3c73 100644
--- a/phpBB/phpbb/request/request.php
+++ b/phpBB/phpbb/request/request.php
@@ -1,12 +1,14 @@
<?php
/**
*
-* @package phpbb_request
+* @package \phpbb\request\request
* @copyright (c) 2010 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
+namespace phpbb\request;
+
/**
* @ignore
*/
@@ -21,20 +23,20 @@ if (!defined('IN_PHPBB'))
* It provides a method to disable access to input data through super globals.
* This should force MOD authors to read about data validation.
*
-* @package phpbb_request
+* @package \phpbb\request\request
*/
-class phpbb_request implements phpbb_request_interface
+class request implements \phpbb\request\request_interface
{
/**
* @var array The names of super global variables that this class should protect if super globals are disabled.
*/
protected $super_globals = array(
- phpbb_request_interface::POST => '_POST',
- phpbb_request_interface::GET => '_GET',
- phpbb_request_interface::REQUEST => '_REQUEST',
- phpbb_request_interface::COOKIE => '_COOKIE',
- phpbb_request_interface::SERVER => '_SERVER',
- phpbb_request_interface::FILES => '_FILES',
+ \phpbb\request\request_interface::POST => '_POST',
+ \phpbb\request\request_interface::GET => '_GET',
+ \phpbb\request\request_interface::REQUEST => '_REQUEST',
+ \phpbb\request\request_interface::COOKIE => '_COOKIE',
+ \phpbb\request\request_interface::SERVER => '_SERVER',
+ \phpbb\request\request_interface::FILES => '_FILES',
);
/**
@@ -53,15 +55,15 @@ class phpbb_request implements phpbb_request_interface
protected $input;
/**
- * @var phpbb_request_type_cast_helper_interface An instance of a type cast helper providing convenience methods for type conversions.
+ * @var \phpbb\request\type_cast_helper_interface An instance of a type cast helper providing convenience methods for type conversions.
*/
protected $type_cast_helper;
/**
* Initialises the request class, that means it stores all input data in {@link $input input}
- * and then calls {@link phpbb_request_deactivated_super_global phpbb_request_deactivated_super_global}
+ * and then calls {@link \phpbb\request\deactivated_super_global \phpbb\request\deactivated_super_global}
*/
- public function __construct(phpbb_request_type_cast_helper_interface $type_cast_helper = null, $disable_super_globals = true)
+ public function __construct(\phpbb\request\type_cast_helper_interface $type_cast_helper = null, $disable_super_globals = true)
{
if ($type_cast_helper)
{
@@ -69,7 +71,7 @@ class phpbb_request implements phpbb_request_interface
}
else
{
- $this->type_cast_helper = new phpbb_request_type_cast_helper();
+ $this->type_cast_helper = new \phpbb\request\type_cast_helper();
}
foreach ($this->super_globals as $const => $super_global)
@@ -78,8 +80,8 @@ class phpbb_request implements phpbb_request_interface
}
// simulate request_order = GP
- $this->original_request = $this->input[phpbb_request_interface::REQUEST];
- $this->input[phpbb_request_interface::REQUEST] = $this->input[phpbb_request_interface::POST] + $this->input[phpbb_request_interface::GET];
+ $this->original_request = $this->input[\phpbb\request\request_interface::REQUEST];
+ $this->input[\phpbb\request\request_interface::REQUEST] = $this->input[\phpbb\request\request_interface::POST] + $this->input[\phpbb\request\request_interface::GET];
if ($disable_super_globals)
{
@@ -99,7 +101,7 @@ class phpbb_request implements phpbb_request_interface
/**
* Disables access of super globals specified in $super_globals.
- * This is achieved by overwriting the super globals with instances of {@link phpbb_request_deactivated_super_global phpbb_request_deactivated_super_global}
+ * This is achieved by overwriting the super globals with instances of {@link \phpbb\request\deactivated_super_global \phpbb\request\deactivated_super_global}
*/
public function disable_super_globals()
{
@@ -108,7 +110,7 @@ class phpbb_request implements phpbb_request_interface
foreach ($this->super_globals as $const => $super_global)
{
unset($GLOBALS[$super_global]);
- $GLOBALS[$super_global] = new phpbb_request_deactivated_super_global($this, $super_global, $const);
+ $GLOBALS[$super_global] = new \phpbb\request\deactivated_super_global($this, $super_global, $const);
}
$this->super_globals_disabled = true;
@@ -144,10 +146,10 @@ class phpbb_request implements phpbb_request_interface
* @param string $var_name The name of the variable that shall be overwritten
* @param mixed $value The value which the variable shall contain.
* If this is null the variable will be unset.
- * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global
+ * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global
* Specifies which super global shall be changed
*/
- public function overwrite($var_name, $value, $super_global = phpbb_request_interface::REQUEST)
+ public function overwrite($var_name, $value, $super_global = \phpbb\request\request_interface::REQUEST)
{
if (!isset($this->super_globals[$super_global]))
{
@@ -193,13 +195,13 @@ class phpbb_request implements phpbb_request_interface
* 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
* Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks
- * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global
+ * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global
* Specifies which super global should be used
*
* @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.
*/
- public function variable($var_name, $default, $multibyte = false, $super_global = phpbb_request_interface::REQUEST)
+ public function variable($var_name, $default, $multibyte = false, $super_global = \phpbb\request\request_interface::REQUEST)
{
return $this->_variable($var_name, $default, $multibyte, $super_global, true);
}
@@ -217,13 +219,13 @@ class phpbb_request implements phpbb_request_interface
* 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
* Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks
- * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global
+ * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global
* Specifies which super global should be used
*
* @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.
*/
- public function untrimmed_variable($var_name, $default, $multibyte, $super_global = phpbb_request_interface::REQUEST)
+ public function untrimmed_variable($var_name, $default, $multibyte, $super_global = \phpbb\request\request_interface::REQUEST)
{
return $this->_variable($var_name, $default, $multibyte, $super_global, false);
}
@@ -234,8 +236,8 @@ class phpbb_request implements phpbb_request_interface
* Also fall back to getenv(), some CGI setups may need it (probably not, but
* whatever).
*
- * @param string|array $var_name See phpbb_request_interface::variable
- * @param mixed $Default See phpbb_request_interface::variable
+ * @param string|array $var_name See \phpbb\request\request_interface::variable
+ * @param mixed $Default See \phpbb\request\request_interface::variable
*
* @return mixed The server variable value.
*/
@@ -243,9 +245,9 @@ class phpbb_request implements phpbb_request_interface
{
$multibyte = true;
- if ($this->is_set($var_name, phpbb_request_interface::SERVER))
+ if ($this->is_set($var_name, \phpbb\request\request_interface::SERVER))
{
- return $this->variable($var_name, $default, $multibyte, phpbb_request_interface::SERVER);
+ return $this->variable($var_name, $default, $multibyte, \phpbb\request\request_interface::SERVER);
}
else
{
@@ -259,7 +261,7 @@ class phpbb_request implements phpbb_request_interface
* Shortcut method to retrieve the value of client HTTP headers.
*
* @param string|array $header_name The name of the header to retrieve.
- * @param mixed $default See phpbb_request_interface::variable
+ * @param mixed $default See \phpbb\request\request_interface::variable
*
* @return mixed The header value.
*/
@@ -279,7 +281,7 @@ class phpbb_request implements phpbb_request_interface
*/
public function file($form_name)
{
- return $this->variable($form_name, array('name' => 'none'), false, phpbb_request_interface::FILES);
+ return $this->variable($form_name, array('name' => 'none'), false, \phpbb\request\request_interface::FILES);
}
/**
@@ -294,7 +296,7 @@ class phpbb_request implements phpbb_request_interface
*/
public function is_set_post($name)
{
- return $this->is_set($name, phpbb_request_interface::POST);
+ return $this->is_set($name, \phpbb\request\request_interface::POST);
}
/**
@@ -302,12 +304,12 @@ class phpbb_request implements phpbb_request_interface
* arrays.
*
* @param string $var Name of the variable
- * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global
+ * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global
* Specifies the super global which shall be checked
*
* @return bool True if the variable was sent as input
*/
- public function is_set($var, $super_global = phpbb_request_interface::REQUEST)
+ public function is_set($var, $super_global = \phpbb\request\request_interface::REQUEST)
{
return isset($this->input[$super_global][$var]);
}
@@ -335,13 +337,13 @@ class phpbb_request implements phpbb_request_interface
/**
* Returns all variable names for a given super global
*
- * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global
+ * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global
* The super global from which names shall be taken
*
* @return array All variable names that are set for the super global.
* Pay attention when using these, they are unsanitised!
*/
- public function variable_names($super_global = phpbb_request_interface::REQUEST)
+ public function variable_names($super_global = \phpbb\request\request_interface::REQUEST)
{
if (!isset($this->input[$super_global]))
{
@@ -362,14 +364,14 @@ class phpbb_request implements phpbb_request_interface
* 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
* Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks
- * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global
+ * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global
* Specifies which super global should be used
* @param bool $trim Indicates whether trim() should be applied to string values.
*
* @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.
*/
- protected function _variable($var_name, $default, $multibyte = false, $super_global = phpbb_request_interface::REQUEST, $trim = true)
+ protected function _variable($var_name, $default, $multibyte = false, $super_global = \phpbb\request\request_interface::REQUEST, $trim = true)
{
$path = false;
@@ -412,4 +414,12 @@ class phpbb_request implements phpbb_request_interface
return $var;
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function get_super_global($super_global = \phpbb\request\request_interface::REQUEST)
+ {
+ return $this->input[$super_global];
+ }
}
diff --git a/phpBB/phpbb/request/interface.php b/phpBB/phpbb/request/request_interface.php
index 741db35917..cd949147f7 100644
--- a/phpBB/phpbb/request/interface.php
+++ b/phpBB/phpbb/request/request_interface.php
@@ -1,12 +1,14 @@
<?php
/**
*
-* @package phpbb_request
+* @package \phpbb\request\request
* @copyright (c) 2010 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
+namespace phpbb\request;
+
/**
* @ignore
*/
@@ -18,9 +20,9 @@ if (!defined('IN_PHPBB'))
/**
* An interface through which all application input can be accessed.
*
-* @package phpbb_request
+* @package \phpbb\request\request
*/
-interface phpbb_request_interface
+interface request_interface
{
/**#@+
* Constant identifying the super global with the same name.
@@ -43,10 +45,10 @@ interface phpbb_request_interface
* @param string $var_name The name of the variable that shall be overwritten
* @param mixed $value The value which the variable shall contain.
* If this is null the variable will be unset.
- * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global
+ * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global
* Specifies which super global shall be changed
*/
- public function overwrite($var_name, $value, $super_global = phpbb_request_interface::REQUEST);
+ public function overwrite($var_name, $value, $super_global = \phpbb\request\request_interface::REQUEST);
/**
* Central type safe input handling function.
@@ -60,19 +62,19 @@ interface phpbb_request_interface
* 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
* Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks
- * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global
+ * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global
* Specifies which super global should be used
*
* @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.
*/
- public function variable($var_name, $default, $multibyte = false, $super_global = phpbb_request_interface::REQUEST);
+ public function variable($var_name, $default, $multibyte = false, $super_global = \phpbb\request\request_interface::REQUEST);
/**
* Shortcut method to retrieve SERVER variables.
*
- * @param string|array $var_name See phpbb_request_interface::variable
- * @param mixed $default See phpbb_request_interface::variable
+ * @param string|array $var_name See \phpbb\request\request_interface::variable
+ * @param mixed $default See \phpbb\request\request_interface::variable
*
* @return mixed The server variable value.
*/
@@ -82,7 +84,7 @@ interface phpbb_request_interface
* Shortcut method to retrieve the value of client HTTP headers.
*
* @param string|array $header_name The name of the header to retrieve.
- * @param mixed $default See phpbb_request_interface::variable
+ * @param mixed $default See \phpbb\request\request_interface::variable
*
* @return mixed The header value.
*/
@@ -105,12 +107,12 @@ interface phpbb_request_interface
* arrays.
*
* @param string $var Name of the variable
- * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global
+ * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global
* Specifies the super global which shall be checked
*
* @return bool True if the variable was sent as input
*/
- public function is_set($var, $super_global = phpbb_request_interface::REQUEST);
+ public function is_set($var, $super_global = \phpbb\request\request_interface::REQUEST);
/**
* Checks whether the current request is an AJAX request (XMLHttpRequest)
@@ -129,11 +131,21 @@ interface phpbb_request_interface
/**
* Returns all variable names for a given super global
*
- * @param phpbb_request_interface::POST|GET|REQUEST|COOKIE $super_global
+ * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global
* The super global from which names shall be taken
*
* @return array All variable names that are set for the super global.
* Pay attention when using these, they are unsanitised!
*/
- public function variable_names($super_global = phpbb_request_interface::REQUEST);
+ public function variable_names($super_global = \phpbb\request\request_interface::REQUEST);
+
+ /**
+ * Returns the original array of the requested super global
+ *
+ * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global
+ * The super global which will be returned
+ *
+ * @return array The original array of the requested super global.
+ */
+ public function get_super_global($super_global = \phpbb\request\request_interface::REQUEST);
}
diff --git a/phpBB/phpbb/request/type_cast_helper.php b/phpBB/phpbb/request/type_cast_helper.php
index 1a5274ed14..262aff73c1 100644
--- a/phpBB/phpbb/request/type_cast_helper.php
+++ b/phpBB/phpbb/request/type_cast_helper.php
@@ -1,12 +1,14 @@
<?php
/**
*
-* @package phpbb_request
+* @package \phpbb\request\request
* @copyright (c) 2010 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
+namespace phpbb\request;
+
/**
* @ignore
*/
@@ -18,9 +20,9 @@ if (!defined('IN_PHPBB'))
/**
* A helper class that provides convenience methods for type casting.
*
-* @package phpbb_request
+* @package \phpbb\request\request
*/
-class phpbb_request_type_cast_helper implements phpbb_request_type_cast_helper_interface
+class type_cast_helper implements \phpbb\request\type_cast_helper_interface
{
/**
diff --git a/phpBB/phpbb/request/type_cast_helper_interface.php b/phpBB/phpbb/request/type_cast_helper_interface.php
index 3920d16fc7..e8195c352e 100644
--- a/phpBB/phpbb/request/type_cast_helper_interface.php
+++ b/phpBB/phpbb/request/type_cast_helper_interface.php
@@ -1,12 +1,14 @@
<?php
/**
*
-* @package phpbb_request
+* @package \phpbb\request\request
* @copyright (c) 2010 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
+namespace phpbb\request;
+
/**
* @ignore
*/
@@ -18,9 +20,9 @@ if (!defined('IN_PHPBB'))
/**
* An interface for type cast operations.
*
-* @package phpbb_request
+* @package \phpbb\request\request
*/
-interface phpbb_request_type_cast_helper_interface
+interface type_cast_helper_interface
{
/**
* Recursively applies addslashes to a variable.
diff --git a/phpBB/phpbb/search/base.php b/phpBB/phpbb/search/base.php
index 914cef9167..f2f982c31b 100644
--- a/phpBB/phpbb/search/base.php
+++ b/phpBB/phpbb/search/base.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\search;
+
/**
* @ignore
*/
@@ -23,12 +25,12 @@ define('SEARCH_RESULT_IN_CACHE', 1);
define('SEARCH_RESULT_INCOMPLETE', 2);
/**
-* phpbb_search_base
+* \phpbb\search\base
* optional base class for search plugins providing simple caching based on ACM
* and functions to retrieve ignore_words and synonyms
* @package search
*/
-class phpbb_search_base
+class base
{
var $ignore_words = array();
var $match_synonym = array();
diff --git a/phpBB/phpbb/search/fulltext_mysql.php b/phpBB/phpbb/search/fulltext_mysql.php
index a1e1b089b9..50d2d2577f 100644
--- a/phpBB/phpbb/search/fulltext_mysql.php
+++ b/phpBB/phpbb/search/fulltext_mysql.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\search;
+
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
* Fulltext search for MySQL
* @package search
*/
-class phpbb_search_fulltext_mysql extends phpbb_search_base
+class fulltext_mysql extends \phpbb\search\base
{
/**
* Associative array holding index stats
@@ -36,19 +38,19 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
/**
* Config object
- * @var phpbb_config
+ * @var \phpbb\config\config
*/
protected $config;
-
+
/**
* Database connection
- * @var phpbb_db_driver
+ * @var \phpbb\db\driver\driver
*/
protected $db;
-
+
/**
* User object
- * @var phpbb_user
+ * @var \phpbb\user
*/
protected $user;
@@ -74,7 +76,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base
/**
* Constructor
- * Creates a new phpbb_search_fulltext_mysql, which is used as a search backend
+ * Creates a new \phpbb\search\fulltext_mysql, which is used as a search backend
*
* @param string|bool $error Any error that occurs is passed on through this reference variable otherwise false
*/
diff --git a/phpBB/phpbb/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php
index 730c3a6c2d..33326f2882 100644
--- a/phpBB/phpbb/search/fulltext_native.php
+++ b/phpBB/phpbb/search/fulltext_native.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\search;
+
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
* phpBB's own db driven fulltext search, version 2
* @package search
*/
-class phpbb_search_fulltext_native extends phpbb_search_base
+class fulltext_native extends \phpbb\search\base
{
/**
* Associative array holding index stats
@@ -80,19 +82,19 @@ class phpbb_search_fulltext_native extends phpbb_search_base
/**
* Config object
- * @var phpbb_config
+ * @var \phpbb\config\config
*/
protected $config;
/**
* Database connection
- * @var phpbb_db_driver
+ * @var \phpbb\db\driver\driver
*/
protected $db;
/**
* User object
- * @var phpbb_user
+ * @var \phpbb\user
*/
protected $user;
@@ -1556,7 +1558,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base
* @param string $encoding Text encoding
* @return string Cleaned up text, only alphanumeric chars are left
*
- * @todo normalizer::cleanup being able to be used?
+ * @todo \normalizer::cleanup being able to be used?
*/
protected function cleanup($text, $allowed_chars = null, $encoding = 'utf-8')
{
@@ -1588,7 +1590,7 @@ class phpbb_search_fulltext_native extends phpbb_search_base
* If we use it more widely, an instance of that class should be held in a
* a global variable instead
*/
- utf_normalizer::nfc($text);
+ \utf_normalizer::nfc($text);
/**
* The first thing we do is:
diff --git a/phpBB/phpbb/search/fulltext_postgres.php b/phpBB/phpbb/search/fulltext_postgres.php
index 6b4b310f2e..756034103e 100644
--- a/phpBB/phpbb/search/fulltext_postgres.php
+++ b/phpBB/phpbb/search/fulltext_postgres.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\search;
+
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
* Fulltext search for PostgreSQL
* @package search
*/
-class phpbb_search_fulltext_postgres extends phpbb_search_base
+class fulltext_postgres extends \phpbb\search\base
{
/**
* Associative array holding index stats
@@ -61,19 +63,19 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
/**
* Config object
- * @var phpbb_config
+ * @var \phpbb\config\config
*/
protected $config;
/**
* Database connection
- * @var phpbb_db_driver
+ * @var \phpbb\db\driver\driver
*/
protected $db;
/**
* User object
- * @var phpbb_user
+ * @var \phpbb\user
*/
protected $user;
@@ -99,7 +101,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
/**
* Constructor
- * Creates a new phpbb_search_fulltext_postgres, which is used as a search backend
+ * Creates a new \phpbb\search\fulltext_postgres, which is used as a search backend
*
* @param string|bool $error Any error that occurs is passed on through this reference variable otherwise false
*/
diff --git a/phpBB/phpbb/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php
index 4f3f852664..cb76d58f49 100644
--- a/phpBB/phpbb/search/fulltext_sphinx.php
+++ b/phpBB/phpbb/search/fulltext_sphinx.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\search;
+
/**
*/
if (!defined('IN_PHPBB'))
@@ -26,7 +28,7 @@ define('SPHINX_CONNECT_WAIT_TIME', 300);
* Fulltext search based on the sphinx search deamon
* @package search
*/
-class phpbb_search_fulltext_sphinx
+class fulltext_sphinx
{
/**
* Associative array holding index stats
@@ -73,25 +75,25 @@ class phpbb_search_fulltext_sphinx
/**
* Auth object
- * @var phpbb_auth
+ * @var \phpbb\auth\auth
*/
protected $auth;
/**
* Config object
- * @var phpbb_config
+ * @var \phpbb\config\config
*/
protected $config;
/**
* Database connection
- * @var phpbb_db_driver
+ * @var \phpbb\db\driver\driver
*/
protected $db;
/**
* Database Tools object
- * @var phpbb_db_tools
+ * @var \phpbb\db\tools
*/
protected $db_tools;
@@ -103,7 +105,7 @@ class phpbb_search_fulltext_sphinx
/**
* User object
- * @var phpbb_user
+ * @var \phpbb\user
*/
protected $user;
@@ -122,7 +124,7 @@ class phpbb_search_fulltext_sphinx
/**
* Constructor
- * Creates a new phpbb_search_fulltext_postgres, which is used as a search backend
+ * Creates a new \phpbb\search\fulltext_postgres, which is used as a search backend
*
* @param string|bool $error Any error that occurs is passed on through this reference variable otherwise false
*/
@@ -135,8 +137,8 @@ class phpbb_search_fulltext_sphinx
$this->db = $db;
$this->auth = $auth;
- // Initialize phpbb_db_tools object
- $this->db_tools = new phpbb_db_tools($this->db);
+ // Initialize \phpbb\db\tools object
+ $this->db_tools = new \phpbb\db\tools($this->db);
if(!$this->config['fulltext_sphinx_id'])
{
@@ -151,7 +153,7 @@ class phpbb_search_fulltext_sphinx
}
// Initialize sphinx client
- $this->sphinx = new SphinxClient();
+ $this->sphinx = new \SphinxClient();
$this->sphinx->SetServer(($this->config['fulltext_sphinx_host'] ? $this->config['fulltext_sphinx_host'] : 'localhost'), ($this->config['fulltext_sphinx_port'] ? (int) $this->config['fulltext_sphinx_port'] : 9312));
@@ -250,7 +252,7 @@ class phpbb_search_fulltext_sphinx
/* Now that we're sure everything was entered correctly,
generate a config for the index. We use a config value
fulltext_sphinx_id for this, as it should be unique. */
- $config_object = new phpbb_search_sphinx_config($this->config_file_data);
+ $config_object = new \phpbb\search\sphinx\config($this->config_file_data);
$config_data = array(
'source source_phpbb_' . $this->id . '_main' => array(
array('type', $this->dbtype . ' # mysql or pgsql'),
diff --git a/phpBB/phpbb/search/sphinx/config.php b/phpBB/phpbb/search/sphinx/config.php
index f1864f0c8c..262d6008cc 100644
--- a/phpBB/phpbb/search/sphinx/config.php
+++ b/phpBB/phpbb/search/sphinx/config.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\search\sphinx;
+
/**
* @ignore
*/
@@ -16,12 +18,12 @@ if (!defined('IN_PHPBB'))
}
/**
-* phpbb_search_sphinx_config
+* \phpbb\search\sphinx\config
* An object representing the sphinx configuration
* Can read it from file and write it back out after modification
* @package search
*/
-class phpbb_search_sphinx_config
+class config
{
private $sections = array();
@@ -44,7 +46,7 @@ class phpbb_search_sphinx_config
* Get a section object by its name
*
* @param string $name The name of the section that shall be returned
- * @return phpbb_search_sphinx_config_section The section object or null if none was found
+ * @return \phpbb\search\sphinx\config_section The section object or null if none was found
*
* @access public
*/
@@ -53,7 +55,7 @@ class phpbb_search_sphinx_config
for ($i = 0, $size = sizeof($this->sections); $i < $size; $i++)
{
// Make sure this is really a section object and not a comment
- if (($this->sections[$i] instanceof phpbb_search_sphinx_config_section) && $this->sections[$i]->get_name() == $name)
+ if (($this->sections[$i] instanceof \phpbb\search\sphinx\config_section) && $this->sections[$i]->get_name() == $name)
{
return $this->sections[$i];
}
@@ -64,13 +66,13 @@ class phpbb_search_sphinx_config
* Appends a new empty section to the end of the config
*
* @param string $name The name for the new section
- * @return phpbb_search_sphinx_config_section The newly created section object
+ * @return \phpbb\search\sphinx\config_section The newly created section object
*
* @access public
*/
function add_section($name)
{
- $this->sections[] = new phpbb_search_sphinx_config_section($name, '');
+ $this->sections[] = new \phpbb\search\sphinx\config_section($name, '');
return $this->sections[sizeof($this->sections) - 1];
}
@@ -109,7 +111,7 @@ class phpbb_search_sphinx_config
// that way they're not deleted when reassembling the file from the sections
if (!$line || $line[0] == '#')
{
- $this->sections[] = new phpbb_search_sphinx_config_comment($config_file[$i]);
+ $this->sections[] = new \phpbb\search\sphinx\config_comment($config_file[$i]);
continue;
}
else
@@ -143,7 +145,7 @@ class phpbb_search_sphinx_config
// And then we create the new section object
$section_name = trim($section_name);
- $section = new phpbb_search_sphinx_config_section($section_name, $section_name_comment);
+ $section = new \phpbb\search\sphinx\config_section($section_name, $section_name_comment);
}
}
else
@@ -158,10 +160,10 @@ class phpbb_search_sphinx_config
// of this section so they're not deleted on reassembly
if (!$line || $line[0] == '#')
{
- $section->add_variable(new phpbb_search_sphinx_config_comment($config_file[$i]));
+ $section->add_variable(new \phpbb\search\sphinx\config_comment($config_file[$i]));
continue;
}
-
+
// As long as we haven't yet actually found an opening bracket for this section
// we treat everything as comments so it's not deleted either
if (!$found_opening_bracket)
@@ -174,13 +176,13 @@ class phpbb_search_sphinx_config
}
else
{
- $section->add_variable(new phpbb_search_sphinx_config_comment($config_file[$i]));
+ $section->add_variable(new \phpbb\search\sphinx\config_comment($config_file[$i]));
continue;
}
}
}
- // If we did not find a comment in this line or still add to the previous
+ // If we did not find a comment in this line or still add to the previous
// line's value ...
if ($line || $in_value)
{
@@ -239,16 +241,16 @@ class phpbb_search_sphinx_config
}
}
- // If a name and an equal sign were found then we have append a
+ // If a name and an equal sign were found then we have append a
// new variable object to the section
if ($name && $found_assignment)
{
- $section->add_variable(new phpbb_search_sphinx_config_variable(trim($name), trim($value), ($end_section) ? '' : $comment));
+ $section->add_variable(new \phpbb\search\sphinx\config_variable(trim($name), trim($value), ($end_section) ? '' : $comment));
continue;
}
/* If we found a closing curly bracket this section has been completed
- and we can append it to the section list and continue with looking for
+ and we can append it to the section list and continue with looking for
the next section */
if ($end_section)
{
@@ -262,7 +264,7 @@ class phpbb_search_sphinx_config
// If we did not find anything meaningful up to here, then just treat it
// as a comment
$comment = ($skip_first) ? "\t" . substr(ltrim($config_file[$i]), 1) : $config_file[$i];
- $section->add_variable(new phpbb_search_sphinx_config_comment($comment));
+ $section->add_variable(new \phpbb\search\sphinx\config_comment($comment));
}
}
diff --git a/phpBB/phpbb/search/sphinx/config_comment.php b/phpBB/phpbb/search/sphinx/config_comment.php
index 7f695dbf0c..77a943377d 100644
--- a/phpBB/phpbb/search/sphinx/config_comment.php
+++ b/phpBB/phpbb/search/sphinx/config_comment.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\search\sphinx;
+
/**
* @ignore
*/
@@ -16,10 +18,10 @@ if (!defined('IN_PHPBB'))
}
/**
-* phpbb_search_sphinx_config_comment
+* \phpbb\search\sphinx\config_comment
* Represents a comment inside the sphinx configuration
*/
-class phpbb_search_sphinx_config_comment
+class config_comment
{
private $exact_string;
diff --git a/phpBB/phpbb/search/sphinx/config_section.php b/phpBB/phpbb/search/sphinx/config_section.php
index 79c9c8563d..730abf011e 100644
--- a/phpBB/phpbb/search/sphinx/config_section.php
+++ b/phpBB/phpbb/search/sphinx/config_section.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\search\sphinx;
+
/**
* @ignore
*/
@@ -16,10 +18,10 @@ if (!defined('IN_PHPBB'))
}
/**
-* phpbb_search_sphinx_config_section
+* \phpbb\search\sphinx\config_section
* Represents a single section inside the sphinx configuration
*/
-class phpbb_search_sphinx_config_section
+class config_section
{
private $name;
private $comment;
@@ -45,7 +47,7 @@ class phpbb_search_sphinx_config_section
/**
* Add a variable object to the list of variables in this section
*
- * @param phpbb_search_sphinx_config_variable $variable The variable object
+ * @param \phpbb\search\sphinx\config_variable $variable The variable object
*
* @access public
*/
@@ -82,7 +84,7 @@ class phpbb_search_sphinx_config_section
* Get a variable object by its name
*
* @param string $name The name of the variable that shall be returned
- * @return phpbb_search_sphinx_config_section The first variable object from this section with the
+ * @return \phpbb\search\sphinx\config_section The first variable object from this section with the
* given name or null if none was found
*
* @access public
@@ -92,7 +94,7 @@ class phpbb_search_sphinx_config_section
for ($i = 0, $size = sizeof($this->variables); $i < $size; $i++)
{
// Make sure this is a variable object and not a comment
- if (($this->variables[$i] instanceof phpbb_search_sphinx_config_variable) && $this->variables[$i]->get_name() == $name)
+ if (($this->variables[$i] instanceof \phpbb\search\sphinx\config_variable) && $this->variables[$i]->get_name() == $name)
{
return $this->variables[$i];
}
@@ -111,7 +113,7 @@ class phpbb_search_sphinx_config_section
for ($i = 0, $size = sizeof($this->variables); $i < $size; $i++)
{
// Make sure this is a variable object and not a comment
- if (($this->variables[$i] instanceof phpbb_search_sphinx_config_variable) && $this->variables[$i]->get_name() == $name)
+ if (($this->variables[$i] instanceof \phpbb\search\sphinx\config_variable) && $this->variables[$i]->get_name() == $name)
{
array_splice($this->variables, $i, 1);
$i--;
@@ -124,13 +126,13 @@ class phpbb_search_sphinx_config_section
*
* @param string $name The name for the new variable
* @param string $value The value for the new variable
- * @return phpbb_search_sphinx_config_variable Variable object that was created
+ * @return \phpbb\search\sphinx\config_variable Variable object that was created
*
* @access public
*/
function create_variable($name, $value)
{
- $this->variables[] = new phpbb_search_sphinx_config_variable($name, $value, '');
+ $this->variables[] = new \phpbb\search\sphinx\config_variable($name, $value, '');
return $this->variables[sizeof($this->variables) - 1];
}
diff --git a/phpBB/phpbb/search/sphinx/config_variable.php b/phpBB/phpbb/search/sphinx/config_variable.php
index 2c1d35a49c..c8f40bfb5f 100644
--- a/phpBB/phpbb/search/sphinx/config_variable.php
+++ b/phpBB/phpbb/search/sphinx/config_variable.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\search\sphinx;
+
/**
* @ignore
*/
@@ -16,10 +18,10 @@ if (!defined('IN_PHPBB'))
}
/**
-* phpbb_search_sphinx_config_variable
+* \phpbb\search\sphinx\config_variable
* Represents a single variable inside the sphinx configuration
*/
-class phpbb_search_sphinx_config_variable
+class config_variable
{
private $name;
private $value;
diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php
index dc33786666..2baf61043d 100644
--- a/phpBB/phpbb/session.php
+++ b/phpBB/phpbb/session.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb;
+
/**
* @ignore
*/
@@ -19,7 +21,7 @@ if (!defined('IN_PHPBB'))
* Session class
* @package phpBB3
*/
-class phpbb_session
+class session
{
var $cookie_data = array();
var $page = array();
@@ -243,7 +245,7 @@ class phpbb_session
$this->forwarded_for = '';
}
- if ($request->is_set($config['cookie_name'] . '_sid', phpbb_request_interface::COOKIE) || $request->is_set($config['cookie_name'] . '_u', phpbb_request_interface::COOKIE))
+ if ($request->is_set($config['cookie_name'] . '_sid', \phpbb\request\request_interface::COOKIE) || $request->is_set($config['cookie_name'] . '_u', \phpbb\request\request_interface::COOKIE))
{
$this->cookie_data['u'] = request_var($config['cookie_name'] . '_u', 0, false, true);
$this->cookie_data['k'] = request_var($config['cookie_name'] . '_k', '', false, true);
@@ -405,9 +407,9 @@ class phpbb_session
$provider = $phpbb_container->get('auth.provider.' . $method);
- if (!($provider instanceof phpbb_auth_provider_interface))
+ if (!($provider instanceof \phpbb\auth\provider\provider_interface))
{
- throw new \RuntimeException($provider . ' must implement phpbb_auth_provider_interface');
+ throw new \RuntimeException($provider . ' must implement \phpbb\auth\provider\provider_interface');
}
$ret = $provider->validate_session($this->data);
@@ -1022,7 +1024,7 @@ class phpbb_session
{
include($phpbb_root_path . "includes/captcha/captcha_factory." . $phpEx);
}
- $captcha_factory = new phpbb_captcha_factory();
+ $captcha_factory = new \phpbb_captcha_factory();
$captcha_factory->garbage_collect($config['captcha_plugin']);
$sql = 'DELETE FROM ' . LOGIN_ATTEMPT_TABLE . '
diff --git a/phpBB/phpbb/style/extension_path_provider.php b/phpBB/phpbb/style/extension_path_provider.php
deleted file mode 100644
index ec1d85f821..0000000000
--- a/phpBB/phpbb/style/extension_path_provider.php
+++ /dev/null
@@ -1,137 +0,0 @@
-<?php
-/**
-*
-* @package phpBB3
-* @copyright (c) 2011 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* Provides a style resource locator with core style paths and extension style paths
-*
-* Finds installed style paths and makes them available to the resource locator.
-*
-* @package phpBB3
-*/
-class phpbb_style_extension_path_provider extends phpbb_extension_provider implements phpbb_style_path_provider_interface
-{
- /**
- * Optional prefix for style paths searched within extensions.
- *
- * Empty by default. Relative to the extension directory. As an example, it
- * could be adm/ for admin style.
- *
- * @var string
- */
- protected $ext_dir_prefix = '';
-
- /**
- * A provider of paths to be searched for styles
- * @var phpbb_style_path_provider
- */
- protected $base_path_provider;
-
- /** @var string */
- protected $phpbb_root_path;
-
- /**
- * Constructor stores extension manager
- *
- * @param phpbb_extension_manager $extension_manager phpBB extension manager
- * @param phpbb_style_path_provider $base_path_provider A simple path provider
- * to provide paths to be located in extensions
- * @param string $phpbb_root_path phpBB root path
- */
- public function __construct(phpbb_extension_manager $extension_manager, phpbb_style_path_provider $base_path_provider, $phpbb_root_path)
- {
- parent::__construct($extension_manager);
- $this->base_path_provider = $base_path_provider;
- $this->phpbb_root_path = $phpbb_root_path;
- }
-
- /**
- * Sets a prefix for style paths searched within extensions.
- *
- * The prefix is inserted between the extension's path e.g. ext/foo/ and
- * the looked up style path, e.g. styles/bar/. So it should not have a
- * leading slash, but should have a trailing slash.
- *
- * @param string $ext_dir_prefix The prefix including trailing slash
- * @return null
- */
- public function set_ext_dir_prefix($ext_dir_prefix)
- {
- $this->ext_dir_prefix = $ext_dir_prefix;
- }
-
- /**
- * Finds style paths using the extension manager
- *
- * Locates a path (e.g. styles/prosilver/) in all active extensions.
- * Then appends the core style paths based in the current working
- * directory.
- *
- * @return array List of style paths
- */
- public function find()
- {
- $directories = array();
-
- $finder = $this->extension_manager->get_finder();
- foreach ($this->base_path_provider as $key => $paths)
- {
- if ($key == 'style')
- {
- foreach ($paths as $path)
- {
- $directories['style'][] = $path;
- if ($path && !phpbb_is_absolute($path))
- {
- // Remove phpBB root path from the style path,
- // so the finder is able to find extension styles,
- // when the root path is not ./
- if (strpos($path, $this->phpbb_root_path) === 0)
- {
- $path = substr($path, strlen($this->phpbb_root_path));
- }
-
- $result = $finder->directory('/' . $this->ext_dir_prefix . $path)
- ->get_directories(true, false, true);
- foreach ($result as $ext => $ext_path)
- {
- // Make sure $ext_path has no ending slash
- if (substr($ext_path, -1) === '/')
- {
- $ext_path = substr($ext_path, 0, -1);
- }
- $directories[$ext][] = $ext_path;
- }
- }
- }
- }
- }
-
- return $directories;
- }
-
- /**
- * Overwrites the current style paths
- *
- * @param array $styles An array of style paths. The first element is the main style.
- * @return null
- */
- public function set_styles(array $styles)
- {
- $this->base_path_provider->set_styles($styles);
- $this->items = null;
- }
-}
diff --git a/phpBB/phpbb/style/path_provider.php b/phpBB/phpbb/style/path_provider.php
deleted file mode 100644
index 731d682e88..0000000000
--- a/phpBB/phpbb/style/path_provider.php
+++ /dev/null
@@ -1,62 +0,0 @@
-<?php
-/**
-*
-* @package phpBB3
-* @copyright (c) 2011 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* Provides a style resource locator with paths
-*
-* Finds installed style paths and makes them available to the resource locator.
-*
-* @package phpBB3
-*/
-class phpbb_style_path_provider implements IteratorAggregate, phpbb_style_path_provider_interface
-{
- protected $paths = array();
-
- /**
- * Ignores the extension dir prefix
- *
- * @param string $ext_dir_prefix The prefix including trailing slash
- * @return null
- */
- public function set_ext_dir_prefix($ext_dir_prefix)
- {
- }
-
- /**
- * Overwrites the current style paths
- *
- * The first element of the passed styles map, is considered the main
- * style.
- *
- * @param array $styles An array of style paths. The first element is the main style.
- * @return null
- */
- public function set_styles(array $styles)
- {
- $this->paths = array('style' => $styles);
- }
-
- /**
- * Retrieve an iterator over all style paths
- *
- * @return ArrayIterator An iterator for the array of style paths
- */
- public function getIterator()
- {
- return new ArrayIterator($this->paths);
- }
-}
diff --git a/phpBB/phpbb/style/path_provider_interface.php b/phpBB/phpbb/style/path_provider_interface.php
deleted file mode 100644
index 1a6153a4d3..0000000000
--- a/phpBB/phpbb/style/path_provider_interface.php
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-/**
-*
-* @package phpBB3
-* @copyright (c) 2011 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* Provides a style resource locator with paths
-*
-* Finds installed style paths and makes them available to the resource locator.
-*
-* @package phpBB3
-*/
-interface phpbb_style_path_provider_interface extends Traversable
-{
- /**
- * Defines a prefix to use for style paths in extensions
- *
- * @param string $ext_dir_prefix The prefix including trailing slash
- * @return null
- */
- public function set_ext_dir_prefix($ext_dir_prefix);
-
- /**
- * Overwrites the current style paths
- *
- * @param array $styles An array of style paths. The first element is the main style.
- * @return null
- */
- public function set_styles(array $styles);
-}
diff --git a/phpBB/phpbb/style/resource_locator.php b/phpBB/phpbb/style/resource_locator.php
deleted file mode 100644
index 4cf767c062..0000000000
--- a/phpBB/phpbb/style/resource_locator.php
+++ /dev/null
@@ -1,348 +0,0 @@
-<?php
-/**
-*
-* @package phpBB3
-* @copyright (c) 2011 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-
-/**
-* Style resource locator.
-* Maintains mapping from template handles to source template file paths.
-* Locates style files: resources (such as .js and .css files) and templates.
-*
-* Style resource locator is aware of styles tree, and can return actual
-* filesystem paths (i.e., the "child" style or the "parent" styles)
-* depending on what files exist.
-*
-* Root paths stored in locator are paths to style directories. Templates are
-* stored in subdirectory that $template_path points to.
-*
-* @package phpBB3
-*/
-class phpbb_style_resource_locator implements phpbb_template_locator
-{
- /**
- * Paths to style directories.
- * @var array
- */
- private $roots = array();
-
- /**
- * Location of templates directory within style directories.
- * Must have trailing slash. Empty if templates are stored in root
- * style directory, such as admin control panel templates.
- * @var string
- */
- private $template_path;
-
- /**
- * Map from root index to handles to source template file paths.
- * Normally it only contains paths for handles that are used
- * (or are likely to be used) by the page being rendered and not
- * all templates that exist on the filesystem.
- * @var array
- */
- private $files = array();
-
- /**
- * Map from handles to source template file names.
- * Covers the same data as $files property but maps to basenames
- * instead of paths.
- * @var array
- */
- private $filenames = array();
-
- /**
- * Constructor.
- *
- * Sets default template path to template/.
- */
- public function __construct()
- {
- $this->set_default_template_path();
- }
-
- /**
- * Sets the list of style paths
- *
- * These paths will be searched for style files in the provided order.
- * Paths may be outside of phpBB, but templates loaded from these paths
- * will still be cached.
- *
- * @param array $style_paths An array of paths to style directories
- * @return null
- */
- public function set_paths($style_paths)
- {
- $this->roots = array();
- $this->files = array();
- $this->filenames = array();
-
- foreach ($style_paths as $key => $paths)
- {
- foreach ($paths as $path)
- {
- // Make sure $path has no ending slash
- if (substr($path, -1) === '/')
- {
- $path = substr($path, 0, -1);
- }
- $this->roots[$key][] = $path;
- }
- }
- }
-
- /**
- * Sets the location of templates directory within style directories.
- *
- * The location must be a relative path, with a trailing slash.
- * Typically it is one directory level deep, e.g. "template/".
- *
- * @param string $template_path Relative path to templates directory within style directories
- * @return null
- */
- public function set_template_path($template_path)
- {
- $this->template_path = $template_path;
- }
-
- /**
- * Sets the location of templates directory within style directories
- * to the default, which is "template/".
- *
- * @return null
- */
- public function set_default_template_path()
- {
- $this->template_path = 'template/';
- }
-
- /**
- * {@inheritDoc}
- */
- public function set_filenames(array $filename_array)
- {
- foreach ($filename_array as $handle => $filename)
- {
- if (empty($filename))
- {
- trigger_error("style resource locator: set_filenames: Empty filename specified for $handle", E_USER_ERROR);
- }
-
- $this->filename[$handle] = $filename;
-
- foreach ($this->roots as $root_key => $root_paths)
- {
- foreach ($root_paths as $root_index => $root)
- {
- $this->files[$root_key][$root_index][$handle] = $root . '/' . $this->template_path . $filename;
- }
- }
- }
- }
-
- /**
- * {@inheritDoc}
- */
- public function get_filename_for_handle($handle)
- {
- if (!isset($this->filename[$handle]))
- {
- trigger_error("style resource locator: get_filename_for_handle: No file specified for handle $handle", E_USER_ERROR);
- }
- return $this->filename[$handle];
- }
-
- /**
- * {@inheritDoc}
- */
- public function get_virtual_source_file_for_handle($handle)
- {
- // If we don't have a file assigned to this handle, die.
- if (!isset($this->files['style'][0][$handle]))
- {
- trigger_error("style resource locator: No file specified for handle $handle", E_USER_ERROR);
- }
-
- $source_file = $this->files['style'][0][$handle];
- return $source_file;
- }
-
- /**
- * {@inheritDoc}
- */
- public function get_source_file_for_handle($handle, $find_all = false)
- {
- // If we don't have a file assigned to this handle, die.
- if (!isset($this->files['style'][0][$handle]))
- {
- trigger_error("style resource locator: No file specified for handle $handle", E_USER_ERROR);
- }
-
- // locate a source file that exists
- $source_file = $this->files['style'][0][$handle];
- $tried = $source_file;
- $found = false;
- $found_all = array();
- foreach ($this->roots as $root_key => $root_paths)
- {
- foreach ($root_paths as $root_index => $root)
- {
- $source_file = $this->files[$root_key][$root_index][$handle];
- $tried .= ', ' . $source_file;
- if (file_exists($source_file))
- {
- $found = true;
- break;
- }
- }
- if ($found)
- {
- if ($find_all)
- {
- $found_all[] = $source_file;
- $found = false;
- }
- else
- {
- break;
- }
- }
- }
-
- // search failed
- if (!$found && !$find_all)
- {
- trigger_error("style resource locator: File for handle $handle does not exist. Could not find: $tried", E_USER_ERROR);
- }
-
- return ($find_all) ? $found_all : $source_file;
- }
-
- /**
- * {@inheritDoc}
- */
- public function get_first_file_location($files, $return_default = false, $return_full_path = true)
- {
- // set default value
- $default_result = false;
-
- // check all available paths
- foreach ($this->roots as $root_paths)
- {
- foreach ($root_paths as $path)
- {
- // check all files
- foreach ($files as $filename)
- {
- $source_file = $path . '/' . $filename;
- if (file_exists($source_file))
- {
- return ($return_full_path) ? $source_file : $filename;
- }
-
- // assign first file as result if $return_default is true
- if ($return_default && $default_result === false)
- {
- $default_result = $source_file;
- }
- }
- }
- }
-
- // search failed
- return $default_result;
- }
-
- /**
- * Obtains filesystem path for a template file.
- *
- * The simplest use is specifying a single template file as a string
- * in the first argument. This template file should be a basename
- * of a template file in the selected style, or its parent styles
- * if template inheritance is being utilized.
- *
- * Note: "selected style" is whatever style the style resource locator
- * is configured for.
- *
- * The return value then will be a path, relative to the current
- * directory or absolute, to the template file in the selected style
- * or its closest parent.
- *
- * If the selected style does not have the template file being searched,
- * (and if inheritance is involved, none of the parents have it either),
- * false will be returned.
- *
- * Specifying true for $return_default will cause the function to
- * return the first path which was checked for existence in the event
- * that the template file was not found, instead of false.
- * This is the path in the selected style itself, not any of its
- * parents.
- *
- * $files can be given an array of templates instead of a single
- * template. When given an array, the function will try to resolve
- * each template in the array to a path, and will return the first
- * path that exists, or false if none exist.
- *
- * If $files is an array and template inheritance is involved, first
- * each of the files will be checked in the selected style, then each
- * of the files will be checked in the immediate parent, and so on.
- *
- * If $return_full_path is false, then instead of returning a usable
- * path (when the template is found) only the template's basename
- * will be returned. This can be used to check which of the templates
- * specified in $files exists. Naturally more than one template must
- * be given in $files.
- *
- * This function works identically to get_first_file_location except
- * it operates on a list of templates, not files. Practically speaking,
- * the templates given in the first argument first are prepended with
- * the template path (property in this class), then given to
- * get_first_file_location for the rest of the processing.
- *
- * Templates given to this function can be relative paths for templates
- * located in subdirectories of the template directories. The paths
- * should be relative to the templates directory (template/ by default).
- *
- * @param string or array $files List of templates to locate. If there is only
- * one template, $files can be a string to make code easier to read.
- * @param bool $return_default Determines what to return if template does not
- * exist. If true, function will return location where template is
- * supposed to be. If false, function will return false.
- * @param bool $return_full_path If true, function will return full path
- * to template. If false, function will return template file name.
- * This parameter can be used to check which one of set of template
- * files is available.
- * @return string or boolean Source template path if template exists or $return_default is
- * true. False if template does not exist and $return_default is false
- */
- public function get_first_template_location($templates, $return_default = false, $return_full_path = true)
- {
- // add template path prefix
- $files = array();
- if (is_string($templates))
- {
- $files[] = $this->template_path . $templates;
- }
- else
- {
- foreach ($templates as $template)
- {
- $files[] = $this->template_path . $template;
- }
- }
-
- return $this->get_first_file_location($files, $return_default, $return_full_path);
- }
-}
diff --git a/phpBB/phpbb/style/style.php b/phpBB/phpbb/style/style.php
deleted file mode 100644
index 034f518091..0000000000
--- a/phpBB/phpbb/style/style.php
+++ /dev/null
@@ -1,241 +0,0 @@
-<?php
-/**
-*
-* @package phpBB3
-* @copyright (c) 2005 phpBB Group, sections (c) 2001 ispi of Lincoln Inc
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* Base Style class.
-* @package phpBB3
-*/
-class phpbb_style
-{
- /**
- * Template class.
- * Handles everything related to templates.
- * @var phpbb_template
- */
- private $template;
-
- /**
- * phpBB root path
- * @var string
- */
- private $phpbb_root_path;
-
- /**
- * PHP file extension
- * @var string
- */
- private $php_ext;
-
- /**
- * phpBB config instance
- * @var phpbb_config
- */
- private $config;
-
- /**
- * Current user
- * @var phpbb_user
- */
- private $user;
-
- /**
- * Style resource locator
- * @var phpbb_style_resource_locator
- */
- private $locator;
-
- /**
- * Style path provider
- * @var phpbb_style_path_provider
- */
- private $provider;
-
- /**
- * Constructor.
- *
- * @param string $phpbb_root_path phpBB root path
- * @param user $user current user
- * @param phpbb_style_resource_locator $locator style resource locator
- * @param phpbb_style_path_provider $provider style path provider
- * @param phpbb_template $template template
- */
- public function __construct($phpbb_root_path, $php_ext, $config, $user, phpbb_style_resource_locator $locator, phpbb_style_path_provider_interface $provider, phpbb_template $template)
- {
- $this->phpbb_root_path = $phpbb_root_path;
- $this->php_ext = $php_ext;
- $this->config = $config;
- $this->user = $user;
- $this->locator = $locator;
- $this->provider = $provider;
- $this->template = $template;
- }
-
- /**
- * Get the style tree of the style preferred by the current user
- *
- * @return array Style tree, most specific first
- */
- public function get_user_style()
- {
- $style_list = array(
- $this->user->style['style_path'],
- );
-
- if ($this->user->style['style_parent_id'])
- {
- $style_list = array_merge($style_list, array_reverse(explode('/', $this->user->style['style_parent_tree'])));
- }
-
- return $style_list;
- }
-
- /**
- * Set style location based on (current) user's chosen style.
- *
- * @param array $style_directories The directories to add style paths for
- * E.g. array('ext/foo/bar/styles', 'styles')
- * Default: array('styles') (phpBB's style directory)
- * @return bool true
- */
- public function set_style($style_directories = array('styles'))
- {
- $this->names = $this->get_user_style();
-
- $paths = array();
- foreach ($style_directories as $directory)
- {
- foreach ($this->names as $name)
- {
- $path = $this->get_style_path($name, $directory);
-
- if (is_dir($path))
- {
- $paths[] = $path;
- }
- }
- }
-
- $this->provider->set_styles($paths);
- $this->locator->set_paths($this->provider);
-
- $new_paths = array();
- foreach ($paths as $path)
- {
- $new_paths[] = $path . '/template/';
- }
-
- $this->template->set_style_names($this->names, $new_paths, ($style_directories === array('styles')));
-
- return true;
- }
-
- /**
- * Set custom style location (able to use directory outside of phpBB).
- *
- * Note: Templates are still compiled to phpBB's cache directory.
- *
- * @param string $name Name of style, used for cache prefix. Examples: "admin", "prosilver"
- * @param array or string $paths Array of style paths, relative to current root directory
- * @param array $names Array of names of templates in inheritance tree order, used by extensions. If empty, $name will be used.
- * @param string $template_path Path to templates, relative to style directory. False if path should be set to default (templates/).
- * @return bool true
- */
- public function set_custom_style($name, $paths, $names = array(), $template_path = false)
- {
- if (is_string($paths))
- {
- $paths = array($paths);
- }
-
- if (empty($names))
- {
- $names = array($name);
- }
- $this->names = $names;
-
- $this->provider->set_styles($paths);
- $this->locator->set_paths($this->provider);
-
- if ($template_path !== false)
- {
- $this->locator->set_template_path($template_path);
- }
-
- $new_paths = array();
- foreach ($paths as $path)
- {
- $new_paths[] = $path . '/' . (($template_path !== false) ? $template_path : 'template/');
- }
-
- $this->template->set_style_names($names, $new_paths);
-
- return true;
- }
-
- /**
- * Get location of style directory for specific style_path
- *
- * @param string $path Style path, such as "prosilver"
- * @param string $style_base_directory The base directory the style is in
- * E.g. 'styles', 'ext/foo/bar/styles'
- * Default: 'styles'
- * @return string Path to style directory, relative to current path
- */
- public function get_style_path($path, $style_base_directory = 'styles')
- {
- return $this->phpbb_root_path . trim($style_base_directory, '/') . '/' . $path;
- }
-
- /**
- * Defines a prefix to use for style paths in extensions
- *
- * @param string $ext_dir_prefix The prefix including trailing slash
- * @return null
- */
- public function set_ext_dir_prefix($ext_dir_prefix)
- {
- $this->provider->set_ext_dir_prefix($ext_dir_prefix);
- }
-
- /**
- * Locates source file path, accounting for styles tree and verifying that
- * the path exists.
- *
- * @param string or array $files List of files to locate. If there is only
- * one file, $files can be a string to make code easier to read.
- * @param bool $return_default Determines what to return if file does not
- * exist. If true, function will return location where file is
- * supposed to be. If false, function will return false.
- * @param bool $return_full_path If true, function will return full path
- * to file. If false, function will return file name. This
- * parameter can be used to check which one of set of files
- * is available.
- * @return string or boolean Source file path if file exists or $return_default is
- * true. False if file does not exist and $return_default is false
- */
- public function locate($files, $return_default = false, $return_full_path = true)
- {
- // convert string to array
- if (is_string($files))
- {
- $files = array($files);
- }
-
- // use resource locator to find files
- return $this->locator->get_first_file_location($files, $return_default, $return_full_path);
- }
-}
diff --git a/phpBB/phpbb/symfony_request.php b/phpBB/phpbb/symfony_request.php
new file mode 100644
index 0000000000..92784c213b
--- /dev/null
+++ b/phpBB/phpbb/symfony_request.php
@@ -0,0 +1,48 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+namespace phpbb;
+
+use Symfony\Component\HttpFoundation\Request;
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+class symfony_request extends Request
+{
+ /**
+ * Constructor
+ *
+ * @param phpbb\request\request_interface $phpbb_request
+ */
+ public function __construct(\phpbb\request\request_interface $phpbb_request)
+ {
+ // This function is meant to sanitize the global input arrays
+ $sanitizer = function(&$value, $key) {
+ $type_cast_helper = new \phpbb\request\type_cast_helper();
+ $type_cast_helper->set_var($value, $value, gettype($value), true);
+ };
+
+ $get_parameters = $phpbb_request->get_super_global(\phpbb\request\request_interface::GET);
+ $post_parameters = $phpbb_request->get_super_global(\phpbb\request\request_interface::POST);
+ $server_parameters = $phpbb_request->get_super_global(\phpbb\request\request_interface::SERVER);
+ $files_parameters = $phpbb_request->get_super_global(\phpbb\request\request_interface::FILES);
+ $cookie_parameters = $phpbb_request->get_super_global(\phpbb\request\request_interface::COOKIE);
+
+ array_walk_recursive($get_parameters, $sanitizer);
+ array_walk_recursive($post_parameters, $sanitizer);
+
+ parent::__construct($get_parameters, $post_parameters, array(), $cookie_parameters, $files_parameters, $server_parameters);
+ }
+}
diff --git a/phpBB/phpbb/template/asset.php b/phpBB/phpbb/template/asset.php
index 7c322cd971..0e0b6b4782 100644
--- a/phpBB/phpbb/template/asset.php
+++ b/phpBB/phpbb/template/asset.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\template;
+
/**
* @ignore
*/
@@ -15,17 +17,22 @@ if (!defined('IN_PHPBB'))
exit;
}
-class phpbb_template_asset
+class asset
{
protected $components = array();
+ /** @var \phpbb\filesystem **/
+ protected $phpbb_filesystem;
+
/**
* Constructor
*
* @param string $url URL
*/
- public function __construct($url)
+ public function __construct($url, \phpbb\filesystem $phpbb_filesystem)
{
+ $this->phpbb_filesystem = $phpbb_filesystem;
+
$this->set_url($url);
}
@@ -112,7 +119,7 @@ class phpbb_template_asset
*/
public function get_url()
{
- return $this->join_url($this->components);
+ return $this->phpbb_filesystem->update_web_root_path($this->join_url($this->components));
}
/**
diff --git a/phpBB/phpbb/template/base.php b/phpBB/phpbb/template/base.php
new file mode 100644
index 0000000000..86868707f0
--- /dev/null
+++ b/phpBB/phpbb/template/base.php
@@ -0,0 +1,150 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+namespace phpbb\template;
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+abstract class base implements template
+{
+ /**
+ * Template context.
+ * Stores template data used during template rendering.
+ *
+ * @var \phpbb\template\context
+ */
+ protected $context;
+
+ /**
+ * Array of filenames assigned to set_filenames
+ *
+ * @var array
+ */
+ protected $filenames = array();
+
+ /**
+ * {@inheritdoc}
+ */
+ public function set_filenames(array $filename_array)
+ {
+ $this->filenames = array_merge($this->filenames, $filename_array);
+
+ return $this;
+ }
+
+ /**
+ * Get a filename from the handle
+ *
+ * @param string $handle
+ * @return string
+ */
+ protected function get_filename_from_handle($handle)
+ {
+ return (isset($this->filenames[$handle])) ? $this->filenames[$handle] : $handle;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function destroy()
+ {
+ $this->context->clear();
+
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function destroy_block_vars($blockname)
+ {
+ $this->context->destroy_block_vars($blockname);
+
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function assign_vars(array $vararray)
+ {
+ foreach ($vararray as $key => $val)
+ {
+ $this->assign_var($key, $val);
+ }
+
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function assign_var($varname, $varval)
+ {
+ $this->context->assign_var($varname, $varval);
+
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function append_var($varname, $varval)
+ {
+ $this->context->append_var($varname, $varval);
+
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function assign_block_vars($blockname, array $vararray)
+ {
+ $this->context->assign_block_vars($blockname, $vararray);
+
+ return $this;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert')
+ {
+ return $this->context->alter_block_array($blockname, $vararray, $key, $mode);
+ }
+
+ /**
+ * Calls hook if any is defined.
+ *
+ * @param string $handle Template handle being displayed.
+ * @param string $method Method name of the caller.
+ */
+ protected function call_hook($handle, $method)
+ {
+ global $phpbb_hook;
+
+ if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, $method), $handle, $this))
+ {
+ if ($phpbb_hook->hook_return(array(__CLASS__, $method)))
+ {
+ $result = $phpbb_hook->hook_return_result(array(__CLASS__, $method));
+ return array($result);
+ }
+ }
+
+ return false;
+ }
+}
diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php
index c5ce7422b9..24234c1e4a 100644
--- a/phpBB/phpbb/template/context.php
+++ b/phpBB/phpbb/template/context.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\template;
+
/**
* @ignore
*/
@@ -20,7 +22,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-class phpbb_template_context
+class context
{
/**
* variable that holds all the data we'll be substituting into
@@ -86,7 +88,7 @@ class phpbb_template_context
* Returns a reference to template data array.
*
* This function is public so that template renderer may invoke it.
- * Users should alter template variables via functions in phpbb_template.
+ * Users should alter template variables via functions in \phpbb\template\template.
*
* Note: modifying returned array will affect data stored in the context.
*
@@ -223,7 +225,7 @@ class phpbb_template_context
* @param string $mode Mode to execute (valid modes are 'insert' and 'change')
*
* If insert, the vararray is inserted at the given position (position counting from zero).
- * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value).
+ * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new \value).
*
* Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array)
* and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars)
diff --git a/phpBB/phpbb/template/locator.php b/phpBB/phpbb/template/locator.php
deleted file mode 100644
index f6fd20bcc2..0000000000
--- a/phpBB/phpbb/template/locator.php
+++ /dev/null
@@ -1,163 +0,0 @@
-<?php
-/**
-*
-* @package phpBB3
-* @copyright (c) 2011 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-
-/**
-* Resource locator interface.
-*
-* Objects implementing this interface maintain mapping from template handles
-* to source template file paths and locate templates.
-*
-* Locates style files.
-*
-* Resource locator is aware of styles tree, and can return actual
-* filesystem paths (i.e., the "child" style or the "parent" styles)
-* depending on what files exist.
-*
-* Root paths stored in locator are paths to style directories. Templates are
-* stored in subdirectory that $template_path points to.
-*
-* @package phpBB3
-*/
-interface phpbb_template_locator
-{
- /**
- * Sets the template filenames for handles. $filename_array
- * should be a hash of handle => filename pairs.
- *
- * @param array $filename_array Should be a hash of handle => filename pairs.
- */
- public function set_filenames(array $filename_array);
-
- /**
- * Determines the filename for a template handle.
- *
- * The filename comes from array used in a set_filenames call,
- * which should have been performed prior to invoking this function.
- * Return value is a file basename (without path).
- *
- * @param $handle string Template handle
- * @return string Filename corresponding to the template handle
- */
- public function get_filename_for_handle($handle);
-
- /**
- * Determines the source file path for a template handle without
- * regard for styles tree.
- *
- * This function returns the path in "primary" style directory
- * corresponding to the given template handle. That path may or
- * may not actually exist on the filesystem. Because this function
- * does not perform stat calls to determine whether the path it
- * returns actually exists, it is faster than get_source_file_for_handle.
- *
- * Use get_source_file_for_handle to obtain the actual path that is
- * guaranteed to exist (which might come from the parent style
- * directory if primary style has parent styles).
- *
- * This function will trigger an error if the handle was never
- * associated with a template file via set_filenames.
- *
- * @param $handle string Template handle
- * @return string Path to source file path in primary style directory
- */
- public function get_virtual_source_file_for_handle($handle);
-
- /**
- * Determines the source file path for a template handle, accounting
- * for styles tree and verifying that the path exists.
- *
- * This function returns the actual path that may be compiled for
- * the specified template handle. It will trigger an error if
- * the template handle was never associated with a template path
- * via set_filenames or if the template file does not exist on the
- * filesystem.
- *
- * Use get_virtual_source_file_for_handle to just resolve a template
- * handle to a path without any filesystem or styles tree checks.
- *
- * @param string $handle Template handle (i.e. "friendly" template name)
- * @param bool $find_all If true, each root path will be checked and function
- * will return array of files instead of string and will not
- * trigger a error if template does not exist
- * @return string Source file path
- */
- public function get_source_file_for_handle($handle, $find_all = false);
-
- /**
- * Obtains a complete filesystem path for a file in a style.
- *
- * This function traverses the style tree (selected style and
- * its parents in order, if inheritance is being used) and finds
- * the first file on the filesystem matching specified relative path,
- * or the first of the specified paths if more than one path is given.
- *
- * This function can be used to determine filesystem path of any
- * file under any style, with the consequence being that complete
- * relative to the style directory path must be provided as an argument.
- *
- * In particular, this function can be used to locate templates
- * and javascript files.
- *
- * For locating templates get_first_template_location should be used
- * as it prepends the configured template path to the template basename.
- *
- * Note: "selected style" is whatever style the style resource locator
- * is configured for.
- *
- * The return value then will be a path, relative to the current
- * directory or absolute, to the first existing file in the selected
- * style or its closest parent.
- *
- * If the selected style does not have the file being searched,
- * (and if inheritance is involved, none of the parents have it either),
- * false will be returned.
- *
- * Multiple files can be specified, in which case the first file in
- * the list that can be found on the filesystem is returned.
- *
- * If multiple files are specified and inheritance is involved,
- * first each of the specified files is checked in the selected style,
- * then each of the specified files is checked in the immediate parent,
- * etc.
- *
- * Specifying true for $return_default will cause the function to
- * return the first path which was checked for existence in the event
- * that the template file was not found, instead of false.
- * This is always a path in the selected style itself, not any of its
- * parents.
- *
- * If $return_full_path is false, then instead of returning a usable
- * path (when the file is found) the file's path relative to the style
- * directory will be returned. This is the same path as was given to
- * the function as a parameter. This can be used to check which of the
- * files specified in $files exists. Naturally this requires passing
- * more than one file in $files.
- *
- * @param array $files List of files to locate.
- * @param bool $return_default Determines what to return if file does not
- * exist. If true, function will return location where file is
- * supposed to be. If false, function will return false.
- * @param bool $return_full_path If true, function will return full path
- * to file. If false, function will return file name. This
- * parameter can be used to check which one of set of files
- * is available.
- * @return string or boolean Source file path if file exists or $return_default is
- * true. False if file does not exist and $return_default is false
- */
- public function get_first_file_location($files, $return_default = false, $return_full_path = true);
-}
diff --git a/phpBB/phpbb/template/template.php b/phpBB/phpbb/template/template.php
index 89a01e924d..cf38bba522 100644
--- a/phpBB/phpbb/template/template.php
+++ b/phpBB/phpbb/template/template.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\template;
+
/**
* @ignore
*/
@@ -15,13 +17,13 @@ if (!defined('IN_PHPBB'))
exit;
}
-interface phpbb_template
+interface template
{
/**
* Clear the cache
*
- * @return phpbb_template
+ * @return \phpbb\template\template
*/
public function clear_cache();
@@ -29,24 +31,42 @@ interface phpbb_template
* Sets the template filenames for handles.
*
* @param array $filename_array Should be a hash of handle => filename pairs.
- * @return phpbb_template $this
+ * @return \phpbb\template\template $this
*/
public function set_filenames(array $filename_array);
/**
- * Sets the style names/paths corresponding to style hierarchy being compiled
- * and/or rendered.
+ * Get the style tree of the style preferred by the current user
+ *
+ * @return array Style tree, most specific first
+ */
+ public function get_user_style();
+
+ /**
+ * Set style location based on (current) user's chosen style.
+ *
+ * @param array $style_directories The directories to add style paths for
+ * E.g. array('ext/foo/bar/styles', 'styles')
+ * Default: array('styles') (phpBB's style directory)
+ * @return \phpbb\template\template $this
+ */
+ public function set_style($style_directories = array('styles'));
+
+ /**
+ * Set custom style location (able to use directory outside of phpBB).
+ *
+ * Note: Templates are still compiled to phpBB's cache directory.
*
- * @param array $style_names List of style names in inheritance tree order
- * @param array $style_paths List of style paths in inheritance tree order
- * @return phpbb_template $this
+ * @param string|array $names Array of names or string of name of template(s) in inheritance tree order, used by extensions.
+ * @param string|array or string $paths Array of style paths, relative to current root directory
+ * @return \phpbb\template\template $this
*/
- public function set_style_names(array $style_names, array $style_paths);
+ public function set_custom_style($names, $paths);
/**
* Clears all variables and blocks assigned to this template.
*
- * @return phpbb_template $this
+ * @return \phpbb\template\template $this
*/
public function destroy();
@@ -54,7 +74,7 @@ interface phpbb_template
* Reset/empty complete block
*
* @param string $blockname Name of block to destroy
- * @return phpbb_template $this
+ * @return \phpbb\template\template $this
*/
public function destroy_block_vars($blockname);
@@ -66,7 +86,7 @@ interface phpbb_template
* This function calls hooks.
*
* @param string $handle Handle to display
- * @return phpbb_template $this
+ * @return \phpbb\template\template $this
*/
public function display($handle);
@@ -77,7 +97,7 @@ interface phpbb_template
* @param string $handle Handle to operate on
* @param string $template_var Template variable to assign compiled handle to
* @param bool $return_content If true return compiled handle, otherwise assign to $template_var
- * @return phpbb_template|string if $return_content is true return string of the compiled handle, otherwise return $this
+ * @return \phpbb\template\template|string if $return_content is true return string of the compiled handle, otherwise return $this
*/
public function assign_display($handle, $template_var = '', $return_content = true);
@@ -85,7 +105,7 @@ interface phpbb_template
* Assign key variable pairs from an array
*
* @param array $vararray A hash of variable name => value pairs
- * @return phpbb_template $this
+ * @return \phpbb\template\template $this
*/
public function assign_vars(array $vararray);
@@ -96,7 +116,7 @@ interface phpbb_template
*
* @param string $varname Variable name
* @param string $varval Value to assign to variable
- * @return phpbb_template $this
+ * @return \phpbb\template\template $this
*/
public function assign_var($varname, $varval);
@@ -107,7 +127,7 @@ interface phpbb_template
*
* @param string $varname Variable name
* @param string $varval Value to append to variable
- * @return phpbb_template $this
+ * @return \phpbb\template\template $this
*/
public function append_var($varname, $varval);
@@ -115,7 +135,7 @@ interface phpbb_template
* Assign key variable pairs from an array to a specified block
* @param string $blockname Name of block to assign $vararray to
* @param array $vararray A hash of variable name => value pairs
- * @return phpbb_template $this
+ * @return \phpbb\template\template $this
*/
public function assign_block_vars($blockname, array $vararray);
@@ -139,7 +159,7 @@ interface phpbb_template
* @param string $mode Mode to execute (valid modes are 'insert' and 'change')
*
* If insert, the vararray is inserted at the given position (position counting from zero).
- * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value).
+ * If change, the current block gets merged with the vararray (resulting in new \key/value pairs be added and existing keys be replaced by the new \value).
*
* Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array)
* and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars)
diff --git a/phpBB/phpbb/template/twig/definition.php b/phpBB/phpbb/template/twig/definition.php
index 6557b209eb..2490a43f81 100644
--- a/phpBB/phpbb/template/twig/definition.php
+++ b/phpBB/phpbb/template/twig/definition.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\template\twig;
+
/**
* @ignore
*/
@@ -18,7 +20,7 @@ if (!defined('IN_PHPBB'))
/**
* This class holds all DEFINE variables from the current page load
*/
-class phpbb_template_twig_definition
+class definition
{
/** @var array **/
protected $definitions = array();
@@ -39,7 +41,7 @@ class phpbb_template_twig_definition
*
* @param string $name
* @param mixed $value
- * @return phpbb_template_twig_definition
+ * @return \phpbb\template\twig\definition
*/
public function set($name, $value)
{
@@ -53,7 +55,7 @@ class phpbb_template_twig_definition
*
* @param string $name
* @param string $value
- * @return phpbb_template_twig_definition
+ * @return \phpbb\template\twig\definition
*/
public function append($name, $value)
{
diff --git a/phpBB/phpbb/template/twig/environment.php b/phpBB/phpbb/template/twig/environment.php
index b60cd72325..e0ee23dcd9 100644
--- a/phpBB/phpbb/template/twig/environment.php
+++ b/phpBB/phpbb/template/twig/environment.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\template\twig;
+
/**
* @ignore
*/
@@ -15,34 +17,44 @@ if (!defined('IN_PHPBB'))
exit;
}
-class phpbb_template_twig_environment extends Twig_Environment
+class environment extends \Twig_Environment
{
/** @var array */
protected $phpbb_extensions;
- /** @var phpbb_config */
+ /** @var \phpbb\config\config */
protected $phpbb_config;
+ /** @var \phpbb\filesystem */
+ protected $phpbb_filesystem;
+
/** @var string */
protected $phpbb_root_path;
+ /** @var string */
+ protected $web_root_path;
+
/** @var array **/
protected $namespace_look_up_order = array('__main__');
/**
* Constructor
*
- * @param phpbb_config $phpbb_config
+ * @param \phpbb\config\config $phpbb_config
* @param array $phpbb_extensions Array of enabled extensions (name => path)
+ * @param \phpbb\filesystem
* @param string $phpbb_root_path
* @param Twig_LoaderInterface $loader
* @param array $options Array of options to pass to Twig
*/
- public function __construct($phpbb_config, $phpbb_extensions, $phpbb_root_path, Twig_LoaderInterface $loader = null, $options = array())
+ public function __construct($phpbb_config, $phpbb_extensions, \phpbb\filesystem $phpbb_filesystem, \Twig_LoaderInterface $loader = null, $options = array())
{
$this->phpbb_config = $phpbb_config;
$this->phpbb_extensions = $phpbb_extensions;
- $this->phpbb_root_path = $phpbb_root_path;
+
+ $this->phpbb_filesystem = $phpbb_filesystem;
+ $this->phpbb_root_path = $this->phpbb_filesystem->get_phpbb_root_path();
+ $this->web_root_path = $this->phpbb_filesystem->get_web_root_path();
return parent::__construct($loader, $options);
}
@@ -62,7 +74,7 @@ class phpbb_template_twig_environment extends Twig_Environment
/**
* Get phpBB config
*
- * @return phpbb_config
+ * @return \phpbb\config\config
*/
public function get_phpbb_config()
{
@@ -80,6 +92,26 @@ class phpbb_template_twig_environment extends Twig_Environment
}
/**
+ * Get the web root path
+ *
+ * @return string
+ */
+ public function get_web_root_path()
+ {
+ return $this->web_root_path;
+ }
+
+ /**
+ * Get the phpbb_filesystem object
+ *
+ * @return \phpbb\filesystem
+ */
+ public function get_filesystem()
+ {
+ return $this->phpbb_filesystem;
+ }
+
+ /**
* Get the namespace look up order
*
* @return array
@@ -124,7 +156,7 @@ class phpbb_template_twig_environment extends Twig_Environment
return parent::loadTemplate('@' . $namespace . '/' . $name, $index);
}
- catch (Twig_Error_Loader $e)
+ catch (\Twig_Error_Loader $e)
{
}
}
@@ -137,4 +169,39 @@ class phpbb_template_twig_environment extends Twig_Environment
return parent::loadTemplate($name, $index);
}
}
+
+ /**
+ * Finds a template by name.
+ *
+ * @param string $name The template name
+ * @return string
+ */
+ public function findTemplate($name)
+ {
+ if (strpos($name, '@') === false)
+ {
+ foreach ($this->getNamespaceLookUpOrder() as $namespace)
+ {
+ try
+ {
+ if ($namespace === '__main__')
+ {
+ return parent::getLoader()->getCacheKey($name);
+ }
+
+ return parent::getLoader()->getCacheKey('@' . $namespace . '/' . $name);
+ }
+ catch (Twig_Error_Loader $e)
+ {
+ }
+ }
+
+ // We were unable to load any templates
+ throw $e;
+ }
+ else
+ {
+ return parent::getLoader()->getCacheKey($name);
+ }
+ }
}
diff --git a/phpBB/phpbb/template/twig/extension.php b/phpBB/phpbb/template/twig/extension.php
index c279726434..1ddb97369e 100644
--- a/phpBB/phpbb/template/twig/extension.php
+++ b/phpBB/phpbb/template/twig/extension.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\template\twig;
+
/**
* @ignore
*/
@@ -15,22 +17,22 @@ if (!defined('IN_PHPBB'))
exit;
}
-class phpbb_template_twig_extension extends Twig_Extension
+class extension extends \Twig_Extension
{
- /** @var phpbb_template_context */
+ /** @var \phpbb\template\context */
protected $context;
- /** @var phpbb_user */
+ /** @var \phpbb\user */
protected $user;
/**
* Constructor
*
- * @param phpbb_template_context $context
- * @param phpbb_user $user
- * @return phpbb_template_twig_extension
+ * @param \phpbb\template\context $context
+ * @param \phpbb\user $user
+ * @return \phpbb\template\twig\extension
*/
- public function __construct(phpbb_template_context $context, $user)
+ public function __construct(\phpbb\template\context $context, $user)
{
$this->context = $context;
$this->user = $user;
@@ -54,13 +56,13 @@ class phpbb_template_twig_extension extends Twig_Extension
public function getTokenParsers()
{
return array(
- new phpbb_template_twig_tokenparser_define,
- new phpbb_template_twig_tokenparser_include,
- new phpbb_template_twig_tokenparser_includejs,
- new phpbb_template_twig_tokenparser_includecss,
- new phpbb_template_twig_tokenparser_event,
- new phpbb_template_twig_tokenparser_includephp,
- new phpbb_template_twig_tokenparser_php,
+ new \phpbb\template\twig\tokenparser\defineparser,
+ new \phpbb\template\twig\tokenparser\includeparser,
+ new \phpbb\template\twig\tokenparser\includejs,
+ new \phpbb\template\twig\tokenparser\includecss,
+ new \phpbb\template\twig\tokenparser\event,
+ new \phpbb\template\twig\tokenparser\includephp,
+ new \phpbb\template\twig\tokenparser\php,
);
}
@@ -72,8 +74,8 @@ class phpbb_template_twig_extension extends Twig_Extension
public function getFilters()
{
return array(
- new Twig_SimpleFilter('subset', array($this, 'loop_subset'), array('needs_environment' => true)),
- new Twig_SimpleFilter('addslashes', 'addslashes'),
+ new \Twig_SimpleFilter('subset', array($this, 'loop_subset'), array('needs_environment' => true)),
+ new \Twig_SimpleFilter('addslashes', 'addslashes'),
);
}
@@ -85,7 +87,7 @@ class phpbb_template_twig_extension extends Twig_Extension
public function getFunctions()
{
return array(
- new Twig_SimpleFunction('lang', array($this, 'lang')),
+ new \Twig_SimpleFunction('lang', array($this, 'lang')),
);
}
@@ -102,26 +104,26 @@ class phpbb_template_twig_extension extends Twig_Extension
),
array(
// precedence settings are copied from similar operators in Twig core extension
- '||' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
- '&&' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
+ '||' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT),
+ '&&' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT),
- 'eq' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Equal', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
+ 'eq' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Equal', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT),
- 'ne' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
- 'neq' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
- '<>' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
+ 'ne' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT),
+ 'neq' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT),
+ '<>' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT),
- '===' => array('precedence' => 20, 'class' => 'phpbb_template_twig_node_expression_binary_equalequal', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
- '!==' => array('precedence' => 20, 'class' => 'phpbb_template_twig_node_expression_binary_notequalequal', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
+ '===' => array('precedence' => 20, 'class' => '\phpbb\template\twig\node\expression\binary\equalequal', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT),
+ '!==' => array('precedence' => 20, 'class' => '\phpbb\template\twig\node\expression\binary\notequalequal', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT),
- 'gt' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Greater', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
- 'gte' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_GreaterEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
- 'ge' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_GreaterEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
- 'lt' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Less', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
- 'lte' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
- 'le' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
+ 'gt' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Greater', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT),
+ 'gte' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_GreaterEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT),
+ 'ge' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_GreaterEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT),
+ 'lt' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Less', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT),
+ 'lte' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT),
+ 'le' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT),
- 'mod' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Mod', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT),
+ 'mod' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Mod', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT),
),
);
}
@@ -137,7 +139,7 @@ class phpbb_template_twig_extension extends Twig_Extension
*
* @return mixed The sliced variable
*/
- function loop_subset(Twig_Environment $env, $item, $start, $end = null, $preserveKeys = false)
+ function loop_subset(\Twig_Environment $env, $item, $start, $end = null, $preserveKeys = false)
{
// We do almost the same thing as Twig's slice (array_slice), except when $end is positive
if ($end >= 1)
diff --git a/phpBB/phpbb/template/twig/lexer.php b/phpBB/phpbb/template/twig/lexer.php
index 3534311b7a..d832fbf84e 100644
--- a/phpBB/phpbb/template/twig/lexer.php
+++ b/phpBB/phpbb/template/twig/lexer.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\template\twig;
+
/**
* @ignore
*/
@@ -15,7 +17,7 @@ if (!defined('IN_PHPBB'))
exit;
}
-class phpbb_template_twig_lexer extends Twig_Lexer
+class lexer extends \Twig_Lexer
{
public function tokenize($code, $filename = null)
{
@@ -75,7 +77,7 @@ class phpbb_template_twig_lexer extends Twig_Lexer
// Fix tokens that may have inline variables (e.g. <!-- DEFINE $TEST = '{FOO}')
$code = $this->fix_inline_variable_tokens(array(
- 'DEFINE.+=',
+ 'DEFINE \$[a-zA-Z0-9_]+ =',
'INCLUDE',
'INCLUDEPHP',
'INCLUDEJS',
@@ -130,7 +132,7 @@ class phpbb_template_twig_lexer extends Twig_Lexer
// E.g. 'asdf'"' -> asdf'"
// E.g. "asdf'"" -> asdf'"
// E.g. 'asdf'" -> 'asdf'"
- $matches[2] = preg_replace('#^([\'"])?(.+?)\1$#', '$2', $matches[2]);
+ $matches[2] = preg_replace('#^([\'"])?(.*?)\1$#', '$2', $matches[2]);
// Replace template variables with start/end to parse variables (' ~ TEST ~ '.html)
$matches[2] = preg_replace('#{([a-zA-Z0-9_\.$]+)}#', "'~ \$1 ~'", $matches[2]);
@@ -161,6 +163,9 @@ class phpbb_template_twig_lexer extends Twig_Lexer
$subset = trim(substr($matches[2], 1, -1)); // Remove parenthesis
$body = $matches[3];
+ // Replace <!-- BEGINELSE -->
+ $body = str_replace('<!-- BEGINELSE -->', '{% else %}', $body);
+
// Is the designer wanting to call another loop in a loop?
// <!-- BEGIN loop -->
// <!-- BEGIN !loop2 -->
@@ -205,9 +210,6 @@ class phpbb_template_twig_lexer extends Twig_Lexer
return "{% for {$name} in {$parent}{$name}{$subset} %}{$body}{% endfor %}";
};
- // Replace <!-- BEGINELSE --> correctly, only needs to be done once
- $code = str_replace('<!-- BEGINELSE -->', '{% else %}', $code);
-
return preg_replace_callback('#<!-- BEGIN ([!a-zA-Z0-9_]+)(\([0-9,\-]+\))? -->(.+?)<!-- END \1 -->#s', $callback, $code);
}
@@ -219,25 +221,28 @@ class phpbb_template_twig_lexer extends Twig_Lexer
*/
protected function fix_if_tokens($code)
{
+ // Replace ELSE IF with ELSEIF
+ $code = preg_replace('#<!-- ELSE IF (.+?) -->#', '<!-- ELSEIF $1 -->', $code);
+
+ // Replace our "div by" with Twig's divisibleby (Twig does not like test names with spaces)
+ $code = preg_replace('# div by ([0-9]+)#', ' divisibleby($1)', $code);
+
$callback = function($matches)
{
$inner = $matches[2];
// Replace $TEST with definition.TEST
- $inner = preg_replace('#\s\$([a-zA-Z_0-9]+)#', ' definition.$1', $inner);
+ $inner = preg_replace('#(\s\(*!?)\$([a-zA-Z_0-9]+)#', '$1definition.$2', $inner);
// Replace .foo with loops.foo|length
- $inner = preg_replace('#\s\.([a-zA-Z_0-9]+)([^a-zA-Z_0-9\.])#', ' loops.$1|length$2', $inner);
+ $inner = preg_replace('#(\s\(*!?)\.([a-zA-Z_0-9]+)([^a-zA-Z_0-9\.])#', '$1loops.$2|length$3', $inner);
// Replace .foo.bar with foo.bar|length
- $inner = preg_replace('#\s\.([a-zA-Z_0-9\.]+)([^a-zA-Z_0-9\.])#', ' $1|length$2', $inner);
+ $inner = preg_replace('#(\s\(*!?)\.([a-zA-Z_0-9\.]+)([^a-zA-Z_0-9\.])#', '$1$2|length$3', $inner);
return "<!-- {$matches[1]}IF{$inner}-->";
};
- // Replace our "div by" with Twig's divisibleby (Twig does not like test names with spaces)
- $code = preg_replace('# div by ([0-9]+)#', ' divisibleby($1)', $code);
-
- return preg_replace_callback('#<!-- (ELSE)?IF((.*)[\s][\$|\.|!]([^\s]+)(.*))-->#', $callback, $code);
+ return preg_replace_callback('#<!-- (ELSE)?IF((.*?) \(*!?[\$|\.]([^\s]+)(.*?))-->#', $callback, $code);
}
/**
@@ -261,10 +266,10 @@ class phpbb_template_twig_lexer extends Twig_Lexer
*/
// Replace <!-- DEFINE $NAME with {% DEFINE definition.NAME
- $code = preg_replace('#<!-- DEFINE \$(.*)-->#', '{% DEFINE $1 %}', $code);
+ $code = preg_replace('#<!-- DEFINE \$(.*?) -->#', '{% DEFINE $1 %}', $code);
// Changing UNDEFINE NAME to DEFINE NAME = null to save from creating an extra token parser/node
- $code = preg_replace('#<!-- UNDEFINE \$(.*)-->#', '{% DEFINE $1= null %}', $code);
+ $code = preg_replace('#<!-- UNDEFINE \$(.*?)-->#', '{% DEFINE $1= null %}', $code);
// Replace all of our variables, {$VARNAME}, with Twig style, {{ definition.VARNAME }}
$code = preg_replace('#{\$([a-zA-Z0-9_\.]+)}#', '{{ definition.$1 }}', $code);
diff --git a/phpBB/phpbb/template/twig/loader.php b/phpBB/phpbb/template/twig/loader.php
new file mode 100644
index 0000000000..910061dc0f
--- /dev/null
+++ b/phpBB/phpbb/template/twig/loader.php
@@ -0,0 +1,152 @@
+<?php
+/**
+*
+* @package phpBB3
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+namespace phpbb\template\twig;
+
+/**
+* @ignore
+*/
+if (!defined('IN_PHPBB'))
+{
+ exit;
+}
+
+/**
+* Twig Template loader
+* @package phpBB3
+*/
+class loader extends \Twig_Loader_Filesystem
+{
+ protected $safe_directories = array();
+
+ /**
+ * Set safe directories
+ *
+ * @param array $directories Array of directories that are safe (empty to clear)
+ * @return Twig_Loader_Filesystem
+ */
+ public function setSafeDirectories($directories = array())
+ {
+ $this->safe_directories = array();
+
+ if (!empty($directories))
+ {
+ foreach ($directories as $directory)
+ {
+ $this->addSafeDirectory($directory);
+ }
+ }
+
+ return $this;
+ }
+
+ /**
+ * Add safe directory
+ *
+ * @param string $directory Directory that should be added
+ * @return Twig_Loader_Filesystem
+ */
+ public function addSafeDirectory($directory)
+ {
+ $directory = phpbb_realpath($directory);
+
+ if ($directory !== false)
+ {
+ $this->safe_directories[] = $directory;
+ }
+
+ return $this;
+ }
+
+ /**
+ * Get current safe directories
+ *
+ * @return array
+ */
+ public function getSafeDirectories()
+ {
+ return $this->safe_directories;
+ }
+
+ /**
+ * Override for parent::validateName()
+ *
+ * This is done because we added support for safe directories, and when Twig
+ * findTemplate() is called, validateName() is called first, which would
+ * always throw an exception if the file is outside of the configured
+ * template directories.
+ */
+ protected function validateName($name)
+ {
+ return;
+ }
+
+ /**
+ * Find the template
+ *
+ * Override for Twig_Loader_Filesystem::findTemplate to add support
+ * for loading from safe directories.
+ */
+ protected function findTemplate($name)
+ {
+ $name = (string) $name;
+
+ // normalize name
+ $name = preg_replace('#/{2,}#', '/', strtr($name, '\\', '/'));
+
+ // If this is in the cache we can skip the entire process below
+ // as it should have already been validated
+ if (isset($this->cache[$name])) {
+ return $this->cache[$name];
+ }
+
+ // First, find the template name. The override above of validateName
+ // causes the validateName process to be skipped for this call
+ $file = parent::findTemplate($name);
+
+ try
+ {
+ // Try validating the name (which may throw an exception)
+ parent::validateName($name);
+ }
+ catch (Twig_Error_Loader $e)
+ {
+ if (strpos($e->getRawMessage(), 'Looks like you try to load a template outside configured directories') === 0)
+ {
+ // Ok, so outside of the configured template directories, we
+ // can now check if we're within a "safe" directory
+
+ // Find the real path of the directory the file is in
+ $directory = phpbb_realpath(dirname($file));
+
+ if ($directory === false)
+ {
+ // Some sort of error finding the actual path, must throw the exception
+ throw $e;
+ }
+
+ foreach ($this->safe_directories as $safe_directory)
+ {
+ if (strpos($directory, $safe_directory) === 0)
+ {
+ // The directory being loaded is below a directory
+ // that is "safe". We're good to load it!
+ return $file;
+ }
+ }
+ }
+
+ // Not within any safe directories
+ throw $e;
+ }
+
+ // No exception from validateName, safe to load.
+ return $file;
+ }
+}
diff --git a/phpBB/phpbb/template/twig/node/define.php b/phpBB/phpbb/template/twig/node/definenode.php
index fcb19cc773..ec084d0f7d 100644
--- a/phpBB/phpbb/template/twig/node/define.php
+++ b/phpBB/phpbb/template/twig/node/definenode.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\template\twig\node;
+
/**
* @ignore
*/
@@ -16,9 +18,9 @@ if (!defined('IN_PHPBB'))
}
-class phpbb_template_twig_node_define extends Twig_Node
+class definenode extends \Twig_Node
{
- public function __construct($capture, Twig_NodeInterface $name, Twig_NodeInterface $value, $lineno, $tag = null)
+ public function __construct($capture, \Twig_NodeInterface $name, \Twig_NodeInterface $value, $lineno, $tag = null)
{
parent::__construct(array('name' => $name, 'value' => $value), array('capture' => $capture, 'safe' => false), $lineno, $tag);
}
@@ -28,7 +30,7 @@ class phpbb_template_twig_node_define extends Twig_Node
*
* @param Twig_Compiler A Twig_Compiler instance
*/
- public function compile(Twig_Compiler $compiler)
+ public function compile(\Twig_Compiler $compiler)
{
$compiler->addDebugInfo($this);
@@ -38,7 +40,7 @@ class phpbb_template_twig_node_define extends Twig_Node
->subcompile($this->getNode('value'))
;
- $compiler->write("\$value = ('' === \$value = ob_get_clean()) ? '' : new Twig_Markup(\$value, \$this->env->getCharset());\n");
+ $compiler->write("\$value = ('' === \$value = ob_get_clean()) ? '' : new \Twig_Markup(\$value, \$this->env->getCharset());\n");
}
else
{
diff --git a/phpBB/phpbb/template/twig/node/event.php b/phpBB/phpbb/template/twig/node/event.php
index c94e5fdf20..202db775ee 100644
--- a/phpBB/phpbb/template/twig/node/event.php
+++ b/phpBB/phpbb/template/twig/node/event.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\template\twig\node;
+
/**
* @ignore
*/
@@ -16,9 +18,9 @@ if (!defined('IN_PHPBB'))
}
-class phpbb_template_twig_node_event extends Twig_Node
+class event extends \Twig_Node
{
- /**
+ /**
* The subdirectory in which all template listener files must be placed
* @var string
*/
@@ -27,7 +29,7 @@ class phpbb_template_twig_node_event extends Twig_Node
/** @var Twig_Environment */
protected $environment;
- public function __construct(Twig_Node_Expression $expr, phpbb_template_twig_environment $environment, $lineno, $tag = null)
+ public function __construct(\Twig_Node_Expression $expr, \phpbb\template\twig\environment $environment, $lineno, $tag = null)
{
$this->environment = $environment;
@@ -39,7 +41,7 @@ class phpbb_template_twig_node_event extends Twig_Node
*
* @param Twig_Compiler A Twig_Compiler instance
*/
- public function compile(Twig_Compiler $compiler)
+ public function compile(\Twig_Compiler $compiler)
{
$compiler->addDebugInfo($this);
diff --git a/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php b/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php
index 8ec2069114..48d8b814b8 100644
--- a/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php
+++ b/phpBB/phpbb/template/twig/node/expression/binary/equalequal.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\template\twig\node\expression\binary;
+
/**
* @ignore
*/
@@ -16,9 +18,9 @@ if (!defined('IN_PHPBB'))
}
-class phpbb_template_twig_node_expression_binary_equalequal extends Twig_Node_Expression_Binary
+class equalequal extends \Twig_Node_Expression_Binary
{
- public function operator(Twig_Compiler $compiler)
+ public function operator(\Twig_Compiler $compiler)
{
return $compiler->raw('===');
}
diff --git a/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php b/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php
index 96f32c502e..87585dfb4c 100644
--- a/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php
+++ b/phpBB/phpbb/template/twig/node/expression/binary/notequalequal.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\template\twig\node\expression\binary;
+
/**
* @ignore
*/
@@ -16,9 +18,9 @@ if (!defined('IN_PHPBB'))
}
-class phpbb_template_twig_node_expression_binary_notequalequal extends Twig_Node_Expression_Binary
+class notequalequal extends \Twig_Node_Expression_Binary
{
- public function operator(Twig_Compiler $compiler)
+ public function operator(\Twig_Compiler $compiler)
{
return $compiler->raw('!==');
}
diff --git a/phpBB/phpbb/template/twig/node/includeasset.php b/phpBB/phpbb/template/twig/node/includeasset.php
index 1cab416c79..f15fd6296b 100644
--- a/phpBB/phpbb/template/twig/node/includeasset.php
+++ b/phpBB/phpbb/template/twig/node/includeasset.php
@@ -7,12 +7,14 @@
*
*/
-abstract class phpbb_template_twig_node_includeasset extends Twig_Node
+namespace phpbb\template\twig\node;
+
+abstract class includeasset extends \Twig_Node
{
/** @var Twig_Environment */
protected $environment;
- public function __construct(Twig_Node_Expression $expr, phpbb_template_twig_environment $environment, $lineno, $tag = null)
+ public function __construct(\Twig_Node_Expression $expr, \phpbb\template\twig\environment $environment, $lineno, $tag = null)
{
$this->environment = $environment;
@@ -23,7 +25,7 @@ abstract class phpbb_template_twig_node_includeasset extends Twig_Node
*
* @param Twig_Compiler A Twig_Compiler instance
*/
- public function compile(Twig_Compiler $compiler)
+ public function compile(\Twig_Compiler $compiler)
{
$compiler->addDebugInfo($this);
@@ -33,17 +35,17 @@ abstract class phpbb_template_twig_node_includeasset extends Twig_Node
->write("\$asset_file = ")
->subcompile($this->getNode('expr'))
->raw(";\n")
- ->write("\$asset = new phpbb_template_asset(\$asset_file);\n")
+ ->write("\$asset = new \phpbb\\template\\asset(\$asset_file, \$this->getEnvironment()->get_filesystem());\n")
->write("if (substr(\$asset_file, 0, 2) !== './' && \$asset->is_relative()) {\n")
->indent()
->write("\$asset_path = \$asset->get_path();")
->write("\$local_file = \$this->getEnvironment()->get_phpbb_root_path() . \$asset_path;\n")
->write("if (!file_exists(\$local_file)) {\n")
->indent()
- ->write("\$local_file = \$this->getEnvironment()->getLoader()->getCacheKey(\$asset_path);\n")
+ ->write("\$local_file = \$this->getEnvironment()->findTemplate(\$asset_path);\n")
->write("\$asset->set_path(\$local_file, true);\n")
->outdent()
- ->write("\$asset->add_assets_version({$config['assets_version']});\n")
+ ->write("\$asset->add_assets_version('{$config['assets_version']}');\n")
->write("\$asset_file = \$asset->get_url();\n")
->write("}\n")
->outdent()
@@ -71,5 +73,5 @@ abstract class phpbb_template_twig_node_includeasset extends Twig_Node
* @param Twig_Compiler A Twig_Compiler instance
* @return null
*/
- abstract protected function append_asset(Twig_Compiler $compiler);
+ abstract protected function append_asset(\Twig_Compiler $compiler);
}
diff --git a/phpBB/phpbb/template/twig/node/includecss.php b/phpBB/phpbb/template/twig/node/includecss.php
index a9d9b46d69..deb279fa4a 100644
--- a/phpBB/phpbb/template/twig/node/includecss.php
+++ b/phpBB/phpbb/template/twig/node/includecss.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_template_twig_node_includecss extends phpbb_template_twig_node_includeasset
+namespace phpbb\template\twig\node;
+
+class includecss extends \phpbb\template\twig\node\includeasset
{
/**
* {@inheritdoc}
@@ -20,7 +22,7 @@ class phpbb_template_twig_node_includecss extends phpbb_template_twig_node_inclu
/**
* {@inheritdoc}
*/
- public function append_asset(Twig_Compiler $compiler)
+ public function append_asset(\Twig_Compiler $compiler)
{
$compiler
->raw("<link href=\"' . ")
diff --git a/phpBB/phpbb/template/twig/node/includejs.php b/phpBB/phpbb/template/twig/node/includejs.php
index 2b4b55fb0a..696b640eac 100644
--- a/phpBB/phpbb/template/twig/node/includejs.php
+++ b/phpBB/phpbb/template/twig/node/includejs.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_template_twig_node_includejs extends phpbb_template_twig_node_includeasset
+namespace phpbb\template\twig\node;
+
+class includejs extends \phpbb\template\twig\node\includeasset
{
/**
* {@inheritdoc}
@@ -20,7 +22,7 @@ class phpbb_template_twig_node_includejs extends phpbb_template_twig_node_includ
/**
* {@inheritdoc}
*/
- protected function append_asset(Twig_Compiler $compiler)
+ protected function append_asset(\Twig_Compiler $compiler)
{
$config = $this->environment->get_phpbb_config();
diff --git a/phpBB/phpbb/template/twig/node/include.php b/phpBB/phpbb/template/twig/node/includenode.php
index 5c6ae1bbcf..77fe7f3acb 100644
--- a/phpBB/phpbb/template/twig/node/include.php
+++ b/phpBB/phpbb/template/twig/node/includenode.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\template\twig\node;
+
/**
* @ignore
*/
@@ -16,14 +18,14 @@ if (!defined('IN_PHPBB'))
}
-class phpbb_template_twig_node_include extends Twig_Node_Include
+class includenode extends \Twig_Node_Include
{
/**
* Compiles the node to PHP.
*
* @param Twig_Compiler A Twig_Compiler instance
*/
- public function compile(Twig_Compiler $compiler)
+ public function compile(\Twig_Compiler $compiler)
{
$compiler->addDebugInfo($this);
diff --git a/phpBB/phpbb/template/twig/node/includephp.php b/phpBB/phpbb/template/twig/node/includephp.php
index dbe54f0e1a..4024cf0cc8 100644
--- a/phpBB/phpbb/template/twig/node/includephp.php
+++ b/phpBB/phpbb/template/twig/node/includephp.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\template\twig\node;
+
/**
* @ignore
*/
@@ -16,12 +18,12 @@ if (!defined('IN_PHPBB'))
}
-class phpbb_template_twig_node_includephp extends Twig_Node
+class includephp extends \Twig_Node
{
/** @var Twig_Environment */
protected $environment;
- public function __construct(Twig_Node_Expression $expr, phpbb_template_twig_environment $environment, $ignoreMissing = false, $lineno, $tag = null)
+ public function __construct(\Twig_Node_Expression $expr, \phpbb\template\twig\environment $environment, $ignoreMissing = false, $lineno, $tag = null)
{
$this->environment = $environment;
@@ -33,7 +35,7 @@ class phpbb_template_twig_node_includephp extends Twig_Node
*
* @param Twig_Compiler A Twig_Compiler instance
*/
- public function compile(Twig_Compiler $compiler)
+ public function compile(\Twig_Compiler $compiler)
{
$compiler->addDebugInfo($this);
@@ -80,7 +82,7 @@ class phpbb_template_twig_node_includephp extends Twig_Node
if ($this->getAttribute('ignore_missing')) {
$compiler
->outdent()
- ->write("} catch (Twig_Error_Loader \$e) {\n")
+ ->write("} catch (\Twig_Error_Loader \$e) {\n")
->indent()
->write("// ignore missing template\n")
->outdent()
diff --git a/phpBB/phpbb/template/twig/node/php.php b/phpBB/phpbb/template/twig/node/php.php
index c11539ea7f..b37759303d 100644
--- a/phpBB/phpbb/template/twig/node/php.php
+++ b/phpBB/phpbb/template/twig/node/php.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\template\twig\node;
+
/**
* @ignore
*/
@@ -16,12 +18,12 @@ if (!defined('IN_PHPBB'))
}
-class phpbb_template_twig_node_php extends Twig_Node
+class php extends \Twig_Node
{
/** @var Twig_Environment */
protected $environment;
- public function __construct(Twig_Node_Text $text, phpbb_template_twig_environment $environment, $lineno, $tag = null)
+ public function __construct(\Twig_Node_Text $text, \phpbb\template\twig\environment $environment, $lineno, $tag = null)
{
$this->environment = $environment;
@@ -33,7 +35,7 @@ class phpbb_template_twig_node_php extends Twig_Node
*
* @param Twig_Compiler A Twig_Compiler instance
*/
- public function compile(Twig_Compiler $compiler)
+ public function compile(\Twig_Compiler $compiler)
{
$compiler->addDebugInfo($this);
diff --git a/phpBB/phpbb/template/twig/tokenparser/define.php b/phpBB/phpbb/template/twig/tokenparser/defineparser.php
index 4ea15388c4..688afec191 100644
--- a/phpBB/phpbb/template/twig/tokenparser/define.php
+++ b/phpBB/phpbb/template/twig/tokenparser/defineparser.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\template\twig\tokenparser;
+
/**
* @ignore
*/
@@ -16,7 +18,7 @@ if (!defined('IN_PHPBB'))
}
-class phpbb_template_twig_tokenparser_define extends Twig_TokenParser
+class defineparser extends \Twig_TokenParser
{
/**
* Parses a token and returns a node.
@@ -25,31 +27,31 @@ class phpbb_template_twig_tokenparser_define extends Twig_TokenParser
*
* @return Twig_NodeInterface A Twig_NodeInterface instance
*/
- public function parse(Twig_Token $token)
+ public function parse(\Twig_Token $token)
{
$lineno = $token->getLine();
$stream = $this->parser->getStream();
$name = $this->parser->getExpressionParser()->parseExpression();
$capture = false;
- if ($stream->test(Twig_Token::OPERATOR_TYPE, '=')) {
+ if ($stream->test(\Twig_Token::OPERATOR_TYPE, '=')) {
$stream->next();
$value = $this->parser->getExpressionParser()->parseExpression();
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
+ $stream->expect(\Twig_Token::BLOCK_END_TYPE);
} else {
$capture = true;
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
+ $stream->expect(\Twig_Token::BLOCK_END_TYPE);
$value = $this->parser->subparse(array($this, 'decideBlockEnd'), true);
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
+ $stream->expect(\Twig_Token::BLOCK_END_TYPE);
}
- return new phpbb_template_twig_node_define($capture, $name, $value, $lineno, $this->getTag());
+ return new \phpbb\template\twig\node\definenode($capture, $name, $value, $lineno, $this->getTag());
}
- public function decideBlockEnd(Twig_Token $token)
+ public function decideBlockEnd(\Twig_Token $token)
{
return $token->test('ENDDEFINE');
}
diff --git a/phpBB/phpbb/template/twig/tokenparser/event.php b/phpBB/phpbb/template/twig/tokenparser/event.php
index e4dddd6dcc..7cf4000909 100644
--- a/phpBB/phpbb/template/twig/tokenparser/event.php
+++ b/phpBB/phpbb/template/twig/tokenparser/event.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\template\twig\tokenparser;
+
/**
* @ignore
*/
@@ -16,7 +18,7 @@ if (!defined('IN_PHPBB'))
}
-class phpbb_template_twig_tokenparser_event extends Twig_TokenParser
+class event extends \Twig_TokenParser
{
/**
* Parses a token and returns a node.
@@ -25,14 +27,14 @@ class phpbb_template_twig_tokenparser_event extends Twig_TokenParser
*
* @return Twig_NodeInterface A Twig_NodeInterface instance
*/
- public function parse(Twig_Token $token)
+ public function parse(\Twig_Token $token)
{
$expr = $this->parser->getExpressionParser()->parseExpression();
$stream = $this->parser->getStream();
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
+ $stream->expect(\Twig_Token::BLOCK_END_TYPE);
- return new phpbb_template_twig_node_event($expr, $this->parser->getEnvironment(), $token->getLine(), $this->getTag());
+ return new \phpbb\template\twig\node\event($expr, $this->parser->getEnvironment(), $token->getLine(), $this->getTag());
}
/**
diff --git a/phpBB/phpbb/template/twig/tokenparser/includecss.php b/phpBB/phpbb/template/twig/tokenparser/includecss.php
index 6c24dda647..7bf4c610b1 100644
--- a/phpBB/phpbb/template/twig/tokenparser/includecss.php
+++ b/phpBB/phpbb/template/twig/tokenparser/includecss.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_template_twig_tokenparser_includecss extends Twig_TokenParser
+namespace phpbb\template\twig\tokenparser;
+
+class includecss extends \Twig_TokenParser
{
/**
* Parses a token and returns a node.
@@ -16,14 +18,14 @@ class phpbb_template_twig_tokenparser_includecss extends Twig_TokenParser
*
* @return Twig_NodeInterface A Twig_NodeInterface instance
*/
- public function parse(Twig_Token $token)
+ public function parse(\Twig_Token $token)
{
$expr = $this->parser->getExpressionParser()->parseExpression();
$stream = $this->parser->getStream();
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
+ $stream->expect(\Twig_Token::BLOCK_END_TYPE);
- return new phpbb_template_twig_node_includecss($expr, $this->parser->getEnvironment(), $token->getLine(), $this->getTag());
+ return new \phpbb\template\twig\node\includecss($expr, $this->parser->getEnvironment(), $token->getLine(), $this->getTag());
}
/**
diff --git a/phpBB/phpbb/template/twig/tokenparser/includejs.php b/phpBB/phpbb/template/twig/tokenparser/includejs.php
index b02b2f89ba..30a99f3279 100644
--- a/phpBB/phpbb/template/twig/tokenparser/includejs.php
+++ b/phpBB/phpbb/template/twig/tokenparser/includejs.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\template\twig\tokenparser;
+
/**
* @ignore
*/
@@ -16,7 +18,7 @@ if (!defined('IN_PHPBB'))
}
-class phpbb_template_twig_tokenparser_includejs extends Twig_TokenParser
+class includejs extends \Twig_TokenParser
{
/**
* Parses a token and returns a node.
@@ -25,14 +27,14 @@ class phpbb_template_twig_tokenparser_includejs extends Twig_TokenParser
*
* @return Twig_NodeInterface A Twig_NodeInterface instance
*/
- public function parse(Twig_Token $token)
+ public function parse(\Twig_Token $token)
{
$expr = $this->parser->getExpressionParser()->parseExpression();
$stream = $this->parser->getStream();
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
+ $stream->expect(\Twig_Token::BLOCK_END_TYPE);
- return new phpbb_template_twig_node_includejs($expr, $this->parser->getEnvironment(), $token->getLine(), $this->getTag());
+ return new \phpbb\template\twig\node\includejs($expr, $this->parser->getEnvironment(), $token->getLine(), $this->getTag());
}
/**
diff --git a/phpBB/phpbb/template/twig/tokenparser/include.php b/phpBB/phpbb/template/twig/tokenparser/includeparser.php
index 520f9fd1a0..715c0ec84d 100644
--- a/phpBB/phpbb/template/twig/tokenparser/include.php
+++ b/phpBB/phpbb/template/twig/tokenparser/includeparser.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\template\twig\tokenparser;
+
/**
* @ignore
*/
@@ -16,7 +18,7 @@ if (!defined('IN_PHPBB'))
}
-class phpbb_template_twig_tokenparser_include extends Twig_TokenParser_Include
+class includeparser extends \Twig_TokenParser_Include
{
/**
* Parses a token and returns a node.
@@ -25,13 +27,13 @@ class phpbb_template_twig_tokenparser_include extends Twig_TokenParser_Include
*
* @return Twig_NodeInterface A Twig_NodeInterface instance
*/
- public function parse(Twig_Token $token)
+ public function parse(\Twig_Token $token)
{
$expr = $this->parser->getExpressionParser()->parseExpression();
list($variables, $only, $ignoreMissing) = $this->parseArguments();
- return new phpbb_template_twig_node_include($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag());
+ return new \phpbb\template\twig\node\includenode($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag());
}
/**
diff --git a/phpBB/phpbb/template/twig/tokenparser/includephp.php b/phpBB/phpbb/template/twig/tokenparser/includephp.php
index 13fe6de8a6..d906837590 100644
--- a/phpBB/phpbb/template/twig/tokenparser/includephp.php
+++ b/phpBB/phpbb/template/twig/tokenparser/includephp.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\template\twig\tokenparser;
+
/**
* @ignore
*/
@@ -16,7 +18,7 @@ if (!defined('IN_PHPBB'))
}
-class phpbb_template_twig_tokenparser_includephp extends Twig_TokenParser
+class includephp extends \Twig_TokenParser
{
/**
* Parses a token and returns a node.
@@ -25,23 +27,23 @@ class phpbb_template_twig_tokenparser_includephp extends Twig_TokenParser
*
* @return Twig_NodeInterface A Twig_NodeInterface instance
*/
- public function parse(Twig_Token $token)
+ public function parse(\Twig_Token $token)
{
$expr = $this->parser->getExpressionParser()->parseExpression();
$stream = $this->parser->getStream();
$ignoreMissing = false;
- if ($stream->test(Twig_Token::NAME_TYPE, 'ignore')) {
+ if ($stream->test(\Twig_Token::NAME_TYPE, 'ignore')) {
$stream->next();
- $stream->expect(Twig_Token::NAME_TYPE, 'missing');
+ $stream->expect(\Twig_Token::NAME_TYPE, 'missing');
$ignoreMissing = true;
}
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
+ $stream->expect(\Twig_Token::BLOCK_END_TYPE);
- return new phpbb_template_twig_node_includephp($expr, $this->parser->getEnvironment(), $ignoreMissing, $token->getLine(), $this->getTag());
+ return new \phpbb\template\twig\node\includephp($expr, $this->parser->getEnvironment(), $ignoreMissing, $token->getLine(), $this->getTag());
}
/**
diff --git a/phpBB/phpbb/template/twig/tokenparser/php.php b/phpBB/phpbb/template/twig/tokenparser/php.php
index 197980a59a..e4f70fb9b1 100644
--- a/phpBB/phpbb/template/twig/tokenparser/php.php
+++ b/phpBB/phpbb/template/twig/tokenparser/php.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\template\twig\tokenparser;
+
/**
* @ignore
*/
@@ -16,7 +18,7 @@ if (!defined('IN_PHPBB'))
}
-class phpbb_template_twig_tokenparser_php extends Twig_TokenParser
+class php extends \Twig_TokenParser
{
/**
* Parses a token and returns a node.
@@ -25,20 +27,20 @@ class phpbb_template_twig_tokenparser_php extends Twig_TokenParser
*
* @return Twig_NodeInterface A Twig_NodeInterface instance
*/
- public function parse(Twig_Token $token)
+ public function parse(\Twig_Token $token)
{
$stream = $this->parser->getStream();
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
+ $stream->expect(\Twig_Token::BLOCK_END_TYPE);
$body = $this->parser->subparse(array($this, 'decideEnd'), true);
- $stream->expect(Twig_Token::BLOCK_END_TYPE);
+ $stream->expect(\Twig_Token::BLOCK_END_TYPE);
- return new phpbb_template_twig_node_php($body, $this->parser->getEnvironment(), $token->getLine(), $this->getTag());
+ return new \phpbb\template\twig\node\php($body, $this->parser->getEnvironment(), $token->getLine(), $this->getTag());
}
- public function decideEnd(Twig_Token $token)
+ public function decideEnd(\Twig_Token $token)
{
return $token->test('ENDPHP');
}
diff --git a/phpBB/phpbb/template/twig/twig.php b/phpBB/phpbb/template/twig/twig.php
index 6cff1bb8e4..2da7405743 100644
--- a/phpBB/phpbb/template/twig/twig.php
+++ b/phpBB/phpbb/template/twig/twig.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\template\twig;
+
/**
* @ignore
*/
@@ -19,16 +21,9 @@ if (!defined('IN_PHPBB'))
* Twig Template class.
* @package phpBB3
*/
-class phpbb_template_twig implements phpbb_template
+class twig extends \phpbb\template\base
{
/**
- * Template context.
- * Stores template data used during template rendering.
- * @var phpbb_template_context
- */
- protected $context;
-
- /**
* Path of the cache directory for the template
*
* Cannot be changed during runtime.
@@ -38,16 +33,16 @@ class phpbb_template_twig implements phpbb_template
private $cachepath = '';
/**
- * phpBB root path
- * @var string
+ * phpBB filesystem
+ * @var \phpbb\filesystem
*/
- protected $phpbb_root_path;
+ protected $phpbb_filesystem;
/**
- * adm relative path
+ * phpBB root path
* @var string
*/
- protected $adm_relative_path;
+ protected $phpbb_root_path;
/**
* PHP file extension
@@ -57,34 +52,24 @@ class phpbb_template_twig implements phpbb_template
/**
* phpBB config instance
- * @var phpbb_config
+ * @var \phpbb\config\config
*/
protected $config;
/**
* Current user
- * @var phpbb_user
+ * @var \phpbb\user
*/
protected $user;
/**
* Extension manager.
*
- * @var phpbb_extension_manager
+ * @var \phpbb\extension\manager
*/
protected $extension_manager;
/**
- * Name of the style that the template being compiled and/or rendered
- * belongs to, and its parents, in inheritance tree order.
- *
- * Used to invoke style-specific template events.
- *
- * @var array
- */
- protected $style_names;
-
- /**
* Twig Environment
*
* @var Twig_Environment
@@ -92,42 +77,33 @@ class phpbb_template_twig implements phpbb_template
protected $twig;
/**
- * Array of filenames assigned to set_filenames
- *
- * @var array
- */
- protected $filenames = array();
-
- /**
* Constructor.
*
- * @param string $phpbb_root_path phpBB root path
- * @param string $php_ext php extension (typically 'php')
- * @param phpbb_config $config
- * @param phpbb_user $user
- * @param phpbb_template_context $context template context
- * @param phpbb_extension_manager $extension_manager extension manager, if null then template events will not be invoked
- * @param string $adm_relative_path relative path to adm directory
+ * @param \phpbb\filesystem $phpbb_filesystem
+ * @param \phpbb\config\config $config
+ * @param \phpbb\user $user
+ * @param \phpbb\template\context $context template context
+ * @param \phpbb\extension\manager $extension_manager extension manager, if null then template events will not be invoked
*/
- public function __construct($phpbb_root_path, $php_ext, $config, $user, phpbb_template_context $context, phpbb_extension_manager $extension_manager = null, $adm_relative_path = null)
+ public function __construct(\phpbb\filesystem $phpbb_filesystem, $config, $user, \phpbb\template\context $context, \phpbb\extension\manager $extension_manager = null)
{
- $this->phpbb_root_path = $phpbb_root_path;
- $this->adm_relative_path = $adm_relative_path;
- $this->php_ext = $php_ext;
+ $this->phpbb_filesystem = $phpbb_filesystem;
+ $this->phpbb_root_path = $phpbb_filesystem->get_phpbb_root_path();
+ $this->php_ext = $phpbb_filesystem->get_php_ext();
$this->config = $config;
$this->user = $user;
$this->context = $context;
$this->extension_manager = $extension_manager;
- $this->cachepath = $phpbb_root_path . 'cache/twig/';
+ $this->cachepath = $this->phpbb_root_path . 'cache/twig/';
// Initiate the loader, __main__ namespace paths will be setup later in set_style_names()
- $loader = new Twig_Loader_Filesystem('');
+ $loader = new \phpbb\template\twig\loader('');
- $this->twig = new phpbb_template_twig_environment(
+ $this->twig = new \phpbb\template\twig\environment(
$this->config,
($this->extension_manager) ? $this->extension_manager->all_enabled() : array(),
- $this->phpbb_root_path,
+ $this->phpbb_filesystem,
$loader,
array(
'cache' => (defined('IN_INSTALL')) ? false : $this->cachepath,
@@ -138,21 +114,27 @@ class phpbb_template_twig implements phpbb_template
);
$this->twig->addExtension(
- new phpbb_template_twig_extension(
+ new \phpbb\template\twig\extension(
$this->context,
$this->user
)
);
- $lexer = new phpbb_template_twig_lexer($this->twig);
+ $lexer = new \phpbb\template\twig\lexer($this->twig);
$this->twig->setLexer($lexer);
+
+ // Add admin namespace
+ if ($this->phpbb_filesystem->get_adm_relative_path() !== null && is_dir($this->phpbb_root_path . $this->phpbb_filesystem->get_adm_relative_path() . 'style/'))
+ {
+ $this->twig->getLoader()->setPaths($this->phpbb_root_path . $this->phpbb_filesystem->get_adm_relative_path() . 'style/', 'admin');
+ }
}
/**
* Clear the cache
*
- * @return phpbb_template
+ * @return \phpbb\template\template
*/
public function clear_cache()
{
@@ -165,51 +147,94 @@ class phpbb_template_twig implements phpbb_template
}
/**
- * Sets the template filenames for handles.
+ * Get the style tree of the style preferred by the current user
*
- * @param array $filename_array Should be a hash of handle => filename pairs.
- * @return phpbb_template $this
+ * @return array Style tree, most specific first
*/
- public function set_filenames(array $filename_array)
+ public function get_user_style()
{
- $this->filenames = array_merge($this->filenames, $filename_array);
+ $style_list = array(
+ $this->user->style['style_path'],
+ );
- return $this;
+ if ($this->user->style['style_parent_id'])
+ {
+ $style_list = array_merge($style_list, array_reverse(explode('/', $this->user->style['style_parent_tree'])));
+ }
+
+ return $style_list;
}
/**
- * Sets the style names/paths corresponding to style hierarchy being compiled
- * and/or rendered.
+ * Set style location based on (current) user's chosen style.
*
- * @param array $style_names List of style names in inheritance tree order
- * @param array $style_paths List of style paths in inheritance tree order
- * @param bool $is_core True if the style names are the "core" styles for this page load
- * Core means the main phpBB template files
- * @return phpbb_template $this
+ * @param array $style_directories The directories to add style paths for
+ * E.g. array('ext/foo/bar/styles', 'styles')
+ * Default: array('styles') (phpBB's style directory)
+ * @return \phpbb\template\template $this
*/
- public function set_style_names(array $style_names, array $style_paths, $is_core = false)
+ public function set_style($style_directories = array('styles'))
{
- $this->style_names = $style_names;
+ if ($style_directories !== array('styles') && $this->twig->getLoader()->getPaths('core') === array())
+ {
+ // We should set up the core styles path since not already setup
+ $this->set_style();
+ }
- // Set as __main__ namespace
- $this->twig->getLoader()->setPaths($style_paths);
+ $names = $this->get_user_style();
- // Core style namespace from phpbb_style::set_style()
- if ($is_core)
+ $paths = array();
+ foreach ($style_directories as $directory)
{
- $this->twig->getLoader()->setPaths($style_paths, 'core');
+ foreach ($names as $name)
+ {
+ $path = $this->phpbb_root_path . trim($directory, '/') . "/{$name}/";
+ $template_path = $path . 'template/';
+
+ if (is_dir($template_path))
+ {
+ // Add the base style directory as a safe directory
+ $this->twig->getLoader()->addSafeDirectory($path);
+
+ $paths[] = $template_path;
+ }
+ }
}
- // Add admin namespace
- if (is_dir($this->phpbb_root_path . $this->adm_relative_path . 'style/'))
+ // If we're setting up the main phpBB styles directory and the core
+ // namespace isn't setup yet, we will set it up now
+ if ($style_directories === array('styles') && $this->twig->getLoader()->getPaths('core') === array())
{
- $this->twig->getLoader()->setPaths($this->phpbb_root_path . $this->adm_relative_path . 'style/', 'admin');
+ // Set up the core style paths namespace
+ $this->twig->getLoader()->setPaths($paths, 'core');
}
+ $this->set_custom_style($names, $paths);
+
+ return $this;
+ }
+
+ /**
+ * Set custom style location (able to use directory outside of phpBB).
+ *
+ * Note: Templates are still compiled to phpBB's cache directory.
+ *
+ * @param string|array $names Array of names or string of name of template(s) in inheritance tree order, used by extensions.
+ * @param string|array or string $paths Array of style paths, relative to current root directory
+ * @return phpbb_template $this
+ */
+ public function set_custom_style($names, $paths)
+ {
+ $paths = (is_string($paths)) ? array($paths) : $paths;
+ $names = (is_string($names)) ? array($names) : $names;
+
+ // Set as __main__ namespace
+ $this->twig->getLoader()->setPaths($paths);
+
// Add all namespaces for all extensions
- if ($this->extension_manager instanceof phpbb_extension_manager)
+ if ($this->extension_manager instanceof \phpbb\extension\manager)
{
- $style_names[] = 'all';
+ $names[] = 'all';
foreach ($this->extension_manager->all_enabled() as $ext_namespace => $ext_path)
{
@@ -217,13 +242,17 @@ class phpbb_template_twig implements phpbb_template
$namespace = str_replace('/', '_', $ext_namespace);
$paths = array();
- foreach ($style_names as $style_name)
+ foreach ($names as $style_name)
{
- $ext_style_path = $ext_path . 'styles/' . $style_name . '/template';
+ $ext_style_path = $ext_path . 'styles/' . $style_name . '/';
+ $ext_style_template_path = $ext_style_path . 'template/';
- if (is_dir($ext_style_path))
+ if (is_dir($ext_style_template_path))
{
- $paths[] = $ext_style_path;
+ // Add the base style directory as a safe directory
+ $this->twig->getLoader()->addSafeDirectory($ext_style_path);
+
+ $paths[] = $ext_style_template_path;
}
}
@@ -235,31 +264,6 @@ class phpbb_template_twig implements phpbb_template
}
/**
- * Clears all variables and blocks assigned to this template.
- *
- * @return phpbb_template $this
- */
- public function destroy()
- {
- $this->context = array();
-
- return $this;
- }
-
- /**
- * Reset/empty complete block
- *
- * @param string $blockname Name of block to destroy
- * @return phpbb_template $this
- */
- public function destroy_block_vars($blockname)
- {
- $this->context->destroy_block_vars($blockname);
-
- return $this;
- }
-
- /**
* Display a template for provided handle.
*
* The template will be loaded and compiled, if necessary, first.
@@ -267,7 +271,7 @@ class phpbb_template_twig implements phpbb_template
* This function calls hooks.
*
* @param string $handle Handle to display
- * @return phpbb_template $this
+ * @return \phpbb\template\template $this
*/
public function display($handle)
{
@@ -283,35 +287,13 @@ class phpbb_template_twig implements phpbb_template
}
/**
- * Calls hook if any is defined.
- *
- * @param string $handle Template handle being displayed.
- * @param string $method Method name of the caller.
- */
- protected function call_hook($handle, $method)
- {
- global $phpbb_hook;
-
- if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, $method), $handle, $this))
- {
- if ($phpbb_hook->hook_return(array(__CLASS__, $method)))
- {
- $result = $phpbb_hook->hook_return_result(array(__CLASS__, $method));
- return array($result);
- }
- }
-
- return false;
- }
-
- /**
* Display the handle and assign the output to a template variable
* or return the compiled result.
*
* @param string $handle Handle to operate on
* @param string $template_var Template variable to assign compiled handle to
* @param bool $return_content If true return compiled handle, otherwise assign to $template_var
- * @return phpbb_template|string if $return_content is true return string of the compiled handle, otherwise return $this
+ * @return \phpbb\template\template|string if $return_content is true return string of the compiled handle, otherwise return $this
*/
public function assign_display($handle, $template_var = '', $return_content = true)
{
@@ -326,111 +308,18 @@ class phpbb_template_twig implements phpbb_template
}
/**
- * Assign key variable pairs from an array
- *
- * @param array $vararray A hash of variable name => value pairs
- * @return phpbb_template $this
- */
- public function assign_vars(array $vararray)
- {
- foreach ($vararray as $key => $val)
- {
- $this->assign_var($key, $val);
- }
-
- return $this;
- }
-
- /**
- * Assign a single scalar value to a single key.
- *
- * Value can be a string, an integer or a boolean.
- *
- * @param string $varname Variable name
- * @param string $varval Value to assign to variable
- * @return phpbb_template $this
- */
- public function assign_var($varname, $varval)
- {
- $this->context->assign_var($varname, $varval);
-
- return $this;
- }
-
- /**
- * Append text to the string value stored in a key.
- *
- * Text is appended using the string concatenation operator (.).
- *
- * @param string $varname Variable name
- * @param string $varval Value to append to variable
- * @return phpbb_template $this
- */
- public function append_var($varname, $varval)
- {
- $this->context->append_var($varname, $varval);
-
- return $this;
- }
-
- /**
- * Assign key variable pairs from an array to a specified block
- * @param string $blockname Name of block to assign $vararray to
- * @param array $vararray A hash of variable name => value pairs
- * @return phpbb_template $this
- */
- public function assign_block_vars($blockname, array $vararray)
- {
- $this->context->assign_block_vars($blockname, $vararray);
-
- return $this;
- }
-
- /**
- * Change already assigned key variable pair (one-dimensional - single loop entry)
- *
- * An example of how to use this function:
- * {@example alter_block_array.php}
- *
- * @param string $blockname the blockname, for example 'loop'
- * @param array $vararray the var array to insert/add or merge
- * @param mixed $key Key to search for
- *
- * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position]
- *
- * int: Position [the position to change or insert at directly given]
- *
- * If key is false the position is set to 0
- * If key is true the position is set to the last entry
- *
- * @param string $mode Mode to execute (valid modes are 'insert' and 'change')
- *
- * If insert, the vararray is inserted at the given position (position counting from zero).
- * If change, the current block gets merged with the vararray (resulting in new key/value pairs be added and existing keys be replaced by the new value).
- *
- * Since counting begins by zero, inserting at the last position will result in this array: array(vararray, last positioned array)
- * and inserting at position 1 will result in this array: array(first positioned array, vararray, following vars)
- *
- * @return bool false on error, true on success
- */
- public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert')
- {
- return $this->context->alter_block_array($blockname, $vararray, $key, $mode);
- }
-
- /**
* Get template vars in a format Twig will use (from the context)
*
* @return array
*/
- public function get_template_vars()
+ protected function get_template_vars()
{
$context_vars = $this->context->get_data_ref();
$vars = array_merge(
$context_vars['.'][0], // To get normal vars
array(
- 'definition' => new phpbb_template_twig_definition(),
+ 'definition' => new \phpbb\template\twig\definition(),
'user' => $this->user,
'loops' => $context_vars, // To get loops
)
@@ -443,17 +332,6 @@ class phpbb_template_twig implements phpbb_template
}
/**
- * Get a filename from the handle
- *
- * @param string $handle
- * @return string
- */
- protected function get_filename_from_handle($handle)
- {
- return (isset($this->filenames[$handle])) ? $this->filenames[$handle] : $handle;
- }
-
- /**
* Get path to template for handle (required for BBCode parser)
*
* @return string
diff --git a/phpBB/phpbb/tree/nestedset.php b/phpBB/phpbb/tree/nestedset.php
index 4d851a87a8..171dae4d14 100644
--- a/phpBB/phpbb/tree/nestedset.php
+++ b/phpBB/phpbb/tree/nestedset.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\tree;
+
/**
* @ignore
*/
@@ -15,12 +17,12 @@ if (!defined('IN_PHPBB'))
exit;
}
-abstract class phpbb_tree_nestedset implements phpbb_tree_interface
+abstract class nestedset implements \phpbb\tree\tree_interface
{
- /** @var phpbb_db_driver */
+ /** @var \phpbb\db\driver\driver */
protected $db;
- /** @var phpbb_lock_db */
+ /** @var \phpbb\lock\db */
protected $lock;
/** @var string */
@@ -58,15 +60,15 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_interface
/**
* Construct
*
- * @param phpbb_db_driver $db Database connection
- * @param phpbb_lock_db $lock Lock class used to lock the table when moving forums around
+ * @param \phpbb\db\driver\driver $db Database connection
+ * @param \phpbb\lock\db $lock Lock class used to lock the table when moving forums around
* @param string $table_name Table name
* @param string $message_prefix Prefix for the messages thrown by exceptions
* @param string $sql_where Additional SQL restrictions for the queries
* @param array $item_basic_data Array with basic item data that is stored in item_parents
* @param array $columns Array with column names to overwrite
*/
- public function __construct(phpbb_db_driver $db, phpbb_lock_db $lock, $table_name, $message_prefix = '', $sql_where = '', $item_basic_data = array(), $columns = array())
+ public function __construct(\phpbb\db\driver\driver $db, \phpbb\lock\db $lock, $table_name, $message_prefix = '', $sql_where = '', $item_basic_data = array(), $columns = array())
{
$this->db = $db;
$this->lock = $lock;
@@ -116,7 +118,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_interface
if (!$this->lock->acquire())
{
- throw new RuntimeException($this->message_prefix . 'LOCK_FAILED_ACQUIRE');
+ throw new \RuntimeException($this->message_prefix . 'LOCK_FAILED_ACQUIRE');
}
return true;
@@ -184,7 +186,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_interface
$item_id = (int) $item_id;
if (!$item_id)
{
- throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM');
+ throw new \OutOfBoundsException($this->message_prefix . 'INVALID_ITEM');
}
$items = $this->get_subtree_data($item_id);
@@ -192,7 +194,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_interface
if (empty($items) || !isset($items[$item_id]))
{
- throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM');
+ throw new \OutOfBoundsException($this->message_prefix . 'INVALID_ITEM');
}
$this->remove_subset($item_ids, $items[$item_id]);
@@ -242,7 +244,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_interface
if (!$item)
{
$this->lock->release();
- throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM');
+ throw new \OutOfBoundsException($this->message_prefix . 'INVALID_ITEM');
}
/**
@@ -364,7 +366,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_interface
if (!$current_parent_id)
{
- throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM');
+ throw new \OutOfBoundsException($this->message_prefix . 'INVALID_ITEM');
}
$this->acquire_lock();
@@ -373,7 +375,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_interface
if (!isset($item_data[$current_parent_id]))
{
$this->lock->release();
- throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM');
+ throw new \OutOfBoundsException($this->message_prefix . 'INVALID_ITEM');
}
$current_parent = $item_data[$current_parent_id];
@@ -389,7 +391,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_interface
if (in_array($new_parent_id, $move_items))
{
$this->lock->release();
- throw new OutOfBoundsException($this->message_prefix . 'INVALID_PARENT');
+ throw new \OutOfBoundsException($this->message_prefix . 'INVALID_PARENT');
}
$diff = sizeof($move_items) * 2;
@@ -413,7 +415,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_interface
{
$this->db->sql_transaction('rollback');
$this->lock->release();
- throw new OutOfBoundsException($this->message_prefix . 'INVALID_PARENT');
+ throw new \OutOfBoundsException($this->message_prefix . 'INVALID_PARENT');
}
$new_right_id = $this->prepare_adding_subset($move_items, $new_parent, true);
@@ -470,7 +472,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_interface
if (!$item_id)
{
- throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM');
+ throw new \OutOfBoundsException($this->message_prefix . 'INVALID_ITEM');
}
$this->acquire_lock();
@@ -479,7 +481,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_interface
if (!isset($item_data[$item_id]))
{
$this->lock->release();
- throw new OutOfBoundsException($this->message_prefix . 'INVALID_ITEM');
+ throw new \OutOfBoundsException($this->message_prefix . 'INVALID_ITEM');
}
$item = $item_data[$item_id];
@@ -488,7 +490,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_interface
if (in_array($new_parent_id, $move_items))
{
$this->lock->release();
- throw new OutOfBoundsException($this->message_prefix . 'INVALID_PARENT');
+ throw new \OutOfBoundsException($this->message_prefix . 'INVALID_PARENT');
}
$diff = sizeof($move_items) * 2;
@@ -512,7 +514,7 @@ abstract class phpbb_tree_nestedset implements phpbb_tree_interface
{
$this->db->sql_transaction('rollback');
$this->lock->release();
- throw new OutOfBoundsException($this->message_prefix . 'INVALID_PARENT');
+ throw new \OutOfBoundsException($this->message_prefix . 'INVALID_PARENT');
}
$new_right_id = $this->prepare_adding_subset($move_items, $new_parent, true);
diff --git a/phpBB/phpbb/tree/nestedset_forum.php b/phpBB/phpbb/tree/nestedset_forum.php
index ff09ef55d0..2fee5b097e 100644
--- a/phpBB/phpbb/tree/nestedset_forum.php
+++ b/phpBB/phpbb/tree/nestedset_forum.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\tree;
+
/**
* @ignore
*/
@@ -15,16 +17,16 @@ if (!defined('IN_PHPBB'))
exit;
}
-class phpbb_tree_nestedset_forum extends phpbb_tree_nestedset
+class nestedset_forum extends \phpbb\tree\nestedset
{
/**
* Construct
*
- * @param phpbb_db_driver $db Database connection
- * @param phpbb_lock_db $lock Lock class used to lock the table when moving forums around
+ * @param \phpbb\db\driver\driver $db Database connection
+ * @param \phpbb\lock\db $lock Lock class used to lock the table when moving forums around
* @param string $table_name Table name
*/
- public function __construct(phpbb_db_driver $db, phpbb_lock_db $lock, $table_name)
+ public function __construct(\phpbb\db\driver\driver $db, \phpbb\lock\db $lock, $table_name)
{
parent::__construct(
$db,
diff --git a/phpBB/phpbb/tree/interface.php b/phpBB/phpbb/tree/tree_interface.php
index cc8aab2115..162c1e5e29 100644
--- a/phpBB/phpbb/tree/interface.php
+++ b/phpBB/phpbb/tree/tree_interface.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\tree;
+
/**
* @ignore
*/
@@ -15,7 +17,7 @@ if (!defined('IN_PHPBB'))
exit;
}
-interface phpbb_tree_interface
+interface tree_interface
{
/**
* Inserts an item into the database table and into the tree.
@@ -79,7 +81,7 @@ interface phpbb_tree_interface
/**
* Change parent item
*
- * Moves the item to the bottom of the new parent's list of children
+ * Moves the item to the bottom of the new \parent's list of children
*
* @param int $item_id The item to be moved
* @param int $new_parent_id The new parent item
diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php
index 656c17aadd..f97cc94d40 100644
--- a/phpBB/phpbb/user.php
+++ b/phpBB/phpbb/user.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb;
+
/**
* @ignore
*/
@@ -23,7 +25,7 @@ if (!defined('IN_PHPBB'))
*
* @package phpBB3
*/
-class phpbb_user extends phpbb_session
+class user extends \phpbb\session
{
var $lang = array();
var $help = array();
@@ -75,7 +77,7 @@ class phpbb_user extends phpbb_session
*/
function setup($lang_set = false, $style_id = false)
{
- global $db, $phpbb_style, $template, $config, $auth, $phpEx, $phpbb_root_path, $cache;
+ global $db, $template, $config, $auth, $phpEx, $phpbb_root_path, $cache;
global $phpbb_dispatcher;
if ($this->data['user_id'] != ANONYMOUS)
@@ -160,12 +162,12 @@ class phpbb_user extends phpbb_session
try
{
- $this->timezone = new DateTimeZone($user_timezone);
+ $this->timezone = new \DateTimeZone($user_timezone);
}
- catch (Exception $e)
+ catch (\Exception $e)
{
// If the timezone the user has selected is invalid, we fall back to UTC.
- $this->timezone = new DateTimeZone('UTC');
+ $this->timezone = new \DateTimeZone('UTC');
}
// We include common language file here to not load it every time a custom language file is included
@@ -251,7 +253,7 @@ class phpbb_user extends phpbb_session
}
}
- $phpbb_style->set_style();
+ $template->set_style();
$this->img_lang = $this->lang_name;
@@ -671,27 +673,27 @@ class phpbb_user extends phpbb_session
if (!isset($utc))
{
- $utc = new DateTimeZone('UTC');
+ $utc = new \DateTimeZone('UTC');
}
- $time = new phpbb_datetime($this, "@$gmepoch", $utc);
+ $time = new \phpbb\datetime($this, "@$gmepoch", $utc);
$time->setTimezone($this->timezone);
return $time->format($format, $forcedate);
}
/**
- * Create a phpbb_datetime object in the context of the current user
+ * Create a \phpbb\datetime object in the context of the current user
*
* @since 3.1
* @param string $time String in a format accepted by strtotime().
* @param DateTimeZone $timezone Time zone of the time.
- * @return phpbb_datetime Date time object linked to the current users locale
+ * @return \phpbb\datetime Date time object linked to the current users locale
*/
- public function create_datetime($time = 'now', DateTimeZone $timezone = null)
+ public function create_datetime($time = 'now', \DateTimeZone $timezone = null)
{
$timezone = $timezone ?: $this->timezone;
- return new phpbb_datetime($this, $time, $timezone);
+ return new \phpbb\datetime($this, $time, $timezone);
}
/**
@@ -702,10 +704,10 @@ class phpbb_user extends phpbb_session
* @param DateTimeZone $timezone Timezone of the date/time, falls back to timezone of current user
* @return int Returns the unix timestamp
*/
- public function get_timestamp_from_format($format, $time, DateTimeZone $timezone = null)
+ public function get_timestamp_from_format($format, $time, \DateTimeZone $timezone = null)
{
$timezone = $timezone ?: $this->timezone;
- $date = DateTime::createFromFormat($format, $time, $timezone);
+ $date = \DateTime::createFromFormat($format, $time, $timezone);
return ($date !== false) ? $date->format('U') : false;
}
diff --git a/phpBB/phpbb/user_loader.php b/phpBB/phpbb/user_loader.php
index 37bf9648c1..78620ab1b9 100644
--- a/phpBB/phpbb/user_loader.php
+++ b/phpBB/phpbb/user_loader.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb;
+
/**
*/
if (!defined('IN_PHPBB'))
@@ -22,9 +24,9 @@ if (!defined('IN_PHPBB'))
* have to query the same user multiple times in
* different services.
*/
-class phpbb_user_loader
+class user_loader
{
- /** @var phpbb_db_driver */
+ /** @var \phpbb\db\driver\driver */
protected $db = null;
/** @var string */
@@ -46,12 +48,12 @@ class phpbb_user_loader
/**
* User loader constructor
*
- * @param phpbb_db_driver $db A database connection
+ * @param \phpbb\db\driver\driver $db A database connection
* @param string $phpbb_root_path Path to the phpbb includes directory.
* @param string $php_ext php file extension
* @param string $users_table The name of the database table (phpbb_users)
*/
- public function __construct(phpbb_db_driver $db, $phpbb_root_path, $php_ext, $users_table)
+ public function __construct(\phpbb\db\driver\driver $db, $phpbb_root_path, $php_ext, $users_table)
{
$this->db = $db;
diff --git a/phpBB/posting.php b/phpBB/posting.php
index ac459197b3..1609382551 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -697,7 +697,7 @@ if ($submit || $preview || $refresh)
$message_parser->message = utf8_normalize_nfc(request_var('message', '', true));
$post_data['username'] = utf8_normalize_nfc(request_var('username', $post_data['username'], true));
- $post_data['post_edit_reason'] = ($request->variable('edit_reason', false, false, phpbb_request_interface::POST) && $mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? utf8_normalize_nfc(request_var('edit_reason', '', true)) : '';
+ $post_data['post_edit_reason'] = ($request->variable('edit_reason', false, false, \phpbb\request\request_interface::POST) && $mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? utf8_normalize_nfc(request_var('edit_reason', '', true)) : '';
$post_data['orig_topic_type'] = $post_data['topic_type'];
$post_data['topic_type'] = request_var('topic_type', (($mode != 'post') ? (int) $post_data['topic_type'] : POST_NORMAL));
@@ -1152,8 +1152,14 @@ if ($submit || $preview || $refresh)
$data['topic_posts_softdeleted'] = $post_data['topic_posts_softdeleted'];
}
+ // Only return the username when it is either a guest posting or we are editing a post and
+ // the username was supplied; otherwise post_data might hold the data of the post that is
+ // being quoted (which could result in the username being returned being that of the quoted
+ // post's poster, not the poster of the current post). See: PHPBB3-11769 for more information.
+ $post_author_name = ((!$user->data['is_registered'] || $mode == 'edit') && $post_data['username'] !== '') ? $post_data['username'] : '';
+
// The last parameter tells submit_post if search indexer has to be run
- $redirect_url = submit_post($mode, $post_data['post_subject'], $post_data['username'], $post_data['topic_type'], $poll, $data, $update_message, ($update_message || $update_subject) ? true : false);
+ $redirect_url = submit_post($mode, $post_data['post_subject'], $post_author_name, $post_data['topic_type'], $poll, $data, $update_message, ($update_message || $update_subject) ? true : false);
if ($config['enable_post_confirm'] && !$user->data['is_registered'] && (isset($captcha) && $captcha->is_solved() === true) && ($mode == 'post' || $mode == 'reply' || $mode == 'quote'))
{
diff --git a/phpBB/search.php b/phpBB/search.php
index 40c0b9a8ce..ae573b18e8 100644
--- a/phpBB/search.php
+++ b/phpBB/search.php
@@ -683,7 +683,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
if ($config['load_anon_lastread'] || ($user->data['is_registered'] && !$config['load_db_lastread']))
{
- $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();
}
@@ -964,14 +964,8 @@ if ($keywords || $author || $author_id || $search_id || $submit)
}
else
{
- // Second parse bbcode here
- if ($row['bbcode_bitfield'])
- {
- $bbcode->bbcode_second_pass($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield']);
- }
-
- $row['post_text'] = bbcode_nl2br($row['post_text']);
- $row['post_text'] = smiley_text($row['post_text']);
+ $parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
+ $row['post_text'] = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, false);
if (!empty($attachments[$row['post_id']]))
{
diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js
index eccb12e827..800fadd972 100644
--- a/phpBB/styles/prosilver/template/forum_fn.js
+++ b/phpBB/styles/prosilver/template/forum_fn.js
@@ -25,14 +25,29 @@ function popup(url, width, height, name) {
/**
* Jump to page
*/
-function jumpto() {
- var page = prompt(jump_page, on_page);
+function jumpto(item) {
+ if (!item || !item.length) {
+ item = $('a.pagination-trigger[data-lang-jump-page]');
+ if (!item.length) {
+ return;
+ }
+ }
+
+ var jump_page = item.attr('data-lang-jump-page'),
+ on_page = item.attr('data-on-page'),
+ per_page = item.attr('data-per-page'),
+ base_url = item.attr('data-base-url'),
+ page = prompt(jump_page, on_page);
if (page !== null && !isNaN(page) && page == Math.floor(page) && page > 0) {
- if (base_url.indexOf('?') === -1) {
- document.location.href = base_url + '?start=' + ((page - 1) * per_page);
+ if (base_url.indexOf('%d') === -1) {
+ if (base_url.indexOf('?') === -1) {
+ document.location.href = base_url + '?start=' + ((page - 1) * per_page);
+ } else {
+ document.location.href = base_url.replace(/&amp;/g, '&') + '&start=' + ((page - 1) * per_page);
+ }
} else {
- document.location.href = base_url.replace(/&amp;/g, '&') + '&start=' + ((page - 1) * per_page);
+ document.location.href = base_url.replace('%d', page);
}
}
}
@@ -42,19 +57,12 @@ function jumpto() {
* id = ID of parent container, name = name prefix, state = state [true/false]
*/
function marklist(id, name, state) {
- var parent = document.getElementById(id) || document[id];
-
- if (!parent) {
- return;
- }
-
- var rb = parent.getElementsByTagName('input');
-
- for (var r = 0; r < rb.length; r++) {
- if (rb[r].name.substr(0, name.length) === name) {
- rb[r].checked = state;
+ jQuery('#' + id + ' input[type=checkbox][name]').each(function() {
+ var $this = jQuery(this);
+ if ($this.attr('name').substr(0, name.length) == name) {
+ $this.prop('checked', state);
}
- }
+ });
}
/**
@@ -124,29 +132,15 @@ jQuery(document).ready(function() {
}
function subPanels(p) {
- var i, e, t;
+ var i;
if (typeof(p) === 'string') {
show_panel = p;
}
for (i = 0; i < panels.length; i++) {
- e = document.getElementById(panels[i]);
- t = document.getElementById(panels[i] + '-tab');
-
- if (e) {
- if (panels[i] === show_panel) {
- e.style.display = 'block';
- if (t) {
- t.className = 'activetab';
- }
- } else {
- e.style.display = 'none';
- if (t) {
- t.className = '';
- }
- }
- }
+ jQuery('#' + panels[i]).css('display', panels[i] === show_panel ? 'block' : 'none');
+ jQuery('#' + panels[i] + '-tab').toggleClass('activetab', panels[i] === show_panel);
}
}
});
@@ -255,57 +249,6 @@ function play_qt_file(obj) {
obj.Play();
}
-/**
-* Check if the nodeName of elem is name
-* @author jQuery
-*/
-function is_node_name(elem, name) {
- return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
-}
-
-/**
-* Check if elem is in array, return position
-* @author jQuery
-*/
-function is_in_array(elem, array) {
- for (var i = 0, length = array.length; i < length; i++) {
- // === is correct (IE)
- if (array[i] === elem) {
- return i;
- }
- }
-
- return -1;
-}
-
-/**
-* Find Element, type and class in tree
-* Not used, but may come in handy for those not using JQuery
-* @author jQuery.find, Meik Sievertsen
-*/
-function find_in_tree(node, tag, type, class_name) {
- var result, element, i = 0, length = node.childNodes.length;
-
- for (element = node.childNodes[0]; i < length; element = node.childNodes[++i]) {
- if (!element || element.nodeType !== 1) {
- continue;
- }
-
- if ((!tag || is_node_name(element, tag)) && (!type || element.type === type)
- && (!class_name || is_in_array(class_name, (element.className || element).toString().split(/\s+/)) > -1)) {
- return element;
- }
-
- if (element.childNodes.length) {
- result = find_in_tree(element, tag, type, class_name);
- }
-
- if (result) {
- return result;
- }
- }
-}
-
var in_autocomplete = false;
var last_key_entered = '';
@@ -337,50 +280,7 @@ function phpbb_check_key(event) {
}
/**
-* Usually used for onkeypress event, to submit a form on enter
-*/
-function submit_default_button(event, selector, class_name) {
- // Add which for key events
- if (!event.which && ((event.charCode || event.charCode === 0) ? event.charCode : event.keyCode)) {
- event.which = event.charCode || event.keyCode;
- }
-
- if (phpbb_check_key(event)) {
- return true;
- }
-
- var current = selector.parentNode;
-
- // Search parent form element
- while (current && (!current.nodeName || current.nodeType !== 1 || !is_node_name(current, 'form')) && current !== document) {
- current = current.parentNode;
- }
-
- // Find the input submit button with the class name
- //current = find_in_tree(current, 'input', 'submit', class_name);
- var input_tags = current.getElementsByTagName('input');
- current = false;
-
- for (var i = 0, element = input_tags[0]; i < input_tags.length; element = input_tags[++i]) {
- if (element.type === 'submit' && is_in_array(class_name, (element.className || element).toString().split(/\s+/)) > -1) {
- current = element;
- }
- }
-
- if (!current) {
- return true;
- }
-
- // Submit form
- current.focus();
- current.click();
- return false;
-}
-
-/**
* Apply onkeypress event for forcing default submit button on ENTER key press
-* The jQuery snippet used is based on http://greatwebguy.com/programming/dom/default-html-button-submit-on-enter-with-jquery/
-* The non-jQuery code is a mimick of the jQuery code ;)
*/
function apply_onkeypress_event() {
jQuery('form input[type=text], form input[type=password]').on('keypress', function (e) {
@@ -406,20 +306,137 @@ function apply_onkeypress_event() {
jQuery(document).ready(apply_onkeypress_event);
/**
-* Adjust HTML code for IE8 and older versions
+* Run MSN action
+*/
+function msn_action(action, address)
+{
+ // Does the browser support the MSNM object?
+ var app = document.getElementById('objMessengerApp');
+
+ if (!app || !app.MyStatus) {
+ var lang = $('form[data-lang-im-msnm-browser]');
+ if (lang.length) {
+ alert(lang.attr('data-lang-im-msnm-browser'));
+ }
+ return false;
+ }
+
+ // Is MSNM connected?
+ if (app.MyStatus == 1) {
+ var lang = $('form[data-lang-im-msnm-connect]');
+ if (lang.length) {
+ alert(lang.attr('data-lang-im-msnm-connect'));
+ }
+ return false;
+ }
+
+ // Do stuff
+ try {
+ switch (action) {
+ case 'add':
+ app.AddContact(0, address);
+ break;
+
+ case 'im':
+ app.InstantMessage(address);
+ break;
+ }
+ }
+ catch (e) {
+ return;
+ }
+}
+
+/**
+* Add to your contact list
+*/
+function add_contact(address)
+{
+ msn_action('add', address);
+}
+
+/**
+* Write IM to contact
+*/
+function im_contact(address)
+{
+ msn_action('im', address);
+}
+
+/**
+* Functions for user search popup
+*/
+function insert_user(formId, value)
+{
+ var form = jQuery(formId),
+ formName = form.attr('data-form-name'),
+ fieldName = form.attr('data-field-name'),
+ item = opener.document.forms[formName][fieldName];
+
+ if (item.value.length && item.type == 'textarea') {
+ value = item.value + "\n" + value;
+ }
+
+ item.value = value;
+}
+
+function insert_marked_users(formId, users)
+{
+ if (typeof(users.length) == "undefined")
+ {
+ if (users.checked)
+ {
+ insert_user(formId, users.value);
+ }
+ }
+ else if (users.length > 0)
+ {
+ for (i = 0; i < users.length; i++)
+ {
+ if (users[i].checked)
+ {
+ insert_user(formId, users[i].value);
+ }
+ }
+ }
+
+ self.close();
+}
+
+function insert_single_user(formId, user)
+{
+ insert_user(formId, user);
+ self.close();
+}
+
+/**
+* Run onload functions
*/
(function($) {
$(document).ready(function() {
+ // Focus forms
+ $('form[data-focus]:first').each(function() {
+ $('#' + this.getAttribute('data-focus')).focus();
+ });
+
+ // Reset avatar dimensions when changing URL or EMAIL
+ $('input[data-reset-on-edit]').bind('keyup', function() {
+ $(this.getAttribute('data-reset-on-edit')).val('');
+ });
+
+ // Pagination
+ $('a.pagination-trigger').click(function() {
+ jumpto($(this));
+ });
+
+ // Adjust HTML code for IE8 and older versions
var test = document.createElement('div'),
oldBrowser = (typeof test.style.borderRadius == 'undefined');
delete test;
- if (!oldBrowser) {
- return;
+ if (oldBrowser) {
+ // Fix .linkslist.bulletin lists
+ $('ul.linklist.bulletin li:first-child, ul.linklist.bulletin li.rightside:last-child').addClass('no-bulletin');
}
-
- // Fix .linkslist.bulletin lists
- $('ul.linklist.bulletin li:first-child, ul.linklist.bulletin li.rightside:last-child').addClass('no-bulletin');
});
})(jQuery);
-
diff --git a/phpBB/styles/prosilver/template/jumpbox.html b/phpBB/styles/prosilver/template/jumpbox.html
index dd793fbadc..201b2dece2 100644
--- a/phpBB/styles/prosilver/template/jumpbox.html
+++ b/phpBB/styles/prosilver/template/jumpbox.html
@@ -1,12 +1,12 @@
<!-- IF S_VIEWTOPIC -->
- <p></p><p><a href="{U_VIEW_FORUM}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" accesskey="r">{L_RETURN_TO} {FORUM_NAME}</a></p>
+ <p class="jumpbox-return"><a href="{U_VIEW_FORUM}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" accesskey="r">{L_RETURN_TO} {FORUM_NAME}</a></p>
<!-- ELSEIF S_VIEWFORUM -->
- <p></p><p><a href="{U_INDEX}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" accesskey="r">{L_RETURN_TO} {L_INDEX}</a></p>
+ <p class="jumpbox-return"><a href="{U_INDEX}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" accesskey="r">{L_RETURN_TO} {L_INDEX}</a></p>
<!-- ELSEIF SEARCH_TOPIC -->
- <p></p><p><a class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH_TOPIC}" accesskey="r">{L_RETURN_TO}{L_COLON} {SEARCH_TOPIC}</a></p>
+ <p class="jumpbox-return"><a class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH_TOPIC}" accesskey="r">{L_RETURN_TO}{L_COLON} {SEARCH_TOPIC}</a></p>
<!-- ELSEIF S_SEARCH_ACTION -->
- <p></p><p><a class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH}" title="{L_SEARCH_ADV}" accesskey="r">{L_RETURN_TO_SEARCH_ADV}</a></p>
+ <p class="jumpbox-return"><a class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH}" title="{L_SEARCH_ADV}" accesskey="r">{L_RETURN_TO_SEARCH_ADV}</a></p>
<!-- ENDIF -->
<!-- IF S_DISPLAY_JUMPBOX -->
diff --git a/phpBB/styles/prosilver/template/login_body.html b/phpBB/styles/prosilver/template/login_body.html
index 89ef8acd6f..38d9f8c68b 100644
--- a/phpBB/styles/prosilver/template/login_body.html
+++ b/phpBB/styles/prosilver/template/login_body.html
@@ -1,14 +1,6 @@
<!-- INCLUDE overall_header.html -->
-<script type="text/javascript">
-// <![CDATA[
- onload_functions.push(function () {
- document.getElementById("<!-- IF S_ADMIN_AUTH -->{PASSWORD_CREDENTIAL}<!-- ELSE -->{USERNAME_CREDENTIAL}<!-- ENDIF -->").focus();
- });
-// ]]>
-</script>
-
-<form action="{S_LOGIN_ACTION}" method="post" id="login">
+<form action="{S_LOGIN_ACTION}" method="post" id="login" data-focus="<!-- IF S_ADMIN_AUTH -->{PASSWORD_CREDENTIAL}<!-- ELSE -->{USERNAME_CREDENTIAL}<!-- ENDIF -->">
<div class="panel">
<div class="inner">
@@ -47,6 +39,10 @@
</dl>
</fieldset>
</div>
+
+ <!-- IF not S_ADMIN_AUTH and PROVIDER_TEMPLATE_FILE -->
+ <!-- INCLUDE {PROVIDER_TEMPLATE_FILE} -->
+ <!-- ENDIF -->
</div>
</div>
diff --git a/phpBB/styles/prosilver/template/login_body_oauth.html b/phpBB/styles/prosilver/template/login_body_oauth.html
new file mode 100644
index 0000000000..156485d211
--- /dev/null
+++ b/phpBB/styles/prosilver/template/login_body_oauth.html
@@ -0,0 +1,8 @@
+<div class="content">
+ <!-- BEGIN oauth -->
+ <dl>
+ <dt>&nbsp;</dt>
+ <dd><a href="{oauth.REDIRECT_URL}" class="button2">{oauth.SERVICE_NAME}</a></dd>
+ </dl>
+ <!-- END oauth -->
+</div>
diff --git a/phpBB/styles/prosilver/template/mcp_notes_user.html b/phpBB/styles/prosilver/template/mcp_notes_user.html
index 1738e45045..eb954fd11d 100644
--- a/phpBB/styles/prosilver/template/mcp_notes_user.html
+++ b/phpBB/styles/prosilver/template/mcp_notes_user.html
@@ -88,7 +88,7 @@
<tr>
<td class="bg1" colspan="<!-- IF S_CLEAR_ALLOWED -->5<!-- ELSE -->4<!-- ENDIF -->" align="center"><span class="gen">{L_NO_ENTRIES}</span></td>
</tr>
- <!-- END usernames -->
+ <!-- END usernotes -->
</tbody>
</table>
diff --git a/phpBB/styles/prosilver/template/mcp_post.html b/phpBB/styles/prosilver/template/mcp_post.html
index 4cdd62957c..a205164e60 100644
--- a/phpBB/styles/prosilver/template/mcp_post.html
+++ b/phpBB/styles/prosilver/template/mcp_post.html
@@ -13,8 +13,8 @@
<div class="postbody">
<h3>{L_REPORT_REASON}{L_COLON} {REPORT_REASON_TITLE}</h3>
<p class="author">{L_REPORTED} {L_POST_BY_AUTHOR} {REPORTER_FULL} &laquo; {REPORT_DATE}</p>
- <!-- IF not S_POST_REPORTED -->
- <p class="rules">{L_REPORT_CLOSED}</p>
+ <!-- IF S_REPORT_CLOSED -->
+ <p class="post-notice reported">{L_REPORT_CLOSED}</p>
<!-- ENDIF -->
<div class="content">
<!-- IF REPORT_TEXT -->
@@ -31,7 +31,7 @@
<form method="post" id="mcp_report" action="{S_CLOSE_ACTION}">
<fieldset class="submit-buttons">
- <!-- IF S_POST_REPORTED -->
+ <!-- IF not S_REPORT_CLOSED -->
<input class="button1" type="submit" value="{L_CLOSE_REPORT}" name="action[close]" /> &nbsp;
<!-- ENDIF -->
<input class="button2" type="submit" value="{L_DELETE_REPORT}" name="action[delete]" />
@@ -71,7 +71,7 @@
<!-- IF S_POST_UNAPPROVED -->
<form method="post" id="mcp_approve" action="{U_APPROVE_ACTION}">
- <p class="rules">
+ <p class="post-notice unapproved">
<input class="button2" type="submit" value="{L_DISAPPROVE}" name="action[disapprove]" /> &nbsp;
<input class="button1" type="submit" value="{L_APPROVE}" name="action[approve]" />
<!-- IF not S_FIRST_POST --><input type="hidden" name="mode" value="unapproved_posts" /><!-- ENDIF -->
@@ -82,7 +82,7 @@
<!-- ELSEIF S_POST_DELETED -->
<form method="post" id="mcp_approve" action="{U_APPROVE_ACTION}">
- <p class="rules">
+ <p class="post-notice deleted">
<input class="button2" type="submit" value="{L_DELETE}" name="action[disapprove]" /> &nbsp;
<input class="button1" type="submit" value="{L_RESTORE}" name="action[restore]" />
<!-- IF not S_FIRST_POST --><input type="hidden" name="mode" value="unapproved_posts" /><!-- ENDIF -->
@@ -93,7 +93,7 @@
<!-- ENDIF -->
<!-- IF S_MESSAGE_REPORTED -->
- <p class="rules">
+ <p class="post-notice reported">
{REPORTED_IMG} <a href="{U_MCP_REPORT}"><strong>{L_MESSAGE_REPORTED}</strong></a>
</p>
<!-- ENDIF -->
diff --git a/phpBB/styles/prosilver/template/mcp_topic.html b/phpBB/styles/prosilver/template/mcp_topic.html
index 0fd5a9455f..bfe18579a6 100644
--- a/phpBB/styles/prosilver/template/mcp_topic.html
+++ b/phpBB/styles/prosilver/template/mcp_topic.html
@@ -101,11 +101,21 @@
<h3><a href="{postrow.U_POST_DETAILS}">{postrow.POST_SUBJECT}</a></h3>
<p class="author"><a href="#pr{postrow.POST_ID}">{postrow.MINI_POST_IMG}</a> {L_POSTED} {postrow.POST_DATE} {L_POST_BY_AUTHOR} <strong>{postrow.POST_AUTHOR_FULL}</strong><!-- IF postrow.U_MCP_DETAILS --> [ <a href="{postrow.U_MCP_DETAILS}">{L_POST_DETAILS}</a> ]<!-- ENDIF --></p>
- <!-- IF postrow.S_POST_UNAPPROVED or postrow.S_POST_DELETED or postrow.S_POST_REPORTED -->
- <p class="rules">
- <!-- IF postrow.S_POST_UNAPPROVED -->{UNAPPROVED_IMG} <a href="{postrow.U_MCP_APPROVE}"><strong>{L_POST_UNAPPROVED}</strong></a><br /><!-- ENDIF -->
- <!-- IF postrow.S_POST_DELETED -->{DELETED_IMG} <a href="{postrow.U_MCP_APPROVE}"><strong>{L_POST_DELETED}</strong></a><br /><!-- ENDIF -->
- <!-- IF postrow.S_POST_REPORTED -->{REPORTED_IMG} <a href="{postrow.U_MCP_REPORT}"><strong>{L_POST_REPORTED}</strong></a><!-- ENDIF -->
+ <!-- IF postrow.S_POST_UNAPPROVED -->
+ <p class="post-notice unapproved">
+ <a href="{postrow.U_MCP_APPROVE}"><strong>{L_POST_UNAPPROVED}</strong></a>
+ </p>
+ <!-- ENDIF -->
+
+ <!-- IF postrow.S_POST_DELETED -->
+ <p class="post-notice deleted">
+ <a href="{postrow.U_MCP_APPROVE}"><strong>{L_POST_DELETED}</strong></a>
+ </p>
+ <!-- ENDIF -->
+
+ <!-- IF postrow.S_POST_REPORTED -->
+ <p class="post-notice reported">
+ <a href="{postrow.U_MCP_REPORT}"><strong>{L_POST_REPORTED}</strong></a>
</p>
<!-- ENDIF -->
diff --git a/phpBB/styles/prosilver/template/memberlist_body.html b/phpBB/styles/prosilver/template/memberlist_body.html
index 459c3f6bc6..46b35eae2c 100644
--- a/phpBB/styles/prosilver/template/memberlist_body.html
+++ b/phpBB/styles/prosilver/template/memberlist_body.html
@@ -1,7 +1,7 @@
<!-- IF S_IN_SEARCH_POPUP -->
<!-- INCLUDE simple_header.html -->
<!-- INCLUDE memberlist_search.html -->
- <form method="post" id="results" action="{S_MODE_ACTION}" onsubmit="insert_marked(this.user); return false">
+ <form method="post" id="results" action="{S_MODE_ACTION}" onsubmit="insert_marked_users('#results', this.user); return false;" data-form-name="{S_FORM_NAME}" data-field-name="{S_FIELD_NAME}">
<!-- ELSE -->
<!-- INCLUDE overall_header.html -->
@@ -109,7 +109,7 @@
<!-- ENDIF -->
<tr class="<!-- IF memberrow.S_ROW_COUNT is even -->bg1<!-- ELSE -->bg2<!-- ENDIF -->">
- <td><!-- IF memberrow.RANK_IMG --><span class="rank-img">{memberrow.RANK_IMG}</span><!-- ELSE --><span class="rank-img">{memberrow.RANK_TITLE}</span><!-- ENDIF --><!-- IF S_IN_SEARCH_POPUP and not S_SELECT_SINGLE --><input type="checkbox" name="user" value="{memberrow.USERNAME}" /> <!-- ENDIF --><!-- EVENT memberlist_body_username_prepend -->{memberrow.USERNAME_FULL}<!-- EVENT memberlist_body_username_append --><!-- IF S_SELECT_SINGLE --><br />[&nbsp;<a href="#" onclick="insert_single('{memberrow.A_USERNAME}'); return false;">{L_SELECT}</a>&nbsp;]<!-- ENDIF --></td>
+ <td><!-- IF memberrow.RANK_IMG --><span class="rank-img">{memberrow.RANK_IMG}</span><!-- ELSE --><span class="rank-img">{memberrow.RANK_TITLE}</span><!-- ENDIF --><!-- IF S_IN_SEARCH_POPUP and not S_SELECT_SINGLE --><input type="checkbox" name="user" value="{memberrow.USERNAME}" /> <!-- ENDIF --><!-- EVENT memberlist_body_username_prepend -->{memberrow.USERNAME_FULL}<!-- EVENT memberlist_body_username_append --><!-- IF S_IN_SEARCH_POPUP --><br />[&nbsp;<a href="#" onclick="insert_single_user('#results', '{memberrow.A_USERNAME}'); return false;">{L_SELECT}</a>&nbsp;]<!-- ENDIF --></td>
<td class="posts"><!-- IF memberrow.POSTS and S_DISPLAY_SEARCH --><a href="{memberrow.U_SEARCH_USER}" title="{L_SEARCH_USER_POSTS}">{memberrow.POSTS}</a><!-- ELSE -->{memberrow.POSTS}<!-- ENDIF --></td>
<td class="info"><!-- IF memberrow.U_WWW or memberrow.LOCATION --><!-- IF memberrow.U_WWW --><div><a href="{memberrow.U_WWW}" title="{L_VISIT_WEBSITE}{L_COLON} {memberrow.U_WWW}">{memberrow.U_SHORT_WWW}</a></div><!-- ENDIF --><!-- IF memberrow.LOCATION --><div>{memberrow.LOCATION}</div><!-- ENDIF --><!-- ELSE -->&nbsp;<!-- ENDIF --></td>
<td>{memberrow.JOINED}</td>
diff --git a/phpBB/styles/prosilver/template/memberlist_im.html b/phpBB/styles/prosilver/template/memberlist_im.html
index 68aed0b3dd..8e7842e631 100644
--- a/phpBB/styles/prosilver/template/memberlist_im.html
+++ b/phpBB/styles/prosilver/template/memberlist_im.html
@@ -3,7 +3,7 @@
<!-- MSNM info from http://www.cdolive.net/ - doesn't seem to work with MSN Messenger -->
<h2 class="solo">{L_SEND_IM}</h2>
-<form method="post" action="{S_IM_ACTION}">
+<form method="post" action="{S_IM_ACTION}" data-lang-im-msnm-connect="{L_IM_MSNM_CONNECT|e('html_attr')}" data-lang-im-msnm-browser="{L_IM_MSNM_BROWSER|e('html_attr')}">
<div class="panel bg2">
<div class="inner">
@@ -85,74 +85,4 @@
<a href="#" onclick="window.close(); return false;">{L_CLOSE_WINDOW}</a>
-<script type="text/javascript">
-// <![CDATA[
-
- /** The following will not work with Windows Vista **/
-
- var app = document.getElementById('objMessengerApp');
-
- /**
- * Check whether the browser supports this and whether MSNM is connected
- */
- function msn_supported()
- {
- // Does the browser support the MSNM object?
- if (app.MyStatus)
- {
- // Is MSNM connected?
- if (app.MyStatus == 1)
- {
- alert('{LA_IM_MSNM_CONNECT}');
- return false;
- }
- }
- else
- {
- alert('{LA_IM_MSNM_BROWSER}');
- return false;
- }
- return true;
- }
-
- /**
- * Add to your contact list
- */
- function add_contact(address)
- {
- if (msn_supported())
- {
- // Could return an error while MSNM is connecting, don't want that
- try
- {
- app.AddContact(0, address);
- }
- catch (e)
- {
- return;
- }
- }
-}
-
-/**
-* Write IM to contact
-*/
-function im_contact(address)
-{
- if (msn_supported())
- {
- // Could return an error while MSNM is connecting, don't want that
- try
- {
- app.InstantMessage(address);
- }
- catch (e)
- {
- return;
- }
- }
-}
-// ]]>
-</script>
-
<!-- INCLUDE simple_footer.html -->
diff --git a/phpBB/styles/prosilver/template/memberlist_search.html b/phpBB/styles/prosilver/template/memberlist_search.html
index f9538ef2e2..0b04d0087c 100644
--- a/phpBB/styles/prosilver/template/memberlist_search.html
+++ b/phpBB/styles/prosilver/template/memberlist_search.html
@@ -1,43 +1,3 @@
-<!-- IF S_IN_SEARCH_POPUP -->
-<!-- You should retain this javascript in your own template! -->
-<script type="text/javascript">
-// <![CDATA[
-function insert_user(user)
-{
- opener.document.forms['{S_FORM_NAME}'].{S_FIELD_NAME}.value = ( opener.document.forms['{S_FORM_NAME}'].{S_FIELD_NAME}.value.length && opener.document.forms['{S_FORM_NAME}'].{S_FIELD_NAME}.type == "textarea" ) ? opener.document.forms['{S_FORM_NAME}'].{S_FIELD_NAME}.value + "\n" + user : user;
-}
-
-function insert_marked(users)
-{
- if (typeof(users.length) == "undefined")
- {
- if (users.checked)
- {
- insert_user(users.value);
- }
- }
- else if (users.length > 0)
- {
- for (i = 0; i < users.length; i++)
- {
- if (users[i].checked)
- {
- insert_user(users[i].value);
- }
- }
- }
-
- self.close();
-}
-
-function insert_single(user)
-{
- opener.document.forms['{S_FORM_NAME}'].{S_FIELD_NAME}.value = user;
- self.close();
-}
-// ]]>
-</script>
-<!-- ENDIF -->
<h2 class="solo">{L_FIND_USERNAME}</h2>
<form method="post" action="{S_MODE_ACTION}" id="search_memberlist">
diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html
index b948d9f627..15a298053b 100644
--- a/phpBB/styles/prosilver/template/overall_footer.html
+++ b/phpBB/styles/prosilver/template/overall_footer.html
@@ -58,8 +58,8 @@
<script type="text/javascript" src="{T_JQUERY_LINK}"></script>
<!-- IF S_JQUERY_FALLBACK --><script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript src="{T_ASSETS_PATH}/javascript/jquery.js?assets_version={T_ASSETS_VERSION}" type="text/javascript"%3E%3C/script%3E'));</script><!-- ENDIF -->
+<script type="text/javascript" src="{T_ASSETS_PATH}/javascript/core.js?assets_version={T_ASSETS_VERSION}"></script>
<!-- INCLUDEJS forum_fn.js -->
-<!-- INCLUDEJS {T_ASSETS_PATH}/javascript/core.js -->
<!-- INCLUDEJS ajax.js -->
<!-- EVENT overall_footer_after -->
diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html
index c1cdc0c223..0b0c7a4172 100644
--- a/phpBB/styles/prosilver/template/overall_header.html
+++ b/phpBB/styles/prosilver/template/overall_header.html
@@ -24,42 +24,6 @@
Modified by:
-->
-<script type="text/javascript">
-// <![CDATA[
- var jump_page = '{LA_JUMP_PAGE}{L_COLON}';
- var on_page = '{ON_PAGE}';
- var per_page = '{PER_PAGE}';
- var base_url = '{A_BASE_URL}';
- var onload_functions = new Array();
- var onunload_functions = new Array();
-
- <!-- IF S_USER_PM_POPUP and S_NEW_PM -->
- var url = '{UA_POPUP_PM}';
- window.open(url.replace(/&amp;/g, '&'), '_phpbbprivmsg', 'height=225,resizable=yes,scrollbars=yes, width=400');
- <!-- ENDIF -->
-
- /**
- * New function for handling multiple calls to window.onload and window.unload by pentapenguin
- */
- window.onload = function()
- {
- for (var i = 0; i < onload_functions.length; i++)
- {
- onload_functions[i]();
- }
- };
-
- window.onunload = function()
- {
- for (var i = 0; i < onunload_functions.length; i++)
- {
- onunload_functions[i]();
- }
- };
-
-// ]]>
-</script>
-
<link href="{T_THEME_PATH}/print.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" type="text/css" media="print" title="printonly" />
<link href="{T_STYLESHEET_LINK}" rel="stylesheet" type="text/css" media="screen, projection" />
<link href="{T_STYLESHEET_LANG_LINK}" rel="stylesheet" type="text/css" media="screen, projection" />
diff --git a/phpBB/styles/prosilver/template/pagination.html b/phpBB/styles/prosilver/template/pagination.html
index 1c8441a9fd..172bc952e4 100644
--- a/phpBB/styles/prosilver/template/pagination.html
+++ b/phpBB/styles/prosilver/template/pagination.html
@@ -1,5 +1,4 @@
-
- <a href="#" onclick="jumpto(); return false;" title="{L_JUMP_TO_PAGE}">{PAGE_NUMBER}</a> &bull;
+ <a href="#" class="pagination-trigger" title="{L_JUMP_TO_PAGE}" data-lang-jump-page="{L_JUMP_PAGE|e('html_attr')}{L_COLON}" data-on-page="{ON_PAGE}" data-per-page="{PER_PAGE}" data-base-url="{BASE_URL|e('html_attr')}">{PAGE_NUMBER}</a> &bull;
<ul>
<!-- BEGIN pagination -->
<!-- IF pagination.S_IS_PREV -->
diff --git a/phpBB/styles/prosilver/template/posting_poll_body.html b/phpBB/styles/prosilver/template/posting_poll_body.html
index 5bb7e1a3df..a131c10533 100644
--- a/phpBB/styles/prosilver/template/posting_poll_body.html
+++ b/phpBB/styles/prosilver/template/posting_poll_body.html
@@ -26,7 +26,7 @@
<dl>
<dt><label for="poll_max_options">{L_POLL_MAX_OPTIONS}{L_COLON}</label></dt>
- <dd><input type="number" min="1" max="999" name="poll_max_options" id="poll_max_options" size="3" maxlength="3" value="{POLL_MAX_OPTIONS}" class="inputbox autowidth" /></dd>
+ <dd><input type="number" min="0" max="999" name="poll_max_options" id="poll_max_options" size="3" maxlength="3" value="{POLL_MAX_OPTIONS}" class="inputbox autowidth" /></dd>
<dd>{L_POLL_MAX_OPTIONS_EXPLAIN}</dd>
</dl>
<dl>
diff --git a/phpBB/styles/prosilver/template/search_body.html b/phpBB/styles/prosilver/template/search_body.html
index fedbdc6642..d4c1f98a2a 100644
--- a/phpBB/styles/prosilver/template/search_body.html
+++ b/phpBB/styles/prosilver/template/search_body.html
@@ -1,16 +1,8 @@
<!-- INCLUDE overall_header.html -->
-<script type="text/javascript">
-// <![CDATA[
- onload_functions.push(function () {
- document.getElementById("keywords").focus();
- });
-// ]]>
-</script>
-
<h2 class="solo">{L_SEARCH}</h2>
-<form method="get" action="{S_SEARCH_ACTION}">
+<form method="get" action="{S_SEARCH_ACTION}" data-focus="keywords">
<div class="panel">
<div class="inner">
diff --git a/phpBB/styles/prosilver/template/simple_header.html b/phpBB/styles/prosilver/template/simple_header.html
index 5bdc539f40..08b212363e 100644
--- a/phpBB/styles/prosilver/template/simple_header.html
+++ b/phpBB/styles/prosilver/template/simple_header.html
@@ -7,38 +7,6 @@
{META}
<title>{SITENAME} &bull; <!-- IF S_IN_MCP -->{L_MCP} &bull; <!-- ELSEIF S_IN_UCP -->{L_UCP} &bull; <!-- ENDIF -->{PAGE_TITLE}</title>
-<script type="text/javascript">
-// <![CDATA[
-
- var jump_page = '{LA_JUMP_PAGE}{L_COLON}';
- var on_page = '{ON_PAGE}';
- var per_page = '{PER_PAGE}';
- var base_url = '{A_BASE_URL}';
- var onload_functions = new Array();
- var onunload_functions = new Array();
-
- /**
- * New function for handling multiple calls to window.onload and window.unload by pentapenguin
- */
- window.onload = function()
- {
- for (var i = 0; i < onload_functions.length; i++)
- {
- onload_functions[i]();
- }
- }
-
- window.onunload = function()
- {
- for (var i = 0; i < onunload_functions.length; i++)
- {
- onunload_functions[i]();
- }
- }
-
-// ]]>
-</script>
-
<link href="{T_THEME_PATH}/print.css?assets_version={T_ASSETS_VERSION}" rel="stylesheet" type="text/css" media="print" title="printonly" />
<link href="{T_STYLESHEET_LINK}" rel="stylesheet" type="text/css" media="screen, projection" />
<link href="{T_STYLESHEET_LANG_LINK}" rel="stylesheet" type="text/css" media="screen, projection" />
diff --git a/phpBB/styles/prosilver/template/ucp_auth_link.html b/phpBB/styles/prosilver/template/ucp_auth_link.html
new file mode 100644
index 0000000000..078da58d19
--- /dev/null
+++ b/phpBB/styles/prosilver/template/ucp_auth_link.html
@@ -0,0 +1,15 @@
+<!-- INCLUDE ucp_header.html -->
+
+<h2>{L_UCP_AUTH_LINK_TITLE}</h2>
+
+<div class="panel">
+ <div class="inner">
+ <!-- IF ERROR --><dl><dd class="error">{ERROR}</dd></dl><!-- ENDIF -->
+
+ <!-- IF PROVIDER_TEMPLATE_FILE -->
+ <!-- INCLUDE {PROVIDER_TEMPLATE_FILE} -->
+ <!-- ENDIF -->
+ </div>
+</div>
+
+<!-- INCLUDE ucp_footer.html -->
diff --git a/phpBB/styles/prosilver/template/ucp_auth_link_oauth.html b/phpBB/styles/prosilver/template/ucp_auth_link_oauth.html
new file mode 100644
index 0000000000..a3e27328cd
--- /dev/null
+++ b/phpBB/styles/prosilver/template/ucp_auth_link_oauth.html
@@ -0,0 +1,29 @@
+<!-- BEGIN oauth -->
+ <form id="ucp" method="post" action="{S_UCP_ACTION}">
+ <h3>{oauth.SERVICE_NAME}</h3>
+
+ <fieldset class="fields2">
+ <!-- IF oauth.UNIQUE_ID -->
+ <dl>
+ <dt>{L_UCP_AUTH_LINK_ID}{L_COLON}</dt>
+ <dd>{oauth.UNIQUE_ID}</dd>
+ </dl>
+ <dl>
+ <dt>&nbsp;</dt>
+ <dd><input type="submit" name="submit" tabindex="6" value="{L_UCP_AUTH_LINK_UNLINK}" class="button1" /></dd>
+ </dl>
+ <!-- ELSE -->
+ <dl>
+ <dd>{L_UCP_AUTH_LINK_ASK}</dd>
+ </dl>
+ <dl>
+ <dt>&nbsp;</dt>
+ <dd><input type="submit" name="submit" tabindex="6" value="{L_UCP_AUTH_LINK_LINK}" class="button1" /></dd>
+ </dl>
+ <!-- ENDIF-->
+ </fieldset>
+ {oauth.HIDDEN_FIELDS}
+ {S_HIDDEN_FIELDS}
+ {S_FORM_TOKEN}
+ </form>
+<!-- END oauth -->
diff --git a/phpBB/styles/prosilver/template/ucp_avatar_options_gravatar.html b/phpBB/styles/prosilver/template/ucp_avatar_options_gravatar.html
index 88e0e69f53..b1076c2d14 100644
--- a/phpBB/styles/prosilver/template/ucp_avatar_options_gravatar.html
+++ b/phpBB/styles/prosilver/template/ucp_avatar_options_gravatar.html
@@ -1,20 +1,6 @@
-<script type="text/javascript">
-// <![CDATA[
-
-onload_functions.push(function() {
- $('#avatar_gravatar_email').bind('keyup', function () {
- $('#avatar_gravatar_width').val('');
- $('#avatar_gravatar_height').val('');
- $('#avatar_gravatar_email').unbind('keyup');
- });
-});
-
-// ]]>
-</script>
-
<dl>
<dt><label for="avatar_gravatar_email">{L_GRAVATAR_AVATAR_EMAIL}{L_COLON}</label><br /><span>{L_GRAVATAR_AVATAR_EMAIL_EXPLAIN}</span></dt>
- <dd><input type="email" name="avatar_gravatar_email" id="avatar_gravatar_email" value="{AVATAR_GRAVATAR_EMAIL}" class="inputbox" /></dd>
+ <dd><input type="email" name="avatar_gravatar_email" id="avatar_gravatar_email" value="{AVATAR_GRAVATAR_EMAIL}" class="inputbox" data-reset-on-edit="#avatar_gravatar_width, #avatar_gravatar_height" /></dd>
</dl>
<dl>
<dt><label for="avatar_gravatar_width">{L_GRAVATAR_AVATAR_SIZE}{L_COLON}</label><br /><span>{L_GRAVATAR_AVATAR_SIZE_EXPLAIN}</span></dt>
diff --git a/phpBB/styles/prosilver/template/ucp_avatar_options_remote.html b/phpBB/styles/prosilver/template/ucp_avatar_options_remote.html
index 59adf10058..a8f6135fb2 100644
--- a/phpBB/styles/prosilver/template/ucp_avatar_options_remote.html
+++ b/phpBB/styles/prosilver/template/ucp_avatar_options_remote.html
@@ -1,20 +1,6 @@
-<script type="text/javascript">
-// <![CDATA[
-
-onload_functions.push(function() {
- $('#avatar_remote_url').bind('keyup', function () {
- $('#avatar_remote_width').val('');
- $('#avatar_remote_height').val('');
- $('#avatar_remote_url').unbind('keyup');
- });
-});
-
-// ]]>
-</script>
-
<dl>
<dt><label for="avatar_remote_url">{L_LINK_REMOTE_AVATAR}{L_COLON}</label><br /><span>{L_LINK_REMOTE_AVATAR_EXPLAIN}</span></dt>
- <dd><input type="url" name="avatar_remote_url" id="avatar_remote_url" value="{AVATAR_REMOTE_URL}" class="inputbox" /></dd>
+ <dd><input type="url" name="avatar_remote_url" id="avatar_remote_url" value="{AVATAR_REMOTE_URL}" class="inputbox" data-reset-on-edit="#avatar_remote_width, #avatar_remote_height" /></dd>
</dl>
<dl>
<dt><label for="avatar_remote_width">{L_LINK_REMOTE_SIZE}{L_COLON}</label><br /><span>{L_LINK_REMOTE_SIZE_EXPLAIN}</span></dt>
diff --git a/phpBB/styles/prosilver/template/ucp_login_link.html b/phpBB/styles/prosilver/template/ucp_login_link.html
new file mode 100644
index 0000000000..d3c6931ce3
--- /dev/null
+++ b/phpBB/styles/prosilver/template/ucp_login_link.html
@@ -0,0 +1,58 @@
+<!-- INCLUDE overall_header.html -->
+
+<div class="panel">
+ <div class="inner">
+
+ <h2>{SITENAME} - {L_LOGIN_LINK}</h2>
+
+ <p>{L_LOGIN_LINK_EXPLAIN}</p>
+
+ <!-- IF LOGIN_LINK_ERROR --><div class="content">
+ <div class="error">{LOGIN_LINK_ERROR}</div>
+ </div><!-- ENDIF -->
+
+ <div class="content">
+ <h2>{L_REGISTER}</h2>
+
+ <form action="{REGISTER_ACTION}" method="post" id="register">
+ <fieldset class="fields1">
+ <dl>
+ <dt>&nbsp;</dt>
+ <dd>{S_HIDDEN_FIELDS}<input type="submit" name="register" tabindex="1" value="{L_REGISTER}" class="button1" /></dd>
+ </dl>
+ </fieldset>
+ </form>
+ </div>
+
+ <div class="content">
+ <h2>{L_LOGIN}</h2>
+
+ <form action="{LOGIN_ACTION}" method="post" id="login">
+ <fieldset class="fields1">
+ <!-- IF LOGIN_ERROR --><div class="error">{LOGIN_ERROR}</div><!-- ENDIF -->
+ <dl>
+ <dt><label for="{USERNAME_CREDENTIAL}">{L_USERNAME}{L_COLON}</label></dt>
+ <dd><input type="text" tabindex="2" name="{USERNAME_CREDENTIAL}" id="{USERNAME_CREDENTIAL}" size="25" value="{LOGIN_USERNAME}" class="inputbox autowidth" /></dd>
+ </dl>
+ <dl>
+ <dt><label for="{PASSWORD_CREDENTIAL}">{L_PASSWORD}{L_COLON}</label></dt>
+ <dd><input type="password" tabindex="3" id="{PASSWORD_CREDENTIAL}" name="{PASSWORD_CREDENTIAL}" size="25" class="inputbox autowidth" /></dd>
+ </dl>
+ <!-- IF CAPTCHA_TEMPLATE and S_CONFIRM_CODE -->
+ <!-- DEFINE $CAPTCHA_TAB_INDEX = 4 -->
+ <!-- INCLUDE {CAPTCHA_TEMPLATE} -->
+ <!-- ENDIF -->
+
+ {S_LOGIN_REDIRECT}
+ <dl>
+ <dt>&nbsp;</dt>
+ <dd>{S_HIDDEN_FIELDS}<input type="submit" name="login" tabindex="5" value="{L_LOGIN}" class="button1" /></dd>
+ </dl>
+ </fieldset>
+ </form>
+ </div>
+
+ </div>
+</div>
+
+<!-- INCLUDE overall_footer.html -->
diff --git a/phpBB/styles/prosilver/template/ucp_notifications.html b/phpBB/styles/prosilver/template/ucp_notifications.html
index 6a1d3b8de4..2088de49e8 100644
--- a/phpBB/styles/prosilver/template/ucp_notifications.html
+++ b/phpBB/styles/prosilver/template/ucp_notifications.html
@@ -83,7 +83,7 @@
</div>
</dt>
- <dd class="mark">&nbsp;<!-- IF notification_list.UNREAD --><input type="checkbox" name="mark[]" value="{notification_list.NOTIFICATION_ID}" /> <dfn>{L_MARK_READ}</dfn><!-- ENDIF -->&nbsp;</dd>
+ <dd class="mark">&nbsp;<input type="checkbox" name="mark[]" value="{notification_list.NOTIFICATION_ID}"<!-- IF not notification_list.UNREAD --> disabled="disabled"<!-- ENDIF --> /> <dfn>{L_MARK_READ}</dfn>&nbsp;</dd>
</dl>
</li>
<!-- END notification_list -->
diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html
index 4f2531d3a6..50e76f5b75 100644
--- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html
+++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html
@@ -62,7 +62,7 @@
<!-- ENDIF -->
<!-- IF S_DISPLAY_NOTICE -->
- <div class="rules">{L_DOWNLOAD_NOTICE}</div>
+ <div class="post-notice error">{L_DOWNLOAD_NOTICE}</div>
<!-- ENDIF -->
<!-- IF EDITED_MESSAGE or EDIT_REASON -->
diff --git a/phpBB/styles/prosilver/template/ucp_prefs_personal.html b/phpBB/styles/prosilver/template/ucp_prefs_personal.html
index 9a639786b7..8111496dcb 100644
--- a/phpBB/styles/prosilver/template/ucp_prefs_personal.html
+++ b/phpBB/styles/prosilver/template/ucp_prefs_personal.html
@@ -9,6 +9,7 @@
<fieldset>
<!-- IF ERROR --><p class="error">{ERROR}</p><!-- ENDIF -->
+ <!-- EVENT ucp_prefs_personal_prepend -->
<dl>
<dt><label for="viewemail0">{L_SHOW_EMAIL}{L_COLON}</label></dt>
<dd>
@@ -71,6 +72,7 @@
</dd>
<dd id="custom_date" style="display:none;"><input type="text" name="dateformat" id="dateformat" value="{DATE_FORMAT}" maxlength="30" class="inputbox narrow" style="margin-top: 3px;" /></dd>
</dl>
+ <!-- EVENT ucp_prefs_personal_append -->
</fieldset>
</div>
diff --git a/phpBB/styles/prosilver/template/ucp_prefs_post.html b/phpBB/styles/prosilver/template/ucp_prefs_post.html
index 6c68b2bccc..891e49af6f 100644
--- a/phpBB/styles/prosilver/template/ucp_prefs_post.html
+++ b/phpBB/styles/prosilver/template/ucp_prefs_post.html
@@ -8,6 +8,7 @@
<fieldset>
<!-- IF ERROR --><p class="error">{ERROR}</p><!-- ENDIF -->
+ <!-- EVENT ucp_prefs_post_prepend -->
<dl>
<dt><label for="bbcode1">{L_DEFAULT_BBCODE}{L_COLON}</label></dt>
<dd>
@@ -36,6 +37,7 @@
<label for="notify0"><input type="radio" name="notify" id="notify0" value="0"<!-- IF not S_NOTIFY --> checked="checked"<!-- ENDIF --> /> {L_NO}</label>
</dd>
</dl>
+ <!-- EVENT ucp_prefs_post_append -->
</fieldset>
</div>
diff --git a/phpBB/styles/prosilver/template/ucp_prefs_view.html b/phpBB/styles/prosilver/template/ucp_prefs_view.html
index 51561349c3..7f8d0a344c 100644
--- a/phpBB/styles/prosilver/template/ucp_prefs_view.html
+++ b/phpBB/styles/prosilver/template/ucp_prefs_view.html
@@ -9,6 +9,7 @@
<fieldset>
<!-- IF ERROR --><p class="error">{ERROR}</p><!-- ENDIF -->
+ <!-- EVENT ucp_prefs_view_radio_buttons_prepend -->
<dl>
<dt><label for="images1">{L_VIEW_IMAGES}{L_COLON}</label></dt>
<dd>
@@ -53,7 +54,9 @@
</dd>
</dl>
<!-- ENDIF -->
+ <!-- EVENT ucp_prefs_view_radio_buttons_append -->
<hr />
+ <!-- EVENT ucp_prefs_view_select_menu_prepend -->
<dl>
<dt><label>{L_VIEW_TOPICS_DAYS}{L_COLON}</label></dt>
<dd>{S_TOPIC_SORT_DAYS}</dd>
@@ -79,6 +82,7 @@
<dt><label>{L_VIEW_POSTS_DIR}{L_COLON}</label></dt>
<dd>{S_POST_SORT_DIR}</dd>
</dl>
+ <!-- EVENT ucp_prefs_view_select_menu_append -->
</fieldset>
</div>
diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html
index 0dd4ff220d..e104257e12 100644
--- a/phpBB/styles/prosilver/template/viewtopic_body.html
+++ b/phpBB/styles/prosilver/template/viewtopic_body.html
@@ -151,29 +151,32 @@
<h3 <!-- IF postrow.S_FIRST_ROW -->class="first"<!-- ENDIF -->><!-- IF postrow.POST_ICON_IMG --><img src="{T_ICONS_PATH}{postrow.POST_ICON_IMG}" width="{postrow.POST_ICON_IMG_WIDTH}" height="{postrow.POST_ICON_IMG_HEIGHT}" alt="" /> <!-- ENDIF --><a href="#p{postrow.POST_ID}">{postrow.POST_SUBJECT}</a></h3>
<p class="author"><!-- IF S_IS_BOT -->{postrow.MINI_POST_IMG}<!-- ELSE --><a href="{postrow.U_MINI_POST}">{postrow.MINI_POST_IMG}</a><!-- ENDIF -->{L_POST_BY_AUTHOR} <strong>{postrow.POST_AUTHOR_FULL}</strong> &raquo; {postrow.POST_DATE} </p>
- <!-- IF postrow.S_POST_UNAPPROVED or postrow.S_POST_DELETED or postrow.S_POST_REPORTED -->
+ <!-- IF postrow.S_POST_UNAPPROVED -->
<form method="post" class="mcp_approve" action="{postrow.U_APPROVE_ACTION}">
- <p class="rules">
- <!-- IF postrow.S_POST_UNAPPROVED -->
- {UNAPPROVED_IMG} <strong>{L_POST_UNAPPROVED}</strong>
- <input class="button2" type="submit" value="{L_DISAPPROVE}" name="action[disapprove]" />
- <input class="button1" type="submit" value="{L_APPROVE}" name="action[approve]" />
- <input type="hidden" name="post_id_list[]" value="{postrow.POST_ID}" />
- {S_FORM_TOKEN}
- <br />
- <!-- ELSEIF postrow.S_POST_DELETED -->
- {DELETED_IMG} <strong>{L_POST_DELETED}</strong>
- <input class="button2" type="submit" value="{L_DELETE}" name="action[disapprove]" />
- <input class="button1" type="submit" value="{L_RESTORE}" name="action[restore]" />
- <input type="hidden" name="post_id_list[]" value="{postrow.POST_ID}" />
- {S_FORM_TOKEN}
- <br />
- <!-- ENDIF -->
- <!-- IF postrow.S_POST_REPORTED -->
- {REPORTED_IMG} <a href="{postrow.U_MCP_REPORT}"><strong>{L_POST_REPORTED}</strong></a>
- <!-- ENDIF -->
+ <p class="post-notice unapproved">
+ <strong>{L_POST_UNAPPROVED}</strong>
+ <input class="button2" type="submit" value="{L_DISAPPROVE}" name="action[disapprove]" />
+ <input class="button1" type="submit" value="{L_APPROVE}" name="action[approve]" />
+ <input type="hidden" name="post_id_list[]" value="{postrow.POST_ID}" />
+ {S_FORM_TOKEN}
</p>
</form>
+ <!-- ELSEIF postrow.S_POST_DELETED -->
+ <form method="post" class="mcp_approve" action="{postrow.U_APPROVE_ACTION}">
+ <p class="post-notice deleted">
+ <strong>{L_POST_DELETED}</strong>
+ <input class="button2" type="submit" value="{L_DELETE}" name="action[disapprove]" />
+ <input class="button1" type="submit" value="{L_RESTORE}" name="action[restore]" />
+ <input type="hidden" name="post_id_list[]" value="{postrow.POST_ID}" />
+ {S_FORM_TOKEN}
+ </p>
+ </form>
+ <!-- ENDIF -->
+
+ <!-- IF postrow.S_POST_REPORTED -->
+ <p class="post-notice reported">
+ <a href="{postrow.U_MCP_REPORT}"><strong>{L_POST_REPORTED}</strong></a>
+ </p>
<!-- ENDIF -->
<div class="content">{postrow.MESSAGE}</div>
diff --git a/phpBB/styles/prosilver/theme/bidi.css b/phpBB/styles/prosilver/theme/bidi.css
index a921805327..41a9874a18 100644
--- a/phpBB/styles/prosilver/theme/bidi.css
+++ b/phpBB/styles/prosilver/theme/bidi.css
@@ -371,6 +371,13 @@
float: right;
}
+.rtl p.post-notice:before {
+ left: auto;
+ right: 0;
+ padding-left: 5px;
+ padding-right: 26px;
+}
+
/* Topic review panel
----------------------------------------*/
.rtl #topicreview {
diff --git a/phpBB/styles/prosilver/theme/colours.css b/phpBB/styles/prosilver/theme/colours.css
index db55540901..9e3d29bec2 100644
--- a/phpBB/styles/prosilver/theme/colours.css
+++ b/phpBB/styles/prosilver/theme/colours.css
@@ -214,11 +214,24 @@ div.rules {
color: #BC2A4D;
}
-p.rules {
+p.post-notice {
background-color: #ECD5D8;
background-image: none;
}
+p.post-notice.deleted:before {
+ background-image: url("./images/icon_topic_deleted.png");
+}
+
+p.post-notice.unapproved:before {
+ background-image: url("./images/icon_topic_unapproved.gif");
+}
+
+p.post-notice.reported:before, p.post-notice.error:before {
+ background-image: url("./images/icon_topic_reported.gif");
+}
+
+
/*
--------------------------------------------------------------
Colours and backgrounds for links.css
diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css
index a2b8034187..9021c157a3 100644
--- a/phpBB/styles/prosilver/theme/common.css
+++ b/phpBB/styles/prosilver/theme/common.css
@@ -134,6 +134,10 @@ p.right {
text-align: right;
}
+p.jumpbox-return {
+ margin-top: 1em;
+}
+
b, strong {
font-weight: bold;
}
@@ -685,23 +689,28 @@ div.rules ul, div.rules ol {
margin-left: 20px;
}
-p.rules {
- background-image: none;
+p.post-notice {
+ position: relative;
padding: 5px;
+ padding-left: 26px;
+ min-height: 14px;
+ margin-bottom: 1em;
}
-p.rules img {
- vertical-align: middle;
-}
-
-p.rules strong {
- vertical-align: middle;
- padding-top: 5px;
+p.post-notice:before {
+ content: '';
+ display: block;
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ width: 28px;
+ background: transparent none 50% 50% no-repeat;
+ pointer-events: none;
}
-p.rules a {
- vertical-align: middle;
- clear: both;
+form > p.post-notice strong {
+ line-height: 20px;
}
#top {
diff --git a/phpBB/styles/prosilver/theme/forms.css b/phpBB/styles/prosilver/theme/forms.css
index b66544acf7..34f8bc8c32 100644
--- a/phpBB/styles/prosilver/theme/forms.css
+++ b/phpBB/styles/prosilver/theme/forms.css
@@ -28,6 +28,10 @@ select {
font-size: 1em;
}
+select:focus {
+ outline-style: none;
+}
+
option {
padding-right: 1em;
}
@@ -271,6 +275,7 @@ fieldset.submit-buttons input {
.inputbox:hover, .inputbox:focus {
border: 1px solid transparent;
+ outline-style: none;
}
input.inputbox { width: 85%; }
@@ -347,6 +352,11 @@ input.disabled {
font-weight: normal;
}
+/* Focus states */
+input.button1:focus, input.button2:focus, input.button3:focus {
+ outline-style: none;
+}
+
/* Topic and forum Search */
.search-box {
margin-top: 3px;
diff --git a/phpBB/styles/subsilver2/template/login_body.html b/phpBB/styles/subsilver2/template/login_body.html
index 2b895dda89..ed63e748cf 100644
--- a/phpBB/styles/subsilver2/template/login_body.html
+++ b/phpBB/styles/subsilver2/template/login_body.html
@@ -61,6 +61,9 @@
<td><input type="checkbox" class="radio" name="viewonline" tabindex="4" /> <span class="gensmall">{L_HIDE_ME}</span></td>
</tr>
<!-- ENDIF -->
+ <!-- IF not S_ADMIN_AUTH and PROVIDER_TEMPLATE_FILE -->
+ <!-- INCLUDE {PROVIDER_TEMPLATE_FILE} -->
+ <!-- ENDIF -->
</table>
</td>
</tr>
diff --git a/phpBB/styles/subsilver2/template/login_body_oauth.html b/phpBB/styles/subsilver2/template/login_body_oauth.html
new file mode 100644
index 0000000000..6f374fa4f2
--- /dev/null
+++ b/phpBB/styles/subsilver2/template/login_body_oauth.html
@@ -0,0 +1,7 @@
+<!-- BEGIN oauth -->
+ <tr>
+ <td>
+ <a href="{oauth.REDIRECT_URL}">{oauth.SERVICE_NAME}</a>
+ </td>
+ </tr>
+<!-- END oauth -->
diff --git a/phpBB/styles/subsilver2/template/mcp_post.html b/phpBB/styles/subsilver2/template/mcp_post.html
index a3ebb00d06..0f000ca931 100644
--- a/phpBB/styles/subsilver2/template/mcp_post.html
+++ b/phpBB/styles/subsilver2/template/mcp_post.html
@@ -28,7 +28,7 @@
</tr>
<!-- ENDIF -->
<tr>
- <td class="cat" align="center" colspan="2"><!-- IF S_POST_REPORTED --><input class="btnmain" type="submit" value="{L_CLOSE_REPORT}" name="action[close]" /><!-- ELSE -->{L_REPORT_CLOSED}<!-- ENDIF --> &nbsp; <input class="btnlite" type="submit" value="{L_DELETE_REPORT}" name="action[delete]" /></td>
+ <td class="cat" align="center" colspan="2"><!-- IF not S_REPORT_CLOSED --><input class="btnmain" type="submit" value="{L_CLOSE_REPORT}" name="action[close]" /><!-- ELSE -->{L_REPORT_CLOSED}<!-- ENDIF --> &nbsp; <input class="btnlite" type="submit" value="{L_DELETE_REPORT}" name="action[delete]" /></td>
</tr>
</table>
diff --git a/phpBB/styles/subsilver2/template/overall_footer.html b/phpBB/styles/subsilver2/template/overall_footer.html
index d2b30c22a0..348db5d309 100644
--- a/phpBB/styles/subsilver2/template/overall_footer.html
+++ b/phpBB/styles/subsilver2/template/overall_footer.html
@@ -13,7 +13,7 @@
<script type="text/javascript" src="{T_JQUERY_LINK}"></script>
<!-- IF S_JQUERY_FALLBACK --><script type="text/javascript">window.jQuery || document.write(unescape('%3Cscript src="{T_ASSETS_PATH}/javascript/jquery.js?assets_version={T_ASSETS_VERSION}" type="text/javascript"%3E%3C/script%3E'));</script><!-- ENDIF -->
-<!-- INCLUDEJS {T_ASSETS_PATH}/javascript/core.js -->
+<script type="text/javascript" src="{T_ASSETS_PATH}/javascript/core.js?assets_version={T_ASSETS_VERSION}"></script>
<!-- EVENT overall_footer_after -->
diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html
index 02ff1be8d8..7bfb85017a 100644
--- a/phpBB/styles/subsilver2/template/overall_header.html
+++ b/phpBB/styles/subsilver2/template/overall_header.html
@@ -22,9 +22,6 @@
<script type="text/javascript">
// <![CDATA[
-<!-- IF S_USER_PM_POPUP and S_NEW_PM -->
- popup('{UA_POPUP_PM}', 400, 225, '_phpbbprivmsg');
-<!-- ENDIF -->
function popup(url, width, height, name)
{
@@ -41,7 +38,7 @@ function jumpto()
{
var page = prompt('{LA_JUMP_PAGE}{L_COLON}', '{ON_PAGE}');
var per_page = '{PER_PAGE}';
- var base_url = '{A_BASE_URL}';
+ var base_url = '{BASE_URL|e('js')}';
if (page !== null && !isNaN(page) && page == Math.floor(page) && page > 0)
{
diff --git a/phpBB/styles/subsilver2/template/ucp_auth_link.html b/phpBB/styles/subsilver2/template/ucp_auth_link.html
new file mode 100644
index 0000000000..75e3133fcf
--- /dev/null
+++ b/phpBB/styles/subsilver2/template/ucp_auth_link.html
@@ -0,0 +1,19 @@
+<!-- INCLUDE ucp_header.html -->
+
+<table class="tablebg" width="100%" cellspacing="1">
+ <tr>
+ <th colspan="4">{L_UCP_AUTH_LINK_TITLE}</th>
+ </tr>
+
+ <!-- IF ERROR -->
+ <tr>
+ <td class="row1" colspan="2" align="center"><span class="genmed error">{ERROR}</span></td>
+ </tr>
+ <!-- ENDIF -->
+
+ <!-- IF PROVIDER_TEMPLATE_FILE -->
+ <!-- INCLUDE {PROVIDER_TEMPLATE_FILE} -->
+ <!-- ENDIF -->
+</table>
+
+<!-- INCLUDE ucp_footer.html -->
diff --git a/phpBB/styles/subsilver2/template/ucp_auth_link_oauth.html b/phpBB/styles/subsilver2/template/ucp_auth_link_oauth.html
new file mode 100644
index 0000000000..56a4c89125
--- /dev/null
+++ b/phpBB/styles/subsilver2/template/ucp_auth_link_oauth.html
@@ -0,0 +1,34 @@
+<!-- BEGIN oauth -->
+ <tr>
+ <th>{oauth.SERVICE_NAME}</th>
+ </tr>
+
+ <tr>
+ <td class="row1">
+ <form id="ucp" method="post" action="{S_UCP_ACTION}">
+ <table>
+ <!-- IF oauth.UNIQUE_ID -->
+ <tr>
+ <td class="row1">{L_UCP_AUTH_LINK_ID}{L_COLON}</td>
+ <td class="row1">{oauth.UNIQUE_ID}</td>
+ </tr>
+ <tr>
+ <td class="row1">&nbsp;</td>
+ <td class="row1"><input type="submit" name="submit" tabindex="6" value="{L_UCP_AUTH_LINK_UNLINK}" class="button1" /></td>
+ </tr>
+ <!-- ELSE -->
+ <tr>
+ <td class="row1">{L_UCP_AUTH_LINK_ASK}</td>
+ </tr>
+ <tr>
+ <td class="row1"><input type="submit" name="submit" tabindex="6" value="{L_UCP_AUTH_LINK_LINK}" class="button1" /></td>
+ </tr>
+ <!-- ENDIF-->
+ </table>
+ {oauth.HIDDEN_FIELDS}
+ {S_HIDDEN_FIELDS}
+ {S_FORM_TOKEN}
+ </form>
+ </td>
+ </tr>
+<!-- END oauth -->
diff --git a/phpBB/styles/subsilver2/template/ucp_login_link.html b/phpBB/styles/subsilver2/template/ucp_login_link.html
new file mode 100644
index 0000000000..5d8e3ee27b
--- /dev/null
+++ b/phpBB/styles/subsilver2/template/ucp_login_link.html
@@ -0,0 +1,74 @@
+<!-- INCLUDE overall_header.html -->
+
+<table class="tablebg" width="100%" cellspacing="1">
+ <tr>
+ <th>{SITENAME} - {L_LOGIN_LINK}</th>
+ </tr>
+
+ <tr>
+ <td class="row1" align="center"><span class="genmed">{L_LOGIN_LINK_EXPLAIN}</span></td>
+ </tr>
+
+ <!-- IF LOGIN_LINK_ERROR -->
+ <tr>
+ <td class="row1" align="center"><span class="genmed error">{LOGIN_LINK_ERROR}</span></td>
+ </tr>
+ <!-- ENDIF -->
+
+ <tr>
+ <td class="row1">
+ <form action="{REGISTER_ACTION}" method="post" id="register">
+ <table width="100%" cellspacing="1">
+ <tr>
+ <th colspan="2">{L_REGISTER}</th>
+ </tr>
+
+ <tr>
+ <td>{S_HIDDEN_FIELDS}<input type="submit" name="register" tabindex="1" value="{L_REGISTER}" class="button1" /></td>
+ </tr>
+ </table>
+ </form>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="row1">
+ <form action="{LOGIN_ACTION}" method="post" id="login">
+ <table width="100%" cellspacing="1">
+ <tr>
+ <th colspan="2">{L_LOGIN}</th>
+ </tr>
+
+ <!-- IF LOGIN_ERROR -->
+ <tr>
+ <td class="row1" align="center" colspan="2"><span class="genmed error">{LOGIN_ERROR}</span></td>
+ </tr>
+ <!-- ENDIF -->
+
+ <tr>
+ <td><label for="{USERNAME_CREDENTIAL}">{L_USERNAME}{L_COLON}</label></td>
+ <td><input type="text" tabindex="2" name="{USERNAME_CREDENTIAL}" id="{USERNAME_CREDENTIAL}" size="25" value="{LOGIN_USERNAME}" class="inputbox autowidth" /></td>
+ </tr>
+
+ <tr>
+ <td><label for="{PASSWORD_CREDENTIAL}">{L_PASSWORD}{L_COLON}</label></td>
+ <td><input type="password" tabindex="3" id="{PASSWORD_CREDENTIAL}" name="{PASSWORD_CREDENTIAL}" size="25" class="inputbox autowidth" /></td>
+ </tr>
+
+ <!-- IF CAPTCHA_TEMPLATE and S_CONFIRM_CODE -->
+ <!-- DEFINE $CAPTCHA_TAB_INDEX = 4 -->
+ <!-- INCLUDE {CAPTCHA_TEMPLATE} -->
+ <!-- ENDIF -->
+
+ {S_LOGIN_REDIRECT}
+ <tr>
+ <td>&nbsp;</td>
+ <td>{S_HIDDEN_FIELDS}<input type="submit" name="login" tabindex="5" value="{L_LOGIN}" class="button1" /></td>
+ </tr>
+ </table>
+ </form>
+ </td>
+ </tr>
+</table>
+
+<!-- INCLUDE overall_footer.html -->
diff --git a/phpBB/styles/subsilver2/template/ucp_notifications.html b/phpBB/styles/subsilver2/template/ucp_notifications.html
index d85584d20e..4a1630786a 100644
--- a/phpBB/styles/subsilver2/template/ucp_notifications.html
+++ b/phpBB/styles/subsilver2/template/ucp_notifications.html
@@ -102,7 +102,7 @@
</span>
</td>
<td align="center">
- <!-- IF notification_list.UNREAD --><input type="checkbox" name="mark[]" value="{notification_list.NOTIFICATION_ID}" /><!-- ENDIF -->
+ <input type="checkbox" name="mark[]" value="{notification_list.NOTIFICATION_ID}"<!-- IF not notification_list.UNREAD --> disabled="disabled"<!-- ENDIF --> />
</td>
</tr>
<!-- END notification_list -->
diff --git a/phpBB/styles/subsilver2/template/ucp_prefs_personal.html b/phpBB/styles/subsilver2/template/ucp_prefs_personal.html
index 8f6e345e69..cd5fc9a13f 100644
--- a/phpBB/styles/subsilver2/template/ucp_prefs_personal.html
+++ b/phpBB/styles/subsilver2/template/ucp_prefs_personal.html
@@ -29,6 +29,7 @@
<td class="row3" colspan="2" align="center"><span class="gensmall error">{ERROR}</span></td>
</tr>
<!-- ENDIF -->
+<!-- EVENT ucp_prefs_personal_prepend -->
<tr>
<td class="row1" width="50%"><b class="genmed">{L_SHOW_EMAIL}{L_COLON}</b></td>
<td class="row2"><input type="radio" class="radio" name="viewemail" value="1"<!-- IF S_VIEW_EMAIL --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_YES}</span>&nbsp;&nbsp;<input type="radio" class="radio" name="viewemail" value="0"<!-- IF not S_VIEW_EMAIL --> checked="checked"<!-- ENDIF --> /><span class="genmed">{L_NO}</span></td>
@@ -75,6 +76,7 @@
<div id="custom_date"<!-- IF not S_CUSTOM_DATEFORMAT --> style="display:none;"<!-- ENDIF -->><input type="text" name="dateformat" id="dateformat" value="{DATE_FORMAT}" maxlength="30" class="post" style="margin-top: 3px;" /></div>
</td>
</tr>
+<!-- EVENT ucp_prefs_personal_append -->
<tr>
<td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="submit" value="{L_SUBMIT}" />&nbsp;&nbsp;<input class="btnlite" type="reset" value="{L_RESET}" name="reset" /></td>
</tr>
diff --git a/phpBB/styles/subsilver2/template/ucp_prefs_post.html b/phpBB/styles/subsilver2/template/ucp_prefs_post.html
index 03f1472942..0a558b863c 100644
--- a/phpBB/styles/subsilver2/template/ucp_prefs_post.html
+++ b/phpBB/styles/subsilver2/template/ucp_prefs_post.html
@@ -9,6 +9,7 @@
<td class="row3" colspan="2" align="center"><span class="gensmall error">{ERROR}</span></td>
</tr>
<!-- ENDIF -->
+<!-- EVENT ucp_prefs_post_prepend -->
<tr>
<td class="row1" width="50%"><b class="genmed">{L_DEFAULT_BBCODE}{L_COLON}</b></td>
<td class="row2"><input type="radio" class="radio" name="bbcode" value="1"<!-- IF S_BBCODE --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_YES}</span>&nbsp; &nbsp;<input type="radio" class="radio" name="bbcode" value="0"<!-- IF not S_BBCODE --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_NO}</span></td>
@@ -25,6 +26,7 @@
<td class="row1" width="50%"><b class="genmed">{L_DEFAULT_NOTIFY}{L_COLON}</b></td>
<td class="row2"><input type="radio" class="radio" name="notify" value="1"<!-- IF S_NOTIFY --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_YES}</span>&nbsp; &nbsp;<input type="radio" class="radio" name="notify" value="0"<!-- IF not S_NOTIFY --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_NO}</span></td>
</tr>
+<!-- EVENT ucp_prefs_post_append -->
<tr>
<td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="submit" value="{L_SUBMIT}" />&nbsp;&nbsp;<input class="btnlite" type="reset" value="{L_RESET}" name="reset" /></td>
</tr>
diff --git a/phpBB/styles/subsilver2/template/ucp_prefs_view.html b/phpBB/styles/subsilver2/template/ucp_prefs_view.html
index cc1b20a987..c10c458627 100644
--- a/phpBB/styles/subsilver2/template/ucp_prefs_view.html
+++ b/phpBB/styles/subsilver2/template/ucp_prefs_view.html
@@ -9,6 +9,7 @@
<td class="row3" colspan="2" align="center"><span class="gensmall error">{ERROR}</span></td>
</tr>
<!-- ENDIF -->
+<!-- EVENT ucp_prefs_view_radio_buttons_prepend -->
<tr>
<td class="row1" width="50%"><b class="genmed">{L_VIEW_IMAGES}{L_COLON}</b></td>
<td class="row2"><input type="radio" class="radio" name="images" value="1"<!-- IF S_IMAGES --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_YES}</span>&nbsp; &nbsp;<input type="radio" class="radio" name="images" value="0"<!-- IF not S_IMAGES --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_NO}</span></td>
@@ -35,9 +36,11 @@
<td class="row2"><input type="radio" class="radio" name="wordcensor" value="1"<!-- IF S_DISABLE_CENSORS --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_YES}</span>&nbsp; &nbsp;<input type="radio" class="radio" name="wordcensor" value="0"<!-- IF not S_DISABLE_CENSORS --> checked="checked"<!-- ENDIF --> /><span class="gen">{L_NO}</span></td>
</tr>
<!-- ENDIF -->
+<!-- EVENT ucp_prefs_view_radio_buttons_append -->
<tr>
<td colspan="2" class="spacer"></td>
</tr>
+<!-- EVENT ucp_prefs_view_select_menu_prepend -->
<tr>
<td class="row1" width="50%"><b class="genmed">{L_VIEW_TOPICS_DAYS}{L_COLON}</b></td>
<td class="row2">{S_TOPIC_SORT_DAYS}</td>
@@ -65,6 +68,7 @@
<td class="row1" width="50%"><b class="genmed">{L_VIEW_POSTS_DIR}{L_COLON}</b></td>
<td class="row2">{S_POST_SORT_DIR}</td>
</tr>
+<!-- EVENT ucp_prefs_view_select_menu_append -->
<tr>
<td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="submit" value="{L_SUBMIT}" />&nbsp;&nbsp;<input class="btnlite" type="reset" value="{L_RESET}" name="reset" /></td>
</tr>
diff --git a/phpBB/styles/subsilver2/theme/stylesheet.css b/phpBB/styles/subsilver2/theme/stylesheet.css
index d2352d93ef..7d14376454 100644
--- a/phpBB/styles/subsilver2/theme/stylesheet.css
+++ b/phpBB/styles/subsilver2/theme/stylesheet.css
@@ -552,6 +552,9 @@ input.radio {
border-style: none;
}
+input:focus, select:focus, textarea:focus {
+ outline-style: none;
+}
/* BBCode
------------ */
diff --git a/phpBB/ucp.php b/phpBB/ucp.php
index 7180c54de6..0c587cbf28 100644
--- a/phpBB/ucp.php
+++ b/phpBB/ucp.php
@@ -21,7 +21,7 @@ require($phpbb_root_path . 'includes/functions_module.' . $phpEx);
$id = request_var('i', '');
$mode = request_var('mode', '');
-if (in_array($mode, array('login', 'logout', 'confirm', 'sendpassword', 'activate')))
+if (in_array($mode, array('login', 'login_link', 'logout', 'confirm', 'sendpassword', 'activate')))
{
define('IN_LOGIN', true);
}
@@ -80,6 +80,16 @@ switch ($mode)
login_box(request_var('redirect', "index.$phpEx"));
break;
+ case 'login_link':
+ if ($user->data['is_registered'])
+ {
+ redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
+ }
+
+ $module->load('ucp', 'login_link');
+ $module->display($user->lang['UCP_LOGIN_LINK']);
+ break;
+
case 'logout':
if ($user->data['user_id'] != ANONYMOUS && $request->is_set('sid') && $request->variable('sid', '') === $user->session_id)
{
@@ -139,9 +149,9 @@ switch ($mode)
{
$set_time = time() - 31536000;
- foreach ($request->variable_names(phpbb_request_interface::COOKIE) as $cookie_name)
+ foreach ($request->variable_names(\phpbb\request\request_interface::COOKIE) as $cookie_name)
{
- $cookie_data = $request->variable($cookie_name, '', true, phpbb_request_interface::COOKIE);
+ $cookie_data = $request->variable($cookie_name, '', true, \phpbb\request\request_interface::COOKIE);
// Only delete board cookies, no other ones...
if (strpos($cookie_name, $config['cookie_name'] . '_') !== 0)
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index 1fa2030671..c6712db46c 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -191,7 +191,7 @@ if ($mark_read == 'topics')
'MESSAGE_TITLE' => $user->lang['INFORMATION'],
'MESSAGE_TEXT' => $user->lang['TOPICS_MARKED']
);
- $json_response = new phpbb_json_response();
+ $json_response = new \phpbb\json_response();
$json_response->send($data);
}
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index bc54a249a9..6880b6882d 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -716,9 +716,9 @@ if (!empty($topic_data['poll_start']))
// Cookie based guest tracking ... I don't like this but hum ho
// it's oft requested. This relies on "nice" users who don't feel
// the need to delete cookies to mess with results.
- if ($request->is_set($config['cookie_name'] . '_poll_' . $topic_id, phpbb_request_interface::COOKIE))
+ if ($request->is_set($config['cookie_name'] . '_poll_' . $topic_id, \phpbb\request\request_interface::COOKIE))
{
- $cur_voted_id = explode(',', $request->variable($config['cookie_name'] . '_poll_' . $topic_id, '', true, phpbb_request_interface::COOKIE));
+ $cur_voted_id = explode(',', $request->variable($config['cookie_name'] . '_poll_' . $topic_id, '', true, \phpbb\request\request_interface::COOKIE));
$cur_voted_id = array_map('intval', $cur_voted_id);
}
}
@@ -1012,7 +1012,7 @@ while ($row = $db->sql_fetchrow($result))
}
}
- $rowset[$row['post_id']] = array(
+ $rowset_data = array(
'hide_post' => (($row['foe'] || $row['post_visibility'] == ITEM_DELETED) && ($view != 'show' || $post_id != $row['post_id'])) ? true : false,
'post_id' => $row['post_id'],
@@ -1047,6 +1047,19 @@ while ($row = $db->sql_fetchrow($result))
'foe' => $row['foe'],
);
+ /**
+ * Modify the post rowset containing data to be displayed with posts
+ *
+ * @event core.viewtopic_post_rowset_data
+ * @var array rowset_data Array with the rowset data for this post
+ * @var array row Array with original user and post data
+ * @since 3.1-A1
+ */
+ $vars = array('rowset_data', 'row');
+ extract($phpbb_dispatcher->trigger_event('core.viewtopic_post_rowset_data', compact($vars)));
+
+ $rowset[$row['post_id']] = $rowset_data;
+
// Define the global bbcode bitfield, will be used to load bbcodes
$bbcode_bitfield = $bbcode_bitfield | base64_decode($row['bbcode_bitfield']);
diff --git a/tests/RUNNING_TESTS.md b/tests/RUNNING_TESTS.md
index f2688ab675..0778046141 100644
--- a/tests/RUNNING_TESTS.md
+++ b/tests/RUNNING_TESTS.md
@@ -57,7 +57,7 @@ found below. More information on configuration options can be found on the
wiki (see below).
<?php
- $dbms = 'phpbb_db_driver_mysqli';
+ $dbms = 'phpbb\db\driver\mysqli';
$dbhost = 'localhost';
$dbport = '';
$dbname = 'database';
diff --git a/tests/acp_board/auth_provider/invalid.php b/tests/acp_board/auth_provider/invalid.php
index c12851afe6..acce3b7e2d 100644
--- a/tests/acp_board/auth_provider/invalid.php
+++ b/tests/acp_board/auth_provider/invalid.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_auth_provider_acp_board_invalid
+namespace phpbb\auth\provider\acp;
+
+class board_invalid
{
}
diff --git a/tests/acp_board/auth_provider/valid.php b/tests/acp_board/auth_provider/valid.php
index 42b14cb0af..13ec1e3250 100644
--- a/tests/acp_board/auth_provider/valid.php
+++ b/tests/acp_board/auth_provider/valid.php
@@ -7,7 +7,9 @@
*
*/
-class phpbb_auth_provider_acp_board_valid extends phpbb_auth_provider_base
+namespace phpbb\auth\provider\acp;
+
+class board_valid extends \phpbb\auth\provider\base
{
public function login($username, $password)
{
diff --git a/tests/acp_board/select_auth_method_test.php b/tests/acp_board/select_auth_method_test.php
index 91aa5d1232..b943554564 100644
--- a/tests/acp_board/select_auth_method_test.php
+++ b/tests/acp_board/select_auth_method_test.php
@@ -31,8 +31,8 @@ class phpbb_acp_board_select_auth_method_test extends phpbb_test_case
$phpbb_container = new phpbb_mock_container_builder();
$phpbb_container->set('auth.provider_collection', array(
- 'auth.provider.acp_board_valid' => new phpbb_auth_provider_acp_board_valid,
- 'auth.provider.acp_board_invalid' => new phpbb_auth_provider_acp_board_invalid,
+ 'auth.provider.acp_board_valid' => new phpbb\auth\provider\acp\board_valid,
+ 'auth.provider.acp_board_invalid' => new phpbb\auth\provider\acp\board_invalid,
));
$this->acp_board = new acp_board();
diff --git a/tests/auth/fixtures/oauth_tokens.xml b/tests/auth/fixtures/oauth_tokens.xml
new file mode 100644
index 0000000000..9bfb5a4422
--- /dev/null
+++ b/tests/auth/fixtures/oauth_tokens.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<dataset>
+ <table name="phpbb_oauth_tokens">
+ <column>user_id</column>
+ <column>session_id</column>
+ <column>provider</column>
+ <column>oauth_token</column>
+ </table>
+</dataset>
+
diff --git a/tests/auth/provider_apache_test.php b/tests/auth/provider_apache_test.php
index 0ca6ef763e..e135a1f002 100644
--- a/tests/auth/provider_apache_test.php
+++ b/tests/auth/provider_apache_test.php
@@ -22,11 +22,11 @@ class phpbb_auth_provider_apache_test extends phpbb_database_test_case
global $phpbb_root_path, $phpEx;
$db = $this->new_dbal();
- $config = new phpbb_config(array());
- $this->request = $this->getMock('phpbb_request');
- $this->user = $this->getMock('phpbb_user');
+ $config = new \phpbb\config\config(array());
+ $this->request = $this->getMock('\phpbb\request\request');
+ $this->user = $this->getMock('\phpbb\user');
- $this->provider = new phpbb_auth_provider_apache($db, $config, $this->request, $this->user, $phpbb_root_path, $phpEx);
+ $this->provider = new \phpbb\auth\provider\apache($db, $config, $this->request, $this->user, $phpbb_root_path, $phpEx);
}
public function getDataSet()
@@ -43,7 +43,7 @@ class phpbb_auth_provider_apache_test extends phpbb_database_test_case
$this->request->expects($this->once())
->method('is_set')
->with('PHP_AUTH_USER',
- phpbb_request_interface::SERVER)
+ \phpbb\request\request_interface::SERVER)
->will($this->returnValue(true));
$this->request->expects($this->once())
->method('server')
@@ -61,7 +61,7 @@ class phpbb_auth_provider_apache_test extends phpbb_database_test_case
$this->request->expects($this->once())
->method('is_set')
->with('PHP_AUTH_USER',
- phpbb_request_interface::SERVER)
+ \phpbb\request\request_interface::SERVER)
->will($this->returnValue(true));
$this->request->expects($this->at(1))
->method('server')
@@ -93,7 +93,7 @@ class phpbb_auth_provider_apache_test extends phpbb_database_test_case
$this->request->expects($this->once())
->method('is_set')
->with('PHP_AUTH_USER',
- phpbb_request_interface::SERVER)
+ \phpbb\request\request_interface::SERVER)
->will($this->returnValue(true));
$this->request->expects($this->at(1))
->method('server')
@@ -194,7 +194,7 @@ class phpbb_auth_provider_apache_test extends phpbb_database_test_case
$this->request->expects($this->once())
->method('is_set')
->with('PHP_AUTH_USER',
- phpbb_request_interface::SERVER)
+ \phpbb\request\request_interface::SERVER)
->will($this->returnValue(true));
$this->request->expects($this->once())
->method('server')
diff --git a/tests/auth/provider_db_test.php b/tests/auth/provider_db_test.php
index d876683f84..140a28cd3d 100644
--- a/tests/auth/provider_db_test.php
+++ b/tests/auth/provider_db_test.php
@@ -21,14 +21,14 @@ class phpbb_auth_provider_db_test extends phpbb_database_test_case
global $phpbb_root_path, $phpEx;
$db = $this->new_dbal();
- $config = new phpbb_config(array(
+ $config = new \phpbb\config\config(array(
'ip_login_limit_max' => 0,
'ip_login_limit_use_forwarded' => 0,
'max_login_attempts' => 0,
));
- $request = $this->getMock('phpbb_request');
- $user = $this->getMock('phpbb_user');
- $provider = new phpbb_auth_provider_db($db, $config, $request, $user, $phpbb_root_path, $phpEx);
+ $request = $this->getMock('\phpbb\request\request');
+ $user = $this->getMock('\phpbb\user');
+ $provider = new \phpbb\auth\provider\db($db, $config, $request, $user, $phpbb_root_path, $phpEx);
$expected = array(
'status' => LOGIN_SUCCESS,
diff --git a/tests/auth/provider_oauth_token_storage_test.php b/tests/auth/provider_oauth_token_storage_test.php
new file mode 100644
index 0000000000..fdc08833a3
--- /dev/null
+++ b/tests/auth/provider_oauth_token_storage_test.php
@@ -0,0 +1,207 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+use OAuth\OAuth2\Token\StdOAuth2Token;
+
+class phpbb_auth_provider_oauth_token_storage_test extends phpbb_database_test_case
+{
+ protected $db;
+ protected $service_name;
+ protected $session_id;
+ protected $token_storage;
+ protected $token_storage_table;
+ protected $user;
+
+ protected function setup()
+ {
+ parent::setUp();
+
+ global $phpbb_root_path, $phpEx;
+
+ $this->db = $this->new_dbal();
+ $this->user = $this->getMock('\phpbb\user');
+ $this->service_name = 'auth.provider.oauth.service.testing';
+ $this->token_storage_table = 'phpbb_oauth_tokens';
+
+ // Give the user a session_id that we will remember
+ $this->session_id = '12345';
+ $this->user->data['session_id'] = $this->session_id;
+
+ // Set the user id to anonymous
+ $this->user->data['user_id'] = ANONYMOUS;
+
+ $this->token_storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->token_storage_table);
+ }
+
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/oauth_tokens.xml');
+ }
+
+ public static function retrieveAccessToken_data()
+ {
+ return array(
+ array(new StdOAuth2Token('access', 'refresh', StdOAuth2Token::EOL_NEVER_EXPIRES, array('extra' => 'param')), null),
+ array(null, 'OAuth\Common\Storage\Exception\TokenNotFoundException'),
+ );
+ }
+
+ /**
+ * @dataProvider retrieveAccessToken_data
+ */
+ public function test_retrieveAccessToken($cache_token, $exception)
+ {
+ if ($cache_token)
+ {
+ $this->token_storage->storeAccessToken($this->service_name, $cache_token);
+ $token = $cache_token;
+ }
+
+ $this->setExpectedException($exception);
+
+ $stored_token = $this->token_storage->retrieveAccessToken($this->service_name);
+ $this->assertEquals($token, $stored_token);
+ }
+
+ public function test_retrieveAccessToken_from_db()
+ {
+ $expected_token = new StdOAuth2Token('access', 'refresh', StdOAuth2Token::EOL_NEVER_EXPIRES);
+
+ // Store a token in the database
+ $temp_storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->token_storage_table);
+ $temp_storage->storeAccessToken($this->service_name, $expected_token);
+ unset($temp_storage);
+
+ // Test to see if the token can be retrieved
+ $stored_token = $this->token_storage->retrieveAccessToken($this->service_name);
+ $this->assertEquals($expected_token, $stored_token);
+ }
+
+ /**
+ * @dataProvider retrieveAccessToken_data
+ */
+ public function test_retrieve_access_token_by_session($cache_token, $exception)
+ {
+ if ($cache_token)
+ {
+ $this->token_storage->storeAccessToken($this->service_name, $cache_token);
+ $token = $cache_token;
+ }
+
+ $this->setExpectedException($exception);
+
+ $stored_token = $this->token_storage->retrieve_access_token_by_session($this->service_name);
+ $this->assertEquals($token, $stored_token);
+ }
+
+ public function test_retrieve_access_token_by_session_from_db()
+ {
+ $expected_token = new StdOAuth2Token('access', 'refresh', StdOAuth2Token::EOL_NEVER_EXPIRES);
+
+ // Store a token in the database
+ $temp_storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->token_storage_table);
+ $temp_storage->storeAccessToken($this->service_name, $expected_token);
+ unset($temp_storage);
+
+ // Test to see if the token can be retrieved
+ $stored_token = $this->token_storage->retrieve_access_token_by_session($this->service_name);
+ $this->assertEquals($expected_token, $stored_token);
+ }
+
+ public function test_storeAccessToken()
+ {
+ $token = new StdOAuth2Token('access', 'refresh', StdOAuth2Token::EOL_NEVER_EXPIRES, array('extra' => 'param') );
+ $this->token_storage->storeAccessToken($this->service_name, $token);
+
+ // Confirm that the token is cached
+ $extraParams = $this->token_storage->retrieveAccessToken($this->service_name)->getExtraParams();
+ $this->assertEquals( 'param', $extraParams['extra'] );
+ $this->assertEquals( 'access', $this->token_storage->retrieveAccessToken($this->service_name)->getAccessToken() );
+
+ $row = $this->get_token_row_by_session_id($this->session_id);
+
+ // The token is serialized before stored in the database
+ $this->assertEquals($this->token_storage->json_encode_token($token), $row['oauth_token']);
+ }
+
+ public static function hasAccessToken_data()
+ {
+ return array(
+ array(null, false),
+ array(new StdOAuth2Token('access', 'refresh', StdOAuth2Token::EOL_NEVER_EXPIRES, array('extra' => 'param') ), true),
+ );
+ }
+
+ /**
+ * @dataProvider hasAccessToken_data
+ */
+ public function test_hasAccessToken($token, $expected)
+ {
+ if ($token)
+ {
+ $this->token_storage->storeAccessToken($this->service_name, $token);
+ }
+
+ $has_access_token = $this->token_storage->hasAccessToken($this->service_name);
+ $this->assertEquals($expected, $has_access_token);
+ }
+
+ /**
+ * @dataProvider hasAccessToken_data
+ */
+ public function test_has_access_token_by_session($token, $expected)
+ {
+ if ($token)
+ {
+ $this->token_storage->storeAccessToken($this->service_name, $token);
+ }
+
+ $has_access_token = $this->token_storage->has_access_token_by_session($this->service_name);
+ $this->assertEquals($expected, $has_access_token);
+ }
+
+ public function test_clearToken()
+ {
+ $token = new StdOAuth2Token('access', 'refresh', StdOAuth2Token::EOL_NEVER_EXPIRES, array('extra' => 'param') );
+ $this->token_storage->storeAccessToken($this->service_name, $token);
+
+ $this->token_storage->clearToken($this->service_name);
+
+ // Check that the database has been cleared
+ $row = $this->get_token_row_by_session_id($this->session_id);
+ $this->assertFalse($row);
+
+ // Check that the token is no longer in memory
+ $this->assertFalse($this->token_storage->hasAccessToken($this->service_name));
+ }
+
+ public function test_set_user_id()
+ {
+ $token = new StdOAuth2Token('access', 'refresh', StdOAuth2Token::EOL_NEVER_EXPIRES, array('extra' => 'param') );
+ $this->token_storage->storeAccessToken($this->service_name, $token);
+
+ $new_user_id = ANONYMOUS + 1;
+ $this->token_storage->set_user_id($new_user_id);
+
+ $row = $this->get_token_row_by_session_id($this->session_id);
+ $this->assertEquals($new_user_id, $row['user_id']);
+ }
+
+ protected function get_token_row_by_session_id($session_id)
+ {
+ // Test that the token is stored in the database
+ $sql = 'SELECT * FROM phpbb_oauth_tokens
+ WHERE session_id = \'' . $this->db->sql_escape($session_id) . '\'';
+ $result = $this->db->sql_query($sql);
+ $row = $this->db->sql_fetchrow($result);
+ $this->db->sql_freeresult($result);
+
+ return $row;
+ }
+}
diff --git a/tests/avatar/driver/barfoo.php b/tests/avatar/driver/barfoo.php
index 0b701a4d70..11c100db36 100644
--- a/tests/avatar/driver/barfoo.php
+++ b/tests/avatar/driver/barfoo.php
@@ -1,6 +1,8 @@
<?php
-class phpbb_avatar_driver_barfoo extends phpbb_avatar_driver
+namespace phpbb\avatar\driver;
+
+class barfoo extends \phpbb\avatar\driver\driver
{
public function get_data($row)
{
diff --git a/tests/avatar/driver/foobar.php b/tests/avatar/driver/foobar.php
index 995f35818b..a1e7bdf7cc 100644
--- a/tests/avatar/driver/foobar.php
+++ b/tests/avatar/driver/foobar.php
@@ -1,6 +1,8 @@
<?php
-class phpbb_avatar_driver_foobar extends phpbb_avatar_driver
+namespace phpbb\avatar\driver;
+
+class foobar extends \phpbb\avatar\driver\driver
{
public function get_data($row)
{
diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php
index 4ebe79c9cd..ba1fb04b33 100644
--- a/tests/avatar/manager_test.php
+++ b/tests/avatar/manager_test.php
@@ -22,17 +22,17 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase
->will($this->returnArgument(0));
// Prepare dependencies for avatar manager and driver
- $config = new phpbb_config(array());
- $request = $this->getMock('phpbb_request');
- $cache = $this->getMock('phpbb_cache_driver_interface');
+ $config = new \phpbb\config\config(array());
+ $request = $this->getMock('\phpbb\request\request');
+ $cache = $this->getMock('\phpbb\cache\driver\driver_interface');
// $this->avatar_foobar will be needed later on
- $this->avatar_foobar = $this->getMock('phpbb_avatar_driver_foobar', array('get_name'), array($config, $phpbb_root_path, $phpEx, $cache));
+ $this->avatar_foobar = $this->getMock('\phpbb\avatar\driver\foobar', array('get_name'), array($config, $phpbb_root_path, $phpEx, $cache));
$this->avatar_foobar->expects($this->any())
->method('get_name')
->will($this->returnValue('avatar.driver.foobar'));
// barfoo driver can't be mocked with constructor arguments
- $this->avatar_barfoo = $this->getMock('phpbb_avatar_driver_barfoo', array('get_name'));
+ $this->avatar_barfoo = $this->getMock('\phpbb\avatar\driver\barfoo', array('get_name'));
$this->avatar_barfoo->expects($this->any())
->method('get_name')
->will($this->returnValue('avatar.driver.barfoo'));
@@ -40,7 +40,7 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase
foreach ($this->avatar_drivers() as $driver)
{
- $cur_avatar = $this->getMock('phpbb_avatar_driver_' . $driver, array('get_name'), array($config, $phpbb_root_path, $phpEx, $cache));
+ $cur_avatar = $this->getMock('\phpbb\avatar\driver\\' . $driver, array('get_name'), array($config, $phpbb_root_path, $phpEx, $cache));
$cur_avatar->expects($this->any())
->method('get_name')
->will($this->returnValue('avatar.driver.' . $driver));
@@ -52,7 +52,7 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase
$config['allow_avatar_' . get_class($this->avatar_barfoo)] = false;
// Set up avatar manager
- $this->manager = new phpbb_avatar_manager($config, $avatar_drivers, $this->phpbb_container);
+ $this->manager = new \phpbb\avatar\manager($config, $avatar_drivers, $this->phpbb_container);
}
protected function avatar_drivers()
@@ -203,7 +203,7 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase
{
$cleaned_row = array();
- $cleaned_row = phpbb_avatar_manager::clean_row($input);
+ $cleaned_row = \phpbb\avatar\manager::clean_row($input);
foreach ($output as $key => $null)
{
$this->assertArrayHasKey($key, $cleaned_row);
@@ -222,7 +222,7 @@ class phpbb_avatar_manager_test extends PHPUnit_Framework_TestCase
public function test_localize_errors()
{
- $user = $this->getMock('phpbb_user');
+ $user = $this->getMock('\phpbb\user');
$lang_array = array(
array('FOOBAR_OFF', 'foobar_off'),
array('FOOBAR_EXPLAIN', 'FOOBAR_EXPLAIN %s'),
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index 68cbb64c03..afb586435c 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -16,11 +16,11 @@ $table_prefix = 'phpbb_';
require_once $phpbb_root_path . 'includes/constants.php';
require_once $phpbb_root_path . 'phpbb/class_loader.' . $phpEx;
-$phpbb_class_loader_mock = new phpbb_class_loader('phpbb_mock_', $phpbb_root_path . '../tests/mock/', "php");
+$phpbb_class_loader_mock = new \phpbb\class_loader('phpbb_mock_', $phpbb_root_path . '../tests/mock/', "php");
$phpbb_class_loader_mock->register();
-$phpbb_class_loader_ext = new phpbb_class_loader('phpbb_ext_', $phpbb_root_path . 'ext/', "php");
+$phpbb_class_loader_ext = new \phpbb\class_loader('\\', $phpbb_root_path . 'ext/', "php");
$phpbb_class_loader_ext->register();
-$phpbb_class_loader = new phpbb_class_loader('phpbb_', $phpbb_root_path . 'phpbb/', "php");
+$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', $phpbb_root_path . 'phpbb/', "php");
$phpbb_class_loader->register();
require_once 'test_framework/phpbb_test_case_helpers.php';
diff --git a/tests/cache/apc_driver_test.php b/tests/cache/apc_driver_test.php
index 3380762878..51f3ac24b6 100644
--- a/tests/cache/apc_driver_test.php
+++ b/tests/cache/apc_driver_test.php
@@ -30,7 +30,7 @@ class phpbb_cache_apc_driver_test extends phpbb_cache_common_test_case
self::markTestSkipped('APC extension is not loaded');
}
- $php_ini = new phpbb_php_ini;
+ $php_ini = new \phpbb\php\ini;
if (!$php_ini->get_bool('apc.enabled'))
{
@@ -47,7 +47,7 @@ class phpbb_cache_apc_driver_test extends phpbb_cache_common_test_case
{
parent::setUp();
- $this->driver = new phpbb_cache_driver_apc;
+ $this->driver = new \phpbb\cache\driver\apc;
$this->driver->purge();
}
}
diff --git a/tests/cache/common_test_case.php b/tests/cache/common_test_case.php
index a5bc2bfda9..3fe10c63e1 100644
--- a/tests/cache/common_test_case.php
+++ b/tests/cache/common_test_case.php
@@ -65,9 +65,9 @@ abstract class phpbb_cache_common_test_case extends phpbb_database_test_case
public function test_cache_sql()
{
global $db, $cache, $phpbb_root_path, $phpEx;
- $config = new phpbb_config(array());
+ $config = new phpbb\config\config(array());
$db = $this->new_dbal();
- $cache = new phpbb_cache_service($this->driver, $config, $db, $phpbb_root_path, $phpEx);
+ $cache = new \phpbb\cache\service($this->driver, $config, $db, $phpbb_root_path, $phpEx);
$sql = "SELECT * FROM phpbb_config
WHERE config_name = 'foo'";
diff --git a/tests/cache/file_driver_test.php b/tests/cache/file_driver_test.php
index 745c6bb081..c0843e8ed9 100644
--- a/tests/cache/file_driver_test.php
+++ b/tests/cache/file_driver_test.php
@@ -36,7 +36,7 @@ class phpbb_cache_file_driver_test extends phpbb_cache_common_test_case
}
$this->create_cache_dir();
- $this->driver = new phpbb_cache_driver_file($this->cache_dir);
+ $this->driver = new \phpbb\cache\driver\file($this->cache_dir);
}
protected function tearDown()
diff --git a/tests/cache/null_driver_test.php b/tests/cache/null_driver_test.php
index 43a0cc806c..58e57f2b3a 100644
--- a/tests/cache/null_driver_test.php
+++ b/tests/cache/null_driver_test.php
@@ -20,7 +20,7 @@ class phpbb_cache_null_driver_test extends phpbb_database_test_case
{
parent::setUp();
- $this->driver = new phpbb_cache_driver_null;
+ $this->driver = new \phpbb\cache\driver\null;
}
public function test_get_put()
@@ -48,9 +48,9 @@ class phpbb_cache_null_driver_test extends phpbb_database_test_case
public function test_cache_sql()
{
global $db, $cache, $phpbb_root_path, $phpEx;
- $config = new phpbb_config(array());
+ $config = new phpbb\config\config(array());
$db = $this->new_dbal();
- $cache = new phpbb_cache_service($this->driver, $config, $db, $phpbb_root_path, $phpEx);
+ $cache = new \phpbb\cache\service($this->driver, $config, $db, $phpbb_root_path, $phpEx);
$sql = "SELECT * FROM phpbb_config
WHERE config_name = 'foo'";
diff --git a/tests/cache/redis_driver_test.php b/tests/cache/redis_driver_test.php
index 1308519a18..3d954dc0db 100644
--- a/tests/cache/redis_driver_test.php
+++ b/tests/cache/redis_driver_test.php
@@ -43,7 +43,7 @@ class phpbb_cache_redis_driver_test extends phpbb_cache_common_test_case
{
parent::setUp();
- $this->driver = new phpbb_cache_driver_redis(self::$config['host'], self::$config['port']);
+ $this->driver = new \phpbb\cache\driver\redis(self::$config['host'], self::$config['port']);
$this->driver->purge();
}
}
diff --git a/tests/class_loader/class_loader_test.php b/tests/class_loader/class_loader_test.php
index 2b55c1ff8d..6e551f658a 100644
--- a/tests/class_loader/class_loader_test.php
+++ b/tests/class_loader/class_loader_test.php
@@ -30,74 +30,68 @@ class phpbb_class_loader_test extends PHPUnit_Framework_TestCase
public function test_resolve_path()
{
$prefix = dirname(__FILE__) . '/';
- $class_loader = new phpbb_class_loader('phpbb_', $prefix . 'phpbb/');
+ $class_loader = new \phpbb\class_loader('phpbb\\', $prefix . 'phpbb/');
$prefix .= 'phpbb/';
$this->assertEquals(
- '',
- $class_loader->resolve_path('phpbb_dir'),
- 'Class with same name as a directory is unloadable'
- );
-
- $this->assertEquals(
$prefix . 'class_name.php',
- $class_loader->resolve_path('phpbb_class_name'),
+ $class_loader->resolve_path('\\phpbb\\class_name'),
'Top level class'
);
$this->assertEquals(
$prefix . 'dir/class_name.php',
- $class_loader->resolve_path('phpbb_dir_class_name'),
+ $class_loader->resolve_path('\\phpbb\\dir\\class_name'),
'Class in a directory'
);
$this->assertEquals(
$prefix . 'dir/subdir/class_name.php',
- $class_loader->resolve_path('phpbb_dir_subdir_class_name'),
+ $class_loader->resolve_path('\\phpbb\\dir\\subdir\\class_name'),
'Class in a sub-directory'
);
$this->assertEquals(
$prefix . 'dir2/dir2.php',
- $class_loader->resolve_path('phpbb_dir2'),
- 'Class with name of dir within dir (short class name)'
+ $class_loader->resolve_path('\\phpbb\\dir2\\dir2'),
+ 'Class with name of dir within dir'
);
}
public function test_resolve_cached()
{
$cache_map = array(
- 'class_loader_phpbb_' => array('phpbb_a_cached_name' => 'a/cached_name'),
- 'class_loader_phpbb_ext_' => array('phpbb_ext_foo' => 'foo'),
+ 'class_loader___phpbb__' => array('\\phpbb\\a\\cached_name' => 'a/cached_name'),
+ 'class_loader___' => array('\\phpbb\\ext\\foo' => 'foo'),
);
$cache = new phpbb_mock_cache($cache_map);
$prefix = dirname(__FILE__) . '/';
- $class_loader = new phpbb_class_loader('phpbb_', $prefix . 'phpbb/', 'php', $cache);
- $class_loader_ext = new phpbb_class_loader('phpbb_ext_', $prefix . 'phpbb/', 'php', $cache);
+ $class_loader = new \phpbb\class_loader('phpbb\\', $prefix . 'phpbb/', 'php', $cache);
+ $class_loader_ext = new \phpbb\class_loader('\\', $prefix . 'phpbb/', 'php', $cache);
$prefix .= 'phpbb/';
$this->assertEquals(
$prefix . 'dir/class_name.php',
- $class_loader->resolve_path('phpbb_dir_class_name'),
+ $class_loader->resolve_path('\\phpbb\\dir\\class_name'),
'Class in a directory'
);
- $this->assertFalse($class_loader->resolve_path('phpbb_ext_foo'));
- $this->assertFalse($class_loader_ext->resolve_path('phpbb_a_cached_name'));
+ $this->assertFalse($class_loader->resolve_path('\\phpbb\\ext\\foo'));
+ $this->assertFalse($class_loader_ext->resolve_path('\\phpbb\\a\\cached_name'));
$this->assertEquals(
$prefix . 'a/cached_name.php',
- $class_loader->resolve_path('phpbb_a_cached_name'),
+ $class_loader->resolve_path('\\phpbb\\a\\cached_name'),
'Cached class found'
);
$this->assertEquals(
$prefix . 'foo.php',
- $class_loader_ext->resolve_path('phpbb_ext_foo'),
+ $class_loader_ext->resolve_path('\\phpbb\\ext\\foo'),
'Cached class found in alternative loader'
);
- $cache_map['class_loader_phpbb_']['phpbb_dir_class_name'] = 'dir/class_name';
+ $cache_map['class_loader___phpbb__']['\\phpbb\\dir\\class_name'] = 'dir/class_name';
$cache->check($this, $cache_map);
}
}
diff --git a/tests/class_loader/phpbb/class_name.php b/tests/class_loader/phpbb/class_name.php
index e941173cdd..64a3fa646e 100644
--- a/tests/class_loader/phpbb/class_name.php
+++ b/tests/class_loader/phpbb/class_name.php
@@ -1,6 +1,8 @@
<?php
-class phpbb_class_name
+namespace phpbb;
+
+class class_name
{
}
diff --git a/tests/class_loader/phpbb/dir.php b/tests/class_loader/phpbb/dir.php
deleted file mode 100644
index 1c8930d8e7..0000000000
--- a/tests/class_loader/phpbb/dir.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-
-class phpbb_dir
-{
-}
-
diff --git a/tests/class_loader/phpbb/dir/class_name.php b/tests/class_loader/phpbb/dir/class_name.php
index 0675aa8fc5..1cd39a1181 100644
--- a/tests/class_loader/phpbb/dir/class_name.php
+++ b/tests/class_loader/phpbb/dir/class_name.php
@@ -1,6 +1,8 @@
<?php
-class phpbb_dir_class_name
+namespace phpbb\dir;
+
+class class_name
{
}
diff --git a/tests/class_loader/phpbb/dir/subdir/class_name.php b/tests/class_loader/phpbb/dir/subdir/class_name.php
index 7321a609cc..89affbc847 100644
--- a/tests/class_loader/phpbb/dir/subdir/class_name.php
+++ b/tests/class_loader/phpbb/dir/subdir/class_name.php
@@ -1,6 +1,8 @@
<?php
-class phpbb_dir_subdir_class_name
+namespace phpbb\dir\subdir;
+
+class class_name
{
}
diff --git a/tests/class_loader/phpbb/dir2/dir2.php b/tests/class_loader/phpbb/dir2/dir2.php
index 01cf4086ff..b273511fcd 100644
--- a/tests/class_loader/phpbb/dir2/dir2.php
+++ b/tests/class_loader/phpbb/dir2/dir2.php
@@ -1,6 +1,8 @@
<?php
-class phpbb_dir2
+namespace phpbb;
+
+class dir2
{
}
diff --git a/tests/config/config_test.php b/tests/config/config_test.php
index 5845cc4590..5373fcef5f 100644
--- a/tests/config/config_test.php
+++ b/tests/config/config_test.php
@@ -11,7 +11,7 @@ class phpbb_config_test extends phpbb_test_case
{
public function test_offset_exists()
{
- $config = new phpbb_config(array('foo' => 'bar'));
+ $config = new \phpbb\config\config(array('foo' => 'bar'));
$this->assertTrue(isset($config['foo']));
$this->assertFalse(isset($config['foobar']));
@@ -19,19 +19,19 @@ class phpbb_config_test extends phpbb_test_case
public function test_offset_get()
{
- $config = new phpbb_config(array('foo' => 'bar'));
+ $config = new \phpbb\config\config(array('foo' => 'bar'));
$this->assertEquals('bar', $config['foo']);
}
public function test_offset_get_missing()
{
- $config = new phpbb_config(array());
+ $config = new \phpbb\config\config(array());
$this->assertEquals('', $config['foo']);
}
public function test_offset_set()
{
- $config = new phpbb_config(array());
+ $config = new \phpbb\config\config(array());
$config['foo'] = 'x';
$this->assertEquals('x', $config['foo']);
}
@@ -39,20 +39,20 @@ class phpbb_config_test extends phpbb_test_case
public function test_offset_unset_fails()
{
$this->setExpectedTriggerError(E_USER_ERROR);
- $config = new phpbb_config(array('foo' => 'x'));
+ $config = new \phpbb\config\config(array('foo' => 'x'));
unset($config['foo']);
}
public function test_count()
{
- $config = new phpbb_config(array('foo' => 'bar'));
+ $config = new \phpbb\config\config(array('foo' => 'bar'));
$this->assertEquals(1, count($config));
}
public function test_iterate()
{
$vars = array('foo' => '23', 'bar' => '42');
- $config = new phpbb_config($vars);
+ $config = new \phpbb\config\config($vars);
$count = 0;
foreach ($config as $key => $value)
@@ -68,42 +68,42 @@ class phpbb_config_test extends phpbb_test_case
public function test_set_overwrite()
{
- $config = new phpbb_config(array('foo' => 'x'));
+ $config = new \phpbb\config\config(array('foo' => 'x'));
$config->set('foo', 'bar');
$this->assertEquals('bar', $config['foo']);
}
public function test_set_new()
{
- $config = new phpbb_config(array());
+ $config = new \phpbb\config\config(array());
$config->set('foo', 'bar');
$this->assertEquals('bar', $config['foo']);
}
public function test_set_atomic_overwrite()
{
- $config = new phpbb_config(array('foo' => 'bar'));
+ $config = new \phpbb\config\config(array('foo' => 'bar'));
$this->assertTrue($config->set_atomic('foo', 'bar', '23'));
$this->assertEquals('23', $config['foo']);
}
public function test_set_atomic_new()
{
- $config = new phpbb_config(array());
+ $config = new \phpbb\config\config(array());
$this->assertTrue($config->set_atomic('foo', false, '23'));
$this->assertEquals('23', $config['foo']);
}
public function test_set_atomic_failure()
{
- $config = new phpbb_config(array('foo' => 'bar'));
+ $config = new \phpbb\config\config(array('foo' => 'bar'));
$this->assertFalse($config->set_atomic('foo', 'wrong', '23'));
$this->assertEquals('bar', $config['foo']);
}
public function test_increment()
{
- $config = new phpbb_config(array('foo' => '23'));
+ $config = new \phpbb\config\config(array('foo' => '23'));
$config->increment('foo', 3);
$this->assertEquals(26, $config['foo']);
$config->increment('foo', 1);
@@ -112,7 +112,7 @@ class phpbb_config_test extends phpbb_test_case
public function test_delete()
{
- $config = new phpbb_config(array('foo' => 'bar'));
+ $config = new \phpbb\config\config(array('foo' => 'bar'));
$config->delete('foo');
$this->assertFalse(isset($config['foo']));
diff --git a/tests/config/db_test.php b/tests/config/db_test.php
index 0b8f73d53a..dd1c88f707 100644
--- a/tests/config/db_test.php
+++ b/tests/config/db_test.php
@@ -24,7 +24,7 @@ class phpbb_config_db_test extends phpbb_database_test_case
$this->cache = new phpbb_mock_cache;
$this->db = $this->new_dbal();
- $this->config = new phpbb_config_db($this->db, $this->cache, 'phpbb_config');
+ $this->config = new \phpbb\config\db($this->db, $this->cache, 'phpbb_config');
}
public function test_load_config()
@@ -36,7 +36,7 @@ class phpbb_config_db_test extends phpbb_database_test_case
public function test_load_cached()
{
$cache = new phpbb_mock_cache(array('config' => array('x' => 'y')));
- $this->config = new phpbb_config_db($this->db, $cache, 'phpbb_config');
+ $this->config = new \phpbb\config\db($this->db, $cache, 'phpbb_config');
$this->assertTrue(!isset($this->config['foo']));
$this->assertEquals('42', $this->config['bar']);
@@ -49,7 +49,7 @@ class phpbb_config_db_test extends phpbb_database_test_case
$this->config['foo'] = 'x'; // temporary set
$this->assertEquals('x', $this->config['foo']);
- $config2 = new phpbb_config_db($this->db, $this->cache, 'phpbb_config');
+ $config2 = new \phpbb\config\db($this->db, $this->cache, 'phpbb_config');
$this->assertEquals('23', $config2['foo']);
}
@@ -59,7 +59,7 @@ class phpbb_config_db_test extends phpbb_database_test_case
$this->assertEquals('17', $this->config['foo']);
// re-read config and populate cache
- $config2 = new phpbb_config_db($this->db, $this->cache, 'phpbb_config');
+ $config2 = new \phpbb\config\db($this->db, $this->cache, 'phpbb_config');
$this->cache->checkVar($this, 'config', array('foo' => '17'));
}
@@ -68,7 +68,7 @@ class phpbb_config_db_test extends phpbb_database_test_case
$this->config->set('bar', '17', false);
// re-read config and populate cache
- $config2 = new phpbb_config_db($this->db, $this->cache, 'phpbb_config');
+ $config2 = new \phpbb\config\db($this->db, $this->cache, 'phpbb_config');
$this->cache->checkVar($this, 'config', array('foo' => '23'));
}
@@ -78,7 +78,7 @@ class phpbb_config_db_test extends phpbb_database_test_case
$this->assertEquals('5', $this->config['foobar']);
// re-read config and populate cache
- $config2 = new phpbb_config_db($this->db, $this->cache, 'phpbb_config');
+ $config2 = new \phpbb\config\db($this->db, $this->cache, 'phpbb_config');
$this->cache->checkVar($this, 'config', array('foo' => '23', 'foobar' => '5'));
}
@@ -88,7 +88,7 @@ class phpbb_config_db_test extends phpbb_database_test_case
$this->assertEquals('5', $this->config['foobar']);
// re-read config and populate cache
- $config2 = new phpbb_config_db($this->db, $this->cache, 'phpbb_config');
+ $config2 = new \phpbb\config\db($this->db, $this->cache, 'phpbb_config');
$this->cache->checkVar($this, 'config', array('foo' => '23'));
}
@@ -133,7 +133,7 @@ class phpbb_config_db_test extends phpbb_database_test_case
// re-read config and populate cache
$cache2 = new phpbb_mock_cache;
- $config2 = new phpbb_config_db($this->db, $cache2, 'phpbb_config');
+ $config2 = new \phpbb\config\db($this->db, $cache2, 'phpbb_config');
$cache2->checkVarUnset($this, 'foo');
$this->assertFalse(isset($config2['foo']));
}
@@ -145,7 +145,7 @@ class phpbb_config_db_test extends phpbb_database_test_case
$this->config->delete('bar');
$this->cache->checkVarUnset($this, 'bar');
$this->assertFalse(isset($this->config['bar']));
-
+
$this->config->set('bar', 'new bar', false);
$this->assertEquals('new bar', $this->config['bar']);
}
@@ -157,7 +157,7 @@ class phpbb_config_db_test extends phpbb_database_test_case
$this->config->delete('foo');
$this->cache->checkVarUnset($this, 'foo');
$this->assertFalse(isset($this->config['foo']));
-
+
$this->config->set('foo', 'new foo', true);
$this->assertEquals('new foo', $this->config['foo']);
}
diff --git a/tests/config/db_text_test.php b/tests/config/db_text_test.php
index 4818bba8c9..354c0efacf 100644
--- a/tests/config/db_text_test.php
+++ b/tests/config/db_text_test.php
@@ -22,7 +22,7 @@ class phpbb_config_db_text_test extends phpbb_database_test_case
parent::setUp();
$this->db = $this->new_dbal();
- $this->config_text = new phpbb_config_db_text($this->db, 'phpbb_config_text');
+ $this->config_text = new \phpbb\config\db_text($this->db, 'phpbb_config_text');
}
public function test_get()
diff --git a/tests/content_visibility/delete_post_test.php b/tests/content_visibility/delete_post_test.php
index 6234aac9ad..b2bdcb3b49 100644
--- a/tests/content_visibility/delete_post_test.php
+++ b/tests/content_visibility/delete_post_test.php
@@ -267,21 +267,21 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
$config['search_type'] = 'phpbb_mock_search';
$cache = new phpbb_mock_cache;
$db = $this->new_dbal();
- set_config_count(null, null, null, new phpbb_config(array('num_posts' => 3, 'num_topics' => 1)));
+ set_config_count(null, null, null, new \phpbb\config\config(array('num_posts' => 3, 'num_topics' => 1)));
// Create auth mock
- $auth = $this->getMock('phpbb_auth');
+ $auth = $this->getMock('\phpbb\auth\auth');
$auth->expects($this->any())
->method('acl_get')
->with($this->stringContains('_'), $this->anything())
->will($this->returnValueMap(array(
array('m_approve', 1, true),
)));
- $user = $this->getMock('phpbb_user');
+ $user = $this->getMock('\phpbb\user');
$phpbb_container = new phpbb_mock_container_builder();
$phpbb_container->set('notification_manager', new phpbb_mock_notification_manager());
- $phpbb_container->set('content.visibility', new phpbb_content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE));
+ $phpbb_container->set('content.visibility', new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE));
delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $reason);
diff --git a/tests/content_visibility/get_forums_visibility_sql_test.php b/tests/content_visibility/get_forums_visibility_sql_test.php
index aa44fa4013..22f210c406 100644
--- a/tests/content_visibility/get_forums_visibility_sql_test.php
+++ b/tests/content_visibility/get_forums_visibility_sql_test.php
@@ -125,13 +125,13 @@ class phpbb_content_visibility_get_forums_visibility_sql_test extends phpbb_data
$db = $this->new_dbal();
// Create auth mock
- $auth = $this->getMock('phpbb_auth');
+ $auth = $this->getMock('\phpbb\auth\auth');
$auth->expects($this->any())
->method('acl_getf')
->with($this->stringContains('_'), $this->anything())
->will($this->returnValueMap($permissions));
- $user = $this->getMock('phpbb_user');
- $content_visibility = new phpbb_content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);
+ $user = $this->getMock('\phpbb\user');
+ $content_visibility = new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);
$result = $db->sql_query('SELECT ' . $mode . '_id
FROM ' . $table . '
diff --git a/tests/content_visibility/get_global_visibility_sql_test.php b/tests/content_visibility/get_global_visibility_sql_test.php
index 0f019ffa50..9488a8c0b3 100644
--- a/tests/content_visibility/get_global_visibility_sql_test.php
+++ b/tests/content_visibility/get_global_visibility_sql_test.php
@@ -125,13 +125,13 @@ class phpbb_content_visibility_get_global_visibility_sql_test extends phpbb_data
$db = $this->new_dbal();
// Create auth mock
- $auth = $this->getMock('phpbb_auth');
+ $auth = $this->getMock('\phpbb\auth\auth');
$auth->expects($this->any())
->method('acl_getf')
->with($this->stringContains('_'), $this->anything())
->will($this->returnValueMap($permissions));
- $user = $this->getMock('phpbb_user');
- $content_visibility = new phpbb_content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);
+ $user = $this->getMock('\phpbb\user');
+ $content_visibility = new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);
$result = $db->sql_query('SELECT ' . $mode . '_id
FROM ' . $table . '
diff --git a/tests/content_visibility/get_visibility_sql_test.php b/tests/content_visibility/get_visibility_sql_test.php
index cc6c10c649..111e735650 100644
--- a/tests/content_visibility/get_visibility_sql_test.php
+++ b/tests/content_visibility/get_visibility_sql_test.php
@@ -72,13 +72,13 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te
$db = $this->new_dbal();
// Create auth mock
- $auth = $this->getMock('phpbb_auth');
+ $auth = $this->getMock('\phpbb\auth\auth');
$auth->expects($this->any())
->method('acl_get')
->with($this->stringContains('_'), $this->anything())
->will($this->returnValueMap($permissions));
- $user = $this->getMock('phpbb_user');
- $content_visibility = new phpbb_content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);
+ $user = $this->getMock('\phpbb\user');
+ $content_visibility = new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);
$result = $db->sql_query('SELECT ' . $mode . '_id
FROM ' . $table . '
diff --git a/tests/content_visibility/set_post_visibility_test.php b/tests/content_visibility/set_post_visibility_test.php
index 81abf56c75..f81b83ff86 100644
--- a/tests/content_visibility/set_post_visibility_test.php
+++ b/tests/content_visibility/set_post_visibility_test.php
@@ -119,9 +119,9 @@ class phpbb_content_visibility_set_post_visibility_test extends phpbb_database_t
$cache = new phpbb_mock_cache;
$db = $this->new_dbal();
- $auth = $this->getMock('phpbb_auth');
- $user = $this->getMock('phpbb_user');
- $content_visibility = new phpbb_content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);
+ $auth = $this->getMock('\phpbb\auth\auth');
+ $user = $this->getMock('\phpbb\user');
+ $content_visibility = new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);
$content_visibility->set_post_visibility($visibility, $post_id, $topic_id, $forum_id, $user_id, $time, $reason, $is_starter, $is_latest);
diff --git a/tests/content_visibility/set_topic_visibility_test.php b/tests/content_visibility/set_topic_visibility_test.php
index 6b5d884a2b..92b1253a15 100644
--- a/tests/content_visibility/set_topic_visibility_test.php
+++ b/tests/content_visibility/set_topic_visibility_test.php
@@ -83,9 +83,9 @@ class phpbb_content_visibility_set_topic_visibility_test extends phpbb_database_
$cache = new phpbb_mock_cache;
$db = $this->new_dbal();
- $auth = $this->getMock('phpbb_auth');
- $user = $this->getMock('phpbb_user');
- $content_visibility = new phpbb_content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);
+ $auth = $this->getMock('\phpbb\auth\auth');
+ $user = $this->getMock('\phpbb\user');
+ $content_visibility = new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);
$content_visibility->set_topic_visibility($visibility, $topic_id, $forum_id, $user_id, $time, $reason, $force_update_all);
diff --git a/tests/controller/config/services.yml b/tests/controller/config/services.yml
index f1bd047489..e4412af3d7 100644
--- a/tests/controller/config/services.yml
+++ b/tests/controller/config/services.yml
@@ -1,3 +1,3 @@
services:
core_foo.controller:
- class: phpbb_controller_foo
+ class: phpbb\controller\foo
diff --git a/tests/controller/controller_test.php b/tests/controller/controller_test.php
index dfc4f80469..10fced05a2 100644
--- a/tests/controller/controller_test.php
+++ b/tests/controller/controller_test.php
@@ -31,7 +31,7 @@ class phpbb_controller_controller_test extends phpbb_test_case
public function test_provider()
{
- $provider = new phpbb_controller_provider;
+ $provider = new \phpbb\controller\provider;
$routes = $provider
->import_paths_from_finder($this->extension_manager->get_finder())
->find('./tests/controller/');
@@ -53,24 +53,24 @@ class phpbb_controller_controller_test extends phpbb_test_case
// Autoloading classes within the tests folder does not work
// so I'll include them manually.
- if (!class_exists('phpbb_ext_foo_controller'))
+ if (!class_exists('foo\\controller'))
{
include(__DIR__.'/ext/foo/controller.php');
}
- if (!class_exists('phpbb_controller_foo'))
+ if (!class_exists('phpbb\\controller\\foo'))
{
include(__DIR__.'/phpbb/controller/foo.php');
}
- $resolver = new phpbb_controller_resolver(new phpbb_user, $container);
+ $resolver = new \phpbb\controller\resolver(new \phpbb\user, $container);
$symfony_request = new Request();
$symfony_request->attributes->set('_controller', 'foo.controller:handle');
- $this->assertEquals($resolver->getController($symfony_request), array(new phpbb_ext_foo_controller, 'handle'));
+ $this->assertEquals($resolver->getController($symfony_request), array(new foo\controller, 'handle'));
$symfony_request = new Request();
$symfony_request->attributes->set('_controller', 'core_foo.controller:bar');
- $this->assertEquals($resolver->getController($symfony_request), array(new phpbb_controller_foo, 'bar'));
+ $this->assertEquals($resolver->getController($symfony_request), array(new phpbb\controller\foo, 'bar'));
}
}
diff --git a/tests/controller/ext/foo/config/services.yml b/tests/controller/ext/foo/config/services.yml
index ce0e18c610..9ed67d5bc2 100644
--- a/tests/controller/ext/foo/config/services.yml
+++ b/tests/controller/ext/foo/config/services.yml
@@ -1,3 +1,3 @@
services:
foo.controller:
- class: phpbb_ext_foo_controller
+ class: foo\controller
diff --git a/tests/controller/ext/foo/controller.php b/tests/controller/ext/foo/controller.php
index cfc5c20622..ce2233b3c9 100644
--- a/tests/controller/ext/foo/controller.php
+++ b/tests/controller/ext/foo/controller.php
@@ -1,8 +1,10 @@
<?php
+namespace foo;
+
use Symfony\Component\HttpFoundation\Response;
-class phpbb_ext_foo_controller
+class controller
{
/**
* Handle method
diff --git a/tests/controller/helper_url_test.php b/tests/controller/helper_url_test.php
index 6686b77e8f..4ea177074f 100644
--- a/tests/controller/helper_url_test.php
+++ b/tests/controller/helper_url_test.php
@@ -12,50 +12,106 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
class phpbb_controller_helper_url_test extends phpbb_test_case
{
- public function helper_url_data()
+ public function helper_url_data_no_rewrite()
{
return array(
- array('foo/bar?t=1&amp;f=2', false, true, false, 'app.php?t=1&amp;f=2&amp;controller=foo/bar', 'parameters in url-argument'),
- array('foo/bar', 't=1&amp;f=2', true, false, 'app.php?controller=foo/bar&amp;t=1&amp;f=2', 'parameters in params-argument using amp'),
- array('foo/bar', 't=1&f=2', false, false, 'app.php?controller=foo/bar&t=1&f=2', 'parameters in params-argument using &'),
- array('foo/bar', array('t' => 1, 'f' => 2), true, false, 'app.php?controller=foo/bar&amp;t=1&amp;f=2', 'parameters in params-argument as array'),
+ array('foo/bar?t=1&amp;f=2', false, true, false, 'app.php/foo/bar?t=1&amp;f=2', 'parameters in url-argument'),
+ array('foo/bar', 't=1&amp;f=2', true, false, 'app.php/foo/bar?t=1&amp;f=2', 'parameters in params-argument using amp'),
+ array('foo/bar', 't=1&f=2', false, false, 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument using &'),
+ array('foo/bar', array('t' => 1, 'f' => 2), true, false, 'app.php/foo/bar?t=1&amp;f=2', 'parameters in params-argument as array'),
// Custom sid parameter
- array('foo/bar', 't=1&amp;f=2', true, 'custom-sid', 'app.php?controller=foo/bar&amp;t=1&amp;f=2&amp;sid=custom-sid', 'using session_id'),
+ array('foo/bar', 't=1&amp;f=2', true, 'custom-sid', 'app.php/foo/bar?t=1&amp;f=2&amp;sid=custom-sid', 'using session_id'),
// Testing anchors
- array('foo/bar?t=1&amp;f=2#anchor', false, true, false, 'app.php?t=1&amp;f=2&amp;controller=foo/bar#anchor', 'anchor in url-argument'),
- array('foo/bar', 't=1&amp;f=2#anchor', true, false, 'app.php?controller=foo/bar&amp;t=1&amp;f=2#anchor', 'anchor in params-argument'),
- array('foo/bar', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'app.php?controller=foo/bar&amp;t=1&amp;f=2#anchor', 'anchor in params-argument (array)'),
+ array('foo/bar?t=1&amp;f=2#anchor', false, true, false, 'app.php/foo/bar?t=1&amp;f=2#anchor', 'anchor in url-argument'),
+ array('foo/bar', 't=1&amp;f=2#anchor', true, false, 'app.php/foo/bar?t=1&amp;f=2#anchor', 'anchor in params-argument'),
+ array('foo/bar', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'app.php/foo/bar?t=1&amp;f=2#anchor', 'anchor in params-argument (array)'),
// Anchors and custom sid
- array('foo/bar?t=1&amp;f=2#anchor', false, true, 'custom-sid', 'app.php?t=1&amp;f=2&amp;controller=foo/bar&amp;sid=custom-sid#anchor', 'anchor in url-argument using session_id'),
- array('foo/bar', 't=1&amp;f=2#anchor', true, 'custom-sid', 'app.php?controller=foo/bar&amp;t=1&amp;f=2&amp;sid=custom-sid#anchor', 'anchor in params-argument using session_id'),
- array('foo/bar', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'app.php?controller=foo/bar&amp;t=1&amp;f=2&amp;sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
+ array('foo/bar?t=1&amp;f=2#anchor', false, true, 'custom-sid', 'app.php/foo/bar?t=1&amp;f=2&amp;sid=custom-sid#anchor', 'anchor in url-argument using session_id'),
+ array('foo/bar', 't=1&amp;f=2#anchor', true, 'custom-sid', 'app.php/foo/bar?t=1&amp;f=2&amp;sid=custom-sid#anchor', 'anchor in params-argument using session_id'),
+ array('foo/bar', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'app.php/foo/bar?t=1&amp;f=2&amp;sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
// Empty parameters should not append the &amp;
- array('foo/bar', false, true, false, 'app.php?controller=foo/bar', 'no params using bool false'),
- array('foo/bar', '', true, false, 'app.php?controller=foo/bar', 'no params using empty string'),
- array('foo/bar', array(), true, false, 'app.php?controller=foo/bar', 'no params using empty array'),
+ array('foo/bar', false, true, false, 'app.php/foo/bar', 'no params using bool false'),
+ array('foo/bar', '', true, false, 'app.php/foo/bar', 'no params using empty string'),
+ array('foo/bar', array(), true, false, 'app.php/foo/bar', 'no params using empty array'),
);
}
/**
- * @dataProvider helper_url_data
+ * @dataProvider helper_url_data_no_rewrite()
*/
- public function test_helper_url($route, $params, $is_amp, $session_id, $expected, $description)
+ public function test_helper_url_no_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
{
global $phpbb_dispatcher, $phpbb_root_path, $phpEx;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher;
- $this->style_resource_locator = new phpbb_style_resource_locator();
- $this->user = $this->getMock('phpbb_user');
- $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $this->user, new phpbb_template_context());
- $this->style_resource_locator = new phpbb_style_resource_locator();
- $this->style_provider = new phpbb_style_path_provider();
- $this->style = new phpbb_style($phpbb_root_path, $phpEx, new phpbb_config(array()), $this->user, $this->style_resource_locator, $this->style_provider, $this->template);
-
- $helper = new phpbb_controller_helper($this->template, $this->user, '', 'php');
+ $this->user = $this->getMock('\phpbb\user');
+ $phpbb_filesystem = new \phpbb\filesystem(
+ new \phpbb\symfony_request(
+ new phpbb_mock_request()
+ ),
+ $phpbb_root_path,
+ $phpEx
+ );
+ $this->template = new phpbb\template\twig\twig($phpbb_filesystem, $config, $this->user, new \phpbb\template\context());
+
+ // We don't use mod_rewrite in these tests
+ $config = new \phpbb\config\config(array('enable_mod_rewrite' => '0'));
+ $helper = new \phpbb\controller\helper($this->template, $this->user, $config, '', 'php');
+ $this->assertEquals($helper->url($route, $params, $is_amp, $session_id), $expected);
+ }
+
+ public function helper_url_data_with_rewrite()
+ {
+ return array(
+ array('foo/bar?t=1&amp;f=2', false, true, false, 'foo/bar?t=1&amp;f=2', 'parameters in url-argument'),
+ array('foo/bar', 't=1&amp;f=2', true, false, 'foo/bar?t=1&amp;f=2', 'parameters in params-argument using amp'),
+ array('foo/bar', 't=1&f=2', false, false, 'foo/bar?t=1&f=2', 'parameters in params-argument using &'),
+ array('foo/bar', array('t' => 1, 'f' => 2), true, false, 'foo/bar?t=1&amp;f=2', 'parameters in params-argument as array'),
+
+ // Custom sid parameter
+ array('foo/bar', 't=1&amp;f=2', true, 'custom-sid', 'foo/bar?t=1&amp;f=2&amp;sid=custom-sid', 'using session_id'),
+
+ // Testing anchors
+ array('foo/bar?t=1&amp;f=2#anchor', false, true, false, 'foo/bar?t=1&amp;f=2#anchor', 'anchor in url-argument'),
+ array('foo/bar', 't=1&amp;f=2#anchor', true, false, 'foo/bar?t=1&amp;f=2#anchor', 'anchor in params-argument'),
+ array('foo/bar', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'foo/bar?t=1&amp;f=2#anchor', 'anchor in params-argument (array)'),
+
+ // Anchors and custom sid
+ array('foo/bar?t=1&amp;f=2#anchor', false, true, 'custom-sid', 'foo/bar?t=1&amp;f=2&amp;sid=custom-sid#anchor', 'anchor in url-argument using session_id'),
+ array('foo/bar', 't=1&amp;f=2#anchor', true, 'custom-sid', 'foo/bar?t=1&amp;f=2&amp;sid=custom-sid#anchor', 'anchor in params-argument using session_id'),
+ array('foo/bar', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'foo/bar?t=1&amp;f=2&amp;sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'),
+
+ // Empty parameters should not append the &amp;
+ array('foo/bar', false, true, false, 'foo/bar', 'no params using bool false'),
+ array('foo/bar', '', true, false, 'foo/bar', 'no params using empty string'),
+ array('foo/bar', array(), true, false, 'foo/bar', 'no params using empty array'),
+ );
+ }
+
+ /**
+ * @dataProvider helper_url_data_with_rewrite()
+ */
+ public function test_helper_url_with_rewrite($route, $params, $is_amp, $session_id, $expected, $description)
+ {
+ global $phpbb_dispatcher, $phpbb_root_path, $phpEx;
+
+ $phpbb_dispatcher = new phpbb_mock_event_dispatcher;
+ $this->user = $this->getMock('\phpbb\user');
+ $phpbb_filesystem = new \phpbb\filesystem(
+ new \phpbb\symfony_request(
+ new phpbb_mock_request()
+ ),
+ $phpbb_root_path,
+ $phpEx
+ );
+ $this->template = new \phpbb\template\twig\twig($phpbb_filesystem, $config, $this->user, new \phpbb\template\context());
+
+ $config = new \phpbb\config\config(array('enable_mod_rewrite' => '1'));
+ $helper = new \phpbb\controller\helper($this->template, $this->user, $config, '', 'php');
$this->assertEquals($helper->url($route, $params, $is_amp, $session_id), $expected);
}
}
diff --git a/tests/controller/phpbb/controller/foo.php b/tests/controller/phpbb/controller/foo.php
index 04576e16c4..98669f428f 100644
--- a/tests/controller/phpbb/controller/foo.php
+++ b/tests/controller/phpbb/controller/foo.php
@@ -1,8 +1,10 @@
<?php
+namespace phpbb\controller;
+
use Symfony\Component\HttpFoundation\Response;
-class phpbb_controller_foo
+class foo
{
/**
* Bar method
diff --git a/tests/cron/ext/testext/cron/dummy_task.php b/tests/cron/ext/testext/cron/dummy_task.php
index 3e81db1895..8cdb6b09d5 100644
--- a/tests/cron/ext/testext/cron/dummy_task.php
+++ b/tests/cron/ext/testext/cron/dummy_task.php
@@ -7,7 +7,7 @@
*
*/
-class phpbb_ext_testext_cron_dummy_task extends phpbb_cron_task_base
+class phpbb_ext_testext_cron_dummy_task extends \phpbb\cron\task\base
{
static public $was_run = 0;
diff --git a/tests/cron/includes/cron/task/core/dummy_task.php b/tests/cron/includes/cron/task/core/dummy_task.php
index c94455603f..c34684701b 100644
--- a/tests/cron/includes/cron/task/core/dummy_task.php
+++ b/tests/cron/includes/cron/task/core/dummy_task.php
@@ -7,7 +7,7 @@
*
*/
-class phpbb_cron_task_core_dummy_task extends phpbb_cron_task_base
+class phpbb_cron_task_core_dummy_task extends \phpbb\cron\task\base
{
static public $was_run = 0;
diff --git a/tests/cron/includes/cron/task/core/second_dummy_task.php b/tests/cron/includes/cron/task/core/second_dummy_task.php
index 77ef6f70ed..1b212ab05d 100644
--- a/tests/cron/includes/cron/task/core/second_dummy_task.php
+++ b/tests/cron/includes/cron/task/core/second_dummy_task.php
@@ -7,7 +7,7 @@
*
*/
-class phpbb_cron_task_core_second_dummy_task extends phpbb_cron_task_base
+class phpbb_cron_task_core_second_dummy_task extends \phpbb\cron\task\base
{
static public $was_run = 0;
diff --git a/tests/cron/manager_test.php b/tests/cron/manager_test.php
index 3c541be2a6..713f44c1e2 100644
--- a/tests/cron/manager_test.php
+++ b/tests/cron/manager_test.php
@@ -29,7 +29,7 @@ class phpbb_cron_manager_test extends PHPUnit_Framework_TestCase
public function test_manager_finds_shipped_task_by_name()
{
$task = $this->manager->find_task($this->task_name);
- $this->assertInstanceOf('phpbb_cron_task_wrapper', $task);
+ $this->assertInstanceOf('\phpbb\cron\task\wrapper', $task);
$this->assertEquals($this->task_name, $task->get_name());
}
@@ -42,7 +42,7 @@ class phpbb_cron_manager_test extends PHPUnit_Framework_TestCase
public function test_manager_finds_one_ready_task()
{
$task = $this->manager->find_one_ready_task();
- $this->assertInstanceOf('phpbb_cron_task_wrapper', $task);
+ $this->assertInstanceOf('\phpbb\cron\task\wrapper', $task);
}
public function test_manager_finds_only_ready_tasks()
@@ -71,6 +71,6 @@ class phpbb_cron_manager_test extends PHPUnit_Framework_TestCase
{
global $phpbb_root_path, $phpEx;
- return new phpbb_cron_manager($tasks, $phpbb_root_path, $phpEx);
+ return new \phpbb\cron\manager($tasks, $phpbb_root_path, $phpEx);
}
}
diff --git a/tests/cron/tasks/simple_not_runnable.php b/tests/cron/tasks/simple_not_runnable.php
index 56d484eacd..4951b5b4b9 100644
--- a/tests/cron/tasks/simple_not_runnable.php
+++ b/tests/cron/tasks/simple_not_runnable.php
@@ -1,6 +1,6 @@
<?php
-class phpbb_cron_task_core_simple_not_runnable extends phpbb_cron_task_base
+class phpbb_cron_task_core_simple_not_runnable extends \phpbb\cron\task\base
{
public function get_name()
{
diff --git a/tests/cron/tasks/simple_ready.php b/tests/cron/tasks/simple_ready.php
index 8aa0507406..245d9ba738 100644
--- a/tests/cron/tasks/simple_ready.php
+++ b/tests/cron/tasks/simple_ready.php
@@ -1,6 +1,6 @@
<?php
-class phpbb_cron_task_core_simple_ready extends phpbb_cron_task_base
+class phpbb_cron_task_core_simple_ready extends \phpbb\cron\task\base
{
public function get_name()
{
diff --git a/tests/cron/tasks/simple_should_not_run.php b/tests/cron/tasks/simple_should_not_run.php
index 58f6df2616..7bd9df31b6 100644
--- a/tests/cron/tasks/simple_should_not_run.php
+++ b/tests/cron/tasks/simple_should_not_run.php
@@ -1,6 +1,6 @@
<?php
-class phpbb_cron_task_core_simple_should_not_run extends phpbb_cron_task_base
+class phpbb_cron_task_core_simple_should_not_run extends \phpbb\cron\task\base
{
public function get_name()
{
diff --git a/tests/datetime/from_format_test.php b/tests/datetime/from_format_test.php
index 2d97672878..34f7f9ae44 100644
--- a/tests/datetime/from_format_test.php
+++ b/tests/datetime/from_format_test.php
@@ -35,7 +35,7 @@ class phpbb_datetime_from_format_test extends phpbb_test_case
{
global $user;
- $user = new phpbb_user();
+ $user = new \phpbb\user();
$user->timezone = new DateTimeZone($timezone);
$user->lang['datetime'] = array(
'TODAY' => 'Today',
diff --git a/tests/dbal/auto_increment_test.php b/tests/dbal/auto_increment_test.php
index 077bfad933..2196292e83 100644
--- a/tests/dbal/auto_increment_test.php
+++ b/tests/dbal/auto_increment_test.php
@@ -26,7 +26,7 @@ class phpbb_dbal_auto_increment_test extends phpbb_database_test_case
parent::setUp();
$this->db = $this->new_dbal();
- $this->tools = new phpbb_db_tools($this->db);
+ $this->tools = new \phpbb\db\tools($this->db);
$this->table_data = array(
'COLUMNS' => array(
diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php
index 7bdbc696e7..e25335165a 100644
--- a/tests/dbal/db_tools_test.php
+++ b/tests/dbal/db_tools_test.php
@@ -26,7 +26,7 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
parent::setUp();
$this->db = $this->new_dbal();
- $this->tools = new phpbb_db_tools($this->db);
+ $this->tools = new \phpbb\db\tools($this->db);
$this->table_data = array(
'COLUMNS' => array(
@@ -254,7 +254,7 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
public function test_peform_schema_changes_drop_tables()
{
- $db_tools = $this->getMock('phpbb_db_tools', array(
+ $db_tools = $this->getMock('\phpbb\db\tools', array(
'sql_table_exists',
'sql_table_drop',
), array(&$this->db));
@@ -280,7 +280,7 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
public function test_peform_schema_changes_drop_columns()
{
- $db_tools = $this->getMock('phpbb_db_tools', array(
+ $db_tools = $this->getMock('\phpbb\db\tools', array(
'sql_column_exists',
'sql_column_remove',
), array(&$this->db));
diff --git a/tests/dbal/migration/dummy.php b/tests/dbal/migration/dummy.php
index 0ac6e733a1..041c529855 100644
--- a/tests/dbal/migration/dummy.php
+++ b/tests/dbal/migration/dummy.php
@@ -7,7 +7,7 @@
*
*/
-class phpbb_dbal_migration_dummy extends phpbb_db_migration
+class phpbb_dbal_migration_dummy extends \phpbb\db\migration\migration
{
static public function depends_on()
{
diff --git a/tests/dbal/migration/fail.php b/tests/dbal/migration/fail.php
index f88d8169f5..d90972720d 100644
--- a/tests/dbal/migration/fail.php
+++ b/tests/dbal/migration/fail.php
@@ -7,7 +7,7 @@
*
*/
-class phpbb_dbal_migration_fail extends phpbb_db_migration
+class phpbb_dbal_migration_fail extends \phpbb\db\migration\migration
{
function update_schema()
{
diff --git a/tests/dbal/migration/if.php b/tests/dbal/migration/if.php
index 83fe21bd21..bbbda60ea3 100644
--- a/tests/dbal/migration/if.php
+++ b/tests/dbal/migration/if.php
@@ -7,7 +7,7 @@
*
*/
-class phpbb_dbal_migration_if extends phpbb_db_migration
+class phpbb_dbal_migration_if extends \phpbb\db\migration\migration
{
function update_schema()
{
diff --git a/tests/dbal/migration/installed.php b/tests/dbal/migration/installed.php
index 01829f7a99..4b86896d9c 100644
--- a/tests/dbal/migration/installed.php
+++ b/tests/dbal/migration/installed.php
@@ -7,7 +7,7 @@
*
*/
-class phpbb_dbal_migration_installed extends phpbb_db_migration
+class phpbb_dbal_migration_installed extends \phpbb\db\migration\migration
{
function effectively_installed()
{
diff --git a/tests/dbal/migration/recall.php b/tests/dbal/migration/recall.php
index 6c2f04bf08..041d12ad27 100644
--- a/tests/dbal/migration/recall.php
+++ b/tests/dbal/migration/recall.php
@@ -7,7 +7,7 @@
*
*/
-class phpbb_dbal_migration_recall extends phpbb_db_migration
+class phpbb_dbal_migration_recall extends \phpbb\db\migration\migration
{
function update_schema()
{
diff --git a/tests/dbal/migration/revert.php b/tests/dbal/migration/revert.php
index ac01987cd4..1882b20492 100644
--- a/tests/dbal/migration/revert.php
+++ b/tests/dbal/migration/revert.php
@@ -7,7 +7,7 @@
*
*/
-class phpbb_dbal_migration_revert extends phpbb_db_migration
+class phpbb_dbal_migration_revert extends \phpbb\db\migration\migration
{
function update_schema()
{
diff --git a/tests/dbal/migration/revert_with_dependency.php b/tests/dbal/migration/revert_with_dependency.php
index ca2c070e8c..0b09fb784d 100644
--- a/tests/dbal/migration/revert_with_dependency.php
+++ b/tests/dbal/migration/revert_with_dependency.php
@@ -7,7 +7,7 @@
*
*/
-class phpbb_dbal_migration_revert_with_dependency extends phpbb_db_migration
+class phpbb_dbal_migration_revert_with_dependency extends \phpbb\db\migration\migration
{
static public function depends_on()
{
diff --git a/tests/dbal/migration/unfulfillable.php b/tests/dbal/migration/unfulfillable.php
index 6d375e6880..a1cdef9a23 100644
--- a/tests/dbal/migration/unfulfillable.php
+++ b/tests/dbal/migration/unfulfillable.php
@@ -7,7 +7,7 @@
*
*/
-class phpbb_dbal_migration_unfulfillable extends phpbb_db_migration
+class phpbb_dbal_migration_unfulfillable extends \phpbb\db\migration\migration
{
static public function depends_on()
{
diff --git a/tests/dbal/migrator_test.php b/tests/dbal/migrator_test.php
index 9e55e4dd35..ef5d167fc2 100644
--- a/tests/dbal/migrator_test.php
+++ b/tests/dbal/migrator_test.php
@@ -33,15 +33,15 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
parent::setUp();
$this->db = $this->new_dbal();
- $this->db_tools = new phpbb_db_tools($this->db);
+ $this->db_tools = new \phpbb\db\tools($this->db);
- $this->config = new phpbb_config_db($this->db, new phpbb_mock_cache, 'phpbb_config');
+ $this->config = new \phpbb\config\db($this->db, new phpbb_mock_cache, 'phpbb_config');
$tools = array(
- new phpbb_db_migration_tool_config($this->config),
+ new \phpbb\db\migration\tool\config($this->config),
);
- $this->migrator = new phpbb_db_migrator(
+ $this->migrator = new \phpbb\db\migrator(
$this->config,
$this->db,
$this->db_tools,
@@ -55,11 +55,17 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
$container = new phpbb_mock_container_builder();
$container->set('migrator', $migrator);
- $this->extension_manager = new phpbb_extension_manager(
+ $this->extension_manager = new \phpbb\extension\manager(
$container,
$this->db,
$this->config,
- new phpbb_filesystem(),
+ new phpbb\filesystem(
+ new phpbb\symfony_request(
+ new phpbb_mock_request()
+ ),
+ dirname(__FILE__) . '/../../phpBB/',
+ 'php'
+ ),
'phpbb_ext',
dirname(__FILE__) . '/../../phpBB/',
'php',
@@ -232,7 +238,7 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
$this->migrator->update();
}
}
- catch (phpbb_db_migration_exception $e) {}
+ catch (\phpbb\db\migration\exception $e) {}
// Failure should have caused an automatic roll-back, so this should not exist.
$this->assertFalse(isset($this->config['foobar3']));
diff --git a/tests/dbal/migrator_tool_config_test.php b/tests/dbal/migrator_tool_config_test.php
index b82d1ef48d..a8d8966839 100644
--- a/tests/dbal/migrator_tool_config_test.php
+++ b/tests/dbal/migrator_tool_config_test.php
@@ -11,9 +11,9 @@ class phpbb_dbal_migrator_tool_config_test extends phpbb_test_case
{
public function setup()
{
- $this->config = new phpbb_config(array());
+ $this->config = new \phpbb\config\config(array());
- $this->tool = new phpbb_db_migration_tool_config($this->config);
+ $this->tool = new \phpbb\db\migration\tool\config($this->config);
parent::setup();
}
diff --git a/tests/dbal/migrator_tool_module_test.php b/tests/dbal/migrator_tool_module_test.php
index 828fb76c65..3c23891348 100644
--- a/tests/dbal/migrator_tool_module_test.php
+++ b/tests/dbal/migrator_tool_module_test.php
@@ -27,15 +27,15 @@ class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case
$skip_add_log = true;
$db = $this->db = $this->new_dbal();
- $this->cache = new phpbb_cache_service(new phpbb_cache_driver_null(), new phpbb_config(array()), $this->db, $phpbb_root_path, $phpEx);
- $user = $this->user = new phpbb_user();
+ $this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\null(), new \phpbb\config\config(array()), $this->db, $phpbb_root_path, $phpEx);
+ $user = $this->user = new \phpbb\user();
$cache = new phpbb_mock_cache;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
- $auth = $this->getMock('phpbb_auth');
- $phpbb_log = new phpbb_log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
+ $auth = $this->getMock('\phpbb\auth\auth');
+ $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
- $this->tool = new phpbb_db_migration_tool_module($this->db, $this->cache, $this->user, $phpbb_root_path, $phpEx, 'phpbb_modules');
+ $this->tool = new \phpbb\db\migration\tool\module($this->db, $this->cache, $this->user, $phpbb_root_path, $phpEx, 'phpbb_modules');
}
public function exists_data()
diff --git a/tests/dbal/migrator_tool_permission_test.php b/tests/dbal/migrator_tool_permission_test.php
index 79d9db66da..1090b4726a 100644
--- a/tests/dbal/migrator_tool_permission_test.php
+++ b/tests/dbal/migrator_tool_permission_test.php
@@ -24,10 +24,10 @@ class phpbb_dbal_migrator_tool_permission_test extends phpbb_database_test_case
parent::setup();
$db = $this->db = $this->new_dbal();
- $cache = $this->cache = new phpbb_cache_service(new phpbb_cache_driver_null(), new phpbb_config(array()), $this->db, $phpbb_root_path, $phpEx);
- $this->auth = new phpbb_auth();
+ $cache = $this->cache = new \phpbb\cache\service(new \phpbb\cache\driver\null(), new \phpbb\config\config(array()), $this->db, $phpbb_root_path, $phpEx);
+ $this->auth = new \phpbb\auth\auth();
- $this->tool = new phpbb_db_migration_tool_permission($this->db, $this->cache, $this->auth, $phpbb_root_path, $phpEx);
+ $this->tool = new \phpbb\db\migration\tool\permission($this->db, $this->cache, $this->auth, $phpbb_root_path, $phpEx);
}
public function exists_data()
diff --git a/tests/dbal/sql_insert_buffer_test.php b/tests/dbal/sql_insert_buffer_test.php
index 45339a6b50..a70eea4f7e 100644
--- a/tests/dbal/sql_insert_buffer_test.php
+++ b/tests/dbal/sql_insert_buffer_test.php
@@ -17,7 +17,7 @@ class phpbb_dbal_sql_insert_buffer_test extends phpbb_database_test_case
parent::setUp();
$this->db = $this->new_dbal();
- $this->buffer = new phpbb_db_sql_insert_buffer($this->db, 'phpbb_config', 2);
+ $this->buffer = new \phpbb\db\sql_insert_buffer($this->db, 'phpbb_config', 2);
$this->assert_config_count(2);
}
diff --git a/tests/dbal/write_test.php b/tests/dbal/write_test.php
index 987161a831..c069d9a796 100644
--- a/tests/dbal/write_test.php
+++ b/tests/dbal/write_test.php
@@ -64,7 +64,7 @@ class phpbb_dbal_write_test extends phpbb_database_test_case
FROM phpbb_config';
$result = $db->sql_query($sql);
$rows = $db->sql_fetchrowset($result);
-
+
$this->assertEquals(1, sizeof($rows));
$this->assertEquals('config2', $rows[0]['config_name']);
diff --git a/tests/di/create_container_test.php b/tests/di/create_container_test.php
index c570f19ebd..a3a1ad3597 100644
--- a/tests/di/create_container_test.php
+++ b/tests/di/create_container_test.php
@@ -7,66 +7,72 @@
*
*/
-require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
-require_once dirname(__FILE__) . '/../../phpBB/includes/functions_container.php';
-
-class phpbb_di_container_test extends phpbb_test_case
+namespace
{
- public function test_phpbb_create_container()
- {
- $phpbb_root_path = __DIR__ . '/../../phpBB/';
- $extensions = array(
- new phpbb_di_extension_config(__DIR__ . '/fixtures/config.php'),
- new phpbb_di_extension_core($phpbb_root_path . 'config'),
- );
- $container = phpbb_create_container($extensions, $phpbb_root_path, 'php');
+ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
+ require_once dirname(__FILE__) . '/../../phpBB/includes/functions_container.php';
+
+ class phpbb_di_container_test extends phpbb_test_case
+ {
+ public function test_phpbb_create_container()
+ {
+ $phpbb_root_path = __DIR__ . '/../../phpBB/';
+ $extensions = array(
+ new \phpbb\di\extension\config(__DIR__ . '/fixtures/config.php'),
+ new \phpbb\di\extension\core($phpbb_root_path . 'config'),
+ );
+ $container = phpbb_create_container($extensions, $phpbb_root_path, 'php');
- $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container);
- }
+ $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container);
+ }
- public function test_phpbb_create_install_container()
- {
- $phpbb_root_path = __DIR__ . '/../../phpBB/';
- $extensions = array(
- new phpbb_di_extension_config(__DIR__ . '/fixtures/config.php'),
- new phpbb_di_extension_core($phpbb_root_path . 'config'),
- );
- $container = phpbb_create_install_container($phpbb_root_path, 'php');
+ public function test_phpbb_create_install_container()
+ {
+ $phpbb_root_path = __DIR__ . '/../../phpBB/';
+ $extensions = array(
+ new \phpbb\di\extension\config(__DIR__ . '/fixtures/config.php'),
+ new \phpbb\di\extension\core($phpbb_root_path . 'config'),
+ );
+ $container = phpbb_create_install_container($phpbb_root_path, 'php');
- $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container);
- $this->assertTrue($container->isFrozen());
- }
+ $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container);
+ $this->assertTrue($container->isFrozen());
+ }
- public function test_phpbb_create_compiled_container()
- {
- $phpbb_root_path = __DIR__ . '/../../phpBB/';
- $config_file = __DIR__ . '/fixtures/config.php';
- $extensions = array(
- new phpbb_di_extension_config(__DIR__ . '/fixtures/config.php'),
- new phpbb_di_extension_core($phpbb_root_path . 'config'),
- );
- $container = phpbb_create_compiled_container($config_file, $extensions, array(), $phpbb_root_path, 'php');
+ public function test_phpbb_create_compiled_container()
+ {
+ $phpbb_root_path = __DIR__ . '/../../phpBB/';
+ $config_file = __DIR__ . '/fixtures/config.php';
+ $extensions = array(
+ new \phpbb\di\extension\config(__DIR__ . '/fixtures/config.php'),
+ new \phpbb\di\extension\core($phpbb_root_path . 'config'),
+ );
+ $container = phpbb_create_compiled_container($config_file, $extensions, array(), $phpbb_root_path, 'php');
- $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container);
- $this->assertTrue($container->isFrozen());
- }
+ $this->assertInstanceOf('Symfony\Component\DependencyInjection\ContainerBuilder', $container);
+ $this->assertTrue($container->isFrozen());
+ }
+ }
}
-class phpbb_db_driver_container_mock extends phpbb_db_driver
+namespace phpbb\db\driver
{
- public function sql_connect()
- {
- }
+ class container_mock extends \phpbb\db\driver\driver
+ {
+ public function sql_connect()
+ {
+ }
- public function sql_query()
- {
- }
+ public function sql_query()
+ {
+ }
- public function sql_fetchrow()
- {
- }
+ public function sql_fetchrow()
+ {
+ }
- public function sql_freeresult()
- {
- }
+ public function sql_freeresult()
+ {
+ }
+ }
}
diff --git a/tests/di/fixtures/config.php b/tests/di/fixtures/config.php
index 5033d2dc9f..04e20f63d8 100644
--- a/tests/di/fixtures/config.php
+++ b/tests/di/fixtures/config.php
@@ -8,4 +8,4 @@ $dbname = 'phpbb';
$dbuser = 'root';
$dbpasswd = '';
$table_prefix = 'phpbb_';
-$acm_type = 'phpbb_cache_driver_null';
+$acm_type = '\phpbb\cache\driver\null';
diff --git a/tests/error_collector_test.php b/tests/error_collector_test.php
index fceb8aa3d8..0804c64f6f 100644
--- a/tests/error_collector_test.php
+++ b/tests/error_collector_test.php
@@ -13,7 +13,7 @@ class phpbb_error_collector_test extends phpbb_test_case
{
public function test_collection()
{
- $collector = new phpbb_error_collector;
+ $collector = new \phpbb\error_collector;
$collector->install();
// Cause a warning
diff --git a/tests/event/dispatcher_test.php b/tests/event/dispatcher_test.php
index 9b9203e06a..a76df90809 100644
--- a/tests/event/dispatcher_test.php
+++ b/tests/event/dispatcher_test.php
@@ -11,9 +11,9 @@ class phpbb_event_dispatcher_test extends phpbb_test_case
{
public function test_trigger_event()
{
- $dispatcher = new phpbb_event_dispatcher(new phpbb_mock_container_builder());
+ $dispatcher = new \phpbb\event\dispatcher(new phpbb_mock_container_builder());
- $dispatcher->addListener('core.test_event', function (phpbb_event_data $event) {
+ $dispatcher->addListener('core.test_event', function (\phpbb\event\data $event) {
$event['foo'] = $event['foo'] . '2';
$event['bar'] = $event['bar'] . '2';
});
diff --git a/tests/extension/ext/bar/ext.php b/tests/extension/ext/bar/ext.php
index 5585edf9ac..22ff5e8077 100644
--- a/tests/extension/ext/bar/ext.php
+++ b/tests/extension/ext/bar/ext.php
@@ -1,6 +1,8 @@
<?php
-class phpbb_ext_bar_ext extends phpbb_extension_base
+namespace bar;
+
+class ext extends \phpbb\extension\base
{
static public $state;
diff --git a/tests/extension/ext/bar/my/hidden_class.php b/tests/extension/ext/bar/my/hidden_class.php
index 0261d7c59a..504c1873dc 100644
--- a/tests/extension/ext/bar/my/hidden_class.php
+++ b/tests/extension/ext/bar/my/hidden_class.php
@@ -1,5 +1,7 @@
<?php
-class phpbb_ext_bar_my_hidden_class
+namespace bar\my;
+
+class hidden_class
{
}
diff --git a/tests/extension/ext/barfoo/acp/a_info.php b/tests/extension/ext/barfoo/acp/a_info.php
index cd7e4e574b..ea07189f7a 100644
--- a/tests/extension/ext/barfoo/acp/a_info.php
+++ b/tests/extension/ext/barfoo/acp/a_info.php
@@ -1,11 +1,13 @@
<?php
-class phpbb_ext_barfoo_acp_a_info
+namespace barfoo\acp;
+
+class a_info
{
public function module()
{
return array(
- 'filename' => 'phpbb_ext_barfoo_acp_a_module',
+ 'filename' => 'barfoo\\acp\\a_module',
'title' => 'Barfoo',
'version' => '3.1.0-dev',
'modes' => array(
diff --git a/tests/extension/ext/barfoo/acp/a_module.php b/tests/extension/ext/barfoo/acp/a_module.php
index 5bedb49645..0ae8775013 100644
--- a/tests/extension/ext/barfoo/acp/a_module.php
+++ b/tests/extension/ext/barfoo/acp/a_module.php
@@ -1,5 +1,7 @@
<?php
-class phpbb_ext_barfoo_acp_a_module
+namespace barfoo\acp;
+
+class a_module
{
}
diff --git a/tests/extension/ext/barfoo/ext.php b/tests/extension/ext/barfoo/ext.php
index 2e11ece8d1..1b7bb7ca5e 100644
--- a/tests/extension/ext/barfoo/ext.php
+++ b/tests/extension/ext/barfoo/ext.php
@@ -1,5 +1,7 @@
<?php
-class phpbb_ext_barfoo_ext extends phpbb_extension_base
+namespace barfoo;
+
+class ext extends \phpbb\extension\base
{
}
diff --git a/tests/extension/ext/foo/a_class.php b/tests/extension/ext/foo/a_class.php
index b7be1ad654..9db45a697f 100644
--- a/tests/extension/ext/foo/a_class.php
+++ b/tests/extension/ext/foo/a_class.php
@@ -1,5 +1,7 @@
<?php
-class phpbb_ext_foo_a_class
+namespace foo;
+
+class a_class
{
}
diff --git a/tests/extension/ext/foo/acp/a_info.php b/tests/extension/ext/foo/acp/a_info.php
index 3e9bbffaca..3b7d8cdd42 100644
--- a/tests/extension/ext/foo/acp/a_info.php
+++ b/tests/extension/ext/foo/acp/a_info.php
@@ -1,11 +1,13 @@
<?php
-class phpbb_ext_foo_acp_a_info
+namespace foo\acp;
+
+class a_info
{
public function module()
{
return array(
- 'filename' => 'phpbb_ext_foo_acp_a_module',
+ 'filename' => 'foo\\acp\\a_module',
'title' => 'Foobar',
'version' => '3.1.0-dev',
'modes' => array(
diff --git a/tests/extension/ext/foo/acp/a_module.php b/tests/extension/ext/foo/acp/a_module.php
index 093b4b1ad7..7aa2351ab3 100644
--- a/tests/extension/ext/foo/acp/a_module.php
+++ b/tests/extension/ext/foo/acp/a_module.php
@@ -1,5 +1,7 @@
<?php
-class phpbb_ext_foo_acp_a_module
+namespace foo\acp;
+
+class a_module
{
}
diff --git a/tests/extension/ext/foo/acp/fail_info.php b/tests/extension/ext/foo/acp/fail_info.php
index 99aa09551e..01d29fc5eb 100644
--- a/tests/extension/ext/foo/acp/fail_info.php
+++ b/tests/extension/ext/foo/acp/fail_info.php
@@ -1,14 +1,17 @@
<?php
+
+namespace foo\acp;
+
/*
* Due to the mismatch between the class name and the file name, this module
* file shouldn't be found by the extension finder
*/
-class phpbb_ext_foo_acp_foo_info
+class foo_info
{
public function module()
{
return array(
- 'filename' => 'phpbb_ext_foo_acp_fail_module',
+ 'filename' => 'foo\acp\fail_module',
'title' => 'Foobar',
'version' => '3.1.0-dev',
'modes' => array(
diff --git a/tests/extension/ext/foo/acp/fail_module.php b/tests/extension/ext/foo/acp/fail_module.php
index a200d92d2f..8070929d3c 100644
--- a/tests/extension/ext/foo/acp/fail_module.php
+++ b/tests/extension/ext/foo/acp/fail_module.php
@@ -1,8 +1,11 @@
<?php
+
+namespace foo\acp;
+
/*
* Due to the mismatch between the class name and the file name of the module
* info file, this module's info file shouldn't be found
*/
-class phpbb_ext_foo_acp_fail_module
+class fail_module
{
}
diff --git a/tests/extension/ext/foo/b_class.php b/tests/extension/ext/foo/b_class.php
index 4645266122..bb2a77c05e 100644
--- a/tests/extension/ext/foo/b_class.php
+++ b/tests/extension/ext/foo/b_class.php
@@ -1,5 +1,7 @@
<?php
-class phpbb_ext_foo_b_class
+namespace foo;
+
+class b_class
{
}
diff --git a/tests/extension/ext/foo/ext.php b/tests/extension/ext/foo/ext.php
index 60b3ad1f16..ac6098f2f1 100644
--- a/tests/extension/ext/foo/ext.php
+++ b/tests/extension/ext/foo/ext.php
@@ -1,6 +1,8 @@
<?php
-class phpbb_ext_foo_ext extends phpbb_extension_base
+namespace foo;
+
+class ext extends \phpbb\extension\base
{
static public $disabled;
diff --git a/tests/extension/ext/foo/mcp/a_info.php b/tests/extension/ext/foo/mcp/a_info.php
index 84a36b9134..9a896ce808 100644
--- a/tests/extension/ext/foo/mcp/a_info.php
+++ b/tests/extension/ext/foo/mcp/a_info.php
@@ -1,11 +1,13 @@
<?php
-class phpbb_ext_foo_mcp_a_info
+namespace foo\mcp;
+
+class a_info
{
public function module()
{
return array(
- 'filename' => 'phpbb_ext_foo_mcp_a_module',
+ 'filename' => 'foo\\mcp\\a_module',
'title' => 'Foobar',
'version' => '3.1.0-dev',
'modes' => array(
diff --git a/tests/extension/ext/foo/mcp/a_module.php b/tests/extension/ext/foo/mcp/a_module.php
index 59d9f8cc6f..ca397e7004 100644
--- a/tests/extension/ext/foo/mcp/a_module.php
+++ b/tests/extension/ext/foo/mcp/a_module.php
@@ -1,5 +1,7 @@
<?php
-class phpbb_ext_foo_mcp_a_module
+namespace foo\mcp;
+
+class a_module
{
}
diff --git a/tests/extension/ext/foo/sub/type/alternative.php b/tests/extension/ext/foo/sub/type/alternative.php
index 2ea7353f4b..1eaf794609 100644
--- a/tests/extension/ext/foo/sub/type/alternative.php
+++ b/tests/extension/ext/foo/sub/type/alternative.php
@@ -1,5 +1,7 @@
<?php
-class phpbb_ext_foo_sub_type_alternative
+namespace foo\sub\type;
+
+class alternative
{
}
diff --git a/tests/extension/ext/foo/type/alternative.php b/tests/extension/ext/foo/type/alternative.php
index 404b66b965..8f753491ef 100644
--- a/tests/extension/ext/foo/type/alternative.php
+++ b/tests/extension/ext/foo/type/alternative.php
@@ -1,5 +1,7 @@
<?php
-class phpbb_ext_foo_type_alternative
+namespace foo\type;
+
+class alternative
{
}
diff --git a/tests/extension/ext/foo/typewrong/error.php b/tests/extension/ext/foo/typewrong/error.php
index ba22cfae9a..5020926043 100644
--- a/tests/extension/ext/foo/typewrong/error.php
+++ b/tests/extension/ext/foo/typewrong/error.php
@@ -1,5 +1,7 @@
<?php
-class phpbb_ext_foo_typewrong_error
+namespace foo\typewrong;
+
+class error
{
}
diff --git a/tests/extension/ext/vendor/moo/ext.php b/tests/extension/ext/vendor/moo/ext.php
index e0ac1a22cc..41ef570452 100644
--- a/tests/extension/ext/vendor/moo/ext.php
+++ b/tests/extension/ext/vendor/moo/ext.php
@@ -1,6 +1,8 @@
<?php
-class phpbb_ext_vendor_moo_ext extends phpbb_extension_base
+namespace vendor\moo;
+
+class ext extends \phpbb\extension\base
{
static public $purged;
diff --git a/tests/extension/ext/vendor/moo/feature_class.php b/tests/extension/ext/vendor/moo/feature_class.php
index c3bcc4451c..cb8bb3da56 100644
--- a/tests/extension/ext/vendor/moo/feature_class.php
+++ b/tests/extension/ext/vendor/moo/feature_class.php
@@ -1,5 +1,7 @@
<?php
-class phpbb_ext_vendor_moo_feature_class
+namespace vendor\moo;
+
+class feature_class
{
}
diff --git a/tests/extension/finder_test.php b/tests/extension/finder_test.php
index 3bf2c42573..8e6e71aaf8 100644
--- a/tests/extension/finder_test.php
+++ b/tests/extension/finder_test.php
@@ -43,10 +43,10 @@ class phpbb_extension_finder_test extends phpbb_test_case
sort($classes);
$this->assertEquals(
array(
- 'phpbb_default_implementation',
- 'phpbb_ext_bar_my_hidden_class',
- 'phpbb_ext_foo_a_class',
- 'phpbb_ext_foo_b_class',
+ '\bar\my\hidden_class',
+ '\foo\a_class',
+ '\foo\b_class',
+ '\phpbb\default\implementation',
),
$classes
);
@@ -67,7 +67,7 @@ class phpbb_extension_finder_test extends phpbb_test_case
public function test_prefix_get_directories()
{
$dirs = $this->finder
- ->prefix('ty')
+ ->prefix('ty')
->get_directories();
sort($dirs);
@@ -88,8 +88,8 @@ class phpbb_extension_finder_test extends phpbb_test_case
sort($classes);
$this->assertEquals(
array(
- 'phpbb_default_implementation',
- 'phpbb_ext_bar_my_hidden_class',
+ '\bar\my\hidden_class',
+ '\phpbb\default\implementation',
),
$classes
);
@@ -105,9 +105,9 @@ class phpbb_extension_finder_test extends phpbb_test_case
sort($classes);
$this->assertEquals(
array(
- 'phpbb_default_implementation',
- 'phpbb_ext_foo_sub_type_alternative',
- 'phpbb_ext_foo_type_alternative',
+ '\foo\sub\type\alternative',
+ '\foo\type\alternative',
+ '\phpbb\default\implementation',
),
$classes
);
@@ -122,7 +122,7 @@ class phpbb_extension_finder_test extends phpbb_test_case
sort($classes);
$this->assertEquals(
array(
- 'phpbb_ext_foo_type_alternative',
+ '\foo\type\alternative',
),
$classes
);
@@ -137,7 +137,7 @@ class phpbb_extension_finder_test extends phpbb_test_case
sort($classes);
$this->assertEquals(
array(
- 'phpbb_ext_foo_sub_type_alternative',
+ '\foo\sub\type\alternative',
),
$classes
);
@@ -152,7 +152,7 @@ class phpbb_extension_finder_test extends phpbb_test_case
sort($classes);
$this->assertEquals(
array(
- 'phpbb_ext_foo_sub_type_alternative',
+ '\foo\sub\type\alternative',
),
$classes
);
@@ -168,8 +168,8 @@ class phpbb_extension_finder_test extends phpbb_test_case
sort($classes);
$this->assertEquals(
array(
- 'phpbb_ext_foo_type_alternative',
- 'phpbb_ext_foo_type_dummy_empty',
+ '\foo\type\alternative',
+ '\foo\type\dummy\empty',
),
$classes
);
@@ -181,7 +181,7 @@ class phpbb_extension_finder_test extends phpbb_test_case
public function test_get_classes_create_cache()
{
$cache = new phpbb_mock_cache;
- $finder = new phpbb_extension_finder($this->extension_manager, new phpbb_filesystem(), dirname(__FILE__) . '/', $cache, 'php', '_custom_cache_name');
+ $finder = new \phpbb\extension\finder($this->extension_manager, new \phpbb\filesystem(), dirname(__FILE__) . '/', $cache, 'php', '_custom_cache_name');
$files = $finder->suffix('_class.php')->get_files();
$expected_files = array(
@@ -219,9 +219,9 @@ class phpbb_extension_finder_test extends phpbb_test_case
'is_dir' => false,
);
- $finder = new phpbb_extension_finder(
+ $finder = new \phpbb\extension\finder(
$this->extension_manager,
- new phpbb_filesystem(),
+ new \phpbb\filesystem(),
dirname(__FILE__) . '/',
new phpbb_mock_cache(array(
'_ext_finder' => array(
diff --git a/tests/extension/manager_test.php b/tests/extension/manager_test.php
index a23e5a18d9..c4a32f53ab 100644
--- a/tests/extension/manager_test.php
+++ b/tests/extension/manager_test.php
@@ -45,31 +45,31 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
public function test_enable()
{
- phpbb_ext_bar_ext::$state = 0;
+ bar\ext::$state = 0;
$this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled()));
$this->extension_manager->enable('bar');
$this->assertEquals(array('bar', 'foo'), array_keys($this->extension_manager->all_enabled()));
$this->assertEquals(array('bar', 'foo', 'vendor/moo'), array_keys($this->extension_manager->all_configured()));
- $this->assertEquals(4, phpbb_ext_bar_ext::$state);
+ $this->assertEquals(4, bar\ext::$state);
}
public function test_disable()
{
- phpbb_ext_foo_ext::$disabled = false;
+ foo\ext::$disabled = false;
$this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled()));
$this->extension_manager->disable('foo');
$this->assertEquals(array(), array_keys($this->extension_manager->all_enabled()));
$this->assertEquals(array('foo', 'vendor/moo'), array_keys($this->extension_manager->all_configured()));
- $this->assertTrue(phpbb_ext_foo_ext::$disabled);
+ $this->assertTrue(foo\ext::$disabled);
}
public function test_purge()
{
- phpbb_ext_vendor_moo_ext::$purged = false;
+ vendor\moo\ext::$purged = false;
$this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled()));
$this->assertEquals(array('foo', 'vendor/moo'), array_keys($this->extension_manager->all_configured()));
@@ -77,7 +77,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
$this->assertEquals(array('foo'), array_keys($this->extension_manager->all_enabled()));
$this->assertEquals(array('foo'), array_keys($this->extension_manager->all_configured()));
- $this->assertTrue(phpbb_ext_vendor_moo_ext::$purged);
+ $this->assertTrue(vendor\moo\ext::$purged);
}
public function test_enabled_no_cache()
@@ -90,14 +90,14 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
protected function create_extension_manager($with_cache = true)
{
- $config = new phpbb_config(array());
+ $config = new \phpbb\config\config(array());
$db = $this->new_dbal();
- $db_tools = new phpbb_db_tools($db);
+ $db_tools = new \phpbb\db\tools($db);
$phpbb_root_path = __DIR__ . './../../phpBB/';
$php_ext = 'php';
$table_prefix = 'phpbb_';
- $migrator = new phpbb_db_migrator(
+ $migrator = new \phpbb\db\migrator(
$config,
$db,
$db_tools,
@@ -110,11 +110,17 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
$container = new phpbb_mock_container_builder();
$container->set('migrator', $migrator);
- return new phpbb_extension_manager(
+ return new \phpbb\extension\manager(
$container,
$db,
$config,
- new phpbb_filesystem(),
+ new \phpbb\filesystem(
+ new \phpbb\symfony_request(
+ new phpbb_mock_request()
+ ),
+ $phpbb_root_path,
+ $php_ext
+ ),
'phpbb_ext',
dirname(__FILE__) . '/',
$php_ext,
diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php
index e5bd29092e..2b27a1bae2 100644
--- a/tests/extension/metadata_manager_test.php
+++ b/tests/extension/metadata_manager_test.php
@@ -30,25 +30,30 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
parent::setUp();
$this->cache = new phpbb_mock_cache();
- $this->config = new phpbb_config(array(
+ $this->config = new \phpbb\config\config(array(
'version' => '3.1.0',
));
$this->db = $this->new_dbal();
- $this->db_tools = new phpbb_db_tools($this->db);
+ $this->db_tools = new \phpbb\db\tools($this->db);
$this->phpbb_root_path = dirname(__FILE__) . '/';
$this->phpEx = 'php';
- $this->user = new phpbb_user();
+ $this->user = new \phpbb\user();
$this->table_prefix = 'phpbb_';
- $this->template = new phpbb_template_twig(
- $this->phpbb_root_path,
- $this->phpEx,
+ $this->template = new \phpbb\template\twig\twig(
+ new \phpbb\filesystem(
+ new \phpbb\symfony_request(
+ new phpbb_mock_request()
+ ),
+ $this->phpbb_root_path,
+ $this->phpEx
+ ),
$this->config,
$this->user,
- new phpbb_template_context()
+ new \phpbb\template\context()
);
- $this->migrator = new phpbb_db_migrator(
+ $this->migrator = new \phpbb\db\migrator(
$this->config,
$this->db,
$this->db_tools,
@@ -61,11 +66,17 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$container = new phpbb_mock_container_builder();
$container->set('migrator', $migrator);
- $this->extension_manager = new phpbb_extension_manager(
+ $this->extension_manager = new \phpbb\extension\manager(
$container,
$this->db,
$this->config,
- new phpbb_filesystem(),
+ new \phpbb\filesystem(
+ new \phpbb\symfony_request(
+ new phpbb_mock_request()
+ ),
+ $this->phpbb_root_path,
+ $this->phpEx
+ ),
'phpbb_ext',
$this->phpbb_root_path,
$this->phpEx,
@@ -84,7 +95,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
{
$manager->get_metadata();
}
- catch(phpbb_extension_exception $e){}
+ catch(\phpbb\extension\exception $e){}
$this->assertEquals((string) $e, 'The required file does not exist: ' . $this->phpbb_root_path . $this->extension_manager->get_extension_path($ext_name) . 'composer.json');
}
@@ -100,7 +111,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
{
$metadata = $manager->get_metadata();
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->fail($e);
}
@@ -123,7 +134,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->fail('Exception not triggered');
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->assertEquals((string) $e, 'Required meta field \'name\' has not been set.');
}
@@ -134,7 +145,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->fail('Exception not triggered');
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->assertEquals((string) $e, 'Required meta field \'type\' has not been set.');
}
@@ -145,7 +156,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->fail('Exception not triggered');
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->assertEquals((string) $e, 'Required meta field \'licence\' has not been set.');
}
@@ -156,7 +167,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->fail('Exception not triggered');
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->assertEquals((string) $e, 'Required meta field \'version\' has not been set.');
}
@@ -167,7 +178,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->fail('Exception not triggered');
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->assertEquals((string) $e, 'Required meta field \'authors\' has not been set.');
}
@@ -184,7 +195,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->fail('Exception not triggered');
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->assertEquals((string) $e, 'Required meta field \'author name\' has not been set.');
}
@@ -211,7 +222,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->fail('Exception not triggered');
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->assertEquals((string) $e, 'Meta field \'name\' is invalid.');
}
@@ -222,7 +233,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->fail('Exception not triggered');
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->assertEquals((string) $e, 'Meta field \'type\' is invalid.');
}
@@ -233,7 +244,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->fail('Exception not triggered');
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->assertEquals((string) $e, 'Meta field \'licence\' is invalid.');
}
@@ -244,7 +255,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->fail('Exception not triggered');
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->assertEquals((string) $e, 'Meta field \'version\' is invalid.');
}
@@ -268,7 +279,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
{
$this->assertEquals(true, $manager->validate('enable'));
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->fail($e);
}
@@ -293,7 +304,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->assertEquals(false, $manager->validate_require_php());
$this->assertEquals(false, $manager->validate_require_phpbb());
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->fail($e);
}
@@ -312,7 +323,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->assertEquals(true, $manager->validate_require_php());
$this->assertEquals(true, $manager->validate_require_phpbb());
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->fail($e);
}
@@ -331,7 +342,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->assertEquals(false, $manager->validate_require_php());
$this->assertEquals(false, $manager->validate_require_phpbb());
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->fail($e);
}
@@ -350,7 +361,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->assertEquals(false, $manager->validate_require_php());
$this->assertEquals(false, $manager->validate_require_phpbb());
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->fail($e);
}
@@ -369,7 +380,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->assertEquals(true, $manager->validate_require_php());
$this->assertEquals(true, $manager->validate_require_phpbb());
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->fail($e);
}
@@ -388,7 +399,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->assertEquals(true, $manager->validate_require_php());
$this->assertEquals(true, $manager->validate_require_phpbb());
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->fail($e);
}
@@ -407,7 +418,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$this->assertEquals(true, $manager->validate_require_php());
$this->assertEquals(true, $manager->validate_require_phpbb());
}
- catch(phpbb_extension_exception $e)
+ catch(\phpbb\extension\exception $e)
{
$this->fail($e);
}
diff --git a/tests/extension/modules_test.php b/tests/extension/modules_test.php
index fe71747c5d..ef21c943c2 100644
--- a/tests/extension/modules_test.php
+++ b/tests/extension/modules_test.php
@@ -45,6 +45,8 @@ class phpbb_extension_modules_test extends phpbb_test_case
{
global $phpbb_root_path;
+// $this->markTestIncomplete('Modules no speak namespace! Going to get rid of db modules altogether and fix this test after.');
+
// Correctly set the root path for this test to this directory, so the classes can be found
$phpbb_root_path = dirname(__FILE__) . '/';
@@ -52,8 +54,8 @@ class phpbb_extension_modules_test extends phpbb_test_case
$this->acp_modules->module_class = 'acp';
$acp_modules = $this->acp_modules->get_module_infos();
$this->assertEquals(array(
- 'phpbb_ext_foo_acp_a_module' => array(
- 'filename' => 'phpbb_ext_foo_acp_a_module',
+ 'foo\\acp\\a_module' => array(
+ 'filename' => 'foo\\acp\\a_module',
'title' => 'Foobar',
'version' => '3.1.0-dev',
'modes' => array(
@@ -74,8 +76,8 @@ class phpbb_extension_modules_test extends phpbb_test_case
$this->acp_modules->module_class = 'mcp';
$acp_modules = $this->acp_modules->get_module_infos();
$this->assertEquals(array(
- 'phpbb_ext_foo_mcp_a_module' => array(
- 'filename' => 'phpbb_ext_foo_mcp_a_module',
+ 'foo\\mcp\\a_module' => array(
+ 'filename' => 'foo\\mcp\\a_module',
'title' => 'Foobar',
'version' => '3.1.0-dev',
'modes' => array(
@@ -88,8 +90,8 @@ class phpbb_extension_modules_test extends phpbb_test_case
$this->acp_modules->module_class = 'mcp';
$acp_modules = $this->acp_modules->get_module_infos('mcp_a_module');
$this->assertEquals(array(
- 'phpbb_ext_foo_mcp_a_module' => array(
- 'filename' => 'phpbb_ext_foo_mcp_a_module',
+ 'foo\\mcp\\a_module' => array(
+ 'filename' => 'foo\\mcp\\a_module',
'title' => 'Foobar',
'version' => '3.1.0-dev',
'modes' => array(
@@ -102,8 +104,8 @@ class phpbb_extension_modules_test extends phpbb_test_case
$this->acp_modules->module_class = '';
$acp_modules = $this->acp_modules->get_module_infos('mcp_a_module', 'mcp');
$this->assertEquals(array(
- 'phpbb_ext_foo_mcp_a_module' => array(
- 'filename' => 'phpbb_ext_foo_mcp_a_module',
+ 'foo\\mcp\\a_module' => array(
+ 'filename' => 'foo\\mcp\\a_module',
'title' => 'Foobar',
'version' => '3.1.0-dev',
'modes' => array(
@@ -124,10 +126,10 @@ class phpbb_extension_modules_test extends phpbb_test_case
// Get module info of specified extension module
$this->acp_modules->module_class = 'acp';
- $acp_modules = $this->acp_modules->get_module_infos('phpbb_ext_foo_acp_a_module');
+ $acp_modules = $this->acp_modules->get_module_infos('foo_acp_a_module');
$this->assertEquals(array(
- 'phpbb_ext_foo_acp_a_module' => array (
- 'filename' => 'phpbb_ext_foo_acp_a_module',
+ 'foo\\acp\\a_module' => array (
+ 'filename' => 'foo\\acp\\a_module',
'title' => 'Foobar',
'version' => '3.1.0-dev',
'modes' => array (
@@ -150,8 +152,8 @@ class phpbb_extension_modules_test extends phpbb_test_case
$this->acp_modules->module_class = 'acp';
$acp_modules = $this->acp_modules->get_module_infos('', false, true);
$this->assertEquals(array(
- 'phpbb_ext_foo_acp_a_module' => array(
- 'filename' => 'phpbb_ext_foo_acp_a_module',
+ 'foo\\acp\\a_module' => array(
+ 'filename' => 'foo\\acp\\a_module',
'title' => 'Foobar',
'version' => '3.1.0-dev',
'modes' => array(
@@ -166,8 +168,8 @@ class phpbb_extension_modules_test extends phpbb_test_case
'test' => array('title' => 'Test', 'auth' => '', 'cat' => array('ACP_GENERAL')),
),
),
- 'phpbb_ext_barfoo_acp_a_module' => array(
- 'filename' => 'phpbb_ext_barfoo_acp_a_module',
+ 'barfoo\\acp\\a_module' => array(
+ 'filename' => 'barfoo\\acp\\a_module',
'title' => 'Barfoo',
'version' => '3.1.0-dev',
'modes' => array(
@@ -177,10 +179,10 @@ class phpbb_extension_modules_test extends phpbb_test_case
), $acp_modules);
// Specific module set to disabled extension
- $acp_modules = $this->acp_modules->get_module_infos('phpbb_ext_barfoo_acp_a_module', 'acp', true);
+ $acp_modules = $this->acp_modules->get_module_infos('barfoo_acp_a_module', 'acp', true);
$this->assertEquals(array(
- 'phpbb_ext_barfoo_acp_a_module' => array(
- 'filename' => 'phpbb_ext_barfoo_acp_a_module',
+ 'barfoo\\acp\\a_module' => array(
+ 'filename' => 'barfoo\\acp\\a_module',
'title' => 'Barfoo',
'version' => '3.1.0-dev',
'modes' => array(
diff --git a/tests/extension/style_path_provider_test.php b/tests/extension/style_path_provider_test.php
deleted file mode 100644
index e1021c20ac..0000000000
--- a/tests/extension/style_path_provider_test.php
+++ /dev/null
@@ -1,50 +0,0 @@
-<?php
-/**
-*
-* @package testing
-* @copyright (c) 2013 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
-
-class phpbb_extension_style_path_provider_test extends phpbb_test_case
-{
- protected $relative_root_path;
- protected $root_path;
-
- public function setUp()
- {
- $this->relative_root_path = './';
- $this->root_path = dirname(__FILE__) . '/';
- }
-
- public function test_find()
- {
- $phpbb_style_path_provider = new phpbb_style_path_provider();
- $phpbb_style_path_provider->set_styles(array($this->relative_root_path . 'styles/prosilver'));
- $phpbb_style_extension_path_provider = new phpbb_style_extension_path_provider(new phpbb_mock_extension_manager(
- $this->root_path,
- array(
- 'foo' => array(
- 'ext_name' => 'foo',
- 'ext_active' => '1',
- 'ext_path' => 'ext/foo/',
- ),
- 'bar' => array(
- 'ext_name' => 'bar',
- 'ext_active' => '1',
- 'ext_path' => 'ext/bar/',
- ),
- )), $phpbb_style_path_provider, $this->relative_root_path);
-
- $this->assertEquals(array(
- 'style' => array(
- $this->relative_root_path . 'styles/prosilver',
- ),
- 'bar' => array(
- $this->root_path . 'ext/bar/styles/prosilver',
- ),
- ), $phpbb_style_extension_path_provider->find());
- }
-}
diff --git a/tests/extension/subdir/style_path_provider_test.php b/tests/extension/subdir/style_path_provider_test.php
deleted file mode 100644
index 1b5ce62e5f..0000000000
--- a/tests/extension/subdir/style_path_provider_test.php
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-/**
-*
-* @package testing
-* @copyright (c) 2013 phpBB Group
-* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
-*
-*/
-require_once dirname(__FILE__) . '/../style_path_provider_test.php';
-
-class phpbb_extension_subdir_style_path_provider_test extends phpbb_extension_style_path_provider_test
-{
- public function setUp()
- {
- $this->relative_root_path = '../';
- $this->root_path = dirname(__FILE__) . '/../';
- }
-}
diff --git a/tests/filesystem/clean_path_test.php b/tests/filesystem/clean_path_test.php
index 50951fc88c..5b9857ef2c 100644
--- a/tests/filesystem/clean_path_test.php
+++ b/tests/filesystem/clean_path_test.php
@@ -14,7 +14,13 @@ class phpbb_filesystem_clean_path_test extends phpbb_test_case
public function setUp()
{
parent::setUp();
- $this->filesystem = new phpbb_filesystem();
+ $this->filesystem = new \phpbb\filesystem(
+ new \phpbb\symfony_request(
+ new phpbb_mock_request()
+ ),
+ dirname(__FILE__) . './../../phpBB/',
+ 'php'
+ );
}
public function clean_path_data()
diff --git a/tests/filesystem/web_root_path_test.php b/tests/filesystem/web_root_path_test.php
new file mode 100644
index 0000000000..e0f716cdae
--- /dev/null
+++ b/tests/filesystem/web_root_path_test.php
@@ -0,0 +1,142 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+class phpbb_filesystem_web_root_path_test extends phpbb_test_case
+{
+ protected $filesystem;
+ protected $phpbb_root_path = '';
+
+ public function setUp()
+ {
+ parent::setUp();
+
+ $this->set_phpbb_root_path();
+
+ $this->filesystem = new \phpbb\filesystem(
+ new \phpbb\symfony_request(
+ new phpbb_mock_request()
+ ),
+ $this->phpbb_root_path,
+ 'php'
+ );
+ }
+
+ /**
+ * Set the phpbb_root_path
+ *
+ * This is necessary because dataProvider functions are called
+ * before setUp or setUpBeforeClass; so we must set the path
+ * any time we wish to use it in one of these functions (and
+ * also in general for everything else)
+ */
+ public function set_phpbb_root_path()
+ {
+ $this->phpbb_root_path = dirname(__FILE__) . './../../phpBB/';
+ }
+
+ public function test_get_web_root_path()
+ {
+ // Symfony Request = null, so always should return phpbb_root_path
+ $this->assertEquals($this->phpbb_root_path, $this->filesystem->get_web_root_path());
+ }
+
+ public function basic_update_web_root_path_data()
+ {
+ $this->set_phpbb_root_path();
+
+ return array(
+ array(
+ $this->phpbb_root_path . 'test.php',
+ $this->phpbb_root_path . 'test.php',
+ ),
+ array(
+ 'test.php',
+ $this->phpbb_root_path . 'test.php',
+ ),
+ array(
+ $this->phpbb_root_path . $this->phpbb_root_path . 'test.php',
+ $this->phpbb_root_path . $this->phpbb_root_path . 'test.php',
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider basic_update_web_root_path_data
+ */
+ public function test_basic_update_web_root_path($input, $expected)
+ {
+ $this->assertEquals($expected, $this->filesystem->update_web_root_path($input, $symfony_request));
+ }
+
+ public function update_web_root_path_data()
+ {
+ $this->set_phpbb_root_path();
+
+ return array(
+ array(
+ $this->phpbb_root_path . 'test.php',
+ $this->phpbb_root_path . 'test.php',
+ '/',
+ ),
+ array(
+ $this->phpbb_root_path . 'test.php',
+ $this->phpbb_root_path . '../test.php',
+ '//',
+ ),
+ array(
+ $this->phpbb_root_path . 'test.php',
+ $this->phpbb_root_path . '../test.php',
+ '//',
+ 'foo/bar.php',
+ 'bar.php',
+ ),
+ array(
+ $this->phpbb_root_path . 'test.php',
+ $this->phpbb_root_path . '../../test.php',
+ '/foo/template',
+ '/phpbb3-fork/phpBB/app.php/foo/template',
+ '/phpbb3-fork/phpBB/app.php',
+ ),
+ array(
+ $this->phpbb_root_path . 'test.php',
+ $this->phpbb_root_path . '../test.php',
+ '/foo/template',
+ '/phpbb3-fork/phpBB/foo/template',
+ '/phpbb3-fork/phpBB/app.php',
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider update_web_root_path_data
+ */
+ public function test_update_web_root_path($input, $expected, $getPathInfo, $getRequestUri = null, $getScriptName = null)
+ {
+ $symfony_request = $this->getMock("\phpbb\symfony_request", array(), array(
+ new phpbb_mock_request(),
+ ));
+ $symfony_request->expects($this->any())
+ ->method('getPathInfo')
+ ->will($this->returnValue($getPathInfo));
+ $symfony_request->expects($this->any())
+ ->method('getRequestUri')
+ ->will($this->returnValue($getRequestUri));
+ $symfony_request->expects($this->any())
+ ->method('getScriptName')
+ ->will($this->returnValue($getScriptName));
+
+ $filesystem = new \phpbb\filesystem(
+ $symfony_request,
+ $this->phpbb_root_path,
+ 'php'
+ );
+
+ $this->assertEquals($expected, $filesystem->update_web_root_path($input, $symfony_request));
+ }
+}
diff --git a/tests/functional/acp_permissions_test.php b/tests/functional/acp_permissions_test.php
index a3d272906f..e17f33dc96 100644
--- a/tests/functional/acp_permissions_test.php
+++ b/tests/functional/acp_permissions_test.php
@@ -91,12 +91,12 @@ class phpbb_functional_acp_permissions_test extends phpbb_functional_test_case
$crawler = self::request('GET', "adm/index.php?i=acp_permissions&icat=16&mode=$mode&${object_name}[0]=$object_id&type=$permission_type&sid=" . $this->sid);
$this->assertContains($this->lang('ACL_SET'), $crawler->filter('h1')->eq(1)->text());
- // XXX globals for phpbb_auth, refactor it later
+ // XXX globals for \phpbb\auth\auth, refactor it later
global $db, $cache;
$db = $this->get_db();
$cache = new phpbb_mock_null_cache;
- $auth = new phpbb_auth;
+ $auth = new \phpbb\auth\auth;
// XXX hardcoded id
$user_data = $auth->obtain_user_data(2);
$auth->acl($user_data);
@@ -114,7 +114,7 @@ class phpbb_functional_acp_permissions_test extends phpbb_functional_test_case
$this->assertContains($this->lang('AUTH_UPDATED'), $crawler->text());
// check acl again
- $auth = new phpbb_auth;
+ $auth = new \phpbb\auth\auth;
// XXX hardcoded id
$user_data = $auth->obtain_user_data(2);
$auth->acl($user_data);
diff --git a/tests/functional/common_avatar_test.php b/tests/functional/common_avatar_test.php
index c0f21d07c2..1fd8f2ed6f 100644
--- a/tests/functional/common_avatar_test.php
+++ b/tests/functional/common_avatar_test.php
@@ -32,7 +32,7 @@ abstract class phpbb_functional_common_avatar_test extends phpbb_functional_test
$crawler = self::request('GET', 'adm/index.php?i=acp_board&mode=avatar&sid=' . $this->sid);
// Check the default entries we should have
$this->assertContainsLang('ALLOW_GRAVATAR', $crawler->text());
- $this->assertContainsLang('ALLOW_REMOTE', $crawler->text());
+ $this->assertContainsLang('ALLOW_REMOTE_UPLOAD', $crawler->text());
$this->assertContainsLang('ALLOW_AVATARS', $crawler->text());
$this->assertContainsLang('ALLOW_LOCAL', $crawler->text());
diff --git a/tests/functional/common_groups_test.php b/tests/functional/common_groups_test.php
index 6c6572af62..950db24767 100644
--- a/tests/functional/common_groups_test.php
+++ b/tests/functional/common_groups_test.php
@@ -43,7 +43,7 @@ abstract class phpbb_functional_common_groups_test extends phpbb_functional_test
$crawler = self::request('GET', 'adm/index.php?i=board&mode=avatar&sid=' . $this->sid);
// Check the default entries we should have
- $this->assertContains($this->lang('ALLOW_REMOTE'), $crawler->text());
+ $this->assertContains($this->lang('ALLOW_REMOTE_UPLOAD'), $crawler->text());
$this->assertContains($this->lang('ALLOW_AVATARS'), $crawler->text());
$this->assertContains($this->lang('ALLOW_LOCAL'), $crawler->text());
diff --git a/tests/functional/extension_controller_test.php b/tests/functional/extension_controller_test.php
index 7d29f0000c..41bd48c204 100644
--- a/tests/functional/extension_controller_test.php
+++ b/tests/functional/extension_controller_test.php
@@ -52,7 +52,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
public function test_foo_bar()
{
$this->phpbb_extension_manager->enable('foo/bar');
- $crawler = self::request('GET', 'app.php?controller=foo/bar', array(), false);
+ $crawler = self::request('GET', 'app.php/foo/bar', array(), false);
self::assert_response_status_code();
$this->assertContains("foo/bar controller handle() method", $crawler->filter('body')->text());
$this->phpbb_extension_manager->purge('foo/bar');
@@ -64,7 +64,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
public function test_controller_with_template()
{
$this->phpbb_extension_manager->enable('foo/bar');
- $crawler = self::request('GET', 'app.php?controller=foo/template');
+ $crawler = self::request('GET', 'app.php/foo/template');
$this->assertContains("I am a variable", $crawler->filter('#content')->text());
$this->phpbb_extension_manager->purge('foo/bar');
}
@@ -76,9 +76,9 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
public function test_missing_argument()
{
$this->phpbb_extension_manager->enable('foo/bar');
- $crawler = self::request('GET', 'app.php?controller=foo/baz', array(), false);
+ $crawler = self::request('GET', 'app.php/foo/baz', array(), false);
$this->assert_response_html(500);
- $this->assertContains('Missing value for argument #1: test in class phpbb_ext_foo_bar_controller:baz', $crawler->filter('body')->text());
+ $this->assertContains('Missing value for argument #1: test in class foo\bar\controller\controller:baz', $crawler->filter('body')->text());
$this->phpbb_extension_manager->purge('foo/bar');
}
@@ -88,7 +88,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
public function test_exception_should_result_in_500_status_code()
{
$this->phpbb_extension_manager->enable('foo/bar');
- $crawler = self::request('GET', 'app.php?controller=foo/exception', array(), false);
+ $crawler = self::request('GET', 'app.php/foo/exception', array(), false);
$this->assert_response_html(500);
$this->assertContains('Exception thrown from foo/exception route', $crawler->filter('body')->text());
$this->phpbb_extension_manager->purge('foo/bar');
@@ -105,7 +105,7 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
*/
public function test_error_ext_disabled_or_404()
{
- $crawler = self::request('GET', 'app.php?controller=does/not/exist', array(), false);
+ $crawler = self::request('GET', 'app.php/does/not/exist', array(), false);
$this->assert_response_html(404);
$this->assertContains('No route found for "GET /does/not/exist"', $crawler->filter('body')->text());
}
diff --git a/tests/functional/extension_module_test.php b/tests/functional/extension_module_test.php
index c31a892ce9..090cd38daf 100644
--- a/tests/functional/extension_module_test.php
+++ b/tests/functional/extension_module_test.php
@@ -69,7 +69,7 @@ class phpbb_functional_extension_module_test extends phpbb_functional_test_case
$modules->update_module_data($parent_data, true);
$module_data = array(
- 'module_basename' => 'phpbb_ext_foo_bar_acp_main_module',
+ 'module_basename' => 'foo\\bar\\acp\\main_module',
'module_enabled' => 1,
'module_display' => 1,
'parent_id' => $parent_data['module_id'],
@@ -90,7 +90,7 @@ class phpbb_functional_extension_module_test extends phpbb_functional_test_case
{
$this->login();
$this->admin_login();
- $crawler = self::request('GET', 'adm/index.php?i=phpbb_ext_foo_bar_acp_main_module&mode=mode&sid=' . $this->sid);
+ $crawler = self::request('GET', 'adm/index.php?i=foo%5cbar%5cacp%5cmain_module&mode=mode&sid=' . $this->sid);
$this->assertContains("Bertie rulez!", $crawler->filter('#main')->text());
$this->phpbb_extension_manager->purge('foo/bar');
}
diff --git a/tests/functional/fixtures/ext/foo/bar/acp/main_info.php b/tests/functional/fixtures/ext/foo/bar/acp/main_info.php
index 21e38b09b5..2ad6d08503 100644
--- a/tests/functional/fixtures/ext/foo/bar/acp/main_info.php
+++ b/tests/functional/fixtures/ext/foo/bar/acp/main_info.php
@@ -8,6 +8,8 @@
*
*/
+namespace foo\bar\acp;
+
/**
* @ignore
*/
@@ -16,12 +18,12 @@ if (!defined('IN_PHPBB'))
exit;
}
-class phpbb_ext_foo_bar_acp_main_info
+class main_info
{
function module()
{
return array(
- 'filename' => 'phpbb_ext_foo_bar_acp_main_module',
+ 'filename' => 'foo\bar\acp\main_module',
'title' => 'ACP_FOOBAR_TITLE',
'version' => '1.0.0',
'modes' => array(
diff --git a/tests/functional/fixtures/ext/foo/bar/acp/main_module.php b/tests/functional/fixtures/ext/foo/bar/acp/main_module.php
index c4ab69fb38..c59b3c6820 100644
--- a/tests/functional/fixtures/ext/foo/bar/acp/main_module.php
+++ b/tests/functional/fixtures/ext/foo/bar/acp/main_module.php
@@ -8,6 +8,8 @@
*
*/
+namespace foo\bar\acp;
+
/**
* @ignore
*/
@@ -16,7 +18,7 @@ if (!defined('IN_PHPBB'))
exit;
}
-class phpbb_ext_foo_bar_acp_main_module
+class main_module
{
var $u_action;
diff --git a/tests/functional/fixtures/ext/foo/bar/config/services.yml b/tests/functional/fixtures/ext/foo/bar/config/services.yml
index 33ced55af9..3bca4c6567 100644
--- a/tests/functional/fixtures/ext/foo/bar/config/services.yml
+++ b/tests/functional/fixtures/ext/foo/bar/config/services.yml
@@ -1,6 +1,6 @@
services:
foo_bar.controller:
- class: phpbb_ext_foo_bar_controller
+ class: foo\bar\controller\controller
arguments:
- @controller.helper
- @template
diff --git a/tests/functional/fixtures/ext/foo/bar/controller/controller.php b/tests/functional/fixtures/ext/foo/bar/controller/controller.php
index 5a91b5f681..259d548299 100644
--- a/tests/functional/fixtures/ext/foo/bar/controller/controller.php
+++ b/tests/functional/fixtures/ext/foo/bar/controller/controller.php
@@ -1,11 +1,14 @@
<?php
+
+namespace foo\bar\controller;
+
use Symfony\Component\HttpFoundation\Response;
-class phpbb_ext_foo_bar_controller
+class controller
{
protected $template;
- public function __construct(phpbb_controller_helper $helper, phpbb_template $template)
+ public function __construct(\phpbb\controller\helper $helper, \phpbb\template\template $template)
{
$this->template = $template;
$this->helper = $helper;
@@ -30,6 +33,6 @@ class phpbb_ext_foo_bar_controller
public function exception()
{
- throw new phpbb_controller_exception('Exception thrown from foo/exception route');
+ throw new \phpbb\controller\exception('Exception thrown from foo/exception route');
}
}
diff --git a/tests/functional/fixtures/ext/foo/bar/event/permission.php b/tests/functional/fixtures/ext/foo/bar/event/permission.php
index 48688a586a..92e24074ad 100644
--- a/tests/functional/fixtures/ext/foo/bar/event/permission.php
+++ b/tests/functional/fixtures/ext/foo/bar/event/permission.php
@@ -8,6 +8,8 @@
*
*/
+namespace foo\bar\event;
+
/**
* @ignore
*/
@@ -22,7 +24,7 @@ if (!defined('IN_PHPBB'))
*/
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
-class phpbb_ext_foo_bar_event_permission implements EventSubscriberInterface
+class permission implements EventSubscriberInterface
{
static public function getSubscribedEvents()
{
diff --git a/tests/functional/fixtures/ext/foo/bar/event/user_setup.php b/tests/functional/fixtures/ext/foo/bar/event/user_setup.php
index 3d2d0c5325..1409f97470 100644
--- a/tests/functional/fixtures/ext/foo/bar/event/user_setup.php
+++ b/tests/functional/fixtures/ext/foo/bar/event/user_setup.php
@@ -8,6 +8,8 @@
*
*/
+namespace foo\bar\event;
+
/**
* @ignore
*/
@@ -22,7 +24,7 @@ if (!defined('IN_PHPBB'))
*/
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
-class phpbb_ext_foo_bar_event_user_setup implements EventSubscriberInterface
+class user_setup implements EventSubscriberInterface
{
static public function getSubscribedEvents()
{
diff --git a/tests/functional/fixtures/ext/foo/bar/ext.php b/tests/functional/fixtures/ext/foo/bar/ext.php
index 74359d51ab..1288edd5ec 100644
--- a/tests/functional/fixtures/ext/foo/bar/ext.php
+++ b/tests/functional/fixtures/ext/foo/bar/ext.php
@@ -1,6 +1,8 @@
<?php
-class phpbb_ext_foo_bar_ext extends phpbb_extension_base
+namespace foo\bar;
+
+class ext extends \phpbb\extension\base
{
}
diff --git a/tests/functional/posting_test.php b/tests/functional/posting_test.php
index 7fd1e4fdcf..dd95704952 100644
--- a/tests/functional/posting_test.php
+++ b/tests/functional/posting_test.php
@@ -22,8 +22,8 @@ class phpbb_functional_posting_test extends phpbb_functional_test_case
$crawler = self::request('GET', "viewtopic.php?t={$post['topic_id']}&sid={$this->sid}");
$this->assertContains('This is a test topic posted by the testing framework.', $crawler->filter('html')->text());
- // Test creating a reply
- $post2 = $this->create_post(2, $post['topic_id'], 'Re: Test Topic 1', 'This is a test post posted by the testing framework.');
+ // Test creating a reply with bbcode
+ $post2 = $this->create_post(2, $post['topic_id'], 'Re: Test Topic 1', 'This is a test [b]post[/b] posted by the testing framework.');
$crawler = self::request('GET', "viewtopic.php?t={$post2['topic_id']}&sid={$this->sid}");
$this->assertContains('This is a test post posted by the testing framework.', $crawler->filter('html')->text());
diff --git a/tests/functional/registration_test.php b/tests/functional/registration_test.php
new file mode 100644
index 0000000000..5baf33c59e
--- /dev/null
+++ b/tests/functional/registration_test.php
@@ -0,0 +1,52 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+/**
+* @group functional
+*/
+class phpbb_functional_registration_test extends phpbb_functional_test_case
+{
+ public function test_disable_captcha_on_registration()
+ {
+ $this->login();
+ $this->admin_login();
+
+ $crawler = self::request('GET', "adm/index.php?i=acp_board&mode=registration&sid={$this->sid}");
+ $form = $crawler->selectButton('Submit')->form();
+ $form['config[enable_confirm]']->setValue('0');
+ $crawler = self::submit($form);
+
+ $this->assertContainsLang('CONFIG_UPDATED', $crawler->filter('#main .successbox')->text());
+ }
+
+ /**
+ * @depends test_disable_captcha_on_registration
+ */
+ public function test_register_new_account()
+ {
+ $this->add_lang('ucp');
+
+ $crawler = self::request('GET', 'ucp.php?mode=register');
+ $this->assertContainsLang('REGISTRATION', $crawler->filter('div.content h2')->text());
+
+ $form = $crawler->selectButton('I agree to these terms')->form();
+ $crawler = self::submit($form);
+
+ $form = $crawler->selectButton('Submit')->form(array(
+ 'username' => 'user-reg-test',
+ 'email' => 'user-reg-test@phpbb.com',
+ 'new_password' => 'testtest',
+ 'password_confirm' => 'testtest',
+ ));
+ $form['tz']->select('Europe/Berlin');
+ $crawler = self::submit($form);
+
+ $this->assertContainsLang('ACCOUNT_ADDED', $crawler->filter('#message')->text());
+ }
+}
diff --git a/tests/functions/convert_30_dbms_to_31_test.php b/tests/functions/convert_30_dbms_to_31_test.php
index d08bf87f15..4d210d7b29 100644
--- a/tests/functions/convert_30_dbms_to_31_test.php
+++ b/tests/functions/convert_30_dbms_to_31_test.php
@@ -31,7 +31,7 @@ class phpbb_convert_30_dbms_to_31_test extends phpbb_test_case
*/
public function test_convert_30_dbms_to_31($input)
{
- $expected = "phpbb_db_driver_$input";
+ $expected = "phpbb\\db\\driver\\$input";
$output = phpbb_convert_30_dbms_to_31($input);
diff --git a/tests/functions/obtain_online_test.php b/tests/functions/obtain_online_test.php
index fe372431a9..624e05f77f 100644
--- a/tests/functions/obtain_online_test.php
+++ b/tests/functions/obtain_online_test.php
@@ -160,7 +160,7 @@ class phpbb_functions_obtain_online_test extends phpbb_database_test_case
$config['load_online_guests'] = $display_guests;
$user = new phpbb_mock_lang();
$user->lang = $this->load_language();
- $auth = $this->getMock('phpbb_auth');
+ $auth = $this->getMock('\phpbb\auth\auth');
$acl_get_map = array(
array('u_viewonline', true),
array('u_viewprofile', true),
diff --git a/tests/functions_user/group_user_attributes_test.php b/tests/functions_user/group_user_attributes_test.php
index 4336fd894e..f8d52a9a6a 100644
--- a/tests/functions_user/group_user_attributes_test.php
+++ b/tests/functions_user/group_user_attributes_test.php
@@ -131,17 +131,17 @@ class phpbb_functions_user_group_user_attributes_test extends phpbb_database_tes
$cache = new phpbb_mock_cache;
$db = $this->new_dbal();
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
- $auth = $this->getMock('phpbb_auth');
+ $auth = $this->getMock('\phpbb\auth\auth');
$auth->expects($this->any())
->method('acl_clear_prefetch');
- $cache_driver = new phpbb_cache_driver_null();
+ $cache_driver = new \phpbb\cache\driver\null();
$phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
$phpbb_container
->expects($this->any())
->method('get')
->with('cache.driver')
->will($this->returnValue($cache_driver));
- $phpbb_log = new phpbb_log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
+ $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
group_user_attributes('default', $group_id, array($user_id), false, 'group_name', $group_row);
diff --git a/tests/groupposition/legend_test.php b/tests/groupposition/legend_test.php
index 16e33b390c..ac54a86b8e 100644
--- a/tests/groupposition/legend_test.php
+++ b/tests/groupposition/legend_test.php
@@ -20,7 +20,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
return array(
array(1, 0, ''),
array(3, 2, ''),
- array(4, 0, 'phpbb_groupposition_exception'),
+ array(4, 0, '\phpbb\groupposition\exception'),
);
}
@@ -33,7 +33,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
$cache = new phpbb_mock_cache;
$db = $this->new_dbal();
- $user = new phpbb_user;
+ $user = new \phpbb\user;
$user->lang = array();
if ($throws_exception)
@@ -41,7 +41,7 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
$this->setExpectedException($throws_exception);
}
- $test_class = new phpbb_groupposition_legend($db, $user);
+ $test_class = new \phpbb\groupposition\legend($db, $user);
$this->assertEquals($expected, $test_class->get_group_value($group_id));
}
@@ -51,10 +51,10 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
$cache = new phpbb_mock_cache;
$db = $this->new_dbal();
- $user = new phpbb_user;
+ $user = new \phpbb\user;
$user->lang = array();
- $test_class = new phpbb_groupposition_legend($db, $user);
+ $test_class = new \phpbb\groupposition\legend($db, $user);
$this->assertEquals(2, $test_class->get_group_count());
}
@@ -91,10 +91,10 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
$cache = new phpbb_mock_cache;
$db = $this->new_dbal();
- $user = new phpbb_user;
+ $user = new \phpbb\user;
$user->lang = array();
- $test_class = new phpbb_groupposition_legend($db, $user);
+ $test_class = new \phpbb\groupposition\legend($db, $user);
$this->assertEquals($expected_added, $test_class->add_group($group_id));
$result = $db->sql_query('SELECT group_id, group_legend
@@ -179,10 +179,10 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
$cache = new phpbb_mock_cache;
$db = $this->new_dbal();
- $user = new phpbb_user;
+ $user = new \phpbb\user;
$user->lang = array();
- $test_class = new phpbb_groupposition_legend($db, $user);
+ $test_class = new \phpbb\groupposition\legend($db, $user);
$this->assertEquals($expected_deleted, $test_class->delete_group($group_id, $skip_group));
$result = $db->sql_query('SELECT group_id, group_legend
@@ -234,10 +234,10 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
$cache = new phpbb_mock_cache;
$db = $this->new_dbal();
- $user = new phpbb_user;
+ $user = new \phpbb\user;
$user->lang = array();
- $test_class = new phpbb_groupposition_legend($db, $user);
+ $test_class = new \phpbb\groupposition\legend($db, $user);
$this->assertEquals($excepted_moved, $test_class->move_up($group_id));
$result = $db->sql_query('SELECT group_id, group_legend
@@ -289,10 +289,10 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
$cache = new phpbb_mock_cache;
$db = $this->new_dbal();
- $user = new phpbb_user;
+ $user = new \phpbb\user;
$user->lang = array();
- $test_class = new phpbb_groupposition_legend($db, $user);
+ $test_class = new \phpbb\groupposition\legend($db, $user);
$this->assertEquals($excepted_moved, $test_class->move_down($group_id));
$result = $db->sql_query('SELECT group_id, group_legend
@@ -387,10 +387,10 @@ class phpbb_groupposition_legend_test extends phpbb_database_test_case
$cache = new phpbb_mock_cache;
$db = $this->new_dbal();
- $user = new phpbb_user;
+ $user = new \phpbb\user;
$user->lang = array();
- $test_class = new phpbb_groupposition_legend($db, $user);
+ $test_class = new \phpbb\groupposition\legend($db, $user);
$this->assertEquals($excepted_moved, $test_class->move($group_id, $increment));
$result = $db->sql_query('SELECT group_id, group_legend
diff --git a/tests/groupposition/teampage_test.php b/tests/groupposition/teampage_test.php
index db26cd09d5..ec89f56775 100644
--- a/tests/groupposition/teampage_test.php
+++ b/tests/groupposition/teampage_test.php
@@ -22,7 +22,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
return array(
array(2, 3, ''),
array(6, 8, ''),
- array(10, 0, 'phpbb_groupposition_exception'),
+ array(10, 0, '\phpbb\groupposition\exception'),
);
}
@@ -35,7 +35,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
$cache = new phpbb_mock_cache;
$db = $this->new_dbal();
- $user = new phpbb_user;
+ $user = new \phpbb\user;
$user->lang = array();
if ($throws_exception)
@@ -43,7 +43,7 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
$this->setExpectedException($throws_exception);
}
- $test_class = new phpbb_groupposition_teampage($db, $user, $cache);
+ $test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
$this->assertEquals($expected, $test_class->get_group_value($group_id));
}
@@ -53,10 +53,10 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
$cache = new phpbb_mock_cache;
$db = $this->new_dbal();
- $user = new phpbb_user;
+ $user = new \phpbb\user;
$user->lang = array();
- $test_class = new phpbb_groupposition_teampage($db, $user, $cache);
+ $test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
$this->assertEquals(8, $test_class->get_group_count());
}
@@ -137,10 +137,10 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
$cache = new phpbb_mock_cache;
$db = $this->new_dbal();
- $user = new phpbb_user;
+ $user = new \phpbb\user;
$user->lang = array();
- $test_class = new phpbb_groupposition_teampage($db, $user, $cache);
+ $test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
$this->assertEquals($expected_added, $test_class->add_group_teampage($group_id, $parent_id));
$result = $db->sql_query('SELECT teampage_position, group_id, teampage_parent, teampage_name
@@ -180,10 +180,10 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
$cache = new phpbb_mock_cache;
$db = $this->new_dbal();
- $user = new phpbb_user;
+ $user = new \phpbb\user;
$user->lang = array();
- $test_class = new phpbb_groupposition_teampage($db, $user, $cache);
+ $test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
$this->assertEquals($expected_added, $test_class->add_category_teampage($group_name));
$result = $db->sql_query('SELECT teampage_position, group_id, teampage_parent, teampage_name
@@ -247,10 +247,10 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
$cache = new phpbb_mock_cache;
$db = $this->new_dbal();
- $user = new phpbb_user;
+ $user = new \phpbb\user;
$user->lang = array();
- $test_class = new phpbb_groupposition_teampage($db, $user, $cache);
+ $test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
$this->assertEquals($expected_deleted, $test_class->delete_group($group_id, false));
$result = $db->sql_query('SELECT teampage_position, group_id, teampage_parent, teampage_name
@@ -299,10 +299,10 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
$cache = new phpbb_mock_cache;
$db = $this->new_dbal();
- $user = new phpbb_user;
+ $user = new \phpbb\user;
$user->lang = array();
- $test_class = new phpbb_groupposition_teampage($db, $user, $cache);
+ $test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
$this->assertEquals($expected_deleted, $test_class->delete_teampage($teampage_id, false));
$result = $db->sql_query('SELECT teampage_position, group_id, teampage_parent, teampage_name
@@ -462,10 +462,10 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
$cache = new phpbb_mock_cache;
$db = $this->new_dbal();
- $user = new phpbb_user;
+ $user = new \phpbb\user;
$user->lang = array();
- $test_class = new phpbb_groupposition_teampage($db, $user, $cache);
+ $test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
$this->assertEquals($excepted_moved, $test_class->move($group_id, $move_delta));
$result = $db->sql_query('SELECT teampage_position, group_id, teampage_parent, teampage_name
@@ -625,10 +625,10 @@ class phpbb_groupposition_teampage_test extends phpbb_database_test_case
$cache = new phpbb_mock_cache;
$db = $this->new_dbal();
- $user = new phpbb_user;
+ $user = new \phpbb\user;
$user->lang = array();
- $test_class = new phpbb_groupposition_teampage($db, $user, $cache);
+ $test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
$this->assertEquals($excepted_moved, $test_class->move_teampage($teampage_id, $move_delta));
$result = $db->sql_query('SELECT teampage_position, group_id, teampage_parent, teampage_name
diff --git a/tests/lock/db_test.php b/tests/lock/db_test.php
index de7a23fd05..da689b7fa3 100644
--- a/tests/lock/db_test.php
+++ b/tests/lock/db_test.php
@@ -25,9 +25,9 @@ class phpbb_lock_db_test extends phpbb_database_test_case
global $db, $config;
$db = $this->db = $this->new_dbal();
- $config = $this->config = new phpbb_config(array('rand_seed' => '', 'rand_seed_last_update' => '0'));
+ $config = $this->config = new \phpbb\config\config(array('rand_seed' => '', 'rand_seed_last_update' => '0'));
set_config(null, null, null, $this->config);
- $this->lock = new phpbb_lock_db('test_lock', $this->config, $this->db);
+ $this->lock = new \phpbb\lock\db('test_lock', $this->config, $this->db);
}
public function test_new_lock()
@@ -38,7 +38,7 @@ class phpbb_lock_db_test extends phpbb_database_test_case
$this->assertTrue($this->lock->owns_lock());
$this->assertTrue(isset($this->config['test_lock']), 'Lock was created');
- $lock2 = new phpbb_lock_db('test_lock', $this->config, $this->db);
+ $lock2 = new \phpbb\lock\db('test_lock', $this->config, $this->db);
$this->assertFalse($lock2->acquire());
$this->assertFalse($lock2->owns_lock());
@@ -49,7 +49,7 @@ class phpbb_lock_db_test extends phpbb_database_test_case
public function test_expire_lock()
{
- $lock = new phpbb_lock_db('foo_lock', $this->config, $this->db);
+ $lock = new \phpbb\lock\db('foo_lock', $this->config, $this->db);
$this->assertTrue($lock->acquire());
}
@@ -82,7 +82,7 @@ class phpbb_lock_db_test extends phpbb_database_test_case
$this->assertFalse($this->lock->owns_lock());
$this->assertEquals('0', $this->config['test_lock'], 'First lock is released');
- $lock2 = new phpbb_lock_db('test_lock', $this->config, $this->db);
+ $lock2 = new \phpbb\lock\db('test_lock', $this->config, $this->db);
$this->assertTrue($lock2->acquire());
$this->assertTrue($lock2->owns_lock());
$this->assertFalse(empty($this->config['test_lock']), 'Second lock is acquired');
diff --git a/tests/lock/flock_test.php b/tests/lock/flock_test.php
index 8f0b866ab3..5e5ac5aa78 100644
--- a/tests/lock/flock_test.php
+++ b/tests/lock/flock_test.php
@@ -13,7 +13,7 @@ class phpbb_lock_flock_test extends phpbb_test_case
{
$path = __DIR__ . '/../tmp/precious';
- $lock = new phpbb_lock_flock($path);
+ $lock = new \phpbb\lock\flock($path);
$ok = $lock->acquire();
$this->assertTrue($ok);
$lock->release();
@@ -23,7 +23,7 @@ class phpbb_lock_flock_test extends phpbb_test_case
{
$path = __DIR__ . '/../tmp/precious';
- $lock = new phpbb_lock_flock($path);
+ $lock = new \phpbb\lock\flock($path);
$ok = $lock->acquire();
$this->assertTrue($ok);
$this->assertTrue($lock->owns_lock());
@@ -48,11 +48,11 @@ class phpbb_lock_flock_test extends phpbb_test_case
{
$path = __DIR__ . '/../tmp/precious';
- $lock1 = new phpbb_lock_flock($path);
+ $lock1 = new \phpbb\lock\flock($path);
$ok = $lock1->acquire();
$this->assertTrue($ok);
- $lock2 = new phpbb_lock_flock($path);
+ $lock2 = new \phpbb\lock\flock($path);
$ok = $lock2->acquire();
$this->assertFalse($ok);
@@ -78,7 +78,7 @@ class phpbb_lock_flock_test extends phpbb_test_case
// wait 0.5 s, acquire the lock, note how long it took
sleep(1);
- $lock = new phpbb_lock_flock($path);
+ $lock = new \phpbb\lock\flock($path);
$start = time();
$ok = $lock->acquire();
$delta = time() - $start;
@@ -105,7 +105,7 @@ class phpbb_lock_flock_test extends phpbb_test_case
{
// child
// immediately acquire the lock and sleep for 2 s
- $lock = new phpbb_lock_flock($path);
+ $lock = new \phpbb\lock\flock($path);
$ok = $lock->acquire();
$this->assertTrue($ok);
$this->assertTrue($lock->owns_lock());
diff --git a/tests/log/add_test.php b/tests/log/add_test.php
index a5f93232f2..032546f002 100644
--- a/tests/log/add_test.php
+++ b/tests/log/add_test.php
@@ -23,10 +23,10 @@ class phpbb_log_add_test extends phpbb_database_test_case
$db = $this->new_dbal();
$cache = new phpbb_mock_cache;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
- $user = $this->getMock('phpbb_user');
- $auth = $this->getMock('phpbb_auth');
+ $user = $this->getMock('\phpbb\user');
+ $auth = $this->getMock('\phpbb\auth\auth');
- $log = new phpbb_log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
+ $log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
$this->assertTrue($log->is_enabled(), 'Initialise failed');
@@ -52,10 +52,10 @@ class phpbb_log_add_test extends phpbb_database_test_case
$db = $this->new_dbal();
$cache = new phpbb_mock_cache;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
- $user = $this->getMock('phpbb_user');
- $auth = $this->getMock('phpbb_auth');
+ $user = $this->getMock('\phpbb\user');
+ $auth = $this->getMock('\phpbb\auth\auth');
- $log = new phpbb_log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
+ $log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
$mode = 'critical';
$user_id = ANONYMOUS;
diff --git a/tests/log/function_add_log_test.php b/tests/log/function_add_log_test.php
index 7aa42be6df..e1bcd4acaf 100644
--- a/tests/log/function_add_log_test.php
+++ b/tests/log/function_add_log_test.php
@@ -157,10 +157,10 @@ class phpbb_log_function_add_log_test extends phpbb_database_test_case
$db = $this->new_dbal();
$cache = new phpbb_mock_cache;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
- $user = $this->getMock('phpbb_user');
- $auth = $this->getMock('phpbb_auth');
+ $user = $this->getMock('\phpbb\user');
+ $auth = $this->getMock('\phpbb\auth\auth');
- $phpbb_log = new phpbb_log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
+ $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
$user->ip = 'user_ip';
if ($user_id)
diff --git a/tests/log/function_view_log_test.php b/tests/log/function_view_log_test.php
index 6827aaa1b6..017484e8a7 100644
--- a/tests/log/function_view_log_test.php
+++ b/tests/log/function_view_log_test.php
@@ -306,7 +306,7 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
// Create auth mock
- $auth = $this->getMock('phpbb_auth');
+ $auth = $this->getMock('\phpbb\auth\auth');
$acl_get_map = array(
array('f_read', 23, true),
array('m_', 23, true),
@@ -333,7 +333,7 @@ class phpbb_log_function_view_log_test extends phpbb_database_test_case
'LOG_INSTALL_INSTALLED' => 'installed: %s',
);
- $phpbb_log = new phpbb_log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
+ $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
$log = array();
$this->assertEquals($expected_returned, view_log($mode, $log, $log_count, $limit, $offset, $forum_id, $topic_id, $user_id, $limit_days, $sort_by, $keywords));
diff --git a/tests/mock/auth_provider.php b/tests/mock/auth_provider.php
index 9d002334d6..734e682ee9 100644
--- a/tests/mock/auth_provider.php
+++ b/tests/mock/auth_provider.php
@@ -10,14 +10,9 @@
/**
* Mock auth provider class with basic functions to help test sessions.
*/
-class phpbb_mock_auth_provider implements phpbb_auth_provider_interface
+class phpbb_mock_auth_provider extends \phpbb\auth\provider\base
{
- function init()
- {
- return null;
- }
-
- function login($username, $password)
+ public function login($username, $password)
{
return array(
'status' => "",
@@ -25,29 +20,4 @@ class phpbb_mock_auth_provider implements phpbb_auth_provider_interface
'user_row' => "",
);
}
-
- function autologin()
- {
- return array();
- }
-
- function acp()
- {
- return array();
- }
-
- function logout($data, $new_session)
- {
- return null;
- }
-
- function validate_session($user)
- {
- return null;
- }
-
- public function get_acp_template($new_config)
- {
- return null;
- }
}
diff --git a/tests/mock/cache.php b/tests/mock/cache.php
index 440592665a..83bbb8ef30 100644
--- a/tests/mock/cache.php
+++ b/tests/mock/cache.php
@@ -7,7 +7,7 @@
*
*/
-class phpbb_mock_cache implements phpbb_cache_driver_interface
+class phpbb_mock_cache implements \phpbb\cache\driver\driver_interface
{
protected $data;
@@ -140,7 +140,7 @@ class phpbb_mock_cache implements phpbb_cache_driver_interface
/**
* {@inheritDoc}
*/
- 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)
{
return $query_result;
}
diff --git a/tests/mock/extension_manager.php b/tests/mock/extension_manager.php
index 10b3595206..0c6b8447f1 100644
--- a/tests/mock/extension_manager.php
+++ b/tests/mock/extension_manager.php
@@ -7,13 +7,19 @@
*
*/
-class phpbb_mock_extension_manager extends phpbb_extension_manager
+class phpbb_mock_extension_manager extends \phpbb\extension\manager
{
public function __construct($phpbb_root_path, $extensions = array())
{
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = 'php';
$this->extensions = $extensions;
- $this->filesystem = new phpbb_filesystem();
+ $this->filesystem = new \phpbb\filesystem(
+ new \phpbb\symfony_request(
+ new phpbb_mock_request()
+ ),
+ $this->phpbb_root_path,
+ $this->php_ext
+ );
}
}
diff --git a/tests/mock/metadata_manager.php b/tests/mock/metadata_manager.php
index a7fbf0681c..b6489acfa4 100644
--- a/tests/mock/metadata_manager.php
+++ b/tests/mock/metadata_manager.php
@@ -7,7 +7,7 @@
*
*/
-class phpbb_mock_metadata_manager extends phpbb_extension_metadata_manager
+class phpbb_mock_metadata_manager extends \phpbb\extension\metadata_manager
{
public function set_metadata($metadata)
{
diff --git a/tests/mock/notifications_auth.php b/tests/mock/notifications_auth.php
index d960acb81a..2d387d8c00 100644
--- a/tests/mock/notifications_auth.php
+++ b/tests/mock/notifications_auth.php
@@ -7,7 +7,7 @@
*
*/
-class phpbb_mock_notifications_auth extends phpbb_auth
+class phpbb_mock_notifications_auth extends \phpbb\auth\auth
{
function acl_get_list($user_id = false, $opts = false, $forum_id = false)
{
diff --git a/tests/mock/request.php b/tests/mock/request.php
index 2a272fc03b..60ba725abd 100644
--- a/tests/mock/request.php
+++ b/tests/mock/request.php
@@ -7,33 +7,33 @@
*
*/
-class phpbb_mock_request implements phpbb_request_interface
+class phpbb_mock_request implements \phpbb\request\request_interface
{
protected $data;
public function __construct($get = array(), $post = array(), $cookie = array(), $server = array(), $request = false, $files = array())
{
- $this->data[phpbb_request_interface::GET] = $get;
- $this->data[phpbb_request_interface::POST] = $post;
- $this->data[phpbb_request_interface::COOKIE] = $cookie;
- $this->data[phpbb_request_interface::REQUEST] = ($request === false) ? $post + $get : $request;
- $this->data[phpbb_request_interface::SERVER] = $server;
- $this->data[phpbb_request_interface::FILES] = $files;
+ $this->data[\phpbb\request\request_interface::GET] = $get;
+ $this->data[\phpbb\request\request_interface::POST] = $post;
+ $this->data[\phpbb\request\request_interface::COOKIE] = $cookie;
+ $this->data[\phpbb\request\request_interface::REQUEST] = ($request === false) ? $post + $get : $request;
+ $this->data[\phpbb\request\request_interface::SERVER] = $server;
+ $this->data[\phpbb\request\request_interface::FILES] = $files;
}
- public function overwrite($var_name, $value, $super_global = phpbb_request_interface::REQUEST)
+ public function overwrite($var_name, $value, $super_global = \phpbb\request\request_interface::REQUEST)
{
$this->data[$super_global][$var_name] = $value;
}
- public function variable($var_name, $default, $multibyte = false, $super_global = phpbb_request_interface::REQUEST)
+ public function variable($var_name, $default, $multibyte = false, $super_global = \phpbb\request\request_interface::REQUEST)
{
return isset($this->data[$super_global][$var_name]) ? $this->data[$super_global][$var_name] : $default;
}
public function server($var_name, $default = '')
{
- $super_global = phpbb_request_interface::SERVER;
+ $super_global = \phpbb\request\request_interface::SERVER;
return isset($this->data[$super_global][$var_name]) ? $this->data[$super_global][$var_name] : $default;
}
@@ -45,16 +45,16 @@ class phpbb_mock_request implements phpbb_request_interface
public function file($form_name)
{
- $super_global = phpbb_request_interface::FILES;
+ $super_global = \phpbb\request\request_interface::FILES;
return isset($this->data[$super_global][$form_name]) ? $this->data[$super_global][$form_name] : array();
}
public function is_set_post($name)
{
- return $this->is_set($name, phpbb_request_interface::POST);
+ return $this->is_set($name, \phpbb\request\request_interface::POST);
}
- public function is_set($var, $super_global = phpbb_request_interface::REQUEST)
+ public function is_set($var, $super_global = \phpbb\request\request_interface::REQUEST)
{
return isset($this->data[$super_global][$var]);
}
@@ -69,20 +69,25 @@ class phpbb_mock_request implements phpbb_request_interface
return false;
}
- public function variable_names($super_global = phpbb_request_interface::REQUEST)
+ public function variable_names($super_global = \phpbb\request\request_interface::REQUEST)
{
return array_keys($this->data[$super_global]);
}
+ public function get_super_global($super_global = \phpbb\request\request_interface::REQUEST)
+ {
+ return $this->data[$super_global];
+ }
+
/* custom methods */
public function set_header($header_name, $value)
{
$var_name = 'HTTP_' . str_replace('-', '_', strtoupper($header_name));
- $this->data[phpbb_request_interface::SERVER][$var_name] = $value;
+ $this->data[\phpbb\request\request_interface::SERVER][$var_name] = $value;
}
- public function merge($super_global = phpbb_request_interface::REQUEST, $values)
+ public function merge($super_global = \phpbb\request\request_interface::REQUEST, $values)
{
$this->data[$super_global] = array_merge($this->data[$super_global], $values);
}
diff --git a/tests/mock/session_testable.php b/tests/mock/session_testable.php
index 283f9af192..d81ae3163e 100644
--- a/tests/mock/session_testable.php
+++ b/tests/mock/session_testable.php
@@ -16,7 +16,7 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
* test it without warnings about sent headers. This class only stores cookie
* data for later verification.
*/
-class phpbb_mock_session_testable extends phpbb_session
+class phpbb_mock_session_testable extends \phpbb\session
{
private $_cookies = array();
diff --git a/tests/mock/sql_insert_buffer.php b/tests/mock/sql_insert_buffer.php
index ba09aa8d7f..aa7c54dddd 100644
--- a/tests/mock/sql_insert_buffer.php
+++ b/tests/mock/sql_insert_buffer.php
@@ -7,7 +7,7 @@
*
*/
-class phpbb_mock_sql_insert_buffer extends phpbb_db_sql_insert_buffer
+class phpbb_mock_sql_insert_buffer extends \phpbb\db\sql_insert_buffer
{
public function flush()
{
diff --git a/tests/notification/base.php b/tests/notification/base.php
new file mode 100644
index 0000000000..549545f01b
--- /dev/null
+++ b/tests/notification/base.php
@@ -0,0 +1,131 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__) . '/manager_helper.php';
+
+abstract class phpbb_tests_notification_base extends phpbb_database_test_case
+{
+ protected $notifications, $db, $container, $user, $config, $auth, $cache;
+
+ protected function get_notification_types()
+ {
+ return array(
+ 'test',
+ 'approve_post',
+ 'approve_topic',
+ 'bookmark',
+ 'disapprove_post',
+ 'disapprove_topic',
+ 'pm',
+ 'post',
+ 'post_in_queue',
+ 'quote',
+ 'report_pm',
+ 'report_pm_closed',
+ 'report_post',
+ 'report_post_closed',
+ 'topic',
+ 'topic_in_queue',
+ );
+ }
+
+ protected function setUp()
+ {
+ parent::setUp();
+
+ global $phpbb_root_path, $phpEx;
+
+ include_once(__DIR__ . '/ext/test/notification/type/test.' . $phpEx);
+
+ global $db, $config, $user, $auth, $cache, $phpbb_container;
+
+ $db = $this->db = $this->new_dbal();
+ $config = $this->config = new \phpbb\config\config(array(
+ 'allow_privmsg' => true,
+ 'allow_bookmarks' => true,
+ 'allow_topic_notify' => true,
+ 'allow_forum_notify' => true,
+ ));
+ $user = $this->user = new \phpbb\user();
+ $this->user_loader = new \phpbb\user_loader($this->db, $phpbb_root_path, $phpEx, 'phpbb_users');
+ $auth = $this->auth = new phpbb_mock_notifications_auth();
+ $cache = $this->cache = new \phpbb\cache\service(
+ new \phpbb\cache\driver\null(),
+ $this->config,
+ $this->db,
+ $phpbb_root_path,
+ $phpEx
+ );
+
+ $phpbb_container = $this->container = new phpbb_mock_container_builder();
+
+ $this->notifications = new phpbb_notification_manager_helper(
+ array(),
+ array(),
+ $this->container,
+ $this->user_loader,
+ $this->db,
+ $this->cache,
+ $this->user,
+ $phpbb_root_path,
+ $phpEx,
+ 'phpbb_notification_types',
+ 'phpbb_notifications',
+ 'phpbb_user_notifications'
+ );
+
+ $phpbb_container->set('notification_manager', $this->notifications);
+
+ $this->notifications->setDependencies($this->auth, $this->config);
+
+ $types = array();
+ foreach ($this->get_notification_types() as $type)
+ {
+ $class = $this->build_type('phpbb\notification\type\\' . $type);
+
+ $types[$type] = $class;
+ $this->container->set('notification.type.' . $type, $class);
+ }
+
+ $this->notifications->set_var('notification_types', $types);
+
+ $this->db->sql_query('DELETE FROM phpbb_notification_types');
+ $this->db->sql_query('DELETE FROM phpbb_notifications');
+ $this->db->sql_query('DELETE FROM phpbb_user_notifications');
+ }
+
+ protected function build_type($type)
+ {
+ global $phpbb_root_path, $phpEx;
+
+ return new $type($this->user_loader, $this->db, $this->cache->get_driver(), $this->user, $this->auth, $this->config, $phpbb_root_path, $phpEx, 'phpbb_notification_types', 'phpbb_notifications', 'phpbb_user_notifications');
+ }
+
+ protected function assert_notifications($expected, $options = array())
+ {
+ $notifications = $this->notifications->load_notifications(array_merge(array(
+ 'count_unread' => true,
+ 'order_by' => 'notification_time',
+ 'order_dir' => 'ASC',
+ ), $options));
+
+ $this->assertEquals(sizeof($expected), $notifications['unread_count']);
+
+ $i = 0;
+ foreach ($notifications['notifications'] as $notification)
+ {
+ foreach ($expected[$i] as $key => $value)
+ {
+ $this->assertEquals($value, $notification->$key, $i . ' ' . $key);
+ }
+
+ $i++;
+ }
+ }
+}
diff --git a/tests/notification/convert_test.php b/tests/notification/convert_test.php
index c038020385..ed1fa9b1bf 100644
--- a/tests/notification/convert_test.php
+++ b/tests/notification/convert_test.php
@@ -25,10 +25,10 @@ class phpbb_notification_convert_test extends phpbb_database_test_case
$this->db = $this->new_dbal();
- $this->migration = new phpbb_db_migration_data_310_notification_options_reconvert(
- new phpbb_config(array()),
+ $this->migration = new \phpbb\db\migration\data\v310\notification_options_reconvert(
+ new \phpbb\config\config(array()),
$this->db,
- new phpbb_db_tools($this->db),
+ new \phpbb\db\tools($this->db),
$phpbb_root_path,
$phpEx,
'phpbb_'
diff --git a/tests/notification/ext/test/notification/type/test.php b/tests/notification/ext/test/notification/type/test.php
index 0d0c584e0d..cdb921ca3b 100644
--- a/tests/notification/ext/test/notification/type/test.php
+++ b/tests/notification/ext/test/notification/type/test.php
@@ -7,6 +7,8 @@
*
*/
+namespace phpbb\notification\type;
+
/**
* @ignore
*/
@@ -15,7 +17,7 @@ if (!defined('IN_PHPBB'))
exit;
}
-class phpbb_notification_type_test extends phpbb_notification_type_base
+class test extends \phpbb\notification\type\base
{
public function get_type()
{
diff --git a/tests/notification/fixtures/group_request.xml b/tests/notification/fixtures/group_request.xml
new file mode 100644
index 0000000000..1eb73f1e15
--- /dev/null
+++ b/tests/notification/fixtures/group_request.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<dataset>
+ <table name="phpbb_users">
+ <column>user_id</column>
+ <column>username</column>
+ <column>username_clean</column>
+ <column>user_permissions</column>
+ <column>user_sig</column>
+ <column>user_occ</column>
+ <column>user_interests</column>
+ <row>
+ <value>2</value>
+ <value>2</value>
+ <value>2</value>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </row>
+ <row>
+ <value>3</value>
+ <value>3</value>
+ <value>3</value>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </row>
+ </table>
+</dataset>
diff --git a/tests/notification/group_request_test.php b/tests/notification/group_request_test.php
new file mode 100644
index 0000000000..b812fff8f8
--- /dev/null
+++ b/tests/notification/group_request_test.php
@@ -0,0 +1,109 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__) . '/base.php';
+
+class phpbb_notification_group_request_test extends phpbb_tests_notification_base
+{
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/group_request.xml');
+ }
+
+ protected function get_notification_types()
+ {
+ return array_merge(
+ parent::get_notification_types(),
+ array(
+ 'group_request',
+ 'group_request_approved',
+ )
+ );
+ }
+
+ public function test_notifications()
+ {
+ global $phpbb_root_path, $phpEx, $phpbb_dispatcher, $phpbb_log;
+
+ include_once($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx);
+ include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
+ include_once($phpbb_root_path . 'includes/functions_content.' . $phpEx);
+
+ set_config(false, false, false, $this->config);
+
+ $this->container->set('groupposition.legend', new \phpbb\groupposition\legend(
+ $this->db,
+ $this->user
+ ));
+ $this->container->set('groupposition.teampage', new \phpbb\groupposition\teampage(
+ $this->db,
+ $this->user,
+ $this->cache->get_driver()
+ ));
+ $phpbb_dispatcher = new phpbb_mock_event_dispatcher;
+ $phpbb_log = new \phpbb\log\null();
+
+ // Now on to the actual test
+
+ $group_id = false;
+ group_create($group_id, GROUP_OPEN, 'test', 'test group', array());
+
+ // Add user 2 as group leader
+ group_user_add($group_id, 2, false, false, false, true, false);
+
+ // Add user 3 as pending
+ group_user_add($group_id, 3, false, false, false, false, true);
+
+ $this->assert_notifications(
+ array(
+ // user 3 pending notification
+ array(
+ 'item_id' => 3, // user_id of requesting join
+ 'item_parent_id' => $group_id,
+ 'user_id' => 2,
+ 'notification_read' => 0,
+ 'notification_data' => array(
+ 'group_name' => 'test',
+ ),
+ ),
+ ),
+ array(
+ 'user_id' => 2,
+ )
+ );
+
+ // Approve user 3 joining the group
+ group_user_attributes('approve', $group_id, array(3));
+
+ // user 3 pending notification should have been deleted
+ $this->assert_notifications(
+ array(),
+ array(
+ 'user_id' => 2,
+ )
+ );
+
+ $this->assert_notifications(
+ array(
+ // user 3 approved notification
+ array(
+ 'item_id' => $group_id, // user_id of requesting join
+ 'user_id' => 3,
+ 'notification_read' => 0,
+ 'notification_data' => array(
+ 'group_name' => 'test',
+ ),
+ ),
+ ),
+ array(
+ 'user_id' => 3,
+ )
+ );
+ }
+}
diff --git a/tests/notification/manager_helper.php b/tests/notification/manager_helper.php
index 7a794f922f..731dd00b7a 100644
--- a/tests/notification/manager_helper.php
+++ b/tests/notification/manager_helper.php
@@ -19,7 +19,7 @@ if (!defined('IN_PHPBB'))
* Notifications service class
* @package notifications
*/
-class phpbb_notification_manager_helper extends phpbb_notification_manager
+class phpbb_notification_manager_helper extends \phpbb\notification\manager
{
public function set_var($name, $value)
{
@@ -40,7 +40,7 @@ class phpbb_notification_manager_helper extends phpbb_notification_manager
*/
public function get_item_type_class($item_type, $data = array())
{
- $item_type = 'phpbb_notification_type_' . $item_type;
+ $item_type = 'phpbb\notification\type\\' . $item_type;
$item = new $item_type($this->user_loader, $this->db, $this->cache->get_driver(), $this->user, $this->auth, $this->config, $this->phpbb_root_path, $this->php_ext, $this->notification_types_table, $this->notifications_table, $this->user_notifications_table);
@@ -56,7 +56,7 @@ class phpbb_notification_manager_helper extends phpbb_notification_manager
*/
public function get_method_class($method_name)
{
- $method_name = 'phpbb_notification_method_' . $method_name;
+ $method_name = 'phpbb\notification\method\\' . $method_name;
$method = new $method_name($this->user_loader, $this->db, $this->cache->get_driver(), $this->user, $this->auth, $this->config, $this->phpbb_root_path, $this->php_ext, $this->notification_types_table, $this->notifications_table, $this->user_notifications_table);
diff --git a/tests/notification/notification_test.php b/tests/notification/notification_test.php
index 8f7eb3b8a8..e1788e8670 100644
--- a/tests/notification/notification_test.php
+++ b/tests/notification/notification_test.php
@@ -7,9 +7,9 @@
*
*/
-require_once dirname(__FILE__) . '/manager_helper.php';
+require_once dirname(__FILE__) . '/base.php';
-class phpbb_notification_test extends phpbb_database_test_case
+class phpbb_notification_test extends phpbb_tests_notification_base
{
protected $notifications, $db, $container, $user, $config, $auth, $cache;
@@ -18,98 +18,17 @@ class phpbb_notification_test extends phpbb_database_test_case
return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/notification.xml');
}
- protected function setUp()
- {
- parent::setUp();
-
- global $phpbb_root_path, $phpEx;
-
- include_once(__DIR__ . '/ext/test/notification/type/test.' . $phpEx);
-
- $this->db = $this->new_dbal();
- $this->config = new phpbb_config(array(
- 'allow_privmsg' => true,
- 'allow_bookmarks' => true,
- 'allow_topic_notify' => true,
- 'allow_forum_notify' => true,
- ));
- $this->user = new phpbb_user();
- $this->user_loader = new phpbb_user_loader($this->db, $phpbb_root_path, $phpEx, 'phpbb_users');
- $this->auth = new phpbb_mock_notifications_auth();
- $this->cache = new phpbb_cache_service(
- new phpbb_cache_driver_null(),
- $this->config,
- $this->db,
- $phpbb_root_path,
- $phpEx
- );
-
- $this->container = new phpbb_mock_container_builder();
-
- $this->notifications = new phpbb_notification_manager_helper(
- array(),
- array(),
- $this->container,
- $this->user_loader,
- $this->db,
- $this->cache,
- $this->user,
- $phpbb_root_path,
- $phpEx,
- 'phpbb_notification_types',
- 'phpbb_notifications',
- 'phpbb_user_notifications'
- );
-
- $this->notifications->setDependencies($this->auth, $this->config);
-
- $types = array();
- foreach (array(
- 'test',
- 'approve_post',
- 'approve_topic',
- 'bookmark',
- 'disapprove_post',
- 'disapprove_topic',
- 'pm',
- 'post',
- 'post_in_queue',
- 'quote',
- 'report_pm',
- 'report_pm_closed',
- 'report_post',
- 'report_post_closed',
- 'topic',
- 'topic_in_queue',
- ) as $type)
- {
- $class = $this->build_type('phpbb_notification_type_' . $type);
-
- $types[$type] = $class;
- $this->container->set('notification.type.' . $type, $class);
- }
-
- $this->notifications->set_var('notification_types', $types);
- }
-
- protected function build_type($type)
- {
- global $phpbb_root_path, $phpEx;
-
- return new $type($this->user_loader, $this->db, $this->cache->get_driver(), $this->user, $this->auth, $this->config, $phpbb_root_path, $phpEx, 'phpbb_notification_types', 'phpbb_notifications', 'phpbb_user_notifications');
- }
-
public function test_get_notification_type_id()
{
// They should be inserted the first time
- $this->assertEquals(1, $this->notifications->get_notification_type_id('post'));
- $this->assertEquals(2, $this->notifications->get_notification_type_id('quote'));
- $this->assertEquals(3, $this->notifications->get_notification_type_id('test'));
+ $post_type_id = $this->notifications->get_notification_type_id('post');
+ $quote_type_id = $this->notifications->get_notification_type_id('quote');
+ $test_type_id = $this->notifications->get_notification_type_id('test');
$this->assertEquals(array(
- 'test' => 3,
- 'quote' => 2,
- 'post' => 1,
+ 'test' => $test_type_id,
+ 'quote' => $quote_type_id,
+ 'post' => $post_type_id,
),
$this->notifications->get_notification_type_ids(array(
'test',
@@ -117,11 +36,11 @@ class phpbb_notification_test extends phpbb_database_test_case
'post',
)
));
- $this->assertEquals(2, $this->notifications->get_notification_type_id('quote'));
+ $this->assertEquals($quote_type_id, $this->notifications->get_notification_type_id('quote'));
try
{
- $this->assertEquals(3, $this->notifications->get_notification_type_id('fail'));
+ $this->assertEquals(false, $this->notifications->get_notification_type_id('fail'));
$this->fail('Non-existent type should throw an exception');
}
@@ -241,88 +160,65 @@ class phpbb_notification_test extends phpbb_database_test_case
'post_time' => 1349413326,
));
- $notifications = $this->notifications->load_notifications(array(
- 'count_unread' => true,
- ));
-
- $expected = array(
- 1 => array(
- 'notification_type_id' => 4,
- 'item_id' => 1,
- 'item_parent_id' => 1,
- 'user_id' => 0,
- 'notification_read' => 0,
- 'notification_time' => 1349413321,
- 'notification_data' => array(),
- ),
- 2 => array(
- 'notification_type_id' => 4,
- 'item_id' => 2,
- 'item_parent_id' => 2,
- 'user_id' => 0,
- 'notification_read' => 0,
- 'notification_time' => 1349413322,
- 'notification_data' => array(),
- ),
- 3 => array(
- 'notification_type_id' => 4,
- 'item_id' => 3,
- 'item_parent_id' => 2,
- 'user_id' => 0,
- 'notification_read' => 0,
- 'notification_time' => 1349413323,
- 'notification_data' => array(),
- ),
- 4 => array(
- 'notification_type_id' => 3,
- 'item_id' => 4,
- 'item_parent_id' => 2,
- 'user_id' => 0,
- 'notification_read' => 0,
- 'notification_time' => 1349413324,
- 'notification_data' => array(
- 'poster_id' => 2,
- 'topic_title' => 'test-title',
- 'post_subject' => 'Re: test-title',
- 'post_username' => '',
- 'forum_id' => 2,
- 'forum_name' => 'Your first forum',
+ $this->assert_notifications(
+ array(
+ array(
+ 'item_id' => 1,
+ 'item_parent_id' => 1,
+ 'user_id' => 0,
+ 'notification_read' => 0,
+ 'notification_time' => 1349413321,
+ 'notification_data' => array(),
),
- ),
- 5 => array(
- 'notification_type_id' => 2,
- 'item_id' => 5,
- 'item_parent_id' => 2,
- 'user_id' => 0,
- 'notification_read' => 0,
- 'notification_time' => 1349413325,
- 'notification_data' => array(
- 'poster_id' => 2,
- 'topic_title' => 'test-title',
- 'post_subject' => 'Re: test-title',
- 'post_username' => '',
- 'forum_id' => 2,
- 'forum_name' => 'Your first forum',
+ array(
+ 'item_id' => 2,
+ 'item_parent_id' => 2,
+ 'user_id' => 0,
+ 'notification_read' => 0,
+ 'notification_time' => 1349413322,
+ 'notification_data' => array(),
),
- ),
+ array(
+ 'item_id' => 3,
+ 'item_parent_id' => 2,
+ 'user_id' => 0,
+ 'notification_read' => 0,
+ 'notification_time' => 1349413323,
+ 'notification_data' => array(),
+ ),
+ array(
+ 'item_id' => 4,
+ 'item_parent_id' => 2,
+ 'user_id' => 0,
+ 'notification_read' => 0,
+ 'notification_time' => 1349413324,
+ 'notification_data' => array(
+ 'poster_id' => 2,
+ 'topic_title' => 'test-title',
+ 'post_subject' => 'Re: test-title',
+ 'post_username' => '',
+ 'forum_id' => 2,
+ 'forum_name' => 'Your first forum',
+ ),
+ ),
+ array(
+ 'item_id' => 5,
+ 'item_parent_id' => 2,
+ 'user_id' => 0,
+ 'notification_read' => 0,
+ 'notification_time' => 1349413325,
+ 'notification_data' => array(
+ 'poster_id' => 2,
+ 'topic_title' => 'test-title',
+ 'post_subject' => 'Re: test-title',
+ 'post_username' => '',
+ 'forum_id' => 2,
+ 'forum_name' => 'Your first forum',
+ ),
+ ),
+ )
);
- $this->assertEquals(sizeof($expected), $notifications['unread_count']);
-
- $notifications = $notifications['notifications'];
-
- foreach ($expected as $notification_id => $notification_data)
- {
- //echo $notifications[$notification_id];
-
- $this->assertEquals($notification_id, $notifications[$notification_id]->notification_id, 'notification_id');
-
- foreach ($notification_data as $key => $value)
- {
- $this->assertEquals($value, $notifications[$notification_id]->$key, $key . ' ' . $notification_id);
- }
- }
-
// Now test updating -------------------------------
$this->notifications->update_notifications('test', array(
@@ -347,86 +243,63 @@ class phpbb_notification_test extends phpbb_database_test_case
'forum_name' => 'Your second forum', // change forum_name
));
- $notifications = $this->notifications->load_notifications(array(
- 'count_unread' => true,
- ));
-
- $expected = array(
- 1 => array(
- 'notification_type_id' => 4,
- 'item_id' => 1,
- 'item_parent_id' => 2,
- 'user_id' => 0,
- 'notification_read' => 0,
- 'notification_time' => 1349413321,
- 'notification_data' => array(),
- ),
- 2 => array(
- 'notification_type_id' => 4,
- 'item_id' => 2,
- 'item_parent_id' => 2,
- 'user_id' => 0,
- 'notification_read' => 0,
- 'notification_time' => 1349413322,
- 'notification_data' => array(),
- ),
- 3 => array(
- 'notification_type_id' => 4,
- 'item_id' => 3,
- 'item_parent_id' => 2,
- 'user_id' => 0,
- 'notification_read' => 0,
- 'notification_time' => 1234,
- 'notification_data' => array(),
- ),
- 4 => array(
- 'notification_type_id' => 3,
- 'item_id' => 4,
- 'item_parent_id' => 2,
- 'user_id' => 0,
- 'notification_read' => 0,
- 'notification_time' => 1349413324,
- 'notification_data' => array(
- 'poster_id' => 2,
- 'topic_title' => 'test-title',
- 'post_subject' => 'Re: test-title',
- 'post_username' => '',
- 'forum_id' => 2,
- 'forum_name' => 'Your first forum',
+ $this->assert_notifications(
+ array(
+ array(
+ 'item_id' => 3,
+ 'item_parent_id' => 2,
+ 'user_id' => 0,
+ 'notification_read' => 0,
+ 'notification_time' => 1234,
+ 'notification_data' => array(),
),
- ),
- 5 => array(
- 'notification_type_id' => 2,
- 'item_id' => 5,
- 'item_parent_id' => 2,
- 'user_id' => 0,
- 'notification_read' => 0,
- 'notification_time' => 1349413325,
- 'notification_data' => array(
- 'poster_id' => 2,
- 'topic_title' => 'test-title2',
- 'post_subject' => 'Re: test-title2',
- 'post_username' => '',
- 'forum_id' => 3,
- 'forum_name' => 'Your second forum',
+ array(
+ 'item_id' => 1,
+ 'item_parent_id' => 2,
+ 'user_id' => 0,
+ 'notification_read' => 0,
+ 'notification_time' => 1349413321,
+ 'notification_data' => array(),
),
- ),
+ array(
+ 'item_id' => 2,
+ 'item_parent_id' => 2,
+ 'user_id' => 0,
+ 'notification_read' => 0,
+ 'notification_time' => 1349413322,
+ 'notification_data' => array(),
+ ),
+ array(
+ 'item_id' => 4,
+ 'item_parent_id' => 2,
+ 'user_id' => 0,
+ 'notification_read' => 0,
+ 'notification_time' => 1349413324,
+ 'notification_data' => array(
+ 'poster_id' => 2,
+ 'topic_title' => 'test-title',
+ 'post_subject' => 'Re: test-title',
+ 'post_username' => '',
+ 'forum_id' => 2,
+ 'forum_name' => 'Your first forum',
+ ),
+ ),
+ array(
+ 'item_id' => 5,
+ 'item_parent_id' => 2,
+ 'user_id' => 0,
+ 'notification_read' => 0,
+ 'notification_time' => 1349413325,
+ 'notification_data' => array(
+ 'poster_id' => 2,
+ 'topic_title' => 'test-title2',
+ 'post_subject' => 'Re: test-title2',
+ 'post_username' => '',
+ 'forum_id' => 3,
+ 'forum_name' => 'Your second forum',
+ ),
+ ),
+ )
);
-
- $this->assertEquals(sizeof($expected), $notifications['unread_count']);
-
- $notifications = $notifications['notifications'];
-
- foreach ($expected as $notification_id => $notification_data)
- {
- //echo $notifications[$notification_id];
-
- $this->assertEquals($notification_id, $notifications[$notification_id]->notification_id, 'notification_id');
-
- foreach ($notification_data as $key => $value)
- {
- $this->assertEquals($value, $notifications[$notification_id]->$key, $key . ' ' . $notification_id);
- }
- }
}
}
diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php
index 4e564ce23c..8597c626a4 100644
--- a/tests/notification/submit_post_base.php
+++ b/tests/notification/submit_post_base.php
@@ -53,7 +53,7 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case
$db = $this->db;
// Auth
- $auth = $this->getMock('phpbb_auth');
+ $auth = $this->getMock('\phpbb\auth\auth');
$auth->expects($this->any())
->method('acl_get')
->with($this->stringContains('_'),
@@ -65,12 +65,12 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case
)));
// Config
- $config = new phpbb_config(array('num_topics' => 1,'num_posts' => 1,));
+ $config = new \phpbb\config\config(array('num_topics' => 1,'num_posts' => 1,));
set_config(null, null, null, $config);
set_config_count(null, null, null, $config);
- $cache = new phpbb_cache_service(
- new phpbb_cache_driver_null(),
+ $cache = new \phpbb\cache\service(
+ new \phpbb\cache\driver\null(),
$config,
$db,
$phpbb_root_path,
@@ -81,7 +81,7 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
// User
- $user = $this->getMock('phpbb_user');
+ $user = $this->getMock('\phpbb\user');
$user->ip = '';
$user->data = array(
'user_id' => 2,
@@ -91,21 +91,21 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case
);
// Request
- $type_cast_helper = $this->getMock('phpbb_request_type_cast_helper_interface');
- $request = $this->getMock('phpbb_request');
+ $type_cast_helper = $this->getMock('\phpbb\request\type_cast_helper_interface');
+ $request = $this->getMock('\phpbb\request\request');
// Container
$phpbb_container = new phpbb_mock_container_builder();
- $phpbb_container->set('content.visibility', new phpbb_content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE));
+ $phpbb_container->set('content.visibility', new \phpbb\content_visibility($auth, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE));
- $user_loader = new phpbb_user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE);
+ $user_loader = new \phpbb\user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE);
// Notification Types
$notification_types = array('quote', 'bookmark', 'post', 'post_in_queue', 'topic', 'approve_topic', 'approve_post');
$notification_types_array = array();
foreach ($notification_types as $type)
{
- $class_name = 'phpbb_notification_type_' . $type;
+ $class_name = '\phpbb\notification\type\\' . $type;
$class = new $class_name(
$user_loader, $db, $cache->get_driver(), $user, $auth, $config,
$phpbb_root_path, $phpEx,
@@ -117,7 +117,7 @@ class phpbb_notification_submit_post_base extends phpbb_database_test_case
}
// Notification Manager
- $phpbb_notifications = new phpbb_notification_manager($notification_types_array, array(),
+ $phpbb_notifications = new \phpbb\notification\manager($notification_types_array, array(),
$phpbb_container, $user_loader, $db, $cache, $user,
$phpbb_root_path, $phpEx,
NOTIFICATION_TYPES_TABLE, NOTIFICATIONS_TABLE, USER_NOTIFICATIONS_TABLE);
diff --git a/tests/pagination/generate_template_test.php b/tests/pagination/generate_template_test.php
new file mode 100644
index 0000000000..587a948583
--- /dev/null
+++ b/tests/pagination/generate_template_test.php
@@ -0,0 +1,111 @@
+<?php
+/**
+*
+* @package testing
+* @copyright (c) 2013 phpBB Group
+* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
+*
+*/
+
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
+require_once dirname(__FILE__) . '/../template/template_test_case.php';
+
+class phpbb_pagination_generate_template_test extends phpbb_template_template_test_case
+{
+ protected $test_path = 'tests/pagination';
+
+ public function phpbb_generate_template_pagination_data()
+ {
+ return array(
+ array(
+ 'page.php',
+ 'start',
+ 95,
+ 10,
+ 10,
+ 'pagination
+ :previous::page.php
+ :else:1:page.php
+ :current:2:page.php?start=10
+ :else:3:page.php?start=20
+ :else:4:page.php?start=30
+ :else:5:page.php?start=40
+ :ellipsis:9:page.php?start=80
+ :else:10:page.php?start=90
+ :next::page.php?start=20
+ :u_prev:page.php
+ :u_next:page.php?start=20',
+ ),
+ array(
+ 'page.php',
+ 'start',
+ 95,
+ 10,
+ 20,
+ 'pagination
+ :previous::page.php?start=10
+ :else:1:page.php
+ :else:2:page.php?start=10
+ :current:3:page.php?start=20
+ :else:4:page.php?start=30
+ :else:5:page.php?start=40
+ :else:6:page.php?start=50
+ :ellipsis:9:page.php?start=80
+ :else:10:page.php?start=90
+ :next::page.php?start=30
+ :u_prev:page.php?start=10
+ :u_next:page.php?start=30',
+ ),
+ array(
+ 'test/page/%d',
+ '/page/%d',
+ 95,
+ 10,
+ 10,
+ 'pagination
+ :previous::test
+ :else:1:test
+ :current:2:test/page/2
+ :else:3:test/page/3
+ :else:4:test/page/4
+ :else:5:test/page/5
+ :ellipsis:9:test/page/9
+ :else:10:test/page/10
+ :next::test/page/3
+ :u_prev:test
+ :u_next:test/page/3',
+ ),
+ array(
+ 'test/page/%d',
+ '/page/%d',
+ 95,
+ 10,
+ 20,
+ 'pagination
+ :previous::test/page/2
+ :else:1:test
+ :else:2:test/page/2
+ :current:3:test/page/3
+ :else:4:test/page/4
+ :else:5:test/page/5
+ :else:6:test/page/6
+ :ellipsis:9:test/page/9
+ :else:10:test/page/10
+ :next::test/page/4
+ :u_prev:test/page/2
+ :u_next:test/page/4',
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider phpbb_generate_template_pagination_data
+ */
+ public function test_phpbb_generate_template_pagination($base_url, $start_name, $num_items, $per_page, $start_item, $expect)
+ {
+ phpbb_generate_template_pagination($this->template, $base_url, 'pagination', $start_name, $num_items, $per_page, $start_item);
+ $this->template->set_filenames(array('test' => 'pagination.html'));
+
+ $this->assertEquals(str_replace("\t", '', $expect), $this->display('test'));
+ }
+}
diff --git a/tests/pagination/templates/pagination.html b/tests/pagination/templates/pagination.html
new file mode 100644
index 0000000000..7f2a329804
--- /dev/null
+++ b/tests/pagination/templates/pagination.html
@@ -0,0 +1,12 @@
+pagination
+<!-- BEGIN pagination -->
+<!-- IF pagination.S_IS_PREV -->:previous:{pagination.PAGE_NUMBER}:{pagination.PAGE_URL}
+<!-- ELSEIF pagination.S_IS_CURRENT -->:current:{pagination.PAGE_NUMBER}:{pagination.PAGE_URL}
+<!-- ELSEIF pagination.S_IS_ELLIPSIS -->:ellipsis:{pagination.PAGE_NUMBER}:{pagination.PAGE_URL}
+<!-- ELSEIF pagination.S_IS_NEXT -->:next:{pagination.PAGE_NUMBER}:{pagination.PAGE_URL}
+<!-- ELSE -->:else:{pagination.PAGE_NUMBER}:{pagination.PAGE_URL}
+<!-- ENDIF -->
+<!-- END pagination -->
+<!-- IF U_PREVIOUS_PAGE -->:u_prev:{U_PREVIOUS_PAGE}<!-- ENDIF -->
+
+<!-- IF U_NEXT_PAGE -->:u_next:{U_NEXT_PAGE}<!-- ENDIF -->
diff --git a/tests/request/deactivated_super_global_test.php b/tests/request/deactivated_super_global_test.php
index 2e19928a5a..d28bd87eec 100644
--- a/tests/request/deactivated_super_global_test.php
+++ b/tests/request/deactivated_super_global_test.php
@@ -16,7 +16,7 @@ class phpbb_deactivated_super_global_test extends phpbb_test_case
public function test_write_triggers_error()
{
$this->setExpectedTriggerError(E_USER_ERROR);
- $obj = new phpbb_request_deactivated_super_global($this->getMock('phpbb_request_interface'), 'obj', phpbb_request_interface::POST);
+ $obj = new \phpbb\request\deactivated_super_global($this->getMock('\phpbb\request\request_interface'), 'obj', \phpbb\request\request_interface::POST);
$obj->offsetSet(0, 0);
}
}
diff --git a/tests/request/request_test.php b/tests/request/request_test.php
index 52c21abd2a..a25792e051 100644
--- a/tests/request/request_test.php
+++ b/tests/request/request_test.php
@@ -33,8 +33,8 @@ class phpbb_request_test extends phpbb_test_case
$_SERVER['HTTP_ACCEPT'] = 'application/json';
$_SERVER['HTTP_SOMEVAR'] = '<value>';
- $this->type_cast_helper = $this->getMock('phpbb_request_type_cast_helper_interface');
- $this->request = new phpbb_request($this->type_cast_helper);
+ $this->type_cast_helper = $this->getMock('\phpbb\request\type_cast_helper_interface');
+ $this->request = new \phpbb\request\request($this->type_cast_helper);
}
public function test_toggle_super_globals()
@@ -135,7 +135,7 @@ class phpbb_request_test extends phpbb_test_case
{
$this->request->enable_super_globals();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest';
- $this->request = new phpbb_request($this->type_cast_helper);
+ $this->request = new \phpbb\request\request($this->type_cast_helper);
$this->assertTrue($this->request->is_ajax());
}
@@ -146,7 +146,7 @@ class phpbb_request_test extends phpbb_test_case
$this->request->enable_super_globals();
$_SERVER['HTTPS'] = 'on';
- $this->request = new phpbb_request($this->type_cast_helper);
+ $this->request = new \phpbb\request\request($this->type_cast_helper);
$this->assertTrue($this->request->is_secure());
}
diff --git a/tests/request/request_var_test.php b/tests/request/request_var_test.php
index 0e85d4694b..d126fe1e8b 100644
--- a/tests/request/request_var_test.php
+++ b/tests/request/request_var_test.php
@@ -90,7 +90,7 @@ class phpbb_request_var_test extends phpbb_test_case
{
$this->unset_variables('var');
- // cannot set $_REQUEST directly because in phpbb_request implementation
+ // cannot set $_REQUEST directly because in \phpbb\request\request implementation
// $_REQUEST = $_POST + $_GET
$_POST['var'] = array(
0 => array(
diff --git a/tests/request/type_cast_helper_test.php b/tests/request/type_cast_helper_test.php
index f41db005af..98f4538c08 100644
--- a/tests/request/type_cast_helper_test.php
+++ b/tests/request/type_cast_helper_test.php
@@ -16,7 +16,7 @@ class phpbb_type_cast_helper_test extends phpbb_test_case
protected function setUp()
{
- $this->type_cast_helper = new phpbb_request_type_cast_helper();
+ $this->type_cast_helper = new \phpbb\request\type_cast_helper();
}
public function test_addslashes_recursively()
diff --git a/tests/search/mysql_test.php b/tests/search/mysql_test.php
index 3ad15bd806..c08484c78d 100644
--- a/tests/search/mysql_test.php
+++ b/tests/search/mysql_test.php
@@ -34,7 +34,7 @@ class phpbb_search_mysql_test extends phpbb_search_common_test_case
$this->db = $this->new_dbal();
$error = null;
- $class = self::get_search_wrapper('phpbb_search_fulltext_mysql');
+ $class = self::get_search_wrapper('\phpbb\search\fulltext_mysql');
$this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $user);
}
}
diff --git a/tests/search/native_test.php b/tests/search/native_test.php
index 4a2c210013..18c6df2445 100644
--- a/tests/search/native_test.php
+++ b/tests/search/native_test.php
@@ -30,7 +30,7 @@ class phpbb_search_native_test extends phpbb_search_test_case
$this->db = $this->new_dbal();
$error = null;
- $class = self::get_search_wrapper('phpbb_search_fulltext_native');
+ $class = self::get_search_wrapper('\phpbb\search\fulltext_native');
$this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $user);
}
diff --git a/tests/search/postgres_test.php b/tests/search/postgres_test.php
index 923af6f854..a59f5abc7d 100644
--- a/tests/search/postgres_test.php
+++ b/tests/search/postgres_test.php
@@ -34,7 +34,7 @@ class phpbb_search_postgres_test extends phpbb_search_common_test_case
$this->db = $this->new_dbal();
$error = null;
- $class = self::get_search_wrapper('phpbb_search_fulltext_postgres');
+ $class = self::get_search_wrapper('\phpbb\search\fulltext_postgres');
$this->search = new $class($error, $phpbb_root_path, $phpEx, null, $config, $this->db, $user);
}
}
diff --git a/tests/security/base.php b/tests/security/base.php
index 08878ad60d..8cd24ff145 100644
--- a/tests/security/base.php
+++ b/tests/security/base.php
@@ -39,13 +39,13 @@ abstract class phpbb_security_test_base extends phpbb_test_case
$request = new phpbb_mock_request(array(), array(), array(), $server);
// Set no user and trick a bit to circumvent errors
- $user = new phpbb_user();
+ $user = new \phpbb\user();
$user->lang = true;
$user->browser = $server['HTTP_USER_AGENT'];
$user->referer = '';
$user->forwarded_for = '';
$user->host = $server['HTTP_HOST'];
- $user->page = phpbb_session::extract_current_page($phpbb_root_path);
+ $user->page = \phpbb\session::extract_current_page($phpbb_root_path);
}
protected function tearDown()
diff --git a/tests/security/extract_current_page_test.php b/tests/security/extract_current_page_test.php
index d77cbbcaf3..e42f446b31 100644
--- a/tests/security/extract_current_page_test.php
+++ b/tests/security/extract_current_page_test.php
@@ -28,12 +28,12 @@ class phpbb_security_extract_current_page_test extends phpbb_security_test_base
{
global $request;
- $request->merge(phpbb_request_interface::SERVER, array(
+ $request->merge(\phpbb\request\request_interface::SERVER, array(
'PHP_SELF' => $url,
'QUERY_STRING' => $query_string,
));
- $result = phpbb_session::extract_current_page('./');
+ $result = \phpbb\session::extract_current_page('./');
$label = 'Running extract_current_page on ' . $query_string . ' with PHP_SELF filled.';
$this->assertEquals($expected, $result['query_string'], $label);
@@ -46,12 +46,12 @@ class phpbb_security_extract_current_page_test extends phpbb_security_test_base
{
global $request;
- $request->merge(phpbb_request_interface::SERVER, array(
+ $request->merge(\phpbb\request\request_interface::SERVER, array(
'PHP_SELF' => $url,
'QUERY_STRING' => $query_string,
));
- $result = phpbb_session::extract_current_page('./');
+ $result = \phpbb\session::extract_current_page('./');
$label = 'Running extract_current_page on ' . $query_string . ' with REQUEST_URI filled.';
$this->assertEquals($expected, $result['query_string'], $label);
diff --git a/tests/session/check_ban_test.php b/tests/session/check_ban_test.php
index 8d6c9a866d..3f13b9f216 100644
--- a/tests/session/check_ban_test.php
+++ b/tests/session/check_ban_test.php
@@ -43,8 +43,8 @@ class phpbb_session_check_ban_test extends phpbb_session_test_case
// Change the global cache object for this test because
// the mock cache object does not hit the database as is needed
// for this test.
- $cache = new phpbb_cache_service(
- new phpbb_cache_driver_file(),
+ $cache = new \phpbb\cache\service(
+ new \phpbb\cache\driver\file(),
$config,
$this->db,
$phpbb_root_path,
diff --git a/tests/session/testable_facade.php b/tests/session/testable_facade.php
index 9f0a3c5f59..f289c48f69 100644
--- a/tests/session/testable_facade.php
+++ b/tests/session/testable_facade.php
@@ -14,11 +14,11 @@ require_once dirname(__FILE__) . '/../../phpBB/phpbb/session.php';
* This class exists to expose session.php's functions in a more testable way.
*
* Since many functions in session.php have global variables inside the function,
- * this exposes those functions through a testable facade that uses
- * testable_factory's mock global variables to modify global variables used in
+ * this exposes those functions through a testable facade that uses
+ * testable_factory's mock global variables to modify global variables used in
* the functions.
*
- * This is using the facade pattern to provide a testable "front" to the
+ * This is using the facade pattern to provide a testable "front" to the
* functions in sessions.php.
*
*/
@@ -35,17 +35,17 @@ class phpbb_session_testable_facade
function extract_current_page(
$root_path,
- $php_self,
+ $php_self,
$query_string,
$request_uri
- )
+ )
{
$this->session_factory->get_session($this->db);
global $request;
- $request->overwrite('PHP_SELF', $php_self, phpbb_request_interface::SERVER);
- $request->overwrite('QUERY_STRING', $query_string, phpbb_request_interface::SERVER);
- $request->overwrite('REQUEST_URI', $request_uri, phpbb_request_interface::SERVER);
- return phpbb_session::extract_current_page($root_path);
+ $request->overwrite('PHP_SELF', $php_self, \phpbb\request\request_interface::SERVER);
+ $request->overwrite('QUERY_STRING', $query_string, \phpbb\request\request_interface::SERVER);
+ $request->overwrite('REQUEST_URI', $request_uri, \phpbb\request\request_interface::SERVER);
+ return \phpbb\session::extract_current_page($root_path);
}
function extract_current_hostname(
@@ -58,8 +58,8 @@ class phpbb_session_testable_facade
global $config, $request;
$config['server_name'] = $server_name_config;
$config['cookie_domain'] = $cookie_domain_config;
- $request->overwrite('SERVER_NAME', $host, phpbb_request_interface::SERVER);
- $request->overwrite('Host', $host, phpbb_request_interface::SERVER);
+ $request->overwrite('SERVER_NAME', $host, \phpbb\request\request_interface::SERVER);
+ $request->overwrite('Host', $host, \phpbb\request\request_interface::SERVER);
// Note: There is a php_uname function used as a fallthrough
// that this function doesn't override
return $session->extract_current_hostname();
@@ -135,7 +135,7 @@ class phpbb_session_testable_facade
$session->host = $host;
$config['force_server_vars'] = $force_server_vars;
$config['server_name'] = $server_name;
- $request->overwrite('SERVER_PORT', $server_port, phpbb_request_interface::SERVER);
+ $request->overwrite('SERVER_PORT', $server_port, \phpbb\request\request_interface::SERVER);
return $session->validate_referer($check_script_path);
}
}
diff --git a/tests/session/testable_factory.php b/tests/session/testable_factory.php
index 8733ce15ef..a58e208efc 100644
--- a/tests/session/testable_factory.php
+++ b/tests/session/testable_factory.php
@@ -63,10 +63,10 @@ class phpbb_session_testable_factory
/**
* Retrieve the configured session class instance
*
- * @param phpbb_db_driver $dbal The database connection to use for session data
+ * @param \phpbb\db\driver\driver $dbal The database connection to use for session data
* @return phpbb_mock_session_testable A session instance
*/
- public function get_session(phpbb_db_driver $dbal)
+ public function get_session(\phpbb\db\driver\driver $dbal)
{
// set up all the global variables used by session
global $SID, $_SID, $db, $config, $cache, $request, $phpbb_container;
@@ -79,7 +79,7 @@ class phpbb_session_testable_factory
);
request_var(null, null, null, null, $request);
- $config = $this->config = new phpbb_config($this->get_config_data());
+ $config = $this->config = new \phpbb\config\config($this->get_config_data());
set_config(null, null, null, $config);
$db = $dbal;
diff --git a/tests/template/includephp_test.php b/tests/template/includephp_test.php
index ff7b890d11..a0dd8368cf 100644
--- a/tests/template/includephp_test.php
+++ b/tests/template/includephp_test.php
@@ -46,7 +46,7 @@ class phpbb_template_includephp_test extends phpbb_template_template_test_case
$this->setup_engine(array('tpl_allow_php' => true));
- $this->style->set_custom_style('tests', $cache_dir, array(), '');
+ $this->template->set_custom_style('tests', $cache_dir);
$this->run_template('includephp_absolute.html', array(), array(), array(), "Path is absolute.\ntesting included php");
diff --git a/tests/template/template_events_test.php b/tests/template/template_events_test.php
index d3b65e763a..4155d5fd83 100644
--- a/tests/template/template_events_test.php
+++ b/tests/template/template_events_test.php
@@ -110,16 +110,20 @@ Zeta test event in all',
global $phpbb_root_path, $phpEx, $user;
$defaults = $this->config_defaults();
- $config = new phpbb_config(array_merge($defaults, $new_config));
+ $config = new \phpbb\config\config(array_merge($defaults, $new_config));
$this->template_path = dirname(__FILE__) . "/datasets/$dataset/styles/silver/template";
- $this->style_resource_locator = new phpbb_style_resource_locator();
$this->extension_manager = new phpbb_mock_filesystem_extension_manager(
dirname(__FILE__) . "/datasets/$dataset/"
);
- $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context, $this->extension_manager);
- $this->style_provider = new phpbb_style_path_provider();
- $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider, $this->template);
- $this->style->set_custom_style('silver', array($this->template_path), $style_names, '');
+ $phpbb_filesystem = new \phpbb\filesystem(
+ new \phpbb\symfony_request(
+ new phpbb_mock_request()
+ ),
+ $phpbb_root_path,
+ $phpEx
+ );
+ $this->template = new \phpbb\template\twig\twig($phpbb_filesystem, $config, $user, new \phpbb\template\context, $this->extension_manager);
+ $this->template->set_custom_style(((!empty($style_names)) ? $style_names : 'silver'), array($this->template_path));
}
}
diff --git a/tests/template/template_includecss_test.php b/tests/template/template_includecss_test.php
index f8999ad1a9..c00aa8e9bb 100644
--- a/tests/template/template_includecss_test.php
+++ b/tests/template/template_includecss_test.php
@@ -18,8 +18,8 @@ class phpbb_template_template_includecss_test extends phpbb_template_template_te
// Prepare correct result
$scripts = array(
- '<link href="' . $this->test_path . '/templates/child_only.css?assets_version=1" rel="stylesheet" type="text/css" media="screen, projection" />',
- '<link href="' . $this->test_path . '/parent_templates/parent_only.css?assets_version=1" rel="stylesheet" type="text/css" media="screen, projection" />',
+ '<link href="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/templates/child_only.css?assets_version=1" rel="stylesheet" type="text/css" media="screen, projection" />',
+ '<link href="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/parent_templates/parent_only.css?assets_version=1" rel="stylesheet" type="text/css" media="screen, projection" />',
);
// Run test
diff --git a/tests/template/template_includejs_test.php b/tests/template/template_includejs_test.php
index b67fa123a1..2faeb5fcaa 100644
--- a/tests/template/template_includejs_test.php
+++ b/tests/template/template_includejs_test.php
@@ -13,6 +13,8 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes
{
public function template_data()
{
+ $this->setup_engine();
+
return array(
/*
array(
@@ -22,51 +24,51 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes
*/
array(
array('TEST' => 1),
- '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?assets_version=1"></script>',
+ '<script type="text/javascript" src="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/templates/parent_and_child.js?assets_version=1"></script>',
),
array(
array('TEST' => 2),
- '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?assets_version=0"></script>',
+ '<script type="text/javascript" src="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/templates/parent_and_child.js?assets_version=0"></script>',
),
array(
array('TEST' => 3),
- '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?test=1&assets_version=0"></script>',
+ '<script type="text/javascript" src="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/templates/parent_and_child.js?test=1&assets_version=0"></script>',
),
array(
array('TEST' => 4),
- '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?test=1&amp;assets_version=0"></script>',
+ '<script type="text/javascript" src="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/templates/parent_and_child.js?test=1&amp;assets_version=0"></script>',
),
array(
array('TEST' => 6),
- '<script type="text/javascript" src="' . $this->test_path . '/parent_templates/parent_only.js?assets_version=1"></script>',
+ '<script type="text/javascript" src="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/parent_templates/parent_only.js?assets_version=1"></script>',
),
array(
array('TEST' => 7),
- '<script type="text/javascript" src="' . $this->test_path . '/templates/child_only.js?assets_version=1"></script>',
+ '<script type="text/javascript" src="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/templates/child_only.js?assets_version=1"></script>',
),
array(
array('TEST' => 8),
- '<script type="text/javascript" src="' . $this->test_path . '/templates/subdir/parent_only.js?assets_version=1"></script>',
+ '<script type="text/javascript" src="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/templates/subdir/parent_only.js?assets_version=1"></script>',
),
array(
array('TEST' => 9),
- '<script type="text/javascript" src="' . $this->test_path . '/templates/subdir/subsubdir/parent_only.js?assets_version=1"></script>',
+ '<script type="text/javascript" src="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/templates/subdir/subsubdir/parent_only.js?assets_version=1"></script>',
),
array(
array('TEST' => 10),
- '<script type="text/javascript" src="' . $this->test_path . '/templates/subdir/parent_only.js?assets_version=1"></script>',
+ '<script type="text/javascript" src="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/templates/subdir/parent_only.js?assets_version=1"></script>',
),
array(
array('TEST' => 11),
- '<script type="text/javascript" src="' . $this->test_path . '/templates/child_only.js?test1=1&amp;test2=2&amp;assets_version=1#test3"></script>',
+ '<script type="text/javascript" src="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/templates/child_only.js?test1=1&amp;test2=2&amp;assets_version=1#test3"></script>',
),
array(
array('TEST' => 12),
- '<script type="text/javascript" src="' . $this->test_path . '/parent_templates/parent_only.js?test1=1&amp;test2=2&amp;assets_version=1#test3"></script>',
+ '<script type="text/javascript" src="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/parent_templates/parent_only.js?test1=1&amp;test2=2&amp;assets_version=1#test3"></script>',
),
array(
array('TEST' => 14),
- '<script type="text/javascript" src="' . $this->test_path . '/parent_templates/parent_only.js?test1=&quot;&amp;assets_version=1#test3"></script>',
+ '<script type="text/javascript" src="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/parent_templates/parent_only.js?test1=&quot;&amp;assets_version=1#test3"></script>',
),
array(
array('TEST' => 15),
@@ -82,7 +84,7 @@ class phpbb_template_template_includejs_test extends phpbb_template_template_tes
),
array(
array('TEST' => 18),
- '<script type="text/javascript" src="' . $this->test_path . '/templates/parent_and_child.js?test=1&test2=0&amp;assets_version=1"></script>',
+ '<script type="text/javascript" src="' . $this->phpbb_filesystem->get_web_root_path() . 'tests/template/templates/parent_and_child.js?test=1&test2=0&amp;assets_version=1"></script>',
),
);
}
diff --git a/tests/template/template_test.php b/tests/template/template_test.php
index 0a6b680100..39eb08ab79 100644
--- a/tests/template/template_test.php
+++ b/tests/template/template_test.php
@@ -64,6 +64,13 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
),
array(
'if.html',
+ array('S_OTHER_OTHER_VALUE' => true),
+ array(),
+ array(),
+ '|S_OTHER_OTHER_VALUE|!false',
+ ),
+ array(
+ 'if.html',
array('S_VALUE' => false, 'S_OTHER_VALUE' => true),
array(),
array(),
@@ -151,7 +158,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
array(),
array('test_loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())),
array(),
- "xyz\nabc\n\$VALUE == 'abc'abc\nbar\nbar\nabc\ntest!@#$%^&*()_-=+{}[]:;\",<.>/?",
+ "xyz\nabc\n\$VALUE == 'abc'\n(\$VALUE == 'abc')\n((\$VALUE == 'abc'))\n!\$DOESNT_EXIST\n(!\$DOESNT_EXIST)\nabc\nbar\nbar\nabc\ntest!@#$%^&*()_-=+{}[]:;\",<.>/?[]|foobar|",
),
array(
'define_advanced.html',
@@ -230,7 +237,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
array('VARIABLE' => 'variable.html'),
array(),
array(),
- 'variable.html',
+ "variable.html\nvariable.html\nvariable.html",
),
array(
'include_loop_define.html',
@@ -410,7 +417,7 @@ class phpbb_template_template_test extends phpbb_template_template_test_case
$this->setup_engine(array('tpl_allow_php' => true));
- $this->style->set_custom_style('tests', $cache_dir, array(), '');
+ $this->template->set_custom_style('tests', $cache_dir);
$this->run_template('php.html', array(), array(), array(), 'test');
}
diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php
index 6d87e5ebc0..e9cbdec1d9 100644
--- a/tests/template/template_test_case.php
+++ b/tests/template/template_test_case.php
@@ -11,11 +11,8 @@ require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
class phpbb_template_template_test_case extends phpbb_test_case
{
- protected $style;
protected $template;
protected $template_path;
- protected $style_resource_locator;
- protected $style_provider;
protected $user;
protected $test_path = 'tests/template';
@@ -63,15 +60,20 @@ class phpbb_template_template_test_case extends phpbb_test_case
global $phpbb_root_path, $phpEx;
$defaults = $this->config_defaults();
- $config = new phpbb_config(array_merge($defaults, $new_config));
- $this->user = new phpbb_user;
+ $config = new \phpbb\config\config(array_merge($defaults, $new_config));
+ $this->user = new \phpbb\user;
+
+ $phpbb_filesystem = new \phpbb\filesystem(
+ new \phpbb\symfony_request(
+ new phpbb_mock_request()
+ ),
+ $phpbb_root_path,
+ $phpEx
+ );
$this->template_path = $this->test_path . '/templates';
- $this->style_resource_locator = new phpbb_style_resource_locator();
- $this->style_provider = new phpbb_style_path_provider();
- $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $this->user, new phpbb_template_context());
- $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $this->user, $this->style_resource_locator, $this->style_provider, $this->template);
- $this->style->set_custom_style('tests', $this->template_path, array(), '');
+ $this->template = new \phpbb\template\twig\twig($phpbb_filesystem, $config, $this->user, new \phpbb\template\context());
+ $this->template->set_custom_style('tests', $this->template_path);
}
protected function setUp()
diff --git a/tests/template/template_test_case_with_tree.php b/tests/template/template_test_case_with_tree.php
index 4b8cbada45..232331d37c 100644
--- a/tests/template/template_test_case_with_tree.php
+++ b/tests/template/template_test_case_with_tree.php
@@ -16,14 +16,19 @@ class phpbb_template_template_test_case_with_tree extends phpbb_template_templat
global $phpbb_root_path, $phpEx, $user;
$defaults = $this->config_defaults();
- $config = new phpbb_config(array_merge($defaults, $new_config));
+ $config = new \phpbb\config\config(array_merge($defaults, $new_config));
+
+ $this->phpbb_filesystem = new \phpbb\filesystem(
+ new \phpbb\symfony_request(
+ new phpbb_mock_request()
+ ),
+ $phpbb_root_path,
+ $phpEx
+ );
$this->template_path = $this->test_path . '/templates';
$this->parent_template_path = $this->test_path . '/parent_templates';
- $this->style_resource_locator = new phpbb_style_resource_locator();
- $this->style_provider = new phpbb_style_path_provider();
- $this->template = new phpbb_template_twig($phpbb_root_path, $phpEx, $config, $user, new phpbb_template_context());
- $this->style = new phpbb_style($phpbb_root_path, $phpEx, $config, $user, $this->style_resource_locator, $this->style_provider, $this->template);
- $this->style->set_custom_style('tests', array($this->template_path, $this->parent_template_path), array(), '');
+ $this->template = new phpbb\template\twig\twig($this->phpbb_filesystem, $config, $user, new phpbb\template\context());
+ $this->template->set_custom_style('tests', array($this->template_path, $this->parent_template_path));
}
}
diff --git a/tests/template/templates/define.html b/tests/template/templates/define.html
index 66e874ca63..e7ce7f7def 100644
--- a/tests/template/templates/define.html
+++ b/tests/template/templates/define.html
@@ -7,6 +7,18 @@ $VALUE != 'abc'
<!-- ELSEIF $VALUE == 'abc' -->
$VALUE == 'abc'
<!-- ENDIF -->
+<!-- IF ($VALUE == 'abc') -->
+($VALUE == 'abc')
+<!-- ENDIF -->
+<!-- IF (($VALUE == 'abc')) -->
+(($VALUE == 'abc'))
+<!-- ENDIF -->
+<!-- IF !$DOESNT_EXIST -->
+!$DOESNT_EXIST
+<!-- ENDIF -->
+<!-- IF (!$DOESNT_EXIST) -->
+(!$DOESNT_EXIST)
+<!-- ENDIF -->
<!-- INCLUDE define_include.html -->
{$INCLUDED_VALUE}
{$VALUE}
@@ -14,3 +26,6 @@ $VALUE == 'abc'
{$VALUE}
<!-- DEFINE $VALUE = 'test!@#$%^&*()_-=+{}[]:;",<.>/?' -->
{$VALUE}
+<!-- DEFINE $VALUE = '' -->
+[{$VALUE}]
+<!-- DEFINE $TEST -->foobar<!-- ENDDEFINE -->|{$TEST}|
diff --git a/tests/template/templates/if.html b/tests/template/templates/if.html
index c010aff7fa..f6ab6e575a 100644
--- a/tests/template/templates/if.html
+++ b/tests/template/templates/if.html
@@ -2,6 +2,8 @@
1
<!-- ELSEIF S_OTHER_VALUE -->
2
+<!-- ELSE IF S_OTHER_OTHER_VALUE -->
+|S_OTHER_OTHER_VALUE|
<!-- ELSE -->
03
<!-- ENDIF -->
diff --git a/tests/template/templates/include_define_variable.html b/tests/template/templates/include_define_variable.html
index aff9b574c2..6052657c97 100644
--- a/tests/template/templates/include_define_variable.html
+++ b/tests/template/templates/include_define_variable.html
@@ -1,2 +1,8 @@
<!-- DEFINE $DEF = '{VARIABLE}' -->
<!-- INCLUDE {$DEF} -->
+
+<!-- DEFINE $DEF_WITH_UNDERSCORES = '{VARIABLE}' -->
+<!-- INCLUDE {$DEF_WITH_UNDERSCORES} -->
+
+<!-- DEFINE $DEF123 = '{VARIABLE}' -->
+<!-- INCLUDE {$DEF123} -->
diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php
index c72ea5f765..4c2e9ff600 100644
--- a/tests/test_framework/phpbb_database_test_case.php
+++ b/tests/test_framework/phpbb_database_test_case.php
@@ -82,7 +82,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test
$db_config = $this->get_database_config();
// Firebird requires table and column names to be uppercase
- if ($db_config['dbms'] == 'phpbb_db_driver_firebird')
+ if ($db_config['dbms'] == 'phpbb\db\driver\firebird')
{
$xml_data = file_get_contents($path);
$xml_data = preg_replace_callback('/(?:(<table name="))([a-z_]+)(?:(">))/', 'phpbb_database_test_case::to_upper', $xml_data);
diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php
index c93a777701..af9bd22662 100644
--- a/tests/test_framework/phpbb_database_test_connection_manager.php
+++ b/tests/test_framework/phpbb_database_test_connection_manager.php
@@ -108,7 +108,7 @@ class phpbb_database_test_connection_manager
// These require different connection strings on the phpBB side than they do in PDO
// so you must provide a DSN string for ODBC separately
- if (!empty($this->config['custom_dsn']) && ($this->config['dbms'] == 'phpbb_db_driver_mssql' || $this->config['dbms'] == 'phpbb_db_driver_firebird'))
+ if (!empty($this->config['custom_dsn']) && ($this->config['dbms'] == 'phpbb\db\driver\mssql' || $this->config['dbms'] == 'phpbb\db\driver\firebird'))
{
$dsn = 'odbc:' . $this->config['custom_dsn'];
}
@@ -117,12 +117,12 @@ class phpbb_database_test_connection_manager
{
switch ($this->config['dbms'])
{
- case 'phpbb_db_driver_mssql':
- case 'phpbb_db_driver_mssql_odbc':
+ case 'phpbb\db\driver\mssql':
+ case 'phpbb\db\driver\mssql_odbc':
$this->pdo = new phpbb_database_connection_odbc_pdo_wrapper('mssql', 0, $dsn, $this->config['dbuser'], $this->config['dbpasswd']);
break;
- case 'phpbb_db_driver_firebird':
+ case 'phpbb\db\driver\firebird':
if (!empty($this->config['custom_dsn']))
{
$this->pdo = new phpbb_database_connection_odbc_pdo_wrapper('firebird', 0, $dsn, $this->config['dbuser'], $this->config['dbpasswd']);
@@ -138,15 +138,15 @@ class phpbb_database_test_connection_manager
catch (PDOException $e)
{
$cleaned_dsn = str_replace($this->config['dbpasswd'], '*password*', $dsn);
- throw new Exception("Unable do connect to $cleaned_dsn using PDO with error: {$e->getMessage()}");
+ throw new Exception("Unable to connect to $cleaned_dsn using PDO with error: {$e->getMessage()}");
}
$this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
switch ($this->config['dbms'])
{
- case 'phpbb_db_driver_mysql':
- case 'phpbb_db_driver_mysqli':
+ case 'phpbb\db\driver\mysql':
+ case 'phpbb\db\driver\mysqli':
$this->pdo->exec('SET NAMES utf8');
/*
@@ -187,8 +187,8 @@ class phpbb_database_test_connection_manager
{
switch ($this->config['dbms'])
{
- case 'phpbb_db_driver_sqlite':
- case 'phpbb_db_driver_firebird':
+ case 'phpbb\db\driver\sqlite':
+ case 'phpbb\db\driver\firebird':
$this->connect();
// Drop all of the tables
foreach ($this->get_tables() as $table)
@@ -198,7 +198,7 @@ class phpbb_database_test_connection_manager
$this->purge_extras();
break;
- case 'phpbb_db_driver_oracle':
+ case 'phpbb\db\driver\oracle':
$this->connect();
// Drop all of the tables
foreach ($this->get_tables() as $table)
@@ -208,7 +208,7 @@ class phpbb_database_test_connection_manager
$this->purge_extras();
break;
- case 'phpbb_db_driver_postgres':
+ case 'phpbb\db\driver\postgres':
$this->connect();
// Drop all of the tables
foreach ($this->get_tables() as $table)
@@ -258,38 +258,38 @@ class phpbb_database_test_connection_manager
switch ($this->config['dbms'])
{
- case 'phpbb_db_driver_mysql':
- case 'phpbb_db_driver_mysqli':
+ case 'phpbb\db\driver\mysql':
+ case 'phpbb\db\driver\mysqli':
$sql = 'SHOW TABLES';
break;
- case 'phpbb_db_driver_sqlite':
+ case 'phpbb\db\driver\sqlite':
$sql = 'SELECT name
FROM sqlite_master
WHERE type = "table"';
break;
- case 'phpbb_db_driver_mssql':
- case 'phpbb_db_driver_mssql_odbc':
- case 'phpbb_db_driver_mssqlnative':
+ case 'phpbb\db\driver\mssql':
+ case 'phpbb\db\driver\mssql_odbc':
+ case 'phpbb\db\driver\mssqlnative':
$sql = "SELECT name
FROM sysobjects
WHERE type='U'";
break;
- case 'phpbb_db_driver_postgres':
+ case 'phpbb\db\driver\postgres':
$sql = 'SELECT relname
FROM pg_stat_user_tables';
break;
- case 'phpbb_db_driver_firebird':
+ case 'phpbb\db\driver\firebird':
$sql = 'SELECT rdb$relation_name
FROM rdb$relations
WHERE rdb$view_source is null
AND rdb$system_flag = 0';
break;
- case 'phpbb_db_driver_oracle':
+ case 'phpbb\db\driver\oracle':
$sql = 'SELECT table_name
FROM USER_TABLES';
break;
@@ -325,7 +325,7 @@ class phpbb_database_test_connection_manager
{
$schema = $this->dbms['SCHEMA'];
- if ($this->config['dbms'] == 'phpbb_db_driver_mysql')
+ if ($this->config['dbms'] == 'phpbb\db\driver\mysql')
{
$sth = $this->pdo->query('SELECT VERSION() AS version');
$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -359,47 +359,47 @@ class phpbb_database_test_connection_manager
protected function get_dbms_data($dbms)
{
$available_dbms = array(
- 'phpbb_db_driver_firebird' => array(
+ 'phpbb\db\driver\firebird' => array(
'SCHEMA' => 'firebird',
'DELIM' => ';;',
'PDO' => 'firebird',
),
- 'phpbb_db_driver_mysqli' => array(
+ 'phpbb\db\driver\mysqli' => array(
'SCHEMA' => 'mysql_41',
'DELIM' => ';',
'PDO' => 'mysql',
),
- 'phpbb_db_driver_mysql' => array(
+ 'phpbb\db\driver\mysql' => array(
'SCHEMA' => 'mysql',
'DELIM' => ';',
'PDO' => 'mysql',
),
- 'phpbb_db_driver_mssql' => array(
+ 'phpbb\db\driver\mssql' => array(
'SCHEMA' => 'mssql',
'DELIM' => 'GO',
'PDO' => 'odbc',
),
- 'phpbb_db_driver_mssql_odbc'=> array(
+ 'phpbb\db\driver\mssql_odbc'=> array(
'SCHEMA' => 'mssql',
'DELIM' => 'GO',
'PDO' => 'odbc',
),
- 'phpbb_db_driver_mssqlnative' => array(
+ 'phpbb\db\driver\mssqlnative' => array(
'SCHEMA' => 'mssql',
'DELIM' => 'GO',
'PDO' => 'sqlsrv',
),
- 'phpbb_db_driver_oracle' => array(
+ 'phpbb\db\driver\oracle' => array(
'SCHEMA' => 'oracle',
'DELIM' => '/',
'PDO' => 'oci',
),
- 'phpbb_db_driver_postgres' => array(
+ 'phpbb\db\driver\postgres' => array(
'SCHEMA' => 'postgres',
'DELIM' => ';',
'PDO' => 'pgsql',
),
- 'phpbb_db_driver_sqlite' => array(
+ 'phpbb\db\driver\sqlite' => array(
'SCHEMA' => 'sqlite',
'DELIM' => ';',
'PDO' => 'sqlite2',
@@ -428,7 +428,7 @@ class phpbb_database_test_connection_manager
switch ($this->config['dbms'])
{
- case 'phpbb_db_driver_firebird':
+ case 'phpbb\db\driver\firebird':
$sql = 'SELECT RDB$GENERATOR_NAME
FROM RDB$GENERATORS
WHERE RDB$SYSTEM_FLAG = 0';
@@ -440,7 +440,7 @@ class phpbb_database_test_connection_manager
}
break;
- case 'phpbb_db_driver_oracle':
+ case 'phpbb\db\driver\oracle':
$sql = 'SELECT sequence_name
FROM USER_SEQUENCES';
$result = $this->pdo->query($sql);
@@ -451,7 +451,7 @@ class phpbb_database_test_connection_manager
}
break;
- case 'phpbb_db_driver_postgres':
+ case 'phpbb\db\driver\postgres':
$sql = 'SELECT sequence_name
FROM information_schema.sequences';
$result = $this->pdo->query($sql);
@@ -509,7 +509,7 @@ class phpbb_database_test_connection_manager
switch ($this->config['dbms'])
{
- case 'phpbb_db_driver_oracle':
+ case 'phpbb\db\driver\oracle':
// Get all of the information about the sequences
$sql = "SELECT t.table_name, tc.column_name, d.referenced_name as sequence_name, s.increment_by, s.min_value
FROM USER_TRIGGERS t
@@ -544,14 +544,14 @@ class phpbb_database_test_connection_manager
* Since we have no objects attached to our sequencers (triggers aren't attached), this works fine.
*/
$queries[] = 'DROP SEQUENCE ' . $row['SEQUENCE_NAME'];
- $queries[] = "CREATE SEQUENCE {$row['SEQUENCE_NAME']}
- MINVALUE {$row['MIN_VALUE']}
- INCREMENT BY {$row['INCREMENT_BY']}
+ $queries[] = "CREATE SEQUENCE {$row['SEQUENCE_NAME']}
+ MINVALUE {$row['MIN_VALUE']}
+ INCREMENT BY {$row['INCREMENT_BY']}
START WITH $max_val";
}
break;
- case 'phpbb_db_driver_postgres':
+ case 'phpbb\db\driver\postgres':
// Get the sequences attached to the tables
$sql = 'SELECT column_name, table_name FROM information_schema.columns
WHERE table_name IN (' . implode(', ', $table_names) . ")
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php
index ce748bb9cf..f87b3538a1 100644
--- a/tests/test_framework/phpbb_functional_test_case.php
+++ b/tests/test_framework/phpbb_functional_test_case.php
@@ -150,7 +150,7 @@ class phpbb_functional_test_case extends phpbb_test_case
{
global $phpbb_root_path, $phpEx;
// so we don't reopen an open connection
- if (!($this->db instanceof phpbb_db_driver))
+ if (!($this->db instanceof \phpbb\db\driver\driver))
{
$dbms = self::$config['dbms'];
$this->db = new $dbms();
@@ -163,7 +163,7 @@ class phpbb_functional_test_case extends phpbb_test_case
{
if (!$this->cache)
{
- $this->cache = new phpbb_cache_driver_file;
+ $this->cache = new \phpbb\cache\driver\file;
}
return $this->cache;
@@ -182,11 +182,11 @@ class phpbb_functional_test_case extends phpbb_test_case
{
global $phpbb_root_path, $phpEx;
- $config = new phpbb_config(array());
+ $config = new \phpbb\config\config(array());
$db = $this->get_db();
- $db_tools = new phpbb_db_tools($db);
+ $db_tools = new \phpbb\db\tools($db);
- $migrator = new phpbb_db_migrator(
+ $migrator = new \phpbb\db\migrator(
$config,
$db,
$db_tools,
@@ -199,11 +199,17 @@ class phpbb_functional_test_case extends phpbb_test_case
$container = new phpbb_mock_container_builder();
$container->set('migrator', $migrator);
- $extension_manager = new phpbb_extension_manager(
+ $extension_manager = new \phpbb\extension\manager(
$container,
$db,
$config,
- new phpbb_filesystem(),
+ new phpbb\filesystem(
+ new phpbb\symfony_request(
+ new phpbb_mock_request()
+ ),
+ $phpbb_root_path,
+ $php_ext
+ ),
self::$config['table_prefix'] . 'ext',
dirname(__FILE__) . '/',
$php_ext,
@@ -265,7 +271,7 @@ class phpbb_functional_test_case extends phpbb_test_case
self::assertContains('Database configuration', $crawler->filter('#main')->text());
$form = $crawler->selectButton('submit')->form(array(
// Installer uses 3.0-style dbms name
- 'dbms' => str_replace('phpbb_db_driver_', '', self::$config['dbms']),
+ 'dbms' => str_replace('phpbb\db\driver\\', '', self::$config['dbms']),
'dbhost' => self::$config['dbhost'],
'dbport' => self::$config['dbport'],
'dbname' => self::$config['dbname'],
@@ -471,7 +477,7 @@ class phpbb_functional_test_case extends phpbb_test_case
// Required by unique_id
global $config;
- $config = new phpbb_config(array());
+ $config = new \phpbb\config\config(array());
$config['rand_seed'] = '';
$config['rand_seed_last_update'] = time() + 600;
@@ -484,7 +490,7 @@ class phpbb_functional_test_case extends phpbb_test_case
}
$cache = new phpbb_mock_null_cache;
- $cache_driver = new phpbb_cache_driver_null();
+ $cache_driver = new \phpbb\cache\driver\null();
$phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
$phpbb_container
->expects($this->any())
@@ -521,24 +527,21 @@ class phpbb_functional_test_case extends phpbb_test_case
{
global $db, $cache, $auth, $config, $phpbb_dispatcher, $phpbb_log, $phpbb_container, $phpbb_root_path, $phpEx;
- $config = new phpbb_config(array());
+ $config = new \phpbb\config\config(array());
$config['coppa_enable'] = 0;
$db = $this->get_db();
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
- $user = $this->getMock('phpbb_user');
- $auth = $this->getMock('phpbb_auth');
+ $user = $this->getMock('\phpbb\user');
+ $auth = $this->getMock('\phpbb\auth\auth');
- $phpbb_log = new phpbb_log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
+ $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
$cache = new phpbb_mock_null_cache;
- $cache_driver = new phpbb_cache_driver_null();
- $phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
- $phpbb_container
- ->expects($this->any())
- ->method('get')
- ->with('cache.driver')
- ->will($this->returnValue($cache_driver));
+ $cache_driver = new \phpbb\cache\driver\null();
+ $phpbb_container = new phpbb_mock_container_builder();
+ $phpbb_container->set('cache.driver', $cache_driver);
+ $phpbb_container->set('notification_manager', new phpbb_mock_notification_manager());
if (!function_exists('utf_clean_string'))
{
@@ -563,18 +566,18 @@ class phpbb_functional_test_case extends phpbb_test_case
{
global $db, $cache, $auth, $config, $phpbb_dispatcher, $phpbb_log, $phpbb_container, $phpbb_root_path, $phpEx;
- $config = new phpbb_config(array());
+ $config = new \phpbb\config\config(array());
$config['coppa_enable'] = 0;
$db = $this->get_db();
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
- $user = $this->getMock('phpbb_user');
- $auth = $this->getMock('phpbb_auth');
+ $user = $this->getMock('\phpbb\user');
+ $auth = $this->getMock('\phpbb\auth\auth');
- $phpbb_log = new phpbb_log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
+ $phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
$cache = new phpbb_mock_null_cache;
- $cache_driver = new phpbb_cache_driver_null();
+ $cache_driver = new \phpbb\cache\driver\null();
$phpbb_container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface');
$phpbb_container
->expects($this->any())
@@ -928,7 +931,7 @@ class phpbb_functional_test_case extends phpbb_test_case
$hidden_fields = array(
$crawler->filter('[type="hidden"]')->each(function ($node, $i) {
- return array('name' => $node->getAttribute('name'), 'value' => $node->getAttribute('value'));
+ return array('name' => $node->attr('name'), 'value' => $node->attr('value'));
}),
);
diff --git a/tests/test_framework/phpbb_search_test_case.php b/tests/test_framework/phpbb_search_test_case.php
index 418d352c17..b929e740ea 100644
--- a/tests/test_framework/phpbb_search_test_case.php
+++ b/tests/test_framework/phpbb_search_test_case.php
@@ -11,7 +11,7 @@ abstract class phpbb_search_test_case extends phpbb_database_test_case
{
static protected function get_search_wrapper($class)
{
- $wrapped = $class . '_wrapper';
+ $wrapped = str_replace('\\', '_', $class) . '_wrapper';
if (!class_exists($wrapped))
{
$code = "
diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php
index 3d9cd10f32..351a3a9594 100644
--- a/tests/test_framework/phpbb_test_case_helpers.php
+++ b/tests/test_framework/phpbb_test_case_helpers.php
@@ -107,7 +107,7 @@ class phpbb_test_case_helpers
if (extension_loaded('sqlite') && version_compare(PHPUnit_Runner_Version::id(), '3.4.15', '>='))
{
$config = array_merge($config, array(
- 'dbms' => 'phpbb_db_driver_sqlite',
+ 'dbms' => 'phpbb\db\driver\sqlite',
'dbhost' => dirname(__FILE__) . '/../phpbb_unit_tests.sqlite2', // filename
'dbport' => '',
'dbname' => '',
diff --git a/tests/tree/nestedset_forum_base.php b/tests/tree/nestedset_forum_base.php
index 43680609f8..ce03c1fc21 100644
--- a/tests/tree/nestedset_forum_base.php
+++ b/tests/tree/nestedset_forum_base.php
@@ -52,11 +52,11 @@ class phpbb_tests_tree_nestedset_forum_base extends phpbb_database_test_case
global $config;
- $config = $this->config = new phpbb_config(array('nestedset_forum_lock' => 0));
+ $config = $this->config = new \phpbb\config\config(array('nestedset_forum_lock' => 0));
set_config(null, null, null, $this->config);
- $this->lock = new phpbb_lock_db('nestedset_forum_lock', $this->config, $this->db);
- $this->set = new phpbb_tree_nestedset_forum($this->db, $this->lock, 'phpbb_forums');
+ $this->lock = new \phpbb\lock\db('nestedset_forum_lock', $this->config, $this->db);
+ $this->set = new \phpbb\tree\nestedset_forum($this->db, $this->lock, 'phpbb_forums');
$this->set_up_forums();
}
@@ -97,7 +97,7 @@ class phpbb_tests_tree_nestedset_forum_base extends phpbb_database_test_case
}
else
{
- $buffer = new phpbb_db_sql_insert_buffer($this->db, 'phpbb_forums');
+ $buffer = new \phpbb\db\sql_insert_buffer($this->db, 'phpbb_forums');
$buffer->insert_all($forums);
$buffer->flush();
diff --git a/tests/user/lang_test.php b/tests/user/lang_test.php
index d7ff451a70..c7c858c59d 100644
--- a/tests/user/lang_test.php
+++ b/tests/user/lang_test.php
@@ -11,7 +11,7 @@ class phpbb_user_lang_test extends phpbb_test_case
{
public function test_user_lang_sprintf()
{
- $user = new phpbb_user;
+ $user = new \phpbb\user;
$user->lang = array(
'FOO' => 'BAR',
'BARZ' => 'PENG',
@@ -93,7 +93,7 @@ class phpbb_user_lang_test extends phpbb_test_case
$this->assertEquals($user->lang('ARRY', 1, 's', 2), '1 post');
// ticket PHPBB3-10345 - different plural rules, not just 0/1/2+
- $user = new phpbb_user;
+ $user = new \phpbb\user;
$user->lang = array(
'PLURAL_RULE' => 13,
'ARRY' => array(
diff --git a/tests/user/user_loader_test.php b/tests/user/user_loader_test.php
index 5cdb654b18..13c35030f9 100644
--- a/tests/user/user_loader_test.php
+++ b/tests/user/user_loader_test.php
@@ -24,7 +24,7 @@ class phpbb_user_loader_test extends phpbb_database_test_case
parent::setUp();
$this->db = $this->new_dbal();
- $this->user_loader = new phpbb_user_loader($this->db, __DIR__ . '/../../phpBB/', 'php', 'phpbb_users');
+ $this->user_loader = new \phpbb\user_loader($this->db, __DIR__ . '/../../phpBB/', 'php', 'phpbb_users');
}
public function test_load_get()
diff --git a/tests/wrapper/phpbb_php_ini_fake.php b/tests/wrapper/phpbb_php_ini_fake.php
index 49bc5936e5..d9e96447e3 100644
--- a/tests/wrapper/phpbb_php_ini_fake.php
+++ b/tests/wrapper/phpbb_php_ini_fake.php
@@ -7,7 +7,7 @@
*
*/
-class phpbb_php_ini_fake extends phpbb_php_ini
+class phpbb_php_ini_fake extends \phpbb\php\ini
{
function get($varname)
{
diff --git a/travis/phpunit-mysql-travis.xml b/travis/phpunit-mysql-travis.xml
index 715e66c223..5fa6c06e46 100644
--- a/travis/phpunit-mysql-travis.xml
+++ b/travis/phpunit-mysql-travis.xml
@@ -32,7 +32,7 @@
</groups>
<php>
- <server name="PHPBB_TEST_DBMS" value="phpbb_db_driver_mysqli" />
+ <server name="PHPBB_TEST_DBMS" value="phpbb\db\driver\mysqli" />
<server name="PHPBB_TEST_DBHOST" value="0.0.0.0" />
<server name="PHPBB_TEST_DBPORT" value="3306" />
<server name="PHPBB_TEST_DBNAME" value="phpbb_tests" />
diff --git a/travis/phpunit-postgres-travis.xml b/travis/phpunit-postgres-travis.xml
index c397882d3c..88d9e0f46a 100644
--- a/travis/phpunit-postgres-travis.xml
+++ b/travis/phpunit-postgres-travis.xml
@@ -31,7 +31,7 @@
<php>
<!-- "Real" test database -->
<!-- uncomment, otherwise sqlite memory runs -->
- <server name="PHPBB_TEST_DBMS" value="phpbb_db_driver_postgres"/>
+ <server name="PHPBB_TEST_DBMS" value="phpbb\db\driver\postgres"/>
<server name="PHPBB_TEST_DBHOST" value="localhost" />
<server name="PHPBB_TEST_DBPORT" value="5432" />
<server name="PHPBB_TEST_DBNAME" value="phpbb_tests" />
diff --git a/travis/setup-webserver.sh b/travis/setup-webserver.sh
index beb04b0fef..95fc4ec1f8 100755
--- a/travis/setup-webserver.sh
+++ b/travis/setup-webserver.sh
@@ -42,7 +42,7 @@ server {
root $PHPBB_ROOT_PATH/;
index index.php index.html;
- location ~ \.php$ {
+ location ~ \.php {
fastcgi_pass unix:$PHP_FPM_SOCK;
include fastcgi_params;
}