aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.editorconfig18
-rw-r--r--.travis.yml4
-rw-r--r--build/build.xml8
-rw-r--r--build/sami.conf.php6
-rw-r--r--phpBB/adm/style/acp_groups.html1
-rw-r--r--phpBB/adm/style/acp_ranks.html11
-rw-r--r--phpBB/adm/style/acp_users_avatar.html1
-rw-r--r--phpBB/adm/style/overall_header.html2
-rw-r--r--phpBB/adm/style/simple_header.html1
-rw-r--r--phpBB/composer.json30
-rw-r--r--phpBB/composer.lock169
-rw-r--r--phpBB/config/auth_providers.yml2
-rw-r--r--phpBB/config/avatars.yml1
-rw-r--r--phpBB/config/captcha.yml62
-rw-r--r--phpBB/config/parameters.yml2
-rw-r--r--phpBB/config/services.yml5
-rw-r--r--phpBB/docs/CHANGELOG.html189
-rw-r--r--phpBB/docs/INSTALL.html43
-rw-r--r--phpBB/docs/events.md106
-rw-r--r--phpBB/download/file.php198
-rw-r--r--phpBB/includes/acp/acp_attachments.php1
-rw-r--r--phpBB/includes/acp/acp_board.php2
-rw-r--r--phpBB/includes/acp/acp_captcha.php17
-rw-r--r--phpBB/includes/acp/acp_extensions.php12
-rw-r--r--phpBB/includes/acp/acp_groups.php22
-rw-r--r--phpBB/includes/acp/acp_modules.php3
-rw-r--r--phpBB/includes/acp/acp_ranks.php46
-rw-r--r--phpBB/includes/acp/acp_styles.php4
-rw-r--r--phpBB/includes/acp/acp_users.php60
-rw-r--r--phpBB/includes/acp/auth.php5
-rw-r--r--phpBB/includes/captcha/captcha_factory.php100
-rw-r--r--phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php69
-rw-r--r--phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php70
-rw-r--r--phpBB/includes/constants.php2
-rw-r--r--phpBB/includes/diff/diff.php13
-rw-r--r--phpBB/includes/functions.php163
-rw-r--r--phpBB/includes/functions_acp.php59
-rw-r--r--phpBB/includes/functions_admin.php18
-rw-r--r--phpBB/includes/functions_content.php1
-rw-r--r--phpBB/includes/functions_display.php53
-rw-r--r--phpBB/includes/functions_download.php21
-rw-r--r--phpBB/includes/functions_install.php2
-rw-r--r--phpBB/includes/functions_messenger.php12
-rw-r--r--phpBB/includes/functions_module.php62
-rw-r--r--phpBB/includes/functions_posting.php108
-rw-r--r--phpBB/includes/functions_privmsgs.php16
-rw-r--r--phpBB/includes/functions_transfer.php2
-rw-r--r--phpBB/includes/functions_upload.php68
-rw-r--r--phpBB/includes/functions_url_matcher.php8
-rw-r--r--phpBB/includes/functions_user.php8
-rw-r--r--phpBB/includes/mcp/mcp_front.php26
-rw-r--r--phpBB/includes/mcp/mcp_main.php28
-rw-r--r--phpBB/includes/mcp/mcp_pm_reports.php2
-rw-r--r--phpBB/includes/mcp/mcp_queue.php93
-rw-r--r--phpBB/includes/mcp/mcp_reports.php10
-rw-r--r--phpBB/includes/mcp/mcp_warn.php4
-rw-r--r--phpBB/includes/message_parser.php20
-rw-r--r--phpBB/includes/ucp/ucp_activate.php2
-rw-r--r--phpBB/includes/ucp/ucp_confirm.php5
-rw-r--r--phpBB/includes/ucp/ucp_groups.php36
-rw-r--r--phpBB/includes/ucp/ucp_login_link.php4
-rw-r--r--phpBB/includes/ucp/ucp_notifications.php8
-rw-r--r--phpBB/includes/ucp/ucp_pm_viewmessage.php7
-rw-r--r--phpBB/includes/ucp/ucp_prefs.php12
-rw-r--r--phpBB/includes/ucp/ucp_profile.php45
-rw-r--r--phpBB/includes/ucp/ucp_register.php5
-rw-r--r--phpBB/install/convertors/convert_phpbb20.php2
-rw-r--r--phpBB/install/database_update.php4
-rw-r--r--phpBB/install/index.php6
-rw-r--r--phpBB/install/install_install.php2
-rw-r--r--phpBB/install/install_update.php8
-rw-r--r--phpBB/install/schemas/schema.json49
-rw-r--r--phpBB/install/schemas/schema_data.sql12
-rw-r--r--phpBB/language/en/acp/extensions.php1
-rw-r--r--phpBB/language/en/cli.php3
-rw-r--r--phpBB/language/en/common.php4
-rw-r--r--phpBB/phpbb/auth/auth.php7
-rw-r--r--phpBB/phpbb/auth/provider/apache.php14
-rw-r--r--phpBB/phpbb/auth/provider/db.php20
-rw-r--r--phpBB/phpbb/auth/provider/ldap.php8
-rw-r--r--phpBB/phpbb/auth/provider/oauth/oauth.php13
-rw-r--r--phpBB/phpbb/avatar/driver/gravatar.php5
-rw-r--r--phpBB/phpbb/avatar/driver/local.php1
-rw-r--r--phpBB/phpbb/avatar/driver/remote.php5
-rw-r--r--phpBB/phpbb/avatar/driver/upload.php30
-rw-r--r--phpBB/phpbb/avatar/manager.php36
-rw-r--r--phpBB/phpbb/cache/driver/base.php213
-rw-r--r--phpBB/phpbb/cache/driver/file.php204
-rw-r--r--phpBB/phpbb/cache/driver/memory.php171
-rw-r--r--phpBB/phpbb/cache/service.php16
-rw-r--r--phpBB/phpbb/captcha/char_cube3d.php277
-rw-r--r--phpBB/phpbb/captcha/colour_manager.php527
-rw-r--r--phpBB/phpbb/captcha/factory.php88
-rw-r--r--phpBB/phpbb/captcha/gd.php (renamed from phpBB/includes/captcha/captcha_gd.php)786
-rw-r--r--phpBB/phpbb/captcha/gd_wave.php (renamed from phpBB/includes/captcha/captcha_gd_wave.php)4
-rw-r--r--phpBB/phpbb/captcha/non_gd.php (renamed from phpBB/includes/captcha/captcha_non_gd.php)12
-rw-r--r--phpBB/phpbb/captcha/plugins/captcha_abstract.php (renamed from phpBB/includes/captcha/plugins/captcha_abstract.php)50
-rw-r--r--phpBB/phpbb/captcha/plugins/gd.php (renamed from phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php)50
-rw-r--r--phpBB/phpbb/captcha/plugins/gd_wave.php42
-rw-r--r--phpBB/phpbb/captcha/plugins/nogd.php42
-rw-r--r--phpBB/phpbb/captcha/plugins/qa.php (renamed from phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php)143
-rw-r--r--phpBB/phpbb/captcha/plugins/recaptcha.php (renamed from phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php)33
-rw-r--r--phpBB/phpbb/composer.json27
-rw-r--r--phpBB/phpbb/config_php_file.php39
-rw-r--r--phpBB/phpbb/console/command/config/increment.php2
-rw-r--r--phpBB/phpbb/console/command/extension/enable.php4
-rw-r--r--phpBB/phpbb/console/command/extension/show.php8
-rw-r--r--phpBB/phpbb/content_visibility.php106
-rw-r--r--phpBB/phpbb/controller/helper.php8
-rw-r--r--phpBB/phpbb/controller/resolver.php18
-rw-r--r--phpBB/phpbb/cron/manager.php2
-rw-r--r--phpBB/phpbb/cron/task/core/prune_all_forums.php2
-rw-r--r--phpBB/phpbb/cron/task/core/prune_forum.php2
-rw-r--r--phpBB/phpbb/cron/task/core/prune_shadow_topics.php2
-rw-r--r--phpBB/phpbb/cron/task/core/queue.php2
-rw-r--r--phpBB/phpbb/cron/task/core/tidy_database.php2
-rw-r--r--phpBB/phpbb/cron/task/core/tidy_search.php2
-rw-r--r--phpBB/phpbb/cron/task/core/tidy_warnings.php2
-rw-r--r--phpBB/phpbb/cron/task/wrapper.php2
-rw-r--r--phpBB/phpbb/datetime.php2
-rw-r--r--phpBB/phpbb/db/driver/driver.php11
-rw-r--r--phpBB/phpbb/db/driver/driver_interface.php10
-rw-r--r--phpBB/phpbb/db/driver/factory.php8
-rw-r--r--phpBB/phpbb/db/driver/mssql.php9
-rw-r--r--phpBB/phpbb/db/driver/mssql_base.php9
-rw-r--r--phpBB/phpbb/db/driver/mysql_base.php9
-rw-r--r--phpBB/phpbb/db/driver/oracle.php9
-rw-r--r--phpBB/phpbb/db/driver/postgres.php9
-rw-r--r--phpBB/phpbb/db/driver/sqlite.php19
-rw-r--r--phpBB/phpbb/db/driver/sqlite3.php21
-rw-r--r--phpBB/phpbb/db/migration/data/v310/captcha_plugins.php44
-rw-r--r--phpBB/phpbb/db/migration/data/v310/notifications_use_full_name.php117
-rw-r--r--phpBB/phpbb/db/migration/data/v310/profilefield_facebook.php3
-rw-r--r--phpBB/phpbb/db/migration/data/v310/profilefield_googleplus.php3
-rw-r--r--phpBB/phpbb/db/migration/data/v310/profilefield_skype.php3
-rw-r--r--phpBB/phpbb/db/migration/data/v310/profilefield_twitter.php3
-rw-r--r--phpBB/phpbb/db/migration/data/v310/profilefield_youtube.php3
-rw-r--r--phpBB/phpbb/db/migration/data/v310/rc3.php35
-rw-r--r--phpBB/phpbb/db/migration/data/v310/rename_too_long_indexes.php38
-rw-r--r--phpBB/phpbb/db/migration/data/v310/search_type.php34
-rw-r--r--phpBB/phpbb/db/migration/data/v310/soft_delete_mod_convert.php3
-rw-r--r--phpBB/phpbb/db/migration/data/v310/topic_sort_username.php44
-rw-r--r--phpBB/phpbb/db/migration/tool/permission.php5
-rw-r--r--phpBB/phpbb/db/tools.php253
-rw-r--r--phpBB/phpbb/event/kernel_request_subscriber.php4
-rw-r--r--phpBB/phpbb/extension/base.php9
-rw-r--r--phpBB/phpbb/extension/extension_interface.php7
-rw-r--r--phpBB/phpbb/extension/manager.php6
-rw-r--r--phpBB/phpbb/extension/metadata_manager.php21
-rw-r--r--phpBB/phpbb/feed/helper.php2
-rw-r--r--phpBB/phpbb/log/log.php4
-rw-r--r--phpBB/phpbb/mimetype/content_guesser.php2
-rw-r--r--phpBB/phpbb/mimetype/guesser.php1
-rw-r--r--phpBB/phpbb/notification/manager.php10
-rw-r--r--phpBB/phpbb/notification/method/email.php2
-rw-r--r--phpBB/phpbb/notification/method/jabber.php2
-rw-r--r--phpBB/phpbb/notification/type/admin_activate_user.php2
-rw-r--r--phpBB/phpbb/notification/type/approve_post.php14
-rw-r--r--phpBB/phpbb/notification/type/approve_topic.php14
-rw-r--r--phpBB/phpbb/notification/type/base.php36
-rw-r--r--phpBB/phpbb/notification/type/bookmark.php17
-rw-r--r--phpBB/phpbb/notification/type/disapprove_post.php2
-rw-r--r--phpBB/phpbb/notification/type/disapprove_topic.php2
-rw-r--r--phpBB/phpbb/notification/type/group_request.php2
-rw-r--r--phpBB/phpbb/notification/type/group_request_approved.php2
-rw-r--r--phpBB/phpbb/notification/type/pm.php7
-rw-r--r--phpBB/phpbb/notification/type/post.php19
-rw-r--r--phpBB/phpbb/notification/type/post_in_queue.php5
-rw-r--r--phpBB/phpbb/notification/type/quote.php24
-rw-r--r--phpBB/phpbb/notification/type/report_pm.php5
-rw-r--r--phpBB/phpbb/notification/type/report_pm_closed.php5
-rw-r--r--phpBB/phpbb/notification/type/report_post.php5
-rw-r--r--phpBB/phpbb/notification/type/report_post_closed.php5
-rw-r--r--phpBB/phpbb/notification/type/topic.php17
-rw-r--r--phpBB/phpbb/notification/type/topic_in_queue.php5
-rw-r--r--phpBB/phpbb/path_helper.php2
-rw-r--r--phpBB/phpbb/profilefields/type/type_googleplus.php10
-rw-r--r--phpBB/phpbb/profilefields/type/type_interface.php2
-rw-r--r--phpBB/phpbb/search/base.php18
-rw-r--r--phpBB/phpbb/search/fulltext_mysql.php6
-rw-r--r--phpBB/phpbb/search/fulltext_postgres.php6
-rw-r--r--phpBB/phpbb/search/fulltext_sphinx.php6
-rw-r--r--phpBB/phpbb/session.php24
-rw-r--r--phpBB/phpbb/template/asset.php1
-rw-r--r--phpBB/phpbb/template/twig/definition.php2
-rw-r--r--phpBB/phpbb/template/twig/environment.php9
-rw-r--r--phpBB/phpbb/template/twig/extension.php1
-rw-r--r--phpBB/phpbb/tree/tree_interface.php2
-rw-r--r--phpBB/phpbb/user.php11
-rw-r--r--phpBB/posting.php5
-rw-r--r--phpBB/report.php7
-rw-r--r--phpBB/search.php5
-rw-r--r--phpBB/styles/prosilver/style.cfg4
-rw-r--r--phpBB/styles/prosilver/template/ajax.js5
-rw-r--r--phpBB/styles/prosilver/template/forumlist_body.html4
-rw-r--r--phpBB/styles/prosilver/template/mcp_topic.html2
-rw-r--r--phpBB/styles/prosilver/template/memberlist_view.html2
-rw-r--r--phpBB/styles/prosilver/template/navbar_header.html12
-rw-r--r--phpBB/styles/prosilver/template/overall_header.html2
-rw-r--r--phpBB/styles/prosilver/template/simple_header.html2
-rw-r--r--phpBB/styles/prosilver/template/ucp_avatar_options.html1
-rw-r--r--phpBB/styles/prosilver/template/ucp_pm_viewmessage.html19
-rw-r--r--phpBB/styles/prosilver/template/ucp_prefs_personal.html4
-rw-r--r--phpBB/styles/prosilver/template/viewtopic_body.html22
-rw-r--r--phpBB/styles/prosilver/template/viewtopic_topic_tools.html14
-rw-r--r--phpBB/styles/prosilver/theme/bidi.css56
-rw-r--r--phpBB/styles/prosilver/theme/buttons.css10
-rw-r--r--phpBB/styles/prosilver/theme/colours.css3
-rw-r--r--phpBB/styles/prosilver/theme/common.css42
-rw-r--r--phpBB/styles/prosilver/theme/content.css18
-rw-r--r--phpBB/styles/prosilver/theme/cp.css12
-rw-r--r--phpBB/styles/prosilver/theme/images/created_by.jpgbin52977 -> 0 bytes
-rw-r--r--[-rwxr-xr-x]phpBB/styles/prosilver/theme/images/icon_print.gifbin204 -> 204 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/plupload/done.gif (renamed from phpBB/assets/plupload/img/done.gif)bin1024 -> 1024 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/plupload/error.gif (renamed from phpBB/assets/plupload/img/error.gif)bin994 -> 994 bytes
-rw-r--r--phpBB/styles/prosilver/theme/images/plupload/throbber.gif (renamed from phpBB/assets/plupload/img/throbber.gif)bin1922 -> 1922 bytes
-rw-r--r--phpBB/styles/prosilver/theme/links.css2
-rw-r--r--phpBB/styles/prosilver/theme/plupload.css6
-rw-r--r--phpBB/styles/prosilver/theme/responsive.css23
-rw-r--r--phpBB/styles/prosilver/theme/tweaks.css5
-rw-r--r--phpBB/styles/subsilver2/style.cfg4
-rw-r--r--phpBB/styles/subsilver2/template/mcp_topic.html2
-rw-r--r--phpBB/styles/subsilver2/template/overall_header.html4
-rw-r--r--phpBB/styles/subsilver2/template/simple_header.html2
-rw-r--r--phpBB/styles/subsilver2/template/ucp_groups_manage.html1
-rw-r--r--phpBB/styles/subsilver2/template/ucp_prefs_personal.html2
-rw-r--r--phpBB/styles/subsilver2/template/ucp_profile_avatar.html1
-rw-r--r--phpBB/styles/subsilver2/template/viewtopic_body.html4
-rw-r--r--phpBB/viewtopic.php51
-rw-r--r--tests/auth/provider_apache_test.php2
-rw-r--r--tests/auth/provider_db_test.php6
-rw-r--r--tests/auth/provider_oauth_token_storage_test.php2
-rw-r--r--tests/avatar/fixtures/users.xml33
-rw-r--r--tests/avatar/manager_test.php83
-rw-r--r--tests/bootstrap.php1
-rw-r--r--tests/config_php_file_test.php10
-rw-r--r--tests/console/cron/cron_list_test.php2
-rw-r--r--tests/console/cron/run_test.php2
-rw-r--r--tests/content_visibility/delete_post_test.php41
-rw-r--r--tests/content_visibility/get_forums_visibility_sql_test.php5
-rw-r--r--tests/content_visibility/get_global_visibility_sql_test.php5
-rw-r--r--tests/content_visibility/get_visibility_sql_test.php5
-rw-r--r--tests/content_visibility/set_post_visibility_test.php10
-rw-r--r--tests/content_visibility/set_topic_visibility_test.php5
-rw-r--r--tests/controller/controller_test.php2
-rw-r--r--tests/controller/helper_route_test.php2
-rw-r--r--tests/datetime/from_format_test.php2
-rw-r--r--tests/dbal/db_tools_test.php12
-rw-r--r--tests/dbal/migrator_test.php2
-rw-r--r--tests/dbal/migrator_tool_module_test.php2
-rw-r--r--tests/dbal/select_test.php60
-rw-r--r--tests/di/create_container_test.php4
-rw-r--r--tests/extension/ext/vendor3/foo/composer.json23
-rw-r--r--tests/extension/ext/vendor3/foo/ext.php20
-rw-r--r--tests/extension/manager_test.php17
-rw-r--r--tests/extension/metadata_manager_test.php2
-rw-r--r--tests/functional/avatar_acp_groups_test.php2
-rw-r--r--tests/functional/avatar_acp_users_test.php2
-rw-r--r--tests/functional/avatar_ucp_groups_test.php2
-rw-r--r--tests/functional/avatar_ucp_users_test.php13
-rw-r--r--tests/functional/common_avatar_test.php15
-rw-r--r--tests/functional/download_test.php64
-rw-r--r--tests/functional/extension_acp_test.php6
-rw-r--r--tests/functional/fileupload_form_test.php6
-rw-r--r--tests/functional/fileupload_remote_test.php4
-rw-r--r--tests/functional/forgot_password_test.php2
-rw-r--r--tests/functional/notification_test.php16
-rw-r--r--tests/functional/plupload_test.php2
-rw-r--r--tests/functional/private_messages_test.php69
-rw-r--r--tests/functions/generate_string_list.php2
-rw-r--r--tests/functions/insert_config_array_test.php142
-rw-r--r--tests/groupposition/legend_test.php14
-rw-r--r--tests/groupposition/teampage_test.php16
-rw-r--r--tests/lock/flock_test.php8
-rw-r--r--tests/log/add_test.php4
-rw-r--r--tests/log/delete_test.php2
-rw-r--r--tests/log/function_add_log_test.php2
-rw-r--r--tests/notification/base.php37
-rw-r--r--tests/notification/fixtures/submit_post_notification.type.bookmark.xml (renamed from tests/notification/fixtures/submit_post_bookmark.xml)12
-rw-r--r--tests/notification/fixtures/submit_post_notification.type.post.xml (renamed from tests/notification/fixtures/submit_post_post.xml)16
-rw-r--r--tests/notification/fixtures/submit_post_notification.type.post_in_queue.xml (renamed from tests/notification/fixtures/submit_post_post_in_queue.xml)16
-rw-r--r--tests/notification/fixtures/submit_post_notification.type.quote.xml (renamed from tests/notification/fixtures/submit_post_quote.xml)12
-rw-r--r--tests/notification/fixtures/submit_post_notification.type.topic.xml (renamed from tests/notification/fixtures/submit_post_topic.xml)10
-rw-r--r--tests/notification/group_request_test.php4
-rw-r--r--tests/notification/manager_helper.php3
-rw-r--r--tests/notification/notification_test.php50
-rw-r--r--tests/notification/submit_post_base.php4
-rw-r--r--tests/notification/submit_post_type_bookmark_test.php2
-rw-r--r--tests/notification/submit_post_type_post_in_queue_test.php2
-rw-r--r--tests/notification/submit_post_type_post_test.php2
-rw-r--r--tests/notification/submit_post_type_quote_test.php2
-rw-r--r--tests/notification/submit_post_type_topic_test.php2
-rw-r--r--tests/notification/user_list_trim_test.php2
-rw-r--r--tests/pagination/pagination_test.php2
-rw-r--r--tests/profilefields/type_bool_test.php2
-rw-r--r--tests/profilefields/type_date_test.php2
-rw-r--r--tests/profilefields/type_dropdown_test.php2
-rw-r--r--tests/profilefields/type_googleplus_test.php54
-rw-r--r--tests/profilefields/type_int_test.php2
-rw-r--r--tests/profilefields/type_string_test.php2
-rw-r--r--tests/profilefields/type_url_test.php2
-rw-r--r--tests/security/base.php2
-rw-r--r--tests/session/garbage_collection_test.php16
-rw-r--r--tests/template/template_test_case.php2
-rw-r--r--tests/test_framework/phpbb_functional_test_case.php280
-rw-r--r--tests/test_framework/phpbb_mink_test_case.php183
-rw-r--r--tests/upload/filespec_test.php39
-rw-r--r--tests/user/lang_test.php4
-rw-r--r--tests/version/version_fetch_test.php2
-rw-r--r--tests/version/version_test.php6
-rwxr-xr-xtravis/check-executable-files.sh68
-rwxr-xr-xtravis/check-image-icc-profiles.sh2
-rwxr-xr-xtravis/check-sami-parse-errors.sh33
-rw-r--r--travis/sami.conf.php19
-rwxr-xr-xtravis/setup-php-extensions.sh6
-rwxr-xr-xtravis/setup-phpbb.sh3
-rwxr-xr-xtravis/setup-unbuffer.sh14
-rwxr-xr-xtravis/setup-webserver.sh7
318 files changed, 4907 insertions, 3507 deletions
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000000..0e7d70f2a7
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,18 @@
+# This file is for standardising the coding style between different editors
+# http://editorconfig.org/
+
+root = true
+
+[*]
+end_of_line = lf
+indent_size = 4
+indent_style = tab
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.md]
+trim_trailing_whitespace = false
+
+[*.yml]
+indent_size = 4
+indent_style = space
diff --git a/.travis.yml b/.travis.yml
index fe91fe78c8..cbba07b16d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -37,7 +37,9 @@ before_script:
script:
- travis/phing-sniff.sh $DB $TRAVIS_PHP_VERSION
+ - travis/check-sami-parse-errors.sh $DB $TRAVIS_PHP_VERSION
- travis/check-image-icc-profiles.sh $DB $TRAVIS_PHP_VERSION
+ - travis/check-executable-files.sh $DB $TRAVIS_PHP_VERSION ./
- phpBB/vendor/bin/phpunit --configuration travis/phpunit-$DB-travis.xml
- - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.5' -a '$DB' = 'mysqli' -a '$TRAVIS_PULL_REQUEST' != 'false' ]; then git-tools/commit-msg-hook-range.sh origin/$TRAVIS_BRANCH..FETCH_HEAD; fi"
+ - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.3.3' -a '$DB' = 'mysqli' -a '$TRAVIS_PULL_REQUEST' != 'false' ]; then git-tools/commit-msg-hook-range.sh origin/$TRAVIS_BRANCH..FETCH_HEAD; fi"
diff --git a/build/build.xml b/build/build.xml
index 3c1a3e4db4..56fe802824 100644
--- a/build/build.xml
+++ b/build/build.xml
@@ -2,9 +2,9 @@
<project name="phpBB" description="The phpBB forum software" default="all" basedir="../">
<!-- a few settings for the build -->
- <property name="newversion" value="3.1.0-RC3-dev" />
- <property name="prevversion" value="3.1.0-RC2" />
- <property name="olderversions" value="3.0.12, 3.1.0-a1, 3.1.0-a2, 3.1.0-a3, 3.1.0-b1, 3.1.0-b2, 3.1.0-b3, 3.1.0-b4, 3.1.0-RC1" />
+ <property name="newversion" value="3.1.0-RC4-dev" />
+ <property name="prevversion" value="3.1.0-RC3" />
+ <property name="olderversions" value="3.0.12, 3.1.0-a1, 3.1.0-a2, 3.1.0-a3, 3.1.0-b1, 3.1.0-b2, 3.1.0-b3, 3.1.0-b4, 3.1.0-RC1, 3.1.0-RC2" />
<!-- no configuration should be needed beyond this point -->
<property name="oldversions" value="${olderversions}, ${prevversion}" />
@@ -259,7 +259,7 @@
command="git archive ${revision} composer.phar | tar -xf - -C ${dir}"
checkreturn="true" />
<exec dir="${dir}"
- command="php composer.phar install --no-dev"
+ command="php composer.phar install --no-dev --optimize-autoloader"
checkreturn="true"
passthru="true" />
<delete file="${dir}/composer.phar" />
diff --git a/build/sami.conf.php b/build/sami.conf.php
index febd0276d4..78d532631c 100644
--- a/build/sami.conf.php
+++ b/build/sami.conf.php
@@ -45,7 +45,7 @@ $versions = Sami\Version\GitVersionCollection::create(__DIR__ . '/../')
->add('develop-ascraeus')
;
-return new Sami\Sami($iterator, array(
+$config = array(
'theme' => 'enhanced',
'versions' => $versions,
'title' => 'phpBB API Documentation',
@@ -54,4 +54,6 @@ return new Sami\Sami($iterator, array(
'default_opened_level' => 2,
// Do not use JsonStore. See https://github.com/fabpot/Sami/issues/79
'store' => new PhpbbArrayStore,
-));
+);
+
+return new Sami\Sami($iterator, $config);
diff --git a/phpBB/adm/style/acp_groups.html b/phpBB/adm/style/acp_groups.html
index 6049673e0a..d24d62497d 100644
--- a/phpBB/adm/style/acp_groups.html
+++ b/phpBB/adm/style/acp_groups.html
@@ -117,7 +117,6 @@
<dl>
<dt><label>{L_AVATAR_TYPE}{L_COLON}</label></dt>
<dd><select name="avatar_driver" id="avatar_driver" data-togglable-settings="true">
- <option value="">{L_NO_AVATAR}</option>
<!-- BEGIN avatar_drivers -->
<option value="{avatar_drivers.DRIVER}"<!-- IF avatar_drivers.SELECTED --> selected="selected"<!-- ENDIF --> data-toggle-setting="#avatar_option_{avatar_drivers.DRIVER}">{avatar_drivers.L_TITLE}</option>
<!-- END avatar_drivers -->
diff --git a/phpBB/adm/style/acp_ranks.html b/phpBB/adm/style/acp_ranks.html
index dd2d07a837..fa06513b98 100644
--- a/phpBB/adm/style/acp_ranks.html
+++ b/phpBB/adm/style/acp_ranks.html
@@ -24,6 +24,9 @@
<fieldset>
<legend>{L_ACP_RANKS}</legend>
+
+ <!-- EVENT acp_ranks_edit_before -->
+
<dl>
<dt><label for="title">{L_RANK_TITLE}{L_COLON}</label></dt>
<dd><input name="title" type="text" id="title" value="{RANK_TITLE}" maxlength="255" /></dd>
@@ -38,13 +41,15 @@
<dd><label><input onclick="phpbb.toggleDisplay('posts', -1)" type="radio" class="radio" name="special_rank" value="1" id="special_rank"<!-- IF S_SPECIAL_RANK --> checked="checked"<!-- ENDIF --> /> {L_YES}</label>
<label><input onclick="phpbb.toggleDisplay('posts', 1)" type="radio" class="radio" name="special_rank" value="0"<!-- IF not S_SPECIAL_RANK --> checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
</dl>
- <!-- IF S_SPECIAL_RANK --><div id="posts" style="display: none;"><!-- ELSE --><div id="posts"><!-- ENDIF -->
+ <div id="posts"<!-- IF S_SPECIAL_RANK --> style="display: none;"<!-- ENDIF -->>
<dl>
<dt><label for="min_posts">{L_RANK_MINIMUM}{L_COLON}</label></dt>
<dd><input name="min_posts" type="number" id="min_posts" maxlength="10" value="{MIN_POSTS}" /></dd>
</dl>
</div>
+ <!-- EVENT acp_ranks_edit_after -->
+
<p class="submit-buttons">
<input type="hidden" name="action" value="save" />
@@ -68,18 +73,22 @@
<table class="table1 zebra-table">
<thead>
<tr>
+ <!-- EVENT acp_ranks_list_header_before -->
<th>{L_RANK_IMAGE}</th>
<th>{L_RANK_TITLE}</th>
<th>{L_RANK_MINIMUM}</th>
+ <!-- EVENT acp_ranks_list_header_after -->
<th>{L_ACTION}</th>
</tr>
</thead>
<tbody>
<!-- BEGIN ranks -->
<tr>
+ <!-- EVENT acp_ranks_list_column_before -->
<td style="text-align: center;"><!-- IF ranks.S_RANK_IMAGE --><img src="{ranks.RANK_IMAGE}" alt="{ranks.RANK_TITLE}" title="{ranks.RANK_TITLE}" /><!-- ELSE -->&nbsp; - &nbsp;<!-- ENDIF --></td>
<td style="text-align: center;">{ranks.RANK_TITLE}</td>
<td style="text-align: center;"><!-- IF ranks.S_SPECIAL_RANK -->&nbsp; - &nbsp;<!-- ELSE -->{ranks.MIN_POSTS}<!-- ENDIF --></td>
+ <!-- EVENT acp_ranks_list_column_after -->
<td style="text-align: center;"><a href="{ranks.U_EDIT}">{ICON_EDIT}</a> <a href="{ranks.U_DELETE}" data-ajax="row_delete">{ICON_DELETE}</a></td>
</tr>
<!-- END ranks -->
diff --git a/phpBB/adm/style/acp_users_avatar.html b/phpBB/adm/style/acp_users_avatar.html
index 8ad4ad710b..8466985fb3 100644
--- a/phpBB/adm/style/acp_users_avatar.html
+++ b/phpBB/adm/style/acp_users_avatar.html
@@ -14,7 +14,6 @@
<dl>
<dt><label>{L_AVATAR_TYPE}</label></dt>
<dd><select name="avatar_driver" id="avatar_driver" data-togglable-settings="true">
- <option value="">{L_NO_AVATAR}</option>
<!-- BEGIN avatar_drivers -->
<option value="{avatar_drivers.DRIVER}"<!-- IF avatar_drivers.SELECTED --> selected="selected"<!-- ENDIF --> data-toggle-setting="#avatar_option_{avatar_drivers.DRIVER}">{avatar_drivers.L_TITLE}</option>
<!-- END avatar_drivers -->
diff --git a/phpBB/adm/style/overall_header.html b/phpBB/adm/style/overall_header.html
index afd2b94924..f1f7eee282 100644
--- a/phpBB/adm/style/overall_header.html
+++ b/phpBB/adm/style/overall_header.html
@@ -89,6 +89,8 @@ function popup(url, width, height, name)
{$STYLESHEETS}
+<!-- EVENT acp_overall_header_stylesheets_after -->
+
</head>
<body class="{S_CONTENT_DIRECTION} {BODY_CLASS} nojs">
diff --git a/phpBB/adm/style/simple_header.html b/phpBB/adm/style/simple_header.html
index bf8f41cd7a..d0b9bf62ed 100644
--- a/phpBB/adm/style/simple_header.html
+++ b/phpBB/adm/style/simple_header.html
@@ -84,6 +84,7 @@ function find_username(url)
</script>
<!-- EVENT acp_simple_header_head_append -->
{$STYLESHEETS}
+<!-- EVENT acp_simple_header_stylesheets_after -->
</head>
<body class="{S_CONTENT_DIRECTION} {BODY_CLASS}">
diff --git a/phpBB/composer.json b/phpBB/composer.json
index 9b473a3bb7..e74dd120f0 100644
--- a/phpBB/composer.json
+++ b/phpBB/composer.json
@@ -1,9 +1,31 @@
{
- "_readme": [
- "You MUST update the clean-vendor-dir target in build/build.xml",
- "accordingly when adding or upgrading dependencies."
+ "name": "phpbb/phpbb",
+ "description": "phpBB Forum Software application",
+ "type": "project",
+ "keywords": ["phpbb", "forum"],
+ "homepage": "https://www.phpbb.com",
+ "license": "GPL-2.0",
+ "authors": [
+ {
+ "name": "phpBB Limited",
+ "email": "operations@phpbb.com",
+ "homepage": "https://www.phpbb.com/go/authors"
+ }
],
+ "support": {
+ "issues": "https://tracker.phpbb.com",
+ "forum": "https://www.phpbb.com/community/",
+ "wiki": "https://wiki.phpbb.com",
+ "irc": "irc://irc.freenode.org/phpbb"
+ },
+ "scripts": {
+ "post-update-cmd": "echo 'You MUST manually modify the clean-vendor-dir target in build/build.xml when adding or upgrading dependencies.'"
+ },
+ "replace": {
+ "phpbb/phpbb-core": "self.version"
+ },
"require": {
+ "php": ">=5.3.3",
"lusitanian/oauth": "0.2.*",
"symfony/config": "2.3.*",
"symfony/console": "2.3.*",
@@ -15,8 +37,6 @@
"twig/twig": "1.13.*"
},
"require-dev": {
- "behat/mink": "1.4.*",
- "behat/mink-goutte-driver": "1.0.*",
"fabpot/goutte": "1.0.*",
"phpunit/dbunit": "1.3.*",
"phpunit/phpunit": "4.1.*",
diff --git a/phpBB/composer.lock b/phpBB/composer.lock
index 751cd0695f..671daa70e1 100644
--- a/phpBB/composer.lock
+++ b/phpBB/composer.lock
@@ -3,7 +3,7 @@
"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": "dcd46c1373cfc4dacd2e1f8a79da0b91",
+ "hash": "27d5da149e0b5d76b76f43210306b666",
"packages": [
{
"name": "lusitanian/oauth",
@@ -721,167 +721,6 @@
],
"packages-dev": [
{
- "name": "behat/mink",
- "version": "v1.4.3",
- "source": {
- "type": "git",
- "url": "https://github.com/Behat/Mink.git",
- "reference": "0817070a6e2ec9f475fad9bfb81a962c462eb934"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/Behat/Mink/zipball/0817070a6e2ec9f475fad9bfb81a962c462eb934",
- "reference": "0817070a6e2ec9f475fad9bfb81a962c462eb934",
- "shasum": ""
- },
- "require": {
- "php": ">=5.3.1",
- "symfony/css-selector": ">=2.0,<2.4-dev"
- },
- "suggest": {
- "behat/mink-browserkit-driver": "extremely fast headless driver for Symfony\\Kernel-based apps (Sf2, Silex)",
- "behat/mink-goutte-driver": "fast headless driver for any app without JS emulation",
- "behat/mink-selenium2-driver": "slow, but JS-enabled driver for any app (requires Selenium2)",
- "behat/mink-zombie-driver": "fast and JS-enabled headless driver for any app (requires node.js)"
- },
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-develop": "1.4.x-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Behat\\Mink": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Konstantin Kudryashov",
- "email": "ever.zet@gmail.com",
- "homepage": "http://everzet.com"
- }
- ],
- "description": "Web acceptance testing framework for PHP 5.3",
- "homepage": "http://mink.behat.org/",
- "keywords": [
- "browser",
- "testing",
- "web"
- ],
- "time": "2013-03-02 15:53:18"
- },
- {
- "name": "behat/mink-browserkit-driver",
- "version": "v1.0.5",
- "source": {
- "type": "git",
- "url": "https://github.com/Behat/MinkBrowserKitDriver.git",
- "reference": "f2771b5fc4dbc233859addf37a7d150852f78418"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/Behat/MinkBrowserKitDriver/zipball/f2771b5fc4dbc233859addf37a7d150852f78418",
- "reference": "f2771b5fc4dbc233859addf37a7d150852f78418",
- "shasum": ""
- },
- "require": {
- "behat/mink": "~1.4.3",
- "php": ">=5.3.1",
- "symfony/browser-kit": "~2.0",
- "symfony/dom-crawler": "~2.0"
- },
- "require-dev": {
- "silex/silex": "@dev"
- },
- "type": "mink-driver",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0.x-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Behat\\Mink\\Driver": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Konstantin Kudryashov",
- "email": "ever.zet@gmail.com",
- "homepage": "http://everzet.com"
- }
- ],
- "description": "Symfony2 BrowserKit driver for Mink framework",
- "homepage": "http://mink.behat.org/",
- "keywords": [
- "Mink",
- "Symfony2",
- "browser",
- "testing"
- ],
- "time": "2013-04-13 12:17:15"
- },
- {
- "name": "behat/mink-goutte-driver",
- "version": "v1.0.9",
- "source": {
- "type": "git",
- "url": "https://github.com/Behat/MinkGoutteDriver.git",
- "reference": "fa1b073b48761464feb0b05e6825da44b20118d8"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/Behat/MinkGoutteDriver/zipball/fa1b073b48761464feb0b05e6825da44b20118d8",
- "reference": "fa1b073b48761464feb0b05e6825da44b20118d8",
- "shasum": ""
- },
- "require": {
- "behat/mink-browserkit-driver": ">=1.0.5,<1.2.0",
- "fabpot/goutte": "~1.0.1",
- "php": ">=5.3.1"
- },
- "type": "mink-driver",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0.x-dev"
- }
- },
- "autoload": {
- "psr-0": {
- "Behat\\Mink\\Driver": "src/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Konstantin Kudryashov",
- "email": "ever.zet@gmail.com",
- "homepage": "http://everzet.com"
- }
- ],
- "description": "Goutte driver for Mink framework",
- "homepage": "http://mink.behat.org/",
- "keywords": [
- "browser",
- "goutte",
- "headless",
- "testing"
- ],
- "time": "2013-07-03 18:43:54"
- },
- {
"name": "fabpot/goutte",
"version": "v1.0.3",
"source": {
@@ -2437,9 +2276,9 @@
"stability-flags": [
],
- "platform": [
-
- ],
+ "platform": {
+ "php": ">=5.3.3"
+ },
"platform-dev": [
]
diff --git a/phpBB/config/auth_providers.yml b/phpBB/config/auth_providers.yml
index d2f22ec477..89303a684a 100644
--- a/phpBB/config/auth_providers.yml
+++ b/phpBB/config/auth_providers.yml
@@ -14,6 +14,7 @@ services:
- @passwords.manager
- @request
- @user
+ - @service_container
- %core.root_path%
- %core.php_ext%
tags:
@@ -51,6 +52,7 @@ services:
- %tables.auth_provider_oauth_account_assoc%
- @auth.provider.oauth.service_collection
- %tables.users%
+ - @service_container
- %core.root_path%
- %core.php_ext%
tags:
diff --git a/phpBB/config/avatars.yml b/phpBB/config/avatars.yml
index d22a5db2ae..8e5b1fdbfe 100644
--- a/phpBB/config/avatars.yml
+++ b/phpBB/config/avatars.yml
@@ -45,6 +45,7 @@ services:
- %core.root_path%
- %core.php_ext%
- @path_helper
+ - @mimetype.guesser
- @cache.driver
calls:
- [set_name, [avatar.driver.upload]]
diff --git a/phpBB/config/captcha.yml b/phpBB/config/captcha.yml
new file mode 100644
index 0000000000..bca37767af
--- /dev/null
+++ b/phpBB/config/captcha.yml
@@ -0,0 +1,62 @@
+parameters:
+ tables.captcha_qa_questions: %core.table_prefix%captcha_questions
+ tables.captcha_qa_answers: %core.table_prefix%captcha_answers
+ tables.captcha_qa_confirm: %core.table_prefix%qa_confirm
+
+services:
+ captcha.factory:
+ class: phpbb\captcha\factory
+ arguments:
+ - @service_container
+ - @captcha.plugins.service_collection
+
+ captcha.plugins.service_collection:
+ class: phpbb\di\service_collection
+ arguments:
+ - @service_container
+ tags:
+ - { name: service_collection, tag: captcha.plugins }
+
+ core.captcha.plugins.gd:
+ class: phpbb\captcha\plugins\gd
+ scope: prototype # scope MUST be prototype for this to work!
+ calls:
+ - [set_name, [core.captcha.plugins.gd]]
+ tags:
+ - { name: captcha.plugins }
+
+ core.captcha.plugins.gd_wave:
+ class: phpbb\captcha\plugins\gd_wave
+ scope: prototype # scope MUST be prototype for this to work!
+ calls:
+ - [set_name, [core.captcha.plugins.gd_wave]]
+ tags:
+ - { name: captcha.plugins }
+
+ core.captcha.plugins.nogd:
+ class: phpbb\captcha\plugins\nogd
+ scope: prototype # scope MUST be prototype for this to work!
+ calls:
+ - [set_name, [core.captcha.plugins.nogd]]
+ tags:
+ - { name: captcha.plugins }
+
+ core.captcha.plugins.qa:
+ class: phpbb\captcha\plugins\qa
+ scope: prototype # scope MUST be prototype for this to work!
+ arguments:
+ - %tables.captcha_qa_questions%
+ - %tables.captcha_qa_answers%
+ - %tables.captcha_qa_confirm%
+ calls:
+ - [set_name, [core.captcha.plugins.qa]]
+ tags:
+ - { name: captcha.plugins }
+
+ core.captcha.plugins.recaptcha:
+ class: phpbb\captcha\plugins\recaptcha
+ scope: prototype # scope MUST be prototype for this to work!
+ calls:
+ - [set_name, [core.captcha.plugins.recaptcha]]
+ tags:
+ - { name: captcha.plugins }
diff --git a/phpBB/config/parameters.yml b/phpBB/config/parameters.yml
new file mode 100644
index 0000000000..5bf2c678ee
--- /dev/null
+++ b/phpBB/config/parameters.yml
@@ -0,0 +1,2 @@
+parameters:
+ datetime.class: \phpbb\datetime
diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml
index b4e387bd73..a588046245 100644
--- a/phpBB/config/services.yml
+++ b/phpBB/config/services.yml
@@ -10,6 +10,8 @@ imports:
- { resource: mimetype_guessers.yml }
- { resource: passwords.yml }
- { resource: profilefields.yml }
+ - { resource: captcha.yml }
+ - { resource: parameters.yml }
services:
acl.permissions:
@@ -79,6 +81,7 @@ services:
class: phpbb\content_visibility
arguments:
- @auth
+ - @config
- @dbal.conn
- @user
- %core.root_path%
@@ -345,6 +348,8 @@ services:
user:
class: phpbb\user
+ arguments:
+ - %datetime.class%
user_loader:
class: phpbb\user_loader
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index 71971108b1..d882d2e3f4 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -46,8 +46,9 @@
<ol>
<li><a href="#changelog">Changelog</a>
<ol style="list-style-type: lower-roman;">
- <li><a href="#v310b3">Changes since 3.1.0-RC1</a></li>
- <li><a href="#v310b3">Changes since 3.1.0-b4</a></li>
+ <li><a href="#v310RC2">Changes since 3.1.0-RC2</a></li>
+ <li><a href="#v310RC1">Changes since 3.1.0-RC1</a></li>
+ <li><a href="#v310b4">Changes since 3.1.0-b4</a></li>
<li><a href="#v310b3">Changes since 3.1.0-b3</a></li>
<li><a href="#v310b2">Changes since 3.1.0-b2</a></li>
<li><a href="#v310b1">Changes since 3.1.0-b1</a></li>
@@ -95,7 +96,131 @@
<div class="content">
- <a name="v310RC1"></a><h3>1.i. Changes since 3.1.0-RC1</h3>
+ <a name="v310RC2"></a><h3>1.i. Changes since 3.1.0-RC2</h3>
+
+ <h4>Bug</h4>
+ <ul>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11148">PHPBB3-11148</a>] - Fix uploading attachments from Android 4 powered devices</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11480">PHPBB3-11480</a>] - Prevent Private Message system from returning &quot;Unknown folder&quot; when inbox folder is full</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11520">PHPBB3-11520</a>] - Post count not incremented when you fork a topic</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11854">PHPBB3-11854</a>] - Captcha code is still in includes/</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12232">PHPBB3-12232</a>] - MCP Banning: Max execution time exceeded</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12448">PHPBB3-12448</a>] - Migration tools don't allow adding columns with default == NULL</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12492">PHPBB3-12492</a>] - DB_TEST: Special chars are not supported.</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12535">PHPBB3-12535</a>] - The profile link should be better adjusted to the avatar image it surrounds in viewtopic.php</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12685">PHPBB3-12685</a>] - CLI doesn't load extension commands</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12710">PHPBB3-12710</a>] - phpBB 3.0.12 on Oracle fails to upgrade to 3.1.0</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12718">PHPBB3-12718</a>] - Hard Deleting Post does not Decrease Post Count</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12742">PHPBB3-12742</a>] - Notifications duplicate code that requires an event</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12744">PHPBB3-12744</a>] - RTL board header is one line higher than LTR</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12748">PHPBB3-12748</a>] - UCP Terms of Use Typo</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12770">PHPBB3-12770</a>] - search_wordmatch unique key name is too long</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12776">PHPBB3-12776</a>] - docs/INSTALL.html is missing 3.0 to 3.1 update instructions</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12789">PHPBB3-12789</a>] - Cached directories are not deleted when the cache is purged (with ACM memory enabled).</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12791">PHPBB3-12791</a>] - String profile fields do not use links, smilies and line breaks in memberlist</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12792">PHPBB3-12792</a>] - Profile field type strings function get_profile_contact_value duplicates raw()</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12793">PHPBB3-12793</a>] - String '0' does not display for string profile fields</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12794">PHPBB3-12794</a>] - Google+ profile field validation is too strict</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12809">PHPBB3-12809</a>] - RTL styling issues with new jump-box dropdown</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12814">PHPBB3-12814</a>] - Error while trying to setup LDAP Authentication in ACP</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12822">PHPBB3-12822</a>] - Preselect avatar type if only 1 type is enabled</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12837">PHPBB3-12837</a>] - Viewing contact form displays &quot;VIEWING_MEMBERS&quot; on viewonline</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12842">PHPBB3-12842</a>] - Out of memory issue in code sniffer call for extensions</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12843">PHPBB3-12843</a>] - When you click on &quot;Mark forums read&quot; in the browser, a console error occurs</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12844">PHPBB3-12844</a>] - $dbpasswd is cleared too early in connection manager</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12845">PHPBB3-12845</a>] - HTML5 Invalid using role=&quot;navigation&quot;</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12846">PHPBB3-12846</a>] - SQLite3 bug in profilefield_base_migration.php</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12849">PHPBB3-12849</a>] - ReferenceError in core.js</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12851">PHPBB3-12851</a>] - Font colour button title is not consistent with other buttons</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12853">PHPBB3-12853</a>] - Problems with ACP/MCP links in mobile design with other translations</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12854">PHPBB3-12854</a>] - Admin contact page should not be used when board emails are disabled</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12855">PHPBB3-12855</a>] - Container is being recompiled on every page request although DEBUG_CONTAINER is not set</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12859">PHPBB3-12859</a>] - Missing post button events from view pm template</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12870">PHPBB3-12870</a>] - Console database migrate function can not update from 3.0.12 to 3.1</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12873">PHPBB3-12873</a>] - Wrong identifier tested in \db\tools\sql_create_(unique_)index()</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12875">PHPBB3-12875</a>] - Extension's info_acp_lang files don't fallback correctly when the user's language is not included in the extension</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12881">PHPBB3-12881</a>] - Debug error - Undefined index: mark_time</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12882">PHPBB3-12882</a>] - $config['search_type'] - is not correctly updated when updating from 3.0 to 3.1</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12883">PHPBB3-12883</a>] - Do not use basename() to get the search class in phpbb\cron\task\core\tidy_search</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12886">PHPBB3-12886</a>] - Redundant lock and unlock expressions for QuickMod in viewtopic.php</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12887">PHPBB3-12887</a>] - Typo in timezone handling code: 'offest' should be 'offset'</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12891">PHPBB3-12891</a>] - Long page generation time when banlist is long</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12895">PHPBB3-12895</a>] - ?style=1 appended to url after using the UCP</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12898">PHPBB3-12898</a>] - In cron.php we try to release the lock after the call to garbage_collection()</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12901">PHPBB3-12901</a>] - Wrong type hint in show_available_child_styles() doc block</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12902">PHPBB3-12902</a>] - Remove duplicate entry in build_cfg_template() switch statement</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12903">PHPBB3-12903</a>] - Remove unused method in phpBB/phpbb/extension/metadata_manager.php</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12908">PHPBB3-12908</a>] - Fix broken operator assignment in increment.php</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12909">PHPBB3-12909</a>] - Use correct lang vars in cli extension enable</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12910">PHPBB3-12910</a>] - Profile fields: Two &quot;simple text field&quot; in dropdown menu</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12912">PHPBB3-12912</a>] - Undefined index when adding logs from extensions</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12918">PHPBB3-12918</a>] - Functional Tests Suite does not run on its own</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12919">PHPBB3-12919</a>] - Allow using class names as module identifier for extensions</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12922">PHPBB3-12922</a>] - Posts per page in MCP should have a minimum value of zero</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12931">PHPBB3-12931</a>] - General error on user registration when domain name is not set</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12932">PHPBB3-12932</a>] - Easy support of non-gregorian calendars</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12937">PHPBB3-12937</a>] - Without config file, extract($phpbb_config_php_file-&gt;get_all()); breaks</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12938">PHPBB3-12938</a>] - Board floods &quot;store&quot;-directory with packed attachments</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12940">PHPBB3-12940</a>] - Unused 'use' statements in download/file.php</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12950">PHPBB3-12950</a>] - Functional tests can not be run anymore if another language is present</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12954">PHPBB3-12954</a>] - Nginx setup on travis returns wrong SCRIPT_NAME info</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12956">PHPBB3-12956</a>] - Unknown column 'field_is_contact' in 'field list'</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12964">PHPBB3-12964</a>] - Undefined $row in download/file.php</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12967">PHPBB3-12967</a>] - Undefined variable: phpbb_dispatcher in mcp_queue.php</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12970">PHPBB3-12970</a>] - chema.json is not up to date with migration files</li>
+ </ul>
+ <h4>Improvement</h4>
+ <ul>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9165">PHPBB3-9165</a>] - Extend template loop to allow iteration step modification</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10073">PHPBB3-10073</a>] - Contact page</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12051">PHPBB3-12051</a>] - Optimise Composer Autoloader on Build</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12560">PHPBB3-12560</a>] - Add methods to set upload and temp paths in Plupload class</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12656">PHPBB3-12656</a>] - Translate existing CLI commands</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12663">PHPBB3-12663</a>] - Extract Command Line Interface language strings into their own file.</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12671">PHPBB3-12671</a>] - Possibility to use NOT LIKE expression</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12693">PHPBB3-12693</a>] - Add a travis test that checks file permissions</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12738">PHPBB3-12738</a>] - Move related code from functions_posting into remove_post_from_statistic()</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12778">PHPBB3-12778</a>] - The automatic updater should have an option to automatically delete removed files during update</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12828">PHPBB3-12828</a>] - Add includes/ucp/ucp_prefs.php common core event to allow additional actions before the page load</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12832">PHPBB3-12832</a>] - Add footer links to the Quick Links menu</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12836">PHPBB3-12836</a>] - [Event] - core.functions.redirect</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12841">PHPBB3-12841</a>] - Allow extensions to position new config vars in an array</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12847">PHPBB3-12847</a>] - Allow extensions to define if they can be enabled</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12857">PHPBB3-12857</a>] - Add template events overall_header_breadcrumbs_before/after</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12864">PHPBB3-12864</a>] - Have an EVENT tag after STYLESHEETS in overall_header</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12871">PHPBB3-12871</a>] - Add PHPBB_DISPLAY_LOAD_TIME constant to config.php on installation</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12872">PHPBB3-12872</a>] - Add poster_id to viewtopic_modify_post_row</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12884">PHPBB3-12884</a>] - Add core event to the function upload_attachment()</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12892">PHPBB3-12892</a>] - S_NUM_ROWS does not scale</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12896">PHPBB3-12896</a>] - Add event in acp_main to allow php checks for admin notices</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12906">PHPBB3-12906</a>] - Add rel=&quot;help&quot; to FAQ link</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12913">PHPBB3-12913</a>] - Add more parameters to core.submit_post_end event</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12942">PHPBB3-12942</a>] - Add core.add_form_key core event</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12944">PHPBB3-12944</a>] - Add core.login_forum_box core event</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12953">PHPBB3-12953</a>] - Page title not updated when notifications are marked as read</li>
+ </ul>
+ <h4>Sub-task</h4>
+ <ul>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12800">PHPBB3-12800</a>] - [Event] - Create core.functions_display.display_user_activity.actives_after</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12801">PHPBB3-12801</a>] - [Event] - core.functions_posting.load_drafts_draft_list_results</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12876">PHPBB3-12876</a>] - [Event] - core.mcp_mcp_front.mcp_front_view_queue_postid_list_after</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12880">PHPBB3-12880</a>] - [Event] - core.mcp_queue_!is_topics_query_before</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12927">PHPBB3-12927</a>] - [Event] - core.mcp_queue_get_posts2_query_before</li>
+ </ul>
+ <h4>Task</h4>
+ <ul>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10404">PHPBB3-10404</a>] - Remove create_function from includes/acp/auth.php</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12557">PHPBB3-12557</a>] - Fix doc block errors found by Sami</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12826">PHPBB3-12826</a>] - Investigate &quot;catch (Exception&quot;</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12860">PHPBB3-12860</a>] - Add template events to mcp_ban.html</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12861">PHPBB3-12861</a>] - Add event before assigning the posts to the template</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12917">PHPBB3-12917</a>] - Move commit check and file executable checks to 5.3.3 build on travis</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12920">PHPBB3-12920</a>] - Create composer installable app and core packages with subtree split</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12941">PHPBB3-12941</a>] - Check for Sami documentation errors on Travis CI</li>
+ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12948">PHPBB3-12948</a>] - Remove Travis CI &quot;broken opcache on PHP 5.5.7 and 5.5.8&quot; workaround.</li>
+ </ul>
+
+ <a name="v310RC1"></a><h3>1.ii. Changes since 3.1.0-RC1</h3>
<h4>Bug</h4>
<ul>
@@ -166,7 +291,7 @@
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12829">PHPBB3-12829</a>] - Remove check for pgsql 8.3/8.2</li>
</ul>
- <a name="v310b4"></a><h3>1.ii. Changes since 3.1.0-b4</h3>
+ <a name="v310b4"></a><h3>1.iii. Changes since 3.1.0-b4</h3>
<h4>Bug</h4>
<ul>
@@ -286,7 +411,7 @@
</ul>
- <a name="v310b3"></a><h3>1.iii. Changes since 3.1.0-b3</h3>
+ <a name="v310b3"></a><h3>1.iv. Changes since 3.1.0-b3</h3>
<h4>Bug</h4>
<ul>
@@ -393,7 +518,7 @@
</ul>
- <a name="v310b2"></a><h3>1.iv. Changes since 3.1.0-b2</h3>
+ <a name="v310b2"></a><h3>1.v. Changes since 3.1.0-b2</h3>
<h4>Bug</h4>
<ul>
@@ -558,7 +683,7 @@
</ul>
- <a name="v310b1"></a><h3>1.v. Changes since 3.1.0-b1</h3>
+ <a name="v310b1"></a><h3>1.vi. Changes since 3.1.0-b1</h3>
<h4>Bug</h4>
<ul>
@@ -626,7 +751,7 @@
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12302">PHPBB3-12302</a>] - Upgrade composer.phar to 1.0.0-alpha8</li>
</ul>
- <a name="v310a3"></a><h3>1.vi. Changes since 3.1.0-a3</h3>
+ <a name="v310a3"></a><h3>1.vii. Changes since 3.1.0-a3</h3>
<h4>Bug</h4>
<ul>
@@ -773,7 +898,7 @@
</ul>
- <a name="v310a2"></a><h3>1.vii. Changes since 3.1.0-a2</h3>
+ <a name="v310a2"></a><h3>1.viii. Changes since 3.1.0-a2</h3>
<h4>Bug</h4>
<ul>
@@ -881,7 +1006,7 @@
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12147">PHPBB3-12147</a>] - Remove Travis CI notification configuration</li>
</ul>
- <a name="v310a1"></a><h3>1.viii. Changes since 3.1.0-a1</h3>
+ <a name="v310a1"></a><h3>1.ix. Changes since 3.1.0-a1</h3>
<h4>Bug</h4>
<ul>
@@ -957,7 +1082,7 @@
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11998">PHPBB3-11998</a>] - Add console / command line client environment </li>
</ul>
- <a name="v30x"></a><h3>1.ix. Changes since 3.0.x</h3>
+ <a name="v30x"></a><h3>1.x. Changes since 3.0.x</h3>
<h4>Bug</h4>
<ul>
@@ -1638,7 +1763,7 @@
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11913">PHPBB3-11913</a>] - Apply reorganisation of download.phpbb.com to build_announcement.php</li>
</ul>
- <a name="v3011"></a><h3>1.x. Changes since 3.0.11</h3>
+ <a name="v3011"></a><h3>1.xi. Changes since 3.0.11</h3>
<h4>Bug</h4>
<ul>
@@ -1793,7 +1918,7 @@
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11753">PHPBB3-11753</a>] - Upgrade mysql_upgrader.php schema data.</li>
</ul>
- <a name="v3010"></a><h3>1.xi. Changes since 3.0.10</h3>
+ <a name="v3010"></a><h3>1.xii. Changes since 3.0.10</h3>
<h4>Bug</h4>
<ul>
@@ -1918,7 +2043,7 @@
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10909">PHPBB3-10909</a>] - Update Travis Test Configuration: Travis no longer supports PHP 5.3.2</li>
</ul>
- <a name="v309"></a><h3>1.xii. Changes since 3.0.9</h3>
+ <a name="v309"></a><h3>1.xiii. Changes since 3.0.9</h3>
<h4>Bug</h4>
<ul>
@@ -2054,7 +2179,7 @@
<li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10480">PHPBB3-10480</a>] - Automate changelog building</li>
</ul>
- <a name="v308"></a><h3>1.xiii. Changes since 3.0.8</h3>
+ <a name="v308"></a><h3>1.xiv. Changes since 3.0.8</h3>
<h4> Bug
</h4>
@@ -2422,7 +2547,7 @@
</ul>
- <a name="v307-PL1"></a><h3>1.xiv. Changes since 3.0.7-PL1</h3>
+ <a name="v307-PL1"></a><h3>1.xv. Changes since 3.0.7-PL1</h3>
<h4> Security
</h4>
<ul>
@@ -2880,13 +3005,13 @@
</ul>
- <a name="v307"></a><h3>1.xv. Changes since 3.0.7</h3>
+ <a name="v307"></a><h3>1.xvi. Changes since 3.0.7</h3>
<ul>
<li>[Sec] Do not expose forum content of forums with ACL entries but no actual permission in ATOM Feeds. (Bug #58595)</li>
</ul>
- <a name="v306"></a><h3>1.xvi. Changes since 3.0.6</h3>
+ <a name="v306"></a><h3>1.xvii. Changes since 3.0.6</h3>
<ul>
<li>[Fix] Allow ban reason and length to be selected and copied in ACP and subsilver2 MCP. (Bug #51095)</li>
@@ -2990,7 +3115,7 @@
</ul>
- <a name="v305"></a><h3>1.xvii. Changes since 3.0.5</h3>
+ <a name="v305"></a><h3>1.xviii. Changes since 3.0.5</h3>
<ul>
<li>[Fix] Allow whitespaces in avatar gallery names. (Bug #44955)</li>
@@ -3212,7 +3337,7 @@
<li>[Feature] Send anonymous statistical information to phpBB on installation and update (optional).</li>
</ul>
- <a name="v304"></a><h3>1.xviii. Changes since 3.0.4</h3>
+ <a name="v304"></a><h3>1.xix. Changes since 3.0.4</h3>
<ul>
<li>[Fix] Delete user entry from ban list table upon user deletion (Bug #40015 - Patch by TerraFrost)</li>
@@ -3301,7 +3426,7 @@
<li>[Sec] Only use forum id supplied for posting if global announcement detected. (Reported by nickvergessen)</li>
</ul>
- <a name="v303"></a><h3>1.xix. Changes since 3.0.3</h3>
+ <a name="v303"></a><h3>1.xx. Changes since 3.0.3</h3>
<ul>
<li>[Fix] Allow mixed-case template directories to be inherited (Bug #36725)</li>
@@ -3333,7 +3458,7 @@
<li>[Sec] Ask for forum password if post within passworded forum quoted in private message. (Reported by nickvergessen)</li>
</ul>
- <a name="v302"></a><h3>1.xx. Changes since 3.0.2</h3>
+ <a name="v302"></a><h3>1.xxi. Changes since 3.0.2</h3>
<ul>
<li>[Fix] Correctly set topic starter if first post in topic removed (Bug #30575 - Patch by blueray2048)</li>
@@ -3432,7 +3557,7 @@
<li>[Sec Precaution] Stricter validation of the HTTP_HOST header (Thanks to Techie-Micheal et al for pointing out possible issues in derived code)</li>
</ul>
- <a name="v301"></a><h3>1.xxi. Changes since 3.0.1</h3>
+ <a name="v301"></a><h3>1.xxii. Changes since 3.0.1</h3>
<ul>
<li>[Fix] Ability to set permissions on non-mysql dbms (Bug #24955)</li>
@@ -3480,7 +3605,7 @@
<li>[Sec] Only allow urls gone through redirect() being used within login_box(). (thanks nookieman)</li>
</ul>
- <a name="v300"></a><h3>1.xxii. Changes since 3.0.0</h3>
+ <a name="v300"></a><h3>1.xxiii. Changes since 3.0.0</h3>
<ul>
<li>[Change] Validate birthdays (Bug #15004)</li>
@@ -3551,7 +3676,7 @@
<li>[Fix] Find and display colliding usernames correctly when converting from one database to another (Bug #23925)</li>
</ul>
- <a name="v30rc8"></a><h3>1.xxiii. Changes since 3.0.RC8</h3>
+ <a name="v30rc8"></a><h3>1.xxiv. Changes since 3.0.RC8</h3>
<ul>
<li>[Fix] Cleaned usernames contain only single spaces, so &quot;a_name&quot; and &quot;a__name&quot; are treated as the same name (Bug #15634)</li>
@@ -3560,7 +3685,7 @@
<li>[Fix] Call garbage_collection() within database updater to correctly close connections (affects Oracle for example)</li>
</ul>
- <a name="v30rc7"></a><h3>1.xxiv. Changes since 3.0.RC7</h3>
+ <a name="v30rc7"></a><h3>1.xxv. Changes since 3.0.RC7</h3>
<ul>
<li>[Fix] Fixed MSSQL related bug in the update system</li>
@@ -3595,7 +3720,7 @@
<li>[Fix] No duplication of active topics (Bug #15474)</li>
</ul>
- <a name="v30rc6"></a><h3>1.xxv. Changes since 3.0.RC6</h3>
+ <a name="v30rc6"></a><h3>1.xxvi. Changes since 3.0.RC6</h3>
<ul>
<li>[Fix] Submitting language changes using acp_language (Bug #14736)</li>
@@ -3605,7 +3730,7 @@
<li>[Fix] Able to request new password (Bug #14743)</li>
</ul>
- <a name="v30rc5"></a><h3>1.xxvi. Changes since 3.0.RC5</h3>
+ <a name="v30rc5"></a><h3>1.xxvii. Changes since 3.0.RC5</h3>
<ul>
<li>[Feature] Removing constant PHPBB_EMBEDDED in favor of using an exit_handler(); the constant was meant to achive this more or less.</li>
@@ -3668,7 +3793,7 @@
<li>[Sec] New password hashing mechanism for storing passwords (#i42)</li>
</ul>
- <a name="v30rc4"></a><h3>1.xxvii. Changes since 3.0.RC4</h3>
+ <a name="v30rc4"></a><h3>1.xxviii. Changes since 3.0.RC4</h3>
<ul>
<li>[Fix] MySQL, PostgreSQL and SQLite related database fixes (Bug #13862)</li>
@@ -3719,7 +3844,7 @@
<li>[Fix] odbc_autocommit causing existing result sets to be dropped (Bug #14182)</li>
</ul>
- <a name="v30rc3"></a><h3>1.xxviii. Changes since 3.0.RC3</h3>
+ <a name="v30rc3"></a><h3>1.xxix. Changes since 3.0.RC3</h3>
<ul>
<li>[Fix] Fixing some subsilver2 and prosilver style issues</li>
@@ -3828,7 +3953,7 @@
</ul>
- <a name="v30rc2"></a><h3>1.xxix. Changes since 3.0.RC2</h3>
+ <a name="v30rc2"></a><h3>1.xxx. Changes since 3.0.RC2</h3>
<ul>
<li>[Fix] Re-allow searching within the memberlist</li>
@@ -3874,7 +3999,7 @@
</ul>
- <a name="v30rc1"></a><h3>1.xxx. Changes since 3.0.RC1</h3>
+ <a name="v30rc1"></a><h3>1.xxxi. Changes since 3.0.RC1</h3>
<ul>
<li>[Fix] (X)HTML issues within the templates (Bug #11255, #11255)</li>
diff --git a/phpBB/docs/INSTALL.html b/phpBB/docs/INSTALL.html
index a46cea47b1..e3e12a3176 100644
--- a/phpBB/docs/INSTALL.html
+++ b/phpBB/docs/INSTALL.html
@@ -61,6 +61,7 @@
<li><a href="#update_all">All package types</a></li>
</ol>
</li>
+ <li><a href="#update30">Updating from phpBB 3.0.x to phpBB 3.1.x</a></li>
<li><a href="#convert">Conversion from phpBB 2.0.x to phpBB 3.1.x</a>
<ol style="list-style-type: lower-roman;">
<li><a href="#prereq">Requirements before converting</a></li>
@@ -324,7 +325,41 @@
<hr />
- <a name="convert"></a><h2>5. Conversion from phpBB 2.0.x to phpBB 3.1.x</h2>
+ <a name="update30"></a><h2>5. Updating from phpBB 3.0.x to phpBB 3.1.x</h2>
+
+ <div class="paragraph">
+ <div class="inner"><span class="corners-top"><span></span></span>
+
+ <div class="content">
+
+ <p>Updating from phpBB 3.0.x to 3.1.x is just the same as <a href="#update">updating from stable releases of phpBB 3.1.x</a></p>
+
+ <p>However you can also start with a new set of phpBB 3.1.x files.</p>
+
+ <ol>
+ <li>Delete all files <strong>EXCEPT</strong> for the following:
+
+ <ul>
+ <li>The <code>config.php</code> file</li>
+ <li>The <code>images/</code> directory</li>
+ <li>The <code>files/</code> directory</li>
+ <li>The <code>store/</code> directory</li>
+ </ul></li>
+
+ <li>Upload the contents of the 3.1.x Full Package into your forum's directory.</li>
+ <li>Browse to install/database_update.php</li>
+ <li>Delete the <code>install/</code> directory</li>
+ </ol>
+ </div>
+
+ <div class="back2top"><a href="#wrap" class="top">Back to Top</a></div>
+
+ <span class="corners-bottom"><span></span></span></div>
+ </div>
+
+ <hr />
+
+ <a name="convert"></a><h2>6. Conversion from phpBB 2.0.x to phpBB 3.1.x</h2>
<div class="paragraph">
<div class="inner"><span class="corners-top"><span></span></span>
@@ -387,7 +422,7 @@
<hr />
- <a name="postinstall"></a><h2>6. Important (security related) post-Install tasks for all installation methods</h2>
+ <a name="postinstall"></a><h2>7. Important (security related) post-Install tasks for all installation methods</h2>
<div class="paragraph">
<div class="inner"><span class="corners-top"><span></span></span>
@@ -425,7 +460,7 @@
<hr />
-<a name="anti_spam"></a><h2>7. Anti-Spam Measures</h2>
+<a name="anti_spam"></a><h2>8. Anti-Spam Measures</h2>
<div class="paragraph">
<div class="inner"><span class="corners-top"><span></span></span>
@@ -441,7 +476,7 @@
<hr />
-<a name="disclaimer"></a><h2>8. Copyright and disclaimer</h2>
+<a name="disclaimer"></a><h2>9. Copyright and disclaimer</h2>
<div class="paragraph">
<div class="inner"><span class="corners-top"><span></span></span>
diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md
index b80e5fd4cb..4f39e71c3c 100644
--- a/phpBB/docs/events.md
+++ b/phpBB/docs/events.md
@@ -64,6 +64,13 @@ acp_overall_header_head_append
* Since: 3.1.0-a1
* Purpose: Add assets within the `<head>` tags in the ACP
+acp_overall_header_stylesheets_after
+===
+* Location: adm/style/overall_header.html
+* Since: 3.1.0-RC3
+* Purpose: Add assets after stylesheets within the `<head>` tags in the ACP.
+Note that INCLUDECSS will not work with this event.
+
acp_posting_buttons_after
===
* Locations:
@@ -78,6 +85,50 @@ acp_posting_buttons_before
* Since: 3.1.0-b4
* Purpose: Add content before BBCode posting buttons in the ACP
+acp_ranks_edit_after
+===
+* Locations:
+ + adm/style/acp_ranks.html
+* Since: 3.1.0-RC3
+* Purpose: Add content after the rank details when editing a rank in the ACP
+
+acp_ranks_edit_before
+===
+* Locations:
+ + adm/style/acp_ranks.html
+* Since: 3.1.0-RC3
+* Purpose: Add content before the rank details when editing a rank in the ACP
+
+acp_ranks_list_column_after
+===
+* Locations:
+ + adm/style/acp_ranks.html
+* Since: 3.1.0-RC3
+* Purpose: Add content before the first column in the ranks list in the ACP
+
+acp_ranks_list_column_before
+===
+* Locations:
+ + adm/style/acp_ranks.html
+* Since: 3.1.0-RC3
+* Purpose: Add content after the last column (but before the action column)
+in the ranks list in the ACP
+
+acp_ranks_list_header_after
+===
+* Locations:
+ + adm/style/acp_ranks.html
+* Since: 3.1.0-RC3
+* Purpose: Add content before the first header-column in the ranks list in the ACP
+
+acp_ranks_list_header_before
+===
+* Locations:
+ + adm/style/acp_ranks.html
+* Since: 3.1.0-RC3
+* Purpose: Add content after the last header-column (but before the action column)
+in the ranks list in the ACP
+
acp_simple_footer_after
===
* Location: adm/style/simple_footer.html
@@ -96,6 +147,13 @@ acp_simple_header_head_append
* Since: 3.1.0-a1
* Purpose: Add assets within the `<head>` tags in the simple header of the ACP
+acp_simple_header_stylesheets_after
+===
+* Location: adm/style/simple_header.html
+* Since: 3.1.0-RC3
+* Purpose: Add assets after stylesheets within the `<head>` tags in the simple header
+of the ACP. Note that INCLUDECSS will not work with this event.
+
acp_users_overview_options_append
===
* Location: adm/style/acp_users_overview.html
@@ -609,6 +667,15 @@ overall_header_page_body_before
* Since: 3.1.0-b3
* Purpose: Add content after the page-header, but before the page-body
+overall_header_stylesheets_after
+===
+* Locations:
+ + styles/prosilver/template/overall_header.html
+ + styles/subsilver2/template/overall_header.html
+* Since: 3.1.0-RC3
+* Purpose: Add asset calls after stylesheets within the `</head>` tag.
+Note that INCLUDECSS will not work with this event.
+
posting_editor_buttons_after
===
* Locations:
@@ -767,6 +834,15 @@ simple_header_head_append
* Since: 3.1.0-b4
* Purpose: Add asset calls directly before the `</head>` tag
+simple_header_stylesheets_after
+===
+* Locations:
+ + styles/prosilver/template/simple_header.html
+ + styles/subsilver2/template/simple_header.html
+* Since: 3.1.0-RC3
+* Purpose: Add asset calls after stylesheets within the `</head>` tag.
+Note that INCLUDECSS will not work with this event.
+
topiclist_row_prepend
===
* Locations:
@@ -803,6 +879,20 @@ ucp_agreement_terms_before
* Since: 3.1.0-b3
* Purpose: Add content before the terms of agreement text at user registration
+ucp_pm_viewmessage_avatar_after
+===
+* Locations:
+ + styles/prosilver/template/ucp_pm_viewmessage.html
+* Since: 3.1.0-RC3
+* Purpose: Add content right after the avatar when viewing a private message
+
+ucp_pm_viewmessage_avatar_before
+===
+* Locations:
+ + styles/prosilver/template/ucp_pm_viewmessage.html
+* Since: 3.1.0-RC3
+* Purpose: Add content right before the avatar when viewing a private message
+
ucp_pm_viewmessage_contact_fields_after
===
* Locations:
@@ -1009,6 +1099,22 @@ viewtopic_print_head_append
* Since: 3.1.0-a1
* Purpose: Add asset calls directly before the `</head>` tag of the Print Topic screen
+viewtopic_body_avatar_after
+===
+* Locations:
+ + styles/prosilver/template/viewtopic_body.html
+ + styles/subsilver2/template/viewtopic_body.html
+* Since: 3.1.0-RC3
+* Purpose: Add content right after the avatar when viewing topics
+
+viewtopic_body_avatar_before
+===
+* Locations:
+ + styles/prosilver/template/viewtopic_body.html
+ + styles/subsilver2/template/viewtopic_body.html
+* Since: 3.1.0-RC3
+* Purpose: Add content right before the avatar when viewing topics
+
viewtopic_body_contact_fields_after
===
* Locations:
diff --git a/phpBB/download/file.php b/phpBB/download/file.php
index d4e0f04d2b..fd94e78fee 100644
--- a/phpBB/download/file.php
+++ b/phpBB/download/file.php
@@ -11,10 +11,6 @@
*
*/
-use Symfony\Component\Config\FileLocator;
-use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
-
/**
* @ignore
*/
@@ -143,11 +139,7 @@ if (isset($_GET['avatar']))
include($phpbb_root_path . 'common.' . $phpEx);
require($phpbb_root_path . 'includes/functions_download' . '.' . $phpEx);
-$download_id = request_var('id', 0);
-$topic_id = $request->variable('topic_id', 0);
-$post_id = $request->variable('post_id', 0);
-$msg_id = $request->variable('msg_id', 0);
-$archive = $request->variable('archive', '.tar');
+$attach_id = request_var('id', 0);
$mode = request_var('mode', '');
$thumbnail = request_var('t', false);
@@ -162,27 +154,7 @@ if (!$config['allow_attachments'] && !$config['allow_pm_attach'])
trigger_error('ATTACHMENT_FUNCTIONALITY_DISABLED');
}
-if ($download_id)
-{
- // Attachment id (only 1 attachment)
- $sql_where = 'attach_id = ' . $download_id;
-}
-else if ($msg_id)
-{
- // Private message id (multiple attachments)
- $sql_where = 'is_orphan = 0 AND in_message = 1 AND post_msg_id = ' . $msg_id;
-}
-else if ($post_id)
-{
- // Post id (multiple attachments)
- $sql_where = 'is_orphan = 0 AND in_message = 0 AND post_msg_id = ' . $post_id;
-}
-else if ($topic_id)
-{
- // Topic id (multiple attachments)
- $sql_where = 'is_orphan = 0 AND topic_id = ' . $topic_id;
-}
-else
+if (!$attach_id)
{
send_status_line(404, 'Not Found');
trigger_error('NO_ATTACHMENT_SELECTED');
@@ -190,25 +162,12 @@ else
$sql = 'SELECT attach_id, post_msg_id, topic_id, in_message, poster_id, is_orphan, physical_filename, real_filename, extension, mimetype, filesize, filetime
FROM ' . ATTACHMENTS_TABLE . "
- WHERE $sql_where";
+ WHERE attach_id = $attach_id";
$result = $db->sql_query($sql);
-
-$attachments = $attachment_ids = array();
-while ($row = $db->sql_fetchrow($result))
-{
- $attachment_id = (int) $row['attach_id'];
-
- $row['physical_filename'] = utf8_basename($row['physical_filename']);
-
- $attachment_ids[$attachment_id] = $attachment_id;
- $attachments[$attachment_id] = $row;
-}
+$attachment = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
-// Make $attachment the first of the attachments we fetched.
-$attachment = current($attachments);
-
-if (empty($attachments))
+if (!$attachment)
{
send_status_line(404, 'Not Found');
trigger_error('ERROR_NO_ATTACHMENT');
@@ -218,9 +177,9 @@ else if (!download_allowed())
send_status_line(403, 'Forbidden');
trigger_error($user->lang['LINKAGE_FORBIDDEN']);
}
-else if ($download_id)
+else
{
- // sizeof($attachments) == 1
+ $attachment['physical_filename'] = utf8_basename($attachment['physical_filename']);
if (!$attachment['in_message'] && !$config['allow_attachments'] || $attachment['in_message'] && !$config['allow_pm_attach'])
{
@@ -265,12 +224,12 @@ else if ($download_id)
else
{
// Attachment is in a private message.
- $row['forum_id'] = false;
+ $post_row = array('forum_id' => false);
phpbb_download_handle_pm_auth($db, $auth, $user->data['user_id'], $attachment['post_msg_id']);
}
$extensions = array();
- if (!extension_allowed($row['forum_id'], $attachment['extension'], $extensions))
+ if (!extension_allowed($post_row['forum_id'], $attachment['extension'], $extensions))
{
send_status_line(403, 'Forbidden');
trigger_error(sprintf($user->lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension']));
@@ -327,142 +286,3 @@ else if ($download_id)
}
}
}
-else
-{
- // sizeof($attachments) >= 1
- if ($attachment['in_message'])
- {
- phpbb_download_handle_pm_auth($db, $auth, $user->data['user_id'], $attachment['post_msg_id']);
- }
- else
- {
- phpbb_download_handle_forum_auth($db, $auth, $attachment['topic_id']);
- }
-
- if (!class_exists('compress'))
- {
- require $phpbb_root_path . 'includes/functions_compress.' . $phpEx;
- }
-
- if (!in_array($archive, compress::methods()))
- {
- $archive = '.tar';
- }
-
- $post_visibility = array();
- if ($msg_id)
- {
- $sql = 'SELECT message_subject AS attach_subject
- FROM ' . PRIVMSGS_TABLE . "
- WHERE msg_id = $msg_id";
- }
- else if ($post_id)
- {
- $sql = 'SELECT post_subject AS attach_subject, forum_id, post_visibility
- FROM ' . POSTS_TABLE . "
- WHERE post_id = $post_id";
- }
- else
- {
- $sql = 'SELECT post_id, post_visibility
- FROM ' . POSTS_TABLE . "
- WHERE topic_id = $topic_id
- AND post_attachment = 1";
- $result = $db->sql_query($sql);
- while ($row = $db->sql_fetchrow($result))
- {
- $post_visibility[(int) $row['post_id']] = (int) $row['post_visibility'];
- }
- $db->sql_freeresult($result);
-
- $sql = 'SELECT topic_title AS attach_subject, forum_id
- FROM ' . TOPICS_TABLE . "
- WHERE topic_id = $topic_id";
- }
-
- $result = $db->sql_query($sql);
- $row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
-
- if (empty($row))
- {
- send_status_line(404, 'Not Found');
- trigger_error('ERROR_NO_ATTACHMENT');
- }
-
- $clean_name = phpbb_download_clean_filename($row['attach_subject']);
- $suffix = '_' . (($msg_id) ? 'm' . $msg_id : (($post_id) ? 'p' . $post_id : 't' . $topic_id)) . '_' . $clean_name;
- $archive_name = 'attachments' . $suffix;
-
- $store_name = 'att_' . time() . '_' . unique_id();
- $archive_path = "{$phpbb_root_path}store/{$store_name}{$archive}";
-
- if ($archive === '.zip')
- {
- $compress = new compress_zip('w', $archive_path);
- }
- else
- {
- $compress = new compress_tar('w', $archive_path, $archive);
- }
-
- $extensions = array();
- $files_added = 0;
- $forum_id = ($attachment['in_message']) ? false : (int) $row['forum_id'];
- $disallowed_extension = array();
-
- foreach ($attachments as $attach)
- {
- if (!extension_allowed($forum_id, $attach['extension'], $extensions))
- {
- $disallowed_extension[$attach['extension']] = $attach['extension'];
- continue;
- }
-
- if ($post_id && $row['post_visibility'] != ITEM_APPROVED && !$auth->acl_get('m_approve', $forum_id))
- {
- // Attachment of a soft deleted post and the user is not allowed to see the post
- continue;
- }
-
- if ($topic_id && (!isset($post_visibility[$attach['post_msg_id']]) || $post_visibility[$attach['post_msg_id']] != ITEM_APPROVED) && !$auth->acl_get('m_approve', $forum_id))
- {
- // Attachment of a soft deleted post and the user is not allowed to see the post
- continue;
- }
-
- $prefix = '';
- if ($topic_id)
- {
- $prefix = $attach['post_msg_id'] . '_';
- }
-
- $compress->add_custom_file("{$phpbb_root_path}files/{$attach['physical_filename']}", "{$prefix}{$attach['real_filename']}");
- $files_added++;
- }
-
- $compress->close();
-
- if ($files_added)
- {
- phpbb_increment_downloads($db, $attachment_ids);
- $compress->download($store_name, $archive_name);
- }
-
- unlink($archive_path);
-
- if (!$files_added && !empty($disallowed_extension))
- {
- // None of the attachments had a valid extension
- $disallowed_extension = implode($user->lang['COMMA_SEPARATOR'], $disallowed_extension);
- send_status_line(403, 'Forbidden');
- trigger_error($user->lang('EXTENSION_DISABLED_AFTER_POSTING', $disallowed_extension));
- }
- else if (!$files_added)
- {
- send_status_line(404, 'Not Found');
- trigger_error('ERROR_NO_ATTACHMENT');
- }
-
- file_gc();
-}
diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php
index 59057a0447..2372c1f73c 100644
--- a/phpBB/includes/acp/acp_attachments.php
+++ b/phpBB/includes/acp/acp_attachments.php
@@ -1301,7 +1301,6 @@ class acp_attachments
/**
* Check accuracy of attachment statistics.
*
- * @param $resync bool Resync stats if they're incorrect.
* @return bool|string Returns false if stats are correct or error message
* otherwise.
*/
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index 1811748c2f..f2707f15ca 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -925,7 +925,7 @@ class acp_board
{
$user->timezone = new DateTimeZone($config['board_timezone']);
}
- catch (Exception $e)
+ catch (\Exception $e)
{
// If the board timezone is invalid, we just use the users timezone.
}
diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php
index a625005bf8..fa8d8fb6a9 100644
--- a/phpBB/includes/acp/acp_captcha.php
+++ b/phpBB/includes/acp/acp_captcha.php
@@ -26,12 +26,11 @@ class acp_captcha
function main($id, $mode)
{
global $db, $user, $auth, $template;
- global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
+ global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_container;
$user->add_lang('acp/board');
- include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
- $factory = new phpbb_captcha_factory();
+ $factory = $phpbb_container->get('captcha.factory');
$captchas = $factory->get_captcha_types();
$selected = request_var('select_captcha', $config['captcha_plugin']);
@@ -47,7 +46,7 @@ class acp_captcha
// Delegate
if ($configure)
{
- $config_captcha = phpbb_captcha_factory::get_instance($selected);
+ $config_captcha = $factory->get_instance($selected);
$config_captcha->acp_page($id, $this);
}
else
@@ -79,11 +78,11 @@ class acp_captcha
// sanity check
if (isset($captchas['available'][$selected]))
{
- $old_captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']);
+ $old_captcha = $factory->get_instance($config['captcha_plugin']);
$old_captcha->uninstall();
set_config('captcha_plugin', $selected);
- $new_captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']);
+ $new_captcha = $factory->get_instance($config['captcha_plugin']);
$new_captcha->install();
add_log('admin', 'LOG_CONFIG_VISUAL');
@@ -114,7 +113,7 @@ class acp_captcha
$captcha_select .= '<option value="' . $value . '"' . $current . ' class="disabled-option">' . $user->lang($title) . '</option>';
}
- $demo_captcha = phpbb_captcha_factory::get_instance($selected);
+ $demo_captcha = $factory->get_instance($selected);
foreach ($config_vars as $config_var => $options)
{
@@ -137,9 +136,9 @@ class acp_captcha
*/
function deliver_demo($selected)
{
- global $db, $user, $config;
+ global $db, $user, $config, $phpbb_container;
- $captcha = phpbb_captcha_factory::get_instance($selected);
+ $captcha = $phpbb_container->get('captcha.factory')->get_instance($selected);
$captcha->init(CONFIRM_REG);
$captcha->execute_demo();
diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php
index aba9caaece..9bdd8eb458 100644
--- a/phpBB/includes/acp/acp_extensions.php
+++ b/phpBB/includes/acp/acp_extensions.php
@@ -137,6 +137,12 @@ class acp_extensions
trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
}
+ $extension = $phpbb_extension_manager->get_extension($ext_name);
+ if (!$extension->is_enableable())
+ {
+ trigger_error($user->lang['EXTENSION_NOT_ENABLEABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+
if ($phpbb_extension_manager->is_enabled($ext_name))
{
redirect($this->u_action);
@@ -162,6 +168,12 @@ class acp_extensions
trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
}
+ $extension = $phpbb_extension_manager->get_extension($ext_name);
+ if (!$extension->is_enableable())
+ {
+ trigger_error($user->lang['EXTENSION_NOT_ENABLEABLE'] . adm_back_link($this->u_action), E_USER_WARNING);
+ }
+
if ($phpbb_extension_manager->is_enabled($ext_name))
{
redirect($this->u_action);
diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php
index f10f0b1015..edfada1bf1 100644
--- a/phpBB/includes/acp/acp_groups.php
+++ b/phpBB/includes/acp/acp_groups.php
@@ -331,6 +331,28 @@ class acp_groups
}
}
+ if ($request->is_set_post('avatar_delete'))
+ {
+ if (confirm_box(true))
+ {
+ $avatar_data['id'] = substr($avatar_data['id'], 1);
+ $phpbb_avatar_manager->handle_avatar_delete($db, $user, $avatar_data, GROUPS_TABLE, 'group_');
+
+ $message = ($action == 'edit') ? 'GROUP_UPDATED' : 'GROUP_CREATED';
+ trigger_error($user->lang[$message] . adm_back_link($this->u_action));
+ }
+ else
+ {
+ confirm_box(false, $user->lang('CONFIRM_AVATAR_DELETE'), build_hidden_fields(array(
+ 'avatar_delete' => true,
+ 'i' => $id,
+ 'mode' => $mode,
+ 'g' => $group_id,
+ 'action' => $action))
+ );
+ }
+ }
+
// Did we submit?
if ($update)
{
diff --git a/phpBB/includes/acp/acp_modules.php b/phpBB/includes/acp/acp_modules.php
index 5932f4cddd..ea6b388328 100644
--- a/phpBB/includes/acp/acp_modules.php
+++ b/phpBB/includes/acp/acp_modules.php
@@ -766,7 +766,8 @@ class acp_modules
/**
* Update/Add module
*
- * @param bool $run_inline if set to true errors will be returned and no logs being written
+ * @param array &$module_data The module data
+ * @param bool $run_inline if set to true errors will be returned and no logs being written
*/
function update_module_data(&$module_data, $run_inline = false)
{
diff --git a/phpBB/includes/acp/acp_ranks.php b/phpBB/includes/acp/acp_ranks.php
index fdbd0e0a1d..5885de57ec 100644
--- a/phpBB/includes/acp/acp_ranks.php
+++ b/phpBB/includes/acp/acp_ranks.php
@@ -25,7 +25,7 @@ class acp_ranks
function main($id, $mode)
{
- global $db, $user, $auth, $template, $cache, $request;
+ global $db, $user, $auth, $template, $cache, $request, $phpbb_dispatcher;
global $config, $phpbb_root_path, $phpbb_admin_path, $phpEx;
$user->add_lang('acp/posting');
@@ -73,6 +73,17 @@ class acp_ranks
'rank_image' => htmlspecialchars_decode($rank_image)
);
+ /**
+ * Modify the SQL array when saving a rank
+ *
+ * @event core.acp_ranks_save_modify_sql_ary
+ * @var int rank_id The ID of the rank (if available)
+ * @var array sql_ary Array with the rank's data
+ * @since 3.1.0-RC3
+ */
+ $vars = array('rank_id', 'sql_ary');
+ extract($phpbb_dispatcher->trigger_event('core.acp_ranks_save_modify_sql_ary', compact($vars)));
+
if ($rank_id)
{
$sql = 'UPDATE ' . RANKS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE rank_id = $rank_id";
@@ -202,7 +213,7 @@ class acp_ranks
$filename_list = '<option value=""' . (($edit_img == '') ? ' selected="selected"' : '') . '>----------</option>' . $filename_list;
unset($existing_imgs, $imglist);
- $template->assign_vars(array(
+ $tpl_ary = array(
'S_EDIT' => true,
'U_BACK' => $this->u_action,
'RANKS_PATH' => $phpbb_root_path . $config['ranks_path'],
@@ -212,9 +223,21 @@ class acp_ranks
'S_FILENAME_LIST' => $filename_list,
'RANK_IMAGE' => ($edit_img) ? $phpbb_root_path . $config['ranks_path'] . '/' . $edit_img : htmlspecialchars($phpbb_admin_path) . 'images/spacer.gif',
'S_SPECIAL_RANK' => (isset($ranks['rank_special']) && $ranks['rank_special']) ? true : false,
- 'MIN_POSTS' => (isset($ranks['rank_min']) && !$ranks['rank_special']) ? $ranks['rank_min'] : 0)
+ 'MIN_POSTS' => (isset($ranks['rank_min']) && !$ranks['rank_special']) ? $ranks['rank_min'] : 0,
);
+ /**
+ * Modify the template output array for editing/adding ranks
+ *
+ * @event core.acp_ranks_edit_modify_tpl_ary
+ * @var array ranks Array with the rank's data
+ * @var array tpl_ary Array with the rank's template data
+ * @since 3.1.0-RC3
+ */
+ $vars = array('ranks', 'tpl_ary');
+ extract($phpbb_dispatcher->trigger_event('core.acp_ranks_edit_modify_tpl_ary', compact($vars)));
+
+ $template->assign_vars($tpl_ary);
return;
break;
@@ -231,7 +254,7 @@ class acp_ranks
while ($row = $db->sql_fetchrow($result))
{
- $template->assign_block_vars('ranks', array(
+ $rank_row = array(
'S_RANK_IMAGE' => ($row['rank_image']) ? true : false,
'S_SPECIAL_RANK' => ($row['rank_special']) ? true : false,
@@ -240,8 +263,21 @@ class acp_ranks
'MIN_POSTS' => $row['rank_min'],
'U_EDIT' => $this->u_action . '&amp;action=edit&amp;id=' . $row['rank_id'],
- 'U_DELETE' => $this->u_action . '&amp;action=delete&amp;id=' . $row['rank_id'])
+ 'U_DELETE' => $this->u_action . '&amp;action=delete&amp;id=' . $row['rank_id'],
);
+
+ /**
+ * Modify the template output array for each listed rank
+ *
+ * @event core.acp_ranks_list_modify_rank_row
+ * @var array row Array with the rank's data
+ * @var array rank_row Array with the rank's template data
+ * @since 3.1.0-RC3
+ */
+ $vars = array('row', 'rank_row');
+ extract($phpbb_dispatcher->trigger_event('core.acp_ranks_list_modify_rank_row', compact($vars)));
+
+ $template->assign_block_vars('ranks', $rank_row);
}
$db->sql_freeresult($result);
diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php
index 4cc93e5670..2a02e3e845 100644
--- a/phpBB/includes/acp/acp_styles.php
+++ b/phpBB/includes/acp/acp_styles.php
@@ -804,7 +804,7 @@ class acp_styles
*
* @param array $styles Styles list, passed as reference
* @param string $name Name of parent style
- * @param string $level Styles tree level
+ * @param int $level Styles tree level
*/
protected function show_available_child_styles(&$styles, $name, $level)
{
@@ -888,7 +888,7 @@ class acp_styles
* Show item in styles list
*
* @param array $style style row
- * @param array $level style inheritance level
+ * @param int $level style inheritance level
*/
protected function list_style(&$style, $level)
{
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index 71880c2267..40d8218a07 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -404,7 +404,7 @@ class acp_users
if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
{
$phpbb_notifications = $phpbb_container->get('notification_manager');
- $phpbb_notifications->delete_notifications('admin_activate_user', $user_row['user_id']);
+ $phpbb_notifications->delete_notifications('notification.type.admin_activate_user', $user_row['user_id']);
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
@@ -465,25 +465,9 @@ class acp_users
trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&amp;u=' . $user_id), E_USER_WARNING);
}
- $sql_ary = array(
- 'user_avatar' => '',
- 'user_avatar_type' => '',
- 'user_avatar_width' => 0,
- 'user_avatar_height' => 0,
- );
-
- $sql = 'UPDATE ' . USERS_TABLE . '
- SET ' . $db->sql_build_array('UPDATE', $sql_ary) . "
- WHERE user_id = $user_id";
- $db->sql_query($sql);
-
// Delete old avatar if present
$phpbb_avatar_manager = $phpbb_container->get('avatar.manager');
- $driver = $phpbb_avatar_manager->get_driver($user_row['user_avatar_type']);
- if ($driver)
- {
- $driver->delete($user_row);
- }
+ $phpbb_avatar_manager->handle_avatar_delete($db, $user, $phpbb_avatar_manager->clean_row($user_row, 'user'), USERS_TABLE, 'user_');
add_log('admin', 'LOG_USER_DEL_AVATAR', $user_row['username']);
add_log('user', $user_id, 'LOG_USER_DEL_AVATAR_USER');
@@ -1779,29 +1763,6 @@ class acp_users
trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&amp;u=' . $user_id));
}
}
- else
- {
- $driver = $phpbb_avatar_manager->get_driver($avatar_data['avatar_type']);
- if ($driver)
- {
- $driver->delete($avatar_data);
- }
-
- // Removing the avatar
- $result = array(
- 'user_avatar' => '',
- 'user_avatar_type' => '',
- 'user_avatar_width' => 0,
- 'user_avatar_height' => 0,
- );
-
- $sql = 'UPDATE ' . USERS_TABLE . '
- SET ' . $db->sql_build_array('UPDATE', $result) . '
- WHERE user_id = ' . (int) $user_id;
-
- $db->sql_query($sql);
- trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&amp;u=' . $user_id));
- }
}
else
{
@@ -1809,6 +1770,23 @@ class acp_users
}
}
+ // Handle deletion of avatars
+ if ($request->is_set_post('avatar_delete'))
+ {
+ if (!confirm_box(true))
+ {
+ confirm_box(false, $user->lang('CONFIRM_AVATAR_DELETE'), build_hidden_fields(array(
+ 'avatar_delete' => true))
+ );
+ }
+ else
+ {
+ $phpbb_avatar_manager->handle_avatar_delete($db, $user, $avatar_data, USERS_TABLE, 'user_');
+
+ trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&amp;u=' . $user_id));
+ }
+ }
+
$selected_driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', $user_row['user_avatar_type']));
foreach ($avatar_drivers as $current_driver)
diff --git a/phpBB/includes/acp/auth.php b/phpBB/includes/acp/auth.php
index 7ff3212b72..905e981cdc 100644
--- a/phpBB/includes/acp/auth.php
+++ b/phpBB/includes/acp/auth.php
@@ -183,7 +183,10 @@ class auth_admin extends \phpbb\auth\auth
}
// Defining the user-function here to save some memory
- $return_acl_fill = create_function('$value', 'return ' . $acl_fill . ';');
+ $return_acl_fill = function () use ($acl_fill)
+ {
+ return $acl_fill;
+ };
// Actually fill the gaps
if (sizeof($hold_ary))
diff --git a/phpBB/includes/captcha/captcha_factory.php b/phpBB/includes/captcha/captcha_factory.php
deleted file mode 100644
index ebeb695282..0000000000
--- a/phpBB/includes/captcha/captcha_factory.php
+++ /dev/null
@@ -1,100 +0,0 @@
-<?php
-/**
-*
-* This file is part of the phpBB Forum Software package.
-*
-* @copyright (c) phpBB Limited <https://www.phpbb.com>
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-* For full copyright and license information, please see
-* the docs/CREDITS.txt file.
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* A small class for 3.0.x (no autoloader in 3.0.x)
-*/
-class phpbb_captcha_factory
-{
- /**
- * return an instance of class $name in file $name_plugin.php
- */
- static public function get_instance($name)
- {
- global $phpbb_root_path, $phpEx;
-
- $name = basename($name);
- if (!class_exists($name))
- {
- include($phpbb_root_path . "includes/captcha/plugins/{$name}_plugin." . $phpEx);
- }
- $instance = call_user_func(array($name, 'get_instance'));
- return $instance;
- }
-
- /**
- * Call the garbage collector
- */
- function garbage_collect($name)
- {
- global $phpbb_root_path, $phpEx;
-
- $name = basename($name);
- if (!class_exists($name))
- {
- include($phpbb_root_path . "includes/captcha/plugins/{$name}_plugin." . $phpEx);
- }
- $captcha = self::get_instance($name);
- $captcha->garbage_collect(0);
- }
-
- /**
- * return a list of all discovered CAPTCHA plugins
- */
- function get_captcha_types()
- {
- global $phpbb_root_path, $phpEx, $phpbb_extension_manager;
-
- $captchas = array(
- 'available' => array(),
- 'unavailable' => array(),
- );
-
- $finder = $phpbb_extension_manager->get_finder();
- $captcha_plugin_classes = $finder
- ->extension_directory('/captcha')
- ->suffix('_plugin')
- ->core_path('includes/captcha/plugins/')
- ->get_classes();
-
- foreach ($captcha_plugin_classes as $class)
- {
- // check if this class needs to be loaded in legacy mode
- $old_class = preg_replace('/^phpbb_captcha_plugins_/', '', $class);
- if (file_exists($phpbb_root_path . "includes/captcha/plugins/$old_class.$phpEx") && !class_exists($old_class))
- {
- include($phpbb_root_path . "includes/captcha/plugins/$old_class.$phpEx");
- $class = preg_replace('/_plugin$/', '', $old_class);
- }
-
- if (call_user_func(array($class, 'is_available')))
- {
- $captchas['available'][$class] = call_user_func(array($class, 'get_name'));
- }
- else
- {
- $captchas['unavailable'][$class] = call_user_func(array($class, 'get_name'));
- }
- }
-
- return $captchas;
- }
-}
diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php
deleted file mode 100644
index b6ccabaa2e..0000000000
--- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_wave_plugin.php
+++ /dev/null
@@ -1,69 +0,0 @@
-<?php
-/**
-*
-* This file is part of the phpBB Forum Software package.
-*
-* @copyright (c) phpBB Limited <https://www.phpbb.com>
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-* For full copyright and license information, please see
-* the docs/CREDITS.txt file.
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* Placeholder for autoload
-*/
-if (!class_exists('phpbb_default_captcha', false))
-{
- include($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx);
-}
-
-class phpbb_captcha_gd_wave extends phpbb_default_captcha
-{
-
- function phpbb_captcha_gd_wave()
- {
- global $phpbb_root_path, $phpEx;
-
- if (!class_exists('captcha'))
- {
- include_once($phpbb_root_path . 'includes/captcha/captcha_gd_wave.' . $phpEx);
- }
- }
-
- static public function get_instance()
- {
- return new phpbb_captcha_gd_wave();
- }
-
- static public function is_available()
- {
- return @extension_loaded('gd');
- }
-
- static public function get_name()
- {
- return 'CAPTCHA_GD_3D';
- }
-
- function get_class_name()
- {
- return 'phpbb_captcha_gd_wave';
- }
-
- function acp_page($id, &$module)
- {
- global $config, $db, $template, $user;
-
- trigger_error($user->lang['CAPTCHA_NO_OPTIONS'] . adm_back_link($module->u_action));
- }
-}
diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php
deleted file mode 100644
index 64f788a659..0000000000
--- a/phpBB/includes/captcha/plugins/phpbb_captcha_nogd_plugin.php
+++ /dev/null
@@ -1,70 +0,0 @@
-<?php
-/**
-*
-* This file is part of the phpBB Forum Software package.
-*
-* @copyright (c) phpBB Limited <https://www.phpbb.com>
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-* For full copyright and license information, please see
-* the docs/CREDITS.txt file.
-*
-*/
-
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* Placeholder for autoload
-*/
-if (!class_exists('phpbb_default_captcha', false))
-{
- include($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx);
-}
-
-class phpbb_captcha_nogd extends phpbb_default_captcha
-{
-
- function phpbb_captcha_nogd()
- {
- global $phpbb_root_path, $phpEx;
-
- if (!class_exists('captcha'))
- {
- include_once($phpbb_root_path . 'includes/captcha/captcha_non_gd.' . $phpEx);
- }
- }
-
- static public function get_instance()
- {
- $instance = new phpbb_captcha_nogd();
- return $instance;
- }
-
- static public function is_available()
- {
- return true;
- }
-
- static public function get_name()
- {
- return 'CAPTCHA_NO_GD';
- }
-
- function get_class_name()
- {
- return 'phpbb_captcha_nogd';
- }
-
- function acp_page($id, &$module)
- {
- global $user;
-
- trigger_error($user->lang['CAPTCHA_NO_OPTIONS'] . adm_back_link($module->u_action));
- }
-}
diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php
index cd4e19bf1d..0eac2e9417 100644
--- a/phpBB/includes/constants.php
+++ b/phpBB/includes/constants.php
@@ -28,7 +28,7 @@ if (!defined('IN_PHPBB'))
*/
// phpBB Version
-define('PHPBB_VERSION', '3.1.0-RC3-dev');
+define('PHPBB_VERSION', '3.1.0-RC4-dev');
// QA-related
// define('PHPBB_QA', 1);
diff --git a/phpBB/includes/diff/diff.php b/phpBB/includes/diff/diff.php
index dd0fbcee02..d307880c4b 100644
--- a/phpBB/includes/diff/diff.php
+++ b/phpBB/includes/diff/diff.php
@@ -46,8 +46,9 @@ class diff
/**
* Computes diffs between sequences of strings.
*
- * @param array $from_lines An array of strings. Typically these are lines from a file.
- * @param array $to_lines An array of strings.
+ * @param array &$from_content An array of strings. Typically these are lines from a file.
+ * @param array &$to_content An array of strings.
+ * @param bool $preserve_cr If true, \r is replaced by a new line in the diff output
*/
function diff(&$from_content, &$to_content, $preserve_cr = true)
{
@@ -491,9 +492,11 @@ class diff3 extends diff
/**
* Computes diff between 3 sequences of strings.
*
- * @param array $orig The original lines to use.
- * @param array $final1 The first version to compare to.
- * @param array $final2 The second version to compare to.
+ * @param array &$orig The original lines to use.
+ * @param array &$final1 The first version to compare to.
+ * @param array &$final2 The second version to compare to.
+ * @param bool $preserve_cr If true, \r\n and bare \r are replaced by a new line
+ * in the diff output
*/
function diff3(&$orig, &$final1, &$final2, $preserve_cr = true)
{
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 3402a618b0..21776693b0 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -289,7 +289,6 @@ function phpbb_gmgetdate($time = false)
* @param array $allowed_units only allow these units (data array indexes)
*
* @return mixed data array if $string_only is false
-* @author bantu
*/
function get_formatted_filesize($value, $string_only = true, $allowed_units = false)
{
@@ -463,7 +462,6 @@ function phpbb_version_compare($version1, $version2, $operator = null)
* @param int $perms Permissions to set
*
* @return bool true on success, otherwise false
-* @author faw, phpBB Limited
*/
function phpbb_chmod($filename, $perms = CHMOD_READ)
{
@@ -1031,7 +1029,7 @@ function phpbb_get_timezone_identifiers($selected_timezone)
$validate_timezone = new DateTimeZone($selected_timezone);
$timezones[] = $selected_timezone;
}
- catch (Exception $e)
+ catch (\Exception $e)
{
}
}
@@ -1061,7 +1059,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 = $user->create_datetime('now', $tz);
$offset = $dt->getOffset();
$current_time = $dt->format($user->lang['DATETIME_FORMAT'], true);
$offset_string = phpbb_format_timezone_offset($offset);
@@ -1146,12 +1144,12 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
// Mark all topic notifications read for this user
$phpbb_notifications->mark_notifications_read(array(
- 'topic',
- 'quote',
- 'bookmark',
- 'post',
- 'approve_topic',
- 'approve_post',
+ 'notification.type.topic',
+ 'notification.type.quote',
+ 'notification.type.bookmark',
+ 'notification.type.post',
+ 'notification.type.approve_topic',
+ 'notification.type.approve_post',
), false, $user->data['user_id'], $post_time);
if ($config['load_db_lastread'] && $user->data['is_registered'])
@@ -1211,8 +1209,8 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
$phpbb_notifications = $phpbb_container->get('notification_manager');
$phpbb_notifications->mark_notifications_read_by_parent(array(
- 'topic',
- 'approve_topic',
+ 'notification.type.topic',
+ 'notification.type.approve_topic',
), $forum_id, $user->data['user_id'], $post_time);
// Mark all post/quote notifications read for this user in this forum
@@ -1228,10 +1226,10 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
$db->sql_freeresult($result);
$phpbb_notifications->mark_notifications_read_by_parent(array(
- 'quote',
- 'bookmark',
- 'post',
- 'approve_post',
+ 'notification.type.quote',
+ 'notification.type.bookmark',
+ 'notification.type.post',
+ 'notification.type.approve_post',
), $topic_ids, $user->data['user_id'], $post_time);
// Add 0 to forums array to mark global announcements correctly
@@ -1334,15 +1332,15 @@ function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $
// Mark post notifications read for this user in this topic
$phpbb_notifications->mark_notifications_read(array(
- 'topic',
- 'approve_topic',
+ 'notification.type.topic',
+ 'notification.type.approve_topic',
), $topic_id, $user->data['user_id'], $post_time);
$phpbb_notifications->mark_notifications_read_by_parent(array(
- 'quote',
- 'bookmark',
- 'post',
- 'approve_post',
+ 'notification.type.quote',
+ 'notification.type.bookmark',
+ 'notification.type.post',
+ 'notification.type.approve_post',
), $topic_id, $user->data['user_id'], $post_time);
if ($config['load_db_lastread'] && $user->data['is_registered'])
@@ -2210,7 +2208,7 @@ function generate_board_url($without_script_path = false)
*/
function redirect($url, $return = false, $disable_cd_check = false)
{
- global $db, $cache, $config, $user, $phpbb_root_path, $phpbb_filesystem, $phpbb_path_helper, $phpEx;
+ global $db, $cache, $config, $user, $phpbb_root_path, $phpbb_filesystem, $phpbb_path_helper, $phpEx, $phpbb_dispatcher;
$failover_flag = false;
@@ -2219,11 +2217,6 @@ function redirect($url, $return = false, $disable_cd_check = false)
$user->add_lang('common');
}
- if (!$return)
- {
- garbage_collection();
- }
-
// Make sure no &amp;'s are in, this will break the redirect
$url = str_replace('&amp;', '&', $url);
@@ -2298,10 +2291,26 @@ function redirect($url, $return = false, $disable_cd_check = false)
trigger_error('INSECURE_REDIRECT', E_USER_ERROR);
}
+ /**
+ * Execute code and/or overwrite redirect()
+ *
+ * @event core.functions.redirect
+ * @var string url The url
+ * @var bool return If true, do not redirect but return the sanitized URL.
+ * @var bool disable_cd_check If true, redirect() will redirect to an external domain. If false, the redirect point to the boards url if it does not match the current domain.
+ * @since 3.1.0-RC3
+ */
+ $vars = array('url', 'return', 'disable_cd_check');
+ extract($phpbb_dispatcher->trigger_event('core.functions.redirect', compact($vars)));
+
if ($return)
{
return $url;
}
+ else
+ {
+ garbage_collection();
+ }
// Redirect via an HTML form for PITA webservers
if (@preg_match('#Microsoft|WebSTAR|Xitami#', getenv('SERVER_SOFTWARE')))
@@ -2529,7 +2538,7 @@ function check_link_hash($token, $link_name)
*/
function add_form_key($form_name)
{
- global $config, $template, $user;
+ global $config, $template, $user, $phpbb_dispatcher;
$now = time();
$token_sid = ($user->data['user_id'] == ANONYMOUS && !empty($config['form_token_sid_guests'])) ? $user->session_id : '';
@@ -2540,6 +2549,27 @@ function add_form_key($form_name)
'form_token' => $token,
));
+ /**
+ * Perform additional actions on creation of the form token
+ *
+ * @event core.add_form_key
+ * @var string form_name The form name
+ * @var int now Current time timestamp
+ * @var string s_fields Generated hidden fields
+ * @var string token Form token
+ * @var string token_sid User session ID
+ *
+ * @since 3.1.0-RC3
+ */
+ $vars = array(
+ 'form_name',
+ 'now',
+ 's_fields',
+ 'token',
+ 'token_sid',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.add_form_key', compact($vars)));
+
$template->assign_vars(array(
'S_FORM_TOKEN' => $s_fields,
));
@@ -2719,11 +2749,6 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa
global $db, $user, $template, $auth, $phpEx, $phpbb_root_path, $config;
global $request, $phpbb_container;
- if (!class_exists('phpbb_captcha_factory', false))
- {
- include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
- }
-
$err = '';
// Make sure user->setup() has been called
@@ -2833,7 +2858,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa
{
case LOGIN_ERROR_ATTEMPTS:
- $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']);
+ $captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']);
$captcha->init(CONFIRM_LOGIN);
// $captcha->reset();
@@ -2945,7 +2970,7 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa
*/
function login_forum_box($forum_data)
{
- global $db, $phpbb_container, $request, $template, $user;
+ global $db, $phpbb_container, $request, $template, $user, $phpbb_dispatcher;
$password = $request->variable('password', '', true);
@@ -3006,6 +3031,17 @@ function login_forum_box($forum_data)
$template->assign_var('LOGIN_ERROR', $user->lang['WRONG_PASSWORD']);
}
+ /**
+ * Performing additional actions, load additional data on forum login
+ *
+ * @event core.login_forum_box
+ * @var array forum_data Array with forum data
+ * @var string password Password entered
+ * @since 3.1.0-RC3
+ */
+ $vars = array('forum_data', 'password');
+ extract($phpbb_dispatcher->trigger_event('core.login_forum_box', compact($vars)));
+
page_header($user->lang['LOGIN']);
$template->assign_vars(array(
@@ -3366,8 +3402,6 @@ function short_ipv6($ip, $length)
*
* @return mixed false if specified address is not valid,
* string otherwise
-*
-* @author bantu
*/
function phpbb_ip_normalise($address)
{
@@ -3396,8 +3430,6 @@ function phpbb_ip_normalise($address)
*
* @return mixed false on failure,
* string otherwise
-*
-* @author APTX
*/
function phpbb_inet_ntop($in_addr)
{
@@ -3467,8 +3499,6 @@ function phpbb_inet_ntop($in_addr)
*
* @return mixed false if address is invalid,
* in_addr representation of the given address otherwise (string)
-*
-* @author APTX
*/
function phpbb_inet_pton($address)
{
@@ -3548,8 +3578,6 @@ function phpbb_inet_pton($address)
*
* Since null can also be returned, you probably want to compare the result
* with === true or === false,
-*
-* @author bantu
*/
function phpbb_checkdnsrr($host, $type = 'MX')
{
@@ -4870,7 +4898,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
}
}
- $dt = new \phpbb\datetime($user, 'now', $user->timezone);
+ $dt = $user->create_datetime();
$timezone_offset = 'GMT' . phpbb_format_timezone_offset($dt->getOffset());
$timezone_name = $user->timezone->getName();
if (isset($user->lang['timezones'][$timezone_name]))
@@ -5030,6 +5058,20 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
'SITE_LOGO_IMG' => $user->img('site_logo'),
));
+ // An array of http headers that phpbb will set. The following event may override these.
+ $http_headers = array(
+ // application/xhtml+xml not used because of IE
+ 'Content-type' => 'text/html; charset=UTF-8',
+ 'Cache-Control' => 'private, no-cache="set-cookie"',
+ 'Expires' => '0',
+ 'Pragma' => 'no-cache',
+ );
+ if (!empty($user->data['is_bot']))
+ {
+ // Let reverse proxies know we detected a bot.
+ $http_headers['X-PHPBB-IS-BOT'] = 'yes';
+ }
+
/**
* Execute code and/or overwrite _common_ template variables after they have been assigned.
*
@@ -5040,23 +5082,16 @@ function page_header($page_title = '', $display_online_list = false, $item_id =
* session item, e.g. forum for
* session_forum_id
* @var int item_id Restrict online users to item id
+ * @var array http_headers HTTP headers that should be set by phpbb
*
* @since 3.1.0-b3
*/
- $vars = array('page_title', 'display_online_list', 'item_id', 'item');
+ $vars = array('page_title', 'display_online_list', 'item_id', 'item', 'http_headers');
extract($phpbb_dispatcher->trigger_event('core.page_header_after', compact($vars)));
- // application/xhtml+xml not used because of IE
- header('Content-type: text/html; charset=UTF-8');
-
- header('Cache-Control: private, no-cache="set-cookie"');
- header('Expires: 0');
- header('Pragma: no-cache');
-
- if (!empty($user->data['is_bot']))
+ foreach ($http_headers as $hname => $hval)
{
- // Let reverse proxies know we detected a bot.
- header('X-PHPBB-IS-BOT: yes');
+ header((string) $hname . ': ' . (string) $hval);
}
return;
@@ -5084,9 +5119,10 @@ function phpbb_check_and_display_sql_report(\phpbb\request\request_interface $re
* @param \phpbb\config\config $config Config object
* @param \phpbb\auth\auth $auth Auth object
* @param \phpbb\user $user User object
+* @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher
* @return string
*/
-function phpbb_generate_debug_output(phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\auth\auth $auth, \phpbb\user $user)
+function phpbb_generate_debug_output(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\auth\auth $auth, \phpbb\user $user, \phpbb\event\dispatcher_interface $phpbb_dispatcher)
{
$debug_info = array();
@@ -5125,6 +5161,17 @@ function phpbb_generate_debug_output(phpbb\db\driver\driver_interface $db, \phpb
}
}
+ /**
+ * Modify debug output information
+ *
+ * @event core.phpbb_generate_debug_output
+ * @var array debug_info Array of strings with debug information
+ *
+ * @since 3.1.0-RC3
+ */
+ $vars = array('debug_info');
+ extract($phpbb_dispatcher->trigger_event('core.phpbb_generate_debug_output', compact($vars)));
+
return implode(' | ', $debug_info);
}
@@ -5163,7 +5210,7 @@ function page_footer($run_cron = true, $display_template = true, $exit_handler =
phpbb_check_and_display_sql_report($request, $auth, $db);
$template->assign_vars(array(
- 'DEBUG_OUTPUT' => phpbb_generate_debug_output($db, $config, $auth, $user),
+ 'DEBUG_OUTPUT' => phpbb_generate_debug_output($db, $config, $auth, $user, $phpbb_dispatcher),
'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '',
'CREDIT_LINE' => $user->lang('POWERED_BY', '<a href="https://www.phpbb.com/">phpBB</a>&reg; Forum Software &copy; phpBB Limited'),
diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php
index 8453da6e6e..d9dc11239c 100644
--- a/phpBB/includes/functions_acp.php
+++ b/phpBB/includes/functions_acp.php
@@ -107,12 +107,31 @@ function adm_page_header($page_title)
'S_CONTENT_FLOW_END' => ($user->lang['DIRECTION'] == 'ltr') ? 'right' : 'left',
));
- // application/xhtml+xml not used because of IE
- header('Content-type: text/html; charset=UTF-8');
+ // An array of http headers that phpbb will set. The following event may override these.
+ $http_headers = array(
+ // application/xhtml+xml not used because of IE
+ 'Content-type' => 'text/html; charset=UTF-8',
+ 'Cache-Control' => 'private, no-cache="set-cookie"',
+ 'Expires' => '0',
+ 'Pragma' => 'no-cache',
+ );
+
+ /**
+ * Execute code and/or overwrite _common_ template variables after they have been assigned.
+ *
+ * @event core.adm_page_header_after
+ * @var string page_title Page title
+ * @var array http_headers HTTP headers that should be set by phpbb
+ *
+ * @since 3.1.0-RC3
+ */
+ $vars = array('page_title', 'http_headers');
+ extract($phpbb_dispatcher->trigger_event('core.adm_page_header_after', compact($vars)));
- header('Cache-Control: private, no-cache="set-cookie"');
- header('Expires: 0');
- header('Pragma: no-cache');
+ foreach ($http_headers as $hname => $hval)
+ {
+ header((string) $hname . ': ' . (string) $hval);
+ }
return;
}
@@ -149,7 +168,7 @@ function adm_page_footer($copyright_html = true)
phpbb_check_and_display_sql_report($request, $auth, $db);
$template->assign_vars(array(
- 'DEBUG_OUTPUT' => phpbb_generate_debug_output($db, $config, $auth, $user),
+ 'DEBUG_OUTPUT' => phpbb_generate_debug_output($db, $config, $auth, $user, $phpbb_dispatcher),
'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '',
'S_COPYRIGHT_HTML' => $copyright_html,
'CREDIT_LINE' => $user->lang('POWERED_BY', '<a href="https://www.phpbb.com/">phpBB</a>&reg; Forum Software &copy; phpBB Limited'),
@@ -240,7 +259,6 @@ function build_cfg_template($tpl_type, $key, &$new, $config_key, $vars)
case 'range':
case 'search':
case 'tel':
- case 'url':
case 'week':
$size = (int) $tpl_type[1];
$maxlength = (int) $tpl_type[2];
@@ -656,3 +674,30 @@ function validate_range($value_ary, &$error)
}
}
}
+
+/**
+* Inserts new config display_vars into an exisiting display_vars array
+* at the given position.
+*
+* @param array $display_vars An array of existing config display vars
+* @param array $add_config_vars An array of new config display vars
+* @param array $where Where to place the new config vars,
+* before or after an exisiting config, as an array
+* of the form: array('after' => 'config_name') or
+* array('before' => 'config_name').
+* @return array The array of config display vars
+*/
+function phpbb_insert_config_array($display_vars, $add_config_vars, $where)
+{
+ if (is_array($where) && array_key_exists(current($where), $display_vars))
+ {
+ $position = array_search(current($where), array_keys($display_vars)) + ((key($where) == 'before') ? 0 : 1);
+ $display_vars = array_merge(
+ array_slice($display_vars, 0, $position),
+ $add_config_vars,
+ array_slice($display_vars, $position)
+ );
+ }
+
+ return $display_vars;
+}
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php
index accc8a6a83..e3e8657afb 100644
--- a/phpBB/includes/functions_admin.php
+++ b/phpBB/includes/functions_admin.php
@@ -27,8 +27,6 @@ if (!defined('IN_PHPBB'))
* @param string $table constant or fullname of the table
* @param int $parent_id parent_id of the current set (default = 0)
* @param array $where contains strings to compare closer on the where statement (additional)
-*
-* @author EXreaction
*/
function recalc_nested_sets(&$new_id, $pkey, $table, $parent_id = 0, $where = array())
{
@@ -315,8 +313,6 @@ function get_forum_branch($forum_id, $type = 'all', $order = 'descending', $incl
* @param bool $add_log True if log entry should be added
*
* @return bool False on error
-*
-* @author bantu
*/
function copy_forum_permissions($src_forum_id, $dest_forum_ids, $clear_dest_perms = true, $add_log = true)
{
@@ -722,9 +718,9 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s
$phpbb_notifications = $phpbb_container->get('notification_manager');
$phpbb_notifications->delete_notifications(array(
- 'topic',
- 'approve_topic',
- 'topic_in_queue',
+ 'notification.type.topic',
+ 'notification.type.approve_topic',
+ 'notification.type.topic_in_queue',
), $topic_ids);
return $return;
@@ -739,9 +735,9 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync =
// Notifications types to delete
$delete_notifications_types = array(
- 'quote',
- 'approve_post',
- 'post_in_queue',
+ 'notification.type.quote',
+ 'notification.type.approve_post',
+ 'notification.type.post_in_queue',
);
/**
@@ -1224,8 +1220,6 @@ function delete_attachments($mode, $ids, $resync = true)
* @param bool $auto_sync Will call sync() if this is true
*
* @return array Array with affected forums
-*
-* @author bantu
*/
function delete_topic_shadows($forum_id, $sql_more = '', $auto_sync = true)
{
diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php
index ee78364083..f275ed1dd1 100644
--- a/phpBB/includes/functions_content.php
+++ b/phpBB/includes/functions_content.php
@@ -1323,7 +1323,6 @@ function truncate_string($string, $max_length = 60, $max_store_length = 255, $al
* @param string $custom_profile_url optional parameter to specify a profile url. The user id get appended to this url as &amp;u={user_id}
*
* @return string A string consisting of what is wanted based on $mode.
-* @author BartVB, Acyd Burn
*/
function get_username_string($mode, $user_id, $username, $username_colour = '', $guest_username = false, $custom_profile_url = false)
{
diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php
index 68b1356297..78137d075b 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -1063,7 +1063,8 @@ function display_reasons($reason_id = 0)
function display_user_activity(&$userdata)
{
global $auth, $template, $db, $user;
- global $phpbb_root_path, $phpEx, $phpbb_container;
+ global $phpbb_root_path, $phpEx;
+ global $phpbb_container, $phpbb_dispatcher;
// Do not display user activity for users having more than 5000 posts...
if ($userdata['user_posts'] > 5000)
@@ -1134,6 +1135,18 @@ function display_user_activity(&$userdata)
}
}
+ /**
+ * Alter list of forums and topics to display as active
+ *
+ * @event core.display_user_activity_modify_actives
+ * @var array userdata User's data
+ * @var array active_f_row List of active forums
+ * @var array active_t_row List of active posts
+ * @since 3.1.0-RC3
+ */
+ $vars = array('userdata', 'active_f_row', 'active_t_row');
+ extract($phpbb_dispatcher->trigger_event('core.display_user_activity_modify_actives', compact($vars)));
+
$userdata['active_t_row'] = $active_t_row;
$userdata['active_f_row'] = $active_f_row;
@@ -1408,44 +1421,6 @@ function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank
}
/**
-* Generate a list of archive types available for compressing attachments
-*
-* @param string $param_key Either topic_id or post_id
-* @param string $param_val The value of the topic or post id
-* @param string $phpbb_root_path The root path of the phpBB installation
-* @param string $phpEx The PHP extension
-*
-* @return array Array containing the link and the type of compression
-*/
-function phpbb_gen_download_links($param_key, $param_val, $phpbb_root_path, $phpEx)
-{
- if (!class_exists('compress'))
- {
- require $phpbb_root_path . 'includes/functions_compress.' . $phpEx;
- }
-
- $methods = compress::methods();
- // Sort by preferred type.
- $methods = array_intersect(array('.zip', '.tar.bz2', '.tar.gz', '.tar'), $methods);
- $links = array();
-
- foreach ($methods as $method)
- {
- $exploded = explode('.', $method);
- $type = array_pop($exploded);
- $params = array('archive' => $method);
- $params[$param_key] = $param_val;
-
- $links[] = array(
- 'LINK' => append_sid("{$phpbb_root_path}download/file.$phpEx", $params),
- 'TYPE' => $type,
- );
- }
-
- return $links;
-}
-
-/**
* Prepare profile data
*/
function phpbb_show_profile($data, $user_notes_enabled = false, $warn_user_enabled = false)
diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php
index 7a7efd5b34..4ff3994f4c 100644
--- a/phpBB/includes/functions_download.php
+++ b/phpBB/includes/functions_download.php
@@ -718,27 +718,6 @@ function phpbb_download_check_pm_auth($db, $user_id, $msg_id)
}
/**
-* Cleans a filename of any characters that could potentially cause a problem on
-* a user's filesystem.
-*
-* @param string $filename The filename to clean
-*
-* @return string The cleaned filename
-*/
-function phpbb_download_clean_filename($filename)
-{
- $bad_chars = array("'", "\\", ' ', '/', ':', '*', '?', '"', '<', '>', '|');
-
- // rawurlencode to convert any potentially 'bad' characters that we missed
- $filename = rawurlencode(str_replace($bad_chars, '_', $filename));
-
- // Turn the %xx entities created by rawurlencode to _
- $filename = preg_replace("/%(\w{2})/", '_', $filename);
-
- return $filename;
-}
-
-/**
* Check if the browser is internet explorer version 7+
*
* @param string $user_agent User agent HTTP header
diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php
index ab6ecb5519..28cc603bdb 100644
--- a/phpBB/includes/functions_install.php
+++ b/phpBB/includes/functions_install.php
@@ -266,7 +266,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
if (is_array($db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true)))
{
$db_error = $db->sql_error();
- $error[] = $lang['INST_ERR_DB_CONNECT'] . '<br />' . (($db_error['message']) ? $db_error['message'] : $lang['INST_ERR_DB_NO_ERROR']);
+ $error[] = $lang['INST_ERR_DB_CONNECT'] . '<br />' . (($db_error['message']) ? utf8_convert_message($db_error['message']) : $lang['INST_ERR_DB_NO_ERROR']);
}
else
{
diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php
index 3657a89aa0..045e555d05 100644
--- a/phpBB/includes/functions_messenger.php
+++ b/phpBB/includes/functions_messenger.php
@@ -402,17 +402,9 @@ class messenger
*/
function generate_message_id()
{
- global $config;
+ global $config, $request;
- $domain = 'phpbb.generated';
- if ($config['server_name'])
- {
- $domain = $config['server_name'];
- }
- else if (!empty($_SERVER['SERVER_NAME']))
- {
- $domain = $_SERVER['SERVER_NAME'];
- }
+ $domain = ($config['server_name']) ?: $request->server('SERVER_NAME', 'phpbb.generated');
return md5(unique_id(time())) . '@' . $domain;
}
diff --git a/phpBB/includes/functions_module.php b/phpBB/includes/functions_module.php
index 86439ea03f..fe9bcdb9d1 100644
--- a/phpBB/includes/functions_module.php
+++ b/phpBB/includes/functions_module.php
@@ -489,6 +489,12 @@ class p_master
$id = request_var('icat', '');
}
+ // Restore the backslashes in class names
+ if (strpos($id, '-') !== false)
+ {
+ $id = str_replace('-', '\\', $id);
+ }
+
if ($id && !is_numeric($id) && !$this->is_full_class($id))
{
$id = $this->p_class . '_' . $id;
@@ -541,7 +547,9 @@ class p_master
*
* This method loads a given module, passing it the relevant id and mode.
*
- * @param string $mode mode, as passed through to the module
+ * @param string|false $mode mode, as passed through to the module
+ * @param string|false $module_url If supplied, we use this module url
+ * @param bool $execute_module If true, at the end we execute the main method for the new instance
*/
function load_active($mode = false, $module_url = false, $execute_module = true)
{
@@ -614,7 +622,7 @@ class p_master
}
// Not being able to overwrite ;)
- $this->module->u_action = append_sid("{$phpbb_admin_path}index.$phpEx", 'i=' . $this->get_module_identifier($this->p_name, $this->p_id)) . (($icat) ? '&amp;icat=' . $icat : '') . "&amp;mode={$this->p_mode}";
+ $this->module->u_action = append_sid("{$phpbb_admin_path}index.$phpEx", 'i=' . $this->get_module_identifier($this->p_name)) . (($icat) ? '&amp;icat=' . $icat : '') . "&amp;mode={$this->p_mode}";
}
else
{
@@ -646,7 +654,7 @@ class p_master
$this->module->u_action = $phpbb_root_path . (($user->page['page_dir']) ? $user->page['page_dir'] . '/' : '') . $user->page['page_name'];
}
- $this->module->u_action = append_sid($this->module->u_action, 'i=' . $this->get_module_identifier($this->p_name, $this->p_id)) . (($icat) ? '&amp;icat=' . $icat : '') . "&amp;mode={$this->p_mode}";
+ $this->module->u_action = append_sid($this->module->u_action, 'i=' . $this->get_module_identifier($this->p_name)) . (($icat) ? '&amp;icat=' . $icat : '') . "&amp;mode={$this->p_mode}";
}
// Add url_extra parameter to u_action url
@@ -899,7 +907,7 @@ class p_master
else
{
// if the category has a name, then use it.
- $u_title .= $this->get_module_identifier($item_ary['name'], $item_ary['id']);
+ $u_title .= $this->get_module_identifier($item_ary['name']);
}
// If the item is not a category append the mode
if (!$item_ary['cat'])
@@ -1040,19 +1048,45 @@ class p_master
*/
function add_mod_info($module_class)
{
- global $user, $phpEx;
-
- global $phpbb_extension_manager;
+ global $config, $user, $phpEx, $phpbb_extension_manager;
$finder = $phpbb_extension_manager->get_finder();
- $lang_files = $finder
+ // We grab the language files from the default, English and user's language.
+ // So we can fall back to the other files like we do when using add_lang()
+ $default_lang_files = $english_lang_files = $user_lang_files = array();
+
+ // Search for board default language if it's not the user language
+ if ($config['default_lang'] != $user->lang_name)
+ {
+ $default_lang_files = $finder
+ ->prefix('info_' . strtolower($module_class) . '_')
+ ->suffix(".$phpEx")
+ ->extension_directory('/language/' . basename($config['default_lang']))
+ ->core_path('language/' . basename($config['default_lang']) . '/mods/')
+ ->find();
+ }
+
+ // Search for english, if its not the default or user language
+ if ($config['default_lang'] != 'en' && $user->lang_name != 'en')
+ {
+ $english_lang_files = $finder
+ ->prefix('info_' . strtolower($module_class) . '_')
+ ->suffix(".$phpEx")
+ ->extension_directory('/language/en')
+ ->core_path('language/en/mods/')
+ ->find();
+ }
+
+ // Find files in the user's language
+ $user_lang_files = $finder
->prefix('info_' . strtolower($module_class) . '_')
->suffix(".$phpEx")
->extension_directory('/language/' . $user->lang_name)
->core_path('language/' . $user->lang_name . '/mods/')
->find();
+ $lang_files = array_unique(array_merge($user_lang_files, $english_lang_files, $default_lang_files));
foreach ($lang_files as $lang_file => $ext_name)
{
$user->add_lang_ext($ext_name, $lang_file);
@@ -1078,26 +1112,24 @@ class p_master
}
/**
- * If the basename contains a \ we dont use that for the URL.
+ * If the basename contains a \ we don't use that for the URL.
*
* Firefox is currently unable to correctly copy a urlencoded \
* so users will be unable to post links to modules.
- * However we can still fallback to the id instead of the name,
- * so we do that in this case.
+ * However we can replace them with dashes and re-replace them later
*
* @param string $basename Basename of the module
- * @param int $id Id of the module
- * @return mixed Identifier that should be used for
+ * @return string Identifier that should be used for
* module link creation
*/
- protected function get_module_identifier($basename, $id)
+ protected function get_module_identifier($basename)
{
if (strpos($basename, '\\') === false)
{
return $basename;
}
- return $id;
+ return str_replace('\\', '-', $basename);
}
/**
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 04e28fb865..acfd8d779a 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -398,11 +398,12 @@ function posting_gen_topic_types($forum_id, $cur_topic_type = POST_NORMAL)
* @param string $local_storage The path to the local file
* @param bool $is_message Whether it is a PM or not
* @param \filespec $local_filedata A filespec object created for the local file
+* @param \phpbb\mimetype\guesser $mimetype_guesser The mimetype guesser object if used
* @param \phpbb\plupload\plupload $plupload The plupload object if one is being used
*
* @return object filespec
*/
-function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = false, \phpbb\plupload\plupload $plupload = null)
+function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = false, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null)
{
global $auth, $user, $config, $db, $cache;
global $phpbb_root_path, $phpEx, $phpbb_dispatcher;
@@ -434,7 +435,7 @@ function upload_attachment($form_name, $forum_id, $local = false, $local_storage
$extensions = $cache->obtain_attach_extensions((($is_message) ? false : (int) $forum_id));
$upload->set_allowed_extensions(array_keys($extensions['_allowed_']));
- $file = ($local) ? $upload->local_upload($local_storage, $local_filedata) : $upload->form_upload($form_name, $plupload);
+ $file = ($local) ? $upload->local_upload($local_storage, $local_filedata, $mimetype_guesser) : $upload->form_upload($form_name, $mimetype_guesser, $plupload);
if ($file->init_error)
{
@@ -907,7 +908,7 @@ function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_a
function load_drafts($topic_id = 0, $forum_id = 0, $id = 0, $pm_action = '', $msg_id = 0)
{
global $user, $db, $template, $auth;
- global $phpbb_root_path, $phpEx;
+ global $phpbb_root_path, $phpbb_dispatcher, $phpEx;
$topic_ids = $forum_ids = $draft_rows = array();
@@ -950,7 +951,7 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0, $pm_action = '', $ms
$topic_rows = array();
if (sizeof($topic_ids))
{
- $sql = 'SELECT topic_id, forum_id, topic_title
+ $sql = 'SELECT topic_id, forum_id, topic_title, topic_poster
FROM ' . TOPICS_TABLE . '
WHERE ' . $db->sql_in_set('topic_id', array_unique($topic_ids));
$result = $db->sql_query($sql);
@@ -961,6 +962,20 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0, $pm_action = '', $ms
}
$db->sql_freeresult($result);
}
+
+ /**
+ * Drafts found and their topics
+ * Edit $draft_rows in order to add or remove drafts loaded
+ *
+ * @event core.load_drafts_draft_list_result
+ * @var array draft_rows The drafts query result. Includes its forum id and everything about the draft
+ * @var array topic_ids The list of topics got from the topics table
+ * @var array topic_rows The topics that draft_rows references
+ * @since 3.1.0-RC3
+ */
+ $vars = array('draft_rows', 'topic_ids', 'topic_rows');
+ extract($phpbb_dispatcher->trigger_event('core.load_drafts_draft_list_result', compact($vars)));
+
unset($topic_ids);
$template->assign_var('S_SHOW_DRAFTS', true);
@@ -1309,18 +1324,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $
{
delete_topics('topic_id', array($topic_id), false);
- if ($data['topic_visibility'] == ITEM_APPROVED)
- {
- $sql_data[FORUMS_TABLE] .= 'forum_posts_approved = forum_posts_approved - 1, forum_topics_approved = forum_topics_approved - 1';
- }
- else if ($data['topic_visibility'] == ITEM_UNAPPROVED || $data['post_visibility'] == ITEM_REAPPROVE)
- {
- $sql_data[FORUMS_TABLE] .= 'forum_posts_unapproved = forum_posts_unapproved - 1, forum_topics_unapproved = forum_topics_unapproved - 1';
- }
- else if ($data['topic_visibility'] == ITEM_DELETED)
- {
- $sql_data[FORUMS_TABLE] .= 'forum_posts_softdeleted = forum_posts_softdeleted - 1, forum_topics_softdeleted = forum_topics_softdeleted - 1';
- }
+ $phpbb_content_visibility->remove_topic_from_statistic($data, $sql_data);
$update_sql = update_post_information('forum', $forum_id, true);
if (sizeof($update_sql))
@@ -1416,20 +1420,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $
{
if (!$is_soft)
{
- if ($data['post_visibility'] == ITEM_APPROVED)
- {
- $phpbb_content_visibility->remove_post_from_statistic($data, $sql_data);
- }
- else if ($data['post_visibility'] == ITEM_UNAPPROVED || $data['post_visibility'] == ITEM_REAPPROVE)
- {
- $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . 'forum_posts_unapproved = forum_posts_unapproved - 1';
- $sql_data[TOPICS_TABLE] = (($sql_data[TOPICS_TABLE]) ? $sql_data[TOPICS_TABLE] . ', ' : '') . 'topic_posts_unapproved = topic_posts_unapproved - 1';
- }
- else if ($data['post_visibility'] == ITEM_DELETED)
- {
- $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . 'forum_posts_softdeleted = forum_posts_softdeleted - 1';
- $sql_data[TOPICS_TABLE] = (($sql_data[TOPICS_TABLE]) ? $sql_data[TOPICS_TABLE] . ', ' : '') . 'topic_posts_softdeleted = topic_posts_softdeleted - 1';
- }
+ $phpbb_content_visibility->remove_post_from_statistic($data, $sql_data);
}
$sql = 'SELECT 1 AS has_attachments
@@ -2265,17 +2256,17 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
{
case 'post':
$phpbb_notifications->add_notifications(array(
- 'quote',
- 'topic',
+ 'notification.type.quote',
+ 'notification.type.topic',
), $notification_data);
break;
case 'reply':
case 'quote':
$phpbb_notifications->add_notifications(array(
- 'quote',
- 'bookmark',
- 'post',
+ 'notification.type.quote',
+ 'notification.type.bookmark',
+ 'notification.type.post',
), $notification_data);
break;
@@ -2284,10 +2275,10 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
case 'edit':
case 'edit_last_post':
$phpbb_notifications->update_notifications(array(
- 'quote',
- 'bookmark',
- 'topic',
- 'post',
+ 'notification.type.quote',
+ 'notification.type.bookmark',
+ 'notification.type.topic',
+ 'notification.type.post',
), $notification_data);
break;
}
@@ -2297,12 +2288,12 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
switch ($mode)
{
case 'post':
- $phpbb_notifications->add_notifications('topic_in_queue', $notification_data);
+ $phpbb_notifications->add_notifications('notification.type.topic_in_queue', $notification_data);
break;
case 'reply':
case 'quote':
- $phpbb_notifications->add_notifications('post_in_queue', $notification_data);
+ $phpbb_notifications->add_notifications('notification.type.post_in_queue', $notification_data);
break;
case 'edit_topic':
@@ -2319,20 +2310,20 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
{
case 'edit_topic':
case 'edit_first_post':
- $phpbb_notifications->add_notifications('topic_in_queue', $notification_data);
+ $phpbb_notifications->add_notifications('notification.type.topic_in_queue', $notification_data);
// Delete the approve_post notification so we can notify the user again,
// when his post got reapproved
- $phpbb_notifications->delete_notifications('approve_post', $notification_data['post_id']);
+ $phpbb_notifications->delete_notifications('notification.type.approve_post', $notification_data['post_id']);
break;
case 'edit':
case 'edit_last_post':
- $phpbb_notifications->add_notifications('post_in_queue', $notification_data);
+ $phpbb_notifications->add_notifications('notification.type.post_in_queue', $notification_data);
// Delete the approve_post notification so we can notify the user again,
// when his post got reapproved
- $phpbb_notifications->delete_notifications('approve_post', $notification_data['post_id']);
+ $phpbb_notifications->delete_notifications('notification.type.approve_post', $notification_data['post_id']);
break;
case 'post':
@@ -2387,12 +2378,31 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
* event is to modify the return URL ($url).
*
* @event core.submit_post_end
- * @var string url The "Return to topic" URL
- * @var array data Array of post data about the
- * submitted post
+ * @var string mode Variable containing posting mode value
+ * @var string subject Variable containing post subject value
+ * @var string username Variable containing post author name
+ * @var int topic_type Variable containing topic type value
+ * @var array poll Array with the poll data for the post
+ * @var array data Array with the data for the post
+ * @var bool update_message Flag indicating if the post will be updated
+ * @var bool update_search_index Flag indicating if the search index will be updated
+ * @var string url The "Return to topic" URL
+ *
* @since 3.1.0-a3
+ * @change 3.1.0-RC3 Added vars mode, subject, username, topic_type,
+ * poll, update_message, update_search_index
*/
- $vars = array('url', 'data');
+ $vars = array(
+ 'mode',
+ 'subject',
+ 'username',
+ 'topic_type',
+ 'poll',
+ 'data',
+ 'update_message',
+ 'update_search_index',
+ 'url',
+ );
extract($phpbb_dispatcher->trigger_event('core.submit_post_end', compact($vars)));
return $url;
diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php
index e60311f8ab..29cea477e4 100644
--- a/phpBB/includes/functions_privmsgs.php
+++ b/phpBB/includes/functions_privmsgs.php
@@ -212,7 +212,7 @@ function get_folder($user_id, $folder_id = false)
);
}
- if ($folder_id !== false && !isset($folder[$folder_id]))
+ if ($folder_id !== false && $folder_id !== PRIVMSGS_HOLD_BOX && !isset($folder[$folder_id]))
{
trigger_error('UNKNOWN_FOLDER');
}
@@ -883,7 +883,7 @@ function update_unread_status($unread, $msg_id, $user_id, $folder_id)
$phpbb_notifications = $phpbb_container->get('notification_manager');
- $phpbb_notifications->mark_notifications_read('pm', $msg_id, $user_id);
+ $phpbb_notifications->mark_notifications_read('notification.type.pm', $msg_id, $user_id);
$sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . "
SET pm_unread = 0
@@ -1114,7 +1114,7 @@ function delete_pm($user_id, $msg_ids, $folder_id)
$phpbb_notifications = $phpbb_container->get('notification_manager');
- $phpbb_notifications->delete_notifications('pm', array_keys($delete_rows));
+ $phpbb_notifications->delete_notifications('notification.type.pm', array_keys($delete_rows));
// Now we have to check which messages we can delete completely
$sql = 'SELECT msg_id
@@ -1296,7 +1296,7 @@ function phpbb_delete_users_pms($user_ids)
AND ' . $db->sql_in_set('msg_id', $delivered_msg);
$db->sql_query($sql);
- $phpbb_notifications->delete_notifications('pm', $delivered_msg);
+ $phpbb_notifications->delete_notifications('notification.type.pm', $delivered_msg);
}
if (!empty($undelivered_msg))
@@ -1309,7 +1309,7 @@ function phpbb_delete_users_pms($user_ids)
WHERE ' . $db->sql_in_set('msg_id', $undelivered_msg);
$db->sql_query($sql);
- $phpbb_notifications->delete_notifications('pm', $undelivered_msg);
+ $phpbb_notifications->delete_notifications('notification.type.pm', $undelivered_msg);
}
}
@@ -1353,7 +1353,7 @@ function phpbb_delete_users_pms($user_ids)
WHERE ' . $db->sql_in_set('msg_id', $delete_ids);
$db->sql_query($sql);
- $phpbb_notifications->delete_notifications('pm', $delete_ids);
+ $phpbb_notifications->delete_notifications('notification.type.pm', $delete_ids);
}
}
@@ -1911,11 +1911,11 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true)
if ($mode == 'edit')
{
- $phpbb_notifications->update_notifications('pm', $pm_data);
+ $phpbb_notifications->update_notifications('notification.type.pm', $pm_data);
}
else
{
- $phpbb_notifications->add_notifications('pm', $pm_data);
+ $phpbb_notifications->add_notifications('notification.type.pm', $pm_data);
}
/**
diff --git a/phpBB/includes/functions_transfer.php b/phpBB/includes/functions_transfer.php
index fca183a225..42fdee364c 100644
--- a/phpBB/includes/functions_transfer.php
+++ b/phpBB/includes/functions_transfer.php
@@ -507,8 +507,6 @@ class ftp extends transfer
/**
* FTP fsock transfer class
-*
-* @author wGEric
*/
class ftp_fsock extends transfer
{
diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php
index 0847c3a550..a0a67ccf3d 100644
--- a/phpBB/includes/functions_upload.php
+++ b/phpBB/includes/functions_upload.php
@@ -53,10 +53,16 @@ class filespec
protected $plupload;
/**
+ * phpBB Mimetype guesser
+ * @var \phpbb\mimetype\guesser
+ */
+ protected $mimetype_guesser;
+
+ /**
* File Class
* @access private
*/
- function filespec($upload_ary, $upload_namespace, \phpbb\plupload\plupload $plupload = null)
+ function filespec($upload_ary, $upload_namespace, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null)
{
if (!isset($upload_ary))
{
@@ -76,7 +82,7 @@ class filespec
if (!$this->mimetype)
{
- $this->mimetype = 'application/octetstream';
+ $this->mimetype = 'application/octet-stream';
}
$this->extension = strtolower(self::get_extension($this->realname));
@@ -90,6 +96,7 @@ class filespec
$this->local = (isset($upload_ary['local_mode'])) ? true : false;
$this->upload = $upload_namespace;
$this->plupload = $plupload;
+ $this->mimetype_guesser = $mimetype_guesser;
}
/**
@@ -97,6 +104,7 @@ class filespec
*
* @param real|unique|unique_ext $mode real creates a realname, filtering some characters, lowering every character. Unique creates an unique filename
* @param string $prefix Prefix applied to filename
+ * @param string $user_id The user_id is only needed for when cleaning a user's avatar
* @access public
*/
function clean_filename($mode = 'unique', $prefix = '', $user_id = '')
@@ -215,25 +223,19 @@ class filespec
}
/**
- * Get mimetype. Utilize mime_content_type if the function exist.
- * Not used at the moment...
+ * Get mimetype
+ *
+ * @param string $filename Filename that needs to be checked
+ * @return string Mimetype of supplied filename
*/
function get_mimetype($filename)
{
- $mimetype = '';
-
- if (function_exists('mime_content_type'))
- {
- $mimetype = mime_content_type($filename);
- }
-
- // Some browsers choke on a mimetype of application/octet-stream
- if (!$mimetype || $mimetype == 'application/octet-stream')
+ if ($this->mimetype_guesser !== null)
{
- $mimetype = 'application/octetstream';
+ $this->mimetype = $this->mimetype_guesser->guess($filename);
}
- return $mimetype;
+ return $this->mimetype;
}
/**
@@ -276,8 +278,9 @@ class filespec
* Move file to destination folder
* The phpbb_root_path variable will be applied to the destination path
*
- * @param string $destination_path Destination path, for example $config['avatar_path']
+ * @param string $destination Destination path, for example $config['avatar_path']
* @param bool $overwrite If set to true, an already existing file will be overwritten
+ * @param bool $skip_image_check If set to true, the check for the file to be a valid image is skipped
* @param string $chmod Permission mask for chmodding the file after a successful move. The mode entered here reflects the mode defined by {@link phpbb_chmod()}
*
* @access public
@@ -372,6 +375,9 @@ class filespec
// Try to get real filesize from destination folder
$this->filesize = (@filesize($this->destination_file)) ? @filesize($this->destination_file) : $this->filesize;
+ // Get mimetype of supplied file
+ $this->mimetype = $this->get_mimetype($this->destination_file);
+
if ($this->is_image() && !$skip_image_check)
{
$this->width = $this->height = 0;
@@ -498,6 +504,8 @@ class fileupload
* @param int $min_height Minimum image height (only checked for images)
* @param int $max_width Maximum image width (only checked for images)
* @param int $max_height Maximum image height (only checked for images)
+ * @param bool|array $disallowed_content If enabled, the first 256 bytes of the file must not
+ * contain any of its values. Defaults to false.
*
*/
function fileupload($error_prefix = '', $allowed_extensions = false, $max_filesize = false, $min_width = false, $min_height = false, $max_width = false, $max_height = false, $disallowed_content = false)
@@ -578,12 +586,13 @@ class fileupload
* Upload file from users harddisk
*
* @param string $form_name Form name assigned to the file input field (if it is an array, the key has to be specified)
+ * @param \phpbb\mimetype\guesser $mimetype_guesser Mimetype guesser
* @param \phpbb\plupload\plupload $plupload The plupload object
*
* @return object $file Object "filespec" is returned, all further operations can be done with this object
* @access public
*/
- function form_upload($form_name, \phpbb\plupload\plupload $plupload = null)
+ function form_upload($form_name, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null)
{
global $user, $request;
@@ -599,7 +608,7 @@ class fileupload
}
}
- $file = new filespec($upload, $this, $plupload);
+ $file = new filespec($upload, $this, $mimetype_guesser, $plupload);
if ($file->init_error)
{
@@ -659,7 +668,7 @@ class fileupload
/**
* Move file from another location to phpBB
*/
- function local_upload($source_file, $filedata = false)
+ function local_upload($source_file, $filedata = false, \phpbb\mimetype\guesser $mimetype_guesser = null)
{
global $user, $request;
@@ -672,20 +681,6 @@ class fileupload
{
$upload['name'] = utf8_basename($source_file);
$upload['size'] = 0;
- $mimetype = '';
-
- if (function_exists('mime_content_type'))
- {
- $mimetype = mime_content_type($source_file);
- }
-
- // Some browsers choke on a mimetype of application/octet-stream
- if (!$mimetype || $mimetype == 'application/octet-stream')
- {
- $mimetype = 'application/octetstream';
- }
-
- $upload['type'] = $mimetype;
}
else
{
@@ -694,7 +689,7 @@ class fileupload
$upload['type'] = $filedata['type'];
}
- $file = new filespec($upload, $this);
+ $file = new filespec($upload, $this, $mimetype_guesser);
if ($file->init_error)
{
@@ -749,10 +744,11 @@ class fileupload
* Uploads file from given url
*
* @param string $upload_url URL pointing to file to upload, for example http://www.foobar.com/example.gif
+ * @param \phpbb\mimetype\guesser $mimetype_guesser Mimetype guesser
* @return object $file Object "filespec" is returned, all further operations can be done with this object
* @access public
*/
- function remote_upload($upload_url)
+ function remote_upload($upload_url, \phpbb\mimetype\guesser $mimetype_guesser = null)
{
global $user, $phpbb_root_path;
@@ -931,7 +927,7 @@ class fileupload
$upload_ary['tmp_name'] = $filename;
- $file = new filespec($upload_ary, $this);
+ $file = new filespec($upload_ary, $this, $mimetype_guesser);
$this->common_checks($file);
return $file;
diff --git a/phpBB/includes/functions_url_matcher.php b/phpBB/includes/functions_url_matcher.php
index 7e17d1c2d8..b965046aad 100644
--- a/phpBB/includes/functions_url_matcher.php
+++ b/phpBB/includes/functions_url_matcher.php
@@ -29,7 +29,7 @@ if (!defined('IN_PHPBB'))
* @param \phpbb\extension\manager $manager Extension manager
* @param RequestContext $context Symfony RequestContext object
* @param string $root_path Root path
-* @param string $php_ext PHP extension
+* @param string $php_ext PHP file extension
* @return null
*/
function phpbb_get_url_matcher(\phpbb\extension\manager $manager, RequestContext $context, $root_path, $php_ext)
@@ -52,7 +52,7 @@ function phpbb_get_url_matcher(\phpbb\extension\manager $manager, RequestContext
*
* @param \phpbb\extension\manager $manager Extension manager
* @param string $root_path Root path
-* @param string $php_ext PHP extension
+* @param string $php_ext PHP file extension
* @return null
*/
function phpbb_create_dumped_url_matcher(\phpbb\extension\manager $manager, $root_path, $php_ext)
@@ -88,7 +88,7 @@ function phpbb_create_url_matcher(\phpbb\extension\manager $manager, RequestCont
*
* @param RequestContext $context Symfony RequestContext object
* @param string $root_path Root path
-* @param string $php_ext PHP extension
+* @param string $php_ext PHP file extension
* @return phpbb_url_matcher
*/
function phpbb_load_url_matcher(RequestContext $context, $root_path, $php_ext)
@@ -103,7 +103,7 @@ function phpbb_load_url_matcher(RequestContext $context, $root_path, $php_ext)
* The class is automatically dumped to the cache directory
*
* @param string $root_path Root path
-* @param string $php_ext PHP extension
+* @param string $php_ext PHP file extension
* @return bool True if it exists, false if not
*/
function phpbb_url_matcher_dumped($root_path, $php_ext)
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index d39be50251..38ae34c66c 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -2675,7 +2675,7 @@ function group_user_add($group_id, $user_id_ary = false, $username_ary = false,
foreach ($add_id_ary as $user_id)
{
- $phpbb_notifications->add_notifications('group_request', array(
+ $phpbb_notifications->add_notifications('notification.type.group_request', array(
'group_id' => $group_id,
'user_id' => $user_id,
'group_name' => $group_name,
@@ -2832,7 +2832,7 @@ function group_user_del($group_id, $user_id_ary = false, $username_ary = false,
$phpbb_notifications = $phpbb_container->get('notification_manager');
- $phpbb_notifications->delete_notifications('group_request', $user_id_ary, $group_id);
+ $phpbb_notifications->delete_notifications('notification.type.group_request', $user_id_ary, $group_id);
// Return false - no error
return false;
@@ -2996,12 +2996,12 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna
$phpbb_notifications = $phpbb_container->get('notification_manager');
- $phpbb_notifications->add_notifications('group_request_approved', array(
+ $phpbb_notifications->add_notifications('notification.type.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);
+ $phpbb_notifications->delete_notifications('notification.type.group_request', $user_id_ary, $group_id);
$log = 'LOG_USERS_APPROVED';
break;
diff --git a/phpBB/includes/mcp/mcp_front.php b/phpBB/includes/mcp/mcp_front.php
index 04206a6fcd..b4ec0092e7 100644
--- a/phpBB/includes/mcp/mcp_front.php
+++ b/phpBB/includes/mcp/mcp_front.php
@@ -26,6 +26,7 @@ function mcp_front_view($id, $mode, $action)
{
global $phpEx, $phpbb_root_path, $config;
global $template, $db, $user, $auth, $module;
+ global $phpbb_dispatcher;
// Latest 5 unapproved
if ($module->loaded('queue'))
@@ -80,6 +81,19 @@ function mcp_front_view($id, $mode, $action)
}
}
+ /**
+ * Alter list of posts and total as required
+ *
+ * @event core.mcp_front_view_queue_postid_list_after
+ * @var int total Number of unapproved posts
+ * @var array post_list List of unapproved posts
+ * @var array forum_list List of forums that contain the posts
+ * @var array forum_names Associative array with forum_id as key and it's corresponding forum_name as value
+ * @since 3.1.0-RC3
+ */
+ $vars = array('total', 'post_list', 'forum_list', 'forum_names');
+ extract($phpbb_dispatcher->trigger_event('core.mcp_front_view_queue_postid_list_after', compact($vars)));
+
if ($total)
{
$sql = 'SELECT p.post_id, p.post_subject, p.post_time, p.post_attachment, p.poster_id, p.post_username, u.username, u.username_clean, u.user_colour, t.topic_id, t.topic_title, t.topic_first_post_id, p.forum_id
@@ -178,6 +192,18 @@ function mcp_front_view($id, $mode, $action)
'ORDER_BY' => 'p.post_time DESC',
);
+
+ /**
+ * Alter sql query to get latest reported posts
+ *
+ * @event core.mcp_front_reports_listing_query_before
+ * @var int sql_ary Associative array with the query to be executed
+ * @var array forum_list List of forums that contain the posts
+ * @since 3.1.0-RC3
+ */
+ $vars = array('sql_ary', 'forum_list');
+ extract($phpbb_dispatcher->trigger_event('core.mcp_front_reports_listing_query_before', compact($vars)));
+
$sql = $db->sql_build_query('SELECT', $sql_ary);
$result = $db->sql_query_limit($sql, 5);
diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php
index 9f6125f256..92000c6ceb 100644
--- a/phpBB/includes/mcp/mcp_main.php
+++ b/phpBB/includes/mcp/mcp_main.php
@@ -1114,6 +1114,7 @@ function mcp_fork_topic($topic_ids)
$forum_id = request_var('f', 0);
$redirect = request_var('redirect', build_url(array('action', 'quickmod')));
$additional_msg = $success_msg = '';
+ $counter = array();
$s_hidden_fields = build_hidden_fields(array(
'topic_id_list' => $topic_ids,
@@ -1306,9 +1307,20 @@ function mcp_fork_topic($topic_ids)
'post_edit_time' => (int) $row['post_edit_time'],
'post_edit_count' => (int) $row['post_edit_count'],
'post_edit_locked' => (int) $row['post_edit_locked'],
- 'post_postcount' => 0,
+ 'post_postcount' => $row['post_postcount'],
);
-
+ // Adjust post count only if the post can be incremented to the user counter
+ if ($row['post_postcount'])
+ {
+ if (isset($counter[$row['poster_id']]))
+ {
+ ++$counter[$row['poster_id']];
+ }
+ else
+ {
+ $counter[$row['poster_id']] = 1;
+ }
+ }
$db->sql_query('INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary));
$new_post_id = $db->sql_nextid();
@@ -1428,6 +1440,18 @@ function mcp_fork_topic($topic_ids)
WHERE forum_id = ' . $to_forum_id;
$db->sql_query($sql);
+ if (!empty($counter))
+ {
+ // Do only one query per user and not a query per post.
+ foreach ($counter as $user_id => $count)
+ {
+ $sql = 'UPDATE ' . USERS_TABLE . '
+ SET user_posts = user_posts + ' . (int) $count . '
+ WHERE user_id = ' . (int) $user_id;
+ $db->sql_query($sql);
+ }
+ }
+
sync('topic', 'topic_id', $new_topic_id_list);
sync('forum', 'forum_id', $to_forum_id);
diff --git a/phpBB/includes/mcp/mcp_pm_reports.php b/phpBB/includes/mcp/mcp_pm_reports.php
index 03e4ed4722..d76bedba98 100644
--- a/phpBB/includes/mcp/mcp_pm_reports.php
+++ b/phpBB/includes/mcp/mcp_pm_reports.php
@@ -95,7 +95,7 @@ class mcp_pm_reports
$phpbb_notifications = $phpbb_container->get('notification_manager');
- $phpbb_notifications->mark_notifications_read_by_parent('report_pm', $report_id, $user->data['user_id']);
+ $phpbb_notifications->mark_notifications_read_by_parent('notification.type.report_pm', $report_id, $user->data['user_id']);
$pm_id = $report['pm_id'];
$report_id = $report['report_id'];
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index 37ce3c6fc3..bfd30a5be2 100644
--- a/phpBB/includes/mcp/mcp_queue.php
+++ b/phpBB/includes/mcp/mcp_queue.php
@@ -37,6 +37,7 @@ class mcp_queue
{
global $auth, $db, $user, $template, $cache, $request;
global $config, $phpbb_root_path, $phpEx, $action, $phpbb_container;
+ global $phpbb_dispatcher;
include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
@@ -164,7 +165,7 @@ class mcp_queue
{
$post_id = (int) $topic_info[$topic_id]['topic_first_post_id'];
- $phpbb_notifications->mark_notifications_read('topic_in_queue', $topic_id, $user->data['user_id']);
+ $phpbb_notifications->mark_notifications_read('notification.type.topic_in_queue', $topic_id, $user->data['user_id']);
}
else
{
@@ -172,7 +173,7 @@ class mcp_queue
}
}
- $phpbb_notifications->mark_notifications_read('post_in_queue', $post_id, $user->data['user_id']);
+ $phpbb_notifications->mark_notifications_read('notification.type.post_in_queue', $post_id, $user->data['user_id']);
$post_info = phpbb_get_post_data(array($post_id), 'm_approve', true);
@@ -429,6 +430,29 @@ class mcp_queue
OR t.topic_delete_user = 0)
$limit_time_sql
ORDER BY $sort_order_sql";
+
+ /**
+ * Alter sql query to get posts in queue to be accepted
+ *
+ * @event core.mcp_queue_get_posts_query_before
+ * @var string sql Associative array with the query to be executed
+ * @var array forum_list List of forums that contain the posts
+ * @var int visibility_const Integer with one of the possible ITEM_* constant values
+ * @var int topic_id If topic_id not equal to 0, the topic id to filter the posts to display
+ * @var string limit_time_sql String with the SQL code to limit the time interval of the post (Note: May be empty string)
+ * @var string sort_order_sql String with the ORDER BY SQL code used in this query
+ * @since 3.1.0-RC3
+ */
+ $vars = array(
+ 'sql',
+ 'forum_list',
+ 'visibility_const',
+ 'topic_id',
+ 'limit_time_sql',
+ 'sort_order_sql',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.mcp_queue_get_posts_query_before', compact($vars)));
+
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
$i = 0;
@@ -478,6 +502,29 @@ class mcp_queue
AND topic_delete_user <> 0
$limit_time_sql
ORDER BY $sort_order_sql";
+
+ /**
+ * Alter sql query to get information on all topics in the list of forums provided.
+ *
+ * @event core.mcp_queue_get_posts_for_topics_query_before
+ * @var string sql String with the query to be executed
+ * @var array forum_list List of forums that contain the posts
+ * @var int visibility_const Integer with one of the possible ITEM_* constant values
+ * @var int topic_id topic_id in the page request
+ * @var string limit_time_sql String with the SQL code to limit the time interval of the post (Note: May be empty string)
+ * @var string sort_order_sql String with the ORDER BY SQL code used in this query
+ * @since 3.1.0-RC3
+ */
+ $vars = array(
+ 'sql',
+ 'forum_list',
+ 'visibility_const',
+ 'topic_id',
+ 'limit_time_sql',
+ 'sort_order_sql',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.mcp_queue_get_posts_for_topics_query_before', compact($vars)));
+
$result = $db->sql_query_limit($sql, $config['topics_per_page'], $start);
$rowset = array();
@@ -654,11 +701,11 @@ class mcp_queue
// A single topic approval may also happen here, so handle deleting the respective notification.
if (!$post_data['topic_posts_approved'])
{
- $phpbb_notifications->delete_notifications('topic_in_queue', $post_data['topic_id']);
+ $phpbb_notifications->delete_notifications('notification.type.topic_in_queue', $post_data['topic_id']);
if ($post_data['post_visibility'] == ITEM_UNAPPROVED)
{
- $phpbb_notifications->add_notifications(array('topic'), $post_data);
+ $phpbb_notifications->add_notifications(array('notification.type.topic'), $post_data);
}
if ($post_data['post_visibility'] != ITEM_APPROVED)
{
@@ -674,18 +721,18 @@ class mcp_queue
if ($post_data['post_visibility'] == ITEM_UNAPPROVED)
{
$phpbb_notifications->add_notifications(array(
- 'bookmark',
- 'post',
+ 'notification.type.bookmark',
+ 'notification.type.post',
), $post_data);
}
}
- $phpbb_notifications->add_notifications(array('quote'), $post_data);
- $phpbb_notifications->delete_notifications('post_in_queue', $post_id);
+ $phpbb_notifications->add_notifications(array('notification.type.quote'), $post_data);
+ $phpbb_notifications->delete_notifications('notification.type.post_in_queue', $post_id);
$phpbb_notifications->mark_notifications_read(array(
- 'quote',
- 'bookmark',
- 'post',
+ 'notification.type.quote',
+ 'notification.type.bookmark',
+ 'notification.type.post',
), $post_data['post_id'], $user->data['user_id']);
// Notify Poster?
@@ -698,11 +745,11 @@ class mcp_queue
if (!$post_data['topic_posts_approved'])
{
- $phpbb_notifications->add_notifications('approve_post', $post_data);
+ $phpbb_notifications->add_notifications('notification.type.approve_post', $post_data);
}
else
{
- $phpbb_notifications->add_notifications('approve_topic', $post_data);
+ $phpbb_notifications->add_notifications('notification.type.approve_topic', $post_data);
}
}
}
@@ -874,7 +921,7 @@ class mcp_queue
'post_username' => $topic_data['topic_first_poster_name'],
));
- $phpbb_notifications->delete_notifications('topic_in_queue', $topic_id);
+ $phpbb_notifications->delete_notifications('notification.type.topic_in_queue', $topic_id);
// Only add notifications, if we are not reapproving post
// When the topic was already approved, but was edited and
@@ -883,17 +930,17 @@ class mcp_queue
if ($topic_data['topic_visibility'] == ITEM_UNAPPROVED)
{
$phpbb_notifications->add_notifications(array(
- 'quote',
- 'topic',
+ 'notification.type.quote',
+ 'notification.type.topic',
), $topic_data);
}
- $phpbb_notifications->mark_notifications_read('quote', $topic_data['post_id'], $user->data['user_id']);
- $phpbb_notifications->mark_notifications_read('topic', $topic_id, $user->data['user_id']);
+ $phpbb_notifications->mark_notifications_read('notification.type.quote', $topic_data['post_id'], $user->data['user_id']);
+ $phpbb_notifications->mark_notifications_read('notification.type.topic', $topic_id, $user->data['user_id']);
if ($notify_poster)
{
- $phpbb_notifications->add_notifications('approve_topic', $topic_data);
+ $phpbb_notifications->add_notifications('notification.type.approve_topic', $topic_data);
}
}
}
@@ -1131,12 +1178,12 @@ class mcp_queue
$topic_information[$topic_id]['topic_posts_softdeleted'] == 0 &&
$topic_information[$topic_id]['topic_posts_unapproved'] == $topic_posts_unapproved[$topic_id];
- $phpbb_notifications->delete_notifications('post_in_queue', $post_id);
+ $phpbb_notifications->delete_notifications('notification.type.post_in_queue', $post_id);
// Do we disapprove the whole topic? Remove potential notifications
if ($disapprove_all_posts_in_topic)
{
- $phpbb_notifications->delete_notifications('topic_in_queue', $post_data['topic_id']);
+ $phpbb_notifications->delete_notifications('notification.type.topic_in_queue', $post_data['topic_id']);
}
// Notify Poster?
@@ -1181,13 +1228,13 @@ class mcp_queue
{
// If there is only 1 post when disapproving the topic,
// we send the user a "disapprove topic" notification...
- $phpbb_notifications->add_notifications('disapprove_topic', $post_data);
+ $phpbb_notifications->add_notifications('notification.type.disapprove_topic', $post_data);
}
else
{
// ... otherwise there are multiple unapproved posts and
// all of them are disapproved as posts.
- $phpbb_notifications->add_notifications('disapprove_post', $post_data);
+ $phpbb_notifications->add_notifications('notification.type.disapprove_post', $post_data);
}
}
}
diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php
index a7d8bf18d6..ba118e5db8 100644
--- a/phpBB/includes/mcp/mcp_reports.php
+++ b/phpBB/includes/mcp/mcp_reports.php
@@ -92,7 +92,7 @@ class mcp_reports
$phpbb_notifications = $phpbb_container->get('notification_manager');
- $phpbb_notifications->mark_notifications_read('report_post', $post_id, $user->data['user_id']);
+ $phpbb_notifications->mark_notifications_read('notification.type.report_post', $post_id, $user->data['user_id']);
if (!$report_id && $report['report_closed'])
{
@@ -631,12 +631,12 @@ function close_report($report_id_list, $mode, $action, $pm = false)
if ($pm)
{
add_log('mod', 0, 0, 'LOG_PM_REPORT_' . strtoupper($action) . 'D', $post_info[$report['pm_id']]['message_subject']);
- $phpbb_notifications->delete_notifications('report_pm', $report['pm_id']);
+ $phpbb_notifications->delete_notifications('notification.type.report_pm', $report['pm_id']);
}
else
{
add_log('mod', $post_info[$report['post_id']]['forum_id'], $post_info[$report['post_id']]['topic_id'], 'LOG_REPORT_' . strtoupper($action) . 'D', $post_info[$report['post_id']]['post_subject']);
- $phpbb_notifications->delete_notifications('report_post', $report['post_id']);
+ $phpbb_notifications->delete_notifications('notification.type.report_post', $report['post_id']);
}
}
@@ -654,7 +654,7 @@ function close_report($report_id_list, $mode, $action, $pm = false)
if ($pm)
{
- $phpbb_notifications->add_notifications('report_pm_closed', array_merge($post_info[$post_id], array(
+ $phpbb_notifications->add_notifications('notification.type.report_pm_closed', array_merge($post_info[$post_id], array(
'reporter' => $reporter['user_id'],
'closer_id' => $user->data['user_id'],
'from_user_id' => $post_info[$post_id]['author_id'],
@@ -662,7 +662,7 @@ function close_report($report_id_list, $mode, $action, $pm = false)
}
else
{
- $phpbb_notifications->add_notifications('report_post_closed', array_merge($post_info[$post_id], array(
+ $phpbb_notifications->add_notifications('notification.type.report_post_closed', array_merge($post_info[$post_id], array(
'reporter' => $reporter['user_id'],
'closer_id' => $user->data['user_id'],
)));
diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php
index fb47522644..106b025757 100644
--- a/phpBB/includes/mcp/mcp_warn.php
+++ b/phpBB/includes/mcp/mcp_warn.php
@@ -535,7 +535,7 @@ function add_warning($user_row, $warning, $send_pm = true, $post_id = 0)
$message_parser = new parse_message();
- $message_parser->message = sprintf($lang['WARNING_PM_BODY'], $warning);
+ $message_parser->message = $user->lang('WARNING_PM_BODY', $warning);
$message_parser->parse(true, true, true, false, false, true, true);
$pm_data = array(
@@ -553,7 +553,7 @@ function add_warning($user_row, $warning, $send_pm = true, $post_id = 0)
'address_list' => array('u' => array($user_row['user_id'] => 'to')),
);
- submit_pm('post', $lang['WARNING_PM_SUBJECT'], $pm_data, false);
+ submit_pm('post', $user->lang('WARNING_PM_SUBJECT'), $pm_data, false);
}
add_log('admin', 'LOG_USER_WARNING', $user_row['username']);
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index da27d8900d..92ace7b585 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -1083,6 +1083,12 @@ class parse_message extends bbcode_firstpass
protected $plupload;
/**
+ * The mimetype guesser object used for attachment mimetypes
+ * @var \phpbb\mimetype\guesser
+ */
+ protected $mimetype_guesser;
+
+ /**
* Init - give message here or manually
*/
function parse_message($message = '')
@@ -1560,7 +1566,7 @@ class parse_message extends bbcode_firstpass
{
if ($num_attachments < $cfg['max_attachments'] || $auth->acl_gets('m_', 'a_', $forum_id))
{
- $filedata = upload_attachment($form_name, $forum_id, false, '', $is_message, false, $this->plupload);
+ $filedata = upload_attachment($form_name, $forum_id, false, '', $is_message, false, $this->mimetype_guesser, $this->plupload);
$error = array_merge($error, $filedata['error']);
if (!sizeof($error))
@@ -1792,4 +1798,16 @@ class parse_message extends bbcode_firstpass
{
$this->plupload = $plupload;
}
+
+ /**
+ * Setter function for passing the mimetype_guesser object
+ *
+ * @param \phpbb\mimetype\guesser $mimetype_guesser The mimetype_guesser object
+ *
+ * @return null
+ */
+ public function set_mimetype_guesser(\phpbb\mimetype\guesser $mimetype_guesser)
+ {
+ $this->mimetype_guesser = $mimetype_guesser;
+ }
}
diff --git a/phpBB/includes/ucp/ucp_activate.php b/phpBB/includes/ucp/ucp_activate.php
index 53dec89aad..6e357b260a 100644
--- a/phpBB/includes/ucp/ucp_activate.php
+++ b/phpBB/includes/ucp/ucp_activate.php
@@ -111,7 +111,7 @@ class ucp_activate
if ($config['require_activation'] == USER_ACTIVATION_ADMIN && !$update_password)
{
$phpbb_notifications = $phpbb_container->get('notification_manager');
- $phpbb_notifications->delete_notifications('admin_activate_user', $user_row['user_id']);
+ $phpbb_notifications->delete_notifications('notification.type.admin_activate_user', $user_row['user_id']);
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
diff --git a/phpBB/includes/ucp/ucp_confirm.php b/phpBB/includes/ucp/ucp_confirm.php
index bcba32cdf6..7392f8dea8 100644
--- a/phpBB/includes/ucp/ucp_confirm.php
+++ b/phpBB/includes/ucp/ucp_confirm.php
@@ -36,10 +36,9 @@ class ucp_confirm
function main($id, $mode)
{
- global $db, $user, $phpbb_root_path, $config, $phpEx;
+ global $db, $user, $phpbb_root_path, $config, $phpEx, $phpbb_container;
- include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
- $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']);
+ $captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']);
$captcha->init(request_var('type', 0));
$captcha->execute();
diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php
index e4931fbe23..b9606945b4 100644
--- a/phpBB/includes/ucp/ucp_groups.php
+++ b/phpBB/includes/ucp/ucp_groups.php
@@ -471,6 +471,29 @@ class ucp_groups
$avatar_data = \phpbb\avatar\manager::clean_row($group_row, 'group');
}
+ // Handle deletion of avatars
+ if ($request->is_set_post('avatar_delete'))
+ {
+ if (confirm_box(true))
+ {
+ $phpbb_avatar_manager->handle_avatar_delete($db, $user, $avatar_data, GROUPS_TABLE, 'group_');
+ $cache->destroy('sql', GROUPS_TABLE);
+
+ $message = ($action == 'edit') ? 'GROUP_UPDATED' : 'GROUP_CREATED';
+ trigger_error($user->lang[$message] . $return_page);
+ }
+ else
+ {
+ confirm_box(false, $user->lang('CONFIRM_AVATAR_DELETE'), build_hidden_fields(array(
+ 'avatar_delete' => true,
+ 'i' => $id,
+ 'mode' => $mode,
+ 'g' => $group_id,
+ 'action' => $action))
+ );
+ }
+ }
+
// Did we submit?
if ($update)
{
@@ -510,19 +533,6 @@ class ucp_groups
$submit_ary = array_merge($submit_ary, $result);
}
}
- else
- {
- if ($driver = $phpbb_avatar_manager->get_driver($avatar_data['avatar_type']))
- {
- $driver->delete($avatar_data);
- }
-
- // Removing the avatar
- $submit_ary['avatar_type'] = '';
- $submit_ary['avatar'] = '';
- $submit_ary['avatar_width'] = 0;
- $submit_ary['avatar_height'] = 0;
- }
// Merge any avatars errors into the primary error array
$error = array_merge($error, $phpbb_avatar_manager->localize_errors($user, $avatar_error));
diff --git a/phpBB/includes/ucp/ucp_login_link.php b/phpBB/includes/ucp/ucp_login_link.php
index a8762313fd..5ca5df00f7 100644
--- a/phpBB/includes/ucp/ucp_login_link.php
+++ b/phpBB/includes/ucp/ucp_login_link.php
@@ -181,7 +181,7 @@ class ucp_login_link
*/
protected function process_login_result($result)
{
- global $config, $request, $template, $user;
+ global $config, $request, $template, $user, $phpbb_container;
$login_error = null;
@@ -197,7 +197,7 @@ class ucp_login_link
{
case LOGIN_ERROR_ATTEMPTS:
- $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']);
+ $captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']);
$captcha->init(CONFIRM_LOGIN);
$template->assign_vars(array(
diff --git a/phpBB/includes/ucp/ucp_notifications.php b/phpBB/includes/ucp/ucp_notifications.php
index 0ed3084e9f..5691302b83 100644
--- a/phpBB/includes/ucp/ucp_notifications.php
+++ b/phpBB/includes/ucp/ucp_notifications.php
@@ -58,21 +58,21 @@ class ucp_notifications
{
foreach($notification_methods as $method => $method_data)
{
- if ($request->is_set_post($type . '_' . $method_data['id']) && (!isset($subscriptions[$type]) || !in_array($method_data['id'], $subscriptions[$type])))
+ if ($request->is_set_post(str_replace('.', '_', $type . '_' . $method_data['id'])) && (!isset($subscriptions[$type]) || !in_array($method_data['id'], $subscriptions[$type])))
{
$phpbb_notifications->add_subscription($type, 0, $method_data['id']);
}
- else if (!$request->is_set_post($type . '_' . $method_data['id']) && isset($subscriptions[$type]) && in_array($method_data['id'], $subscriptions[$type]))
+ else if (!$request->is_set_post(str_replace('.', '_', $type . '_' . $method_data['id'])) && isset($subscriptions[$type]) && in_array($method_data['id'], $subscriptions[$type]))
{
$phpbb_notifications->delete_subscription($type, 0, $method_data['id']);
}
}
- if ($request->is_set_post($type . '_notification') && !isset($subscriptions[$type]))
+ if ($request->is_set_post(str_replace('.', '_', $type) . '_notification') && !isset($subscriptions[$type]))
{
$phpbb_notifications->add_subscription($type);
}
- else if (!$request->is_set_post($type . '_notification') && isset($subscriptions[$type]))
+ else if (!$request->is_set_post(str_replace('.', '_', $type) . '_notification') && isset($subscriptions[$type]))
{
$phpbb_notifications->delete_subscription($type);
}
diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php
index 94383b935f..d5a1dbae87 100644
--- a/phpBB/includes/ucp/ucp_pm_viewmessage.php
+++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php
@@ -250,7 +250,6 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
'U_PM_ACTION' => $url . '&amp;mode=compose&amp;f=' . $folder_id . '&amp;p=' . $message_row['msg_id'],
'S_HAS_ATTACHMENTS' => (sizeof($attachments)) ? true : false,
- 'S_HAS_MULTIPLE_ATTACHMENTS' => (sizeof($attachments) > 1),
'S_DISPLAY_NOTICE' => $display_notice && $message_row['message_attachment'],
'S_AUTHOR_DELETED' => ($author_id == ANONYMOUS) ? true : false,
'S_SPECIAL_FOLDER' => in_array($folder_id, array(PRIVMSGS_NO_BOX, PRIVMSGS_OUTBOX)),
@@ -339,12 +338,6 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row)
// Display not already displayed Attachments for this post, we already parsed them. ;)
if (isset($attachments) && sizeof($attachments))
{
- $methods = phpbb_gen_download_links('msg_id', $msg_id, $phpbb_root_path, $phpEx);
- foreach ($methods as $method)
- {
- $template->assign_block_vars('dl_method', $method);
- }
-
foreach ($attachments as $attachment)
{
$template->assign_block_vars('attachment', array(
diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php
index df1e722fa4..a8c8920a7d 100644
--- a/phpBB/includes/ucp/ucp_prefs.php
+++ b/phpBB/includes/ucp/ucp_prefs.php
@@ -43,7 +43,7 @@ class ucp_prefs
'notifymethod' => request_var('notifymethod', $user->data['user_notify_type']),
'dateformat' => request_var('dateformat', $user->data['user_dateformat'], true),
'lang' => basename(request_var('lang', $user->data['user_lang'])),
- 'style' => request_var('style', (int) $user->data['user_style']),
+ 'user_style' => request_var('user_style', (int) $user->data['user_style']),
'tz' => request_var('tz', $user->data['user_timezone']),
'viewemail' => request_var('viewemail', (bool) $user->data['user_allow_viewemail']),
@@ -76,11 +76,11 @@ class ucp_prefs
{
if ($config['override_user_style'])
{
- $data['style'] = (int) $config['default_style'];
+ $data['user_style'] = (int) $config['default_style'];
}
- else if (!phpbb_style_is_active($data['style']))
+ else if (!phpbb_style_is_active($data['user_style']))
{
- $data['style'] = (int) $user->data['user_style'];
+ $data['user_style'] = (int) $user->data['user_style'];
}
$error = validate_data($data, array(
@@ -107,7 +107,7 @@ class ucp_prefs
'user_dateformat' => $data['dateformat'],
'user_lang' => $data['lang'],
'user_timezone' => $data['tz'],
- 'user_style' => $data['style'],
+ 'user_style' => $data['user_style'],
);
/**
@@ -207,7 +207,7 @@ class ucp_prefs
'S_MORE_STYLES' => $s_more_styles,
'S_LANG_OPTIONS' => language_select($data['lang']),
- 'S_STYLE_OPTIONS' => ($config['override_user_style']) ? '' : style_select($data['style']),
+ 'S_STYLE_OPTIONS' => ($config['override_user_style']) ? '' : style_select($data['user_style']),
'S_TZ_OPTIONS' => $timezone_selects['tz_select'],
'S_TZ_DATE_OPTIONS' => $timezone_selects['tz_dates'],
'S_CAN_HIDE_ONLINE' => ($auth->acl_get('u_hideonline')) ? true : false,
diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php
index a315b167d7..361dc831aa 100644
--- a/phpBB/includes/ucp/ucp_profile.php
+++ b/phpBB/includes/ucp/ucp_profile.php
@@ -564,30 +564,6 @@ class ucp_profile
trigger_error($message);
}
}
- else
- {
- if ($driver = $phpbb_avatar_manager->get_driver($avatar_data['avatar_type']))
- {
- $driver->delete($avatar_data);
- }
-
- $result = array(
- 'user_avatar' => '',
- 'user_avatar_type' => '',
- 'user_avatar_width' => 0,
- 'user_avatar_height' => 0,
- );
-
- $sql = 'UPDATE ' . USERS_TABLE . '
- SET ' . $db->sql_build_array('UPDATE', $result) . '
- WHERE user_id = ' . (int) $user->data['user_id'];
-
- $db->sql_query($sql);
-
- meta_refresh(3, $this->u_action);
- $message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
- trigger_error($message);
- }
}
else
{
@@ -595,6 +571,27 @@ class ucp_profile
}
}
+ // Handle deletion of avatars
+ if ($request->is_set_post('avatar_delete'))
+ {
+ if (!confirm_box(true))
+ {
+ confirm_box(false, $user->lang('CONFIRM_AVATAR_DELETE'), build_hidden_fields(array(
+ 'avatar_delete' => true,
+ 'i' => $id,
+ 'mode' => $mode))
+ );
+ }
+ else
+ {
+ $phpbb_avatar_manager->handle_avatar_delete($db, $user, $avatar_data, USERS_TABLE, 'user_');
+
+ meta_refresh(3, $this->u_action);
+ $message = $user->lang['PROFILE_UPDATED'] . '<br /><br />' . sprintf($user->lang['RETURN_UCP'], '<a href="' . $this->u_action . '">', '</a>');
+ trigger_error($message);
+ }
+ }
+
$selected_driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', $user->data['user_avatar_type']));
foreach ($avatar_drivers as $current_driver)
diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php
index 97934fc32d..06baf7e5f2 100644
--- a/phpBB/includes/ucp/ucp_register.php
+++ b/phpBB/includes/ucp/ucp_register.php
@@ -182,8 +182,7 @@ class ucp_register
// The CAPTCHA kicks in here. We can't help that the information gets lost on language change.
if ($config['enable_confirm'])
{
- include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
- $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']);
+ $captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']);
$captcha->init(CONFIRM_REG);
}
@@ -390,7 +389,7 @@ class ucp_register
if ($config['require_activation'] == USER_ACTIVATION_ADMIN)
{
$phpbb_notifications = $phpbb_container->get('notification_manager');
- $phpbb_notifications->add_notifications('admin_activate_user', array(
+ $phpbb_notifications->add_notifications('notification.type.admin_activate_user', array(
'user_id' => $user_id,
'user_actkey' => $user_row['user_actkey'],
'user_regdate' => $user_row['user_regdate'],
diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php
index 696075b07c..de0cccd234 100644
--- a/phpBB/install/convertors/convert_phpbb20.php
+++ b/phpBB/install/convertors/convert_phpbb20.php
@@ -38,7 +38,7 @@ $dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms);
$convertor_data = array(
'forum_name' => 'phpBB 2.0.x',
'version' => '1.0.3',
- 'phpbb_version' => '3.1.0-RC2',
+ 'phpbb_version' => '3.1.0-RC3',
'author' => '<a href="https://www.phpbb.com/">phpBB Limited</a>',
'dbms' => $dbms,
'dbhost' => $dbhost,
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 517143792a..6a91033dbb 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -13,10 +13,6 @@
$update_start_time = time();
-use Symfony\Component\Config\FileLocator;
-use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
-
/**
* @ignore
*/
diff --git a/phpBB/install/index.php b/phpBB/install/index.php
index d443c537fa..2e497da3db 100644
--- a/phpBB/install/index.php
+++ b/phpBB/install/index.php
@@ -11,10 +11,6 @@
*
*/
-use Symfony\Component\Config\FileLocator;
-use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
-
/**#@+
* @ignore
*/
@@ -244,7 +240,7 @@ $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();
+$user = new \phpbb\user('\phpbb\datetime');
$auth = new \phpbb\auth\auth();
// Add own hook handler, if present. :o
diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php
index b82df84a00..20b211dde9 100644
--- a/phpBB/install/install_install.php
+++ b/phpBB/install/install_install.php
@@ -1382,7 +1382,7 @@ class install_install extends module
if (@extension_loaded('gd'))
{
$sql_ary[] = 'UPDATE ' . $data['table_prefix'] . "config
- SET config_value = 'phpbb_captcha_gd'
+ SET config_value = 'core.captcha.plugins.gd'
WHERE config_name = 'captcha_plugin'";
$sql_ary[] = 'UPDATE ' . $data['table_prefix'] . "config
diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php
index 28777a8d24..82ca0fc18d 100644
--- a/phpBB/install/install_update.php
+++ b/phpBB/install/install_update.php
@@ -1063,6 +1063,14 @@ class install_update extends module
$transfer->write_file($file_struct['filename'], $contents);
}
break;
+
+ case 'deleted':
+
+ if ($update_mode != 'download')
+ {
+ $transfer->rename($file_struct['filename'], $file_struct['filename'] . '.bak');
+ }
+ break;
}
}
}
diff --git a/phpBB/install/schemas/schema.json b/phpBB/install/schemas/schema.json
index a3ffd923a1..b71b1fecbe 100644
--- a/phpBB/install/schemas/schema.json
+++ b/phpBB/install/schemas/schema.json
@@ -2088,16 +2088,12 @@
"UINT",
0
],
- "pf_phpbb_skype": [
- "VCHAR",
- ""
- ],
- "pf_phpbb_twitter": [
- "VCHAR",
+ "pf_phpbb_interests": [
+ "MTEXT",
""
],
- "pf_phpbb_youtube": [
- "VCHAR",
+ "pf_phpbb_occupation": [
+ "MTEXT",
""
],
"pf_phpbb_facebook": [
@@ -2108,19 +2104,19 @@
"VCHAR",
""
],
- "pf_phpbb_interests": [
- "MTEXT",
+ "pf_phpbb_icq": [
+ "VCHAR",
""
],
- "pf_phpbb_occupation": [
- "MTEXT",
+ "pf_phpbb_location": [
+ "VCHAR",
""
],
- "pf_phpbb_icq": [
+ "pf_phpbb_skype": [
"VCHAR",
""
],
- "pf_phpbb_location": [
+ "pf_phpbb_twitter": [
"VCHAR",
""
],
@@ -2136,6 +2132,10 @@
"VCHAR",
""
],
+ "pf_phpbb_youtube": [
+ "VCHAR",
+ ""
+ ],
"pf_phpbb_aol": [
"VCHAR",
""
@@ -2397,14 +2397,6 @@
]
},
"KEYS": {
- "unq_mtch": [
- "UNIQUE",
- [
- "word_id",
- "post_id",
- "title_match"
- ]
- ],
"word_id": [
"INDEX",
"word_id"
@@ -2412,6 +2404,14 @@
"post_id": [
"INDEX",
"post_id"
+ ],
+ "un_mtch": [
+ "UNIQUE",
+ [
+ "word_id",
+ "post_id",
+ "title_match"
+ ]
]
}
},
@@ -2711,8 +2711,9 @@
0
],
"topic_first_poster_name": [
- "VCHAR_UNI",
- ""
+ "VCHAR_UNI:255",
+ "",
+ "true_sort"
],
"topic_first_poster_colour": [
"VCHAR:6",
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index 9cc151f728..90b1ac8f92 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -70,7 +70,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('browser_check', '1
INSERT INTO phpbb_config (config_name, config_value) VALUES ('bump_interval', '10');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('bump_type', 'd');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('cache_gc', '7200');
-INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_plugin', 'phpbb_captcha_nogd');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_plugin', 'core.captcha.plugins.nogd');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_foreground_noise', '0');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('captcha_gd_x_grid', '25');
@@ -273,7 +273,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('tpl_allow_php', '0
INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_icons_path', 'images/upload_icons');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_path', 'files');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('use_system_cron', '0');
-INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.1.0-RC3-dev');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.1.0-RC4-dev');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_expire_days', '90');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_gc', '14400');
@@ -813,9 +813,9 @@ INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_len
INSERT INTO phpbb_profile_fields (field_name, field_type, field_ident, field_length, field_minlen, field_maxlen, field_novalue, field_default_value, field_validation, field_required, field_show_novalue, field_show_on_reg, field_show_on_pm, field_show_on_vt, field_show_on_ml, field_show_profile, field_hide, field_no_view, field_active, field_order, field_is_contact, field_contact_desc, field_contact_url) VALUES ('phpbb_googleplus', 'profilefields.type.googleplus', 'phpbb_googleplus', '20', '3', '255', '', '', '[\w]+', 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 13, 1, 'VIEW_GOOGLEPLUS_PROFILE', 'http://plus.google.com/%s');
# User Notification Options (for first user)
-INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('post', 0, 2, '');
-INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('post', 0, 2, 'email');
-INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('topic', 0, 2, '');
-INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('topic', 0, 2, 'email');
+INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('notification.type.post', 0, 2, '');
+INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('notification.type.post', 0, 2, 'notification.method.email');
+INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('notification.type.topic', 0, 2, '');
+INSERT INTO phpbb_user_notifications (item_type, item_id, user_id, method) VALUES('notification.type.topic', 0, 2, 'notification.method.email');
# POSTGRES COMMIT #
diff --git a/phpBB/language/en/acp/extensions.php b/phpBB/language/en/acp/extensions.php
index 6ec722bb78..28cdc8829d 100644
--- a/phpBB/language/en/acp/extensions.php
+++ b/phpBB/language/en/acp/extensions.php
@@ -42,6 +42,7 @@ $lang = array_merge($lang, array(
'EXTENSION_INVALID_LIST' => 'The “%s” extension is not valid.<br />%s<br /><br />',
'EXTENSION_NOT_AVAILABLE' => 'The selected extension is not available for this board, please verify your phpBB and PHP versions are allowed (see the details page).',
'EXTENSION_DIR_INVALID' => 'The selected extension has an invalid directory structure and cannot be enabled.',
+ 'EXTENSION_NOT_ENABLEABLE' => 'The selected extension cannot be enabled, please verify the extension’s requirements.',
'DETAILS' => 'Details',
diff --git a/phpBB/language/en/cli.php b/phpBB/language/en/cli.php
index eb0f5bb357..0e7dc39b95 100644
--- a/phpBB/language/en/cli.php
+++ b/phpBB/language/en/cli.php
@@ -73,6 +73,9 @@ $lang = array_merge($lang, array(
'CLI_EXTENSION_PURGE_FAILURE' => 'Could not purge extension %s',
'CLI_EXTENSION_PURGE_SUCCESS' => 'Successfully purged extension %s',
'CLI_EXTENSION_NOT_FOUND' => 'No extensions were found.',
+ 'CLI_EXTENSIONS_AVAILABLE' => 'Available',
+ 'CLI_EXTENSIONS_DISABLED' => 'Disabled',
+ 'CLI_EXTENSIONS_ENABLED' => 'Enabled',
'CLI_FIXUP_RECALCULATE_EMAIL_HASH_SUCCESS' => 'Successfully recalculated all email hashes.',
));
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index a58aec43cd..783faa8fad 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -167,6 +167,7 @@ $lang = array_merge($lang, array(
'CONFIRM_CODE_EXPLAIN' => 'Enter the code exactly as it appears. All letters are case insensitive.',
'CONFIRM_CODE_WRONG' => 'The confirmation code you entered was incorrect.',
'CONFIRM_OPERATION' => 'Are you sure you wish to carry out this operation?',
+ 'CONFIRM_AVATAR_DELETE' => 'Are you sure you wish to delete this avatar?',
'CONGRATULATIONS' => 'Congratulations to',
'CONNECTION_FAILED' => 'Connection failed.',
'CONNECTION_SUCCESS' => 'Connection was successful!',
@@ -191,8 +192,6 @@ $lang = array_merge($lang, array(
'DISPLAY_MESSAGES' => 'Display messages from previous',
'DISPLAY_POSTS' => 'Display posts from previous',
'DISPLAY_TOPICS' => 'Display topics from previous',
- 'DOWNLOAD_ALL' => 'Download all',
- 'DOWNLOAD_ALL_ATTACHMENTS' => 'Download all attachments',
'DOWNLOADED' => 'Downloaded',
'DOWNLOADING_FILE' => 'Downloading file',
'DOWNLOAD_COUNTS' => array(
@@ -483,7 +482,6 @@ $lang = array_merge($lang, array(
'NO_AUTH_ADMIN_USER_DIFFER' => 'You are not able to re-authenticate as a different user.',
'NO_AUTH_OPERATION' => 'You do not have the necessary permissions to complete this operation.',
'NO_AVATARS' => 'No avatars currently available',
- 'NO_AVATAR_SELECTED' => 'You have not selected any avatar.',
'NO_CONNECT_TO_SMTP_HOST' => 'Could not connect to smtp host : %1$s : %2$s',
'NO_BIRTHDAYS' => 'No birthdays today',
'NO_EMAIL_MESSAGE' => 'Email message was blank.',
diff --git a/phpBB/phpbb/auth/auth.php b/phpBB/phpbb/auth/auth.php
index 65249275d4..38755ccf99 100644
--- a/phpBB/phpbb/auth/auth.php
+++ b/phpBB/phpbb/auth/auth.php
@@ -208,9 +208,12 @@ class auth
/**
* Get forums with the specified permission setting
- * if the option is prefixed with !, then the result becomes negated
*
- * @param bool $clean set to true if only values needs to be returned which are set/unset
+ * @param string $opt The permission name to lookup. If prefixed with !, the result is negated.
+ * @param bool $clean set to true if only values needs to be returned which are set/unset
+ *
+ * @return array Contains the forum ids with the specified permission set to true.
+ This is a nested array: array => forum_id => permission => true
*/
function acl_getf($opt, $clean = false)
{
diff --git a/phpBB/phpbb/auth/provider/apache.php b/phpBB/phpbb/auth/provider/apache.php
index 4f44efe9af..9137a77210 100644
--- a/phpBB/phpbb/auth/provider/apache.php
+++ b/phpBB/phpbb/auth/provider/apache.php
@@ -28,13 +28,13 @@ class apache extends \phpbb\auth\provider\base
/**
* Apache Authentication Constructor
*
- * @param \phpbb\db\driver\driver_interface $db
- * @param \phpbb\config\config $config
- * @param \phpbb\passwords\manager $passwords_manager
- * @param \phpbb\request\request $request
- * @param \phpbb\user $user
- * @param string $phpbb_root_path
- * @param string $php_ext
+ * @param \phpbb\db\driver\driver_interface $db Database object
+ * @param \phpbb\config\config $config Config object
+ * @param \phpbb\passwords\manager $passwords_manager Passwords Manager object
+ * @param \phpbb\request\request $request Request object
+ * @param \phpbb\user $user User object
+ * @param string $phpbb_root_path Relative path to phpBB root
+ * @param string $php_ext PHP file extension
*/
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request $request, \phpbb\user $user, $phpbb_root_path, $php_ext)
{
diff --git a/phpBB/phpbb/auth/provider/db.php b/phpBB/phpbb/auth/provider/db.php
index 142a47247f..722eeffa9a 100644
--- a/phpBB/phpbb/auth/provider/db.php
+++ b/phpBB/phpbb/auth/provider/db.php
@@ -27,6 +27,13 @@ class db extends \phpbb\auth\provider\base
protected $passwords_manager;
/**
+ * DI container
+ *
+ * @var \Symfony\Component\DependencyInjection\ContainerInterface
+ */
+ protected $phpbb_container;
+
+ /**
* Database Authentication Constructor
*
* @param \phpbb\db\driver\driver_interface $db
@@ -34,10 +41,11 @@ class db extends \phpbb\auth\provider\base
* @param \phpbb\passwords\manager $passwords_manager
* @param \phpbb\request\request $request
* @param \phpbb\user $user
+ * @param \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container DI container
* @param string $phpbb_root_path
* @param string $php_ext
*/
- public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request $request, \phpbb\user $user, $phpbb_root_path, $php_ext)
+ public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request $request, \phpbb\user $user, \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container, $phpbb_root_path, $php_ext)
{
$this->db = $db;
$this->config = $config;
@@ -46,6 +54,7 @@ class db extends \phpbb\auth\provider\base
$this->user = $user;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
+ $this->phpbb_container = $phpbb_container;
}
/**
@@ -146,13 +155,8 @@ class db extends \phpbb\auth\provider\base
// Every auth module is able to define what to do by itself...
if ($show_captcha)
{
- // Visual Confirmation handling
- if (!class_exists('phpbb_captcha_factory', false))
- {
- include ($this->phpbb_root_path . 'includes/captcha/captcha_factory.' . $this->php_ext);
- }
-
- $captcha = \phpbb_captcha_factory::get_instance($this->config['captcha_plugin']);
+ $captcha_factory = $this->phpbb_container->get('captcha.factory');
+ $captcha = $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/ldap.php b/phpBB/phpbb/auth/provider/ldap.php
index e7764b754b..d32e7504eb 100644
--- a/phpBB/phpbb/auth/provider/ldap.php
+++ b/phpBB/phpbb/auth/provider/ldap.php
@@ -29,10 +29,10 @@ class ldap extends \phpbb\auth\provider\base
/**
* LDAP Authentication Constructor
*
- * @param \phpbb\db\driver\driver_interface $db
- * @param \phpbb\config\config $config
- * @param \phpbb\passwords\manager $passwords_manager
- * @param \phpbb\user $user
+ * @param \phpbb\db\driver\driver_interface $db Database object
+ * @param \phpbb\config\config $config Config object
+ * @param \phpbb\passwords\manager $passwords_manager Passwords manager object
+ * @param \phpbb\user $user User object
*/
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\user $user)
{
diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php
index 7b71e3c844..902c6ae84c 100644
--- a/phpBB/phpbb/auth/provider/oauth/oauth.php
+++ b/phpBB/phpbb/auth/provider/oauth/oauth.php
@@ -91,6 +91,13 @@ class oauth extends \phpbb\auth\provider\base
protected $current_uri;
/**
+ * DI container
+ *
+ * @var \Symfony\Component\DependencyInjection\ContainerInterface
+ */
+ protected $phpbb_container;
+
+ /**
* phpBB root path
*
* @var string
@@ -116,10 +123,11 @@ class oauth extends \phpbb\auth\provider\base
* @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 \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container DI container
* @param string $phpbb_root_path
* @param string $php_ext
*/
- public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \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)
+ public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \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, \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container, $phpbb_root_path, $php_ext)
{
$this->db = $db;
$this->config = $config;
@@ -130,6 +138,7 @@ class oauth extends \phpbb\auth\provider\base
$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_container = $phpbb_container;
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;
}
@@ -160,7 +169,7 @@ class oauth extends \phpbb\auth\provider\base
// 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->passwords_manager, $this->request, $this->user, $this->phpbb_root_path, $this->php_ext);
+ $provider = new \phpbb\auth\provider\db($this->db, $this->config, $this->passwords_manager, $this->request, $this->user, $this->phpbb_container, $this->phpbb_root_path, $this->php_ext);
return $provider->login($username, $password);
}
diff --git a/phpBB/phpbb/avatar/driver/gravatar.php b/phpBB/phpbb/avatar/driver/gravatar.php
index 4aa7445d20..2082e0fd02 100644
--- a/phpBB/phpbb/avatar/driver/gravatar.php
+++ b/phpBB/phpbb/avatar/driver/gravatar.php
@@ -69,6 +69,11 @@ class gravatar extends \phpbb\avatar\driver\driver
$row['avatar_width'] = $request->variable('avatar_gravatar_width', 0);
$row['avatar_height'] = $request->variable('avatar_gravatar_height', 0);
+ if (empty($row['avatar']))
+ {
+ return false;
+ }
+
if (!function_exists('validate_data'))
{
require($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext);
diff --git a/phpBB/phpbb/avatar/driver/local.php b/phpBB/phpbb/avatar/driver/local.php
index ff1996854b..07b3ed59de 100644
--- a/phpBB/phpbb/avatar/driver/local.php
+++ b/phpBB/phpbb/avatar/driver/local.php
@@ -120,7 +120,6 @@ class local extends \phpbb\avatar\driver\driver
if (empty($category) || empty($file))
{
- $error[] = 'NO_AVATAR_SELECTED';
return false;
}
diff --git a/phpBB/phpbb/avatar/driver/remote.php b/phpBB/phpbb/avatar/driver/remote.php
index 455ddebf62..1bd7f6c927 100644
--- a/phpBB/phpbb/avatar/driver/remote.php
+++ b/phpBB/phpbb/avatar/driver/remote.php
@@ -53,6 +53,11 @@ class remote extends \phpbb\avatar\driver\driver
$width = $request->variable('avatar_remote_width', 0);
$height = $request->variable('avatar_remote_height', 0);
+ if (empty($url))
+ {
+ return false;
+ }
+
if (!preg_match('#^(http|https|ftp)://#i', $url))
{
$url = 'http://' . $url;
diff --git a/phpBB/phpbb/avatar/driver/upload.php b/phpBB/phpbb/avatar/driver/upload.php
index c43004f340..003b23659f 100644
--- a/phpBB/phpbb/avatar/driver/upload.php
+++ b/phpBB/phpbb/avatar/driver/upload.php
@@ -19,6 +19,31 @@ namespace phpbb\avatar\driver;
class upload extends \phpbb\avatar\driver\driver
{
/**
+ * @var \phpbb\mimetype\guesser
+ */
+ protected $mimetype_guesser;
+
+ /**
+ * Construct a driver object
+ *
+ * @param \phpbb\config\config $config phpBB configuration
+ * @param string $phpbb_root_path Path to the phpBB root
+ * @param string $php_ext PHP file extension
+ * @param \phpbb_path_helper $path_helper phpBB path helper
+ * @param \phpbb\mimetype\guesser $mimetype_guesser Mimetype guesser
+ * @param \phpbb\cache\driver\driver_interface $cache Cache driver
+ */
+ public function __construct(\phpbb\config\config $config, $phpbb_root_path, $php_ext, \phpbb\path_helper $path_helper, \phpbb\mimetype\guesser $mimetype_guesser, \phpbb\cache\driver\driver_interface $cache = null)
+ {
+ $this->config = $config;
+ $this->phpbb_root_path = $phpbb_root_path;
+ $this->php_ext = $php_ext;
+ $this->path_helper = $path_helper;
+ $this->mimetype_guesser = $mimetype_guesser;
+ $this->cache = $cache;
+ }
+
+ /**
* {@inheritdoc}
*/
public function get_data($row, $ignore_config = false)
@@ -70,7 +95,7 @@ class upload extends \phpbb\avatar\driver\driver
if (!empty($upload_file['name']))
{
- $file = $upload->form_upload('avatar_upload_file');
+ $file = $upload->form_upload('avatar_upload_file', $this->mimetype_guesser);
}
else if (!empty($this->config['allow_avatar_remote_upload']) && !empty($url))
{
@@ -100,11 +125,10 @@ class upload extends \phpbb\avatar\driver\driver
return false;
}
- $file = $upload->remote_upload($url);
+ $file = $upload->remote_upload($url, $this->mimetype_guesser);
}
else
{
- $error[] = 'NO_AVATAR_SELECTED';
return false;
}
diff --git a/phpBB/phpbb/avatar/manager.php b/phpBB/phpbb/avatar/manager.php
index 7cf136be2c..42ae61a9a2 100644
--- a/phpBB/phpbb/avatar/manager.php
+++ b/phpBB/phpbb/avatar/manager.php
@@ -41,8 +41,8 @@ class manager
static protected $default_row = array(
'avatar' => '',
'avatar_type' => '',
- 'avatar_width' => '',
- 'avatar_height' => '',
+ 'avatar_width' => 0,
+ 'avatar_height' => 0,
);
/**
@@ -307,4 +307,36 @@ class manager
return $error;
}
+
+ /**
+ * Handle deleting avatars
+ *
+ * @param \phpbb\db\driver\driver_interface $db phpBB dbal
+ * @param \phpbb\user $user phpBB user object
+ * @param array $avatar_data Cleaned user data containing the user's
+ * avatar data
+ * @param string $table Database table from which the avatar should be deleted
+ * @param string $prefix Prefix of user data columns in database
+ * @return null
+ */
+ public function handle_avatar_delete(\phpbb\db\driver\driver_interface $db, \phpbb\user $user, $avatar_data, $table, $prefix)
+ {
+ if ($driver = $this->get_driver($avatar_data['avatar_type']))
+ {
+ $driver->delete($avatar_data);
+ }
+
+ $result = self::$default_row;
+
+ foreach ($result as $key => $value)
+ {
+ $result[$prefix . $key] = $value;
+ unset($result[$key]);
+ }
+
+ $sql = 'UPDATE ' . $table . '
+ SET ' . $db->sql_build_array('UPDATE', $result) . '
+ WHERE ' . $prefix . 'id = ' . (int) $avatar_data['id'];
+ $db->sql_query($sql);
+ }
}
diff --git a/phpBB/phpbb/cache/driver/base.php b/phpBB/phpbb/cache/driver/base.php
index 685cdc4e57..4c20ad916d 100644
--- a/phpBB/phpbb/cache/driver/base.php
+++ b/phpBB/phpbb/cache/driver/base.php
@@ -15,4 +15,217 @@ namespace phpbb\cache\driver;
abstract class base implements \phpbb\cache\driver\driver_interface
{
+ var $vars = array();
+ var $is_modified = false;
+
+ var $sql_rowset = array();
+ var $sql_row_pointer = array();
+ var $cache_dir = '';
+
+ /**
+ * {@inheritDoc}
+ */
+ function purge()
+ {
+ // Purge all phpbb cache files
+ try
+ {
+ $iterator = new \DirectoryIterator($this->cache_dir);
+ }
+ catch (\Exception $e)
+ {
+ return;
+ }
+
+ foreach ($iterator as $fileInfo)
+ {
+ if ($fileInfo->isDot())
+ {
+ continue;
+ }
+ $filename = $fileInfo->getFilename();
+ if ($fileInfo->isDir())
+ {
+ $this->remove_dir($fileInfo->getPathname());
+ }
+ else if (strpos($filename, 'container_') === 0 ||
+ strpos($filename, 'url_matcher') === 0 ||
+ strpos($filename, 'sql_') === 0 ||
+ strpos($filename, 'data_') === 0)
+ {
+ $this->remove_file($fileInfo->getPathname());
+ }
+ }
+
+ unset($this->vars);
+ unset($this->sql_rowset);
+ unset($this->sql_row_pointer);
+
+ $this->vars = array();
+ $this->sql_rowset = array();
+ $this->sql_row_pointer = array();
+
+ $this->is_modified = false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ function unload()
+ {
+ $this->save();
+ unset($this->vars);
+ unset($this->sql_rowset);
+ unset($this->sql_row_pointer);
+
+ $this->vars = array();
+ $this->sql_rowset = array();
+ $this->sql_row_pointer = array();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ function sql_load($query)
+ {
+ // Remove extra spaces and tabs
+ $query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
+
+ if (($rowset = $this->_read('sql_' . md5($query))) === false)
+ {
+ return false;
+ }
+
+ $query_id = sizeof($this->sql_rowset);
+ $this->sql_rowset[$query_id] = $rowset;
+ $this->sql_row_pointer[$query_id] = 0;
+
+ return $query_id;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ function sql_exists($query_id)
+ {
+ return isset($this->sql_rowset[$query_id]);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ function sql_fetchrow($query_id)
+ {
+ if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id]))
+ {
+ return $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++];
+ }
+
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ function sql_fetchfield($query_id, $field)
+ {
+ if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id]))
+ {
+ return (isset($this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field])) ? $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++][$field] : false;
+ }
+
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ function sql_rowseek($rownum, $query_id)
+ {
+ if ($rownum >= sizeof($this->sql_rowset[$query_id]))
+ {
+ return false;
+ }
+
+ $this->sql_row_pointer[$query_id] = $rownum;
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ function sql_freeresult($query_id)
+ {
+ if (!isset($this->sql_rowset[$query_id]))
+ {
+ return false;
+ }
+
+ unset($this->sql_rowset[$query_id]);
+ unset($this->sql_row_pointer[$query_id]);
+
+ return true;
+ }
+
+ /**
+ * Removes/unlinks file
+ *
+ * @param string $filename Filename to remove
+ * @param bool $check Check file permissions
+ * @return bool True if the file was successfully removed, otherwise false
+ */
+ function remove_file($filename, $check = false)
+ {
+ if (!function_exists('phpbb_is_writable'))
+ {
+ global $phpbb_root_path, $phpEx;
+ include($phpbb_root_path . 'includes/functions.' . $phpEx);
+ }
+
+ if ($check && !phpbb_is_writable($this->cache_dir))
+ {
+ // E_USER_ERROR - not using language entry - intended.
+ trigger_error('Unable to remove files within ' . $this->cache_dir . '. Please check directory permissions.', E_USER_ERROR);
+ }
+
+ return @unlink($filename);
+ }
+
+ /**
+ * Remove directory
+ *
+ * @param string $dir Directory to remove
+ *
+ * @return null
+ */
+ protected function remove_dir($dir)
+ {
+ try
+ {
+ $iterator = new \DirectoryIterator($dir);
+ }
+ catch (\Exception $e)
+ {
+ return;
+ }
+
+ foreach ($iterator as $fileInfo)
+ {
+ if ($fileInfo->isDot())
+ {
+ continue;
+ }
+
+ if ($fileInfo->isDir())
+ {
+ $this->remove_dir($fileInfo->getPathname());
+ }
+ else
+ {
+ $this->remove_file($fileInfo->getPathname());
+ }
+ }
+
+ @rmdir($dir);
+ }
}
diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php
index b32af32d25..fd5bce4515 100644
--- a/phpBB/phpbb/cache/driver/file.php
+++ b/phpBB/phpbb/cache/driver/file.php
@@ -18,13 +18,7 @@ namespace phpbb\cache\driver;
*/
class file extends \phpbb\cache\driver\base
{
- var $vars = array();
var $var_expires = array();
- var $is_modified = false;
-
- var $sql_rowset = array();
- var $sql_row_pointer = array();
- var $cache_dir = '';
/**
* Set cache path
@@ -50,16 +44,9 @@ class file extends \phpbb\cache\driver\base
*/
function unload()
{
- $this->save();
- unset($this->vars);
+ parent::unload();
unset($this->var_expires);
- unset($this->sql_rowset);
- unset($this->sql_row_pointer);
-
- $this->vars = array();
$this->var_expires = array();
- $this->sql_rowset = array();
- $this->sql_row_pointer = array();
}
/**
@@ -166,8 +153,6 @@ class file extends \phpbb\cache\driver\base
{
if ($var_name[0] == '_')
{
- global $phpEx;
-
if (!$this->_exists($var_name))
{
return false;
@@ -203,85 +188,8 @@ class file extends \phpbb\cache\driver\base
*/
function purge()
{
- // Purge all phpbb cache files
- try
- {
- $iterator = new \DirectoryIterator($this->cache_dir);
- }
- catch (Exception $e)
- {
- return;
- }
-
- foreach ($iterator as $fileInfo)
- {
- if ($fileInfo->isDot())
- {
- continue;
- }
- $filename = $fileInfo->getFilename();
- if ($fileInfo->isDir())
- {
- $this->remove_dir($fileInfo->getPathname());
- }
- else if (strpos($filename, 'container_') === 0 ||
- strpos($filename, 'url_matcher') === 0 ||
- strpos($filename, 'sql_') === 0 ||
- strpos($filename, 'data_') === 0)
- {
- $this->remove_file($fileInfo->getPathname());
- }
- }
-
- unset($this->vars);
- unset($this->var_expires);
- unset($this->sql_rowset);
- unset($this->sql_row_pointer);
-
- $this->vars = array();
+ parent::purge();
$this->var_expires = array();
- $this->sql_rowset = array();
- $this->sql_row_pointer = array();
-
- $this->is_modified = false;
- }
-
- /**
- * Remove directory
- *
- * @param string $dir Directory to remove
- *
- * @return null
- */
- protected function remove_dir($dir)
- {
- try
- {
- $iterator = new \DirectoryIterator($dir);
- }
- catch (Exception $e)
- {
- return;
- }
-
- foreach ($iterator as $fileInfo)
- {
- if ($fileInfo->isDot())
- {
- continue;
- }
-
- if ($fileInfo->isDir())
- {
- $this->remove_dir($fileInfo->getPathname());
- }
- else
- {
- $this->remove_file($fileInfo->getPathname());
- }
- }
-
- @rmdir($dir);
}
/**
@@ -392,26 +300,6 @@ class file extends \phpbb\cache\driver\base
/**
* {@inheritDoc}
*/
- function sql_load($query)
- {
- // Remove extra spaces and tabs
- $query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
-
- if (($rowset = $this->_read('sql_' . md5($query))) === false)
- {
- return false;
- }
-
- $query_id = sizeof($this->sql_rowset);
- $this->sql_rowset[$query_id] = $rowset;
- $this->sql_row_pointer[$query_id] = 0;
-
- return $query_id;
- }
-
- /**
- * {@inheritDoc}
- */
function sql_save(\phpbb\db\driver\driver_interface $db, $query, $query_result, $ttl)
{
// Remove extra spaces and tabs
@@ -436,70 +324,6 @@ class file extends \phpbb\cache\driver\base
}
/**
- * {@inheritDoc}
- */
- function sql_exists($query_id)
- {
- return isset($this->sql_rowset[$query_id]);
- }
-
- /**
- * {@inheritDoc}
- */
- function sql_fetchrow($query_id)
- {
- if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id]))
- {
- return $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++];
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- function sql_fetchfield($query_id, $field)
- {
- if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id]))
- {
- return (isset($this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field])) ? $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++][$field] : false;
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- function sql_rowseek($rownum, $query_id)
- {
- if ($rownum >= sizeof($this->sql_rowset[$query_id]))
- {
- return false;
- }
-
- $this->sql_row_pointer[$query_id] = $rownum;
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- function sql_freeresult($query_id)
- {
- if (!isset($this->sql_rowset[$query_id]))
- {
- return false;
- }
-
- unset($this->sql_rowset[$query_id]);
- unset($this->sql_row_pointer[$query_id]);
-
- return true;
- }
-
- /**
* Read cached data from a specified file
*
* @access private
@@ -760,28 +584,4 @@ class file extends \phpbb\cache\driver\base
return $return_value;
}
-
- /**
- * Removes/unlinks file
- *
- * @param string $filename Filename to remove
- * @param bool $check Check file permissions
- * @return bool True if the file was successfully removed, otherwise false
- */
- function remove_file($filename, $check = false)
- {
- if (!function_exists('phpbb_is_writable'))
- {
- global $phpbb_root_path, $phpEx;
- include($phpbb_root_path . 'includes/functions.' . $phpEx);
- }
-
- if ($check && !phpbb_is_writable($this->cache_dir))
- {
- // E_USER_ERROR - not using language entry - intended.
- trigger_error('Unable to remove files within ' . $this->cache_dir . '. Please check directory permissions.', E_USER_ERROR);
- }
-
- return @unlink($filename);
- }
}
diff --git a/phpBB/phpbb/cache/driver/memory.php b/phpBB/phpbb/cache/driver/memory.php
index 5dee375192..56308be8da 100644
--- a/phpBB/phpbb/cache/driver/memory.php
+++ b/phpBB/phpbb/cache/driver/memory.php
@@ -20,13 +20,6 @@ abstract class memory extends \phpbb\cache\driver\base
{
var $key_prefix;
- var $vars = array();
- var $is_modified = false;
-
- var $sql_rowset = array();
- var $sql_row_pointer = array();
- var $cache_dir = '';
-
/**
* Set cache path
*/
@@ -71,21 +64,6 @@ abstract class memory extends \phpbb\cache\driver\base
/**
* {@inheritDoc}
*/
- function unload()
- {
- $this->save();
- unset($this->vars);
- unset($this->sql_rowset);
- unset($this->sql_row_pointer);
-
- $this->vars = array();
- $this->sql_rowset = array();
- $this->sql_row_pointer = array();
- }
-
- /**
- * {@inheritDoc}
- */
function save()
{
if (!$this->is_modified)
@@ -147,47 +125,6 @@ abstract class memory extends \phpbb\cache\driver\base
/**
* {@inheritDoc}
*/
- function purge()
- {
- // Purge all phpbb cache files
- $dir = @opendir($this->cache_dir);
-
- if (!$dir)
- {
- return;
- }
-
- while (($entry = readdir($dir)) !== false)
- {
- if (strpos($entry, 'container_') !== 0 &&
- strpos($entry, 'url_matcher') !== 0 &&
- strpos($entry, 'sql_') !== 0 &&
- strpos($entry, 'data_') !== 0 &&
- strpos($entry, 'ctpl_') !== 0 &&
- strpos($entry, 'tpl_') !== 0)
- {
- continue;
- }
-
- $this->remove_file($this->cache_dir . $entry);
- }
- closedir($dir);
-
- unset($this->vars);
- unset($this->sql_rowset);
- unset($this->sql_row_pointer);
-
- $this->vars = array();
- $this->sql_rowset = array();
- $this->sql_row_pointer = array();
-
- $this->is_modified = false;
- }
-
-
- /**
- * {@inheritDoc}
- */
function destroy($var_name, $table = '')
{
if ($var_name == 'sql' && !empty($table))
@@ -262,26 +199,6 @@ abstract class memory extends \phpbb\cache\driver\base
/**
* {@inheritDoc}
*/
- function sql_load($query)
- {
- // Remove extra spaces and tabs
- $query = preg_replace('/[\n\r\s\t]+/', ' ', $query);
- $query_id = sizeof($this->sql_rowset);
-
- if (($result = $this->_read('sql_' . md5($query))) === false)
- {
- return false;
- }
-
- $this->sql_rowset[$query_id] = $result;
- $this->sql_row_pointer[$query_id] = 0;
-
- return $query_id;
- }
-
- /**
- * {@inheritDoc}
- */
function sql_save(\phpbb\db\driver\driver_interface $db, $query, $query_result, $ttl)
{
// Remove extra spaces and tabs
@@ -338,94 +255,6 @@ abstract class memory extends \phpbb\cache\driver\base
}
/**
- * {@inheritDoc}
- */
- function sql_exists($query_id)
- {
- return isset($this->sql_rowset[$query_id]);
- }
-
- /**
- * {@inheritDoc}
- */
- function sql_fetchrow($query_id)
- {
- if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id]))
- {
- return $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++];
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- function sql_fetchfield($query_id, $field)
- {
- if ($this->sql_row_pointer[$query_id] < sizeof($this->sql_rowset[$query_id]))
- {
- return (isset($this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]][$field])) ? $this->sql_rowset[$query_id][$this->sql_row_pointer[$query_id]++][$field] : false;
- }
-
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
- function sql_rowseek($rownum, $query_id)
- {
- if ($rownum >= sizeof($this->sql_rowset[$query_id]))
- {
- return false;
- }
-
- $this->sql_row_pointer[$query_id] = $rownum;
- return true;
- }
-
- /**
- * {@inheritDoc}
- */
- function sql_freeresult($query_id)
- {
- if (!isset($this->sql_rowset[$query_id]))
- {
- return false;
- }
-
- unset($this->sql_rowset[$query_id]);
- unset($this->sql_row_pointer[$query_id]);
-
- return true;
- }
-
- /**
- * Removes/unlinks file
- *
- * @param string $filename Filename to remove
- * @param bool $check Check file permissions
- * @return bool True if the file was successfully removed, otherwise false
- */
- function remove_file($filename, $check = false)
- {
- if (!function_exists('phpbb_is_writable'))
- {
- global $phpbb_root_path, $phpEx;
- include($phpbb_root_path . 'includes/functions.' . $phpEx);
- }
-
- if ($check && !phpbb_is_writable($this->cache_dir))
- {
- // E_USER_ERROR - not using language entry - intended.
- trigger_error('Unable to remove files within ' . $this->cache_dir . '. Please check directory permissions.', E_USER_ERROR);
- }
-
- return @unlink($filename);
- }
-
- /**
* Check if a cache var exists
*
* @access protected
diff --git a/phpBB/phpbb/cache/service.php b/phpBB/phpbb/cache/service.php
index d6bf150384..56727c2ad5 100644
--- a/phpBB/phpbb/cache/service.php
+++ b/phpBB/phpbb/cache/service.php
@@ -47,7 +47,7 @@ class service
protected $phpbb_root_path;
/**
- * PHP extension.
+ * PHP file extension.
*
* @var string
*/
@@ -60,7 +60,7 @@ class service
* @param \phpbb\config\config $config The config
* @param \phpbb\db\driver\driver_interface $db Database connection
* @param string $phpbb_root_path Root path
- * @param string $php_ext PHP extension
+ * @param string $php_ext PHP file extension
*/
public function __construct(\phpbb\cache\driver\driver_interface $driver, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, $phpbb_root_path, $php_ext)
{
@@ -168,18 +168,12 @@ class service
{
if ($row['rank_special'])
{
- $ranks['special'][$row['rank_id']] = array(
- 'rank_title' => $row['rank_title'],
- 'rank_image' => $row['rank_image']
- );
+ unset($row['rank_min']);
+ $ranks['special'][$row['rank_id']] = $row;
}
else
{
- $ranks['normal'][] = array(
- 'rank_title' => $row['rank_title'],
- 'rank_min' => $row['rank_min'],
- 'rank_image' => $row['rank_image']
- );
+ $ranks['normal'][$row['rank_id']] = $row;
}
}
$this->db->sql_freeresult($result);
diff --git a/phpBB/phpbb/captcha/char_cube3d.php b/phpBB/phpbb/captcha/char_cube3d.php
new file mode 100644
index 0000000000..a712b16dce
--- /dev/null
+++ b/phpBB/phpbb/captcha/char_cube3d.php
@@ -0,0 +1,277 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\captcha;
+
+class char_cube3d
+{
+ var $bitmap;
+ var $bitmap_width;
+ var $bitmap_height;
+
+ var $basis_matrix = array(array(1, 0, 0), array(0, 1, 0), array(0, 0, 1));
+ var $abs_x = array(1, 0);
+ var $abs_y = array(0, 1);
+ var $x = 0;
+ var $y = 1;
+ var $z = 2;
+ var $letter = '';
+
+ /**
+ */
+ function __construct(&$bitmaps, $letter)
+ {
+ $this->bitmap = $bitmaps['data'][$letter];
+ $this->bitmap_width = $bitmaps['width'];
+ $this->bitmap_height = $bitmaps['height'];
+
+ $this->basis_matrix[0][0] = mt_rand(-600, 600);
+ $this->basis_matrix[0][1] = mt_rand(-600, 600);
+ $this->basis_matrix[0][2] = (mt_rand(0, 1) * 2000) - 1000;
+ $this->basis_matrix[1][0] = mt_rand(-1000, 1000);
+ $this->basis_matrix[1][1] = mt_rand(-1000, 1000);
+ $this->basis_matrix[1][2] = mt_rand(-1000, 1000);
+
+ $this->normalize($this->basis_matrix[0]);
+ $this->normalize($this->basis_matrix[1]);
+ $this->basis_matrix[2] = $this->cross_product($this->basis_matrix[0], $this->basis_matrix[1]);
+ $this->normalize($this->basis_matrix[2]);
+
+ // $this->basis_matrix[1] might not be (probably isn't) orthogonal to $basis_matrix[0]
+ $this->basis_matrix[1] = $this->cross_product($this->basis_matrix[0], $this->basis_matrix[2]);
+ $this->normalize($this->basis_matrix[1]);
+
+ // Make sure our cube is facing into the canvas (assuming +z == in)
+ for ($i = 0; $i < 3; ++$i)
+ {
+ if ($this->basis_matrix[$i][2] < 0)
+ {
+ $this->basis_matrix[$i][0] *= -1;
+ $this->basis_matrix[$i][1] *= -1;
+ $this->basis_matrix[$i][2] *= -1;
+ }
+ }
+
+ // Force our "z" basis vector to be the one with greatest absolute z value
+ $this->x = 0;
+ $this->y = 1;
+ $this->z = 2;
+
+ // Swap "y" with "z"
+ if ($this->basis_matrix[1][2] > $this->basis_matrix[2][2])
+ {
+ $this->z = 1;
+ $this->y = 2;
+ }
+
+ // Swap "x" with "z"
+ if ($this->basis_matrix[0][2] > $this->basis_matrix[$this->z][2])
+ {
+ $this->x = $this->z;
+ $this->z = 0;
+ }
+
+ // Still need to determine which of $x,$y are which.
+ // wrong orientation if y's y-component is less than it's x-component
+ // likewise if x's x-component is less than it's y-component
+ // if they disagree, go with the one with the greater weight difference.
+ // rotate if positive
+ $weight = (abs($this->basis_matrix[$this->x][1]) - abs($this->basis_matrix[$this->x][0])) + (abs($this->basis_matrix[$this->y][0]) - abs($this->basis_matrix[$this->y][1]));
+
+ // Swap "x" with "y"
+ if ($weight > 0)
+ {
+ list($this->x, $this->y) = array($this->y, $this->x);
+ }
+
+ $this->abs_x = array($this->basis_matrix[$this->x][0], $this->basis_matrix[$this->x][1]);
+ $this->abs_y = array($this->basis_matrix[$this->y][0], $this->basis_matrix[$this->y][1]);
+
+ if ($this->abs_x[0] < 0)
+ {
+ $this->abs_x[0] *= -1;
+ $this->abs_x[1] *= -1;
+ }
+
+ if ($this->abs_y[1] > 0)
+ {
+ $this->abs_y[0] *= -1;
+ $this->abs_y[1] *= -1;
+ }
+
+ $this->letter = $letter;
+ }
+
+ /**
+ * Draw a character
+ */
+ function drawchar($scale, $xoff, $yoff, $img, $background, $colours)
+ {
+ $width = $this->bitmap_width;
+ $height = $this->bitmap_height;
+ $bitmap = $this->bitmap;
+
+ $colour1 = $colours[array_rand($colours)];
+ $colour2 = $colours[array_rand($colours)];
+
+ $swapx = ($this->basis_matrix[$this->x][0] > 0);
+ $swapy = ($this->basis_matrix[$this->y][1] < 0);
+
+ for ($y = 0; $y < $height; ++$y)
+ {
+ for ($x = 0; $x < $width; ++$x)
+ {
+ $xp = ($swapx) ? ($width - $x - 1) : $x;
+ $yp = ($swapy) ? ($height - $y - 1) : $y;
+
+ if ($bitmap[$height - $yp - 1][$xp])
+ {
+ $dx = $this->scale($this->abs_x, ($xp - ($swapx ? ($width / 2) : ($width / 2) - 1)) * $scale);
+ $dy = $this->scale($this->abs_y, ($yp - ($swapy ? ($height / 2) : ($height / 2) - 1)) * $scale);
+ $xo = $xoff + $dx[0] + $dy[0];
+ $yo = $yoff + $dx[1] + $dy[1];
+
+ $origin = array(0, 0, 0);
+ $xvec = $this->scale($this->basis_matrix[$this->x], $scale);
+ $yvec = $this->scale($this->basis_matrix[$this->y], $scale);
+ $face_corner = $this->sum2($xvec, $yvec);
+
+ $zvec = $this->scale($this->basis_matrix[$this->z], $scale);
+ $x_corner = $this->sum2($xvec, $zvec);
+ $y_corner = $this->sum2($yvec, $zvec);
+
+ imagefilledpolygon($img, $this->gen_poly($xo, $yo, $origin, $xvec, $x_corner,$zvec), 4, $colour1);
+ imagefilledpolygon($img, $this->gen_poly($xo, $yo, $origin, $yvec, $y_corner,$zvec), 4, $colour2);
+
+ $face = $this->gen_poly($xo, $yo, $origin, $xvec, $face_corner, $yvec);
+
+ imagefilledpolygon($img, $face, 4, $background);
+ imagepolygon($img, $face, 4, $colour1);
+ }
+ }
+ }
+ }
+
+ /*
+ * return a roughly acceptable range of sizes for rendering with this texttype
+ */
+ function range()
+ {
+ return array(3, 4);
+ }
+
+ /**
+ * Vector length
+ */
+ function vectorlen($vector)
+ {
+ return sqrt(pow($vector[0], 2) + pow($vector[1], 2) + pow($vector[2], 2));
+ }
+
+ /**
+ * Normalize
+ */
+ function normalize(&$vector, $length = 1)
+ {
+ $length = (( $length < 1) ? 1 : $length);
+ $length /= $this->vectorlen($vector);
+ $vector[0] *= $length;
+ $vector[1] *= $length;
+ $vector[2] *= $length;
+ }
+
+ /**
+ */
+ function cross_product($vector1, $vector2)
+ {
+ $retval = array(0, 0, 0);
+ $retval[0] = (($vector1[1] * $vector2[2]) - ($vector1[2] * $vector2[1]));
+ $retval[1] = -(($vector1[0] * $vector2[2]) - ($vector1[2] * $vector2[0]));
+ $retval[2] = (($vector1[0] * $vector2[1]) - ($vector1[1] * $vector2[0]));
+
+ return $retval;
+ }
+
+ /**
+ */
+ function sum($vector1, $vector2)
+ {
+ return array($vector1[0] + $vector2[0], $vector1[1] + $vector2[1], $vector1[2] + $vector2[2]);
+ }
+
+ /**
+ */
+ function sum2($vector1, $vector2)
+ {
+ return array($vector1[0] + $vector2[0], $vector1[1] + $vector2[1]);
+ }
+
+ /**
+ */
+ function scale($vector, $length)
+ {
+ if (sizeof($vector) == 2)
+ {
+ return array($vector[0] * $length, $vector[1] * $length);
+ }
+
+ return array($vector[0] * $length, $vector[1] * $length, $vector[2] * $length);
+ }
+
+ /**
+ */
+ function gen_poly($xoff, $yoff, &$vec1, &$vec2, &$vec3, &$vec4)
+ {
+ $poly = array();
+ $poly[0] = $xoff + $vec1[0];
+ $poly[1] = $yoff + $vec1[1];
+ $poly[2] = $xoff + $vec2[0];
+ $poly[3] = $yoff + $vec2[1];
+ $poly[4] = $xoff + $vec3[0];
+ $poly[5] = $yoff + $vec3[1];
+ $poly[6] = $xoff + $vec4[0];
+ $poly[7] = $yoff + $vec4[1];
+
+ return $poly;
+ }
+
+ /**
+ * dimensions
+ */
+ function dimensions($size)
+ {
+ $xn = $this->scale($this->basis_matrix[$this->x], -($this->bitmap_width / 2) * $size);
+ $xp = $this->scale($this->basis_matrix[$this->x], ($this->bitmap_width / 2) * $size);
+ $yn = $this->scale($this->basis_matrix[$this->y], -($this->bitmap_height / 2) * $size);
+ $yp = $this->scale($this->basis_matrix[$this->y], ($this->bitmap_height / 2) * $size);
+
+ $p = array();
+ $p[0] = $this->sum2($xn, $yn);
+ $p[1] = $this->sum2($xp, $yn);
+ $p[2] = $this->sum2($xp, $yp);
+ $p[3] = $this->sum2($xn, $yp);
+
+ $min_x = $max_x = $p[0][0];
+ $min_y = $max_y = $p[0][1];
+
+ for ($i = 1; $i < 4; ++$i)
+ {
+ $min_x = ($min_x > $p[$i][0]) ? $p[$i][0] : $min_x;
+ $min_y = ($min_y > $p[$i][1]) ? $p[$i][1] : $min_y;
+ $max_x = ($max_x < $p[$i][0]) ? $p[$i][0] : $max_x;
+ $max_y = ($max_y < $p[$i][1]) ? $p[$i][1] : $max_y;
+ }
+
+ return array($min_x, $min_y, $max_x, $max_y);
+ }
+}
diff --git a/phpBB/phpbb/captcha/colour_manager.php b/phpBB/phpbb/captcha/colour_manager.php
new file mode 100644
index 0000000000..6ca3c3fd2c
--- /dev/null
+++ b/phpBB/phpbb/captcha/colour_manager.php
@@ -0,0 +1,527 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\captcha;
+
+class colour_manager
+{
+ var $img;
+ var $mode;
+ var $colours;
+ var $named_colours;
+
+ /**
+ * Create the colour manager, link it to the image resource
+ */
+ function __construct($img, $background = false, $mode = 'ahsv')
+ {
+ $this->img = $img;
+ $this->mode = $mode;
+ $this->colours = array();
+ $this->named_colours = array();
+
+ if ($background !== false)
+ {
+ $bg = $this->allocate_named('background', $background);
+ imagefill($this->img, 0, 0, $bg);
+ }
+ }
+
+ /**
+ * Lookup a named colour resource
+ */
+ function get_resource($named_colour)
+ {
+ if (isset($this->named_colours[$named_colour]))
+ {
+ return $this->named_colours[$named_colour];
+ }
+
+ if (isset($this->named_rgb[$named_colour]))
+ {
+ return $this->allocate_named($named_colour, $this->named_rgb[$named_colour], 'rgb');
+ }
+
+ return false;
+ }
+
+ /**
+ * Assign a name to a colour resource
+ */
+ function name_colour($name, $resource)
+ {
+ $this->named_colours[$name] = $resource;
+ }
+
+ /**
+ * names and allocates a colour resource
+ */
+ function allocate_named($name, $colour, $mode = false)
+ {
+ $resource = $this->allocate($colour, $mode);
+
+ if ($resource !== false)
+ {
+ $this->name_colour($name, $resource);
+ }
+ return $resource;
+ }
+
+ /**
+ * allocates a specified colour into the image
+ */
+ function allocate($colour, $mode = false)
+ {
+ if ($mode === false)
+ {
+ $mode = $this->mode;
+ }
+
+ if (!is_array($colour))
+ {
+ if (isset($this->named_rgb[$colour]))
+ {
+ return $this->allocate_named($colour, $this->named_rgb[$colour], 'rgb');
+ }
+
+ if (!is_int($colour))
+ {
+ return false;
+ }
+
+ $mode = 'rgb';
+ $colour = array(255 & ($colour >> 16), 255 & ($colour >> 8), 255 & $colour);
+ }
+
+ if (isset($colour['mode']))
+ {
+ $mode = $colour['mode'];
+ unset($colour['mode']);
+ }
+
+ if (isset($colour['random']))
+ {
+ unset($colour['random']);
+ // everything else is params
+ return $this->random_colour($colour, $mode);
+ }
+
+ $rgb = $this->model_convert($colour, $mode, 'rgb');
+ $store = ($this->mode == 'rgb') ? $rgb : $this->model_convert($colour, $mode, $this->mode);
+ $resource = imagecolorallocate($this->img, $rgb[0], $rgb[1], $rgb[2]);
+ $this->colours[$resource] = $store;
+
+ return $resource;
+ }
+
+ /**
+ * randomly generates a colour, with optional params
+ */
+ function random_colour($params = array(), $mode = false)
+ {
+ if ($mode === false)
+ {
+ $mode = $this->mode;
+ }
+
+ switch ($mode)
+ {
+ case 'rgb':
+ // @TODO random rgb generation. do we intend to do this, or is it just too tedious?
+ break;
+
+ case 'ahsv':
+ case 'hsv':
+ default:
+
+ $default_params = array(
+ 'hue_bias' => false, // degree / 'r'/'g'/'b'/'c'/'m'/'y' /'o'
+ 'hue_range' => false, // if hue bias, then difference range +/- from bias
+ 'min_saturation' => 30, // 0 - 100
+ 'max_saturation' => 80, // 0 - 100
+ 'min_value' => 30, // 0 - 100
+ 'max_value' => 80, // 0 - 100
+ );
+
+ $alt = ($mode == 'ahsv') ? true : false;
+ $params = array_merge($default_params, $params);
+
+ $min_hue = 0;
+ $max_hue = 359;
+ $min_saturation = max(0, $params['min_saturation']);
+ $max_saturation = min(100, $params['max_saturation']);
+ $min_value = max(0, $params['min_value']);
+ $max_value = min(100, $params['max_value']);
+
+ if ($params['hue_bias'] !== false)
+ {
+ if (is_numeric($params['hue_bias']))
+ {
+ $h = intval($params['hue_bias']) % 360;
+ }
+ else
+ {
+ switch ($params['hue_bias'])
+ {
+ case 'o':
+ $h = $alt ? 60 : 30;
+ break;
+
+ case 'y':
+ $h = $alt ? 120 : 60;
+ break;
+
+ case 'g':
+ $h = $alt ? 180 : 120;
+ break;
+
+ case 'c':
+ $h = $alt ? 210 : 180;
+ break;
+
+ case 'b':
+ $h = 240;
+ break;
+
+ case 'm':
+ $h = 300;
+ break;
+
+ case 'r':
+ default:
+ $h = 0;
+ break;
+ }
+ }
+
+ $min_hue = $h + 360;
+ $max_hue = $h + 360;
+
+ if ($params['hue_range'])
+ {
+ $min_hue -= min(180, $params['hue_range']);
+ $max_hue += min(180, $params['hue_range']);
+ }
+ }
+
+ $h = mt_rand($min_hue, $max_hue);
+ $s = mt_rand($min_saturation, $max_saturation);
+ $v = mt_rand($min_value, $max_value);
+
+ return $this->allocate(array($h, $s, $v), $mode);
+
+ break;
+ }
+ }
+
+ /**
+ */
+ function colour_scheme($resource, $include_original = true)
+ {
+ $mode = 'hsv';
+
+ if (($pre = $this->get_resource($resource)) !== false)
+ {
+ $resource = $pre;
+ }
+
+ $colour = $this->model_convert($this->colours[$resource], $this->mode, $mode);
+ $results = ($include_original) ? array($resource) : array();
+ $colour2 = $colour3 = $colour4 = $colour;
+ $colour2[0] += 150;
+ $colour3[0] += 180;
+ $colour4[0] += 210;
+
+ $results[] = $this->allocate($colour2, $mode);
+ $results[] = $this->allocate($colour3, $mode);
+ $results[] = $this->allocate($colour4, $mode);
+
+ return $results;
+ }
+
+ /**
+ */
+ function mono_range($resource, $count = 5, $include_original = true)
+ {
+ if (is_array($resource))
+ {
+ $results = array();
+ for ($i = 0, $size = sizeof($resource); $i < $size; ++$i)
+ {
+ $results = array_merge($results, $this->mono_range($resource[$i], $count, $include_original));
+ }
+ return $results;
+ }
+
+ $mode = (in_array($this->mode, array('hsv', 'ahsv'), true) ? $this->mode : 'ahsv');
+ if (($pre = $this->get_resource($resource)) !== false)
+ {
+ $resource = $pre;
+ }
+
+ $colour = $this->model_convert($this->colours[$resource], $this->mode, $mode);
+
+ $results = array();
+ if ($include_original)
+ {
+ $results[] = $resource;
+ $count--;
+ }
+
+ // This is a hard problem. I chicken out and try to maintain readability at the cost of less randomness.
+
+ while ($count > 0)
+ {
+ $colour[1] = ($colour[1] + mt_rand(40,60)) % 99;
+ $colour[2] = ($colour[2] + mt_rand(40,60));
+ $results[] = $this->allocate($colour, $mode);
+ $count--;
+ }
+ return $results;
+ }
+
+ /**
+ * Convert from one colour model to another
+ */
+ function model_convert($colour, $from_model, $to_model)
+ {
+ if ($from_model == $to_model)
+ {
+ return $colour;
+ }
+
+ switch ($to_model)
+ {
+ case 'hsv':
+
+ switch ($from_model)
+ {
+ case 'ahsv':
+ return $this->ah2h($colour);
+ break;
+
+ case 'rgb':
+ return $this->rgb2hsv($colour);
+ break;
+ }
+ break;
+
+ case 'ahsv':
+
+ switch ($from_model)
+ {
+ case 'hsv':
+ return $this->h2ah($colour);
+ break;
+
+ case 'rgb':
+ return $this->h2ah($this->rgb2hsv($colour));
+ break;
+ }
+ break;
+
+ case 'rgb':
+ switch ($from_model)
+ {
+ case 'hsv':
+ return $this->hsv2rgb($colour);
+ break;
+
+ case 'ahsv':
+ return $this->hsv2rgb($this->ah2h($colour));
+ break;
+ }
+ break;
+ }
+ return false;
+ }
+
+ /**
+ * Slightly altered from wikipedia's algorithm
+ */
+ function hsv2rgb($hsv)
+ {
+ $this->normalize_hue($hsv[0]);
+
+ $h = $hsv[0];
+ $s = min(1, max(0, $hsv[1] / 100));
+ $v = min(1, max(0, $hsv[2] / 100));
+
+ // calculate hue sector
+ $hi = floor($hsv[0] / 60);
+
+ // calculate opposite colour
+ $p = $v * (1 - $s);
+
+ // calculate distance between hex vertices
+ $f = ($h / 60) - $hi;
+
+ // coming in or going out?
+ if (!($hi & 1))
+ {
+ $f = 1 - $f;
+ }
+
+ // calculate adjacent colour
+ $q = $v * (1 - ($f * $s));
+
+ switch ($hi)
+ {
+ case 0:
+ $rgb = array($v, $q, $p);
+ break;
+
+ case 1:
+ $rgb = array($q, $v, $p);
+ break;
+
+ case 2:
+ $rgb = array($p, $v, $q);
+ break;
+
+ case 3:
+ $rgb = array($p, $q, $v);
+ break;
+
+ case 4:
+ $rgb = array($q, $p, $v);
+ break;
+
+ case 5:
+ $rgb = array($v, $p, $q);
+ break;
+
+ default:
+ return array(0, 0, 0);
+ break;
+ }
+
+ return array(255 * $rgb[0], 255 * $rgb[1], 255 * $rgb[2]);
+ }
+
+ /**
+ * (more than) Slightly altered from wikipedia's algorithm
+ */
+ function rgb2hsv($rgb)
+ {
+ $r = min(255, max(0, $rgb[0]));
+ $g = min(255, max(0, $rgb[1]));
+ $b = min(255, max(0, $rgb[2]));
+ $max = max($r, $g, $b);
+ $min = min($r, $g, $b);
+
+ $v = $max / 255;
+ $s = (!$max) ? 0 : 1 - ($min / $max);
+
+ // if max - min is 0, we want hue to be 0 anyway.
+ $h = $max - $min;
+
+ if ($h)
+ {
+ switch ($max)
+ {
+ case $g:
+ $h = 120 + (60 * ($b - $r) / $h);
+ break;
+
+ case $b:
+ $h = 240 + (60 * ($r - $g) / $h);
+ break;
+
+ case $r:
+ $h = 360 + (60 * ($g - $b) / $h);
+ break;
+ }
+ }
+ $this->normalize_hue($h);
+
+ return array($h, $s * 100, $v * 100);
+ }
+
+ /**
+ */
+ function normalize_hue(&$hue)
+ {
+ $hue %= 360;
+
+ if ($hue < 0)
+ {
+ $hue += 360;
+ }
+ }
+
+ /**
+ * Alternate hue to hue
+ */
+ function ah2h($ahue)
+ {
+ if (is_array($ahue))
+ {
+ $ahue[0] = $this->ah2h($ahue[0]);
+ return $ahue;
+ }
+ $this->normalize_hue($ahue);
+
+ // blue through red is already ok
+ if ($ahue >= 240)
+ {
+ return $ahue;
+ }
+
+ // ahue green is at 180
+ if ($ahue >= 180)
+ {
+ // return (240 - (2 * (240 - $ahue)));
+ return (2 * $ahue) - 240; // equivalent
+ }
+
+ // ahue yellow is at 120 (RYB rather than RGB)
+ if ($ahue >= 120)
+ {
+ return $ahue - 60;
+ }
+
+ return $ahue / 2;
+ }
+
+ /**
+ * hue to Alternate hue
+ */
+ function h2ah($hue)
+ {
+ if (is_array($hue))
+ {
+ $hue[0] = $this->h2ah($hue[0]);
+ return $hue;
+ }
+ $this->normalize_hue($hue);
+
+ // blue through red is already ok
+ if ($hue >= 240)
+ {
+ return $hue;
+ }
+ else if ($hue <= 60)
+ {
+ return $hue * 2;
+ }
+ else if ($hue <= 120)
+ {
+ return $hue + 60;
+ }
+ else
+ {
+ return ($hue + 240) / 2;
+ }
+ }
+}
diff --git a/phpBB/phpbb/captcha/factory.php b/phpBB/phpbb/captcha/factory.php
new file mode 100644
index 0000000000..dd44aca8bb
--- /dev/null
+++ b/phpBB/phpbb/captcha/factory.php
@@ -0,0 +1,88 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\captcha;
+
+class factory
+{
+ /**
+ * @var \Symfony\Component\DependencyInjection\ContainerInterface
+ */
+ private $container;
+
+ /**
+ * @var \phpbb\di\service_collection
+ */
+ private $plugins;
+
+ /**
+ * Constructor
+ *
+ * @param \Symfony\Component\DependencyInjection\ContainerInterface $container
+ * @param \phpbb\di\service_collection $plugins
+ */
+ public function __construct(\Symfony\Component\DependencyInjection\ContainerInterface $container, \phpbb\di\service_collection $plugins)
+ {
+ $this->container = $container;
+ $this->plugins = $plugins;
+ }
+
+ /**
+ * Return a new instance of a given plugin
+ *
+ * @param $name
+ * @return object
+ */
+ public function get_instance($name)
+ {
+ return $this->container->get($name);
+ }
+
+ /**
+ * Call the garbage collector
+ *
+ * @param string $name The name to the captcha service.
+ */
+ function garbage_collect($name)
+ {
+ $captcha = $this->get_instance($name);
+ $captcha->garbage_collect(0);
+ }
+
+ /**
+ * Return a list of all registered CAPTCHA plugins
+ *
+ * @returns array
+ */
+ function get_captcha_types()
+ {
+ $captchas = array(
+ 'available' => array(),
+ 'unavailable' => array(),
+ );
+
+ foreach ($this->plugins as $plugin => $plugin_instance)
+ {
+ if ($plugin_instance->is_available())
+ {
+ $captchas['available'][$plugin] = $plugin_instance->get_name();
+ }
+ else
+ {
+ $captchas['unavailable'][$plugin] = $plugin_instance->get_name();
+ }
+ }
+
+ return $captchas;
+ }
+}
diff --git a/phpBB/includes/captcha/captcha_gd.php b/phpBB/phpbb/captcha/gd.php
index 7e37cc33f9..652df28f8a 100644
--- a/phpBB/includes/captcha/captcha_gd.php
+++ b/phpBB/phpbb/captcha/gd.php
@@ -11,15 +11,9 @@
*
*/
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
+namespace phpbb\captcha;
-class captcha
+class gd
{
var $width = 360;
var $height = 96;
@@ -1851,779 +1845,3 @@ class captcha
);
}
}
-
-class char_cube3d
-{
- var $bitmap;
- var $bitmap_width;
- var $bitmap_height;
-
- var $basis_matrix = array(array(1, 0, 0), array(0, 1, 0), array(0, 0, 1));
- var $abs_x = array(1, 0);
- var $abs_y = array(0, 1);
- var $x = 0;
- var $y = 1;
- var $z = 2;
- var $letter = '';
-
- /**
- */
- function char_cube3d(&$bitmaps, $letter)
- {
- $this->bitmap = $bitmaps['data'][$letter];
- $this->bitmap_width = $bitmaps['width'];
- $this->bitmap_height = $bitmaps['height'];
-
- $this->basis_matrix[0][0] = mt_rand(-600, 600);
- $this->basis_matrix[0][1] = mt_rand(-600, 600);
- $this->basis_matrix[0][2] = (mt_rand(0, 1) * 2000) - 1000;
- $this->basis_matrix[1][0] = mt_rand(-1000, 1000);
- $this->basis_matrix[1][1] = mt_rand(-1000, 1000);
- $this->basis_matrix[1][2] = mt_rand(-1000, 1000);
-
- $this->normalize($this->basis_matrix[0]);
- $this->normalize($this->basis_matrix[1]);
- $this->basis_matrix[2] = $this->cross_product($this->basis_matrix[0], $this->basis_matrix[1]);
- $this->normalize($this->basis_matrix[2]);
-
- // $this->basis_matrix[1] might not be (probably isn't) orthogonal to $basis_matrix[0]
- $this->basis_matrix[1] = $this->cross_product($this->basis_matrix[0], $this->basis_matrix[2]);
- $this->normalize($this->basis_matrix[1]);
-
- // Make sure our cube is facing into the canvas (assuming +z == in)
- for ($i = 0; $i < 3; ++$i)
- {
- if ($this->basis_matrix[$i][2] < 0)
- {
- $this->basis_matrix[$i][0] *= -1;
- $this->basis_matrix[$i][1] *= -1;
- $this->basis_matrix[$i][2] *= -1;
- }
- }
-
- // Force our "z" basis vector to be the one with greatest absolute z value
- $this->x = 0;
- $this->y = 1;
- $this->z = 2;
-
- // Swap "y" with "z"
- if ($this->basis_matrix[1][2] > $this->basis_matrix[2][2])
- {
- $this->z = 1;
- $this->y = 2;
- }
-
- // Swap "x" with "z"
- if ($this->basis_matrix[0][2] > $this->basis_matrix[$this->z][2])
- {
- $this->x = $this->z;
- $this->z = 0;
- }
-
- // Still need to determine which of $x,$y are which.
- // wrong orientation if y's y-component is less than it's x-component
- // likewise if x's x-component is less than it's y-component
- // if they disagree, go with the one with the greater weight difference.
- // rotate if positive
- $weight = (abs($this->basis_matrix[$this->x][1]) - abs($this->basis_matrix[$this->x][0])) + (abs($this->basis_matrix[$this->y][0]) - abs($this->basis_matrix[$this->y][1]));
-
- // Swap "x" with "y"
- if ($weight > 0)
- {
- list($this->x, $this->y) = array($this->y, $this->x);
- }
-
- $this->abs_x = array($this->basis_matrix[$this->x][0], $this->basis_matrix[$this->x][1]);
- $this->abs_y = array($this->basis_matrix[$this->y][0], $this->basis_matrix[$this->y][1]);
-
- if ($this->abs_x[0] < 0)
- {
- $this->abs_x[0] *= -1;
- $this->abs_x[1] *= -1;
- }
-
- if ($this->abs_y[1] > 0)
- {
- $this->abs_y[0] *= -1;
- $this->abs_y[1] *= -1;
- }
-
- $this->letter = $letter;
- }
-
- /**
- * Draw a character
- */
- function drawchar($scale, $xoff, $yoff, $img, $background, $colours)
- {
- $width = $this->bitmap_width;
- $height = $this->bitmap_height;
- $bitmap = $this->bitmap;
-
- $colour1 = $colours[array_rand($colours)];
- $colour2 = $colours[array_rand($colours)];
-
- $swapx = ($this->basis_matrix[$this->x][0] > 0);
- $swapy = ($this->basis_matrix[$this->y][1] < 0);
-
- for ($y = 0; $y < $height; ++$y)
- {
- for ($x = 0; $x < $width; ++$x)
- {
- $xp = ($swapx) ? ($width - $x - 1) : $x;
- $yp = ($swapy) ? ($height - $y - 1) : $y;
-
- if ($bitmap[$height - $yp - 1][$xp])
- {
- $dx = $this->scale($this->abs_x, ($xp - ($swapx ? ($width / 2) : ($width / 2) - 1)) * $scale);
- $dy = $this->scale($this->abs_y, ($yp - ($swapy ? ($height / 2) : ($height / 2) - 1)) * $scale);
- $xo = $xoff + $dx[0] + $dy[0];
- $yo = $yoff + $dx[1] + $dy[1];
-
- $origin = array(0, 0, 0);
- $xvec = $this->scale($this->basis_matrix[$this->x], $scale);
- $yvec = $this->scale($this->basis_matrix[$this->y], $scale);
- $face_corner = $this->sum2($xvec, $yvec);
-
- $zvec = $this->scale($this->basis_matrix[$this->z], $scale);
- $x_corner = $this->sum2($xvec, $zvec);
- $y_corner = $this->sum2($yvec, $zvec);
-
- imagefilledpolygon($img, $this->gen_poly($xo, $yo, $origin, $xvec, $x_corner,$zvec), 4, $colour1);
- imagefilledpolygon($img, $this->gen_poly($xo, $yo, $origin, $yvec, $y_corner,$zvec), 4, $colour2);
-
- $face = $this->gen_poly($xo, $yo, $origin, $xvec, $face_corner, $yvec);
-
- imagefilledpolygon($img, $face, 4, $background);
- imagepolygon($img, $face, 4, $colour1);
- }
- }
- }
- }
-
- /*
- * return a roughly acceptable range of sizes for rendering with this texttype
- */
- function range()
- {
- return array(3, 4);
- }
-
- /**
- * Vector length
- */
- function vectorlen($vector)
- {
- return sqrt(pow($vector[0], 2) + pow($vector[1], 2) + pow($vector[2], 2));
- }
-
- /**
- * Normalize
- */
- function normalize(&$vector, $length = 1)
- {
- $length = (( $length < 1) ? 1 : $length);
- $length /= $this->vectorlen($vector);
- $vector[0] *= $length;
- $vector[1] *= $length;
- $vector[2] *= $length;
- }
-
- /**
- */
- function cross_product($vector1, $vector2)
- {
- $retval = array(0, 0, 0);
- $retval[0] = (($vector1[1] * $vector2[2]) - ($vector1[2] * $vector2[1]));
- $retval[1] = -(($vector1[0] * $vector2[2]) - ($vector1[2] * $vector2[0]));
- $retval[2] = (($vector1[0] * $vector2[1]) - ($vector1[1] * $vector2[0]));
-
- return $retval;
- }
-
- /**
- */
- function sum($vector1, $vector2)
- {
- return array($vector1[0] + $vector2[0], $vector1[1] + $vector2[1], $vector1[2] + $vector2[2]);
- }
-
- /**
- */
- function sum2($vector1, $vector2)
- {
- return array($vector1[0] + $vector2[0], $vector1[1] + $vector2[1]);
- }
-
- /**
- */
- function scale($vector, $length)
- {
- if (sizeof($vector) == 2)
- {
- return array($vector[0] * $length, $vector[1] * $length);
- }
-
- return array($vector[0] * $length, $vector[1] * $length, $vector[2] * $length);
- }
-
- /**
- */
- function gen_poly($xoff, $yoff, &$vec1, &$vec2, &$vec3, &$vec4)
- {
- $poly = array();
- $poly[0] = $xoff + $vec1[0];
- $poly[1] = $yoff + $vec1[1];
- $poly[2] = $xoff + $vec2[0];
- $poly[3] = $yoff + $vec2[1];
- $poly[4] = $xoff + $vec3[0];
- $poly[5] = $yoff + $vec3[1];
- $poly[6] = $xoff + $vec4[0];
- $poly[7] = $yoff + $vec4[1];
-
- return $poly;
- }
-
- /**
- * dimensions
- */
- function dimensions($size)
- {
- $xn = $this->scale($this->basis_matrix[$this->x], -($this->bitmap_width / 2) * $size);
- $xp = $this->scale($this->basis_matrix[$this->x], ($this->bitmap_width / 2) * $size);
- $yn = $this->scale($this->basis_matrix[$this->y], -($this->bitmap_height / 2) * $size);
- $yp = $this->scale($this->basis_matrix[$this->y], ($this->bitmap_height / 2) * $size);
-
- $p = array();
- $p[0] = $this->sum2($xn, $yn);
- $p[1] = $this->sum2($xp, $yn);
- $p[2] = $this->sum2($xp, $yp);
- $p[3] = $this->sum2($xn, $yp);
-
- $min_x = $max_x = $p[0][0];
- $min_y = $max_y = $p[0][1];
-
- for ($i = 1; $i < 4; ++$i)
- {
- $min_x = ($min_x > $p[$i][0]) ? $p[$i][0] : $min_x;
- $min_y = ($min_y > $p[$i][1]) ? $p[$i][1] : $min_y;
- $max_x = ($max_x < $p[$i][0]) ? $p[$i][0] : $max_x;
- $max_y = ($max_y < $p[$i][1]) ? $p[$i][1] : $max_y;
- }
-
- return array($min_x, $min_y, $max_x, $max_y);
- }
-}
-
-class colour_manager
-{
- var $img;
- var $mode;
- var $colours;
- var $named_colours;
-
- /**
- * Create the colour manager, link it to the image resource
- */
- function colour_manager($img, $background = false, $mode = 'ahsv')
- {
- $this->img = $img;
- $this->mode = $mode;
- $this->colours = array();
- $this->named_colours = array();
-
- if ($background !== false)
- {
- $bg = $this->allocate_named('background', $background);
- imagefill($this->img, 0, 0, $bg);
- }
- }
-
- /**
- * Lookup a named colour resource
- */
- function get_resource($named_colour)
- {
- if (isset($this->named_colours[$named_colour]))
- {
- return $this->named_colours[$named_colour];
- }
-
- if (isset($this->named_rgb[$named_colour]))
- {
- return $this->allocate_named($named_colour, $this->named_rgb[$named_colour], 'rgb');
- }
-
- return false;
- }
-
- /**
- * Assign a name to a colour resource
- */
- function name_colour($name, $resource)
- {
- $this->named_colours[$name] = $resource;
- }
-
- /**
- * names and allocates a colour resource
- */
- function allocate_named($name, $colour, $mode = false)
- {
- $resource = $this->allocate($colour, $mode);
-
- if ($resource !== false)
- {
- $this->name_colour($name, $resource);
- }
- return $resource;
- }
-
- /**
- * allocates a specified colour into the image
- */
- function allocate($colour, $mode = false)
- {
- if ($mode === false)
- {
- $mode = $this->mode;
- }
-
- if (!is_array($colour))
- {
- if (isset($this->named_rgb[$colour]))
- {
- return $this->allocate_named($colour, $this->named_rgb[$colour], 'rgb');
- }
-
- if (!is_int($colour))
- {
- return false;
- }
-
- $mode = 'rgb';
- $colour = array(255 & ($colour >> 16), 255 & ($colour >> 8), 255 & $colour);
- }
-
- if (isset($colour['mode']))
- {
- $mode = $colour['mode'];
- unset($colour['mode']);
- }
-
- if (isset($colour['random']))
- {
- unset($colour['random']);
- // everything else is params
- return $this->random_colour($colour, $mode);
- }
-
- $rgb = $this->model_convert($colour, $mode, 'rgb');
- $store = ($this->mode == 'rgb') ? $rgb : $this->model_convert($colour, $mode, $this->mode);
- $resource = imagecolorallocate($this->img, $rgb[0], $rgb[1], $rgb[2]);
- $this->colours[$resource] = $store;
-
- return $resource;
- }
-
- /**
- * randomly generates a colour, with optional params
- */
- function random_colour($params = array(), $mode = false)
- {
- if ($mode === false)
- {
- $mode = $this->mode;
- }
-
- switch ($mode)
- {
- case 'rgb':
- // @TODO random rgb generation. do we intend to do this, or is it just too tedious?
- break;
-
- case 'ahsv':
- case 'hsv':
- default:
-
- $default_params = array(
- 'hue_bias' => false, // degree / 'r'/'g'/'b'/'c'/'m'/'y' /'o'
- 'hue_range' => false, // if hue bias, then difference range +/- from bias
- 'min_saturation' => 30, // 0 - 100
- 'max_saturation' => 80, // 0 - 100
- 'min_value' => 30, // 0 - 100
- 'max_value' => 80, // 0 - 100
- );
-
- $alt = ($mode == 'ahsv') ? true : false;
- $params = array_merge($default_params, $params);
-
- $min_hue = 0;
- $max_hue = 359;
- $min_saturation = max(0, $params['min_saturation']);
- $max_saturation = min(100, $params['max_saturation']);
- $min_value = max(0, $params['min_value']);
- $max_value = min(100, $params['max_value']);
-
- if ($params['hue_bias'] !== false)
- {
- if (is_numeric($params['hue_bias']))
- {
- $h = intval($params['hue_bias']) % 360;
- }
- else
- {
- switch ($params['hue_bias'])
- {
- case 'o':
- $h = $alt ? 60 : 30;
- break;
-
- case 'y':
- $h = $alt ? 120 : 60;
- break;
-
- case 'g':
- $h = $alt ? 180 : 120;
- break;
-
- case 'c':
- $h = $alt ? 210 : 180;
- break;
-
- case 'b':
- $h = 240;
- break;
-
- case 'm':
- $h = 300;
- break;
-
- case 'r':
- default:
- $h = 0;
- break;
- }
- }
-
- $min_hue = $h + 360;
- $max_hue = $h + 360;
-
- if ($params['hue_range'])
- {
- $min_hue -= min(180, $params['hue_range']);
- $max_hue += min(180, $params['hue_range']);
- }
- }
-
- $h = mt_rand($min_hue, $max_hue);
- $s = mt_rand($min_saturation, $max_saturation);
- $v = mt_rand($min_value, $max_value);
-
- return $this->allocate(array($h, $s, $v), $mode);
-
- break;
- }
- }
-
- /**
- */
- function colour_scheme($resource, $include_original = true)
- {
- $mode = 'hsv';
-
- if (($pre = $this->get_resource($resource)) !== false)
- {
- $resource = $pre;
- }
-
- $colour = $this->model_convert($this->colours[$resource], $this->mode, $mode);
- $results = ($include_original) ? array($resource) : array();
- $colour2 = $colour3 = $colour4 = $colour;
- $colour2[0] += 150;
- $colour3[0] += 180;
- $colour4[0] += 210;
-
- $results[] = $this->allocate($colour2, $mode);
- $results[] = $this->allocate($colour3, $mode);
- $results[] = $this->allocate($colour4, $mode);
-
- return $results;
- }
-
- /**
- */
- function mono_range($resource, $count = 5, $include_original = true)
- {
- if (is_array($resource))
- {
- $results = array();
- for ($i = 0, $size = sizeof($resource); $i < $size; ++$i)
- {
- $results = array_merge($results, $this->mono_range($resource[$i], $count, $include_original));
- }
- return $results;
- }
-
- $mode = (in_array($this->mode, array('hsv', 'ahsv'), true) ? $this->mode : 'ahsv');
- if (($pre = $this->get_resource($resource)) !== false)
- {
- $resource = $pre;
- }
-
- $colour = $this->model_convert($this->colours[$resource], $this->mode, $mode);
-
- $results = array();
- if ($include_original)
- {
- $results[] = $resource;
- $count--;
- }
-
- // This is a hard problem. I chicken out and try to maintain readability at the cost of less randomness.
-
- while ($count > 0)
- {
- $colour[1] = ($colour[1] + mt_rand(40,60)) % 99;
- $colour[2] = ($colour[2] + mt_rand(40,60));
- $results[] = $this->allocate($colour, $mode);
- $count--;
- }
- return $results;
- }
-
- /**
- * Convert from one colour model to another
- */
- function model_convert($colour, $from_model, $to_model)
- {
- if ($from_model == $to_model)
- {
- return $colour;
- }
-
- switch ($to_model)
- {
- case 'hsv':
-
- switch ($from_model)
- {
- case 'ahsv':
- return $this->ah2h($colour);
- break;
-
- case 'rgb':
- return $this->rgb2hsv($colour);
- break;
- }
- break;
-
- case 'ahsv':
-
- switch ($from_model)
- {
- case 'hsv':
- return $this->h2ah($colour);
- break;
-
- case 'rgb':
- return $this->h2ah($this->rgb2hsv($colour));
- break;
- }
- break;
-
- case 'rgb':
- switch ($from_model)
- {
- case 'hsv':
- return $this->hsv2rgb($colour);
- break;
-
- case 'ahsv':
- return $this->hsv2rgb($this->ah2h($colour));
- break;
- }
- break;
- }
- return false;
- }
-
- /**
- * Slightly altered from wikipedia's algorithm
- */
- function hsv2rgb($hsv)
- {
- $this->normalize_hue($hsv[0]);
-
- $h = $hsv[0];
- $s = min(1, max(0, $hsv[1] / 100));
- $v = min(1, max(0, $hsv[2] / 100));
-
- // calculate hue sector
- $hi = floor($hsv[0] / 60);
-
- // calculate opposite colour
- $p = $v * (1 - $s);
-
- // calculate distance between hex vertices
- $f = ($h / 60) - $hi;
-
- // coming in or going out?
- if (!($hi & 1))
- {
- $f = 1 - $f;
- }
-
- // calculate adjacent colour
- $q = $v * (1 - ($f * $s));
-
- switch ($hi)
- {
- case 0:
- $rgb = array($v, $q, $p);
- break;
-
- case 1:
- $rgb = array($q, $v, $p);
- break;
-
- case 2:
- $rgb = array($p, $v, $q);
- break;
-
- case 3:
- $rgb = array($p, $q, $v);
- break;
-
- case 4:
- $rgb = array($q, $p, $v);
- break;
-
- case 5:
- $rgb = array($v, $p, $q);
- break;
-
- default:
- return array(0, 0, 0);
- break;
- }
-
- return array(255 * $rgb[0], 255 * $rgb[1], 255 * $rgb[2]);
- }
-
- /**
- * (more than) Slightly altered from wikipedia's algorithm
- */
- function rgb2hsv($rgb)
- {
- $r = min(255, max(0, $rgb[0]));
- $g = min(255, max(0, $rgb[1]));
- $b = min(255, max(0, $rgb[2]));
- $max = max($r, $g, $b);
- $min = min($r, $g, $b);
-
- $v = $max / 255;
- $s = (!$max) ? 0 : 1 - ($min / $max);
-
- // if max - min is 0, we want hue to be 0 anyway.
- $h = $max - $min;
-
- if ($h)
- {
- switch ($max)
- {
- case $g:
- $h = 120 + (60 * ($b - $r) / $h);
- break;
-
- case $b:
- $h = 240 + (60 * ($r - $g) / $h);
- break;
-
- case $r:
- $h = 360 + (60 * ($g - $b) / $h);
- break;
- }
- }
- $this->normalize_hue($h);
-
- return array($h, $s * 100, $v * 100);
- }
-
- /**
- */
- function normalize_hue(&$hue)
- {
- $hue %= 360;
-
- if ($hue < 0)
- {
- $hue += 360;
- }
- }
-
- /**
- * Alternate hue to hue
- */
- function ah2h($ahue)
- {
- if (is_array($ahue))
- {
- $ahue[0] = $this->ah2h($ahue[0]);
- return $ahue;
- }
- $this->normalize_hue($ahue);
-
- // blue through red is already ok
- if ($ahue >= 240)
- {
- return $ahue;
- }
-
- // ahue green is at 180
- if ($ahue >= 180)
- {
- // return (240 - (2 * (240 - $ahue)));
- return (2 * $ahue) - 240; // equivalent
- }
-
- // ahue yellow is at 120 (RYB rather than RGB)
- if ($ahue >= 120)
- {
- return $ahue - 60;
- }
-
- return $ahue / 2;
- }
-
- /**
- * hue to Alternate hue
- */
- function h2ah($hue)
- {
- if (is_array($hue))
- {
- $hue[0] = $this->h2ah($hue[0]);
- return $hue;
- }
- $this->normalize_hue($hue);
-
- // blue through red is already ok
- if ($hue >= 240)
- {
- return $hue;
- }
- else if ($hue <= 60)
- {
- return $hue * 2;
- }
- else if ($hue <= 120)
- {
- return $hue + 60;
- }
- else
- {
- return ($hue + 240) / 2;
- }
- }
-}
diff --git a/phpBB/includes/captcha/captcha_gd_wave.php b/phpBB/phpbb/captcha/gd_wave.php
index c2a4d3a31e..d48fc753a5 100644
--- a/phpBB/includes/captcha/captcha_gd_wave.php
+++ b/phpBB/phpbb/captcha/gd_wave.php
@@ -11,10 +11,12 @@
*
*/
+namespace phpbb\captcha;
+
/**
* Wave3D CAPTCHA
*/
-class captcha
+class gd_wave
{
var $width = 360;
var $height = 96;
diff --git a/phpBB/includes/captcha/captcha_non_gd.php b/phpBB/phpbb/captcha/non_gd.php
index 91970ea7a4..3818672f17 100644
--- a/phpBB/includes/captcha/captcha_non_gd.php
+++ b/phpBB/phpbb/captcha/non_gd.php
@@ -11,19 +11,13 @@
*
*/
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
+namespace phpbb\captcha;
/**
* Main non-gd captcha class
* @ignore
*/
-class captcha
+class non_gd
{
var $filtered_pngs;
var $width = 320;
@@ -32,7 +26,7 @@ class captcha
/**
* Define filtered pngs on init
*/
- function captcha()
+ function __construct()
{
// If we can we will generate a single filtered png, we avoid nastiness via emulation of some Zlib stuff
$this->define_filtered_pngs();
diff --git a/phpBB/includes/captcha/plugins/captcha_abstract.php b/phpBB/phpbb/captcha/plugins/captcha_abstract.php
index 8e1e61bdb7..24ed7f939d 100644
--- a/phpBB/includes/captcha/plugins/captcha_abstract.php
+++ b/phpBB/phpbb/captcha/plugins/captcha_abstract.php
@@ -11,18 +11,12 @@
*
*/
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
+namespace phpbb\captcha\plugins;
/**
* This class holds the code shared by the two default 3.0.x CAPTCHAs.
*/
-class phpbb_captcha_plugins_captcha_abstract
+abstract class captcha_abstract
{
var $confirm_id;
var $confirm_code;
@@ -33,6 +27,11 @@ class phpbb_captcha_plugins_captcha_abstract
var $solved = 0;
var $captcha_vars = false;
+ /**
+ * @var string name of the service.
+ */
+ protected $service_name;
+
function init($type)
{
global $config, $db, $user;
@@ -65,7 +64,8 @@ class phpbb_captcha_plugins_captcha_abstract
// compute $seed % 0x7fffffff
$this->seed -= 0x7fffffff * floor($this->seed / 0x7fffffff);
- $captcha = new captcha();
+ $generator = $this->get_generator_class();
+ $captcha = new $generator();
define('IMAGE_OUTPUT', 1);
$captcha->execute($this->code, $this->seed);
}
@@ -80,7 +80,8 @@ class phpbb_captcha_plugins_captcha_abstract
return false;
}
}
- $captcha = new captcha();
+ $generator = $this->get_generator_class();
+ $captcha = new $generator();
define('IMAGE_OUTPUT', 1);
$captcha->execute($this->code, $this->seed);
}
@@ -130,7 +131,7 @@ class phpbb_captcha_plugins_captcha_abstract
// acp_captcha has a delivery function; let's use it
$template->assign_vars(array(
- 'CONFIRM_IMAGE' => append_sid($phpbb_admin_path . 'index.' . $phpEx, 'captcha_demo=1&amp;mode=visual&amp;i=' . $id . '&amp;select_captcha=' . $this->get_class_name()) . $variables,
+ 'CONFIRM_IMAGE' => append_sid($phpbb_admin_path . 'index.' . $phpEx, 'captcha_demo=1&amp;mode=visual&amp;i=' . $id . '&amp;select_captcha=' . $this->get_service_name()) . $variables,
'CONFIRM_ID' => $this->confirm_id,
));
@@ -364,11 +365,26 @@ class phpbb_captcha_plugins_captcha_abstract
return false;
}
-}
+ /**
+ * @return string the name of the service corresponding to the plugin
+ */
+ function get_service_name()
+ {
+ return $this->service_name;
+ }
-/**
-* Old class name for legacy use. The new class name is auto loadable.
-*/
-class phpbb_default_captcha extends phpbb_captcha_plugins_captcha_abstract
-{
+ /**
+ * Set the name of the plugin
+ *
+ * @param string $name
+ */
+ public function set_name($name)
+ {
+ $this->service_name = $name;
+ }
+
+ /**
+ * @return string the name of the class used to generate the captcha
+ */
+ abstract function get_generator_class();
}
diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php b/phpBB/phpbb/captcha/plugins/gd.php
index 8dbd458ede..f6200b5b2f 100644
--- a/phpBB/includes/captcha/plugins/phpbb_captcha_gd_plugin.php
+++ b/phpBB/phpbb/captcha/plugins/gd.php
@@ -11,25 +11,10 @@
*
*/
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-/**
-* Placeholder for autoload
-*/
-if (!class_exists('phpbb_default_captcha', false))
-{
- include($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx);
-}
+namespace phpbb\captcha\plugins;
-class phpbb_captcha_gd extends phpbb_default_captcha
+class gd extends captcha_abstract
{
-
var $captcha_vars = array(
'captcha_gd_x_grid' => 'CAPTCHA_GD_X_GRID',
'captcha_gd_y_grid' => 'CAPTCHA_GD_Y_GRID',
@@ -40,25 +25,17 @@ class phpbb_captcha_gd extends phpbb_default_captcha
'captcha_gd_fonts' => 'CAPTCHA_GD_FONTS',
);
- function phpbb_captcha_gd()
+ public function is_available()
{
- global $phpbb_root_path, $phpEx;
-
- if (!class_exists('captcha'))
- {
- include($phpbb_root_path . 'includes/captcha/captcha_gd.' . $phpEx);
- }
- }
-
- static public function get_instance()
- {
- $instance = new phpbb_captcha_gd();
- return $instance;
+ return @extension_loaded('gd');
}
- static public function is_available()
+ /**
+ * @return string the name of the class used to generate the captcha
+ */
+ function get_generator_class()
{
- return @extension_loaded('gd');
+ return '\\phpbb\\captcha\\gd';
}
/**
@@ -69,16 +46,11 @@ class phpbb_captcha_gd extends phpbb_default_captcha
return true;
}
- static public function get_name()
+ public function get_name()
{
return 'CAPTCHA_GD';
}
- function get_class_name()
- {
- return 'phpbb_captcha_gd';
- }
-
function acp_page($id, &$module)
{
global $db, $user, $auth, $template;
@@ -129,7 +101,7 @@ class phpbb_captcha_gd extends phpbb_default_captcha
$template->assign_vars(array(
'CAPTCHA_PREVIEW' => $this->get_demo_template($id),
- 'CAPTCHA_NAME' => $this->get_class_name(),
+ 'CAPTCHA_NAME' => $this->get_service_name(),
'U_ACTION' => $module->u_action,
));
}
diff --git a/phpBB/phpbb/captcha/plugins/gd_wave.php b/phpBB/phpbb/captcha/plugins/gd_wave.php
new file mode 100644
index 0000000000..e1d44df778
--- /dev/null
+++ b/phpBB/phpbb/captcha/plugins/gd_wave.php
@@ -0,0 +1,42 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\captcha\plugins;
+
+class gd_wave extends captcha_abstract
+{
+ public function is_available()
+ {
+ return @extension_loaded('gd');
+ }
+
+ public function get_name()
+ {
+ return 'CAPTCHA_GD_3D';
+ }
+
+ /**
+ * @return string the name of the class used to generate the captcha
+ */
+ function get_generator_class()
+ {
+ return '\\phpbb\\captcha\\gd_wave';
+ }
+
+ function acp_page($id, &$module)
+ {
+ global $config, $db, $template, $user;
+
+ trigger_error($user->lang['CAPTCHA_NO_OPTIONS'] . adm_back_link($module->u_action));
+ }
+}
diff --git a/phpBB/phpbb/captcha/plugins/nogd.php b/phpBB/phpbb/captcha/plugins/nogd.php
new file mode 100644
index 0000000000..6845e5935c
--- /dev/null
+++ b/phpBB/phpbb/captcha/plugins/nogd.php
@@ -0,0 +1,42 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\captcha\plugins;
+
+class nogd extends captcha_abstract
+{
+ public function is_available()
+ {
+ return true;
+ }
+
+ public function get_name()
+ {
+ return 'CAPTCHA_NO_GD';
+ }
+
+ /**
+ * @return string the name of the class used to generate the captcha
+ */
+ function get_generator_class()
+ {
+ return '\\phpbb\\captcha\\non_gd';
+ }
+
+ function acp_page($id, &$module)
+ {
+ global $user;
+
+ trigger_error($user->lang['CAPTCHA_NO_OPTIONS'] . adm_back_link($module->u_action));
+ }
+}
diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/phpbb/captcha/plugins/qa.php
index 5a44755365..a7ba994cc3 100644
--- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php
+++ b/phpBB/phpbb/captcha/plugins/qa.php
@@ -11,25 +11,13 @@
*
*/
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-global $table_prefix;
-
-define('CAPTCHA_QUESTIONS_TABLE', $table_prefix . 'captcha_questions');
-define('CAPTCHA_ANSWERS_TABLE', $table_prefix . 'captcha_answers');
-define('CAPTCHA_QA_CONFIRM_TABLE', $table_prefix . 'qa_confirm');
+namespace phpbb\captcha\plugins;
/**
* And now to something completely different. Let's make a captcha without extending the abstract class.
* QA CAPTCHA sample implementation
*/
-class phpbb_captcha_qa
+class qa
{
var $confirm_id;
var $answer;
@@ -42,6 +30,29 @@ class phpbb_captcha_qa
// dirty trick: 0 is false, but can still encode that the captcha is not yet validated
var $solved = 0;
+ protected $table_captcha_questions;
+ protected $table_captcha_answers;
+ protected $table_qa_confirm;
+
+ /**
+ * @var string name of the service.
+ */
+ protected $service_name;
+
+ /**
+ * Constructor
+ *
+ * @param string $table_captcha_questions
+ * @param string $table_captcha_answers
+ * @param string $table_qa_confirm
+ */
+ function __construct($table_captcha_questions, $table_captcha_answers, $table_qa_confirm)
+ {
+ $this->table_captcha_questions = $table_captcha_questions;
+ $this->table_captcha_answers = $table_captcha_answers;
+ $this->table_qa_confirm = $table_qa_confirm;
+ }
+
/**
* @param int $type as per the CAPTCHA API docs, the type
*/
@@ -62,7 +73,7 @@ class phpbb_captcha_qa
// we need all defined questions - shouldn't be too many, so we can just grab them
// try the user's lang first
$sql = 'SELECT question_id
- FROM ' . CAPTCHA_QUESTIONS_TABLE . "
+ FROM ' . $this->table_captcha_questions . "
WHERE lang_iso = '" . $db->sql_escape($user->lang_name) . "'";
$result = $db->sql_query($sql, 3600);
@@ -78,7 +89,7 @@ class phpbb_captcha_qa
$this->question_lang = $config['default_lang'];
$sql = 'SELECT question_id
- FROM ' . CAPTCHA_QUESTIONS_TABLE . "
+ FROM ' . $this->table_captcha_questions . "
WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'";
$result = $db->sql_query($sql, 7200);
@@ -98,44 +109,34 @@ class phpbb_captcha_qa
}
/**
- * API function
- */
- static public function get_instance()
- {
- $instance = new phpbb_captcha_qa();
-
- return $instance;
- }
-
- /**
* See if the captcha has created its tables.
*/
- static public function is_installed()
+ public function is_installed()
{
global $db;
$db_tool = new \phpbb\db\tools($db);
- return $db_tool->sql_table_exists(CAPTCHA_QUESTIONS_TABLE);
+ return $db_tool->sql_table_exists($this->table_captcha_questions);
}
/**
* API function - for the captcha to be available, it must have installed itself and there has to be at least one question in the board's default lang
*/
- static public function is_available()
+ public function is_available()
{
global $config, $db, $phpbb_root_path, $phpEx, $user;
// load language file for pretty display in the ACP dropdown
$user->add_lang('captcha_qa');
- if (!self::is_installed())
+ if (!$this->is_installed())
{
return false;
}
$sql = 'SELECT COUNT(question_id) AS question_count
- FROM ' . CAPTCHA_QUESTIONS_TABLE . "
+ FROM ' . $this->table_captcha_questions . "
WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
@@ -161,11 +162,21 @@ class phpbb_captcha_qa
}
/**
- * API function
+ * @return string the name of the service corresponding to the plugin
+ */
+ function get_service_name()
+ {
+ return $this->service_name;
+ }
+
+ /**
+ * Set the name of the plugin
+ *
+ * @param string $name
*/
- function get_class_name()
+ public function set_name($name)
{
- return 'phpbb_captcha_qa';
+ $this->service_name = $name;
}
/**
@@ -216,7 +227,7 @@ class phpbb_captcha_qa
if ($this->is_available())
{
$sql = 'SELECT question_text
- FROM ' . CAPTCHA_QUESTIONS_TABLE . "
+ FROM ' . $this->table_captcha_questions . "
WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'";
$result = $db->sql_query_limit($sql, 1);
if ($row = $db->sql_fetchrow($result))
@@ -255,7 +266,7 @@ class phpbb_captcha_qa
global $db, $config;
$sql = 'SELECT c.confirm_id
- FROM ' . CAPTCHA_QA_CONFIRM_TABLE . ' c
+ FROM ' . $this->table_qa_confirm . ' c
LEFT JOIN ' . SESSIONS_TABLE . ' s
ON (c.session_id = s.session_id)
WHERE s.session_id IS NULL' .
@@ -274,7 +285,7 @@ class phpbb_captcha_qa
if (sizeof($sql_in))
{
- $sql = 'DELETE FROM ' . CAPTCHA_QA_CONFIRM_TABLE . '
+ $sql = 'DELETE FROM ' . $this->table_qa_confirm . '
WHERE ' . $db->sql_in_set('confirm_id', $sql_in);
$db->sql_query($sql);
}
@@ -299,12 +310,12 @@ class phpbb_captcha_qa
$db_tool = new \phpbb\db\tools($db);
- $tables = array(CAPTCHA_QUESTIONS_TABLE, CAPTCHA_ANSWERS_TABLE, CAPTCHA_QA_CONFIRM_TABLE);
+ $tables = array($this->table_captcha_questions, $this->table_captcha_answers, $this->table_qa_confirm);
$schemas = array(
- CAPTCHA_QUESTIONS_TABLE => array (
+ $this->table_captcha_questions => array (
'COLUMNS' => array(
- 'question_id' => array('UINT', Null, 'auto_increment'),
+ 'question_id' => array('UINT', null, 'auto_increment'),
'strict' => array('BOOL', 0),
'lang_id' => array('UINT', 0),
'lang_iso' => array('VCHAR:30', ''),
@@ -315,7 +326,7 @@ class phpbb_captcha_qa
'lang' => array('INDEX', 'lang_iso'),
),
),
- CAPTCHA_ANSWERS_TABLE => array (
+ $this->table_captcha_answers => array (
'COLUMNS' => array(
'question_id' => array('UINT', 0),
'answer_text' => array('STEXT_UNI', ''),
@@ -324,7 +335,7 @@ class phpbb_captcha_qa
'qid' => array('INDEX', 'question_id'),
),
),
- CAPTCHA_QA_CONFIRM_TABLE => array (
+ $this->table_qa_confirm => array (
'COLUMNS' => array(
'session_id' => array('CHAR:32', ''),
'confirm_id' => array('CHAR:32', ''),
@@ -408,7 +419,7 @@ class phpbb_captcha_qa
$this->confirm_id = md5(unique_id($user->ip));
$this->question = (int) array_rand($this->question_ids);
- $sql = 'INSERT INTO ' . CAPTCHA_QA_CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array(
+ $sql = 'INSERT INTO ' . $this->table_qa_confirm . ' ' . $db->sql_build_array('INSERT', array(
'confirm_id' => (string) $this->confirm_id,
'session_id' => (string) $user->session_id,
'lang_iso' => (string) $this->question_lang,
@@ -435,7 +446,7 @@ class phpbb_captcha_qa
$this->question = (int) array_rand($this->question_ids);
$this->solved = 0;
- $sql = 'UPDATE ' . CAPTCHA_QA_CONFIRM_TABLE . '
+ $sql = 'UPDATE ' . $this->table_qa_confirm . '
SET question_id = ' . (int) $this->question . "
WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "'
AND session_id = '" . $db->sql_escape($user->session_id) . "'";
@@ -455,7 +466,7 @@ class phpbb_captcha_qa
$this->question = (int) array_rand($this->question_ids);
$this->solved = 0;
- $sql = 'UPDATE ' . CAPTCHA_QA_CONFIRM_TABLE . '
+ $sql = 'UPDATE ' . $this->table_qa_confirm . '
SET question_id = ' . (int) $this->question . ",
attempts = attempts + 1
WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "'
@@ -474,7 +485,7 @@ class phpbb_captcha_qa
global $db, $user;
$sql = 'SELECT confirm_id
- FROM ' . CAPTCHA_QA_CONFIRM_TABLE . "
+ FROM ' . $this->table_qa_confirm . "
WHERE
session_id = '" . $db->sql_escape($user->session_id) . "'
AND lang_iso = '" . $db->sql_escape($this->question_lang) . "'
@@ -504,7 +515,7 @@ class phpbb_captcha_qa
}
$sql = 'SELECT con.question_id, attempts, question_text, strict
- FROM ' . CAPTCHA_QA_CONFIRM_TABLE . ' con, ' . CAPTCHA_QUESTIONS_TABLE . " qes
+ FROM ' . $this->table_qa_confirm . ' con, ' . $this->table_captcha_questions . " qes
WHERE con.question_id = qes.question_id
AND confirm_id = '" . $db->sql_escape($this->confirm_id) . "'
AND session_id = '" . $db->sql_escape($user->session_id) . "'
@@ -538,7 +549,7 @@ class phpbb_captcha_qa
$answer = ($this->question_strict) ? utf8_normalize_nfc(request_var('qa_answer', '', true)) : utf8_clean_string(utf8_normalize_nfc(request_var('qa_answer', '', true)));
$sql = 'SELECT answer_text
- FROM ' . CAPTCHA_ANSWERS_TABLE . '
+ FROM ' . $this->table_captcha_answers . '
WHERE question_id = ' . (int) $this->question;
$result = $db->sql_query($sql);
@@ -573,7 +584,7 @@ class phpbb_captcha_qa
{
global $db, $user;
- $sql = 'DELETE FROM ' . CAPTCHA_QA_CONFIRM_TABLE . "
+ $sql = 'DELETE FROM ' . $this->table_qa_confirm . "
WHERE session_id = '" . $db->sql_escape($user->session_id) . "'
AND confirm_type = " . (int) $this->type;
$db->sql_query($sql);
@@ -621,12 +632,12 @@ class phpbb_captcha_qa
$action = request_var('action', '');
// we have two pages, so users might want to navigate from one to the other
- $list_url = $module->u_action . "&amp;configure=1&amp;select_captcha=" . $this->get_class_name();
+ $list_url = $module->u_action . "&amp;configure=1&amp;select_captcha=" . $this->get_service_name();
$template->assign_vars(array(
'U_ACTION' => $module->u_action,
'QUESTION_ID' => $question_id ,
- 'CLASS' => $this->get_class_name(),
+ 'CLASS' => $this->get_service_name(),
));
// show the list?
@@ -636,7 +647,7 @@ class phpbb_captcha_qa
}
else if ($question_id && $action == 'delete')
{
- if ($this->get_class_name() !== $config['captcha_plugin'] || !$this->acp_is_last($question_id))
+ if ($this->get_service_name() !== $config['captcha_plugin'] || !$this->acp_is_last($question_id))
{
if (confirm_box(true))
{
@@ -650,7 +661,7 @@ class phpbb_captcha_qa
'question_id' => $question_id,
'action' => $action,
'configure' => 1,
- 'select_captcha' => $this->get_class_name(),
+ 'select_captcha' => $this->get_service_name(),
))
);
}
@@ -750,7 +761,7 @@ class phpbb_captcha_qa
global $db, $template;
$sql = 'SELECT *
- FROM ' . CAPTCHA_QUESTIONS_TABLE;
+ FROM ' . $this->table_captcha_questions;
$result = $db->sql_query($sql);
$template->assign_vars(array(
@@ -759,7 +770,7 @@ class phpbb_captcha_qa
while ($row = $db->sql_fetchrow($result))
{
- $url = $module->u_action . "&amp;question_id={$row['question_id']}&amp;configure=1&amp;select_captcha=" . $this->get_class_name() . '&amp;';
+ $url = $module->u_action . "&amp;question_id={$row['question_id']}&amp;configure=1&amp;select_captcha=" . $this->get_service_name() . '&amp;';
$template->assign_block_vars('questions', array(
'QUESTION_TEXT' => $row['question_text'],
@@ -782,7 +793,7 @@ class phpbb_captcha_qa
if ($question_id)
{
$sql = 'SELECT *
- FROM ' . CAPTCHA_QUESTIONS_TABLE . '
+ FROM ' . $this->table_captcha_questions . '
WHERE question_id = ' . $question_id;
$result = $db->sql_query($sql);
$question = $db->sql_fetchrow($result);
@@ -796,7 +807,7 @@ class phpbb_captcha_qa
$question['answers'] = array();
$sql = 'SELECT *
- FROM ' . CAPTCHA_ANSWERS_TABLE . '
+ FROM ' . $this->table_captcha_answers . '
WHERE question_id = ' . $question_id;
$result = $db->sql_query($sql);
@@ -835,7 +846,7 @@ class phpbb_captcha_qa
global $db, $cache;
// easier to delete all answers than to figure out which to update
- $sql = 'DELETE FROM ' . CAPTCHA_ANSWERS_TABLE . " WHERE question_id = $question_id";
+ $sql = 'DELETE FROM ' . $this->table_captcha_answers . " WHERE question_id = $question_id";
$db->sql_query($sql);
$langs = $this->get_languages();
@@ -843,14 +854,14 @@ class phpbb_captcha_qa
$question_ary['lang_id'] = $langs[$question_ary['lang_iso']]['id'];
unset($question_ary['answers']);
- $sql = 'UPDATE ' . CAPTCHA_QUESTIONS_TABLE . '
+ $sql = 'UPDATE ' . $this->table_captcha_questions . '
SET ' . $db->sql_build_array('UPDATE', $question_ary) . "
WHERE question_id = $question_id";
$db->sql_query($sql);
$this->acp_insert_answers($data, $question_id);
- $cache->destroy('sql', CAPTCHA_QUESTIONS_TABLE);
+ $cache->destroy('sql', $this->table_captcha_questions);
}
/**
@@ -867,14 +878,14 @@ class phpbb_captcha_qa
$question_ary['lang_id'] = $langs[$data['lang_iso']]['id'];
unset($question_ary['answers']);
- $sql = 'INSERT INTO ' . CAPTCHA_QUESTIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $question_ary);
+ $sql = 'INSERT INTO ' . $this->table_captcha_questions . ' ' . $db->sql_build_array('INSERT', $question_ary);
$db->sql_query($sql);
$question_id = $db->sql_nextid();
$this->acp_insert_answers($data, $question_id);
- $cache->destroy('sql', CAPTCHA_QUESTIONS_TABLE);
+ $cache->destroy('sql', $this->table_captcha_questions);
}
/**
@@ -892,11 +903,11 @@ class phpbb_captcha_qa
'answer_text' => $answer,
);
- $sql = 'INSERT INTO ' . CAPTCHA_ANSWERS_TABLE . ' ' . $db->sql_build_array('INSERT', $answer_ary);
+ $sql = 'INSERT INTO ' . $this->table_captcha_answers . ' ' . $db->sql_build_array('INSERT', $answer_ary);
$db->sql_query($sql);
}
- $cache->destroy('sql', CAPTCHA_ANSWERS_TABLE);
+ $cache->destroy('sql', $this->table_captcha_answers);
}
/**
@@ -906,7 +917,7 @@ class phpbb_captcha_qa
{
global $db, $cache;
- $tables = array(CAPTCHA_QUESTIONS_TABLE, CAPTCHA_ANSWERS_TABLE);
+ $tables = array($this->table_captcha_questions, $this->table_captcha_answers);
foreach ($tables as $table)
{
@@ -981,7 +992,7 @@ class phpbb_captcha_qa
if ($question_id)
{
$sql = 'SELECT question_id
- FROM ' . CAPTCHA_QUESTIONS_TABLE . "
+ FROM ' . $this->table_captcha_questions . "
WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'
AND question_id <> " . (int) $question_id;
$result = $db->sql_query_limit($sql, 1);
diff --git a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php b/phpBB/phpbb/captcha/plugins/recaptcha.php
index 12cc49ef9b..ea446d7bc3 100644
--- a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php
+++ b/phpBB/phpbb/captcha/plugins/recaptcha.php
@@ -11,21 +11,9 @@
*
*/
-/**
-* @ignore
-*/
-if (!defined('IN_PHPBB'))
-{
- exit;
-}
-
-if (!class_exists('phpbb_default_captcha', false))
-{
- // we need the classic captcha code for tracking solutions and attempts
- include($phpbb_root_path . 'includes/captcha/plugins/captcha_abstract.' . $phpEx);
-}
+namespace phpbb\captcha\plugins;
-class phpbb_recaptcha extends phpbb_default_captcha
+class recaptcha extends captcha_abstract
{
var $recaptcha_server = 'http://www.google.com/recaptcha/api';
var $recaptcha_server_secure = 'https://www.google.com/recaptcha/api'; // class constants :(
@@ -55,13 +43,7 @@ class phpbb_recaptcha extends phpbb_default_captcha
$this->response = request_var('recaptcha_response_field', '');
}
- static public function get_instance()
- {
- $instance = new phpbb_recaptcha();
- return $instance;
- }
-
- static public function is_available()
+ public function is_available()
{
global $config, $user;
$user->add_lang('captcha_recaptcha');
@@ -81,9 +63,12 @@ class phpbb_recaptcha extends phpbb_default_captcha
return 'CAPTCHA_RECAPTCHA';
}
- function get_class_name()
+ /**
+ * This function is implemented because required by the upper class, but is never used for reCaptcha.
+ */
+ function get_generator_class()
{
- return 'phpbb_recaptcha';
+ throw new \Exception('No generator class given.');
}
function acp_page($id, &$module)
@@ -131,7 +116,7 @@ class phpbb_recaptcha extends phpbb_default_captcha
$template->assign_vars(array(
'CAPTCHA_PREVIEW' => $this->get_demo_template($id),
- 'CAPTCHA_NAME' => $this->get_class_name(),
+ 'CAPTCHA_NAME' => $this->get_service_name(),
'U_ACTION' => $module->u_action,
));
diff --git a/phpBB/phpbb/composer.json b/phpBB/phpbb/composer.json
new file mode 100644
index 0000000000..513d7e4559
--- /dev/null
+++ b/phpBB/phpbb/composer.json
@@ -0,0 +1,27 @@
+{
+ "name": "phpbb/phpbb-core",
+ "description": "Collection of core phpBB libraries",
+ "type": "library",
+ "keywords": ["phpbb", "forum"],
+ "homepage": "https://www.phpbb.com",
+ "license": "GPL-2.0",
+ "authors": [
+ {
+ "name": "phpBB Limited",
+ "email": "operations@phpbb.com",
+ "homepage": "https://www.phpbb.com/go/authors"
+ }
+ ],
+ "support": {
+ "issues": "https://tracker.phpbb.com",
+ "forum": "https://www.phpbb.com/community/",
+ "wiki": "https://wiki.phpbb.com",
+ "irc": "irc://irc.freenode.org/phpbb"
+ },
+ "autoload": {
+ "classmap": [""]
+ },
+ "require": {
+ "php": ">=5.3.3"
+ }
+}
diff --git a/phpBB/phpbb/config_php_file.php b/phpBB/phpbb/config_php_file.php
index 1a562e470d..7445e7df22 100644
--- a/phpBB/phpbb/config_php_file.php
+++ b/phpBB/phpbb/config_php_file.php
@@ -71,59 +71,44 @@ class config_php_file
/**
* Returns an associative array containing the variables defined by the config file.
*
- * @return bool|array Return the content of the config file or false if the file does not exists.
+ * @return array Return the content of the config file or an empty array if the file does not exists.
*/
public function get_all()
{
- if (!$this->load_config_file())
- {
- return false;
- }
+ $this->load_config_file();
return $this->config_data;
}
/**
- * Return the value of a variable defined into the config.php file and false if the variable does not exist.
+ * Return the value of a variable defined into the config.php file or null if the variable does not exist.
*
* @param string $variable The name of the variable
- * @return mixed
+ * @return mixed Value of the variable or null if the variable is not defined.
*/
public function get($variable)
{
- if (!$this->load_config_file())
- {
- return false;
- }
+ $this->load_config_file();
- return isset($this->config_data[$variable]) ? $this->config_data[$variable] : false;
+ return isset($this->config_data[$variable]) ? $this->config_data[$variable] : null;
}
/**
* Load the config file and store the information.
*
- * @return bool True if the file was correctly loaded, false otherwise.
+ * @return null
*/
protected function load_config_file()
{
- if (!$this->config_loaded)
+ if (!$this->config_loaded && file_exists($this->config_file))
{
- if (file_exists($this->config_file))
- {
- $this->defined_vars = get_defined_vars();
+ $this->defined_vars = get_defined_vars();
- require($this->config_file);
- $this->config_data = array_diff_key(get_defined_vars(), $this->defined_vars);
+ require($this->config_file);
+ $this->config_data = array_diff_key(get_defined_vars(), $this->defined_vars);
- $this->config_loaded = true;
- }
- else
- {
- return false;
- }
+ $this->config_loaded = true;
}
-
- return true;
}
/**
diff --git a/phpBB/phpbb/console/command/config/increment.php b/phpBB/phpbb/console/command/config/increment.php
index 0c25075ce8..b4d7438b66 100644
--- a/phpBB/phpbb/console/command/config/increment.php
+++ b/phpBB/phpbb/console/command/config/increment.php
@@ -41,7 +41,7 @@ class increment extends command
'dynamic',
'd',
InputOption::VALUE_NONE,
- $this->user-lang('CLI_CONFIG_CANNOT_CACHED')
+ $this->user->lang('CLI_CONFIG_CANNOT_CACHED')
)
;
}
diff --git a/phpBB/phpbb/console/command/extension/enable.php b/phpBB/phpbb/console/command/extension/enable.php
index cca4975aa6..59ff11e9b7 100644
--- a/phpBB/phpbb/console/command/extension/enable.php
+++ b/phpBB/phpbb/console/command/extension/enable.php
@@ -40,12 +40,12 @@ class enable extends command
if ($this->manager->is_enabled($name))
{
$this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_ENABLE', time(), array($name));
- $output->writeln('<error>' . $this->user->lang('CLI_EXTENSION_ENABLE_FAILURE', $name) . '</error>');
+ $output->writeln('<info>' . $this->user->lang('CLI_EXTENSION_ENABLE_SUCCESS', $name) . '</info>');
return 0;
}
else
{
- $output->writeln('<info>' . $this->user->lang('CLI_EXTENSION_ENABLE_SUCCESS', $name) . '</info>');
+ $output->writeln('<error>' . $this->user->lang('CLI_EXTENSION_ENABLE_FAILURE', $name) . '</error>');
return 1;
}
}
diff --git a/phpBB/phpbb/console/command/extension/show.php b/phpBB/phpbb/console/command/extension/show.php
index 6ce9607098..f9322034d7 100644
--- a/phpBB/phpbb/console/command/extension/show.php
+++ b/phpBB/phpbb/console/command/extension/show.php
@@ -37,22 +37,22 @@ class show extends command
}
$enabled = array_keys($this->manager->all_enabled());
- $this->print_extension_list($output, 'Enabled', $enabled);
+ $this->print_extension_list($output, $this->user->lang('CLI_EXTENSIONS_ENABLED') . $this->user->lang('COLON'), $enabled);
$output->writeln('');
$disabled = array_keys($this->manager->all_disabled());
- $this->print_extension_list($output, 'Disabled', $disabled);
+ $this->print_extension_list($output, $this->user->lang('CLI_EXTENSIONS_DISABLED') . $this->user->lang('COLON'), $disabled);
$output->writeln('');
$purged = array_diff($all, $enabled, $disabled);
- $this->print_extension_list($output, 'Available', $purged);
+ $this->print_extension_list($output, $this->user->lang('CLI_EXTENSIONS_AVAILABLE') . $this->user->lang('COLON'), $purged);
}
protected function print_extension_list(OutputInterface $output, $type, array $extensions)
{
- $output->writeln("<info>$type:</info>");
+ $output->writeln("<info>$type</info>");
foreach ($extensions as $extension)
{
diff --git a/phpBB/phpbb/content_visibility.php b/phpBB/phpbb/content_visibility.php
index 1f50032f26..8bd537586e 100644
--- a/phpBB/phpbb/content_visibility.php
+++ b/phpBB/phpbb/content_visibility.php
@@ -38,6 +38,12 @@ class content_visibility
protected $auth;
/**
+ * config object
+ * @var \phpbb\config\config
+ */
+ protected $config;
+
+ /**
* phpBB root path
* @var string
*/
@@ -53,6 +59,7 @@ class content_visibility
* Constructor
*
* @param \phpbb\auth\auth $auth Auth object
+ * @param \phpbb\config\config $config Config object
* @param \phpbb\db\driver\driver_interface $db Database object
* @param \phpbb\user $user User object
* @param string $phpbb_root_path Root path
@@ -62,9 +69,10 @@ class content_visibility
* @param string $topics_table Topics table name
* @param string $users_table Users table name
*/
- public function __construct(\phpbb\auth\auth $auth, \phpbb\db\driver\driver_interface $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\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, $phpbb_root_path, $php_ext, $forums_table, $posts_table, $topics_table, $users_table)
{
$this->auth = $auth;
+ $this->config = $config;
$this->db = $db;
$this->user = $user;
$this->phpbb_root_path = $phpbb_root_path;
@@ -562,7 +570,7 @@ class content_visibility
* Add post to topic and forum statistics
*
* @param $data array Contains information from the topics table about given topic
- * @param $sql_data array Populated with the SQL changes, may be empty at call time
+ * @param &$sql_data array Populated with the SQL changes, may be empty at call time
* @return null
*/
public function add_post_to_statistic($data, &$sql_data)
@@ -576,90 +584,68 @@ class content_visibility
$sql_data[$this->users_table] = (($sql_data[$this->users_table]) ? $sql_data[$this->users_table] . ', ' : '') . 'user_posts = user_posts + 1';
}
- set_config_count('num_posts', 1, true);
+ $this->config->increment('num_posts', 1, false);
}
/**
* Remove post from topic and forum statistics
*
* @param $data array Contains information from the topics table about given topic
- * @param $sql_data array Populated with the SQL changes, may be empty at call time
+ * @param &$sql_data array Populated with the SQL changes, may be empty at call time
* @return null
*/
public function remove_post_from_statistic($data, &$sql_data)
{
- $sql_data[$this->topics_table] = ((!empty($sql_data[$this->topics_table])) ? $sql_data[$this->topics_table] . ', ' : '') . 'topic_posts_approved = topic_posts_approved - 1';
- $sql_data[$this->forums_table] = ((!empty($sql_data[$this->forums_table])) ? $sql_data[$this->forums_table] . ', ' : '') . 'forum_posts_approved = forum_posts_approved - 1';
+ if ($data['post_visibility'] == ITEM_APPROVED)
+ {
+ $sql_data[$this->topics_table] = ((!empty($sql_data[$this->topics_table])) ? $sql_data[$this->topics_table] . ', ' : '') . 'topic_posts_approved = topic_posts_approved - 1';
+ $sql_data[$this->forums_table] = ((!empty($sql_data[$this->forums_table])) ? $sql_data[$this->forums_table] . ', ' : '') . 'forum_posts_approved = forum_posts_approved - 1';
- if ($data['post_postcount'])
+ if ($data['post_postcount'])
+ {
+ $sql_data[$this->users_table] = ((!empty($sql_data[$this->users_table])) ? $sql_data[$this->users_table] . ', ' : '') . 'user_posts = user_posts - 1';
+ }
+
+ $this->config->increment('num_posts', -1, false);
+ }
+ else if ($data['post_visibility'] == ITEM_UNAPPROVED || $data['post_visibility'] == ITEM_REAPPROVE)
{
- $sql_data[$this->users_table] = ((!empty($sql_data[$this->users_table])) ? $sql_data[$this->users_table] . ', ' : '') . 'user_posts = user_posts - 1';
+ $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . 'forum_posts_unapproved = forum_posts_unapproved - 1';
+ $sql_data[TOPICS_TABLE] = (($sql_data[TOPICS_TABLE]) ? $sql_data[TOPICS_TABLE] . ', ' : '') . 'topic_posts_unapproved = topic_posts_unapproved - 1';
+ }
+ else if ($data['post_visibility'] == ITEM_DELETED)
+ {
+ $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . 'forum_posts_softdeleted = forum_posts_softdeleted - 1';
+ $sql_data[TOPICS_TABLE] = (($sql_data[TOPICS_TABLE]) ? $sql_data[TOPICS_TABLE] . ', ' : '') . 'topic_posts_softdeleted = topic_posts_softdeleted - 1';
}
-
- set_config_count('num_posts', -1, true);
}
/**
* Remove topic from forum statistics
*
- * @param $topic_id int The topic to act on
- * @param $forum_id int Forum where the topic is found
- * @param $topic_row array Contains information from the topic, may be empty at call time
- * @param $sql_data array Populated with the SQL changes, may be empty at call time
+ * @param $data array Post and topic data
+ * @param &$sql_data array Populated with the SQL changes, may be empty at call time
* @return null
*/
- public function remove_topic_from_statistic($topic_id, $forum_id, &$topic_row, &$sql_data)
+ public function remove_topic_from_statistic($data, &$sql_data)
{
- // Do we need to grab some topic informations?
- if (!sizeof($topic_row))
+ if ($data['topic_visibility'] == ITEM_APPROVED)
{
- $sql = 'SELECT topic_type, topic_posts_approved, topic_posts_unapproved, topic_posts_softdeleted, topic_visibility
- FROM ' . $this->topics_table . '
- WHERE topic_id = ' . (int) $topic_id;
- $result = $this->db->sql_query($sql);
- $topic_row = $this->db->sql_fetchrow($result);
- $this->db->sql_freeresult($result);
- }
+ $sql_data[FORUMS_TABLE] .= 'forum_posts_approved = forum_posts_approved - 1, forum_topics_approved = forum_topics_approved - 1';
- // If this is an edited topic or the first post the topic gets completely disapproved later on...
- $sql_data[$this->forums_table] = (($sql_data[$this->forums_table]) ? $sql_data[$this->forums_table] . ', ' : '') . 'forum_topics_approved = forum_topics_approved - 1';
- $sql_data[$this->forums_table] .= ', forum_posts_approved = forum_posts_approved - ' . $topic_row['topic_posts_approved'];
- $sql_data[$this->forums_table] .= ', forum_posts_unapproved = forum_posts_unapproved - ' . $topic_row['topic_posts_unapproved'];
- $sql_data[$this->forums_table] .= ', forum_posts_softdeleted = forum_posts_softdeleted - ' . $topic_row['topic_posts_softdeleted'];
-
- set_config_count('num_topics', -1, true);
- set_config_count('num_posts', $topic_row['topic_posts_approved'] * (-1), true);
-
- // Get user post count information
- $sql = 'SELECT poster_id, COUNT(post_id) AS num_posts
- FROM ' . $this->posts_table . '
- WHERE topic_id = ' . (int) $topic_id . '
- AND post_postcount = 1
- AND post_visibility = ' . ITEM_APPROVED . '
- GROUP BY poster_id';
- $result = $this->db->sql_query($sql);
-
- $postcounts = array();
- while ($row = $this->db->sql_fetchrow($result))
+ if ($data['post_postcount'])
+ {
+ $sql_data[$this->users_table] = ((!empty($sql_data[$this->users_table])) ? $sql_data[$this->users_table] . ', ' : '') . 'user_posts = user_posts - 1';
+ }
+ }
+ else if ($data['topic_visibility'] == ITEM_UNAPPROVED || $data['post_visibility'] == ITEM_REAPPROVE)
{
- $postcounts[(int) $row['num_posts']][] = (int) $row['poster_id'];
+ $sql_data[FORUMS_TABLE] .= 'forum_posts_unapproved = forum_posts_unapproved - 1, forum_topics_unapproved = forum_topics_unapproved - 1';
}
- $this->db->sql_freeresult($result);
-
- // Decrement users post count
- foreach ($postcounts as $num_posts => $poster_ids)
+ else if ($data['topic_visibility'] == ITEM_DELETED)
{
- $sql = 'UPDATE ' . $this->users_table . '
- SET user_posts = 0
- WHERE user_posts < ' . $num_posts . '
- AND ' . $this->db->sql_in_set('user_id', $poster_ids);
- $this->db->sql_query($sql);
-
- $sql = 'UPDATE ' . $this->users_table . '
- SET user_posts = user_posts - ' . $num_posts . '
- WHERE user_posts >= ' . $num_posts . '
- AND ' . $this->db->sql_in_set('user_id', $poster_ids);
- $this->db->sql_query($sql);
+ $sql_data[FORUMS_TABLE] .= 'forum_posts_softdeleted = forum_posts_softdeleted - 1, forum_topics_softdeleted = forum_topics_softdeleted - 1';
}
+
}
}
diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php
index e330fb5b6d..dd89d0504a 100644
--- a/phpBB/phpbb/controller/helper.php
+++ b/phpBB/phpbb/controller/helper.php
@@ -50,7 +50,7 @@ class helper
protected $phpbb_root_path;
/**
- * PHP extension
+ * PHP file extension
* @var string
*/
protected $php_ext;
@@ -65,7 +65,7 @@ class helper
* @param \phpbb\extension\manager $manager Extension manager object
* @param \phpbb\symfony_request $symfony_request Symfony Request object
* @param string $phpbb_root_path phpBB root path
- * @param string $php_ext PHP extension
+ * @param string $php_ext PHP file extension
*/
public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\config\config $config, \phpbb\controller\provider $provider, \phpbb\extension\manager $manager, \phpbb\symfony_request $symfony_request, $phpbb_root_path, $php_ext)
{
@@ -82,9 +82,11 @@ class helper
/**
* Automate setting up the page and creating the response object.
*
- * @param string $handle The template handle to render
+ * @param string $template_file The template handle to render
* @param string $page_title The title of the page to output
* @param int $status_code The status code to be sent to the page header
+ * @param bool $display_online_list Do we display online users list
+ *
* @return Response object containing rendered page
*/
public function render($template_file, $page_title = '', $status_code = 200, $display_online_list = false)
diff --git a/phpBB/phpbb/controller/resolver.php b/phpBB/phpbb/controller/resolver.php
index efab34b701..948a6a218c 100644
--- a/phpBB/phpbb/controller/resolver.php
+++ b/phpBB/phpbb/controller/resolver.php
@@ -41,6 +41,12 @@ class resolver implements ControllerResolverInterface
protected $template;
/**
+ * Request type cast helper object
+ * @var \phpbb\request\type_cast_helper
+ */
+ protected $type_cast_helper;
+
+ /**
* phpBB root path
* @var string
*/
@@ -59,6 +65,7 @@ class resolver implements ControllerResolverInterface
$this->user = $user;
$this->container = $container;
$this->template = $template;
+ $this->type_cast_helper = new \phpbb\request\type_cast_helper();
$this->phpbb_root_path = $phpbb_root_path;
}
@@ -138,7 +145,16 @@ class resolver implements ControllerResolverInterface
{
if (array_key_exists($param->name, $attributes))
{
- $arguments[] = $attributes[$param->name];
+ if (is_string($attributes[$param->name]))
+ {
+ $value = $attributes[$param->name];
+ $this->type_cast_helper->set_var($value, $attributes[$param->name], 'string', true, false);
+ $arguments[] = $value;
+ }
+ else
+ {
+ $arguments[] = $attributes[$param->name];
+ }
}
else if ($param->getClass() && $param->getClass()->isInstance($request))
{
diff --git a/phpBB/phpbb/cron/manager.php b/phpBB/phpbb/cron/manager.php
index b0601e641a..5c8ac04b77 100644
--- a/phpBB/phpbb/cron/manager.php
+++ b/phpBB/phpbb/cron/manager.php
@@ -35,6 +35,8 @@ class manager
* Constructor. Loads all available tasks.
*
* @param array|\Traversable $tasks Provides an iterable set of task names
+ * @param string $phpbb_root_path Relative path to phpBB root
+ * @param string $php_ext PHP file extension
*/
public function __construct($tasks, $phpbb_root_path, $php_ext)
{
diff --git a/phpBB/phpbb/cron/task/core/prune_all_forums.php b/phpBB/phpbb/cron/task/core/prune_all_forums.php
index 032ba1d2cc..b47939ccbe 100644
--- a/phpBB/phpbb/cron/task/core/prune_all_forums.php
+++ b/phpBB/phpbb/cron/task/core/prune_all_forums.php
@@ -31,7 +31,7 @@ class prune_all_forums extends \phpbb\cron\task\base
* Constructor.
*
* @param string $phpbb_root_path The root path
- * @param string $php_ext The PHP extension
+ * @param string $php_ext The PHP file extension
* @param \phpbb\config\config $config The config
* @param \phpbb\db\driver\driver_interface $db The db connection
*/
diff --git a/phpBB/phpbb/cron/task/core/prune_forum.php b/phpBB/phpbb/cron/task/core/prune_forum.php
index 8da0048baa..ba68565197 100644
--- a/phpBB/phpbb/cron/task/core/prune_forum.php
+++ b/phpBB/phpbb/cron/task/core/prune_forum.php
@@ -41,7 +41,7 @@ class prune_forum extends \phpbb\cron\task\base implements \phpbb\cron\task\para
* Constructor.
*
* @param string $phpbb_root_path The root path
- * @param string $php_ext The PHP extension
+ * @param string $php_ext PHP file extension
* @param \phpbb\config\config $config The config
* @param \phpbb\db\driver\driver_interface $db The db connection
*/
diff --git a/phpBB/phpbb/cron/task/core/prune_shadow_topics.php b/phpBB/phpbb/cron/task/core/prune_shadow_topics.php
index 83a2460454..97a4b0ea86 100644
--- a/phpBB/phpbb/cron/task/core/prune_shadow_topics.php
+++ b/phpBB/phpbb/cron/task/core/prune_shadow_topics.php
@@ -43,7 +43,7 @@ class prune_shadow_topics extends \phpbb\cron\task\base implements \phpbb\cron\t
* Constructor.
*
* @param string $phpbb_root_path The root path
- * @param string $php_ext The PHP extension
+ * @param string $php_ext PHP file extension
* @param \phpbb\config\config $config The config
* @param \phpbb\db\driver\driver_interface $db The db connection
* @param \phpbb\log\log $log The phpBB log system
diff --git a/phpBB/phpbb/cron/task/core/queue.php b/phpBB/phpbb/cron/task/core/queue.php
index 553e424bd0..796a96d7f5 100644
--- a/phpBB/phpbb/cron/task/core/queue.php
+++ b/phpBB/phpbb/cron/task/core/queue.php
@@ -26,7 +26,7 @@ class queue extends \phpbb\cron\task\base
* Constructor.
*
* @param string $phpbb_root_path The root path
- * @param string $php_ext The PHP extension
+ * @param string $php_ext PHP file extension
* @param \phpbb\config\config $config The config
*/
public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config)
diff --git a/phpBB/phpbb/cron/task/core/tidy_database.php b/phpBB/phpbb/cron/task/core/tidy_database.php
index ec058b4a50..949bba8012 100644
--- a/phpBB/phpbb/cron/task/core/tidy_database.php
+++ b/phpBB/phpbb/cron/task/core/tidy_database.php
@@ -26,7 +26,7 @@ class tidy_database extends \phpbb\cron\task\base
* Constructor.
*
* @param string $phpbb_root_path The root path
- * @param string $php_ext The PHP extension
+ * @param string $php_ext The PHP file extension
* @param \phpbb\config\config $config The config
*/
public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config)
diff --git a/phpBB/phpbb/cron/task/core/tidy_search.php b/phpBB/phpbb/cron/task/core/tidy_search.php
index 2c30274dfa..ce16b3f988 100644
--- a/phpBB/phpbb/cron/task/core/tidy_search.php
+++ b/phpBB/phpbb/cron/task/core/tidy_search.php
@@ -31,7 +31,7 @@ class tidy_search extends \phpbb\cron\task\base
* Constructor.
*
* @param string $phpbb_root_path The root path
- * @param string $php_ext The PHP extension
+ * @param string $php_ext The PHP file extension
* @param \phpbb\auth\auth $auth The auth
* @param \phpbb\config\config $config The config
* @param \phpbb\db\driver\driver_interface $db The db connection
diff --git a/phpBB/phpbb/cron/task/core/tidy_warnings.php b/phpBB/phpbb/cron/task/core/tidy_warnings.php
index 058288222c..7b67eae6ef 100644
--- a/phpBB/phpbb/cron/task/core/tidy_warnings.php
+++ b/phpBB/phpbb/cron/task/core/tidy_warnings.php
@@ -28,7 +28,7 @@ class tidy_warnings extends \phpbb\cron\task\base
* Constructor.
*
* @param string $phpbb_root_path The root path
- * @param string $php_ext The PHP extension
+ * @param string $php_ext PHP file extension
* @param \phpbb\config\config $config The config
*/
public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config)
diff --git a/phpBB/phpbb/cron/task/wrapper.php b/phpBB/phpbb/cron/task/wrapper.php
index 11399282d3..8a4a8b1f0c 100644
--- a/phpBB/phpbb/cron/task/wrapper.php
+++ b/phpBB/phpbb/cron/task/wrapper.php
@@ -29,6 +29,8 @@ class wrapper
* Wraps a task $task, which must implement cron_task interface.
*
* @param \phpbb\cron\task\task $task The cron task to wrap.
+ * @param string $phpbb_root_path Relative path to phpBB root
+ * @param string $php_ext PHP file extension
*/
public function __construct(\phpbb\cron\task\task $task, $phpbb_root_path, $php_ext)
{
diff --git a/phpBB/phpbb/datetime.php b/phpBB/phpbb/datetime.php
index 9c9292a8e4..e674707883 100644
--- a/phpBB/phpbb/datetime.php
+++ b/phpBB/phpbb/datetime.php
@@ -38,9 +38,9 @@ class datetime extends \DateTime
* 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 user $user object for context.
* @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)
{
diff --git a/phpBB/phpbb/db/driver/driver.php b/phpBB/phpbb/db/driver/driver.php
index 3e9110d8bc..9fc04d47a1 100644
--- a/phpBB/phpbb/db/driver/driver.php
+++ b/phpBB/phpbb/db/driver/driver.php
@@ -372,6 +372,17 @@ abstract class driver implements driver_interface
/**
* {@inheritDoc}
*/
+ function sql_not_like_expression($expression)
+ {
+ $expression = utf8_str_replace(array('_', '%'), array("\_", "\%"), $expression);
+ $expression = utf8_str_replace(array(chr(0) . "\_", chr(0) . "\%"), array('_', '%'), $expression);
+
+ return $this->_sql_not_like_expression('NOT LIKE \'' . $this->sql_escape($expression) . '\'');
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public function sql_case($condition, $action_true, $action_false = false)
{
$sql_case = 'CASE WHEN ' . $condition;
diff --git a/phpBB/phpbb/db/driver/driver_interface.php b/phpBB/phpbb/db/driver/driver_interface.php
index 6722d059a5..8b487c5d42 100644
--- a/phpBB/phpbb/db/driver/driver_interface.php
+++ b/phpBB/phpbb/db/driver/driver_interface.php
@@ -419,6 +419,16 @@ interface driver_interface
public function sql_like_expression($expression);
/**
+ * Correctly adjust NOT LIKE expression for special characters
+ * Some DBMS are handling them in a different way
+ *
+ * @param string $expression The expression to use. Every wildcard is
+ * escaped, except $this->any_char and $this->one_char
+ * @return string A SQL statement like: "NOT LIKE 'bertie_%'"
+ */
+ public function sql_not_like_expression($expression);
+
+ /**
* Explain queries
*
* @param string $mode Available modes: display, start, stop,
diff --git a/phpBB/phpbb/db/driver/factory.php b/phpBB/phpbb/db/driver/factory.php
index f0fa18051b..fb3a826254 100644
--- a/phpBB/phpbb/db/driver/factory.php
+++ b/phpBB/phpbb/db/driver/factory.php
@@ -420,6 +420,14 @@ class factory implements driver_interface
/**
* {@inheritdoc}
*/
+ public function sql_not_like_expression($expression)
+ {
+ return $this->get_driver()->sql_not_like_expression($expression);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
public function sql_report($mode, $query = '')
{
return $this->get_driver()->sql_report($mode, $query);
diff --git a/phpBB/phpbb/db/driver/mssql.php b/phpBB/phpbb/db/driver/mssql.php
index 268463a151..f9ea884ce2 100644
--- a/phpBB/phpbb/db/driver/mssql.php
+++ b/phpBB/phpbb/db/driver/mssql.php
@@ -351,6 +351,15 @@ class mssql extends \phpbb\db\driver\driver
}
/**
+ * Build NOT LIKE expression
+ * @access private
+ */
+ function _sql_not_like_expression($expression)
+ {
+ return $expression . " ESCAPE '\\'";
+ }
+
+ /**
* return sql error array
* @access private
*/
diff --git a/phpBB/phpbb/db/driver/mssql_base.php b/phpBB/phpbb/db/driver/mssql_base.php
index e7101903b8..514df9eaca 100644
--- a/phpBB/phpbb/db/driver/mssql_base.php
+++ b/phpBB/phpbb/db/driver/mssql_base.php
@@ -52,6 +52,15 @@ abstract class mssql_base extends \phpbb\db\driver\driver
}
/**
+ * Build NOT LIKE expression
+ * @access private
+ */
+ function _sql_not_like_expression($expression)
+ {
+ return $expression . " ESCAPE '\\'";
+ }
+
+ /**
* Build db-specific query data
* @access private
*/
diff --git a/phpBB/phpbb/db/driver/mysql_base.php b/phpBB/phpbb/db/driver/mysql_base.php
index e7c9b63f20..5e0b359134 100644
--- a/phpBB/phpbb/db/driver/mysql_base.php
+++ b/phpBB/phpbb/db/driver/mysql_base.php
@@ -112,6 +112,15 @@ abstract class mysql_base extends \phpbb\db\driver\driver
}
/**
+ * Build NOT LIKE expression
+ * @access private
+ */
+ function _sql_not_like_expression($expression)
+ {
+ return $expression;
+ }
+
+ /**
* Build db-specific query data
* @access private
*/
diff --git a/phpBB/phpbb/db/driver/oracle.php b/phpBB/phpbb/db/driver/oracle.php
index d1a186f1ba..6dcab5dd7d 100644
--- a/phpBB/phpbb/db/driver/oracle.php
+++ b/phpBB/phpbb/db/driver/oracle.php
@@ -645,6 +645,15 @@ class oracle extends \phpbb\db\driver\driver
return $expression . " ESCAPE '\\'";
}
+ /**
+ * Build NOT LIKE expression
+ * @access private
+ */
+ function _sql_not_like_expression($expression)
+ {
+ return $expression . " ESCAPE '\\'";
+ }
+
function _sql_custom_build($stage, $data)
{
return $data;
diff --git a/phpBB/phpbb/db/driver/postgres.php b/phpBB/phpbb/db/driver/postgres.php
index 83e9fa51f6..a3b9aa4c6b 100644
--- a/phpBB/phpbb/db/driver/postgres.php
+++ b/phpBB/phpbb/db/driver/postgres.php
@@ -371,6 +371,15 @@ class postgres extends \phpbb\db\driver\driver
}
/**
+ * Build NOT LIKE expression
+ * @access private
+ */
+ function _sql_not_like_expression($expression)
+ {
+ return $expression;
+ }
+
+ /**
* {@inheritDoc}
*/
function cast_expr_to_bigint($expression)
diff --git a/phpBB/phpbb/db/driver/sqlite.php b/phpBB/phpbb/db/driver/sqlite.php
index 2112e5ba2f..d5da0e2438 100644
--- a/phpBB/phpbb/db/driver/sqlite.php
+++ b/phpBB/phpbb/db/driver/sqlite.php
@@ -277,7 +277,7 @@ class sqlite extends \phpbb\db\driver\driver
*/
function sql_like_expression($expression)
{
- // Unlike LIKE, GLOB is case sensitive (unfortunatly). SQLite users need to live with it!
+ // Unlike LIKE, GLOB is unfortunately case sensitive.
// We only catch * and ? here, not the character map possible on file globbing.
$expression = str_replace(array(chr(0) . '_', chr(0) . '%'), array(chr(0) . '?', chr(0) . '*'), $expression);
@@ -288,6 +288,23 @@ class sqlite extends \phpbb\db\driver\driver
}
/**
+ * {@inheritDoc}
+ *
+ * For SQLite an underscore is a not-known character...
+ */
+ function sql_not_like_expression($expression)
+ {
+ // Unlike NOT LIKE, NOT GLOB is unfortunately case sensitive.
+ // We only catch * and ? here, not the character map possible on file globbing.
+ $expression = str_replace(array(chr(0) . '_', chr(0) . '%'), array(chr(0) . '?', chr(0) . '*'), $expression);
+
+ $expression = str_replace(array('?', '*'), array("\?", "\*"), $expression);
+ $expression = str_replace(array(chr(0) . "\?", chr(0) . "\*"), array('?', '*'), $expression);
+
+ return 'NOT GLOB \'' . $this->sql_escape($expression) . '\'';
+ }
+
+ /**
* return sql error array
* @access private
*/
diff --git a/phpBB/phpbb/db/driver/sqlite3.php b/phpBB/phpbb/db/driver/sqlite3.php
index 0922229e0a..4e3e0d3329 100644
--- a/phpBB/phpbb/db/driver/sqlite3.php
+++ b/phpBB/phpbb/db/driver/sqlite3.php
@@ -260,11 +260,11 @@ class sqlite3 extends \phpbb\db\driver\driver
/**
* {@inheritDoc}
*
- * For SQLite an underscore is a not-known character...
+ * For SQLite an underscore is an unknown character.
*/
public function sql_like_expression($expression)
{
- // Unlike LIKE, GLOB is case sensitive (unfortunatly). SQLite users need to live with it!
+ // Unlike LIKE, GLOB is unfortunately case sensitive.
// We only catch * and ? here, not the character map possible on file globbing.
$expression = str_replace(array(chr(0) . '_', chr(0) . '%'), array(chr(0) . '?', chr(0) . '*'), $expression);
@@ -275,6 +275,23 @@ class sqlite3 extends \phpbb\db\driver\driver
}
/**
+ * {@inheritDoc}
+ *
+ * For SQLite an underscore is an unknown character.
+ */
+ public function sql_not_like_expression($expression)
+ {
+ // Unlike NOT LIKE, NOT GLOB is unfortunately case sensitive
+ // We only catch * and ? here, not the character map possible on file globbing.
+ $expression = str_replace(array(chr(0) . '_', chr(0) . '%'), array(chr(0) . '?', chr(0) . '*'), $expression);
+
+ $expression = str_replace(array('?', '*'), array("\?", "\*"), $expression);
+ $expression = str_replace(array(chr(0) . "\?", chr(0) . "\*"), array('?', '*'), $expression);
+
+ return 'NOT GLOB \'' . $this->sql_escape($expression) . '\'';
+ }
+
+ /**
* return sql error array
*
* @return array
diff --git a/phpBB/phpbb/db/migration/data/v310/captcha_plugins.php b/phpBB/phpbb/db/migration/data/v310/captcha_plugins.php
new file mode 100644
index 0000000000..13071e9891
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/captcha_plugins.php
@@ -0,0 +1,44 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v310;
+
+class captcha_plugins extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v310\rc2',
+ );
+ }
+
+ public function update_data()
+ {
+ $captcha_plugin = $this->config['captcha_plugin'];
+ if (strpos($this->config['captcha_plugin'], 'phpbb_captcha_') === 0)
+ {
+ $captcha_plugin = substr($this->config['captcha_plugin'], strlen('phpbb_captcha_'));
+ }
+
+ return array(
+ array('if', array(
+ (is_file($this->phpbb_root_path . 'phpbb/captcha/plugins/' . $captcha_plugin . '.' . $this->php_ext)),
+ array('config.update', array('captcha_plugin', 'core.captcha.plugins.' . $captcha_plugin)),
+ )),
+ array('if', array(
+ (!is_file($this->phpbb_root_path . 'phpbb/captcha/plugins/' . $captcha_plugin . '.' . $this->php_ext)),
+ array('config.update', array('captcha_plugin', 'core.captcha.plugins.nogd')),
+ )),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v310/notifications_use_full_name.php b/phpBB/phpbb/db/migration/data/v310/notifications_use_full_name.php
new file mode 100644
index 0000000000..30168f4b0b
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/notifications_use_full_name.php
@@ -0,0 +1,117 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v310;
+
+class notifications_use_full_name extends \phpbb\db\migration\migration
+{
+ protected $notification_types = array(
+ 'admin_activate_user',
+ 'approve_post',
+ 'approve_topic',
+ 'bookmark',
+ 'disapprove_post',
+ 'disapprove_topic',
+ 'group_request',
+ 'group_request_approved',
+ 'pm',
+ 'post',
+ 'post_in_queue',
+ 'quote',
+ 'report_pm',
+ 'report_pm_closed',
+ 'report_post',
+ 'report_post_closed',
+ 'topic',
+ 'topic_in_queue');
+
+ protected $notification_methods = array(
+ 'email',
+ 'jabber',
+ );
+
+ static public function depends_on()
+ {
+ return array('\phpbb\db\migration\data\v310\rc3');
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('custom', array(array($this, 'update_notifications_name'))),
+ array('custom', array(array($this, 'update_notifications_method_name'))),
+ );
+ }
+
+ public function revert_data()
+ {
+ return array(
+ array('custom', array(array($this, 'revert_notifications_name'))),
+ array('custom', array(array($this, 'revert_notifications_method_name'))),
+ );
+ }
+
+ public function update_notifications_method_name()
+ {
+ foreach ($this->notification_methods as $notification_method)
+ {
+ $sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . "
+ SET method = 'notification.method.{$notification_method}'
+ WHERE method = '{$notification_method}'";
+ $this->db->sql_query($sql);
+ }
+ }
+
+ public function revert_notifications_method_name()
+ {
+ foreach ($this->notification_methods as $notification_method)
+ {
+ $sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . "
+ SET method = '{$notification_method}'
+ WHERE method = 'notification.method.{$notification_method}'";
+ $this->db->sql_query($sql);
+ }
+ }
+
+ public function update_notifications_name()
+ {
+ foreach ($this->notification_types as $notification_type)
+ {
+ $sql = 'UPDATE ' . NOTIFICATION_TYPES_TABLE . "
+ SET notification_type_name = 'notification.type.{$notification_type}'
+ WHERE notification_type_name = '{$notification_type}'";
+ $this->db->sql_query($sql);
+
+ $sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . "
+ SET item_type = 'notification.type.{$notification_type}'
+ WHERE item_type = '{$notification_type}'";
+ $this->db->sql_query($sql);
+ }
+ }
+
+ public function revert_notifications_name()
+ {
+ foreach ($this->notification_types as $notification_type)
+ {
+ $sql = 'UPDATE ' . NOTIFICATION_TYPES_TABLE . "
+ SET notification_type_name = '{$notification_type}'
+ WHERE notification_type_name = 'notification.type.{$notification_type}'";
+ $this->db->sql_query($sql);
+
+ $sql = 'UPDATE ' . USER_NOTIFICATIONS_TABLE . "
+ SET item_type = '{$notification_type}'
+ WHERE item_type = 'notification.type.{$notification_type}'";
+ $this->db->sql_query($sql);
+ }
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_facebook.php b/phpBB/phpbb/db/migration/data/v310/profilefield_facebook.php
index 5964e7a997..7324b893cc 100644
--- a/phpBB/phpbb/db/migration/data/v310/profilefield_facebook.php
+++ b/phpBB/phpbb/db/migration/data/v310/profilefield_facebook.php
@@ -18,8 +18,9 @@ class profilefield_facebook extends \phpbb\db\migration\profilefield_base_migrat
static public function depends_on()
{
return array(
- '\phpbb\db\migration\data\v310\profilefield_types',
+ '\phpbb\db\migration\data\v310\profilefield_contact_field',
'\phpbb\db\migration\data\v310\profilefield_show_novalue',
+ '\phpbb\db\migration\data\v310\profilefield_types',
);
}
diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_googleplus.php b/phpBB/phpbb/db/migration/data/v310/profilefield_googleplus.php
index 9bef0a4c0b..3b0963fc19 100644
--- a/phpBB/phpbb/db/migration/data/v310/profilefield_googleplus.php
+++ b/phpBB/phpbb/db/migration/data/v310/profilefield_googleplus.php
@@ -18,8 +18,9 @@ class profilefield_googleplus extends \phpbb\db\migration\profilefield_base_migr
static public function depends_on()
{
return array(
- '\phpbb\db\migration\data\v310\profilefield_types',
+ '\phpbb\db\migration\data\v310\profilefield_contact_field',
'\phpbb\db\migration\data\v310\profilefield_show_novalue',
+ '\phpbb\db\migration\data\v310\profilefield_types',
);
}
diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_skype.php b/phpBB/phpbb/db/migration/data/v310/profilefield_skype.php
index 9a5de9d0eb..0dbe9041bb 100644
--- a/phpBB/phpbb/db/migration/data/v310/profilefield_skype.php
+++ b/phpBB/phpbb/db/migration/data/v310/profilefield_skype.php
@@ -18,8 +18,9 @@ class profilefield_skype extends \phpbb\db\migration\profilefield_base_migration
static public function depends_on()
{
return array(
- '\phpbb\db\migration\data\v310\profilefield_types',
+ '\phpbb\db\migration\data\v310\profilefield_contact_field',
'\phpbb\db\migration\data\v310\profilefield_show_novalue',
+ '\phpbb\db\migration\data\v310\profilefield_types',
);
}
diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_twitter.php b/phpBB/phpbb/db/migration/data/v310/profilefield_twitter.php
index 68d038f609..850e096439 100644
--- a/phpBB/phpbb/db/migration/data/v310/profilefield_twitter.php
+++ b/phpBB/phpbb/db/migration/data/v310/profilefield_twitter.php
@@ -18,8 +18,9 @@ class profilefield_twitter extends \phpbb\db\migration\profilefield_base_migrati
static public function depends_on()
{
return array(
- '\phpbb\db\migration\data\v310\profilefield_types',
+ '\phpbb\db\migration\data\v310\profilefield_contact_field',
'\phpbb\db\migration\data\v310\profilefield_show_novalue',
+ '\phpbb\db\migration\data\v310\profilefield_types',
);
}
diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_youtube.php b/phpBB/phpbb/db/migration/data/v310/profilefield_youtube.php
index bb90c0aa5c..40a569d2a2 100644
--- a/phpBB/phpbb/db/migration/data/v310/profilefield_youtube.php
+++ b/phpBB/phpbb/db/migration/data/v310/profilefield_youtube.php
@@ -18,8 +18,9 @@ class profilefield_youtube extends \phpbb\db\migration\profilefield_base_migrati
static public function depends_on()
{
return array(
- '\phpbb\db\migration\data\v310\profilefield_types',
+ '\phpbb\db\migration\data\v310\profilefield_contact_field',
'\phpbb\db\migration\data\v310\profilefield_show_novalue',
+ '\phpbb\db\migration\data\v310\profilefield_types',
);
}
diff --git a/phpBB/phpbb/db/migration/data/v310/rc3.php b/phpBB/phpbb/db/migration/data/v310/rc3.php
new file mode 100644
index 0000000000..0e6a452251
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/rc3.php
@@ -0,0 +1,35 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v310;
+
+class rc3 extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array(
+ '\phpbb\db\migration\data\v310\rc2',
+ '\phpbb\db\migration\data\v310\captcha_plugins',
+ '\phpbb\db\migration\data\v310\rename_too_long_indexes',
+ '\phpbb\db\migration\data\v310\search_type',
+ '\phpbb\db\migration\data\v310\topic_sort_username',
+ );
+ }
+
+ public function update_data()
+ {
+ return array(
+ array('config.update', array('version', '3.1.0-RC3')),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v310/rename_too_long_indexes.php b/phpBB/phpbb/db/migration/data/v310/rename_too_long_indexes.php
new file mode 100644
index 0000000000..8d2a15d8ea
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/rename_too_long_indexes.php
@@ -0,0 +1,38 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v310;
+
+class rename_too_long_indexes extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array('\phpbb\db\migration\data\v30x\release_3_0_0');
+ }
+
+ public function update_schema()
+ {
+ return array(
+ 'drop_keys' => array(
+ $this->table_prefix . 'search_wordmatch' => array(
+ 'unq_mtch',
+ ),
+ ),
+ 'add_unique_index' => array(
+ $this->table_prefix . 'search_wordmatch' => array(
+ 'un_mtch' => array('word_id', 'post_id', 'title_match'),
+ ),
+ ),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v310/search_type.php b/phpBB/phpbb/db/migration/data/v310/search_type.php
new file mode 100644
index 0000000000..f89456ae19
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/search_type.php
@@ -0,0 +1,34 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v310;
+
+class search_type 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(
+ (is_file($this->phpbb_root_path . 'phpbb/search/' . $this->config['search_type'] . $this->php_ext)),
+ array('config.update', array('search_type', '\\phpbb\\search\\' . $this->config['search_type'])),
+ )),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/data/v310/soft_delete_mod_convert.php b/phpBB/phpbb/db/migration/data/v310/soft_delete_mod_convert.php
index f5970e74b2..58845b88ec 100644
--- a/phpBB/phpbb/db/migration/data/v310/soft_delete_mod_convert.php
+++ b/phpBB/phpbb/db/migration/data/v310/soft_delete_mod_convert.php
@@ -119,8 +119,9 @@ class soft_delete_mod_convert extends \phpbb\db\migration\migration
{
return new \phpbb\content_visibility(
new \phpbb\auth\auth(),
+ $this->config,
$this->db,
- new \phpbb\user(),
+ new \phpbb\user('\phpbb\datetime'),
$this->phpbb_root_path,
$this->php_ext,
$this->table_prefix . 'forums',
diff --git a/phpBB/phpbb/db/migration/data/v310/topic_sort_username.php b/phpBB/phpbb/db/migration/data/v310/topic_sort_username.php
new file mode 100644
index 0000000000..527da20590
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/topic_sort_username.php
@@ -0,0 +1,44 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+namespace phpbb\db\migration\data\v310;
+
+class topic_sort_username extends \phpbb\db\migration\migration
+{
+ static public function depends_on()
+ {
+ return array('\phpbb\db\migration\data\v310\dev');
+ }
+
+ public function update_schema()
+ {
+ return array(
+ 'change_columns' => array(
+ $this->table_prefix . 'topics' => array(
+ 'topic_first_poster_name' => array('VCHAR_UNI:255', '', 'true_sort'),
+ ),
+ ),
+ );
+ }
+
+ public function revert_schema()
+ {
+ return array(
+ 'change_columns' => array(
+ $this->table_prefix . 'topics' => array(
+ 'topic_first_poster_name' => array('VCHAR_UNI:255', ''),
+ ),
+ ),
+ );
+ }
+}
diff --git a/phpBB/phpbb/db/migration/tool/permission.php b/phpBB/phpbb/db/migration/tool/permission.php
index d2df27613a..5cfbc5ca00 100644
--- a/phpBB/phpbb/db/migration/tool/permission.php
+++ b/phpBB/phpbb/db/migration/tool/permission.php
@@ -105,6 +105,7 @@ class permission implements \phpbb\db\migration\tool\tool_interface
* @param string $auth_option The name of the permission (auth) option
* @param bool $global True for checking a global permission setting,
* False for a local permission setting
+ * @param int|false $copy_from If set, contains the id of the permission from which to copy the new one.
* @return null
*/
public function add($auth_option, $global = true, $copy_from = false)
@@ -243,7 +244,9 @@ class permission implements \phpbb\db\migration\tool\tool_interface
* Add a new permission role
*
* @param string $role_name The new role name
- * @param sting $role_type The type (u_, m_, a_)
+ * @param string $role_type The type (u_, m_, a_)
+ * @param string $role_description Description of the new role
+ *
* @return null
*/
public function role_add($role_name, $role_type, $role_description = '')
diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php
index ae0c695aa2..3567570137 100644
--- a/phpBB/phpbb/db/tools.php
+++ b/phpBB/phpbb/db/tools.php
@@ -1816,7 +1816,8 @@ class tools
$old_return_statements = $this->return_statements;
$this->return_statements = true;
- $indexes = $this->mssql_get_existing_indexes($table_name, $column_name);
+ $indexes = $this->get_existing_indexes($table_name, $column_name);
+ $indexes = array_merge($indexes, $this->get_existing_indexes($table_name, $column_name, true));
// Drop any indexes
$recreate_indexes = array();
@@ -2038,7 +2039,7 @@ class tools
break;
case 'oracle':
- $statements[] = 'ALTER TABLE ' . $table_name . 'add CONSTRAINT pk_' . $table_name . ' PRIMARY KEY (' . implode(', ', $column) . ')';
+ $statements[] = 'ALTER TABLE ' . $table_name . ' add CONSTRAINT pk_' . $table_name . ' PRIMARY KEY (' . implode(', ', $column) . ')';
break;
case 'sqlite':
@@ -2104,7 +2105,7 @@ class tools
$statements = array();
$table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config)
- if (strlen($table_name . $index_name) - strlen($table_prefix) > 24)
+ if (strlen($table_name . '_' . $index_name) - strlen($table_prefix) > 24)
{
$max_length = strlen($table_prefix) + 24;
trigger_error("Index name '{$table_name}_$index_name' on table '$table_name' is too long. The maximum is $max_length characters.", E_USER_ERROR);
@@ -2274,10 +2275,23 @@ class tools
}
/**
+ * Removes table_name from the index_name if it is at the beginning
+ *
+ * @param $table_name
+ * @param $index_name
+ * @return string
+ */
+ protected function strip_table_name_from_index_name($table_name, $index_name)
+ {
+ return (strpos(strtoupper($index_name), strtoupper($table_name)) === 0) ? substr($index_name, strlen($table_name) + 1) : $index_name;
+ }
+
+ /**
* Change column type (not name!)
*/
function sql_column_change($table_name, $column_name, $column_data, $inline = false)
{
+ $original_column_data = $column_data;
$column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data);
$statements = array();
@@ -2289,12 +2303,14 @@ class tools
$old_return_statements = $this->return_statements;
$this->return_statements = true;
- $indexes = $this->mssql_get_existing_indexes($table_name, $column_name);
+ $indexes = $this->get_existing_indexes($table_name, $column_name);
+ $unique_indexes = $this->get_existing_indexes($table_name, $column_name, true);
// Drop any indexes
- if (!empty($indexes))
+ if (!empty($indexes) || !empty($unique_indexes))
{
- foreach ($indexes as $index_name => $index_data)
+ $drop_indexes = array_merge(array_keys($indexes), array_keys($unique_indexes));
+ foreach ($drop_indexes as $index_name)
{
$result = $this->sql_index_drop($table_name, $index_name);
$statements = array_merge($statements, $result);
@@ -2324,6 +2340,16 @@ class tools
}
}
+ if (!empty($unique_indexes))
+ {
+ // Recreate unique indexes after we changed the column
+ foreach ($unique_indexes as $index_name => $index_data)
+ {
+ $result = $this->sql_create_unique_index($table_name, $index_name, $index_data);
+ $statements = array_merge($statements, $result);
+ }
+ }
+
$this->return_statements = $old_return_statements;
break;
@@ -2333,7 +2359,69 @@ class tools
break;
case 'oracle':
- $statements[] = 'ALTER TABLE ' . $table_name . ' MODIFY ' . $column_name . ' ' . $column_data['column_type_sql'];
+ // We need the data here
+ $old_return_statements = $this->return_statements;
+ $this->return_statements = true;
+
+ // Get list of existing indexes
+ $indexes = $this->get_existing_indexes($table_name, $column_name);
+ $unique_indexes = $this->get_existing_indexes($table_name, $column_name, true);
+
+ // Drop any indexes
+ if (!empty($indexes) || !empty($unique_indexes))
+ {
+ $drop_indexes = array_merge(array_keys($indexes), array_keys($unique_indexes));
+ foreach ($drop_indexes as $index_name)
+ {
+ $result = $this->sql_index_drop($table_name, $this->strip_table_name_from_index_name($table_name, $index_name));
+ $statements = array_merge($statements, $result);
+ }
+ }
+
+ $temp_column_name = 'temp_' . substr(md5($column_name), 0, 25);
+ // Add a temporary table with the new type
+ $result = $this->sql_column_add($table_name, $temp_column_name, $original_column_data);
+ $statements = array_merge($statements, $result);
+
+ // Copy the data to the new column
+ $statements[] = 'UPDATE ' . $table_name . ' SET ' . $temp_column_name . ' = ' . $column_name;
+
+ // Drop the original column
+ $result = $this->sql_column_remove($table_name, $column_name);
+ $statements = array_merge($statements, $result);
+
+ // Recreate the original column with the new type
+ $result = $this->sql_column_add($table_name, $column_name, $original_column_data);
+ $statements = array_merge($statements, $result);
+
+ if (!empty($indexes))
+ {
+ // Recreate indexes after we changed the column
+ foreach ($indexes as $index_name => $index_data)
+ {
+ $result = $this->sql_create_index($table_name, $this->strip_table_name_from_index_name($table_name, $index_name), $index_data);
+ $statements = array_merge($statements, $result);
+ }
+ }
+
+ if (!empty($unique_indexes))
+ {
+ // Recreate unique indexes after we changed the column
+ foreach ($unique_indexes as $index_name => $index_data)
+ {
+ $result = $this->sql_create_unique_index($table_name, $this->strip_table_name_from_index_name($table_name, $index_name), $index_data);
+ $statements = array_merge($statements, $result);
+ }
+ }
+
+ // Copy the data to the original column
+ $statements[] = 'UPDATE ' . $table_name . ' SET ' . $column_name . ' = ' . $temp_column_name;
+
+ // Drop the temporary column again
+ $result = $this->sql_column_remove($table_name, $temp_column_name);
+ $statements = array_merge($statements, $result);
+
+ $this->return_statements = $old_return_statements;
break;
case 'postgres':
@@ -2517,45 +2605,78 @@ class tools
*
* @param string $table_name
* @param string $column_name
+ * @param bool $unique Should we get unique indexes or normal ones
* @return array Array with Index name => columns
*/
- protected function mssql_get_existing_indexes($table_name, $column_name)
+ public function get_existing_indexes($table_name, $column_name, $unique = false)
{
- $existing_indexes = array();
- if ($this->mssql_is_sql_server_2000())
+ switch ($this->sql_layer)
{
- // http://msdn.microsoft.com/en-us/library/aa175912%28v=sql.80%29.aspx
- // Deprecated in SQL Server 2005
- $sql = "SELECT DISTINCT ix.name AS phpbb_index_name
- FROM sysindexes ix
- INNER JOIN sysindexkeys ixc
- ON ixc.id = ix.id
- AND ixc.indid = ix.indid
- INNER JOIN syscolumns cols
- ON cols.colid = ixc.colid
- AND cols.id = ix.id
- WHERE ix.id = object_id('{$table_name}')
- AND cols.name = '{$column_name}'";
+ case 'mysql_40':
+ case 'mysql_41':
+ case 'postgres':
+ case 'sqlite':
+ case 'sqlite3':
+ // Not supported
+ throw new \Exception('DBMS is not supported');
+ break;
}
- else
+
+ $sql = '';
+ $existing_indexes = array();
+
+ switch ($this->sql_layer)
{
- $sql = "SELECT DISTINCT ix.name AS phpbb_index_name
- FROM sys.indexes ix
- INNER JOIN sys.index_columns ixc
- ON ixc.object_id = ix.object_id
- AND ixc.index_id = ix.index_id
- INNER JOIN sys.columns cols
- ON cols.column_id = ixc.column_id
- AND cols.object_id = ix.object_id
- WHERE ix.object_id = object_id('{$table_name}')
- AND cols.name = '{$column_name}'";
+ case 'mssql':
+ case 'mssqlnative':
+ if ($this->mssql_is_sql_server_2000())
+ {
+ // http://msdn.microsoft.com/en-us/library/aa175912%28v=sql.80%29.aspx
+ // Deprecated in SQL Server 2005
+ $sql = "SELECT DISTINCT ix.name AS phpbb_index_name
+ FROM sysindexes ix
+ INNER JOIN sysindexkeys ixc
+ ON ixc.id = ix.id
+ AND ixc.indid = ix.indid
+ INNER JOIN syscolumns cols
+ ON cols.colid = ixc.colid
+ AND cols.id = ix.id
+ WHERE ix.id = object_id('{$table_name}')
+ AND cols.name = '{$column_name}'
+ AND INDEXPROPERTY(ix.id, ix.name, 'IsUnique') = " . ($unique) ? '1' : '0';
+ }
+ else
+ {
+ $sql = "SELECT DISTINCT ix.name AS phpbb_index_name
+ FROM sys.indexes ix
+ INNER JOIN sys.index_columns ixc
+ ON ixc.object_id = ix.object_id
+ AND ixc.index_id = ix.index_id
+ INNER JOIN sys.columns cols
+ ON cols.column_id = ixc.column_id
+ AND cols.object_id = ix.object_id
+ WHERE ix.object_id = object_id('{$table_name}')
+ AND cols.name = '{$column_name}'
+ AND ix.is_unique = " . ($unique) ? '1' : '0';
+ }
+ break;
+
+ case 'oracle':
+ $sql = "SELECT ix.index_name AS phpbb_index_name, ix.uniqueness AS is_unique
+ FROM all_ind_columns ixc, all_indexes ix
+ WHERE ix.index_name = ixc.index_name
+ AND ixc.table_name = '" . strtoupper($table_name) . "'
+ AND ixc.column_name = '" . strtoupper($column_name) . "'";
+ break;
}
$result = $this->db->sql_query($sql);
- $existing_indexes = array();
while ($row = $this->db->sql_fetchrow($result))
{
- $existing_indexes[$row['phpbb_index_name']] = array();
+ if (!isset($row['is_unique']) || ($unique && $row['is_unique'] == 'UNIQUE') || (!$unique && $row['is_unique'] == 'NONUNIQUE'))
+ {
+ $existing_indexes[$row['phpbb_index_name']] = array();
+ }
}
$this->db->sql_freeresult($result);
@@ -2564,35 +2685,47 @@ class tools
return array();
}
- if ($this->mssql_is_sql_server_2000())
- {
- $sql = "SELECT DISTINCT ix.name AS phpbb_index_name, cols.name AS phpbb_column_name
- FROM sysindexes ix
- INNER JOIN sysindexkeys ixc
- ON ixc.id = ix.id
- AND ixc.indid = ix.indid
- INNER JOIN syscolumns cols
- ON cols.colid = ixc.colid
- AND cols.id = ix.id
- WHERE ix.id = object_id('{$table_name}')
- AND " . $this->db->sql_in_set('ix.name', array_keys($existing_indexes));
- }
- else
+ switch ($this->sql_layer)
{
- $sql = "SELECT DISTINCT ix.name AS phpbb_index_name, cols.name AS phpbb_column_name
- FROM sys.indexes ix
- INNER JOIN sys.index_columns ixc
- ON ixc.object_id = ix.object_id
- AND ixc.index_id = ix.index_id
- INNER JOIN sys.columns cols
- ON cols.column_id = ixc.column_id
- AND cols.object_id = ix.object_id
- WHERE ix.object_id = object_id('{$table_name}')
- AND " . $this->db->sql_in_set('ix.name', array_keys($existing_indexes));
+ case 'mssql':
+ case 'mssqlnative':
+ if ($this->mssql_is_sql_server_2000())
+ {
+ $sql = "SELECT DISTINCT ix.name AS phpbb_index_name, cols.name AS phpbb_column_name
+ FROM sysindexes ix
+ INNER JOIN sysindexkeys ixc
+ ON ixc.id = ix.id
+ AND ixc.indid = ix.indid
+ INNER JOIN syscolumns cols
+ ON cols.colid = ixc.colid
+ AND cols.id = ix.id
+ WHERE ix.id = object_id('{$table_name}')
+ AND " . $this->db->sql_in_set('ix.name', array_keys($existing_indexes));
+ }
+ else
+ {
+ $sql = "SELECT DISTINCT ix.name AS phpbb_index_name, cols.name AS phpbb_column_name
+ FROM sys.indexes ix
+ INNER JOIN sys.index_columns ixc
+ ON ixc.object_id = ix.object_id
+ AND ixc.index_id = ix.index_id
+ INNER JOIN sys.columns cols
+ ON cols.column_id = ixc.column_id
+ AND cols.object_id = ix.object_id
+ WHERE ix.object_id = object_id('{$table_name}')
+ AND " . $this->db->sql_in_set('ix.name', array_keys($existing_indexes));
+ }
+ break;
+
+ case 'oracle':
+ $sql = "SELECT index_name AS phpbb_index_name, column_name AS phpbb_column_name
+ FROM all_ind_columns
+ WHERE table_name = '" . strtoupper($table_name) . "'
+ AND " . $this->db->sql_in_set('index_name', array_keys($existing_indexes));
+ break;
}
$result = $this->db->sql_query($sql);
-
while ($row = $this->db->sql_fetchrow($result))
{
$existing_indexes[$row['phpbb_index_name']][] = $row['phpbb_column_name'];
diff --git a/phpBB/phpbb/event/kernel_request_subscriber.php b/phpBB/phpbb/event/kernel_request_subscriber.php
index 323dabb84c..ee9f29a59d 100644
--- a/phpBB/phpbb/event/kernel_request_subscriber.php
+++ b/phpBB/phpbb/event/kernel_request_subscriber.php
@@ -28,7 +28,7 @@ class kernel_request_subscriber implements EventSubscriberInterface
protected $manager;
/**
- * PHP extension
+ * PHP file extension
* @var string
*/
protected $php_ext;
@@ -44,7 +44,7 @@ class kernel_request_subscriber implements EventSubscriberInterface
*
* @param \phpbb\extension\manager $manager Extension manager object
* @param string $root_path Root path
- * @param string $php_ext PHP extension
+ * @param string $php_ext PHP file extension
*/
public function __construct(\phpbb\extension\manager $manager, $root_path, $php_ext)
{
diff --git a/phpBB/phpbb/extension/base.php b/phpBB/phpbb/extension/base.php
index cbbd7bc622..288fb7d19c 100644
--- a/phpBB/phpbb/extension/base.php
+++ b/phpBB/phpbb/extension/base.php
@@ -40,6 +40,7 @@ class base implements \phpbb\extension\extension_interface
*
* @param ContainerInterface $container Container object
* @param \phpbb\finder $extension_finder
+ * @param \phpbb\db\migrator $migrator
* @param string $extension_name Name of this extension (from ext.manager)
* @param string $extension_path Relative path to this extension
*/
@@ -54,6 +55,14 @@ class base implements \phpbb\extension\extension_interface
}
/**
+ * {@inheritdoc}
+ */
+ public function is_enableable()
+ {
+ return true;
+ }
+
+ /**
* Single enable step that installs any included migrations
*
* @param mixed $old_state State returned by previous call of this method
diff --git a/phpBB/phpbb/extension/extension_interface.php b/phpBB/phpbb/extension/extension_interface.php
index cc8b8be980..6a6b6adb8f 100644
--- a/phpBB/phpbb/extension/extension_interface.php
+++ b/phpBB/phpbb/extension/extension_interface.php
@@ -20,6 +20,13 @@ namespace phpbb\extension;
interface extension_interface
{
/**
+ * Indicate whether or not the extension can be enabled.
+ *
+ * @return bool
+ */
+ public function is_enableable();
+
+ /**
* enable_step is executed on enabling an extension until it returns false.
*
* Calls to this function can be made in subsequent requests, when the
diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php
index 4a12e9ec8c..76f0e3558e 100644
--- a/phpBB/phpbb/extension/manager.php
+++ b/phpBB/phpbb/extension/manager.php
@@ -178,6 +178,12 @@ class manager
$old_state = (isset($this->extensions[$name]['ext_state'])) ? unserialize($this->extensions[$name]['ext_state']) : false;
$extension = $this->get_extension($name);
+
+ if (!$extension->is_enableable())
+ {
+ return false;
+ }
+
$state = $extension->enable_step($old_state);
$active = ($state === false);
diff --git a/phpBB/phpbb/extension/metadata_manager.php b/phpBB/phpbb/extension/metadata_manager.php
index 1051021ea7..edca8ee1af 100644
--- a/phpBB/phpbb/extension/metadata_manager.php
+++ b/phpBB/phpbb/extension/metadata_manager.php
@@ -330,27 +330,6 @@ class metadata_manager
}
/**
- * Version validation helper
- *
- * @param string $string The string for comparing to a version
- * @param string $current_version The version to compare to
- * @return bool True/False if meets version requirements
- */
- private function _validate_version($string, $current_version)
- {
- // Allow them to specify their own comparison operator (ex: <3.1.2, >=3.1.0)
- $comparison_matches = false;
- preg_match('#[=<>]+#', $string, $comparison_matches);
-
- if (!empty($comparison_matches))
- {
- return version_compare($current_version, str_replace(array($comparison_matches[0], ' '), '', $string), $comparison_matches[0]);
- }
-
- return version_compare($current_version, $string, '>=');
- }
-
- /**
* Outputs the metadata into the template
*
* @return null
diff --git a/phpBB/phpbb/feed/helper.php b/phpBB/phpbb/feed/helper.php
index 9741b752af..198134cdcf 100644
--- a/phpBB/phpbb/feed/helper.php
+++ b/phpBB/phpbb/feed/helper.php
@@ -36,7 +36,7 @@ class helper
* @param \phpbb\config\config $config Config object
* @param \phpbb\user $user User object
* @param string $phpbb_root_path Root path
- * @param string $phpEx PHP extension
+ * @param string $phpEx PHP file extension
*/
public function __construct(\phpbb\config\config $config, \phpbb\user $user, $phpbb_root_path, $phpEx)
{
diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php
index c522c3273f..2af8b50b54 100644
--- a/phpBB/phpbb/log/log.php
+++ b/phpBB/phpbb/log/log.php
@@ -245,9 +245,9 @@ class log implements \phpbb\log\log_interface
break;
case 'mod':
- $forum_id = (int) $additional_data['forum_id'];
+ $forum_id = isset($additional_data['forum_id']) ? (int) $additional_data['forum_id'] : 0;
unset($additional_data['forum_id']);
- $topic_id = (int) $additional_data['topic_id'];
+ $topic_id = isset($additional_data['topic_id']) ? (int) $additional_data['topic_id'] : 0;
unset($additional_data['topic_id']);
$sql_ary += array(
'log_type' => LOG_MOD,
diff --git a/phpBB/phpbb/mimetype/content_guesser.php b/phpBB/phpbb/mimetype/content_guesser.php
index 9c83e8dd73..f3ad7f5f41 100644
--- a/phpBB/phpbb/mimetype/content_guesser.php
+++ b/phpBB/phpbb/mimetype/content_guesser.php
@@ -20,7 +20,7 @@ class content_guesser extends guesser_base
*/
public function is_supported()
{
- return function_exists('mime_content_type');
+ return function_exists('mime_content_type') && is_callable('mime_content_type');
}
/**
diff --git a/phpBB/phpbb/mimetype/guesser.php b/phpBB/phpbb/mimetype/guesser.php
index 87b164b561..773a1f822a 100644
--- a/phpBB/phpbb/mimetype/guesser.php
+++ b/phpBB/phpbb/mimetype/guesser.php
@@ -99,6 +99,7 @@ class guesser
* Guess mimetype of supplied file
*
* @param string $file Path to file
+ * @param string $file_name The real file name
*
* @return string Guess for mimetype of file
*/
diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php
index 74ef980445..81b450ebbd 100644
--- a/phpBB/phpbb/notification/manager.php
+++ b/phpBB/phpbb/notification/manager.php
@@ -68,12 +68,14 @@ class manager
* @param \phpbb\user_loader $user_loader
* @param \phpbb\config\config $config
* @param \phpbb\db\driver\driver_interface $db
+ * @param \phpbb\cache\service $cache
* @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
*/
public function __construct($notification_types, $notification_methods, ContainerInterface $phpbb_container, \phpbb\user_loader $user_loader, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, $user, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table)
@@ -568,7 +570,7 @@ class manager
{
$subscription_methods[$method_name] = array(
'id' => $method->get_type(),
- 'lang' => 'NOTIFICATION_METHOD_' . strtoupper($method->get_type()),
+ 'lang' => str_replace('.', '_', strtoupper($method->get_type())),
);
}
}
@@ -832,7 +834,7 @@ class 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
+ * @param bool $only_read True (default) to only prune read notifications
*/
public function prune_notifications($timestamp, $only_read = true)
{
@@ -849,8 +851,6 @@ class manager
*/
public function get_item_type_class($notification_type_name, $data = array())
{
- $notification_type_name = (strpos($notification_type_name, 'notification.type.') === 0) ? $notification_type_name : 'notification.type.' . $notification_type_name;
-
$item = $this->load_object($notification_type_name);
$item->set_initial_data($data);
@@ -863,8 +863,6 @@ class manager
*/
public function get_method_class($method_name)
{
- $method_name = (strpos($method_name, 'notification.method.') === 0) ? $method_name : 'notification.method.' . $method_name;
-
return $this->load_object($method_name);
}
diff --git a/phpBB/phpbb/notification/method/email.php b/phpBB/phpbb/notification/method/email.php
index 424f0aaf57..a4b93bc85c 100644
--- a/phpBB/phpbb/notification/method/email.php
+++ b/phpBB/phpbb/notification/method/email.php
@@ -27,7 +27,7 @@ class email extends \phpbb\notification\method\messenger_base
*/
public function get_type()
{
- return 'email';
+ return 'notification.method.email';
}
/**
diff --git a/phpBB/phpbb/notification/method/jabber.php b/phpBB/phpbb/notification/method/jabber.php
index 55de50fecd..09f186e3ca 100644
--- a/phpBB/phpbb/notification/method/jabber.php
+++ b/phpBB/phpbb/notification/method/jabber.php
@@ -27,7 +27,7 @@ class jabber extends \phpbb\notification\method\messenger_base
*/
public function get_type()
{
- return 'jabber';
+ return 'notification.method.jabber';
}
/**
diff --git a/phpBB/phpbb/notification/type/admin_activate_user.php b/phpBB/phpbb/notification/type/admin_activate_user.php
index 364df74cc5..038ca3726e 100644
--- a/phpBB/phpbb/notification/type/admin_activate_user.php
+++ b/phpBB/phpbb/notification/type/admin_activate_user.php
@@ -25,7 +25,7 @@ class admin_activate_user extends \phpbb\notification\type\base
*/
public function get_type()
{
- return 'admin_activate_user';
+ return 'notification.type.admin_activate_user';
}
/**
diff --git a/phpBB/phpbb/notification/type/approve_post.php b/phpBB/phpbb/notification/type/approve_post.php
index a6735dc793..a9e635b41a 100644
--- a/phpBB/phpbb/notification/type/approve_post.php
+++ b/phpBB/phpbb/notification/type/approve_post.php
@@ -27,7 +27,7 @@ class approve_post extends \phpbb\notification\type\post
*/
public function get_type()
{
- return 'approve_post';
+ return 'notification.type.approve_post';
}
/**
@@ -67,7 +67,8 @@ class approve_post extends \phpbb\notification\type\post
/**
* Find the users who want to receive notifications
*
- * @param array $post Data from
+ * @param array $post Data from submit_post
+ * @param array $options Options for finding users for notification
*
* @return array
*/
@@ -80,14 +81,7 @@ class approve_post extends \phpbb\notification\type\post
$users = array();
$users[$post['poster_id']] = array('');
- $auth_read = $this->auth->acl_get_list(array_keys($users), 'f_read', $post['forum_id']);
-
- if (empty($auth_read))
- {
- return array();
- }
-
- return $this->check_user_notification_options($auth_read[$post['forum_id']]['f_read'], array_merge($options, array(
+ return $this->get_authorised_recipients(array_keys($users), $post['forum_id'], array_merge($options, array(
'item_type' => self::$notification_option['id'],
)));
}
diff --git a/phpBB/phpbb/notification/type/approve_topic.php b/phpBB/phpbb/notification/type/approve_topic.php
index 459a0ec348..2f4678359c 100644
--- a/phpBB/phpbb/notification/type/approve_topic.php
+++ b/phpBB/phpbb/notification/type/approve_topic.php
@@ -27,7 +27,7 @@ class approve_topic extends \phpbb\notification\type\topic
*/
public function get_type()
{
- return 'approve_topic';
+ return 'notification.type.approve_topic';
}
/**
@@ -67,7 +67,8 @@ class approve_topic extends \phpbb\notification\type\topic
/**
* Find the users who want to receive notifications
*
- * @param array $post Data from
+ * @param array $post Data from submit_post
+ * @param array $options Options for finding users for notification
*
* @return array
*/
@@ -80,14 +81,7 @@ class approve_topic extends \phpbb\notification\type\topic
$users = array();
$users[$post['poster_id']] = array('');
- $auth_read = $this->auth->acl_get_list(array_keys($users), 'f_read', $post['forum_id']);
-
- if (empty($auth_read))
- {
- return array();
- }
-
- return $this->check_user_notification_options($auth_read[$post['forum_id']]['f_read'], array_merge($options, array(
+ return $this->get_authorised_recipients(array_keys($users), $post['forum_id'], array_merge($options, array(
'item_type' => self::$notification_option['id'],
)));
}
diff --git a/phpBB/phpbb/notification/type/base.php b/phpBB/phpbb/notification/type/base.php
index 910f51b3a6..4ead06071e 100644
--- a/phpBB/phpbb/notification/type/base.php
+++ b/phpBB/phpbb/notification/type/base.php
@@ -161,6 +161,8 @@ abstract class base implements \phpbb\notification\type\type_interface
* Magic method to set data on this notification
*
* @param mixed $name
+ * @param mixed $value
+ *
* @return null
*/
public function __set($name, $value)
@@ -174,7 +176,6 @@ abstract class base implements \phpbb\notification\type\type_interface
*
* Primarily for testing
*
- * @param string $name
* @return mixed
*/
public function __toString()
@@ -532,4 +533,37 @@ abstract class base implements \phpbb\notification\type\type_interface
WHERE ' . $where;
$this->db->sql_query($sql);
}
+
+ /**
+ * Get a list of users that are authorised to receive notifications
+ *
+ * @param array $users Array of users that have subscribed to a notification
+ * @param int $forum_id Forum ID of the forum
+ * @param array $options Array of notification options
+ * @param bool $sort Whether the users array should be sorted. Default: false
+ * @return array Array of users that are authorised recipients
+ */
+ protected function get_authorised_recipients($users, $forum_id, $options, $sort = false)
+ {
+ if (empty($users))
+ {
+ return array();
+ }
+
+ $users = array_unique($users);
+
+ if ($sort)
+ {
+ sort($users);
+ }
+
+ $auth_read = $this->auth->acl_get_list($users, 'f_read', $forum_id);
+
+ if (empty($auth_read))
+ {
+ return array();
+ }
+
+ return $this->check_user_notification_options($auth_read[$forum_id]['f_read'], $options);
+ }
}
diff --git a/phpBB/phpbb/notification/type/bookmark.php b/phpBB/phpbb/notification/type/bookmark.php
index f4870e8a52..4f2d34cb60 100644
--- a/phpBB/phpbb/notification/type/bookmark.php
+++ b/phpBB/phpbb/notification/type/bookmark.php
@@ -27,7 +27,7 @@ class bookmark extends \phpbb\notification\type\post
*/
public function get_type()
{
- return 'bookmark';
+ return 'notification.type.bookmark';
}
/**
@@ -59,7 +59,8 @@ class bookmark extends \phpbb\notification\type\post
/**
* Find the users who want to receive notifications
*
- * @param array $post Data from
+ * @param array $post Data from submit_post
+ * @param array $options Options for finding users for notification
*
* @return array
*/
@@ -82,21 +83,13 @@ class bookmark extends \phpbb\notification\type\post
}
$this->db->sql_freeresult($result);
- if (empty($users))
- {
- return array();
- }
- sort($users);
-
- $auth_read = $this->auth->acl_get_list($users, 'f_read', $post['forum_id']);
+ $notify_users = $this->get_authorised_recipients($users, $post['forum_id'], $options, true);
- if (empty($auth_read))
+ if (empty($notify_users))
{
return array();
}
- $notify_users = $this->check_user_notification_options($auth_read[$post['forum_id']]['f_read'], $options);
-
// Try to find the users who already have been notified about replies and have not read the topic since and just update their notifications
$update_notifications = array();
$sql = 'SELECT n.*
diff --git a/phpBB/phpbb/notification/type/disapprove_post.php b/phpBB/phpbb/notification/type/disapprove_post.php
index 7b18ed70ea..6c7bcbcaee 100644
--- a/phpBB/phpbb/notification/type/disapprove_post.php
+++ b/phpBB/phpbb/notification/type/disapprove_post.php
@@ -27,7 +27,7 @@ class disapprove_post extends \phpbb\notification\type\approve_post
*/
public function get_type()
{
- return 'disapprove_post';
+ return 'notification.type.disapprove_post';
}
/**
diff --git a/phpBB/phpbb/notification/type/disapprove_topic.php b/phpBB/phpbb/notification/type/disapprove_topic.php
index 3f87741807..efa5eb7ecd 100644
--- a/phpBB/phpbb/notification/type/disapprove_topic.php
+++ b/phpBB/phpbb/notification/type/disapprove_topic.php
@@ -27,7 +27,7 @@ class disapprove_topic extends \phpbb\notification\type\approve_topic
*/
public function get_type()
{
- return 'disapprove_topic';
+ return 'notification.type.disapprove_topic';
}
/**
diff --git a/phpBB/phpbb/notification/type/group_request.php b/phpBB/phpbb/notification/type/group_request.php
index 980234c129..4baf516fed 100644
--- a/phpBB/phpbb/notification/type/group_request.php
+++ b/phpBB/phpbb/notification/type/group_request.php
@@ -20,7 +20,7 @@ class group_request extends \phpbb\notification\type\base
*/
public function get_type()
{
- return 'group_request';
+ return 'notification.type.group_request';
}
/**
diff --git a/phpBB/phpbb/notification/type/group_request_approved.php b/phpBB/phpbb/notification/type/group_request_approved.php
index bf9cd0019f..d284046ffa 100644
--- a/phpBB/phpbb/notification/type/group_request_approved.php
+++ b/phpBB/phpbb/notification/type/group_request_approved.php
@@ -20,7 +20,7 @@ class group_request_approved extends \phpbb\notification\type\base
*/
public function get_type()
{
- return 'group_request_approved';
+ return 'notification.type.group_request_approved';
}
/**
diff --git a/phpBB/phpbb/notification/type/pm.php b/phpBB/phpbb/notification/type/pm.php
index 4f54e93e06..330a70c85a 100644
--- a/phpBB/phpbb/notification/type/pm.php
+++ b/phpBB/phpbb/notification/type/pm.php
@@ -27,7 +27,7 @@ class pm extends \phpbb\notification\type\base
*/
public function get_type()
{
- return 'pm';
+ return 'notification.type.pm';
}
/**
@@ -72,7 +72,8 @@ class pm extends \phpbb\notification\type\base
/**
* Find the users who want to receive notifications
*
- * @param array $pm Data from
+ * @param array $pm Data from submit_pm
+ * @param array $options Options for finding users for notification
*
* @return array
*/
@@ -178,7 +179,7 @@ class pm extends \phpbb\notification\type\base
* Function for preparing the data for insertion in an SQL query
* (The service handles insertion)
*
- * @param array $post Data from submit_post
+ * @param array $pm Data from submit_post
* @param array $pre_create_data Data from pre_create_insert_array()
*
* @return array Array of data ready to be inserted into the database
diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php
index ee3a253e0f..d9e74f2e95 100644
--- a/phpBB/phpbb/notification/type/post.php
+++ b/phpBB/phpbb/notification/type/post.php
@@ -27,7 +27,7 @@ class post extends \phpbb\notification\type\base
*/
public function get_type()
{
- return 'post';
+ return 'notification.type.post';
}
/**
@@ -86,7 +86,8 @@ class post extends \phpbb\notification\type\base
/**
* Find the users who want to receive notifications
*
- * @param array $post Data from
+ * @param array $post Data from submit_post
+ * @param array $options Options for finding users for notification
*
* @return array
*/
@@ -122,23 +123,13 @@ class post extends \phpbb\notification\type\base
}
$this->db->sql_freeresult($result);
- if (empty($users))
- {
- return array();
- }
+ $notify_users = $this->get_authorised_recipients($users, $post['forum_id'], $options, true);
- $users = array_unique($users);
- sort($users);
-
- $auth_read = $this->auth->acl_get_list($users, 'f_read', $post['forum_id']);
-
- if (empty($auth_read))
+ if (empty($notify_users))
{
return array();
}
- $notify_users = $this->check_user_notification_options($auth_read[$post['forum_id']]['f_read'], $options);
-
// Try to find the users who already have been notified about replies and have not read the topic since and just update their notifications
$update_notifications = array();
$sql = 'SELECT n.*
diff --git a/phpBB/phpbb/notification/type/post_in_queue.php b/phpBB/phpbb/notification/type/post_in_queue.php
index b893ad0d15..315b8b0243 100644
--- a/phpBB/phpbb/notification/type/post_in_queue.php
+++ b/phpBB/phpbb/notification/type/post_in_queue.php
@@ -27,7 +27,7 @@ class post_in_queue extends \phpbb\notification\type\post
*/
public function get_type()
{
- return 'post_in_queue';
+ return 'notification.type.post_in_queue';
}
/**
@@ -44,7 +44,7 @@ class post_in_queue extends \phpbb\notification\type\post
* Array of data (including keys 'id', 'lang', and 'group')
*/
public static $notification_option = array(
- 'id' => 'needs_approval',
+ 'id' => 'notification.type.needs_approval',
'lang' => 'NOTIFICATION_TYPE_IN_MODERATION_QUEUE',
'group' => 'NOTIFICATION_GROUP_MODERATION',
);
@@ -70,6 +70,7 @@ class post_in_queue extends \phpbb\notification\type\post
* Find the users who want to receive notifications
*
* @param array $post Data from the post
+ * @param array $options Options for finding users for notification
*
* @return array
*/
diff --git a/phpBB/phpbb/notification/type/quote.php b/phpBB/phpbb/notification/type/quote.php
index 7c61b76b58..508ca92fa0 100644
--- a/phpBB/phpbb/notification/type/quote.php
+++ b/phpBB/phpbb/notification/type/quote.php
@@ -27,7 +27,7 @@ class quote extends \phpbb\notification\type\post
*/
public function get_type()
{
- return 'quote';
+ return 'notification.type.quote';
}
/**
@@ -66,7 +66,8 @@ class quote extends \phpbb\notification\type\post
/**
* Find the users who want to receive notifications
*
- * @param array $post Data from
+ * @param array $post Data from submit_post
+ * @param array $options Options for finding users for notification
*
* @return array
*/
@@ -101,28 +102,13 @@ class quote extends \phpbb\notification\type\post
}
$this->db->sql_freeresult($result);
- if (empty($users))
- {
- return array();
- }
- sort($users);
-
- $auth_read = $this->auth->acl_get_list($users, 'f_read', $post['forum_id']);
-
- if (empty($auth_read))
- {
- return array();
- }
-
- $notify_users = $this->check_user_notification_options($auth_read[$post['forum_id']]['f_read'], $options);
-
- return $notify_users;
+ return $this->get_authorised_recipients($users, $post['forum_id'], $options, true);
}
/**
* Update a notification
*
- * @param array $data Data specific for this type that will be updated
+ * @param array $post Data specific for this type that will be updated
*/
public function update_notifications($post)
{
diff --git a/phpBB/phpbb/notification/type/report_pm.php b/phpBB/phpbb/notification/type/report_pm.php
index 2eb802eb4b..d39143f4b7 100644
--- a/phpBB/phpbb/notification/type/report_pm.php
+++ b/phpBB/phpbb/notification/type/report_pm.php
@@ -27,7 +27,7 @@ class report_pm extends \phpbb\notification\type\pm
*/
public function get_type()
{
- return 'report_pm';
+ return 'notification.type.report_pm';
}
/**
@@ -61,7 +61,7 @@ class report_pm extends \phpbb\notification\type\pm
* Array of data (including keys 'id', 'lang', and 'group')
*/
public static $notification_option = array(
- 'id' => 'report',
+ 'id' => 'notification.type.report',
'lang' => 'NOTIFICATION_TYPE_REPORT',
'group' => 'NOTIFICATION_GROUP_MODERATION',
);
@@ -94,6 +94,7 @@ class report_pm extends \phpbb\notification\type\pm
* (copied from post_in_queue)
*
* @param array $post Data from the post
+ * @param array $options Options for finding users for notification
*
* @return array
*/
diff --git a/phpBB/phpbb/notification/type/report_pm_closed.php b/phpBB/phpbb/notification/type/report_pm_closed.php
index ed40df67f3..9f301ee2cc 100644
--- a/phpBB/phpbb/notification/type/report_pm_closed.php
+++ b/phpBB/phpbb/notification/type/report_pm_closed.php
@@ -27,7 +27,7 @@ class report_pm_closed extends \phpbb\notification\type\pm
*/
public function get_type()
{
- return 'report_pm_closed';
+ return 'notification.type.report_pm_closed';
}
/**
@@ -52,7 +52,8 @@ class report_pm_closed extends \phpbb\notification\type\pm
/**
* Find the users who want to receive notifications
*
- * @param array $pm Data from
+ * @param array $pm Data from submit_pm
+ * @param array $options Options for finding users for notification
*
* @return array
*/
diff --git a/phpBB/phpbb/notification/type/report_post.php b/phpBB/phpbb/notification/type/report_post.php
index 024c8d9d42..027cca716b 100644
--- a/phpBB/phpbb/notification/type/report_post.php
+++ b/phpBB/phpbb/notification/type/report_post.php
@@ -26,7 +26,7 @@ class report_post extends \phpbb\notification\type\post_in_queue
*/
public function get_type()
{
- return 'report_post';
+ return 'notification.type.report_post';
}
/**
@@ -67,7 +67,7 @@ class report_post extends \phpbb\notification\type\post_in_queue
* Array of data (including keys 'id' and 'lang')
*/
public static $notification_option = array(
- 'id' => 'report',
+ 'id' => 'notification.type.report',
'lang' => 'NOTIFICATION_TYPE_REPORT',
'group' => 'NOTIFICATION_GROUP_MODERATION',
);
@@ -76,6 +76,7 @@ class report_post extends \phpbb\notification\type\post_in_queue
* Find the users who want to receive notifications
*
* @param array $post Data from the post
+ * @param array $options Options for finding users for notification
*
* @return array
*/
diff --git a/phpBB/phpbb/notification/type/report_post_closed.php b/phpBB/phpbb/notification/type/report_post_closed.php
index a979af1fb0..a0bb187a0d 100644
--- a/phpBB/phpbb/notification/type/report_post_closed.php
+++ b/phpBB/phpbb/notification/type/report_post_closed.php
@@ -27,7 +27,7 @@ class report_post_closed extends \phpbb\notification\type\post
*/
public function get_type()
{
- return 'report_post_closed';
+ return 'notification.type.report_post_closed';
}
/**
@@ -59,7 +59,8 @@ class report_post_closed extends \phpbb\notification\type\post
/**
* Find the users who want to receive notifications
*
- * @param array $post Data from
+ * @param array $post Data from submit_post
+ * @param array $options Options for finding users for notification
*
* @return array
*/
diff --git a/phpBB/phpbb/notification/type/topic.php b/phpBB/phpbb/notification/type/topic.php
index a512a12f20..cf0ec77099 100644
--- a/phpBB/phpbb/notification/type/topic.php
+++ b/phpBB/phpbb/notification/type/topic.php
@@ -27,7 +27,7 @@ class topic extends \phpbb\notification\type\base
*/
public function get_type()
{
- return 'topic';
+ return 'notification.type.topic';
}
/**
@@ -87,6 +87,7 @@ class topic extends \phpbb\notification\type\base
* Find the users who want to receive notifications
*
* @param array $topic Data from the topic
+ * @param array $options Options for finding users for notification
*
* @return array
*/
@@ -110,19 +111,7 @@ class topic extends \phpbb\notification\type\base
}
$this->db->sql_freeresult($result);
- if (empty($users))
- {
- return array();
- }
-
- $auth_read = $this->auth->acl_get_list($users, 'f_read', $topic['forum_id']);
-
- if (empty($auth_read))
- {
- return array();
- }
-
- return $this->check_user_notification_options($auth_read[$topic['forum_id']]['f_read'], $options);
+ return $this->get_authorised_recipients($users, $topic['forum_id'], $options);
}
/**
diff --git a/phpBB/phpbb/notification/type/topic_in_queue.php b/phpBB/phpbb/notification/type/topic_in_queue.php
index 2d54a68648..4c60c6b858 100644
--- a/phpBB/phpbb/notification/type/topic_in_queue.php
+++ b/phpBB/phpbb/notification/type/topic_in_queue.php
@@ -27,7 +27,7 @@ class topic_in_queue extends \phpbb\notification\type\topic
*/
public function get_type()
{
- return 'topic_in_queue';
+ return 'notification.type.topic_in_queue';
}
/**
@@ -44,7 +44,7 @@ class topic_in_queue extends \phpbb\notification\type\topic
* Array of data (including keys 'id', 'lang', and 'group')
*/
public static $notification_option = array(
- 'id' => 'needs_approval',
+ 'id' => 'notification.type.needs_approval',
'lang' => 'NOTIFICATION_TYPE_IN_MODERATION_QUEUE',
'group' => 'NOTIFICATION_GROUP_MODERATION',
);
@@ -70,6 +70,7 @@ class topic_in_queue extends \phpbb\notification\type\topic
* Find the users who want to receive notifications
*
* @param array $topic Data from the topic
+ * @param array $options Options for finding users for notification
*
* @return array
*/
diff --git a/phpBB/phpbb/path_helper.php b/phpBB/phpbb/path_helper.php
index a8592eac6c..38dbbab51e 100644
--- a/phpBB/phpbb/path_helper.php
+++ b/phpBB/phpbb/path_helper.php
@@ -46,7 +46,7 @@ class path_helper
* @param \phpbb\filesystem $filesystem
* @param \phpbb\request\request_interface $request
* @param string $phpbb_root_path Relative path to phpBB root
- * @param string $php_ext PHP extension (php)
+ * @param string $php_ext PHP file extension
* @param mixed $adm_relative_path Relative path admin path to adm/ root
*/
public function __construct(\phpbb\symfony_request $symfony_request, \phpbb\filesystem $filesystem, \phpbb\request\request_interface $request, $phpbb_root_path, $php_ext, $adm_relative_path = null)
diff --git a/phpBB/phpbb/profilefields/type/type_googleplus.php b/phpBB/phpbb/profilefields/type/type_googleplus.php
index df1bcc7f4b..e6729b1935 100644
--- a/phpBB/phpbb/profilefields/type/type_googleplus.php
+++ b/phpBB/phpbb/profilefields/type/type_googleplus.php
@@ -18,6 +18,14 @@ class type_googleplus extends type_string
/**
* {@inheritDoc}
*/
+ public function get_name()
+ {
+ return $this->user->lang('FIELD_GOOGLEPLUS');
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public function get_service_name()
{
return 'profilefields.type.googleplus';
@@ -32,7 +40,7 @@ class type_googleplus extends type_string
'field_length' => 20,
'field_minlen' => 3,
'field_maxlen' => 255,
- 'field_validation' => '[\w]+',
+ 'field_validation' => '(?:(?!\.{2,})([^<>=+]))+',
'field_novalue' => '',
'field_default_value' => '',
);
diff --git a/phpBB/phpbb/profilefields/type/type_interface.php b/phpBB/phpbb/profilefields/type/type_interface.php
index 2dd13fa480..ec770f9467 100644
--- a/phpBB/phpbb/profilefields/type/type_interface.php
+++ b/phpBB/phpbb/profilefields/type/type_interface.php
@@ -189,8 +189,8 @@ interface type_interface
/**
* Allows manipulating the intended variables if needed
*
- * @param string $key Name of the option
* @param int $step Step on which the option is hidden
+ * @param string $key Name of the option
* @param string $action Currently performed action (create|edit)
* @param array $field_data Array with data for this field
* @return mixed Final value of the option
diff --git a/phpBB/phpbb/search/base.php b/phpBB/phpbb/search/base.php
index 9395b6a273..30781975d8 100644
--- a/phpBB/phpbb/search/base.php
+++ b/phpBB/phpbb/search/base.php
@@ -85,8 +85,12 @@ class base
/**
* Retrieves cached search results
*
- * @param int &$result_count will contain the number of all results for the search (not only for the current page)
- * @param array &$id_ary is filled with the ids belonging to the requested page that are stored in the cache
+ * @param string $search_key an md5 string generated from all the passed search options to identify the results
+ * @param int &$result_count will contain the number of all results for the search (not only for the current page)
+ * @param array &$id_ary is filled with the ids belonging to the requested page that are stored in the cache
+ * @param int &$start indicates the first index of the page
+ * @param int $per_page number of ids each page is supposed to contain
+ * @param string $sort_dir is either a or d representing ASC and DESC
*
* @return int SEARCH_RESULT_NOT_IN_CACHE or SEARCH_RESULT_IN_CACHE or SEARCH_RESULT_INCOMPLETE
*/
@@ -160,8 +164,16 @@ class base
/**
* Caches post/topic ids
*
- * @param array &$id_ary contains a list of post or topic ids that shall be cached, the first element
+ * @param string $search_key an md5 string generated from all the passed search options to identify the results
+ * @param string $keywords contains the keywords as entered by the user
+ * @param array $author_ary an array of author ids, if the author should be ignored during the search the array is empty
+ * @param int $result_count contains the number of all results for the search (not only for the current page)
+ * @param array &$id_ary contains a list of post or topic ids that shall be cached, the first element
* must have the absolute index $start in the result set.
+ * @param int $start indicates the first index of the page
+ * @param string $sort_dir is either a or d representing ASC and DESC
+ *
+ * @return null
*/
function save_ids($search_key, $keywords, $author_ary, $result_count, &$id_ary, $start, $sort_dir)
{
diff --git a/phpBB/phpbb/search/fulltext_mysql.php b/phpBB/phpbb/search/fulltext_mysql.php
index d4e7de31e5..1a0aba096f 100644
--- a/phpBB/phpbb/search/fulltext_mysql.php
+++ b/phpBB/phpbb/search/fulltext_mysql.php
@@ -73,6 +73,12 @@ class fulltext_mysql extends \phpbb\search\base
* 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
+ * @param string $phpbb_root_path Relative path to phpBB root
+ * @param string $phpEx PHP file extension
+ * @param \phpbb\auth\auth $auth Auth object
+ * @param \phpbb\config\config $config Config object
+ * @param \phpbb\db\driver\driver_interface Database object
+ * @param \phpbb\user $user User object
*/
public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user)
{
diff --git a/phpBB/phpbb/search/fulltext_postgres.php b/phpBB/phpbb/search/fulltext_postgres.php
index b3e7f51f87..b6af371d13 100644
--- a/phpBB/phpbb/search/fulltext_postgres.php
+++ b/phpBB/phpbb/search/fulltext_postgres.php
@@ -86,6 +86,12 @@ class fulltext_postgres extends \phpbb\search\base
* 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
+ * @param string $phpbb_root_path Relative path to phpBB root
+ * @param string $phpEx PHP file extension
+ * @param \phpbb\auth\auth $auth Auth object
+ * @param \phpbb\config\config $config Config object
+ * @param \phpbb\db\driver\driver_interface Database object
+ * @param \phpbb\user $user User object
*/
public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user)
{
diff --git a/phpBB/phpbb/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php
index 78c11f1180..79d68d2ae1 100644
--- a/phpBB/phpbb/search/fulltext_sphinx.php
+++ b/phpBB/phpbb/search/fulltext_sphinx.php
@@ -119,6 +119,12 @@ class fulltext_sphinx
* 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
+ * @param string $phpbb_root_path Relative path to phpBB root
+ * @param string $phpEx PHP file extension
+ * @param \phpbb\auth\auth $auth Auth object
+ * @param \phpbb\config\config $config Config object
+ * @param \phpbb\db\driver\driver_interface Database object
+ * @param \phpbb\user $user User object
*/
public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user)
{
diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php
index 59b7ec2029..7d564742af 100644
--- a/phpBB/phpbb/session.php
+++ b/phpBB/phpbb/session.php
@@ -962,7 +962,7 @@ class session
*/
function session_gc()
{
- global $db, $config, $phpbb_root_path, $phpEx;
+ global $db, $config, $phpbb_root_path, $phpEx, $phpbb_container;
$batch_size = 10;
@@ -1022,11 +1022,7 @@ class session
}
// only called from CRON; should be a safe workaround until the infrastructure gets going
- if (!class_exists('phpbb_captcha_factory', false))
- {
- include($phpbb_root_path . "includes/captcha/captcha_factory." . $phpEx);
- }
- $captcha_factory = new \phpbb_captcha_factory();
+ $captcha_factory = $phpbb_container->get('captcha.factory');
$captcha_factory->garbage_collect($config['captcha_plugin']);
$sql = 'DELETE FROM ' . LOGIN_ATTEMPT_TABLE . '
@@ -1062,11 +1058,13 @@ class session
* Check for banned user
*
* Checks whether the supplied user is banned by id, ip or email. If no parameters
- * are passed to the method pre-existing session data is used. If $return is false
- * this routine does not return on finding a banned user, it outputs a relevant
- * message and stops execution.
+ * are passed to the method pre-existing session data is used.
*
- * @param string|array $user_ips Can contain a string with one IP or an array of multiple IPs
+ * @param int|false $user_id The user id
+ * @param mixed $user_ips Can contain a string with one IP or an array of multiple IPs
+ * @param string|false $user_email The user email
+ * @param bool $return If $return is false this routine does not return on finding a banned user,
+ * it outputs a relevant message and stops execution.
*/
function check_ban($user_id = false, $user_ips = false, $user_email = false, $return = false)
{
@@ -1254,12 +1252,14 @@ class session
/**
* Check if ip is blacklisted
- * This should be called only where absolutly necessary
+ * This should be called only where absolutely necessary
*
* Only IPv4 (rbldns does not support AAAA records/IPv6 lookups)
*
* @author satmd (from the php manual)
- * @param string $mode register/post - spamcop for example is ommitted for posting
+ * @param string $mode register/post - spamcop for example is ommitted for posting
+ * @param string|false $ip the IPv4 address to check
+ *
* @return false if ip is not blacklisted, else an array([checked server], [lookup])
*/
function check_dnsbl($mode, $ip = false)
diff --git a/phpBB/phpbb/template/asset.php b/phpBB/phpbb/template/asset.php
index 5a01ee3a93..67dbd7b357 100644
--- a/phpBB/phpbb/template/asset.php
+++ b/phpBB/phpbb/template/asset.php
@@ -24,6 +24,7 @@ class asset
* Constructor
*
* @param string $url URL
+ * @param \phpbb\path_helper $path_helper Path helper object
*/
public function __construct($url, \phpbb\path_helper $path_helper)
{
diff --git a/phpBB/phpbb/template/twig/definition.php b/phpBB/phpbb/template/twig/definition.php
index 39653f6d26..cb3c953692 100644
--- a/phpBB/phpbb/template/twig/definition.php
+++ b/phpBB/phpbb/template/twig/definition.php
@@ -25,6 +25,8 @@ class definition
* Get a DEFINE'd variable
*
* @param string $name
+ * @param array $arguments
+ *
* @return mixed Null if not found
*/
public function __call($name, $arguments)
diff --git a/phpBB/phpbb/template/twig/environment.php b/phpBB/phpbb/template/twig/environment.php
index 8d25153e14..476ffd935e 100644
--- a/phpBB/phpbb/template/twig/environment.php
+++ b/phpBB/phpbb/template/twig/environment.php
@@ -36,11 +36,10 @@ class environment extends \Twig_Environment
/**
* Constructor
*
- * @param \phpbb\config\config $phpbb_config
- * @param \phpbb\path_helper
- * @param \phpbb\extension\manager
- * @param string $phpbb_root_path
- * @param \Twig_LoaderInterface $loader
+ * @param \phpbb\config\config $phpbb_config The phpBB configuration
+ * @param \phpbb\path_helper $path_helper phpBB path helper
+ * @param \phpbb\extension\manager $extension_manager phpBB extension manager
+ * @param \Twig_LoaderInterface $loader Twig loader interface
* @param array $options Array of options to pass to Twig
*/
public function __construct($phpbb_config, \phpbb\path_helper $path_helper, \phpbb\extension\manager $extension_manager = null, \Twig_LoaderInterface $loader = null, $options = array())
diff --git a/phpBB/phpbb/template/twig/extension.php b/phpBB/phpbb/template/twig/extension.php
index 8f523684dd..3a983491b9 100644
--- a/phpBB/phpbb/template/twig/extension.php
+++ b/phpBB/phpbb/template/twig/extension.php
@@ -162,7 +162,6 @@ class extension extends \Twig_Extension
* (e.g. in the ACP, L_TITLE)
* If not, we return the result of $user->lang()
*
- * @param string $lang name
* @return string
*/
function lang()
diff --git a/phpBB/phpbb/tree/tree_interface.php b/phpBB/phpbb/tree/tree_interface.php
index 8238a072ff..5df01a89cf 100644
--- a/phpBB/phpbb/tree/tree_interface.php
+++ b/phpBB/phpbb/tree/tree_interface.php
@@ -18,7 +18,7 @@ interface tree_interface
/**
* Inserts an item into the database table and into the tree.
*
- * @param array $item The item to be added
+ * @param array $additional_data The item to be added
* @return array Array with item data as set in the database
*/
public function insert(array $additional_data);
diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php
index 4e90044395..ea98034434 100644
--- a/phpBB/phpbb/user.php
+++ b/phpBB/phpbb/user.php
@@ -31,6 +31,11 @@ class user extends \phpbb\session
*/
public $timezone;
+ /**
+ * @var string Class name of datetime object
+ */
+ protected $datetime;
+
var $lang_name = false;
var $lang_id = false;
var $lang_path;
@@ -42,12 +47,14 @@ class user extends \phpbb\session
/**
* Constructor to set the lang path
+ * @param string $datetime_class Class name of datetime class
*/
- function __construct()
+ function __construct($datetime_class)
{
global $phpbb_root_path;
$this->lang_path = $phpbb_root_path . 'language/';
+ $this->datetime = $datetime_class;
}
/**
@@ -727,7 +734,7 @@ class user extends \phpbb\session
public function create_datetime($time = 'now', \DateTimeZone $timezone = null)
{
$timezone = $timezone ?: $this->timezone;
- return new \phpbb\datetime($this, $time, $timezone);
+ return new $this->datetime($this, $time, $timezone);
}
/**
diff --git a/phpBB/posting.php b/phpBB/posting.php
index 70df052099..4c3d012ca5 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -241,8 +241,7 @@ $user->setup(array('posting', 'mcp', 'viewtopic'), $post_data['forum_style']);
if ($config['enable_post_confirm'] && !$user->data['is_registered'])
{
- include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
- $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']);
+ $captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']);
$captcha->init(CONFIRM_POST);
}
@@ -523,7 +522,9 @@ $orig_poll_options_size = sizeof($post_data['poll_options']);
$message_parser = new parse_message();
$plupload = $phpbb_container->get('plupload');
+$mimetype_guesser = $phpbb_container->get('mimetype.guesser');
$message_parser->set_plupload($plupload);
+$message_parser->set_mimetype_guesser($mimetype_guesser);
if (isset($post_data['post_text']))
{
diff --git a/phpBB/report.php b/phpBB/report.php
index 3684c2162f..1b5d3c9d46 100644
--- a/phpBB/report.php
+++ b/phpBB/report.php
@@ -151,8 +151,7 @@ else
if ($config['enable_post_confirm'] && !$user->data['is_registered'])
{
- include($phpbb_root_path . 'includes/captcha/captcha_factory.' . $phpEx);
- $captcha = phpbb_captcha_factory::get_instance($config['captcha_plugin']);
+ $captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']);
$captcha->init(CONFIRM_REPORT);
}
@@ -232,7 +231,7 @@ if ($submit && $reason_id)
$lang_return = $user->lang['RETURN_TOPIC'];
$lang_success = $user->lang['POST_REPORTED_SUCCESS'];
- $phpbb_notifications->add_notifications('report_post', array_merge($report_data, $row, $forum_data, array(
+ $phpbb_notifications->add_notifications('notification.type.report_post', array_merge($report_data, $row, $forum_data, array(
'report_text' => $report_text,
)));
}
@@ -262,7 +261,7 @@ if ($submit && $reason_id)
$lang_return = $user->lang['RETURN_PM'];
$lang_success = $user->lang['PM_REPORTED_SUCCESS'];
- $phpbb_notifications->add_notifications('report_pm', array_merge($report_data, $row, array(
+ $phpbb_notifications->add_notifications('notification.type.report_pm', array_merge($report_data, $row, array(
'report_text' => $report_text,
'from_user_id' => $report_data['author_id'],
'report_id' => $report_id,
diff --git a/phpBB/search.php b/phpBB/search.php
index 071db30f3d..67f6f4dbb5 100644
--- a/phpBB/search.php
+++ b/phpBB/search.php
@@ -281,12 +281,11 @@ if ($keywords || $author || $author_id || $search_id || $submit)
trigger_error($error);
}
- $common_words = $search->get_common_words();
-
// let the search module split up the keywords
if ($keywords)
{
$correct_query = $search->split_keywords($keywords, $search_terms);
+ $common_words = $search->get_common_words();
if (!$correct_query || (!$search->get_search_query() && !sizeof($author_id_ary) && !$search_id))
{
$ignored = (sizeof($common_words)) ? sprintf($user->lang['IGNORED_TERMS_EXPLAIN'], implode(' ', $common_words)) . '<br />' : '';
@@ -599,7 +598,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
'SEARCH_MATCHES' => $l_search_matches,
'SEARCH_WORDS' => $keywords,
'SEARCHED_QUERY' => $search->get_search_query(),
- 'IGNORED_WORDS' => (sizeof($common_words)) ? implode(' ', $common_words) : '',
+ 'IGNORED_WORDS' => (!empty($common_words)) ? implode(' ', $common_words) : '',
'PHRASE_SEARCH_DISABLED' => $phrase_search_disabled,
diff --git a/phpBB/styles/prosilver/style.cfg b/phpBB/styles/prosilver/style.cfg
index 520b1f0e98..aea59021d6 100644
--- a/phpBB/styles/prosilver/style.cfg
+++ b/phpBB/styles/prosilver/style.cfg
@@ -21,8 +21,8 @@
# General Information about this style
name = prosilver
copyright = © phpBB Limited, 2007
-style_version = 3.1.0-RC2
-phpbb_version = 3.1.0-RC2
+style_version = 3.1.0-RC3
+phpbb_version = 3.1.0-RC3
# Defining a different template bitfield
# template_bitfield = lNg=
diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js
index 649a384418..63efe5f8ae 100644
--- a/phpBB/styles/prosilver/template/ajax.js
+++ b/phpBB/styles/prosilver/template/ajax.js
@@ -134,6 +134,11 @@ phpbb.markNotifications = function(el, unreadCount) {
if (!unreadCount) {
$('#mark_all_notifications').remove();
}
+
+ // Update page title
+ $('title').text(
+ (unreadCount ? '(' + unreadCount + ')' : '') + $('title').text().replace(/(\(([0-9])\))/, '')
+ );
};
// This callback finds the post from the delete link, and removes it.
diff --git a/phpBB/styles/prosilver/template/forumlist_body.html b/phpBB/styles/prosilver/template/forumlist_body.html
index 0dd47bea9e..22859b2452 100644
--- a/phpBB/styles/prosilver/template/forumlist_body.html
+++ b/phpBB/styles/prosilver/template/forumlist_body.html
@@ -34,8 +34,8 @@
<!-- IF S_ENABLE_FEEDS and forumrow.S_FEED_ENABLED --><!-- <a class="feed-icon-forum" title="{L_FEED} - {forumrow.FORUM_NAME}" href="{U_FEED}?f={forumrow.FORUM_ID}"><img src="{T_THEME_PATH}/images/feed.gif" alt="{L_FEED} - {forumrow.FORUM_NAME}" /></a> --><!-- ENDIF -->
<!-- IF forumrow.FORUM_IMAGE --><span class="forum-image">{forumrow.FORUM_IMAGE}</span><!-- ENDIF -->
- <a href="{forumrow.U_VIEWFORUM}" class="forumtitle">{forumrow.FORUM_NAME}</a><br />
- {forumrow.FORUM_DESC}
+ <a href="{forumrow.U_VIEWFORUM}" class="forumtitle">{forumrow.FORUM_NAME}</a>
+ <!-- IF forumrow.FORUM_DESC --><br />{forumrow.FORUM_DESC}<!-- ENDIF -->
<!-- IF forumrow.MODERATORS -->
<br /><strong>{forumrow.L_MODERATOR_STR}{L_COLON}</strong> {forumrow.MODERATORS}
<!-- ENDIF -->
diff --git a/phpBB/styles/prosilver/template/mcp_topic.html b/phpBB/styles/prosilver/template/mcp_topic.html
index 6bf6af1b78..082bea22f1 100644
--- a/phpBB/styles/prosilver/template/mcp_topic.html
+++ b/phpBB/styles/prosilver/template/mcp_topic.html
@@ -34,7 +34,7 @@
<fieldset id="display-panel" class="fields2" role="tabpanel">
<dl>
<dt><label for="posts_per_page">{L_POSTS_PER_PAGE}{L_COLON}</label><br /><span>{L_POSTS_PER_PAGE_EXPLAIN}</span></dt>
- <dd><input class="inputbox autowidth" type="number" min="1" name="posts_per_page" id="posts_per_page" size="6" value="{POSTS_PER_PAGE}" /></dd>
+ <dd><input class="inputbox autowidth" type="number" min="0" name="posts_per_page" id="posts_per_page" size="6" value="{POSTS_PER_PAGE}" /></dd>
</dl>
<dl>
<dt><label>{L_DISPLAY_POSTS}{L_COLON}</label></dt>
diff --git a/phpBB/styles/prosilver/template/memberlist_view.html b/phpBB/styles/prosilver/template/memberlist_view.html
index a25b53350b..eb151af8df 100644
--- a/phpBB/styles/prosilver/template/memberlist_view.html
+++ b/phpBB/styles/prosilver/template/memberlist_view.html
@@ -10,7 +10,7 @@
<!-- IF AVATAR_IMG -->
<dl class="left-box">
- <dt>{AVATAR_IMG}</dt>
+ <dt class="profile-avatar">{AVATAR_IMG}</dt>
<!-- IF RANK_TITLE --><dd style="text-align: center;">{RANK_TITLE}</dd><!-- ENDIF -->
<!-- IF RANK_IMG --><dd style="text-align: center;">{RANK_IMG}</dd><!-- ENDIF -->
</dl>
diff --git a/phpBB/styles/prosilver/template/navbar_header.html b/phpBB/styles/prosilver/template/navbar_header.html
index ed34089550..41c5793320 100644
--- a/phpBB/styles/prosilver/template/navbar_header.html
+++ b/phpBB/styles/prosilver/template/navbar_header.html
@@ -23,6 +23,14 @@
<!-- ENDIF -->
<li class="small-icon icon-search-unanswered"><a href="{U_SEARCH_UNANSWERED}" role="menuitem">{L_SEARCH_UNANSWERED}</a></li>
<li class="small-icon icon-search-active"><a href="{U_SEARCH_ACTIVE_TOPICS}" role="menuitem">{L_SEARCH_ACTIVE_TOPICS}</a></li>
+ <li class="separator"></li>
+ <li class="small-icon icon-search"><a href="{U_SEARCH}" role="menuitem">{L_SEARCH}</a></li>
+ <!-- ENDIF -->
+
+ <!-- IF not S_IS_BOT and (S_DISPLAY_MEMBERLIST or U_TEAM) -->
+ <li class="separator"></li>
+ <!-- IF S_DISPLAY_MEMBERLIST --><li class="small-icon icon-members"><a href="{U_MEMBERLIST}" role="menuitem">{L_MEMBERLIST}</a></li><!-- ENDIF -->
+ <!-- IF U_TEAM --><li class="small-icon icon-team"><a href="{U_TEAM}" role="menuitem">{L_THE_TEAM}</a></li><!-- ENDIF -->
<!-- ENDIF -->
<li class="separator"></li>
@@ -32,10 +40,10 @@
</li>
<!-- EVENT overall_header_navigation_prepend -->
- <li class="small-icon icon-faq" <!-- IF not S_USER_LOGGED_IN -->data-skip-responsive="true"<!-- ELSE -->data-last-responsive="true"<!-- ENDIF -->><a href="{U_FAQ}" title="{L_FAQ_EXPLAIN}" role="menuitem">{L_FAQ}</a></li>
+ <li class="small-icon icon-faq" <!-- IF not S_USER_LOGGED_IN -->data-skip-responsive="true"<!-- ELSE -->data-last-responsive="true"<!-- ENDIF -->><a href="{U_FAQ}" rel="help" title="{L_FAQ_EXPLAIN}" role="menuitem">{L_FAQ}</a></li>
<!-- EVENT overall_header_navigation_append -->
<!-- IF U_ACP --><li class="small-icon icon-acp" data-last-responsive="true"><a href="{U_ACP}" title="{L_ACP}" role="menuitem">{L_ACP_SHORT}</a></li><!-- ENDIF -->
- <!-- IF U_MCP --><li class="small-icon icon-mcp" data-skip-responsive="true"><a href="{U_MCP}" title="{L_MCP}" role="menuitem">{L_MCP_SHORT}</a></li><!-- ENDIF -->
+ <!-- IF U_MCP --><li class="small-icon icon-mcp" data-last-responsive="true"><a href="{U_MCP}" title="{L_MCP}" role="menuitem">{L_MCP_SHORT}</a></li><!-- ENDIF -->
<!-- IF S_REGISTERED_USER -->
<li id="username_logged_in" class="rightside <!-- IF CURRENT_USER_AVATAR --> no-bulletin<!-- ENDIF -->" data-skip-responsive="true">
diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html
index df09fc6a30..076a3160f0 100644
--- a/phpBB/styles/prosilver/template/overall_header.html
+++ b/phpBB/styles/prosilver/template/overall_header.html
@@ -51,6 +51,8 @@
{$STYLESHEETS}
+<!-- EVENT overall_header_stylesheets_after -->
+
</head>
<body id="phpbb" class="nojs notouch section-{SCRIPT_NAME} {S_CONTENT_DIRECTION} {BODY_CLASS}">
diff --git a/phpBB/styles/prosilver/template/simple_header.html b/phpBB/styles/prosilver/template/simple_header.html
index e8b5936d48..610e5d5582 100644
--- a/phpBB/styles/prosilver/template/simple_header.html
+++ b/phpBB/styles/prosilver/template/simple_header.html
@@ -28,6 +28,8 @@
{$STYLESHEETS}
+<!-- EVENT simple_header_stylesheets_after -->
+
</head>
<body id="phpbb" class="nojs {S_CONTENT_DIRECTION} {BODY_CLASS}">
diff --git a/phpBB/styles/prosilver/template/ucp_avatar_options.html b/phpBB/styles/prosilver/template/ucp_avatar_options.html
index ca077fdf5b..2cf9488ed0 100644
--- a/phpBB/styles/prosilver/template/ucp_avatar_options.html
+++ b/phpBB/styles/prosilver/template/ucp_avatar_options.html
@@ -17,7 +17,6 @@
<dl>
<dt><label>{L_AVATAR_TYPE}{L_COLON}</label></dt>
<dd><select name="avatar_driver" id="avatar_driver" data-togglable-settings="true">
- <option value="">{L_NO_AVATAR}</option>
<!-- BEGIN avatar_drivers -->
<option value="{avatar_drivers.DRIVER}"<!-- IF avatar_drivers.SELECTED --> selected="selected"<!-- ENDIF --> data-toggle-setting="#avatar_option_{avatar_drivers.DRIVER}">{avatar_drivers.L_TITLE}</option>
<!-- END avatar_drivers -->
diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html
index f3d4ae6eda..1d0b7916d9 100644
--- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html
+++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html
@@ -18,7 +18,14 @@
<div class="inner">
<dl class="postprofile" id="profile{MESSAGE_ID}">
- <dt class="<!-- IF RANK_TITLE or RANK_IMG -->has-profile-rank<!-- ELSE -->no-profile-rank<!-- ENDIF -->"><!-- IF AUTHOR_AVATAR --><a href="{U_MESSAGE_AUTHOR}" class="avatar">{AUTHOR_AVATAR}</a><!-- ENDIF -->{MESSAGE_AUTHOR_FULL}</dt>
+ <dt class="<!-- IF RANK_TITLE or RANK_IMG -->has-profile-rank<!-- ELSE -->no-profile-rank<!-- ENDIF --> <!-- IF AUTHOR_AVATAR -->has-avatar<!-- ELSE -->no-avatar<!-- ENDIF -->">
+ <div class="avatar-container">
+ <!-- EVENT ucp_pm_viewmessage_avatar_before -->
+ <!-- IF AUTHOR_AVATAR --><a href="{U_MESSAGE_AUTHOR}" class="avatar">{AUTHOR_AVATAR}</a><!-- ENDIF -->
+ <!-- EVENT ucp_pm_viewmessage_avatar_after -->
+ </div>
+ {MESSAGE_AUTHOR_FULL}
+ </dt>
<!-- IF RANK_TITLE or RANK_IMG --><dd class="profile-rank">{RANK_TITLE}<!-- IF RANK_TITLE and RANK_IMG --><br /><!-- ENDIF -->{RANK_IMG}</dd><!-- ENDIF -->
@@ -106,16 +113,6 @@
<dl class="attachbox">
<dt>
{L_ATTACHMENTS}
- <!-- IF S_HAS_MULTIPLE_ATTACHMENTS -->
- <div class="dl_links">
- <strong>{L_DOWNLOAD_ALL}{L_COLON}</strong>
- <ul>
- <!-- BEGIN dl_method -->
- <li>[ <a href="{dl_method.LINK}">{dl_method.TYPE}</a> ]</li>
- <!-- END dl_method -->
- </ul>
- </div>
- <!-- ENDIF -->
</dt>
<!-- BEGIN attachment -->
<dd>{attachment.DISPLAY_ATTACHMENT}</dd>
diff --git a/phpBB/styles/prosilver/template/ucp_prefs_personal.html b/phpBB/styles/prosilver/template/ucp_prefs_personal.html
index d07aab1a89..c8b028f83a 100644
--- a/phpBB/styles/prosilver/template/ucp_prefs_personal.html
+++ b/phpBB/styles/prosilver/template/ucp_prefs_personal.html
@@ -58,8 +58,8 @@
<!-- ENDIF -->
<!-- IF S_STYLE_OPTIONS and S_MORE_STYLES -->
<dl>
- <dt><label for="style">{L_BOARD_STYLE}{L_COLON}</label></dt>
- <dd><select name="style" id="style">{S_STYLE_OPTIONS}</select></dd>
+ <dt><label for="user_style">{L_BOARD_STYLE}{L_COLON}</label></dt>
+ <dd><select name="user_style" id="user_style">{S_STYLE_OPTIONS}</select></dd>
</dl>
<!-- ENDIF -->
<!-- INCLUDE timezone_option.html -->
diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html
index c2541b8cfd..04529096c9 100644
--- a/phpBB/styles/prosilver/template/viewtopic_body.html
+++ b/phpBB/styles/prosilver/template/viewtopic_body.html
@@ -124,10 +124,14 @@
<div class="inner">
<dl class="postprofile" id="profile{postrow.POST_ID}"<!-- IF postrow.S_POST_HIDDEN --> style="display: none;"<!-- ENDIF -->>
- <dt class="<!-- IF postrow.RANK_TITLE or postrow.RANK_IMG -->has-profile-rank<!-- ELSE -->no-profile-rank<!-- ENDIF -->">
- <!-- IF postrow.POSTER_AVATAR -->
- <!-- IF postrow.U_POST_AUTHOR --><a href="{postrow.U_POST_AUTHOR}" class="avatar">{postrow.POSTER_AVATAR}</a><!-- ELSE --><span class="avatar">{postrow.POSTER_AVATAR}</span><!-- ENDIF -->
- <!-- ENDIF -->
+ <dt class="<!-- IF postrow.RANK_TITLE or postrow.RANK_IMG -->has-profile-rank<!-- ELSE -->no-profile-rank<!-- ENDIF --> <!-- IF postrow.POSTER_AVATAR -->has-avatar<!-- ELSE -->no-avatar<!-- ENDIF -->">
+ <div class="avatar-container">
+ <!-- EVENT viewtopic_body_avatar_before -->
+ <!-- IF postrow.POSTER_AVATAR -->
+ <!-- IF postrow.U_POST_AUTHOR --><a href="{postrow.U_POST_AUTHOR}" class="avatar">{postrow.POSTER_AVATAR}</a><!-- ELSE --><span class="avatar">{postrow.POSTER_AVATAR}</span><!-- ENDIF -->
+ <!-- ENDIF -->
+ <!-- EVENT viewtopic_body_avatar_after -->
+ </div>
<!-- IF not postrow.U_POST_AUTHOR --><strong>{postrow.POST_AUTHOR_FULL}</strong><!-- ELSE -->{postrow.POST_AUTHOR_FULL}<!-- ENDIF -->
</dt>
@@ -274,16 +278,6 @@
<dl class="attachbox">
<dt>
{L_ATTACHMENTS}
- <!-- IF postrow.S_MULTIPLE_ATTACHMENTS -->
- <div class="dl_links">
- <strong>{L_DOWNLOAD_ALL}{L_COLON}</strong>
- <ul>
- <!-- BEGIN dl_method -->
- <li>[ <a href="{postrow.dl_method.LINK}">{postrow.dl_method.TYPE}</a> ]</li>
- <!-- END dl_method -->
- </ul>
- </div>
- <!-- ENDIF -->
</dt>
<!-- BEGIN attachment -->
<dd>{postrow.attachment.DISPLAY_ATTACHMENT}</dd>
diff --git a/phpBB/styles/prosilver/template/viewtopic_topic_tools.html b/phpBB/styles/prosilver/template/viewtopic_topic_tools.html
index 2a34ebd446..8378e3bcf4 100644
--- a/phpBB/styles/prosilver/template/viewtopic_topic_tools.html
+++ b/phpBB/styles/prosilver/template/viewtopic_topic_tools.html
@@ -1,4 +1,4 @@
-<!-- IF not S_IS_BOT and (U_WATCH_TOPIC or U_BOOKMARK_TOPIC or U_BUMP_TOPIC or S_HAS_ATTACHMENTS or U_EMAIL_TOPIC or U_PRINT_TOPIC or S_DISPLAY_TOPIC_TOOLS) -->
+<!-- IF not S_IS_BOT and (U_WATCH_TOPIC or U_BOOKMARK_TOPIC or U_BUMP_TOPIC or U_EMAIL_TOPIC or U_PRINT_TOPIC or S_DISPLAY_TOPIC_TOOLS) -->
<div class="dropdown-container dropdown-button-control topic-tools">
<span title="{L_TOPIC_TOOLS}" class="button icon-button tools-icon dropdown-trigger dropdown-select"></span>
<div class="dropdown hidden">
@@ -18,18 +18,6 @@
<!-- IF U_BUMP_TOPIC --><li class="small-icon icon-bump"><a href="{U_BUMP_TOPIC}" title="{L_BUMP_TOPIC}" data-ajax="true">{L_BUMP_TOPIC}</a></li><!-- ENDIF -->
<!-- IF U_EMAIL_TOPIC --><li class="small-icon icon-sendemail"><a href="{U_EMAIL_TOPIC}" title="{L_EMAIL_TOPIC}">{L_EMAIL_TOPIC}</a></li><!-- ENDIF -->
<!-- IF U_PRINT_TOPIC --><li class="small-icon icon-print"><a href="{U_PRINT_TOPIC}" title="{L_PRINT_TOPIC}" accesskey="p">{L_PRINT_TOPIC}</a></li><!-- ENDIF -->
- <!-- IF S_HAS_ATTACHMENTS -->
- <li class="small-icon icon-download">
- <a class="dropdown-toggle-submenu" href="{U_DOWNLOAD_ALL_ATTACHMENTS}" title="{L_DOWNLOAD_ALL_ATTACHMENTS}">{L_DOWNLOAD_ALL_ATTACHMENTS}</a>
- <ul class="dropdown-submenu hidden">
- <li>
- <!-- BEGIN dl_method -->
- <a href="{dl_method.LINK}">{dl_method.TYPE}</a><!-- IF not dl_method.S_LAST_ROW --> &bull; <!-- ENDIF -->
- <!-- END dl_method -->
- </li>
- </ul>
- </li>
- <!-- ENDIF -->
<!-- EVENT viewtopic_topic_tools_after -->
</ul>
</div>
diff --git a/phpBB/styles/prosilver/theme/bidi.css b/phpBB/styles/prosilver/theme/bidi.css
index bc9e4b3965..0d98fe7a66 100644
--- a/phpBB/styles/prosilver/theme/bidi.css
+++ b/phpBB/styles/prosilver/theme/bidi.css
@@ -112,9 +112,18 @@
text-align: right;
}
+.rtl .dropdown-contents > li {
+ padding-left: 15px;
+ padding-right: 0;
+}
+
+.rtl .dropdown-nonscroll > li {
+ padding-left: 0;
+}
+
.rtl .dropdown li li {
padding-left: 0;
- padding-right: 10px;
+ padding-right: 18px;
}
.rtl .dropdown-extended .header {
@@ -315,7 +324,7 @@
unicode-bidi: embed;
}
-ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a {
+li.breadcrumbs span:first-child > a {
padding-left: 0;
padding-right: 19px;
}
@@ -332,12 +341,8 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a {
.rtl .skiplink {
/* invisible skip link, used for accessibility */
- position: relative;
- width: 1px;
- height: 1px;
- overflow: hidden;
- display: block;
left: 0;
+ right: -999px;
}
.rtl a.feed-icon-forum {
@@ -586,6 +591,10 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a {
margin-right: 8px;
}
+.rtl .postprofile .avatar {
+ float: right;
+}
+
.rtl .online {
background-position: 0 0;
}
@@ -601,8 +610,8 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a {
/* Rollover buttons
Based on: http://wellstyled.com/css-nopreload-rollovers.html
----------------------------------------*/
-.rtl .icon-button.dropdown-select {
- padding-left: 26px;
+.rtl .dropdown-select {
+ padding-left: 24px;
padding-right: 8px;
}
@@ -612,7 +621,12 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a {
margin-right: 2px;
}
-.dropdown-select:after {
+.rtl .dropdown-select.icon-button:before {
+ margin-left: 4px;
+ margin-right: 0;
+}
+
+.rtl .dropdown-select:after {
border-left: 0;
border-right-style: solid;
border-right-width: 1px;
@@ -628,12 +642,11 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a {
---------------------------------------- */
.rtl .small-icon {
background-position: 100% 50%;
- padding-left: 0;
- padding-right: 19px;
}
-.rtl ul.linklist li.small-icon {
- padding-right: 0;
+.rtl .small-icon > a {
+ padding-left: 0;
+ padding-right: 19px;
}
/* Post control buttons
@@ -916,16 +929,6 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a {
float: left;
}
-/* Jumpbox */
-.rtl fieldset.jumpbox {
- text-align: left;
-}
-
-.rtl fieldset.quickmod {
- float: left;
- text-align: left;
-}
-
/* Posting page styles
----------------------------------------*/
@@ -1079,8 +1082,11 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a {
border-width: 0 0 1px 0;
}
+ .rtl .postprofile dt, .rtl .postprofile dd.profile-rank, .rtl .search .postprofile dd {
+ margin: 0;
+ }
+
.rtl .postprofile .avatar {
- float: right;
margin-left: 5px;
margin-right: 0;
}
diff --git a/phpBB/styles/prosilver/theme/buttons.css b/phpBB/styles/prosilver/theme/buttons.css
index 18c71d251e..b45aae5672 100644
--- a/phpBB/styles/prosilver/theme/buttons.css
+++ b/phpBB/styles/prosilver/theme/buttons.css
@@ -105,17 +105,21 @@
background-position: 0 50%;
background-repeat: no-repeat;
background-image: none;
- padding: 0 0 0 17px;
}
-ul.linklist li.small-icon {
- padding-left: 0;
+.small-icon > a {
+ display: inline-block;
+ padding: 0 0 0 18px;
}
ul.linklist.bulletin > li.small-icon:before {
display: none;
}
+.dropdown .small-icon > a {
+ display: block;
+}
+
/* Poster contact icons
----------------------------------------*/
.contact-icons.dropdown-contents {
diff --git a/phpBB/styles/prosilver/theme/colours.css b/phpBB/styles/prosilver/theme/colours.css
index fce66f7efb..df27467cf8 100644
--- a/phpBB/styles/prosilver/theme/colours.css
+++ b/phpBB/styles/prosilver/theme/colours.css
@@ -610,7 +610,7 @@ Colours and backgrounds for buttons.css
color: #D31141;
}
-.dropdown-select, .dropdown-select:visited {
+.dropdown-select {
color: #536482;
}
@@ -654,7 +654,6 @@ Colours and backgrounds for buttons.css
.icon-pm { background-image: url("./images/icon_pm.gif"); }
.icon-print { background-image: url("./images/icon_print.gif"); }
.icon-profile { background-image: url("./images/icon_profile.gif"); }
-.icon-quick-links { background-image: url("./images/icon_quick_links.gif"); }
.icon-register { background-image: url("./images/icon_register.gif"); }
.icon-search, .responsive-search a { background-image: url("./images/icon_search.gif"); }
.icon-search-active { background-image: url("./images/subforum_read.gif"); }
diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css
index 6d3a871376..84701cc061 100644
--- a/phpBB/styles/prosilver/theme/common.css
+++ b/phpBB/styles/prosilver/theme/common.css
@@ -301,12 +301,6 @@ ol ol ul, ol ul ul, ul ol ul, ul ul ul {
border-radius: 7px;
}
-.inner:after {
- content: '';
- clear: both;
- display: block;
-}
-
.rowbg {
margin: 5px 5px 2px 5px;
}
@@ -322,12 +316,6 @@ ul.linklist {
margin: 0;
}
-ul.linklist:after {
- content: '';
- display: block;
- clear: both;
-}
-
#cp-main .panel {
padding: 5px 10px;
}
@@ -621,7 +609,7 @@ ul.linklist.bulletin > li.no-bulletin:before {
.dropdown li li {
border-top: 1px dotted transparent;
- padding-left: 10px;
+ padding-left: 18px;
}
.wrap .dropdown li, .dropdown.wrap li, .dropdown-extended li {
@@ -776,6 +764,7 @@ table.info tbody th {
float: left;
width: auto;
text-align: left;
+ max-width: 100%;
}
.left-box.profile-details {
@@ -786,6 +775,7 @@ table.info tbody th {
float: right;
width: auto;
text-align: right;
+ max-width: 100%;
}
dl.details {
@@ -852,12 +842,6 @@ fieldset.fields1 dl.pmlist dd.recipients {
margin-top: 2em;
}
-.action-bar:after {
- clear: both;
- content: '';
- display: block;
-}
-
/* Pagination
---------------------------------------- */
.pagination {
@@ -1126,6 +1110,20 @@ form > p.post-notice strong {
background: transparent;
}
+/* Inner box-model clearing */
+.inner:after,
+ul.linklist:after,
+.action-bar:after,
+.notification_text:after,
+.tabs-container:after,
+#tabs > ul:after,
+#minitabs > ul:after,
+.postprofile .avatar-container:after {
+ clear: both;
+ content: '';
+ display: block;
+}
+
.hidden {
display: none;
}
@@ -1281,12 +1279,6 @@ form > p.post-notice strong {
margin-left: 58px;
}
-.notification_text:after {
- content: '';
- clear: both;
- display: block;
-}
-
/* Navbar specific list items
----------------------------------------*/
diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css
index a014f57d47..d00c544050 100644
--- a/phpBB/styles/prosilver/theme/content.css
+++ b/phpBB/styles/prosilver/theme/content.css
@@ -710,15 +710,22 @@ fieldset.polls dd div {
margin-bottom: 10px;
}
+/* Post-profile avatars */
+.postprofile .has-avatar .avatar-container {
+ margin-bottom: 3px;
+ overflow: hidden;
+}
+
.postprofile .avatar {
display: block;
- border: none;
- margin-bottom: 3px;
+ float: left;
+ max-width: 100%;
}
.postprofile .avatar img {
- max-width: 90%;
+ display: block;
height: auto !important;
+ max-width: 100%;
}
dd.profile-warnings {
@@ -752,6 +759,11 @@ dd.profile-contact {
width: 30%;
}
+/* Profile used on view-profile */
+.profile-avatar img {
+ max-width: 100%;
+}
+
/* pm list in compose message if mass pm is enabled */
dl.pmlist dt {
width: 60% !important;
diff --git a/phpBB/styles/prosilver/theme/cp.css b/phpBB/styles/prosilver/theme/cp.css
index 5149a16ec9..d3699c3012 100644
--- a/phpBB/styles/prosilver/theme/cp.css
+++ b/phpBB/styles/prosilver/theme/cp.css
@@ -96,12 +96,6 @@ ul.cplist {
margin-bottom: 0px;
}
-.tabs-container:after {
- clear: both;
- content: '';
- display: block;
-}
-
/* CP tabs shared
----------------------------------------*/
#tabs, #minitabs {
@@ -115,12 +109,6 @@ ul.cplist {
position: relative;
}
-#tabs > ul:after, #minitabs > ul:after {
- clear: both;
- content: '';
- display: block;
-}
-
#tabs .tab, #minitabs .tab {
display: inline-block;
float: left;
diff --git a/phpBB/styles/prosilver/theme/images/created_by.jpg b/phpBB/styles/prosilver/theme/images/created_by.jpg
deleted file mode 100644
index 68d56e2013..0000000000
--- a/phpBB/styles/prosilver/theme/images/created_by.jpg
+++ /dev/null
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/images/icon_print.gif b/phpBB/styles/prosilver/theme/images/icon_print.gif
index e464e304ea..e464e304ea 100755..100644
--- a/phpBB/styles/prosilver/theme/images/icon_print.gif
+++ b/phpBB/styles/prosilver/theme/images/icon_print.gif
Binary files differ
diff --git a/phpBB/assets/plupload/img/done.gif b/phpBB/styles/prosilver/theme/images/plupload/done.gif
index 29f3ed7c97..29f3ed7c97 100644
--- a/phpBB/assets/plupload/img/done.gif
+++ b/phpBB/styles/prosilver/theme/images/plupload/done.gif
Binary files differ
diff --git a/phpBB/assets/plupload/img/error.gif b/phpBB/styles/prosilver/theme/images/plupload/error.gif
index 4682b63007..4682b63007 100644
--- a/phpBB/assets/plupload/img/error.gif
+++ b/phpBB/styles/prosilver/theme/images/plupload/error.gif
Binary files differ
diff --git a/phpBB/assets/plupload/img/throbber.gif b/phpBB/styles/prosilver/theme/images/plupload/throbber.gif
index 4ae8b16a5a..4ae8b16a5a 100644
--- a/phpBB/assets/plupload/img/throbber.gif
+++ b/phpBB/styles/prosilver/theme/images/plupload/throbber.gif
Binary files differ
diff --git a/phpBB/styles/prosilver/theme/links.css b/phpBB/styles/prosilver/theme/links.css
index 890f854baa..9b5c00d9b6 100644
--- a/phpBB/styles/prosilver/theme/links.css
+++ b/phpBB/styles/prosilver/theme/links.css
@@ -27,7 +27,7 @@ a:hover { text-decoration: underline; }
}
/* Navigation bar links */
-ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a {
+li.breadcrumbs span:first-child > a {
display: inline-block;
padding-left: 17px;
}
diff --git a/phpBB/styles/prosilver/theme/plupload.css b/phpBB/styles/prosilver/theme/plupload.css
index f81064dbe6..7d4092c3fe 100644
--- a/phpBB/styles/prosilver/theme/plupload.css
+++ b/phpBB/styles/prosilver/theme/plupload.css
@@ -58,15 +58,15 @@
}
.file-status.file-working {
- background: url('../../../assets/plupload/img/throbber.gif');
+ background: url('./images/plupload/throbber.gif');
}
.file-status.file-uploaded {
- background: url('../../../assets/plupload/img/done.gif');
+ background: url('./images/plupload/done.gif');
}
.file-status.file-error {
- background: url('../../../assets/plupload/img/error.gif');
+ background: url('./images/plupload/error.gif');
}
.file-status {
diff --git a/phpBB/styles/prosilver/theme/responsive.css b/phpBB/styles/prosilver/theme/responsive.css
index 241b4d132e..3ef0044621 100644
--- a/phpBB/styles/prosilver/theme/responsive.css
+++ b/phpBB/styles/prosilver/theme/responsive.css
@@ -424,16 +424,22 @@ fieldset.polls dd.resultbar, fieldset.polls dd.poll_option_percent {
margin: 0;
}
+.postprofile .has-avatar .avatar-container {
+ margin: 0;
+ overflow: inherit;
+}
+
+.postprofile .avatar-container:after {
+ clear: none;
+}
+
.postprofile .avatar {
- display: block;
- float: left;
margin-right: 5px;
}
.postprofile .avatar img {
width: auto !important;
height: auto !important;
- display: block;
max-height: 32px;
}
@@ -460,12 +466,6 @@ p.rightside {
margin-bottom: 0;
}
-fieldset.quickmod {
- width: auto;
- float: none;
- text-align: center;
-}
-
fieldset.display-options label {
display: block;
clear: both;
@@ -503,14 +503,11 @@ fieldset.display-actions {
margin: 0;
}
- .action-bar > .pagination, fieldset.jumpbox {
- text-align: center;
- }
-
.action-bar > .pagination {
float: none;
clear: both;
padding-bottom: 1px;
+ text-align: center;
}
.action-bar > .pagination li.page-jump {
diff --git a/phpBB/styles/prosilver/theme/tweaks.css b/phpBB/styles/prosilver/theme/tweaks.css
index ea0c66d20a..851b3a6bb6 100644
--- a/phpBB/styles/prosilver/theme/tweaks.css
+++ b/phpBB/styles/prosilver/theme/tweaks.css
@@ -71,3 +71,8 @@ dd.option {
.header-avatar img {
height: 20px;
}
+
+/* IE8 often can't handle max-width in %, so we use px instead */
+.postprofile .avatar img {
+ max-width: 150px;
+}
diff --git a/phpBB/styles/subsilver2/style.cfg b/phpBB/styles/subsilver2/style.cfg
index 633acf66e0..3ef3154742 100644
--- a/phpBB/styles/subsilver2/style.cfg
+++ b/phpBB/styles/subsilver2/style.cfg
@@ -21,8 +21,8 @@
# General Information about this style
name = subsilver2
copyright = © 2005 phpBB Limited
-style_version = 3.1.0-RC2
-phpbb_version = 3.1.0-RC2
+style_version = 3.1.0-RC3
+phpbb_version = 3.1.0-RC3
# Defining a different template bitfield
# template_bitfield = lNg=
diff --git a/phpBB/styles/subsilver2/template/mcp_topic.html b/phpBB/styles/subsilver2/template/mcp_topic.html
index 5bd762ec0b..cba473147e 100644
--- a/phpBB/styles/subsilver2/template/mcp_topic.html
+++ b/phpBB/styles/subsilver2/template/mcp_topic.html
@@ -55,7 +55,7 @@
</tr>
<tr>
<td class="row1" nowrap="nowrap"><span class="gen">{L_POSTS_PER_PAGE}</span><br /><span class="gensmall">{L_POSTS_PER_PAGE_EXPLAIN}</span></td>
- <td class="row2" colspan="2"><input class="post" type="number" min="1" name="posts_per_page" size="6" value="{POSTS_PER_PAGE}" /></td>
+ <td class="row2" colspan="2"><input class="post" type="number" min="0" name="posts_per_page" size="6" value="{POSTS_PER_PAGE}" /></td>
</tr>
<tr>
<td class="cat" colspan="3" align="center"><span class="gensmall">{L_DISPLAY_POSTS}{L_COLON}</span> {S_SELECT_SORT_DAYS}&nbsp;<span class="gensmall">{L_SORT_BY}</span> {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR}&nbsp;<input class="btnlite" type="submit" name="sort" value="{L_GO}" /></td>
diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html
index cb9a3a2a36..ebb7b3be4d 100644
--- a/phpBB/styles/subsilver2/template/overall_header.html
+++ b/phpBB/styles/subsilver2/template/overall_header.html
@@ -135,6 +135,8 @@ function marklist(id, name, state)
{$STYLESHEETS}
+<!-- EVENT overall_header_stylesheets_after -->
+
</head>
<body class="{S_CONTENT_DIRECTION} {BODY_CLASS}">
@@ -212,7 +214,7 @@ function marklist(id, name, state)
</td>
<td class="genmed" align="{S_CONTENT_FLOW_END}">
<!-- EVENT overall_header_navigation_prepend -->
- <a href="{U_FAQ}"><img src="{T_THEME_PATH}/images/icon_mini_faq.gif" width="12" height="13" alt="*" /> {L_FAQ}</a>
+ <a href="{U_FAQ}" rel="help"><img src="{T_THEME_PATH}/images/icon_mini_faq.gif" width="12" height="13" alt="*" /> {L_FAQ}</a>
<!-- IF S_DISPLAY_SEARCH -->&nbsp; &nbsp;<a href="{U_SEARCH}"><img src="{T_THEME_PATH}/images/icon_mini_search.gif" width="12" height="13" alt="*" /> {L_SEARCH}</a><!-- ENDIF -->
<!-- IF not S_IS_BOT -->
<!-- IF S_DISPLAY_MEMBERLIST -->&nbsp; &nbsp;<a href="{U_MEMBERLIST}"><img src="{T_THEME_PATH}/images/icon_mini_members.gif" width="12" height="13" alt="*" /> {L_MEMBERLIST}</a><!-- ENDIF -->
diff --git a/phpBB/styles/subsilver2/template/simple_header.html b/phpBB/styles/subsilver2/template/simple_header.html
index faeeaea3d5..0c3dff4a05 100644
--- a/phpBB/styles/subsilver2/template/simple_header.html
+++ b/phpBB/styles/subsilver2/template/simple_header.html
@@ -14,6 +14,8 @@
{$STYLESHEETS}
+<!-- EVENT simple_header_stylesheets_after -->
+
</head>
<body class="{S_CONTENT_DIRECTION} {BODY_CLASS}">
diff --git a/phpBB/styles/subsilver2/template/ucp_groups_manage.html b/phpBB/styles/subsilver2/template/ucp_groups_manage.html
index 55c1c20528..09d59c8ec0 100644
--- a/phpBB/styles/subsilver2/template/ucp_groups_manage.html
+++ b/phpBB/styles/subsilver2/template/ucp_groups_manage.html
@@ -78,7 +78,6 @@
<td class="row1" width="35%"><b class="genmed">{L_AVATAR_TYPE}{L_COLON}</b></td>
<td class="row2">
<select name="avatar_driver" id="avatar_driver">
- <option value="">{L_NO_AVATAR}</option>
<!-- BEGIN avatar_drivers -->
<option value="{avatar_drivers.DRIVER}"<!-- IF avatar_drivers.SELECTED --> selected="selected"<!-- ENDIF -->>{avatar_drivers.L_TITLE}</option>
<!-- END avatar_drivers -->
diff --git a/phpBB/styles/subsilver2/template/ucp_prefs_personal.html b/phpBB/styles/subsilver2/template/ucp_prefs_personal.html
index 93fcfac5b1..1c76e3226d 100644
--- a/phpBB/styles/subsilver2/template/ucp_prefs_personal.html
+++ b/phpBB/styles/subsilver2/template/ucp_prefs_personal.html
@@ -49,7 +49,7 @@
<!-- IF S_STYLE_OPTIONS and S_MORE_STYLES -->
<tr>
<td class="row1" width="50%"><b class="genmed">{L_BOARD_STYLE}{L_COLON}</b></td>
- <td class="row2"><select name="style">{S_STYLE_OPTIONS}</select></td>
+ <td class="row2"><select name="user_style">{S_STYLE_OPTIONS}</select></td>
</tr>
<!-- ENDIF -->
<!-- INCLUDE timezone_option.html -->
diff --git a/phpBB/styles/subsilver2/template/ucp_profile_avatar.html b/phpBB/styles/subsilver2/template/ucp_profile_avatar.html
index fc52c149c6..8b1e8cffac 100644
--- a/phpBB/styles/subsilver2/template/ucp_profile_avatar.html
+++ b/phpBB/styles/subsilver2/template/ucp_profile_avatar.html
@@ -28,7 +28,6 @@
<td class="row1" width="35%"><b class="genmed">{L_AVATAR_TYPE}{L_COLON}</b></td>
<td class="row2">
<select name="avatar_driver" id="avatar_driver" data-togglable-settings="true">
- <option value="">{L_NO_AVATAR}</option>
<!-- BEGIN avatar_drivers -->
<option value="{avatar_drivers.DRIVER}"<!-- IF avatar_drivers.SELECTED --> selected="selected"<!-- ENDIF --> data-toggle-setting=".avatar_option_{avatar_drivers.DRIVER}">{avatar_drivers.L_TITLE}</option>
<!-- END avatar_drivers -->
diff --git a/phpBB/styles/subsilver2/template/viewtopic_body.html b/phpBB/styles/subsilver2/template/viewtopic_body.html
index c69be83a1e..0f34b50950 100644
--- a/phpBB/styles/subsilver2/template/viewtopic_body.html
+++ b/phpBB/styles/subsilver2/template/viewtopic_body.html
@@ -192,11 +192,15 @@
<td>{postrow.RANK_IMG}</td>
</tr>
<!-- ENDIF -->
+
+ <!-- EVENT viewtopic_body_avatar_before -->
<!-- IF postrow.POSTER_AVATAR -->
<tr>
<td>{postrow.POSTER_AVATAR}</td>
</tr>
<!-- ENDIF -->
+ <!-- EVENT viewtopic_body_avatar_after -->
+
<!-- IF not (postrow.ONLINE_IMG or postrow.RANK_TITLE or postrow.RANK_IMG or postrow.POSTER_AVATAR) -->
<tr>
<td></td>
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 1fdce5a6c3..c2faffca85 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -539,8 +539,8 @@ $s_quickmod_action = append_sid(
$quickmod_array = array(
// 'key' => array('LANG_KEY', $userHasPermissions),
- 'lock' => array('LOCK_TOPIC', ($topic_data['topic_status'] == ITEM_UNLOCKED) && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] && $topic_data['topic_status'] == ITEM_UNLOCKED))),
- 'unlock' => array('UNLOCK_TOPIC', ($topic_data['topic_status'] != ITEM_UNLOCKED) && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'] && $topic_data['topic_status'] == ITEM_UNLOCKED))),
+ 'lock' => array('LOCK_TOPIC', ($topic_data['topic_status'] == ITEM_UNLOCKED) && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster']))),
+ 'unlock' => array('UNLOCK_TOPIC', ($topic_data['topic_status'] != ITEM_UNLOCKED) && ($auth->acl_get('m_lock', $forum_id))),
'delete_topic' => array('DELETE_TOPIC', ($auth->acl_get('m_delete', $forum_id) || (($topic_data['topic_visibility'] != ITEM_DELETED) && $auth->acl_get('m_softdelete', $forum_id)))),
'restore_topic' => array('RESTORE_TOPIC', (($topic_data['topic_visibility'] == ITEM_DELETED) && $auth->acl_get('m_approve', $forum_id))),
'move' => array('MOVE_TOPIC', $auth->acl_get('m_move', $forum_id) && $topic_data['topic_status'] != ITEM_MOVED),
@@ -602,6 +602,35 @@ if (!empty($_EXTRA_URL))
// If we've got a hightlight set pass it on to pagination.
$base_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id" . ((strlen($u_sort_param)) ? "&amp;$u_sort_param" : '') . (($highlight_match) ? "&amp;hilit=$highlight" : ''));
+
+/**
+* Event to modify data before template variables are being assigned
+*
+* @event core.viewtopic_assign_template_vars_before
+* @var string base_url URL to be passed to generate pagination
+* @var int forum_id Forum ID
+* @var int post_id Post ID
+* @var array quickmod_array Array with quick moderation options data
+* @var int start Pagination information
+* @var array topic_data Array with topic data
+* @var int topic_id Topic ID
+* @var array topic_tracking_info Array with topic tracking data
+* @var int total_posts Topic total posts count
+* @since 3.1.0-RC4
+*/
+$vars = array(
+ 'base_url',
+ 'forum_id',
+ 'post_id',
+ 'quickmod_array',
+ 'start',
+ 'topic_data',
+ 'topic_id',
+ 'topic_tracking_info',
+ 'total_posts',
+);
+extract($phpbb_dispatcher->trigger_event('core.viewtopic_assign_template_vars_before', compact($vars)));
+
$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_posts, $config['posts_per_page'], $start);
// Send vars to template
@@ -1392,17 +1421,6 @@ if (sizeof($attach_list))
}
}
-$methods = phpbb_gen_download_links('topic_id', $topic_id, $phpbb_root_path, $phpEx);
-foreach ($methods as $method)
-{
- $template->assign_block_vars('dl_method', $method);
-}
-
-$template->assign_vars(array(
- 'S_HAS_ATTACHMENTS' => $topic_data['topic_attachment'],
- 'U_DOWNLOAD_ALL_ATTACHMENTS' => $methods[0]['LINK'],
-));
-
// Instantiate BBCode if need be
if ($bbcode_bitfield !== '')
{
@@ -1420,6 +1438,7 @@ $i_total = sizeof($rowset) - 1;
$prev_post_id = '';
$template->assign_vars(array(
+ 'S_HAS_ATTACHMENTS' => $topic_data['topic_attachment'],
'S_NUM_POSTS' => sizeof($post_list))
);
@@ -1918,12 +1937,6 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
'DISPLAY_ATTACHMENT' => $attachment)
);
}
-
- $methods = phpbb_gen_download_links('post_id', $row['post_id'], $phpbb_root_path, $phpEx);
- foreach ($methods as $method)
- {
- $template->assign_block_vars('postrow.dl_method', $method);
- }
}
$current_row_number = $i;
diff --git a/tests/auth/provider_apache_test.php b/tests/auth/provider_apache_test.php
index 2decf0f18c..68ad7b2c19 100644
--- a/tests/auth/provider_apache_test.php
+++ b/tests/auth/provider_apache_test.php
@@ -29,7 +29,7 @@ class phpbb_auth_provider_apache_test extends phpbb_database_test_case
$db = $this->new_dbal();
$config = new \phpbb\config\config(array());
$this->request = $this->getMock('\phpbb\request\request');
- $this->user = $this->getMock('\phpbb\user');
+ $this->user = new \phpbb\user('\phpbb\datetime');
$driver_helper = new \phpbb\passwords\driver\helper($config);
$passwords_drivers = array(
'passwords.driver.bcrypt_2y' => new \phpbb\passwords\driver\bcrypt_2y($config, $driver_helper),
diff --git a/tests/auth/provider_db_test.php b/tests/auth/provider_db_test.php
index 23324f87f2..e33eae6b54 100644
--- a/tests/auth/provider_db_test.php
+++ b/tests/auth/provider_db_test.php
@@ -39,7 +39,7 @@ class phpbb_auth_provider_db_test extends phpbb_database_test_case
'max_login_attempts' => 0,
));
$request = $this->getMock('\phpbb\request\request');
- $user = $this->getMock('\phpbb\user');
+ $user = new \phpbb\user('\phpbb\datetime');
$driver_helper = new \phpbb\passwords\driver\helper($config);
$passwords_drivers = array(
'passwords.driver.bcrypt_2y' => new \phpbb\passwords\driver\bcrypt_2y($config, $driver_helper),
@@ -52,7 +52,9 @@ class phpbb_auth_provider_db_test extends phpbb_database_test_case
// Set up passwords manager
$passwords_manager = new \phpbb\passwords\manager($config, $passwords_drivers, $passwords_helper, array_keys($passwords_drivers));
- $provider = new \phpbb\auth\provider\db($db, $config, $passwords_manager, $request, $user, $phpbb_root_path, $phpEx);
+ $phpbb_container = new phpbb_mock_container_builder();
+
+ $provider = new \phpbb\auth\provider\db($db, $config, $passwords_manager, $request, $user, $phpbb_container, $phpbb_root_path, $phpEx);
if (version_compare(PHP_VERSION, '5.3.7', '<'))
{
$password_hash = '$2a$10$e01Syh9PbJjUkio66eFuUu4FhCE2nRgG7QPc1JACalsPXcIuG2bbi';
diff --git a/tests/auth/provider_oauth_token_storage_test.php b/tests/auth/provider_oauth_token_storage_test.php
index 45daa9816b..71b49ff439 100644
--- a/tests/auth/provider_oauth_token_storage_test.php
+++ b/tests/auth/provider_oauth_token_storage_test.php
@@ -31,7 +31,7 @@ class phpbb_auth_provider_oauth_token_storage_test extends phpbb_database_test_c
global $phpbb_root_path, $phpEx;
$this->db = $this->new_dbal();
- $this->user = $this->getMock('\phpbb\user');
+ $this->user = new \phpbb\user('\phpbb\datetime');
$this->service_name = 'auth.provider.oauth.service.testing';
$this->token_storage_table = 'phpbb_oauth_tokens';
diff --git a/tests/avatar/fixtures/users.xml b/tests/avatar/fixtures/users.xml
new file mode 100644
index 0000000000..3e6586e909
--- /dev/null
+++ b/tests/avatar/fixtures/users.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<dataset>
+ <table name="phpbb_users">
+ <column>user_id</column>
+ <column>username_clean</column>
+ <column>user_permissions</column>
+ <column>user_sig</column>
+ <column>user_avatar</column>
+ <column>user_avatar_type</column>
+ <column>user_avatar_width</column>
+ <column>user_avatar_height</column>
+ <row>
+ <value>1</value>
+ <value>barfoo</value>
+ <value></value>
+ <value></value>
+ <value>foobar@example.com</value>
+ <value>avatar.driver.gravatar</value>
+ <value>80</value>
+ <value>80</value>
+ </row>
+ <row>
+ <value>2</value>
+ <value>foobar</value>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ <value></value>
+ </row>
+ </table>
+</dataset>
diff --git a/tests/avatar/manager_test.php b/tests/avatar/manager_test.php
index de505e2c9f..81c153aed4 100644
--- a/tests/avatar/manager_test.php
+++ b/tests/avatar/manager_test.php
@@ -13,13 +13,18 @@
require_once dirname(__FILE__) . '/driver/foobar.php';
-class phpbb_avatar_manager_test extends \phpbb_test_case
+class phpbb_avatar_manager_test extends \phpbb_database_test_case
{
/** @var \phpbb\avatar\manager */
protected $manager;
protected $avatar_foobar;
protected $avatar_barfoo;
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/users.xml');
+ }
+
public function setUp()
{
global $phpbb_root_path, $phpEx;
@@ -31,7 +36,7 @@ class phpbb_avatar_manager_test extends \phpbb_test_case
->will($this->returnArgument(0));
// Prepare dependencies for avatar manager and driver
- $config = new \phpbb\config\config(array());
+ $this->config = new \phpbb\config\config(array());
$cache = $this->getMock('\phpbb\cache\driver\driver_interface');
$path_helper = new \phpbb\path_helper(
new \phpbb\symfony_request(
@@ -43,8 +48,16 @@ class phpbb_avatar_manager_test extends \phpbb_test_case
$phpEx
);
+ $guessers = array(
+ new \Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser(),
+ new \Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser(),
+ new \phpbb\mimetype\extension_guesser,
+ new \phpbb\mimetype\content_guesser,
+ );
+ $guesser = new \phpbb\mimetype\guesser($guessers);
+
// $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, $path_helper, $cache));
+ $this->avatar_foobar = $this->getMock('\phpbb\avatar\driver\foobar', array('get_name'), array($this->config, $phpbb_root_path, $phpEx, $path_helper, $cache));
$this->avatar_foobar->expects($this->any())
->method('get_name')
->will($this->returnValue('avatar.driver.foobar'));
@@ -57,19 +70,28 @@ class phpbb_avatar_manager_test extends \phpbb_test_case
foreach ($this->avatar_drivers() as $driver)
{
- $cur_avatar = $this->getMock('\phpbb\avatar\driver\\' . $driver, array('get_name'), array($config, $phpbb_root_path, $phpEx, $path_helper, $cache));
+ if ($driver !== 'upload')
+ {
+ $cur_avatar = $this->getMock('\phpbb\avatar\driver\\' . $driver, array('get_name'), array($this->config, $phpbb_root_path, $phpEx, $path_helper, $cache));
+ }
+ else
+ {
+ $cur_avatar = $this->getMock('\phpbb\avatar\driver\\' . $driver, array('get_name'), array($this->config, $phpbb_root_path, $phpEx, $path_helper, $guesser, $cache));
+ }
$cur_avatar->expects($this->any())
->method('get_name')
->will($this->returnValue('avatar.driver.' . $driver));
- $config['allow_avatar_' . get_class($cur_avatar)] = false;
+ $this->config['allow_avatar_' . get_class($cur_avatar)] = $driver == 'gravatar';
$avatar_drivers[] = $cur_avatar;
}
- $config['allow_avatar_' . get_class($this->avatar_foobar)] = true;
- $config['allow_avatar_' . get_class($this->avatar_barfoo)] = false;
+ $this->config['allow_avatar_' . get_class($this->avatar_foobar)] = true;
+ $this->config['allow_avatar_' . get_class($this->avatar_barfoo)] = false;
// Set up avatar manager
- $this->manager = new \phpbb\avatar\manager($config, $avatar_drivers, $phpbb_container);
+ $this->manager = new \phpbb\avatar\manager($this->config, $avatar_drivers, $phpbb_container);
+ $this->db = $this->new_dbal();
+ $this->user = new \phpbb\user('\phpbb\datetime');
}
protected function avatar_drivers()
@@ -107,6 +129,7 @@ class phpbb_avatar_manager_test extends \phpbb_test_case
{
return array(
array('avatar.driver.foobar', 'avatar.driver.foobar'),
+ array('avatar.driver.gravatar', 'avatar.driver.gravatar'),
array('avatar.driver.foo_wrong', null),
array('avatar.driver.local', null),
array(AVATAR_GALLERY, null),
@@ -181,8 +204,8 @@ class phpbb_avatar_manager_test extends \phpbb_test_case
array(
'avatar' => '',
'avatar_type' => '',
- 'avatar_width' => '',
- 'avatar_height' => '',
+ 'avatar_width' => 0,
+ 'avatar_height' => 0,
),
),
array(
@@ -251,7 +274,7 @@ class phpbb_avatar_manager_test extends \phpbb_test_case
public function test_localize_errors()
{
- $user = $this->getMock('\phpbb\user');
+ $user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
$lang_array = array(
array('FOOBAR_OFF', 'foobar_off'),
array('FOOBAR_EXPLAIN', 'FOOBAR_EXPLAIN %s'),
@@ -272,4 +295,42 @@ class phpbb_avatar_manager_test extends \phpbb_test_case
array('FOOBAR_EXPLAIN', 'foo'),
)));
}
+
+ public function data_handle_avatar_delete()
+ {
+ return array(
+ array(array(
+ 'avatar' => '',
+ 'avatar_type' => '',
+ 'avatar_width' => 0,
+ 'avatar_height' => 0,
+ ), 1, array(
+ 'avatar' => 'foobar@example.com',
+ 'avatar_type' => 'avatar.driver.gravatar',
+ 'avatar_width' => '16',
+ 'avatar_height' => '16',
+ ), USERS_TABLE, 'user_'),
+ );
+ }
+
+ /**
+ * @dataProvider data_handle_avatar_delete
+ */
+ public function test_handle_avatar_delete($expected, $id, $avatar_data, $table, $prefix)
+ {
+ $this->config['allow_avatar_gravatar'] = true;
+ $this->assertNull($this->manager->handle_avatar_delete($this->db, $this->user, $avatar_data, $table, $prefix));
+
+ $sql = 'SELECT * FROM ' . $table . '
+ WHERE ' . $prefix . 'id = ' . $id;
+ $result = $this->db->sql_query_limit($sql, 1);
+
+ $row = $this->manager->clean_row($this->db->sql_fetchrow($result), substr($prefix, 0, -1));
+ $this->db->sql_freeresult($result);
+
+ foreach ($expected as $key => $value)
+ {
+ $this->assertEquals($value, $row[$key]);
+ }
+ }
}
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index 2856ba02bb..bb4a703cc3 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -31,5 +31,4 @@ require_once 'test_framework/phpbb_test_case_helpers.php';
require_once 'test_framework/phpbb_test_case.php';
require_once 'test_framework/phpbb_database_test_case.php';
require_once 'test_framework/phpbb_database_test_connection_manager.php';
-require_once 'test_framework/phpbb_mink_test_case.php';
require_once 'test_framework/phpbb_functional_test_case.php';
diff --git a/tests/config_php_file_test.php b/tests/config_php_file_test.php
index c2e4eb21c7..c319678108 100644
--- a/tests/config_php_file_test.php
+++ b/tests/config_php_file_test.php
@@ -17,6 +17,7 @@ class phpbb_config_php_file_test extends phpbb_test_case
{
$config_php = new \phpbb\config_php_file(dirname( __FILE__ ) . '/fixtures/', 'php');
$this->assertSame('bar', $config_php->get('foo'));
+ $this->assertNull($config_php->get('bar'));
$this->assertSame(array('foo' => 'bar', 'foo_foo' => 'bar bar'), $config_php->get_all());
}
@@ -25,6 +26,15 @@ class phpbb_config_php_file_test extends phpbb_test_case
$config_php = new \phpbb\config_php_file(dirname( __FILE__ ) . '/fixtures/', 'php');
$config_php->set_config_file(dirname( __FILE__ ) . '/fixtures/config_other.php');
$this->assertSame('foo', $config_php->get('bar'));
+ $this->assertNull($config_php->get('foo'));
$this->assertSame(array('bar' => 'foo', 'bar_bar' => 'foo foo'), $config_php->get_all());
}
+
+ public function test_non_existent_file()
+ {
+ $config_php = new \phpbb\config_php_file(dirname( __FILE__ ) . '/fixtures/non_existent/', 'php');
+ $this->assertNull($config_php->get('bar'));
+ $this->assertNull($config_php->get('foo'));
+ $this->assertSame(array(), $config_php->get_all());
+ }
}
diff --git a/tests/console/cron/cron_list_test.php b/tests/console/cron/cron_list_test.php
index 1059a3f221..22423304be 100644
--- a/tests/console/cron/cron_list_test.php
+++ b/tests/console/cron/cron_list_test.php
@@ -32,7 +32,7 @@ class phpbb_console_command_cron_list_test extends phpbb_test_case
protected function setUp()
{
- $this->user = $this->getMock('\phpbb\user');
+ $this->user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
$this->user->method('lang')->will($this->returnArgument(0));
}
diff --git a/tests/console/cron/run_test.php b/tests/console/cron/run_test.php
index 60bd74e1f0..029dc5249b 100644
--- a/tests/console/cron/run_test.php
+++ b/tests/console/cron/run_test.php
@@ -41,7 +41,7 @@ class phpbb_console_command_cron_run_test extends phpbb_database_test_case
set_config(null, null, null, $this->config);
$this->lock = new \phpbb\lock\db('cron_lock', $this->config, $this->db);
- $this->user = $this->getMock('\phpbb\user');
+ $this->user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
$this->user->method('lang')->will($this->returnArgument(0));
$this->task = new phpbb_cron_task_simple();
diff --git a/tests/content_visibility/delete_post_test.php b/tests/content_visibility/delete_post_test.php
index 99068729df..65dda3ce48 100644
--- a/tests/content_visibility/delete_post_test.php
+++ b/tests/content_visibility/delete_post_test.php
@@ -67,6 +67,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
array(
array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 0, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 3),
),
+ array(
+ array('user_posts' => 3),
+ ),
),
array(
1, 1, 1,
@@ -93,6 +96,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
array(
array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 0, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 3),
),
+ array(
+ array('user_posts' => 3),
+ ),
),
array(
1, 1, 3,
@@ -119,6 +125,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
array(
array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 0, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 2),
),
+ array(
+ array('user_posts' => 3),
+ ),
),
array(
1, 1, 2,
@@ -145,6 +154,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
array(
array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 1, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 3),
),
+ array(
+ array('user_posts' => 3),
+ ),
),
array(
1, 1, 1,
@@ -171,6 +183,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
array(
array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 1, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 3),
),
+ array(
+ array('user_posts' => 3),
+ ),
),
array(
1, 1, 3,
@@ -197,6 +212,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
array(
array('forum_posts_approved' => 2, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 1, 'forum_topics_approved' => 1, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 2),
),
+ array(
+ array('user_posts' => 3),
+ ),
),
array(
@@ -222,6 +240,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
array(
array('forum_posts_approved' => 0, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 0, 'forum_topics_approved' => 0, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 0, 'forum_last_post_id' => 0),
),
+ array(
+ array('user_posts' => 3),
+ ),
),
array(
@@ -257,6 +278,9 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
array(
array('forum_posts_approved' => 0, 'forum_posts_unapproved' => 0, 'forum_posts_softdeleted' => 1, 'forum_topics_approved' => 0, 'forum_topics_unapproved' => 0, 'forum_topics_softdeleted' => 1, 'forum_last_post_id' => 0),
),
+ array(
+ array('user_posts' => 3),
+ ),
),
);
}
@@ -264,14 +288,15 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
/**
* @dataProvider delete_post_data
*/
- public function test_delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $reason, $expected_posts, $expected_topic, $expected_forum)
+ public function test_delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $reason, $expected_posts, $expected_topic, $expected_forum, $expected_user)
{
global $auth, $cache, $config, $db, $phpbb_container, $phpbb_dispatcher, $phpbb_root_path, $phpEx;
$config['search_type'] = 'phpbb_mock_search';
$cache = new phpbb_mock_cache;
$db = $this->new_dbal();
- set_config_count(null, null, null, new \phpbb\config\config(array('num_posts' => 3, 'num_topics' => 1)));
+ $phpbb_config = new \phpbb\config\config(array('num_posts' => 3, 'num_topics' => 1));
+ set_config_count(null, null, null, $phpbb_config);
// Create auth mock
$auth = $this->getMock('\phpbb\auth\auth');
@@ -281,13 +306,13 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
->will($this->returnValueMap(array(
array('m_approve', 1, true),
)));
- $user = $this->getMock('\phpbb\user');
+ $user = new \phpbb\user('\phpbb\datetime');
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
$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, $phpbb_config, $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);
@@ -312,5 +337,13 @@ class phpbb_content_visibility_delete_post_test extends phpbb_database_test_case
$this->assertEquals($expected_forum, $db->sql_fetchrowset($result));
$db->sql_freeresult($result);
+
+ $sql = 'SELECT user_posts
+ FROM ' . USERS_TABLE . '
+ WHERE user_id = ' . (int) $data['poster_id'];
+ $result = $db->sql_query($sql);
+
+ $this->assertEquals($expected_user, $db->sql_fetchrowset($result));
+ $db->sql_freeresult($result);
}
}
diff --git a/tests/content_visibility/get_forums_visibility_sql_test.php b/tests/content_visibility/get_forums_visibility_sql_test.php
index 9fd84d7c04..fe7ab36436 100644
--- a/tests/content_visibility/get_forums_visibility_sql_test.php
+++ b/tests/content_visibility/get_forums_visibility_sql_test.php
@@ -134,8 +134,9 @@ class phpbb_content_visibility_get_forums_visibility_sql_test extends phpbb_data
->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 = new \phpbb\user('\phpbb\datetime');
+ $config = new phpbb\config\config(array());
+ $content_visibility = new \phpbb\content_visibility($auth, $config, $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 6397cd6e45..43a80c792b 100644
--- a/tests/content_visibility/get_global_visibility_sql_test.php
+++ b/tests/content_visibility/get_global_visibility_sql_test.php
@@ -134,8 +134,9 @@ class phpbb_content_visibility_get_global_visibility_sql_test extends phpbb_data
->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 = new \phpbb\user('\phpbb\datetime');
+ $config = new phpbb\config\config(array());
+ $content_visibility = new \phpbb\content_visibility($auth, $config, $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 daad901b67..f718e6c29a 100644
--- a/tests/content_visibility/get_visibility_sql_test.php
+++ b/tests/content_visibility/get_visibility_sql_test.php
@@ -81,8 +81,9 @@ class phpbb_content_visibility_get_visibility_sql_test extends phpbb_database_te
->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 = new \phpbb\user('\phpbb\datetime');
+ $config = new phpbb\config\config(array());
+ $content_visibility = new \phpbb\content_visibility($auth, $config, $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 abfefaddfa..ab79fbc2ee 100644
--- a/tests/content_visibility/set_post_visibility_test.php
+++ b/tests/content_visibility/set_post_visibility_test.php
@@ -124,8 +124,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\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);
+ $user = new \phpbb\user('\phpbb\datetime');
+ $config = new phpbb\config\config(array());
+ $content_visibility = new \phpbb\content_visibility($auth, $config, $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);
@@ -173,8 +174,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\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);
+ $user = new \phpbb\user('\phpbb\datetime');
+ $config = new phpbb\config\config(array());
+ $content_visibility = new \phpbb\content_visibility($auth, $config, $db, $user, $phpbb_root_path, $phpEx, FORUMS_TABLE, POSTS_TABLE, TOPICS_TABLE, USERS_TABLE);
$content_visibility->set_post_visibility(ITEM_DELETED, $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 6437c61436..4d02a55490 100644
--- a/tests/content_visibility/set_topic_visibility_test.php
+++ b/tests/content_visibility/set_topic_visibility_test.php
@@ -88,8 +88,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\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);
+ $user = new \phpbb\user('\phpbb\datetime');
+ $config = new phpbb\config\config(array());
+ $content_visibility = new \phpbb\content_visibility($auth, $config, $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/controller_test.php b/tests/controller/controller_test.php
index 67faf83e29..58bcf0ef81 100644
--- a/tests/controller/controller_test.php
+++ b/tests/controller/controller_test.php
@@ -72,7 +72,7 @@ class phpbb_controller_controller_test extends phpbb_test_case
include(__DIR__.'/phpbb/controller/foo.php');
}
- $resolver = new \phpbb\controller\resolver(new \phpbb\user, $container, dirname(__FILE__) . '/');
+ $resolver = new \phpbb\controller\resolver(new \phpbb\user('\phpbb\datetime'), $container, dirname(__FILE__) . '/');
$symfony_request = new Request();
$symfony_request->attributes->set('_controller', 'foo.controller:handle');
diff --git a/tests/controller/helper_route_test.php b/tests/controller/helper_route_test.php
index 206c3a4f0b..04bff81683 100644
--- a/tests/controller/helper_route_test.php
+++ b/tests/controller/helper_route_test.php
@@ -20,7 +20,7 @@ class phpbb_controller_helper_route_test extends phpbb_test_case
global $phpbb_dispatcher, $phpbb_root_path, $phpEx;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher;
- $this->user = $this->getMock('\phpbb\user');
+ $this->user = new \phpbb\user('\phpbb\datetime');
$phpbb_path_helper = new \phpbb\path_helper(
new \phpbb\symfony_request(
new phpbb_mock_request()
diff --git a/tests/datetime/from_format_test.php b/tests/datetime/from_format_test.php
index 88eec525a3..5f155adbbd 100644
--- a/tests/datetime/from_format_test.php
+++ b/tests/datetime/from_format_test.php
@@ -39,7 +39,7 @@ class phpbb_datetime_from_format_test extends phpbb_test_case
{
global $user;
- $user = new \phpbb\user();
+ $user = new \phpbb\user('\phpbb\datetime');
$user->timezone = new DateTimeZone($timezone);
$user->lang['datetime'] = array(
'TODAY' => 'Today',
diff --git a/tests/dbal/db_tools_test.php b/tests/dbal/db_tools_test.php
index 6cc2f8ec0f..51f9daacfb 100644
--- a/tests/dbal/db_tools_test.php
+++ b/tests/dbal/db_tools_test.php
@@ -288,13 +288,13 @@ class phpbb_dbal_db_tools_test extends phpbb_database_test_case
$this->assertTrue($this->tools->sql_column_exists('prefix_table_name', 'c_bug_12012_2'));
// Create index over the column
- $this->assertFalse($this->tools->sql_index_exists('prefix_table_name', 'i_bug_12012_2'));
- $this->assertTrue($this->tools->sql_create_index('prefix_table_name', 'i_bug_12012_2', array('c_bug_12012_2', 'c_bool')));
- $this->assertTrue($this->tools->sql_index_exists('prefix_table_name', 'i_bug_12012_2'));
+ $this->assertFalse($this->tools->sql_index_exists('prefix_table_name', 'bug_12012_2'));
+ $this->assertTrue($this->tools->sql_create_index('prefix_table_name', 'bug_12012_2', array('c_bug_12012_2', 'c_bool')));
+ $this->assertTrue($this->tools->sql_index_exists('prefix_table_name', 'bug_12012_2'));
- $this->assertFalse($this->tools->sql_index_exists('prefix_table_name', 'i_bug_12012_3'));
- $this->assertTrue($this->tools->sql_create_index('prefix_table_name', 'i_bug_12012_3', array('c_bug_12012_2')));
- $this->assertTrue($this->tools->sql_index_exists('prefix_table_name', 'i_bug_12012_3'));
+ $this->assertFalse($this->tools->sql_index_exists('prefix_table_name', 'bug_12012_3'));
+ $this->assertTrue($this->tools->sql_create_index('prefix_table_name', 'bug_12012_3', array('c_bug_12012_2')));
+ $this->assertTrue($this->tools->sql_index_exists('prefix_table_name', 'bug_12012_3'));
// Remove the column
$this->assertTrue($this->tools->sql_column_exists('prefix_table_name', 'c_bug_12012_2'));
diff --git a/tests/dbal/migrator_test.php b/tests/dbal/migrator_test.php
index 4a1d15aea4..10a9444d63 100644
--- a/tests/dbal/migrator_test.php
+++ b/tests/dbal/migrator_test.php
@@ -60,7 +60,7 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case
$container = new phpbb_mock_container_builder();
$container->set('migrator', $migrator);
- $user = new \phpbb\user();
+ $user = new \phpbb\user('\phpbb\datetime');
$this->extension_manager = new \phpbb\extension\manager(
$container,
diff --git a/tests/dbal/migrator_tool_module_test.php b/tests/dbal/migrator_tool_module_test.php
index aeb69e27ac..08c3e979b8 100644
--- a/tests/dbal/migrator_tool_module_test.php
+++ b/tests/dbal/migrator_tool_module_test.php
@@ -32,7 +32,7 @@ class phpbb_dbal_migrator_tool_module_test extends phpbb_database_test_case
$db = $this->db = $this->new_dbal();
$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();
+ $user = $this->user = new \phpbb\user('\phpbb\user');
$cache = new phpbb_mock_cache;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
diff --git a/tests/dbal/select_test.php b/tests/dbal/select_test.php
index e480716a49..b7074552ba 100644
--- a/tests/dbal/select_test.php
+++ b/tests/dbal/select_test.php
@@ -233,6 +233,66 @@ class phpbb_dbal_select_test extends phpbb_database_test_case
$db->sql_freeresult($result);
}
+ public function not_like_expression_data()
+ {
+ // * = any_char; # = one_char
+ return array(
+ array('barfoo', array(
+ array('username_clean' => 'foobar'),
+ array('username_clean' => 'bertie')
+ )),
+ array('bar', array(
+ array('username_clean' => 'barfoo'),
+ array('username_clean' => 'foobar'),
+ array('username_clean' => 'bertie'),
+ )),
+ array('bar*', array(
+ array('username_clean' => 'foobar'),
+ array('username_clean' => 'bertie'))
+ ),
+ array('*bar*', array(array('username_clean' => 'bertie'))),
+ array('b*r', array(
+ array('username_clean' => 'barfoo'),
+ array('username_clean' => 'foobar'),
+ array('username_clean' => 'bertie')
+ )),
+ array('b*e', array(
+ array('username_clean' => 'barfoo'),
+ array('username_clean' => 'foobar')
+ )),
+ array('#b*e', array(
+ array('username_clean' => 'barfoo'),
+ array('username_clean' => 'foobar'),
+ array('username_clean' => 'bertie')
+ )),
+ array('b####e', array(
+ array('username_clean' => 'barfoo'),
+ array('username_clean' => 'foobar')
+ )),
+ );
+ }
+
+ /**
+ * @dataProvider not_like_expression_data
+ */
+ public function test_not_like_expression($like_expression, $expected)
+ {
+ $db = $this->new_dbal();
+
+ $like_expression = str_replace('*', $db->get_any_char(), $like_expression);
+ $like_expression = str_replace('#', $db->get_one_char(), $like_expression);
+ $where = ($like_expression) ? 'username_clean ' . $db->sql_not_like_expression($like_expression) : '';
+
+ $result = $db->sql_query('SELECT username_clean
+ FROM phpbb_users
+ ' . (($where) ? ' WHERE ' . $where : '') . '
+ ORDER BY user_id ASC');
+
+ $this->assertEquals($expected, $db->sql_fetchrowset($result));
+
+ $db->sql_freeresult($result);
+ }
+
public function in_set_data()
{
return array(
diff --git a/tests/di/create_container_test.php b/tests/di/create_container_test.php
index 559c0b122c..4ae6017989 100644
--- a/tests/di/create_container_test.php
+++ b/tests/di/create_container_test.php
@@ -191,6 +191,10 @@ namespace phpbb\db\driver
{
}
+ function sql_not_like_expression($expression)
+ {
+ }
+
function sql_fetchrowset($query_id = false)
{
return array(
diff --git a/tests/extension/ext/vendor3/foo/composer.json b/tests/extension/ext/vendor3/foo/composer.json
new file mode 100644
index 0000000000..b4b3e6f32f
--- /dev/null
+++ b/tests/extension/ext/vendor3/foo/composer.json
@@ -0,0 +1,23 @@
+{
+ "name": "vendor3/foo",
+ "type": "phpbb-extension",
+ "description": "An example/sample extension to be used for testing purposes in phpBB Development.",
+ "version": "1.0.0",
+ "time": "2012-02-15 01:01:01",
+ "license": "GPL-2.0",
+ "authors": [{
+ "name": "John Smith",
+ "email": "email@phpbb.com",
+ "homepage": "http://phpbb.com",
+ "role": "N/A"
+ }],
+ "require": {
+ "php": ">=5.3"
+ },
+ "extra": {
+ "display-name": "phpBB Bar Extension",
+ "soft-require": {
+ "phpbb/phpbb": "3.1.*@dev"
+ }
+ }
+}
diff --git a/tests/extension/ext/vendor3/foo/ext.php b/tests/extension/ext/vendor3/foo/ext.php
new file mode 100644
index 0000000000..b52649d921
--- /dev/null
+++ b/tests/extension/ext/vendor3/foo/ext.php
@@ -0,0 +1,20 @@
+<?php
+
+namespace vendor3\foo;
+
+class ext extends \phpbb\extension\base
+{
+ static public $enabled;
+
+ public function enable_step($old_state)
+ {
+ self::$enabled = true;
+
+ return self::$enabled;
+ }
+
+ public function is_enableable()
+ {
+ return false;
+ }
+}
diff --git a/tests/extension/manager_test.php b/tests/extension/manager_test.php
index 067fd62581..5ec8e60a68 100644
--- a/tests/extension/manager_test.php
+++ b/tests/extension/manager_test.php
@@ -13,6 +13,7 @@
require_once dirname(__FILE__) . '/ext/vendor2/bar/ext.php';
require_once dirname(__FILE__) . '/ext/vendor2/foo/ext.php';
+require_once dirname(__FILE__) . '/ext/vendor3/foo/ext.php';
require_once dirname(__FILE__) . '/ext/vendor/moo/ext.php';
class phpbb_extension_manager_test extends phpbb_database_test_case
@@ -35,7 +36,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
public function test_all_available()
{
// barfoo and vendor3/bar should not listed due to missing composer.json. barfoo also has incorrect dir structure.
- $this->assertEquals(array('vendor/moo', 'vendor2/bar', 'vendor2/foo'), array_keys($this->extension_manager->all_available()));
+ $this->assertEquals(array('vendor/moo', 'vendor2/bar', 'vendor2/foo', 'vendor3/foo'), array_keys($this->extension_manager->all_available()));
}
public function test_all_enabled()
@@ -100,6 +101,18 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
$this->assertEquals(4, vendor2\bar\ext::$state);
}
+ public function test_enable_not_enableable()
+ {
+ vendor3\foo\ext::$enabled = false;
+
+ $this->assertEquals(array('vendor2/foo'), array_keys($this->extension_manager->all_enabled()));
+ $this->extension_manager->enable('vendor3/foo');
+ $this->assertEquals(array('vendor2/foo'), array_keys($this->extension_manager->all_enabled()));
+ $this->assertEquals(array('vendor/moo', 'vendor2/foo'), array_keys($this->extension_manager->all_configured()));
+
+ $this->assertSame(false, vendor3\foo\ext::$enabled);
+ }
+
public function test_disable()
{
vendor2\foo\ext::$disabled = false;
@@ -141,7 +154,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case
$phpbb_root_path = __DIR__ . './../../phpBB/';
$php_ext = 'php';
$table_prefix = 'phpbb_';
- $user = new \phpbb\user();
+ $user = new \phpbb\user('\phpbb\user');
$migrator = new \phpbb\db\migrator(
$config,
diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php
index 535e4fe0d5..8e27b39459 100644
--- a/tests/extension/metadata_manager_test.php
+++ b/tests/extension/metadata_manager_test.php
@@ -44,7 +44,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case
$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('\phpbb\datetime');
$this->table_prefix = 'phpbb_';
$this->template = new \phpbb\template\twig\twig(
diff --git a/tests/functional/avatar_acp_groups_test.php b/tests/functional/avatar_acp_groups_test.php
index 35f7956252..925335a2f7 100644
--- a/tests/functional/avatar_acp_groups_test.php
+++ b/tests/functional/avatar_acp_groups_test.php
@@ -48,7 +48,7 @@ class phpbb_functional_avatar_acp_groups_test extends phpbb_functional_common_av
),
// Delete avatar image to reset group settings
array(
- 'GROUP_UPDATED',
+ array('CONFIRM_AVATAR_DELETE', 'GROUP_UPDATED'),
'avatar_driver_gravatar',
array(
'avatar_delete' => array('tick', ''),
diff --git a/tests/functional/avatar_acp_users_test.php b/tests/functional/avatar_acp_users_test.php
index 38e001f516..5eca473157 100644
--- a/tests/functional/avatar_acp_users_test.php
+++ b/tests/functional/avatar_acp_users_test.php
@@ -46,7 +46,7 @@ class phpbb_functional_avatar_acp_users_test extends phpbb_functional_common_ava
),
// Reset avatar settings
array(
- 'USER_AVATAR_UPDATED',
+ array('CONFIRM_AVATAR_DELETE', 'USER_AVATAR_UPDATED'),
'avatar_driver_gravatar',
array(
'avatar_delete' => array('tick', ''),
diff --git a/tests/functional/avatar_ucp_groups_test.php b/tests/functional/avatar_ucp_groups_test.php
index fddf66933f..1e8ca911c6 100644
--- a/tests/functional/avatar_ucp_groups_test.php
+++ b/tests/functional/avatar_ucp_groups_test.php
@@ -55,7 +55,7 @@ class phpbb_functional_avatar_ucp_groups_test extends phpbb_functional_common_av
),
),
array(
- 'GROUP_UPDATED',
+ array('CONFIRM_AVATAR_DELETE', 'GROUP_UPDATED'),
'avatar_driver_gravatar',
array(
'avatar_delete' => array('tick', ''),
diff --git a/tests/functional/avatar_ucp_users_test.php b/tests/functional/avatar_ucp_users_test.php
index 62cd79c307..972bfa0fb2 100644
--- a/tests/functional/avatar_ucp_users_test.php
+++ b/tests/functional/avatar_ucp_users_test.php
@@ -36,18 +36,9 @@ class phpbb_functional_avatar_ucp_users_test extends phpbb_functional_common_ava
'avatar_gravatar_height' => 80,
),
),
- // Wrong driver selected
- array(
- 'NO_AVATAR_SELECTED',
- 'avatar_driver_upload',
- array(
- 'avatar_remote_url' => 'https://secure.gravatar.com/avatar/55502f40dc8b7c769880b10874abc9d0.jpg',
- 'avatar_remote_width' => 80,
- 'avatar_remote_height' => 80,
- ),
- ),
+
array(
- 'PROFILE_UPDATED',
+ array('CONFIRM_AVATAR_DELETE', 'PROFILE_UPDATED'),
'avatar_driver_gravatar',
array(
'avatar_delete' => array('tick', ''),
diff --git a/tests/functional/common_avatar_test.php b/tests/functional/common_avatar_test.php
index 1bb9e5cd8e..82d7136c98 100644
--- a/tests/functional/common_avatar_test.php
+++ b/tests/functional/common_avatar_test.php
@@ -50,7 +50,7 @@ abstract class phpbb_functional_common_avatar_test extends phpbb_functional_test
$this->assertContainsLang('CONFIG_UPDATED', $crawler->text());
}
- public function assert_avatar_submit($expected, $type, $data, $button_text = 'SUBMIT')
+ public function assert_avatar_submit($expected, $type, $data, $delete = false, $button_text = 'SUBMIT')
{
$crawler = self::request('GET', $this->get_url() . '&sid=' . $this->sid);
@@ -72,6 +72,12 @@ abstract class phpbb_functional_common_avatar_test extends phpbb_functional_test
$crawler = self::submit($form);
+ if (is_array($expected))
+ {
+ $delete_expected = $expected[1];
+ $expected = $expected[0];
+ }
+
try
{
$this->assertContainsLang($expected, $crawler->text());
@@ -80,5 +86,12 @@ abstract class phpbb_functional_common_avatar_test extends phpbb_functional_test
{
$this->assertContains($expected, $crawler->text());
}
+
+ if ($delete)
+ {
+ $form = $crawler->selectButton('confirm')->form();
+ $crawler = self::submit($form);
+ $this->assertContainsLang($delete_expected, $crawler->text());
+ }
}
}
diff --git a/tests/functional/download_test.php b/tests/functional/download_test.php
index 6a6df14c81..4e4995c21e 100644
--- a/tests/functional/download_test.php
+++ b/tests/functional/download_test.php
@@ -80,20 +80,6 @@ class phpbb_functional_download_test extends phpbb_functional_test_case
'attachments' => true,
));
- // Download topic archive as guest
- $crawler = self::request('GET', "download/file.php?archive=.zip&topic_id={$this->data['topics']['Download Topic #1']}", array(), false);
- self::assert_response_status_code(200);
- $content = self::$client->getResponse()->getContent();
- $finfo = new finfo(FILEINFO_MIME_TYPE);
- self::assertEquals('application/zip', $finfo->buffer($content));
-
- // Download post archive as guest
- $crawler = self::request('GET', "download/file.php?archive=.zip&post_id={$this->data['posts']['Re: Download Topic #1-#2']}", array(), false);
- self::assert_response_status_code(200);
- $content = self::$client->getResponse()->getContent();
- $finfo = new finfo(FILEINFO_MIME_TYPE);
- self::assertEquals('application/zip', $finfo->buffer($content));
-
// Download attachment as guest
$crawler = self::request('GET', "download/file.php?id={$this->data['attachments'][$this->data['posts']['Re: Download Topic #1-#2']]}", array(), false);
self::assert_response_status_code(200);
@@ -147,18 +133,6 @@ class phpbb_functional_download_test extends phpbb_functional_test_case
));
$this->add_lang('viewtopic');
- // Download topic archive as guest: still works
- $crawler = self::request('GET', "download/file.php?archive=.zip&topic_id={$this->data['topics']['Download Topic #1']}", array(), false);
- self::assert_response_status_code(200);
- $content = self::$client->getResponse()->getContent();
- $finfo = new finfo(FILEINFO_MIME_TYPE);
- self::assertEquals('application/zip', $finfo->buffer($content));
-
- // No download post archive as guest
- $crawler = self::request('GET', "download/file.php?archive=.zip&post_id={$this->data['posts']['Re: Download Topic #1-#2']}", array(), false);
- self::assert_response_html(404);
- $this->assertContainsLang('ERROR_NO_ATTACHMENT', $crawler->filter('#message')->text());
-
// No download attachment as guest
$crawler = self::request('GET', "download/file.php?id={$this->data['attachments'][$this->data['posts']['Re: Download Topic #1-#2']]}", array(), false);
self::assert_response_html(404);
@@ -167,20 +141,6 @@ class phpbb_functional_download_test extends phpbb_functional_test_case
// Login as admin and try again, should work now.
$this->login();
- // Download topic archive as admin
- $crawler = self::request('GET', "download/file.php?archive=.zip&topic_id={$this->data['topics']['Download Topic #1']}", array(), false);
- self::assert_response_status_code(200);
- $content = self::$client->getResponse()->getContent();
- $finfo = new finfo(FILEINFO_MIME_TYPE);
- self::assertEquals('application/zip', $finfo->buffer($content));
-
- // Download post archive as admin
- $crawler = self::request('GET', "download/file.php?archive=.zip&post_id={$this->data['posts']['Re: Download Topic #1-#2']}", array(), false);
- self::assert_response_status_code(200);
- $content = self::$client->getResponse()->getContent();
- $finfo = new finfo(FILEINFO_MIME_TYPE);
- self::assertEquals('application/zip', $finfo->buffer($content));
-
// Download attachment as admin
$crawler = self::request('GET', "download/file.php?id={$this->data['attachments'][$this->data['posts']['Re: Download Topic #1-#2']]}", array(), false);
self::assert_response_status_code(200);
@@ -235,16 +195,6 @@ class phpbb_functional_download_test extends phpbb_functional_test_case
));
$this->add_lang('viewtopic');
- // Download topic archive as guest: still works
- $crawler = self::request('GET', "download/file.php?archive=.zip&topic_id={$this->data['topics']['Download Topic #1']}", array(), false);
- self::assert_response_html(404);
- $this->assertContainsLang('ERROR_NO_ATTACHMENT', $crawler->filter('#message')->text());
-
- // No download post archive as guest
- $crawler = self::request('GET', "download/file.php?archive=.zip&post_id={$this->data['posts']['Re: Download Topic #1-#2']}", array(), false);
- self::assert_response_html(404);
- $this->assertContainsLang('ERROR_NO_ATTACHMENT', $crawler->filter('#message')->text());
-
// No download attachment as guest
$crawler = self::request('GET', "download/file.php?id={$this->data['attachments'][$this->data['posts']['Re: Download Topic #1-#2']]}", array(), false);
self::assert_response_html(404);
@@ -253,20 +203,6 @@ class phpbb_functional_download_test extends phpbb_functional_test_case
// Login as admin and try again, should work now.
$this->login();
- // Download topic archive as admin
- $crawler = self::request('GET', "download/file.php?archive=.zip&topic_id={$this->data['topics']['Download Topic #1']}", array(), false);
- self::assert_response_status_code(200);
- $content = self::$client->getResponse()->getContent();
- $finfo = new finfo(FILEINFO_MIME_TYPE);
- self::assertEquals('application/zip', $finfo->buffer($content));
-
- // Download post archive as admin
- $crawler = self::request('GET', "download/file.php?archive=.zip&post_id={$this->data['posts']['Re: Download Topic #1-#2']}", array(), false);
- self::assert_response_status_code(200);
- $content = self::$client->getResponse()->getContent();
- $finfo = new finfo(FILEINFO_MIME_TYPE);
- self::assertEquals('application/zip', $finfo->buffer($content));
-
// Download attachment as admin
$crawler = self::request('GET', "download/file.php?id={$this->data['attachments'][$this->data['posts']['Re: Download Topic #1-#2']]}", array(), false);
self::assert_response_status_code(200);
diff --git a/tests/functional/extension_acp_test.php b/tests/functional/extension_acp_test.php
index b6dd5db708..6490c1ead3 100644
--- a/tests/functional/extension_acp_test.php
+++ b/tests/functional/extension_acp_test.php
@@ -84,7 +84,7 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&sid=' . $this->sid);
$this->assertCount(1, $crawler->filter('.ext_enabled'));
- $this->assertCount(4, $crawler->filter('.ext_disabled'));
+ $this->assertCount(5, $crawler->filter('.ext_disabled'));
$this->assertContains('phpBB Foo Extension', $crawler->filter('.ext_enabled')->eq(0)->text());
$this->assertContainsLang('EXTENSION_DISABLE', $crawler->filter('.ext_enabled')->eq(0)->text());
@@ -162,6 +162,10 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case
$crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=vendor%2Fmoo&sid=' . $this->sid);
$this->assertContains($this->lang('EXTENSION_ENABLE_CONFIRM', 'phpBB Moo Extension'), $crawler->filter('#main')->text());
+
+ // Correctly submit the enable form
+ $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=enable_pre&ext_name=vendor3%2Ffoo&sid=' . $this->sid);
+ $this->assertContainsLang('EXTENSION_NOT_ENABLEABLE', $crawler->filter('.errorbox')->text());
}
public function test_disable_pre()
diff --git a/tests/functional/fileupload_form_test.php b/tests/functional/fileupload_form_test.php
index b9d55fbd3c..e87953367f 100644
--- a/tests/functional/fileupload_form_test.php
+++ b/tests/functional/fileupload_form_test.php
@@ -42,8 +42,6 @@ class phpbb_functional_fileupload_form_test extends phpbb_functional_test_case
unlink($fileinfo->getPathname());
}
-
- parent::tearDown();
}
private function upload_file($filename, $mimetype)
@@ -109,9 +107,9 @@ class phpbb_functional_fileupload_form_test extends phpbb_functional_test_case
$crawler = $this->upload_file('disallowed.jpg', 'image/jpeg');
- // Hitting the UNABLE_GET_IMAGE_SIZE error means we passed the
+ // Hitting the ATTACHED_IMAGE_NOT_IMAGE error means we passed the
// DISALLOWED_CONTENT check
- $this->assertEquals($this->lang('UNABLE_GET_IMAGE_SIZE'), $crawler->filter('p.error')->text());
+ $this->assertContains($this->lang('ATTACHED_IMAGE_NOT_IMAGE'), $crawler->text());
}
public function test_too_large()
diff --git a/tests/functional/fileupload_remote_test.php b/tests/functional/fileupload_remote_test.php
index b170fc051f..6ece150b23 100644
--- a/tests/functional/fileupload_remote_test.php
+++ b/tests/functional/fileupload_remote_test.php
@@ -11,6 +11,8 @@
*
*/
+require_once __DIR__ . '/../../phpBB/includes/functions_upload.php';
+
/**
* @group functional
*/
@@ -43,8 +45,6 @@ class phpbb_functional_fileupload_remote_test extends phpbb_functional_test_case
global $config, $user;
$user = null;
$config = array();
-
- parent::tearDown();
}
public function test_invalid_extension()
diff --git a/tests/functional/forgot_password_test.php b/tests/functional/forgot_password_test.php
index c95efc5b2e..64fa19557f 100644
--- a/tests/functional/forgot_password_test.php
+++ b/tests/functional/forgot_password_test.php
@@ -57,7 +57,5 @@ class phpbb_functional_forgot_password_test extends phpbb_functional_test_case
'config[allow_password_reset]' => 1,
));
$crawler = self::submit($form);
-
- parent::tearDown();
}
}
diff --git a/tests/functional/notification_test.php b/tests/functional/notification_test.php
index e4a960f862..667d268b1e 100644
--- a/tests/functional/notification_test.php
+++ b/tests/functional/notification_test.php
@@ -21,20 +21,20 @@ class phpbb_functional_notification_test extends phpbb_functional_test_case
return array(
// Rows inserted by phpBB/install/schemas/schema_data.sql
// Also see PHPBB3-11460
- array('post_notification', true),
- array('topic_notification', true),
- array('post_email', true),
- array('topic_email', true),
+ array('notification.type.post_notification', true),
+ array('notification.type.topic_notification', true),
+ array('notification.type.post_notification.method.email', true),
+ array('notification.type.topic_notification.method.email', true),
// Default behaviour for in-board notifications:
// If user did not opt-out, in-board notifications are on.
- array('bookmark_notification', true),
- array('quote_notification', true),
+ array('notification.type.bookmark_notification', true),
+ array('notification.type.quote_notification', true),
// Default behaviour for email notifications:
// If user did not opt-in, email notifications are off.
- array('bookmark_email', false),
- array('quote_email', false),
+ array('notification.type.bookmark_notification.method.email', false),
+ array('notification.type.quote_notification.method.email', false),
);
}
diff --git a/tests/functional/plupload_test.php b/tests/functional/plupload_test.php
index d9faec035c..ee71597ffc 100644
--- a/tests/functional/plupload_test.php
+++ b/tests/functional/plupload_test.php
@@ -57,8 +57,6 @@ class phpbb_functional_plupload_test extends phpbb_functional_test_case
unlink($fileinfo->getPathname());
}
-
- parent::tearDown();
}
public function get_urls()
diff --git a/tests/functional/private_messages_test.php b/tests/functional/private_messages_test.php
new file mode 100644
index 0000000000..1f6dc3a979
--- /dev/null
+++ b/tests/functional/private_messages_test.php
@@ -0,0 +1,69 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+/**
+* @group functional
+*/
+class phpbb_functional_private_messages_test extends phpbb_functional_test_case
+{
+ public function test_setup_config()
+ {
+ $this->login();
+ $this->admin_login();
+
+ $crawler = self::request('GET', "adm/index.php?sid={$this->sid}&i=board&mode=message");
+
+ $form = $crawler->selectButton('Submit')->form();
+ $values = $form->getValues();
+
+ // Set the maximum number of private messages per folder to 1
+ $values['config[pm_max_msgs]'] = 1;
+
+ $form->setValues($values);
+
+ $crawler = self::submit($form);
+ $this->assertContains($this->lang('CONFIG_UPDATED'), $crawler->filter('.successbox')->text());
+ }
+
+ public function test_inbox_full()
+ {
+ $this->login();
+ $message_id = $this->create_private_message('Test private message #1', 'This is a test private message sent by the testing framework.', array(2));
+
+ $crawler = self::request('GET', "ucp.php?i=pm&mode=view&sid{$this->sid}&p={$message_id}");
+ $this->assertContains($this->lang('UCP_PM_VIEW'), $crawler->filter('html')->text());
+
+ $message_id = $this->create_private_message('Test private message #2', 'This is a test private message sent by the testing framework.', array(2));
+
+ $crawler = self::request('GET', "ucp.php?i=pm&mode=view&sid{$this->sid}&p={$message_id}");
+ $this->assertContains($this->lang('NO_AUTH_READ_HOLD_MESSAGE'), $crawler->filter('html')->text());
+ }
+
+ public function test_restore_config()
+ {
+ $this->login();
+ $this->admin_login();
+
+ $crawler = self::request('GET', "adm/index.php?sid={$this->sid}&i=board&mode=message");
+
+ $form = $crawler->selectButton('Submit')->form();
+ $values = $form->getValues();
+
+ $values['config[pm_max_msgs]'] = 50;
+
+ $form->setValues($values);
+
+ $crawler = self::submit($form);
+ $this->assertContains($this->lang('CONFIG_UPDATED'), $crawler->filter('.successbox')->text());
+ }
+}
diff --git a/tests/functions/generate_string_list.php b/tests/functions/generate_string_list.php
index 32a04c1501..cd1e37618a 100644
--- a/tests/functions/generate_string_list.php
+++ b/tests/functions/generate_string_list.php
@@ -22,7 +22,7 @@ class phpbb_generate_string_list_test extends phpbb_test_case
{
parent::setUp();
- $this->user = new \phpbb\user();
+ $this->user = new \phpbb\user('\phpbb\datetime');
$this->user->data = array('user_lang' => 'en');
$this->user->add_lang('common');
}
diff --git a/tests/functions/insert_config_array_test.php b/tests/functions/insert_config_array_test.php
new file mode 100644
index 0000000000..bfcb05862e
--- /dev/null
+++ b/tests/functions/insert_config_array_test.php
@@ -0,0 +1,142 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+class phpbb_functions_insert_config_array_test extends phpbb_test_case
+{
+ public function config_display_vars()
+ {
+ return array(
+ 'legend1' => '',
+ 'acp_config_1' => array(),
+ 'acp_config_2' => array(),
+ 'acp_config_3' => array(),
+ 'acp_config_4' => array(),
+ 'acp_config_5' => array(),
+ );
+ }
+
+ public function insert_config_array_data()
+ {
+ return array(
+ array( // Add a new config after 1st array item
+ array('new_config_1' => array()),
+ array('after' => 'legend1'),
+ array(
+ 'legend1' => '',
+ 'new_config_1' => array(),
+ 'acp_config_1' => array(),
+ 'acp_config_2' => array(),
+ 'acp_config_3' => array(),
+ 'acp_config_4' => array(),
+ 'acp_config_5' => array(),
+ ),
+ ),
+ array( // Add a new config after last array item
+ array('new_config_1' => array()),
+ array('after' => 'acp_config_5'),
+ array(
+ 'legend1' => '',
+ 'acp_config_1' => array(),
+ 'acp_config_2' => array(),
+ 'acp_config_3' => array(),
+ 'acp_config_4' => array(),
+ 'acp_config_5' => array(),
+ 'new_config_1' => array(),
+ ),
+ ),
+ array( // Add a new config before 2nd array item
+ array('new_config_1' => array()),
+ array('before' => 'acp_config_1'),
+ array(
+ 'legend1' => '',
+ 'new_config_1' => array(),
+ 'acp_config_1' => array(),
+ 'acp_config_2' => array(),
+ 'acp_config_3' => array(),
+ 'acp_config_4' => array(),
+ 'acp_config_5' => array(),
+ ),
+ ),
+ array( // Add a new config before last config item
+ array('new_config_1' => array()),
+ array('before' => 'acp_config_5'),
+ array(
+ 'legend1' => '',
+ 'acp_config_1' => array(),
+ 'acp_config_2' => array(),
+ 'acp_config_3' => array(),
+ 'acp_config_4' => array(),
+ 'new_config_1' => array(),
+ 'acp_config_5' => array(),
+ ),
+ ),
+ array( // When an array key does not exist
+ array('new_config_1' => array()),
+ array('after' => 'foobar'),
+ array(
+ 'legend1' => '',
+ 'acp_config_1' => array(),
+ 'acp_config_2' => array(),
+ 'acp_config_3' => array(),
+ 'acp_config_4' => array(),
+ 'acp_config_5' => array(),
+ ),
+ ),
+ array( // When after|before is not used correctly (defaults to after)
+ array('new_config_1' => array()),
+ array('foobar' => 'acp_config_1'),
+ array(
+ 'legend1' => '',
+ 'acp_config_1' => array(),
+ 'new_config_1' => array(),
+ 'acp_config_2' => array(),
+ 'acp_config_3' => array(),
+ 'acp_config_4' => array(),
+ 'acp_config_5' => array(),
+ ),
+ ),
+ array( // Add a new config set after the last array item
+ array(
+ 'legend2' => array(),
+ 'new_config_1' => array(),
+ 'new_config_2' => array(),
+ 'new_config_3' => array(),
+ ),
+ array('after' => 'acp_config_5'),
+ array(
+ 'legend1' => '',
+ 'acp_config_1' => array(),
+ 'acp_config_2' => array(),
+ 'acp_config_3' => array(),
+ 'acp_config_4' => array(),
+ 'acp_config_5' => array(),
+ 'legend2' => array(),
+ 'new_config_1' => array(),
+ 'new_config_2' => array(),
+ 'new_config_3' => array(),
+ ),
+ ),
+ );
+ }
+
+ /**
+ * @dataProvider insert_config_array_data
+ */
+ public function test_insert_config_array($new_config, $position, $expected)
+ {
+ $config_array = $this->config_display_vars();
+ $new_config_array = phpbb_insert_config_array($config_array, $new_config, $position);
+
+ $this->assertSame($expected, $new_config_array);
+ }
+}
diff --git a/tests/groupposition/legend_test.php b/tests/groupposition/legend_test.php
index 4bad598a31..fe003e93a7 100644
--- a/tests/groupposition/legend_test.php
+++ b/tests/groupposition/legend_test.php
@@ -37,7 +37,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('\phpbb\datetime');
$user->lang = array();
if ($throws_exception)
@@ -55,7 +55,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('\phpbb\datetime');
$user->lang = array();
$test_class = new \phpbb\groupposition\legend($db, $user);
@@ -95,7 +95,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('\phpbb\datetime');
$user->lang = array();
$test_class = new \phpbb\groupposition\legend($db, $user);
@@ -183,7 +183,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('\phpbb\datetime');
$user->lang = array();
$test_class = new \phpbb\groupposition\legend($db, $user);
@@ -238,7 +238,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('\phpbb\datetime');
$user->lang = array();
$test_class = new \phpbb\groupposition\legend($db, $user);
@@ -293,7 +293,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('\phpbb\datetime');
$user->lang = array();
$test_class = new \phpbb\groupposition\legend($db, $user);
@@ -391,7 +391,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('\phpbb\datetime');
$user->lang = array();
$test_class = new \phpbb\groupposition\legend($db, $user);
diff --git a/tests/groupposition/teampage_test.php b/tests/groupposition/teampage_test.php
index dbdeb35e9f..1e61e3ebfb 100644
--- a/tests/groupposition/teampage_test.php
+++ b/tests/groupposition/teampage_test.php
@@ -39,7 +39,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('\phpbb\datetime');
$user->lang = array();
if ($throws_exception)
@@ -57,7 +57,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('\phpbb\datetime');
$user->lang = array();
$test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
@@ -141,7 +141,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('\phpbb\datetime');
$user->lang = array();
$test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
@@ -184,7 +184,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('\phpbb\datetime');
$user->lang = array();
$test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
@@ -251,7 +251,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('\phpbb\datetime');
$user->lang = array();
$test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
@@ -303,7 +303,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('\phpbb\datetime');
$user->lang = array();
$test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
@@ -466,7 +466,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('\phpbb\datetime');
$user->lang = array();
$test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
@@ -629,7 +629,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('\phpbb\datetime');
$user->lang = array();
$test_class = new \phpbb\groupposition\teampage($db, $user, $cache);
diff --git a/tests/lock/flock_test.php b/tests/lock/flock_test.php
index 0ff38b6cc8..554b7e57f4 100644
--- a/tests/lock/flock_test.php
+++ b/tests/lock/flock_test.php
@@ -83,9 +83,9 @@ class phpbb_lock_flock_test extends phpbb_test_case
sleep(1);
$lock = new \phpbb\lock\flock($path);
- $start = time();
+ $start = microtime(true);
$ok = $lock->acquire();
- $delta = time() - $start;
+ $delta = microtime(true) - $start;
$this->assertTrue($ok);
$this->assertTrue($lock->owns_lock());
$this->assertGreaterThan(0.5, $delta, 'First lock acquired too soon');
@@ -94,9 +94,9 @@ class phpbb_lock_flock_test extends phpbb_test_case
$this->assertFalse($lock->owns_lock());
// acquire again, this should be instantaneous
- $start = time();
+ $start = microtime(true);
$ok = $lock->acquire();
- $delta = time() - $start;
+ $delta = microtime(true) - $start;
$this->assertTrue($ok);
$this->assertTrue($lock->owns_lock());
$this->assertLessThan(0.1, $delta, 'Second lock not acquired instantaneously');
diff --git a/tests/log/add_test.php b/tests/log/add_test.php
index d7e3760f0f..bacc0c76f7 100644
--- a/tests/log/add_test.php
+++ b/tests/log/add_test.php
@@ -27,7 +27,7 @@ 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');
+ $user = new \phpbb\user('\phpbb\datetime');
$auth = $this->getMock('\phpbb\auth\auth');
$log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
@@ -56,7 +56,7 @@ 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');
+ $user = new \phpbb\user('\phpbb\datetime');
$auth = $this->getMock('\phpbb\auth\auth');
$log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
diff --git a/tests/log/delete_test.php b/tests/log/delete_test.php
index b8be15efa5..ec43182a0c 100644
--- a/tests/log/delete_test.php
+++ b/tests/log/delete_test.php
@@ -30,7 +30,7 @@ class phpbb_log_delete_test extends phpbb_database_test_case
$db = $this->new_dbal();
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
- $user = $this->getMock('\phpbb\user');
+ $user = new \phpbb\user('\phpbb\datetime');
$user->data['user_id'] = 1;
$auth = $this->getMock('\phpbb\auth\auth');
diff --git a/tests/log/function_add_log_test.php b/tests/log/function_add_log_test.php
index 99d412537c..63e468498e 100644
--- a/tests/log/function_add_log_test.php
+++ b/tests/log/function_add_log_test.php
@@ -161,7 +161,7 @@ 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');
+ $user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
$auth = $this->getMock('\phpbb\auth\auth');
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
diff --git a/tests/notification/base.php b/tests/notification/base.php
index a66e5986fd..c97b7c24e2 100644
--- a/tests/notification/base.php
+++ b/tests/notification/base.php
@@ -21,21 +21,21 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
{
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',
+ 'notification.type.approve_post',
+ 'notification.type.approve_topic',
+ 'notification.type.bookmark',
+ 'notification.type.disapprove_post',
+ 'notification.type.disapprove_topic',
+ 'notification.type.pm',
+ 'notification.type.post',
+ 'notification.type.post_in_queue',
+ 'notification.type.quote',
+ 'notification.type.report_pm',
+ 'notification.type.report_pm_closed',
+ 'notification.type.report_post',
+ 'notification.type.report_post_closed',
+ 'notification.type.topic',
+ 'notification.type.topic_in_queue',
);
}
@@ -56,7 +56,7 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
'allow_topic_notify' => true,
'allow_forum_notify' => true,
));
- $user = $this->user = new \phpbb\user();
+ $user = $this->user = new \phpbb\user('\phpbb\datetime');
$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(
@@ -92,10 +92,11 @@ abstract class phpbb_tests_notification_base extends phpbb_database_test_case
$types = array();
foreach ($this->get_notification_types() as $type)
{
- $class = $this->build_type('phpbb\notification\type\\' . $type);
+ $type_parts = explode('.', $type);
+ $class = $this->build_type('phpbb\notification\type\\' . array_pop($type_parts));
$types[$type] = $class;
- $this->container->set('notification.type.' . $type, $class);
+ $this->container->set($type, $class);
}
$this->notifications->set_var('notification_types', $types);
diff --git a/tests/notification/fixtures/submit_post_bookmark.xml b/tests/notification/fixtures/submit_post_notification.type.bookmark.xml
index 525d0484e0..a1413e2cf8 100644
--- a/tests/notification/fixtures/submit_post_bookmark.xml
+++ b/tests/notification/fixtures/submit_post_notification.type.bookmark.xml
@@ -50,7 +50,7 @@
<column>notification_type_enabled</column>
<row>
<value>1</value>
- <value>bookmark</value>
+ <value>notification.type.bookmark</value>
<value>1</value>
</row>
</table>
@@ -123,35 +123,35 @@
<column>method</column>
<column>notify</column>
<row>
- <value>bookmark</value>
+ <value>notification.type.bookmark</value>
<value>0</value>
<value>2</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>bookmark</value>
+ <value>notification.type.bookmark</value>
<value>0</value>
<value>3</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>bookmark</value>
+ <value>notification.type.bookmark</value>
<value>0</value>
<value>4</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>bookmark</value>
+ <value>notification.type.bookmark</value>
<value>0</value>
<value>5</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>bookmark</value>
+ <value>notification.type.bookmark</value>
<value>0</value>
<value>6</value>
<value></value>
diff --git a/tests/notification/fixtures/submit_post_post.xml b/tests/notification/fixtures/submit_post_notification.type.post.xml
index a38ca77ea0..ed75787c70 100644
--- a/tests/notification/fixtures/submit_post_post.xml
+++ b/tests/notification/fixtures/submit_post_notification.type.post.xml
@@ -50,7 +50,7 @@
<column>notification_type_enabled</column>
<row>
<value>1</value>
- <value>post</value>
+ <value>notification.type.post</value>
<value>1</value>
</row>
</table>
@@ -153,49 +153,49 @@
<column>method</column>
<column>notify</column>
<row>
- <value>post</value>
+ <value>notification.type.post</value>
<value>0</value>
<value>2</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>post</value>
+ <value>notification.type.post</value>
<value>0</value>
<value>3</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>post</value>
+ <value>notification.type.post</value>
<value>0</value>
<value>4</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>post</value>
+ <value>notification.type.post</value>
<value>0</value>
<value>5</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>post</value>
+ <value>notification.type.post</value>
<value>0</value>
<value>6</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>post</value>
+ <value>notification.type.post</value>
<value>0</value>
<value>7</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>post</value>
+ <value>notification.type.post</value>
<value>0</value>
<value>8</value>
<value></value>
diff --git a/tests/notification/fixtures/submit_post_post_in_queue.xml b/tests/notification/fixtures/submit_post_notification.type.post_in_queue.xml
index 28cb69be36..2dea8e34dd 100644
--- a/tests/notification/fixtures/submit_post_post_in_queue.xml
+++ b/tests/notification/fixtures/submit_post_notification.type.post_in_queue.xml
@@ -22,7 +22,7 @@
<column>notification_type_enabled</column>
<row>
<value>1</value>
- <value>post_in_queue</value>
+ <value>notification.type.post_in_queue</value>
<value>1</value>
</row>
</table>
@@ -107,49 +107,49 @@
<column>method</column>
<column>notify</column>
<row>
- <value>needs_approval</value>
+ <value>notification.type.needs_approval</value>
<value>0</value>
<value>2</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>needs_approval</value>
+ <value>notification.type.needs_approval</value>
<value>0</value>
<value>3</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>needs_approval</value>
+ <value>notification.type.needs_approval</value>
<value>0</value>
<value>4</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>needs_approval</value>
+ <value>notification.type.needs_approval</value>
<value>0</value>
<value>5</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>needs_approval</value>
+ <value>notification.type.needs_approval</value>
<value>0</value>
<value>6</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>needs_approval</value>
+ <value>notification.type.needs_approval</value>
<value>0</value>
<value>7</value>
<value></value>
<value>0</value>
</row>
<row>
- <value>needs_approval</value>
+ <value>notification.type.needs_approval</value>
<value>0</value>
<value>9</value>
<value></value>
diff --git a/tests/notification/fixtures/submit_post_quote.xml b/tests/notification/fixtures/submit_post_notification.type.quote.xml
index 2b11992e54..dd5bc620cd 100644
--- a/tests/notification/fixtures/submit_post_quote.xml
+++ b/tests/notification/fixtures/submit_post_notification.type.quote.xml
@@ -22,7 +22,7 @@
<column>notification_type_enabled</column>
<row>
<value>1</value>
- <value>quote</value>
+ <value>notification.type.quote</value>
<value>1</value>
</row>
</table>
@@ -95,35 +95,35 @@
<column>method</column>
<column>notify</column>
<row>
- <value>quote</value>
+ <value>notification.type.quote</value>
<value>0</value>
<value>2</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>quote</value>
+ <value>notification.type.quote</value>
<value>0</value>
<value>3</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>quote</value>
+ <value>notification.type.quote</value>
<value>0</value>
<value>4</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>quote</value>
+ <value>notification.type.quote</value>
<value>0</value>
<value>5</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>quote</value>
+ <value>notification.type.quote</value>
<value>0</value>
<value>6</value>
<value></value>
diff --git a/tests/notification/fixtures/submit_post_topic.xml b/tests/notification/fixtures/submit_post_notification.type.topic.xml
index 5e179d9b99..1ba8d05699 100644
--- a/tests/notification/fixtures/submit_post_topic.xml
+++ b/tests/notification/fixtures/submit_post_notification.type.topic.xml
@@ -42,7 +42,7 @@
<column>notification_type_enabled</column>
<row>
<value>1</value>
- <value>topic</value>
+ <value>notification.type.topic</value>
<value>1</value>
</row>
</table>
@@ -103,28 +103,28 @@
<column>method</column>
<column>notify</column>
<row>
- <value>topic</value>
+ <value>notification.type.topic</value>
<value>0</value>
<value>2</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>topic</value>
+ <value>notification.type.topic</value>
<value>0</value>
<value>6</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>topic</value>
+ <value>notification.type.topic</value>
<value>0</value>
<value>7</value>
<value></value>
<value>1</value>
</row>
<row>
- <value>topic</value>
+ <value>notification.type.topic</value>
<value>0</value>
<value>8</value>
<value></value>
diff --git a/tests/notification/group_request_test.php b/tests/notification/group_request_test.php
index 14ed4ff62c..afbc586601 100644
--- a/tests/notification/group_request_test.php
+++ b/tests/notification/group_request_test.php
@@ -25,8 +25,8 @@ class phpbb_notification_group_request_test extends phpbb_tests_notification_bas
return array_merge(
parent::get_notification_types(),
array(
- 'group_request',
- 'group_request_approved',
+ 'notification.type.group_request',
+ 'notification.type.group_request_approved',
)
);
}
diff --git a/tests/notification/manager_helper.php b/tests/notification/manager_helper.php
index 24030f5775..75b7275d3a 100644
--- a/tests/notification/manager_helper.php
+++ b/tests/notification/manager_helper.php
@@ -43,7 +43,8 @@ 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_parts = explode('.', $item_type);
+ $item_type = 'phpbb\notification\type\\' . array_pop($item_parts);
$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);
diff --git a/tests/notification/notification_test.php b/tests/notification/notification_test.php
index 27ea8ddb44..79fa5338c4 100644
--- a/tests/notification/notification_test.php
+++ b/tests/notification/notification_test.php
@@ -25,22 +25,22 @@ class phpbb_notification_test extends phpbb_tests_notification_base
public function test_get_notification_type_id()
{
// They should be inserted the first time
- $post_type_id = $this->notifications->get_notification_type_id('post');
- $quote_type_id = $this->notifications->get_notification_type_id('quote');
+ $post_type_id = $this->notifications->get_notification_type_id('notification.type.post');
+ $quote_type_id = $this->notifications->get_notification_type_id('notification.type.quote');
$test_type_id = $this->notifications->get_notification_type_id('test');
$this->assertEquals(array(
'test' => $test_type_id,
- 'quote' => $quote_type_id,
- 'post' => $post_type_id,
+ 'notification.type.quote' => $quote_type_id,
+ 'notification.type.post' => $post_type_id,
),
$this->notifications->get_notification_type_ids(array(
'test',
- 'quote',
- 'post',
+ 'notification.type.quote',
+ 'notification.type.post',
)
));
- $this->assertEquals($quote_type_id, $this->notifications->get_notification_type_id('quote'));
+ $this->assertEquals($quote_type_id, $this->notifications->get_notification_type_id('notification.type.quote'));
try
{
@@ -58,12 +58,12 @@ class phpbb_notification_test extends phpbb_tests_notification_base
$this->assertArrayHasKey('NOTIFICATION_GROUP_MISCELLANEOUS', $subscription_types);
$this->assertArrayHasKey('NOTIFICATION_GROUP_POSTING', $subscription_types);
- $this->assertArrayHasKey('bookmark', $subscription_types['NOTIFICATION_GROUP_POSTING']);
- $this->assertArrayHasKey('post', $subscription_types['NOTIFICATION_GROUP_POSTING']);
- $this->assertArrayHasKey('quote', $subscription_types['NOTIFICATION_GROUP_POSTING']);
- $this->assertArrayHasKey('topic', $subscription_types['NOTIFICATION_GROUP_POSTING']);
+ $this->assertArrayHasKey('notification.type.bookmark', $subscription_types['NOTIFICATION_GROUP_POSTING']);
+ $this->assertArrayHasKey('notification.type.post', $subscription_types['NOTIFICATION_GROUP_POSTING']);
+ $this->assertArrayHasKey('notification.type.quote', $subscription_types['NOTIFICATION_GROUP_POSTING']);
+ $this->assertArrayHasKey('notification.type.topic', $subscription_types['NOTIFICATION_GROUP_POSTING']);
- $this->assertArrayHasKey('pm', $subscription_types['NOTIFICATION_GROUP_MISCELLANEOUS']);
+ $this->assertArrayHasKey('notification.type.pm', $subscription_types['NOTIFICATION_GROUP_MISCELLANEOUS']);
//get_subscription_types
//get_subscription_methods
@@ -72,12 +72,12 @@ class phpbb_notification_test extends phpbb_tests_notification_base
public function test_subscriptions()
{
$expected_subscriptions = array(
- 'post' => array(''),
- 'topic' => array(''),
- 'quote' => array(''),
- 'bookmark' => array(''),
+ 'notification.type.post' => array(''),
+ 'notification.type.topic' => array(''),
+ 'notification.type.quote' => array(''),
+ 'notification.type.bookmark' => array(''),
'test' => array(''),
- 'pm' => array(''),
+ 'notification.type.pm' => array(''),
);
$subscriptions = $this->notifications->get_global_subscriptions(2);
@@ -92,20 +92,20 @@ class phpbb_notification_test extends phpbb_tests_notification_base
$this->assert_array_content_equals($methods, $expected_subscriptions[$item_type]);
}
- $this->notifications->delete_subscription('post', 0, '', 2);
+ $this->notifications->delete_subscription('notification.type.post', 0, '', 2);
- $this->assertArrayNotHasKey('post', $this->notifications->get_global_subscriptions(2));
+ $this->assertArrayNotHasKey('notification.type.post', $this->notifications->get_global_subscriptions(2));
- $this->notifications->add_subscription('post', 0, '', 2);
+ $this->notifications->add_subscription('notification.type.post', 0, '', 2);
- $this->assertArrayHasKey('post', $this->notifications->get_global_subscriptions(2));
+ $this->assertArrayHasKey('notification.type.post', $this->notifications->get_global_subscriptions(2));
}
public function test_notifications()
{
$this->db->sql_query('DELETE FROM phpbb_notification_types');
- $types = array('quote', 'bookmark', 'post', 'test');
+ $types = array('notification.type.quote', 'notification.type.bookmark', 'notification.type.post', 'test');
foreach ($types as $id => $type)
{
$this->db->sql_query('INSERT INTO phpbb_notification_types ' .
@@ -150,7 +150,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
'post_time' => 1349413323,
));
- $this->notifications->add_notifications(array('quote', 'bookmark', 'post', 'test'), array(
+ $this->notifications->add_notifications(array('notification.type.quote', 'notification.type.bookmark', 'notification.type.post', 'test'), array(
'post_id' => '4',
'topic_id' => '2',
'post_time' => 1349413324,
@@ -166,7 +166,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
'user_id' => 0,
)));
- $this->notifications->add_notifications(array('quote', 'bookmark', 'post', 'test'), array(
+ $this->notifications->add_notifications(array('notification.type.quote', 'notification.type.bookmark', 'notification.type.post', 'test'), array(
'post_id' => '5',
'topic_id' => '2',
'post_time' => 1349413325,
@@ -258,7 +258,7 @@ class phpbb_notification_test extends phpbb_tests_notification_base
'post_time' => 1234, // change time
));
- $this->notifications->update_notifications(array('quote', 'bookmark', 'post', 'test'), array(
+ $this->notifications->update_notifications(array('notification.type.quote', 'notification.type.bookmark', 'notification.type.post', 'test'), array(
'post_id' => '5',
'topic_id' => '2',
'poster_id' => 2,
diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php
index c22c4c5ad2..684dd99280 100644
--- a/tests/notification/submit_post_base.php
+++ b/tests/notification/submit_post_base.php
@@ -85,7 +85,7 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
// User
- $user = $this->getMock('\phpbb\user');
+ $user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
$user->ip = '';
$user->data = array(
'user_id' => 2,
@@ -100,7 +100,7 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c
// 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, $config, $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);
diff --git a/tests/notification/submit_post_type_bookmark_test.php b/tests/notification/submit_post_type_bookmark_test.php
index 6d7747c2ba..7c3b9f938f 100644
--- a/tests/notification/submit_post_type_bookmark_test.php
+++ b/tests/notification/submit_post_type_bookmark_test.php
@@ -15,7 +15,7 @@ require_once dirname(__FILE__) . '/submit_post_base.php';
class phpbb_notification_submit_post_type_bookmark_test extends phpbb_notification_submit_post_base
{
- protected $item_type = 'bookmark';
+ protected $item_type = 'notification.type.bookmark';
public function setUp()
{
diff --git a/tests/notification/submit_post_type_post_in_queue_test.php b/tests/notification/submit_post_type_post_in_queue_test.php
index 6bd9c8c93f..1390e92d96 100644
--- a/tests/notification/submit_post_type_post_in_queue_test.php
+++ b/tests/notification/submit_post_type_post_in_queue_test.php
@@ -15,7 +15,7 @@ require_once dirname(__FILE__) . '/submit_post_base.php';
class phpbb_notification_submit_post_type_post_in_queue_test extends phpbb_notification_submit_post_base
{
- protected $item_type = 'post_in_queue';
+ protected $item_type = 'notification.type.post_in_queue';
public function setUp()
{
diff --git a/tests/notification/submit_post_type_post_test.php b/tests/notification/submit_post_type_post_test.php
index 5007424690..037c326bc0 100644
--- a/tests/notification/submit_post_type_post_test.php
+++ b/tests/notification/submit_post_type_post_test.php
@@ -15,7 +15,7 @@ require_once dirname(__FILE__) . '/submit_post_base.php';
class phpbb_notification_submit_post_type_post_test extends phpbb_notification_submit_post_base
{
- protected $item_type = 'post';
+ protected $item_type = 'notification.type.post';
public function setUp()
{
diff --git a/tests/notification/submit_post_type_quote_test.php b/tests/notification/submit_post_type_quote_test.php
index 94979fd154..61e3840773 100644
--- a/tests/notification/submit_post_type_quote_test.php
+++ b/tests/notification/submit_post_type_quote_test.php
@@ -15,7 +15,7 @@ require_once dirname(__FILE__) . '/submit_post_base.php';
class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_submit_post_base
{
- protected $item_type = 'quote';
+ protected $item_type = 'notification.type.quote';
public function setUp()
{
diff --git a/tests/notification/submit_post_type_topic_test.php b/tests/notification/submit_post_type_topic_test.php
index 52e9353c7c..c095fbc4ba 100644
--- a/tests/notification/submit_post_type_topic_test.php
+++ b/tests/notification/submit_post_type_topic_test.php
@@ -15,7 +15,7 @@ require_once dirname(__FILE__) . '/submit_post_base.php';
class phpbb_notification_submit_post_type_topic_test extends phpbb_notification_submit_post_base
{
- protected $item_type = 'topic';
+ protected $item_type = 'notification.type.topic';
public function setUp()
{
diff --git a/tests/notification/user_list_trim_test.php b/tests/notification/user_list_trim_test.php
index 851c9ec221..c43eff729c 100644
--- a/tests/notification/user_list_trim_test.php
+++ b/tests/notification/user_list_trim_test.php
@@ -53,7 +53,7 @@ class phpbb_notification_user_list_trim_test extends phpbb_database_test_case
array('u_viewprofile', 1, false),
)));
- $user = new \phpbb\user();
+ $user = new \phpbb\user('\phpbb\datetime');
$user->data = array('user_lang' => 'en');
$user->add_lang('common');
diff --git a/tests/pagination/pagination_test.php b/tests/pagination/pagination_test.php
index ace8c1eed0..321d6c2caf 100644
--- a/tests/pagination/pagination_test.php
+++ b/tests/pagination/pagination_test.php
@@ -29,7 +29,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case
global $phpbb_dispatcher;
$phpbb_dispatcher = new phpbb_mock_event_dispatcher;
- $this->user = $this->getMock('\phpbb\user');
+ $this->user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
$this->user->expects($this->any())
->method('lang')
->will($this->returnCallback(array($this, 'return_callback_implode')));
diff --git a/tests/profilefields/type_bool_test.php b/tests/profilefields/type_bool_test.php
index bdab179c8c..41c40ddb4b 100644
--- a/tests/profilefields/type_bool_test.php
+++ b/tests/profilefields/type_bool_test.php
@@ -25,7 +25,7 @@ class phpbb_profilefield_type_bool_test extends phpbb_test_case
*/
public function setUp()
{
- $user = $this->getMock('\phpbb\user');
+ $user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
$user->expects($this->any())
->method('lang')
->will($this->returnCallback(array($this, 'return_callback_implode')));
diff --git a/tests/profilefields/type_date_test.php b/tests/profilefields/type_date_test.php
index 0ad2cde9fe..123955198e 100644
--- a/tests/profilefields/type_date_test.php
+++ b/tests/profilefields/type_date_test.php
@@ -25,7 +25,7 @@ class phpbb_profilefield_type_date_test extends phpbb_test_case
*/
public function setUp()
{
- $this->user = $this->getMock('\phpbb\user');
+ $this->user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
$this->user->expects($this->any())
->method('lang')
->will($this->returnCallback(array($this, 'return_callback_implode')));
diff --git a/tests/profilefields/type_dropdown_test.php b/tests/profilefields/type_dropdown_test.php
index ebecbf97f0..3845a8e96b 100644
--- a/tests/profilefields/type_dropdown_test.php
+++ b/tests/profilefields/type_dropdown_test.php
@@ -25,7 +25,7 @@ class phpbb_profilefield_type_dropdown_test extends phpbb_test_case
*/
public function setUp()
{
- $user = $this->getMock('\phpbb\user');
+ $user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
$user->expects($this->any())
->method('lang')
->will($this->returnCallback(array($this, 'return_callback_implode')));
diff --git a/tests/profilefields/type_googleplus_test.php b/tests/profilefields/type_googleplus_test.php
index fdbdd86553..f3db6ef01f 100644
--- a/tests/profilefields/type_googleplus_test.php
+++ b/tests/profilefields/type_googleplus_test.php
@@ -11,8 +11,27 @@
*
*/
+require_once __DIR__ . '/../../phpBB/includes/utf/utf_tools.php';
+
class phpbb_profilefield_type_googleplus_test extends phpbb_test_case
{
+ protected $field;
+
+ public function setUp()
+ {
+ parent::setUp();
+
+ $user = new \phpbb\user('\phpbb\datetime');
+ $user->add_lang('ucp');
+ $request = $this->getMock('\phpbb\request\request');
+ $template = $this->getMock('\phpbb\template\template');
+
+ $this->field = new \phpbb\profilefields\type\type_googleplus(
+ $request,
+ $template,
+ $user
+ );
+ }
public function get_profile_contact_value_data()
{
return array(
@@ -36,16 +55,6 @@ class phpbb_profilefield_type_googleplus_test extends phpbb_test_case
*/
public function test_get_profile_contact_value($value, $field_options, $expected, $description)
{
- $user = $this->getMock('\phpbb\user');
- $request = $this->getMock('\phpbb\request\request');
- $template = $this->getMock('\phpbb\template\template');
-
- $field = new \phpbb\profilefields\type\type_googleplus(
- $request,
- $template,
- $user
- );
-
$default_field_options = array(
'field_type' => '\phpbb\profilefields\type\type_googleplus',
'field_name' => 'field',
@@ -57,6 +66,29 @@ class phpbb_profilefield_type_googleplus_test extends phpbb_test_case
);
$field_options = array_merge($default_field_options, $field_options);
- $this->assertSame($expected, $field->get_profile_contact_value($value, $field_options), $description);
+ $this->assertSame($expected, $this->field->get_profile_contact_value($value, $field_options), $description);
+ }
+
+ public function data_validate_googleplus()
+ {
+ return array(
+ array('foobar', false),
+ array('2342340929304', false),
+ array('foo<bar', 'The field “googleplus” has invalid characters.'),
+ array('klkd.klkl', false),
+ array('kl+', 'The field “googleplus” has invalid characters.'),
+ array('foo=bar', 'The field “googleplus” has invalid characters.'),
+ array('..foo', 'The field “googleplus” has invalid characters.'),
+ array('foo..bar', 'The field “googleplus” has invalid characters.'),
+ );
+ }
+
+ /**
+ * @dataProvider data_validate_googleplus
+ */
+ public function test_validate_googleplus($input, $expected)
+ {
+ $field_data = array_merge(array('lang_name' => 'googleplus'), $this->field->get_default_option_values());
+ $this->assertSame($expected, $this->field->validate_string_profile_field('string', $input, $field_data));
}
}
diff --git a/tests/profilefields/type_int_test.php b/tests/profilefields/type_int_test.php
index ac48c10a84..07b22525e2 100644
--- a/tests/profilefields/type_int_test.php
+++ b/tests/profilefields/type_int_test.php
@@ -24,7 +24,7 @@ class phpbb_profilefield_type_int_test extends phpbb_test_case
*/
public function setUp()
{
- $user = $this->getMock('\phpbb\user');
+ $user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
$user->expects($this->any())
->method('lang')
->will($this->returnCallback(array($this, 'return_callback_implode')));
diff --git a/tests/profilefields/type_string_test.php b/tests/profilefields/type_string_test.php
index 2277526758..d5384e0ae8 100644
--- a/tests/profilefields/type_string_test.php
+++ b/tests/profilefields/type_string_test.php
@@ -30,7 +30,7 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case
{
global $request, $user, $cache;
- $user = $this->getMock('\phpbb\user');
+ $user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
$cache = new phpbb_mock_cache;
$user->expects($this->any())
->method('lang')
diff --git a/tests/profilefields/type_url_test.php b/tests/profilefields/type_url_test.php
index a45a28e7c7..372c07418f 100644
--- a/tests/profilefields/type_url_test.php
+++ b/tests/profilefields/type_url_test.php
@@ -26,7 +26,7 @@ class phpbb_profilefield_type_url_test extends phpbb_test_case
*/
public function setUp()
{
- $user = $this->getMock('\phpbb\user');
+ $user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
$user->expects($this->any())
->method('lang')
->will($this->returnCallback(array($this, 'return_callback_implode')));
diff --git a/tests/security/base.php b/tests/security/base.php
index 83d0649dfa..5519cac441 100644
--- a/tests/security/base.php
+++ b/tests/security/base.php
@@ -59,7 +59,7 @@ abstract class phpbb_security_test_base extends phpbb_test_case
$phpbb_filesystem = new \phpbb\filesystem($symfony_request, $phpbb_root_path, $phpEx);
// Set no user and trick a bit to circumvent errors
- $user = new \phpbb\user();
+ $user = new \phpbb\user('\phpbb\datetime');
$user->lang = true;
$user->browser = $server['HTTP_USER_AGENT'];
$user->referer = '';
diff --git a/tests/session/garbage_collection_test.php b/tests/session/garbage_collection_test.php
index 0fbc71dcd7..3fad81c68b 100644
--- a/tests/session/garbage_collection_test.php
+++ b/tests/session/garbage_collection_test.php
@@ -12,6 +12,7 @@
*/
require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php';
+require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php';
class phpbb_session_garbage_collection_test extends phpbb_session_test_case
{
@@ -26,6 +27,19 @@ class phpbb_session_garbage_collection_test extends phpbb_session_test_case
{
parent::setUp();
$this->session = $this->session_factory->get_session($this->db);
+
+ global $phpbb_container;
+
+ $plugins = new \phpbb\di\service_collection($phpbb_container);
+ $plugins->add('core.captcha.plugins.nogd');
+ $phpbb_container->set(
+ 'captcha.factory',
+ new \phpbb\captcha\factory($phpbb_container, $plugins)
+ );
+ $phpbb_container->set(
+ 'core.captcha.plugins.nogd',
+ new \phpbb\captcha\plugins\nogd()
+ );
}
public function test_cleanup_all()
@@ -47,7 +61,7 @@ class phpbb_session_garbage_collection_test extends phpbb_session_test_case
global $config;
$config['session_length'] = 0;
// There is an error unless the captcha plugin is set
- $config['captcha_plugin'] = 'phpbb_captcha_nogd';
+ $config['captcha_plugin'] = 'core.captcha.plugins.nogd';
$this->session->session_gc();
$this->check_sessions_equals(
array(),
diff --git a/tests/template/template_test_case.php b/tests/template/template_test_case.php
index 83446b5352..1250397401 100644
--- a/tests/template/template_test_case.php
+++ b/tests/template/template_test_case.php
@@ -65,7 +65,7 @@ class phpbb_template_template_test_case extends phpbb_test_case
$defaults = $this->config_defaults();
$config = new \phpbb\config\config(array_merge($defaults, $new_config));
- $this->user = new \phpbb\user;
+ $this->user = new \phpbb\user('\phpbb\datetime');
$path_helper = new \phpbb\path_helper(
new \phpbb\symfony_request(
diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php
index 07ef826abf..49cc72363e 100644
--- a/tests/test_framework/phpbb_functional_test_case.php
+++ b/tests/test_framework/phpbb_functional_test_case.php
@@ -11,12 +11,14 @@
*
*/
use Symfony\Component\BrowserKit\CookieJar;
-use Behat\Mink\Driver\Goutte\Client;
-use Behat\Mink\Driver\GoutteDriver;
-class phpbb_functional_test_case extends phpbb_mink_test_case
+require_once __DIR__ . '/../../phpBB/includes/functions_install.php';
+
+class phpbb_functional_test_case extends phpbb_test_case
{
+ static protected $client;
static protected $cookieJar;
+ static protected $root_url;
protected $cache = null;
protected $db = null;
@@ -34,6 +36,7 @@ class phpbb_functional_test_case extends phpbb_mink_test_case
*/
protected $lang = array();
+ static protected $config = array();
static protected $already_installed = false;
static public function setUpBeforeClass()
@@ -43,24 +46,6 @@ class phpbb_functional_test_case extends phpbb_mink_test_case
self::$config = phpbb_test_case_helpers::get_test_config();
self::$root_url = self::$config['phpbb_functional_url'];
- self::$cookieJar = new CookieJar;
- self::$client = new Client(array(), null, self::$cookieJar);
-
- $client_options = array(
- Guzzle\Http\Client::DISABLE_REDIRECTS => true,
- 'curl.options' => array(
- CURLOPT_TIMEOUT => 120,
- ),
- );
-
- self::$client->setClient(new Guzzle\Http\Client('', $client_options));
-
- // Reset the curl handle because it is 0 at this point and not a valid
- // resource
- self::$client->getClient()->getCurlMulti()->reset(true);
-
- self::$driver = new GoutteDriver(self::$client);
-
// Important: this is used both for installation and by
// test cases for querying the tables.
// Therefore table prefix must be set before a board is
@@ -93,6 +78,12 @@ class phpbb_functional_test_case extends phpbb_mink_test_case
$this->bootstrap();
+ self::$cookieJar = new CookieJar;
+ self::$client = new Goutte\Client(array(), null, self::$cookieJar);
+ // Reset the curl handle because it is 0 at this point and not a valid
+ // resource
+ self::$client->getClient()->getCurlMulti()->reset(true);
+
// Clear the language array so that things
// that were added in other tests are gone
$this->lang = array();
@@ -119,14 +110,13 @@ class phpbb_functional_test_case extends phpbb_mink_test_case
protected function tearDown()
{
+ parent::tearDown();
+
if ($this->db instanceof \phpbb\db\driver\driver_interface)
{
// Close the database connections again this test
$this->db->sql_close();
}
-
- self::$cookieJar->clear();
- parent::tearDown();
}
/**
@@ -249,7 +239,7 @@ class phpbb_functional_test_case extends phpbb_mink_test_case
);
$container = new phpbb_mock_container_builder();
$container->set('migrator', $migrator);
- $user = new \phpbb\user();
+ $user = new \phpbb\user('\phpbb\datetime');
$extension_manager = new \phpbb\extension\manager(
$container,
@@ -266,6 +256,144 @@ class phpbb_functional_test_case extends phpbb_mink_test_case
return $extension_manager;
}
+ static protected function install_board()
+ {
+ global $phpbb_root_path, $phpEx;
+
+ self::recreate_database(self::$config);
+
+ $config_file = $phpbb_root_path . "config.$phpEx";
+ $config_file_dev = $phpbb_root_path . "config_dev.$phpEx";
+ $config_file_test = $phpbb_root_path . "config_test.$phpEx";
+
+ if (file_exists($config_file))
+ {
+ if (!file_exists($config_file_dev))
+ {
+ rename($config_file, $config_file_dev);
+ }
+ else
+ {
+ unlink($config_file);
+ }
+ }
+
+ self::$cookieJar = new CookieJar;
+ self::$client = new Goutte\Client(array(), null, self::$cookieJar);
+ // Set client manually so we can increase the cURL timeout
+ self::$client->setClient(new Guzzle\Http\Client('', array(
+ Guzzle\Http\Client::DISABLE_REDIRECTS => true,
+ 'curl.options' => array(
+ CURLOPT_TIMEOUT => 120,
+ ),
+ )));
+
+ // Reset the curl handle because it is 0 at this point and not a valid
+ // resource
+ self::$client->getClient()->getCurlMulti()->reset(true);
+
+ $parseURL = parse_url(self::$config['phpbb_functional_url']);
+
+ $crawler = self::request('GET', 'install/index.php?mode=install&language=en');
+ self::assertContains('Welcome to Installation', $crawler->filter('#main')->text());
+ $form = $crawler->selectButton('submit')->form();
+
+ // install/index.php?mode=install&sub=requirements
+ $crawler = self::submit($form);
+ self::assertContains('Installation compatibility', $crawler->filter('#main')->text());
+ $form = $crawler->selectButton('submit')->form();
+
+ // install/index.php?mode=install&sub=database
+ $crawler = self::submit($form);
+ 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']),
+ 'dbhost' => self::$config['dbhost'],
+ 'dbport' => self::$config['dbport'],
+ 'dbname' => self::$config['dbname'],
+ 'dbuser' => self::$config['dbuser'],
+ 'dbpasswd' => self::$config['dbpasswd'],
+ 'table_prefix' => self::$config['table_prefix'],
+ ));
+
+ // install/index.php?mode=install&sub=database
+ $crawler = self::submit($form);
+ self::assertContains('Successful connection', $crawler->filter('#main')->text());
+ $form = $crawler->selectButton('submit')->form();
+
+ // install/index.php?mode=install&sub=administrator
+ $crawler = self::submit($form);
+ self::assertContains('Administrator configuration', $crawler->filter('#main')->text());
+ $form = $crawler->selectButton('submit')->form(array(
+ 'default_lang' => 'en',
+ 'admin_name' => 'admin',
+ 'admin_pass1' => 'adminadmin',
+ 'admin_pass2' => 'adminadmin',
+ 'board_email' => 'nobody@example.com',
+ ));
+
+ // install/index.php?mode=install&sub=administrator
+ $crawler = self::submit($form);
+ self::assertContains('Tests passed', $crawler->filter('#main')->text());
+ $form = $crawler->selectButton('submit')->form();
+
+ // We have to skip install/index.php?mode=install&sub=config_file
+ // because that step will create a config.php file if phpBB has the
+ // permission to do so. We have to create the config file on our own
+ // in order to get the DEBUG constants defined.
+ $config_php_data = phpbb_create_config_file_data(self::$config, self::$config['dbms'], true, false, true);
+ $config_created = file_put_contents($config_file, $config_php_data) !== false;
+ if (!$config_created)
+ {
+ self::markTestSkipped("Could not write $config_file file.");
+ }
+
+ // We also have to create a install lock that is normally created by
+ // the installer. The file will be removed by the final step of the
+ // installer.
+ $install_lock_file = $phpbb_root_path . 'cache/install_lock';
+ $lock_created = file_put_contents($install_lock_file, '') !== false;
+ if (!$lock_created)
+ {
+ self::markTestSkipped("Could not create $lock_created file.");
+ }
+ @chmod($install_lock_file, 0666);
+
+ // install/index.php?mode=install&sub=advanced
+ $form_data = $form->getValues();
+ unset($form_data['submit']);
+
+ $crawler = self::request('POST', 'install/index.php?mode=install&sub=advanced', $form_data);
+ self::assertContains('The settings on this page are only necessary to set if you know that you require something different from the default.', $crawler->filter('#main')->text());
+ $form = $crawler->selectButton('submit')->form(array(
+ 'email_enable' => true,
+ 'smtp_delivery' => true,
+ 'smtp_host' => 'nxdomain.phpbb.com',
+ 'smtp_auth' => 'PLAIN',
+ 'smtp_user' => 'nxuser',
+ 'smtp_pass' => 'nxpass',
+ 'cookie_secure' => false,
+ 'force_server_vars' => false,
+ 'server_protocol' => $parseURL['scheme'] . '://',
+ 'server_name' => 'localhost',
+ 'server_port' => isset($parseURL['port']) ? (int) $parseURL['port'] : 80,
+ 'script_path' => $parseURL['path'],
+ ));
+
+ // install/index.php?mode=install&sub=create_table
+ $crawler = self::submit($form);
+ self::assertContains('The database tables used by phpBB', $crawler->filter('#main')->text());
+ self::assertContains('have been created and populated with some initial data.', $crawler->filter('#main')->text());
+ $form = $crawler->selectButton('submit')->form();
+
+ // install/index.php?mode=install&sub=final
+ $crawler = self::submit($form);
+ self::assertContains('You have successfully installed', $crawler->text());
+
+ copy($config_file, $config_file_test);
+ }
+
public function install_ext($extension)
{
$this->login();
@@ -284,6 +412,12 @@ class phpbb_functional_test_case extends phpbb_mink_test_case
$this->logout();
}
+ static private function recreate_database($config)
+ {
+ $db_conn_mgr = new phpbb_database_test_connection_manager($config);
+ $db_conn_mgr->recreate_db();
+ }
+
/**
* Creates a new style
*
@@ -464,7 +598,7 @@ class phpbb_functional_test_case extends phpbb_mink_test_case
$db = $this->get_db();
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
- $user = $this->getMock('\phpbb\user');
+ $user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
$auth = $this->getMock('\phpbb\auth\auth');
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
@@ -503,7 +637,7 @@ class phpbb_functional_test_case extends phpbb_mink_test_case
$db = $this->get_db();
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
- $user = $this->getMock('\phpbb\user');
+ $user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
$auth = $this->getMock('\phpbb\auth\auth');
$phpbb_log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE);
@@ -897,6 +1031,76 @@ class phpbb_functional_test_case extends phpbb_mink_test_case
{
$this->add_lang('posting');
+ $crawler = $this->submit_message($posting_url, $posting_contains, $form_data);
+
+ if ($expected !== '')
+ {
+ if (isset($this->lang[$expected]))
+ {
+ $this->assertContainsLang($expected, $crawler->filter('html')->text());
+ }
+ else
+ {
+ $this->assertContains($expected, $crawler->filter('html')->text());
+ }
+ return null;
+ }
+
+ $url = $crawler->selectLink($form_data['subject'])->link()->getUri();
+
+ return array(
+ 'topic_id' => $this->get_parameter_from_link($url, 't'),
+ 'post_id' => $this->get_parameter_from_link($url, 'p'),
+ );
+ }
+
+ /**
+ * Creates a private message
+ *
+ * Be sure to login before creating
+ *
+ * @param string $subject
+ * @param string $message
+ * @param array $to
+ * @param array $additional_form_data Any additional form data to be sent in the request
+ * @return int private_message_id
+ */
+ public function create_private_message($subject, $message, $to, $additional_form_data = array())
+ {
+ $this->add_lang(array('ucp', 'posting'));
+
+ $posting_url = "ucp.php?i=pm&mode=compose&sid={$this->sid}";
+
+ $form_data = array_merge(array(
+ 'subject' => $subject,
+ 'message' => $message,
+ 'post' => true,
+ ), $additional_form_data);
+
+ foreach ($to as $user_id)
+ {
+ $form_data['address_list[u][' . $user_id . ']'] = 'to';
+ }
+
+ $crawler = self::submit_message($posting_url, 'POST_NEW_PM', $form_data);
+
+ $this->assertContains($this->lang('MESSAGE_STORED'), $crawler->filter('html')->text());
+ $url = $crawler->selectLink($this->lang('VIEW_PRIVATE_MESSAGE', '', ''))->link()->getUri();
+
+ return $this->get_parameter_from_link($url, 'p');
+ }
+
+ /**
+ * Helper for submitting a message (post or private message)
+ *
+ * @param string $posting_url
+ * @param string $posting_contains
+ * @param array $form_data
+ * @return \Symfony\Component\DomCrawler\Crawler the crawler object
+ */
+ protected function submit_message($posting_url, $posting_contains, $form_data)
+ {
+
$crawler = self::request('GET', $posting_url);
$this->assertContains($this->lang($posting_contains), $crawler->filter('html')->text());
@@ -938,27 +1142,7 @@ class phpbb_functional_test_case extends phpbb_mink_test_case
// I use a request because the form submission method does not allow you to send data that is not
// contained in one of the actual form fields that the browser sees (i.e. it ignores "hidden" inputs)
// Instead, I send it as a request with the submit button "post" set to true.
- $crawler = self::request('POST', $posting_url, $form_data);
-
- if ($expected !== '')
- {
- if (isset($this->lang[$expected]))
- {
- $this->assertContainsLang($expected, $crawler->filter('html')->text());
- }
- else
- {
- $this->assertContains($expected, $crawler->filter('html')->text());
- }
- return null;
- }
-
- $url = $crawler->selectLink($form_data['subject'])->link()->getUri();
-
- return array(
- 'topic_id' => $this->get_parameter_from_link($url, 't'),
- 'post_id' => $this->get_parameter_from_link($url, 'p'),
- );
+ return self::request('POST', $posting_url, $form_data);
}
/**
diff --git a/tests/test_framework/phpbb_mink_test_case.php b/tests/test_framework/phpbb_mink_test_case.php
deleted file mode 100644
index ba480e35fb..0000000000
--- a/tests/test_framework/phpbb_mink_test_case.php
+++ /dev/null
@@ -1,183 +0,0 @@
-<?php
-/**
-*
-* This file is part of the phpBB Forum Software package.
-*
-* @copyright (c) phpBB Limited <https://www.phpbb.com>
-* @license GNU General Public License, version 2 (GPL-2.0)
-*
-* For full copyright and license information, please see
-* the docs/CREDITS.txt file.
-*
-*/
-use \Behat\Mink\Session;
-
-require_once __DIR__ . '/../../phpBB/includes/functions_install.php';
-
-abstract class phpbb_mink_test_case extends phpbb_test_case
-{
- static protected $driver;
- static protected $client;
- static protected $session;
- static protected $config = array();
- static protected $root_url;
-
- public function __construct($name = null, array $data = array(), $dataName = '')
- {
- parent::__construct($name, $data, $dataName);
-
- $this->backupStaticAttributesBlacklist += array(
- 'phpbb_mink_test_case' => array('config', 'already_installed'),
- );
- }
-
- static public function setUpBeforeClass()
- {
- parent::setUpBeforeClass();
- }
-
- public function setUp()
- {
- parent::setUp();
-
- if (!self::$driver)
- {
- self::markTestSkipped('Mink driver not initialized.');
- }
-
- if (!self::$session)
- {
- self::$session = new Session(self::$driver);
- }
- }
-
- static protected function recreate_database($config)
- {
- $db_conn_mgr = new phpbb_database_test_connection_manager($config);
- $db_conn_mgr->recreate_db();
- }
-
- protected function tearDown()
- {
- self::$session->reset();
- parent::tearDown();
- }
-
- static protected function visit($path)
- {
- self::$session->visit(self::$root_url . $path);
- return self::$session->getPage();
- }
-
- static protected function click_submit($submit_button_id = 'submit')
- {
- self::$session->getPage()->findById($submit_button_id)->click();
- return self::$session->getPage();
- }
-
- static protected function install_board()
- {
- global $phpbb_root_path, $phpEx;
-
- self::recreate_database(self::$config);
- self::$session = new Session(self::$driver);
-
- $config_file = $phpbb_root_path . "config.$phpEx";
- $config_file_dev = $phpbb_root_path . "config_dev.$phpEx";
- $config_file_test = $phpbb_root_path . "config_test.$phpEx";
-
- if (file_exists($config_file))
- {
- if (!file_exists($config_file_dev))
- {
- rename($config_file, $config_file_dev);
- }
- else
- {
- unlink($config_file);
- }
- }
-
- $parseURL = parse_url(self::$config['phpbb_functional_url']);
-
- $page = self::visit('install/index.php?mode=install');
- self::assertContains('Welcome to Installation', $page->findById('main')->getText());
-
- // install/index.php?mode=install&sub=requirements
- $page = self::click_submit();
- self::assertContains('Installation compatibility', $page->findById('main')->getText());
-
- // install/index.php?mode=install&sub=database
- $page = self::click_submit();
- self::assertContains('Database configuration', $page->findById('main')->getText());
-
- $page->findById('dbms')->setValue(str_replace('phpbb\db\driver\\', '', self::$config['dbms']));
- $page->findById('dbhost')->setValue(self::$config['dbhost']);
- $page->findById('dbport')->setValue(self::$config['dbport']);
- $page->findById('dbname')->setValue(self::$config['dbname']);
- $page->findById('dbuser')->setValue(self::$config['dbuser']);
- $page->findById('dbpasswd')->setValue(self::$config['dbpasswd']);
- $page->findById('table_prefix')->setValue(self::$config['table_prefix']);
-
- // install/index.php?mode=install&sub=database
- $page = self::click_submit();
- self::assertContains('Successful connection', $page->findById('main')->getText());
-
- // install/index.php?mode=install&sub=administrator
- $page = self::click_submit();
- self::assertContains('Administrator configuration', $page->findById('main')->getText());
-
- $page->findById('admin_name')->setValue('admin');
- $page->findById('admin_pass1')->setValue('adminadmin');
- $page->findById('admin_pass2')->setValue('adminadmin');
- $page->findById('board_email')->setValue('nobody@example.com');
-
- // install/index.php?mode=install&sub=administrator
- $page = self::click_submit();
- self::assertContains('Tests passed', $page->findById('main')->getText());
-
- // install/index.php?mode=install&sub=config_file
- $page = self::click_submit();
-
- // Installer has created a config.php file, we will overwrite it with a
- // config file of our own in order to get the DEBUG constants defined
- $config_php_data = phpbb_create_config_file_data(self::$config, self::$config['dbms'], true, false, true);
- $config_created = file_put_contents($config_file, $config_php_data) !== false;
- if (!$config_created)
- {
- self::markTestSkipped("Could not write $config_file file.");
- }
-
- if (strpos($page->findById('main')->getText(), 'The configuration file has been written') === false)
- {
- $page = self::click_submit('dldone');
- }
- self::assertContains('The configuration file has been written', $page->findById('main')->getText());
-
- // install/index.php?mode=install&sub=advanced
- $page = self::click_submit();
- self::assertContains('The settings on this page are only necessary to set if you know that you require something different from the default.', $page->findById('main')->getText());
-
- $page->findById('smtp_delivery')->setValue('1');
- $page->findById('smtp_host')->setValue('nxdomain.phpbb.com');
- $page->findById('smtp_user')->setValue('nxuser');
- $page->findById('smtp_pass')->setValue('nxpass');
- $page->findById('server_protocol')->setValue($parseURL['scheme'] . '://');
- $page->findById('server_name')->setValue('localhost');
- $page->findById('server_port')->setValue(isset($parseURL['port']) ? $parseURL['port'] : 80);
- $page->findById('script_path')->setValue($parseURL['path']);
-
- // install/index.php?mode=install&sub=create_table
- $page = self::click_submit();
- self::assertContains('The database tables used by phpBB', $page->findById('main')->getText());
- self::assertContains('have been created and populated with some initial data.', $page->findById('main')->getText());
-
- // install/index.php?mode=install&sub=final
- $page = self::click_submit();
- self::assertContains('You have successfully installed', $page->getText());
-
- copy($config_file, $config_file_test);
-
- self::$session->stop();
- }
-}
diff --git a/tests/upload/filespec_test.php b/tests/upload/filespec_test.php
index 5e333213f4..d8fa82e2b5 100644
--- a/tests/upload/filespec_test.php
+++ b/tests/upload/filespec_test.php
@@ -65,6 +65,16 @@ class phpbb_filespec_test extends phpbb_test_case
copy($fileinfo->getPathname(), $this->path . 'copies/' . $fileinfo->getFilename() . '_copy_2');
}
}
+
+ $guessers = array(
+ new \Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser(),
+ new \Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser(),
+ new \phpbb\mimetype\content_guesser(),
+ new \phpbb\mimetype\extension_guesser(),
+ );
+ $guessers[2]->set_priority(-2);
+ $guessers[3]->set_priority(-2);
+ $this->mimetype_guesser = new \phpbb\mimetype\guesser($guessers);
}
private function get_filespec($override = array())
@@ -78,7 +88,7 @@ class phpbb_filespec_test extends phpbb_test_case
'error' => '',
);
- return new filespec(array_merge($upload_ary, $override), null);
+ return new filespec(array_merge($upload_ary, $override), null, $this->mimetype_guesser);
}
protected function tearDown()
@@ -222,6 +232,9 @@ class phpbb_filespec_test extends phpbb_test_case
array('png', 'image/png', true),
array('tif', 'image/tif', true),
array('txt', 'text/plain', false),
+ array('jpg', 'application/octet-stream', false),
+ array('gif', 'application/octetstream', false),
+ array('png', 'application/mime', false),
);
}
@@ -234,6 +247,30 @@ class phpbb_filespec_test extends phpbb_test_case
$this->assertEquals($expected, $filespec->is_image());
}
+ public function is_image_get_mimetype()
+ {
+ return array(
+ array('gif', 'image/gif', true),
+ array('jpg', 'image/jpg', true),
+ array('png', 'image/png', true),
+ array('tif', 'image/tif', true),
+ array('txt', 'text/plain', false),
+ array('jpg', 'application/octet-stream', true),
+ array('gif', 'application/octetstream', true),
+ array('png', 'application/mime', true),
+ );
+ }
+
+ /**
+ * @dataProvider is_image_get_mimetype
+ */
+ public function test_is_image_get_mimetype($filename, $mimetype, $expected)
+ {
+ $filespec = $this->get_filespec(array('tmp_name' => $this->path . $filename, 'type' => $mimetype));
+ $filespec->get_mimetype($this->path . $filename);
+ $this->assertEquals($expected, $filespec->is_image());
+ }
+
public function move_file_variables()
{
return array(
diff --git a/tests/user/lang_test.php b/tests/user/lang_test.php
index 45c6b04c65..bb11bb63cb 100644
--- a/tests/user/lang_test.php
+++ b/tests/user/lang_test.php
@@ -17,7 +17,7 @@ class phpbb_user_lang_test extends phpbb_test_case
{
public function test_user_lang_sprintf()
{
- $user = new \phpbb\user;
+ $user = new \phpbb\user('\phpbb\datetime');
$user->lang = array(
'FOO' => 'BAR',
'BARZ' => 'PENG',
@@ -99,7 +99,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('\phpbb\datetime');
$user->lang = array(
'PLURAL_RULE' => 13,
'ARRY' => array(
diff --git a/tests/version/version_fetch_test.php b/tests/version/version_fetch_test.php
index aa0ebaaa26..05eac58a52 100644
--- a/tests/version/version_fetch_test.php
+++ b/tests/version/version_fetch_test.php
@@ -33,7 +33,7 @@ class phpbb_version_helper_fetch_test extends phpbb_test_case
new \phpbb\config\config(array(
'version' => '3.1.0',
)),
- new \phpbb\user()
+ new \phpbb\user('\phpbb\datetime')
);
}
diff --git a/tests/version/version_test.php b/tests/version/version_test.php
index bc4f2c0294..ba31c79a79 100644
--- a/tests/version/version_test.php
+++ b/tests/version/version_test.php
@@ -30,7 +30,7 @@ class phpbb_version_helper_test extends phpbb_test_case
new \phpbb\config\config(array(
'version' => '3.1.0',
)),
- new \phpbb\user()
+ new \phpbb\user('\phpbb\datetime')
);
}
@@ -208,7 +208,7 @@ class phpbb_version_helper_test extends phpbb_test_case
new \phpbb\config\config(array(
'version' => $current_version,
)),
- new \phpbb\user(),
+ new \phpbb\user('\phpbb\datetime'),
))
->getMock()
;
@@ -318,7 +318,7 @@ class phpbb_version_helper_test extends phpbb_test_case
new \phpbb\config\config(array(
'version' => $current_version,
)),
- new \phpbb\user(),
+ new \phpbb\user('\phpbb\datetime'),
))
->getMock()
;
diff --git a/travis/check-executable-files.sh b/travis/check-executable-files.sh
new file mode 100755
index 0000000000..4d420add1c
--- /dev/null
+++ b/travis/check-executable-files.sh
@@ -0,0 +1,68 @@
+#!/bin/bash
+#
+# This file is part of the phpBB Forum Software package.
+#
+# @copyright (c) phpBB Limited <https://www.phpbb.com>
+# @license GNU General Public License, version 2 (GPL-2.0)
+#
+# For full copyright and license information, please see
+# the docs/CREDITS.txt file.
+#
+set -e
+
+DB=$1
+TRAVIS_PHP_VERSION=$2
+root="$3"
+path="${root}phpBB/"
+
+if [ "$TRAVIS_PHP_VERSION" == "5.3.3" -a "$DB" == "mysqli" ]
+then
+ # Check the permissions of the files
+
+ # The following variables MUST NOT contain any wildcard
+ # Directories to skip
+ directories_skipped="-path ${path}develop -o -path ${path}vendor"
+
+ # Files to skip
+ files_skipped="-false"
+
+ # Files which have to be executable
+ executable_files="-path ${path}bin/*"
+
+ incorrect_files=$( \
+ find ${path} \
+ '(' \
+ '(' \
+ ${directories_skipped} \
+ ')' \
+ -a -type d -prune -a -type f \
+ ')' -o \
+ '(' \
+ -type f -a \
+ -not '(' \
+ ${files_skipped} \
+ ')' -a \
+ '(' \
+ '(' \
+ '(' \
+ ${executable_files} \
+ ')' -a \
+ -not -perm +100 \
+ ')' -o \
+ '(' \
+ -not '(' \
+ ${executable_files} \
+ ')' -a \
+ -perm +111 \
+ ')' \
+ ')' \
+ ')' \
+ )
+
+ if [ "${incorrect_files}" != '' ]
+ then
+ echo "The following files do not have proper permissions:";
+ ls -la ${incorrect_files}
+ exit 1;
+ fi
+fi
diff --git a/travis/check-image-icc-profiles.sh b/travis/check-image-icc-profiles.sh
index 31848dc9e7..bb070ccc27 100755
--- a/travis/check-image-icc-profiles.sh
+++ b/travis/check-image-icc-profiles.sh
@@ -13,7 +13,7 @@ set -e
DB=$1
TRAVIS_PHP_VERSION=$2
-if [ "$TRAVIS_PHP_VERSION" == "5.5" -a "$DB" == "mysqli" ]
+if [ "$TRAVIS_PHP_VERSION" == "5.3.3" -a "$DB" == "mysqli" ]
then
find . -type f -not -path './phpBB/vendor/*' -iregex '.*\.\(gif\|jpg\|jpeg\|png\)$' | \
parallel --gnu --keep-order 'phpBB/develop/strip_icc_profiles.sh {}'
diff --git a/travis/check-sami-parse-errors.sh b/travis/check-sami-parse-errors.sh
new file mode 100755
index 0000000000..847c54a61a
--- /dev/null
+++ b/travis/check-sami-parse-errors.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+#
+# This file is part of the phpBB Forum Software package.
+#
+# @copyright (c) phpBB Limited <https://www.phpbb.com>
+# @license GNU General Public License, version 2 (GPL-2.0)
+#
+# For full copyright and license information, please see
+# the docs/CREDITS.txt file.
+#
+set -e
+
+DB=$1
+TRAVIS_PHP_VERSION=$2
+
+if [ "$TRAVIS_PHP_VERSION" == "5.3.3" -a "$DB" == "mysqli" ]
+then
+ # Workarounds for
+ # https://github.com/fabpot/Sami/issues/116
+ # and
+ # https://github.com/fabpot/Sami/issues/117
+ errors=$(
+ unbuffer phpBB/vendor/bin/sami.php parse travis/sami.conf.php -v | \
+ sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" | \
+ grep "ERROR: " | \
+ tee /dev/tty | \
+ wc -l
+ )
+ if [ "$errors" != "0" ]
+ then
+ exit 1
+ fi
+fi
diff --git a/travis/sami.conf.php b/travis/sami.conf.php
new file mode 100644
index 0000000000..8e7cfa42e9
--- /dev/null
+++ b/travis/sami.conf.php
@@ -0,0 +1,19 @@
+<?php
+/**
+*
+* This file is part of the phpBB Forum Software package.
+*
+* @copyright (c) phpBB Limited <https://www.phpbb.com>
+* @license GNU General Public License, version 2 (GPL-2.0)
+*
+* For full copyright and license information, please see
+* the docs/CREDITS.txt file.
+*
+*/
+
+require __DIR__ . '/../build/' . basename(__FILE__);
+
+// Removing the versions array key will make Sami use the current branch.
+unset($config['versions']);
+
+return new Sami\Sami($iterator, $config);
diff --git a/travis/setup-php-extensions.sh b/travis/setup-php-extensions.sh
index 3655d6e952..c0defe44ef 100755
--- a/travis/setup-php-extensions.sh
+++ b/travis/setup-php-extensions.sh
@@ -42,12 +42,6 @@ function install_php_extension
php_ini_file=$(find_php_ini)
-# disable broken opcache on PHP 5.5.7 and 5.5.8
-if [ `php -r "echo (int) version_compare(PHP_VERSION, '5.5.9', '<');"` == "1" ]
-then
- sed -i '/opcache.so/d' "$php_ini_file"
-fi
-
# apc
if [ `php -r "echo (int) version_compare(PHP_VERSION, '5.5.0-dev', '<');"` == "1" ]
then
diff --git a/travis/setup-phpbb.sh b/travis/setup-phpbb.sh
index e2cf6eeda2..d829772196 100755
--- a/travis/setup-phpbb.sh
+++ b/travis/setup-phpbb.sh
@@ -14,9 +14,10 @@ set -x
DB=$1
TRAVIS_PHP_VERSION=$2
-if [ "$TRAVIS_PHP_VERSION" == "5.5" -a "$DB" == "mysqli" ]
+if [ "$TRAVIS_PHP_VERSION" == "5.3.3" -a "$DB" == "mysqli" ]
then
travis/setup-exiftool.sh
+ travis/setup-unbuffer.sh
fi
if [ "$DB" == "mariadb" ]
diff --git a/travis/setup-unbuffer.sh b/travis/setup-unbuffer.sh
new file mode 100755
index 0000000000..4423d1b8b6
--- /dev/null
+++ b/travis/setup-unbuffer.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+#
+# This file is part of the phpBB Forum Software package.
+#
+# @copyright (c) phpBB Limited <https://www.phpbb.com>
+# @license GNU General Public License, version 2 (GPL-2.0)
+#
+# For full copyright and license information, please see
+# the docs/CREDITS.txt file.
+#
+set -e
+
+sudo apt-get update
+sudo apt-get install -y expect-dev
diff --git a/travis/setup-webserver.sh b/travis/setup-webserver.sh
index ea1929a5b0..ab045431cc 100755
--- a/travis/setup-webserver.sh
+++ b/travis/setup-webserver.sh
@@ -72,8 +72,11 @@ echo "
index index.php index.html;
location ~ \.php {
- fastcgi_pass unix:$APP_SOCK;
- include fastcgi_params;
+ include fastcgi_params;
+ fastcgi_split_path_info ^(.+\.php)(/.*)$;
+ fastcgi_param PATH_INFO \$fastcgi_path_info;
+ fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name;
+ fastcgi_pass unix:$APP_SOCK;
}
}
" | sudo tee $NGINX_CONF > /dev/null