aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.editorconfig18
-rw-r--r--build/build.xml6
-rw-r--r--phpBB/adm/style/acp_groups.html1
-rw-r--r--phpBB/adm/style/acp_users_avatar.html1
-rw-r--r--phpBB/config/auth_providers.yml2
-rw-r--r--phpBB/config/captcha.yml62
-rw-r--r--phpBB/config/parameters.yml2
-rw-r--r--phpBB/config/services.yml4
-rw-r--r--phpBB/docs/CHANGELOG.html189
-rw-r--r--phpBB/download/file.php194
-rw-r--r--phpBB/includes/acp/acp_captcha.php17
-rw-r--r--phpBB/includes/acp/acp_groups.php22
-rw-r--r--phpBB/includes/acp/acp_users.php60
-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/functions.php140
-rw-r--r--phpBB/includes/functions_acp.php31
-rw-r--r--phpBB/includes/functions_admin.php18
-rw-r--r--phpBB/includes/functions_content.php1
-rw-r--r--phpBB/includes/functions_display.php38
-rw-r--r--phpBB/includes/functions_download.php21
-rw-r--r--phpBB/includes/functions_messenger.php12
-rw-r--r--phpBB/includes/functions_posting.php30
-rw-r--r--phpBB/includes/functions_privmsgs.php14
-rw-r--r--phpBB/includes/functions_transfer.php2
-rw-r--r--phpBB/includes/functions_user.php8
-rw-r--r--phpBB/includes/mcp/mcp_pm_reports.php2
-rw-r--r--phpBB/includes/mcp/mcp_queue.php47
-rw-r--r--phpBB/includes/mcp/mcp_reports.php10
-rw-r--r--phpBB/includes/mcp/mcp_warn.php4
-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_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/index.php2
-rw-r--r--phpBB/install/install_install.php2
-rw-r--r--phpBB/install/schemas/schema.json33
-rw-r--r--phpBB/install/schemas/schema_data.sql12
-rw-r--r--phpBB/language/en/cli.php3
-rw-r--r--phpBB/language/en/common.php4
-rw-r--r--phpBB/phpbb/auth/provider/db.php20
-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.php1
-rw-r--r--phpBB/phpbb/avatar/manager.php36
-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/console/command/extension/show.php8
-rw-r--r--phpBB/phpbb/controller/provider.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.php122
-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/soft_delete_mod_convert.php2
-rw-r--r--phpBB/phpbb/db/migration/data/v310/topic_sort_username.php44
-rw-r--r--phpBB/phpbb/db/migrator.php54
-rw-r--r--phpBB/phpbb/notification/manager.php6
-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.php2
-rw-r--r--phpBB/phpbb/notification/type/approve_topic.php2
-rw-r--r--phpBB/phpbb/notification/type/bookmark.php2
-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.php2
-rw-r--r--phpBB/phpbb/notification/type/post.php2
-rw-r--r--phpBB/phpbb/notification/type/post_in_queue.php4
-rw-r--r--phpBB/phpbb/notification/type/quote.php2
-rw-r--r--phpBB/phpbb/notification/type/report_pm.php4
-rw-r--r--phpBB/phpbb/notification/type/report_pm_closed.php2
-rw-r--r--phpBB/phpbb/notification/type/report_post.php4
-rw-r--r--phpBB/phpbb/notification/type/report_post_closed.php2
-rw-r--r--phpBB/phpbb/notification/type/topic.php2
-rw-r--r--phpBB/phpbb/notification/type/topic_in_queue.php4
-rw-r--r--phpBB/phpbb/profilefields/type/type_googleplus.php2
-rw-r--r--phpBB/phpbb/session.php8
-rw-r--r--phpBB/phpbb/user.php11
-rw-r--r--phpBB/posting.php3
-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/memberlist_im.html2
-rw-r--r--phpBB/styles/prosilver/template/memberlist_view.html4
-rw-r--r--phpBB/styles/prosilver/template/posting_editor.html4
-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.html14
-rw-r--r--phpBB/styles/prosilver/template/viewonline_whois.html8
-rw-r--r--phpBB/styles/prosilver/template/viewtopic_body.html18
-rw-r--r--phpBB/styles/prosilver/template/viewtopic_topic_tools.html14
-rw-r--r--phpBB/styles/prosilver/theme/bidi.css44
-rw-r--r--phpBB/styles/prosilver/theme/buttons.css8
-rw-r--r--phpBB/styles/prosilver/theme/colours.css2
-rw-r--r--phpBB/styles/prosilver/theme/common.css7
-rw-r--r--phpBB/styles/prosilver/theme/content.css15
-rw-r--r--phpBB/styles/prosilver/theme/images/created_by.jpgbin52977 -> 0 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/plupload.css6
-rw-r--r--phpBB/styles/prosilver/theme/responsive.css34
-rw-r--r--phpBB/styles/subsilver2/style.cfg4
-rw-r--r--phpBB/styles/subsilver2/template/ucp_groups_manage.html1
-rw-r--r--phpBB/styles/subsilver2/template/ucp_profile_avatar.html1
-rw-r--r--phpBB/viewtopic.php47
-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.php70
-rw-r--r--tests/console/config/config_test.php251
-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.php2
-rw-r--r--tests/content_visibility/get_forums_visibility_sql_test.php2
-rw-r--r--tests/content_visibility/get_global_visibility_sql_test.php2
-rw-r--r--tests/content_visibility/get_visibility_sql_test.php2
-rw-r--r--tests/content_visibility/set_post_visibility_test.php4
-rw-r--r--tests/content_visibility/set_topic_visibility_test.php2
-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/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/manager_test.php2
-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_controller_test.php14
-rw-r--r--tests/functional/fixtures/ext/foo/foo/composer.json24
-rw-r--r--tests/functional/fixtures/ext/foo/foo/config/resource.yml3
-rw-r--r--tests/functional/fixtures/ext/foo/foo/config/routing.yml3
-rw-r--r--tests/functional/fixtures/ext/foo/foo/config/services.yml3
-rw-r--r--tests/functional/fixtures/ext/foo/foo/controller/controller.php13
-rw-r--r--tests/functional/fixtures/ext/foo/foo/ext.php8
-rw-r--r--tests/functional/notification_test.php16
-rw-r--r--tests/functions/generate_string_list.php2
-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.php2
-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.php8
-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
218 files changed, 3013 insertions, 2240 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/build/build.xml b/build/build.xml
index ca71aae924..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}" />
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_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/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/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 a9f9f5ed19..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:
@@ -346,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/download/file.php b/phpBB/download/file.php
index a521f413ed..fd94e78fee 100644
--- a/phpBB/download/file.php
+++ b/phpBB/download/file.php
@@ -139,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);
@@ -158,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');
@@ -186,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');
@@ -214,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'])
{
@@ -261,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']));
@@ -323,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_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_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_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/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/functions.php b/phpBB/includes/functions.php
index 3fe13ae1e1..df613682a7 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)
{
@@ -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'])
@@ -2540,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 : '';
@@ -2551,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,
));
@@ -2730,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
@@ -2844,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();
@@ -2956,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);
@@ -3017,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(
@@ -3377,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)
{
@@ -3407,8 +3430,6 @@ function phpbb_ip_normalise($address)
*
* @return mixed false on failure,
* string otherwise
-*
-* @author APTX
*/
function phpbb_inet_ntop($in_addr)
{
@@ -3478,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)
{
@@ -3559,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')
{
@@ -4647,7 +4664,7 @@ function phpbb_get_group_avatar($user_row, $alt = 'GROUP_AVATAR', $ignore_config
/**
* Get avatar
*
-* @param array $row Row cleaned by \phpbb\avatar\driver\driver::clean_row
+* @param array $row Row cleaned by \phpbb\avatar\manager::clean_row
* @param string $alt Optional language string for alt tag within image, can be a language key or text
* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP
*
@@ -4881,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]))
@@ -5041,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.
*
@@ -5051,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;
@@ -5095,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();
@@ -5136,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);
}
@@ -5174,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 abf726581d..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',
+ );
- header('Cache-Control: private, no-cache="set-cookie"');
- header('Expires: 0');
- header('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)));
+
+ 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'),
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 62f218cf60..78137d075b 100644
--- a/phpBB/includes/functions_display.php
+++ b/phpBB/includes/functions_display.php
@@ -1421,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 file 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_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_posting.php b/phpBB/includes/functions_posting.php
index bc35f4e76b..768011fa5b 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -2256,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;
@@ -2275,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;
}
@@ -2288,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':
@@ -2310,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':
diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php
index 488f46a398..29cea477e4 100644
--- a/phpBB/includes/functions_privmsgs.php
+++ b/phpBB/includes/functions_privmsgs.php
@@ -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_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_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 54b31c642a..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);
@@ -700,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)
{
@@ -720,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?
@@ -744,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);
}
}
}
@@ -920,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
@@ -929,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);
}
}
}
@@ -1177,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?
@@ -1227,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/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_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/index.php b/phpBB/install/index.php
index 395aff6c7d..2e497da3db 100644
--- a/phpBB/install/index.php
+++ b/phpBB/install/index.php
@@ -240,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/schemas/schema.json b/phpBB/install/schemas/schema.json
index 1a9b9b62b7..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",
""
@@ -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/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/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/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 f5ba50451a..003b23659f 100644
--- a/phpBB/phpbb/avatar/driver/upload.php
+++ b/phpBB/phpbb/avatar/driver/upload.php
@@ -129,7 +129,6 @@ class upload extends \phpbb\avatar\driver\driver
}
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/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/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/controller/provider.php b/phpBB/phpbb/controller/provider.php
index fffd4f0428..7e26848290 100644
--- a/phpBB/phpbb/controller/provider.php
+++ b/phpBB/phpbb/controller/provider.php
@@ -73,7 +73,7 @@ class provider
$this->routes = new RouteCollection;
foreach ($this->routing_files as $file_path)
{
- $loader = new YamlFileLoader(new FileLocator($base_path));
+ $loader = new YamlFileLoader(new FileLocator(phpbb_realpath($base_path)));
$this->routes->addCollection($loader->load($file_path));
}
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..f749b32119
--- /dev/null
+++ b/phpBB/phpbb/db/migration/data/v310/notifications_use_full_name.php
@@ -0,0 +1,122 @@
+<?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()
+ {
+ $sql = 'UPDATE ' . NOTIFICATION_TYPES_TABLE . '
+ SET notification_type_enabled = 0
+ WHERE ' . $this->db->sql_in_set('notification_type_name', $this->notification_types, true);
+ $this->db->sql_query($sql);
+
+ 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/soft_delete_mod_convert.php b/phpBB/phpbb/db/migration/data/v310/soft_delete_mod_convert.php
index 6335c75398..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
@@ -121,7 +121,7 @@ class soft_delete_mod_convert extends \phpbb\db\migration\migration
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/migrator.php b/phpBB/phpbb/db/migrator.php
index 8bc63e564a..44bea3c5d2 100644
--- a/phpBB/phpbb/db/migrator.php
+++ b/phpBB/phpbb/db/migrator.php
@@ -715,60 +715,6 @@ class migrator
}
/**
- * Load migration data files from a directory
- *
- * @param \phpbb\finder $finder
- * @param string $path Path to migration data files
- * @param bool $check_fulfillable If TRUE (default), we will check
- * if all of the migrations are fulfillable after loading them.
- * If FALSE, we will not check. You SHOULD check at least once
- * to prevent errors (if including multiple directories, check
- * with the last call to prevent throwing errors unnecessarily).
- * @return array Array of migration names
- * @throws \phpbb\db\migration\exception
- */
- public function load_migrations(\phpbb\finder $finder, $path, $check_fulfillable = true)
- {
- if (!is_dir($path))
- {
- throw new \phpbb\db\migration\exception('DIRECTORY INVALID', $path);
- }
-
- $migrations = array();
-
- $files = $finder
- ->extension_directory("/")
- ->find_from_paths(array('/' => $path));
- foreach ($files as $file)
- {
- $migrations[$file['path'] . $file['filename']] = '';
- }
- $migrations = $finder->get_classes_from_files($migrations);
-
- foreach ($migrations as $migration)
- {
- if (!in_array($migration, $this->migrations))
- {
- $this->migrations[] = $migration;
- }
- }
-
- if ($check_fulfillable)
- {
- foreach ($this->migrations as $name)
- {
- $unfulfillable = $this->unfulfillable($name);
- if ($unfulfillable !== false)
- {
- throw new \phpbb\db\migration\exception('MIGRATION_NOT_FULFILLABLE', $name, $unfulfillable);
- }
- }
- }
-
- return $this->migrations;
- }
-
- /**
* Creates the migrations table if it does not exist.
* @return null
*/
diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php
index 5e4bab1530..81b450ebbd 100644
--- a/phpBB/phpbb/notification/manager.php
+++ b/phpBB/phpbb/notification/manager.php
@@ -570,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())),
);
}
}
@@ -851,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);
@@ -865,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 22c9076adc..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';
}
/**
diff --git a/phpBB/phpbb/notification/type/approve_topic.php b/phpBB/phpbb/notification/type/approve_topic.php
index 77e53a0064..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';
}
/**
diff --git a/phpBB/phpbb/notification/type/bookmark.php b/phpBB/phpbb/notification/type/bookmark.php
index 21180b3b53..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';
}
/**
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 8445ca4b22..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';
}
/**
diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php
index 1eba4a6a88..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';
}
/**
diff --git a/phpBB/phpbb/notification/type/post_in_queue.php b/phpBB/phpbb/notification/type/post_in_queue.php
index 3bb1028619..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',
);
diff --git a/phpBB/phpbb/notification/type/quote.php b/phpBB/phpbb/notification/type/quote.php
index 5c3c822ec2..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';
}
/**
diff --git a/phpBB/phpbb/notification/type/report_pm.php b/phpBB/phpbb/notification/type/report_pm.php
index 14a328e104..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',
);
diff --git a/phpBB/phpbb/notification/type/report_pm_closed.php b/phpBB/phpbb/notification/type/report_pm_closed.php
index de7bf74a97..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';
}
/**
diff --git a/phpBB/phpbb/notification/type/report_post.php b/phpBB/phpbb/notification/type/report_post.php
index bec59df9d5..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',
);
diff --git a/phpBB/phpbb/notification/type/report_post_closed.php b/phpBB/phpbb/notification/type/report_post_closed.php
index cd1400f8fa..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';
}
/**
diff --git a/phpBB/phpbb/notification/type/topic.php b/phpBB/phpbb/notification/type/topic.php
index af199fb765..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';
}
/**
diff --git a/phpBB/phpbb/notification/type/topic_in_queue.php b/phpBB/phpbb/notification/type/topic_in_queue.php
index aef1487d77..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',
);
diff --git a/phpBB/phpbb/profilefields/type/type_googleplus.php b/phpBB/phpbb/profilefields/type/type_googleplus.php
index 887baa3de1..e6729b1935 100644
--- a/phpBB/phpbb/profilefields/type/type_googleplus.php
+++ b/phpBB/phpbb/profilefields/type/type_googleplus.php
@@ -40,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/session.php b/phpBB/phpbb/session.php
index 5a0d7c0031..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 . '
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 6638caa94b..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);
}
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/memberlist_im.html b/phpBB/styles/prosilver/template/memberlist_im.html
index 4fb383a0ba..bc71aa0969 100644
--- a/phpBB/styles/prosilver/template/memberlist_im.html
+++ b/phpBB/styles/prosilver/template/memberlist_im.html
@@ -1,6 +1,6 @@
<!-- INCLUDE simple_header.html -->
-<h2 class="solo">{L_SEND_IM}</h2>
+<h2>{L_SEND_IM}</h2>
<form method="post" action="{S_IM_ACTION}">
diff --git a/phpBB/styles/prosilver/template/memberlist_view.html b/phpBB/styles/prosilver/template/memberlist_view.html
index ffa57f9cc8..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>
@@ -65,7 +65,7 @@
<dl class="details">
<!-- IF U_EMAIL --><dt>{L_EMAIL_ADDRESS}{L_COLON}</dt> <dd><a href="{U_EMAIL}">{L_SEND_EMAIL_USER}</a></dd><!-- ENDIF -->
<!-- IF U_PM --><dt>{L_PM}{L_COLON}</dt> <dd><a href="{U_PM}">{L_SEND_PRIVATE_MESSAGE}</a></dd><!-- ENDIF -->
- <!-- IF U_JABBER and S_JABBER_ENABLED --><dt>{L_JABBER}{L_COLON}</dt> <dd><a href="{U_JABBER}" onclick="popup(this.href, 550, 320); return false;">{L_SEND_JABBER_MESSAGE}</a></dd><!-- ELSEIF USER_JABBER --><dt>{L_JABBER}{L_COLON}</dt> <dd>{USER_JABBER}</dd><!-- ENDIF -->
+ <!-- IF U_JABBER and S_JABBER_ENABLED --><dt>{L_JABBER}{L_COLON}</dt> <dd><a href="{U_JABBER}" onclick="popup(this.href, 750, 320); return false;">{L_SEND_JABBER_MESSAGE}</a></dd><!-- ELSEIF USER_JABBER --><dt>{L_JABBER}{L_COLON}</dt> <dd>{USER_JABBER}</dd><!-- ENDIF -->
<!-- BEGIN custom_fields -->
<!-- IF custom_fields.S_PROFILE_CONTACT -->
<dt>{custom_fields.PROFILE_FIELD_NAME}{L_COLON}</dt>
diff --git a/phpBB/styles/prosilver/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html
index 25e3be3bcb..333e61008e 100644
--- a/phpBB/styles/prosilver/template/posting_editor.html
+++ b/phpBB/styles/prosilver/template/posting_editor.html
@@ -43,7 +43,7 @@
<!-- END smiley -->
<!-- ENDIF -->
<!-- IF S_SHOW_SMILEY_LINK and S_SMILIES_ALLOWED-->
- <br /><a href="{U_MORE_SMILIES}" onclick="popup(this.href, 300, 350, '_phpbbsmilies'); return false;">{L_MORE_SMILIES}</a>
+ <br /><a href="{U_MORE_SMILIES}" onclick="popup(this.href, 750, 350, '_phpbbsmilies'); return false;">{L_MORE_SMILIES}</a>
<!-- ENDIF -->
<!-- IF BBCODE_STATUS -->
@@ -107,7 +107,7 @@
<a href="#tabs" data-subpanel="attach-panel" role="tab" aria-controls="attach-panel">
{L_ATTACHMENTS} <strong id="file-total-progress"><strong id="file-total-progress-bar"></strong></strong>
</a>
- </li>
+ </li>
<!-- ENDIF -->
<!-- IF S_SHOW_POLL_BOX || S_POLL_DELETE -->
<li id="poll-panel-tab" class="tab">
diff --git a/phpBB/styles/prosilver/template/simple_header.html b/phpBB/styles/prosilver/template/simple_header.html
index 0831d5f9dc..610e5d5582 100644
--- a/phpBB/styles/prosilver/template/simple_header.html
+++ b/phpBB/styles/prosilver/template/simple_header.html
@@ -36,6 +36,6 @@
<!-- EVENT simple_header_body_before -->
-<div id="simple-wrap">
+<div id="wrap">
<a id="top" class="anchor" accesskey="t"></a>
<div id="page-body">
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 62993e9b4e..ddd95780d7 100644
--- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html
+++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html
@@ -14,7 +14,7 @@
<!-- ENDIF -->
-<div id="post-{MESSAGE_ID}" class="post pm<!-- IF S_POST_UNAPPROVED or S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF S_ONLINE --> online<!-- ENDIF -->">
+<div id="post-{MESSAGE_ID}" class="post pm has-profile<!-- IF S_POST_UNAPPROVED or S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF S_ONLINE --> online<!-- ENDIF -->">
<div class="inner">
<dl class="postprofile" id="profile{MESSAGE_ID}">
@@ -55,7 +55,7 @@
<!-- IF REMAINDER eq 0 -->
<div>
<!-- ENDIF -->
- <a href="<!-- IF contact.U_CONTACT -->{contact.U_CONTACT}<!-- ELSE -->{contact.U_PROFILE_AUTHOR}<!-- ENDIF -->" title="{contact.NAME}"<!-- IF $S_LAST_CELL --> class="last-cell"<!-- ENDIF --><!-- IF contact.ID eq 'jabber' --> onclick="popup(this.href, 550, 320); return false;"<!-- ENDIF -->>
+ <a href="<!-- IF contact.U_CONTACT -->{contact.U_CONTACT}<!-- ELSE -->{contact.U_PROFILE_AUTHOR}<!-- ENDIF -->" title="{contact.NAME}"<!-- IF $S_LAST_CELL --> class="last-cell"<!-- ENDIF --><!-- IF contact.ID eq 'jabber' --> onclick="popup(this.href, 750, 320); return false;"<!-- ENDIF -->>
<span class="contact-icon {contact.ID}-icon">{contact.NAME}</span>
</a>
<!-- IF REMAINDER eq 3 or contact.S_LAST_ROW -->
@@ -113,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/viewonline_whois.html b/phpBB/styles/prosilver/template/viewonline_whois.html
index 031f18afdc..5d780490da 100644
--- a/phpBB/styles/prosilver/template/viewonline_whois.html
+++ b/phpBB/styles/prosilver/template/viewonline_whois.html
@@ -1,14 +1,10 @@
<!-- INCLUDE simple_header.html -->
-<h2 class="whois-title">{L_WHOIS}</h2>
+<h2>{L_WHOIS}</h2>
<div class="panel">
<div class="inner">
-
- <div class="postbody"><div class="content">
- <pre>{WHOIS}</pre>
- </div></div>
-
+ <pre>{WHOIS}</pre>
</div>
</div>
<a href="#" onclick="window.close(); return false;">{L_CLOSE_WINDOW}</a>
diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html
index 810c30ed15..a51d65ae99 100644
--- a/phpBB/styles/prosilver/template/viewtopic_body.html
+++ b/phpBB/styles/prosilver/template/viewtopic_body.html
@@ -51,7 +51,7 @@
<!-- IF .pagination or TOTAL_POSTS -->
<div class="pagination">
- <!-- IF U_VIEW_UNREAD_POST and not S_IS_BOT --><a href="{U_VIEW_UNREAD_POST}" class="mark">{L_VIEW_UNREAD_POST}</a> &bull; <!-- ENDIF -->{TOTAL_POSTS}
+ <!-- IF U_VIEW_UNREAD_POST and not S_IS_BOT --><a href="{U_VIEW_UNREAD_POST}" class="mark">{L_VIEW_UNREAD_POST}</a> &bull; <!-- ENDIF -->{TOTAL_POSTS}
<!-- IF .pagination -->
<!-- INCLUDE pagination.html -->
<!-- ELSE -->
@@ -120,7 +120,7 @@
<!-- IF postrow.S_FIRST_UNREAD -->
<a id="unread" class="anchor"<!-- IF S_UNREAD_VIEW --> data-url="{postrow.U_MINI_POST}"<!-- ENDIF -->></a>
<!-- ENDIF -->
- <div id="p{postrow.POST_ID}" class="post <!-- IF postrow.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF postrow.S_UNREAD_POST --> unreadpost<!-- ENDIF --><!-- IF postrow.S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF postrow.S_POST_DELETED --> deleted<!-- ENDIF --><!-- IF postrow.S_ONLINE and not postrow.S_POST_HIDDEN --> online<!-- ENDIF --><!-- IF postrow.POSTER_WARNINGS --> warned<!-- ENDIF -->">
+ <div id="p{postrow.POST_ID}" class="post has-profile <!-- IF postrow.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF postrow.S_UNREAD_POST --> unreadpost<!-- ENDIF --><!-- IF postrow.S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF postrow.S_POST_DELETED --> deleted<!-- ENDIF --><!-- IF postrow.S_ONLINE and not postrow.S_POST_HIDDEN --> online<!-- ENDIF --><!-- IF postrow.POSTER_WARNINGS --> warned<!-- ENDIF -->">
<div class="inner">
<dl class="postprofile" id="profile{postrow.POST_ID}"<!-- IF postrow.S_POST_HIDDEN --> style="display: none;"<!-- ENDIF -->>
@@ -169,7 +169,7 @@
<!-- IF REMAINDER eq 0 -->
<div>
<!-- ENDIF -->
- <a href="<!-- IF postrow.contact.U_CONTACT -->{postrow.contact.U_CONTACT}<!-- ELSE -->{postrow.contact.U_PROFILE_AUTHOR}<!-- ENDIF -->" title="{postrow.contact.NAME}"<!-- IF $S_LAST_CELL --> class="last-cell"<!-- ENDIF --><!-- IF postrow.contact.ID eq 'jabber' --> onclick="popup(this.href, 550, 320); return false;"<!-- ENDIF -->>
+ <a href="<!-- IF postrow.contact.U_CONTACT -->{postrow.contact.U_CONTACT}<!-- ELSE -->{postrow.contact.U_PROFILE_AUTHOR}<!-- ENDIF -->" title="{postrow.contact.NAME}"<!-- IF $S_LAST_CELL --> class="last-cell"<!-- ENDIF --><!-- IF postrow.contact.ID eq 'jabber' --> onclick="popup(this.href, 750, 320); return false;"<!-- ENDIF -->>
<span class="contact-icon {postrow.contact.ID}-icon">{postrow.contact.NAME}</span>
</a>
<!-- IF REMAINDER eq 3 or postrow.contact.S_LAST_ROW -->
@@ -278,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>
@@ -371,7 +361,7 @@
<!-- IF .pagination or TOTAL_POSTS -->
<div class="pagination">
- {TOTAL_POSTS}
+ {TOTAL_POSTS}
<!-- IF .pagination -->
<!-- INCLUDE pagination.html -->
<!-- ELSE -->
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 f6e490f82a..46fbbadef7 100644
--- a/phpBB/styles/prosilver/theme/bidi.css
+++ b/phpBB/styles/prosilver/theme/bidi.css
@@ -112,6 +112,15 @@
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: 18px;
@@ -455,6 +464,11 @@ li.breadcrumbs span:first-child > a {
float: right;
}
+.rtl .has-profile .postbody h3 {
+ margin-right: 0;
+ margin-left: 180px;
+}
+
.rtl p.post-notice {
padding-left: 5px;
padding-right: 26px;
@@ -601,8 +615,8 @@ 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 +626,12 @@ 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;
@@ -641,6 +660,11 @@ li.breadcrumbs span:first-child > a {
float: left;
}
+.rtl .has-profile .post-buttons {
+ left: 0;
+ right: auto;
+}
+
.rtl .post-buttons li {
float: right;
}
@@ -915,16 +939,6 @@ 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
----------------------------------------*/
@@ -1086,4 +1100,8 @@ li.breadcrumbs span:first-child > a {
margin-left: 5px;
margin-right: 0;
}
+
+ .rtl .has-profile .post-buttons {
+ left: 20px;
+ }
}
diff --git a/phpBB/styles/prosilver/theme/buttons.css b/phpBB/styles/prosilver/theme/buttons.css
index b45aae5672..a08b49a81c 100644
--- a/phpBB/styles/prosilver/theme/buttons.css
+++ b/phpBB/styles/prosilver/theme/buttons.css
@@ -177,6 +177,14 @@ ul.linklist.bulletin > li.small-icon:before {
margin-top: 2px;
}
+.has-profile .post-buttons {
+ float: none;
+ position: absolute;
+ margin: 0;
+ right: 0;
+ top: 5px;
+}
+
.post-buttons > li {
float: left;
margin-right: 3px;
diff --git a/phpBB/styles/prosilver/theme/colours.css b/phpBB/styles/prosilver/theme/colours.css
index 82542c8d86..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;
}
diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css
index 45cb88890d..a3a4157704 100644
--- a/phpBB/styles/prosilver/theme/common.css
+++ b/phpBB/styles/prosilver/theme/common.css
@@ -189,10 +189,6 @@ ol ol ul, ol ul ul, ul ol ul, ul ul ul {
}
}
-#simple-wrap {
- padding: 6px 0;
-}
-
#page-body {
margin: 4px 0;
clear: both;
@@ -303,6 +299,7 @@ ol ol ul, ol ul ul, ul ol ul, ul ul ul {
background-repeat: no-repeat;
background-position: 100% 0;
border-radius: 7px;
+ position: relative;
}
.rowbg {
@@ -768,6 +765,7 @@ table.info tbody th {
float: left;
width: auto;
text-align: left;
+ max-width: 100%;
}
.left-box.profile-details {
@@ -778,6 +776,7 @@ table.info tbody th {
float: right;
width: auto;
text-align: right;
+ max-width: 100%;
}
dl.details {
diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css
index 8b84545a2c..fa23a665f1 100644
--- a/phpBB/styles/prosilver/theme/content.css
+++ b/phpBB/styles/prosilver/theme/content.css
@@ -233,6 +233,7 @@ dd.option {
line-height: 1.48em;
width: 76%;
float: left;
+ position: relative;
}
.postbody .ignore {
@@ -249,7 +250,8 @@ dd.option {
float: left;
font-size: 1.5em;
padding: 2px 0 0 0;
- margin: 0 0 0.3em 0 !important;
+ margin-top: 0 !important;
+ margin-bottom: 0.3em !important;
text-transform: none;
border: none;
font-family: "Trebuchet MS", Verdana, Helvetica, Arial, sans-serif;
@@ -261,6 +263,12 @@ dd.option {
vertical-align: bottom;
}
+.has-profile .postbody h3 {
+ /* If there is a post-profile, we position the post-buttons differently */
+ float: none !important;
+ margin-right: 180px;
+}
+
.postbody .content {
font-size: 1.3em;
overflow-x: auto;
@@ -759,6 +767,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/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/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/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 b9cbd4cdfb..fc39e03da7 100644
--- a/phpBB/styles/prosilver/theme/responsive.css
+++ b/phpBB/styles/prosilver/theme/responsive.css
@@ -398,6 +398,10 @@ fieldset.polls dd.resultbar, fieldset.polls dd.poll_option_percent {
/* Post
----------------------------------------*/
+.postbody {
+ position: inherit;
+}
+
.postprofile, .postbody, .search .postbody {
display: block;
width: auto;
@@ -412,6 +416,7 @@ fieldset.polls dd.resultbar, fieldset.polls dd.poll_option_percent {
padding-bottom: 5px;
margin: 0;
margin-bottom: 5px;
+ min-height: 40px;
overflow: hidden;
}
@@ -443,12 +448,18 @@ fieldset.polls dd.resultbar, fieldset.polls dd.poll_option_percent {
max-height: 32px;
}
-@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi), (min-resolution: 1.5dppx)
-{
- /* Scale online image for HD displays */
- .online {
- background-size: 40px;
- }
+.has-profile .postbody h3 {
+ margin-left: 0 !important;
+ margin-right: 0 !important;
+}
+
+.has-profile .post-buttons {
+ right: 20px;
+ top: 15px;
+}
+
+.online {
+ background-size: 40px;
}
/* Misc stuff
@@ -466,12 +477,6 @@ p.rightside {
margin-bottom: 0;
}
-fieldset.quickmod {
- width: auto;
- float: none;
- text-align: center;
-}
-
fieldset.display-options label {
display: block;
clear: both;
@@ -509,14 +514,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/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/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_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/viewtopic.php b/phpBB/viewtopic.php
index 3d1bce1ccc..20fea19f7c 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -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 d8099b40d4..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(
@@ -52,7 +57,7 @@ class phpbb_avatar_manager_test extends \phpbb_test_case
$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'));
@@ -67,24 +72,26 @@ class phpbb_avatar_manager_test extends \phpbb_test_case
{
if ($driver !== 'upload')
{
- $cur_avatar = $this->getMock('\phpbb\avatar\driver\\' . $driver, array('get_name'), array($config, $phpbb_root_path, $phpEx, $path_helper, $cache));
+ $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($config, $phpbb_root_path, $phpEx, $path_helper, $guesser, $cache));
+ $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()
@@ -122,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),
@@ -196,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(
@@ -266,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'),
@@ -287,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/console/config/config_test.php b/tests/console/config/config_test.php
new file mode 100644
index 0000000000..7c098af004
--- /dev/null
+++ b/tests/console/config/config_test.php
@@ -0,0 +1,251 @@
+<?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 Symfony\Component\Console\Application;
+use Symfony\Component\Console\Tester\CommandTester;
+
+class phpbb_console_command_config_test extends phpbb_test_case
+{
+ protected $config;
+ protected $command_name;
+ protected $user;
+
+ public function setUp()
+ {
+ $this->config = new \phpbb\config\config(array());
+
+ $this->user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime'));
+ $this->user->method('lang')->will($this->returnArgument(0));
+ }
+
+ public function test_set_dynamic()
+ {
+ $this->assertEmpty($this->config);
+
+ $command_tester = $this->get_command_tester('set');
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'test_key',
+ 'value' => 'test_value',
+ '--dynamic' => true,
+ ));
+
+ $this->assertSame($this->config['test_key'], 'test_value');
+ }
+
+ public function test_set_no_dynamic()
+ {
+ $this->assertEmpty($this->config);
+
+ $command_tester = $this->get_command_tester('set');
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'test_key',
+ 'value' => 'test_value',
+ '--dynamic' => false,
+ ));
+
+ $this->assertSame($this->config['test_key'], 'test_value');
+ }
+
+ public function test_set_atomic_dynamic()
+ {
+ $this->assertEmpty($this->config);
+
+ $this->config->set('test_key', 'old_value', true);
+ $this->assertSame($this->config['test_key'], 'old_value');
+
+ $command_tester = $this->get_command_tester('set_atomic');
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'test_key',
+ 'old' => 'old_value',
+ 'new' => 'new_value',
+ '--dynamic' => true,
+ ));
+
+ $this->assertSame($this->config['test_key'], 'new_value');
+ }
+
+ public function test_set_atomic_no_dynamic()
+ {
+ $this->assertEmpty($this->config);
+
+ $this->config->set('test_key', 'old_value', false);
+ $this->assertSame($this->config['test_key'], 'old_value');
+
+ $command_tester = $this->get_command_tester('set_atomic');
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'test_key',
+ 'old' => 'old_value',
+ 'new' => 'new_value',
+ '--dynamic' => false,
+ ));
+
+ $this->assertSame($this->config['test_key'], 'new_value');
+ }
+
+ public function test_set_atomic_error_dynamic()
+ {
+ $this->assertEmpty($this->config);
+
+ $this->config->set('test_key', 'wrong_value', true);
+ $this->assertSame($this->config['test_key'], 'wrong_value');
+
+ $command_tester = $this->get_command_tester('set_atomic');
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'test_key',
+ 'old' => 'old_value',
+ 'new' => 'new_value',
+ '--dynamic' => true,
+ ));
+
+ $this->assertSame($this->config['test_key'], 'wrong_value');
+ }
+
+ public function test_get_no_new_line()
+ {
+ $this->config->set('test_key', 'test_value', false);
+ $this->assertSame($this->config['test_key'], 'test_value');
+
+ $command_tester = $this->get_command_tester('get');
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'test_key',
+ '--no-newline' => true,
+ ));
+
+ $this->assertSame($this->config['test_key'], $command_tester->getDisplay());
+ }
+
+ public function test_get_new_line()
+ {
+ $this->config->set('test_key', 'test_value', false);
+ $this->assertSame($this->config['test_key'], 'test_value');
+
+ $command_tester = $this->get_command_tester('get');
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'test_key',
+ '--no-newline' => false,
+ ));
+
+ $this->assertSame($this->config['test_key'] . PHP_EOL, $command_tester->getDisplay());
+ }
+
+ public function test_get_error()
+ {
+ $this->config->set('test_key', 'test_value', false);
+ $this->assertSame($this->config['test_key'], 'test_value');
+
+ $command_tester = $this->get_command_tester('get');
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'wrong_key',
+ '--no-newline' => false,
+ ));
+
+ $this->assertContains('CLI_CONFIG_NOT_EXISTS', $command_tester->getDisplay());
+ }
+
+ public function test_increment_dynamic()
+ {
+ $this->config->set('test_key', 0, false);
+ $this->assertSame($this->config['test_key'], 0);
+
+ $command_tester = $this->get_command_tester('increment');
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'test_key',
+ 'increment' => 2,
+ '--dynamic' => true,
+ ));
+
+ $this->assertContains('CLI_CONFIG_INCREMENT_SUCCESS', $command_tester->getDisplay());
+ $this->assertSame(2, $this->config['test_key']);
+ }
+
+ public function test_increment_no_dynamic()
+ {
+ $this->config->set('test_key', 0, false);
+ $this->assertSame($this->config['test_key'], 0);
+
+ $command_tester = $this->get_command_tester('increment');
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'test_key',
+ 'increment' => 2,
+ '--dynamic' => false,
+ ));
+
+ $this->assertContains('CLI_CONFIG_INCREMENT_SUCCESS', $command_tester->getDisplay());
+ $this->assertSame(2, $this->config['test_key']);
+ }
+
+ public function test_increment_no_set()
+ {
+ $this->assertEmpty($this->config);
+
+ $command_tester = $this->get_command_tester('increment');
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'test_key',
+ 'increment' => 2,
+ '--dynamic' => true,
+ ));
+
+ $this->assertContains('CLI_CONFIG_INCREMENT_SUCCESS', $command_tester->getDisplay());
+ $this->assertSame(2, $this->config['test_key']);
+ }
+
+ public function test_delete_ok()
+ {
+ $this->config->set('test_key', 'test_value', false);
+ $this->assertSame($this->config['test_key'], 'test_value');
+
+ $command_tester = $this->get_command_tester('delete');
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'test_key',
+ ));
+
+ $this->assertContains('CLI_CONFIG_DELETE_SUCCESS', $command_tester->getDisplay());
+ $this->assertEmpty($this->config);
+ }
+
+ public function test_delete_error()
+ {
+ $this->assertEmpty($this->config);
+
+ $command_tester = $this->get_command_tester('delete');
+ $command_tester->execute(array(
+ 'command' => $this->command_name,
+ 'key' => 'wrong_key',
+ ));
+
+ $this->assertContains('CLI_CONFIG_NOT_EXISTS', $command_tester->getDisplay());
+ $this->assertEmpty($this->config);
+ }
+
+ public function get_command_tester($class_name)
+ {
+ $command_complete_name = '\phpbb\console\command\config' . '\\' . $class_name;
+ $application = new Application();
+ $application->add(new $command_complete_name($this->user, $this->config));
+ $command = $application->find('config:' . $this->command_name);
+ $this->command_name = $command->getName();
+ return new CommandTester($command);
+ }
+}
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 7f31dd9b28..65dda3ce48 100644
--- a/tests/content_visibility/delete_post_test.php
+++ b/tests/content_visibility/delete_post_test.php
@@ -306,7 +306,7 @@ 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();
diff --git a/tests/content_visibility/get_forums_visibility_sql_test.php b/tests/content_visibility/get_forums_visibility_sql_test.php
index 7e4ce6577d..fe7ab36436 100644
--- a/tests/content_visibility/get_forums_visibility_sql_test.php
+++ b/tests/content_visibility/get_forums_visibility_sql_test.php
@@ -134,7 +134,7 @@ 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');
+ $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);
diff --git a/tests/content_visibility/get_global_visibility_sql_test.php b/tests/content_visibility/get_global_visibility_sql_test.php
index 082e0d76ab..43a80c792b 100644
--- a/tests/content_visibility/get_global_visibility_sql_test.php
+++ b/tests/content_visibility/get_global_visibility_sql_test.php
@@ -134,7 +134,7 @@ 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');
+ $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);
diff --git a/tests/content_visibility/get_visibility_sql_test.php b/tests/content_visibility/get_visibility_sql_test.php
index 2d4f24f1c6..f718e6c29a 100644
--- a/tests/content_visibility/get_visibility_sql_test.php
+++ b/tests/content_visibility/get_visibility_sql_test.php
@@ -81,7 +81,7 @@ 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');
+ $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);
diff --git a/tests/content_visibility/set_post_visibility_test.php b/tests/content_visibility/set_post_visibility_test.php
index a596b45714..ab79fbc2ee 100644
--- a/tests/content_visibility/set_post_visibility_test.php
+++ b/tests/content_visibility/set_post_visibility_test.php
@@ -124,7 +124,7 @@ 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');
+ $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);
@@ -174,7 +174,7 @@ 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');
+ $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);
diff --git a/tests/content_visibility/set_topic_visibility_test.php b/tests/content_visibility/set_topic_visibility_test.php
index 230474428c..4d02a55490 100644
--- a/tests/content_visibility/set_topic_visibility_test.php
+++ b/tests/content_visibility/set_topic_visibility_test.php
@@ -88,7 +88,7 @@ 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');
+ $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);
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/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/manager_test.php b/tests/extension/manager_test.php
index 1e43c2a0a3..5ec8e60a68 100644
--- a/tests/extension/manager_test.php
+++ b/tests/extension/manager_test.php
@@ -154,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_controller_test.php b/tests/functional/extension_controller_test.php
index 532a160a47..18eb9ad4c6 100644
--- a/tests/functional/extension_controller_test.php
+++ b/tests/functional/extension_controller_test.php
@@ -26,6 +26,8 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
'foo/bar/event/',
'foo/bar/language/en/',
'foo/bar/styles/prosilver/template/',
+ 'foo/foo/config/',
+ 'foo/foo/controller/',
);
static public function setUpBeforeClass()
@@ -65,6 +67,18 @@ class phpbb_functional_extension_controller_test extends phpbb_functional_test_c
}
/**
+ * Check a controller for extension foo/bar.
+ */
+ public function test_routing_resources()
+ {
+ $this->phpbb_extension_manager->enable('foo/foo');
+ $crawler = self::request('GET', 'app.php/foo/foo', array(), false);
+ self::assert_response_status_code();
+ $this->assertContains("foo/foo controller handle() method", $crawler->filter('body')->text());
+ $this->phpbb_extension_manager->purge('foo/foo');
+ }
+
+ /**
* Check the output of a controller using the template system
*/
public function test_controller_with_template()
diff --git a/tests/functional/fixtures/ext/foo/foo/composer.json b/tests/functional/fixtures/ext/foo/foo/composer.json
new file mode 100644
index 0000000000..d85c76a6a2
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/foo/composer.json
@@ -0,0 +1,24 @@
+{
+ "name": "foo/foo",
+ "type": "phpbb-extension",
+ "description": "Testing extensions",
+ "homepage": "",
+ "version": "1.0.0",
+ "time": "2013-03-21 01:01:01",
+ "license": "GPL-2.0",
+ "authors": [{
+ "name": "Tristan Darricau",
+ "email": "nicofuma@phpbb.com",
+ "homepage": "http://www.phpbb.com",
+ "role": "Developer"
+ }],
+ "require": {
+ "php": ">=5.3"
+ },
+ "extra": {
+ "display-name": "phpBB 3.1 Extension Testing",
+ "soft-require": {
+ "phpbb/phpbb": "3.1.*@dev"
+ }
+ }
+}
diff --git a/tests/functional/fixtures/ext/foo/foo/config/resource.yml b/tests/functional/fixtures/ext/foo/foo/config/resource.yml
new file mode 100644
index 0000000000..ed1d018016
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/foo/config/resource.yml
@@ -0,0 +1,3 @@
+foo_foo_controller:
+ pattern: /foo
+ defaults: { _controller: foo_foo.controller:handle }
diff --git a/tests/functional/fixtures/ext/foo/foo/config/routing.yml b/tests/functional/fixtures/ext/foo/foo/config/routing.yml
new file mode 100644
index 0000000000..c2c401687d
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/foo/config/routing.yml
@@ -0,0 +1,3 @@
+foo_foo.general:
+ resource: "resource.yml"
+ prefix: /foo
diff --git a/tests/functional/fixtures/ext/foo/foo/config/services.yml b/tests/functional/fixtures/ext/foo/foo/config/services.yml
new file mode 100644
index 0000000000..b3c7719715
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/foo/config/services.yml
@@ -0,0 +1,3 @@
+services:
+ foo_foo.controller:
+ class: foo\foo\controller\controller
diff --git a/tests/functional/fixtures/ext/foo/foo/controller/controller.php b/tests/functional/fixtures/ext/foo/foo/controller/controller.php
new file mode 100644
index 0000000000..771eaeacfc
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/foo/controller/controller.php
@@ -0,0 +1,13 @@
+<?php
+
+namespace foo\foo\controller;
+
+use Symfony\Component\HttpFoundation\Response;
+
+class controller
+{
+ public function handle()
+ {
+ return new Response('foo/foo controller handle() method', 200);
+ }
+}
diff --git a/tests/functional/fixtures/ext/foo/foo/ext.php b/tests/functional/fixtures/ext/foo/foo/ext.php
new file mode 100644
index 0000000000..80acda74fe
--- /dev/null
+++ b/tests/functional/fixtures/ext/foo/foo/ext.php
@@ -0,0 +1,8 @@
+<?php
+
+namespace foo\foo;
+
+class ext extends \phpbb\extension\base
+{
+
+}
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/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/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 bd926e2a98..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,
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 80e6293ff9..49cc72363e 100644
--- a/tests/test_framework/phpbb_functional_test_case.php
+++ b/tests/test_framework/phpbb_functional_test_case.php
@@ -239,7 +239,7 @@ class phpbb_functional_test_case extends phpbb_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,
@@ -294,7 +294,7 @@ class phpbb_functional_test_case extends phpbb_test_case
$parseURL = parse_url(self::$config['phpbb_functional_url']);
- $crawler = self::request('GET', 'install/index.php?mode=install');
+ $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();
@@ -598,7 +598,7 @@ class phpbb_functional_test_case extends phpbb_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);
@@ -637,7 +637,7 @@ class phpbb_functional_test_case extends phpbb_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);
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()
;