diff options
140 files changed, 3825 insertions, 4491 deletions
diff --git a/.gitignore b/.gitignore index de503c10ad..f9c04980ba 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,7 @@ /phpBB/images/avatars/gallery/* /phpBB/images/avatars/upload/* /phpBB/images/ranks/* +/phpBB/install/schemas/schema.json /phpBB/language/* !/phpBB/language/en /phpBB/store/* diff --git a/build/build.xml b/build/build.xml index 8ac7c1758c..de0f916a1f 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-RC5-dev" /> - <property name="prevversion" value="3.1.0-RC4" /> - <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, 3.1.0-RC3" /> + <property name="newversion" value="3.1.0-RC6-dev" /> + <property name="prevversion" value="3.1.0-RC5" /> + <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, 3.1.0-RC3, 3.1.0-RC4" /> <!-- no configuration should be needed beyond this point --> <property name="oldversions" value="${olderversions}, ${prevversion}" /> @@ -273,6 +273,9 @@ </else> </if> + <!-- Create schema.json --> + <exec dir="${dir}" command="php develop/create_schema_files.php" /> + <delete file="${dir}/config.php" /> <delete dir="${dir}/develop" /> <delete dir="${dir}/install/data" /> diff --git a/phpBB/adm/style/acp_logs.html b/phpBB/adm/style/acp_logs.html index 4f67f46e24..76ea801de0 100644 --- a/phpBB/adm/style/acp_logs.html +++ b/phpBB/adm/style/acp_logs.html @@ -8,7 +8,7 @@ <form id="list" method="post" action="{U_ACTION}"> -<fieldset class="display-options" style="float: left"> +<fieldset class="display-options search-box"> {L_SEARCH_KEYWORDS}{L_COLON} <input type="text" name="keywords" value="{S_KEYWORDS}" /> <input type="submit" class="button2" name="filter" value="{L_SEARCH}" /> </fieldset> diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css index b83750875a..b03cb0ba24 100644 --- a/phpBB/adm/style/admin.css +++ b/phpBB/adm/style/admin.css @@ -109,6 +109,14 @@ hr { text-align: center; } +.search-box { + float: left; +} + +.rtl .search-box { + float: right; +} + .small { font-size: 0.85em; } @@ -1773,6 +1781,7 @@ li.pagination ul { margin: 10px 0; color: #FFFFFF; text-align: center; + clear: both; } .success { diff --git a/phpBB/adm/style/timezone_option.html b/phpBB/adm/style/timezone_option.html index 7a799b69c6..acfff30184 100644 --- a/phpBB/adm/style/timezone_option.html +++ b/phpBB/adm/style/timezone_option.html @@ -1,17 +1,25 @@ <dl> <dt><label for="timezone">{L_BOARD_TIMEZONE}{L_COLON}</label></dt> - <!-- IF S_TZ_DATE_OPTIONS --> + <!-- IF .timezone_date --> <dd id="tz_select_date" style="display: none;"> <select name="tz_date" id="tz_date" class="autowidth tz_select"> <option value="">{L_SELECT_CURRENT_TIME}</option> - {S_TZ_DATE_OPTIONS} + <!-- BEGIN timezone_date --> + <option value="{timezone_date.VALUE}"<!-- IF timezone_date.SELECTED --> selected="selected"<!-- ENDIF -->>{timezone_date.TITLE}</option> + <!-- END timezone_date --> </select> </dd> <!-- ENDIF --> <dd> <select name="tz" id="timezone" class="autowidth tz_select"> <option value="">{L_SELECT_TIMEZONE}</option> - {S_TZ_OPTIONS} + <!-- BEGIN timezone_select --> + <optgroup label="{timezone_select.LABEL}" data-tz-value="{timezone_select.VALUE}"> + <!-- BEGIN timezone_options --> + <option title="{timezone_select.timezone_options.TITLE}" value="{timezone_select.timezone_options.VALUE}"<!-- IF timezone_select.timezone_options.SELECTED --> selected="selected"<!-- ENDIF -->>{timezone_select.timezone_options.LABEL}</option> + <!-- END timezone_options --> + </optgroup> + <!-- END timezone_select --> </select> <!-- INCLUDEJS timezone.js --> diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index b5187991f9..6ddbba7515 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -786,7 +786,7 @@ phpbb.timezoneSwitchDate = function(keepSelection) { } if ($tzDate.val() !== '') { - $timezone.children('optgroup').remove(':not([label="' + $('#tz_date').val() + '"])'); + $timezone.children('optgroup').remove(':not([data-tz-value="' + $('#tz_date').val() + '"])'); } if ($tzDate.val() === $tzSelectDateSuggest.attr('data-suggested-tz')) { @@ -795,7 +795,7 @@ phpbb.timezoneSwitchDate = function(keepSelection) { $tzSelectDateSuggest.css('display', 'inline'); } - var $tzOptions = $timezone.children('optgroup[label="' + $tzDate.val() + '"]').children('option'); + var $tzOptions = $timezone.children('optgroup[data-tz-value="' + $tzDate.val() + '"]').children('option'); if ($tzOptions.length === 1) { // If there is only one timezone for the selected date, we just select that automatically. @@ -849,7 +849,7 @@ phpbb.timezonePreselectSelect = function(forceSelector) { minutes = minutes.toString(); } - var prefix = 'GMT' + sign + hours + ':' + minutes; + var prefix = 'UTC' + sign + hours + ':' + minutes; var prefixLength = prefix.length; var selectorOptions = $('option', '#tz_date'); var i; diff --git a/phpBB/assets/javascript/editor.js b/phpBB/assets/javascript/editor.js index dfc7dab525..5fd4f7eae3 100644 --- a/phpBB/assets/javascript/editor.js +++ b/phpBB/assets/javascript/editor.js @@ -266,10 +266,6 @@ function mozWrap(txtarea, open, close) { var selEnd = txtarea.selectionEnd; var scrollTop = txtarea.scrollTop; - if (selEnd === 1 || selEnd === 2) { - selEnd = selLength; - } - var s1 = (txtarea.value).substring(0,selStart); var s2 = (txtarea.value).substring(selStart, selEnd); var s3 = (txtarea.value).substring(selEnd, selLength); diff --git a/phpBB/common.php b/phpBB/common.php index f6586c40fe..0782bd7321 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -104,7 +104,7 @@ require($phpbb_root_path . 'includes/compatibility_globals.' . $phpEx); // Add own hook handler require($phpbb_root_path . 'includes/hooks/index.' . $phpEx); -$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('\phpbb\template\template', 'display'))); +$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display'))); $phpbb_hook_finder = $phpbb_container->get('hook_finder'); foreach ($phpbb_hook_finder->find() as $hook) diff --git a/phpBB/config/auth_providers.yml b/phpBB/config/auth.yml index 89303a684a..88a90ca2d6 100644 --- a/phpBB/config/auth_providers.yml +++ b/phpBB/config/auth.yml @@ -1,4 +1,9 @@ services: +# ----- Auth management ----- + auth: + class: phpbb\auth\auth + +# ----- Auth providers ----- auth.provider_collection: class: phpbb\auth\provider_collection arguments: @@ -6,6 +11,7 @@ services: - @config tags: - { name: service_collection, tag: auth.provider } + auth.provider.db: class: phpbb\auth\provider\db arguments: @@ -19,6 +25,7 @@ services: - %core.php_ext% tags: - { name: auth.provider } + auth.provider.apache: class: phpbb\auth\provider\apache arguments: @@ -31,6 +38,7 @@ services: - %core.php_ext% tags: - { name: auth.provider } + auth.provider.ldap: class: phpbb\auth\provider\ldap arguments: @@ -40,6 +48,7 @@ services: - @user tags: - { name: auth.provider } + auth.provider.oauth: class: phpbb\auth\provider\oauth\oauth arguments: @@ -57,12 +66,15 @@ services: - %core.php_ext% tags: - { name: auth.provider } + +# ----- OAuth services providers ----- auth.provider.oauth.service_collection: class: phpbb\di\service_collection arguments: - @service_container tags: - { name: service_collection, tag: auth.provider.oauth.service } + auth.provider.oauth.service.bitly: class: phpbb\auth\provider\oauth\service\bitly arguments: @@ -70,6 +82,7 @@ services: - @request tags: - { name: auth.provider.oauth.service } + auth.provider.oauth.service.facebook: class: phpbb\auth\provider\oauth\service\facebook arguments: @@ -77,6 +90,7 @@ services: - @request tags: - { name: auth.provider.oauth.service } + auth.provider.oauth.service.google: class: phpbb\auth\provider\oauth\service\google arguments: diff --git a/phpBB/config/avatars.yml b/phpBB/config/avatar.yml index 8e5b1fdbfe..5292489715 100644 --- a/phpBB/config/avatars.yml +++ b/phpBB/config/avatar.yml @@ -1,4 +1,18 @@ services: + avatar.manager: + class: phpbb\avatar\manager + arguments: + - @config + - @avatar.driver_collection + +# ----- Avatar drivers ----- + avatar.driver_collection: + class: phpbb\di\service_collection + arguments: + - @service_container + tags: + - { name: service_collection, tag: avatar.driver } + avatar.driver.gravatar: class: phpbb\avatar\driver\gravatar arguments: @@ -51,10 +65,3 @@ services: - [set_name, [avatar.driver.upload]] tags: - { name: avatar.driver } - - avatar.driver_collection: - class: phpbb\di\service_collection - arguments: - - @service_container - tags: - - { name: service_collection, tag: avatar.driver } diff --git a/phpBB/config/captcha.yml b/phpBB/config/captcha.yml index bca37767af..e3f617e909 100644 --- a/phpBB/config/captcha.yml +++ b/phpBB/config/captcha.yml @@ -1,8 +1,3 @@ -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 @@ -10,6 +5,8 @@ services: - @service_container - @captcha.plugins.service_collection +# ----- Captcha plugins ----- +# Scope MUST be prototype for all the plugins to work. captcha.plugins.service_collection: class: phpbb\di\service_collection arguments: @@ -19,7 +16,7 @@ services: core.captcha.plugins.gd: class: phpbb\captcha\plugins\gd - scope: prototype # scope MUST be prototype for this to work! + scope: prototype calls: - [set_name, [core.captcha.plugins.gd]] tags: @@ -27,7 +24,7 @@ services: core.captcha.plugins.gd_wave: class: phpbb\captcha\plugins\gd_wave - scope: prototype # scope MUST be prototype for this to work! + scope: prototype calls: - [set_name, [core.captcha.plugins.gd_wave]] tags: @@ -35,7 +32,7 @@ services: core.captcha.plugins.nogd: class: phpbb\captcha\plugins\nogd - scope: prototype # scope MUST be prototype for this to work! + scope: prototype calls: - [set_name, [core.captcha.plugins.nogd]] tags: @@ -43,7 +40,7 @@ services: core.captcha.plugins.qa: class: phpbb\captcha\plugins\qa - scope: prototype # scope MUST be prototype for this to work! + scope: prototype arguments: - %tables.captcha_qa_questions% - %tables.captcha_qa_answers% @@ -55,7 +52,7 @@ services: core.captcha.plugins.recaptcha: class: phpbb\captcha\plugins\recaptcha - scope: prototype # scope MUST be prototype for this to work! + scope: prototype calls: - [set_name, [core.captcha.plugins.recaptcha]] tags: diff --git a/phpBB/config/content.yml b/phpBB/config/content.yml new file mode 100644 index 0000000000..f0985f0292 --- /dev/null +++ b/phpBB/config/content.yml @@ -0,0 +1,71 @@ +services: + content.visibility: + class: phpbb\content_visibility + arguments: + - @auth + - @config + - @dbal.conn + - @user + - %core.root_path% + - %core.php_ext% + - %tables.forums% + - %tables.posts% + - %tables.topics% + - %tables.users% + + groupposition.legend: + class: phpbb\groupposition\legend + arguments: + - @dbal.conn + - @user + + groupposition.teampage: + class: phpbb\groupposition\teampage + arguments: + - @dbal.conn + - @user + - @cache.driver + + message.form.admin: + class: phpbb\message\admin_form + arguments: + - @auth + - @config + - @config_text + - @dbal.conn + - @user + - %core.root_path% + - %core.php_ext% + + message.form.topic: + class: phpbb\message\topic_form + arguments: + - @auth + - @config + - @dbal.conn + - @user + - %core.root_path% + - %core.php_ext% + + message.form.user: + class: phpbb\message\user_form + arguments: + - @auth + - @config + - @dbal.conn + - @user + - %core.root_path% + - %core.php_ext% + + pagination: + class: phpbb\pagination + arguments: + - @template + - @user + - @controller.helper + - @dispatcher + + viewonline_helper: + class: phpbb\viewonline_helper + arguments: + - @filesystem diff --git a/phpBB/config/cron_tasks.yml b/phpBB/config/cron.yml index acf9a48bf9..7a90c39733 100644 --- a/phpBB/config/cron_tasks.yml +++ b/phpBB/config/cron.yml @@ -1,4 +1,26 @@ services: + cron.manager: + class: phpbb\cron\manager + arguments: + - @cron.task_collection + - %core.root_path% + - %core.php_ext% + + cron.lock_db: + class: phpbb\lock\db + arguments: + - cron_lock + - @config + - @dbal.conn + +# ----- Cron tasks ----- + cron.task_collection: + class: phpbb\di\service_collection + arguments: + - @service_container + tags: + - { name: service_collection, tag: cron.task } + cron.task.core.prune_all_forums: class: phpbb\cron\task\core\prune_all_forums arguments: diff --git a/phpBB/config/migrator.yml b/phpBB/config/db.yml index cd04eea5c2..b3f1b485ea 100644 --- a/phpBB/config/migrator.yml +++ b/phpBB/config/db.yml @@ -1,4 +1,20 @@ services: + dbal.conn: + class: phpbb\db\driver\factory + arguments: + - @service_container + + dbal.conn.driver: + class: %dbal.driver.class% + calls: + - [sql_connect, [%dbal.dbhost%, %dbal.dbuser%, %dbal.dbpasswd%, %dbal.dbname%, %dbal.dbport%, false, %dbal.new_link%]] + + dbal.tools: + class: phpbb\db\tools + arguments: + - @dbal.conn + +# ----- Migrator ----- migrator: class: phpbb\db\migrator arguments: @@ -15,6 +31,7 @@ services: migrator.helper: class: phpbb\db\migration\helper +# ----- Migrator's tools ----- migrator.tool_collection: class: phpbb\di\service_collection arguments: diff --git a/phpBB/config/event.yml b/phpBB/config/event.yml new file mode 100644 index 0000000000..599b3cbb40 --- /dev/null +++ b/phpBB/config/event.yml @@ -0,0 +1,34 @@ +services: + dispatcher: + class: phpbb\event\dispatcher + arguments: + - @service_container + + hook_finder: + class: phpbb\hook\finder + arguments: + - %core.root_path% + - %core.php_ext% + - @cache.driver + + kernel_request_subscriber: + class: phpbb\event\kernel_request_subscriber + arguments: + - @ext.manager + - %core.root_path% + - %core.php_ext% + tags: + - { name: kernel.event_subscriber } + + kernel_exception_subscriber: + class: phpbb\event\kernel_exception_subscriber + arguments: + - @template + - @user + tags: + - { name: kernel.event_subscriber } + + kernel_terminate_subscriber: + class: phpbb\event\kernel_terminate_subscriber + tags: + - { name: kernel.event_subscriber } diff --git a/phpBB/config/mimetype_guessers.yml b/phpBB/config/mimetype_guesser.yml index 0115146deb..2e89ed3c1f 100644 --- a/phpBB/config/mimetype_guessers.yml +++ b/phpBB/config/mimetype_guesser.yml @@ -1,11 +1,11 @@ -parameters: - mimetype.guesser.priority.lowest: -2 - mimetype.guesser.priority.low: -1 - mimetype.guesser.priority.default: 0 - mimetype.guesser.priority.high: 1 - mimetype.guesser.priority.highest: 2 - services: + mimetype.guesser_collection: + class: phpbb\di\service_collection + arguments: + - @service_container + tags: + - { name: service_collection, tag: mimetype.guessers } + mimetype.fileinfo_mimetype_guesser: class: Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser tags: @@ -30,13 +30,6 @@ services: tags: - { name: mimetype.guessers } - mimetype.guesser_collection: - class: phpbb\di\service_collection - arguments: - - @service_container - tags: - - { name: service_collection, tag: mimetype.guessers } - mimetype.guesser: class: phpbb\mimetype\guesser arguments: diff --git a/phpBB/config/notifications.yml b/phpBB/config/notification.yml index 5675e76a99..add577be2c 100644 --- a/phpBB/config/notifications.yml +++ b/phpBB/config/notification.yml @@ -1,21 +1,33 @@ services: - notification.type_collection: - class: phpbb\di\service_collection + notification_manager: + class: phpbb\notification\manager arguments: + - @notification.type_collection + - @notification.method_collection - @service_container - tags: - - { name: service_collection, tag: notification.type } + - @user_loader + - @config + - @dbal.conn + - @cache + - @user + - %core.root_path% + - %core.php_ext% + - %tables.notification_types% + - %tables.notifications% + - %tables.user_notifications% - notification.method_collection: +# ----- Notification's types ----- +# Scope MUST be prototype for all the plugins to work. + notification.type_collection: class: phpbb\di\service_collection arguments: - @service_container tags: - - { name: service_collection, tag: notification.method } + - { name: service_collection, tag: notification.type } notification.type.approve_post: class: phpbb\notification\type\approve_post - scope: prototype # scope MUST be prototype for this to work! # scope MUST be prototype for this to work! + scope: prototype arguments: - @user_loader - @dbal.conn @@ -33,7 +45,7 @@ services: notification.type.approve_topic: class: phpbb\notification\type\approve_topic - scope: prototype # scope MUST be prototype for this to work! + scope: prototype arguments: - @user_loader - @dbal.conn @@ -51,7 +63,7 @@ services: notification.type.bookmark: class: phpbb\notification\type\bookmark - scope: prototype # scope MUST be prototype for this to work! + scope: prototype arguments: - @user_loader - @dbal.conn @@ -69,7 +81,7 @@ services: notification.type.disapprove_post: class: phpbb\notification\type\disapprove_post - scope: prototype # scope MUST be prototype for this to work! + scope: prototype arguments: - @user_loader - @dbal.conn @@ -87,7 +99,7 @@ services: notification.type.disapprove_topic: class: phpbb\notification\type\disapprove_topic - scope: prototype # scope MUST be prototype for this to work! + scope: prototype arguments: - @user_loader - @dbal.conn @@ -105,7 +117,7 @@ services: notification.type.group_request: class: phpbb\notification\type\group_request - scope: prototype # scope MUST be prototype for this to work! + scope: prototype arguments: - @user_loader - @dbal.conn @@ -123,7 +135,7 @@ services: notification.type.group_request_approved: class: phpbb\notification\type\group_request_approved - scope: prototype # scope MUST be prototype for this to work! + scope: prototype arguments: - @user_loader - @dbal.conn @@ -141,7 +153,7 @@ services: notification.type.pm: class: phpbb\notification\type\pm - scope: prototype # scope MUST be prototype for this to work! + scope: prototype arguments: - @user_loader - @dbal.conn @@ -159,7 +171,7 @@ services: notification.type.post: class: phpbb\notification\type\post - scope: prototype # scope MUST be prototype for this to work! + scope: prototype arguments: - @user_loader - @dbal.conn @@ -177,7 +189,7 @@ services: notification.type.post_in_queue: class: phpbb\notification\type\post_in_queue - scope: prototype # scope MUST be prototype for this to work! + scope: prototype arguments: - @user_loader - @dbal.conn @@ -195,7 +207,7 @@ services: notification.type.quote: class: phpbb\notification\type\quote - scope: prototype # scope MUST be prototype for this to work! + scope: prototype arguments: - @user_loader - @dbal.conn @@ -213,7 +225,7 @@ services: notification.type.report_pm: class: phpbb\notification\type\report_pm - scope: prototype # scope MUST be prototype for this to work! + scope: prototype arguments: - @user_loader - @dbal.conn @@ -231,7 +243,7 @@ services: notification.type.report_pm_closed: class: phpbb\notification\type\report_pm_closed - scope: prototype # scope MUST be prototype for this to work! + scope: prototype arguments: - @user_loader - @dbal.conn @@ -249,7 +261,7 @@ services: notification.type.report_post: class: phpbb\notification\type\report_post - scope: prototype # scope MUST be prototype for this to work! + scope: prototype arguments: - @user_loader - @dbal.conn @@ -267,7 +279,7 @@ services: notification.type.report_post_closed: class: phpbb\notification\type\report_post_closed - scope: prototype # scope MUST be prototype for this to work! + scope: prototype arguments: - @user_loader - @dbal.conn @@ -285,7 +297,7 @@ services: notification.type.topic: class: phpbb\notification\type\topic - scope: prototype # scope MUST be prototype for this to work! + scope: prototype arguments: - @user_loader - @dbal.conn @@ -303,7 +315,7 @@ services: notification.type.topic_in_queue: class: phpbb\notification\type\topic_in_queue - scope: prototype # scope MUST be prototype for this to work! + scope: prototype arguments: - @user_loader - @dbal.conn @@ -321,7 +333,7 @@ services: notification.type.admin_activate_user: class: phpbb\notification\type\admin_activate_user - scope: prototype # scope MUST be prototype for this to work! + scope: prototype arguments: - @user_loader - @dbal.conn @@ -336,10 +348,19 @@ services: - %tables.user_notifications% tags: - { name: notification.type } + +# ----- Notification's methods ----- +# Scope MUST be prototype for all the plugins to work. + notification.method_collection: + class: phpbb\di\service_collection + arguments: + - @service_container + tags: + - { name: service_collection, tag: notification.method } notification.method.email: class: phpbb\notification\method\email - scope: prototype # scope MUST be prototype for this to work! + scope: prototype arguments: - @user_loader - @dbal.conn @@ -354,7 +375,7 @@ services: notification.method.jabber: class: phpbb\notification\method\jabber - scope: prototype # scope MUST be prototype for this to work! + scope: prototype arguments: - @user_loader - @dbal.conn diff --git a/phpBB/config/parameters.yml b/phpBB/config/parameters.yml index b076ea3ecb..8ecc1428f4 100644 --- a/phpBB/config/parameters.yml +++ b/phpBB/config/parameters.yml @@ -1,3 +1,20 @@ parameters: + # Disable the usage of the super globals (_GET, _POST, _SERVER...) core.disable_super_globals: true + + # Datetime class to use datetime.class: \phpbb\datetime + + # Mimetype guesser priorities + mimetype.guesser.priority.lowest: -2 + mimetype.guesser.priority.low: -1 + mimetype.guesser.priority.default: 0 + mimetype.guesser.priority.high: 1 + mimetype.guesser.priority.highest: 2 + + # List of default password driver types + passwords.algorithms: + - passwords.driver.bcrypt_2y + - passwords.driver.bcrypt + - passwords.driver.salted_md5 + - passwords.driver.phpass diff --git a/phpBB/config/passwords.yml b/phpBB/config/password.yml index 3dc217286f..09e935016e 100644 --- a/phpBB/config/passwords.yml +++ b/phpBB/config/password.yml @@ -1,11 +1,29 @@ -parameters: - passwords.algorithms: - - passwords.driver.bcrypt_2y - - passwords.driver.bcrypt - - passwords.driver.salted_md5 - - passwords.driver.phpass - services: +# ----- Password management ----- + passwords.manager: + class: phpbb\passwords\manager + arguments: + - @config + - @passwords.driver_collection + - @passwords.helper + - %passwords.algorithms% + + passwords.helper: + class: phpbb\passwords\helper + + passwords.driver_helper: + class: phpbb\passwords\driver\helper + arguments: + - @config + +# ----- Password's drivers ----- + passwords.driver_collection: + class: phpbb\di\service_collection + arguments: + - @service_container + tags: + - { name: service_collection, tag: passwords.driver } + passwords.driver.bcrypt: class: phpbb\passwords\driver\bcrypt arguments: @@ -103,26 +121,3 @@ services: - @passwords.driver_helper tags: - { name: passwords.driver } - - passwords.driver_collection: - class: phpbb\di\service_collection - arguments: - - @service_container - tags: - - { name: service_collection, tag: passwords.driver } - - passwords.driver_helper: - class: phpbb\passwords\driver\helper - arguments: - - @config - - passwords.manager: - class: phpbb\passwords\manager - arguments: - - @config - - @passwords.driver_collection - - @passwords.helper - - %passwords.algorithms% - - passwords.helper: - class: phpbb\passwords\helper diff --git a/phpBB/config/profilefields.yml b/phpBB/config/profilefield.yml index ce2a84b12b..5ccfef9148 100644 --- a/phpBB/config/profilefields.yml +++ b/phpBB/config/profilefield.yml @@ -19,6 +19,7 @@ services: - @dbal.conn - %tables.profile_fields_options_language% +# ----- Profile fields types ----- profilefields.type_collection: class: phpbb\di\service_collection arguments: diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index cca655263f..5003697564 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -1,34 +1,23 @@ imports: - - { resource: tables.yml } - - { resource: cron_tasks.yml } - - { resource: notifications.yml } - - { resource: migrator.yml } - - { resource: avatars.yml } - - { resource: feed.yml } - - { resource: auth_providers.yml } - - { resource: console.yml } - - { resource: mimetype_guessers.yml } - - { resource: passwords.yml } - - { resource: profilefields.yml } + - { resource: auth.yml } + - { resource: avatar.yml } - { resource: captcha.yml } + - { resource: console.yml } + - { resource: content.yml } + - { resource: cron.yml } + - { resource: db.yml } + - { resource: event.yml } + - { resource: feed.yml } + - { resource: mimetype_guesser.yml } + - { resource: notification.yml } + - { resource: password.yml } + - { resource: profilefield.yml } + - { resource: user.yml } + + - { resource: tables.yml } - { resource: parameters.yml } services: - acl.permissions: - class: phpbb\permissions - arguments: - - @dispatcher - - @user - - auth: - class: phpbb\auth\auth - - avatar.manager: - class: phpbb\avatar\manager - arguments: - - @config - - @avatar.driver_collection - cache: class: phpbb\cache\service arguments: @@ -77,20 +66,6 @@ services: - @dbal.conn - %tables.config_text% - content.visibility: - class: phpbb\content_visibility - arguments: - - @auth - - @config - - @dbal.conn - - @user - - %core.root_path% - - %core.php_ext% - - %tables.forums% - - %tables.posts% - - %tables.topics% - - %tables.users% - controller.helper: class: phpbb\controller\helper arguments: @@ -117,47 +92,6 @@ services: calls: - [find, [%core.root_path%]] - cron.task_collection: - class: phpbb\di\service_collection - arguments: - - @service_container - tags: - - { name: service_collection, tag: cron.task } - - cron.manager: - class: phpbb\cron\manager - arguments: - - @cron.task_collection - - %core.root_path% - - %core.php_ext% - - cron.lock_db: - class: phpbb\lock\db - arguments: - - cron_lock - - @config - - @dbal.conn - - dispatcher: - class: phpbb\event\dispatcher - arguments: - - @service_container - - dbal.conn: - class: phpbb\db\driver\factory - arguments: - - @service_container - - dbal.conn.driver: - class: %dbal.driver.class% - calls: - - [sql_connect, [%dbal.dbhost%, %dbal.dbuser%, %dbal.dbpasswd%, %dbal.dbname%, %dbal.dbport%, false, %dbal.new_link%]] - - dbal.tools: - class: phpbb\db\tools - arguments: - - @dbal.conn - ext.manager: class: phpbb\extension\manager arguments: @@ -174,54 +108,12 @@ services: filesystem: class: phpbb\filesystem - groupposition.legend: - class: phpbb\groupposition\legend - arguments: - - @dbal.conn - - @user - - groupposition.teampage: - class: phpbb\groupposition\teampage - arguments: - - @dbal.conn - - @user - - @cache.driver - http_kernel: class: Symfony\Component\HttpKernel\HttpKernel arguments: - @dispatcher - @controller.resolver - hook_finder: - class: phpbb\hook\finder - arguments: - - %core.root_path% - - %core.php_ext% - - @cache.driver - - kernel_request_subscriber: - class: phpbb\event\kernel_request_subscriber - arguments: - - @ext.manager - - %core.root_path% - - %core.php_ext% - tags: - - { name: kernel.event_subscriber } - - kernel_exception_subscriber: - class: phpbb\event\kernel_exception_subscriber - arguments: - - @template - - @user - tags: - - { name: kernel.event_subscriber } - - kernel_terminate_subscriber: - class: phpbb\event\kernel_terminate_subscriber - tags: - - { name: kernel.event_subscriber } - log: class: phpbb\log\log arguments: @@ -234,61 +126,6 @@ services: - %core.php_ext% - %tables.log% - message.form.admin: - class: phpbb\message\admin_form - arguments: - - @auth - - @config - - @config_text - - @dbal.conn - - @user - - %core.root_path% - - %core.php_ext% - - message.form.topic: - class: phpbb\message\topic_form - arguments: - - @auth - - @config - - @dbal.conn - - @user - - %core.root_path% - - %core.php_ext% - - message.form.user: - class: phpbb\message\user_form - arguments: - - @auth - - @config - - @dbal.conn - - @user - - %core.root_path% - - %core.php_ext% - - notification_manager: - class: phpbb\notification\manager - arguments: - - @notification.type_collection - - @notification.method_collection - - @service_container - - @user_loader - - @config - - @dbal.conn - - @cache - - @user - - %core.root_path% - - %core.php_ext% - - %tables.notification_types% - - %tables.notifications% - - %tables.user_notifications% - - pagination: - class: phpbb\pagination - arguments: - - @template - - @user - - @controller.helper - path_helper: class: phpbb\path_helper arguments: @@ -335,19 +172,6 @@ services: template_context: class: phpbb\template\context - user: - class: phpbb\user - arguments: - - %datetime.class% - - user_loader: - class: phpbb\user_loader - arguments: - - @dbal.conn - - %core.root_path% - - %core.php_ext% - - %tables.users% - version_helper: class: phpbb\version_helper scope: prototype @@ -355,8 +179,3 @@ services: - @cache - @config - @user - - viewonline_helper: - class: phpbb\viewonline_helper - arguments: - - @filesystem diff --git a/phpBB/config/tables.yml b/phpBB/config/tables.yml index e4f7bda89b..2fe2a33be8 100644 --- a/phpBB/config/tables.yml +++ b/phpBB/config/tables.yml @@ -1,6 +1,9 @@ parameters: tables.auth_provider_oauth_token_storage: %core.table_prefix%oauth_tokens tables.auth_provider_oauth_account_assoc: %core.table_prefix%oauth_accounts + 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 tables.config: %core.table_prefix%config tables.config_text: %core.table_prefix%config_text tables.ext: %core.table_prefix%ext diff --git a/phpBB/config/user.yml b/phpBB/config/user.yml new file mode 100644 index 0000000000..1ca853ea45 --- /dev/null +++ b/phpBB/config/user.yml @@ -0,0 +1,19 @@ +services: + acl.permissions: + class: phpbb\permissions + arguments: + - @dispatcher + - @user + + user: + class: phpbb\user + arguments: + - %datetime.class% + + user_loader: + class: phpbb\user_loader + arguments: + - @dbal.conn + - %core.root_path% + - %core.php_ext% + - %tables.users% diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index b1e981795f..7ef86ad7fc 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -57,4 +57,4 @@ $fp = fopen($schema_path . 'schema.json', 'wb'); fwrite($fp, json_encode($schema_data, JSON_PRETTY_PRINT)); fclose($fp); -echo 'done'; +echo 'Successfully created schema file'; diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 7b46129c6c..3f6bd0ee51 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <meta name="keywords" content="" /> <meta name="description" content="phpBB 3.1.x Changelog" /> -<title>phpBB3 • Changelog</title> +<title>phpBB • Changelog</title> <link href="stylesheet.css" rel="stylesheet" type="text/css" media="screen, projection" /> @@ -46,6 +46,7 @@ <ol> <li><a href="#changelog">Changelog</a> <ol style="list-style-type: lower-roman;"> + <li><a href="#v310RC4">Changes since 3.1.0-RC4</a></li> <li><a href="#v310RC3">Changes since 3.1.0-RC3</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> @@ -97,7 +98,74 @@ <div class="content"> - <a name="v310RC3"></a><h3>1.i. Changes since 3.1.0-RC3</h3> + <a name="v310RC4"></a><h3>1.i. Changes since 3.1.0-RC4</h3> + + <h4>Bug</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10729">PHPBB3-10729</a>] - Post editor information is not updated when user being deleted with posts</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11224">PHPBB3-11224</a>] - SQL cache destroy does not destroy queries to tables joined</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12368">PHPBB3-12368</a>] - Updating database fails in upgrade from 3.0 when trying twice without purging the cache</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12489">PHPBB3-12489</a>] - Description for Contact link in custom profile fields</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12657">PHPBB3-12657</a>] - Add a test file for cli command cache:purge</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12858">PHPBB3-12858</a>] - 'GMT' is hard coded and not pulled from language files</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12889">PHPBB3-12889</a>] - multi-select element in unban email-adresses not limited in width</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13011">PHPBB3-13011</a>] - Javascript bug when selecting first one or two characters of a post</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13027">PHPBB3-13027</a>] - PM folder full percentage could be a bit more accurate</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13033">PHPBB3-13033</a>] - Duplicate entry SQL error thrown when running notifications_use_full_name migration</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13045">PHPBB3-13045</a>] - Pragma header not specified as response header by RFC2616</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13048">PHPBB3-13048</a>] - AJAX requests are being stored to session_page</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13055">PHPBB3-13055</a>] - String profile fields validation limits content to latin chars only</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13070">PHPBB3-13070</a>] - Wrong hook name is registered for array(template, display)</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13071">PHPBB3-13071</a>] - total_match_count is used before core.search_get_posts_data event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13080">PHPBB3-13080</a>] - Responsive design - language variable to long</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13082">PHPBB3-13082</a>] - Search box does not displayed proper in admin cp when no logs listed</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13085">PHPBB3-13085</a>] - Fix typo in oauth.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13086">PHPBB3-13086</a>] - Update ACP_MASS_EMAIL_EXPLAIN language key</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13087">PHPBB3-13087</a>] - WLM link is empty in viewtopic</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13097">PHPBB3-13097</a>] - Fix missing unit type in forms.css</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13104">PHPBB3-13104</a>] - Responsive tabs display bug in IE11</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13105">PHPBB3-13105</a>] - Future dates are displayed as "Tomorrow" with relative date format</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13111">PHPBB3-13111</a>] - Debug output when editing DropDown Custom Fields with multiple languages</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13113">PHPBB3-13113</a>] - The routes are not always generated for the good app.php file</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13116">PHPBB3-13116</a>] - Topic and post approval notifications got interchanged</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13117">PHPBB3-13117</a>] - Installation fails on MySQL 5.7 because auto_increment columns can be NULL</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13118">PHPBB3-13118</a>] - datetime.class parameter not used in user class</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13120">PHPBB3-13120</a>] - phpbb_load_extensions_autoloaders() doesn't work very well with the extensions behind a symlink</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13121">PHPBB3-13121</a>] - Customise Purge Cache always returns user to Styles page</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13125">PHPBB3-13125</a>] - Uploaded avatars are not displayed in IE <= 7</li> + </ul> + <h4>Improvement</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12408">PHPBB3-12408</a>] - Add quick setting for "default guest style" to ACP board settings</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12985">PHPBB3-12985</a>] - Add event to modify the redirect after a successful login</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12993">PHPBB3-12993</a>] - Add event to get_user_rank() function</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13025">PHPBB3-13025</a>] - Add template events for buttons on viewforum and viewtopic</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13059">PHPBB3-13059</a>] - Add core event to generate_page_link() to allow modifying pagination URLs</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13072">PHPBB3-13072</a>] - Add total_match_count to core.search_get_topic_data event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13077">PHPBB3-13077</a>] - Change module order in Customise tab for better usability</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13094">PHPBB3-13094</a>] - Remove the search box if there are no new posts to search for</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13107">PHPBB3-13107</a>] - Add template events to forum row in forumlist_body.html</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13108">PHPBB3-13108</a>] - Add core event to the parse_attachments() function to allow modifying files info</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13110">PHPBB3-13110</a>] - Add core event to the page_footer() function to allow handling overall output</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13122">PHPBB3-13122</a>] - phpbb_wrapper_gmgetdate_test intermittently fails</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13134">PHPBB3-13134</a>] - Add core event to the root of the function display_forums()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13137">PHPBB3-13137</a>] - Remove schema.json from repository</li> + </ul> + <h4>Sub-task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12929">PHPBB3-12929</a>] - Add an event when getting the information for PM composal</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12930">PHPBB3-12930</a>] - Add an event to the query getting the post for quoting in a PM</li> + </ul> + <h4>Task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10794">PHPBB3-10794</a>] - Make schema available at runtime</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12987">PHPBB3-12987</a>] - Cleanup the services.yml file</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13106">PHPBB3-13106</a>] - Remove the \phpbb\di\pass\kernel_pass class</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13119">PHPBB3-13119</a>] - Add events to mcp and acp ban modules</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13123">PHPBB3-13123</a>] - Add events to allow post blocking and post pre/past processing</li> + </ul> + + <a name="v310RC3"></a><h3>1.ii. Changes since 3.1.0-RC3</h3> <h4>Bug</h4> <ul> @@ -187,7 +255,7 @@ </ul> - <a name="v310RC2"></a><h3>1.ii. Changes since 3.1.0-RC2</h3> + <a name="v310RC2"></a><h3>1.iii. Changes since 3.1.0-RC2</h3> <h4>Bug</h4> <ul> @@ -311,7 +379,7 @@ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12948">PHPBB3-12948</a>] - Remove Travis CI "broken opcache on PHP 5.5.7 and 5.5.8" workaround.</li> </ul> - <a name="v310RC1"></a><h3>1.iii. Changes since 3.1.0-RC1</h3> + <a name="v310RC1"></a><h3>1.iv. Changes since 3.1.0-RC1</h3> <h4>Bug</h4> <ul> @@ -382,7 +450,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.iv. Changes since 3.1.0-b4</h3> + <a name="v310b4"></a><h3>1.v. Changes since 3.1.0-b4</h3> <h4>Bug</h4> <ul> @@ -502,7 +570,7 @@ </ul> - <a name="v310b3"></a><h3>1.v. Changes since 3.1.0-b3</h3> + <a name="v310b3"></a><h3>1.vi. Changes since 3.1.0-b3</h3> <h4>Bug</h4> <ul> @@ -609,7 +677,7 @@ </ul> - <a name="v310b2"></a><h3>1.vi. Changes since 3.1.0-b2</h3> + <a name="v310b2"></a><h3>1.vii. Changes since 3.1.0-b2</h3> <h4>Bug</h4> <ul> @@ -774,7 +842,7 @@ </ul> - <a name="v310b1"></a><h3>1.vii. Changes since 3.1.0-b1</h3> + <a name="v310b1"></a><h3>1.viii. Changes since 3.1.0-b1</h3> <h4>Bug</h4> <ul> @@ -842,7 +910,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.viii. Changes since 3.1.0-a3</h3> + <a name="v310a3"></a><h3>1.ix. Changes since 3.1.0-a3</h3> <h4>Bug</h4> <ul> @@ -989,7 +1057,7 @@ </ul> - <a name="v310a2"></a><h3>1.ix. Changes since 3.1.0-a2</h3> + <a name="v310a2"></a><h3>1.x. Changes since 3.1.0-a2</h3> <h4>Bug</h4> <ul> @@ -1097,7 +1165,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.x. Changes since 3.1.0-a1</h3> + <a name="v310a1"></a><h3>1.xi. Changes since 3.1.0-a1</h3> <h4>Bug</h4> <ul> @@ -1173,7 +1241,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.xi. Changes since 3.0.x</h3> + <a name="v30x"></a><h3>1.xii. Changes since 3.0.x</h3> <h4>Bug</h4> <ul> @@ -1854,7 +1922,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.xii. Changes since 3.0.11</h3> + <a name="v3011"></a><h3>1.xiii. Changes since 3.0.11</h3> <h4>Bug</h4> <ul> @@ -2009,7 +2077,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.xiii. Changes since 3.0.10</h3> + <a name="v3010"></a><h3>1.xiv. Changes since 3.0.10</h3> <h4>Bug</h4> <ul> @@ -2134,7 +2202,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.xiv. Changes since 3.0.9</h3> + <a name="v309"></a><h3>1.xv. Changes since 3.0.9</h3> <h4>Bug</h4> <ul> @@ -2270,7 +2338,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.xv. Changes since 3.0.8</h3> + <a name="v308"></a><h3>1.xvi. Changes since 3.0.8</h3> <h4> Bug </h4> @@ -2638,7 +2706,7 @@ </ul> - <a name="v307-PL1"></a><h3>1.xvi. Changes since 3.0.7-PL1</h3> + <a name="v307-PL1"></a><h3>1.xvii. Changes since 3.0.7-PL1</h3> <h4> Security </h4> <ul> @@ -3096,13 +3164,13 @@ </ul> - <a name="v307"></a><h3>1.xvii. Changes since 3.0.7</h3> + <a name="v307"></a><h3>1.xviii. 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.xviii. Changes since 3.0.6</h3> + <a name="v306"></a><h3>1.xix. 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> @@ -3206,7 +3274,7 @@ </ul> - <a name="v305"></a><h3>1.xix. Changes since 3.0.5</h3> + <a name="v305"></a><h3>1.xx. Changes since 3.0.5</h3> <ul> <li>[Fix] Allow whitespaces in avatar gallery names. (Bug #44955)</li> @@ -3428,7 +3496,7 @@ <li>[Feature] Send anonymous statistical information to phpBB on installation and update (optional).</li> </ul> - <a name="v304"></a><h3>1.xx. Changes since 3.0.4</h3> + <a name="v304"></a><h3>1.xxi. 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> @@ -3517,7 +3585,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.xxi. Changes since 3.0.3</h3> + <a name="v303"></a><h3>1.xxii. Changes since 3.0.3</h3> <ul> <li>[Fix] Allow mixed-case template directories to be inherited (Bug #36725)</li> @@ -3549,7 +3617,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.xxii. Changes since 3.0.2</h3> + <a name="v302"></a><h3>1.xxiii. 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> @@ -3648,7 +3716,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.xxiii. Changes since 3.0.1</h3> + <a name="v301"></a><h3>1.xxiv. Changes since 3.0.1</h3> <ul> <li>[Fix] Ability to set permissions on non-mysql dbms (Bug #24955)</li> @@ -3696,7 +3764,7 @@ <li>[Sec] Only allow urls gone through redirect() being used within login_box(). (thanks nookieman)</li> </ul> - <a name="v300"></a><h3>1.xxiv. Changes since 3.0.0</h3> + <a name="v300"></a><h3>1.xxv. Changes since 3.0.0</h3> <ul> <li>[Change] Validate birthdays (Bug #15004)</li> @@ -3767,7 +3835,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.xxv. Changes since 3.0.RC8</h3> + <a name="v30rc8"></a><h3>1.xxvi. Changes since 3.0.RC8</h3> <ul> <li>[Fix] Cleaned usernames contain only single spaces, so "a_name" and "a__name" are treated as the same name (Bug #15634)</li> @@ -3776,7 +3844,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.xxvi. Changes since 3.0.RC7</h3> + <a name="v30rc7"></a><h3>1.xxvii. Changes since 3.0.RC7</h3> <ul> <li>[Fix] Fixed MSSQL related bug in the update system</li> @@ -3811,7 +3879,7 @@ <li>[Fix] No duplication of active topics (Bug #15474)</li> </ul> - <a name="v30rc6"></a><h3>1.xxvii. Changes since 3.0.RC6</h3> + <a name="v30rc6"></a><h3>1.xxviii. Changes since 3.0.RC6</h3> <ul> <li>[Fix] Submitting language changes using acp_language (Bug #14736)</li> @@ -3821,7 +3889,7 @@ <li>[Fix] Able to request new password (Bug #14743)</li> </ul> - <a name="v30rc5"></a><h3>1.xxviii. Changes since 3.0.RC5</h3> + <a name="v30rc5"></a><h3>1.xxix. 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> @@ -3884,7 +3952,7 @@ <li>[Sec] New password hashing mechanism for storing passwords (#i42)</li> </ul> - <a name="v30rc4"></a><h3>1.xxix. Changes since 3.0.RC4</h3> + <a name="v30rc4"></a><h3>1.xxx. Changes since 3.0.RC4</h3> <ul> <li>[Fix] MySQL, PostgreSQL and SQLite related database fixes (Bug #13862)</li> @@ -3935,7 +4003,7 @@ <li>[Fix] odbc_autocommit causing existing result sets to be dropped (Bug #14182)</li> </ul> - <a name="v30rc3"></a><h3>1.xxx. Changes since 3.0.RC3</h3> + <a name="v30rc3"></a><h3>1.xxxi. Changes since 3.0.RC3</h3> <ul> <li>[Fix] Fixing some subsilver2 and prosilver style issues</li> @@ -4044,7 +4112,7 @@ </ul> - <a name="v30rc2"></a><h3>1.xxxi. Changes since 3.0.RC2</h3> + <a name="v30rc2"></a><h3>1.xxxii. Changes since 3.0.RC2</h3> <ul> <li>[Fix] Re-allow searching within the memberlist</li> @@ -4090,7 +4158,7 @@ </ul> - <a name="v30rc1"></a><h3>1.xxxii. Changes since 3.0.RC1</h3> + <a name="v30rc1"></a><h3>1.xxxiii. Changes since 3.0.RC1</h3> <ul> <li>[Fix] (X)HTML issues within the templates (Bug #11255, #11255)</li> diff --git a/phpBB/docs/FAQ.html b/phpBB/docs/FAQ.html index 1180c898dd..d9ba651032 100644 --- a/phpBB/docs/FAQ.html +++ b/phpBB/docs/FAQ.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <meta name="keywords" content="" /> <meta name="description" content="phpBB 3.1.x frequently asked questions" /> -<title>phpBB3 • FAQ</title> +<title>phpBB • FAQ</title> <link href="stylesheet.css" rel="stylesheet" type="text/css" media="screen, projection" /> @@ -35,7 +35,7 @@ <!-- BEGIN DOCUMENT --> - <p>This is a very basic Frequently Asked Questions (FAQ) page which attempts to answer some of the more commonly asked questions. It is by no means exhaustive and should be used in combination with the 'built-in' User FAQ within phpBB3, the community forums and our IRC channel (see <a href="README.html">README</a> for details).</p> + <p>This is a very basic Frequently Asked Questions (FAQ) page which attempts to answer some of the more commonly asked questions. It is by no means exhaustive and should be used in combination with the 'built-in' User FAQ within phpBB, the community forums and our IRC channel (see <a href="README.html">README</a> for details).</p> <h1>FAQ</h1> @@ -78,7 +78,7 @@ <div class="content"> -<p>Simple answer, no we will not. We are not being difficult when we say this we are actually trying to help you. phpBB has a reputation for being easy to install, that reputation is we believe well deserved. It is a simple process of unarchiving a single file, uploading the resulting directory/files to their intended location and entering some data in a web based form. The sequence of events, what to type where, etc. is covered in detail in the accompanying <a href="INSTALL.html">INSTALL.html</a> documentation. If you cannot install phpBB3 the chances are you will be unable to administer or update it.</p> +<p>Simple answer, no we will not. We are not being difficult when we say this we are actually trying to help you. phpBB has a reputation for being easy to install, that reputation is we believe well deserved. It is a simple process of unarchiving a single file, uploading the resulting directory/files to their intended location and entering some data in a web based form. The sequence of events, what to type where, etc. is covered in detail in the accompanying <a href="INSTALL.html">INSTALL.html</a> documentation. If you cannot install phpBB the chances are you will be unable to administer or update it.</p> <p>There are people, companies (unrelated to your hosting provider), etc. that will install your forum, either for free or for a payment. We do not recommend you make use of these offers. Unless the service is provided by your hosting company you will have to divulge passwords and other sensitive details. If you did not know how to use an ATM would you give a passer-by your bank card and PIN and ask them to show you what to do? No, probably not! The same applies to your hosting account details!</p> diff --git a/phpBB/docs/INSTALL.html b/phpBB/docs/INSTALL.html index e3e12a3176..4bde6c01ea 100644 --- a/phpBB/docs/INSTALL.html +++ b/phpBB/docs/INSTALL.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <meta name="keywords" content="" /> <meta name="description" content="phpBB 3.1.x Installation, updating and conversion informations" /> -<title>phpBB3 • Install</title> +<title>phpBB • Install</title> <link href="stylesheet.css" rel="stylesheet" type="text/css" media="screen, projection" /> @@ -39,7 +39,7 @@ <p>This document will walk you through the basics on installing, updating and converting the forum software.</p> -<p>A basic overview of running phpBB3 can be found in the accompanying <a href="README.html">README</a> file. Please ensure you read that document in addition to this! For more detailed information on using, installing, updating and converting phpBB3 you should read <a href="https://www.phpbb.com/support/documentation/3.0/">the documentation</a> available online.</p> +<p>A basic overview of running phpBB can be found in the accompanying <a href="README.html">README</a> file. Please ensure you read that document in addition to this! For more detailed information on using, installing, updating and converting phpBB you should read <a href="https://www.phpbb.com/support/documentation/3.0/">the documentation</a> available online.</p> <h1>Install</h1> @@ -142,10 +142,11 @@ </ul> </li> <li><strong>PHP 5.3.3+</strong> with support for the database you intend to use.</li> - <li>The following PHP modules are required:</li> + <li>The following PHP modules are required: <ul> <li>json</li> </ul> + </li> <li>getimagesize() function must be enabled.</li> <li>Presence of the following modules within PHP will provide access to additional features, but they are not required: <ul> @@ -176,23 +177,23 @@ <div class="content"> - <p>Installation of phpBB3 will vary according to your server and database. If you have <em>shell access</em> to your account (via telnet or ssh for example) you may want to upload the entire phpBB3 archive (in binary mode!) to a directory on your host and unarchive it there.</p> + <p>Installation of phpBB will vary according to your server and database. If you have <em>shell access</em> to your account (via telnet or ssh for example) you may want to upload the entire phpBB archive (in binary mode!) to a directory on your host and unarchive it there.</p> - <p>If you do not have shell access or do not wish to use it, you will need to decompress the phpBB3 archive to a local directory on your system using your favourite compression program, e.g. winzip, rar, zip, etc. From there you must FTP <strong>ALL</strong> the files it contains (being sure to retain the directory structure and filenames) to your host. Please ensure that the cases of filenames are retained, do <strong>NOT</strong> force filenames to all lower or upper case as doing so will cause errors later.</p> + <p>If you do not have shell access or do not wish to use it, you will need to decompress the phpBB archive to a local directory on your system using your favourite compression program, e.g. winzip, rar, zip, etc. From there you must FTP <strong>ALL</strong> the files it contains (being sure to retain the directory structure and filenames) to your host. Please ensure that the cases of filenames are retained, do <strong>NOT</strong> force filenames to all lower or upper case as doing so will cause errors later.</p> <p>All .php, .sql, .cfg, .css, .js, .html, .htaccess and .txt files should be uploaded in <strong>ASCII</strong> mode, while all graphics should be uploaded in <strong>BINARY</strong> mode. If you are unfamiliar with what this means please refer to your FTP client documentation. In most cases this is all handled transparantly by your ftp client, but if you encounter problems later you should be sure the files were uploaded correctly as described here.</p> - <p>phpBB3 comes supplied with British English as its standard language. However, a number of separate packs for different languages are available. If you are not a native English speaker you may wish to install one or more of these packages before continuing. The installation process below will allow you to select a default language from those available (you can, of course, change this default at a later stage). For more details on language packs, where to obtain them and how to install them please see the <a href="README.html#i18n">README</a>.</p> + <p>phpBB comes supplied with British English as its standard language. However, a number of separate packs for different languages are available. If you are not a native English speaker you may wish to install one or more of these packages before continuing. The installation process below will allow you to select a default language from those available (you can, of course, change this default at a later stage). For more details on language packs, where to obtain them and how to install them please see the <a href="README.html#i18n">README</a>.</p> - <p>Once all the files have been uploaded to your site, you should point your browser at this location with the addition of <code>/install/</code>. For example, if your domain name is <code>www.example.com</code> and you placed the phpBB3 files in the directory <code>/phpBB3</code> off your web root you would enter <code>http://www.example.com/phpBB3/install/</code> or (alternatively) <code>http://www.example.com/phpBB3/install/index.php</code> into your browser. When you have done this, you should see the <strong><em>phpBB3 Introduction</em></strong> screen appear.</p> + <p>Once all the files have been uploaded to your site, you should point your browser at this location with the addition of <code>/install/</code>. For example, if your domain name is <code>www.example.com</code> and you placed the phpBB files in the directory <code>/phpBB3</code> off your web root you would enter <code>http://www.example.com/phpBB3/install/</code> or (alternatively) <code>http://www.example.com/phpBB3/install/index.php</code> into your browser. When you have done this, you should see the <strong><em>phpBB Introduction</em></strong> screen appear.</p> <h4>Introduction:</h4> - <p>The initial screen gives you a short introduction into phpBB. It allows you to read the license phpBB3 is released under (General Public License v2) and provides information about how you can receive support. To start the installation, use the <strong><em>INSTALL</em></strong> tab.</p> + <p>The initial screen gives you a short introduction into phpBB. It allows you to read the license phpBB is released under (General Public License v2) and provides information about how you can receive support. To start the installation, use the <strong><em>INSTALL</em></strong> tab.</p> <h4>Requirements</h4> - <p>The first page you will see after starting the installation is the Requirements list. phpBB3 automatically checks whether everything that it needs to run properly is installed on your server. You need to have at least the minimum PHP version installed, and at least one database available to continue the installation. Also important, is that all shown folders are available and have the correct permissions. Please see the description of each section to find out whether they are optional or required for phpBB3 to run. If everything is in order, you can continue the installation with <em>Start Install</em>.</p> + <p>The first page you will see after starting the installation is the Requirements list. phpBB automatically checks whether everything that it needs to run properly is installed on your server. You need to have at least the minimum PHP version installed, and at least one database available to continue the installation. Also important, is that all shown folders are available and have the correct permissions. Please see the description of each section to find out whether they are optional or required for phpBB to run. If everything is in order, you can continue the installation with <em>Start Install</em>.</p> <h4>Database settings</h4> @@ -212,7 +213,7 @@ <p>You don't need to change the Prefix for tables in database setting, unless you plan on using multipe phpBB installations on one database. In this case, you can use a different prefix for each installation to make it work.</p> - <p>After you entered your details, you can continue with the <em>Proceed to next step</em> button. Now phpBB3 will check whether the data you entered will lead to a successful database connection and whether tables with the same prefix already exist.</p> + <p>After you entered your details, you can continue with the <em>Proceed to next step</em> button. Now phpBB will check whether the data you entered will lead to a successful database connection and whether tables with the same prefix already exist.</p> <p>A <em>Could not connect to the database</em> error means that you didn't enter the database data correctly and it is not possible for phpBB to connect. Make sure that everything you entered is in order and try again. Again, if you are unsure about your database settings, please contact your host.</p> @@ -222,7 +223,7 @@ <h4>Administrator details</h4> - <p>Now you have to create your administration user. This user will have full administration access and he/she will be the first user on your forum. All fields on this page are required. You can also set the default language of your forum on this page. In a vanilla phpBB3 installation, we only include British English. You can download further languages from <a href="https://www.phpbb.com/">www.phpbb.com</a>, and add them before installing or later.</p> + <p>Now you have to create your administration user. This user will have full administration access and he/she will be the first user on your forum. All fields on this page are required. You can also set the default language of your forum on this page. In a vanilla phpBB installation, we only include British English. You can download further languages from <a href="https://www.phpbb.com/">www.phpbb.com</a>, and add them before installing or later.</p> <h4>Configuration file</h4> @@ -236,7 +237,7 @@ <p>If the installation was successful, you can now use the <em>Login</em> button to visit the Administration Control Panel. Congratulations, you have installed phpBB successfully. But there is still work ahead!</p> - <p>If you are unable to get phpBB3 installed even after reading this guide, please look at the support section of the installer's introduction page to find out where you can ask for further assistance.</p> + <p>If you are unable to get phpBB installed even after reading this guide, please look at the support section of the installer's introduction page to find out where you can ask for further assistance.</p> <p>At this point if you are converting from phpBB 2.0.x, you should refer to the <a href="#convert">conversion steps</a> for further information. If not, you should remove the install directory from your server as you will only be able to access the Administration Control Panel whilst it is present.</p> @@ -256,15 +257,15 @@ <div class="content"> -<p>If you are currently using a stable release of phpBB3, updating to this version is straightforward. You would have downloaded one of four packages and your choice determines what you need to do. <strong>Note</strong>: Before updating, we heavily recommend you do a <em>full backup of your database and existing phpBB3 files</em>! If you are unsure how to achieve this please ask your hosting provider for advice.</p> +<p>If you are currently using a stable release of phpBB, updating to this version is straightforward. You would have downloaded one of four packages and your choice determines what you need to do. <strong>Note</strong>: Before updating, we heavily recommend you do a <em>full backup of your database and existing phpBB files</em>! If you are unsure how to achieve this please ask your hosting provider for advice.</p> -<p><strong>Please make sure you update your phpBB3 source files too, even if you run the <code>database_update.php</code> file.</strong></p> +<p><strong>Please make sure you update your phpBB source files too, even if you run the <code>database_update.php</code> file.</strong></p> <a name="update_full"></a><h3>4.i. Full package</h3> <p>The full package is normally meant for new installations only, but if you want to replace all source files, this package comes in handy.</p> - <p>First, you should make a copy of your existing <code>config.php</code> file; keep it in a safe place! Next, delete all the existing phpBB3 files, you may want to leave your <code>files/</code> and <code>images/</code> directorie in place. You can leave alternative styles in place too. With this complete, you can upload the new phpBB files (see <a href="#install">New installation</a> for details if necessary). Once complete, copy back your saved <code>config.php</code>, replacing the new one. Another method is to just <strong>replace</strong> the existing files with the files from the full package - though make sure you do <strong>not</strong> overwrite your config.php file.</p> + <p>First, you should make a copy of your existing <code>config.php</code> file; keep it in a safe place! Next, delete all the existing phpBB files, you may want to leave your <code>files/</code> and <code>images/</code> directories in place. You can leave alternative styles in place too. With this complete, you can upload the new phpBB files (see <a href="#install">New installation</a> for details if necessary). Once complete, copy back your saved <code>config.php</code>, replacing the new one. Another method is to just <strong>replace</strong> the existing files with the files from the full package - though make sure you do <strong>not</strong> overwrite your config.php file.</p> <p>You should now run <code>install/database_update.php</code> which, depending on your previous version, will make a number of database changes. You may receive <em>FAILURES</em> during this procedure. They should not be a cause for concern unless you see an actual <em>ERROR</em>, in which case the script will stop (in this case you should seek help via our forums or bug tracker).</p> @@ -303,7 +304,7 @@ <ul> <li>Go to the <a href="https://www.phpbb.com/downloads/">downloads page</a> and download the latest update package listed there, matching your current version.</li> <li>Upload the uncompressed archive contents to your phpBB installation - only the install folder is required. Upload the whole install folder, retaining the file structure.</li> - <li>After the install folder is present, phpBB3 will go offline automatically.</li> + <li>After the install folder is present, phpBB will go offline automatically.</li> <li>Point your browser to the install directory, for example <code>http://www.example.com/phpBB3/install/</code></li> <li>Choose the "Update" Tab and follow the instructions</li> </ul> @@ -429,13 +430,13 @@ <div class="content"> - <p>Once you have successfully installed phpBB3 you <strong>MUST</strong> ensure you remove the entire <code>install/</code> directory. Leaving the install directory in place is a <em>very serious potential security issue</em> which may lead to deletion or alteration of files, etc. Please note that until this directory is removed, phpBB will not operate and a warning message will be displayed. Beyond this <strong>essential</strong> deletion, you may also wish to delete the docs/ directory if you wish.</p> + <p>Once you have successfully installed phpBB you <strong>MUST</strong> ensure you remove the entire <code>install/</code> directory. Leaving the install directory in place is a <em>very serious potential security issue</em> which may lead to deletion or alteration of files, etc. Please note that until this directory is removed, phpBB will not operate and a warning message will be displayed. Beyond this <strong>essential</strong> deletion, you may also wish to delete the docs/ directory if you wish.</p> <p>With these directories deleted, you should proceed to the administration panel. Depending on how the installation completed, you may have been directed there automatically. If not, login as the administrator you specified during install/conversion and click the <strong>Administration Control Panel</strong> link at the bottom of any page. Ensure that details specified on the <strong>General</strong> tab are correct!</p> <a name="avatars"></a><h3>6.i. Uploadable avatars</h3> - <p>phpBB3 supports several methods for allowing users to select their own <em>avatar</em> (an avatar is a small image generally unique to a user and displayed just below their username in posts).</p> + <p>phpBB supports several methods for allowing users to select their own <em>avatar</em> (an avatar is a small image generally unique to a user and displayed just below their username in posts).</p> <p>Two of these options allow users to upload an avatar from their machine or a remote location (via a URL). If you wish to enable this function you should first ensure the correct path for uploadable avatars is set in <strong>Administration Control Panel -> General -> Board Configuration -> Avatar settings</strong>. By default this is <code>images/avatars/uploads</code>, but you can set it to whatever you like, just ensure the configuration setting is updated. You must also ensure this directory can be written to by the webserver. Usually this means you have to alter its permissions to allow anyone to read and write to it. Exactly how you should do this depends on your FTP client or server operating system.</p> diff --git a/phpBB/docs/README.html b/phpBB/docs/README.html index e64d3dd8f2..77d5d33115 100644 --- a/phpBB/docs/README.html +++ b/phpBB/docs/README.html @@ -4,7 +4,7 @@ <meta charset="utf-8"> <meta name="keywords" content="" /> <meta name="description" content="phpBB 3.1.x Readme" /> -<title>phpBB3 • Readme</title> +<title>phpBB • Readme</title> <link href="stylesheet.css" rel="stylesheet" type="text/css" media="screen, projection" /> @@ -34,7 +34,7 @@ <!-- BEGIN DOCUMENT --> - <p>Thank you for downloading phpBB3. This README will guide you through the basics of installation and operation of phpBB3. Please ensure you read this and the accompanying documentation fully <strong>before</strong> proceeding with the installation.</p> + <p>Thank you for downloading phpBB. This README will guide you through the basics of installation and operation of phpBB. Please ensure you read this and the accompanying documentation fully <strong>before</strong> proceeding with the installation.</p> <h1>Readme</h1> @@ -44,15 +44,15 @@ <div class="content"> <ol> - <li><a href="#install">Installing phpBB3</a></li> - <li><a href="#run">Running phpBB3</a> + <li><a href="#install">Installing phpBB</a></li> + <li><a href="#run">Running phpBB</a> <ol style="list-style-type: lower-roman;"> <li><a href="#i18n">Languages (Internationalisation - i18n)</a></li> <li><a href="#styles">Styles</a></li> - <li><a href="#mods">Modifications</a></li> + <li><a href="#extensions">Extensions</a></li> </ol> </li> - <li><a href="#help">Getting help with phpBB3</a> + <li><a href="#help">Getting help with phpBB</a> <ol style="list-style-type: lower-roman;"> <li><a href="#docs">Documentation</a></li> <li><a href="#kb">Knowledge Base</a></li> @@ -78,7 +78,7 @@ <hr /> - <a name="install"></a><h2>1. Installing phpBB3</h2> + <a name="install"></a><h2>1. Installing phpBB</h2> <div class="paragraph"> <div class="inner"><span class="corners-top"><span></span></span> @@ -115,7 +115,7 @@ <hr /> - <a name="run"></a><h2>2. Running phpBB3</h2> + <a name="run"></a><h2>2. Running phpBB</h2> <div class="paragraph"> <div class="inner"><span class="corners-top"><span></span></span> @@ -132,31 +132,31 @@ <p>This is the <em>official</em> location for all supported language sets. If you download a package from a 3rd party site you do so with the understanding that we cannot offer support. Please do not ask for support if you download a language pack from a 3rd party site.</p> - <p>Installation of these packages is straightforward: simply download the required language pack, uncompress (unzip) it and via FTP transfer the included <code>language</code> and <code>styles</code> folders to the root of your board installation. The language can then be installed via the Administration Control Panel of your board: <code>System tab -> General Tasks -> Language packs</code>. A more detailed description of the process is in the Knowledge Base article, <a href="https://www.phpbb.com/kb/article/how-to-install-a-language-pack/">How to Install a Language Pack</a>.</p> + <p>Installation of these packages is straightforward: simply download the required language pack, uncompress (unzip) it and via FTP transfer the included <code>language</code> and <code>styles</code> folders to the root of your board installation. The language can then be installed via the Administration Control Panel of your board: <code>Customise tab -> Language management -> Language packs</code>. A more detailed description of the process is in the Knowledge Base article, <a href="https://www.phpbb.com/kb/article/how-to-install-a-language-pack/">How to Install a Language Pack</a>.</p> <p>If your language is not available, please visit our <a href="https://www.phpbb.com/community/viewforum.php?f=66">[3.0.x] Translations</a> forum where you will find topics on translations in progress. Should you wish to volunteer to translate a language not currently available or assist in maintaining an existing language pack, you can <a href="https://www.phpbb.com/languages/apply.php">Apply to become a translator</a>.</p> <a name="styles"></a><h3>2.ii. Styles</h3> - <p>Although we are rather proud of the included styles, we realise that they may not be to everyone's taste. Therefore, phpBB3 allows styles to be switched with relative ease. First, you need to locate and download a style you like. You can find them listed in the <a href="https://www.phpbb.com/customise/db/styles-2/">Styles</a> section of our <a href="https://www.phpbb.com/customise/db/">Customisation Database</a>.</p> + <p>Although we are rather proud of the included styles, we realise that they may not be to everyone's taste. Therefore, phpBB allows styles to be switched with relative ease. First, you need to locate and download a style you like. You can find them listed in the <a href="https://www.phpbb.com/customise/db/styles-2/">Styles</a> section of our <a href="https://www.phpbb.com/customise/db/">Customisation Database</a>.</p> <p>For more information about styles, please see: <a href="https://www.phpbb.com/styles/">https://www.phpbb.com/styles/</a></p> <p><strong>Please note</strong> that 3rd party styles downloaded for versions of phpBB2 will <strong>not</strong> work in phpBB3. It is also important to ensure that the style is updated to match the current version of the phpBB software you are using.</p> - <p>Once you have downloaded a style, the usual next step is to unarchive (or upload the unarchived contents of) the package into your <code>styles/</code> directory. You then need to visit <code>Administration Control Panel -> Styles tab</code> where you should see the new style available. Click "Install" to install the style.</p> + <p>Once you have downloaded a style, the usual next step is to unarchive (or upload the unarchived contents of) the package into your <code>styles/</code> directory. You then need to visit <code>Administration Control Panel -> Customise tab -> Style management -> Install Styles</code> where you should see the new style available. Click "Install style" to install the style.</p> - <p><strong>Please note</strong> that to improve efficiency, the software caches certain data. For this reason, if you create your own style or modify existing ones, please remember to "Refresh" the appropriate style components <code>Administration Control Panel -> Styles tab -> Style Components</code> screen. You may also need to reload the page you have changed in your web browser to overcome browser caching. If the changed components are not refreshed you will not see your changes taking effect.</p> + <p><strong>Please note</strong> that to improve efficiency, the software caches certain data. For this reason, if you create your own style or modify existing ones, please remember to purge the board cache by clicking the <code>Run now</code> button next to the <code>Purge the cache</code> option in the index page of the Administration Control Panel. You may also need to reload the page you have changed in your web browser to overcome browser caching. If the cache is not purged, you will not see your changes taking effect.</p> - <a name="mods"></a><h3>2.iii. Modifications</h3> + <a name="extensions"></a><h3>2.iii. Extensions</h3> - <p>We are proud to have a thriving modifications community. These third party modifications to the standard phpBB software, known as <strong>MODs</strong>, extend its capabilities still further. You can browse through many of the MODs in the <a href="https://www.phpbb.com/customise/db/modifications-1/">Modifications</a> section of our <a href="https://www.phpbb.com/customise/db/">Customisation Database</a>.</p> + <p>We are proud to have a thriving extensions community. These third party extensions to the standard phpBB software, extend its capabilities still further. You can browse through many of the extensions in the <a href="https://www.phpbb.com/customise/db/extensions-27/">Extensions</a> section of our <a href="https://www.phpbb.com/customise/db/">Customisation Database</a>.</p> - <p>For more information about MODs, please see: <a href="https://www.phpbb.com/mods/">https://www.phpbb.com/mods/</a></p> + <p>For more information about extensions, please see: <a href="https://www.phpbb.com/extensions">https://www.phpbb.com/extensions</a></p> - <p><strong>Please remember</strong> that any bugs or other issues that occur after you have added any modification should <strong>NOT</strong> be reported to the bug tracker (see below). First remove the MOD and see if the problem is resolved. Any support for a MOD should only be sought in the "Discussion/Support" forum for that MOD.</p> + <p><strong>Please remember</strong> that any bugs or other issues that occur after you have added any extension should <strong>NOT</strong> be reported to the bug tracker (see below). First disable the extension and see if the problem is resolved. Any support for an extension should only be sought in the "Discussion/Support" forum for that extension.</p> - <p>Also remember that any modifications, particularly those which modify the database in any way, may render upgrading your forum to future versions more difficult. With all this said, many users have and continue to utilise many of the MODs already available with great success.</p> + <p>Also remember that any extensions which modify the database in any way, may render upgrading your forum to future versions more difficult.</p> </div> @@ -167,16 +167,16 @@ <hr /> -<a name="help"></a><h2>3. Getting help with phpBB3</h2> +<a name="help"></a><h2>3. Getting help with phpBB</h2> <div class="paragraph"> <div class="inner"><span class="corners-top"><span></span></span> <div class="content"> - <p>phpBB3 can sometimes seem a little daunting to new users, particularly with regards to the permission system. The first thing you should do is check the <a href="FAQ.html">FAQ</a>, which covers a few basic getting started questions. If you need additional help there are several places you can find it.</p> + <p>phpBB can sometimes seem a little daunting to new users, particularly with regards to the permission system. The first thing you should do is check the <a href="FAQ.html">FAQ</a>, which covers a few basic getting started questions. If you need additional help there are several places you can find it.</p> - <a name="docs"></a><h3>3.i. phpBB3 Documentation</h3> + <a name="docs"></a><h3>3.i. phpBB Documentation</h3> <p>Comprehensive documentation is now available on the phpBB website:</p> @@ -244,16 +244,16 @@ <div class="content"> - <p>The phpBB Limited uses a bug tracking system to store, list and manage all reported bugs, it can be found at the location listed below. Please <strong>DO NOT</strong> post bug reports to our forums. In addition please <strong>DO NOT</strong> use the bug tracker for support requests. Posting such a request will only see you directed to the support forums (while taking time away from working on real bugs).</p> + <p>The phpBB developers use a bug tracking system to store, list and manage all reported bugs, it can be found at the location listed below. Please <strong>DO NOT</strong> post bug reports to our forums. In addition please <strong>DO NOT</strong> use the bug tracker for support requests. Posting such a request will only see you directed to the support forums (while taking time away from working on real bugs).</p> <p><a href="http://tracker.phpbb.com/browse/PHPBB3">http://tracker.phpbb.com/browse/PHPBB3</a></p> <p>While we very much appreciate receiving bug reports (the more reports the more stable phpBB will be) we ask you carry out a few steps before adding new entries:</p> <ul> - <li>First, determine if your bug is reproduceable; how to determine this depends on the bug in question. Only if the bug is reproduceable is it likely to be a problem with phpBB3 (or in some way connected). If something cannot be reproduced it may turn out to have been your hosting provider working on something, a user doing something silly, etc. Bug reports for non-reproduceable events can slow down our attempts to fix real, reproduceable issues<br /><br /></li> + <li>First, determine if your bug is reproduceable; how to determine this depends on the bug in question. Only if the bug is reproduceable is it likely to be a problem with phpBB (or in some way connected). If something cannot be reproduced it may turn out to have been your hosting provider working on something, a user doing something silly, etc. Bug reports for non-reproduceable events can slow down our attempts to fix real, reproduceable issues<br /><br /></li> <li>Next, please read or search through the existing bug reports to see if <em>your</em> bug (or one very similar to it) is already listed. If it is please add to that existing bug rather than creating a new duplicate entry (all this does is slow us down).<br /><br /></li> - <li>Check the forums (use search!) to see if people have discussed anything that sounds similar to what you are seeing. However, as noted above please <strong>DO NOT</strong> post your particular bug to the forum unless it's non-reproduceable or you are sure it’s related to something you have done rather than phpBB3<br /><br /></li> + <li>Check the forums (use search!) to see if people have discussed anything that sounds similar to what you are seeing. However, as noted above please <strong>DO NOT</strong> post your particular bug to the forum unless it's non-reproduceable or you are sure it’s related to something you have done rather than phpBB<br /><br /></li> <li>If no existing bug exists then please feel free to add it</li> </ul> @@ -267,7 +267,7 @@ <p>The relevant database type/version is listed within the administration control panel.</p> - <p>Please be as detailed as you can in your report, and if possible, list the steps required to duplicate the problem. If you have a patch that fixes the issue, please attach it to the ticket or submit a pull request to our repository <a href="https://github.com/phpbb/phpbb3">on GitHub</a>.</p> + <p>Please be as detailed as you can in your report, and if possible, list the steps required to duplicate the problem. If you have a patch that fixes the issue, please attach it to the ticket or submit a pull request to our repository <a href="https://github.com/phpbb/phpbb">on GitHub</a>.</p> <p>If you create a patch, it is very much appreciated (but not required) if you follow the phpBB coding guidelines. Please note that the coding guidelines are somewhat different between different versions of phpBB. For phpBB 3.1.x the coding guidelines may be found here: <a href="http://area51.phpbb.com/docs/31x/coding-guidelines.html">http://area51.phpbb.com/docs/31x/coding-guidelines.html</a></p> @@ -321,7 +321,7 @@ <p>phpBB 3.1.x takes advantage of new features added in PHP 5.3. We recommend that you upgrade to the latest stable release of PHP5 to run phpBB. The minimum version required is PHP 5.3.3.</p> - <p>Please remember that running any application on a development (unstable, e.g. a beta release) version of PHP can lead to strange/unexpected results which may appear to be bugs in the application. Therefore, we recommend you upgrade to the newest stable version of PHP before running phpBB3. If you are running a development version of PHP please check any bugs you find on a system running a stable release before submitting.</p> + <p>Please remember that running any application on a development (unstable, e.g. a beta release) version of PHP can lead to strange/unexpected results which may appear to be bugs in the application. Therefore, we recommend you upgrade to the newest stable version of PHP before running phpBB. If you are running a development version of PHP please check any bugs you find on a system running a stable release before submitting.</p> <p>This board has been developed and tested under Linux and Windows (amongst others) running Apache using MySQL 3.23, 4.x, 5.x, MariaDB 5.x, MSSQL Server 2000, PostgreSQL 8.x, Oracle 8, SQLite 2 and SQLite 3. Versions of PHP used range from 5.3.x to 5.4.x without problem.</p> diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index e1308c71d1..c51bc72160 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -224,6 +224,38 @@ forumlist_body_category_header_before * Since: 3.1.0-a4 * Purpose: Add content before the header of the category on the forum list. +forumlist_body_forum_row_after +=== +* Locations: + + styles/prosilver/template/forumlist_body.html + + styles/subsilver2/template/forumlist_body.html +* Since: 3.1.0-RC5 +* Purpose: Add content after the forum list item. + +forumlist_body_forum_row_append +=== +* Locations: + + styles/prosilver/template/forumlist_body.html + + styles/subsilver2/template/forumlist_body.html +* Since: 3.1.0-RC5 +* Purpose: Add content at the start of the forum list item. + +forumlist_body_forum_row_before +=== +* Locations: + + styles/prosilver/template/forumlist_body.html + + styles/subsilver2/template/forumlist_body.html +* Since: 3.1.0-RC5 +* Purpose: Add content before the forum list item. + +forumlist_body_forum_row_prepend +=== +* Locations: + + styles/prosilver/template/forumlist_body.html + + styles/subsilver2/template/forumlist_body.html +* Since: 3.1.0-RC5 +* Purpose: Add content at the end of the forum list item. + forumlist_body_last_post_title_prepend === * Locations: @@ -1123,6 +1155,70 @@ ucp_friend_list_after * Since: 3.1.0-a4 * Purpose: Add optional elements after list of friends in UCP +viewforum_buttons_bottom_before +=== +* Locations: + + styles/prosilver/template/viewforum_body.html + + styles/subsilver2/template/viewforum_body.html +* Since: 3.1.0-RC5 +* Purpose: Add buttons before New Topic button on the bottom of the topic's list + +viewforum_buttons_bottom_after +=== +* Locations: + + styles/prosilver/template/viewforum_body.html + + styles/subsilver2/template/viewforum_body.html +* Since: 3.1.0-RC5 +* Purpose: Add buttons after New Topic button on the bottom of the topic's list + +viewforum_buttons_top_before +=== +* Locations: + + styles/prosilver/template/viewforum_body.html + + styles/subsilver2/template/viewforum_body.html +* Since: 3.1.0-RC5 +* Purpose: Add buttons before New Topic button on the top of the topic's list + +viewforum_buttons_top_after +=== +* Locations: + + styles/prosilver/template/viewforum_body.html + + styles/subsilver2/template/viewforum_body.html +* Since: 3.1.0-RC5 +* Purpose: Add buttons after New Topic button on the top of the topic's list + +viewtopic_buttons_bottom_before +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html + + styles/subsilver2/template/viewtopic_body.html +* Since: 3.1.0-RC5 +* Purpose: Add buttons before Post Reply button on the bottom of the posts's list + +viewtopic_buttons_bottom_after +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html + + styles/subsilver2/template/viewtopic_body.html +* Since: 3.1.0-RC5 +* Purpose: Add buttons after Post Reply button on the bottom of the posts's list + +viewtopic_buttons_top_before +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html + + styles/subsilver2/template/viewtopic_body.html +* Since: 3.1.0-RC5 +* Purpose: Add buttons before Post Reply button on the top of the posts's list + +viewtopic_buttons_top_after +=== +* Locations: + + styles/prosilver/template/viewtopic_body.html + + styles/subsilver2/template/viewtopic_body.html +* Since: 3.1.0-RC5 +* Purpose: Add buttons after Post Reply button on the top of the posts's list + viewforum_forum_name_append === * Locations: diff --git a/phpBB/feed.php b/phpBB/feed.php index d4dfb15928..e0c0b01db6 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -165,7 +165,6 @@ if (defined('DEBUG') && request_var('explain', 0) && $auth->acl_get('a_')) header('Content-type: text/html; charset=UTF-8'); header('Cache-Control: private, no-cache="set-cookie"'); header('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT'); - header('Pragma: no-cache'); $mtime = explode(' ', microtime()); $totaltime = $mtime[0] + $mtime[1] - $starttime; diff --git a/phpBB/includes/acp/acp_ban.php b/phpBB/includes/acp/acp_ban.php index 361ef2666c..b555f46a94 100644 --- a/phpBB/includes/acp/acp_ban.php +++ b/phpBB/includes/acp/acp_ban.php @@ -25,14 +25,13 @@ class acp_ban function main($id, $mode) { - global $config, $db, $user, $auth, $template, $cache; - global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix; + global $user, $template, $request, $phpbb_dispatcher; + global $phpbb_root_path, $phpEx; include($phpbb_root_path . 'includes/functions_user.' . $phpEx); - $bansubmit = (isset($_POST['bansubmit'])) ? true : false; - $unbansubmit = (isset($_POST['unbansubmit'])) ? true : false; - $current_time = time(); + $bansubmit = $request->is_set_post('bansubmit'); + $unbansubmit = $request->is_set_post('unbansubmit'); $user->add_lang(array('acp/ban', 'acp/users')); $this->tpl_name = 'acp_ban'; @@ -48,23 +47,79 @@ class acp_ban if ($bansubmit) { // Grab the list of entries - $ban = utf8_normalize_nfc(request_var('ban', '', true)); - $ban_len = request_var('banlength', 0); - $ban_len_other = request_var('banlengthother', ''); - $ban_exclude = request_var('banexclude', 0); - $ban_reason = utf8_normalize_nfc(request_var('banreason', '', true)); - $ban_give_reason = utf8_normalize_nfc(request_var('bangivereason', '', true)); + $ban = $request->variable('ban', '', true); + $ban_length = $request->variable('banlength', 0); + $ban_length_other = $request->variable('banlengthother', ''); + $ban_exclude = $request->variable('banexclude', 0); + $ban_reason = $request->variable('banreason', '', true); + $ban_give_reason = $request->variable('bangivereason', '', true); if ($ban) { - user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reason, $ban_give_reason); + $abort_ban = false; + /** + * Use this event to modify the ban details before the ban is performed + * + * @event core.acp_ban_before + * @var string mode One of the following: user, ip, email + * @var string ban Either string or array with usernames, ips or email addresses + * @var int ban_length Ban length in minutes + * @var string ban_length_other Ban length as a date (YYYY-MM-DD) + * @var bool ban_exclude Are we banning or excluding from another ban + * @var string ban_reason Ban reason displayed to moderators + * @var string ban_give_reason Ban reason displayed to the banned user + * @var mixed abort_ban Either false, or an error message that is displayed to the user. + * If a string is given the bans are not issued. + * @since 3.1.0-RC5 + */ + $vars = array( + 'mode', + 'ban', + 'ban_length', + 'ban_length_other', + 'ban_exclude', + 'ban_reason', + 'ban_give_reason', + 'abort_ban', + ); + extract($phpbb_dispatcher->trigger_event('core.acp_ban_before', compact($vars))); + + if ($abort_ban) + { + trigger_error($abort_ban . adm_back_link($this->u_action)); + } + user_ban($mode, $ban, $ban_length, $ban_length_other, $ban_exclude, $ban_reason, $ban_give_reason); + + /** + * Use this event to perform actions after the ban has been performed + * + * @event core.acp_ban_after + * @var string mode One of the following: user, ip, email + * @var string ban Either string or array with usernames, ips or email addresses + * @var int ban_length Ban length in minutes + * @var string ban_length_other Ban length as a date (YYYY-MM-DD) + * @var bool ban_exclude Are we banning or excluding from another ban + * @var string ban_reason Ban reason displayed to moderators + * @var string ban_give_reason Ban reason displayed to the banned user + * @since 3.1.0-RC5 + */ + $vars = array( + 'mode', + 'ban', + 'ban_length', + 'ban_length_other', + 'ban_exclude', + 'ban_reason', + 'ban_give_reason', + ); + extract($phpbb_dispatcher->trigger_event('core.acp_ban_after', compact($vars))); trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . adm_back_link($this->u_action)); } } else if ($unbansubmit) { - $ban = request_var('unban', array('')); + $ban = $request->variable('unban', array('')); if ($ban) { diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index f2707f15ca..f4f7512f0c 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -65,13 +65,16 @@ class acp_board 'default_lang' => array('lang' => 'DEFAULT_LANGUAGE', 'validate' => 'lang', 'type' => 'select', 'function' => 'language_select', 'params' => array('{CONFIG_VALUE}'), 'explain' => false), 'default_dateformat' => array('lang' => 'DEFAULT_DATE_FORMAT', 'validate' => 'string', 'type' => 'custom', 'method' => 'dateformat_select', 'explain' => true), 'board_timezone' => array('lang' => 'SYSTEM_TIMEZONE', 'validate' => 'timezone', 'type' => 'custom', 'method' => 'timezone_select', 'explain' => true), - 'default_style' => array('lang' => 'DEFAULT_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array('{CONFIG_VALUE}', false), 'explain' => false), + + 'legend2' => 'BOARD_STYLE', + 'default_style' => array('lang' => 'DEFAULT_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array('{CONFIG_VALUE}', false), 'explain' => true), + 'guest_style' => array('lang' => 'GUEST_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array($this->guest_style_get(), false), 'explain' => true), 'override_user_style' => array('lang' => 'OVERRIDE_STYLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'legend2' => 'WARNINGS', + 'legend3' => 'WARNINGS', 'warnings_expire_days' => array('lang' => 'WARNINGS_EXPIRE', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), - 'legend3' => 'ACP_SUBMIT_CHANGES', + 'legend4' => 'ACP_SUBMIT_CHANGES', ) ); break; @@ -509,6 +512,14 @@ class acp_board continue; } + if ($config_name == 'guest_style') + { + if (isset($cfg_array[$config_name])) { + $this->guest_style_set($cfg_array[$config_name]); + } + continue; + } + $this->new_config[$config_name] = $config_value = $cfg_array[$config_name]; if ($config_name == 'email_function_name') @@ -904,12 +915,44 @@ class acp_board */ function timezone_select($value, $key) { - global $user; + global $template, $user; + + $timezone_select = phpbb_timezone_select($template, $user, $value, true); - $timezone_select = phpbb_timezone_select($user, $value, true); - $timezone_select['tz_select']; + return '<select name="config[' . $key . ']" id="' . $key . '">' . $timezone_select . '</select>'; + } - return '<select name="config[' . $key . ']" id="' . $key . '">' . $timezone_select['tz_select'] . '</select>'; + /** + * Get guest style + */ + public function guest_style_get() + { + global $db; + + $sql = 'SELECT user_style + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . ANONYMOUS; + $result = $db->sql_query($sql); + + $style = (int) $db->sql_fetchfield('user_style'); + $db->sql_freeresult($result); + + return $style; + } + + /** + * Set guest style + * + * @param int $style_id The style ID + */ + public function guest_style_set($style_id) + { + global $db; + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_style = ' . (int) $style_id . ' + WHERE user_id = ' . ANONYMOUS; + $db->sql_query($sql); } /** diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index 8f9c155ffc..0c52f82459 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -269,7 +269,7 @@ class acp_database break; } - header('Pragma: no-cache'); + header('Cache-Control: private, no-cache'); header("Content-Type: $mimetype; name=\"$name\""); header("Content-disposition: attachment; filename=$name"); @@ -510,7 +510,7 @@ class base_extractor if ($download == true) { $name = $filename . $ext; - header('Pragma: no-cache'); + header('Cache-Control: private, no-cache'); header("Content-Type: $mimetype; name=\"$name\""); header("Content-disposition: attachment; filename=$name"); diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php index 028025b547..9265415dd1 100644 --- a/phpBB/includes/acp/acp_icons.php +++ b/phpBB/includes/acp/acp_icons.php @@ -737,7 +737,7 @@ class acp_icons { garbage_collection(); - header('Pragma: public'); + header('Cache-Control: public'); // Send out the Headers header('Content-Type: text/x-delimtext; name="' . $mode . '.pak"'); diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 2a28226d6c..48ca05a118 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -655,8 +655,8 @@ class acp_main 'S_MBSTRING_LOADED' => true, 'S_MBSTRING_FUNC_OVERLOAD_FAIL' => (intval(@ini_get('mbstring.func_overload')) & (MB_OVERLOAD_MAIL | MB_OVERLOAD_STRING)), 'S_MBSTRING_ENCODING_TRANSLATION_FAIL' => (@ini_get('mbstring.encoding_translation') != 0), - 'S_MBSTRING_HTTP_INPUT_FAIL' => (@ini_get('mbstring.http_input') != 'pass'), - 'S_MBSTRING_HTTP_OUTPUT_FAIL' => (@ini_get('mbstring.http_output') != 'pass'), + 'S_MBSTRING_HTTP_INPUT_FAIL' => !in_array(@ini_get('mbstring.http_input'), array('pass', '')), + 'S_MBSTRING_HTTP_OUTPUT_FAIL' => !in_array(@ini_get('mbstring.http_output'), array('pass', '')), )); } diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 2a02e3e845..42c67a88b5 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -133,33 +133,11 @@ class acp_styles $this->welcome_message('INSTALL_STYLES', 'INSTALL_STYLES_EXPLAIN'); $this->show_available(); return; - case 'cache': - $this->action_cache(); - return; } trigger_error($this->user->lang['NO_MODE'] . adm_back_link($this->u_action), E_USER_WARNING); } /** - * Purge cache - */ - protected function action_cache() - { - global $db, $cache, $auth; - - $this->config->increment('assets_version', 1); - $this->cache->purge(); - - // Clear permissions - $this->auth->acl_clear_prefetch(); - phpbb_cache_moderators($db, $cache, $auth); - - add_log('admin', 'LOG_PURGE_CACHE'); - - trigger_error($this->user->lang['PURGED_CACHE'] . adm_back_link($this->u_base_action), E_USER_NOTICE); - } - - /** * Install style(s) */ protected function action_install() diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 40d8218a07..31b033604d 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1661,7 +1661,7 @@ class acp_users ${'s_sort_' . $sort_option . '_dir'} .= '</select>'; } - $timezone_selects = phpbb_timezone_select($user, $data['tz'], true); + phpbb_timezone_select($template, $user, $data['tz'], true); $user_prefs_data = array( 'S_PREFS' => true, 'S_JABBER_DISABLED' => ($config['jab_enable'] && $user_row['user_jabber'] && @extension_loaded('xml')) ? false : true, @@ -1700,8 +1700,6 @@ class acp_users 'S_LANG_OPTIONS' => language_select($data['lang']), 'S_STYLE_OPTIONS' => style_select($data['style']), - 'S_TZ_OPTIONS' => $timezone_selects['tz_select'], - 'S_TZ_DATE_OPTIONS' => $timezone_selects['tz_dates'], ); /** diff --git a/phpBB/includes/acp/info/acp_styles.php b/phpBB/includes/acp/info/acp_styles.php index 1a9865aa1d..c0ab005502 100644 --- a/phpBB/includes/acp/info/acp_styles.php +++ b/phpBB/includes/acp/info/acp_styles.php @@ -22,7 +22,6 @@ class acp_styles_info 'modes' => array( 'style' => array('title' => 'ACP_STYLES', 'auth' => 'acl_a_styles', 'cat' => array('ACP_STYLE_MANAGEMENT')), 'install' => array('title' => 'ACP_STYLES_INSTALL', 'auth' => 'acl_a_styles', 'cat' => array('ACP_STYLE_MANAGEMENT')), - 'cache' => array('title' => 'ACP_STYLES_CACHE', 'auth' => 'acl_a_styles', 'cat' => array('ACP_STYLE_MANAGEMENT')), ), ); } diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index b72e4ab6d4..6693b822fe 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-RC5-dev'); +define('PHPBB_VERSION', '3.1.0-RC6-dev'); // QA-related // define('PHPBB_QA', 1); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 9e1e1cae0e..7700dcfd27 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -31,7 +31,7 @@ function phpbb_load_extensions_autoloaders($phpbb_root_path) new \phpbb\recursive_dot_prefix_filter_iterator( new \RecursiveDirectoryIterator( $phpbb_root_path . 'ext/', - \FilesystemIterator::SKIP_DOTS + \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS ) ), \RecursiveIteratorIterator::SELF_FIRST @@ -937,14 +937,20 @@ function style_select($default = '', $all = false) * Format the timezone offset with hours and minutes * * @param int $tz_offset Timezone offset in seconds +* @param bool $show_null Whether null offsets should be shown * @return string Normalized offset string: -7200 => -02:00 * 16200 => +04:30 */ -function phpbb_format_timezone_offset($tz_offset) +function phpbb_format_timezone_offset($tz_offset, $show_null = false) { $sign = ($tz_offset < 0) ? '-' : '+'; $time_offset = abs($tz_offset); + if ($time_offset == 0 && $show_null == false) + { + return ''; + } + $offset_seconds = $time_offset % 3600; $offset_minutes = $offset_seconds / 60; $offset_hours = ($time_offset - $offset_seconds) / 3600; @@ -1040,13 +1046,14 @@ function phpbb_get_timezone_identifiers($selected_timezone) /** * Options to pick a timezone and date/time * +* @param \phpbb\template\template $template phpBB template object * @param \phpbb\user $user Object of the current user * @param string $default A timezone to select * @param boolean $truncate Shall we truncate the options text * -* @return array Returns an array, also containing the options for the time selector. +* @return array Returns an array containing the options for the time selector. */ -function phpbb_timezone_select($user, $default = '', $truncate = false) +function phpbb_timezone_select($template, $user, $default = '', $truncate = false) { static $timezones; @@ -1062,15 +1069,15 @@ function phpbb_timezone_select($user, $default = '', $truncate = false) $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); - $timezones['GMT' . $offset_string . ' - ' . $timezone] = array( + $offset_string = phpbb_format_timezone_offset($offset, true); + $timezones['UTC' . $offset_string . ' - ' . $timezone] = array( 'tz' => $timezone, - 'offset' => 'GMT' . $offset_string, + 'offset' => $offset_string, 'current' => $current_time, ); if ($timezone === $default) { - $default_offset = 'GMT' . $offset_string; + $default_offset = 'UTC' . $offset_string; } } unset($unsorted_timezones); @@ -1078,18 +1085,27 @@ function phpbb_timezone_select($user, $default = '', $truncate = false) uksort($timezones, 'phpbb_tz_select_compare'); } - $tz_select = $tz_dates = $opt_group = ''; + $tz_select = $opt_group = ''; - foreach ($timezones as $timezone) + foreach ($timezones as $key => $timezone) { if ($opt_group != $timezone['offset']) { + // Generate tz_select for backwards compatibility $tz_select .= ($opt_group) ? '</optgroup>' : ''; - $tz_select .= '<optgroup label="' . $timezone['offset'] . ' - ' . $timezone['current'] . '">'; + $tz_select .= '<optgroup label="' . $user->lang(array('timezones', 'UTC_OFFSET_CURRENT'), $timezone['offset'], $timezone['current']) . '">'; $opt_group = $timezone['offset']; + $template->assign_block_vars('timezone_select', array( + 'LABEL' => $user->lang(array('timezones', 'UTC_OFFSET_CURRENT'), $timezone['offset'], $timezone['current']), + 'VALUE' => $key . ' - ' . $timezone['current'], + )); - $selected = ($default_offset == $timezone['offset']) ? ' selected="selected"' : ''; - $tz_dates .= '<option value="' . $timezone['offset'] . ' - ' . $timezone['current'] . '"' . $selected . '>' . $timezone['offset'] . ' - ' . $timezone['current'] . '</option>'; + $selected = (!empty($default_offset) && strpos($key, $default_offset) !== false) ? ' selected="selected"' : ''; + $template->assign_block_vars('timezone_date', array( + 'VALUE' => $key . ' - ' . $timezone['current'], + 'SELECTED' => !empty($selected), + 'TITLE' => $user->lang(array('timezones', 'UTC_OFFSET_CURRENT'), $timezone['offset'], $timezone['current']), + )); } $label = $timezone['tz']; @@ -1097,22 +1113,26 @@ function phpbb_timezone_select($user, $default = '', $truncate = false) { $label = $user->lang['timezones'][$label]; } - $title = $timezone['offset'] . ' - ' . $label; + $title = $user->lang(array('timezones', 'UTC_OFFSET_CURRENT'), $timezone['offset'], $label); if ($truncate) { $label = truncate_string($label, 50, 255, false, '...'); } + // Also generate timezone_select for backwards compatibility $selected = ($timezone['tz'] === $default) ? ' selected="selected"' : ''; $tz_select .= '<option title="' . $title . '" value="' . $timezone['tz'] . '"' . $selected . '>' . $label . '</option>'; + $template->assign_block_vars('timezone_select.timezone_options', array( + 'TITLE' => $title, + 'VALUE' => $timezone['tz'], + 'SELECTED' => !empty($selected), + 'LABEL' => $label, + )); } $tz_select .= '</optgroup>'; - return array( - 'tz_select' => $tz_select, - 'tz_dates' => $tz_dates, - ); + return $tz_select; } // Functions handling topic/post tracking/marking @@ -2748,7 +2768,7 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = false, $s_display = true) { global $db, $user, $template, $auth, $phpEx, $phpbb_root_path, $config; - global $request, $phpbb_container; + global $request, $phpbb_container, $phpbb_dispatcher; $err = ''; @@ -2834,6 +2854,18 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa { $redirect = request_var('redirect', "{$phpbb_root_path}index.$phpEx"); + /** + * This event allows an extension to modify the redirection when a user successfully logs in + * + * @event core.login_box_redirect + * @var string redirect Redirect string + * @var boolean admin Is admin? + * @var bool return If true, do not redirect but return the sanitized URL. + * @since 3.1.0-RC5 + */ + $vars = array('redirect', 'admin', 'return'); + extract($phpbb_dispatcher->trigger_event('core.login_box_redirect', compact($vars))); + // append/replace SID (may change during the session for AOL users) $redirect = reapply_sid($redirect); @@ -4903,7 +4935,7 @@ function page_header($page_title = '', $display_online_list = false, $item_id = } $dt = $user->create_datetime(); - $timezone_offset = 'GMT' . phpbb_format_timezone_offset($dt->getOffset()); + $timezone_offset = $user->lang(array('timezones', 'UTC_OFFSET'), phpbb_format_timezone_offset($dt->getOffset())); $timezone_name = $user->timezone->getName(); if (isset($user->lang['timezones'][$timezone_name])) { @@ -5068,7 +5100,6 @@ function page_header($page_title = '', $display_online_list = false, $item_id = 'Content-type' => 'text/html; charset=UTF-8', 'Cache-Control' => 'private, no-cache="set-cookie"', 'Expires' => gmdate('D, d M Y H:i:s', time()) . ' GMT', - 'Pragma' => 'no-cache', ); if (!empty($user->data['is_bot'])) { @@ -5259,6 +5290,18 @@ function page_footer($run_cron = true, $display_template = true, $exit_handler = } } + /** + * Execute code and/or modify output before displaying the template. + * + * @event core.page_footer_after + * @var bool display_template Whether or not to display the template + * @var bool exit_handler Whether or not to run the exit_handler() + * + * @since 3.1.0-RC5 + */ + $vars = array('display_template', 'exit_handler'); + extract($phpbb_dispatcher->trigger_event('core.page_footer_after', compact($vars))); + if ($display_template) { $template->display('body'); diff --git a/phpBB/includes/functions_acp.php b/phpBB/includes/functions_acp.php index da8d756db9..e30c6da505 100644 --- a/phpBB/includes/functions_acp.php +++ b/phpBB/includes/functions_acp.php @@ -113,7 +113,6 @@ function adm_page_header($page_title) 'Content-type' => 'text/html; charset=UTF-8', 'Cache-Control' => 'private, no-cache="set-cookie"', 'Expires' => gmdate('D, d M Y H:i:s', time()) . ' GMT', - 'Pragma' => 'no-cache', ); /** diff --git a/phpBB/includes/functions_compatibility.php b/phpBB/includes/functions_compatibility.php index 093cb19538..fbb1f0e03d 100644 --- a/phpBB/includes/functions_compatibility.php +++ b/phpBB/includes/functions_compatibility.php @@ -133,10 +133,9 @@ function phpbb_clean_path($path) */ function tz_select($default = '', $truncate = false) { - global $user; + global $template, $user; - $timezone_select = phpbb_timezone_select($user, $default, $truncate); - return $timezone_select['tz_select']; + return phpbb_timezone_select($template, $user, $default, $truncate); } /** @@ -166,3 +165,30 @@ function update_foes($group_id = false, $user_id = false) global $db, $auth; return phpbb_update_foes($db, $auth, $group_id, $user_id); } + +/** +* Get user rank title and image +* +* @param int $user_rank the current stored users rank id +* @param int $user_posts the users number of posts +* @param string &$rank_title the rank title will be stored here after execution +* @param string &$rank_img the rank image as full img tag is stored here after execution +* @param string &$rank_img_src the rank image source is stored here after execution +* +* @deprecated 3.1.0-RC5 (To be removed: 3.3.0) +* +* Note: since we do not want to break backwards-compatibility, this function will only properly assign ranks to guests if you call it for them with user_posts == false +*/ +function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank_img_src) +{ + global $phpbb_root_path, $phpEx; + if (!function_exists('phpbb_get_user_rank')) + { + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } + + $rank_data = phpbb_get_user_rank(array('user_rank' => $user_rank), $user_posts); + $rank_title = $rank_data['title']; + $rank_img = $rank_data['img']; + $rank_img_src = $rank_data['img_src']; +} diff --git a/phpBB/includes/functions_compress.php b/phpBB/includes/functions_compress.php index 6ed69d6928..a7ee29dd91 100644 --- a/phpBB/includes/functions_compress.php +++ b/phpBB/includes/functions_compress.php @@ -509,7 +509,7 @@ class compress_zip extends compress $mimetype = 'application/zip'; - header('Pragma: no-cache'); + header('Cache-Control: private, no-cache'); header("Content-Type: $mimetype; name=\"$download_name.zip\""); header("Content-disposition: attachment; filename=$download_name.zip"); @@ -757,7 +757,7 @@ class compress_tar extends compress break; } - header('Pragma: no-cache'); + header('Cache-Control: private, no-cache'); header("Content-Type: $mimetype; name=\"$download_name$this->type\""); header("Content-disposition: attachment; filename=$download_name$this->type"); diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index f275ed1dd1..25ca50e8f1 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -912,7 +912,7 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, return; } - global $template, $cache, $user; + global $template, $cache, $user, $phpbb_dispatcher; global $extensions, $config, $phpbb_root_path, $phpEx; // @@ -1187,6 +1187,34 @@ function parse_attachments($forum_id, &$message, &$attachments, &$update_count, ); } + /** + * Use this event to modify the attachment template data. + * + * This event is triggered once per attachment. + * + * @event core.parse_attachments_modify_template_data + * @var array attachment Array with attachment data + * @var array block_array Template data of the attachment + * @var int display_cat Attachment category data + * @var string download_link Attachment download link + * @var array extensions Array with attachment extensions data + * @var mixed forum_id The forum id the attachments are displayed in (false if in private message) + * @var bool preview Flag indicating if we are in post preview mode + * @var array update_count Array with attachment ids to update download count + * @since 3.1.0-RC5 + */ + $vars = array( + 'attachment', + 'block_array', + 'display_cat', + 'download_link', + 'extensions', + 'forum_id', + 'preview', + 'update_count', + ); + extract($phpbb_dispatcher->trigger_event('core.parse_attachments_modify_template_data', compact($vars))); + $template->assign_block_vars('_file', $block_array); $compiled_attachments[] = $template->assign_display('attachment_tpl'); diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 85d9496061..745eb20c77 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -649,6 +649,28 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'UNAPPROVED_POST_IMG' => $user->img('icon_topic_unapproved', 'POSTS_UNAPPROVED_FORUM'), )); + /** + * Event to perform additional actions after the forum list has been generated + * + * @event core.display_forums_after + * @var array active_forum_ary Array with forum data to display active topics + * @var bool display_moderators Flag indicating if we display forum moderators + * @var array forum_moderators Array with forum moderators list + * @var array forum_rows Data array of all forums we display + * @var bool return_moderators Flag indicating if moderators list should be returned + * @var array root_data Array with the root forum data + * @since 3.1.0-RC5 + */ + $vars = array( + 'active_forum_ary', + 'display_moderators', + 'forum_moderators', + 'forum_rows', + 'return_moderators', + 'root_data', + ); + extract($phpbb_dispatcher->trigger_event('core.display_forums_after', compact($vars))); + if ($return_moderators) { return array($active_forum_ary, $forum_moderators); @@ -1402,17 +1424,34 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, /** * Get user rank title and image * -* @param int $user_rank the current stored users rank id +* @param array $user_data the current stored users data * @param int $user_posts the users number of posts -* @param string &$rank_title the rank title will be stored here after execution -* @param string &$rank_img the rank image as full img tag is stored here after execution -* @param string &$rank_img_src the rank image source is stored here after execution +* +* @return array An associative array containing the rank title (title), the rank image source (img) and the rank image as full img tag (img) * * Note: since we do not want to break backwards-compatibility, this function will only properly assign ranks to guests if you call it for them with user_posts == false */ -function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank_img_src) +function phpbb_get_user_rank($user_data, $user_posts) { - global $ranks, $config, $phpbb_root_path, $phpbb_path_helper; + global $ranks, $config, $phpbb_root_path, $phpbb_path_helper, $phpbb_dispatcher; + + $user_rank_data = array( + 'title' => null, + 'img' => null, + 'img_src' => null, + ); + + /** + * Preparing a user's rank before displaying + * + * @event core.modify_user_rank + * @var array user_data Array with user's data + * @var int user_posts User_posts to change + * @since 3.1.0-RC4 + */ + + $vars = array('user_data', 'user_posts'); + extract($phpbb_dispatcher->trigger_event('core.modify_user_rank', compact($vars))); if (empty($ranks)) { @@ -1420,11 +1459,14 @@ function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank $ranks = $cache->obtain_ranks(); } - if (!empty($user_rank)) + if (!empty($user_data['user_rank'])) { - $rank_title = (isset($ranks['special'][$user_rank]['rank_title'])) ? $ranks['special'][$user_rank]['rank_title'] : ''; - $rank_img_src = (!empty($ranks['special'][$user_rank]['rank_image'])) ? $phpbb_path_helper->update_web_root_path($phpbb_root_path . $config['ranks_path'] . '/' . $ranks['special'][$user_rank]['rank_image']) : ''; - $rank_img = (!empty($ranks['special'][$user_rank]['rank_image'])) ? '<img src="' . $rank_img_src . '" alt="' . $ranks['special'][$user_rank]['rank_title'] . '" title="' . $ranks['special'][$user_rank]['rank_title'] . '" />' : ''; + + $user_rank_data['title'] = (isset($ranks['special'][$user_data['user_rank']]['rank_title'])) ? $ranks['special'][$user_data['user_rank']]['rank_title'] : ''; + + $user_rank_data['img_src'] = (!empty($ranks['special'][$user_data['user_rank']]['rank_image'])) ? $phpbb_path_helper->update_web_root_path($phpbb_root_path . $config['ranks_path'] . '/' . $ranks['special'][$user_data['user_rank']]['rank_image']) : ''; + + $user_rank_data['img'] = (!empty($ranks['special'][$user_data['user_rank']]['rank_image'])) ? '<img src="' . $user_rank_data['img_src'] . '" alt="' . $ranks['special'][$user_data['user_rank']]['rank_title'] . '" title="' . $ranks['special'][$user_data['user_rank']]['rank_title'] . '" />' : ''; } else if ($user_posts !== false) { @@ -1434,14 +1476,16 @@ function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank { if ($user_posts >= $rank['rank_min']) { - $rank_title = $rank['rank_title']; - $rank_img_src = (!empty($rank['rank_image'])) ? $phpbb_path_helper->update_web_root_path($phpbb_root_path . $config['ranks_path'] . '/' . $rank['rank_image']) : ''; - $rank_img = (!empty($rank['rank_image'])) ? '<img src="' . $rank_img_src . '" alt="' . $rank['rank_title'] . '" title="' . $rank['rank_title'] . '" />' : ''; + $user_rank_data['title'] = $rank['rank_title']; + $user_rank_data['img_src'] = (!empty($rank['rank_image'])) ? $phpbb_path_helper->update_web_root_path($phpbb_root_path . $config['ranks_path'] . '/' . $rank['rank_image']) : ''; + $user_rank_data['img'] = (!empty($rank['rank_image'])) ? '<img src="' . $user_rank_data['img_src'] . '" alt="' . $rank['rank_title'] . '" title="' . $rank['rank_title'] . '" />' : ''; break; } } } } + + return $user_rank_data; } /** @@ -1454,8 +1498,7 @@ function phpbb_show_profile($data, $user_notes_enabled = false, $warn_user_enabl $username = $data['username']; $user_id = $data['user_id']; - $rank_title = $rank_img = $rank_img_src = ''; - get_user_rank($data['user_rank'], (($user_id == ANONYMOUS) ? false : $data['user_posts']), $rank_title, $rank_img, $rank_img_src); + $user_rank_data = phpbb_get_user_rank($data, (($user_id == ANONYMOUS) ? false : $data['user_posts'])); if ((!empty($data['user_allow_viewemail']) && $auth->acl_get('u_sendemail')) || $auth->acl_get('a_user')) { @@ -1536,7 +1579,7 @@ function phpbb_show_profile($data, $user_notes_enabled = false, $warn_user_enabl // Dump it out to the template $template_data = array( 'AGE' => $age, - 'RANK_TITLE' => $rank_title, + 'RANK_TITLE' => $user_rank_data['title'], 'JOINED' => $user->format_date($data['user_regdate']), 'LAST_ACTIVE' => (empty($last_active)) ? ' - ' : $user->format_date($last_active), 'POSTS' => ($data['user_posts']) ? $data['user_posts'] : 0, @@ -1552,8 +1595,8 @@ function phpbb_show_profile($data, $user_notes_enabled = false, $warn_user_enabl 'AVATAR_IMG' => phpbb_get_user_avatar($data), 'ONLINE_IMG' => (!$config['load_onlinetrack']) ? '' : (($online) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')), 'S_ONLINE' => ($config['load_onlinetrack'] && $online) ? true : false, - 'RANK_IMG' => $rank_img, - 'RANK_IMG_SRC' => $rank_img_src, + 'RANK_IMG' => $user_rank_data['img'], + 'RANK_IMG_SRC' => $user_rank_data['img_src'], 'S_JABBER_ENABLED' => ($config['jab_enable']) ? true : false, 'S_WARNINGS' => ($auth->acl_getf_global('m_') || $auth->acl_get('m_warn')) ? true : false, diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php index 3be84299f0..fbeae50f55 100644 --- a/phpBB/includes/functions_download.php +++ b/phpBB/includes/functions_download.php @@ -45,12 +45,12 @@ function send_avatar_to_browser($file, $browser) if ((@file_exists($file_path) && @is_readable($file_path)) && !headers_sent()) { - header('Pragma: public'); + header('Cache-Control: public'); $image_data = @getimagesize($file_path); header('Content-Type: ' . image_type_to_mime_type($image_data[2])); - if ((strpos(strtolower($user->browser), 'msie') !== false) && !phpbb_is_greater_ie_version($browser, 7)) + if ((strpos(strtolower($browser), 'msie') !== false) && !phpbb_is_greater_ie_version($browser, 7)) { header('Content-Disposition: attachment; ' . header_filename($file)); @@ -175,7 +175,7 @@ function send_file_to_browser($attachment, $upload_dir, $category) } // Now the tricky part... let's dance - header('Pragma: public'); + header('Cache-Control: public'); // Send out the Headers. Do not set Content-Disposition to inline please, it is a security measure for users using the Internet Explorer. header('Content-Type: ' . $attachment['mimetype']); @@ -420,7 +420,7 @@ function set_modified_headers($stamp, $browser) { send_status_line(304, 'Not Modified'); // seems that we need those too ... browsers - header('Pragma: public'); + header('Cache-Control: public'); header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 31536000) . ' GMT'); return true; } diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 1fdc7ee9ea..af44f6270e 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -2384,6 +2384,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u * @var int topic_type Variable containing topic type value * @var array poll Array with the poll data for the post * @var array data Array with the data for the post + * @var int post_visibility Variable containing up to date post visibility * @var bool update_message Flag indicating if the post will be updated * @var bool update_search_index Flag indicating if the search index will be updated * @var string url The "Return to topic" URL @@ -2399,6 +2400,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u 'topic_type', 'poll', 'data', + 'post_visibility', 'update_message', 'update_search_index', 'url', diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 29cea477e4..ad142b1cca 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1573,7 +1573,7 @@ function get_folder_status($folder_id, $folder) 'cur' => $folder['num_messages'], 'remaining' => ($user->data['message_limit']) ? $user->data['message_limit'] - $folder['num_messages'] : 0, 'max' => $user->data['message_limit'], - 'percent' => ($user->data['message_limit']) ? (($user->data['message_limit'] > 0) ? round(($folder['num_messages'] / $user->data['message_limit']) * 100) : 100) : 0, + 'percent' => ($user->data['message_limit']) ? (($user->data['message_limit'] > 0) ? floor(($folder['num_messages'] / $user->data['message_limit']) * 100) : 100) : 0, ); $return['message'] = $user->lang('FOLDER_STATUS_MSG', $user->lang('MESSAGES_COUNT', (int) $return['max']), $return['cur'], $return['percent']); diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 38ae34c66c..e4479f07b0 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -363,12 +363,16 @@ function user_add($user_row, $cp_data = false) } /** -* Remove User -* @param $mode Either 'retain' or 'remove' -*/ + * Remove User + * + * @param string $mode Either 'retain' or 'remove' + * @param mixed $user_ids Either an array of integers or an integer + * @param bool $retain_username + * @return bool + */ function user_delete($mode, $user_ids, $retain_username = true) { - global $cache, $config, $db, $user, $auth, $phpbb_dispatcher; + global $cache, $config, $db, $user, $phpbb_dispatcher; global $phpbb_root_path, $phpEx; $db->sql_transaction('begin'); @@ -555,11 +559,6 @@ function user_delete($mode, $user_ids, $retain_username = true) WHERE ' . $db->sql_in_set('poster_id', $user_ids); $db->sql_query($sql); - $sql = 'UPDATE ' . POSTS_TABLE . ' - SET post_edit_user = ' . ANONYMOUS . ' - WHERE ' . $db->sql_in_set('post_edit_user', $user_ids); - $db->sql_query($sql); - $sql = 'UPDATE ' . USERS_TABLE . ' SET user_posts = user_posts + ' . $added_guest_posts . ' WHERE user_id = ' . ANONYMOUS; @@ -589,6 +588,30 @@ function user_delete($mode, $user_ids, $retain_username = true) $cache->destroy('sql', MODERATOR_CACHE_TABLE); + // Change user_id to anonymous for posts edited by this user + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET post_edit_user = ' . ANONYMOUS . ' + WHERE ' . $db->sql_in_set('post_edit_user', $user_ids); + $db->sql_query($sql); + + // Change user_id to anonymous for pms edited by this user + $sql = 'UPDATE ' . PRIVMSGS_TABLE . ' + SET message_edit_user = ' . ANONYMOUS . ' + WHERE ' . $db->sql_in_set('message_edit_user', $user_ids); + $db->sql_query($sql); + + // Change user_id to anonymous for posts deleted by this user + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET post_delete_user = ' . ANONYMOUS . ' + WHERE ' . $db->sql_in_set('post_delete_user', $user_ids); + $db->sql_query($sql); + + // Change user_id to anonymous for topics deleted by this user + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_delete_user = ' . ANONYMOUS . ' + WHERE ' . $db->sql_in_set('topic_delete_user', $user_ids); + $db->sql_query($sql); + // Delete user log entries about this user $sql = 'DELETE FROM ' . LOG_TABLE . ' WHERE ' . $db->sql_in_set('reportee_id', $user_ids); diff --git a/phpBB/includes/mcp/mcp_ban.php b/phpBB/includes/mcp/mcp_ban.php index e6fac3b80c..4d2151fded 100644 --- a/phpBB/includes/mcp/mcp_ban.php +++ b/phpBB/includes/mcp/mcp_ban.php @@ -25,7 +25,7 @@ class mcp_ban function main($id, $mode) { - global $config, $db, $user, $auth, $template, $cache; + global $db, $user, $auth, $template, $request, $phpbb_dispatcher; global $phpbb_root_path, $phpEx; include($phpbb_root_path . 'includes/functions_user.' . $phpEx); @@ -33,55 +33,133 @@ class mcp_ban // Include the admin banning interface... include($phpbb_root_path . 'includes/acp/acp_ban.' . $phpEx); - $bansubmit = (isset($_POST['bansubmit'])) ? true : false; - $unbansubmit = (isset($_POST['unbansubmit'])) ? true : false; - $current_time = time(); + $bansubmit = $request->is_set_post('bansubmit'); + $unbansubmit = $request->is_set_post('unbansubmit'); $user->add_lang(array('acp/ban', 'acp/users')); $this->tpl_name = 'mcp_ban'; + /** + * Use this event to pass perform actions when a ban is issued or revoked + * + * @event core.mcp_ban_main + * @var bool bansubmit True if a ban is issued + * @var bool unbansubmit True if a ban is removed + * @var string mode Mode of the ban that is being worked on + * @since 3.1.0-RC5 + */ + $vars = array( + 'bansubmit', + 'unbansubmit', + 'mode', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_ban_main', compact($vars))); + // Ban submitted? if ($bansubmit) { // Grab the list of entries - $ban = request_var('ban', '', ($mode === 'user') ? true : false); - - if ($mode === 'user') - { - $ban = utf8_normalize_nfc($ban); - } - - $ban_len = request_var('banlength', 0); - $ban_len_other = request_var('banlengthother', ''); - $ban_exclude = request_var('banexclude', 0); - $ban_reason = utf8_normalize_nfc(request_var('banreason', '', true)); - $ban_give_reason = utf8_normalize_nfc(request_var('bangivereason', '', true)); + $ban = $request->variable('ban', '', $mode === 'user'); + $ban_length = $request->variable('banlength', 0); + $ban_length_other = $request->variable('banlengthother', ''); + $ban_exclude = $request->variable('banexclude', 0); + $ban_reason = $request->variable('banreason', '', true); + $ban_give_reason = $request->variable('bangivereason', '', true); if ($ban) { if (confirm_box(true)) { - user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reason, $ban_give_reason); + $abort_ban = false; + /** + * Use this event to modify the ban details before the ban is performed + * + * @event core.mcp_ban_before + * @var string mode One of the following: user, ip, email + * @var string ban Either string or array with usernames, ips or email addresses + * @var int ban_length Ban length in minutes + * @var string ban_length_other Ban length as a date (YYYY-MM-DD) + * @var bool ban_exclude Are we banning or excluding from another ban + * @var string ban_reason Ban reason displayed to moderators + * @var string ban_give_reason Ban reason displayed to the banned user + * @var mixed abort_ban Either false, or an error message that is displayed to the user. + * If a string is given the bans are not issued. + * @since 3.1.0-RC5 + */ + $vars = array( + 'mode', + 'ban', + 'ban_length', + 'ban_length_other', + 'ban_exclude', + 'ban_reason', + 'ban_give_reason', + 'abort_ban', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_ban_before', compact($vars))); + + if ($abort_ban) + { + trigger_error($abort_ban); + } + user_ban($mode, $ban, $ban_length, $ban_length_other, $ban_exclude, $ban_reason, $ban_give_reason); + + /** + * Use this event to perform actions after the ban has been performed + * + * @event core.mcp_ban_after + * @var string mode One of the following: user, ip, email + * @var string ban Either string or array with usernames, ips or email addresses + * @var int ban_length Ban length in minutes + * @var string ban_length_other Ban length as a date (YYYY-MM-DD) + * @var bool ban_exclude Are we banning or excluding from another ban + * @var string ban_reason Ban reason displayed to moderators + * @var string ban_give_reason Ban reason displayed to the banned user + * @since 3.1.0-RC5 + */ + $vars = array( + 'mode', + 'ban', + 'ban_length', + 'ban_length_other', + 'ban_exclude', + 'ban_reason', + 'ban_give_reason', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_ban_after', compact($vars))); trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . '<br /><br /><a href="' . $this->u_action . '">« ' . $user->lang['BACK_TO_PREV'] . '</a>'); } else { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + $hidden_fields = array( 'mode' => $mode, 'ban' => $ban, 'bansubmit' => true, - 'banlength' => $ban_len, - 'banlengthother' => $ban_len_other, + 'banlength' => $ban_length, + 'banlengthother' => $ban_length_other, 'banexclude' => $ban_exclude, 'banreason' => $ban_reason, - 'bangivereason' => $ban_give_reason))); + 'bangivereason' => $ban_give_reason, + ); + + /** + * Use this event to pass data from the ban form to the confirmation screen + * + * @event core.mcp_ban_confirm + * @var array hidden_fields Hidden fields that are passed through the confirm screen + * @since 3.1.0-RC5 + */ + $vars = array('hidden_fields'); + extract($phpbb_dispatcher->trigger_event('core.mcp_ban_confirm', compact($vars))); + + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($hidden_fields)); } } } else if ($unbansubmit) { - $ban = request_var('unban', array('')); + $ban = $request->variable('unban', array('')); if ($ban) { @@ -157,9 +235,9 @@ class mcp_ban } // As a "service" we will check if any post id is specified and populate the username of the poster id if given - $post_id = request_var('p', 0); - $user_id = request_var('u', 0); - $username = $pre_fill = false; + $post_id = $request->variable('p', 0); + $user_id = $request->variable('u', 0); + $pre_fill = false; if ($user_id && $user_id <> ANONYMOUS) { diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 74bf687fc8..19a0ee3051 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -754,7 +754,8 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '' { global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container; - if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_delete'))) + $check_permission = ($is_soft) ? 'm_softdelete' : 'm_delete'; + if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array($check_permission))) { return; } @@ -882,7 +883,8 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', { global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container; - if (!phpbb_check_ids($post_ids, POSTS_TABLE, 'post_id', array('m_softdelete'))) + $check_permission = ($is_soft) ? 'm_softdelete' : 'm_delete'; + if (!phpbb_check_ids($post_ids, POSTS_TABLE, 'post_id', array($check_permission))) { return; } diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index bfd30a5be2..f9c00da3ec 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -745,11 +745,11 @@ class mcp_queue if (!$post_data['topic_posts_approved']) { - $phpbb_notifications->add_notifications('notification.type.approve_post', $post_data); + $phpbb_notifications->add_notifications('notification.type.approve_topic', $post_data); } else { - $phpbb_notifications->add_notifications('notification.type.approve_topic', $post_data); + $phpbb_notifications->add_notifications('notification.type.approve_post', $post_data); } } } diff --git a/phpBB/includes/mcp/mcp_warn.php b/phpBB/includes/mcp/mcp_warn.php index 106b025757..425c3ac235 100644 --- a/phpBB/includes/mcp/mcp_warn.php +++ b/phpBB/includes/mcp/mcp_warn.php @@ -336,12 +336,12 @@ class mcp_warn $message = generate_text_for_display($user_row['post_text'], $user_row['bbcode_uid'], $user_row['bbcode_bitfield'], $parse_flags, true); // Generate the appropriate user information for the user we are looking at - if (!function_exists('get_user_rank')) + if (!function_exists('phpbb_get_user_rank')) { include($phpbb_root_path . 'includes/functions_display.' . $phpEx); } - get_user_rank($user_row['user_rank'], $user_row['user_posts'], $rank_title, $rank_img, $rank_img_src); + $user_rank_data = phpbb_get_user_rank($user_row, $user_row['user_posts']); $avatar_img = phpbb_get_user_avatar($user_row); $template->assign_vars(array( @@ -350,13 +350,13 @@ class mcp_warn 'POST' => $message, 'USERNAME' => $user_row['username'], 'USER_COLOR' => (!empty($user_row['user_colour'])) ? $user_row['user_colour'] : '', - 'RANK_TITLE' => $rank_title, + 'RANK_TITLE' => $user_rank_data['title'], 'JOINED' => $user->format_date($user_row['user_regdate']), 'POSTS' => ($user_row['user_posts']) ? $user_row['user_posts'] : 0, 'WARNINGS' => ($user_row['user_warnings']) ? $user_row['user_warnings'] : 0, 'AVATAR_IMG' => $avatar_img, - 'RANK_IMG' => $rank_img, + 'RANK_IMG' => $user_rank_data['img'], 'L_WARNING_POST_DEFAULT' => sprintf($user->lang['WARNING_POST_DEFAULT'], generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&p=$post_id#p$post_id"), @@ -486,18 +486,18 @@ class mcp_warn } // Generate the appropriate user information for the user we are looking at - if (!function_exists('get_user_rank')) + if (!function_exists('phpbb_get_user_rank')) { include($phpbb_root_path . 'includes/functions_display.' . $phpEx); } - get_user_rank($user_row['user_rank'], $user_row['user_posts'], $rank_title, $rank_img, $rank_img_src); + $user_rank_data = phpbb_get_user_rank($user_row, $user_row['user_posts']); $avatar_img = phpbb_get_user_avatar($user_row); // OK, they didn't submit a warning so lets build the page for them to do so $template->assign_vars(array( 'U_POST_ACTION' => $this->u_action, - 'RANK_TITLE' => $rank_title, + 'RANK_TITLE' => $user_rank_data['title'], 'JOINED' => $user->format_date($user_row['user_regdate']), 'POSTS' => ($user_row['user_posts']) ? $user_row['user_posts'] : 0, 'WARNINGS' => ($user_row['user_warnings']) ? $user_row['user_warnings'] : 0, @@ -508,7 +508,7 @@ class mcp_warn 'U_PROFILE' => get_username_string('profile', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), 'AVATAR_IMG' => $avatar_img, - 'RANK_IMG' => $rank_img, + 'RANK_IMG' => $user_rank_data['img'], 'S_CAN_NOTIFY' => $s_can_notify, )); diff --git a/phpBB/includes/ucp/ucp_notifications.php b/phpBB/includes/ucp/ucp_notifications.php index 5691302b83..b0aeaba227 100644 --- a/phpBB/includes/ucp/ucp_notifications.php +++ b/phpBB/includes/ucp/ucp_notifications.php @@ -95,35 +95,25 @@ class ucp_notifications case 'notification_list': default: // Mark all items read - if ($request->variable('mark', '') == 'all' && (confirm_box(true) || check_link_hash($request->variable('token', ''), 'mark_all_notifications_read'))) + if ($request->variable('mark', '') == 'all' && check_link_hash($request->variable('token', ''), 'mark_all_notifications_read')) { - if (confirm_box(true)) - { - $phpbb_notifications->mark_notifications_read(false, false, $user->data['user_id'], $form_time); - - meta_refresh(3, $this->u_action); - $message = $user->lang['NOTIFICATIONS_MARK_ALL_READ_SUCCESS']; + $phpbb_notifications->mark_notifications_read(false, false, $user->data['user_id'], $form_time); - if ($request->is_ajax()) - { - $json_response = new \phpbb\json_response(); - $json_response->send(array( - 'MESSAGE_TITLE' => $user->lang['INFORMATION'], - 'MESSAGE_TEXT' => $message, - 'success' => true, - )); - } - $message .= '<br /><br />' . $user->lang('RETURN_UCP', '<a href="' . $this->u_action . '">', '</a>'); + meta_refresh(3, $this->u_action); + $message = $user->lang['NOTIFICATIONS_MARK_ALL_READ_SUCCESS']; - trigger_error($message); - } - else + if ($request->is_ajax()) { - confirm_box(false, 'NOTIFICATIONS_MARK_ALL_READ', build_hidden_fields(array( - 'mark' => 'all', - 'form_time' => $form_time, - ))); + $json_response = new \phpbb\json_response(); + $json_response->send(array( + 'MESSAGE_TITLE' => $user->lang['INFORMATION'], + 'MESSAGE_TEXT' => $message, + 'success' => true, + )); } + $message .= '<br /><br />' . $user->lang('RETURN_UCP', '<a href="' . $this->u_action . '">', '</a>'); + + trigger_error($message); } // Mark specific notifications read diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index 01c2041f42..f3b59186a6 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -27,8 +27,7 @@ function compose_pm($id, $mode, $action, $user_folders = array()) { global $template, $db, $auth, $user, $cache; global $phpbb_root_path, $phpEx, $config; - global $request; - global $phpbb_container; + global $request, $phpbb_dispatcher, $phpbb_container; // Damn php and globals - i know, this is horrible // Needed for handle_message_list_actions() @@ -233,6 +232,42 @@ function compose_pm($id, $mode, $action, $user_folders = array()) if ($sql) { + /** + * Alter sql query to get message for user to write the PM + * + * @event core.ucp_pm_compose_compose_pm_basic_info_query_before + * @var string sql String with the query to be executed + * @var array forum_list List of forums that contain the posts + * @var int visibility_const Integer with one of the possible ITEM_* constant values + * @var int msg_id topic_id in the page request + * @var int to_user_id The id of whom the message is to + * @var int to_group_id The id of the group whom the message is to + * @var bool submit Whether the user is sending the PM or not + * @var bool preview Whether the user is previewing the PM or not + * @var string action One of: post, reply, quote, forward, quotepost, edit, delete, smilies + * @var bool delete Whether the user is deleting the PM + * @var int reply_to_all Value of reply_to_all request variable. + * @var string limit_time_sql String with the SQL code to limit the time interval of the post (Note: May be empty string) + * @var string sort_order_sql String with the ORDER BY SQL code used in this query + * @since 3.1.0-RC5 + */ + $vars = array( + 'sql', + 'forum_list', + 'visibility_const', + 'msg_id', + 'to_user_id', + 'to_group_id', + 'submit', + 'preview', + 'action', + 'delete', + 'reply_to_all', + 'limit_time_sql', + 'sort_order_sql', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_compose_pm_basic_info_query_before', compact($vars))); + $result = $db->sql_query($sql); $post = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -267,6 +302,40 @@ function compose_pm($id, $mode, $action, $user_folders = array()) trigger_error('NOT_AUTHORISED'); } + /** + * Get the result of querying for the post to be quoted in the pm message + * + * @event core.ucp_pm_compose_quotepost_query_after + * @var string sql The original SQL used in the query + * @var array post Associative array with the data of the quoted post + * @var array msg_id The post_id that was searched to get the message for quoting + * @var int visibility_const Visibility of the quoted post (one of the possible ITEM_* constant values) + * @var int topic_id Topic ID of the quoted post + * @var int to_user_id Users the message is sent to + * @var int to_group_id Groups the message is sent to + * @var bool submit Whether the user is sending the PM or not + * @var bool preview Whether the user is previewing the PM or not + * @var string action One of: post, reply, quote, forward, quotepost, edit, delete, smilies + * @var bool delete If deleting message + * @var int reply_to_all Value of reply_to_all request variable. + * @since 3.1.0-RC5 + */ + $vars = array( + 'sql', + 'post', + 'msg_id', + 'visibility_const', + 'topic_id', + 'to_user_id', + 'to_group_id', + 'submit', + 'preview', + 'action', + 'delete', + 'reply_to_all', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_quotepost_query_after', compact($vars))); + // Passworded forum? if ($post['forum_id']) { diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php index 72921270f4..19acd9ecb9 100644 --- a/phpBB/includes/ucp/ucp_pm_viewfolder.php +++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php @@ -383,7 +383,7 @@ function view_folder($id, $mode, $folder_id, $folder) break; } - header('Pragma: no-cache'); + header('Cache-Control: private, no-cache'); header("Content-Type: $mimetype; name=\"data.$filetype\""); header("Content-disposition: attachment; filename=data.$filetype"); echo $string; diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index d5a1dbae87..2f34fd64a5 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -403,12 +403,15 @@ function get_user_information($user_id, $user_row) $user_row['avatar'] = ($user->optionget('viewavatars')) ? phpbb_get_user_avatar($user_row) : ''; - if (!function_exists('get_user_rank')) + if (!function_exists('phpbb_get_user_rank')) { include($phpbb_root_path . 'includes/functions_display.' . $phpEx); } - get_user_rank($user_row['user_rank'], $user_row['user_posts'], $user_row['rank_title'], $user_row['rank_image'], $user_row['rank_image_src']); + $user_rank_data = phpbb_get_user_rank($user_row, $user_row['user_posts']); + $user_row['rank_title'] = $user_rank_data['title']; + $user_row['rank_image'] = $user_rank_data['img']; + $user_row['rank_image_src'] = $user_rank_data['img_src']; if ((!empty($user_row['user_allow_viewemail']) && $auth->acl_get('u_sendemail')) || $auth->acl_get('a_email')) { diff --git a/phpBB/includes/ucp/ucp_prefs.php b/phpBB/includes/ucp/ucp_prefs.php index 3ff8fe9ada..2195500b57 100644 --- a/phpBB/includes/ucp/ucp_prefs.php +++ b/phpBB/includes/ucp/ucp_prefs.php @@ -154,7 +154,7 @@ class ucp_prefs } $dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>'; - $timezone_selects = phpbb_timezone_select($user, $data['tz'], true); + phpbb_timezone_select($template, $user, $data['tz'], true); // check if there are any user-selectable languages $sql = 'SELECT COUNT(lang_id) as languages_count @@ -208,8 +208,6 @@ class ucp_prefs 'S_LANG_OPTIONS' => language_select($data['lang']), 'S_STYLE_OPTIONS' => ($config['override_user_style']) ? '' : style_select($data['user_style']), - 'S_TZ_OPTIONS' => $timezone_selects['tz_select'], - 'S_TZ_DATE_OPTIONS' => $timezone_selects['tz_dates'], 'S_CAN_HIDE_ONLINE' => ($auth->acl_get('u_hideonline')) ? true : false, 'S_SELECT_NOTIFY' => ($config['jab_enable'] && $user->data['user_jabber'] && @extension_loaded('xml')) ? true : false) ); diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 06baf7e5f2..9a15967bae 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -452,7 +452,7 @@ class ucp_register break; } - $timezone_selects = phpbb_timezone_select($user, $data['tz'], true); + $timezone_selects = phpbb_timezone_select($template, $user, $data['tz'], true); $template->assign_vars(array( 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', 'USERNAME' => $data['username'], @@ -465,8 +465,6 @@ class ucp_register 'L_PASSWORD_EXPLAIN' => $user->lang($config['pass_complex'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_pass_chars']), $user->lang('CHARACTERS', (int) $config['max_pass_chars'])), 'S_LANG_OPTIONS' => language_select($data['lang']), - 'S_TZ_OPTIONS' => $timezone_selects['tz_select'], - 'S_TZ_DATE_OPTIONS' => $timezone_selects['tz_dates'], 'S_TZ_PRESELECT' => !$submit, 'S_CONFIRM_REFRESH' => ($config['enable_confirm'] && $config['confirm_refresh']) ? true : false, 'S_REGISTRATION' => true, diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php index 4ec408a670..cab3fd7f1f 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-RC4', + 'phpbb_version' => '3.1.0-RC5', '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 5531a98c09..5c16421499 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -446,7 +446,6 @@ class module header('Content-type: text/html; charset=UTF-8'); header('Cache-Control: private, no-cache="set-cookie"'); header('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT'); - header('Pragma: no-cache'); return; } diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 20b211dde9..103262b516 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1175,8 +1175,31 @@ class install_install extends module } // Ok we have the db info go ahead and work on building the table - $db_table_schema = @file_get_contents('schemas/schema.json'); - $db_table_schema = json_decode($db_table_schema, true); + if (file_exists('schemas/schema.json')) + { + $db_table_schema = @file_get_contents('schemas/schema.json'); + $db_table_schema = json_decode($db_table_schema, true); + } + else + { + global $phpbb_root_path, $phpEx, $table_prefix; + $table_prefix = 'phpbb_'; + + if (!defined('CONFIG_TABLE')) + { + // We need to include the constants file for the table constants + // when we generate the schema from the migration files. + include($phpbb_root_path . 'includes/constants.' . $phpEx); + } + + $finder = new \phpbb\finder(new \phpbb\filesystem(), $phpbb_root_path, null, $phpEx); + $classes = $finder->core_path('phpbb/db/migration/data/') + ->get_classes(); + + $sqlite_db = new \phpbb\db\driver\sqlite(); + $schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $sqlite_db, new \phpbb\db\tools($sqlite_db, true), $phpbb_root_path, $phpEx, $table_prefix); + $db_table_schema = $schema_generator->get_schema(); + } if (!defined('CONFIG_TABLE')) { @@ -1654,6 +1677,19 @@ class install_install extends module $db->sql_freeresult($result); $_module->move_module_by($row, 'move_up', 5); + + // Move extension management module 1 up... + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_langname = 'ACP_EXTENSION_MANAGEMENT' + AND module_class = 'acp' + AND module_mode = '' + AND module_basename = ''"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $_module->move_module_by($row, 'move_up', 1); } if ($module_class == 'mcp') diff --git a/phpBB/install/schemas/schema.json b/phpBB/install/schemas/schema.json deleted file mode 100644 index b71b1fecbe..0000000000 --- a/phpBB/install/schemas/schema.json +++ /dev/null @@ -1,3356 +0,0 @@ -{ - "phpbb_acl_groups": { - "COLUMNS": { - "group_id": [ - "UINT", - 0 - ], - "forum_id": [ - "UINT", - 0 - ], - "auth_option_id": [ - "UINT", - 0 - ], - "auth_role_id": [ - "UINT", - 0 - ], - "auth_setting": [ - "TINT:2", - 0 - ] - }, - "KEYS": { - "group_id": [ - "INDEX", - "group_id" - ], - "auth_opt_id": [ - "INDEX", - "auth_option_id" - ], - "auth_role_id": [ - "INDEX", - "auth_role_id" - ] - } - }, - "phpbb_acl_options": { - "COLUMNS": { - "auth_option_id": [ - "UINT", - null, - "auto_increment" - ], - "auth_option": [ - "VCHAR:50", - "" - ], - "is_global": [ - "BOOL", - 0 - ], - "is_local": [ - "BOOL", - 0 - ], - "founder_only": [ - "BOOL", - 0 - ] - }, - "PRIMARY_KEY": "auth_option_id", - "KEYS": { - "auth_option": [ - "UNIQUE", - [ - "auth_option" - ] - ] - } - }, - "phpbb_acl_roles": { - "COLUMNS": { - "role_id": [ - "UINT", - null, - "auto_increment" - ], - "role_name": [ - "VCHAR_UNI", - "" - ], - "role_description": [ - "TEXT_UNI", - "" - ], - "role_type": [ - "VCHAR:10", - "" - ], - "role_order": [ - "USINT", - 0 - ] - }, - "PRIMARY_KEY": "role_id", - "KEYS": { - "role_type": [ - "INDEX", - "role_type" - ], - "role_order": [ - "INDEX", - "role_order" - ] - } - }, - "phpbb_acl_roles_data": { - "COLUMNS": { - "role_id": [ - "UINT", - 0 - ], - "auth_option_id": [ - "UINT", - 0 - ], - "auth_setting": [ - "TINT:2", - 0 - ] - }, - "PRIMARY_KEY": [ - "role_id", - "auth_option_id" - ], - "KEYS": { - "ath_op_id": [ - "INDEX", - "auth_option_id" - ] - } - }, - "phpbb_acl_users": { - "COLUMNS": { - "user_id": [ - "UINT", - 0 - ], - "forum_id": [ - "UINT", - 0 - ], - "auth_option_id": [ - "UINT", - 0 - ], - "auth_role_id": [ - "UINT", - 0 - ], - "auth_setting": [ - "TINT:2", - 0 - ] - }, - "KEYS": { - "user_id": [ - "INDEX", - "user_id" - ], - "auth_option_id": [ - "INDEX", - "auth_option_id" - ], - "auth_role_id": [ - "INDEX", - "auth_role_id" - ] - } - }, - "phpbb_attachments": { - "COLUMNS": { - "attach_id": [ - "UINT", - null, - "auto_increment" - ], - "post_msg_id": [ - "UINT", - 0 - ], - "topic_id": [ - "UINT", - 0 - ], - "in_message": [ - "BOOL", - 0 - ], - "poster_id": [ - "UINT", - 0 - ], - "is_orphan": [ - "BOOL", - 1 - ], - "physical_filename": [ - "VCHAR", - "" - ], - "real_filename": [ - "VCHAR", - "" - ], - "download_count": [ - "UINT", - 0 - ], - "attach_comment": [ - "TEXT_UNI", - "" - ], - "extension": [ - "VCHAR:100", - "" - ], - "mimetype": [ - "VCHAR:100", - "" - ], - "filesize": [ - "UINT:20", - 0 - ], - "filetime": [ - "TIMESTAMP", - 0 - ], - "thumbnail": [ - "BOOL", - 0 - ] - }, - "PRIMARY_KEY": "attach_id", - "KEYS": { - "filetime": [ - "INDEX", - "filetime" - ], - "post_msg_id": [ - "INDEX", - "post_msg_id" - ], - "topic_id": [ - "INDEX", - "topic_id" - ], - "poster_id": [ - "INDEX", - "poster_id" - ], - "is_orphan": [ - "INDEX", - "is_orphan" - ] - } - }, - "phpbb_banlist": { - "COLUMNS": { - "ban_id": [ - "UINT", - null, - "auto_increment" - ], - "ban_userid": [ - "UINT", - 0 - ], - "ban_ip": [ - "VCHAR:40", - "" - ], - "ban_email": [ - "VCHAR_UNI:100", - "" - ], - "ban_start": [ - "TIMESTAMP", - 0 - ], - "ban_end": [ - "TIMESTAMP", - 0 - ], - "ban_exclude": [ - "BOOL", - 0 - ], - "ban_reason": [ - "VCHAR_UNI", - "" - ], - "ban_give_reason": [ - "VCHAR_UNI", - "" - ] - }, - "PRIMARY_KEY": "ban_id", - "KEYS": { - "ban_end": [ - "INDEX", - "ban_end" - ], - "ban_user": [ - "INDEX", - [ - "ban_userid", - "ban_exclude" - ] - ], - "ban_email": [ - "INDEX", - [ - "ban_email", - "ban_exclude" - ] - ], - "ban_ip": [ - "INDEX", - [ - "ban_ip", - "ban_exclude" - ] - ] - } - }, - "phpbb_bbcodes": { - "COLUMNS": { - "bbcode_id": [ - "USINT", - 0 - ], - "bbcode_tag": [ - "VCHAR:16", - "" - ], - "bbcode_helpline": [ - "VCHAR_UNI", - "" - ], - "display_on_posting": [ - "BOOL", - 0 - ], - "bbcode_match": [ - "TEXT_UNI", - "" - ], - "bbcode_tpl": [ - "MTEXT_UNI", - "" - ], - "first_pass_match": [ - "MTEXT_UNI", - "" - ], - "first_pass_replace": [ - "MTEXT_UNI", - "" - ], - "second_pass_match": [ - "MTEXT_UNI", - "" - ], - "second_pass_replace": [ - "MTEXT_UNI", - "" - ] - }, - "PRIMARY_KEY": "bbcode_id", - "KEYS": { - "display_on_post": [ - "INDEX", - "display_on_posting" - ] - } - }, - "phpbb_bookmarks": { - "COLUMNS": { - "topic_id": [ - "UINT", - 0 - ], - "user_id": [ - "UINT", - 0 - ] - }, - "PRIMARY_KEY": [ - "topic_id", - "user_id" - ] - }, - "phpbb_bots": { - "COLUMNS": { - "bot_id": [ - "UINT", - null, - "auto_increment" - ], - "bot_active": [ - "BOOL", - 1 - ], - "bot_name": [ - "STEXT_UNI", - "" - ], - "user_id": [ - "UINT", - 0 - ], - "bot_agent": [ - "VCHAR", - "" - ], - "bot_ip": [ - "VCHAR", - "" - ] - }, - "PRIMARY_KEY": "bot_id", - "KEYS": { - "bot_active": [ - "INDEX", - "bot_active" - ] - } - }, - "phpbb_config": { - "COLUMNS": { - "config_name": [ - "VCHAR", - "" - ], - "config_value": [ - "VCHAR_UNI", - "" - ], - "is_dynamic": [ - "BOOL", - 0 - ] - }, - "PRIMARY_KEY": "config_name", - "KEYS": { - "is_dynamic": [ - "INDEX", - "is_dynamic" - ] - } - }, - "phpbb_config_text": { - "COLUMNS": { - "config_name": [ - "VCHAR", - "" - ], - "config_value": [ - "MTEXT", - "" - ] - }, - "PRIMARY_KEY": "config_name" - }, - "phpbb_confirm": { - "COLUMNS": { - "confirm_id": [ - "CHAR:32", - "" - ], - "session_id": [ - "CHAR:32", - "" - ], - "confirm_type": [ - "TINT:3", - 0 - ], - "code": [ - "VCHAR:8", - "" - ], - "seed": [ - "UINT:10", - 0 - ], - "attempts": [ - "UINT", - 0 - ] - }, - "PRIMARY_KEY": [ - "session_id", - "confirm_id" - ], - "KEYS": { - "confirm_type": [ - "INDEX", - "confirm_type" - ] - } - }, - "phpbb_disallow": { - "COLUMNS": { - "disallow_id": [ - "UINT", - null, - "auto_increment" - ], - "disallow_username": [ - "VCHAR_UNI:255", - "" - ] - }, - "PRIMARY_KEY": "disallow_id" - }, - "phpbb_drafts": { - "COLUMNS": { - "draft_id": [ - "UINT", - null, - "auto_increment" - ], - "user_id": [ - "UINT", - 0 - ], - "topic_id": [ - "UINT", - 0 - ], - "forum_id": [ - "UINT", - 0 - ], - "save_time": [ - "TIMESTAMP", - 0 - ], - "draft_subject": [ - "STEXT_UNI", - "" - ], - "draft_message": [ - "MTEXT_UNI", - "" - ] - }, - "PRIMARY_KEY": "draft_id", - "KEYS": { - "save_time": [ - "INDEX", - "save_time" - ] - } - }, - "phpbb_ext": { - "COLUMNS": { - "ext_name": [ - "VCHAR", - "" - ], - "ext_active": [ - "BOOL", - 0 - ], - "ext_state": [ - "TEXT", - "" - ] - }, - "KEYS": { - "ext_name": [ - "UNIQUE", - "ext_name" - ] - } - }, - "phpbb_extension_groups": { - "COLUMNS": { - "group_id": [ - "UINT", - null, - "auto_increment" - ], - "group_name": [ - "VCHAR_UNI", - "" - ], - "cat_id": [ - "TINT:2", - 0 - ], - "allow_group": [ - "BOOL", - 0 - ], - "download_mode": [ - "BOOL", - 1 - ], - "upload_icon": [ - "VCHAR", - "" - ], - "max_filesize": [ - "UINT:20", - 0 - ], - "allowed_forums": [ - "TEXT", - "" - ], - "allow_in_pm": [ - "BOOL", - 0 - ] - }, - "PRIMARY_KEY": "group_id" - }, - "phpbb_extensions": { - "COLUMNS": { - "extension_id": [ - "UINT", - null, - "auto_increment" - ], - "group_id": [ - "UINT", - 0 - ], - "extension": [ - "VCHAR:100", - "" - ] - }, - "PRIMARY_KEY": "extension_id" - }, - "phpbb_forums": { - "COLUMNS": { - "forum_id": [ - "UINT", - null, - "auto_increment" - ], - "parent_id": [ - "UINT", - 0 - ], - "left_id": [ - "UINT", - 0 - ], - "right_id": [ - "UINT", - 0 - ], - "forum_parents": [ - "MTEXT", - "" - ], - "forum_name": [ - "STEXT_UNI", - "" - ], - "forum_desc": [ - "TEXT_UNI", - "" - ], - "forum_desc_bitfield": [ - "VCHAR:255", - "" - ], - "forum_desc_options": [ - "UINT:11", - 7 - ], - "forum_desc_uid": [ - "VCHAR:8", - "" - ], - "forum_link": [ - "VCHAR_UNI", - "" - ], - "forum_password": [ - "VCHAR:255", - "" - ], - "forum_style": [ - "UINT", - 0 - ], - "forum_image": [ - "VCHAR", - "" - ], - "forum_rules": [ - "TEXT_UNI", - "" - ], - "forum_rules_link": [ - "VCHAR_UNI", - "" - ], - "forum_rules_bitfield": [ - "VCHAR:255", - "" - ], - "forum_rules_options": [ - "UINT:11", - 7 - ], - "forum_rules_uid": [ - "VCHAR:8", - "" - ], - "forum_topics_per_page": [ - "TINT:4", - 0 - ], - "forum_type": [ - "TINT:4", - 0 - ], - "forum_status": [ - "TINT:4", - 0 - ], - "forum_last_post_id": [ - "UINT", - 0 - ], - "forum_last_poster_id": [ - "UINT", - 0 - ], - "forum_last_post_subject": [ - "STEXT_UNI", - "" - ], - "forum_last_post_time": [ - "TIMESTAMP", - 0 - ], - "forum_last_poster_name": [ - "VCHAR_UNI", - "" - ], - "forum_last_poster_colour": [ - "VCHAR:6", - "" - ], - "forum_flags": [ - "TINT:4", - 32 - ], - "display_on_index": [ - "BOOL", - 1 - ], - "enable_indexing": [ - "BOOL", - 1 - ], - "enable_icons": [ - "BOOL", - 1 - ], - "enable_prune": [ - "BOOL", - 0 - ], - "prune_next": [ - "TIMESTAMP", - 0 - ], - "prune_days": [ - "UINT", - 0 - ], - "prune_viewed": [ - "UINT", - 0 - ], - "prune_freq": [ - "UINT", - 0 - ], - "display_subforum_list": [ - "BOOL", - 1 - ], - "forum_options": [ - "UINT:20", - 0 - ], - "enable_shadow_prune": [ - "BOOL", - 0 - ], - "prune_shadow_days": [ - "UINT", - 7 - ], - "prune_shadow_freq": [ - "UINT", - 1 - ], - "prune_shadow_next": [ - "INT:11", - 0 - ], - "forum_posts_approved": [ - "UINT", - 0 - ], - "forum_posts_unapproved": [ - "UINT", - 0 - ], - "forum_posts_softdeleted": [ - "UINT", - 0 - ], - "forum_topics_approved": [ - "UINT", - 0 - ], - "forum_topics_unapproved": [ - "UINT", - 0 - ], - "forum_topics_softdeleted": [ - "UINT", - 0 - ] - }, - "PRIMARY_KEY": "forum_id", - "KEYS": { - "left_right_id": [ - "INDEX", - [ - "left_id", - "right_id" - ] - ], - "forum_lastpost_id": [ - "INDEX", - "forum_last_post_id" - ] - } - }, - "phpbb_forums_access": { - "COLUMNS": { - "forum_id": [ - "UINT", - 0 - ], - "user_id": [ - "UINT", - 0 - ], - "session_id": [ - "CHAR:32", - "" - ] - }, - "PRIMARY_KEY": [ - "forum_id", - "user_id", - "session_id" - ] - }, - "phpbb_forums_track": { - "COLUMNS": { - "user_id": [ - "UINT", - 0 - ], - "forum_id": [ - "UINT", - 0 - ], - "mark_time": [ - "TIMESTAMP", - 0 - ] - }, - "PRIMARY_KEY": [ - "user_id", - "forum_id" - ] - }, - "phpbb_forums_watch": { - "COLUMNS": { - "forum_id": [ - "UINT", - 0 - ], - "user_id": [ - "UINT", - 0 - ], - "notify_status": [ - "BOOL", - 0 - ] - }, - "KEYS": { - "forum_id": [ - "INDEX", - "forum_id" - ], - "user_id": [ - "INDEX", - "user_id" - ], - "notify_stat": [ - "INDEX", - "notify_status" - ] - } - }, - "phpbb_groups": { - "COLUMNS": { - "group_id": [ - "UINT", - null, - "auto_increment" - ], - "group_type": [ - "TINT:4", - 1 - ], - "group_founder_manage": [ - "BOOL", - 0 - ], - "group_skip_auth": [ - "BOOL", - 0 - ], - "group_name": [ - "VCHAR_CI", - "" - ], - "group_desc": [ - "TEXT_UNI", - "" - ], - "group_desc_bitfield": [ - "VCHAR:255", - "" - ], - "group_desc_options": [ - "UINT:11", - 7 - ], - "group_desc_uid": [ - "VCHAR:8", - "" - ], - "group_display": [ - "BOOL", - 0 - ], - "group_avatar": [ - "VCHAR", - "" - ], - "group_avatar_type": [ - "VCHAR:255", - "" - ], - "group_avatar_width": [ - "USINT", - 0 - ], - "group_avatar_height": [ - "USINT", - 0 - ], - "group_rank": [ - "UINT", - 0 - ], - "group_colour": [ - "VCHAR:6", - "" - ], - "group_sig_chars": [ - "UINT", - 0 - ], - "group_receive_pm": [ - "BOOL", - 0 - ], - "group_message_limit": [ - "UINT", - 0 - ], - "group_legend": [ - "UINT", - 0 - ], - "group_max_recipients": [ - "UINT", - 0 - ] - }, - "PRIMARY_KEY": "group_id", - "KEYS": { - "group_legend_name": [ - "INDEX", - [ - "group_legend", - "group_name" - ] - ] - } - }, - "phpbb_icons": { - "COLUMNS": { - "icons_id": [ - "UINT", - null, - "auto_increment" - ], - "icons_url": [ - "VCHAR", - "" - ], - "icons_width": [ - "TINT:4", - 0 - ], - "icons_height": [ - "TINT:4", - 0 - ], - "icons_order": [ - "UINT", - 0 - ], - "display_on_posting": [ - "BOOL", - 1 - ] - }, - "PRIMARY_KEY": "icons_id", - "KEYS": { - "display_on_posting": [ - "INDEX", - "display_on_posting" - ] - } - }, - "phpbb_lang": { - "COLUMNS": { - "lang_id": [ - "TINT:4", - null, - "auto_increment" - ], - "lang_iso": [ - "VCHAR:30", - "" - ], - "lang_dir": [ - "VCHAR:30", - "" - ], - "lang_english_name": [ - "VCHAR_UNI:100", - "" - ], - "lang_local_name": [ - "VCHAR_UNI:255", - "" - ], - "lang_author": [ - "VCHAR_UNI:255", - "" - ] - }, - "PRIMARY_KEY": "lang_id", - "KEYS": { - "lang_iso": [ - "INDEX", - "lang_iso" - ] - } - }, - "phpbb_log": { - "COLUMNS": { - "log_id": [ - "UINT", - null, - "auto_increment" - ], - "log_type": [ - "TINT:4", - 0 - ], - "user_id": [ - "UINT", - 0 - ], - "forum_id": [ - "UINT", - 0 - ], - "topic_id": [ - "UINT", - 0 - ], - "reportee_id": [ - "UINT", - 0 - ], - "log_ip": [ - "VCHAR:40", - "" - ], - "log_time": [ - "TIMESTAMP", - 0 - ], - "log_operation": [ - "TEXT_UNI", - "" - ], - "log_data": [ - "MTEXT_UNI", - "" - ] - }, - "PRIMARY_KEY": "log_id", - "KEYS": { - "log_type": [ - "INDEX", - "log_type" - ], - "forum_id": [ - "INDEX", - "forum_id" - ], - "topic_id": [ - "INDEX", - "topic_id" - ], - "reportee_id": [ - "INDEX", - "reportee_id" - ], - "user_id": [ - "INDEX", - "user_id" - ] - } - }, - "phpbb_login_attempts": { - "COLUMNS": { - "attempt_ip": [ - "VCHAR:40", - "" - ], - "attempt_browser": [ - "VCHAR:150", - "" - ], - "attempt_forwarded_for": [ - "VCHAR:255", - "" - ], - "attempt_time": [ - "TIMESTAMP", - 0 - ], - "user_id": [ - "UINT", - 0 - ], - "username": [ - "VCHAR_UNI:255", - 0 - ], - "username_clean": [ - "VCHAR_CI", - 0 - ] - }, - "KEYS": { - "att_ip": [ - "INDEX", - [ - "attempt_ip", - "attempt_time" - ] - ], - "att_for": [ - "INDEX", - [ - "attempt_forwarded_for", - "attempt_time" - ] - ], - "att_time": [ - "INDEX", - [ - "attempt_time" - ] - ], - "user_id": [ - "INDEX", - "user_id" - ] - } - }, - "phpbb_migrations": { - "COLUMNS": { - "migration_name": [ - "VCHAR", - "" - ], - "migration_depends_on": [ - "TEXT", - "" - ], - "migration_schema_done": [ - "BOOL", - 0 - ], - "migration_data_done": [ - "BOOL", - 0 - ], - "migration_data_state": [ - "TEXT", - "" - ], - "migration_start_time": [ - "TIMESTAMP", - 0 - ], - "migration_end_time": [ - "TIMESTAMP", - 0 - ] - }, - "PRIMARY_KEY": "migration_name" - }, - "phpbb_moderator_cache": { - "COLUMNS": { - "forum_id": [ - "UINT", - 0 - ], - "user_id": [ - "UINT", - 0 - ], - "username": [ - "VCHAR_UNI:255", - "" - ], - "group_id": [ - "UINT", - 0 - ], - "group_name": [ - "VCHAR_UNI", - "" - ], - "display_on_index": [ - "BOOL", - 1 - ] - }, - "KEYS": { - "disp_idx": [ - "INDEX", - "display_on_index" - ], - "forum_id": [ - "INDEX", - "forum_id" - ] - } - }, - "phpbb_modules": { - "COLUMNS": { - "module_id": [ - "UINT", - null, - "auto_increment" - ], - "module_enabled": [ - "BOOL", - 1 - ], - "module_display": [ - "BOOL", - 1 - ], - "module_basename": [ - "VCHAR", - "" - ], - "module_class": [ - "VCHAR:10", - "" - ], - "parent_id": [ - "UINT", - 0 - ], - "left_id": [ - "UINT", - 0 - ], - "right_id": [ - "UINT", - 0 - ], - "module_langname": [ - "VCHAR", - "" - ], - "module_mode": [ - "VCHAR", - "" - ], - "module_auth": [ - "VCHAR", - "" - ] - }, - "PRIMARY_KEY": "module_id", - "KEYS": { - "left_right_id": [ - "INDEX", - [ - "left_id", - "right_id" - ] - ], - "module_enabled": [ - "INDEX", - "module_enabled" - ], - "class_left_id": [ - "INDEX", - [ - "module_class", - "left_id" - ] - ] - } - }, - "phpbb_notification_types": { - "COLUMNS": { - "notification_type_id": [ - "USINT", - null, - "auto_increment" - ], - "notification_type_name": [ - "VCHAR:255", - "" - ], - "notification_type_enabled": [ - "BOOL", - 1 - ] - }, - "PRIMARY_KEY": [ - "notification_type_id" - ], - "KEYS": { - "type": [ - "UNIQUE", - [ - "notification_type_name" - ] - ] - } - }, - "phpbb_notifications": { - "COLUMNS": { - "notification_id": [ - "UINT:10", - null, - "auto_increment" - ], - "notification_type_id": [ - "USINT", - 0 - ], - "item_id": [ - "UINT", - 0 - ], - "item_parent_id": [ - "UINT", - 0 - ], - "user_id": [ - "UINT", - 0 - ], - "notification_read": [ - "BOOL", - 0 - ], - "notification_time": [ - "TIMESTAMP", - 1 - ], - "notification_data": [ - "TEXT_UNI", - "" - ] - }, - "PRIMARY_KEY": "notification_id", - "KEYS": { - "item_ident": [ - "INDEX", - [ - "notification_type_id", - "item_id" - ] - ], - "user": [ - "INDEX", - [ - "user_id", - "notification_read" - ] - ] - } - }, - "phpbb_oauth_accounts": { - "COLUMNS": { - "user_id": [ - "UINT", - 0 - ], - "provider": [ - "VCHAR", - "" - ], - "oauth_provider_id": [ - "TEXT_UNI", - "" - ] - }, - "PRIMARY_KEY": [ - "user_id", - "provider" - ] - }, - "phpbb_oauth_tokens": { - "COLUMNS": { - "user_id": [ - "UINT", - 0 - ], - "session_id": [ - "CHAR:32", - "" - ], - "provider": [ - "VCHAR", - "" - ], - "oauth_token": [ - "MTEXT", - "" - ] - }, - "KEYS": { - "user_id": [ - "INDEX", - "user_id" - ], - "provider": [ - "INDEX", - "provider" - ] - } - }, - "phpbb_poll_options": { - "COLUMNS": { - "poll_option_id": [ - "TINT:4", - 0 - ], - "topic_id": [ - "UINT", - 0 - ], - "poll_option_text": [ - "TEXT_UNI", - "" - ], - "poll_option_total": [ - "UINT", - 0 - ] - }, - "KEYS": { - "poll_opt_id": [ - "INDEX", - "poll_option_id" - ], - "topic_id": [ - "INDEX", - "topic_id" - ] - } - }, - "phpbb_poll_votes": { - "COLUMNS": { - "topic_id": [ - "UINT", - 0 - ], - "poll_option_id": [ - "TINT:4", - 0 - ], - "vote_user_id": [ - "UINT", - 0 - ], - "vote_user_ip": [ - "VCHAR:40", - "" - ] - }, - "KEYS": { - "topic_id": [ - "INDEX", - "topic_id" - ], - "vote_user_id": [ - "INDEX", - "vote_user_id" - ], - "vote_user_ip": [ - "INDEX", - "vote_user_ip" - ] - } - }, - "phpbb_posts": { - "COLUMNS": { - "post_id": [ - "UINT", - null, - "auto_increment" - ], - "topic_id": [ - "UINT", - 0 - ], - "forum_id": [ - "UINT", - 0 - ], - "poster_id": [ - "UINT", - 0 - ], - "icon_id": [ - "UINT", - 0 - ], - "poster_ip": [ - "VCHAR:40", - "" - ], - "post_time": [ - "TIMESTAMP", - 0 - ], - "post_reported": [ - "BOOL", - 0 - ], - "enable_bbcode": [ - "BOOL", - 1 - ], - "enable_smilies": [ - "BOOL", - 1 - ], - "enable_magic_url": [ - "BOOL", - 1 - ], - "enable_sig": [ - "BOOL", - 1 - ], - "post_username": [ - "VCHAR_UNI:255", - "" - ], - "post_subject": [ - "STEXT_UNI", - "", - "true_sort" - ], - "post_text": [ - "MTEXT_UNI", - "" - ], - "post_checksum": [ - "VCHAR:32", - "" - ], - "post_attachment": [ - "BOOL", - 0 - ], - "bbcode_bitfield": [ - "VCHAR:255", - "" - ], - "bbcode_uid": [ - "VCHAR:8", - "" - ], - "post_postcount": [ - "BOOL", - 1 - ], - "post_edit_time": [ - "TIMESTAMP", - 0 - ], - "post_edit_reason": [ - "STEXT_UNI", - "" - ], - "post_edit_user": [ - "UINT", - 0 - ], - "post_edit_count": [ - "USINT", - 0 - ], - "post_edit_locked": [ - "BOOL", - 0 - ], - "post_visibility": [ - "TINT:3", - 0 - ], - "post_delete_time": [ - "TIMESTAMP", - 0 - ], - "post_delete_reason": [ - "STEXT_UNI", - "" - ], - "post_delete_user": [ - "UINT", - 0 - ] - }, - "PRIMARY_KEY": "post_id", - "KEYS": { - "forum_id": [ - "INDEX", - "forum_id" - ], - "topic_id": [ - "INDEX", - "topic_id" - ], - "poster_ip": [ - "INDEX", - "poster_ip" - ], - "poster_id": [ - "INDEX", - "poster_id" - ], - "tid_post_time": [ - "INDEX", - [ - "topic_id", - "post_time" - ] - ], - "post_username": [ - "INDEX", - [ - "post_username:255" - ] - ], - "post_visibility": [ - "INDEX", - [ - "post_visibility" - ] - ] - } - }, - "phpbb_privmsgs": { - "COLUMNS": { - "msg_id": [ - "UINT", - null, - "auto_increment" - ], - "root_level": [ - "UINT", - 0 - ], - "author_id": [ - "UINT", - 0 - ], - "icon_id": [ - "UINT", - 0 - ], - "author_ip": [ - "VCHAR:40", - "" - ], - "message_time": [ - "TIMESTAMP", - 0 - ], - "enable_bbcode": [ - "BOOL", - 1 - ], - "enable_smilies": [ - "BOOL", - 1 - ], - "enable_magic_url": [ - "BOOL", - 1 - ], - "enable_sig": [ - "BOOL", - 1 - ], - "message_subject": [ - "STEXT_UNI", - "" - ], - "message_text": [ - "MTEXT_UNI", - "" - ], - "message_edit_reason": [ - "STEXT_UNI", - "" - ], - "message_edit_user": [ - "UINT", - 0 - ], - "message_attachment": [ - "BOOL", - 0 - ], - "bbcode_bitfield": [ - "VCHAR:255", - "" - ], - "bbcode_uid": [ - "VCHAR:8", - "" - ], - "message_edit_time": [ - "TIMESTAMP", - 0 - ], - "message_edit_count": [ - "USINT", - 0 - ], - "to_address": [ - "TEXT_UNI", - "" - ], - "bcc_address": [ - "TEXT_UNI", - "" - ], - "message_reported": [ - "BOOL", - 0 - ] - }, - "PRIMARY_KEY": "msg_id", - "KEYS": { - "author_ip": [ - "INDEX", - "author_ip" - ], - "message_time": [ - "INDEX", - "message_time" - ], - "author_id": [ - "INDEX", - "author_id" - ], - "root_level": [ - "INDEX", - "root_level" - ] - } - }, - "phpbb_privmsgs_folder": { - "COLUMNS": { - "folder_id": [ - "UINT", - null, - "auto_increment" - ], - "user_id": [ - "UINT", - 0 - ], - "folder_name": [ - "VCHAR_UNI", - "" - ], - "pm_count": [ - "UINT", - 0 - ] - }, - "PRIMARY_KEY": "folder_id", - "KEYS": { - "user_id": [ - "INDEX", - "user_id" - ] - } - }, - "phpbb_privmsgs_rules": { - "COLUMNS": { - "rule_id": [ - "UINT", - null, - "auto_increment" - ], - "user_id": [ - "UINT", - 0 - ], - "rule_check": [ - "UINT", - 0 - ], - "rule_connection": [ - "UINT", - 0 - ], - "rule_string": [ - "VCHAR_UNI", - "" - ], - "rule_user_id": [ - "UINT", - 0 - ], - "rule_group_id": [ - "UINT", - 0 - ], - "rule_action": [ - "UINT", - 0 - ], - "rule_folder_id": [ - "INT:11", - 0 - ] - }, - "PRIMARY_KEY": "rule_id", - "KEYS": { - "user_id": [ - "INDEX", - "user_id" - ] - } - }, - "phpbb_privmsgs_to": { - "COLUMNS": { - "msg_id": [ - "UINT", - 0 - ], - "user_id": [ - "UINT", - 0 - ], - "author_id": [ - "UINT", - 0 - ], - "pm_deleted": [ - "BOOL", - 0 - ], - "pm_new": [ - "BOOL", - 1 - ], - "pm_unread": [ - "BOOL", - 1 - ], - "pm_replied": [ - "BOOL", - 0 - ], - "pm_marked": [ - "BOOL", - 0 - ], - "pm_forwarded": [ - "BOOL", - 0 - ], - "folder_id": [ - "INT:11", - 0 - ] - }, - "KEYS": { - "msg_id": [ - "INDEX", - "msg_id" - ], - "author_id": [ - "INDEX", - "author_id" - ], - "usr_flder_id": [ - "INDEX", - [ - "user_id", - "folder_id" - ] - ] - } - }, - "phpbb_profile_fields": { - "COLUMNS": { - "field_id": [ - "UINT", - null, - "auto_increment" - ], - "field_name": [ - "VCHAR_UNI", - "" - ], - "field_type": [ - "VCHAR:100", - "" - ], - "field_ident": [ - "VCHAR:20", - "" - ], - "field_length": [ - "VCHAR:20", - "" - ], - "field_minlen": [ - "VCHAR", - "" - ], - "field_maxlen": [ - "VCHAR", - "" - ], - "field_novalue": [ - "VCHAR_UNI", - "" - ], - "field_default_value": [ - "VCHAR_UNI", - "" - ], - "field_validation": [ - "VCHAR_UNI:20", - "" - ], - "field_required": [ - "BOOL", - 0 - ], - "field_show_on_reg": [ - "BOOL", - 0 - ], - "field_hide": [ - "BOOL", - 0 - ], - "field_no_view": [ - "BOOL", - 0 - ], - "field_active": [ - "BOOL", - 0 - ], - "field_order": [ - "UINT", - 0 - ], - "field_show_profile": [ - "BOOL", - 0 - ], - "field_show_on_vt": [ - "BOOL", - 0 - ], - "field_show_novalue": [ - "BOOL", - 0 - ], - "field_show_on_pm": [ - "BOOL", - 0 - ], - "field_show_on_ml": [ - "BOOL", - 0 - ], - "field_is_contact": [ - "BOOL", - 0 - ], - "field_contact_desc": [ - "VCHAR", - "" - ], - "field_contact_url": [ - "VCHAR", - "" - ] - }, - "PRIMARY_KEY": "field_id", - "KEYS": { - "fld_type": [ - "INDEX", - "field_type" - ], - "fld_ordr": [ - "INDEX", - "field_order" - ] - } - }, - "phpbb_profile_fields_data": { - "COLUMNS": { - "user_id": [ - "UINT", - 0 - ], - "pf_phpbb_interests": [ - "MTEXT", - "" - ], - "pf_phpbb_occupation": [ - "MTEXT", - "" - ], - "pf_phpbb_facebook": [ - "VCHAR", - "" - ], - "pf_phpbb_googleplus": [ - "VCHAR", - "" - ], - "pf_phpbb_icq": [ - "VCHAR", - "" - ], - "pf_phpbb_location": [ - "VCHAR", - "" - ], - "pf_phpbb_skype": [ - "VCHAR", - "" - ], - "pf_phpbb_twitter": [ - "VCHAR", - "" - ], - "pf_phpbb_website": [ - "VCHAR", - "" - ], - "pf_phpbb_wlm": [ - "VCHAR", - "" - ], - "pf_phpbb_yahoo": [ - "VCHAR", - "" - ], - "pf_phpbb_youtube": [ - "VCHAR", - "" - ], - "pf_phpbb_aol": [ - "VCHAR", - "" - ] - }, - "PRIMARY_KEY": "user_id" - }, - "phpbb_profile_fields_lang": { - "COLUMNS": { - "field_id": [ - "UINT", - 0 - ], - "lang_id": [ - "UINT", - 0 - ], - "option_id": [ - "UINT", - 0 - ], - "field_type": [ - "VCHAR:100", - "" - ], - "lang_value": [ - "VCHAR_UNI", - "" - ] - }, - "PRIMARY_KEY": [ - "field_id", - "lang_id", - "option_id" - ] - }, - "phpbb_profile_lang": { - "COLUMNS": { - "field_id": [ - "UINT", - 0 - ], - "lang_id": [ - "UINT", - 0 - ], - "lang_name": [ - "VCHAR_UNI", - "" - ], - "lang_explain": [ - "TEXT_UNI", - "" - ], - "lang_default_value": [ - "VCHAR_UNI", - "" - ] - }, - "PRIMARY_KEY": [ - "field_id", - "lang_id" - ] - }, - "phpbb_ranks": { - "COLUMNS": { - "rank_id": [ - "UINT", - null, - "auto_increment" - ], - "rank_title": [ - "VCHAR_UNI", - "" - ], - "rank_min": [ - "UINT", - 0 - ], - "rank_special": [ - "BOOL", - 0 - ], - "rank_image": [ - "VCHAR", - "" - ] - }, - "PRIMARY_KEY": "rank_id" - }, - "phpbb_reports": { - "COLUMNS": { - "report_id": [ - "UINT", - null, - "auto_increment" - ], - "reason_id": [ - "USINT", - 0 - ], - "post_id": [ - "UINT", - 0 - ], - "user_id": [ - "UINT", - 0 - ], - "user_notify": [ - "BOOL", - 0 - ], - "report_closed": [ - "BOOL", - 0 - ], - "report_time": [ - "TIMESTAMP", - 0 - ], - "report_text": [ - "MTEXT_UNI", - "" - ], - "pm_id": [ - "UINT", - 0 - ], - "reported_post_enable_bbcode": [ - "BOOL", - 1 - ], - "reported_post_enable_smilies": [ - "BOOL", - 1 - ], - "reported_post_enable_magic_url": [ - "BOOL", - 1 - ], - "reported_post_text": [ - "MTEXT_UNI", - "" - ], - "reported_post_uid": [ - "VCHAR:8", - "" - ], - "reported_post_bitfield": [ - "VCHAR:255", - "" - ] - }, - "PRIMARY_KEY": "report_id", - "KEYS": { - "post_id": [ - "INDEX", - [ - "post_id" - ] - ], - "pm_id": [ - "INDEX", - [ - "pm_id" - ] - ] - } - }, - "phpbb_reports_reasons": { - "COLUMNS": { - "reason_id": [ - "USINT", - null, - "auto_increment" - ], - "reason_title": [ - "VCHAR_UNI", - "" - ], - "reason_description": [ - "MTEXT_UNI", - "" - ], - "reason_order": [ - "USINT", - 0 - ] - }, - "PRIMARY_KEY": "reason_id" - }, - "phpbb_search_results": { - "COLUMNS": { - "search_key": [ - "VCHAR:32", - "" - ], - "search_time": [ - "TIMESTAMP", - 0 - ], - "search_keywords": [ - "MTEXT_UNI", - "" - ], - "search_authors": [ - "MTEXT", - "" - ] - }, - "PRIMARY_KEY": "search_key" - }, - "phpbb_search_wordlist": { - "COLUMNS": { - "word_id": [ - "UINT", - null, - "auto_increment" - ], - "word_text": [ - "VCHAR_UNI", - "" - ], - "word_common": [ - "BOOL", - 0 - ], - "word_count": [ - "UINT", - 0 - ] - }, - "PRIMARY_KEY": "word_id", - "KEYS": { - "wrd_txt": [ - "UNIQUE", - "word_text" - ], - "wrd_cnt": [ - "INDEX", - "word_count" - ] - } - }, - "phpbb_search_wordmatch": { - "COLUMNS": { - "post_id": [ - "UINT", - 0 - ], - "word_id": [ - "UINT", - 0 - ], - "title_match": [ - "BOOL", - 0 - ] - }, - "KEYS": { - "word_id": [ - "INDEX", - "word_id" - ], - "post_id": [ - "INDEX", - "post_id" - ], - "un_mtch": [ - "UNIQUE", - [ - "word_id", - "post_id", - "title_match" - ] - ] - } - }, - "phpbb_sessions": { - "COLUMNS": { - "session_id": [ - "CHAR:32", - "" - ], - "session_user_id": [ - "UINT", - 0 - ], - "session_last_visit": [ - "TIMESTAMP", - 0 - ], - "session_start": [ - "TIMESTAMP", - 0 - ], - "session_time": [ - "TIMESTAMP", - 0 - ], - "session_ip": [ - "VCHAR:40", - "" - ], - "session_browser": [ - "VCHAR:150", - "" - ], - "session_forwarded_for": [ - "VCHAR:255", - "" - ], - "session_page": [ - "VCHAR_UNI", - "" - ], - "session_viewonline": [ - "BOOL", - 1 - ], - "session_autologin": [ - "BOOL", - 0 - ], - "session_admin": [ - "BOOL", - 0 - ], - "session_forum_id": [ - "UINT", - 0 - ] - }, - "PRIMARY_KEY": "session_id", - "KEYS": { - "session_time": [ - "INDEX", - "session_time" - ], - "session_user_id": [ - "INDEX", - "session_user_id" - ], - "session_fid": [ - "INDEX", - [ - "session_forum_id" - ] - ] - } - }, - "phpbb_sessions_keys": { - "COLUMNS": { - "key_id": [ - "CHAR:32", - "" - ], - "user_id": [ - "UINT", - 0 - ], - "last_ip": [ - "VCHAR:40", - "" - ], - "last_login": [ - "TIMESTAMP", - 0 - ] - }, - "PRIMARY_KEY": [ - "key_id", - "user_id" - ], - "KEYS": { - "last_login": [ - "INDEX", - "last_login" - ] - } - }, - "phpbb_sitelist": { - "COLUMNS": { - "site_id": [ - "UINT", - null, - "auto_increment" - ], - "site_ip": [ - "VCHAR:40", - "" - ], - "site_hostname": [ - "VCHAR", - "" - ], - "ip_exclude": [ - "BOOL", - 0 - ] - }, - "PRIMARY_KEY": "site_id" - }, - "phpbb_smilies": { - "COLUMNS": { - "smiley_id": [ - "UINT", - null, - "auto_increment" - ], - "code": [ - "VCHAR_UNI:50", - "" - ], - "emotion": [ - "VCHAR_UNI:50", - "" - ], - "smiley_url": [ - "VCHAR:50", - "" - ], - "smiley_width": [ - "USINT", - 0 - ], - "smiley_height": [ - "USINT", - 0 - ], - "smiley_order": [ - "UINT", - 0 - ], - "display_on_posting": [ - "BOOL", - 1 - ] - }, - "PRIMARY_KEY": "smiley_id", - "KEYS": { - "display_on_post": [ - "INDEX", - "display_on_posting" - ] - } - }, - "phpbb_styles": { - "COLUMNS": { - "style_id": [ - "UINT", - null, - "auto_increment" - ], - "style_name": [ - "VCHAR_UNI:255", - "" - ], - "style_copyright": [ - "VCHAR_UNI", - "" - ], - "style_active": [ - "BOOL", - 1 - ], - "style_path": [ - "VCHAR:100", - "" - ], - "bbcode_bitfield": [ - "VCHAR:255", - "kNg=" - ], - "style_parent_id": [ - "UINT:4", - 0 - ], - "style_parent_tree": [ - "TEXT", - "" - ] - }, - "PRIMARY_KEY": "style_id", - "KEYS": { - "style_name": [ - "UNIQUE", - "style_name" - ] - } - }, - "phpbb_teampage": { - "COLUMNS": { - "teampage_id": [ - "UINT", - null, - "auto_increment" - ], - "group_id": [ - "UINT", - 0 - ], - "teampage_name": [ - "VCHAR_UNI:255", - "" - ], - "teampage_position": [ - "UINT", - 0 - ], - "teampage_parent": [ - "UINT", - 0 - ] - }, - "PRIMARY_KEY": "teampage_id" - }, - "phpbb_topics": { - "COLUMNS": { - "topic_id": [ - "UINT", - null, - "auto_increment" - ], - "forum_id": [ - "UINT", - 0 - ], - "icon_id": [ - "UINT", - 0 - ], - "topic_attachment": [ - "BOOL", - 0 - ], - "topic_reported": [ - "BOOL", - 0 - ], - "topic_title": [ - "STEXT_UNI", - "", - "true_sort" - ], - "topic_poster": [ - "UINT", - 0 - ], - "topic_time": [ - "TIMESTAMP", - 0 - ], - "topic_time_limit": [ - "TIMESTAMP", - 0 - ], - "topic_views": [ - "UINT", - 0 - ], - "topic_status": [ - "TINT:3", - 0 - ], - "topic_type": [ - "TINT:3", - 0 - ], - "topic_first_post_id": [ - "UINT", - 0 - ], - "topic_first_poster_name": [ - "VCHAR_UNI:255", - "", - "true_sort" - ], - "topic_first_poster_colour": [ - "VCHAR:6", - "" - ], - "topic_last_post_id": [ - "UINT", - 0 - ], - "topic_last_poster_id": [ - "UINT", - 0 - ], - "topic_last_poster_name": [ - "VCHAR_UNI", - "" - ], - "topic_last_poster_colour": [ - "VCHAR:6", - "" - ], - "topic_last_post_subject": [ - "STEXT_UNI", - "" - ], - "topic_last_post_time": [ - "TIMESTAMP", - 0 - ], - "topic_last_view_time": [ - "TIMESTAMP", - 0 - ], - "topic_moved_id": [ - "UINT", - 0 - ], - "topic_bumped": [ - "BOOL", - 0 - ], - "topic_bumper": [ - "UINT", - 0 - ], - "poll_title": [ - "STEXT_UNI", - "" - ], - "poll_start": [ - "TIMESTAMP", - 0 - ], - "poll_length": [ - "TIMESTAMP", - 0 - ], - "poll_max_options": [ - "TINT:4", - 1 - ], - "poll_last_vote": [ - "TIMESTAMP", - 0 - ], - "poll_vote_change": [ - "BOOL", - 0 - ], - "topic_visibility": [ - "TINT:3", - 0 - ], - "topic_delete_time": [ - "TIMESTAMP", - 0 - ], - "topic_delete_reason": [ - "STEXT_UNI", - "" - ], - "topic_delete_user": [ - "UINT", - 0 - ], - "topic_posts_approved": [ - "UINT", - 0 - ], - "topic_posts_unapproved": [ - "UINT", - 0 - ], - "topic_posts_softdeleted": [ - "UINT", - 0 - ] - }, - "PRIMARY_KEY": "topic_id", - "KEYS": { - "forum_id": [ - "INDEX", - "forum_id" - ], - "forum_id_type": [ - "INDEX", - [ - "forum_id", - "topic_type" - ] - ], - "last_post_time": [ - "INDEX", - "topic_last_post_time" - ], - "fid_time_moved": [ - "INDEX", - [ - "forum_id", - "topic_last_post_time", - "topic_moved_id" - ] - ], - "topic_visibility": [ - "INDEX", - [ - "topic_visibility" - ] - ], - "forum_vis_last": [ - "INDEX", - [ - "forum_id", - "topic_visibility", - "topic_last_post_id" - ] - ] - } - }, - "phpbb_topics_posted": { - "COLUMNS": { - "user_id": [ - "UINT", - 0 - ], - "topic_id": [ - "UINT", - 0 - ], - "topic_posted": [ - "BOOL", - 0 - ] - }, - "PRIMARY_KEY": [ - "user_id", - "topic_id" - ] - }, - "phpbb_topics_track": { - "COLUMNS": { - "user_id": [ - "UINT", - 0 - ], - "topic_id": [ - "UINT", - 0 - ], - "forum_id": [ - "UINT", - 0 - ], - "mark_time": [ - "TIMESTAMP", - 0 - ] - }, - "PRIMARY_KEY": [ - "user_id", - "topic_id" - ], - "KEYS": { - "forum_id": [ - "INDEX", - "forum_id" - ], - "topic_id": [ - "INDEX", - [ - "topic_id" - ] - ] - } - }, - "phpbb_topics_watch": { - "COLUMNS": { - "topic_id": [ - "UINT", - 0 - ], - "user_id": [ - "UINT", - 0 - ], - "notify_status": [ - "BOOL", - 0 - ] - }, - "KEYS": { - "topic_id": [ - "INDEX", - "topic_id" - ], - "user_id": [ - "INDEX", - "user_id" - ], - "notify_stat": [ - "INDEX", - "notify_status" - ] - } - }, - "phpbb_user_group": { - "COLUMNS": { - "group_id": [ - "UINT", - 0 - ], - "user_id": [ - "UINT", - 0 - ], - "group_leader": [ - "BOOL", - 0 - ], - "user_pending": [ - "BOOL", - 1 - ] - }, - "KEYS": { - "group_id": [ - "INDEX", - "group_id" - ], - "user_id": [ - "INDEX", - "user_id" - ], - "group_leader": [ - "INDEX", - "group_leader" - ] - } - }, - "phpbb_user_notifications": { - "COLUMNS": { - "item_type": [ - "VCHAR:255", - "" - ], - "item_id": [ - "UINT", - 0 - ], - "user_id": [ - "UINT", - 0 - ], - "method": [ - "VCHAR:255", - "" - ], - "notify": [ - "BOOL", - 1 - ] - } - }, - "phpbb_users": { - "COLUMNS": { - "user_id": [ - "UINT", - null, - "auto_increment" - ], - "user_type": [ - "TINT:2", - 0 - ], - "group_id": [ - "UINT", - 3 - ], - "user_permissions": [ - "MTEXT", - "" - ], - "user_perm_from": [ - "UINT", - 0 - ], - "user_ip": [ - "VCHAR:40", - "" - ], - "user_regdate": [ - "TIMESTAMP", - 0 - ], - "username": [ - "VCHAR_CI", - "" - ], - "username_clean": [ - "VCHAR_CI", - "" - ], - "user_password": [ - "VCHAR:255", - "" - ], - "user_passchg": [ - "TIMESTAMP", - 0 - ], - "user_email": [ - "VCHAR_UNI:100", - "" - ], - "user_email_hash": [ - "BINT", - 0 - ], - "user_birthday": [ - "VCHAR:10", - "" - ], - "user_lastvisit": [ - "TIMESTAMP", - 0 - ], - "user_lastmark": [ - "TIMESTAMP", - 0 - ], - "user_lastpost_time": [ - "TIMESTAMP", - 0 - ], - "user_lastpage": [ - "VCHAR_UNI:200", - "" - ], - "user_last_confirm_key": [ - "VCHAR:10", - "" - ], - "user_last_search": [ - "TIMESTAMP", - 0 - ], - "user_warnings": [ - "TINT:4", - 0 - ], - "user_last_warning": [ - "TIMESTAMP", - 0 - ], - "user_login_attempts": [ - "TINT:4", - 0 - ], - "user_inactive_reason": [ - "TINT:2", - 0 - ], - "user_inactive_time": [ - "TIMESTAMP", - 0 - ], - "user_posts": [ - "UINT", - 0 - ], - "user_lang": [ - "VCHAR:30", - "" - ], - "user_timezone": [ - "VCHAR:100", - "" - ], - "user_dateformat": [ - "VCHAR_UNI:30", - "d M Y H:i" - ], - "user_style": [ - "UINT", - 0 - ], - "user_rank": [ - "UINT", - 0 - ], - "user_colour": [ - "VCHAR:6", - "" - ], - "user_new_privmsg": [ - "INT:4", - 0 - ], - "user_unread_privmsg": [ - "INT:4", - 0 - ], - "user_last_privmsg": [ - "TIMESTAMP", - 0 - ], - "user_message_rules": [ - "BOOL", - 0 - ], - "user_full_folder": [ - "INT:11", - -3 - ], - "user_emailtime": [ - "TIMESTAMP", - 0 - ], - "user_topic_show_days": [ - "USINT", - 0 - ], - "user_topic_sortby_type": [ - "VCHAR:1", - "t" - ], - "user_topic_sortby_dir": [ - "VCHAR:1", - "d" - ], - "user_post_show_days": [ - "USINT", - 0 - ], - "user_post_sortby_type": [ - "VCHAR:1", - "t" - ], - "user_post_sortby_dir": [ - "VCHAR:1", - "a" - ], - "user_notify": [ - "BOOL", - 0 - ], - "user_notify_pm": [ - "BOOL", - 1 - ], - "user_notify_type": [ - "TINT:4", - 0 - ], - "user_allow_pm": [ - "BOOL", - 1 - ], - "user_allow_viewonline": [ - "BOOL", - 1 - ], - "user_allow_viewemail": [ - "BOOL", - 1 - ], - "user_allow_massemail": [ - "BOOL", - 1 - ], - "user_options": [ - "UINT:11", - 230271 - ], - "user_avatar": [ - "VCHAR", - "" - ], - "user_avatar_type": [ - "VCHAR:255", - "" - ], - "user_avatar_width": [ - "USINT", - 0 - ], - "user_avatar_height": [ - "USINT", - 0 - ], - "user_sig": [ - "MTEXT_UNI", - "" - ], - "user_sig_bbcode_uid": [ - "VCHAR:8", - "" - ], - "user_sig_bbcode_bitfield": [ - "VCHAR:255", - "" - ], - "user_jabber": [ - "VCHAR_UNI", - "" - ], - "user_actkey": [ - "VCHAR:32", - "" - ], - "user_newpasswd": [ - "VCHAR:255", - "" - ], - "user_form_salt": [ - "VCHAR_UNI:32", - "" - ], - "user_new": [ - "BOOL", - 1 - ], - "user_reminded": [ - "TINT:4", - 0 - ], - "user_reminded_time": [ - "TIMESTAMP", - 0 - ] - }, - "PRIMARY_KEY": "user_id", - "KEYS": { - "user_birthday": [ - "INDEX", - "user_birthday" - ], - "user_email_hash": [ - "INDEX", - "user_email_hash" - ], - "user_type": [ - "INDEX", - "user_type" - ], - "username_clean": [ - "UNIQUE", - "username_clean" - ] - } - }, - "phpbb_warnings": { - "COLUMNS": { - "warning_id": [ - "UINT", - null, - "auto_increment" - ], - "user_id": [ - "UINT", - 0 - ], - "post_id": [ - "UINT", - 0 - ], - "log_id": [ - "UINT", - 0 - ], - "warning_time": [ - "TIMESTAMP", - 0 - ] - }, - "PRIMARY_KEY": "warning_id" - }, - "phpbb_words": { - "COLUMNS": { - "word_id": [ - "UINT", - null, - "auto_increment" - ], - "word": [ - "VCHAR_UNI", - "" - ], - "replacement": [ - "VCHAR_UNI", - "" - ] - }, - "PRIMARY_KEY": "word_id" - }, - "phpbb_zebra": { - "COLUMNS": { - "user_id": [ - "UINT", - 0 - ], - "zebra_id": [ - "UINT", - 0 - ], - "friend": [ - "BOOL", - 0 - ], - "foe": [ - "BOOL", - 0 - ] - }, - "PRIMARY_KEY": [ - "user_id", - "zebra_id" - ] - } -}
\ No newline at end of file diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index baabe90f2a..adbd5a540e 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -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-RC5-dev'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.1.0-RC6-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'); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 24cfe4556b..ae7565d608 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -41,17 +41,21 @@ $lang = array_merge($lang, array( 'ACP_BOARD_SETTINGS_EXPLAIN' => 'Here you can determine the basic operation of your board, give it a fitting name and description, and among other settings adjust the default values for timezone and language.', 'BOARD_INDEX_TEXT' => 'Board index text', 'BOARD_INDEX_TEXT_EXPLAIN' => 'This text is displayed as the board index in the board’s breadcrumbs. If not specified, it will default to “Board index”.', + 'BOARD_STYLE' => 'Board style', 'CUSTOM_DATEFORMAT' => 'Custom…', 'DEFAULT_DATE_FORMAT' => 'Date format', 'DEFAULT_DATE_FORMAT_EXPLAIN' => 'The date format is the same as the PHP <code>date</code> function.', 'DEFAULT_LANGUAGE' => 'Default language', 'DEFAULT_STYLE' => 'Default style', + 'DEFAULT_STYLE_EXPLAIN' => 'The default style for new users.', 'DISABLE_BOARD' => 'Disable board', 'DISABLE_BOARD_EXPLAIN' => 'This will make the board unavailable to users who are neither administrators nor moderators. You can also enter a short (255 character) message to display if you wish.', 'DISPLAY_LAST_SUBJECT' => 'Display subject of last added post on forum list', 'DISPLAY_LAST_SUBJECT_EXPLAIN' => 'The subject of the last added post will be displayed in the forum list with a hyperlink to the post. Subjects from password protected forums and forums in which user doesn’t have read access are not shown.', + 'GUEST_STYLE' => 'Guest style', + 'GUEST_STYLE_EXPLAIN' => 'The board style for guests.', 'OVERRIDE_STYLE' => 'Override user style', - 'OVERRIDE_STYLE_EXPLAIN' => 'Replaces user’s style with the default.', + 'OVERRIDE_STYLE_EXPLAIN' => 'Replaces user’s (and guest’s) style with the style as defined under "Default style".', 'SITE_DESC' => 'Site description', 'SITE_HOME_TEXT' => 'Main website text', 'SITE_HOME_TEXT_EXPLAIN' => 'This text will be displayed as a link to your website homepage in the board’s breadcrumbs. If not specified, it will default to “Home”.', diff --git a/phpBB/language/en/acp/email.php b/phpBB/language/en/acp/email.php index ddacb9df25..0d47e37d09 100644 --- a/phpBB/language/en/acp/email.php +++ b/phpBB/language/en/acp/email.php @@ -38,7 +38,7 @@ if (empty($lang) || !is_array($lang)) // Email settings $lang = array_merge($lang, array( - 'ACP_MASS_EMAIL_EXPLAIN' => 'Here you can email a message to either all of your users or all users of a specific group <strong>having the option to receive mass emails enabled</strong>. To achieve this an email will be sent out to the administrative email address supplied, with a blind carbon copy sent to all recipients. The default setting is to only include 50 recipients in such an email, for more recipients more emails will be sent. If you are emailing a large group of people please be patient after submitting and do not stop the page halfway through. It is normal for a mass emailing to take a long time, you will be notified when the script has completed.', + 'ACP_MASS_EMAIL_EXPLAIN' => 'Here you can email a message to either all of your users or all users of a specific group <strong>having the option to receive mass emails enabled</strong>. To achieve this an email will be sent out to the administrative email address supplied, with a blind carbon copy sent to all recipients. The default setting is to only include 20 recipients in such an email, for more recipients more emails will be sent. If you are emailing a large group of people please be patient after submitting and do not stop the page halfway through. It is normal for a mass emailing to take a long time, you will be notified when the script has completed.', 'ALL_USERS' => 'All users', 'COMPOSE' => 'Compose', diff --git a/phpBB/language/en/acp/profile.php b/phpBB/language/en/acp/profile.php index d27deed602..d365aeb183 100644 --- a/phpBB/language/en/acp/profile.php +++ b/phpBB/language/en/acp/profile.php @@ -99,7 +99,7 @@ $lang = array_merge($lang, array( 'FIELD_IDENT_EXPLAIN' => 'The field identification is a name to identify the profile field within the database and the templates.', 'FIELD_INT' => 'Numbers', 'FIELD_IS_CONTACT' => 'Display field as a contact field', - 'FIELD_IS_CONTACT_EXPLAIN' => 'Contact fields are displayed within the contact section of the user profile and are displayed differently in the mini profile next to posts and private messages.', + 'FIELD_IS_CONTACT_EXPLAIN' => 'Contact fields are displayed within the contact section of the user profile and are displayed differently in the mini profile next to posts and private messages. You can use <samp>%s</samp> as a placeholder variable which will be replaced by a value provided by the user.', 'FIELD_LENGTH' => 'Length of input box', 'FIELD_NOT_FOUND' => 'Profile field not found.', 'FIELD_STRING' => 'Single text field', @@ -119,6 +119,12 @@ $lang = array_merge($lang, array( 'LANG_SPECIFIC_OPTIONS' => 'Language specific options [<strong>%s</strong>]', + 'LETTER_NUM_DOTS' => 'Any letters, numbers and dots (periods)', + 'LETTER_NUM_ONLY' => 'Any letters and numbers', + 'LETTER_NUM_PUNCTUATION' => 'Any letters, numbers, comma, dots, underscores and dashes beginning with any letter', + 'LETTER_NUM_SPACERS' => 'Any letters, numbers and spacers', + 'LETTER_NUM_UNDERSCORE' => 'Any letters, numbers and underscores', + 'MAX_FIELD_CHARS' => 'Maximum number of characters', 'MAX_FIELD_NUMBER' => 'Highest allowed number', 'MIN_FIELD_CHARS' => 'Minimum number of characters', diff --git a/phpBB/language/en/acp/search.php b/phpBB/language/en/acp/search.php index 564d9dd04c..98412cb050 100644 --- a/phpBB/language/en/acp/search.php +++ b/phpBB/language/en/acp/search.php @@ -83,7 +83,7 @@ $lang = array_merge($lang, array( 'FULLTEXT_SPHINX_PORT_EXPLAIN' => 'Port on which the sphinx search daemon (searchd) listens. Leave empty to use the default Sphinx API port 9312', 'FULLTEXT_SPHINX_WRONG_DATABASE' => 'The sphinx search for phpBB supports MySQL and PostgreSQL only.', 'FULLTEXT_SPHINX_CONFIG_FILE' => 'Sphinx config file', - 'FULLTEXT_SPHINX_CONFIG_FILE_EXPLAIN' => 'The generated content of the sphinx config file. This data needs to be pasted into the sphinx.conf which is used by sphinx search daemon.', + 'FULLTEXT_SPHINX_CONFIG_FILE_EXPLAIN' => 'The generated content of the sphinx config file. This data needs to be pasted into the sphinx.conf which is used by sphinx search daemon. Replace the [dbuser] and [dbpassword] placeholders with your database credentials.', 'FULLTEXT_SPHINX_NO_CONFIG_DATA' => 'The sphinx data and config directory paths are not defined. Please define them to generate the config file.', 'GENERAL_SEARCH_SETTINGS' => 'General search settings', diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 83e1f4eaa1..79d504a67d 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -937,32 +937,34 @@ $lang = array_merge($lang, array( // Timezones can be translated. We use this for the Etc/GMT timezones here, // because they are named invers to their offset. 'timezones' => array( - 'UTC' => 'UTC', - - 'Etc/GMT-12' => 'GMT+12', - 'Etc/GMT-11' => 'GMT+11', - 'Etc/GMT-10' => 'GMT+10', - 'Etc/GMT-9' => 'GMT+9', - 'Etc/GMT-8' => 'GMT+8', - 'Etc/GMT-7' => 'GMT+7', - 'Etc/GMT-6' => 'GMT+6', - 'Etc/GMT-5' => 'GMT+5', - 'Etc/GMT-4' => 'GMT+4', - 'Etc/GMT-3' => 'GMT+3', - 'Etc/GMT-2' => 'GMT+2', - 'Etc/GMT-1' => 'GMT+1', - 'Etc/GMT+1' => 'GMT-1', - 'Etc/GMT+2' => 'GMT-2', - 'Etc/GMT+3' => 'GMT-3', - 'Etc/GMT+4' => 'GMT-4', - 'Etc/GMT+5' => 'GMT-5', - 'Etc/GMT+6' => 'GMT-6', - 'Etc/GMT+7' => 'GMT-7', - 'Etc/GMT+8' => 'GMT-8', - 'Etc/GMT+9' => 'GMT-9', - 'Etc/GMT+10' => 'GMT-10', - 'Etc/GMT+11' => 'GMT-11', - 'Etc/GMT+12' => 'GMT-12', + 'UTC' => 'UTC', + 'UTC_OFFSET' => 'UTC%1$s', + 'UTC_OFFSET_CURRENT' => 'UTC%1$s - %2$s', + + 'Etc/GMT-12' => 'UTC+12', + 'Etc/GMT-11' => 'UTC+11', + 'Etc/GMT-10' => 'UTC+10', + 'Etc/GMT-9' => 'UTC+9', + 'Etc/GMT-8' => 'UTC+8', + 'Etc/GMT-7' => 'UTC+7', + 'Etc/GMT-6' => 'UTC+6', + 'Etc/GMT-5' => 'UTC+5', + 'Etc/GMT-4' => 'UTC+4', + 'Etc/GMT-3' => 'UTC+3', + 'Etc/GMT-2' => 'UTC+2', + 'Etc/GMT-1' => 'UTC+1', + 'Etc/GMT+1' => 'UTC-1', + 'Etc/GMT+2' => 'UTC-2', + 'Etc/GMT+3' => 'UTC-3', + 'Etc/GMT+4' => 'UTC-4', + 'Etc/GMT+5' => 'UTC-5', + 'Etc/GMT+6' => 'UTC-6', + 'Etc/GMT+7' => 'UTC-7', + 'Etc/GMT+8' => 'UTC-8', + 'Etc/GMT+9' => 'UTC-9', + 'Etc/GMT+10' => 'UTC-10', + 'Etc/GMT+11' => 'UTC-11', + 'Etc/GMT+12' => 'UTC-12', 'Africa/Abidjan' => 'Africa/Abidjan', 'Africa/Accra' => 'Africa/Accra', diff --git a/phpBB/language/en/memberlist.php b/phpBB/language/en/memberlist.php index 1a05975892..b8c626d331 100644 --- a/phpBB/language/en/memberlist.php +++ b/phpBB/language/en/memberlist.php @@ -54,6 +54,8 @@ $lang = array_merge($lang, array( 'DEST_LANG' => 'Language', 'DEST_LANG_EXPLAIN' => 'Select an appropriate language (if available) for the recipient of this message.', + 'EDIT_PROFILE' => 'Edit profile', + 'EMAIL_BODY_EXPLAIN' => 'This message will be sent as plain text, do not include any HTML or BBCode. The return address for this message will be set to your email address.', 'EMAIL_DISABLED' => 'Sorry but all email related functions have been disabled.', 'EMAIL_SENT' => 'The email has been sent.', diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index d692828bd7..ad7063d3f9 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -214,6 +214,11 @@ $lang = array_merge($lang, array( 'FIELD_INVALID_CHARS_ALPHA_PUNCTUATION' => 'The field “%s” has invalid characters, only alphanumeric or _,-. characters are allowed and the first character must be alphabetic.', 'FIELD_INVALID_CHARS_ALPHA_SPACERS' => 'The field “%s” has invalid characters, only alphanumeric, space or -+_[] characters are allowed.', 'FIELD_INVALID_CHARS_ALPHA_UNDERSCORE' => 'The field “%s” has invalid characters, only alphanumeric or _ characters are allowed.', + 'FIELD_INVALID_CHARS_LETTER_NUM_DOTS' => 'The field “%s” has invalid characters, only letter, number or . characters are allowed.', + 'FIELD_INVALID_CHARS_LETTER_NUM_ONLY' => 'The field “%s” has invalid characters, only letter and number characters are allowed.', + 'FIELD_INVALID_CHARS_LETTER_NUM_PUNCTUATION' => 'The field “%s” has invalid characters, only letter, number or _,-. characters are allowed and the first character must be alphabetic.', + 'FIELD_INVALID_CHARS_LETTER_NUM_SPACERS' => 'The field “%s” has invalid characters, only letter, number, space or -+_[] characters are allowed.', + 'FIELD_INVALID_CHARS_LETTER_NUM_UNDERSCORE' => 'The field “%s” has invalid characters, only letter, number or _ characters are allowed.', 'FIELD_INVALID_DATE' => 'The field “%s” has an invalid date.', 'FIELD_INVALID_URL' => 'The field “%s” has an invalid url.', 'FIELD_INVALID_VALUE' => 'The field “%s” has an invalid value.', @@ -584,6 +589,7 @@ $lang = array_merge($lang, array( ), 'VIEW_PREVIOUS_HISTORY' => 'Previous PM in history', 'VIEW_PREVIOUS_PM' => 'Previous PM', + 'VIEW_PROFILE' => 'View profile', 'VIEW_SIGS' => 'Display signatures', 'VIEW_SMILIES' => 'Display smilies as images', 'VIEW_TOPICS_DAYS' => 'Display topics from previous days', diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index 4f4dcb1b41..e3ac8dad51 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -283,21 +283,20 @@ switch ($mode) continue; } - $rank_title = $rank_img = $rank_img_src = ''; - get_user_rank($row['user_rank'], (($row['user_id'] == ANONYMOUS) ? false : $row['user_posts']), $rank_title, $rank_img, $rank_img_src); + $user_rank_data = phpbb_get_user_rank($row, (($row['user_id'] == ANONYMOUS) ? false : $row['user_posts'])); $template->assign_block_vars('group.user', array( 'USER_ID' => $row['user_id'], 'FORUMS' => $row['forums'], 'FORUM_OPTIONS' => (isset($row['forums_options'])) ? true : false, - 'RANK_TITLE' => $rank_title, + 'RANK_TITLE' => $user_rank_data['title'], 'GROUP_NAME' => $groups_ary[$row['default_group']]['group_name'], 'GROUP_COLOR' => $groups_ary[$row['default_group']]['group_colour'], 'U_GROUP' => $groups_ary[$row['default_group']]['u_group'], - 'RANK_IMG' => $rank_img, - 'RANK_IMG_SRC' => $rank_img_src, + 'RANK_IMG' => $user_rank_data['img'], + 'RANK_IMG_SRC' => $user_rank_data['img_src'], 'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($row['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&u=' . $row['user_id']) : '', @@ -682,6 +681,7 @@ switch ($mode) 'U_MCP_QUEUE' => ($auth->acl_getf_global('m_approve')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue', true, $user->session_id) : '', 'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_id) ? append_sid("{$phpbb_root_path}ucp.$phpEx", "mode=switch_perm&u={$user_id}&hash=" . generate_link_hash('switchperm')) : '', + 'U_EDIT_SELF' => ($user_id == $user->data['user_id']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=ucp_profile&mode=profile_info') : '', 'S_USER_NOTES' => ($user_notes_enabled) ? true : false, 'S_WARN_USER' => ($warn_user_enabled) ? true : false, @@ -1080,10 +1080,14 @@ switch ($mode) $avatar_img = phpbb_get_group_avatar($group_row); // ... same for group rank - $rank_title = $rank_img = $rank_img_src = ''; + $user_rank_data = array( + 'title' => null, + 'img' => null, + 'img_src' => null, + ); if ($group_row['group_rank']) { - get_user_rank($group_row['group_rank'], false, $rank_title, $rank_img, $rank_img_src); + $user_rank_data = phpbb_get_user_rank($group_row, false); if ($rank_img) { @@ -1096,11 +1100,11 @@ switch ($mode) 'GROUP_NAME' => ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'], 'GROUP_COLOR' => $group_row['group_colour'], 'GROUP_TYPE' => $user->lang['GROUP_IS_' . $group_row['l_group_type']], - 'GROUP_RANK' => $rank_title, + 'GROUP_RANK' => $user_rank_data['title'], 'AVATAR_IMG' => $avatar_img, - 'RANK_IMG' => $rank_img, - 'RANK_IMG_SRC' => $rank_img_src, + 'RANK_IMG' => $user_rank_data['img'], + 'RANK_IMG_SRC' => $user_rank_data['img_src'], 'U_PM' => ($auth->acl_get('u_sendpm') && $auth->acl_get('u_masspm_group') && $group_row['group_receive_pm'] && $config['allow_privmsg'] && $config['allow_mass_pm']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&g=' . $group_id) : '',) ); diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php index 902c6ae84c..c0ce3f1fba 100644 --- a/phpBB/phpbb/auth/provider/oauth/oauth.php +++ b/phpBB/phpbb/auth/provider/oauth/oauth.php @@ -105,7 +105,7 @@ class oauth extends \phpbb\auth\provider\base protected $phpbb_root_path; /** - * PHP extenstion + * PHP file extension * * @var string */ diff --git a/phpBB/phpbb/cache/driver/memory.php b/phpBB/phpbb/cache/driver/memory.php index 56308be8da..0b0e323e3d 100644 --- a/phpBB/phpbb/cache/driver/memory.php +++ b/phpBB/phpbb/cache/driver/memory.php @@ -208,12 +208,24 @@ abstract class memory extends \phpbb\cache\driver\base // determine which tables this query belongs to // Some queries use backticks, namely the get_database_size() query // don't check for conformity, the SQL would error and not reach here. - if (!preg_match('/FROM \\(?(`?\\w+`?(?: \\w+)?(?:, ?`?\\w+`?(?: \\w+)?)*)\\)?/', $query, $regs)) + if (!preg_match_all('/(?:FROM \\(?(`?\\w+`?(?: \\w+)?(?:, ?`?\\w+`?(?: \\w+)?)*)\\)?)|(?:JOIN (`?\\w+`?(?: \\w+)?))/', $query, $regs, PREG_SET_ORDER)) { // Bail out if the match fails. return $query_result; } - $tables = array_map('trim', explode(',', $regs[1])); + + $tables = array(); + foreach ($regs as $match) + { + if ($match[0][0] == 'F') + { + $tables = array_merge($tables, array_map('trim', explode(',', $match[1]))); + } + else + { + $tables[] = $match[2]; + } + } foreach ($tables as $table_name) { diff --git a/phpBB/phpbb/console/command/cache/purge.php b/phpBB/phpbb/console/command/cache/purge.php index ec8229200c..d0c2ef6f72 100644 --- a/phpBB/phpbb/console/command/cache/purge.php +++ b/phpBB/phpbb/console/command/cache/purge.php @@ -26,7 +26,7 @@ class purge extends \phpbb\console\command\command /** @var \phpbb\auth\auth */ protected $auth; - /** @var \phpbb\log\log */ + /** @var \phpbb\log\log_interface */ protected $log; /** @var \phpbb\config\config */ @@ -42,7 +42,7 @@ class purge extends \phpbb\console\command\command * @param \phpbb\log\log $log Logger instance * @param \phpbb\config\config $config Config instance */ - public function __construct(\phpbb\user $user, \phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\log\log $log, \phpbb\config\config $config) + public function __construct(\phpbb\user $user, \phpbb\cache\driver\driver_interface $cache, \phpbb\db\driver\driver_interface $db, \phpbb\auth\auth $auth, \phpbb\log\log_interface $log, \phpbb\config\config $config) { $this->cache = $cache; $this->db = $db; diff --git a/phpBB/phpbb/console/command/db/migrate.php b/phpBB/phpbb/console/command/db/migrate.php index 86545c237d..c760cde5b5 100644 --- a/phpBB/phpbb/console/command/db/migrate.php +++ b/phpBB/phpbb/console/command/db/migrate.php @@ -55,6 +55,8 @@ class migrate extends \phpbb\console\command\command { $this->migrator->create_migrations_table(); + $this->cache->purge(); + $this->load_migrations(); $orig_version = $this->config['version']; while (!$this->migrator->finished()) diff --git a/phpBB/phpbb/controller/helper.php b/phpBB/phpbb/controller/helper.php index fc19b855c0..187e455d48 100644 --- a/phpBB/phpbb/controller/helper.php +++ b/phpBB/phpbb/controller/helper.php @@ -140,14 +140,17 @@ class helper // If enable_mod_rewrite is false we need to replace the current front-end by app.php, otherwise we need to remove it. $base_url = str_replace('/' . $page_name, empty($this->config['enable_mod_rewrite']) ? '/app.' . $this->php_ext : '', $base_url); - // We need to update the base url to move to the directory of the app.php file - if (empty($this->config['enable_mod_rewrite'])) + // We need to update the base url to move to the directory of the app.php file if the current script is not app.php + if ($page_name !== 'app.php') { - $base_url = str_replace('/app.' . $this->php_ext, '/' . $this->phpbb_root_path . 'app.' . $this->php_ext, $base_url); - } - else - { - $base_url .= preg_replace(get_preg_expression('path_remove_dot_trailing_slash'), '$2', $this->phpbb_root_path); + if (empty($this->config['enable_mod_rewrite'])) + { + $base_url = str_replace('/app.' . $this->php_ext, '/' . $this->phpbb_root_path . 'app.' . $this->php_ext, $base_url); + } + else + { + $base_url .= preg_replace(get_preg_expression('path_remove_dot_trailing_slash'), '$2', $this->phpbb_root_path); + } } $base_url = $this->filesystem->clean_path($base_url); diff --git a/phpBB/phpbb/datetime.php b/phpBB/phpbb/datetime.php index e674707883..63cdba90fd 100644 --- a/phpBB/phpbb/datetime.php +++ b/phpBB/phpbb/datetime.php @@ -91,25 +91,28 @@ class datetime extends \DateTime $midnight = $midnight->getTimestamp(); - $day = false; - - if ($timestamp > $midnight + 86400) - { - $day = 'TOMORROW'; - } - else if ($timestamp > $midnight) - { - $day = 'TODAY'; - } - else if ($timestamp > $midnight - 86400) - { - $day = 'YESTERDAY'; - } - - if ($day !== false) + if ($timestamp <= $midnight + 2 * 86400) { - // Format using the short formatting and finally swap out the relative token placeholder with the correct value - return str_replace(self::RELATIVE_WRAPPER . self::RELATIVE_WRAPPER, $this->user->lang['datetime'][$day], strtr(parent::format($format['format_short']), $format['lang'])); + $day = false; + + if ($timestamp > $midnight + 86400) + { + $day = 'TOMORROW'; + } + else if ($timestamp > $midnight) + { + $day = 'TODAY'; + } + else if ($timestamp > $midnight - 86400) + { + $day = 'YESTERDAY'; + } + + if ($day !== false) + { + // Format using the short formatting and finally swap out the relative token placeholder with the correct value + return str_replace(self::RELATIVE_WRAPPER . self::RELATIVE_WRAPPER, $this->user->lang['datetime'][$day], strtr(parent::format($format['format_short']), $format['lang'])); + } } } } 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 index f749b32119..112c1e85e8 100644 --- a/phpBB/phpbb/db/migration/data/v310/notifications_use_full_name.php +++ b/phpBB/phpbb/db/migration/data/v310/notifications_use_full_name.php @@ -92,10 +92,41 @@ class notifications_use_full_name extends \phpbb\db\migration\migration 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 = 'SELECT notification_type_id + FROM ' . NOTIFICATION_TYPES_TABLE . " + WHERE notification_type_name = 'notification.type.{$notification_type}'"; + $result = $this->db->sql_query($sql); + $new_type_id = (int) $this->db->sql_fetchfield('notification_type_id'); + $this->db->sql_freeresult($result); + + if ($new_type_id) + { + // New type name already exists, + // so we delete the old type and update the type id of existing entries. + $sql = 'SELECT notification_type_id + FROM ' . NOTIFICATION_TYPES_TABLE . " + WHERE notification_type_name = '{$notification_type}'"; + $result = $this->db->sql_query($sql); + $old_type_id = (int) $this->db->sql_fetchfield('notification_type_id'); + $this->db->sql_freeresult($result); + + $sql = 'UPDATE ' . NOTIFICATIONS_TABLE . ' + SET notification_type_id = ' . (int) $new_type_id . ' + WHERE notification_type_id = ' . (int) $old_type_id; + $this->db->sql_query($sql); + + $sql = 'DELETE FROM ' . NOTIFICATION_TYPES_TABLE . " + WHERE notification_type_name = '{$notification_type}'"; + $this->db->sql_query($sql); + } + else + { + // Otherwise we just update the name + $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}' @@ -108,10 +139,41 @@ class notifications_use_full_name extends \phpbb\db\migration\migration { 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 = 'SELECT notification_type_id + FROM ' . NOTIFICATION_TYPES_TABLE . " + WHERE notification_type_name = '{$notification_type}'"; + $result = $this->db->sql_query($sql); + $new_type_id = (int) $this->db->sql_fetchfield('notification_type_id'); + $this->db->sql_freeresult($result); + + if ($new_type_id) + { + // New type name already exists, + // so we delete the old type and update the type id of existing entries. + $sql = 'SELECT notification_type_id + FROM ' . NOTIFICATION_TYPES_TABLE . " + WHERE notification_type_name = 'notification.type.{$notification_type}'"; + $result = $this->db->sql_query($sql); + $old_type_id = (int) $this->db->sql_fetchfield('notification_type_id'); + $this->db->sql_freeresult($result); + + $sql = 'UPDATE ' . NOTIFICATIONS_TABLE . ' + SET notification_type_id = ' . (int) $new_type_id . ' + WHERE notification_type_id = ' . (int) $old_type_id; + $this->db->sql_query($sql); + + $sql = 'DELETE FROM ' . NOTIFICATION_TYPES_TABLE . " + WHERE notification_type_name = 'notification.type.{$notification_type}'"; + $this->db->sql_query($sql); + } + else + { + // Otherwise we just update the name + $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}' diff --git a/phpBB/phpbb/db/migration/data/v310/profilefield_field_validation_length.php b/phpBB/phpbb/db/migration/data/v310/profilefield_field_validation_length.php new file mode 100644 index 0000000000..c7d8b2dc91 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/profilefield_field_validation_length.php @@ -0,0 +1,90 @@ +<?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 profilefield_field_validation_length extends \phpbb\db\migration\migration +{ + protected $validation_options_old = array( + 'ALPHA_SPACERS' => '[\w_\+\. \-\[\]]+', + ); + + protected $validation_options_new = array( + 'ALPHA_SPACERS' => '[\w\x20_+\-\[\]]+', + ); + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\rc3', + ); + } + + public function update_schema() + { + return array( + 'change_columns' => array( + $this->table_prefix . 'profile_fields' => array( + 'field_validation' => array('VCHAR_UNI:64', ''), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'change_columns' => array( + $this->table_prefix . 'profile_fields' => array( + 'field_validation' => array('VCHAR_UNI:20', ''), + ), + ), + ); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'update_profile_fields_validation'))), + ); + } + + public function revert_data() + { + return array( + array('custom', array(array($this, 'revert_profile_fields_validation'))), + ); + } + + public function update_profile_fields_validation() + { + foreach ($this->validation_options_new as $validation_type => $regex) + { + $sql = 'UPDATE ' . $this->table_prefix . "profile_fields + SET field_validation = '" . $this->db->sql_escape($this->validation_options_new[$validation_type]) . "' + WHERE field_validation = '" . $this->db->sql_escape($this->validation_options_old[$validation_type]) . "'"; + $this->sql_query($sql); + } + } + + public function revert_profile_fields_validation() + { + foreach ($this->validation_options_new as $validation_type => $regex) + { + $sql = 'UPDATE ' . $this->table_prefix . "profile_fields + SET field_validation = '" . $this->db->sql_escape($this->validation_options_old[$validation_type]) . "' + WHERE field_validation = '" . $this->db->sql_escape($this->validation_options_new[$validation_type]) . "'"; + $this->sql_query($sql); + } + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/rc5.php b/phpBB/phpbb/db/migration/data/v310/rc5.php new file mode 100644 index 0000000000..5b6f70e32e --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/rc5.php @@ -0,0 +1,33 @@ +<?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 rc5 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\rc4', + '\phpbb\db\migration\data\v310\profilefield_field_validation_length', + '\phpbb\db\migration\data\v310\remove_acp_styles_cache', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.0-RC5')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/remove_acp_styles_cache.php b/phpBB/phpbb/db/migration/data/v310/remove_acp_styles_cache.php new file mode 100644 index 0000000000..7b84539814 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/remove_acp_styles_cache.php @@ -0,0 +1,51 @@ +<?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 remove_acp_styles_cache extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + $sql = 'SELECT module_id + FROM ' . MODULES_TABLE . " + WHERE module_class = 'acp' + AND module_langname = 'ACP_STYLES_CACHE'"; + $result = $this->db->sql_query($sql); + $module_id = $this->db->sql_fetchfield('module_id'); + $this->db->sql_freeresult($result); + + return !$module_id; + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\rc4'); + } + + public function update_data() + { + return array( + array('module.remove', array( + 'acp', + 'ACP_STYLE_MANAGEMENT', + array( + 'module_basename' => 'acp_styles', + 'module_langname' => 'ACP_STYLES_CACHE', + 'module_mode' => 'cache', + 'module_auth' => 'acl_a_styles', + ), + )), + ); + } +} diff --git a/phpBB/phpbb/db/tools.php b/phpBB/phpbb/db/tools.php index 3567570137..0781d7425e 100644 --- a/phpBB/phpbb/db/tools.php +++ b/phpBB/phpbb/db/tools.php @@ -1512,7 +1512,7 @@ class tools $sql .= (strpos($column_data[1], '0x') === 0) ? "DEFAULT {$column_data[1]} " : "DEFAULT '{$column_data[1]}' "; } - if (!is_null($column_data[1])) + if (!is_null($column_data[1]) || (isset($column_data[2]) && $column_data[2] == 'auto_increment')) { $sql .= 'NOT NULL'; } diff --git a/phpBB/phpbb/di/pass/kernel_pass.php b/phpBB/phpbb/di/pass/kernel_pass.php deleted file mode 100644 index c154c7532d..0000000000 --- a/phpBB/phpbb/di/pass/kernel_pass.php +++ /dev/null @@ -1,67 +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. -* -*/ - -namespace phpbb\di\pass; - -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; - -class kernel_pass implements CompilerPassInterface -{ - /** - * Modify the container before it is passed to the rest of the code - * - * @param ContainerBuilder $container ContainerBuilder object - * @return null - * @throws \InvalidArgumentException - */ - public function process(ContainerBuilder $container) - { - $definition = $container->getDefinition('dispatcher'); - - foreach ($container->findTaggedServiceIds('kernel.event_listener') as $id => $events) - { - foreach ($events as $event) - { - $priority = isset($event['priority']) ? $event['priority'] : 0; - - if (!isset($event['event'])) - { - throw new \InvalidArgumentException(sprintf('Service "%1$s" must define the "event" attribute on "kernel.event_listener" tags.', $id)); - } - - if (!isset($event['method'])) - { - throw new \InvalidArgumentException(sprintf('Service "%1$s" must define the "method" attribute on "kernel.event_listener" tags.', $id)); - } - - $definition->addMethodCall('addListenerService', array($event['event'], array($id, $event['method']), $priority)); - } - } - - foreach ($container->findTaggedServiceIds('kernel.event_subscriber') as $id => $attributes) - { - // We must assume that the class value has been correctly filled, even if the service is created by a factory - $class = $container->getDefinition($id)->getClass(); - - $refClass = new \ReflectionClass($class); - $interface = 'Symfony\Component\EventDispatcher\EventSubscriberInterface'; - if (!$refClass->implementsInterface($interface)) - { - throw new \InvalidArgumentException(sprintf('Service "%1$s" must implement interface "%2$s".', $id, $interface)); - } - - $definition->addMethodCall('addSubscriberService', array($id, $class)); - } - } -} diff --git a/phpBB/phpbb/event/php_exporter.php b/phpBB/phpbb/event/php_exporter.php index badbbb48fd..35144eeeec 100644 --- a/phpBB/phpbb/event/php_exporter.php +++ b/phpBB/phpbb/event/php_exporter.php @@ -253,7 +253,7 @@ class php_exporter public function get_event_name($event_line, $is_dispatch) { $event_text_line = $this->file_lines[$event_line]; - $event_text_line = ltrim($event_text_line, "\t"); + $event_text_line = ltrim($event_text_line, "\t "); if ($is_dispatch) { @@ -389,7 +389,7 @@ class php_exporter $found_comment_end = false; while (ltrim($this->file_lines[$this->current_event_line - $current_doc_line], "\t") !== '/**') { - if (ltrim($this->file_lines[$this->current_event_line - $current_doc_line], "\t") === '*/') + if (ltrim($this->file_lines[$this->current_event_line - $current_doc_line], "\t ") === '*/') { $found_comment_end = true; } @@ -471,7 +471,7 @@ class php_exporter { $find_tag_line = 0; $found_comment_end = false; - while (strpos(ltrim($this->file_lines[$this->current_event_line - $find_tag_line], "\t"), '* @' . $find_tag . ' ') !== 0) + while (strpos(ltrim($this->file_lines[$this->current_event_line - $find_tag_line], "\t "), '* @' . $find_tag . ' ') !== 0) { if ($found_comment_end && ltrim($this->file_lines[$this->current_event_line - $find_tag_line], "\t") === '/**') { @@ -482,7 +482,7 @@ class php_exporter foreach ($disallowed_tags as $disallowed_tag) { - if ($found_comment_end && strpos(ltrim($this->file_lines[$this->current_event_line - $find_tag_line], "\t"), '* @' . $disallowed_tag) === 0) + if ($found_comment_end && strpos(ltrim($this->file_lines[$this->current_event_line - $find_tag_line], "\t "), '* @' . $disallowed_tag) === 0) { // Found @var after the @since throw new \LogicException("Found '@{$disallowed_tag}' information after '@{$find_tag}' for event " @@ -490,7 +490,7 @@ class php_exporter } } - if (ltrim($this->file_lines[$this->current_event_line - $find_tag_line], "\t") === '*/') + if (ltrim($this->file_lines[$this->current_event_line - $find_tag_line], "\t ") === '*/') { $found_comment_end = true; } @@ -550,7 +550,7 @@ class php_exporter public function validate_since($line) { $match = array(); - preg_match('#^\* @since (\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?)$#', ltrim($line, "\t"), $match); + preg_match('#^\* @since (\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?)$#', ltrim($line, "\t "), $match); if (!isset($match[1])) { throw new \LogicException("Invalid '@since' information for event " @@ -570,7 +570,7 @@ class php_exporter */ public function validate_event($event_name, $line) { - $event = substr(ltrim($line, "\t"), strlen('* @event ')); + $event = substr(ltrim($line, "\t "), strlen('* @event ')); if ($event !== trim($event)) { diff --git a/phpBB/phpbb/pagination.php b/phpBB/phpbb/pagination.php index 8aba41d651..7a81c25ad2 100644 --- a/phpBB/phpbb/pagination.php +++ b/phpBB/phpbb/pagination.php @@ -21,18 +21,26 @@ class pagination /** @var \phpbb\user */ protected $user; + /** @var \phpbb\controller\helper */ + protected $helper; + + /** @var \phpbb\event\dispatcher_interface */ + protected $phpbb_dispatcher; + /** * Constructor * - * @param \phpbb\template\template $template - * @param \phpbb\user $user - * @param \phpbb\controller\helper $helper + * @param \phpbb\template\template $template + * @param \phpbb\user $user + * @param \phpbb\controller\helper $helper + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher */ - public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\controller\helper $helper) + public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\controller\helper $helper, \phpbb\event\dispatcher_interface $phpbb_dispatcher) { $this->template = $template; $this->user = $user; $this->helper = $helper; + $this->phpbb_dispatcher = $phpbb_dispatcher; } /** @@ -50,6 +58,36 @@ class pagination */ protected function generate_page_link($base_url, $on_page, $start_name, $per_page) { + // A listener can set this variable to the new pagination URL + // to override the generate_page_link() function generated value + $generate_page_link_override = false; + + /** + * Execute code and/or override generate_page_link() + * + * To override the generate_page_link() function generated value + * set $generate_page_link_override to the new URL value + * + * @event core.pagination_generate_page_link + * @var string base_url is url prepended to all links generated within the function + * If you use page numbers inside your controller route, base_url should contains a placeholder (%d) + * for the page. Also be sure to specify the pagination path information into the start_name argument + * @var string on_page is the page for which we want to generate the link + * @var string start_name is the name of the parameter containing the first item of the given page (example: start=20) + * If you use page numbers inside your controller route, start name should be the string + * that should be removed for the first page (example: /page/%d) + * @var int per_page the number of items, posts, etc. to display per page, used to determine the number of pages to produce + * @var bool|string generate_page_link_override Shall we return custom pagination link (string URL) or not (false) + * @since 3.1.0-RC5 + */ + $vars = array('base_url', 'on_page', 'start_name', 'per_page', 'generate_page_link_override'); + extract($this->phpbb_dispatcher->trigger_event('core.pagination_generate_page_link', compact($vars))); + + if ($generate_page_link_override) + { + return $generate_page_link_override; + } + if (!is_string($base_url)) { if (is_array($base_url['routes'])) diff --git a/phpBB/phpbb/profilefields/type/type_base.php b/phpBB/phpbb/profilefields/type/type_base.php index c770a0d93c..52f5d15511 100644 --- a/phpBB/phpbb/profilefields/type/type_base.php +++ b/phpBB/phpbb/profilefields/type/type_base.php @@ -133,7 +133,7 @@ abstract class type_base implements type_interface { foreach ($field_data[$key] as $lang_id => $options) { - $field_data[$key][$lang_id] = explode("\n", $options); + $field_data[$key][$lang_id] = is_array($options) ? $options : explode("\n", $options); } return $current_value; diff --git a/phpBB/phpbb/profilefields/type/type_string_common.php b/phpBB/phpbb/profilefields/type/type_string_common.php index 0eaf7e527d..ff33a7b49c 100644 --- a/phpBB/phpbb/profilefields/type/type_string_common.php +++ b/phpBB/phpbb/profilefields/type/type_string_common.php @@ -21,8 +21,13 @@ abstract class type_string_common extends type_base 'ALPHA_ONLY' => '[\w]+', 'ALPHA_UNDERSCORE' => '[\w_]+', 'ALPHA_DOTS' => '[\w.]+', - 'ALPHA_SPACERS' => '[\w_\+\. \-\[\]]+', + 'ALPHA_SPACERS' => '[\w\x20_+\-\[\]]+', 'ALPHA_PUNCTUATION' => '[a-zA-Z][\w\.,\-_]+', + 'LETTER_NUM_ONLY' => '[\p{Lu}\p{Ll}0-9]+', + 'LETTER_NUM_UNDERSCORE' => '[\p{Lu}\p{Ll}0-9_]+', + 'LETTER_NUM_DOTS' => '[\p{Lu}\p{Ll}0-9.]+', + 'LETTER_NUM_SPACERS' => '[\p{Lu}\p{Ll}0-9\x20_+\-\[\]]+', + 'LETTER_NUM_PUNCTUATION' => '[\p{Lu}\p{Ll}][\p{Lu}\p{Ll}0-9.,\-_]+', ); /** @@ -79,7 +84,7 @@ abstract class type_string_common extends type_base if (!empty($field_data['field_validation']) && $field_data['field_validation'] != '.*') { $field_validate = ($field_type != 'text') ? $field_value : bbcode_nl2br($field_value); - if (!preg_match('#^' . str_replace('\\\\', '\\', $field_data['field_validation']) . '$#i', $field_validate)) + if (!preg_match('#^' . str_replace('\\\\', '\\', $field_data['field_validation']) . '$#iu', $field_validate)) { $validation = array_search($field_data['field_validation'], $this->validation_options); if ($validation) diff --git a/phpBB/phpbb/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php index 79d68d2ae1..eb53ca6d40 100644 --- a/phpBB/phpbb/search/fulltext_sphinx.php +++ b/phpBB/phpbb/search/fulltext_sphinx.php @@ -256,8 +256,8 @@ class fulltext_sphinx array('type', $this->dbtype . ' # mysql or pgsql'), // This config value sql_host needs to be changed incase sphinx and sql are on different servers array('sql_host', $dbhost . ' # SQL server host sphinx connects to'), - array('sql_user', $dbuser), - array('sql_pass', $dbpasswd), + array('sql_user', '[dbuser]'), + array('sql_pass', '[dbpassword]'), array('sql_db', $dbname), array('sql_port', $dbport . ' # optional, default is 3306 for mysql and 5432 for pgsql'), array('sql_query_pre', 'SET NAMES \'utf8\''), @@ -715,6 +715,7 @@ class fulltext_sphinx ), 'ON' => 'p1.topic_id = p2.topic_id', )), + 'WHERE' => 'p2.post_id = ' . ((int) $post_id), ); $sql = $this->db->sql_build_query('SELECT', $sql_array); diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 30b364821d..cf8ea1877e 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -441,12 +441,13 @@ class session if (!$session_expired) { - // Only update session DB a minute or so after last update or if page changes and is not ajax request - if (($this->time_now - $this->data['session_time'] > 60 || ($this->update_session_page && $this->data['session_page'] != $this->page['page'])) && !$request->is_ajax()) + // Only update session DB a minute or so after last update or if page changes + if ($this->time_now - $this->data['session_time'] > 60 || ($this->update_session_page && $this->data['session_page'] != $this->page['page'])) { $sql_ary = array('session_time' => $this->time_now); - if ($this->update_session_page) + // Do not update the session page for ajax requests, so the view online still works as intended + if ($this->update_session_page && !$request->is_ajax()) { $sql_ary['session_page'] = substr($this->page['page'], 0, 199); $sql_ary['session_forum_id'] = $this->page['forum']; @@ -576,32 +577,7 @@ class session } } - $provider_collection = $phpbb_container->get('auth.provider_collection'); - $provider = $provider_collection->get_provider(); - $this->data = $provider->autologin(); - - if (sizeof($this->data)) - { - $this->cookie_data['k'] = ''; - $this->cookie_data['u'] = $this->data['user_id']; - } - - // If we're presented with an autologin key we'll join against it. - // Else if we've been passed a user_id we'll grab data based on that - if (isset($this->cookie_data['k']) && $this->cookie_data['k'] && $this->cookie_data['u'] && !sizeof($this->data)) - { - $sql = 'SELECT u.* - FROM ' . USERS_TABLE . ' u, ' . SESSIONS_KEYS_TABLE . ' k - WHERE u.user_id = ' . (int) $this->cookie_data['u'] . ' - AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ") - AND k.user_id = u.user_id - AND k.key_id = '" . $db->sql_escape(md5($this->cookie_data['k'])) . "'"; - $result = $db->sql_query($sql); - $this->data = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - $bot = false; - } - else if ($user_id !== false && !sizeof($this->data)) + if ($user_id !== false && !sizeof($this->data)) { $this->cookie_data['k'] = ''; $this->cookie_data['u'] = $user_id; @@ -615,6 +591,34 @@ class session $db->sql_freeresult($result); $bot = false; } + else if (!$bot) + { + $provider_collection = $phpbb_container->get('auth.provider_collection'); + $provider = $provider_collection->get_provider(); + $this->data = $provider->autologin(); + + if (sizeof($this->data)) + { + $this->cookie_data['k'] = ''; + $this->cookie_data['u'] = $this->data['user_id']; + } + + // If we're presented with an autologin key we'll join against it. + // Else if we've been passed a user_id we'll grab data based on that + if (isset($this->cookie_data['k']) && $this->cookie_data['k'] && $this->cookie_data['u'] && !sizeof($this->data)) + { + $sql = 'SELECT u.* + FROM ' . USERS_TABLE . ' u, ' . SESSIONS_KEYS_TABLE . ' k + WHERE u.user_id = ' . (int) $this->cookie_data['u'] . ' + AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ") + AND k.user_id = u.user_id + AND k.key_id = '" . $db->sql_escape(md5($this->cookie_data['k'])) . "'"; + $result = $db->sql_query($sql); + $this->data = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + $bot = false; + } + } // Bot user, if they have a SID in the Request URI we need to get rid of it // otherwise they'll index this page with the SID, duplicate content oh my! diff --git a/phpBB/phpbb/template/base.php b/phpBB/phpbb/template/base.php index ab0e1f281d..9a40702ba8 100644 --- a/phpBB/phpbb/template/base.php +++ b/phpBB/phpbb/template/base.php @@ -142,11 +142,11 @@ abstract class base implements template { global $phpbb_hook; - if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array(__CLASS__, $method), $handle, $this)) + if (!empty($phpbb_hook) && $phpbb_hook->call_hook(array('template', $method), $handle, $this)) { - if ($phpbb_hook->hook_return(array(__CLASS__, $method))) + if ($phpbb_hook->hook_return(array('template', $method))) { - $result = $phpbb_hook->hook_return_result(array(__CLASS__, $method)); + $result = $phpbb_hook->hook_return_result(array('template', $method)); return array($result); } } diff --git a/phpBB/phpbb/user.php b/phpBB/phpbb/user.php index ea98034434..882e9cef26 100644 --- a/phpBB/phpbb/user.php +++ b/phpBB/phpbb/user.php @@ -717,7 +717,7 @@ class user extends \phpbb\session $utc = new \DateTimeZone('UTC'); } - $time = new \phpbb\datetime($this, "@$gmepoch", $utc); + $time = new $this->datetime($this, "@$gmepoch", $utc); $time->setTimezone($this->timezone); return $time->format($format, $forcedate); diff --git a/phpBB/phpbb/user_loader.php b/phpBB/phpbb/user_loader.php index c9707ee432..24e663b150 100644 --- a/phpBB/phpbb/user_loader.php +++ b/phpBB/phpbb/user_loader.php @@ -212,7 +212,7 @@ class user_loader return ''; } - if (!function_exists('get_user_rank')) + if (!function_exists('phpbb_get_user_rank')) { include($this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext); } @@ -223,7 +223,10 @@ class user_loader 'rank_img_src', ); - get_user_rank($user['user_rank'], (($user['user_id'] == ANONYMOUS) ? false : $user['user_posts']), $rank['rank_title'], $rank['rank_img'], $rank['rank_img_src']); + $user_rank_data = phpbb_get_user_rank($user, (($user['user_id'] == ANONYMOUS) ? false : $user['user_posts'])); + $rank['rank_title'] = $user_rank_data['title']; + $rank['rank_img'] = $user_rank_data['img']; + $rank['rank_img_src'] = $user_rank_data['img_src']; return $rank; } diff --git a/phpBB/posting.php b/phpBB/posting.php index 18572a3a6c..764a16d386 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1155,6 +1155,34 @@ if ($submit || $preview || $refresh) } } + /** + * This event allows you to define errors before the post action is performed + * + * @event core.posting_modify_submission_errors + * @var array post_data Array with post data + * @var string mode What action to take if the form is submitted + * post|reply|quote|edit|delete|bump|smilies|popup + * @var string page_title Title of the mode page + * @var int post_id ID of the post + * @var int topic_id ID of the topic + * @var int forum_id ID of the forum + * @var bool submit Whether or not the form has been submitted + * @var array error Any error strings; a non-empty array aborts form submission. + * NOTE: Should be actual language strings, NOT language keys. + * @since 3.1.0-RC5 + */ + $vars = array( + 'post_data', + 'mode', + 'page_title', + 'post_id', + 'topic_id', + 'forum_id', + 'submit', + 'error', + ); + extract($phpbb_dispatcher->trigger_event('core.posting_modify_submission_errors', compact($vars))); + // Store message, sync counters if (!sizeof($error) && $submit) { @@ -1246,9 +1274,87 @@ if ($submit || $preview || $refresh) // post's poster, not the poster of the current post). See: PHPBB3-11769 for more information. $post_author_name = ((!$user->data['is_registered'] || $mode == 'edit') && $post_data['username'] !== '') ? $post_data['username'] : ''; + /** + * This event allows you to define errors before the post action is performed + * + * @event core.posting_modify_submit_post_before + * @var array post_data Array with post data + * @var array poll Array with poll data + * @var array data Array with post data going to be stored in the database + * @var string mode What action to take if the form is submitted + * post|reply|quote|edit|delete + * @var string page_title Title of the mode page + * @var int post_id ID of the post + * @var int topic_id ID of the topic + * @var int forum_id ID of the forum + * @var string post_author_name Author name for guest posts + * @var bool update_message Boolean if the post message was changed + * @var bool update_subject Boolean if the post subject was changed + * @var bool submit Whether or not the form has been submitted + * @var array error Any error strings; a non-empty array aborts form submission. + * NOTE: Should be actual language strings, NOT language keys. + * @since 3.1.0-RC5 + */ + $vars = array( + 'post_data', + 'poll', + 'data', + 'mode', + 'page_title', + 'post_id', + 'topic_id', + 'forum_id', + 'post_author_name', + 'update_message', + 'update_subject', + 'submit', + 'error', + ); + extract($phpbb_dispatcher->trigger_event('core.posting_modify_submit_post_before', compact($vars))); + // The last parameter tells submit_post if search indexer has to be run $redirect_url = submit_post($mode, $post_data['post_subject'], $post_author_name, $post_data['topic_type'], $poll, $data, $update_message, ($update_message || $update_subject) ? true : false); + /** + * This event allows you to define errors after the post action is performed + * + * @event core.posting_modify_submit_post_after + * @var array post_data Array with post data + * @var array poll Array with poll data + * @var array data Array with post data going to be stored in the database + * @var string mode What action to take if the form is submitted + * post|reply|quote|edit|delete + * @var string page_title Title of the mode page + * @var int post_id ID of the post + * @var int topic_id ID of the topic + * @var int forum_id ID of the forum + * @var string post_author_name Author name for guest posts + * @var bool update_message Boolean if the post message was changed + * @var bool update_subject Boolean if the post subject was changed + * @var string redirect_url URL the user is going to be redirected to + * @var bool submit Whether or not the form has been submitted + * @var array error Any error strings; a non-empty array aborts form submission. + * NOTE: Should be actual language strings, NOT language keys. + * @since 3.1.0-RC5 + */ + $vars = array( + 'post_data', + 'poll', + 'data', + 'mode', + 'page_title', + 'post_id', + 'topic_id', + 'forum_id', + 'post_author_name', + 'update_message', + 'update_subject', + 'redirect_url', + 'submit', + 'error', + ); + extract($phpbb_dispatcher->trigger_event('core.posting_modify_submit_post_after', compact($vars))); + if ($config['enable_post_confirm'] && !$user->data['is_registered'] && (isset($captcha) && $captcha->is_solved() === true) && ($mode == 'post' || $mode == 'reply' || $mode == 'quote')) { $captcha->reset(); diff --git a/phpBB/search.php b/phpBB/search.php index 93f12f4310..0d269c5606 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -553,16 +553,6 @@ if ($keywords || $author || $author_id || $search_id || $submit) // Grab icons $icons = $cache->obtain_icons(); - // Output header - if ($found_more_search_matches) - { - $l_search_matches = $user->lang('FOUND_MORE_SEARCH_MATCHES', (int) $total_match_count); - } - else - { - $l_search_matches = $user->lang('FOUND_SEARCH_MATCHES', (int) $total_match_count); - } - // define some vars for urls // A single wildcard will make the search results look ugly $hilit = phpbb_clean_search_string(str_replace(array('+', '-', '|', '(', ')', '"'), ' ', $keywords)); @@ -584,44 +574,6 @@ if ($keywords || $author || $author_id || $search_id || $submit) $u_search .= ($search_fields != 'all') ? '&sf=' . $search_fields : ''; $u_search .= ($return_chars != 300) ? '&ch=' . $return_chars : ''; - // Check if search backend supports phrase search or not - $phrase_search_disabled = ''; - if (strpos(html_entity_decode($keywords), '"') !== false && method_exists($search, 'supports_phrase_search')) - { - $phrase_search_disabled = $search->supports_phrase_search() ? false : true; - } - - $pagination->generate_template_pagination($u_search, 'pagination', 'start', $total_match_count, $per_page, $start); - - $template->assign_vars(array( - 'SEARCH_TITLE' => $l_search_title, - 'SEARCH_MATCHES' => $l_search_matches, - 'SEARCH_WORDS' => $keywords, - 'SEARCHED_QUERY' => $search->get_search_query(), - 'IGNORED_WORDS' => (!empty($common_words)) ? implode(' ', $common_words) : '', - - 'PHRASE_SEARCH_DISABLED' => $phrase_search_disabled, - - 'TOTAL_MATCHES' => $total_match_count, - 'SEARCH_IN_RESULTS' => ($search_id) ? false : true, - - 'S_SELECT_SORT_DIR' => $s_sort_dir, - 'S_SELECT_SORT_KEY' => $s_sort_key, - 'S_SELECT_SORT_DAYS' => $s_limit_days, - 'S_SEARCH_ACTION' => $u_search, - 'S_SHOW_TOPICS' => ($show_results == 'posts') ? false : true, - - 'GOTO_PAGE_IMG' => $user->img('icon_post_target', 'GOTO_PAGE'), - 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), - 'REPORTED_IMG' => $user->img('icon_topic_reported', 'TOPIC_REPORTED'), - 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'TOPIC_UNAPPROVED'), - 'DELETED_IMG' => $user->img('icon_topic_deleted', 'TOPIC_DELETED'), - 'POLL_IMG' => $user->img('icon_topic_poll', 'TOPIC_POLL'), - 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), - - 'U_SEARCH_WORDS' => $u_search, - )); - if ($sql_where) { if ($show_results == 'posts') @@ -739,9 +691,11 @@ if ($keywords || $author || $author_id || $search_id || $submit) * @var string sql_select The SQL SELECT string used by search to get topic data * @var string sql_from The SQL FROM string used by search to get topic data * @var string sql_where The SQL WHERE string used by search to get topic data + * @var int total_match_count The total number of search matches * @since 3.1.0-a1 + * @changed 3.1.0-RC5 Added total_match_count */ - $vars = array('sql_select', 'sql_from', 'sql_where'); + $vars = array('sql_select', 'sql_from', 'sql_where', 'total_match_count'); extract($phpbb_dispatcher->trigger_event('core.search_get_topic_data', compact($vars))); $sql = "SELECT $sql_select @@ -1149,6 +1103,54 @@ if ($keywords || $author || $author_id || $search_id || $submit) } unset($rowset); + // Output header + if ($found_more_search_matches) + { + $l_search_matches = $user->lang('FOUND_MORE_SEARCH_MATCHES', (int) $total_match_count); + } + else + { + $l_search_matches = $user->lang('FOUND_SEARCH_MATCHES', (int) $total_match_count); + } + + // Check if search backend supports phrase search or not + $phrase_search_disabled = ''; + if (strpos(html_entity_decode($keywords), '"') !== false && method_exists($search, 'supports_phrase_search')) + { + $phrase_search_disabled = $search->supports_phrase_search() ? false : true; + } + + $pagination->generate_template_pagination($u_search, 'pagination', 'start', $total_match_count, $per_page, $start); + + $template->assign_vars(array( + 'SEARCH_TITLE' => $l_search_title, + 'SEARCH_MATCHES' => $l_search_matches, + 'SEARCH_WORDS' => $keywords, + 'SEARCHED_QUERY' => $search->get_search_query(), + 'IGNORED_WORDS' => (!empty($common_words)) ? implode(' ', $common_words) : '', + + 'PHRASE_SEARCH_DISABLED' => $phrase_search_disabled, + + 'TOTAL_MATCHES' => $total_match_count, + 'SEARCH_IN_RESULTS' => ($search_id) ? false : true, + + 'S_SELECT_SORT_DIR' => $s_sort_dir, + 'S_SELECT_SORT_KEY' => $s_sort_key, + 'S_SELECT_SORT_DAYS' => $s_limit_days, + 'S_SEARCH_ACTION' => $u_search, + 'S_SHOW_TOPICS' => ($show_results == 'posts') ? false : true, + + 'GOTO_PAGE_IMG' => $user->img('icon_post_target', 'GOTO_PAGE'), + 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), + 'REPORTED_IMG' => $user->img('icon_topic_reported', 'TOPIC_REPORTED'), + 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'TOPIC_UNAPPROVED'), + 'DELETED_IMG' => $user->img('icon_topic_deleted', 'TOPIC_DELETED'), + 'POLL_IMG' => $user->img('icon_topic_poll', 'TOPIC_POLL'), + 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), + + 'U_SEARCH_WORDS' => $u_search, + )); + /** * Modify the title and/or load data for the search results page * diff --git a/phpBB/styles/prosilver/style.cfg b/phpBB/styles/prosilver/style.cfg index 1c4315f937..8853bd4382 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-RC4 -phpbb_version = 3.1.0-RC4 +style_version = 3.1.0-RC5 +phpbb_version = 3.1.0-RC5 # Defining a different template bitfield # template_bitfield = lNg= diff --git a/phpBB/styles/prosilver/template/captcha_default.html b/phpBB/styles/prosilver/template/captcha_default.html index 550962db67..02899bcafd 100644 --- a/phpBB/styles/prosilver/template/captcha_default.html +++ b/phpBB/styles/prosilver/template/captcha_default.html @@ -1,5 +1,5 @@ <!-- IF S_TYPE == 1 --> -<div class="panel"> +<div class="panel captcha-panel"> <div class="inner"> <h3 class="captcha-title">{L_CONFIRMATION}</h3> @@ -10,7 +10,7 @@ <dl> <dt><label for="confirm_code">{L_CONFIRM_CODE}{L_COLON}</label></dt> - <dd><img src="{CONFIRM_IMAGE_LINK}" alt="{L_CONFIRM_CODE}" /></dd> + <dd class="captcha captcha-image"><img src="{CONFIRM_IMAGE_LINK}" alt="{L_CONFIRM_CODE}" /></dd> <dd><input type="text" name="confirm_code" id="confirm_code" size="8" maxlength="8" tabindex="{$CAPTCHA_TAB_INDEX}" class="inputbox narrow" title="{L_CONFIRM_CODE}" /> <!-- IF S_CONFIRM_REFRESH --><input type="submit" name="refresh_vc" id="refresh_vc" class="button2" value="{L_VC_REFRESH}" /><!-- ENDIF --> <input type="hidden" name="confirm_id" id="confirm_id" value="{CONFIRM_ID}" /></dd> diff --git a/phpBB/styles/prosilver/template/captcha_qa.html b/phpBB/styles/prosilver/template/captcha_qa.html index 1671987f63..b8c6678066 100644 --- a/phpBB/styles/prosilver/template/captcha_qa.html +++ b/phpBB/styles/prosilver/template/captcha_qa.html @@ -1,5 +1,5 @@ <!-- IF S_TYPE == 1 --> -<div class="panel"> +<div class="panel captcha-panel"> <div class="inner"> <h3 class="captcha-title">{L_CONFIRMATION}</h3> @@ -8,7 +8,7 @@ <dl> <dt><label>{QA_CONFIRM_QUESTION}{L_COLON}</label><br /><span>{L_CONFIRM_QUESTION_EXPLAIN}</span></dt> - <dd> + <dd class="captcha"> <input type="text" tabindex="{$CAPTCHA_TAB_INDEX}" name="qa_answer" id="answer" size="45" class="inputbox autowidth" title="{L_ANSWER}" /> <input type="hidden" name="qa_confirm_id" id="qa_confirm_id" value="{QA_CONFIRM_ID}" /> </dd> diff --git a/phpBB/styles/prosilver/template/captcha_recaptcha.html b/phpBB/styles/prosilver/template/captcha_recaptcha.html index bde0c9df13..fee0f7423e 100644 --- a/phpBB/styles/prosilver/template/captcha_recaptcha.html +++ b/phpBB/styles/prosilver/template/captcha_recaptcha.html @@ -1,5 +1,5 @@ <!-- IF S_TYPE == 1 --> -<div class="panel"> +<div class="panel captcha-panel"> <div class="inner"> <h3 class="captcha-title">{L_CONFIRMATION}</h3> @@ -11,24 +11,16 @@ <!-- IF S_RECAPTCHA_AVAILABLE --> <dl> <dt><label>{L_CONFIRM_CODE}{L_COLON}</label><br /><span>{L_RECAPTCHA_EXPLAIN}</span></dt> - <dd> - <script type="text/javascript"> - // <![CDATA[ + <dd class="captcha"> + <script> var RecaptchaOptions = { lang : '{LA_RECAPTCHA_LANG}', theme : 'clean', tabindex : <!-- IF $CAPTCHA_TAB_INDEX -->{$CAPTCHA_TAB_INDEX}<!-- ELSE -->10<!-- ENDIF --> }; - // ]]> - </script> - <script type="text/javascript" src="{RECAPTCHA_SERVER}/challenge?k={RECAPTCHA_PUBKEY}{RECAPTCHA_ERRORGET}"></script> - <script type="text/javascript"> - // <![CDATA[ - <!-- IF S_CONTENT_DIRECTION eq 'rtl' --> - document.getElementById('recaptcha_table').style.direction = 'ltr'; - <!-- ENDIF --> - // ]]> </script> + <script src="{RECAPTCHA_SERVER}/challenge?k={RECAPTCHA_PUBKEY}{RECAPTCHA_ERRORGET}"></script> + <noscript> <div> <object data="{RECAPTCHA_SERVER}/noscript?k={RECAPTCHA_PUBKEY}{RECAPTCHA_ERRORGET}" type="text/html" height="300" width="500"></object><br /> @@ -37,6 +29,7 @@ </div> </noscript> + <a href="http://www.google.com/intl/{LA_RECAPTCHA_LANG}/policies/" target="_blank" class="recaptcha-responsive" style="display: none"><img alt="" width="71" height="36" src="{RECAPTCHA_SERVER}/img/clean/logo.png"></a> </dd> </dl> <!-- ELSE --> diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index 1280ceb8ac..aabc5679f6 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -1,5 +1,3 @@ -/* global phpbb */ - /** * phpBB3 forum functions */ @@ -321,7 +319,8 @@ function parseDocument($container) { 'use strict'; var test = document.createElement('div'), - oldBrowser = (typeof test.style.borderRadius == 'undefined'); + oldBrowser = (typeof test.style.borderRadius == 'undefined'), + $body = $('body'); /** * Reset avatar dimensions when changing URL or EMAIL @@ -348,7 +347,7 @@ function parseDocument($container) { $container.find('.pagination .dropdown-trigger').click(function() { var $dropdownContainer = $(this).parent(); // Wait a little bit to make sure the dropdown has activated - setTimeout(function() { + setTimeout(function() { if ($dropdownContainer.hasClass('dropdown-visible')) { $dropdownContainer.find('input.inputbox').focus(); } @@ -356,7 +355,7 @@ function parseDocument($container) { }); /** - * Adjust HTML code for IE8 and older versions + * Adjust HTML code for IE8 and older versions */ if (oldBrowser) { // Fix .linklist.bulletin lists @@ -364,7 +363,7 @@ function parseDocument($container) { } /** - * Resize navigation block to keep all links on same line + * Resize navigation (breadcrumbs) block to keep all links on same line */ $container.find('.navlinks').each(function() { var $this = $(this), @@ -394,7 +393,6 @@ function parseDocument($container) { */ $container.find('.breadcrumbs:not([data-skip-responsive])').each(function() { var $this = $(this), - $body = $('body'), $links = $this.find('.crumb'), length = $links.length, classes = ['wrapped-max', 'wrapped-wide', 'wrapped-medium', 'wrapped-small', 'wrapped-tiny'], @@ -461,159 +459,173 @@ function parseDocument($container) { */ $container.find('.linklist:not(.navlinks, [data-skip-responsive]), .postbody .post-buttons:not([data-skip-responsive])').each(function() { var $this = $(this), - $body = $('body'), filterSkip = '.breadcrumbs, [data-skip-responsive]', filterLast = '.edit-icon, .quote-icon, [data-last-responsive]', - persist = $this.attr('id') == 'nav-main', - $allLinks = $this.children(), - $links = $allLinks.not(filterSkip), - html = '<li class="responsive-menu" style="display:none;"><a href="javascript:void(0);" class="responsive-menu-link"> </a><div class="dropdown" style="display:none;"><div class="pointer"><div class="pointer-inner" /></div><ul class="dropdown-contents" /></div></li>', - $filterLastList = $links.filter(filterLast), - slack = 1; // Vertical slack space (in pixels). Determines how sensitive the script is in determining whether a line-break has occured. - - if (!persist) { - if ($links.is('.rightside')) { - $links.filter('.rightside:first').before(html); + $linksAll = $this.children(), + $linksNotSkip = $linksAll.not(filterSkip), // All items that can potentially be hidden + $linksFirst = $linksNotSkip.not(filterLast), // The items that will be hidden first + $linksLast = $linksNotSkip.filter(filterLast), // The items that will be hidden last + persistent = $this.attr('id') == 'nav-main', // Does this list already have a menu (such as quick-links)? + html = '<li class="responsive-menu hidden"><a href="javascript:void(0);" class="responsive-menu-link"> </a><div class="dropdown hidden"><div class="pointer"><div class="pointer-inner" /></div><ul class="dropdown-contents" /></div></li>', + slack = 3; // Vertical slack space (in pixels). Determines how sensitive the script is in determining whether a line-break has occured. + + // Add a hidden drop-down menu to each links list (except those that already have one) + if (!persistent) { + if ($linksNotSkip.is('.rightside')) { + $linksNotSkip.filter('.rightside:first').before(html); $this.children('.responsive-menu').addClass('rightside'); } else { $this.append(html); } } - var $item = $this.children('.responsive-menu'), - $menu = $item.find('.dropdown-contents'), + // Set some object references and initial states + var $menu = $this.children('.responsive-menu'), + $menuContents = $menu.find('.dropdown-contents'), + persistentContent = $menuContents.find('li:not(.separator)').length, lastWidth = false, compact = false, - responsive = false, - copied = false; + responsive1 = false, + responsive2 = false, + copied1 = false, + copied2 = false, + maxHeight = 0; + + // Find the tallest element in the list (we assume that all elements are roughly the same height) + $linksAll.each(function() { + if (!$(this).height()) { + return; + } + maxHeight = Math.max(maxHeight, $(this).outerHeight(true)); + }); + if (maxHeight < 1) { + return; // Shouldn't be possible, but just in case, abort + } else { + maxHeight = maxHeight + slack; + } function check() { var width = $body.width(); - if (responsive && width <= lastWidth) { + // We can't make it any smaller than this, so just skip + if (responsive2 && compact && (width <= lastWidth)) { return; } - - // Unhide the quick-links menu if it has content - if (persist) { - $item.addClass('hidden'); - if ($menu.find('li:not(.separator, .clone)').length || (responsive && $menu.find('li.clone').length)) { - $item.removeClass('hidden'); - } - } + lastWidth = width; // Reset responsive and compact layout - if (responsive) { - $this.removeClass('responsive'); - $links.css('display', ''); - if (!persist) { - $item.css('display', 'none'); - } + if (responsive1 || responsive2) { + $linksNotSkip.removeClass('hidden'); + $menuContents.children('.clone').addClass('hidden'); + responsive1 = responsive2 = false; } - if (compact) { $this.removeClass('compact'); + compact = false; } - // Find tallest element - var maxHeight = 0; - $allLinks.each(function() { - if (!$(this).height()) { - return; - } - maxHeight = Math.max(maxHeight, $(this).outerHeight(true)); - }); - - if (maxHeight < 1) { - return; + // Unhide the quick-links menu if it has "persistent" content + if (persistent && persistentContent) { + $menu.removeClass('hidden'); + } else { + $menu.addClass('hidden'); } // Nothing to resize if block's height is not bigger than tallest element's height - if ($this.height() <= (maxHeight + slack)) { + if ($this.height() <= maxHeight) { return; } - // Enable compact layout, find tallest element, compare to height of whole block - $this.addClass('compact'); - - var compactMaxHeight = 0; - $allLinks.each(function() { - if (!$(this).height()) { - return; - } - compactMaxHeight = Math.max(compactMaxHeight, $(this).outerHeight(true)); - }); - - if ($this.height() <= (maxHeight + slack)) { + // STEP 1: Compact + if (!compact) { + $this.addClass('compact'); + compact = true; + } + if ($this.height() <= maxHeight) { return; } - // Compact layout did not resize block enough, switch to responsive layout - $this.removeClass('compact'); - responsive = true; - - if (!copied) { - var clone = $links.clone(true); - clone.filter('.rightside').each(function() { - if (persist) { - $(this).addClass('clone'); - } - $menu.prepend(this); - }); - - if (persist) { - $menu.prepend(clone.not('.rightside').addClass('clone')); - } else { - $menu.prepend(clone.not('.rightside')); - } - - $menu.find('li.leftside, li.rightside').removeClass('leftside rightside'); - $menu.find('.inputbox').parents('li:first').css('white-space', 'normal'); + // STEP 2: First responsive set - compact + if (compact) { + $this.removeClass('compact'); + compact = false; + } + // Copy the list items to the dropdown + if (!copied1) { + var $clones1 = $linksFirst.clone(); + $menuContents.prepend($clones1.addClass('clone clone-first').removeClass('leftside rightside')); if ($this.hasClass('post-buttons')) { - $('.button', $menu).removeClass('button icon-button'); - $('.responsive-menu-link', $item).addClass('button icon-button').prepend('<span></span>'); + $('.button', $menuContents).removeClass('button icon-button'); + $('.responsive-menu-link', $menu).addClass('button icon-button').prepend('<span></span>'); } - copied = true; - } else { - $menu.children().css('display', ''); + copied1 = true; + } + if (!responsive1) { + $linksFirst.addClass('hidden'); + responsive1 = true; + $menuContents.children('.clone-first').removeClass('hidden'); + $menu.removeClass('hidden'); + } + if ($this.height() <= maxHeight) { + return; } - $item.css('display', ''); - $this.addClass('responsive'); - - // Try to not hide filtered items - if ($filterLastList.length) { - $links.not(filterLast).css('display', 'none'); - - maxHeight = 0; - $filterLastList.each(function() { - if (!$(this).height()) return; - maxHeight = Math.max(maxHeight, $(this).outerHeight(true)); - }); - - if ($this.height() <= (maxHeight + slack)) { - $menu.children().filter(filterLast).css('display', 'none'); - return; - } + // STEP 3: First responsive set + compact + if (!compact) { + $this.addClass('compact'); + compact = true; + } + if ($this.height() <= maxHeight) { + return; } - // If even responsive isn't enough, use both responsive and compact at same time - compact = true; - $this.addClass('compact'); + // STEP 4: Last responsive set - compact + if (!$linksLast.length) { + return; // No other links to hide, can't do more + } + if (compact) { + $this.removeClass('compact'); + compact = false; + } + // Copy the list items to the dropdown + if (!copied2) { + var $clones2 = $linksLast.clone(); + $menuContents.prepend($clones2.addClass('clone clone-last').removeClass('leftside rightside')); + copied2 = true; + } + if (!responsive2) { + $linksLast.addClass('hidden'); + responsive2 = true; + $menuContents.children('.clone-last').removeClass('hidden'); + } + if ($this.height() <= maxHeight) { + return; + } - $links.css('display', 'none'); + // STEP 5: Last responsive set + compact + if (!compact) { + $this.addClass('compact'); + compact = true; + } } - if (!persist) { - phpbb.registerDropdown($item.find('a.responsive-menu-link'), $item.find('.dropdown')); + if (!persistent) { + phpbb.registerDropdown($menu.find('a.responsive-menu-link'), $menu.find('.dropdown'), false); } + // If there are any images in the links list, run the check again after they have loaded + $linksAll.find('img').each(function() { + $(this).load(function() { + check(); + }); + }); + check(); $(window).resize(check); }); /** - * Do not run functions below for old browsers + * Do not run functions below for old browsers */ if (oldBrowser) { return; @@ -747,7 +759,7 @@ function parseDocument($container) { $this.addClass('show-header'); } }); - + headersLength = headers.length; // Add header text to each cell as <dfn> @@ -804,7 +816,6 @@ function parseDocument($container) { */ $container.find('#tabs, #minitabs').not('[data-skip-responsive]').each(function() { var $this = $(this), - $body = $('body'), $ul = $this.children(), $tabs = $ul.children().not('[data-skip-responsive]'), $links = $tabs.children('a'), diff --git a/phpBB/styles/prosilver/template/forumlist_body.html b/phpBB/styles/prosilver/template/forumlist_body.html index 22859b2452..c90f5b0639 100644 --- a/phpBB/styles/prosilver/template/forumlist_body.html +++ b/phpBB/styles/prosilver/template/forumlist_body.html @@ -26,7 +26,9 @@ <!-- EVENT forumlist_body_category_header_after --> <!-- IF not forumrow.S_IS_CAT --> + <!-- EVENT forumlist_body_forum_row_before --> <li class="row"> + <!-- EVENT forumlist_body_forum_row_prepend --> <dl class="icon {forumrow.FORUM_IMG_STYLE}"> <dt title="{forumrow.FORUM_FOLDER_IMG_ALT}"> <!-- IF forumrow.S_UNREAD_FORUM --><a href="{forumrow.U_VIEWFORUM}" class="icon-link"></a><!-- ENDIF --> @@ -80,7 +82,9 @@ </dd> <!-- ENDIF --> </dl> + <!-- EVENT forumlist_body_forum_row_append --> </li> + <!-- EVENT forumlist_body_forum_row_after --> <!-- ENDIF --> <!-- IF forumrow.S_LAST_ROW --> diff --git a/phpBB/styles/prosilver/template/memberlist_view.html b/phpBB/styles/prosilver/template/memberlist_view.html index eb151af8df..5d8e6ec8a8 100644 --- a/phpBB/styles/prosilver/template/memberlist_view.html +++ b/phpBB/styles/prosilver/template/memberlist_view.html @@ -20,6 +20,7 @@ <dt>{L_USERNAME}{L_COLON}</dt> <dd> <!-- IF USER_COLOR --><span style="color: {USER_COLOR}; font-weight: bold;"><!-- ELSE --><span><!-- ENDIF -->{USERNAME}</span> + <!-- IF U_EDIT_SELF --> [ <a href="{U_EDIT_SELF}">{L_EDIT_PROFILE}</a> ]<!-- ENDIF --> <!-- IF U_USER_ADMIN --> [ <a href="{U_USER_ADMIN}">{L_USER_ADMIN}</a> ]<!-- ENDIF --> <!-- IF U_USER_BAN --> [ <a href="{U_USER_BAN}">{L_USER_BAN}</a> ]<!-- ENDIF --> <!-- IF U_SWITCH_PERMISSIONS --> [ <a href="{U_SWITCH_PERMISSIONS}">{L_USE_PERMISSIONS}</a> ]<!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/search_results.html b/phpBB/styles/prosilver/template/search_results.html index b31e7b7b5d..970a7bcdd1 100644 --- a/phpBB/styles/prosilver/template/search_results.html +++ b/phpBB/styles/prosilver/template/search_results.html @@ -11,10 +11,10 @@ <p><a class="arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH}" title="{L_SEARCH_ADV}">{L_GO_TO_SEARCH_ADV}</a></p> <!-- ENDIF --> -<!-- IF .pagination or SEARCH_MATCHES or PAGE_NUMBER --> +<!-- IF .pagination or SEARCH_MATCHES or TOTAL_MATCHES or PAGE_NUMBER --> <div class="action-bar top"> - <!-- IF SEARCH_MATCHES --> + <!-- IF TOTAL_MATCHES > 0 --> <div class="search-box"> <form method="post" action="{S_SEARCH_ACTION}"> <fieldset> @@ -178,9 +178,9 @@ <div class="action-bar bottom"> <div class="pagination"> {SEARCH_MATCHES} - <!-- IF .pagination --> + <!-- IF .pagination --> <!-- INCLUDE pagination.html --> - <!-- ELSE --> + <!-- ELSE --> • {PAGE_NUMBER} <!-- ENDIF --> </div> diff --git a/phpBB/styles/prosilver/template/timezone_option.html b/phpBB/styles/prosilver/template/timezone_option.html index fc0579bffd..b8be456489 100644 --- a/phpBB/styles/prosilver/template/timezone_option.html +++ b/phpBB/styles/prosilver/template/timezone_option.html @@ -1,10 +1,12 @@ <dl> <dt><label for="timezone">{L_BOARD_TIMEZONE}{L_COLON}</label></dt> - <!-- IF S_TZ_DATE_OPTIONS --> + <!-- IF .timezone_date --> <dd id="tz_select_date" style="display: none;"> <select name="tz_date" id="tz_date" class="autowidth tz_select"> <option value="">{L_SELECT_CURRENT_TIME}</option> - {S_TZ_DATE_OPTIONS} + <!-- BEGIN timezone_date --> + <option value="{timezone_date.VALUE}"<!-- IF timezone_date.SELECTED --> selected="selected"<!-- ENDIF -->>{timezone_date.TITLE}</option> + <!-- END timezone_date --> </select> <input type="button" id="tz_select_date_suggest" class="button2" style="display: none;" timezone-preselect="<!-- IF S_TZ_PRESELECT -->true<!-- ELSE -->false<!-- ENDIF -->" data-l-suggestion="{L_TIMEZONE_DATE_SUGGESTION}" value="{L_TIMEZONE_DATE_SUGGESTION}" /> </dd> @@ -12,7 +14,13 @@ <dd> <select name="tz" id="timezone" class="autowidth tz_select"> <option value="">{L_SELECT_TIMEZONE}</option> - {S_TZ_OPTIONS} + <!-- BEGIN timezone_select --> + <optgroup label="{timezone_select.LABEL}" data-tz-value="{timezone_select.VALUE}"> + <!-- BEGIN timezone_options --> + <option title="{timezone_select.timezone_options.TITLE}" value="{timezone_select.timezone_options.VALUE}"<!-- IF timezone_select.timezone_options.SELECTED --> selected="selected"<!-- ENDIF -->>{timezone_select.timezone_options.LABEL}</option> + <!-- END timezone_options --> + </optgroup> + <!-- END timezone_select --> </select> <!-- INCLUDEJS timezone.js --> diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html index ddd95780d7..8a6ea1a0bb 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html @@ -62,6 +62,7 @@ </div> <!-- ENDIF --> <!-- END contact --> + </div> </div> </div> </dd> diff --git a/phpBB/styles/prosilver/template/ucp_profile_profile_info.html b/phpBB/styles/prosilver/template/ucp_profile_profile_info.html index 986bc92298..e8e2aedc14 100644 --- a/phpBB/styles/prosilver/template/ucp_profile_profile_info.html +++ b/phpBB/styles/prosilver/template/ucp_profile_profile_info.html @@ -2,7 +2,7 @@ <form id="ucp" method="post" action="{S_UCP_ACTION}"{S_FORM_ENCTYPE}> -<h2>{L_TITLE}</h2> +<h2>{L_TITLE} <span class="small">[ <a href="{U_USER_PROFILE}" title="{L_VIEW_PROFILE}">{L_VIEW_PROFILE}</a> ]</span></h2> <div class="panel"> <div class="inner"> diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index 4362d50b37..43e994f1f9 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -39,9 +39,13 @@ <!-- IF not S_IS_BOT and S_DISPLAY_POST_INFO --> <div class="buttons"> + <!-- EVENT viewforum_buttons_top_before --> + <a href="{U_POST_NEW_TOPIC}" class="button icon-button <!-- IF S_IS_LOCKED -->locked-icon<!-- ELSE -->post-icon<!-- ENDIF -->" title="<!-- IF S_IS_LOCKED -->{L_FORUM_LOCKED}<!-- ELSE -->{L_POST_TOPIC}<!-- ENDIF -->"> <!-- IF S_IS_LOCKED -->{L_BUTTON_FORUM_LOCKED}<!-- ELSE -->{L_BUTTON_NEW_TOPIC}<!-- ENDIF --> </a> + + <!-- EVENT viewforum_buttons_top_after --> </div> <!-- ENDIF --> @@ -60,7 +64,7 @@ <div class="pagination"> <!-- IF not S_IS_BOT and U_MARK_TOPICS and .topicrow --><a href="{U_MARK_TOPICS}" class="mark" accesskey="m" data-ajax="mark_topics_read">{L_MARK_TOPICS_READ}</a> • <!-- ENDIF --> - {TOTAL_TOPICS} + {TOTAL_TOPICS} <!-- IF .pagination --> <!-- INCLUDE pagination.html --> <!-- ELSE --> @@ -227,15 +231,19 @@ <div class="action-bar bottom"> <!-- IF not S_IS_BOT and S_DISPLAY_POST_INFO --> <div class="buttons"> + <!-- EVENT viewforum_buttons_bottom_before --> + <a href="{U_POST_NEW_TOPIC}" class="button icon-button <!-- IF S_IS_LOCKED -->locked-icon<!-- ELSE -->post-icon<!-- ENDIF -->" title="<!-- IF S_IS_LOCKED -->{L_FORUM_LOCKED}<!-- ELSE -->{L_POST_TOPIC}<!-- ENDIF -->"> <!-- IF S_IS_LOCKED -->{L_BUTTON_FORUM_LOCKED}<!-- ELSE -->{L_BUTTON_NEW_TOPIC}<!-- ENDIF --> </a> + + <!-- EVENT viewforum_buttons_bottom_after --> </div> <!-- ENDIF --> <div class="pagination"> <!-- IF not S_IS_BOT and U_MARK_TOPICS and .topicrow --><a href="{U_MARK_TOPICS}" data-ajax="mark_topics_read">{L_MARK_TOPICS_READ}</a> • <!-- ENDIF --> - {TOTAL_TOPICS} + {TOTAL_TOPICS} <!-- IF .pagination --> <!-- INCLUDE pagination.html --> <!-- ELSE --> diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index 4463f6dfc0..621e2d6143 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -28,11 +28,15 @@ <div class="action-bar top"> <div class="buttons"> + <!-- EVENT viewtopic_buttons_top_before --> + <!-- IF not S_IS_BOT and S_DISPLAY_REPLY_INFO --> <a href="{U_POST_REPLY_TOPIC}" class="button icon-button <!-- IF S_IS_LOCKED -->locked-icon<!-- ELSE -->reply-icon<!-- ENDIF -->" title="<!-- IF S_IS_LOCKED -->{L_TOPIC_LOCKED}<!-- ELSE -->{L_POST_REPLY}<!-- ENDIF -->"> <!-- IF S_IS_LOCKED -->{L_BUTTON_TOPIC_LOCKED}<!-- ELSE -->{L_BUTTON_POST_REPLY}<!-- ENDIF --> </a> <!-- ENDIF --> + + <!-- EVENT viewtopic_buttons_top_after --> </div> <!-- INCLUDE viewtopic_topic_tools.html --> @@ -170,7 +174,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, 750, 320); return false;"<!-- ENDIF -->> + <a href="<!-- IF postrow.contact.U_CONTACT -->{postrow.contact.U_CONTACT}<!-- ELSE -->{postrow.U_POST_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 --> @@ -338,11 +342,15 @@ <!-- EVENT viewtopic_body_topic_actions_before --> <div class="action-bar bottom"> <div class="buttons"> + <!-- EVENT viewtopic_buttons_bottom_before --> + <!-- IF not S_IS_BOT and S_DISPLAY_REPLY_INFO --> <a href="{U_POST_REPLY_TOPIC}" class="button icon-button <!-- IF S_IS_LOCKED -->locked-icon<!-- ELSE -->reply-icon<!-- ENDIF -->" title="<!-- IF S_IS_LOCKED -->{L_TOPIC_LOCKED}<!-- ELSE -->{L_POST_REPLY}<!-- ENDIF -->"> <!-- IF S_IS_LOCKED -->{L_BUTTON_TOPIC_LOCKED}<!-- ELSE -->{L_BUTTON_POST_REPLY}<!-- ENDIF --> </a> <!-- ENDIF --> + + <!-- EVENT viewtopic_buttons_bottom_after --> </div> <!-- INCLUDE viewtopic_topic_tools.html --> diff --git a/phpBB/styles/prosilver/theme/bidi.css b/phpBB/styles/prosilver/theme/bidi.css index 65123af4e5..2d79a78ccb 100644 --- a/phpBB/styles/prosilver/theme/bidi.css +++ b/phpBB/styles/prosilver/theme/bidi.css @@ -1121,4 +1121,20 @@ li.breadcrumbs span:first-child > a { .rtl .has-profile .post-buttons { left: 20px; } + + /* Forms + ----------------------------------------*/ + .rtl fieldset dt, .rtl fieldset.fields1 dt, .rtl fieldset.fields2 dt { + float: none; + } + + .rtl fieldset dd, .rtl fieldset.fields1 dd, .rtl fieldset.fields2 dd { + margin-right: 20px; + } + + @media only screen and (max-width: 500px), only screen and (max-device-width: 500px) { + .captcha-panel dd.captcha { + margin-right: 0; + } + } } diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css index 090046f54f..adcd04b15e 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -1289,18 +1289,10 @@ ul.linklist:after, width: 50px; } -.dropdown .clone { +.dropdown .clone.hidden + li.separator { display: none; } -.responsive .dropdown .clone { - display: inherit; -} - -.dropdown .clone + li.separator { - display: none; -} - -.responsive .dropdown .clone + li.separator { - display: inherit; +.dropdown .clone.hidden + li { + border-top: none; } diff --git a/phpBB/styles/prosilver/theme/cp.css b/phpBB/styles/prosilver/theme/cp.css index d3699c3012..014bb91e7a 100644 --- a/phpBB/styles/prosilver/theme/cp.css +++ b/phpBB/styles/prosilver/theme/cp.css @@ -110,7 +110,7 @@ ul.cplist { } #tabs .tab, #minitabs .tab { - display: inline-block; + display: block; float: left; font-size: 1em; font-weight: bold; diff --git a/phpBB/styles/prosilver/theme/forms.css b/phpBB/styles/prosilver/theme/forms.css index cbdeab11f9..f08a8a9691 100644 --- a/phpBB/styles/prosilver/theme/forms.css +++ b/phpBB/styles/prosilver/theme/forms.css @@ -129,6 +129,10 @@ dd select { width: auto; } +dd select[multiple] { + width: 100%; +} + dd textarea { width: 85%; } @@ -410,7 +414,7 @@ input.button1:focus, input.button2:focus, input.button3:focus { .search-header a.button { border: 0; - border-left: 1; + border-left: 1px; padding: 3px 5px 3px 4px; } diff --git a/phpBB/styles/prosilver/theme/responsive.css b/phpBB/styles/prosilver/theme/responsive.css index 698b9efd75..8653042a69 100644 --- a/phpBB/styles/prosilver/theme/responsive.css +++ b/phpBB/styles/prosilver/theme/responsive.css @@ -161,8 +161,7 @@ ul.topiclist.forums dd.topics dfn, ul.topiclist.topics dd.posts dfn { font-weight: normal; } -@media only screen and (max-width: 550px), only screen and (max-device-width: 550px) -{ +@media only screen and (max-width: 550px), only screen and (max-device-width: 550px) { ul.topiclist.forums dt { margin-right: 0; } @@ -191,8 +190,7 @@ ul.topiclist li.row dt a.subforum { /* Notifications list ----------------------------------------*/ -@media only screen and (max-width: 350px), only screen and (max-device-width: 350px) -{ +@media only screen and (max-width: 350px), only screen and (max-device-width: 350px) { .dropdown-extended .dropdown-contents { width: auto; } @@ -344,22 +342,48 @@ fieldset.quick-login label[for="autologin"] { min-width: 50%; } -@media only screen and (max-width: 500px), only screen and (max-device-width: 500px) -{ +@media only screen and (max-width: 500px), only screen and (max-device-width: 500px) { + dd label { + white-space: normal; + } + select, .inputbox { max-width: 260px; } + + .captcha-panel dd.captcha { + margin-left: 0; + } + + .captcha-panel dd.captcha-image img { + width: 100%; + } + + #recaptcha_challenge_image, + #recaptcha_response_field, + .recaptchatable #recaptcha_image { + width: 100% !important; + height: auto !important; + } + + .recaptchatable tr td:last-child { + display: none; + } + + .captcha-panel .recaptcha-responsive { + display: inline-block !important; + margin-top: 10px; + vertical-align: middle; + } } -@media only screen and (max-width: 430px), only screen and (max-device-width: 430px) -{ +@media only screen and (max-width: 430px), only screen and (max-device-width: 430px) { .section-viewtopic .search-box .inputbox { width: 110px; } } -@media only screen and (max-width: 320px), only screen and (max-device-width: 320px) -{ +@media only screen and (max-width: 320px), only screen and (max-device-width: 320px) { select, .inputbox { max-width: 240px; } @@ -372,8 +396,7 @@ fieldset.quick-login label[for="autologin"] { width: auto; } -@media only screen and (max-width: 500px), only screen and (max-device-width: 500px) -{ +@media only screen and (max-width: 500px), only screen and (max-device-width: 500px) { dl.details dt, dl.details dd { width: auto; float: none; @@ -513,8 +536,7 @@ fieldset.display-actions { width: 100%; } -@media only screen and (max-width: 500px), only screen and (max-device-width: 500px) -{ +@media only screen and (max-width: 500px), only screen and (max-device-width: 500px) { p.responsive-center { float: none; text-align: center; diff --git a/phpBB/styles/subsilver2/style.cfg b/phpBB/styles/subsilver2/style.cfg index 0c0bd04456..b8de165608 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-RC4 -phpbb_version = 3.1.0-RC4 +style_version = 3.1.0-RC5 +phpbb_version = 3.1.0-RC5 # Defining a different template bitfield # template_bitfield = lNg= diff --git a/phpBB/styles/subsilver2/template/forumlist_body.html b/phpBB/styles/subsilver2/template/forumlist_body.html index 0d522a6959..c1609f0979 100644 --- a/phpBB/styles/subsilver2/template/forumlist_body.html +++ b/phpBB/styles/subsilver2/template/forumlist_body.html @@ -39,7 +39,9 @@ <td class="catdiv" colspan="3"> </td> </tr> <!-- ENDIF --> + <!-- EVENT forumlist_body_forum_row_before --> <tr> + <!-- EVENT forumlist_body_forum_row_prepend --> <td class="row1" width="50" align="center">{forumrow.FORUM_FOLDER_IMG}</td> <td class="row1" width="100%"> <!-- IF forumrow.FORUM_IMAGE --> @@ -83,7 +85,9 @@ <p class="topicdetails">{L_NO_POSTS}</p> <!-- ENDIF --> </td> + <!-- EVENT forumlist_body_forum_row_append --> </tr> + <!-- EVENT forumlist_body_forum_row_after --> <!-- ENDIF --> <!-- EVENT forumlist_body_last_row_after --> <!-- BEGINELSE --> diff --git a/phpBB/styles/subsilver2/template/timezone_option.html b/phpBB/styles/subsilver2/template/timezone_option.html index 0f27719f86..3fc7467d16 100644 --- a/phpBB/styles/subsilver2/template/timezone_option.html +++ b/phpBB/styles/subsilver2/template/timezone_option.html @@ -1,18 +1,26 @@ <tr> <td class="row1" width="50%"><b class="genmed">{L_BOARD_TIMEZONE}{L_COLON}</b></td> <td class="row2"> - <!-- IF S_TZ_DATE_OPTIONS --> + <!-- IF .timezone_date --> <div id="tz_select_date" style="display: none;"> <select name="tz_date" id="tz_date" class="autowidth tz_select"> <option value="">{L_SELECT_CURRENT_TIME}</option> - {S_TZ_DATE_OPTIONS} + <!-- BEGIN timezone_date --> + <option value="{timezone_date.VALUE}"<!-- IF timezone_date.SELECTED --> selected="selected"<!-- ENDIF -->>{timezone_date.TITLE}</option> + <!-- END timezone_date --> </select><br /> <input type="button" id="tz_select_date_suggest" class="btnlite" style="display: none;" timezone-preselect="<!-- IF S_TZ_PRESELECT -->true<!-- ELSE -->false<!-- ENDIF -->" data-l-suggestion="{L_TIMEZONE_DATE_SUGGESTION}" value="{L_TIMEZONE_DATE_SUGGESTION}" /> </div> <!-- ENDIF --> <select name="tz" id="timezone" class="autowidth tz_select"> <option value="">{L_SELECT_TIMEZONE}</option> - {S_TZ_OPTIONS} + <!-- BEGIN timezone_select --> + <optgroup label="{timezone_select.LABEL}" data-tz-value="{timezone_select.VALUE}"> + <!-- BEGIN timezone_options --> + <option title="{timezone_select.timezone_options.TITLE}" value="{timezone_select.timezone_options.VALUE}"<!-- IF timezone_select.timezone_options.SELECTED --> selected="selected"<!-- ENDIF -->>{timezone_select.timezone_options.LABEL}</option> + <!-- END timezone_options --> + </optgroup> + <!-- END timezone_select --> </select> <!-- INCLUDEJS timezone.js --> diff --git a/phpBB/styles/subsilver2/template/viewforum_body.html b/phpBB/styles/subsilver2/template/viewforum_body.html index e34d1807e6..925581ffcd 100644 --- a/phpBB/styles/subsilver2/template/viewforum_body.html +++ b/phpBB/styles/subsilver2/template/viewforum_body.html @@ -150,9 +150,16 @@ <!-- IF S_DISPLAY_POST_INFO or TOTAL_TOPICS --> <table width="100%" cellspacing="1"> <tr> + <td align="{S_CONTENT_FLOW_BEGIN}" valign="middle" nowrap="nowrap"> + <!-- EVENT viewforum_buttons_top_before --> + <!-- IF S_DISPLAY_POST_INFO and not S_IS_BOT --> - <td align="{S_CONTENT_FLOW_BEGIN}" valign="middle"><a href="{U_POST_NEW_TOPIC}" class="imageset">{POST_IMG}</a></td> + <a href="{U_POST_NEW_TOPIC}" class="imageset">{POST_IMG}</a> <!-- ENDIF --> + + <!-- EVENT viewforum_buttons_top_after --> + </td> + <!-- IF TOTAL_TOPICS --> <td class="nav" valign="middle" nowrap="nowrap"> {PAGE_NUMBER}<br /></td> <td class="gensmall" nowrap="nowrap"> [ {TOTAL_TOPICS} ] </td> @@ -273,9 +280,16 @@ <!-- IF S_DISPLAY_POST_INFO or TOTAL_TOPICS --> <table width="100%" cellspacing="1"> <tr> + <td align="{S_CONTENT_FLOW_BEGIN}" valign="middle" nowrap="nowrap"> + <!-- EVENT viewforum_buttons_bottom_before --> + <!-- IF S_DISPLAY_POST_INFO and not S_IS_BOT --> - <td align="{S_CONTENT_FLOW_BEGIN}" valign="middle"><a href="{U_POST_NEW_TOPIC}" class="imageset">{POST_IMG}</a></td> + <a href="{U_POST_NEW_TOPIC}" class="imageset">{POST_IMG}</a> <!-- ENDIF --> + + <!-- EVENT viewforum_buttons_bottom_after --> + </td> + <!-- IF TOTAL_TOPICS --> <td class="nav" valign="middle" nowrap="nowrap"> {PAGE_NUMBER}<br /></td> <td class="gensmall" nowrap="nowrap"> [ {TOTAL_TOPICS} ] </td> diff --git a/phpBB/styles/subsilver2/template/viewtopic_body.html b/phpBB/styles/subsilver2/template/viewtopic_body.html index 838f6c5f03..24a8c12be0 100644 --- a/phpBB/styles/subsilver2/template/viewtopic_body.html +++ b/phpBB/styles/subsilver2/template/viewtopic_body.html @@ -32,10 +32,14 @@ <table width="100%" cellspacing="1"> <tr> <td align="{S_CONTENT_FLOW_BEGIN}" valign="middle" nowrap="nowrap"> + <!-- EVENT viewtopic_buttons_top_before --> + <!-- IF not S_IS_BOT --> <!-- IF S_DISPLAY_POST_INFO --><a href="{U_POST_NEW_TOPIC}" class="imageset">{POST_IMG}</a> <!-- ENDIF --> <!-- IF S_DISPLAY_REPLY_INFO --><a href="{U_POST_REPLY_TOPIC}" class="imageset">{REPLY_IMG}</a><!-- ENDIF --> <!-- ENDIF --> + + <!-- EVENT viewtopic_buttons_top_after --> </td> <!-- IF TOTAL_POSTS --> <td class="nav" valign="middle" nowrap="nowrap"> {PAGE_NUMBER}<br /></td> @@ -371,10 +375,14 @@ <table width="100%" cellspacing="1"> <tr> <td align="{S_CONTENT_FLOW_BEGIN}" valign="middle" nowrap="nowrap"> + <!-- EVENT viewtopic_buttons_bottom_before --> + <!-- IF not S_IS_BOT --> <!-- IF S_DISPLAY_POST_INFO --><a href="{U_POST_NEW_TOPIC}" class="imageset">{POST_IMG}</a> <!-- ENDIF --> <!-- IF S_DISPLAY_REPLY_INFO --><a href="{U_POST_REPLY_TOPIC}" class="imageset">{REPLY_IMG}</a><!-- ENDIF --> <!-- ENDIF --> + + <!-- EVENT viewtopic_buttons_bottom_after --> </td> <!-- IF TOTAL_POSTS --> <td class="nav" valign="middle" nowrap="nowrap"> {PAGE_NUMBER}<br /></td> diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index f8b4a54f05..7bedcdfb49 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1203,7 +1203,10 @@ while ($row = $db->sql_fetchrow($result)) $user_cache[$poster_id] = $user_cache_data; - get_user_rank($row['user_rank'], false, $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']); + $user_rank_data = phpbb_get_user_rank($row, false); + $user_cache[$poster_id]['rank_title'] = $user_rank_data['title']; + $user_cache[$poster_id]['rank_image'] = $user_rank_data['img']; + $user_cache[$poster_id]['rank_image_src'] = $user_rank_data['img_src']; } else { @@ -1245,7 +1248,7 @@ while ($row = $db->sql_fetchrow($result)) 'online' => false, 'jabber' => ($row['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=jabber&u=$poster_id") : '', - 'search' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id=$poster_id&sr=posts") : '', + 'search' => ($config['load_search'] && $auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id=$poster_id&sr=posts") : '', 'author_full' => get_username_string('full', $poster_id, $row['username'], $row['user_colour']), 'author_colour' => get_username_string('colour', $poster_id, $row['username'], $row['user_colour']), @@ -1267,7 +1270,10 @@ while ($row = $db->sql_fetchrow($result)) $user_cache[$poster_id] = $user_cache_data; - get_user_rank($row['user_rank'], $row['user_posts'], $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']); + $user_rank_data = phpbb_get_user_rank($row, $row['user_posts']); + $user_cache[$poster_id]['rank_title'] = $user_rank_data['title']; + $user_cache[$poster_id]['rank_image'] = $user_rank_data['img']; + $user_cache[$poster_id]['rank_image_src'] = $user_rank_data['img_src']; if ((!empty($row['user_allow_viewemail']) && $auth->acl_get('u_sendemail')) || $auth->acl_get('a_email')) { diff --git a/tests/cache/cache_memory.php b/tests/cache/cache_memory.php new file mode 100644 index 0000000000..806edb963a --- /dev/null +++ b/tests/cache/cache_memory.php @@ -0,0 +1,64 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +class phpbb_cache_memory extends \phpbb\cache\driver\memory +{ + protected $data = array(); + + /** + * Set cache path + */ + function phpbb_cache_memory() + { + } + + /** + * Fetch an item from the cache + * + * @access protected + * @param string $var Cache key + * @return mixed Cached data + */ + function _read($var) + { + return $this->data[$var]; + } + + /** + * Store data in the cache + * + * @access protected + * @param string $var Cache key + * @param mixed $data Data to store + * @param int $ttl Time-to-live of cached data + * @return bool True if the operation succeeded + */ + function _write($var, $data, $ttl = 2592000) + { + $this->data[$var] = $data; + return true; + } + + /** + * Remove an item from the cache + * + * @access protected + * @param string $var Cache key + * @return bool True if the operation succeeded + */ + function _delete($var) + { + unset($this->data[$var]); + return true; + } +} diff --git a/tests/cache/cache_memory_test.php b/tests/cache/cache_memory_test.php new file mode 100644 index 0000000000..9f92e8d8dc --- /dev/null +++ b/tests/cache/cache_memory_test.php @@ -0,0 +1,129 @@ +<?php +/** + * + * This file is part of the phpBB Forum Software package. + * + * @copyright (c) phpBB Limited <https://www.phpbb.com> + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +require_once dirname(__FILE__) . '/cache_memory.php'; + +class phpbb_cache_memory_test extends phpbb_database_test_case +{ + protected $cache; + protected $db; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/cache_memory.xml'); + } + + protected function setUp() + { + global $db; + parent::setUp(); + + $this->cache = new phpbb_cache_memory(); + $db = $this->new_dbal(); + $this->db = $db; + } + + static public function cache_single_query_data() + { + return array( + array( + array( + array( + 'SELECT * FROM ' . POSTS_TABLE, + 3, + ), + ), + POSTS_TABLE, + ), + array( + array( + array( + 'SELECT * FROM ' . POSTS_TABLE, + 3, + ), + array( + 'SELECT * FROM ' . POSTS_TABLE . ' p + LEFT JOIN ' . TOPICS_TABLE . ' t ON p.topic_id = t.topic_id', + 3, + ), + ), + POSTS_TABLE, + ), + array( + array( + array( + 'SELECT * FROM ' . POSTS_TABLE, + 3, + ), + array( + 'SELECT * FROM ' . POSTS_TABLE . ' p + LEFT JOIN ' . TOPICS_TABLE . ' t ON p.topic_id = t.topic_id', + 3, + ), + array( + 'SELECT * FROM ' . POSTS_TABLE . ' p + LEFT JOIN ' . TOPICS_TABLE . ' t ON p.topic_id = t.topic_id + LEFT JOIN ' . USERS_TABLE . ' u ON p.poster_id = u.user_id', + 3, + ), + ), + POSTS_TABLE, + ), + array( + array( + array( + 'SELECT * FROM ' . POSTS_TABLE . ' p + LEFT JOIN ' . TOPICS_TABLE . ' t ON p.topic_id = t.topic_id', + 3, + ), + array( + 'SELECT * FROM ' . POSTS_TABLE . ' p + LEFT JOIN ' . TOPICS_TABLE . ' t ON p.topic_id = t.topic_id + LEFT JOIN ' . USERS_TABLE . ' u ON p.poster_id = u.user_id', + 3, + ), + ), + TOPICS_TABLE, + ), + ); + } + + /** + * @dataProvider cache_single_query_data + */ + public function test_cache_single_query($sql_queries, $table) + { + foreach ($sql_queries as $query) + { + $sql_request_res = $this->db->sql_query($query[0]); + + $this->cache->sql_save($this->db, $query[0], $sql_request_res, 1); + + $results = array(); + $query_id = $this->cache->sql_load($query[0]); + while ($row = $this->cache->sql_fetchrow($query_id)) + { + $results[] = $row; + } + $this->cache->sql_freeresult($query_id); + $this->assertEquals($query[1], sizeof($results)); + } + + $this->cache->destroy('sql', $table); + + foreach ($sql_queries as $query) + { + $this->assertNotEquals(false, $this->cache->sql_load($query[0])); + } + } +} diff --git a/tests/cache/fixtures/cache_memory.xml b/tests/cache/fixtures/cache_memory.xml new file mode 100644 index 0000000000..9c19ebb7ba --- /dev/null +++ b/tests/cache/fixtures/cache_memory.xml @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_topics"> + <column>topic_id</column> + <column>forum_id</column> + <column>topic_title</column> + <column>topic_first_post_id</column> + <column>topic_last_post_id</column> + <row> + <value>1</value> + <value>1</value> + <value>Topic</value> + <value>2</value> + <value>2</value> + </row> + </table> + <table name="phpbb_posts"> + <column>post_id</column> + <column>poster_id</column> + <column>topic_id</column> + <column>forum_id</column> + <column>post_text</column> + <row> + <value>1</value> + <value>1</value> + <value>1</value> + <value>1</value> + <value>Post 1</value> + </row> + <row> + <value>2</value> + <value>2</value> + <value>1</value> + <value>1</value> + <value>Post 2</value> + </row> + <row> + <value>3</value> + <value>3</value> + <value>1</value> + <value>1</value> + <value>Post 3</value> + </row> + </table> + <table name="phpbb_users"> + <column>user_id</column> + <column>user_posts</column> + <column>username</column> + <column>username_clean</column> + <column>user_permissions</column> + <column>user_sig</column> + <row> + <value>1</value> + <value>1</value> + <value>user 1</value> + <value>user 1</value> + <value></value> + <value></value> + </row> + <row> + <value>2</value> + <value>1</value> + <value>user 2</value> + <value>user 2</value> + <value></value> + <value></value> + </row> + <row> + <value>3</value> + <value>1</value> + <value>user 3</value> + <value>user 3</value> + <value></value> + <value></value> + </row> + </table> +</dataset> diff --git a/tests/console/cache/purge_test.php b/tests/console/cache/purge_test.php new file mode 100644 index 0000000000..96988c1028 --- /dev/null +++ b/tests/console/cache/purge_test.php @@ -0,0 +1,95 @@ +<?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; +use phpbb\console\command\cache\purge; + +require_once dirname(__FILE__) . '/../../../phpBB/includes/functions_admin.php'; + +class phpbb_console_command_cache_purge_test extends phpbb_test_case +{ + protected $cache_dir; + protected $cache; + protected $command_name; + protected $db; + protected $config; + + public function __construct() + { + $this->cache_dir = dirname(__FILE__) . '/tmp/cache/'; + } + + protected function setUp() + { + if (file_exists($this->cache_dir)) + { + // cache directory possibly left after aborted + // or failed run earlier + $this->remove_cache_dir(); + } + $this->create_cache_dir(); + + $this->cache = new \phpbb\cache\driver\file($this->cache_dir); + + $this->db = $this->getMock('\phpbb\db\driver\driver_interface'); + + $this->config = new \phpbb\config\config(array('assets_version' => 1)); + $this->user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime')); + } + + public function test_purge() + { + $this->cache->put('test_key', 'test_value'); + + $this->assertEquals( + 'test_value', + $this->cache->get('test_key'), + 'File ACM put and get' + ); + + $command_tester = $this->get_command_tester(); + $exit_status = $command_tester->execute(array('command' => $this->command_name)); + + $this->assertSame(false, $this->cache->get('test_key')); + $this->assertSame(2, $this->config['assets_version']); + } + + private function create_cache_dir() + { + $this->get_test_case_helpers()->makedirs($this->cache_dir); + } + + private function remove_cache_dir() + { + $iterator = new DirectoryIterator($this->cache_dir); + foreach ($iterator as $file) + { + if ($file != '.' && $file != '..') + { + unlink($this->cache_dir . '/' . $file); + } + } + rmdir($this->cache_dir); + } + + public function get_command_tester() + { + $application = new Application(); + $application->add(new purge($this->user, $this->cache, $this->db, $this->getMock('\phpbb\auth\auth'), new \phpbb\log\null(), $this->config)); + + $command = $application->find('cache:purge'); + $this->command_name = $command->getName(); + return new CommandTester($command); + } +} diff --git a/tests/controller/common_helper_route.php b/tests/controller/common_helper_route.php index 1751578a75..859832412d 100644 --- a/tests/controller/common_helper_route.php +++ b/tests/controller/common_helper_route.php @@ -56,6 +56,11 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case return 'app.php'; } + protected function path_to_app() + { + return ''; + } + protected function generate_route_objects() { $request = new phpbb_mock_request(); @@ -93,30 +98,30 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case public function helper_url_data_no_rewrite() { return array( - array('controller2', array('t' => 1, 'f' => 2), true, false, '/app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller2', array('t' => 1, 'f' => 2), false, false, '/app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '/app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '/app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), true, false, '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), false, false, '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), // Custom sid parameter - array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '/app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '/app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '/app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), // Testing anchors - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '/app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/app.php/foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), // Anchors and custom sid - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '/app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), // Empty parameters should not append the & or ? - array('controller2', array(), true, false, '/app.php/foo/bar', 'no params using empty array'), - array('controller2', array(), false, false, '/app.php/foo/bar', 'no params using empty array'), - array('controller3', array('p' => 3), true, false, '/app.php/foo/bar/p-3', 'no params using empty array'), + array('controller2', array(), true, false, '/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'), + array('controller2', array(), false, false, '/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'), + array('controller3', array('p' => 3), true, false, '/' . $this->path_to_app() . 'app.php/foo/bar/p-3', 'no params using empty array'), ); } @@ -132,30 +137,30 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case public function helper_url_data_with_rewrite() { return array( - array('controller2', array('t' => 1, 'f' => 2), true, false, '/foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller2', array('t' => 1, 'f' => 2), false, false, '/foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), true, false, '/' . $this->path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), false, false, '/' . $this->path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), // Custom sid parameter - array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '/foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), // Testing anchors - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/' . $this->path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '/' . $this->path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), // Anchors and custom sid - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), // Empty parameters should not append the & or ? - array('controller2', array(), true, false, '/foo/bar', 'no params using empty array'), - array('controller2', array(), false, false, '/foo/bar', 'no params using empty array'), - array('controller3', array('p' => 3), true, false, '/foo/bar/p-3', 'no params using empty array'), + array('controller2', array(), true, false, '/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'), + array('controller2', array(), false, false, '/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'), + array('controller3', array('p' => 3), true, false, '/' . $this->path_to_app() . 'foo/bar/p-3', 'no params using empty array'), ); } @@ -172,30 +177,30 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case public function helper_url_data_absolute() { return array( - array('controller2', array('t' => 1, 'f' => 2), true, false, 'http://localhost/app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller2', array('t' => 1, 'f' => 2), false, false, 'http://localhost/app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, 'http://localhost/app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, 'http://localhost/app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), false, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), // Custom sid parameter - array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', 'http://localhost/app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), // Testing anchors - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, 'http://localhost/app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/app.php/foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), // Anchors and custom sid - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', 'http://localhost/app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), // Empty parameters should not append the & or ? - array('controller2', array(), true, false, 'http://localhost/app.php/foo/bar', 'no params using empty array'), - array('controller2', array(), false, false, 'http://localhost/app.php/foo/bar', 'no params using empty array'), - array('controller3', array('p' => 3), true, false, 'http://localhost/app.php/foo/bar/p-3', 'no params using empty array'), + array('controller2', array(), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'), + array('controller2', array(), false, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'), + array('controller3', array('p' => 3), true, false, 'http://localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3', 'no params using empty array'), ); } @@ -252,30 +257,30 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case public function helper_url_data_network() { return array( - array('controller2', array('t' => 1, 'f' => 2), true, false, '//localhost/app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller2', array('t' => 1, 'f' => 2), false, false, '//localhost/app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '//localhost/app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '//localhost/app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), false, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), // Custom sid parameter - array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '//localhost/app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '//localhost/app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '//localhost/app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), // Testing anchors - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '//localhost/app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/app.php/foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), // Anchors and custom sid - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '//localhost/app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '//localhost/' . $this->path_to_app() . 'app.php/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), // Empty parameters should not append the & or ? - array('controller2', array(), true, false, '//localhost/app.php/foo/bar', 'no params using empty array'), - array('controller2', array(), false, false, '//localhost/app.php/foo/bar', 'no params using empty array'), - array('controller3', array('p' => 3), true, false, '//localhost/app.php/foo/bar/p-3', 'no params using empty array'), + array('controller2', array(), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'), + array('controller2', array(), false, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar', 'no params using empty array'), + array('controller3', array('p' => 3), true, false, '//localhost/' . $this->path_to_app() . 'app.php/foo/bar/p-3', 'no params using empty array'), ); } @@ -292,30 +297,30 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case public function helper_url_data_absolute_with_rewrite() { return array( - array('controller2', array('t' => 1, 'f' => 2), true, false, 'http://localhost/foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller2', array('t' => 1, 'f' => 2), false, false, 'http://localhost/foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, 'http://localhost/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, 'http://localhost/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), false, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), // Custom sid parameter - array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', 'http://localhost/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), // Testing anchors - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, 'http://localhost/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), // Anchors and custom sid - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', 'http://localhost/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', 'http://localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), // Empty parameters should not append the & or ? - array('controller2', array(), true, false, 'http://localhost/foo/bar', 'no params using empty array'), - array('controller2', array(), false, false, 'http://localhost/foo/bar', 'no params using empty array'), - array('controller3', array('p' => 3), true, false, 'http://localhost/foo/bar/p-3', 'no params using empty array'), + array('controller2', array(), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'), + array('controller2', array(), false, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'), + array('controller3', array('p' => 3), true, false, 'http://localhost/' . $this->path_to_app() . 'foo/bar/p-3', 'no params using empty array'), ); } @@ -372,30 +377,30 @@ abstract class phpbb_controller_common_helper_route extends phpbb_test_case public function helper_url_data_network_with_rewrite() { return array( - array('controller2', array('t' => 1, 'f' => 2), true, false, '//localhost/foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller2', array('t' => 1, 'f' => 2), false, false, '//localhost/foo/bar?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '//localhost/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '//localhost/foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), true, false, '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller2', array('t' => 1, 'f' => 2), false, false, '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, false, '//localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), false, false, '//localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2', 'parameters in params-argument as array'), // Custom sid parameter - array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '//localhost/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '//localhost/foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '//localhost/foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2), false, 'custom-sid', '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid', 'params-argument (array) using session_id'), // Testing anchors - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '//localhost/foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, false, '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2#anchor', 'anchor in params-argument (array)'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, false, '//localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2#anchor', 'anchor in params-argument (array)'), // Anchors and custom sid - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '//localhost/foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), - array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller2', array('t' => 1, 'f' => 2, '#' => 'anchor'), false, 'custom-sid', '//localhost/' . $this->path_to_app() . 'foo/bar?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), + array('controller3', array('p' => 3, 't' => 1, 'f' => 2, '#' => 'anchor'), true, 'custom-sid', '//localhost/' . $this->path_to_app() . 'foo/bar/p-3?t=1&f=2&sid=custom-sid#anchor', 'anchor in params-argument (array) using session_id'), // Empty parameters should not append the & or ? - array('controller2', array(), true, false, '//localhost/foo/bar', 'no params using empty array'), - array('controller2', array(), false, false, '//localhost/foo/bar', 'no params using empty array'), - array('controller3', array('p' => 3), true, false, '//localhost/foo/bar/p-3', 'no params using empty array'), + array('controller2', array(), true, false, '//localhost/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'), + array('controller2', array(), false, false, '//localhost/' . $this->path_to_app() . 'foo/bar', 'no params using empty array'), + array('controller3', array('p' => 3), true, false, '//localhost/' . $this->path_to_app() . 'foo/bar/p-3', 'no params using empty array'), ); } diff --git a/tests/controller/helper_route_other_app.php b/tests/controller/helper_route_other_app.php new file mode 100644 index 0000000000..e5513a5180 --- /dev/null +++ b/tests/controller/helper_route_other_app.php @@ -0,0 +1,37 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +require_once dirname(__FILE__) . '/common_helper_route.php'; + +class phpbb_controller_helper_route_other_app_test extends phpbb_controller_common_helper_route +{ + protected function get_phpbb_root_path() + { + return './../'; + } + + protected function get_uri() + { + return '/foo/app.php'; + } + + protected function get_script_name() + { + return 'app.php'; + } + + protected function path_to_app() + { + return 'foo/'; + } +} diff --git a/tests/datetime/from_format_test.php b/tests/datetime/from_format_test.php index 5f155adbbd..f10402e8cb 100644 --- a/tests/datetime/from_format_test.php +++ b/tests/datetime/from_format_test.php @@ -37,8 +37,6 @@ class phpbb_datetime_from_format_test extends phpbb_test_case */ public function test_from_format($timezone, $format, $expected) { - global $user; - $user = new \phpbb\user('\phpbb\datetime'); $user->timezone = new DateTimeZone($timezone); $user->lang['datetime'] = array( @@ -55,4 +53,74 @@ class phpbb_datetime_from_format_test extends phpbb_test_case $timestamp = $user->get_timestamp_from_format($format, $expected, new DateTimeZone($timezone)); $this->assertEquals($expected, $user->format_date($timestamp, $format, true)); } + + + public function relative_format_date_data() + { + // If the current time is too close to the testing time, + // the relative time will use "x minutes ago" instead of "today ..." + // So we use 18:01 in the morning and 06:01 in the afternoon. + $testing_time = date('H') <= 12 ? '18:01' : '06:01'; + + return array( + array( + date('Y-m-d', time() + 2 * 86400) . ' ' . $testing_time, false, + date('Y-m-d', time() + 2 * 86400) . ' ' . $testing_time, + ), + + array( + date('Y-m-d', time() + 86400) . ' ' . $testing_time, false, + 'Tomorrow ' . $testing_time, + ), + array( + date('Y-m-d', time() + 86400) . ' ' . $testing_time, true, + date('Y-m-d', time() + 86400) . ' ' . $testing_time, + ), + + array( + date('Y-m-d') . ' ' . $testing_time, false, + 'Today ' . $testing_time, + ), + array( + date('Y-m-d') . ' ' . $testing_time, true, + date('Y-m-d') . ' ' . $testing_time, + ), + + array( + date('Y-m-d', time() - 86400) . ' ' . $testing_time, false, + 'Yesterday ' . $testing_time, + ), + array( + date('Y-m-d', time() - 86400) . ' ' . $testing_time, true, + date('Y-m-d', time() - 86400) . ' ' . $testing_time, + ), + + array( + date('Y-m-d', time() - 2 * 86400) . ' ' . $testing_time, false, + date('Y-m-d', time() - 2 * 86400) . ' ' . $testing_time, + ), + ); + } + + /** + * @dataProvider relative_format_date_data() + */ + public function test_relative_format_date($timestamp, $forcedate, $expected) + { + $user = new \phpbb\user('\phpbb\datetime'); + $user->timezone = new DateTimeZone('UTC'); + $user->lang['datetime'] = array( + 'TODAY' => 'Today', + 'TOMORROW' => 'Tomorrow', + 'YESTERDAY' => 'Yesterday', + 'AGO' => array( + 0 => 'less than a minute ago', + 1 => '%d minute ago', + 2 => '%d minutes ago', + ), + ); + + $timestamp = $user->get_timestamp_from_format('Y-m-d H:i', $timestamp, new DateTimeZone('UTC')); + $this->assertEquals($expected, $user->format_date($timestamp, '|Y-m-d| H:i', $forcedate)); + } } diff --git a/tests/event/fixtures/trigger_wspace.test b/tests/event/fixtures/trigger_wspace.test new file mode 100644 index 0000000000..0334a9c80b --- /dev/null +++ b/tests/event/fixtures/trigger_wspace.test @@ -0,0 +1,15 @@ +<?php + + /** + * Event after the post data has been assigned to the template + * + * @event core.trigger + * @var int start Start item of this page + * @var int current_row_number Number of the post on this page + * @var int end Number of posts on this page + * @var array row Array with original post and user data + * @var array cp_row Custom profile field data of the poster + * @since 3.1.0-a3 + */ + $vars = array('start', 'current_row_number', 'end', 'row', 'cp_row'); + extract($phpbb_dispatcher->trigger_event('core.trigger', compact($vars))); diff --git a/tests/event/php_exporter_test.php b/tests/event/php_exporter_test.php index b52d68e305..692a57f93c 100644 --- a/tests/event/php_exporter_test.php +++ b/tests/event/php_exporter_test.php @@ -62,6 +62,18 @@ class phpbb_event_php_exporter_test extends phpbb_test_case ), ), array( + 'trigger_wspace.test', + array( + 'core.trigger' => array( + 'event' => 'core.trigger', + 'file' => 'trigger_wspace.test', + 'arguments' => array('cp_row', 'current_row_number', 'end', 'row', 'start'), + 'since' => '3.1.0-a3', + 'description' => 'Event after the post data has been assigned to the template', + ), + ), + ), + array( 'trigger_many_vars.test', array( 'core.posting_modify_template_vars' => array( @@ -119,6 +131,7 @@ class phpbb_event_php_exporter_test extends phpbb_test_case array('* @since 3.1.0-b3', '3.1.0-b3'), array(' * @since 3.1.0-b3', '3.1.0-b3'), array('* @since 3.1.0-RC2', '3.1.0-RC2'), + array(' * @since 3.1.0-a1', '3.1.0-a1'), ); } @@ -133,7 +146,6 @@ class phpbb_event_php_exporter_test extends phpbb_test_case static public function validate_since_throws_data() { return array( - array(' * @since 3.1.0-a1'), array('* @since 3.1.0-a1 '), array('* @since 3.1.0-a1 bertie is cool'), array('bertie* @since 3.1.0-a1'), @@ -156,6 +168,7 @@ class phpbb_event_php_exporter_test extends phpbb_test_case return array( array('test.event', '* @event test.event', 'test.event'), array('test.event2', ' * @event test.event2', 'test.event2'), + array('test.event', ' * @event test.event', 'test.event'), ); } @@ -170,7 +183,6 @@ class phpbb_event_php_exporter_test extends phpbb_test_case static public function validate_event_throws_data() { return array( - array('test.event', ' * @event test.event', 1), array('test.event', '* @event test.event bertie is cool', 2), array('test.event', 'bertie* @event test.event', 2), ); diff --git a/tests/functional/notification_test.php b/tests/functional/notification_test.php index 667d268b1e..ec03f7a6a4 100644 --- a/tests/functional/notification_test.php +++ b/tests/functional/notification_test.php @@ -82,8 +82,6 @@ class phpbb_functional_notification_test extends phpbb_functional_test_case // Get form token $link = $crawler->selectLink($this->lang('NOTIFICATIONS_MARK_ALL_READ'))->link()->getUri(); $crawler = self::request('GET', substr($link, strpos($link, 'ucp.'))); - $form = $crawler->selectButton($this->lang('YES'))->form(); - $crawler = self::submit($form); $this->assertEquals(0, $crawler->filter('#notification_list_button strong')->text()); } } diff --git a/tests/functions_user/delete_user_test.php b/tests/functions_user/delete_user_test.php new file mode 100644 index 0000000000..d5c78c64ad --- /dev/null +++ b/tests/functions_user/delete_user_test.php @@ -0,0 +1,440 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2014 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_user.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php'; + +class phpbb_functions_user_delete_user_test extends phpbb_database_test_case +{ + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/delete_user.xml'); + } + + protected function setUp() + { + parent::setUp(); + + global $cache, $config, $db, $phpbb_dispatcher, $phpbb_container; + + $db = $this->db = $this->new_dbal(); + $config = new \phpbb\config\config(array( + 'load_online_time' => 5, + 'search_type' => '\phpbb\search\fulltext_mysql', + )); + set_config(false, false, false, $config); + set_config_count(false, false, false, $config); + $cache = new phpbb_mock_null_cache(); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + $phpbb_container = new phpbb_mock_container_builder(); + $phpbb_container->set('notification_manager', new phpbb_mock_notification_manager()); + } + + public function first_last_post_data() + { + return array( + array( + 'retain', false, + array( + array('post_id' => 1, 'poster_id' => ANONYMOUS, 'post_username' => ''), + array('post_id' => 2, 'poster_id' => ANONYMOUS, 'post_username' => 'Other'), + array('post_id' => 3, 'poster_id' => ANONYMOUS, 'post_username' => ''), + array('post_id' => 4, 'poster_id' => ANONYMOUS, 'post_username' => 'Other'), + ), + array( + array( + 'topic_id' => 1, + 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => '', 'topic_first_poster_colour' => '', + 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => '', 'topic_last_poster_colour' => '', + ), + array( + 'topic_id' => 2, + 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => 'Other', 'topic_first_poster_colour' => '', + 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => 'Other', 'topic_last_poster_colour' => '', + ), + array( + 'topic_id' => 3, + 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => '', 'topic_first_poster_colour' => '', + 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => '', 'topic_last_poster_colour' => '', + ), + array( + 'topic_id' => 4, + 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => 'Other', 'topic_first_poster_colour' => '', + 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => 'Other', 'topic_last_poster_colour' => '', + ), + ), + array( + array('forum_id' => 1, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => '', 'forum_last_poster_colour' => ''), + array('forum_id' => 2, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Other', 'forum_last_poster_colour' => ''), + array('forum_id' => 3, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => '', 'forum_last_poster_colour' => ''), + array('forum_id' => 4, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Other', 'forum_last_poster_colour' => ''), + ), + ), + array( + 'remove', false, + array( + array('post_id' => 2, 'poster_id' => ANONYMOUS, 'post_username' => 'Other'), + array('post_id' => 4, 'poster_id' => ANONYMOUS, 'post_username' => 'Other'), + ), + array( + array( + 'topic_id' => 2, + 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => 'Other', 'topic_first_poster_colour' => '', + 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => 'Other', 'topic_last_poster_colour' => '', + ), + array( + 'topic_id' => 4, + 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => 'Other', 'topic_first_poster_colour' => '', + 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => 'Other', 'topic_last_poster_colour' => '', + ), + ), + array( + array('forum_id' => 1, 'forum_last_poster_id' => 0, 'forum_last_poster_name' => '', 'forum_last_poster_colour' => ''), + array('forum_id' => 2, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Other', 'forum_last_poster_colour' => ''), + array('forum_id' => 3, 'forum_last_poster_id' => 0, 'forum_last_poster_name' => '', 'forum_last_poster_colour' => ''), + array('forum_id' => 4, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Other', 'forum_last_poster_colour' => ''), + ), + ), + array( + 'retain', true, + array( + array('post_id' => 1, 'poster_id' => ANONYMOUS, 'post_username' => 'Foobar'), + array('post_id' => 2, 'poster_id' => ANONYMOUS, 'post_username' => 'Other'), + array('post_id' => 3, 'poster_id' => ANONYMOUS, 'post_username' => 'Foobar'), + array('post_id' => 4, 'poster_id' => ANONYMOUS, 'post_username' => 'Other'), + ), + array( + array( + 'topic_id' => 1, + 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => 'Foobar', 'topic_first_poster_colour' => '', + 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => 'Foobar', 'topic_last_poster_colour' => '', + ), + array( + 'topic_id' => 2, + 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => 'Other', 'topic_first_poster_colour' => '', + 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => 'Other', 'topic_last_poster_colour' => '', + ), + array( + 'topic_id' => 3, + 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => 'Foobar', 'topic_first_poster_colour' => '', + 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => 'Foobar', 'topic_last_poster_colour' => '', + ), + array( + 'topic_id' => 4, + 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => 'Other', 'topic_first_poster_colour' => '', + 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => 'Other', 'topic_last_poster_colour' => '', + ), + ), + array( + array('forum_id' => 1, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Foobar', 'forum_last_poster_colour' => ''), + array('forum_id' => 2, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Other', 'forum_last_poster_colour' => ''), + array('forum_id' => 3, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Foobar', 'forum_last_poster_colour' => ''), + array('forum_id' => 4, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Other', 'forum_last_poster_colour' => ''), + ), + ), + array( + 'remove', true, + array( + array('post_id' => 2, 'poster_id' => ANONYMOUS, 'post_username' => 'Other'), + array('post_id' => 4, 'poster_id' => ANONYMOUS, 'post_username' => 'Other'), + ), + array( + array( + 'topic_id' => 2, + 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => 'Other', 'topic_first_poster_colour' => '', + 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => 'Other', 'topic_last_poster_colour' => '', + ), + array( + 'topic_id' => 4, + 'topic_poster' => ANONYMOUS, 'topic_first_poster_name' => 'Other', 'topic_first_poster_colour' => '', + 'topic_last_poster_id' => ANONYMOUS, 'topic_last_poster_name' => 'Other', 'topic_last_poster_colour' => '', + ), + ), + array( + array('forum_id' => 1, 'forum_last_poster_id' => 0, 'forum_last_poster_name' => '', 'forum_last_poster_colour' => ''), + array('forum_id' => 2, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Other', 'forum_last_poster_colour' => ''), + array('forum_id' => 3, 'forum_last_poster_id' => 0, 'forum_last_poster_name' => '', 'forum_last_poster_colour' => ''), + array('forum_id' => 4, 'forum_last_poster_id' => ANONYMOUS, 'forum_last_poster_name' => 'Other', 'forum_last_poster_colour' => ''), + ), + ), + ); + } + + /** + * @dataProvider first_last_post_data + */ + public function test_first_last_post_info($mode, $retain_username, $expected_posts, $expected_topics, $expected_forums) + { + $this->assertFalse(user_delete($mode, 2, $retain_username)); + + $sql = 'SELECT post_id, poster_id, post_username + FROM ' . POSTS_TABLE . ' + ORDER BY post_id ASC'; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_posts, $this->db->sql_fetchrowset($result), 'Post table poster info is mismatching after deleting a user.'); + $this->db->sql_freeresult($result); + + $sql = 'SELECT topic_id, topic_poster, topic_first_poster_name, topic_first_poster_colour, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour + FROM ' . TOPICS_TABLE . ' + ORDER BY topic_id ASC'; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_topics, $this->db->sql_fetchrowset($result), 'Topic table first/last poster info is mismatching after deleting a user.'); + $this->db->sql_freeresult($result); + + $sql = 'SELECT forum_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour + FROM ' . FORUMS_TABLE . ' + ORDER BY forum_id ASC'; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_forums, $this->db->sql_fetchrowset($result), 'Forum table last poster info is mismatching after deleting a user.'); + $this->db->sql_freeresult($result); + } + + public function report_attachment_data() + { + return array( + array( + 'retain', + array( + array('post_id' => 1, 'post_reported' => 1, 'post_edit_user' => 1, 'post_delete_user' => 1), + array('post_id' => 2, 'post_reported' => 1, 'post_edit_user' => 1, 'post_delete_user' => 1), + array('post_id' => 3, 'post_reported' => 0, 'post_edit_user' => 1, 'post_delete_user' => 1), + array('post_id' => 4, 'post_reported' => 0, 'post_edit_user' => 1, 'post_delete_user' => 1), + ), + array( + array('report_id' => 1, 'post_id' => 1, 'user_id' => 1), + array('report_id' => 3, 'post_id' => 2, 'user_id' => 1), + ), + array( + array('topic_id' => 1, 'topic_reported' => 1, 'topic_delete_user' => 1), + array('topic_id' => 2, 'topic_reported' => 1, 'topic_delete_user' => 1), + array('topic_id' => 3, 'topic_reported' => 0, 'topic_delete_user' => 1), + array('topic_id' => 4, 'topic_reported' => 0, 'topic_delete_user' => 1), + ), + array( + array('attach_id' => 1, 'post_msg_id' => 1, 'poster_id' => 1), + array('attach_id' => 2, 'post_msg_id' => 2, 'poster_id' => 1), + array('attach_id' => 3, 'post_msg_id' => 0, 'poster_id' => 1), // TODO should be deleted: PHPBB3-13089 + ), + ), + array( + 'remove', + array( + array('post_id' => 2, 'post_reported' => 1, 'post_edit_user' => 1, 'post_delete_user' => 1), + array('post_id' => 4, 'post_reported' => 0, 'post_edit_user' => 1, 'post_delete_user' => 1), + ), + array( + array('report_id' => 3, 'post_id' => 2, 'user_id' => 1), + ), + array( + array('topic_id' => 2, 'topic_reported' => 1, 'topic_delete_user' => 1), + array('topic_id' => 4, 'topic_reported' => 0, 'topic_delete_user' => 1), + ), + array( + array('attach_id' => 2, 'post_msg_id' => 2, 'poster_id' => 1), + array('attach_id' => 3, 'post_msg_id' => 0, 'poster_id' => 2), // TODO should be deleted: PHPBB3-13089 + ), + ), + ); + } + + /** + * @dataProvider report_attachment_data + */ + public function test_report_attachment_info($mode, $expected_posts, $expected_reports, $expected_topics, $expected_attach) + { + $this->assertFalse(user_delete($mode, 2)); + + $sql = 'SELECT post_id, post_reported, post_edit_user, post_delete_user + FROM ' . POSTS_TABLE . ' + ORDER BY post_id ASC'; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_posts, $this->db->sql_fetchrowset($result), 'Post report status content is mismatching after deleting a user.'); + $this->db->sql_freeresult($result); + + $sql = 'SELECT report_id, post_id, user_id + FROM ' . REPORTS_TABLE . ' + ORDER BY report_id ASC'; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_reports, $this->db->sql_fetchrowset($result), 'Report table content is mismatching after deleting a user.'); + $this->db->sql_freeresult($result); + + $sql = 'SELECT topic_id, topic_reported, topic_delete_user + FROM ' . TOPICS_TABLE . ' + ORDER BY topic_id ASC'; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_topics, $this->db->sql_fetchrowset($result), 'Topic report status is mismatching after deleting a user.'); + $this->db->sql_freeresult($result); + + $sql = 'SELECT attach_id, post_msg_id, poster_id + FROM ' . ATTACHMENTS_TABLE . ' + ORDER BY attach_id ASC'; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_attach, $this->db->sql_fetchrowset($result), 'Attachment table content is mismatching after deleting a user.'); + $this->db->sql_freeresult($result); + } + + public function delete_data() + { + return array( + array( + 'retain', + array(array('user_id' => 1, 'user_posts' => 4)), + array(array('user_id' => 1, 'zebra_id' => 3)), + array(array('ban_id' => 2), array('ban_id' => 3)), + array(array('session_id' => '12345678901234567890123456789013')), + array( + array('log_id' => 2, 'user_id' => 1, 'reportee_id' => 1), + array('log_id' => 3, 'user_id' => 1, 'reportee_id' => 1), + ), + array( + array('msg_id' => 1, 'author_id' => 3, 'message_edit_user' => 3), + array('msg_id' => 2, 'author_id' => 1, 'message_edit_user' => 1), + ), + ), + array( + 'remove', + array(array('user_id' => 1, 'user_posts' => 2)), + array(array('user_id' => 1, 'zebra_id' => 3)), + array(array('ban_id' => 2), array('ban_id' => 3)), + array(array('session_id' => '12345678901234567890123456789013')), + array( + array('log_id' => 2, 'user_id' => 1, 'reportee_id' => 1), + array('log_id' => 3, 'user_id' => 1, 'reportee_id' => 1), + ), + array( + array('msg_id' => 1, 'author_id' => 3, 'message_edit_user' => 3), + array('msg_id' => 2, 'author_id' => 1, 'message_edit_user' => 1), + ), + ), + ); + } + + /** + * @dataProvider delete_data + */ + public function test_delete_data($mode, $expected_users, $expected_zebra, $expected_ban, $expected_sessions, $expected_logs, $expected_pms) + { + $this->assertFalse(user_delete($mode, 2)); + + $sql = 'SELECT user_id, user_posts + FROM ' . USERS_TABLE . ' + ORDER BY user_id ASC'; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_users, $this->db->sql_fetchrowset($result), 'User table content is mismatching after deleting a user.'); + $this->db->sql_freeresult($result); + + $sql = 'SELECT user_id, zebra_id + FROM ' . ZEBRA_TABLE . ' + ORDER BY user_id ASC, zebra_id ASC'; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_zebra, $this->db->sql_fetchrowset($result), 'Zebra table content is mismatching after deleting a user.'); + $this->db->sql_freeresult($result); + + $sql = 'SELECT ban_id + FROM ' . BANLIST_TABLE . ' + ORDER BY ban_id ASC'; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_ban, $this->db->sql_fetchrowset($result), 'Ban table content is mismatching after deleting a user.'); + $this->db->sql_freeresult($result); + + $sql = 'SELECT session_id + FROM ' . SESSIONS_TABLE . ' + ORDER BY session_id ASC'; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_sessions, $this->db->sql_fetchrowset($result), 'Session table content is mismatching after deleting a user.'); + $this->db->sql_freeresult($result); + + $sql = 'SELECT log_id, user_id, reportee_id + FROM ' . LOG_TABLE . ' + ORDER BY log_id ASC'; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_logs, $this->db->sql_fetchrowset($result), 'Log table content is mismatching after deleting a user.'); + $this->db->sql_freeresult($result); + + $sql = 'SELECT msg_id, author_id, message_edit_user + FROM ' . PRIVMSGS_TABLE . ' + ORDER BY msg_id ASC'; + $result = $this->db->sql_query($sql); + $this->assertEquals($expected_pms, $this->db->sql_fetchrowset($result), 'Private messages table content is mismatching after deleting a user.'); + $this->db->sql_freeresult($result); + } + + public function delete_user_id_data() + { + return array( + array( + 'retain', + array( + USER_GROUP_TABLE, + TOPICS_WATCH_TABLE, + FORUMS_WATCH_TABLE, + ACL_USERS_TABLE, + TOPICS_TRACK_TABLE, + TOPICS_POSTED_TABLE, + FORUMS_TRACK_TABLE, + PROFILE_FIELDS_DATA_TABLE, + MODERATOR_CACHE_TABLE, + DRAFTS_TABLE, + BOOKMARKS_TABLE, + SESSIONS_KEYS_TABLE, + PRIVMSGS_FOLDER_TABLE, + PRIVMSGS_RULES_TABLE, + ), + ), + array( + 'remove', + array( + USER_GROUP_TABLE, + TOPICS_WATCH_TABLE, + FORUMS_WATCH_TABLE, + ACL_USERS_TABLE, + TOPICS_TRACK_TABLE, + TOPICS_POSTED_TABLE, + FORUMS_TRACK_TABLE, + PROFILE_FIELDS_DATA_TABLE, + MODERATOR_CACHE_TABLE, + DRAFTS_TABLE, + BOOKMARKS_TABLE, + SESSIONS_KEYS_TABLE, + PRIVMSGS_FOLDER_TABLE, + PRIVMSGS_RULES_TABLE, + ), + ), + ); + } + + /** + * @dataProvider delete_user_id_data + */ + public function test_delete_user_id_data($mode, $cleaned_tables) + { + $this->assertFalse(user_delete($mode, 2)); + + foreach ($cleaned_tables as $table) + { + $sql = 'SELECT user_id + FROM ' . $table . ' + WHERE user_id = 2'; + $result = $this->db->sql_query($sql); + $this->assertFalse($this->db->sql_fetchfield('user_id'), 'Found data for deleted user in table: ' . $table); + $this->db->sql_freeresult($result); + + $sql = 'SELECT user_id + FROM ' . $table . ' + WHERE user_id = 3'; + $result = $this->db->sql_query($sql); + $this->assertEquals(3, $this->db->sql_fetchfield('user_id'), 'Missing data for user in table: ' . $table); + $this->db->sql_freeresult($result); + } + } +} diff --git a/tests/functions_user/fixtures/delete_user.xml b/tests/functions_user/fixtures/delete_user.xml new file mode 100644 index 0000000000..56014b35d1 --- /dev/null +++ b/tests/functions_user/fixtures/delete_user.xml @@ -0,0 +1,549 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_attachments"> + <column>attach_id</column> + <column>post_msg_id</column> + <column>topic_id</column> + <column>in_message</column> + <column>poster_id</column> + <column>is_orphan</column> + <column>attach_comment</column> + <row> + <value>1</value> + <value>1</value> + <value>1</value> + <value>0</value> + <value>2</value> + <value>0</value> + <value></value> + </row> + <row> + <value>2</value> + <value>2</value> + <value>2</value> + <value>0</value> + <value>1</value> + <value>0</value> + <value></value> + </row> + <row> + <value>3</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>2</value> + <value>1</value> + <value></value> + </row> + </table> + <table name="phpbb_banlist"> + <column>ban_id</column> + <column>ban_userid</column> + <column>ban_email</column> + <column>ban_reason</column> + <column>ban_give_reason</column> + <row> + <value>1</value> + <value>2</value> + <value></value> + <value></value> + <value></value> + </row> + <row> + <value>2</value> + <value>3</value> + <value></value> + <value></value> + <value></value> + </row> + <row> + <value>3</value> + <value>0</value> + <value></value> + <value></value> + <value></value> + </row> + </table> + <table name="phpbb_forums"> + <column>forum_id</column> + <column>forum_last_poster_id</column> + <column>forum_last_poster_name</column> + <column>forum_last_poster_colour</column> + <column>forum_parents</column> + <column>forum_desc</column> + <column>forum_rules</column> + <row> + <value>1</value> + <value>2</value> + <value></value> + <value>00AA00</value> + <value></value> + <value></value> + <value></value> + </row> + <row> + <value>2</value> + <value>1</value> + <value>Other</value> + <value></value> + <value></value> + <value></value> + <value></value> + </row> + <row> + <value>3</value> + <value>2</value> + <value></value> + <value>00AA00</value> + <value></value> + <value></value> + <value></value> + </row> + <row> + <value>4</value> + <value>1</value> + <value>Other</value> + <value></value> + <value></value> + <value></value> + <value></value> + </row> + </table> + <table name="phpbb_log"> + <column>log_id</column> + <column>user_id</column> + <column>reportee_id</column> + <column>log_operation</column> + <column>log_data</column> + <row> + <value>1</value> + <value>1</value> + <value>2</value> + <value></value> + <value></value> + </row> + <row> + <value>2</value> + <value>2</value> + <value>1</value> + <value></value> + <value></value> + </row> + <row> + <value>3</value> + <value>1</value> + <value>1</value> + <value></value> + <value></value> + </row> + <row> + <value>4</value> + <value>2</value> + <value>2</value> + <value></value> + <value></value> + </row> + </table> + <table name="phpbb_posts"> + <column>post_id</column> + <column>poster_id</column> + <column>post_edit_user</column> + <column>post_delete_user</column> + <column>post_username</column> + <column>topic_id</column> + <column>forum_id</column> + <column>post_visibility</column> + <column>post_time</column> + <column>post_text</column> + <column>post_reported</column> + <row> + <value>1</value> + <value>2</value> + <value>2</value> + <value>2</value> + <value></value> + <value>1</value> + <value>1</value> + <value>1</value> + <value>1</value> + <value></value> + <value>1</value> + </row> + <row> + <value>2</value> + <value>1</value> + <value>1</value> + <value>1</value> + <value>Other</value> + <value>2</value> + <value>2</value> + <value>1</value> + <value>1</value> + <value></value> + <value>1</value> + </row> + <row> + <value>3</value> + <value>2</value> + <value>2</value> + <value>2</value> + <value></value> + <value>3</value> + <value>3</value> + <value>1</value> + <value>1</value> + <value></value> + <value>1</value> + </row> + <row> + <value>4</value> + <value>1</value> + <value>1</value> + <value>1</value> + <value>Other</value> + <value>4</value> + <value>4</value> + <value>1</value> + <value>1</value> + <value></value> + <value>1</value> + </row> + </table> + <table name="phpbb_privmsgs"> + <column>msg_id</column> + <column>author_id</column> + <column>message_edit_user</column> + <column>message_text</column> + <column>to_address</column> + <column>bcc_address</column> + <row> + <value>1</value> + <value>3</value> + <value>3</value> + <value></value> + <value></value> + <value></value> + </row> + <row> + <value>2</value> + <value>2</value> + <value>2</value> + <value></value> + <value></value> + <value></value> + </row> + </table> + <table name="phpbb_privmsgs_to"> + <column>msg_id</column> + <column>user_id</column> + <column>author_id</column> + <row> + <value>1</value> + <value>3</value> + <value>3</value> + </row> + <row> + <value>1</value> + <value>2</value> + <value>3</value> + </row> + <row> + <value>2</value> + <value>3</value> + <value>2</value> + </row> + <row> + <value>2</value> + <value>2</value> + <value>2</value> + </row> + </table> + <table name="phpbb_reports"> + <column>report_id</column> + <column>post_id</column> + <column>user_id</column> + <column>report_text</column> + <column>reported_post_text</column> + <row> + <value>1</value> + <value>1</value> + <value>1</value> + <value>Post Removed?</value> + <value></value> + </row> + <row> + <value>2</value> + <value>3</value> + <value>2</value> + <value>Post Removed?</value> + <value></value> + </row> + <row> + <value>3</value> + <value>2</value> + <value>1</value> + <value>Keep</value> + <value></value> + </row> + <row> + <value>4</value> + <value>4</value> + <value>2</value> + <value>Remove Report</value> + <value></value> + </row> + </table> + <table name="phpbb_sessions"> + <column>session_id</column> + <column>session_user_id</column> + <column>session_page</column> + <row> + <value>12345678901234567890123456789012</value> + <value>2</value> + <value></value> + </row> + <row> + <value>12345678901234567890123456789013</value> + <value>3</value> + <value></value> + </row> + </table> + <table name="phpbb_topics"> + <column>topic_id</column> + <column>forum_id</column> + <column>topic_reported</column> + <column>topic_poster</column> + <column>topic_delete_user</column> + <column>topic_first_poster_name</column> + <column>topic_first_poster_colour</column> + <column>topic_last_poster_id</column> + <column>topic_last_poster_name</column> + <column>topic_last_poster_colour</column> + <row> + <value>1</value> + <value>1</value> + <value>1</value> + <value>2</value> + <value>2</value> + <value></value> + <value>00AA00</value> + <value>2</value> + <value></value> + <value>00AA00</value> + </row> + <row> + <value>2</value> + <value>2</value> + <value>1</value> + <value>1</value> + <value>1</value> + <value>Other</value> + <value></value> + <value>1</value> + <value>Other</value> + <value></value> + </row> + <row> + <value>3</value> + <value>3</value> + <value>1</value> + <value>2</value> + <value>2</value> + <value></value> + <value>00AA00</value> + <value>2</value> + <value></value> + <value>00AA00</value> + </row> + <row> + <value>4</value> + <value>4</value> + <value>1</value> + <value>1</value> + <value>1</value> + <value>Other</value> + <value></value> + <value>1</value> + <value>Other</value> + <value></value> + </row> + </table> + <table name="phpbb_users"> + <column>user_id</column> + <column>username</column> + <column>username_clean</column> + <column>user_permissions</column> + <column>user_sig</column> + <column>user_posts</column> + <row> + <value>1</value> + <value>Anonymous</value> + <value>anonymous</value> + <value></value> + <value></value> + <value>2</value> + </row> + <row> + <value>2</value> + <value>Foobar</value> + <value>foobar</value> + <value></value> + <value></value> + <value>2</value> + </row> + </table> + <table name="phpbb_zebra"> + <column>user_id</column> + <column>zebra_id</column> + <row> + <value>1</value> + <value>2</value> + </row> + <row> + <value>1</value> + <value>3</value> + </row> + <row> + <value>2</value> + <value>1</value> + </row> + </table> + <table name="phpbb_user_group"> + <column>user_id</column> + <row> + <value>2</value> + </row> + <row> + <value>3</value> + </row> + </table> + <table name="phpbb_topics_watch"> + <column>user_id</column> + <row> + <value>2</value> + </row> + <row> + <value>3</value> + </row> + </table> + <table name="phpbb_forums_watch"> + <column>user_id</column> + <row> + <value>2</value> + </row> + <row> + <value>3</value> + </row> + </table> + <table name="phpbb_acl_users"> + <column>user_id</column> + <row> + <value>2</value> + </row> + <row> + <value>3</value> + </row> + </table> + <table name="phpbb_topics_track"> + <column>user_id</column> + <row> + <value>2</value> + </row> + <row> + <value>3</value> + </row> + </table> + <table name="phpbb_forums_track"> + <column>user_id</column> + <row> + <value>2</value> + </row> + <row> + <value>3</value> + </row> + </table> + <table name="phpbb_topics_posted"> + <column>user_id</column> + <row> + <value>2</value> + </row> + <row> + <value>3</value> + </row> + </table> + <table name="phpbb_profile_fields_data"> + <column>user_id</column> + <column>pf_phpbb_interests</column> + <column>pf_phpbb_occupation</column> + <row> + <value>2</value> + <value></value> + <value></value> + </row> + <row> + <value>3</value> + <value></value> + <value></value> + </row> + </table> + <table name="phpbb_moderator_cache"> + <column>user_id</column> + <row> + <value>2</value> + </row> + <row> + <value>3</value> + </row> + </table> + <table name="phpbb_bookmarks"> + <column>user_id</column> + <row> + <value>2</value> + </row> + <row> + <value>3</value> + </row> + </table> + <table name="phpbb_sessions_keys"> + <column>user_id</column> + <row> + <value>2</value> + </row> + <row> + <value>3</value> + </row> + </table> + <table name="phpbb_privmsgs_folder"> + <column>user_id</column> + <row> + <value>2</value> + </row> + <row> + <value>3</value> + </row> + </table> + <table name="phpbb_privmsgs_rules"> + <column>user_id</column> + <column>rule_string</column> + <row> + <value>2</value> + <value></value> + </row> + <row> + <value>3</value> + <value></value> + </row> + </table> + <table name="phpbb_drafts"> + <column>user_id</column> + <column>draft_message</column> + <row> + <value>2</value> + <value></value> + </row> + <row> + <value>3</value> + <value></value> + </row> + </table> +</dataset> diff --git a/tests/mock/event_dispatcher.php b/tests/mock/event_dispatcher.php index 613551bffd..fa8b4a1036 100644 --- a/tests/mock/event_dispatcher.php +++ b/tests/mock/event_dispatcher.php @@ -11,9 +11,18 @@ * */ -class phpbb_mock_event_dispatcher +class phpbb_mock_event_dispatcher extends \phpbb\event\dispatcher { - public function trigger_event($eventName, $data) + /** + * Constructor. + * + * Overwrite the constructor to get rid of ContainerInterface param instance + */ + public function __construct() + { + } + + public function trigger_event($eventName, $data = array()) { return array(); } diff --git a/tests/pagination/pagination_test.php b/tests/pagination/pagination_test.php index 95856dd07d..d36aa11a8a 100644 --- a/tests/pagination/pagination_test.php +++ b/tests/pagination/pagination_test.php @@ -28,7 +28,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case global $phpbb_dispatcher; - $phpbb_dispatcher = new phpbb_mock_event_dispatcher; + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); $this->user = $this->getMock('\phpbb\user', array(), array('\phpbb\datetime')); $this->user->expects($this->any()) ->method('lang') @@ -58,7 +58,7 @@ class phpbb_pagination_pagination_test extends phpbb_template_template_test_case ); $this->helper = new phpbb_mock_controller_helper($this->template, $this->user, $this->config, $provider, $manager, $symfony_request, $filesystem, '', 'php', dirname(__FILE__) . '/'); - $this->pagination = new \phpbb\pagination($this->template, $this->user, $this->helper); + $this->pagination = new \phpbb\pagination($this->template, $this->user, $this->helper, $phpbb_dispatcher); } public function generate_template_pagination_data() diff --git a/tests/profilefields/type_string_test.php b/tests/profilefields/type_string_test.php index d5384e0ae8..a7be087fb5 100644 --- a/tests/profilefields/type_string_test.php +++ b/tests/profilefields/type_string_test.php @@ -167,6 +167,55 @@ class phpbb_profilefield_type_string_test extends phpbb_test_case 'FIELD_INVALID_CHARS_ALPHA_PUNCTUATION-field', 'Required field should reject field having invalid input for the given validation', ), + // UTF-8 string tests + array( + 'ö äö äö ä', + array('field_validation' => '[\p{Lu}\p{Ll}0-9]+'), + 'FIELD_INVALID_CHARS_LETTER_NUM_ONLY-field', + 'Required field should reject spaces in UTF-8 letternumeric only field', + ), + array( + 'Имя123', + array('field_validation' => '[\p{Lu}\p{Ll}0-9]+'), + false, + 'Required field should accept UTF-8 letternumeric only field', + ), + array( + 'Ö äö äö- ä+', + array('field_validation' => '[\p{Lu}\p{Ll}0-9_]+'), + 'FIELD_INVALID_CHARS_LETTER_NUM_UNDERSCORE-field', + 'Required field should reject spacers in UTF-8 letternumeric with underscore field', + ), + array( + 'Правильное.Имя123', + array('field_validation' => '[\p{Lu}\p{Ll}0-9.]+'), + false, + 'Required field should accept UTF-8 letternumeric field with dots', + ), + array( + 'Неправильное.,имя123', + array('field_validation' => '[\p{Lu}\p{Ll}0-9.]+'), + 'FIELD_INVALID_CHARS_LETTER_NUM_DOTS-field', + 'Required field should reject comma in UTF-8 letternumeric field with dots', + ), + array( + 'Ö äö äö- ä+', + array('field_validation' => '[\p{Lu}\p{Ll}0-9\x20_+\-\[\]]+'), + false, + 'Required field should accept spacers in UTF-8 letternumeric with spacers field', + ), + array( + 'skype.test.name,_this', + array('field_validation' => '[\p{Lu}\p{Ll}][\p{Lu}\p{Ll}0-9.,\-_]+'), + false, + 'Required field should accept alphanumeric value for UTF-8 letternumeric field with punctuations', + ), + array( + '1skype.this.should.fail', + array('field_validation' => '[\p{Lu}\p{Ll}][\p{Lu}\p{Ll}0-9.,\-_]+'), + 'FIELD_INVALID_CHARS_LETTER_NUM_PUNCTUATION-field', + 'Required field should reject field having leading numeric for UTF-8 letternumeric field with punctuations', + ), ); } diff --git a/tests/session/fixtures/sessions_empty.xml b/tests/session/fixtures/sessions_empty.xml index 2acba58f45..068951dc4c 100644 --- a/tests/session/fixtures/sessions_empty.xml +++ b/tests/session/fixtures/sessions_empty.xml @@ -30,4 +30,11 @@ <column>session_ip</column> <column>session_browser</column> </table> + <table name="phpbb_banlist"> + <column>ban_id</column> + <column>ban_userid</column> + <column>ban_email</column> + <column>ban_reason</column> + <column>ban_give_reason</column> + </table> </dataset> diff --git a/tests/session/session_key_test.php b/tests/session/session_key_test.php index 31a470615c..bf3dfcaa3c 100644 --- a/tests/session/session_key_test.php +++ b/tests/session/session_key_test.php @@ -11,6 +11,7 @@ * */ +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; require_once dirname(__FILE__) . '/../test_framework/phpbb_session_test_case.php'; class phpbb_session_login_keys_test extends phpbb_session_test_case @@ -28,13 +29,14 @@ class phpbb_session_login_keys_test extends phpbb_session_test_case // With AutoLogin setup $this->session_factory->merge_config_data(array('allow_autologin' => true)); $session = $this->session_factory->get_session($this->db); + // Using a user_id and key that is already in the database $session->cookie_data['u'] = $this->user_id; $session->cookie_data['k'] = $this->key_id; - // Try to access session - $session->session_create($this->user_id, false, $this->user_id); - $this->assertEquals($this->user_id, $session->data['user_id'], "session should automatically login"); + // Try to access session with the session key + $session->session_create(false, false, false); + $this->assertEquals($this->user_id, $session->data['user_id'], 'User should be logged in by the session key'); } public function test_reset_keys() @@ -42,14 +44,19 @@ class phpbb_session_login_keys_test extends phpbb_session_test_case // With AutoLogin setup $this->session_factory->merge_config_data(array('allow_autologin' => true)); $session = $this->session_factory->get_session($this->db); + // Reset of the keys for this user $session->reset_login_keys($this->user_id); + // Using a user_id and key that was in the database (before reset) $session->cookie_data['u'] = $this->user_id; $session->cookie_data['k'] = $this->key_id; - // Try to access session - $session->session_create($this->user_id, false, $this->user_id); - $this->assertNotEquals($this->user_id, $session->data['user_id'], "session should be cleared"); + // Try to access session with the session key + $session->session_create(false, false, $this->user_id); + $this->assertNotEquals($this->user_id, $session->data['user_id'], 'User is not logged in because the session key is invalid'); + + $session->session_create($this->user_id, false, false); + $this->assertEquals($this->user_id, $session->data['user_id'], 'User should be logged in because we create a new session'); } } diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index 9dbb7150f1..fc1a3632f4 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -54,46 +54,43 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test static public function setUpBeforeClass() { + global $phpbb_root_path, $phpEx; + $setup_extensions = static::setup_extensions(); - self::$schema_file = ''; + + $finder = new \phpbb\finder(new \phpbb\filesystem(), $phpbb_root_path, null, $phpEx); + $finder->core_path('phpbb/db/migration/data/'); if (!empty($setup_extensions)) { - $schema_md5 = md5(serialize($setup_extensions)); - - self::$schema_file = __DIR__ . '/../tmp/' . $schema_md5 . '.json'; - self::$phpbb_schema_copy = __DIR__ . '/../tmp/schema_phpbb_copy.json'; - self::$install_schema_file = __DIR__ . '/../../phpBB/install/schemas/schema.json'; - - if (!file_exists(self::$schema_file)) - { - global $phpbb_root_path, $phpEx, $table_prefix; + $finder->set_extensions($setup_extensions) + ->extension_directory('/migrations'); + } + $classes = $finder->get_classes(); - $finder = new \phpbb\finder(new \phpbb\filesystem(), $phpbb_root_path, null, $phpEx); - $classes = $finder->core_path('phpbb/db/migration/data/') - ->set_extensions($setup_extensions) - ->extension_directory('/migrations') - ->get_classes(); + $schema_sha1 = sha1(serialize($classes)); + self::$schema_file = __DIR__ . '/../tmp/' . $schema_sha1 . '.json'; + self::$install_schema_file = __DIR__ . '/../../phpBB/install/schemas/schema.json'; - $db = new \phpbb\db\driver\sqlite(); - $schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $db, new \phpbb\db\tools($db, true), $phpbb_root_path, $phpEx, $table_prefix); - $schema_data = $schema_generator->get_schema(); + if (!file_exists(self::$schema_file)) + { - file_put_contents(self::$schema_file, json_encode($schema_data)); - } + global $table_prefix; - copy(self::$install_schema_file, self::$phpbb_schema_copy); - copy(self::$schema_file, self::$install_schema_file); + $db = new \phpbb\db\driver\sqlite(); + $schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $db, new \phpbb\db\tools($db, true), $phpbb_root_path, $phpEx, $table_prefix); + file_put_contents(self::$schema_file, json_encode($schema_generator->get_schema())); } + copy(self::$schema_file, self::$install_schema_file); + parent::setUpBeforeClass(); } static public function tearDownAfterClass() { - if (self::$schema_file !== '') + if (file_exists(self::$install_schema_file)) { - copy(self::$phpbb_schema_copy, self::$install_schema_file); - unlink(self::$schema_file); + unlink(self::$install_schema_file); } parent::tearDownAfterClass(); diff --git a/tests/test_framework/phpbb_database_test_connection_manager.php b/tests/test_framework/phpbb_database_test_connection_manager.php index 92e2080dba..5d643e43e2 100644 --- a/tests/test_framework/phpbb_database_test_connection_manager.php +++ b/tests/test_framework/phpbb_database_test_connection_manager.php @@ -356,8 +356,23 @@ class phpbb_database_test_connection_manager } // Ok we have the db info go ahead and work on building the table - $db_table_schema = file_get_contents($directory . 'schema.json'); - $db_table_schema = json_decode($db_table_schema, true); + if (file_exists($directory . 'schema.json')) + { + $db_table_schema = file_get_contents($directory . 'schema.json'); + $db_table_schema = json_decode($db_table_schema, true); + } + else + { + global $phpbb_root_path, $phpEx, $table_prefix; + + $finder = new \phpbb\finder(new \phpbb\filesystem(), $phpbb_root_path, null, $phpEx); + $classes = $finder->core_path('phpbb/db/migration/data/') + ->get_classes(); + + $db = new \phpbb\db\driver\sqlite(); + $schema_generator = new \phpbb\db\migration\schema_generator($classes, new \phpbb\config\config(array()), $db, new \phpbb\db\tools($db, true), $phpbb_root_path, $phpEx, $table_prefix); + $db_table_schema = $schema_generator->get_schema(); + } $db_tools = new \phpbb\db\tools($db, true); foreach ($db_table_schema as $table_name => $table_data) diff --git a/tests/test_framework/phpbb_session_test_case.php b/tests/test_framework/phpbb_session_test_case.php index d4fc174a12..efad4d5166 100644 --- a/tests/test_framework/phpbb_session_test_case.php +++ b/tests/test_framework/phpbb_session_test_case.php @@ -16,8 +16,13 @@ require_once dirname(__FILE__) . '/../session/testable_facade.php'; abstract class phpbb_session_test_case extends phpbb_database_test_case { + /** @var phpbb_session_testable_factory */ protected $session_factory; + + /** @var phpbb_session_testable_facade */ protected $session_facade; + + /** @var \phpbb\db\driver\driver_interface */ protected $db; function setUp() diff --git a/tests/wrapper/gmgetdate_test.php b/tests/wrapper/gmgetdate_test.php index dc0e38544d..2e55a78d21 100644 --- a/tests/wrapper/gmgetdate_test.php +++ b/tests/wrapper/gmgetdate_test.php @@ -50,7 +50,18 @@ class phpbb_wrapper_gmgetdate_test extends phpbb_test_case $date_array['year'] ); - $this->assertEquals($expected, $actual); + // Calling second-granularity time functions twice isn't guaranteed to + // give the same results. As long as they're in the right order, allow + // a 1 second difference. + $this->assertGreaterThanOrEqual( + $expected, $actual, + 'Expected second time to be after (or equal to) the previous one' + ); + $this->assertLessThanOrEqual( + 1, + abs($actual - $expected), + "Expected $actual to be within 1 second of $expected." + ); if (isset($current_timezone)) { |