diff options
164 files changed, 4065 insertions, 897 deletions
diff --git a/build/build.xml b/build/build.xml index cc29aec654..3a73e09410 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.10" /> - <property name="prevversion" value="3.1.9" /> - <property name="olderversions" value="3.0.14, 3.1.0, 3.1.1, 3.1.2, 3.1.3, 3.1.4, 3.1.5, 3.1.6, 3.1.7, 3.1.7-pl1, 3.1.8" /> + <property name="newversion" value="3.1.11-RC1" /> + <property name="prevversion" value="3.1.10" /> + <property name="olderversions" value="3.0.14, 3.1.0, 3.1.1, 3.1.2, 3.1.3, 3.1.4, 3.1.5, 3.1.6, 3.1.7, 3.1.7-pl1, 3.1.8, 3.1.9" /> <!-- no configuration should be needed beyond this point --> <property name="oldversions" value="${olderversions}, ${prevversion}" /> diff --git a/git-tools/setup_github_network.php b/git-tools/setup_github_network.php deleted file mode 100755 index 100ac53b33..0000000000 --- a/git-tools/setup_github_network.php +++ /dev/null @@ -1,292 +0,0 @@ -#!/usr/bin/env php -<?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. -* -*/ - -function show_usage() -{ - $filename = basename(__FILE__); - - echo "$filename adds repositories of a github network as remotes to a local git repository.\n"; - echo "\n"; - - echo "Usage: [php] $filename -s collaborators|organisation|contributors|forks [OPTIONS]\n"; - echo "\n"; - - echo "Scopes:\n"; - echo " collaborators Repositories of people who have push access to the specified repository\n"; - echo " contributors Repositories of people who have contributed to the specified repository\n"; - echo " organisation Repositories of members of the organisation at github\n"; - echo " forks All repositories of the whole github network\n"; - echo "\n"; - - echo "Options:\n"; - echo " -s scope See description above (mandatory)\n"; - echo " -u github_username Overwrites the github username (optional)\n"; - echo " -r repository_name Overwrites the repository name (optional)\n"; - echo " -m your_github_username Sets up ssh:// instead of git:// for pushable repositories (optional)\n"; - echo " -d Outputs the commands instead of running them (optional)\n"; - echo " -h This help text\n"; - - exit(1); -} - -// Handle arguments -$opts = getopt('s:u:r:m:dh'); - -if (empty($opts) || isset($opts['h'])) -{ - show_usage(); -} - -$scope = get_arg($opts, 's', ''); -$username = get_arg($opts, 'u', 'phpbb'); -$repository = get_arg($opts, 'r', 'phpbb3'); -$developer = get_arg($opts, 'm', ''); -$dry_run = !get_arg($opts, 'd', true); -run(null, $dry_run); -exit(work($scope, $username, $repository, $developer)); - -function work($scope, $username, $repository, $developer) -{ - // Get some basic data - $forks = get_forks($username, $repository); - $collaborators = get_collaborators($username, $repository); - - if ($forks === false || $collaborators === false) - { - echo "Error: failed to retrieve forks or collaborators\n"; - return 1; - } - - switch ($scope) - { - case 'collaborators': - $remotes = array_intersect_key($forks, $collaborators); - break; - - case 'organisation': - $remotes = array_intersect_key($forks, get_organisation_members($username)); - break; - - case 'contributors': - $remotes = array_intersect_key($forks, get_contributors($username, $repository)); - break; - - case 'forks': - $remotes = $forks; - break; - - default: - show_usage(); - } - - if (file_exists('.git')) - { - add_remote($username, $repository, isset($collaborators[$developer])); - } - else - { - clone_repository($username, $repository, isset($collaborators[$developer])); - } - - // Add private security repository for developers - if ($username == 'phpbb' && $repository == 'phpbb3' && isset($collaborators[$developer])) - { - run("git remote add $username-security " . get_repository_url($username, "$repository-security", true)); - } - - // Skip blessed repository. - unset($remotes[$username]); - - foreach ($remotes as $remote) - { - add_remote($remote['username'], $remote['repository'], $remote['username'] == $developer); - } - - run('git remote update'); -} - -function clone_repository($username, $repository, $pushable = false) -{ - $url = get_repository_url($username, $repository, false); - run("git clone $url ./ --origin $username"); - - if ($pushable) - { - $ssh_url = get_repository_url($username, $repository, true); - run("git remote set-url --push $username $ssh_url"); - } -} - -function add_remote($username, $repository, $pushable = false) -{ - $url = get_repository_url($username, $repository, false); - run("git remote add $username $url"); - - if ($pushable) - { - $ssh_url = get_repository_url($username, $repository, true); - run("git remote set-url --push $username $ssh_url"); - } -} - -function get_repository_url($username, $repository, $ssh = false) -{ - $url_base = ($ssh) ? 'git@github.com:' : 'git://github.com/'; - - return $url_base . $username . '/' . $repository . '.git'; -} - -function api_request($query) -{ - return api_url_request("https://api.github.com/$query?per_page=100"); -} - -function api_url_request($url) -{ - $contents = file_get_contents($url, false, stream_context_create(array( - 'http' => array( - 'header' => "User-Agent: phpBB/1.0\r\n", - ), - ))); - - $sub_request_result = array(); - // Check headers for pagination links - if (!empty($http_response_header)) - { - foreach ($http_response_header as $header_element) - { - // Find Link Header which gives us a link to the next page - if (strpos($header_element, 'Link: ') === 0) - { - list($head, $header_content) = explode(': ', $header_element); - foreach (explode(', ', $header_content) as $links) - { - list($url, $rel) = explode('; ', $links); - if ($rel == 'rel="next"') - { - // Found a next link, follow it and merge the results - $sub_request_result = api_url_request(substr($url, 1, -1)); - } - } - } - } - } - - if ($contents === false) - { - return false; - } - $contents = json_decode($contents); - - if (isset($contents->message) && strpos($contents->message, 'API Rate Limit') === 0) - { - throw new RuntimeException('Reached github API Rate Limit. Please try again later' . "\n", 4); - } - - return ($sub_request_result) ? array_merge($sub_request_result, $contents) : $contents; -} - -function get_contributors($username, $repository) -{ - $request = api_request("repos/$username/$repository/stats/contributors"); - if ($request === false) - { - return false; - } - - $usernames = array(); - foreach ($request as $contribution) - { - $usernames[$contribution->author->login] = $contribution->author->login; - } - - return $usernames; -} - -function get_organisation_members($username) -{ - $request = api_request("orgs/$username/public_members"); - if ($request === false) - { - return false; - } - - $usernames = array(); - foreach ($request as $member) - { - $usernames[$member->login] = $member->login; - } - - return $usernames; -} - -function get_collaborators($username, $repository) -{ - $request = api_request("repos/$username/$repository/collaborators"); - if ($request === false) - { - return false; - } - - $usernames = array(); - foreach ($request as $collaborator) - { - $usernames[$collaborator->login] = $collaborator->login; - } - - return $usernames; -} - -function get_forks($username, $repository) -{ - $request = api_request("repos/$username/$repository/forks"); - if ($request === false) - { - return false; - } - - $usernames = array(); - foreach ($request as $fork) - { - $usernames[$fork->owner->login] = array( - 'username' => $fork->owner->login, - 'repository' => $fork->name, - ); - } - - return $usernames; -} - -function get_arg($array, $index, $default) -{ - return isset($array[$index]) ? $array[$index] : $default; -} - -function run($cmd, $dry = false) -{ - static $dry_run; - - if (is_null($cmd)) - { - $dry_run = $dry; - } - else if (!empty($dry_run)) - { - echo "$cmd\n"; - } - else - { - passthru(escapeshellcmd($cmd)); - } -} diff --git a/phpBB/adm/style/acp_ext_details.html b/phpBB/adm/style/acp_ext_details.html index 830c2e3cb4..bd9eca623a 100644 --- a/phpBB/adm/style/acp_ext_details.html +++ b/phpBB/adm/style/acp_ext_details.html @@ -21,6 +21,7 @@ <p>{VERSIONCHECK_FAIL_REASON}</p> </div> <!-- ENDIF --> +<!-- EVENT acp_ext_details_notice --> <fieldset> <legend>{L_EXT_DETAILS}</legend> @@ -136,4 +137,5 @@ <!-- END meta_authors --> </fieldset> + <!-- EVENT acp_ext_details_end --> <!-- INCLUDE overall_footer.html --> diff --git a/phpBB/adm/style/acp_ext_list.html b/phpBB/adm/style/acp_ext_list.html index ccc39ea76d..af9e00a614 100644 --- a/phpBB/adm/style/acp_ext_list.html +++ b/phpBB/adm/style/acp_ext_list.html @@ -48,7 +48,7 @@ </tr> <!-- BEGIN enabled --> <tr class="ext_enabled row-highlight"> - <td><strong title="{enabled.NAME}">{enabled.META_DISPLAY_NAME}</strong></td> + <td><strong title="{enabled.NAME}">{enabled.META_DISPLAY_NAME}</strong><!-- EVENT acp_ext_list_enabled_name_after --></td> <td style="text-align: center;"> <!-- IF enabled.S_VERSIONCHECK --> <strong <!-- IF enabled.S_UP_TO_DATE -->style="color: #228822;"<!-- ELSE -->style="color: #BC2A4D;"<!-- ENDIF -->>{enabled.META_VERSION}</strong> @@ -73,7 +73,7 @@ </tr> <!-- BEGIN disabled --> <tr class="ext_disabled row-highlight"> - <td><strong title="{disabled.NAME}">{disabled.META_DISPLAY_NAME}</strong></td> + <td><strong title="{disabled.NAME}">{disabled.META_DISPLAY_NAME}</strong><!-- EVENT acp_ext_list_disabled_name_after --></td> <td style="text-align: center;"> <!-- IF disabled.S_VERSIONCHECK --> <strong <!-- IF disabled.S_UP_TO_DATE -->style="color: #228822;"<!-- ELSE -->style="color: #BC2A4D;"<!-- ENDIF -->>{disabled.META_VERSION}</strong> diff --git a/phpBB/adm/style/acp_jabber.html b/phpBB/adm/style/acp_jabber.html index 3c3b895624..e76c9a0323 100644 --- a/phpBB/adm/style/acp_jabber.html +++ b/phpBB/adm/style/acp_jabber.html @@ -47,6 +47,21 @@ <dd><label><input type="radio" class="radio" id="jab_use_ssl" name="jab_use_ssl" value="1"<!-- IF JAB_USE_SSL --> checked="checked"<!-- ENDIF --> /> {L_YES}</label> <label><input type="radio" class="radio" name="jab_use_ssl" value="0"<!-- IF not JAB_USE_SSL --> checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd> </dl> +<dl> + <dt><label for="jab_verify_peer">{L_JAB_VERIFY_PEER}{L_COLON}</label><br /><span>{L_JAB_VERIFY_PEER_EXPLAIN}</span></dt> + <dd><label><input type="radio" class="radio" id="jab_verify_peer" name="jab_verify_peer" value="1"<!-- IF JAB_VERIFY_PEER --> checked="checked"<!-- ENDIF --> /> {L_YES}</label> + <label><input type="radio" class="radio" name="jab_verify_peer" value="0"<!-- IF not JAB_VERIFY_PEER --> checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd> +</dl> +<dl> + <dt><label for="jab_verify_peer_name">{L_JAB_VERIFY_PEER_NAME}{L_COLON}</label><br /><span>{L_JAB_VERIFY_PEER_NAME_EXPLAIN}</span></dt> + <dd><label><input type="radio" class="radio" id="jab_verify_peer_name" name="jab_verify_peer_name" value="1"<!-- IF JAB_VERIFY_PEER_NAME --> checked="checked"<!-- ENDIF --> /> {L_YES}</label> + <label><input type="radio" class="radio" name="jab_verify_peer_name" value="0"<!-- IF not JAB_VERIFY_PEER_NAME --> checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd> +</dl> +<dl> + <dt><label for="jab_allow_self_signed">{L_JAB_ALLOW_SELF_SIGNED}{L_COLON}</label><br /><span>{L_JAB_ALLOW_SELF_SIGNED_EXPLAIN}</span></dt> + <dd><label><input type="radio" class="radio" id="jab_allow_self_signed" name="jab_allow_self_signed" value="1"<!-- IF JAB_ALLOW_SELF_SIGNED --> checked="checked"<!-- ENDIF --> /> {L_YES}</label> + <label><input type="radio" class="radio" name="jab_allow_self_signed" value="0"<!-- IF not JAB_ALLOW_SELF_SIGNED --> checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd> +</dl> <!-- ENDIF --> <dl> <dt><label for="jab_package_size">{L_JAB_PACKAGE_SIZE}{L_COLON}</label><br /><span>{L_JAB_PACKAGE_SIZE_EXPLAIN}</span></dt> diff --git a/phpBB/adm/style/acp_main.html b/phpBB/adm/style/acp_main.html index efcb25cb68..1bdb7b8d2a 100644 --- a/phpBB/adm/style/acp_main.html +++ b/phpBB/adm/style/acp_main.html @@ -30,6 +30,11 @@ <p><a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE}</a> · <a href="{U_VERSIONCHECK}">{L_MORE_INFORMATION}</a></p> </div> <!-- ENDIF --> + <!-- IF S_VERSION_UPGRADEABLE --> + <div class="errorbox notice"> + <p>{UPGRADE_INSTRUCTIONS}</p> + </div> + <!-- ENDIF --> <!-- IF S_SEARCH_INDEX_MISSING --> <div class="errorbox"> diff --git a/phpBB/adm/style/acp_profile.html b/phpBB/adm/style/acp_profile.html index 07718846cc..bd3935b464 100644 --- a/phpBB/adm/style/acp_profile.html +++ b/phpBB/adm/style/acp_profile.html @@ -85,6 +85,7 @@ <dd><input type="checkbox" class="radio" id="field_is_contact" name="field_is_contact" value="1"<!-- IF S_FIELD_CONTACT --> checked="checked"<!-- ENDIF --> /></dd> <dd><input class="text medium" type="text" name="field_contact_desc" id="field_contact_desc" value="{FIELD_CONTACT_DESC}" /> <label for="field_contact_desc">{L_FIELD_CONTACT_DESC}</label></dd> <dd><input class="text medium" type="text" name="field_contact_url" id="field_contact_url" value="{FIELD_CONTACT_URL}" /> <label for="field_contact_url">{L_FIELD_CONTACT_URL}</label></dd> + <!-- EVENT acp_profile_contact_last --> </dl> </fieldset> @@ -127,6 +128,7 @@ <!-- ENDIF --> </dl> <!-- ENDIF --> + <!-- EVENT acp_profile_step_one_lang_after --> </fieldset> <fieldset class="quick"> diff --git a/phpBB/adm/style/acp_styles.html b/phpBB/adm/style/acp_styles.html index a36d15fe73..43c2f96a65 100644 --- a/phpBB/adm/style/acp_styles.html +++ b/phpBB/adm/style/acp_styles.html @@ -52,6 +52,10 @@ <dd><strong>{STYLE_PATH}</strong></dd> </dl> <dl> + <dt><label>{L_STYLE_VERSION}{L_COLON}</label></dt> + <dd><strong>{STYLE_VERSION}</strong></dd> + </dl> + <dl> <dt><label for="name">{L_COPYRIGHT}{L_COLON}</label></dt> <dd><strong>{STYLE_COPYRIGHT}</strong></dd> </dl> diff --git a/phpBB/adm/style/acp_update.html b/phpBB/adm/style/acp_update.html index 351a3ba26c..5288833d05 100644 --- a/phpBB/adm/style/acp_update.html +++ b/phpBB/adm/style/acp_update.html @@ -20,6 +20,11 @@ <p>{L_VERSION_NOT_UP_TO_DATE_ACP} - <a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE}</a></p> </div> <!-- ENDIF --> +<!-- IF S_VERSION_UPGRADEABLE --> + <div class="errorbox notice"> + <p>{UPGRADE_INSTRUCTIONS}</p> + </div> +<!-- ENDIF --> <fieldset> <legend></legend> diff --git a/phpBB/adm/style/ajax.js b/phpBB/adm/style/ajax.js index 4ad6b6afa5..77fd28fbe6 100644 --- a/phpBB/adm/style/ajax.js +++ b/phpBB/adm/style/ajax.js @@ -62,7 +62,127 @@ phpbb.addAjaxCallback('row_delete', function(res) { } }); +/** + * Handler for submitting permissions form in chunks + * This call will submit permissions forms in chunks of 5 fieldsets. + */ +function submitPermissions() { + var $form = $('form#set-permissions'), + fieldsetList = $form.find('fieldset[id^=perm]'), + formDataSets = [], + $submitAllButton = $form.find('input[type=submit][name^=action]')[0], + $submitButton = $form.find('input[type=submit][data-clicked=true]')[0]; + + // Set proper start values for handling refresh of page + var permissionSubmitSize = 0, + permissionRequestCount = 0, + forumIds = [], + permissionSubmitFailed = false; + + if ($submitAllButton !== $submitButton) { + fieldsetList = $form.find('fieldset#' + $submitButton.closest('fieldset.permissions').id); + } + + $.each(fieldsetList, function (key, value) { + if (key % 5 === 0) { + formDataSets[Math.floor(key / 5)] = $form.find('fieldset#' + value.id).serialize(); + } else { + formDataSets[Math.floor(key / 5)] += '&' + $form.find('fieldset#' + value.id).serialize(); + } + }); + + permissionSubmitSize = formDataSets.length; + + // Add each forum ID to forum ID list to preserve selected forums + $.each($form.find('input[type=hidden][name^=forum_id]'), function (key, value) { + if (value.name.match(/^forum_id\[([0-9]+)\]$/)) { + forumIds.push(value.value); + } + }); + + /** + * Handler for submitted permissions form chunk + * + * @param {object} res Object returned by AJAX call + */ + function handlePermissionReturn(res) { + permissionRequestCount++; + var $dark = $('#darkenwrapper'); + + if (res.S_USER_WARNING) { + phpbb.alert(res.MESSAGE_TITLE, res.MESSAGE_TEXT); + permissionSubmitFailed = true; + } else if (!permissionSubmitFailed && res.S_USER_NOTICE) { + // Display success message at the end of submitting the form + if (permissionRequestCount >= permissionSubmitSize) { + var $alert = phpbb.alert(res.MESSAGE_TITLE, res.MESSAGE_TEXT); + var $alertBoxLink = $alert.find('p.alert_text > a'); + + // Create form to submit instead of normal "Back to previous page" link + if ($alertBoxLink) { + // Remove forum_id[] from URL + $alertBoxLink.attr('href', $alertBoxLink.attr('href').replace(/(&forum_id\[\]=[0-9]+)/g, '')); + var previousPageForm = '<form action="' + $alertBoxLink.attr('href') + '" method="post">'; + $.each(forumIds, function (key, value) { + previousPageForm += '<input type="text" name="forum_id[]" value="' + value + '" />'; + }); + previousPageForm += '</form>'; + + $alertBoxLink.on('click', function (e) { + var $previousPageForm = $(previousPageForm); + $('body').append($previousPageForm); + e.preventDefault(); + $previousPageForm.submit(); + }); + } + + // Do not allow closing alert + $dark.off('click'); + $alert.find('.alert_close').hide(); + + if (typeof res.REFRESH_DATA !== 'undefined') { + setTimeout(function () { + // Create forum to submit using POST. This will prevent + // exceeding the maximum length of URLs + var form = '<form action="' + res.REFRESH_DATA.url.replace(/(&forum_id\[\]=[0-9]+)/g, '') + '" method="post">'; + $.each(forumIds, function (key, value) { + form += '<input type="text" name="forum_id[]" value="' + value + '" />'; + }); + form += '</form>'; + $form = $(form); + $('body').append($form); + + // Hide the alert even if we refresh the page, in case the user + // presses the back button. + $dark.fadeOut(phpbb.alertTime, function () { + if (typeof $alert !== 'undefined') { + $alert.hide(); + } + }); + + // Submit form + $form.submit(); + }, res.REFRESH_DATA.time * 1000); // Server specifies time in seconds + } + } + } + } + // Create AJAX request for each form data set + $.each(formDataSets, function (key, formData) { + $.ajax({ + url: $form.action, + type: 'POST', + data: formData + '&' + $submitButton.name + '=' + encodeURIComponent($submitButton.value) + + '&creation_time=' + $form.find('input[type=hidden][name=creation_time]')[0].value + + '&form_token=' + $form.find('input[type=hidden][name=form_token]')[0].value + + '&' + $form.children('input[type=hidden]').serialize() + + '&' + $form.find('input[type=checkbox][name^=inherit]').serialize(), + success: handlePermissionReturn, + error: handlePermissionReturn + }); + }); +} $('[data-ajax]').each(function() { var $this = $(this), @@ -83,6 +203,18 @@ $('[data-ajax]').each(function() { */ $(function() { phpbb.resizeTextArea($('textarea:not(.no-auto-resize)'), {minHeight: 75}); + + var $setPermissionsForm = $('form#set-permissions'); + if ($setPermissionsForm.length) { + $setPermissionsForm.on('submit', function (e) { + submitPermissions(); + e.preventDefault(); + }); + $setPermissionsForm.find('input[type=submit]').click(function() { + $('input[type=submit]', $(this).parents($('form#set-permissions'))).removeAttr('data-clicked'); + $(this).attr('data-clicked', true); + }); + } }); diff --git a/phpBB/adm/style/overall_header.html b/phpBB/adm/style/overall_header.html index d399c680ee..bd8caf1443 100644 --- a/phpBB/adm/style/overall_header.html +++ b/phpBB/adm/style/overall_header.html @@ -53,7 +53,7 @@ function marklist(id, name, state) for (var r = 0; r < rb.length; r++) { - if (rb[r].name.substr(0, name.length) == name) + if (rb[r].name.substr(0, name.length) == name && rb[r].disabled !== true) { rb[r].checked = state; } diff --git a/phpBB/adm/style/simple_header.html b/phpBB/adm/style/simple_header.html index 9f47b2052b..439645a211 100644 --- a/phpBB/adm/style/simple_header.html +++ b/phpBB/adm/style/simple_header.html @@ -66,7 +66,7 @@ function marklist(id, name, state) for (var r = 0; r < rb.length; r++) { - if (rb[r].name.substr(0, name.length) == name) + if (rb[r].name.substr(0, name.length) == name && rb[r].disabled !== true) { rb[r].checked = state; } diff --git a/phpBB/assets/javascript/core.js b/phpBB/assets/javascript/core.js index f7ace80705..b079043396 100644 --- a/phpBB/assets/javascript/core.js +++ b/phpBB/assets/javascript/core.js @@ -33,21 +33,28 @@ phpbb.loadingIndicator = function() { if (!$loadingIndicator.is(':visible')) { $loadingIndicator.fadeIn(phpbb.alertTime); - // Wait fifteen seconds and display an error if nothing has been returned by then. + // Wait 60 seconds and display an error if nothing has been returned by then. phpbb.clearLoadingTimeout(); phpbbAlertTimer = setTimeout(function() { - var $alert = $('#phpbb_alert'); - - if ($loadingIndicator.is(':visible')) { - phpbb.alert($alert.attr('data-l-err'), $alert.attr('data-l-timeout-processing-req')); - } - }, 15000); + phpbb.showTimeoutMessage(); + }, 60000); } return $loadingIndicator; }; /** + * Show timeout message + */ +phpbb.showTimeoutMessage = function () { + var $alert = $('#phpbb_alert'); + + if ($loadingIndicator.is(':visible')) { + phpbb.alert($alert.attr('data-l-err'), $alert.attr('data-l-timeout-processing-req')); + } +}; + +/** * Clear loading alert timeout */ phpbb.clearLoadingTimeout = function() { diff --git a/phpBB/composer.json b/phpBB/composer.json index 6b3a2c9918..32770c4cd0 100644 --- a/phpBB/composer.json +++ b/phpBB/composer.json @@ -34,7 +34,7 @@ "symfony/http-kernel": "2.3.*", "symfony/routing": "2.3.*", "symfony/yaml": "2.3.*", - "twig/twig": "1.*" + "twig/twig": "^1.0,<1.25" }, "require-dev": { "fabpot/goutte": "1.0.*", diff --git a/phpBB/composer.lock b/phpBB/composer.lock index 5d6b1ba7a7..f5cce659af 100644 --- a/phpBB/composer.lock +++ b/phpBB/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "33fa9de480a8a9c8f7e3f2926cd4c034", - "content-hash": "2d9c1857e65554ceb4cfa435495df188", + "hash": "ab3d7f33388bce90e6032110a537e61f", + "content-hash": "9c138398f4bc789098b020ed37f6ae20", "packages": [ { "name": "lusitanian/oauth", @@ -72,22 +72,30 @@ }, { "name": "psr/log", - "version": "1.0.0", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b" + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe0936ee26643249e916849d48e3a51d5f5e278b", - "reference": "fe0936ee26643249e916849d48e3a51d5f5e278b", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", "shasum": "" }, + "require": { + "php": ">=5.3.0" + }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, "autoload": { - "psr-0": { - "Psr\\Log\\": "" + "psr-4": { + "Psr\\Log\\": "Psr/Log/" } }, "notification-url": "https://packagist.org/downloads/", @@ -101,12 +109,13 @@ } ], "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", "keywords": [ "log", "psr", "psr-3" ], - "time": "2012-12-21 11:40:51" + "time": "2016-10-10 12:19:37" }, { "name": "symfony/config", @@ -575,16 +584,16 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.2.0", + "version": "v1.3.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "dff51f72b0706335131b00a7f49606168c582594" + "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/dff51f72b0706335131b00a7f49606168c582594", - "reference": "dff51f72b0706335131b00a7f49606168c582594", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4", + "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4", "shasum": "" }, "require": { @@ -596,7 +605,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.3-dev" } }, "autoload": { @@ -630,7 +639,7 @@ "portable", "shim" ], - "time": "2016-05-18 14:26:46" + "time": "2016-11-14 01:06:16" }, { "name": "symfony/routing", @@ -746,16 +755,16 @@ }, { "name": "twig/twig", - "version": "v1.24.1", + "version": "v1.24.2", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "3566d311a92aae4deec6e48682dc5a4528c4a512" + "reference": "33093f6e310e6976baeac7b14f3a6ec02f2d79b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/3566d311a92aae4deec6e48682dc5a4528c4a512", - "reference": "3566d311a92aae4deec6e48682dc5a4528c4a512", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/33093f6e310e6976baeac7b14f3a6ec02f2d79b7", + "reference": "33093f6e310e6976baeac7b14f3a6ec02f2d79b7", "shasum": "" }, "require": { @@ -803,7 +812,7 @@ "keywords": [ "templating" ], - "time": "2016-05-30 09:11:59" + "time": "2016-09-01 17:50:53" } ], "packages-dev": [ @@ -1067,16 +1076,16 @@ }, { "name": "michelf/php-markdown", - "version": "1.6.0", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/michelf/php-markdown.git", - "reference": "156e56ee036505ec637d761ee62dc425d807183c" + "reference": "1f51cc520948f66cd2af8cbc45a5ee175e774220" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/michelf/php-markdown/zipball/156e56ee036505ec637d761ee62dc425d807183c", - "reference": "156e56ee036505ec637d761ee62dc425d807183c", + "url": "https://api.github.com/repos/michelf/php-markdown/zipball/1f51cc520948f66cd2af8cbc45a5ee175e774220", + "reference": "1f51cc520948f66cd2af8cbc45a5ee175e774220", "shasum": "" }, "require": { @@ -1114,7 +1123,7 @@ "keywords": [ "markdown" ], - "time": "2015-12-24 01:37:31" + "time": "2016-10-29 18:58:20" }, { "name": "nikic/php-parser", @@ -1422,25 +1431,30 @@ }, { "name": "phpunit/php-timer", - "version": "1.0.8", + "version": "1.0.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4|~5" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -1462,20 +1476,20 @@ "keywords": [ "timer" ], - "time": "2016-05-12 18:03:57" + "time": "2017-02-26 11:10:40" }, { "name": "phpunit/php-token-stream", - "version": "1.4.8", + "version": "1.4.11", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" + "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", - "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/e03f8f67534427a787e21a385a67ec3ca6978ea7", + "reference": "e03f8f67534427a787e21a385a67ec3ca6978ea7", "shasum": "" }, "require": { @@ -1511,7 +1525,7 @@ "keywords": [ "tokenizer" ], - "time": "2015-09-15 10:49:45" + "time": "2017-02-27 10:12:30" }, { "name": "phpunit/phpunit", @@ -1751,22 +1765,22 @@ }, { "name": "sebastian/comparator", - "version": "1.2.0", + "version": "1.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", "shasum": "" }, "require": { "php": ">=5.3.3", "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2" + "sebastian/exporter": "~1.2 || ~2.0" }, "require-dev": { "phpunit/phpunit": "~4.4" @@ -1811,27 +1825,27 @@ "compare", "equality" ], - "time": "2015-07-26 15:48:44" + "time": "2017-01-29 09:50:25" }, { "name": "sebastian/diff", - "version": "1.4.1", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", "extra": { @@ -1863,27 +1877,27 @@ "keywords": [ "diff" ], - "time": "2015-12-08 07:14:41" + "time": "2017-05-22 07:24:03" }, { "name": "sebastian/environment", - "version": "1.3.7", + "version": "1.3.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716" + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/4e8f0da10ac5802913afc151413bc8c53b6c2716", - "reference": "4e8f0da10ac5802913afc151413bc8c53b6c2716", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^4.8 || ^5.0" }, "type": "library", "extra": { @@ -1913,7 +1927,7 @@ "environment", "hhvm" ], - "time": "2016-05-17 03:18:57" + "time": "2016-08-18 05:49:44" }, { "name": "sebastian/exporter", @@ -1984,16 +1998,16 @@ }, { "name": "sebastian/recursion-context", - "version": "1.0.2", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "913401df809e99e4f47b27cdd781f4a258d58791" + "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791", - "reference": "913401df809e99e4f47b27cdd781f4a258d58791", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", + "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", "shasum": "" }, "require": { @@ -2033,7 +2047,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-11-11 19:50:13" + "time": "2016-10-03 07:41:43" }, { "name": "sebastian/version", @@ -2072,16 +2086,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "2.6.2", + "version": "2.9.1", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "4edb770cb853def6e60c93abb088ad5ac2010c83" + "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/4edb770cb853def6e60c93abb088ad5ac2010c83", - "reference": "4edb770cb853def6e60c93abb088ad5ac2010c83", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/dcbed1074f8244661eecddfc2a675430d8d33f62", + "reference": "dcbed1074f8244661eecddfc2a675430d8d33f62", "shasum": "" }, "require": { @@ -2146,7 +2160,7 @@ "phpcs", "standards" ], - "time": "2016-07-13 23:29:13" + "time": "2017-05-22 02:43:20" }, { "name": "symfony/browser-kit", diff --git a/phpBB/config/auth.yml b/phpBB/config/auth.yml index 88a90ca2d6..ef06080d38 100644 --- a/phpBB/config/auth.yml +++ b/phpBB/config/auth.yml @@ -62,6 +62,7 @@ services: - @auth.provider.oauth.service_collection - %tables.users% - @service_container + - @dispatcher - %core.root_path% - %core.php_ext% tags: diff --git a/phpBB/config/console.yml b/phpBB/config/console.yml index 1e18a7dd37..55ffd358e4 100644 --- a/phpBB/config/console.yml +++ b/phpBB/config/console.yml @@ -139,3 +139,24 @@ services: - @dbal.conn tags: - { name: console.command } + + console.command.fixup.update_hashes: + class: phpbb\console\command\fixup\update_hashes + arguments: + - @config + - @user + - @dbal.conn + - @passwords.manager + - @passwords.driver_collection + - %passwords.algorithms% + tags: + - { name: console.command } + + console.command.fixup.fix_left_right_ids: + class: phpbb\console\command\fixup\fix_left_right_ids + arguments: + - @user + - @dbal.conn + - @cache.driver + tags: + - { name: console.command } diff --git a/phpBB/config/cron.yml b/phpBB/config/cron.yml index c5b88df181..dc628b43ff 100644 --- a/phpBB/config/cron.yml +++ b/phpBB/config/cron.yml @@ -146,3 +146,17 @@ services: - [set_name, [cron.task.core.tidy_warnings]] tags: - { name: cron.task } + + cron.task.core.update_hashes: + class: phpbb\cron\task\core\update_hashes + arguments: + - @config + - @dbal.conn + - @passwords.update.lock + - @passwords.manager + - @passwords.driver_collection + - %passwords.algorithms% + calls: + - [set_name, [cron.task.core.update_hashes]] + tags: + - { name: cron.task } diff --git a/phpBB/config/db.yml b/phpBB/config/db.yml index d11669d8a3..4ab4401bbd 100644 --- a/phpBB/config/db.yml +++ b/phpBB/config/db.yml @@ -5,9 +5,7 @@ services: - @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%]] + synthetic: true dbal.tools: class: phpbb\db\tools diff --git a/phpBB/config/password.yml b/phpBB/config/password.yml index cb45ec3d42..938cef7e16 100644 --- a/phpBB/config/password.yml +++ b/phpBB/config/password.yml @@ -122,3 +122,10 @@ services: - @passwords.driver_helper tags: - { name: passwords.driver } + + passwords.update.lock: + class: phpbb\lock\db + arguments: + - update_hashes_lock + - '@config' + - '@dbal.conn' diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 394d9536e8..a149e3d6c5 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -50,6 +50,7 @@ <ol> <li><a href="#changelog">Changelog</a> <ul> + <li><a href="#v3110">Changes since 3.1.10</a></li> <li><a href="#v319">Changes since 3.1.9</a></li> <li><a href="#v318">Changes since 3.1.8</a></li> <li><a href="#v317pl1">Changes since 3.1.7-PL1</a></li> @@ -119,6 +120,150 @@ <div class="content"> + <a name="v3110"></a><h3>Changes since 3.1.10</h3> + + <h4>Bug</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-7336">PHPBB3-7336</a>] - Words in new topic title aren't found by search after topic is split</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8116">PHPBB3-8116</a>] - Server timeout or browsercrash after viewing postdetails</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-8301">PHPBB3-8301</a>] - admin log generate slow queries</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9590">PHPBB3-9590</a>] - Unable to update permissions for more than 6 forums at a time</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11076">PHPBB3-11076</a>] - Update notification in ACP for minimum PHP version missing essential information</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11483">PHPBB3-11483</a>] - Forced Activation needs looking at.</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11611">PHPBB3-11611</a>] - setup_github_network.php no longer creates a repository</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13247">PHPBB3-13247</a>] - Online indicator in post profile hides behind certain avatars</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13250">PHPBB3-13250</a>] - File cache does not write entries starting with _ and containing a slash</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13429">PHPBB3-13429</a>] - Changes tag in docblock of events should be unified</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13558">PHPBB3-13558</a>] - Error - stream_socket_enable_crypto()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13757">PHPBB3-13757</a>] - Negative PM count</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14468">PHPBB3-14468</a>] - [php] - 'core.viewforum_modify_topics_data' add parameter forum_id</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14549">PHPBB3-14549</a>] - Correctly redirect back after topic merge in MCP</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14770">PHPBB3-14770</a>] - Plupload: WRONG_FILESIZE is used wrong</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14795">PHPBB3-14795</a>] - Topic merge bug</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14801">PHPBB3-14801</a>] - Search highlight option doesn't always highlight unicode strings</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14802">PHPBB3-14802</a>] - Empty/blank lines should not be additional poll options</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14806">PHPBB3-14806</a>] - Authentication for e-mail is not working</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14819">PHPBB3-14819</a>] - Soft deleted posts visible in topic review</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14821">PHPBB3-14821</a>] - Do not expect parsed HTML in kernel subscriber output</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14830">PHPBB3-14830</a>] - FORM_INVALID error on ACP search and CPF settings</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14831">PHPBB3-14831</a>] - Extension migration file fails</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14838">PHPBB3-14838</a>] - feeds.attachments_base - server 500 error for large attachment tables</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14844">PHPBB3-14844</a>] - BBcodes B and I return <strong> and <em> tags instead of CSS under inherited styles</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14859">PHPBB3-14859</a>] - PM report notifications only sent out to full Global Moderators</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14860">PHPBB3-14860</a>] - Broken link on subscriptions page on mobile devices</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14863">PHPBB3-14863</a>] - "Array" in message title when permanently deleting posts</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14864">PHPBB3-14864</a>] - ACP datefromat text input still has 30 max length while dateformat field had been expanded to 64</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14876">PHPBB3-14876</a>] - Multibyte message is not displayed properly on exception</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14877">PHPBB3-14877</a>] - CSS error in ".codebox code" definition</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14881">PHPBB3-14881</a>] - Problems using EVENT (overall_footer_content_after)</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14888">PHPBB3-14888</a>] - Missing check for disabled profile field types</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14889">PHPBB3-14889</a>] - Missing method declaration in profile fields type interface</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14890">PHPBB3-14890</a>] - Wrong validation of input field in profile field type string</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14906">PHPBB3-14906</a>] - Duplicated sig key in user_cache_data array</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14923">PHPBB3-14923</a>] - SQL PostgreSQL blocking errors during DB update installation</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14938">PHPBB3-14938</a>] - Inconsistent data results from ext_mgr->all_available() vs ext_mgr->is_available()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14941">PHPBB3-14941</a>] - MySQL Fulltext search index creating still fails on InnoDB</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14943">PHPBB3-14943</a>] - Template loop access gives PHP error</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14953">PHPBB3-14953</a>] - Incorrect "order by" definition in ucp_pm_viewfolder</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14968">PHPBB3-14968</a>] - Version check marks 3.1.10 boards as outdated </li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14997">PHPBB3-14997</a>] - Bad Position for topiclist_row_topic_title_after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14998">PHPBB3-14998</a>] - ACP Update link is incorrect!</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15003">PHPBB3-15003</a>] - When using mark all, disabled check boxes should not become checked</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15006">PHPBB3-15006</a>] - Permission inheritance with checkbox not working</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15011">PHPBB3-15011</a>] - Error not checked on metadata load failure</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15108">PHPBB3-15108</a>] - Duplicate code in request->overwrite</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15143">PHPBB3-15143</a>] - version check on branch is broken</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15146">PHPBB3-15146</a>] - Date profile field validation incorrect</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15150">PHPBB3-15150</a>] - Yabber SSL/TLS certification</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15186">PHPBB3-15186</a>] - The force_delete_allowed flag does not affect actual posts deletion ability</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15187">PHPBB3-15187</a>] - ACP Template files not purged during Extension Enable</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15246">PHPBB3-15246</a>] - Memcache driver incorrectly handles Unix sockets</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15248">PHPBB3-15248</a>] - Event core.modify_posting_auth does not honor its parameters</li> + </ul> + <h4>Improvement</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9211">PHPBB3-9211</a>] - List subforums-links separately in parent-forums' legend</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12749">PHPBB3-12749</a>] - core.submit_post_end add subject to the event data</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13457">PHPBB3-13457</a>] - New Hooks for ucp_main</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13459">PHPBB3-13459</a>] - New Template-Event in overall_header.html</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13479">PHPBB3-13479</a>] - Add hook for modifying highlighting on viewtopic</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13601">PHPBB3-13601</a>] - New event upon acl_clear_prefetch</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13603">PHPBB3-13603</a>] - New event upon index_body_online_block_after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13605">PHPBB3-13605</a>] - New event upon ucp_pm_compose_predefined_message</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13608">PHPBB3-13608</a>] - New event upon ucp_restore_permissions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13609">PHPBB3-13609</a>] - New event upon ucp_switch_permissions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13845">PHPBB3-13845</a>] - Add event when user changes or delete avatar</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14119">PHPBB3-14119</a>] - [PHP] - (User) unban event request</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14239">PHPBB3-14239</a>] - [PHP] - Add event ucp_remind_modify_select_sql</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14331">PHPBB3-14331</a>] - Add rank calculation or result event access</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14520">PHPBB3-14520</a>] - [Template] - ucp_pm_viewmessage_message_body_after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14522">PHPBB3-14522</a>] - [Template] - ucp_register_buttons_before</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14524">PHPBB3-14524</a>] - [PHP] - core.ucp_register_requests_after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14733">PHPBB3-14733</a>] - Support increasing hashing cost factor</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14750">PHPBB3-14750</a>] - Fileupload form should not set invalid attributes for file input</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14758">PHPBB3-14758</a>] - ACP-Parameter "Maximum thumbnail width in pixel" should be "Maximum thumbnail width/heigth in pixel:"</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14759">PHPBB3-14759</a>] - Event core.mcp_main_modify_shadow_sql</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14760">PHPBB3-14760</a>] - Event core.mcp_main_modify_fork_sql</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14786">PHPBB3-14786</a>] - Add mcp_forum_actions_before/after events</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14804">PHPBB3-14804</a>] - Add core event to MCP after merging topics</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14805">PHPBB3-14805</a>] - Allow building package for previous versions on PHP 7</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14808">PHPBB3-14808</a>] - Add template event overall_header_searchbox_after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14817">PHPBB3-14817</a>] - Add core event on includes/functions_download.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14825">PHPBB3-14825</a>] - Add OAuth events</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14827">PHPBB3-14827</a>] - Possibility to add multiple form keys</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14842">PHPBB3-14842</a>] - Avatar size 0 - unlimited</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14847">PHPBB3-14847</a>] - Add php event to add options in ACP Attachments</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14848">PHPBB3-14848</a>] - Add ACP template events after extensions list titles</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14849">PHPBB3-14849</a>] - Add ACP extension event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14850">PHPBB3-14850</a>] - Add core events for smilies</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14852">PHPBB3-14852</a>] - Add core event to the function build_header()</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14853">PHPBB3-14853</a>] - Add core event to allow modifying PM attachments download auth</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14855">PHPBB3-14855</a>] - Update notifications and PM alert bubbles</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14870">PHPBB3-14870</a>] - Add php events to modify list of PMs</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14872">PHPBB3-14872</a>] - Remove count versus sizeof restriction in coding guidelines</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14874">PHPBB3-14874</a>] - Error on sending a .pak smiley</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14882">PHPBB3-14882</a>] - Add core event to MCP after move posts sync</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14887">PHPBB3-14887</a>] - ACP profile step 1 lang specific event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14918">PHPBB3-14918</a>] - Provide quick access to extension version metadata</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14940">PHPBB3-14940</a>] - Add ACP template event acp_ext_details_end</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14957">PHPBB3-14957</a>] - Do not cache database config</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14958">PHPBB3-14958</a>] - Twig extension function lang() performs redundant template data copying</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15020">PHPBB3-15020</a>] - Add Events for mcp_topic_postrow_post_subject</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15059">PHPBB3-15059</a>] - Do not wrap content in code box</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15081">PHPBB3-15081</a>] - Add ACP template event acp_ext_details_notice</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15107">PHPBB3-15107</a>] - Add additional vars to event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15131">PHPBB3-15131</a>] - Add variable to the 'core.mcp_main_modify_fork_sql' event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15142">PHPBB3-15142</a>] - Extension Version Check Should Support Branches</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15151">PHPBB3-15151</a>] - ACP Cookie settings should contain explanatory text for all fields</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15199">PHPBB3-15199</a>] - Add core event to the function send() in the messenger</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15200">PHPBB3-15200</a>] - Allow extensions using custom templates for help/faq controllers </li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15205">PHPBB3-15205</a>] - Add template events to forumlist_body.html</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15219">PHPBB3-15219</a>] - Add cron to update passwords hashes to bcrypt</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15226">PHPBB3-15226</a>] - Add index for latest topics query in feeds</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15237">PHPBB3-15237</a>] - Unguarded includes functions_user</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15238">PHPBB3-15238</a>] - Add console command to fix left/right IDs for the forums and modules</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15241">PHPBB3-15241</a>] - Add ACP template event acp_profile_contact_last</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15250">PHPBB3-15250</a>] - Add core event to MCP at the end of merge_posts</li> + </ul> + <h4>New Feature</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12545">PHPBB3-12545</a>] - new pre-posting event</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13730">PHPBB3-13730</a>] - [PHP] - core.delete_post_end</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14390">PHPBB3-14390</a>] - [prosilver] - ucp_main_front_user_details_after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14498">PHPBB3-14498</a>] - Not possible to deactivate display of "who is online" and birthdays for guests</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14662">PHPBB3-14662</a>] - [Template] - memberlist_team_username_prepend & append</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14868">PHPBB3-14868</a>] - [Template] - mcp_forum_modify_select_after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-14996">PHPBB3-14996</a>] - [event] - Add Event search_results_topictitle_after</li> + </ul> + <h4>Sub-task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-13149">PHPBB3-13149</a>] - [Event] - core.phpbb_log_get_topic_auth_sql_before</li> + </ul> + <h4>Task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-15178">PHPBB3-15178</a>] - Update 3.1.x dependencies</li> + </ul> + <a name="v319"></a><h3>Changes since 3.1.9</h3> <h4>Bug</h4> diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index eb0fb60de2..56b71006c7 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -1123,9 +1123,6 @@ append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp; <ul> <li> - <p>Use <code>sizeof</code> instead of <code>count</code></p> - </li> - <li> <p>Use <code>strpos</code> instead of <code>strstr</code></p> </li> <li> diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index 0ebaf8f3e0..417666c09e 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -58,12 +58,36 @@ acp_email_options_after * Since: 3.1.2-RC1 * Purpose: Add settings to mass email form +acp_ext_details_end +=== +* Location: adm/style/acp_ext_details.html +* Since: 3.1.11-RC1 +* Purpose: Add more detailed information on extension after the available information. + +acp_ext_details_notice +=== +* Location: adm/style/acp_ext_details.html +* Since: 3.1.11-RC1 +* Purpose: Add extension detail notices after version check information. + +acp_ext_list_disabled_name_after +=== +* Location: adm/style/acp_ext_list.html +* Since: 3.1.11-RC1 +* Purpose: Add content after the name of disabled extensions in the list + acp_ext_list_disabled_title_after === * Location: adm/style/acp_ext_list.html * Since: 3.1.11-RC1 * Purpose: Add text after disabled extensions section title. +acp_ext_list_enabled_name_after +=== +* Location: adm/style/acp_ext_list.html +* Since: 3.1.11-RC1 +* Purpose: Add content after the name of enabled extensions in the list + acp_ext_list_enabled_title_after === * Location: adm/style/acp_ext_list.html @@ -369,6 +393,20 @@ acp_profile_contact_before * Since: 3.1.6-RC1 * Purpose: Add extra options to custom profile field configuration in the ACP +acp_profile_contact_last +=== +* Locations: + + adm/style/acp_profile.html +* Since: 3.1.11-RC1 +* Purpose: Add contact specific options to custom profile fields in the ACP + +acp_profile_step_one_lang_after +=== +* Locations: + + adm/style/acp_profile.html +* Since: 3.1.11-RC1 +* Purpose: Add extra lang specific options to custom profile field step one configuration in the ACP + acp_prune_forums_append === * Locations: @@ -662,6 +700,22 @@ forumlist_body_last_post_title_prepend * Since: 3.1.0-a1 * Purpose: Add content before the post title of the latest post in a forum on the forum list. +forumlist_body_subforum_link_append +=== +* Locations: + + styles/prosilver/template/forumlist_body.html + + styles/subsilver2/template/forumlist_body.html +* Since: 3.1.11-RC1 +* Purpose: Add content at the end of subforum link item. + +forumlist_body_subforum_link_prepend +=== +* Locations: + + styles/prosilver/template/forumlist_body.html + + styles/subsilver2/template/forumlist_body.html +* Since: 3.1.11-RC1 +* Purpose: Add content at the start of subforum link item. + forumlist_body_subforums_after === * Locations: @@ -686,6 +740,14 @@ forumlist_body_last_row_after * Since: 3.1.0-b2 * Purpose: Add content after the very last row of the forum list. +index_body_birthday_block_before +=== +* Locations: + + styles/prosilver/template/index_body.html + + styles/subsilver2/template/index_body.html +* Since: 3.1.11-RC1 +* Purpose: Add new statistic blocks before the Birthday block + index_body_block_birthday_append === * Locations: @@ -814,6 +876,14 @@ mcp_forum_actions_after * Since: 3.1.11-RC1 * Purpose: Add some information after actions fieldset +mcp_forum_actions_append +=== +* Locations: + + styles/prosilver/template/mcp_forum.html + + styles/subsilver2/template/mcp_forum.html +* Since: 3.1.11-RC1 +* Purpose: Add additional options to actions select + mcp_forum_actions_before === * Locations: @@ -926,6 +996,20 @@ mcp_topic_postrow_post_details_before * Since: 3.1.10-RC1 * Purpose: Add content before post details in topic moderation +mcp_topic_postrow_post_subject_after +=== +* Locations: + + styles/prosilver/template/mcp_topic.html +* Since: 3.1.11-RC1 +* Purpose: Add content after post subject in topic moderation + +mcp_topic_postrow_post_subject_before +=== +* Locations: + + styles/prosilver/template/mcp_topic.html +* Since: 3.1.11-RC1 +* Purpose: Add content before post subject in topic moderation + mcp_topic_topic_title_after === * Locations: @@ -1042,6 +1126,22 @@ memberlist_search_sorting_options_before * Since: 3.1.2-RC1 * Purpose: Add information before the search sorting options field. +memberlist_team_username_append +=== +* Locations: + + styles/prosilver/template/memberlist_team.html + + styles/subsilver2/template/memberlist_team.html +* Since: 3.1.11-RC1 +* Purpose: Append information to username of team member + +memberlist_team_username_prepend +=== +* Locations: + + styles/prosilver/template/memberlist_team.html + + styles/subsilver2/template/memberlist_team.html +* Since: 3.1.11-RC1 +* Purpose: Add information before team user username + memberlist_view_contact_after === * Locations: @@ -1914,6 +2014,13 @@ search_results_topic_before * Since: 3.1.0-b4 * Purpose: Add data before search result topics +search_results_topic_title_after +=== +* Locations: + + styles/prosilver/template/search_results.html +* Since: 3.1.11-RC1 +* Purpose: Add data after search results topic title + simple_footer_after === * Locations: @@ -2009,6 +2116,14 @@ ucp_main_front_user_activity_after * Since: 3.1.6-RC1 * Purpose: Add content right after the user activity info viewing UCP front page +ucp_main_front_user_activity_append +=== +* Locations: + + styles/prosilver/template/ucp_main_front.html + + styles/subsilver2/template/ucp_main_front.html +* Since: 3.1.11-RC1 +* Purpose: Add content after last user activity info viewing UCP front page + ucp_main_front_user_activity_before === * Locations: @@ -2017,6 +2132,14 @@ ucp_main_front_user_activity_before * Since: 3.1.6-RC1 * Purpose: Add content right before the user activity info viewing UCP front page +ucp_main_front_user_activity_prepend +=== +* Locations: + + styles/prosilver/template/ucp_main_front.html + + styles/subsilver2/template/ucp_main_front.html +* Since: 3.1.11-RC1 +* Purpose: Add content before first user activity info viewing UCP front page + ucp_pm_history_post_buttons_after === * Locations: @@ -2113,6 +2236,13 @@ ucp_pm_viewmessage_custom_fields_before * Purpose: Add data before the custom fields on the user profile when viewing a private message +ucp_pm_viewmessage_options_before +=== +* Locations: + + styles/prosilver/template/ucp_pm_viewmessage.html +* Since: 3.1.11-RC1 +* Purpose: Add content right before display options + ucp_pm_viewmessage_post_buttons_after === * Locations: @@ -2271,6 +2401,14 @@ ucp_profile_register_details_after * Since: 3.1.4-RC1 * Purpose: Add options in profile page fieldset - after confirm password field. +ucp_register_buttons_before +=== +* Locations: + + styles/prosilver/template/ucp_register.html + + styles/subsilver2/template/ucp_register.html +* Since: 3.1.11-RC1 +* Purpose: Add content before buttons in registration form. + ucp_register_credentials_before === * Locations: diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 56ea273d5c..e60ffad6b0 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -262,7 +262,7 @@ else * @var string mode Download mode * @var bool thumbnail Flag indicating if the file is a thumbnail * @since 3.1.6-RC1 - * @change 3.1.7-RC1 Fixing wrong name of a variable (replacing "extension" by "extensions") + * @changed 3.1.7-RC1 Fixing wrong name of a variable (replacing "extension" by "extensions") */ $vars = array( 'attach_id', diff --git a/phpBB/faq.php b/phpBB/faq.php index 5fe155eab0..cf34ce809a 100644 --- a/phpBB/faq.php +++ b/phpBB/faq.php @@ -25,6 +25,7 @@ $auth->acl($user->data); $user->setup(); $mode = request_var('mode', ''); +$template_file = 'faq_body.html'; // Load the appropriate faq file switch ($mode) @@ -47,13 +48,16 @@ switch ($mode) * @var string lang_file Language file containing the help data * @var string ext_name Vendor and extension name where the help * language file can be loaded from + * @var string template_file Template file name * @since 3.1.4-RC1 + * @changed 3.1.11-RC1 Added template_file var */ $vars = array( 'page_title', 'mode', 'lang_file', 'ext_name', + 'template_file', ); extract($phpbb_dispatcher->trigger_event('core.faq_mode_validation', compact($vars))); @@ -106,7 +110,7 @@ $template->assign_vars(array( page_header($l_title); $template->set_filenames(array( - 'body' => 'faq_body.html') + 'body' => $template_file) ); make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx")); diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index e004d2e81f..5c3c7f30aa 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -26,7 +26,7 @@ if (!defined('IN_PHPBB')) class acp_board { var $u_action; - var $new_config = array(); + var $new_config; function main($id, $mode) { @@ -318,9 +318,9 @@ class acp_board 'title' => 'ACP_COOKIE_SETTINGS', 'vars' => array( 'legend1' => 'ACP_COOKIE_SETTINGS', - 'cookie_domain' => array('lang' => 'COOKIE_DOMAIN', 'validate' => 'string', 'type' => 'text::255', 'explain' => false), - 'cookie_name' => array('lang' => 'COOKIE_NAME', 'validate' => 'string', 'type' => 'text::16', 'explain' => false), - 'cookie_path' => array('lang' => 'COOKIE_PATH', 'validate' => 'string', 'type' => 'text::255', 'explain' => false), + 'cookie_domain' => array('lang' => 'COOKIE_DOMAIN', 'validate' => 'string', 'type' => 'text::255', 'explain' => true), + 'cookie_name' => array('lang' => 'COOKIE_NAME', 'validate' => 'string', 'type' => 'text::16', 'explain' => true), + 'cookie_path' => array('lang' => 'COOKIE_PATH', 'validate' => 'string', 'type' => 'text::255', 'explain' => true), 'cookie_secure' => array('lang' => 'COOKIE_SECURE', 'validate' => 'bool', 'type' => 'radio:disabled_enabled', 'explain' => true), ) ); @@ -454,6 +454,9 @@ class acp_board 'smtp_auth_method' => array('lang' => 'SMTP_AUTH_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'mail_auth_select', 'explain' => true), 'smtp_username' => array('lang' => 'SMTP_USERNAME', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true), 'smtp_password' => array('lang' => 'SMTP_PASSWORD', 'validate' => 'string', 'type' => 'password:25:255', 'explain' => true), + 'smtp_verify_peer' => array('lang' => 'SMTP_VERIFY_PEER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'smtp_verify_peer_name' => array('lang' => 'SMTP_VERIFY_PEER_NAME', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'smtp_allow_self_signed'=> array('lang' => 'SMTP_ALLOW_SELF_SIGNED','validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'legend3' => 'ACP_SUBMIT_CHANGES', ) @@ -482,7 +485,7 @@ class acp_board $user->add_lang($display_vars['lang']); } - $this->new_config = $config; + $this->new_config = clone $config; $cfg_array = (isset($_REQUEST['config'])) ? utf8_normalize_nfc(request_var('config', array('' => ''), true)) : $this->new_config; $error = array(); @@ -1017,7 +1020,7 @@ class acp_board $user->timezone = $old_tz; return "<select name=\"dateoptions\" id=\"dateoptions\" onchange=\"if (this.value == 'custom') { document.getElementById('" . addslashes($key) . "').value = '" . addslashes($value) . "'; } else { document.getElementById('" . addslashes($key) . "').value = this.value; }\">$dateformat_options</select> - <input type=\"text\" name=\"config[$key]\" id=\"$key\" value=\"$value\" maxlength=\"30\" />"; + <input type=\"text\" name=\"config[$key]\" id=\"$key\" value=\"$value\" maxlength=\"64\" />"; } /** diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index f97711d69d..f0348817c8 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -22,55 +22,81 @@ if (!defined('IN_PHPBB')) class acp_extensions { var $u_action; + var $tpl_name; + var $page_title; - private $db; private $config; private $template; private $user; private $cache; private $log; private $request; + private $phpbb_dispatcher; + private $ext_manager; function main() { // Start the page - global $config, $user, $template, $request, $phpbb_extension_manager, $db, $phpbb_root_path, $phpEx, $phpbb_log, $cache; + global $config, $user, $template, $request, $phpbb_extension_manager, $phpbb_root_path, $phpEx, $phpbb_log, $cache, $phpbb_dispatcher; - $this->db = $db; $this->config = $config; $this->template = $template; $this->user = $user; $this->cache = $cache; $this->request = $request; $this->log = $phpbb_log; + $this->phpbb_dispatcher = $phpbb_dispatcher; + $this->ext_manager = $phpbb_extension_manager; - $user->add_lang(array('install', 'acp/extensions', 'migrator')); + $this->user->add_lang(array('install', 'acp/extensions', 'migrator')); $this->page_title = 'ACP_EXTENSIONS'; - $action = $request->variable('action', 'list'); - $ext_name = $request->variable('ext_name', ''); + $action = $this->request->variable('action', 'list'); + $ext_name = $this->request->variable('ext_name', ''); // What is a safe limit of execution time? Half the max execution time should be safe. $safe_time_limit = (ini_get('max_execution_time') / 2); $start_time = time(); // Cancel action - if ($request->is_set_post('cancel')) + if ($this->request->is_set_post('cancel')) { $action = 'list'; $ext_name = ''; } - if (in_array($action, array('enable', 'disable', 'delete_data')) && !check_link_hash($request->variable('hash', ''), $action . '.' . $ext_name)) + if (in_array($action, array('enable', 'disable', 'delete_data')) && !check_link_hash($this->request->variable('hash', ''), $action . '.' . $ext_name)) { trigger_error('FORM_INVALID', E_USER_WARNING); } + /** + * Event to run a specific action on extension + * + * @event core.acp_extensions_run_action_before + * @var string action Action to run; if the event completes execution of the action, should be set to 'none' + * @var string u_action Url we are at + * @var string ext_name Extension name from request + * @var int safe_time_limit Safe limit of execution time + * @var int start_time Start time + * @var string tpl_name Template file to load + * @since 3.1.11-RC1 + * @changed 3.2.1-RC1 Renamed to core.acp_extensions_run_action_before, added tpl_name, added action 'none' + */ + $u_action = $this->u_action; + $tpl_name = ''; + $vars = array('action', 'u_action', 'ext_name', 'safe_time_limit', 'start_time', 'tpl_name'); + extract($this->phpbb_dispatcher->trigger_event('core.acp_extensions_run_action_before', compact($vars))); + + // In case they have been updated by the event + $this->u_action = $u_action; + $this->tpl_name = $tpl_name; + // If they've specified an extension, let's load the metadata manager and validate it. if ($ext_name) { - $md_manager = new \phpbb\extension\metadata_manager($ext_name, $config, $phpbb_extension_manager, $template, $user, $phpbb_root_path); + $md_manager = $this->ext_manager->create_extension_metadata_manager($ext_name, $this->template); try { @@ -85,6 +111,10 @@ class acp_extensions // What are we doing? switch ($action) { + case 'none': + // Intentionally empty, used by extensions that execute additional actions in the prior event + break; + case 'set_config_version_check_force_unstable': $force_unstable = $this->request->variable('force_unstable', false); @@ -94,12 +124,12 @@ class acp_extensions 'force_unstable' => $force_unstable, )); - confirm_box(false, $user->lang('EXTENSION_FORCE_UNSTABLE_CONFIRM'), $s_hidden_fields); + confirm_box(false, $this->user->lang('EXTENSION_FORCE_UNSTABLE_CONFIRM'), $s_hidden_fields); } else { - $config->set('extension_force_unstable', false); - trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); + $this->config->set('extension_force_unstable', false); + trigger_error($this->user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); } break; @@ -107,17 +137,17 @@ class acp_extensions default: if (confirm_box(true)) { - $config->set('extension_force_unstable', true); - trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); + $this->config->set('extension_force_unstable', true); + trigger_error($this->user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); } - $this->list_enabled_exts($phpbb_extension_manager); - $this->list_disabled_exts($phpbb_extension_manager); - $this->list_available_exts($phpbb_extension_manager); + $this->list_enabled_exts(); + $this->list_disabled_exts(); + $this->list_available_exts(); $this->template->assign_vars(array( 'U_VERSIONCHECK_FORCE' => $this->u_action . '&action=list&versioncheck_force=1', - 'FORCE_UNSTABLE' => $config['extension_force_unstable'], + 'FORCE_UNSTABLE' => $this->config['extension_force_unstable'], 'U_ACTION' => $this->u_action, )); @@ -125,30 +155,29 @@ class acp_extensions break; case 'enable_pre': - if (!$md_manager->validate_dir()) + try { - trigger_error($user->lang['EXTENSION_DIR_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + $md_manager->validate_enable(); } - - if (!$md_manager->validate_enable()) + catch (\phpbb\extension\exception $e) { - trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error($e . adm_back_link($this->u_action), E_USER_WARNING); } - $extension = $phpbb_extension_manager->get_extension($ext_name); + $extension = $this->ext_manager->get_extension($ext_name); if (!$extension->is_enableable()) { - trigger_error($user->lang['EXTENSION_NOT_ENABLEABLE'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error($this->user->lang['EXTENSION_NOT_ENABLEABLE'] . adm_back_link($this->u_action), E_USER_WARNING); } - if ($phpbb_extension_manager->is_enabled($ext_name)) + if ($this->ext_manager->is_enabled($ext_name)) { redirect($this->u_action); } $this->tpl_name = 'acp_ext_enable'; - $template->assign_vars(array( + $this->template->assign_vars(array( 'PRE' => true, 'L_CONFIRM_MESSAGE' => $this->user->lang('EXTENSION_ENABLE_CONFIRM', $md_manager->get_metadata('display-name')), 'U_ENABLE' => $this->u_action . '&action=enable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('enable.' . $ext_name), @@ -156,57 +185,65 @@ class acp_extensions break; case 'enable': - if (!$md_manager->validate_dir()) + try { - trigger_error($user->lang['EXTENSION_DIR_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + $md_manager->validate_enable(); } - - if (!$md_manager->validate_enable()) + catch (\phpbb\extension\exception $e) { - trigger_error($user->lang['EXTENSION_NOT_AVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error($e . adm_back_link($this->u_action), E_USER_WARNING); } - $extension = $phpbb_extension_manager->get_extension($ext_name); + $extension = $this->ext_manager->get_extension($ext_name); if (!$extension->is_enableable()) { - trigger_error($user->lang['EXTENSION_NOT_ENABLEABLE'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error($this->user->lang['EXTENSION_NOT_ENABLEABLE'] . adm_back_link($this->u_action), E_USER_WARNING); } try { - while ($phpbb_extension_manager->enable_step($ext_name)) + while ($this->ext_manager->enable_step($ext_name)) { // Are we approaching the time limit? If so we want to pause the update and continue after refreshing if ((time() - $start_time) >= $safe_time_limit) { - $template->assign_var('S_NEXT_STEP', true); + $this->template->assign_var('S_NEXT_STEP', true); meta_refresh(0, $this->u_action . '&action=enable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('enable.' . $ext_name)); } } - $this->log->add('admin', $user->data['user_id'], $user->ip, 'LOG_EXT_ENABLE', time(), array($ext_name)); + + // Update custom style for admin area + $this->template->set_custom_style(array( + array( + 'name' => 'adm', + 'ext_path' => 'adm/style/', + ), + ), array($phpbb_root_path . 'adm/style')); + + $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_EXT_ENABLE', time(), array($ext_name)); } catch (\phpbb\db\migration\exception $e) { - $template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($user)); + $this->template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($this->user)); } $this->tpl_name = 'acp_ext_enable'; - $template->assign_vars(array( + $this->template->assign_vars(array( 'U_RETURN' => $this->u_action . '&action=list', )); break; case 'disable_pre': - if (!$phpbb_extension_manager->is_enabled($ext_name)) + if (!$this->ext_manager->is_enabled($ext_name)) { redirect($this->u_action); } $this->tpl_name = 'acp_ext_disable'; - $template->assign_vars(array( + $this->template->assign_vars(array( 'PRE' => true, 'L_CONFIRM_MESSAGE' => $this->user->lang('EXTENSION_DISABLE_CONFIRM', $md_manager->get_metadata('display-name')), 'U_DISABLE' => $this->u_action . '&action=disable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('disable.' . $ext_name), @@ -214,38 +251,38 @@ class acp_extensions break; case 'disable': - if (!$phpbb_extension_manager->is_enabled($ext_name)) + if (!$this->ext_manager->is_enabled($ext_name)) { redirect($this->u_action); } - while ($phpbb_extension_manager->disable_step($ext_name)) + while ($this->ext_manager->disable_step($ext_name)) { // Are we approaching the time limit? If so we want to pause the update and continue after refreshing if ((time() - $start_time) >= $safe_time_limit) { - $template->assign_var('S_NEXT_STEP', true); + $this->template->assign_var('S_NEXT_STEP', true); meta_refresh(0, $this->u_action . '&action=disable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('disable.' . $ext_name)); } } - $this->log->add('admin', $user->data['user_id'], $user->ip, 'LOG_EXT_DISABLE', time(), array($ext_name)); + $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_EXT_DISABLE', time(), array($ext_name)); $this->tpl_name = 'acp_ext_disable'; - $template->assign_vars(array( + $this->template->assign_vars(array( 'U_RETURN' => $this->u_action . '&action=list', )); break; case 'delete_data_pre': - if ($phpbb_extension_manager->is_enabled($ext_name)) + if ($this->ext_manager->is_enabled($ext_name)) { redirect($this->u_action); } $this->tpl_name = 'acp_ext_delete_data'; - $template->assign_vars(array( + $this->template->assign_vars(array( 'PRE' => true, 'L_CONFIRM_MESSAGE' => $this->user->lang('EXTENSION_DELETE_DATA_CONFIRM', $md_manager->get_metadata('display-name')), 'U_PURGE' => $this->u_action . '&action=delete_data&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('delete_data.' . $ext_name), @@ -253,33 +290,33 @@ class acp_extensions break; case 'delete_data': - if ($phpbb_extension_manager->is_enabled($ext_name)) + if ($this->ext_manager->is_enabled($ext_name)) { redirect($this->u_action); } try { - while ($phpbb_extension_manager->purge_step($ext_name)) + while ($this->ext_manager->purge_step($ext_name)) { // Are we approaching the time limit? If so we want to pause the update and continue after refreshing if ((time() - $start_time) >= $safe_time_limit) { - $template->assign_var('S_NEXT_STEP', true); + $this->template->assign_var('S_NEXT_STEP', true); meta_refresh(0, $this->u_action . '&action=delete_data&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('delete_data.' . $ext_name)); } } - $this->log->add('admin', $user->data['user_id'], $user->ip, 'LOG_EXT_PURGE', time(), array($ext_name)); + $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_EXT_PURGE', time(), array($ext_name)); } catch (\phpbb\db\migration\exception $e) { - $template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($user)); + $this->template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($this->user)); } $this->tpl_name = 'acp_ext_delete_data'; - $template->assign_vars(array( + $this->template->assign_vars(array( 'U_RETURN' => $this->u_action . '&action=list', )); break; @@ -290,28 +327,25 @@ class acp_extensions try { - $updates_available = $this->version_check($md_manager, $request->variable('versioncheck_force', false)); + $updates_available = $this->version_check($md_manager, $this->request->variable('versioncheck_force', false)); - $template->assign_vars(array( + $this->template->assign_vars(array( 'S_UP_TO_DATE' => empty($updates_available), 'S_VERSIONCHECK' => true, 'UP_TO_DATE_MSG' => $this->user->lang(empty($updates_available) ? 'UP_TO_DATE' : 'NOT_UP_TO_DATE', $md_manager->get_metadata('display-name')), )); - foreach ($updates_available as $branch => $version_data) - { - $template->assign_block_vars('updates_available', $version_data); - } + $this->template->assign_block_vars('updates_available', $updates_available); } catch (\RuntimeException $e) { - $template->assign_vars(array( + $this->template->assign_vars(array( 'S_VERSIONCHECK_STATUS' => $e->getCode(), - 'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== $user->lang('VERSIONCHECK_FAIL')) ? $e->getMessage() : '', + 'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== $this->user->lang('VERSIONCHECK_FAIL')) ? $e->getMessage() : '', )); } - $template->assign_vars(array( + $this->template->assign_vars(array( 'U_BACK' => $this->u_action . '&action=list', 'U_VERSIONCHECK_FORCE' => $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')), )); @@ -319,21 +353,41 @@ class acp_extensions $this->tpl_name = 'acp_ext_details'; break; } + + /** + * Event to run after a specific action on extension has completed + * + * @event core.acp_extensions_run_action_after + * @var string action Action that has run + * @var string u_action Url we are at + * @var string ext_name Extension name from request + * @var int safe_time_limit Safe limit of execution time + * @var int start_time Start time + * @var string tpl_name Template file to load + * @since 3.1.11-RC1 + */ + $u_action = $this->u_action; + $tpl_name = $this->tpl_name; + $vars = array('action', 'u_action', 'ext_name', 'safe_time_limit', 'start_time', 'tpl_name'); + extract($this->phpbb_dispatcher->trigger_event('core.acp_extensions_run_action_after', compact($vars))); + + // In case they have been updated by the event + $this->u_action = $u_action; + $this->tpl_name = $tpl_name; } /** * Lists all the enabled extensions and dumps to the template * - * @param $phpbb_extension_manager An instance of the extension manager * @return null */ - public function list_enabled_exts(\phpbb\extension\manager $phpbb_extension_manager) + public function list_enabled_exts() { $enabled_extension_meta_data = array(); - foreach ($phpbb_extension_manager->all_enabled() as $name => $location) + foreach ($this->ext_manager->all_enabled() as $name => $location) { - $md_manager = $phpbb_extension_manager->create_extension_metadata_manager($name, $this->template); + $md_manager = $this->ext_manager->create_extension_metadata_manager($name, $this->template); try { @@ -381,16 +435,15 @@ class acp_extensions /** * Lists all the disabled extensions and dumps to the template * - * @param $phpbb_extension_manager An instance of the extension manager * @return null */ - public function list_disabled_exts(\phpbb\extension\manager $phpbb_extension_manager) + public function list_disabled_exts() { $disabled_extension_meta_data = array(); - foreach ($phpbb_extension_manager->all_disabled() as $name => $location) + foreach ($this->ext_manager->all_disabled() as $name => $location) { - $md_manager = $phpbb_extension_manager->create_extension_metadata_manager($name, $this->template); + $md_manager = $this->ext_manager->create_extension_metadata_manager($name, $this->template); try { @@ -439,18 +492,17 @@ class acp_extensions /** * Lists all the available extensions and dumps to the template * - * @param $phpbb_extension_manager An instance of the extension manager * @return null */ - public function list_available_exts(\phpbb\extension\manager $phpbb_extension_manager) + public function list_available_exts() { - $uninstalled = array_diff_key($phpbb_extension_manager->all_available(), $phpbb_extension_manager->all_configured()); + $uninstalled = array_diff_key($this->ext_manager->all_available(), $this->ext_manager->all_configured()); $available_extension_meta_data = array(); foreach ($uninstalled as $name => $location) { - $md_manager = $phpbb_extension_manager->create_extension_metadata_manager($name, $this->template); + $md_manager = $this->ext_manager->create_extension_metadata_manager($name, $this->template); try { @@ -519,7 +571,7 @@ class acp_extensions * @param \phpbb\extension\metadata_manager $md_manager The metadata manager for the version to check. * @param bool $force_update Ignores cached data. Defaults to false. * @param bool $force_cache Force the use of the cache. Override $force_update. - * @return string + * @return array * @throws RuntimeException */ protected function version_check(\phpbb\extension\metadata_manager $md_manager, $force_update = false, $force_cache = false) @@ -538,7 +590,7 @@ class acp_extensions $version_helper->set_file_location($version_check['host'], $version_check['directory'], $version_check['filename'], isset($version_check['ssl']) ? $version_check['ssl'] : false); $version_helper->force_stability($this->config['extension_force_unstable'] ? 'unstable' : null); - return $updates = $version_helper->get_suggested_updates($force_update, $force_cache); + return $version_helper->get_ext_update_on_branch($force_update, $force_cache); } /** diff --git a/phpBB/includes/acp/acp_jabber.php b/phpBB/includes/acp/acp_jabber.php index a482b41e1d..3b958c0ea1 100644 --- a/phpBB/includes/acp/acp_jabber.php +++ b/phpBB/includes/acp/acp_jabber.php @@ -50,13 +50,16 @@ class acp_jabber $this->tpl_name = 'acp_jabber'; $this->page_title = 'ACP_JABBER_SETTINGS'; - $jab_enable = request_var('jab_enable', (bool) $config['jab_enable']); - $jab_host = request_var('jab_host', (string) $config['jab_host']); - $jab_port = request_var('jab_port', (int) $config['jab_port']); - $jab_username = request_var('jab_username', (string) $config['jab_username']); - $jab_password = request_var('jab_password', (string) $config['jab_password']); - $jab_package_size = request_var('jab_package_size', (int) $config['jab_package_size']); - $jab_use_ssl = request_var('jab_use_ssl', (bool) $config['jab_use_ssl']); + $jab_enable = request_var('jab_enable', (bool) $config['jab_enable']); + $jab_host = request_var('jab_host', (string) $config['jab_host']); + $jab_port = request_var('jab_port', (int) $config['jab_port']); + $jab_username = request_var('jab_username', (string) $config['jab_username']); + $jab_password = request_var('jab_password', (string) $config['jab_password']); + $jab_package_size = request_var('jab_package_size', (int) $config['jab_package_size']); + $jab_use_ssl = request_var('jab_use_ssl', (bool) $config['jab_use_ssl']); + $jab_verify_peer = request_var('jab_verify_peer', (bool) $config['jab_verify_peer']); + $jab_verify_peer_name = request_var('jab_verify_peer_name', (bool) $config['jab_verify_peer_name']); + $jab_allow_self_signed = request_var('jab_allow_self_signed', (bool) $config['jab_allow_self_signed']); $form_name = 'acp_jabber'; add_form_key($form_name); @@ -76,7 +79,7 @@ class acp_jabber // Is this feature enabled? Then try to establish a connection if ($jab_enable) { - $jabber = new jabber($jab_host, $jab_port, $jab_username, $jab_password, $jab_use_ssl); + $jabber = new jabber($jab_host, $jab_port, $jab_username, $jab_password, $jab_use_ssl, $jab_verify_peer, $jab_verify_peer_name, $jab_allow_self_signed); if (!$jabber->connect()) { @@ -116,6 +119,9 @@ class acp_jabber } set_config('jab_package_size', $jab_package_size); set_config('jab_use_ssl', $jab_use_ssl); + set_config('jab_verify_peer', $jab_verify_peer); + set_config('jab_verify_peer_name', $jab_verify_peer_name); + set_config('jab_allow_self_signed', $jab_allow_self_signed); add_log('admin', 'LOG_' . $log); trigger_error($message . adm_back_link($this->u_action)); @@ -131,6 +137,9 @@ class acp_jabber 'JAB_PASSWORD' => $jab_password !== '' ? '********' : '', 'JAB_PACKAGE_SIZE' => $jab_package_size, 'JAB_USE_SSL' => $jab_use_ssl, + 'JAB_VERIFY_PEER' => $jab_verify_peer, + 'JAB_VERIFY_PEER_NAME' => $jab_verify_peer_name, + 'JAB_ALLOW_SELF_SIGNED' => $jab_allow_self_signed, 'S_CAN_USE_SSL' => jabber::can_use_ssl(), 'S_GTALK_NOTE' => (!@function_exists('dns_get_record')) ? true : false, )); diff --git a/phpBB/includes/acp/acp_main.php b/phpBB/includes/acp/acp_main.php index 848cafeb67..6e7bd91a86 100644 --- a/phpBB/includes/acp/acp_main.php +++ b/phpBB/includes/acp/acp_main.php @@ -421,23 +421,33 @@ class acp_main // Version check $user->add_lang('install'); - if ($auth->acl_get('a_server') && version_compare(PHP_VERSION, '5.3.3', '<')) + if ($auth->acl_get('a_server') && version_compare(PHP_VERSION, '5.4.0', '<')) { $template->assign_vars(array( 'S_PHP_VERSION_OLD' => true, - 'L_PHP_VERSION_OLD' => sprintf($user->lang['PHP_VERSION_OLD'], '<a href="https://www.phpbb.com/community/viewtopic.php?f=14&t=2152375">', '</a>'), + 'L_PHP_VERSION_OLD' => sprintf($user->lang['PHP_VERSION_OLD'], PHP_VERSION, '5.4.0', '<a href="https://www.phpbb.com/support/docs/en/3.2/ug/quickstart/requirements">', '</a>'), )); } if ($auth->acl_get('a_board')) { + /** @var \phpbb\version_helper $version_helper */ $version_helper = $phpbb_container->get('version_helper'); try { $recheck = $request->variable('versioncheck_force', false); - $updates_available = $version_helper->get_suggested_updates($recheck); + $updates_available = $version_helper->get_update_on_branch($recheck); + $upgrades_available = $version_helper->get_suggested_updates(); + if (!empty($upgrades_available)) + { + $upgrades_available = array_pop($upgrades_available); + } - $template->assign_var('S_VERSION_UP_TO_DATE', empty($updates_available)); + $template->assign_vars(array( + 'S_VERSION_UP_TO_DATE' => empty($updates_available), + 'S_VERSION_UPGRADEABLE' => !empty($upgrades_available), + 'UPGRADE_INSTRUCTIONS' => !empty($upgrades_available) ? $user->lang('UPGRADE_INSTRUCTIONS', $upgrades_available['current'], $upgrades_available['announcement']) : false, + )); } catch (\RuntimeException $e) { diff --git a/phpBB/includes/acp/acp_permissions.php b/phpBB/includes/acp/acp_permissions.php index 660afb4e93..62e75a2db7 100644 --- a/phpBB/includes/acp/acp_permissions.php +++ b/phpBB/includes/acp/acp_permissions.php @@ -755,6 +755,7 @@ class acp_permissions $this->log_action($mode, 'add', $permission_type, $ug_type, $ug_id, $forum_id); + meta_refresh(5, $this->u_action); trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); } @@ -825,10 +826,12 @@ class acp_permissions if ($mode == 'setting_forum_local' || $mode == 'setting_mod_local') { + meta_refresh(5, $this->u_action . '&forum_id[]=' . implode('&forum_id[]=', $forum_ids)); trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action . '&forum_id[]=' . implode('&forum_id[]=', $forum_ids))); } else { + meta_refresh(5, $this->u_action); trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); } } @@ -899,10 +902,12 @@ class acp_permissions if ($mode == 'setting_forum_local' || $mode == 'setting_mod_local') { + meta_refresh(5, $this->u_action . '&forum_id[]=' . implode('&forum_id[]=', $forum_id)); trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action . '&forum_id[]=' . implode('&forum_id[]=', $forum_id))); } else { + meta_refresh(5, $this->u_action); trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); } } diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index 2012d3c513..9e6cc49522 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -752,6 +752,10 @@ class acp_profile $s_one_need_edit = true; } + if (!isset($this->type_collection[$row['field_type']])) + { + continue; + } $profile_field = $this->type_collection[$row['field_type']]; $template->assign_block_vars('fields', array( 'FIELD_IDENT' => $row['field_ident'], diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 5181b87ecb..c29fb062d8 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -433,6 +433,9 @@ class acp_styles trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); } + // Read style configuration file + $style_cfg = $this->read_style_cfg($style['style_path']); + // Find all available parent styles $list = $this->find_possible_parents($styles, $id); @@ -579,6 +582,7 @@ class acp_styles 'STYLE_ID' => $style['style_id'], 'STYLE_NAME' => htmlspecialchars($style['style_name']), 'STYLE_PATH' => htmlspecialchars($style['style_path']), + 'STYLE_VERSION' => htmlspecialchars($style_cfg['style_version']), 'STYLE_COPYRIGHT' => strip_tags($style['style_copyright']), 'STYLE_PARENT' => $style['style_parent_id'], 'S_STYLE_ACTIVE' => $style['style_active'], diff --git a/phpBB/includes/acp/acp_update.php b/phpBB/includes/acp/acp_update.php index 529f0f2185..cee2ce222e 100644 --- a/phpBB/includes/acp/acp_update.php +++ b/phpBB/includes/acp/acp_update.php @@ -37,7 +37,12 @@ class acp_update try { $recheck = $request->variable('versioncheck_force', false); - $updates_available = $version_helper->get_suggested_updates($recheck); + $updates_available = $version_helper->get_update_on_branch($recheck); + $upgrades_available = $version_helper->get_suggested_updates(); + if (!empty($upgrades_available)) + { + $upgrades_available = array_pop($upgrades_available); + } } catch (\RuntimeException $e) { @@ -46,12 +51,9 @@ class acp_update $updates_available = array(); } - foreach ($updates_available as $branch => $version_data) - { - $template->assign_block_vars('updates_available', $version_data); - } + $template->assign_block_vars('updates_available', $updates_available); - $update_link = append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update'); + $update_link = append_sid($phpbb_root_path . 'install/'); $template->assign_vars(array( 'S_UP_TO_DATE' => empty($updates_available), @@ -61,6 +63,8 @@ class acp_update 'CURRENT_VERSION' => $config['version'], 'UPDATE_INSTRUCTIONS' => sprintf($user->lang['UPDATE_INSTRUCTIONS'], $update_link), + 'S_VERSION_UPGRADEABLE' => !empty($upgrades_available), + 'UPGRADE_INSTRUCTIONS' => !empty($upgrades_available) ? $user->lang('UPGRADE_INSTRUCTIONS', $upgrades_available['current'], $upgrades_available['announcement']) : false, )); // Incomplete update? diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 008cc02471..cd44800af8 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1929,7 +1929,7 @@ class acp_users 'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"', - 'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024), + 'L_AVATAR_EXPLAIN' => $user->lang(($config['avatar_filesize'] == 0) ? 'AVATAR_EXPLAIN_NO_FILESIZE' : 'AVATAR_EXPLAIN', $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024), 'S_AVATARS_ENABLED' => ($config['allow_avatar'] && $avatars_enabled), )); diff --git a/phpBB/includes/acp/info/acp_logs.php b/phpBB/includes/acp/info/acp_logs.php index e9e6034cd4..3b2764c4dc 100644 --- a/phpBB/includes/acp/info/acp_logs.php +++ b/phpBB/includes/acp/info/acp_logs.php @@ -15,16 +15,31 @@ class acp_logs_info { function module() { + global $phpbb_dispatcher; + + $modes = array( + 'admin' => array('title' => 'ACP_ADMIN_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')), + 'mod' => array('title' => 'ACP_MOD_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')), + 'users' => array('title' => 'ACP_USERS_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')), + 'critical' => array('title' => 'ACP_CRITICAL_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')), + ); + + /** + * Event to add or modify ACP log modulemodes + * + * @event core.acp_logs_info_modify_modes + * @var array modes Array with modes info + * @since 3.1.11-RC1 + * @since 3.2.1-RC1 + */ + $vars = array('modes'); + extract($phpbb_dispatcher->trigger_event('core.acp_logs_info_modify_modes', compact($vars))); + return array( 'filename' => 'acp_logs', 'title' => 'ACP_LOGGING', 'version' => '1.0.0', - 'modes' => array( - 'admin' => array('title' => 'ACP_ADMIN_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')), - 'mod' => array('title' => 'ACP_MOD_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')), - 'users' => array('title' => 'ACP_USERS_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')), - 'critical' => array('title' => 'ACP_CRITICAL_LOGS', 'auth' => 'acl_a_viewlogs', 'cat' => array('ACP_FORUM_LOGS')), - ), + 'modes' => $modes, ); } diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 23839e3d9a..79f5a6f30f 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.10'); +define('PHPBB_VERSION', '3.1.11-RC1'); // QA-related // define('PHPBB_QA', 1); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index a152d9b620..ba448f3125 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2776,7 +2776,7 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo $u_action .= ((strpos($u_action, '?') === false) ? '?' : '&') . 'confirm_key=' . $confirm_key; $template->assign_vars(array( - 'MESSAGE_TITLE' => (!isset($user->lang[$title])) ? $user->lang['CONFIRM'] : $user->lang[$title], + 'MESSAGE_TITLE' => (!isset($user->lang[$title])) ? $user->lang['CONFIRM'] : $user->lang($title, 1), 'MESSAGE_TEXT' => (!isset($user->lang[$title . '_CONFIRM'])) ? $title : $user->lang[$title . '_CONFIRM'], 'YES_VALUE' => $user->lang['YES'], diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 1dc246ec33..4bac718999 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -641,8 +641,8 @@ function move_posts($post_ids, $topic_id, $auto_sync = true) * * @event core.move_posts_before * @var array post_ids Array of post ids to move - * @var string topic_id The topic id the posts are moved to - * @var bool auto_sync Whether or not to perform auto sync + * @var int topic_id The topic id the posts are moved to + * @var bool auto_sync Whether or not to perform auto sync * @var array forum_ids Array of the forum ids the posts are moved from * @var array topic_ids Array of the topic ids the posts are moved from * @var array forum_row Array with the forum id of the topic the posts are moved to @@ -673,8 +673,8 @@ function move_posts($post_ids, $topic_id, $auto_sync = true) * * @event core.move_posts_after * @var array post_ids Array of the moved post ids - * @var string topic_id The topic id the posts are moved to - * @var bool auto_sync Whether or not to perform auto sync + * @var int topic_id The topic id the posts are moved to + * @var bool auto_sync Whether or not to perform auto sync * @var array forum_ids Array of the forum ids the posts are moved from * @var array topic_ids Array of the topic ids the posts are moved from * @var array forum_row Array with the forum id of the topic the posts are moved to @@ -698,6 +698,28 @@ function move_posts($post_ids, $topic_id, $auto_sync = true) sync('topic_attachment', 'topic_id', $topic_ids); sync('topic', 'topic_id', $topic_ids, true); sync('forum', 'forum_id', $forum_ids, true, true); + + /** + * Perform additional actions after move post sync + * + * @event core.move_posts_sync_after + * @var array post_ids Array of the moved post ids + * @var int topic_id The topic id the posts are moved to + * @var bool auto_sync Whether or not to perform auto sync + * @var array forum_ids Array of the forum ids the posts are moved from + * @var array topic_ids Array of the topic ids the posts are moved from + * @var array forum_row Array with the forum id of the topic the posts are moved to + * @since 3.1.11-RC1 + */ + $vars = array( + 'post_ids', + 'topic_id', + 'auto_sync', + 'forum_ids', + 'topic_ids', + 'forum_row', + ); + extract($phpbb_dispatcher->trigger_event('core.move_posts_sync_after', compact($vars))); } // Update posted information diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 8e60804d6e..f671f33ed0 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -679,9 +679,11 @@ function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bb * @var string uid The BBCode UID * @var string bitfield The BBCode Bitfield * @var int flags The BBCode Flags + * @var string message_parser The message_parser object * @since 3.1.0-a1 + * @changed 3.1.11-RC1 Added message_parser to vars */ - $vars = array('text', 'uid', 'bitfield', 'flags'); + $vars = array('text', 'uid', 'bitfield', 'flags', 'message_parser'); extract($phpbb_dispatcher->trigger_event('core.modify_text_for_storage_after', compact($vars))); return $message_parser->warn_msg; @@ -980,7 +982,7 @@ function bbcode_nl2br($text) */ function smiley_text($text, $force_option = false) { - global $config, $user, $phpbb_path_helper; + global $config, $user, $phpbb_path_helper, $phpbb_dispatcher; if ($force_option || !$config['allow_smilies'] || !$user->optionget('viewsmilies')) { @@ -989,6 +991,16 @@ function smiley_text($text, $force_option = false) else { $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_path_helper->get_web_root_path(); + + /** + * Event to override the root_path for smilies + * + * @event core.smiley_text_root_path + * @var string root_path root_path for smilies + * @since 3.1.11-RC1 + */ + $vars = array('root_path'); + extract($phpbb_dispatcher->trigger_event('core.smiley_text_root_path', compact($vars))); return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img class="smilies" src="' . $root_path . $config['smilies_path'] . '/\2 />', $text); } } diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 4881dde6f5..3b2d66c2d3 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -646,7 +646,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod * @var array row The data of the forum * @var array subforums_row Template data of subforums * @since 3.1.0-a1 - * @change 3.1.0-b5 Added var subforums_row + * @changed 3.1.0-b5 Added var subforums_row */ $vars = array('forum_row', 'row', 'subforums_row'); extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_template_vars', compact($vars))); @@ -1554,6 +1554,23 @@ function phpbb_get_user_rank($user_data, $user_posts) } } + /** + * Modify a user's rank before displaying + * + * @event core.get_user_rank_after + * @var array user_data Array with user's data + * @var int user_posts User_posts to change + * @var array user_rank_data User rank data + * @since 3.1.11-RC1 + */ + + $vars = array( + 'user_data', + 'user_posts', + 'user_rank_data', + ); + extract($phpbb_dispatcher->trigger_event('core.get_user_rank_after', compact($vars))); + return $user_rank_data; } diff --git a/phpBB/includes/functions_download.php b/phpBB/includes/functions_download.php index c571de579e..053e362682 100644 --- a/phpBB/includes/functions_download.php +++ b/phpBB/includes/functions_download.php @@ -124,7 +124,7 @@ function wrap_img_in_html($src, $title) */ function send_file_to_browser($attachment, $upload_dir, $category) { - global $user, $db, $config, $phpbb_root_path; + global $user, $db, $config, $phpbb_dispatcher, $phpbb_root_path; $filename = $phpbb_root_path . $upload_dir . '/' . $attachment['physical_filename']; @@ -149,6 +149,26 @@ function send_file_to_browser($attachment, $upload_dir, $category) // Now send the File Contents to the Browser $size = @filesize($filename); + /** + * Event to alter attachment before it is sent to browser. + * + * @event core.send_file_to_browser_before + * @var array attachment Attachment data + * @var string upload_dir Relative path of upload directory + * @var int category Attachment category + * @var string filename Path to file, including filename + * @var int size File size + * @since 3.1.11-RC1 + */ + $vars = array( + 'attachment', + 'upload_dir', + 'category', + 'filename', + 'size', + ); + extract($phpbb_dispatcher->trigger_event('core.send_file_to_browser_before', compact($vars))); + // To correctly display further errors we need to make sure we are using the correct headers for both (unsetting content-length may not work) // Check if headers already sent or not able to get the file contents. @@ -677,6 +697,8 @@ function phpbb_download_handle_forum_auth($db, $auth, $topic_id) */ function phpbb_download_handle_pm_auth($db, $auth, $user_id, $msg_id) { + global $phpbb_dispatcher; + if (!$auth->acl_get('u_pm_download')) { send_status_line(403, 'Forbidden'); @@ -685,6 +707,18 @@ function phpbb_download_handle_pm_auth($db, $auth, $user_id, $msg_id) $allowed = phpbb_download_check_pm_auth($db, $user_id, $msg_id); + /** + * Event to modify PM attachments download auth + * + * @event core.modify_pm_attach_download_auth + * @var bool allowed Whether the user is allowed to download from that PM or not + * @var int msg_id The id of the PM to download from + * @var int user_id The user id for auth check + * @since 3.1.11-RC1 + */ + $vars = array('allowed', 'msg_id', 'user_id'); + extract($phpbb_dispatcher->trigger_event('core.modify_pm_attach_download_auth', compact($vars))); + if (!$allowed) { send_status_line(403, 'Forbidden'); diff --git a/phpBB/includes/functions_jabber.php b/phpBB/includes/functions_jabber.php index bd2e9e93ac..c9ec6fea61 100644 --- a/phpBB/includes/functions_jabber.php +++ b/phpBB/includes/functions_jabber.php @@ -41,6 +41,9 @@ class jabber var $username; var $password; var $use_ssl; + var $verify_peer; + var $verify_peer_name; + var $allow_self_signed; var $resource = 'functions_jabber.phpbb.php'; var $enable_logging; @@ -49,8 +52,18 @@ class jabber var $features = array(); /** + * Constructor + * + * @param string $server Jabber server + * @param int $port Jabber server port + * @param string $username Jabber username or JID + * @param string $password Jabber password + * @param boold $use_ssl Use ssl + * @param bool $verify_peer Verify SSL certificate + * @param bool $verify_peer_name Verify Jabber peer name + * @param bool $allow_self_signed Allow self signed certificates */ - function jabber($server, $port, $username, $password, $use_ssl = false) + function __construct($server, $port, $username, $password, $use_ssl = false, $verify_peer = true, $verify_peer_name = true, $allow_self_signed = false) { $this->connect_server = ($server) ? $server : 'localhost'; $this->port = ($port) ? $port : 5222; @@ -71,6 +84,9 @@ class jabber $this->password = $password; $this->use_ssl = ($use_ssl && self::can_use_ssl()) ? true : false; + $this->verify_peer = $verify_peer; + $this->verify_peer_name = $verify_peer_name; + $this->allow_self_signed = $allow_self_signed; // Change port if we use SSL if ($this->port == 5222 && $this->use_ssl) @@ -96,7 +112,7 @@ class jabber */ static public function can_use_tls() { - if (!@extension_loaded('openssl') || !function_exists('stream_socket_enable_crypto') || !function_exists('stream_get_meta_data') || !function_exists('socket_set_blocking') || !function_exists('stream_get_wrappers')) + if (!@extension_loaded('openssl') || !function_exists('stream_socket_enable_crypto') || !function_exists('stream_get_meta_data') || !function_exists('stream_set_blocking') || !function_exists('stream_get_wrappers')) { return false; } @@ -139,7 +155,7 @@ class jabber $this->session['ssl'] = $this->use_ssl; - if ($this->open_socket($this->connect_server, $this->port, $this->use_ssl)) + if ($this->open_socket($this->connect_server, $this->port, $this->use_ssl, $this->verify_peer, $this->verify_peer_name, $this->allow_self_signed)) { $this->send("<?xml version='1.0' encoding='UTF-8' ?" . ">\n"); $this->send("<stream:stream to='{$this->server}' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0'>\n"); @@ -227,10 +243,13 @@ class jabber * @param string $server host to connect to * @param int $port port number * @param bool $use_ssl use ssl or not + * @param bool $verify_peer verify ssl certificate + * @param bool $verify_peer_name verify peer name + * @param bool $allow_self_signed allow self-signed ssl certificates * @access public * @return bool */ - function open_socket($server, $port, $use_ssl = false) + function open_socket($server, $port, $use_ssl, $verify_peer, $verify_peer_name, $allow_self_signed) { if (@function_exists('dns_get_record')) { @@ -241,12 +260,26 @@ class jabber } } - $server = $use_ssl ? 'ssl://' . $server : $server; + $options = array(); - if ($this->connection = @fsockopen($server, $port, $errorno, $errorstr, $this->timeout)) + if ($use_ssl) { - socket_set_blocking($this->connection, 0); - socket_set_timeout($this->connection, 60); + $remote_socket = 'ssl://' . $server . ':' . $port; + + // Set ssl context options, see http://php.net/manual/en/context.ssl.php + $options['ssl'] = array('verify_peer' => $verify_peer, 'verify_peer_name' => $verify_peer_name, 'allow_self_signed' => $allow_self_signed); + } + else + { + $remote_socket = $server . ':' . $port; + } + + $socket_context = stream_context_create($options); + + if ($this->connection = @stream_socket_client($remote_socket, $errorno, $errorstr, $this->timeout, STREAM_CLIENT_CONNECT, $socket_context)) + { + stream_set_blocking($this->connection, 0); + stream_set_timeout($this->connection, 60); return true; } @@ -563,7 +596,7 @@ class jabber case 'proceed': // continue switching to TLS $meta = stream_get_meta_data($this->connection); - socket_set_blocking($this->connection, 1); + stream_set_blocking($this->connection, 1); if (!stream_socket_enable_crypto($this->connection, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) { @@ -571,7 +604,7 @@ class jabber return false; } - socket_set_blocking($this->connection, $meta['blocked']); + stream_set_blocking($this->connection, $meta['blocked']); $this->session['tls'] = true; // new stream diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 9b3ca14101..98975b9d8f 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -312,10 +312,16 @@ class messenger /** * Send the mail out to the recipients set previously in var $this->addresses + * + * @param int $method User notification method NOTIFY_EMAIL|NOTIFY_IM|NOTIFY_BOTH + * @param bool $break Flag indicating if the function only formats the subject + * and the message without sending it + * + * @return bool */ function send($method = NOTIFY_EMAIL, $break = false) { - global $config, $user; + global $config, $user, $phpbb_dispatcher; // We add some standard variables we always use, no need to specify them always $this->assign_vars(array( @@ -324,6 +330,30 @@ class messenger 'SITENAME' => htmlspecialchars_decode($config['sitename']), )); + $subject = $this->subject; + $message = $this->msg; + /** + * Event to modify notification message text before parsing + * + * @event core.modify_notification_message + * @var int method User notification method NOTIFY_EMAIL|NOTIFY_IM|NOTIFY_BOTH + * @var bool break Flag indicating if the function only formats the subject + * and the message without sending it + * @var string subject The message subject + * @var string message The message text + * @since 3.1.11-RC1 + */ + $vars = array( + 'method', + 'break', + 'subject', + 'message', + ); + extract($phpbb_dispatcher->trigger_event('core.modify_notification_message', compact($vars))); + $this->subject = $subject; + $this->msg = $message; + unset($subject, $message); + // Parse message through template $this->msg = trim($this->template->assign_display('body')); @@ -438,7 +468,7 @@ class messenger */ function build_header($to, $cc, $bcc) { - global $config; + global $config, $phpbb_dispatcher; // We could use keys here, but we won't do this for 3.0.x to retain backwards compatibility $headers = array(); @@ -470,6 +500,16 @@ class messenger $headers[] = 'X-MimeOLE: phpBB3'; $headers[] = 'X-phpBB-Origin: phpbb://' . str_replace(array('http://', 'https://'), array('', ''), generate_board_url()); + /** + * Event to modify email header entries + * + * @event core.modify_email_headers + * @var array headers Array containing email header entries + * @since 3.1.11-RC1 + */ + $vars = array('headers'); + extract($phpbb_dispatcher->trigger_event('core.modify_email_headers', compact($vars))); + if (sizeof($this->extra_headers)) { $headers = array_merge($headers, $this->extra_headers); @@ -615,7 +655,7 @@ class messenger if (!$use_queue) { include_once($phpbb_root_path . 'includes/functions_jabber.' . $phpEx); - $this->jabber = new jabber($config['jab_host'], $config['jab_port'], $config['jab_username'], htmlspecialchars_decode($config['jab_password']), $config['jab_use_ssl']); + $this->jabber = new jabber($config['jab_host'], $config['jab_port'], $config['jab_username'], htmlspecialchars_decode($config['jab_password']), $config['jab_use_ssl'], $config['jab_verify_peer'], $config['jab_verify_peer_name'], $config['jab_allow_self_signed']); if (!$this->jabber->connect()) { @@ -790,7 +830,7 @@ class queue } include_once($phpbb_root_path . 'includes/functions_jabber.' . $phpEx); - $this->jabber = new jabber($config['jab_host'], $config['jab_port'], $config['jab_username'], htmlspecialchars_decode($config['jab_password']), $config['jab_use_ssl']); + $this->jabber = new jabber($config['jab_host'], $config['jab_port'], $config['jab_username'], htmlspecialchars_decode($config['jab_password']), $config['jab_use_ssl'], $config['jab_verify_peer'], $config['jab_verify_peer_name'], $config['jab_allow_self_signed']); if (!$this->jabber->connect()) { @@ -1036,7 +1076,18 @@ function smtpmail($addresses, $subject, $message, &$err_msg, $headers = false) } $collector = new \phpbb\error_collector; $collector->install(); - $smtp->socket = fsockopen($config['smtp_host'], $config['smtp_port'], $errno, $errstr, 20); + + $options = array(); + $verify_peer = (bool) $config['smtp_verify_peer']; + $verify_peer_name = (bool) $config['smtp_verify_peer_name']; + $allow_self_signed = (bool) $config['smtp_allow_self_signed']; + $remote_socket = $config['smtp_host'] . ':' . $config['smtp_port']; + + // Set ssl context options, see http://php.net/manual/en/context.ssl.php + $options['ssl'] = array('verify_peer' => $verify_peer, 'verify_peer_name' => $verify_peer_name, 'allow_self_signed' => $allow_self_signed); + $socket_context = stream_context_create($options); + + $smtp->socket = @stream_socket_client($remote_socket, $errno, $errstr, 20, STREAM_CLIENT_CONNECT, $socket_context); $collector->uninstall(); $error_contents = $collector->format_errors(); diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 4a4d2de0fe..9712b6e922 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -119,6 +119,15 @@ function generate_smilies($mode, $forum_id) foreach ($smilies as $row) { + /** + * Modify smiley root path before populating smiley list + * + * @event core.generate_smilies_before + * @var string root_path root_path for smilies + * @since 3.1.11-RC1 + */ + $vars = array('root_path'); + extract($phpbb_dispatcher->trigger_event('core.generate_smilies_before', compact($vars))); $template->assign_block_vars('smiley', array( 'SMILEY_CODE' => $row['code'], 'A_SMILEY_CODE' => addslashes($row['code']), @@ -1306,7 +1315,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id */ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $softdelete_reason = '') { - global $db, $user, $auth, $phpbb_container; + global $db, $user, $auth, $phpbb_container, $phpbb_dispatcher; global $config, $phpEx, $phpbb_root_path; // Specify our post mode @@ -1557,6 +1566,34 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $ sync('topic_reported', 'topic_id', array($topic_id)); } + /** + * This event is used for performing actions directly after a post or topic + * has been deleted. + * + * @event core.delete_post_after + * @var int forum_id Post forum ID + * @var int topic_id Post topic ID + * @var int post_id Post ID + * @var array data Post data + * @var bool is_soft Soft delete flag + * @var string softdelete_reason Soft delete reason + * @var string post_mode delete_topic, delete_first_post, delete_last_post or delete + * @var mixed next_post_id Next post ID in the topic (post ID or false) + * + * @since 3.1.11-RC1 + */ + $vars = array( + 'forum_id', + 'topic_id', + 'post_id', + 'data', + 'is_soft', + 'softdelete_reason', + 'post_mode', + 'next_post_id', + ); + extract($phpbb_dispatcher->trigger_event('core.delete_post_after', compact($vars))); + return $next_post_id; } @@ -2505,7 +2542,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u * @var string url The "Return to topic" URL * * @since 3.1.0-a3 - * @change 3.1.0-RC3 Added vars mode, subject, username, topic_type, + * @changed 3.1.0-RC3 Added vars mode, subject, username, topic_type, * poll, update_message, update_search_index */ $vars = array( @@ -2654,16 +2691,54 @@ function phpbb_upload_popup($forum_style = 0) /** * Do the various checks required for removing posts as well as removing it +* +* @param int $forum_id The id of the forum +* @param int $topic_id The id of the topic +* @param int $post_id The id of the post +* @param array $post_data Array with the post data +* @param bool $is_soft The flag indicating whether it is the soft delete mode +* @param string $delete_reason Description for the post deletion reason +* +* @return null */ function phpbb_handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_soft = false, $delete_reason = '') { global $user, $auth, $config, $request; - global $phpbb_root_path, $phpEx; + global $phpbb_root_path, $phpEx, $phpbb_dispatcher; + $force_delete_allowed = $force_softdelete_allowed = false; $perm_check = ($is_soft) ? 'softdelete' : 'delete'; + /** + * This event allows to modify the conditions for the post deletion + * + * @event core.handle_post_delete_conditions + * @var int forum_id The id of the forum + * @var int topic_id The id of the topic + * @var int post_id The id of the post + * @var array post_data Array with the post data + * @var bool is_soft The flag indicating whether it is the soft delete mode + * @var string delete_reason Description for the post deletion reason + * @var bool force_delete_allowed Allow the user to delete the post (all permissions and conditions are ignored) + * @var bool force_softdelete_allowed Allow the user to softdelete the post (all permissions and conditions are ignored) + * @var string perm_check The deletion mode softdelete|delete + * @since 3.1.11-RC1 + */ + $vars = array( + 'forum_id', + 'topic_id', + 'post_id', + 'post_data', + 'is_soft', + 'delete_reason', + 'force_delete_allowed', + 'force_softdelete_allowed', + 'perm_check', + ); + extract($phpbb_dispatcher->trigger_event('core.handle_post_delete_conditions', compact($vars))); + // If moderator removing post or user itself removing post, present a confirmation screen - if ($auth->acl_get("m_$perm_check", $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get("f_$perm_check", $forum_id) && $post_id == $post_data['topic_last_post_id'] && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time']))) + if ($force_delete_allowed || ($is_soft && $force_softdelete_allowed) || $auth->acl_get("m_$perm_check", $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get("f_$perm_check", $forum_id) && $post_id == $post_data['topic_last_post_id'] && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time']))) { $s_hidden_fields = array( 'p' => $post_id, @@ -2720,10 +2795,10 @@ function phpbb_handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $ } else { - global $user, $template, $request; + global $template; - $can_delete = $auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id)); - $can_softdelete = $auth->acl_get('m_softdelete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_softdelete', $forum_id)); + $can_delete = $force_delete_allowed || ($auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id))); + $can_softdelete = $force_softdelete_allowed || ($auth->acl_get('m_softdelete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_softdelete', $forum_id))); $template->assign_vars(array( 'S_SOFTDELETED' => $post_data['post_visibility'] == ITEM_DELETED, diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 1639eb1a4c..4aad1746d5 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -889,9 +889,16 @@ function update_unread_status($unread, $msg_id, $user_id, $folder_id) SET pm_unread = 0 WHERE msg_id = $msg_id AND user_id = $user_id - AND folder_id = $folder_id"; + AND folder_id = $folder_id + AND pm_unread = 1"; $db->sql_query($sql); + // If the message is already marked as read, we just skip the rest to avoid negative PM count + if (!$db->sql_affectedrows()) + { + return; + } + $sql = 'UPDATE ' . USERS_TABLE . " SET user_unread_privmsg = user_unread_privmsg - 1 WHERE user_id = $user_id"; diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index b82abe0c5e..4aecbff6ba 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -272,13 +272,15 @@ function user_add($user_row, $cp_data = false, $notifications_data = null) * Use this event to modify the values to be inserted when a user is added * * @event core.user_add_modify_data - * @var array user_row Array of user details submited to user_add - * @var array cp_data Array of Custom profile fields submited to user_add - * @var array sql_ary Array of data to be inserted when a user is added + * @var array user_row Array of user details submited to user_add + * @var array cp_data Array of Custom profile fields submited to user_add + * @var array sql_ary Array of data to be inserted when a user is added + * @var array notifications_data Array of notification data to be inserted when a user is added * @since 3.1.0-a1 - * @change 3.1.0-b5 + * @changed 3.1.0-b5 Added user_row and cp_data + * @changed 3.1.11-RC1 Added notifications_data */ - $vars = array('user_row', 'cp_data', 'sql_ary'); + $vars = array('user_row', 'cp_data', 'sql_ary', 'notifications_data'); extract($phpbb_dispatcher->trigger_event('core.user_add_modify_data', compact($vars))); $sql = 'INSERT INTO ' . USERS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); @@ -1291,7 +1293,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas */ function user_unban($mode, $ban) { - global $db, $user, $auth, $cache; + global $db, $user, $auth, $cache, $phpbb_dispatcher; // Delete stale bans $sql = 'DELETE FROM ' . BANLIST_TABLE . ' @@ -1358,6 +1360,20 @@ function user_unban($mode, $ban) add_log('user', $user_id, 'LOG_UNBAN_' . strtoupper($mode), $l_unban_list); } } + + /** + * Use this event to perform actions after the unban has been performed + * + * @event core.user_unban + * @var string mode One of the following: user, ip, email + * @var array user_ids_ary Array with user_ids + * @since 3.1.11-RC1 + */ + $vars = array( + 'mode', + 'user_ids_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.user_unban', compact($vars))); } $cache->destroy('sql', BANLIST_TABLE); @@ -2279,7 +2295,7 @@ function phpbb_avatar_explanation_string() { global $config, $user; - return $user->lang('AVATAR_EXPLAIN', + return $user->lang(($config['avatar_filesize'] == 0) ? 'AVATAR_EXPLAIN_NO_FILESIZE' : 'AVATAR_EXPLAIN', $user->lang('PIXELS', (int) $config['avatar_max_width']), $user->lang('PIXELS', (int) $config['avatar_max_height']), round($config['avatar_filesize'] / 1024)); diff --git a/phpBB/includes/mcp/mcp_ban.php b/phpBB/includes/mcp/mcp_ban.php index 4d2151fded..2f3405f915 100644 --- a/phpBB/includes/mcp/mcp_ban.php +++ b/phpBB/includes/mcp/mcp_ban.php @@ -28,7 +28,10 @@ class mcp_ban global $db, $user, $auth, $template, $request, $phpbb_dispatcher; global $phpbb_root_path, $phpEx; - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + if (!function_exists('user_ban')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } // Include the admin banning interface... include($phpbb_root_path . 'includes/acp/acp_ban.' . $phpEx); diff --git a/phpBB/includes/mcp/mcp_forum.php b/phpBB/includes/mcp/mcp_forum.php index e4c0640ec7..3deb58b96a 100644 --- a/phpBB/includes/mcp/mcp_forum.php +++ b/phpBB/includes/mcp/mcp_forum.php @@ -458,7 +458,7 @@ function merge_topics($forum_id, $topic_ids, $to_topic_id) return; } - $redirect = request_var('redirect', build_url(array('quickmod'))); + $redirect = request_var('redirect', "{$phpbb_root_path}mcp.$phpEx?f=$forum_id&i=main&mode=forum_view"); $s_hidden_fields = build_hidden_fields(array( 'i' => 'main', diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index b2441aed1b..69c66639df 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -164,7 +164,7 @@ class mcp_main * @var string action Topic quick moderation action name * @var bool quickmod Flag indicating whether MCP is in quick moderation mode * @since 3.1.0-a4 - * @change 3.1.0-RC4 Added variables: action, quickmod + * @changed 3.1.0-RC4 Added variables: action, quickmod */ $vars = array('action', 'quickmod'); extract($phpbb_dispatcher->trigger_event('core.modify_quickmod_actions', compact($vars))); @@ -463,7 +463,7 @@ function change_topic_type($action, $topic_ids) */ function mcp_move_topic($topic_ids) { - global $auth, $user, $db, $template, $phpbb_log, $request; + global $auth, $user, $db, $template, $phpbb_log, $request, $phpbb_dispatcher; global $phpEx, $phpbb_root_path; // Here we limit the operation to one forum only @@ -625,6 +625,21 @@ function mcp_move_topic($topic_ids) 'poll_last_vote' => (int) $row['poll_last_vote'] ); + /** + * Perform actions before shadow topic is created. + * + * @event core.mcp_main_modify_shadow_sql + * @var array shadow SQL array to be used by $db->sql_build_array + * @var array row Topic data + * @since 3.1.11-RC1 + * @changed 3.1.11-RC1 Added variable: row + */ + $vars = array( + 'shadow', + 'row', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_main_modify_shadow_sql', compact($vars))); + $db->sql_query('INSERT INTO ' . TOPICS_TABLE . $db->sql_build_array('INSERT', $shadow)); // Shadow topics only count on new "topics" and not posts... a shadow topic alone has 0 posts @@ -1281,6 +1296,21 @@ function mcp_fork_topic($topic_ids) 'poll_vote_change' => (int) $topic_row['poll_vote_change'], ); + /** + * Perform actions before forked topic is created. + * + * @event core.mcp_main_modify_fork_sql + * @var array sql_ary SQL array to be used by $db->sql_build_array + * @var array topic_row Topic data + * @since 3.1.11-RC1 + * @changed 3.1.11-RC1 Added variable: topic_row + */ + $vars = array( + 'sql_ary', + 'topic_row', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_main_modify_fork_sql', compact($vars))); + $db->sql_query('INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); $new_topic_id = $db->sql_nextid(); $new_topic_id_list[$topic_id] = $new_topic_id; diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index 2dcfcd608b..1cf4a74234 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -24,8 +24,8 @@ if (!defined('IN_PHPBB')) */ function mcp_post_details($id, $mode, $action) { - global $phpEx, $phpbb_root_path, $config; - global $template, $db, $user, $auth, $cache; + global $phpEx, $phpbb_root_path, $config, $request; + global $template, $db, $user, $auth, $cache, $phpbb_container; global $phpbb_dispatcher; $user->add_lang('posting'); @@ -53,7 +53,10 @@ function mcp_post_details($id, $mode, $action) if ($auth->acl_get('m_info', $post_info['forum_id'])) { $ip = request_var('ip', ''); - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + if (!function_exists('user_ipwhois')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } $template->assign_vars(array( 'RETURN_POST' => sprintf($user->lang['RETURN_POST'], '<a href="' . append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&mode=$mode&p=$post_id") . '">', '</a>'), @@ -355,7 +358,11 @@ function mcp_post_details($id, $mode, $action) // Get IP if ($auth->acl_get('m_info', $post_info['forum_id'])) { - $rdns_ip_num = request_var('rdns', ''); + /** @var \phpbb\pagination $pagination */ + $pagination = $phpbb_container->get('pagination'); + + $rdns_ip_num = $request->variable('rdns', ''); + $start_users = $request->variable('start_users', 0); if ($rdns_ip_num != 'all') { @@ -364,23 +371,46 @@ function mcp_post_details($id, $mode, $action) ); } + $num_users = false; + if ($start_users) + { + $num_users = phpbb_get_num_posters_for_ip($db, $post_info['poster_ip']); + $start_users = $pagination->validate_start($start_users, $config['posts_per_page'], $num_users); + } + // Get other users who've posted under this IP $sql = 'SELECT poster_id, COUNT(poster_id) as postings FROM ' . POSTS_TABLE . " WHERE poster_ip = '" . $db->sql_escape($post_info['poster_ip']) . "' + AND poster_id <> " . (int) $post_info['poster_id'] . " GROUP BY poster_id - ORDER BY postings DESC"; - $result = $db->sql_query($sql); + ORDER BY postings DESC, poster_id ASC"; + $result = $db->sql_query_limit($sql, $config['posts_per_page'], $start_users); + $page_users = 0; while ($row = $db->sql_fetchrow($result)) { - // Fill the user select list with users who have posted under this IP - if ($row['poster_id'] != $post_info['poster_id']) + $page_users++; + $users_ary[$row['poster_id']] = $row; + } + $db->sql_freeresult($result); + + if ($page_users == $config['posts_per_page'] || $start_users) + { + if ($num_users === false) { - $users_ary[$row['poster_id']] = $row; + $num_users = phpbb_get_num_posters_for_ip($db, $post_info['poster_ip']); } + + $pagination->generate_template_pagination( + $url . '&i=main&mode=post_details', + 'pagination', + 'start_users', + $num_users, + $config['posts_per_page'], + $start_users + ); } - $db->sql_freeresult($result); if (sizeof($users_ary)) { @@ -415,16 +445,26 @@ function mcp_post_details($id, $mode, $action) // A compound index on poster_id, poster_ip (posts table) would help speed up this query a lot, // but the extra size is only valuable if there are persons having more than a thousands posts. // This is better left to the really really big forums. + $start_ips = $request->variable('start_ips', 0); + + $num_ips = false; + if ($start_ips) + { + $num_ips = phpbb_get_num_ips_for_poster($db, $post_info['poster_id']); + $start_ips = $pagination->validate_start($start_ips, $config['posts_per_page'], $num_ips); + } $sql = 'SELECT poster_ip, COUNT(poster_ip) AS postings FROM ' . POSTS_TABLE . ' WHERE poster_id = ' . $post_info['poster_id'] . " GROUP BY poster_ip - ORDER BY postings DESC"; - $result = $db->sql_query($sql); + ORDER BY postings DESC, poster_ip ASC"; + $result = $db->sql_query_limit($sql, $config['posts_per_page'], $start_ips); + $page_ips = 0; while ($row = $db->sql_fetchrow($result)) { + $page_ips++; $hostname = (($rdns_ip_num == $row['poster_ip'] || $rdns_ip_num == 'all') && $row['poster_ip']) ? @gethostbyaddr($row['poster_ip']) : ''; $template->assign_block_vars('iprow', array( @@ -439,6 +479,23 @@ function mcp_post_details($id, $mode, $action) } $db->sql_freeresult($result); + if ($page_ips == $config['posts_per_page'] || $start_ips) + { + if ($num_ips === false) + { + $num_ips = phpbb_get_num_ips_for_poster($db, $post_info['poster_id']); + } + + $pagination->generate_template_pagination( + $url . '&i=main&mode=post_details', + 'pagination_ips', + 'start_ips', + $num_ips, + $config['posts_per_page'], + $start_ips + ); + } + $user_select = ''; if (sizeof($usernames_ary)) @@ -457,6 +514,44 @@ function mcp_post_details($id, $mode, $action) } /** + * Get the number of posters for a given ip + * + * @param \phpbb\db\driver\driver_interface $db DBAL interface + * @param string $poster_ip IP + * @return int Number of posters + */ +function phpbb_get_num_posters_for_ip(\phpbb\db\driver\driver_interface $db, $poster_ip) +{ + $sql = 'SELECT COUNT(DISTINCT poster_id) as num_users + FROM ' . POSTS_TABLE . " + WHERE poster_ip = '" . $db->sql_escape($poster_ip) . "'"; + $result = $db->sql_query($sql); + $num_users = (int) $db->sql_fetchfield('num_users'); + $db->sql_freeresult($result); + + return $num_users; +} + +/** + * Get the number of ips for a given poster + * + * @param \phpbb\db\driver\driver_interface $db + * @param int $poster_id Poster user ID + * @return int Number of IPs for given poster + */ +function phpbb_get_num_ips_for_poster(\phpbb\db\driver\driver_interface $db, $poster_id) +{ + $sql = 'SELECT COUNT(DISTINCT poster_ip) as num_ips + FROM ' . POSTS_TABLE . ' + WHERE poster_id = ' . (int) $poster_id; + $result = $db->sql_query($sql); + $num_ips = (int) $db->sql_fetchfield('num_ips'); + $db->sql_freeresult($result); + + return $num_ips; +} + +/** * Change a post's poster */ function change_poster(&$post_info, $userdata) diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index 2217f8fdeb..d5415302c8 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -407,6 +407,7 @@ function mcp_topic_view($id, $mode, $action) function split_topic($action, $topic_id, $to_forum_id, $subject) { global $db, $template, $user, $phpEx, $phpbb_root_path, $auth, $config; + global $phpbb_dispatcher; $post_id_list = request_var('post_id_list', array(0)); $forum_id = request_var('forum_id', 0); @@ -567,6 +568,47 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) WHERE post_id = {$post_id_list[0]}"; $db->sql_query($sql); + // Grab data for first post in split topic + $sql_array = array( + 'SELECT' => 'p.post_id, p.forum_id, p.poster_id, p.post_text, f.enable_indexing', + 'FROM' => array( + POSTS_TABLE => 'p', + ), + 'LEFT_JOIN' => array( + array( + 'FROM' => array(FORUMS_TABLE => 'f'), + 'ON' => 'p.forum_id = f.forum_id', + ) + ), + 'WHERE' => "post_id = {$post_id_list[0]}", + ); + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query($sql); + $first_post_data = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + // Index first post as if it were edited + if ($first_post_data['enable_indexing']) + { + // Select the search method and do some additional checks to ensure it can actually be utilised + $search_type = $config['search_type']; + + if (!class_exists($search_type)) + { + trigger_error('NO_SUCH_SEARCH_MODULE'); + } + + $error = false; + $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher); + + if ($error) + { + trigger_error($error); + } + + $search->index('edit', $first_post_data['post_id'], $first_post_data['post_text'], $subject, $first_post_data['poster_id'], $first_post_data['forum_id']); + } + // Copy topic subscriptions to new topic $sql = 'SELECT user_id, notify_status FROM ' . TOPICS_WATCH_TABLE . ' @@ -634,7 +676,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject) */ function merge_posts($topic_id, $to_topic_id) { - global $db, $template, $user, $phpEx, $phpbb_root_path, $auth; + global $db, $template, $user, $phpEx, $phpbb_root_path, $auth, $phpbb_dispatcher; if (!$to_topic_id) { @@ -735,6 +777,20 @@ function merge_posts($topic_id, $to_topic_id) $redirect = request_var('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&t=$to_topic_id"); $redirect = reapply_sid($redirect); + /** + * Perform additional actions after merging posts. + * + * @event core.mcp_topics_merge_posts_after + * @var int topic_id The topic ID from which posts are being moved + * @var int to_topic_id The topic ID to which posts are being moved + * @since 3.1.11-RC1 + */ + $vars = array( + 'topic_id', + 'to_topic_id', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_topics_merge_posts_after', compact($vars))); + meta_refresh(3, $redirect); trigger_error($user->lang[$success_msg] . '<br /><br />' . $return_link); } diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 16b65fb83e..bbd5e84233 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -1171,7 +1171,7 @@ class parse_message extends bbcode_firstpass * @var bool return Do we return after the event is triggered if $warn_msg is not empty * @var array warn_msg Array of the warning messages * @since 3.1.2-RC1 - * @change 3.1.3-RC1 Added vars $bbcode_bitfield and $bbcode_uid + * @changed 3.1.3-RC1 Added vars $bbcode_bitfield and $bbcode_uid */ $message = $this->message; $warn_msg = $this->warn_msg; diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index d365e8b489..4906eec1bb 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -450,6 +450,17 @@ function compose_pm($id, $mode, $action, $user_folders = array()) $message_attachment = 0; $message_text = $message_subject = ''; + /** + * Predefine message text and subject + * + * @event core.ucp_pm_compose_predefined_message + * @var string message_text Message text + * @var string message_subject Messate subject + * @since 3.1.11-RC1 + */ + $vars = array('message_text', 'message_subject'); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_predefined_message', compact($vars))); + if ($to_user_id && $to_user_id != ANONYMOUS && $action == 'post') { $address_list['u'][$to_user_id] = 'to'; diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php index 19acd9ecb9..3364206680 100644 --- a/phpBB/includes/ucp/ucp_pm_viewfolder.php +++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php @@ -397,7 +397,7 @@ function view_folder($id, $mode, $folder_id, $folder) */ function get_pm_from($folder_id, $folder, $user_id) { - global $user, $db, $template, $config, $auth, $phpbb_container, $phpbb_root_path, $phpEx; + global $user, $db, $template, $config, $auth, $phpbb_container, $phpbb_root_path, $phpEx, $phpbb_dispatcher; $start = request_var('start', 0); @@ -461,7 +461,7 @@ function get_pm_from($folder_id, $folder, $user_id) $start = $pagination->validate_start($start, $config['topics_per_page'], $pm_count); $pagination->generate_template_pagination($base_url, 'pagination', 'start', $pm_count, $config['topics_per_page'], $start); - $template->assign_vars(array( + $template_vars = array( 'TOTAL_MESSAGES' => $user->lang('VIEW_PM_MESSAGES', (int) $pm_count), 'POST_IMG' => (!$auth->acl_get('u_sendpm')) ? $user->img('button_topic_locked', 'POST_PM_LOCKED') : $user->img('button_pm_new', 'POST_NEW_PM'), @@ -475,7 +475,33 @@ function get_pm_from($folder_id, $folder, $user_id) 'U_POST_NEW_TOPIC' => ($auth->acl_get('u_sendpm')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose') : '', 'S_PM_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=view&action=view_folder&f=$folder_id" . (($start !== 0) ? "&start=$start" : '')), - )); + ); + + /** + * Modify template variables before they are assigned + * + * @event core.ucp_pm_view_folder_get_pm_from_template + * @var int folder_id Folder ID + * @var array folder Folder data + * @var int user_id User ID + * @var string base_url Pagination base URL + * @var int start Pagination start + * @var int pm_count Count of PMs + * @var array template_vars Template variables to be assigned + * @since 3.1.11-RC1 + */ + $vars = array( + 'folder_id', + 'folder', + 'user_id', + 'base_url', + 'start', + 'pm_count', + 'template_vars', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_view_folder_get_pm_from_template', compact($vars))); + + $template->assign_vars($template_vars); // Grab all pm data $rowset = $pm_list = array(); @@ -509,15 +535,38 @@ function get_pm_from($folder_id, $folder, $user_id) $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction; } - $sql = 'SELECT t.*, p.root_level, p.message_time, p.message_subject, p.icon_id, p.to_address, p.message_attachment, p.bcc_address, u.username, u.username_clean, u.user_colour, p.message_reported - FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . " u - WHERE t.user_id = $user_id + $sql_ary = array( + 'SELECT' => 't.*, p.root_level, p.message_time, p.message_subject, p.icon_id, p.to_address, p.message_attachment, p.bcc_address, u.username, u.username_clean, u.user_colour, p.message_reported', + 'FROM' => array( + PRIVMSGS_TO_TABLE => 't', + PRIVMSGS_TABLE => 'p', + USERS_TABLE => 'u', + ), + 'WHERE' => "t.user_id = $user_id AND p.author_id = u.user_id AND $folder_sql AND t.msg_id = p.msg_id - $sql_limit_time - ORDER BY $sql_sort_order"; - $result = $db->sql_query_limit($sql, $sql_limit, $sql_start); + $sql_limit_time", + 'ORDER_BY' => $sql_sort_order, + ); + + /** + * Modify SQL before it is executed + * + * @event core.ucp_pm_view_folder_get_pm_from_sql + * @var array sql_ary SQL array + * @var int sql_limit SQL limit + * @var int sql_start SQL start + * @since 3.1.11-RC1 + */ + $vars = array( + 'sql_ary', + 'sql_limit', + 'sql_start', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_view_folder_get_pm_from_sql', compact($vars))); + + $result = $db->sql_query_limit($db->sql_build_query('SELECT', $sql_ary), $sql_limit, $sql_start); $pm_reported = array(); while ($row = $db->sql_fetchrow($result)) diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 0be1930f1a..4a3d8133b3 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -633,10 +633,19 @@ class ucp_profile 'user_avatar_height' => $result['avatar_height'], ); + /** + * Trigger events on successfull avatar change + * + * @event core.ucp_profile_avatar_sql + * @var array result Array with data to be stored in DB + * @since 3.1.11-RC1 + */ + $vars = array('result'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_avatar_sql', compact($vars))); + $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $result) . ' WHERE user_id = ' . (int) $user->data['user_id']; - $db->sql_query($sql); meta_refresh(3, $this->u_action); diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 3426af95d0..52ed410b04 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -45,6 +45,28 @@ class ucp_register $change_lang = request_var('change_lang', ''); $user_lang = request_var('lang', $user->lang_name); + /** + * Add UCP register data before they are assigned to the template or submitted + * + * To assign data to the template, use $template->assign_vars() + * + * @event core.ucp_register_requests_after + * @var bool coppa Is set coppa + * @var bool agreed Did user agree to coppa? + * @var bool submit Is set post submit? + * @var string change_lang Change language request + * @var string user_lang User language request + * @since 3.1.11-RC1 + */ + $vars = array( + 'coppa', + 'agreed', + 'submit', + 'change_lang', + 'user_lang', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_register_requests_after', compact($vars))); + if ($agreed) { add_form_key('ucp_register'); diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php index 415bf0e84d..497bf6a2c4 100644 --- a/phpBB/includes/ucp/ucp_remind.php +++ b/phpBB/includes/ucp/ucp_remind.php @@ -30,7 +30,7 @@ class ucp_remind function main($id, $mode) { global $config, $phpbb_root_path, $phpEx; - global $db, $user, $auth, $template, $phpbb_container; + global $db, $user, $auth, $template, $phpbb_container, $phpbb_dispatcher; if (!$config['allow_password_reset']) { @@ -41,12 +41,39 @@ class ucp_remind $email = strtolower(request_var('email', '')); $submit = (isset($_POST['submit'])) ? true : false; + add_form_key('ucp_remind'); + if ($submit) { - $sql = 'SELECT user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason - FROM ' . USERS_TABLE . " - WHERE user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "' - AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; + if (!check_form_key('ucp_remind')) + { + trigger_error('FORM_INVALID'); + } + + $sql_array = array( + 'SELECT' => 'user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type, user_lang, user_inactive_reason', + 'FROM' => array(USERS_TABLE => 'u'), + 'WHERE' => "user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "' + AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'" + ); + + /** + * Change SQL query for fetching user data + * + * @event core.ucp_remind_modify_select_sql + * @var string email User's email from the form + * @var string username User's username from the form + * @var array sql_array Fully assembled SQL query with keys SELECT, FROM, WHERE + * @since 3.1.11-RC1 + */ + $vars = array( + 'email', + 'username', + 'sql_array', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_remind_modify_select_sql', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_array); $result = $db->sql_query($sql); $user_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php index 2afec68de6..4aca80188a 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.10', + 'phpbb_version' => '3.1.11', 'author' => '<a href="https://www.phpbb.com/">phpBB Limited</a>', 'dbms' => $dbms, 'dbhost' => $dbhost, diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 3449829d8c..22a539e186 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.10'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.1.11-RC1'); 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/attachments.php b/phpBB/language/en/acp/attachments.php index 7d3d93d693..750f2f8d61 100644 --- a/phpBB/language/en/acp/attachments.php +++ b/phpBB/language/en/acp/attachments.php @@ -125,7 +125,7 @@ $lang = array_merge($lang, array( 'MAX_EXTGROUP_FILESIZE' => 'Maximum file size', 'MAX_IMAGE_SIZE' => 'Maximum image dimensions', 'MAX_IMAGE_SIZE_EXPLAIN' => 'Maximum size of image attachments. Set both values to 0px by 0px to disable dimension checking.', - 'MAX_THUMB_WIDTH' => 'Maximum thumbnail width in pixel', + 'MAX_THUMB_WIDTH' => 'Maximum thumbnail width/height in pixel', 'MAX_THUMB_WIDTH_EXPLAIN' => 'A generated thumbnail will not exceed the width set here.', 'MIN_THUMB_FILESIZE' => 'Minimum thumbnail file size', 'MIN_THUMB_FILESIZE_EXPLAIN' => 'Do not create a thumbnail for images smaller than this.', diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 8b4db6a061..8bb5327028 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -345,11 +345,14 @@ $lang = array_merge($lang, array( // Cookie Settings $lang = array_merge($lang, array( - 'ACP_COOKIE_SETTINGS_EXPLAIN' => 'These details define the data used to send cookies to your users browsers. In most cases the default values for the cookie settings should be sufficient. If you do need to change any do so with care, incorrect settings can prevent users logging in.', + 'ACP_COOKIE_SETTINGS_EXPLAIN' => 'These details define the data used to send cookies to your users browsers. In most cases the default values for the cookie settings should be sufficient. If you do need to change any do so with care, incorrect settings can prevent users logging in. If you have problems with users staying logging in to your board, visit the <b><a href="https://www.phpbb.com/support/go/cookie-settings/">phpBB.com Knowledge Base - Fixing incorrect cookie settings</a></b>.', 'COOKIE_DOMAIN' => 'Cookie domain', + 'COOKIE_DOMAIN_EXPLAIN' => 'In most cases the cookie domain is optional. Leave it blank if you are unsure.<br /><br /> In the case where you have a board integrated with other software or have multiple domains, then to determine the cookie domain you need to do the following. If you have something like <i>example.com</i> and <i>forums.example.com</i>, or perhaps <i>forums.example.com</i> and <i>blog.example.com</i>. Remove the subdomains until you find the common domain, <i>example.com</i>. Now add a dot in front of the common domain and you would enter .example.com (note the dot at the beginning).', 'COOKIE_NAME' => 'Cookie name', + 'COOKIE_NAME_EXPLAIN' => 'This can be anything what you want, make it original. Whenever the cookie settings are changed the name of the cookie should be changed.', 'COOKIE_PATH' => 'Cookie path', + 'COOKIE_PATH_EXPLAIN' => 'Note that this is always a slash, it does not matter what your board URL is.', 'COOKIE_SECURE' => 'Cookie secure', 'COOKIE_SECURE_EXPLAIN' => 'If your server is running via SSL set this to enabled else leave as disabled. Having this enabled and not running via SSL will result in server errors during redirects.', 'ONLINE_LENGTH' => 'View online time span', @@ -558,6 +561,8 @@ $lang = array_merge($lang, array( 'EMAIL_SIG_EXPLAIN' => 'This text will be attached to all emails the board sends.', 'ENABLE_EMAIL' => 'Enable board-wide emails', 'ENABLE_EMAIL_EXPLAIN' => 'If this is set to disabled no emails will be sent by the board at all. <em>Note the user and admin account activation settings require this setting to be enabled. If currently using “user” or “admin” activation in the activation settings, disabling this setting will disable registration.</em>', + 'SMTP_ALLOW_SELF_SIGNED' => 'Allow self-signed SSL certificates', + 'SMTP_ALLOW_SELF_SIGNED_EXPLAIN'=> 'Allow connections to SMTP server with self-signed SSL certificate.<em><strong>Warning:</strong> Allowing self-signed SSL certificates may cause security implications.</em>', 'SMTP_AUTH_METHOD' => 'Authentication method for SMTP', 'SMTP_AUTH_METHOD_EXPLAIN' => 'Only used if a username/password is set, ask your provider if you are unsure which method to use.', 'SMTP_CRAM_MD5' => 'CRAM-MD5', @@ -574,6 +579,11 @@ $lang = array_merge($lang, array( 'SMTP_SETTINGS' => 'SMTP settings', 'SMTP_USERNAME' => 'SMTP username', 'SMTP_USERNAME_EXPLAIN' => 'Only enter a username if your SMTP server requires it.', + 'SMTP_VERIFY_PEER' => 'Verify SSL certificate', + 'SMTP_VERIFY_PEER_EXPLAIN' => 'Require verification of SSL certificate used by SMTP server.<em><strong>Warning:</strong> Connecting peers with unverified SSL certificates may cause security implications.</em>', + 'SMTP_VERIFY_PEER_NAME' => 'Verify SMTP peer name', + 'SMTP_VERIFY_PEER_NAME_EXPLAIN' => 'Require verification of peer name for SMTP servers using SSL / TLS connections.<em><strong>Warning:</strong> Connecting to unverified peers may cause security implications.</em>', + 'USE_SMTP' => 'Use SMTP server for email', 'USE_SMTP_EXPLAIN' => 'Select “Yes” if you want or have to send email via a named server instead of the local mail function.', )); @@ -582,20 +592,26 @@ $lang = array_merge($lang, array( $lang = array_merge($lang, array( 'ACP_JABBER_SETTINGS_EXPLAIN' => 'Here you can enable and control the use of Jabber for instant messaging and board notifications. Jabber is an open source protocol and therefore available for use by anyone. Some Jabber servers include gateways or transports which allow you to contact users on other networks. Not all servers offer all transports and changes in protocols can prevent transports from operating. Please be sure to enter already registered account details - phpBB will use the details you enter here as is.', - 'JAB_ENABLE' => 'Enable Jabber', - 'JAB_ENABLE_EXPLAIN' => 'Enables use of Jabber messaging and notifications.', - 'JAB_GTALK_NOTE' => 'Please note that GTalk will not work because the <samp>dns_get_record</samp> function could not be found. This function is not available in PHP4, and is not implemented on Windows platforms. It currently does not work on BSD-based systems, including Mac OS.', - 'JAB_PACKAGE_SIZE' => 'Jabber package size', - 'JAB_PACKAGE_SIZE_EXPLAIN' => 'This is the number of messages sent in one package. If set to 0 the message is sent immediately and will not be queued for later sending.', - 'JAB_PASSWORD' => 'Jabber password', - 'JAB_PASSWORD_EXPLAIN' => '<em><strong>Warning:</strong> This password will be stored as plain text in the database, visible to everybody who can access your database or who can view this configuration page.</em>', - 'JAB_PORT' => 'Jabber port', - 'JAB_PORT_EXPLAIN' => 'Leave blank unless you know it is not port 5222.', - 'JAB_SERVER' => 'Jabber server', - 'JAB_SERVER_EXPLAIN' => 'See %sjabber.org%s for a list of servers.', - 'JAB_SETTINGS_CHANGED' => 'Jabber settings changed successfully.', - 'JAB_USE_SSL' => 'Use SSL to connect', - 'JAB_USE_SSL_EXPLAIN' => 'If enabled a secure connection is tried to be established. The Jabber port will be modified to 5223 if port 5222 is specified.', - 'JAB_USERNAME' => 'Jabber username or JID', - 'JAB_USERNAME_EXPLAIN' => 'Specify a registered username or a valid JID. The username will not be checked for validity. If you only specify a username, then your JID will be the username and the server you specified above. Else, specify a valid JID, for example user@jabber.org.', + 'JAB_ALLOW_SELF_SIGNED' => 'Allow self-signed SSL certificates', + 'JAB_ALLOW_SELF_SIGNED_EXPLAIN' => 'Allow connections to Jabber server with self-signed SSL certificate.<em><strong>Warning:</strong> Allowing self-signed SSL certificates may cause security implications.</em>', + 'JAB_ENABLE' => 'Enable Jabber', + 'JAB_ENABLE_EXPLAIN' => 'Enables use of Jabber messaging and notifications.', + 'JAB_GTALK_NOTE' => 'Please note that GTalk will not work because the <samp>dns_get_record</samp> function could not be found. This function is not available in PHP4, and is not implemented on Windows platforms. It currently does not work on BSD-based systems, including Mac OS.', + 'JAB_PACKAGE_SIZE' => 'Jabber package size', + 'JAB_PACKAGE_SIZE_EXPLAIN' => 'This is the number of messages sent in one package. If set to 0 the message is sent immediately and will not be queued for later sending.', + 'JAB_PASSWORD' => 'Jabber password', + 'JAB_PASSWORD_EXPLAIN' => '<em><strong>Warning:</strong> This password will be stored as plain text in the database, visible to everybody who can access your database or who can view this configuration page.</em>', + 'JAB_PORT' => 'Jabber port', + 'JAB_PORT_EXPLAIN' => 'Leave blank unless you know it is not port 5222.', + 'JAB_SERVER' => 'Jabber server', + 'JAB_SERVER_EXPLAIN' => 'See %sjabber.org%s for a list of servers.', + 'JAB_SETTINGS_CHANGED' => 'Jabber settings changed successfully.', + 'JAB_USE_SSL' => 'Use SSL to connect', + 'JAB_USE_SSL_EXPLAIN' => 'If enabled a secure connection is tried to be established. The Jabber port will be modified to 5223 if port 5222 is specified.', + 'JAB_USERNAME' => 'Jabber username or JID', + 'JAB_USERNAME_EXPLAIN' => 'Specify a registered username or a valid JID. The username will not be checked for validity. If you only specify a username, then your JID will be the username and the server you specified above. Else, specify a valid JID, for example user@jabber.org.', + 'JAB_VERIFY_PEER' => 'Verify SSL certificate', + 'JAB_VERIFY_PEER_EXPLAIN' => 'Require verification of SSL certificate used by Jabber server.<em><strong>Warning:</strong> Connecting peers with unverified SSL certificates may cause security implications.</em>', + 'JAB_VERIFY_PEER_NAME' => 'Verify Jabber peer name', + 'JAB_VERIFY_PEER_NAME_EXPLAIN' => 'Require verification of peer name for Jabber servers using SSL / TLS connections.<em><strong>Warning:</strong> Connecting to unverified peers may cause security implications.</em>', )); diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index 88e60d00a3..562b446f8a 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -373,7 +373,7 @@ $lang = array_merge($lang, array( 'NUMBER_USERS' => 'Number of users', 'NUMBER_ORPHAN' => 'Orphan attachments', - 'PHP_VERSION_OLD' => 'The version of PHP on this server will no longer be supported by future versions of phpBB. %sDetails%s', + 'PHP_VERSION_OLD' => 'The version of PHP on this server (%1$s) will no longer be supported by future versions of phpBB. The minimum required version will be PHP %2$s. %3$sDetails%4$s', 'POSTS_PER_DAY' => 'Posts per day', diff --git a/phpBB/language/en/acp/styles.php b/phpBB/language/en/acp/styles.php index 0d91eb3704..9293d67ecc 100644 --- a/phpBB/language/en/acp/styles.php +++ b/phpBB/language/en/acp/styles.php @@ -81,6 +81,7 @@ $lang = array_merge($lang, array( 'STYLE_UNINSTALL_DEPENDENT' => 'Style "%s" cannot be uninstalled because it has one or more child styles.', 'STYLE_UNINSTALLED' => 'Style "%s" uninstalled successfully.', 'STYLE_USED_BY' => 'Used by (including robots)', + 'STYLE_VERSION' => 'Style version', 'UNINSTALL_DEFAULT' => 'You cannot uninstall the default style.', diff --git a/phpBB/language/en/cli.php b/phpBB/language/en/cli.php index 6989f26f72..4e27be48cc 100644 --- a/phpBB/language/en/cli.php +++ b/phpBB/language/en/cli.php @@ -55,6 +55,7 @@ $lang = array_merge($lang, array( 'CLI_DESCRIPTION_DISABLE_EXTENSION' => 'Disables the specified extension.', 'CLI_DESCRIPTION_ENABLE_EXTENSION' => 'Enables the specified extension.', 'CLI_DESCRIPTION_FIND_MIGRATIONS' => 'Finds migrations that are not depended upon.', + 'CLI_DESCRIPTION_FIX_LEFT_RIGHT_IDS' => 'Repairs the tree structure of the forums and modules.', 'CLI_DESCRIPTION_GET_CONFIG' => 'Gets a configuration option’s value', 'CLI_DESCRIPTION_INCREMENT_CONFIG' => 'Increments a configuration option’s integer value', 'CLI_DESCRIPTION_LIST_EXTENSIONS' => 'Lists all extensions in the database and on the filesystem.', @@ -64,6 +65,7 @@ $lang = array_merge($lang, array( 'CLI_DESCRIPTION_RECALCULATE_EMAIL_HASH' => 'Recalculates the user_email_hash column of the users table.', 'CLI_DESCRIPTION_SET_ATOMIC_CONFIG' => 'Sets a configuration option’s value only if the old matches the current value', 'CLI_DESCRIPTION_SET_CONFIG' => 'Sets a configuration option’s value', + 'CLI_DESCRIPTION_UPDATE_HASH_BCRYPT' => 'Updates outdated password hashes to be hashed with bcrypt.', 'CLI_EXTENSION_DISABLE_FAILURE' => 'Could not disable extension %s', 'CLI_EXTENSION_DISABLE_SUCCESS' => 'Successfully disabled extension %s', @@ -77,7 +79,9 @@ $lang = array_merge($lang, array( 'CLI_EXTENSIONS_DISABLED' => 'Disabled', 'CLI_EXTENSIONS_ENABLED' => 'Enabled', + 'CLI_FIXUP_FIX_LEFT_RIGHT_IDS_SUCCESS' => 'Successfully repaired the tree structure of the forums and modules.', 'CLI_FIXUP_RECALCULATE_EMAIL_HASH_SUCCESS' => 'Successfully recalculated all email hashes.', + 'CLI_FIXUP_UPDATE_HASH_BCRYPT_SUCCESS' => 'Successfully updated outdated password hashes to bcrypt.' )); // Additional help for commands. diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index a2cfd958aa..b4b328e90d 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -336,6 +336,7 @@ $lang = array_merge($lang, array( 'INTERESTS' => 'Interests', 'INVALID_DIGEST_CHALLENGE' => 'Invalid digest challenge.', 'INVALID_EMAIL_LOG' => '<strong>%s</strong> possibly an invalid email address?', + 'INVALID_FEED_ATTACHMENTS' => 'The selected feed tried fetching attachments with invalid constraints.', 'INVALID_PLURAL_RULE' => 'The chosen plural rule is invalid. Valid values are integers between 0 and 15.', 'IP' => 'IP', 'IP_BLACKLISTED' => 'Your IP %1$s has been blocked because it is blacklisted. For details please see <a href="%2$s">%2$s</a>.', diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 6477a929e9..0460c0613e 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -574,6 +574,7 @@ $lang = array_merge($lang, array( 'UPDATING_DATA' => 'Updating data', 'UPDATING_TO_LATEST_STABLE' => 'Updating database to latest stable release', 'UPDATED_VERSION' => 'Updated version', + 'UPGRADE_INSTRUCTIONS' => 'A new feature release <strong>%1$s</strong> is available. Please read <a href="%2$s" title="%2$s"><strong>the release announcement</strong></a> to learn about what it has to offer, and how to upgrade.', 'UPLOAD_METHOD' => 'Upload method', 'UPDATE_DB_SUCCESS' => 'Database update was successful.', diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php index 59525c6b16..93ee07b1cf 100644 --- a/phpBB/language/en/ucp.php +++ b/phpBB/language/en/ucp.php @@ -100,6 +100,7 @@ $lang = array_merge($lang, array( 'AVATAR_DRIVER_UPLOAD_TITLE' => 'Upload avatar', 'AVATAR_DRIVER_UPLOAD_EXPLAIN' => 'Upload your own custom avatar.', 'AVATAR_EXPLAIN' => 'Maximum dimensions; width: %1$s, height: %2$s, file size: %3$.2f KiB.', + 'AVATAR_EXPLAIN_NO_FILESIZE' => 'Maximum dimensions; width: %1$s, height: %2$s.', 'AVATAR_FEATURES_DISABLED' => 'The avatar functionality is currently disabled.', 'AVATAR_GALLERY' => 'Local gallery', 'AVATAR_GENERAL_UPLOAD_ERROR' => 'Could not upload avatar to %s.', diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index b93476b3bb..b1982958d5 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -101,7 +101,10 @@ switch ($mode) { case 'team': // Display a listing of board admins, moderators - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } $page_title = $user->lang['THE_TEAM']; $template_html = 'memberlist_team.html'; diff --git a/phpBB/phpbb/auth/auth.php b/phpBB/phpbb/auth/auth.php index b7634e04ce..37d4352c10 100644 --- a/phpBB/phpbb/auth/auth.php +++ b/phpBB/phpbb/auth/auth.php @@ -514,7 +514,7 @@ class auth */ function acl_clear_prefetch($user_id = false) { - global $db, $cache; + global $db, $cache, $phpbb_dispatcher; // Rebuild options cache $cache->destroy('_role_cache'); @@ -553,6 +553,16 @@ class auth $where_sql"; $db->sql_query($sql); + /** + * Event is triggered after user(s) permission settings cache has been cleared + * + * @event core.acl_clear_prefetch_after + * @var mixed user_id User ID(s) + * @since 3.1.11-RC1 + */ + $vars = array('user_id'); + extract($phpbb_dispatcher->trigger_event('core.acl_clear_prefetch_after', compact($vars))); + return; } diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php index 9f6345fbba..bd2a414033 100644 --- a/phpBB/phpbb/auth/provider/oauth/oauth.php +++ b/phpBB/phpbb/auth/provider/oauth/oauth.php @@ -98,6 +98,13 @@ class oauth extends \phpbb\auth\provider\base protected $phpbb_container; /** + * phpBB event dispatcher + * + * @var \phpbb\event\dispatcher_interface + */ + protected $dispatcher; + + /** * phpBB root path * * @var string @@ -124,10 +131,11 @@ class oauth extends \phpbb\auth\provider\base * @param \phpbb\di\service_collection $service_providers Contains \phpbb\auth\provider\oauth\service_interface * @param string $users_table * @param \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container DI container + * @param \phpbb\event\dispatcher_interface $dispatcher phpBB event dispatcher * @param string $phpbb_root_path * @param string $php_ext */ - public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request_interface $request, \phpbb\user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_token_account_assoc, \phpbb\di\service_collection $service_providers, $users_table, \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container, $phpbb_root_path, $php_ext) + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request_interface $request, \phpbb\user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_token_account_assoc, \phpbb\di\service_collection $service_providers, $users_table, \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container, \phpbb\event\dispatcher_interface $dispatcher, $phpbb_root_path, $php_ext) { $this->db = $db; $this->config = $config; @@ -139,6 +147,7 @@ class oauth extends \phpbb\auth\provider\base $this->service_providers = $service_providers; $this->users_table = $users_table; $this->phpbb_container = $phpbb_container; + $this->dispatcher = $dispatcher; $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; } @@ -238,6 +247,18 @@ class oauth extends \phpbb\auth\provider\base // Update token storage to store the user_id $storage->set_user_id($row['user_id']); + /** + * Event is triggered after user is successfuly logged in via OAuth. + * + * @event core.auth_oauth_login_after + * @var array row User row + * @since 3.1.11-RC1 + */ + $vars = array( + 'row', + ); + extract($this->dispatcher->trigger_event('core.auth_oauth_login_after', compact($vars))); + // The user is now authenticated and can be logged in return array( 'status' => LOGIN_SUCCESS, @@ -542,6 +563,18 @@ class oauth extends \phpbb\auth\provider\base $sql = 'INSERT INTO ' . $this->auth_provider_oauth_token_account_assoc . ' ' . $this->db->sql_build_array('INSERT', $data); $this->db->sql_query($sql); + + /** + * Event is triggered after user links account. + * + * @event core.auth_oauth_link_after + * @var array data User row + * @since 3.1.11-RC1 + */ + $vars = array( + 'data', + ); + extract($this->dispatcher->trigger_event('core.auth_oauth_link_after', compact($vars))); } /** diff --git a/phpBB/phpbb/cache/driver/file.php b/phpBB/phpbb/cache/driver/file.php index fae4614039..1e9ee960dc 100644 --- a/phpBB/phpbb/cache/driver/file.php +++ b/phpBB/phpbb/cache/driver/file.php @@ -601,6 +601,6 @@ class file extends \phpbb\cache\driver\base */ protected function clean_varname($varname) { - return str_replace('/', '-', $varname); + return str_replace(array('/', '\\'), '-', $varname); } } diff --git a/phpBB/phpbb/cache/driver/memcache.php b/phpBB/phpbb/cache/driver/memcache.php index caa82fb0b1..57f138f574 100644 --- a/phpBB/phpbb/cache/driver/memcache.php +++ b/phpBB/phpbb/cache/driver/memcache.php @@ -52,8 +52,8 @@ class memcache extends \phpbb\cache\driver\memory $this->memcache = new \Memcache; foreach (explode(',', PHPBB_ACM_MEMCACHE) as $u) { - $parts = explode('/', $u); - $this->memcache->addServer(trim($parts[0]), trim($parts[1])); + preg_match('#(.*)/(\d+)#', $u, $parts); + $this->memcache->addServer(trim($parts[1]), (int) trim($parts[2])); } $this->flags = (PHPBB_ACM_MEMCACHE_COMPRESS) ? MEMCACHE_COMPRESSED : 0; } diff --git a/phpBB/phpbb/cache/driver/memcached.php b/phpBB/phpbb/cache/driver/memcached.php new file mode 100644 index 0000000000..a7da22d7e8 --- /dev/null +++ b/phpBB/phpbb/cache/driver/memcached.php @@ -0,0 +1,134 @@ +<?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\cache\driver; + +if (!defined('PHPBB_ACM_MEMCACHED_PORT')) +{ + define('PHPBB_ACM_MEMCACHED_PORT', 11211); +} + +if (!defined('PHPBB_ACM_MEMCACHED_COMPRESS')) +{ + define('PHPBB_ACM_MEMCACHED_COMPRESS', true); +} + +if (!defined('PHPBB_ACM_MEMCACHED_HOST')) +{ + define('PHPBB_ACM_MEMCACHED_HOST', 'localhost'); +} + +if (!defined('PHPBB_ACM_MEMCACHED')) +{ + //can define multiple servers with host1/port1,host2/port2 format + define('PHPBB_ACM_MEMCACHED', PHPBB_ACM_MEMCACHED_HOST . '/' . PHPBB_ACM_MEMCACHED_PORT); +} + +/** +* ACM for Memcached +*/ +class memcached extends \phpbb\cache\driver\memory +{ + /** @var string Extension to use */ + protected $extension = 'memcached'; + + /** @var \Memcached Memcached class */ + protected $memcached; + + /** @var int Flags */ + protected $flags = 0; + + /** + * Memcached constructor + */ + public function __construct() + { + // Call the parent constructor + parent::__construct(); + + $this->memcached = new \Memcached(); + $this->memcached->setOption(\Memcached::OPT_BINARY_PROTOCOL, true); + // Memcached defaults to using compression, disable if we don't want + // to use it + if (!PHPBB_ACM_MEMCACHED_COMPRESS) + { + $this->memcached->setOption(\Memcached::OPT_COMPRESSION, false); + } + + foreach (explode(',', PHPBB_ACM_MEMCACHE) as $u) + { + preg_match('#(.*)/(\d+)#', $u, $parts); + $this->memcache->addServer(trim($parts[1]), (int) trim($parts[2])); + } + } + + /** + * {@inheritDoc} + */ + public function unload() + { + parent::unload(); + + unset($this->memcached); + } + + /** + * {@inheritDoc} + */ + public function purge() + { + $this->memcached->flush(); + + parent::purge(); + } + + /** + * Fetch an item from the cache + * + * @param string $var Cache key + * + * @return mixed Cached data + */ + protected function _read($var) + { + return $this->memcached->get($this->key_prefix . $var); + } + + /** + * Store data in the cache + * + * @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 + */ + protected function _write($var, $data, $ttl = 2592000) + { + if (!$this->memcached->replace($this->key_prefix . $var, $data, $ttl)) + { + return $this->memcached->set($this->key_prefix . $var, $data, $ttl); + } + return true; + } + + /** + * Remove an item from the cache + * + * @param string $var Cache key + * @return bool True if the operation succeeded + */ + protected function _delete($var) + { + return $this->memcached->delete($this->key_prefix . $var); + } +} diff --git a/phpBB/phpbb/console/command/fixup/fix_left_right_ids.php b/phpBB/phpbb/console/command/fixup/fix_left_right_ids.php new file mode 100644 index 0000000000..f55e1761bc --- /dev/null +++ b/phpBB/phpbb/console/command/fixup/fix_left_right_ids.php @@ -0,0 +1,134 @@ +<?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\console\command\fixup; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +class fix_left_right_ids extends \phpbb\console\command\command +{ + /** @var \phpbb\user */ + protected $user; + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\cache\driver\driver_interface */ + protected $cache; + + /** + * Constructor + * + * @param \phpbb\user $user User instance + * @param \phpbb\db\driver\driver_interface $db Database connection + * @param \phpbb\cache\driver\driver_interface $cache Cache instance + */ + public function __construct(\phpbb\user $user, \phpbb\db\driver\driver_interface $db, \phpbb\cache\driver\driver_interface $cache) + { + $this->user = $user; + $this->db = $db; + $this->cache = $cache; + + parent::__construct($user); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('fixup:fix-left-right-ids') + ->setDescription($this->user->lang('CLI_DESCRIPTION_FIX_LEFT_RIGHT_IDS')) + ; + } + + /** + * Executes the command fixup:fix-left-right-ids. + * + * Repairs the tree structure of the forums and modules. + * The code is mainly borrowed from Support toolkit for phpBB Olympus + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + * + * @return void + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + // Fix Left/Right IDs for the modules table + $result = $this->db->sql_query('SELECT DISTINCT(module_class) FROM ' . MODULES_TABLE); + while ($row = $this->db->sql_fetchrow($result)) + { + $i = 1; + $where = array("module_class = '" . $this->db->sql_escape($row['module_class']) . "'"); + $this->fix_ids_tree($i, 'module_id', MODULES_TABLE, 0, $where); + } + $this->db->sql_freeresult($result); + + // Fix the Left/Right IDs for the forums table + $i = 1; + $this->fix_ids_tree($i, 'forum_id', FORUMS_TABLE); + + $this->cache->purge(); + + $output->writeln('<info>' . $this->user->lang('CLI_FIXUP_FIX_LEFT_RIGHT_IDS_SUCCESS') . '</info>'); + } + + /** + * Item's tree structure rebuild helper + * The item is either forum or ACP/MCP/UCP module + * + * @param int $i Item id offset index + * @param string $field The key field to fix, forum_id|module_id + * @param string $table The table name to perform, FORUMS_TABLE|MODULES_TABLE + * @param int $parent_id Parent item id + * @param array $where Additional WHERE clause condition + * + * @return bool True on rebuild success, false otherwise + */ + protected function fix_ids_tree(&$i, $field, $table, $parent_id = 0, $where = array()) + { + $changes_made = false; + $sql = 'SELECT * FROM ' . $table . ' + WHERE parent_id = ' . (int) $parent_id . + ((!empty($where)) ? ' AND ' . implode(' AND ', $where) : '') . ' + ORDER BY left_id ASC'; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + // Update the left_id for the item + if ($row['left_id'] != $i) + { + $this->db->sql_query('UPDATE ' . $table . ' SET ' . $this->db->sql_build_array('UPDATE', array('left_id' => $i)) . " WHERE $field = " . (int) $row[$field]); + $changes_made = true; + } + $i++; + + // Go through children and update their left/right IDs + $changes_made = (($this->fix_ids_tree($i, $field, $table, $row[$field], $where)) || $changes_made) ? true : false; + + // Update the right_id for the item + if ($row['right_id'] != $i) + { + $this->db->sql_query('UPDATE ' . $table . ' SET ' . $this->db->sql_build_array('UPDATE', array('right_id' => $i)) . " WHERE $field = " . (int) $row[$field]); + $changes_made = true; + } + $i++; + } + $this->db->sql_freeresult($result); + + return $changes_made; + } +} diff --git a/phpBB/phpbb/console/command/fixup/update_hashes.php b/phpBB/phpbb/console/command/fixup/update_hashes.php new file mode 100644 index 0000000000..4bcc3b5d19 --- /dev/null +++ b/phpBB/phpbb/console/command/fixup/update_hashes.php @@ -0,0 +1,117 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +namespace phpbb\console\command\fixup; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Helper\ProgressBar; + +class update_hashes extends \phpbb\console\command\command +{ + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\passwords\manager */ + protected $passwords_manager; + + /** @var string Default hashing type */ + protected $default_type; + + /** + * Update_hashes constructor + * + * @param \phpbb\config\config $config + * @param \phpbb\user $user + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\passwords\manager $passwords_manager + * @param array $hashing_algorithms Hashing driver + * service collection + * @param array $defaults Default password types + */ + public function __construct(\phpbb\config\config $config, \phpbb\user $user, + \phpbb\db\driver\driver_interface $db, \phpbb\passwords\manager $passwords_manager, + $hashing_algorithms, $defaults) + { + $this->config = $config; + $this->db = $db; + + $this->passwords_manager = $passwords_manager; + + foreach ($defaults as $type) + { + if ($hashing_algorithms[$type]->is_supported()) + { + $this->default_type = $type; + break; + } + } + + parent::__construct($user); + } + + /** + * {@inheritdoc} + */ + protected function configure() + { + $this + ->setName('fixup:update-hashes') + ->setDescription($this->user->lang('CLI_DESCRIPTION_UPDATE_HASH_BCRYPT')) + ; + } + + /** + * {@inheritdoc} + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + // Get count to be able to display progress + $sql = 'SELECT COUNT(user_id) AS count + FROM ' . USERS_TABLE . ' + WHERE user_password ' . $this->db->sql_like_expression('$H$' . $this->db->get_any_char()) . ' + OR user_password ' . $this->db->sql_like_expression('$CP$' . $this->db->get_any_char()); + $result = $this->db->sql_query($sql); + $total_update_passwords = $this->db->sql_fetchfield('count'); + $this->db->sql_freeresult($result); + + // Create progress bar + $progress_bar = new ProgressBar($output, $total_update_passwords); + $progress_bar->start(); + + $sql = 'SELECT user_id, user_password + FROM ' . USERS_TABLE . ' + WHERE user_password ' . $this->db->sql_like_expression('$H$' . $this->db->get_any_char()) . ' + OR user_password ' . $this->db->sql_like_expression('$CP$' . $this->db->get_any_char()); + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $new_hash = $this->passwords_manager->hash($row['user_password'], array($this->default_type)); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_password = "' . $this->db->sql_escape($new_hash) . '" + WHERE user_id = ' . (int) $row['user_id']; + $this->db->sql_query($sql); + $progress_bar->advance(); + } + + $this->config->set('update_hashes_last_cron', time()); + + $progress_bar->finish(); + + $output->writeln('<info>' . $this->user->lang('CLI_FIXUP_UPDATE_HASH_BCRYPT_SUCCESS') . '</info>'); + } +} diff --git a/phpBB/phpbb/cron/task/core/update_hashes.php b/phpBB/phpbb/cron/task/core/update_hashes.php new file mode 100644 index 0000000000..a4fe477d99 --- /dev/null +++ b/phpBB/phpbb/cron/task/core/update_hashes.php @@ -0,0 +1,130 @@ +<?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\cron\task\core; + +/** + * Update old hashes to the current default hashing algorithm + * + * It is intended to gradually update all "old" style hashes to the + * current default hashing algorithm. + */ +class update_hashes extends \phpbb\cron\task\base +{ + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\lock\db */ + protected $update_lock; + + /** @var \phpbb\passwords\manager */ + protected $passwords_manager; + + /** @var string Default hashing type */ + protected $default_type; + + /** + * Constructor. + * + * @param \phpbb\config\config $config + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\lock\db $update_lock + * @param \phpbb\passwords\manager $passwords_manager + * @param array $hashing_algorithms Hashing driver + * service collection + * @param array $defaults Default password types + */ + public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\lock\db $update_lock, \phpbb\passwords\manager $passwords_manager, $hashing_algorithms, $defaults) + { + $this->config = $config; + $this->db = $db; + $this->passwords_manager = $passwords_manager; + $this->update_lock = $update_lock; + + foreach ($defaults as $type) + { + if ($hashing_algorithms[$type]->is_supported()) + { + $this->default_type = $type; + break; + } + } + } + + /** + * {@inheritdoc} + */ + public function is_runnable() + { + return !$this->config['use_system_cron']; + } + + /** + * {@inheritdoc} + */ + public function should_run() + { + if (!empty($this->config['update_hashes_lock'])) + { + $last_run = explode(' ', $this->config['update_hashes_lock']); + if ($last_run[0] + 60 >= time()) + { + return false; + } + } + + return $this->config['enable_update_hashes'] && $this->config['update_hashes_last_cron'] < (time() - 60); + } + + /** + * {@inheritdoc} + */ + public function run() + { + if ($this->update_lock->acquire()) + { + $sql = 'SELECT user_id, user_password + FROM ' . USERS_TABLE . ' + WHERE user_password ' . $this->db->sql_like_expression('$H$' . $this->db->get_any_char()) . ' + OR user_password ' . $this->db->sql_like_expression('$CP$' . $this->db->get_any_char()); + $result = $this->db->sql_query_limit($sql, 20); + + $affected_rows = 0; + + while ($row = $this->db->sql_fetchrow($result)) + { + $new_hash = $this->passwords_manager->hash($row['user_password'], array($this->default_type)); + + // Increase number so we know that users were selected from the database + $affected_rows++; + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_password = "' . $this->db->sql_escape($new_hash) . '" + WHERE user_id = ' . (int) $row['user_id']; + $this->db->sql_query($sql); + } + + $this->config->set('update_hashes_last_cron', time()); + $this->update_lock->release(); + + // Stop cron for good once all hashes are converted + if ($affected_rows === 0) + { + $this->config->set('enable_update_hashes', '0'); + } + } + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php b/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php index 2d4d26ae61..d43d432dd9 100644 --- a/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php +++ b/phpBB/phpbb/db/migration/data/v310/notification_options_reconvert.php @@ -52,6 +52,7 @@ class notification_options_reconvert extends \phpbb\db\migration\migration { $limit = 250; $converted_users = 0; + $start = $start ?: 0; $sql = 'SELECT user_id, user_notify_type, user_notify_pm FROM ' . $this->table_prefix . 'users diff --git a/phpBB/phpbb/db/migration/data/v31x/add_jabber_ssl_context_config_options.php b/phpBB/phpbb/db/migration/data/v31x/add_jabber_ssl_context_config_options.php new file mode 100644 index 0000000000..9f416fe069 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/add_jabber_ssl_context_config_options.php @@ -0,0 +1,32 @@ +<?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\v31x; + +class add_jabber_ssl_context_config_options extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array('\phpbb\db\migration\data\v31x\v3110'); + } + + public function update_data() + { + return array( + // See http://php.net/manual/en/context.ssl.php + array('config.add', array('jab_verify_peer', 1)), + array('config.add', array('jab_verify_peer_name', 1)), + array('config.add', array('jab_allow_self_signed', 0)), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/add_latest_topics_index.php b/phpBB/phpbb/db/migration/data/v31x/add_latest_topics_index.php new file mode 100644 index 0000000000..fa2899e348 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/add_latest_topics_index.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\v31x; + +class add_latest_topics_index extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v3110', + ); + } + + public function update_schema() + { + return array( + 'add_index' => array( + $this->table_prefix . 'topics' => array( + 'latest_topics' => array( + 'forum_id', + 'topic_last_post_time', + 'topic_last_post_id', + 'topic_moved_id', + ), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_keys' => array( + $this->table_prefix . 'topics' => array( + 'latest_topics', + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/add_smtp_ssl_context_config_options.php b/phpBB/phpbb/db/migration/data/v31x/add_smtp_ssl_context_config_options.php new file mode 100644 index 0000000000..92051dc3ca --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/add_smtp_ssl_context_config_options.php @@ -0,0 +1,32 @@ +<?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\v31x; + +class add_smtp_ssl_context_config_options extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array('\phpbb\db\migration\data\v31x\v3110'); + } + + public function update_data() + { + return array( + // See http://php.net/manual/en/context.ssl.php + array('config.add', array('smtp_verify_peer', 1)), + array('config.add', array('smtp_verify_peer_name', 1)), + array('config.add', array('smtp_allow_self_signed', 0)), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/increase_size_of_emotion.php b/phpBB/phpbb/db/migration/data/v31x/increase_size_of_emotion.php new file mode 100644 index 0000000000..7e486aca7c --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/increase_size_of_emotion.php @@ -0,0 +1,46 @@ +<?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\v31x; + +class increase_size_of_emotion extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v3110', + ); + } + + public function update_schema() + { + return array( + 'change_columns' => array( + $this->table_prefix . 'smilies' => array( + 'emotion' => array('VCHAR_UNI', ''), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'change_columns' => array( + $this->table_prefix . 'smilies' => array( + 'emotion' => array('VCHAR_UNI:50', ''), + ), + ), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/remove_duplicate_migrations.php b/phpBB/phpbb/db/migration/data/v31x/remove_duplicate_migrations.php new file mode 100644 index 0000000000..417d569a09 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/remove_duplicate_migrations.php @@ -0,0 +1,77 @@ +<?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\v31x; + +class remove_duplicate_migrations extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array('\phpbb\db\migration\data\v31x\v3110'); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'deduplicate_entries'))), + ); + } + + public function deduplicate_entries() + { + $migration_state = array(); + $duplicate_migrations = array(); + + $sql = "SELECT * + FROM " . $this->table_prefix . 'migrations'; + $result = $this->db->sql_query($sql); + + if (!$this->db->get_sql_error_triggered()) + { + while ($migration = $this->db->sql_fetchrow($result)) + { + $migration_state[$migration['migration_name']] = $migration; + + $migration_state[$migration['migration_name']]['migration_depends_on'] = unserialize($migration['migration_depends_on']); + } + } + + $this->db->sql_freeresult($result); + + foreach ($migration_state as $name => $migration) + { + $prepended_name = ($name[0] == '\\' ? '' : '\\') . $name; + $prefixless_name = $name[0] == '\\' ? substr($name, 1) : $name; + + if ($prepended_name != $name && isset($migration_state[$prepended_name]) && $migration_state[$prepended_name]['migration_depends_on'] == $migration_state[$name]['migration_depends_on']) + { + $duplicate_migrations[] = $name; + unset($migration_state[$prepended_name]); + } + else if ($prefixless_name != $name && isset($migration_state[$prefixless_name]) && $migration_state[$prefixless_name]['migration_depends_on'] == $migration_state[$name]['migration_depends_on']) + { + $duplicate_migrations[] = $prefixless_name; + unset($migration_state[$prefixless_name]); + } + } + + if (count($duplicate_migrations)) + { + $sql = 'DELETE + FROM ' . $this->table_prefix . 'migrations + WHERE ' . $this->db->sql_in_set('migration_name', $duplicate_migrations); + $this->db->sql_query($sql); + } + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/update_hashes.php b/phpBB/phpbb/db/migration/data/v31x/update_hashes.php new file mode 100644 index 0000000000..aa83c3ffbf --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/update_hashes.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\v31x; + +class update_hashes extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v3110', + ); + } + + public function update_data() + { + return array( + array('config.add', array('enable_update_hashes', '1')), + array('config.add', array('update_hashes_lock', '')), + array('config.add', array('update_hashes_last_cron', '0')) + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v31x/v3111rc1.php b/phpBB/phpbb/db/migration/data/v31x/v3111rc1.php new file mode 100644 index 0000000000..259656283f --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/v3111rc1.php @@ -0,0 +1,43 @@ +<?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\v31x; + +class v3111rc1 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.1.11-RC1', '>='); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v31x\v3110', + '\phpbb\db\migration\data\v31x\add_log_time_index', + '\phpbb\db\migration\data\v31x\increase_size_of_emotion', + '\phpbb\db\migration\data\v31x\add_jabber_ssl_context_config_options', + '\phpbb\db\migration\data\v31x\add_smtp_ssl_context_config_options', + '\phpbb\db\migration\data\v31x\update_hashes', + '\phpbb\db\migration\data\v31x\remove_duplicate_migrations', + '\phpbb\db\migration\data\v31x\add_latest_topics_index', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.11-RC1')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/profilefield_base_migration.php b/phpBB/phpbb/db/migration/profilefield_base_migration.php index da1a38e2fa..b20ca874be 100644 --- a/phpBB/phpbb/db/migration/profilefield_base_migration.php +++ b/phpBB/phpbb/db/migration/profilefield_base_migration.php @@ -191,6 +191,7 @@ abstract class profilefield_base_migration extends container_aware_migration $insert_buffer = new \phpbb\db\sql_insert_buffer($this->db, $this->table_prefix . 'profile_fields_data'); $limit = 250; $converted_users = 0; + $start = $start ?: 0; $sql = 'SELECT user_id, ' . $this->user_column_name . ' FROM ' . $this->table_prefix . 'users diff --git a/phpBB/phpbb/db/migrator.php b/phpBB/phpbb/db/migrator.php index 4c4c0a8672..45a333ac94 100644 --- a/phpBB/phpbb/db/migrator.php +++ b/phpBB/phpbb/db/migrator.php @@ -201,6 +201,34 @@ class migrator } /** + * Get a valid migration name from the migration state array in case the + * supplied name is not in the migration state list. + * + * @param string $name Migration name + * @return string Migration name + */ + protected function get_valid_name($name) + { + // Try falling back to a valid migration name with or without leading backslash + if (!isset($this->migration_state[$name])) + { + $prepended_name = ($name[0] == '\\' ? '' : '\\') . $name; + $prefixless_name = $name[0] == '\\' ? substr($name, 1) : $name; + + if (isset($this->migration_state[$prepended_name])) + { + $name = $prepended_name; + } + else if (isset($this->migration_state[$prefixless_name])) + { + $name = $prefixless_name; + } + } + + return $name; + } + + /** * Effectively runs a single update step from the next migration to be applied. * * @return null @@ -209,6 +237,8 @@ class migrator { foreach ($this->migrations as $name) { + $name = $this->get_valid_name($name); + if (!isset($this->migration_state[$name]) || !$this->migration_state[$name]['migration_schema_done'] || !$this->migration_state[$name]['migration_data_done']) @@ -264,6 +294,9 @@ class migrator foreach ($state['migration_depends_on'] as $depend) { + $depend = $this->get_valid_name($depend); + + // Test all possible namings before throwing exception if ($this->unfulfillable($depend) !== false) { throw new \phpbb\db\migration\exception('MIGRATION_NOT_FULFILLABLE', $name, $depend); @@ -742,6 +775,8 @@ class migrator */ public function unfulfillable($name) { + $name = $this->get_valid_name($name); + if (isset($this->migration_state[$name]) || isset($this->fulfillable_migrations[$name])) { return false; @@ -757,6 +792,7 @@ class migrator foreach ($depends as $depend) { + $depend = $this->get_valid_name($depend); $unfulfillable = $this->unfulfillable($depend); if ($unfulfillable !== false) { diff --git a/phpBB/phpbb/di/container_builder.php b/phpBB/phpbb/di/container_builder.php index a214356ac3..5f3aa685bf 100644 --- a/phpBB/phpbb/di/container_builder.php +++ b/phpBB/phpbb/di/container_builder.php @@ -185,6 +185,7 @@ class container_builder } $this->container->set('config.php', $this->config_php_file); + $this->inject_dbal_driver(); if ($this->compile_container) { @@ -304,6 +305,18 @@ class container_builder } /** + * Inject the dbal connection driver into container + */ + protected function inject_dbal_driver() + { + $config_data = $this->config_php_file->get_all(); + if (!empty($config_data)) + { + $this->container->set('dbal.conn.driver', $this->get_dbal_connection()); + } + } + + /** * Get DB connection. * * @return \phpbb\db\driver\driver_interface @@ -320,6 +333,7 @@ class container_builder $this->config_php_file->get('dbpasswd'), $this->config_php_file->get('dbname'), $this->config_php_file->get('dbport'), + false, defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK ); } diff --git a/phpBB/phpbb/di/extension/config.php b/phpBB/phpbb/di/extension/config.php index 7984a783df..8c9de48823 100644 --- a/phpBB/phpbb/di/extension/config.php +++ b/phpBB/phpbb/di/extension/config.php @@ -43,12 +43,6 @@ class config extends Extension 'core.adm_relative_path' => $this->config_php->get('phpbb_adm_relative_path') ? $this->config_php->get('phpbb_adm_relative_path') : 'adm/', 'core.table_prefix' => $this->config_php->get('table_prefix'), 'cache.driver.class' => $this->convert_30_acm_type($this->config_php->get('acm_type')), - 'dbal.driver.class' => $this->config_php->convert_30_dbms_to_31($this->config_php->get('dbms')), - 'dbal.dbhost' => $this->config_php->get('dbhost'), - 'dbal.dbuser' => $this->config_php->get('dbuser'), - 'dbal.dbpasswd' => $this->config_php->get('dbpasswd'), - 'dbal.dbname' => $this->config_php->get('dbname'), - 'dbal.dbport' => $this->config_php->get('dbport'), 'dbal.new_link' => defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK, ); $parameter_bag = $container->getParameterBag(); diff --git a/phpBB/phpbb/event/kernel_exception_subscriber.php b/phpBB/phpbb/event/kernel_exception_subscriber.php index 9d15f9370e..1ee771cfe7 100644 --- a/phpBB/phpbb/event/kernel_exception_subscriber.php +++ b/phpBB/phpbb/event/kernel_exception_subscriber.php @@ -61,7 +61,7 @@ class kernel_exception_subscriber implements EventSubscriberInterface $exception = $event->getException(); $message = $exception->getMessage(); - $this->type_caster->set_var($message, $message, 'string', false, false); + $this->type_caster->set_var($message, $message, 'string', true, false); if ($exception instanceof \phpbb\exception\exception_interface) { diff --git a/phpBB/phpbb/event/php_exporter.php b/phpBB/phpbb/event/php_exporter.php index d2ab0595c0..ae3553c558 100644 --- a/phpBB/phpbb/event/php_exporter.php +++ b/phpBB/phpbb/event/php_exporter.php @@ -510,7 +510,7 @@ class php_exporter /** * Find the "@changed" Information lines * - * @param string $tag_name Should be 'changed' or 'change' + * @param string $tag_name Should be 'change', not 'changed' * @return array Absolute line numbers * @throws \LogicException */ @@ -658,7 +658,7 @@ class php_exporter { $match = array(); $line = str_replace("\t", ' ', ltrim($line, "\t ")); - preg_match('#^\* @change(d)? (\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?)( (?:.*))?$#', $line, $match); + preg_match('#^\* @changed (\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?)( (?:.*))?$#', $line, $match); if (!isset($match[2])) { throw new \LogicException("Invalid '@changed' information for event " diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php index 76f0e3558e..e7e5f83c23 100644 --- a/phpBB/phpbb/extension/manager.php +++ b/phpBB/phpbb/extension/manager.php @@ -149,10 +149,10 @@ class manager * Instantiates the metadata manager for the extension with the given name * * @param string $name The extension name - * @param \phpbb\template\template $template The template manager + * @param \phpbb\template\template $template The template manager or null * @return \phpbb\extension\metadata_manager Instance of the metadata manager */ - public function create_extension_metadata_manager($name, \phpbb\template\template $template) + public function create_extension_metadata_manager($name, \phpbb\template\template $template = null) { return new \phpbb\extension\metadata_manager($name, $this->config, $this, $template, $this->user, $this->phpbb_root_path); } @@ -433,25 +433,11 @@ class manager if ($file_info->isFile() && $file_info->getFilename() == 'composer.json') { $ext_name = $iterator->getInnerIterator()->getSubPath(); - $composer_file = $iterator->getPath() . '/composer.json'; - - // Ignore the extension if there is no composer.json. - if (!is_readable($composer_file) || !($ext_info = file_get_contents($composer_file))) - { - continue; - } - - $ext_info = json_decode($ext_info, true); $ext_name = str_replace(DIRECTORY_SEPARATOR, '/', $ext_name); - - // Ignore the extension if directory depth is not correct or if the directory structure - // does not match the name value specified in composer.json. - if (substr_count($ext_name, '/') !== 1 || !isset($ext_info['name']) || $ext_name != $ext_info['name']) + if ($this->is_available($ext_name)) { - continue; + $available[$ext_name] = $this->phpbb_root_path . 'ext/' . $ext_name . '/'; } - - $available[$ext_name] = $this->phpbb_root_path . 'ext/' . $ext_name . '/'; } } ksort($available); @@ -524,7 +510,15 @@ class manager */ public function is_available($name) { - return file_exists($this->get_extension_path($name, true)); + $md_manager = $this->create_extension_metadata_manager($name); + try + { + return $md_manager->get_metadata('all') && $md_manager->validate_enable(); + } + catch (\phpbb\extension\exception $e) + { + return false; + } } /** diff --git a/phpBB/phpbb/extension/metadata_manager.php b/phpBB/phpbb/extension/metadata_manager.php index a64d88fe39..a09f07bed2 100644 --- a/phpBB/phpbb/extension/metadata_manager.php +++ b/phpBB/phpbb/extension/metadata_manager.php @@ -66,17 +66,18 @@ class metadata_manager */ protected $metadata_file; + // @codingStandardsIgnoreStart /** * Creates the metadata manager * * @param string $ext_name Name (including vendor) of the extension * @param \phpbb\config\config $config phpBB Config instance * @param \phpbb\extension\manager $extension_manager An instance of the phpBB extension manager - * @param \phpbb\template\template $template phpBB Template instance + * @param \phpbb\template\template $template phpBB Template instance or null * @param \phpbb\user $user User instance * @param string $phpbb_root_path Path to the phpbb includes directory. */ - public function __construct($ext_name, \phpbb\config\config $config, \phpbb\extension\manager $extension_manager, \phpbb\template\template $template, \phpbb\user $user, $phpbb_root_path) + public function __construct($ext_name, \phpbb\config\config $config, \phpbb\extension\manager $extension_manager, \phpbb\template\template $template = null, \phpbb\user $user, $phpbb_root_path) { $this->config = $config; $this->extension_manager = $extension_manager; @@ -88,6 +89,7 @@ class metadata_manager $this->metadata = array(); $this->metadata_file = ''; } + // @codingStandardsIgnoreEnd /** * Processes and gets the metadata requested @@ -97,50 +99,38 @@ class metadata_manager */ public function get_metadata($element = 'all') { - $this->set_metadata_file(); - - // Fetch the metadata - $this->fetch_metadata(); - - // Clean the metadata - $this->clean_metadata_array(); + // Fetch and clean the metadata if not done yet + if ($this->metadata_file === '') + { + $this->fetch_metadata_from_file(); + } switch ($element) { case 'all': default: - // Validate the metadata - if (!$this->validate()) - { - return false; - } - + $this->validate(); return $this->metadata; break; + case 'version': case 'name': - return ($this->validate('name')) ? $this->metadata['name'] : false; + $this->validate($element); + return $this->metadata[$element]; break; case 'display-name': - if (isset($this->metadata['extra']['display-name'])) - { - return $this->metadata['extra']['display-name']; - } - else - { - return ($this->validate('name')) ? $this->metadata['name'] : false; - } + return (isset($this->metadata['extra']['display-name'])) ? $this->metadata['extra']['display-name'] : $this->get_metadata('name'); break; } } /** - * Sets the filepath of the metadata file + * Sets the path of the metadata file, gets its contents and cleans loaded file * * @throws \phpbb\extension\exception */ - private function set_metadata_file() + private function fetch_metadata_from_file() { $ext_filepath = $this->extension_manager->get_extension_path($this->ext_name); $metadata_filepath = $this->phpbb_root_path . $ext_filepath . 'composer.json'; @@ -151,37 +141,19 @@ class metadata_manager { throw new \phpbb\extension\exception($this->user->lang('FILE_NOT_FOUND', $this->metadata_file)); } - } - /** - * Gets the contents of the composer.json file - * - * @return bool True if success, throws an exception on failure - * @throws \phpbb\extension\exception - */ - private function fetch_metadata() - { - if (!file_exists($this->metadata_file)) + if (!($file_contents = file_get_contents($this->metadata_file))) { - throw new \phpbb\extension\exception($this->user->lang('FILE_NOT_FOUND', $this->metadata_file)); + throw new \phpbb\extension\exception($this->user->lang('FILE_CONTENT_ERR', $this->metadata_file)); } - else - { - if (!($file_contents = file_get_contents($this->metadata_file))) - { - throw new \phpbb\extension\exception($this->user->lang('FILE_CONTENT_ERR', $this->metadata_file)); - } - - if (($metadata = json_decode($file_contents, true)) === null) - { - throw new \phpbb\extension\exception($this->user->lang('FILE_JSON_DECODE_ERR', $this->metadata_file)); - } - - array_walk_recursive($metadata, array($this, 'sanitize_json')); - $this->metadata = $metadata; - return true; + if (($metadata = json_decode($file_contents, true)) === null) + { + throw new \phpbb\extension\exception($this->user->lang('FILE_JSON_DECODE_ERR', $this->metadata_file)); } + + array_walk_recursive($metadata, array($this, 'sanitize_json')); + $this->metadata = $metadata; } /** @@ -196,16 +168,6 @@ class metadata_manager } /** - * This array handles the cleaning of the array - * - * @return array Contains the cleaned metadata array - */ - private function clean_metadata_array() - { - return $this->metadata; - } - - /** * Validate fields * * @param string $name ("all" for display and enable validation @@ -227,10 +189,8 @@ class metadata_manager switch ($name) { case 'all': - $this->validate('display'); - $this->validate_enable(); - break; + // no break case 'display': foreach ($fields as $field => $data) @@ -287,40 +247,43 @@ class metadata_manager /** * This array handles the verification that this extension can be enabled on this board * - * @return bool True if validation succeeded, False if failed + * @return bool True if validation succeeded, throws an exception if invalid + * @throws \phpbb\extension\exception */ public function validate_enable() { // Check for valid directory & phpBB, PHP versions - if (!$this->validate_dir() || !$this->validate_require_phpbb() || !$this->validate_require_php()) - { - return false; - } - - return true; + return $this->validate_dir() && $this->validate_require_phpbb() && $this->validate_require_php(); } /** * Validates the most basic directory structure to ensure it follows <vendor>/<ext> convention. * - * @return boolean True when passes validation + * @return boolean True when passes validation, throws an exception if invalid + * @throws \phpbb\extension\exception */ public function validate_dir() { - return (substr_count($this->ext_name, '/') === 1 && $this->ext_name == $this->get_metadata('name')); + if (substr_count($this->ext_name, '/') !== 1 || $this->ext_name != $this->get_metadata('name')) + { + throw new \phpbb\extension\exception($this->user->lang('EXTENSION_DIR_INVALID')); + } + + return true; } /** * Validates the contents of the phpbb requirement field * - * @return boolean True when passes validation + * @return boolean True when passes validation, throws an exception if invalid + * @throws \phpbb\extension\exception */ public function validate_require_phpbb() { if (!isset($this->metadata['extra']['soft-require']['phpbb/phpbb'])) { - return false; + throw new \phpbb\extension\exception($this->user->lang('META_FIELD_NOT_SET', 'soft-require')); } return true; @@ -329,13 +292,14 @@ class metadata_manager /** * Validates the contents of the php requirement field * - * @return boolean True when passes validation + * @return boolean True when passes validation, throws an exception if invalid + * @throws \phpbb\extension\exception */ public function validate_require_php() { if (!isset($this->metadata['require']['php'])) { - return false; + throw new \phpbb\extension\exception($this->user->lang('META_FIELD_NOT_SET', 'require php')); } return true; @@ -358,10 +322,10 @@ class metadata_manager 'META_LICENSE' => $this->metadata['license'], 'META_REQUIRE_PHP' => (isset($this->metadata['require']['php'])) ? $this->metadata['require']['php'] : '', - 'META_REQUIRE_PHP_FAIL' => !$this->validate_require_php(), + 'META_REQUIRE_PHP_FAIL' => (isset($this->metadata['require']['php'])) ? false : true, 'META_REQUIRE_PHPBB' => (isset($this->metadata['extra']['soft-require']['phpbb/phpbb'])) ? $this->metadata['extra']['soft-require']['phpbb/phpbb'] : '', - 'META_REQUIRE_PHPBB_FAIL' => !$this->validate_require_phpbb(), + 'META_REQUIRE_PHPBB_FAIL' => (isset($this->metadata['extra']['soft-require']['phpbb/phpbb'])) ? false : true, 'META_DISPLAY_NAME' => (isset($this->metadata['extra']['display-name'])) ? $this->metadata['extra']['display-name'] : '', )); diff --git a/phpBB/phpbb/feed/attachments_base.php b/phpBB/phpbb/feed/attachments_base.php index 04812f1570..df8f29a626 100644 --- a/phpBB/phpbb/feed/attachments_base.php +++ b/phpBB/phpbb/feed/attachments_base.php @@ -25,8 +25,11 @@ abstract class attachments_base extends \phpbb\feed\base /** * Retrieve the list of attachments that may be displayed + * + * @param array $post_ids Specify for which post IDs to fetch the attachments (optional) + * @param array $topic_ids Specify for which topic IDs to fetch the attachments (optional) */ - protected function fetch_attachments() + protected function fetch_attachments($post_ids = array(), $topic_ids = array()) { $sql_array = array( 'SELECT' => 'a.*', @@ -37,7 +40,20 @@ abstract class attachments_base extends \phpbb\feed\base 'ORDER_BY' => 'a.filetime DESC, a.post_msg_id ASC', ); - if (isset($this->topic_id)) + if (!empty($post_ids)) + { + $sql_array['WHERE'] .= 'AND ' . $this->db->sql_in_set('a.post_msg_id', $post_ids); + } + else if (!empty($topic_ids)) + { + if (isset($this->topic_id)) + { + $topic_ids[] = $this->topic_id; + } + + $sql_array['WHERE'] .= 'AND ' . $this->db->sql_in_set('a.topic_id', $topic_ids); + } + else if (isset($this->topic_id)) { $sql_array['WHERE'] .= 'AND a.topic_id = ' . (int) $this->topic_id; } @@ -51,6 +67,11 @@ abstract class attachments_base extends \phpbb\feed\base ); $sql_array['WHERE'] .= 'AND t.forum_id = ' . (int) $this->forum_id; } + else + { + // Do not allow querying the full attachments table + throw new \RuntimeException($this->user->lang('INVALID_FEED_ATTACHMENTS')); + } $sql = $this->db->sql_build_query('SELECT', $sql_array); $result = $this->db->sql_query($sql); @@ -64,15 +85,6 @@ abstract class attachments_base extends \phpbb\feed\base } /** - * {@inheritDoc} - */ - public function open() - { - parent::open(); - $this->fetch_attachments(); - } - - /** * Get attachments related to a given post * * @param $post_id int Post id diff --git a/phpBB/phpbb/feed/forum.php b/phpBB/phpbb/feed/forum.php index 7a2087c1cd..6aba12a147 100644 --- a/phpBB/phpbb/feed/forum.php +++ b/phpBB/phpbb/feed/forum.php @@ -112,6 +112,8 @@ class forum extends \phpbb\feed\post_base return false; } + parent::fetch_attachments(array(), $topic_ids); + $this->sql = array( 'SELECT' => 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_visibility, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment, ' . 'u.username, u.user_id', diff --git a/phpBB/phpbb/feed/news.php b/phpBB/phpbb/feed/news.php index a02c199d85..5d4786518b 100644 --- a/phpBB/phpbb/feed/news.php +++ b/phpBB/phpbb/feed/news.php @@ -83,6 +83,8 @@ class news extends \phpbb\feed\topic_base return false; } + parent::fetch_attachments($post_ids); + $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views, t.topic_time, t.topic_last_post_time, diff --git a/phpBB/phpbb/feed/overall.php b/phpBB/phpbb/feed/overall.php index ab452f5386..1176a9c182 100644 --- a/phpBB/phpbb/feed/overall.php +++ b/phpBB/phpbb/feed/overall.php @@ -52,6 +52,8 @@ class overall extends \phpbb\feed\post_base return false; } + parent::fetch_attachments(array(), $topic_ids); + // Get the actual data $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, ' . diff --git a/phpBB/phpbb/feed/topic.php b/phpBB/phpbb/feed/topic.php index 66c49e55cf..295bf3f795 100644 --- a/phpBB/phpbb/feed/topic.php +++ b/phpBB/phpbb/feed/topic.php @@ -91,6 +91,8 @@ class topic extends \phpbb\feed\post_base function get_sql() { + parent::fetch_attachments(); + $this->sql = array( 'SELECT' => 'p.post_id, p.post_time, p.post_edit_time, p.post_visibility, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment, ' . 'u.username, u.user_id', diff --git a/phpBB/phpbb/feed/topics.php b/phpBB/phpbb/feed/topics.php index 2b9cb3501a..e6416bc064 100644 --- a/phpBB/phpbb/feed/topics.php +++ b/phpBB/phpbb/feed/topics.php @@ -55,6 +55,8 @@ class topics extends \phpbb\feed\topic_base return false; } + parent::fetch_attachments($post_ids); + $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views, t.topic_time, t.topic_last_post_time, diff --git a/phpBB/phpbb/feed/topics_active.php b/phpBB/phpbb/feed/topics_active.php index 6d5eddfc16..3b751f3233 100644 --- a/phpBB/phpbb/feed/topics_active.php +++ b/phpBB/phpbb/feed/topics_active.php @@ -71,6 +71,8 @@ class topics_active extends \phpbb\feed\topic_base return false; } + parent::fetch_attachments($post_ids); + $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, t.topic_id, t.topic_title, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views, diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php index 094ff78abe..8f199cd931 100644 --- a/phpBB/phpbb/log/log.php +++ b/phpBB/phpbb/log/log.php @@ -893,9 +893,29 @@ class log implements \phpbb\log\log_interface $forum_auth = array('f_read' => array(), 'm_' => array()); $topic_ids = array_unique($topic_ids); - $sql = 'SELECT topic_id, forum_id - FROM ' . TOPICS_TABLE . ' - WHERE ' . $this->db->sql_in_set('topic_id', array_map('intval', $topic_ids)); + $sql_ary = array( + 'SELECT' => 'topic_id, forum_id', + 'FROM' => array( + TOPICS_TABLE => 't', + ), + 'WHERE' => $this->db->sql_in_set('topic_id', array_map('intval', $topic_ids)), + ); + + /** + * Allow modifying SQL query before topic data is retrieved. + * + * @event core.phpbb_log_get_topic_auth_sql_before + * @var array topic_ids Array with unique topic IDs + * @var array sql_ary SQL array + * @since 3.1.11-RC1 + */ + $vars = array( + 'topic_ids', + 'sql_ary', + ); + extract($this->dispatcher->trigger_event('core.phpbb_log_get_topic_auth_sql_before', compact($vars))); + + $sql = $this->db->sql_build_query('SELECT', $sql_ary); $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) diff --git a/phpBB/phpbb/notification/type/report_pm.php b/phpBB/phpbb/notification/type/report_pm.php index cc32984ac6..fc39623c5c 100644 --- a/phpBB/phpbb/notification/type/report_pm.php +++ b/phpBB/phpbb/notification/type/report_pm.php @@ -141,6 +141,8 @@ class report_pm extends \phpbb\notification\type\pm */ public function get_email_template_variables() { + $user_data = $this->user_loader->get_user($this->get_data('reporter_id')); + return array( 'AUTHOR_NAME' => htmlspecialchars_decode($user_data['username']), 'SUBJECT' => htmlspecialchars_decode(censor_text($this->get_data('message_subject'))), diff --git a/phpBB/phpbb/plupload/plupload.php b/phpBB/phpbb/plupload/plupload.php index 7f6267ed32..04d681cea6 100644 --- a/phpBB/phpbb/plupload/plupload.php +++ b/phpBB/phpbb/plupload/plupload.php @@ -266,7 +266,7 @@ class plupload if ($this->config['img_max_height'] > 0 && $this->config['img_max_width'] > 0) { $resize = sprintf( - 'resize: {width: %d, height: %d, quality: 100},', + 'resize: {width: %d, height: %d, quality: 85},', (int) $this->config['img_max_width'], (int) $this->config['img_max_height'] ); diff --git a/phpBB/phpbb/profilefields/type/type_date.php b/phpBB/phpbb/profilefields/type/type_date.php index 90ac9a6703..63a0c79a3d 100644 --- a/phpBB/phpbb/profilefields/type/type_date.php +++ b/phpBB/phpbb/profilefields/type/type_date.php @@ -264,7 +264,7 @@ class type_date extends type_base } $profile_row['s_year_options'] = '<option value="0"' . ((!$year) ? ' selected="selected"' : '') . '>--</option>'; - for ($i = $now['year'] - 100; $i <= $now['year'] + 100; $i++) + for ($i = 1901; $i <= $now['year'] + 50; $i++) { $profile_row['s_year_options'] .= '<option value="' . $i . '"' . (($i == $year) ? ' selected="selected"' : '') . ">$i</option>"; } diff --git a/phpBB/phpbb/profilefields/type/type_interface.php b/phpBB/phpbb/profilefields/type/type_interface.php index ec770f9467..93b9e4b893 100644 --- a/phpBB/phpbb/profilefields/type/type_interface.php +++ b/phpBB/phpbb/profilefields/type/type_interface.php @@ -134,6 +134,14 @@ interface type_interface public function get_field_ident($field_data); /** + * Get the localized name of the field + * + * @param string $field_name Unlocalized name of this field + * @return string Localized name of the field + */ + public function get_field_name($field_name); + + /** * Get the column type for the database * * @return string Returns the database column type diff --git a/phpBB/phpbb/profilefields/type/type_string.php b/phpBB/phpbb/profilefields/type/type_string.php index a8432eaae5..8710c8c603 100644 --- a/phpBB/phpbb/profilefields/type/type_string.php +++ b/phpBB/phpbb/profilefields/type/type_string.php @@ -63,7 +63,7 @@ class type_string extends type_string_common $options = array( 0 => array('TITLE' => $this->user->lang['FIELD_LENGTH'], 'FIELD' => '<input type="number" min="0" max="99999" name="field_length" value="' . $field_data['field_length'] . '" />'), 1 => array('TITLE' => $this->user->lang['MIN_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" max="99999" name="field_minlen" value="' . $field_data['field_minlen'] . '" />'), - 2 => array('TITLE' => $this->user->lang['MAX_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0 max="99999"" name="field_maxlen" value="' . $field_data['field_maxlen'] . '" />'), + 2 => array('TITLE' => $this->user->lang['MAX_FIELD_CHARS'], 'FIELD' => '<input type="number" min="0" max="99999" name="field_maxlen" value="' . $field_data['field_maxlen'] . '" />'), 3 => array('TITLE' => $this->user->lang['FIELD_VALIDATION'], 'FIELD' => '<select name="field_validation">' . $this->validate_options($field_data) . '</select>'), ); diff --git a/phpBB/phpbb/request/request.php b/phpBB/phpbb/request/request.php index 4cac6fbaea..00ff9064cb 100644 --- a/phpBB/phpbb/request/request.php +++ b/phpBB/phpbb/request/request.php @@ -169,12 +169,6 @@ class request implements \phpbb\request\request_interface $GLOBALS[$this->super_globals[$super_global]][$var_name] = $value; } } - - if (!$this->super_globals_disabled()) - { - unset($GLOBALS[$this->super_globals[$super_global]][$var_name]); - $GLOBALS[$this->super_globals[$super_global]][$var_name] = $value; - } } /** diff --git a/phpBB/phpbb/search/fulltext_mysql.php b/phpBB/phpbb/search/fulltext_mysql.php index 9faf5ca08b..64a63e83e0 100644 --- a/phpBB/phpbb/search/fulltext_mysql.php +++ b/phpBB/phpbb/search/fulltext_mysql.php @@ -272,6 +272,27 @@ class fulltext_mysql extends \phpbb\search\base foreach ($this->split_words as $i => $word) { + // Check for not allowed search queries for InnoDB. + // We assume similar restrictions for MyISAM, which is usually even + // slower but not as restrictive as InnoDB. + // InnoDB full-text search does not support the use of a leading + // plus sign with wildcard ('+*'), a plus and minus sign + // combination ('+-'), or leading a plus and minus sign combination. + // InnoDB full-text search only supports leading plus or minus signs. + // For example, InnoDB supports '+apple' but does not support 'apple+'. + // Specifying a trailing plus or minus sign causes InnoDB to report + // a syntax error. InnoDB full-text search does not support the use + // of multiple operators on a single search word, as in this example: + // '++apple'. Use of multiple operators on a single search word + // returns a syntax error to standard out. + // Also, ensure that the wildcard character is only used at the + // end of the line as it's intended by MySQL. + if (preg_match('#^(\+[+-]|\+\*|.+[+-]$|.+\*(?!$))#', $word)) + { + unset($this->split_words[$i]); + continue; + } + $clean_word = preg_replace('#^[+\-|"]#', '', $word); // check word length @@ -942,38 +963,45 @@ class fulltext_mysql extends \phpbb\search\base $this->get_stats(); } - $alter = array(); + $alter_list = array(); if (!isset($this->stats['post_subject'])) { + $alter_entry = array(); if ($this->db->get_sql_layer() == 'mysqli' || version_compare($this->db->sql_server_info(true), '4.1.3', '>=')) { - $alter[] = 'MODIFY post_subject varchar(255) COLLATE utf8_unicode_ci DEFAULT \'\' NOT NULL'; + $alter_entry[] = 'MODIFY post_subject varchar(255) COLLATE utf8_unicode_ci DEFAULT \'\' NOT NULL'; } else { - $alter[] = 'MODIFY post_subject text NOT NULL'; + $alter_entry[] = 'MODIFY post_subject text NOT NULL'; } - $alter[] = 'ADD FULLTEXT (post_subject)'; + $alter_entry[] = 'ADD FULLTEXT (post_subject)'; + $alter_list[] = $alter_entry; } if (!isset($this->stats['post_content'])) { + $alter_entry = array(); if ($this->db->get_sql_layer() == 'mysqli' || version_compare($this->db->sql_server_info(true), '4.1.3', '>=')) { - $alter[] = 'MODIFY post_text mediumtext COLLATE utf8_unicode_ci NOT NULL'; + $alter_entry[] = 'MODIFY post_text mediumtext COLLATE utf8_unicode_ci NOT NULL'; } else { - $alter[] = 'MODIFY post_text mediumtext NOT NULL'; + $alter_entry[] = 'MODIFY post_text mediumtext NOT NULL'; } - $alter[] = 'ADD FULLTEXT post_content (post_text, post_subject)'; + $alter_entry[] = 'ADD FULLTEXT post_content (post_text, post_subject)'; + $alter_list[] = $alter_entry; } - if (sizeof($alter)) + if (sizeof($alter_list)) { - $this->db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' ' . implode(', ', $alter)); + foreach ($alter_list as $alter) + { + $this->db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' ' . implode(', ', $alter)); + } } $this->db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE); diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index eb5543b50b..45e82df591 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -460,6 +460,9 @@ class session $this->data['is_bot'] = (!$this->data['is_registered'] && $this->data['user_id'] != ANONYMOUS) ? true : false; $this->data['user_lang'] = basename($this->data['user_lang']); + // Is user banned? Are they excluded? Won't return on ban, exists within method + $this->check_ban_for_current_session($config); + return true; } } @@ -666,19 +669,7 @@ class session // session exists in which case session_id will also be set // Is user banned? Are they excluded? Won't return on ban, exists within method - if ($this->data['user_type'] != USER_FOUNDER) - { - if (!$config['forwarded_for_check']) - { - $this->check_ban($this->data['user_id'], $this->ip); - } - else - { - $ips = explode(' ', $this->forwarded_for); - $ips[] = $this->ip; - $this->check_ban($this->data['user_id'], $ips); - } - } + $this->check_ban_for_current_session($config); $this->data['is_registered'] = (!$bot && $this->data['user_id'] != ANONYMOUS && ($this->data['user_type'] == USER_NORMAL || $this->data['user_type'] == USER_FOUNDER)) ? true : false; $this->data['is_bot'] = ($bot) ? true : false; @@ -1268,9 +1259,6 @@ class session $message .= ($ban_row['ban_give_reason']) ? '<br /><br />' . sprintf($this->lang['BOARD_BAN_REASON'], $ban_row['ban_give_reason']) : ''; $message .= '<br /><br /><em>' . $this->lang['BAN_TRIGGERED_BY_' . strtoupper($ban_triggered_by)] . '</em>'; - // To circumvent session_begin returning a valid value and the check_ban() not called on second page view, we kill the session again - $this->session_kill(false); - // A very special case... we are within the cron script which is not supposed to print out the ban message... show blank page if (defined('IN_CRON')) { @@ -1279,6 +1267,9 @@ class session exit; } + // To circumvent session_begin returning a valid value and the check_ban() not called on second page view, we kill the session again + $this->session_kill(false); + trigger_error($message); } @@ -1286,6 +1277,28 @@ class session } /** + * Check the current session for bans + * + * @return true if session user is banned. + */ + protected function check_ban_for_current_session($config) + { + if (!defined('SKIP_CHECK_BAN') && $this->data['user_type'] != USER_FOUNDER) + { + if (!$config['forwarded_for_check']) + { + $this->check_ban($this->data['user_id'], $this->ip); + } + else + { + $ips = explode(' ', $this->forwarded_for); + $ips[] = $this->ip; + $this->check_ban($this->data['user_id'], $ips); + } + } + } + + /** * Check if ip is blacklisted * This should be called only where absolutely necessary * @@ -1576,7 +1589,7 @@ class session } // 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'])) + if ($this->time_now - ((isset($this->data['session_time'])) ? $this->data['session_time'] : 0) > 60 || ($this->update_session_page && $this->data['session_page'] != $this->page['page'])) { $sql_ary = array('session_time' => $this->time_now); diff --git a/phpBB/phpbb/template/base.php b/phpBB/phpbb/template/base.php index 9a40702ba8..41c0a01ba8 100644 --- a/phpBB/phpbb/template/base.php +++ b/phpBB/phpbb/template/base.php @@ -133,6 +133,14 @@ abstract class base implements template } /** + * {@inheritdoc} + */ + public function find_key_index($blockname, $key) + { + return $this->context->find_key_index($blockname, $key); + } + + /** * Calls hook if any is defined. * * @param string $handle Template handle being displayed. diff --git a/phpBB/phpbb/template/context.php b/phpBB/phpbb/template/context.php index 4ee48205c8..5d04a09865 100644 --- a/phpBB/phpbb/template/context.php +++ b/phpBB/phpbb/template/context.php @@ -264,6 +264,89 @@ class context } /** + * Find the index for a specified key in the innermost specified block + * + * @param string $blockname the blockname, for example 'loop' + * @param mixed $key Key to search for + * + * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position] + * + * int: Position [the position to search for] + * + * If key is false the position is set to 0 + * If key is true the position is set to the last entry + * + * @return mixed false if not found, index position otherwise; be sure to test with === + */ + public function find_key_index($blockname, $key) + { + // For nested block, $blockcount > 0, for top-level block, $blockcount == 0 + $blocks = explode('.', $blockname); + $blockcount = sizeof($blocks) - 1; + + $block = $this->tpldata; + for ($i = 0; $i < $blockcount; $i++) + { + if (($pos = strpos($blocks[$i], '[')) !== false) + { + $name = substr($blocks[$i], 0, $pos); + + if (strpos($blocks[$i], '[]') === $pos) + { + $index = sizeof($block[$name]) - 1; + } + else + { + $index = min((int) substr($blocks[$i], $pos + 1, -1), sizeof($block[$name]) - 1); + } + } + else + { + $name = $blocks[$i]; + $index = sizeof($block[$name]) - 1; + } + if (!isset($block[$name])) + { + return false; + } + $block = $block[$name]; + if (!isset($block[$index])) + { + return false; + } + $block = $block[$index]; + } + + if (!isset($block[$blocks[$i]])) + { + return false; + } + $block = $block[$blocks[$i]]; // Traverse the last block + + // Change key to zero (change first position) if false and to last position if true + if ($key === false || $key === true) + { + return ($key === false) ? 0 : sizeof($block) - 1; + } + + // Get correct position if array given + if (is_array($key)) + { + // Search array to get correct position + list($search_key, $search_value) = @each($key); + foreach ($block as $i => $val_ary) + { + if ($val_ary[$search_key] === $search_value) + { + return $i; + } + } + } + + return (is_int($key) && ((0 <= $key) && ($key < sizeof($block)))) ? $key : false; + } + + /** * Change already assigned key variable pair (one-dimensional - single loop entry) * * An example of how to use this function: @@ -293,45 +376,49 @@ class context public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert') { $this->num_rows_is_set = false; - if (strpos($blockname, '.') !== false) - { - // Nested block. - $blocks = explode('.', $blockname); - $blockcount = sizeof($blocks) - 1; - $block = &$this->tpldata; - for ($i = 0; $i < $blockcount; $i++) + // For nested block, $blockcount > 0, for top-level block, $blockcount == 0 + $blocks = explode('.', $blockname); + $blockcount = sizeof($blocks) - 1; + + $block = &$this->tpldata; + for ($i = 0; $i < $blockcount; $i++) + { + if (($pos = strpos($blocks[$i], '[')) !== false) { - if (($pos = strpos($blocks[$i], '[')) !== false) + $name = substr($blocks[$i], 0, $pos); + + if (strpos($blocks[$i], '[]') === $pos) { - $name = substr($blocks[$i], 0, $pos); - - if (strpos($blocks[$i], '[]') === $pos) - { - $index = sizeof($block[$name]) - 1; - } - else - { - $index = min((int) substr($blocks[$i], $pos + 1, -1), sizeof($block[$name]) - 1); - } + $index = sizeof($block[$name]) - 1; } else { - $name = $blocks[$i]; - $index = sizeof($block[$name]) - 1; + $index = min((int) substr($blocks[$i], $pos + 1, -1), sizeof($block[$name]) - 1); } - $block = &$block[$name]; - $block = &$block[$index]; } - - $block = &$block[$blocks[$i]]; // Traverse the last block + else + { + $name = $blocks[$i]; + $index = sizeof($block[$name]) - 1; + } + $block = &$block[$name]; + $block = &$block[$index]; } - else + $name = $blocks[$i]; + + // If last block does not exist and we are inserting, and not searching for key, we create it empty; otherwise, nothing to do + if (!isset($block[$name])) { - // Top-level block. - $block = &$this->tpldata[$blockname]; + if ($mode != 'insert' || is_array($key)) + { + return false; + } + $block[$name] = array(); } + $block = &$block[$name]; // Now we can traverse the last block + // Change key to zero (change first position) if false and to last position if true if ($key === false || $key === true) { @@ -365,20 +452,21 @@ class context if ($mode == 'insert') { // Make sure we are not exceeding the last iteration - if ($key >= sizeof($this->tpldata[$blockname])) + if ($key >= sizeof($block)) { - $key = sizeof($this->tpldata[$blockname]); - unset($this->tpldata[$blockname][($key - 1)]['S_LAST_ROW']); + $key = sizeof($block); + unset($block[($key - 1)]['S_LAST_ROW']); $vararray['S_LAST_ROW'] = true; } - else if ($key === 0) + if ($key <= 0) { - unset($this->tpldata[$blockname][0]['S_FIRST_ROW']); + $key = 0; + unset($block[0]['S_FIRST_ROW']); $vararray['S_FIRST_ROW'] = true; } // Assign S_BLOCK_NAME - $vararray['S_BLOCK_NAME'] = $blockname; + $vararray['S_BLOCK_NAME'] = $name; // Re-position template blocks for ($i = sizeof($block); $i > $key; $i--) @@ -398,6 +486,12 @@ class context // Which block to change? if ($mode == 'change') { + // If key is out of bounds, do not change anything + if ($key > sizeof($block) || $key < 0) + { + return false; + } + if ($key == sizeof($block)) { $key--; diff --git a/phpBB/phpbb/template/template.php b/phpBB/phpbb/template/template.php index 041ecb12e4..9e3d658ca8 100644 --- a/phpBB/phpbb/template/template.php +++ b/phpBB/phpbb/template/template.php @@ -173,6 +173,23 @@ interface template public function alter_block_array($blockname, array $vararray, $key = false, $mode = 'insert'); /** + * Find the index for a specified key in the innermost specified block + * + * @param string $blockname the blockname, for example 'loop' + * @param mixed $key Key to search for + * + * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position] + * + * int: Position [the position to search for] + * + * If key is false the position is set to 0 + * If key is true the position is set to the last entry + * + * @return mixed false if not found, index position otherwise; be sure to test with === + */ + public function find_key_index($blockname, $key); + + /** * Get path to template for handle (required for BBCode parser) * * @param string $handle Handle to retrieve the source file diff --git a/phpBB/phpbb/template/twig/extension.php b/phpBB/phpbb/template/twig/extension.php index 3a983491b9..d5b14129b5 100644 --- a/phpBB/phpbb/template/twig/extension.php +++ b/phpBB/phpbb/template/twig/extension.php @@ -169,8 +169,7 @@ class extension extends \Twig_Extension $args = func_get_args(); $key = $args[0]; - $context = $this->context->get_data_ref(); - $context_vars = $context['.'][0]; + $context_vars = $this->context->get_root_ref(); if (isset($context_vars['L_' . $key])) { diff --git a/phpBB/phpbb/version_helper.php b/phpBB/phpbb/version_helper.php index a1e66ba8fe..9dc5a2e7c9 100644 --- a/phpBB/phpbb/version_helper.php +++ b/phpBB/phpbb/version_helper.php @@ -184,7 +184,7 @@ class version_helper $self = $this; $current_version = $this->current_version; - // Filter out any versions less than to the current version + // Filter out any versions less than the current version $versions = array_filter($versions, function($data) use ($self, $current_version) { return $self->compare($data['current'], $current_version, '>='); }); @@ -201,11 +201,117 @@ class version_helper } /** + * Gets the latest update for the current branch the user is on + * Will suggest versions from newer branches when EoL has been reached + * and/or version from newer branch is needed for having all known security + * issues fixed. + * + * @param bool $force_update Ignores cached data. Defaults to false. + * @param bool $force_cache Force the use of the cache. Override $force_update. + * @return array Version info or empty array if there are no updates + * @throws \RuntimeException + */ + public function get_update_on_branch($force_update = false, $force_cache = false) + { + $versions = $this->get_versions_matching_stability($force_update, $force_cache); + + $self = $this; + $current_version = $this->current_version; + + // Filter out any versions less than the current version + $versions = array_filter($versions, function($data) use ($self, $current_version) { + return $self->compare($data['current'], $current_version, '>='); + }); + + // Get the lowest version from the previous list. + $update_info = array_reduce($versions, function($value, $data) use ($self, $current_version) { + if ($value === null && $self->compare($data['current'], $current_version, '>=')) + { + if (!$data['eol'] && (!$data['security'] || $self->compare($data['security'], $data['current'], '<='))) + { + return ($self->compare($data['current'], $current_version, '>')) ? $data : array(); + } + else + { + return null; + } + } + + return $value; + }); + + return $update_info === null ? array() : $update_info; + } + + /** + * Gets the latest extension update for the current phpBB branch the user is on + * Will suggest versions from newer branches when EoL has been reached + * and/or version from newer branch is needed for having all known security + * issues fixed. + * + * @param bool $force_update Ignores cached data. Defaults to false. + * @param bool $force_cache Force the use of the cache. Override $force_update. + * @return array Version info or empty array if there are no updates + * @throws \RuntimeException + */ + public function get_ext_update_on_branch($force_update = false, $force_cache = false) + { + $versions = $this->get_versions_matching_stability($force_update, $force_cache); + + $self = $this; + $current_version = $this->current_version; + + // Get current phpBB branch from version, e.g.: 3.2 + preg_match('/^(\d+\.\d+).*$/', $this->config['version'], $matches); + $current_branch = $matches[1]; + + // Filter out any versions less than the current version + $versions = array_filter($versions, function($data) use ($self, $current_version) { + return $self->compare($data['current'], $current_version, '>='); + }); + + // Filter out any phpbb branches less than the current version + $branches = array_filter(array_keys($versions), function($branch) use ($self, $current_branch) { + return $self->compare($branch, $current_branch, '>='); + }); + if (!empty($branches)) + { + $versions = array_intersect_key($versions, array_flip($branches)); + } + else + { + // If branches are empty, it means the current phpBB branch is newer than any branch the + // extension was validated against. Reverse sort the versions array so we get the newest + // validated release available. + krsort($versions); + } + + // Get the first available version from the previous list. + $update_info = array_reduce($versions, function($value, $data) use ($self, $current_version) { + if ($value === null && $self->compare($data['current'], $current_version, '>=')) + { + if (!$data['eol'] && (!$data['security'] || $self->compare($data['security'], $data['current'], '<='))) + { + return $self->compare($data['current'], $current_version, '>') ? $data : array(); + } + else + { + return null; + } + } + + return $value; + }); + + return $update_info === null ? array() : $update_info; + } + + /** * Obtains the latest version information * * @param bool $force_update Ignores cached data. Defaults to false. * @param bool $force_cache Force the use of the cache. Override $force_update. - * @return string + * @return array * @throws \RuntimeException */ public function get_suggested_updates($force_update = false, $force_cache = false) @@ -226,7 +332,7 @@ class version_helper * * @param bool $force_update Ignores cached data. Defaults to false. * @param bool $force_cache Force the use of the cache. Override $force_update. - * @return string Version info + * @return array Version info * @throws \RuntimeException */ public function get_versions_matching_stability($force_update = false, $force_cache = false) @@ -246,7 +352,7 @@ class version_helper * * @param bool $force_update Ignores cached data. Defaults to false. * @param bool $force_cache Force the use of the cache. Override $force_update. - * @return string Version info, includes stable and unstable data + * @return array Version info, includes stable and unstable data * @throws \RuntimeException */ public function get_versions($force_update = false, $force_cache = false) diff --git a/phpBB/posting.php b/phpBB/posting.php index db580d926b..35c1f84fa3 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -84,7 +84,7 @@ $current_time = time(); * NOTE: Should be actual language strings, NOT * language keys. * @since 3.1.0-a1 -* @change 3.1.2-RC1 Removed 'delete' var as it does not exist +* @changed 3.1.2-RC1 Removed 'delete' var as it does not exist */ $vars = array( 'post_id', @@ -340,11 +340,6 @@ switch ($mode) $is_authed = true; $mode = 'soft_delete'; } - else if (!$is_authed) - { - // Display the same error message for softdelete we use for delete - $mode = 'delete'; - } break; } /** @@ -393,13 +388,13 @@ $vars = array( ); extract($phpbb_dispatcher->trigger_event('core.modify_posting_auth', compact($vars))); -if (!$is_authed) +if (!$is_authed || !empty($error)) { - $check_auth = ($mode == 'quote') ? 'reply' : $mode; + $check_auth = ($mode == 'quote') ? 'reply' : (($mode == 'soft_delete') ? 'delete' : $mode); if ($user->data['is_registered']) { - trigger_error('USER_CANNOT_' . strtoupper($check_auth)); + trigger_error(empty($error) ? 'USER_CANNOT_' . strtoupper($check_auth) : implode('<br/>', $error)); } $message = $user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)]; @@ -941,7 +936,9 @@ if ($submit || $preview || $refresh) * is posting a new topic or editing a post) * @var bool refresh Whether or not to retain previously submitted data * @var object message_parser The message parser object + * @var array error Array of errors * @since 3.1.2-RC1 + * @changed 3.1.11-RC1 Added error */ $vars = array( 'post_data', @@ -956,6 +953,7 @@ if ($submit || $preview || $refresh) 'cancel', 'refresh', 'message_parser', + 'error', ); extract($phpbb_dispatcher->trigger_event('core.posting_modify_message_text', compact($vars))); @@ -1063,7 +1061,10 @@ if ($submit || $preview || $refresh) // Validate username if (($post_data['username'] && !$user->data['is_registered']) || ($mode == 'edit' && $post_data['poster_id'] == ANONYMOUS && $post_data['username'] && $post_data['post_username'] && $post_data['post_username'] != $post_data['username'])) { - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + if (!function_exists('validate_username')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } $user->add_lang('ucp'); @@ -1261,7 +1262,7 @@ if ($submit || $preview || $refresh) * @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 - * @change 3.1.5-RC1 Added poll array to the event + * @changed 3.1.5-RC1 Added poll array to the event */ $vars = array( 'post_data', @@ -1869,13 +1870,13 @@ if (($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_ * posting page via $template->assign_vars() * @var object message_parser The message parser object * @since 3.1.0-a1 -* @change 3.1.0-b3 Added vars post_data, moderators, mode, page_title, +* @changed 3.1.0-b3 Added vars post_data, moderators, mode, page_title, * s_topic_icons, form_enctype, s_action, s_hidden_fields, * post_id, topic_id, forum_id, submit, preview, save, load, * delete, cancel, refresh, error, page_data, message_parser -* @change 3.1.2-RC1 Removed 'delete' var as it does not exist -* @change 3.1.5-RC1 Added poll variables to the page_data array -* @change 3.1.6-RC1 Added 'draft_id' var +* @changed 3.1.2-RC1 Removed 'delete' var as it does not exist +* @changed 3.1.5-RC1 Added poll variables to the page_data array +* @changed 3.1.6-RC1 Added 'draft_id' var */ $vars = array( 'post_data', diff --git a/phpBB/styles/prosilver/style.cfg b/phpBB/styles/prosilver/style.cfg index 300a83164b..019db11bc7 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.10 -phpbb_version = 3.1.10 +style_version = 3.1.11 +phpbb_version = 3.1.11 # Defining a different template bitfield # template_bitfield = lNg= diff --git a/phpBB/styles/prosilver/template/ajax.js b/phpBB/styles/prosilver/template/ajax.js index 311da92a95..ec9b53328f 100644 --- a/phpBB/styles/prosilver/template/ajax.js +++ b/phpBB/styles/prosilver/template/ajax.js @@ -132,9 +132,10 @@ phpbb.markNotifications = function($popup, unreadCount) { // Update the unread count. $('strong', '#notification_list_button').html(unreadCount); - // Remove the Mark all read link & notification count if there are no unread notifications. + // Remove the Mark all read link and hide notification count if there are no unread notifications. if (!unreadCount) { - $('#mark_all_notifications, #notification_list_button > strong').remove(); + $('#mark_all_notifications').remove(); + $('#notification_list_button > strong').addClass('hidden'); } // Update page title diff --git a/phpBB/styles/prosilver/template/bbcode.html b/phpBB/styles/prosilver/template/bbcode.html index 3e38d13a32..49bcd56945 100644 --- a/phpBB/styles/prosilver/template/bbcode.html +++ b/phpBB/styles/prosilver/template/bbcode.html @@ -18,13 +18,13 @@ <!-- BEGIN inline_attachment_open --><div class="inline-attachment"><!-- END inline_attachment_open --> <!-- BEGIN inline_attachment_close --></div><!-- END inline_attachment_close --> -<!-- BEGIN b_open --><strong><!-- END b_open --> +<!-- BEGIN b_open --><strong class="text-strong"><!-- END b_open --> <!-- BEGIN b_close --></strong><!-- END b_close --> <!-- BEGIN u_open --><span style="text-decoration: underline"><!-- END u_open --> <!-- BEGIN u_close --></span><!-- END u_close --> -<!-- BEGIN i_open --><em><!-- END i_open --> +<!-- BEGIN i_open --><em class="text-italics"><!-- END i_open --> <!-- BEGIN i_close --></em><!-- END i_close --> <!-- BEGIN color --><span style="color: {COLOR}">{TEXT}</span><!-- END color --> diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index 99f3108fad..d779008f80 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -57,7 +57,7 @@ function marklist(id, name, state) { jQuery('#' + id + ' input[type=checkbox][name]').each(function() { var $this = jQuery(this); - if ($this.attr('name').substr(0, name.length) === name) { + if ($this.attr('name').substr(0, name.length) === name && !$this.prop('disabled')) { $this.prop('checked', state); } }); diff --git a/phpBB/styles/prosilver/template/forumlist_body.html b/phpBB/styles/prosilver/template/forumlist_body.html index f8d6e36c8c..a197545b90 100644 --- a/phpBB/styles/prosilver/template/forumlist_body.html +++ b/phpBB/styles/prosilver/template/forumlist_body.html @@ -47,7 +47,7 @@ <!-- EVENT forumlist_body_subforums_before --> <br /><strong>{forumrow.L_SUBFORUM_STR}{L_COLON}</strong> <!-- BEGIN subforum --> - <a href="{forumrow.subforum.U_SUBFORUM}" class="subforum<!-- IF forumrow.subforum.S_UNREAD --> unread<!-- ELSE --> read<!-- ENDIF -->" title="<!-- IF forumrow.subforum.S_UNREAD -->{L_UNREAD_POSTS}<!-- ELSE -->{L_NO_UNREAD_POSTS}<!-- ENDIF -->">{forumrow.subforum.SUBFORUM_NAME}</a><!-- IF not forumrow.subforum.S_LAST_ROW -->{L_COMMA_SEPARATOR}<!-- ENDIF --> + <!-- EVENT forumlist_body_subforum_link_prepend --><a href="{forumrow.subforum.U_SUBFORUM}" class="subforum<!-- IF forumrow.subforum.S_UNREAD --> unread<!-- ELSE --> read<!-- ENDIF -->" title="<!-- IF forumrow.subforum.S_UNREAD -->{L_UNREAD_POSTS}<!-- ELSE -->{L_NO_UNREAD_POSTS}<!-- ENDIF -->">{forumrow.subforum.SUBFORUM_NAME}</a><!-- IF not forumrow.subforum.S_LAST_ROW -->{L_COMMA_SEPARATOR}<!-- ENDIF --><!-- EVENT forumlist_body_subforum_link_append --> <!-- END subforum --> <!-- EVENT forumlist_body_subforums_after --> <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/index_body.html b/phpBB/styles/prosilver/template/index_body.html index ec5bf35476..b292c40eb2 100644 --- a/phpBB/styles/prosilver/template/index_body.html +++ b/phpBB/styles/prosilver/template/index_body.html @@ -40,13 +40,18 @@ <!-- IF U_VIEWONLINE --><h3><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a></h3><!-- ELSE --><h3>{L_WHO_IS_ONLINE}</h3><!-- ENDIF --> <p> <!-- EVENT index_body_block_online_prepend --> - {TOTAL_USERS_ONLINE} ({L_ONLINE_EXPLAIN})<br />{RECORD_USERS}<br /> <br />{LOGGED_IN_USER_LIST} - <!-- IF LEGEND --><br /><em>{L_LEGEND}{L_COLON} {LEGEND}</em><!-- ENDIF --> + {TOTAL_USERS_ONLINE} ({L_ONLINE_EXPLAIN})<br />{RECORD_USERS}<br /> + <!-- IF U_VIEWONLINE --> + <br />{LOGGED_IN_USER_LIST} + <!-- IF LEGEND --><br /><em>{L_LEGEND}{L_COLON} {LEGEND}</em><!-- ENDIF --> + <!-- ENDIF --> <!-- EVENT index_body_block_online_append --> </p> </div> <!-- ENDIF --> +<!-- EVENT index_body_birthday_block_before --> + <!-- IF S_DISPLAY_BIRTHDAY_LIST --> <div class="stat-block birthday-list"> <h3>{L_BIRTHDAYS}</h3> diff --git a/phpBB/styles/prosilver/template/jumpbox.html b/phpBB/styles/prosilver/template/jumpbox.html index 3096d08318..fcd8ddbc1e 100644 --- a/phpBB/styles/prosilver/template/jumpbox.html +++ b/phpBB/styles/prosilver/template/jumpbox.html @@ -1,32 +1,34 @@ -<!-- IF S_VIEWTOPIC --> - <p class="jumpbox-return"><a href="{U_VIEW_FORUM}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" accesskey="r">{L_RETURN_TO_FORUM}</a></p> -<!-- ELSEIF S_VIEWFORUM --> - <p class="jumpbox-return"><a href="{U_INDEX}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" accesskey="r">{L_RETURN_TO_INDEX}</a></p> -<!-- ELSEIF SEARCH_TOPIC --> - <p class="jumpbox-return"><a class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH_TOPIC}" accesskey="r">{L_RETURN_TO_TOPIC}</a></p> -<!-- ELSEIF S_SEARCH_ACTION --> - <p class="jumpbox-return"><a class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH}" title="{L_SEARCH_ADV}" accesskey="r">{L_GO_TO_SEARCH_ADV}</a></p> -<!-- ENDIF --> +<div class="action-bar actions-jump"> + <!-- IF S_VIEWTOPIC --> + <p class="jumpbox-return"><a href="{U_VIEW_FORUM}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" accesskey="r">{L_RETURN_TO_FORUM}</a></p> + <!-- ELSEIF S_VIEWFORUM --> + <p class="jumpbox-return"><a href="{U_INDEX}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" accesskey="r">{L_RETURN_TO_INDEX}</a></p> + <!-- ELSEIF SEARCH_TOPIC --> + <p class="jumpbox-return"><a class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH_TOPIC}" accesskey="r">{L_RETURN_TO_TOPIC}</a></p> + <!-- ELSEIF S_SEARCH_ACTION --> + <p class="jumpbox-return"><a class="left-box arrow-{S_CONTENT_FLOW_BEGIN}" href="{U_SEARCH}" title="{L_SEARCH_ADV}" accesskey="r">{L_GO_TO_SEARCH_ADV}</a></p> + <!-- ENDIF --> -<!-- IF S_DISPLAY_JUMPBOX --> + <!-- IF S_DISPLAY_JUMPBOX --> - <div class="dropdown-container dropdown-container-{S_CONTENT_FLOW_END}<!-- IF not S_IN_MCP --> dropdown-up<!-- ENDIF --> dropdown-{S_CONTENT_FLOW_BEGIN} dropdown-button-control" id="jumpbox"> - <span title="<!-- IF S_IN_MCP and S_MERGE_SELECT -->{L_SELECT_TOPICS_FROM}<!-- ELSEIF S_IN_MCP -->{L_MODERATE_FORUM}<!-- ELSE -->{L_JUMP_TO}<!-- ENDIF -->" class="dropdown-trigger button dropdown-select"> - <!-- IF S_IN_MCP and S_MERGE_SELECT -->{L_SELECT_TOPICS_FROM}<!-- ELSEIF S_IN_MCP -->{L_MODERATE_FORUM}<!-- ELSE -->{L_JUMP_TO}<!-- ENDIF --> - </span> - <div class="dropdown hidden"> - <div class="pointer"><div class="pointer-inner"></div></div> - <ul class="dropdown-contents"> - <!-- BEGIN jumpbox_forums --> - <!-- IF jumpbox_forums.FORUM_ID neq -1 --> - <li><!-- BEGIN level --> <!-- END level --><a href="{jumpbox_forums.LINK}">{jumpbox_forums.FORUM_NAME}</a></li> - <!-- ENDIF --> - <!-- END jumpbox_forums --> - </ul> + <div class="dropdown-container dropdown-container-{S_CONTENT_FLOW_END}<!-- IF not S_IN_MCP --> dropdown-up<!-- ENDIF --> dropdown-{S_CONTENT_FLOW_BEGIN} dropdown-button-control" id="jumpbox"> + <span title="<!-- IF S_IN_MCP and S_MERGE_SELECT -->{L_SELECT_TOPICS_FROM}<!-- ELSEIF S_IN_MCP -->{L_MODERATE_FORUM}<!-- ELSE -->{L_JUMP_TO}<!-- ENDIF -->" class="dropdown-trigger button dropdown-select"> + <!-- IF S_IN_MCP and S_MERGE_SELECT -->{L_SELECT_TOPICS_FROM}<!-- ELSEIF S_IN_MCP -->{L_MODERATE_FORUM}<!-- ELSE -->{L_JUMP_TO}<!-- ENDIF --> + </span> + <div class="dropdown hidden"> + <div class="pointer"><div class="pointer-inner"></div></div> + <ul class="dropdown-contents"> + <!-- BEGIN jumpbox_forums --> + <!-- IF jumpbox_forums.FORUM_ID neq -1 --> + <li><!-- BEGIN level --> <!-- END level --><a href="{jumpbox_forums.LINK}">{jumpbox_forums.FORUM_NAME}</a></li> + <!-- ENDIF --> + <!-- END jumpbox_forums --> + </ul> + </div> </div> - </div> -<!-- ELSE --> - <br /><br /> -<!-- ENDIF --> + <!-- ELSE --> + </br></br> + <!-- ENDIF --> +</div> diff --git a/phpBB/styles/prosilver/template/mcp_forum.html b/phpBB/styles/prosilver/template/mcp_forum.html index 5858a2c801..4c037f56ae 100644 --- a/phpBB/styles/prosilver/template/mcp_forum.html +++ b/phpBB/styles/prosilver/template/mcp_forum.html @@ -138,6 +138,7 @@ <option value="make_announce">{L_MAKE_ANNOUNCE}</option> <option value="make_global">{L_MAKE_GLOBAL}</option> <!-- ENDIF --> + <!-- EVENT mcp_forum_actions_append --> </select> <input class="button2" type="submit" value="{L_SUBMIT}" /> <div><a href="#" onclick="marklist('mcp', 'topic_id_list', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('mcp', 'topic_id_list', false); return false;">{L_UNMARK_ALL}</a></div> diff --git a/phpBB/styles/prosilver/template/mcp_post.html b/phpBB/styles/prosilver/template/mcp_post.html index e5777d206a..5acdcef859 100644 --- a/phpBB/styles/prosilver/template/mcp_post.html +++ b/phpBB/styles/prosilver/template/mcp_post.html @@ -294,6 +294,14 @@ </tbody> </table> + <div class="pagination"> + <!-- INCLUDE pagination.html --> + </div> + </div> + </div> + + <div class="panel"> + <div class="inner"> <table class="table1"> <thead> <tr> @@ -315,7 +323,27 @@ </tbody> </table> - <p><a href="{U_LOOKUP_ALL}#ip">{L_LOOKUP_ALL}</a></p> + <div class="buttons"> + <p><a href="{U_LOOKUP_ALL}#ip">{L_LOOKUP_ALL}</a></p> + </div> + + <div class="pagination"> + <ul> + <!-- BEGIN pagination_ips --> + <!-- IF pagination_ips.S_IS_PREV --> + <li class="previous"><a href="{pagination_ips.PAGE_URL}" rel="prev" role="button">{L_PREVIOUS}</a></li> + <!-- ELSEIF pagination_ips.S_IS_CURRENT --> + <li class="active"><span>{pagination_ips.PAGE_NUMBER}</span></li> + <!-- ELSEIF pagination_ips.S_IS_ELLIPSIS --> + <li class="ellipsis" role="separator"><span>{L_ELLIPSIS}</span></li> + <!-- ELSEIF pagination_ips.S_IS_NEXT --> + <li class="next"><a href="{pagination_ips.PAGE_URL}" rel="next" role="button">{L_NEXT}</a></li> + <!-- ELSE --> + <li><a href="{pagination_ips.PAGE_URL}" role="button">{pagination_ips.PAGE_NUMBER}</a></li> + <!-- ENDIF --> + <!-- END pagination_ips --> + </ul> + </div> </div> </div> diff --git a/phpBB/styles/prosilver/template/mcp_topic.html b/phpBB/styles/prosilver/template/mcp_topic.html index 22d837b3d1..af4b63265f 100644 --- a/phpBB/styles/prosilver/template/mcp_topic.html +++ b/phpBB/styles/prosilver/template/mcp_topic.html @@ -111,7 +111,9 @@ </li> </ul> + <!-- EVENT mcp_topic_postrow_post_subject_before --> <h3><a href="{postrow.U_POST_DETAILS}">{postrow.POST_SUBJECT}</a></h3> + <!-- EVENT mcp_topic_postrow_post_subject_after --> <!-- EVENT mcp_topic_postrow_post_details_before --> <p class="author"><a href="#pr{postrow.POST_ID}">{postrow.MINI_POST_IMG}</a> {L_POSTED} {postrow.POST_DATE} {L_POST_BY_AUTHOR} <strong>{postrow.POST_AUTHOR_FULL}</strong><!-- IF postrow.U_MCP_DETAILS --> [ <a href="{postrow.U_MCP_DETAILS}">{L_POST_DETAILS}</a> ]<!-- ENDIF --></p> diff --git a/phpBB/styles/prosilver/template/memberlist_team.html b/phpBB/styles/prosilver/template/memberlist_team.html index b7f2d66d94..327dde412e 100644 --- a/phpBB/styles/prosilver/template/memberlist_team.html +++ b/phpBB/styles/prosilver/template/memberlist_team.html @@ -19,7 +19,7 @@ <tbody> <!-- BEGIN user --> <tr class="<!-- IF group.user.S_ROW_COUNT is even -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF group.user.S_INACTIVE --> inactive<!-- ENDIF -->"> - <td><!-- IF group.user.RANK_IMG --><span class="rank-img">{group.user.RANK_IMG}</span><!-- ELSE --><span class="rank-img">{group.user.RANK_TITLE}</span><!-- ENDIF -->{group.user.USERNAME_FULL}<!-- IF group.user.S_INACTIVE --> ({L_INACTIVE})<!-- ENDIF --></td> + <td><!-- IF group.user.RANK_IMG --><span class="rank-img">{group.user.RANK_IMG}</span><!-- ELSE --><span class="rank-img">{group.user.RANK_TITLE}</span><!-- ENDIF --><!-- EVENT memberlist_team_username_prepend -->{group.user.USERNAME_FULL}<!-- IF group.user.S_INACTIVE --> ({L_INACTIVE})<!-- ENDIF --><!-- EVENT memberlist_team_username_append --></td> <td class="info"><!-- IF group.user.U_GROUP --> <a<!-- IF group.user.GROUP_COLOR --> style="font-weight: bold; color: #{group.user.GROUP_COLOR}"<!-- ENDIF --> href="{group.user.U_GROUP}">{group.user.GROUP_NAME}</a> <!-- ELSE --> diff --git a/phpBB/styles/prosilver/template/navbar_header.html b/phpBB/styles/prosilver/template/navbar_header.html index e5f354a943..bdfb5fb87d 100644 --- a/phpBB/styles/prosilver/template/navbar_header.html +++ b/phpBB/styles/prosilver/template/navbar_header.html @@ -72,12 +72,12 @@ </li> <!-- IF S_DISPLAY_PM --> <li class="small-icon icon-pm rightside" data-skip-responsive="true"> - <a href="{U_PRIVATEMSGS}" role="menuitem"><span>{L_PRIVATE_MESSAGES} </span><!-- IF PRIVATE_MESSAGE_COUNT --><strong class="badge">{PRIVATE_MESSAGE_COUNT}</strong><!-- ENDIF --></a> + <a href="{U_PRIVATEMSGS}" role="menuitem"><span>{L_PRIVATE_MESSAGES} </span><strong class="badge<!-- IF not PRIVATE_MESSAGE_COUNT --> hidden<!-- ENDIF -->">{PRIVATE_MESSAGE_COUNT}</strong></a> </li> <!-- ENDIF --> <!-- IF S_NOTIFICATIONS_DISPLAY --> <li class="small-icon icon-notification dropdown-container dropdown-{S_CONTENT_FLOW_END} rightside" data-skip-responsive="true"> - <a href="{U_VIEW_ALL_NOTIFICATIONS}" id="notification_list_button" class="dropdown-trigger"><span>{L_NOTIFICATIONS} </span><!-- IF NOTIFICATIONS_COUNT --><strong class="badge">{NOTIFICATIONS_COUNT}</strong><!-- ENDIF --></a> + <a href="{U_VIEW_ALL_NOTIFICATIONS}" id="notification_list_button" class="dropdown-trigger"><span>{L_NOTIFICATIONS} </span><strong class="badge<!-- IF not NOTIFICATIONS_COUNT --> hidden<!-- ENDIF -->">{NOTIFICATIONS_COUNT}</strong></a> <!-- INCLUDE notification_dropdown.html --> </li> <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/posting_attach_body.html b/phpBB/styles/prosilver/template/posting_attach_body.html index 81b2c2bf41..d7922297a7 100644 --- a/phpBB/styles/prosilver/template/posting_attach_body.html +++ b/phpBB/styles/prosilver/template/posting_attach_body.html @@ -7,7 +7,7 @@ <dl> <dt><label for="fileupload">{L_FILENAME}{L_COLON}</label></dt> <dd> - <input type="file" name="fileupload" id="fileupload" maxlength="{FILESIZE}" value="" class="inputbox autowidth" /> + <input type="file" name="fileupload" id="fileupload" class="inputbox autowidth" /> <input type="submit" name="add_file" value="{L_ADD_FILE}" class="button2" onclick="upload = true;" /> </dd> </dl> diff --git a/phpBB/styles/prosilver/template/search_results.html b/phpBB/styles/prosilver/template/search_results.html index b6c454bf05..4c83e95a1b 100644 --- a/phpBB/styles/prosilver/template/search_results.html +++ b/phpBB/styles/prosilver/template/search_results.html @@ -76,6 +76,7 @@ <!-- IF searchresults.S_TOPIC_UNAPPROVED or searchresults.S_POSTS_UNAPPROVED --><a href="{searchresults.U_MCP_QUEUE}">{searchresults.UNAPPROVED_IMG}</a> <!-- ENDIF --> <!-- IF searchresults.S_TOPIC_DELETED --><a href="{searchresults.U_MCP_QUEUE}">{DELETED_IMG}</a> <!-- ENDIF --> <!-- IF searchresults.S_TOPIC_REPORTED --><a href="{searchresults.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --><br /> + <!-- EVENT topiclist_row_topic_title_after --> <!-- IF .searchresults.pagination --> <div class="pagination"> <ul> @@ -91,7 +92,6 @@ </div> <!-- ENDIF --> <!-- IF searchresults.S_HAS_POLL -->{POLL_IMG} <!-- ENDIF --> - <!-- EVENT topiclist_row_topic_title_after --> {L_POST_BY_AUTHOR} {searchresults.TOPIC_AUTHOR_FULL} » {searchresults.FIRST_POST_TIME} » {L_IN} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a> <!-- EVENT topiclist_row_append --> @@ -137,6 +137,7 @@ <dd class="search-result-date">{searchresults.POST_DATE}</dd> <dd>{L_FORUM}{L_COLON} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a></dd> <dd>{L_TOPIC}{L_COLON} <a href="{searchresults.U_VIEW_TOPIC}">{searchresults.TOPIC_TITLE}</a></dd> + <!-- EVENT search_results_topic_title_after --> <dd>{L_REPLIES}{L_COLON} <strong>{searchresults.TOPIC_REPLIES}</strong></dd> <dd>{L_VIEWS}{L_COLON} <strong>{searchresults.TOPIC_VIEWS}</strong></dd> <!-- EVENT search_results_postprofile_after --> diff --git a/phpBB/styles/prosilver/template/ucp_main_front.html b/phpBB/styles/prosilver/template/ucp_main_front.html index 7bc8d40078..056ea300d8 100644 --- a/phpBB/styles/prosilver/template/ucp_main_front.html +++ b/phpBB/styles/prosilver/template/ucp_main_front.html @@ -55,12 +55,14 @@ <!-- EVENT ucp_main_front_user_activity_before --> <dl class="details"> + <!-- EVENT ucp_main_front_user_activity_prepend --> <dt>{L_JOINED}{L_COLON}</dt> <dd>{JOINED}</dd> <dt>{L_LAST_ACTIVE}{L_COLON}</dt> <dd>{LAST_VISIT_YOU}</dd> <dt>{L_TOTAL_POSTS}{L_COLON}</dt> <dd><!-- IF POSTS_PCT -->{POSTS}<!-- IF S_DISPLAY_SEARCH --> | <strong><a href="{U_SEARCH_USER}">{L_SEARCH_YOUR_POSTS}</a></strong><!-- ENDIF --><br />({POSTS_DAY} / {POSTS_PCT})<!-- ELSE -->{POSTS}<!-- ENDIF --></dd> <!-- IF ACTIVE_FORUM != '' --><dt>{L_ACTIVE_IN_FORUM}{L_COLON}</dt> <dd><strong><a href="{U_ACTIVE_FORUM}">{ACTIVE_FORUM}</a></strong><br />({ACTIVE_FORUM_POSTS} / {ACTIVE_FORUM_PCT})</dd><!-- ENDIF --> <!-- IF ACTIVE_TOPIC != '' --><dt>{L_ACTIVE_IN_TOPIC}{L_COLON}</dt> <dd><strong><a href="{U_ACTIVE_TOPIC}">{ACTIVE_TOPIC}</a></strong><br />({ACTIVE_TOPIC_POSTS} / {ACTIVE_TOPIC_PCT})</dd><!-- ENDIF --> <!-- IF WARNINGS --><dt>{L_YOUR_WARNINGS}{L_COLON}</dt> <dd class="error">{WARNING_IMG} [{WARNINGS}]</dd><!-- ENDIF --> + <!-- EVENT ucp_main_front_user_activity_append --> </dl> <!-- EVENT ucp_main_front_user_activity_after --> diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html index d92b90a045..009a9bf975 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage.html @@ -146,6 +146,7 @@ </div> </div> +<!-- EVENT ucp_pm_viewmessage_options_before --> <!-- IF S_VIEW_MESSAGE --> <fieldset class="display-options"> <!-- IF U_PREVIOUS_PM --><a href="{U_PREVIOUS_PM}" class="left-box arrow-{S_CONTENT_FLOW_BEGIN}">{L_VIEW_PREVIOUS_PM}</a><!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/ucp_register.html b/phpBB/styles/prosilver/template/ucp_register.html index 655c0fc48c..38413addba 100644 --- a/phpBB/styles/prosilver/template/ucp_register.html +++ b/phpBB/styles/prosilver/template/ucp_register.html @@ -79,8 +79,6 @@ <!-- ENDIF --> <!-- IF S_COPPA --> - - <div class="panel"> <div class="inner"> @@ -91,6 +89,8 @@ </div> <!-- ENDIF --> +<!-- EVENT ucp_register_buttons_before --> + <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 643b78823f..f6fc07ea55 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -261,9 +261,9 @@ <!-- INCLUDE jumpbox.html --> -<!-- IF S_DISPLAY_ONLINE_LIST --> +<!-- IF S_DISPLAY_ONLINE_LIST and U_VIEWONLINE --> <div class="stat-block online-list"> - <h3><!-- IF U_VIEWONLINE --><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a><!-- ELSE -->{L_WHO_IS_ONLINE}<!-- ENDIF --></h3> + <h3><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a></h3> <p>{LOGGED_IN_USER_LIST}</p> </div> <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index d2a253bb77..22a77779bf 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -408,9 +408,9 @@ <!-- EVENT viewtopic_body_footer_before --> <!-- INCLUDE jumpbox.html --> -<!-- IF S_DISPLAY_ONLINE_LIST --> +<!-- IF S_DISPLAY_ONLINE_LIST and U_VIEWONLINE --> <div class="stat-block online-list"> - <h3><!-- IF U_VIEWONLINE --><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a><!-- ELSE -->{L_WHO_IS_ONLINE}<!-- ENDIF --></h3> + <h3><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a></h3> <p>{LOGGED_IN_USER_LIST}</p> </div> <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/theme/common.css b/phpBB/styles/prosilver/theme/common.css index 9c2f33f7a9..df923aa948 100644 --- a/phpBB/styles/prosilver/theme/common.css +++ b/phpBB/styles/prosilver/theme/common.css @@ -137,17 +137,27 @@ p.right { } p.jumpbox-return { - margin-top: 1em; + margin-top: 10px; + margin-bottom: 0; + float: left; } b, strong { font-weight: bold; } +.text-strong { + font-weight: bold; +} + i, em { font-style: italic; } +.text-italics { + font-style: italic; +} + u { text-decoration: underline; } @@ -1267,6 +1277,10 @@ ul.linklist:after, padding: 4px 6px; } +.badge.hidden { + display: none; +} + /* Navbar specific list items ----------------------------------------*/ diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index 92a7db81d9..dfb91891fa 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -493,6 +493,8 @@ blockquote.uncited { padding: 3px; border: 1px solid transparent; font-size: 1em; + overflow-x: scroll; + word-wrap: normal; } .codebox p { @@ -515,7 +517,7 @@ blockquote .codebox { max-height: 200px; white-space: normal; padding-top: 5px; - font: 0.9em Monaco, "Andale Mono","Courier New", Courier, mono; + font: 0.9em Monaco, "Andale Mono","Courier New", Courier, monospace; line-height: 1.3em; margin: 2px 0; } diff --git a/phpBB/styles/prosilver/theme/forms.css b/phpBB/styles/prosilver/theme/forms.css index 777f011c35..235c230ed4 100644 --- a/phpBB/styles/prosilver/theme/forms.css +++ b/phpBB/styles/prosilver/theme/forms.css @@ -288,7 +288,7 @@ textarea.inputbox { } input[type="number"] { - -moz-padding-end: inherit; + -moz-padding-end: 0; } input[type="search"] { diff --git a/phpBB/styles/subsilver2/style.cfg b/phpBB/styles/subsilver2/style.cfg index 4c9abcc02d..65d846402d 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.10 -phpbb_version = 3.1.10 +style_version = 3.1.11 +phpbb_version = 3.1.11 # 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 6c9b64827a..6b7f884aaa 100644 --- a/phpBB/styles/subsilver2/template/forumlist_body.html +++ b/phpBB/styles/subsilver2/template/forumlist_body.html @@ -56,7 +56,7 @@ <!-- EVENT forumlist_body_subforums_before --> <p class="forumdesc"><strong>{forumrow.L_SUBFORUM_STR}{L_COLON}</strong> <!-- BEGIN subforum --> - <a href="{forumrow.subforum.U_SUBFORUM}" class="subforum<!-- IF forumrow.subforum.S_UNREAD --> unread<!-- ELSE --> read<!-- ENDIF -->" title="<!-- IF forumrow.subforum.S_UNREAD -->{L_UNREAD_POSTS}<!-- ELSE -->{L_NO_UNREAD_POSTS}<!-- ENDIF -->">{forumrow.subforum.SUBFORUM_NAME}</a><!-- IF not forumrow.subforum.S_LAST_ROW -->{L_COMMA_SEPARATOR}<!-- ENDIF --> + <!-- EVENT forumlist_body_subforum_link_prepend --><a href="{forumrow.subforum.U_SUBFORUM}" class="subforum<!-- IF forumrow.subforum.S_UNREAD --> unread<!-- ELSE --> read<!-- ENDIF -->" title="<!-- IF forumrow.subforum.S_UNREAD -->{L_UNREAD_POSTS}<!-- ELSE -->{L_NO_UNREAD_POSTS}<!-- ENDIF -->">{forumrow.subforum.SUBFORUM_NAME}</a><!-- IF not forumrow.subforum.S_LAST_ROW -->{L_COMMA_SEPARATOR}<!-- ENDIF --><!-- EVENT forumlist_body_subforum_link_append --> <!-- END subforum --> </p> <!-- EVENT forumlist_body_subforums_after --> diff --git a/phpBB/styles/subsilver2/template/index_body.html b/phpBB/styles/subsilver2/template/index_body.html index c0a8d5fd57..de1523b11c 100644 --- a/phpBB/styles/subsilver2/template/index_body.html +++ b/phpBB/styles/subsilver2/template/index_body.html @@ -66,6 +66,8 @@ </table> <!-- ENDIF --> +<!-- EVENT index_body_birthday_block_before --> + <!-- IF S_DISPLAY_BIRTHDAY_LIST --> <br clear="all" /> diff --git a/phpBB/styles/subsilver2/template/mcp_forum.html b/phpBB/styles/subsilver2/template/mcp_forum.html index d905910c22..12447b2b1e 100644 --- a/phpBB/styles/subsilver2/template/mcp_forum.html +++ b/phpBB/styles/subsilver2/template/mcp_forum.html @@ -77,6 +77,7 @@ <option value="make_announce">{L_MAKE_ANNOUNCE}</option> <option value="make_global">{L_MAKE_GLOBAL}</option> <!-- ENDIF --> + <!-- EVENT mcp_forum_actions_append --> </select> <input class="btnmain" type="submit" value="{L_SUBMIT}" /> </td> diff --git a/phpBB/styles/subsilver2/template/memberlist_search.html b/phpBB/styles/subsilver2/template/memberlist_search.html index 2096062607..5a4c430cd2 100644 --- a/phpBB/styles/subsilver2/template/memberlist_search.html +++ b/phpBB/styles/subsilver2/template/memberlist_search.html @@ -54,7 +54,7 @@ for (var r = 0; r < rb.length; r++) { - if (rb[r].name.substr(0, name.length) == name) + if (rb[r].name.substr(0, name.length) == name && rb[r].disabled !== true) { rb[r].checked = state; } diff --git a/phpBB/styles/subsilver2/template/memberlist_team.html b/phpBB/styles/subsilver2/template/memberlist_team.html index 18995b6e50..75fade184c 100644 --- a/phpBB/styles/subsilver2/template/memberlist_team.html +++ b/phpBB/styles/subsilver2/template/memberlist_team.html @@ -17,7 +17,7 @@ <!-- BEGIN user --> <!-- IF group.user.S_ROW_COUNT is even --><tr class="row2"><!-- ELSE --><tr class="row1"><!-- ENDIF --> - <td class="gen" align="center"><strong>{group.user.USERNAME_FULL}</strong><!-- IF group.user.S_INACTIVE --> <em>({L_INACTIVE})</em><!-- ENDIF --></td> + <td class="gen" align="center"><!-- EVENT memberlist_team_username_prepend --><strong>{group.user.USERNAME_FULL}</strong><!-- IF group.user.S_INACTIVE --> <em>({L_INACTIVE})</em><!-- ENDIF --><!-- EVENT memberlist_team_username_append --></td> <!-- IF S_DISPLAY_MODERATOR_FORUMS --><td class="gensmall" align="center"><!-- IF group.user.FORUM_OPTIONS --><select style="width: 100%;">{group.user.FORUMS}</select><!-- ELSEIF group.user.FORUMS -->{group.user.FORUMS}<!-- ELSE -->-<!-- ENDIF --></td><!-- ENDIF --> <td class="gensmall" align="center" nowrap="nowrap"> <!-- IF group.user.U_GROUP --> diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html index a4185785e3..ae3d48215e 100644 --- a/phpBB/styles/subsilver2/template/overall_header.html +++ b/phpBB/styles/subsilver2/template/overall_header.html @@ -83,7 +83,7 @@ function marklist(id, name, state) for (var r = 0; r < rb.length; r++) { - if (rb[r].name.substr(0, name.length) == name) + if (rb[r].name.substr(0, name.length) == name && rb[r].disabled !== true) { rb[r].checked = state; } diff --git a/phpBB/styles/subsilver2/template/ucp_main_front.html b/phpBB/styles/subsilver2/template/ucp_main_front.html index 7fc906a126..485a58b7ab 100644 --- a/phpBB/styles/subsilver2/template/ucp_main_front.html +++ b/phpBB/styles/subsilver2/template/ucp_main_front.html @@ -38,6 +38,7 @@ <!-- EVENT ucp_main_front_user_activity_before --> <td class="row1" colspan="3"> <table width="100%" cellspacing="1" cellpadding="4"> + <!-- EVENT ucp_main_front_user_activity_prepend --> <tr> <td align="{S_CONTENT_FLOW_END}" valign="top" nowrap="nowrap"><b class="genmed">{L_JOINED}{L_COLON} </b></td> <td width="100%"><b class="gen">{JOINED}</b></td> @@ -62,6 +63,7 @@ <td class="genmed">{WARNING_IMG} [ <b>{WARNINGS}</b> ]</td> </tr> <!-- ENDIF --> + <!-- EVENT ucp_main_front_user_activity_append --> </table> </td> <!-- EVENT ucp_main_front_user_activity_after --> diff --git a/phpBB/styles/subsilver2/template/ucp_register.html b/phpBB/styles/subsilver2/template/ucp_register.html index 9b9e164df4..db26f51ebd 100644 --- a/phpBB/styles/subsilver2/template/ucp_register.html +++ b/phpBB/styles/subsilver2/template/ucp_register.html @@ -91,6 +91,8 @@ </tr> <!-- ENDIF --> +<!-- EVENT ucp_register_buttons_before --> + <tr> <td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input class="btnmain" type="submit" name="submit" id="submit" value="{L_SUBMIT}" /> <input class="btnlite" type="reset" value="{L_RESET}" name="reset" /></td> </tr> diff --git a/phpBB/ucp.php b/phpBB/ucp.php index 8c74ca1f3c..5cd602bab5 100644 --- a/phpBB/ucp.php +++ b/phpBB/ucp.php @@ -237,6 +237,19 @@ switch ($mode) add_log('admin', 'LOG_ACL_TRANSFER_PERMISSIONS', $user_row['username']); $message = sprintf($user->lang['PERMISSIONS_TRANSFERRED'], $user_row['username']) . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>'); + + /** + * Event to run code after permissions are switched + * + * @event core.ucp_switch_permissions + * @var int user_id User ID to switch permission to + * @var array user_row User data + * @var string message Success message + * @since 3.1.11-RC1 + */ + $vars = array('user_id', 'user_row', 'message'); + extract($phpbb_dispatcher->trigger_event('core.ucp_switch_permissions', compact($vars))); + trigger_error($message); break; @@ -260,6 +273,18 @@ switch ($mode) add_log('admin', 'LOG_ACL_RESTORE_PERMISSIONS', $username); $message = $user->lang['PERMISSIONS_RESTORED'] . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . append_sid("{$phpbb_root_path}index.$phpEx") . '">', '</a>'); + + /** + * Event to run code after permissions are restored + * + * @event core.ucp_restore_permissions + * @var string username User name + * @var string message Success message + * @since 3.1.11-RC1 + */ + $vars = array('username', 'message'); + extract($phpbb_dispatcher->trigger_event('core.ucp_restore_permissions', compact($vars))); + trigger_error($message); break; diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index e0cc9ba512..5c51975150 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -146,6 +146,13 @@ else } } +// Is a forum specific topic count required? +if ($forum_data['forum_topics_per_page']) +{ + $config['topics_per_page'] = $forum_data['forum_topics_per_page']; +} + +/* @var $phpbb_content_visibility \phpbb\content_visibility */ $phpbb_content_visibility = $phpbb_container->get('content.visibility'); // Dump out the page header and load viewforum template @@ -209,12 +216,6 @@ if ($mark_read == 'topics') trigger_error($user->lang['TOPICS_MARKED'] . '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect_url . '">', '</a>')); } -// Is a forum specific topic count required? -if ($forum_data['forum_topics_per_page']) -{ - $config['topics_per_page'] = $forum_data['forum_topics_per_page']; -} - // Do the forum Prune thang - cron type job ... if (!$config['use_system_cron']) { @@ -431,9 +432,9 @@ $sql_array = array( * Author, Post time, Replies, Subject, Views * @var string sort_dir Either "a" for ascending or "d" for descending * @since 3.1.0-a1 -* @change 3.1.0-RC4 Added forum_data var -* @change 3.1.4-RC1 Added forum_id, topics_count, sort_days, sort_key and sort_dir vars -* @change 3.1.9-RC1 Fix types of properties +* @changed 3.1.0-RC4 Added forum_data var +* @changed 3.1.4-RC1 Added forum_id, topics_count, sort_days, sort_key and sort_dir vars +* @changed 3.1.9-RC1 Fix types of properties */ $vars = array( 'forum_data', @@ -782,9 +783,11 @@ $topic_tracking_info = $tracking_topics = array(); * @var array topic_list Array with current viewforum page topic ids * @var array rowset Array with topics data (in topic_id => topic_data format) * @var int total_topic_count Forum's total topic count +* @var int forum_id Forum identifier * @since 3.1.0-b3 +* @changed 3.1.11-RC1 Added forum_id */ -$vars = array('topic_list', 'rowset', 'total_topic_count'); +$vars = array('topic_list', 'rowset', 'total_topic_count', 'forum_id'); extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_topics_data', compact($vars))); // Okay, lets dump out the page ... diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php index 8bfa422e26..0a8af2001c 100644 --- a/phpBB/viewonline.php +++ b/phpBB/viewonline.php @@ -60,7 +60,10 @@ $order_by = $sort_key_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC // Whois requested if ($mode == 'whois' && $auth->acl_get('a_') && $session_id) { - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } $sql = 'SELECT u.user_id, u.username, u.user_type, s.session_ip FROM ' . USERS_TABLE . ' u, ' . SESSIONS_TABLE . " s @@ -168,7 +171,7 @@ $sql_ary = array( * @var int guest_counter Number of guests displayed * @var array forum_data Array with forum data * @since 3.1.0-a1 -* @change 3.1.0-a2 Added vars guest_counter and forum_data +* @changed 3.1.0-a2 Added vars guest_counter and forum_data */ $vars = array('sql_ary', 'show_guests', 'guest_counter', 'forum_data'); extract($phpbb_dispatcher->trigger_event('core.viewonline_modify_sql', compact($vars))); @@ -385,7 +388,7 @@ while ($row = $db->sql_fetchrow($result)) * @var string location_url Page url to displayed in the list * @var array forum_data Array with forum data * @since 3.1.0-a1 - * @change 3.1.0-a2 Added var forum_data + * @changed 3.1.0-a2 Added var forum_data */ $vars = array('on_page', 'row', 'location', 'location_url', 'forum_data'); extract($phpbb_dispatcher->trigger_event('core.viewonline_overwrite_location', compact($vars))); diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 780e43e09b..103fc7f108 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -495,6 +495,28 @@ if ($config['allow_topic_notify']) } } +/** +* Event to modify highlight. +* +* @event core.viewtopic_highlight_modify +* @var string highlight String to be highlighted +* @var string highlight_match Highlight string to be used in preg_replace +* @var array topic_data Topic data +* @var int start Pagination start +* @var int total_posts Number of posts +* @var string viewtopic_url Current viewtopic URL +* @since 3.1.11-RC1 +*/ +$vars = array( + 'highlight', + 'highlight_match', + 'topic_data', + 'start', + 'total_posts', + 'viewtopic_url', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_highlight_modify', compact($vars))); + // Bookmarks if ($config['allow_bookmarks'] && $user->data['is_registered'] && request_var('bookmark', 0)) { @@ -678,7 +700,7 @@ $base_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t= * @var int total_posts Topic total posts count * @var string viewtopic_url URL to the topic page * @since 3.1.0-RC4 -* @change 3.1.2-RC1 Added viewtopic_url +* @changed 3.1.2-RC1 Added viewtopic_url */ $vars = array( 'base_url', @@ -1178,7 +1200,7 @@ $sql_ary = array( * @var int start Pagination information * @var array sql_ary The SQL array to get the data of posts and posters * @since 3.1.0-a1 -* @change 3.1.0-a2 Added vars forum_id, topic_id, topic_data, post_list, sort_days, sort_key, sort_dir, start +* @changed 3.1.0-a2 Added vars forum_id, topic_id, topic_data, post_list, sort_days, sort_key, sort_dir, start */ $vars = array( 'forum_id', @@ -1294,7 +1316,6 @@ while ($row = $db->sql_fetchrow($result)) 'rank_title' => '', 'rank_image' => '', 'rank_image_src' => '', - 'sig' => '', 'pm' => '', 'email' => '', 'jabber' => '', @@ -1791,7 +1812,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $s_first_unread = $first_unread = true; } - $force_edit_allowed = $force_delete_allowed = false; + $force_edit_allowed = $force_delete_allowed = $force_softdelete_allowed = false; $s_cannot_edit = !$auth->acl_get('f_edit', $forum_id) || $user->data['user_id'] != $poster_id; $s_cannot_edit_time = $config['edit_time'] && $row['post_time'] <= time() - ($config['edit_time'] * 60); @@ -1821,7 +1842,9 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) * @var bool s_cannot_delete_lastpost User can not delete the post because it's not the last post of the topic * @var bool s_cannot_delete_locked User can not delete the post because it's locked * @var bool s_cannot_delete_time User can not delete the post because edit_time has passed + * @var bool force_softdelete_allowed Allow the user to ыoftdelete the post (all permissions and conditions are ignored) * @since 3.1.0-b4 + * @changed 3.1.11-RC1 Added force_softdelete_allowed var */ $vars = array( 'row', @@ -1835,6 +1858,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 's_cannot_delete_lastpost', 's_cannot_delete_locked', 's_cannot_delete_time', + 'force_softdelete_allowed', ); extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_action_conditions', compact($vars))); @@ -1856,10 +1880,10 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) (!$s_cannot_delete && !$s_cannot_delete_lastpost && !$s_cannot_delete_time && !$s_cannot_delete_locked) )); - $softdelete_allowed = ($auth->acl_get('m_softdelete', $forum_id) || - ($auth->acl_get('f_softdelete', $forum_id) && $user->data['user_id'] == $poster_id)) && ($row['post_visibility'] != ITEM_DELETED); + $softdelete_allowed = $force_softdelete_allowed || (($auth->acl_get('m_softdelete', $forum_id) || + ($auth->acl_get('f_softdelete', $forum_id) && $user->data['user_id'] == $poster_id)) && ($row['post_visibility'] != ITEM_DELETED)); - $permanent_delete_allowed = ($auth->acl_get('m_delete', $forum_id) || + $permanent_delete_allowed = $force_delete_allowed || ($auth->acl_get('m_delete', $forum_id) || ($auth->acl_get('f_delete', $forum_id) && $user->data['user_id'] == $poster_id)); // Can this user receive a Private Message? @@ -1986,9 +2010,9 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) * @var array post_row Template block array of the post * @var array topic_data Array with topic data * @since 3.1.0-a1 - * @change 3.1.0-a3 Added vars start, current_row_number, end, attachments - * @change 3.1.0-b3 Added topic_data array, total_posts - * @change 3.1.0-RC3 Added poster_id + * @changed 3.1.0-a3 Added vars start, current_row_number, end, attachments + * @changed 3.1.0-b3 Added topic_data array, total_posts + * @changed 3.1.0-RC3 Added poster_id */ $vars = array( 'start', @@ -2086,7 +2110,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) * @var array post_row Template block array of the post * @var array topic_data Array with topic data * @since 3.1.0-a3 - * @change 3.1.0-b3 Added topic_data array, total_posts + * @changed 3.1.0-b3 Added topic_data array, total_posts */ $vars = array( 'start', @@ -2249,7 +2273,7 @@ $page_title = $topic_data['topic_title'] . ($start ? ' - ' . sprintf($user->lang * @var int start Start offset used to calculate the page * @var array post_list Array with post_ids we are going to display * @since 3.1.0-a1 -* @change 3.1.0-RC4 Added post_list var +* @changed 3.1.0-RC4 Added post_list var */ $vars = array('page_title', 'topic_data', 'forum_id', 'start', 'post_list'); extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_page_title', compact($vars))); diff --git a/tests/di/create_container_test.php b/tests/di/create_container_test.php index 4ae6017989..1a7eb4698c 100644 --- a/tests/di/create_container_test.php +++ b/tests/di/create_container_test.php @@ -53,7 +53,7 @@ namespace $this->assertTrue($container->isFrozen()); // Checks inject_config - $this->assertTrue($container->hasParameter('dbal.dbhost')); + $this->assertTrue($container->hasParameter('core.table_prefix')); // Checks use_extensions $this->assertTrue($container->hasParameter('enabled')); diff --git a/tests/di/fixtures/config/services.yml b/tests/di/fixtures/config/services.yml index f2a22ae109..913a2603c9 100644 --- a/tests/di/fixtures/config/services.yml +++ b/tests/di/fixtures/config/services.yml @@ -10,5 +10,8 @@ services: arguments: - @service_container + dbal.conn.driver: + synthetic: true + dispatcher: class: phpbb\db\driver\container_mock diff --git a/tests/di/fixtures/other_config/services.yml b/tests/di/fixtures/other_config/services.yml index c299bfc648..d6246d3bc0 100644 --- a/tests/di/fixtures/other_config/services.yml +++ b/tests/di/fixtures/other_config/services.yml @@ -10,5 +10,8 @@ services: arguments: - @service_container + dbal.conn.driver: + synthetic: true + dispatcher: class: phpbb\db\driver\container_mock diff --git a/tests/event/fixtures/trigger_many_vars.test b/tests/event/fixtures/trigger_many_vars.test index a624138588..5e0720d13b 100644 --- a/tests/event/fixtures/trigger_many_vars.test +++ b/tests/event/fixtures/trigger_many_vars.test @@ -34,7 +34,7 @@ * posting page via $template->assign_vars() * @var object message_parser The message parser object * @since 3.1.0-a1 - * @change 3.1.0-b3 Added vars post_data, moderators, mode, page_title, + * @changed 3.1.0-b3 Added vars post_data, moderators, mode, page_title, * s_topic_icons, form_enctype, s_action, s_hidden_fields, * post_id, topic_id, forum_id, submit, preview, save, load, * delete, cancel, refresh, error, page_data, message_parser diff --git a/tests/feed/attachments_base_test.php b/tests/feed/attachments_base_test.php new file mode 100644 index 0000000000..c980dfd3d7 --- /dev/null +++ b/tests/feed/attachments_base_test.php @@ -0,0 +1,94 @@ +<?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__) . '/attachments_mock_feed.php'); + +class phpbb_feed_attachments_base_test extends phpbb_database_test_case +{ + protected $filesystem; + + /** @var \phpbb_feed_attachments_mock_feed */ + protected $attachments_mocks_feed; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/../extension/fixtures/extensions.xml'); + } + + public function setUp() + { + global $phpbb_root_path, $phpEx; + + $this->filesystem = new \phpbb\filesystem(); + $config = new \phpbb\config\config(array()); + $user = new \phpbb\user('\phpbb\datetime'); + $feed_helper = new \phpbb\feed\helper($config, $user, $phpbb_root_path, $phpEx); + $db = $this->new_dbal(); + $cache = new \phpbb_mock_cache(); + $auth = new \phpbb\auth\auth(); + $content_visibility = new \phpbb\content_visibility( + $auth, + $config, + new \phpbb_mock_event_dispatcher(), + $db, + $user, + $phpbb_root_path, + $phpEx, + FORUMS_TABLE, + POSTS_TABLE, + TOPICS_TABLE, + USERS_TABLE + ); + + $this->attachments_mocks_feed = new \phpbb_feed_attachments_mock_feed( + $feed_helper, + $config, + $db, + $cache, + $user, + $auth, + $content_visibility, + new \phpbb_mock_event_dispatcher(), + $phpEx + ); + } + + public function data_fetch_attachments() + { + return array( + array(array(0), array(0)), + array(array(), array(1)), + array(array(), array(), 'RuntimeException') + ); + } + + /** + * @dataProvider data_fetch_attachments + */ + public function test_fetch_attachments($post_ids, $topic_ids, $expected_exception = false) + { + $this->attachments_mocks_feed->post_ids = $post_ids; + $this->attachments_mocks_feed->topic_ids = $topic_ids; + + if ($expected_exception !== false) + { + $this->setExpectedException($expected_exception); + + $this->attachments_mocks_feed->get_sql(); + } + else + { + $this->assertTrue($this->attachments_mocks_feed->get_sql()); + } + } +} diff --git a/tests/feed/attachments_mock_feed.php b/tests/feed/attachments_mock_feed.php new file mode 100644 index 0000000000..0e623fed24 --- /dev/null +++ b/tests/feed/attachments_mock_feed.php @@ -0,0 +1,31 @@ +<?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. + * + */ + +/** + * Board wide feed (aka overall feed) + * + * This will give you the newest {$this->num_items} posts + * from the whole board. + */ +class phpbb_feed_attachments_mock_feed extends \phpbb\feed\attachments_base +{ + public $topic_ids = array(); + public $post_ids = array(); + + function get_sql() + { + parent::fetch_attachments($this->post_ids, $this->topic_ids); + + return true; + } +} diff --git a/tests/functional/notification_test.php b/tests/functional/notification_test.php index d4c61cc062..f21d73817a 100644 --- a/tests/functional/notification_test.php +++ b/tests/functional/notification_test.php @@ -82,6 +82,7 @@ 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.'))); - $this->assertCount(0, $crawler->filter('#notification_list_button strong')); + $this->assertCount(1, $crawler->filter('#notification_list_button strong.badge.hidden')); + $this->assertEquals("0", $crawler->filter('#notification_list_button strong.badge.hidden')->text()); } } diff --git a/tests/functional/visibility_softdelete_test.php b/tests/functional/visibility_softdelete_test.php index 39efc99a35..6450c00c1e 100644 --- a/tests/functional/visibility_softdelete_test.php +++ b/tests/functional/visibility_softdelete_test.php @@ -564,7 +564,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_ $this->assertContainsLang('SPLIT_TOPIC_EXPLAIN', $crawler->text()); $form = $crawler->selectButton('Submit')->form(array( - 'subject' => 'Soft Delete Topic #2', + 'subject' => 'Soft Delete Topic #2 with bang', )); $form['to_forum_id']->select($this->data['forums']['Soft Delete #2']); $form['post_id_list'][1]->tick(); @@ -597,6 +597,11 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_ 'forum_topics_softdeleted' => 1, 'forum_last_post_id' => 0, ), 'after restoring #2'); + + // Assert new topic title is indexed as well + $this->add_lang('search'); + self::request('GET', "search.php?keywords=bang&sid={$this->sid}"); + $this->assertContains(sprintf($this->lang['FOUND_SEARCH_MATCHES'][1], 1), self::get_content()); } public function test_move_topic_back() @@ -609,7 +614,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_ ), 'topics' => array( 'Soft Delete Topic #1', - 'Soft Delete Topic #2', + 'Soft Delete Topic #2 with bang', ), 'posts' => array( 'Soft Delete Topic #1', @@ -618,7 +623,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_ ), )); - $crawler = $this->get_quickmod_page($this->data['topics']['Soft Delete Topic #2'], 'MOVE_TOPIC'); + $crawler = $this->get_quickmod_page($this->data['topics']['Soft Delete Topic #2 with bang'], 'MOVE_TOPIC'); $form = $crawler->selectButton('Yes')->form(); $form['to_forum_id']->select($this->data['forums']['Soft Delete #1']); $crawler = self::submit($form); @@ -644,7 +649,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_ ), 'topics' => array( 'Soft Delete Topic #1', - 'Soft Delete Topic #2', + 'Soft Delete Topic #2 with bang', ), 'posts' => array( 'Soft Delete Topic #1', @@ -664,7 +669,7 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_ ), 'before merging #1'); $this->add_lang('viewtopic'); - $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #2']}&sid={$this->sid}"); + $crawler = self::request('GET', "viewtopic.php?t={$this->data['topics']['Soft Delete Topic #2 with bang']}&sid={$this->sid}"); $bookmark_tag = $crawler->filter('a.bookmark-link'); $this->assertContainsLang('BOOKMARK_TOPIC', $bookmark_tag->text()); @@ -673,10 +678,10 @@ class phpbb_functional_visibility_softdelete_test extends phpbb_functional_test_ $this->assertContainsLang('BOOKMARK_ADDED', $crawler_bookmark->text()); $this->add_lang('mcp'); - $crawler = $this->get_quickmod_page($this->data['topics']['Soft Delete Topic #2'], 'MERGE_TOPIC', $crawler); + $crawler = $this->get_quickmod_page($this->data['topics']['Soft Delete Topic #2 with bang'], 'MERGE_TOPIC', $crawler); $this->assertContainsLang('SELECT_MERGE', $crawler->text()); - $crawler = self::request('GET', "mcp.php?f={$this->data['forums']['Soft Delete #1']}&t={$this->data['topics']['Soft Delete Topic #2']}&i=main&mode=forum_view&action=merge_topic&to_topic_id={$this->data['topics']['Soft Delete Topic #1']}"); + $crawler = self::request('GET', "mcp.php?f={$this->data['forums']['Soft Delete #1']}&t={$this->data['topics']['Soft Delete Topic #2 with bang']}&i=main&mode=forum_view&action=merge_topic&to_topic_id={$this->data['topics']['Soft Delete Topic #1']}"); $this->assertContainsLang('MERGE_TOPICS_CONFIRM', $crawler->text()); $form = $crawler->selectButton('Yes')->form(); diff --git a/tests/functions/user_delete_test.php b/tests/functions/user_delete_test.php index db52dcded7..c224323273 100644 --- a/tests/functions/user_delete_test.php +++ b/tests/functions/user_delete_test.php @@ -71,6 +71,7 @@ class phpbb_functions_user_delete_test extends phpbb_database_test_case $oauth_provider_collection, 'phpbb_users', $phpbb_container, + $phpbb_dispatcher, $this->phpbb_root_path, $this->php_ext ); diff --git a/tests/mcp/fixtures/post_ip.xml b/tests/mcp/fixtures/post_ip.xml new file mode 100644 index 0000000000..fad2193396 --- /dev/null +++ b/tests/mcp/fixtures/post_ip.xml @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <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> + <column>poster_ip</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> + <value>127.0.0.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> + <value>127.0.0.2</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> + <value>127.0.0.3</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> + <value>127.0.0.1</value> + </row> + </table> +</dataset> diff --git a/tests/mcp/post_ip_test.php b/tests/mcp/post_ip_test.php new file mode 100644 index 0000000000..72a9f62774 --- /dev/null +++ b/tests/mcp/post_ip_test.php @@ -0,0 +1,67 @@ +<?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__) . '/../../phpBB/includes/mcp/mcp_post.php'; + +class phpbb_mcp_post_ip_test extends phpbb_database_test_case +{ + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/post_ip.xml'); + } + + protected function setUp() + { + parent::setUp(); + + $this->db = $this->new_dbal(); + } + + public function data_get_num_ips() + { + return array( + array(2, 1), + array(2, 2), + array(0, 3), + ); + } + + /** + * @dataProvider data_get_num_ips + */ + public function test_get_num_ips($expected, $poster_id) + { + $this->assertSame($expected, phpbb_get_num_ips_for_poster($this->db, $poster_id)); + } + + public function data_get_num_posters() + { + return array( + array(2, '127.0.0.1'), + array(1, '127.0.0.2'), + array(1, '127.0.0.3'), + array(0, '127.0.0.4'), + ); + } + + /** + * @dataProvider data_get_num_posters + */ + public function test_get_num_posters($expected, $ip) + { + $this->assertSame($expected, phpbb_get_num_posters_for_ip($this->db, $ip)); + } +} diff --git a/tests/mock/extension_manager.php b/tests/mock/extension_manager.php index 3b759fbbc2..94268159a8 100644 --- a/tests/mock/extension_manager.php +++ b/tests/mock/extension_manager.php @@ -20,5 +20,7 @@ class phpbb_mock_extension_manager extends \phpbb\extension\manager $this->extensions = $extensions; $this->filesystem = new \phpbb\filesystem(); $this->container = $container; + $this->config = new \phpbb\config\config(array()); + $this->user = new \phpbb\user('\phpbb\datetime'); } } diff --git a/tests/plupload/plupload_test.php b/tests/plupload/plupload_test.php index 2f47bf2b39..c3fa2b9bad 100644 --- a/tests/plupload/plupload_test.php +++ b/tests/plupload/plupload_test.php @@ -24,7 +24,7 @@ class phpbb_plupload_test extends phpbb_test_case array( 130, 150, - 'resize: {width: 130, height: 150, quality: 100},' + 'resize: {width: 130, height: 150, quality: 85},' ), ); } diff --git a/tests/template/template_test.php b/tests/template/template_test.php index 0bbfe3848d..69546cc227 100644 --- a/tests/template/template_test.php +++ b/tests/template/template_test.php @@ -528,22 +528,139 @@ EOT ), array( 'outer', + array('VARIABLE' => 'changed'), + 0, + 'change', + <<<EOT +outer - 0 - changed +middle - 0 +middle - 1 +outer - 1 +middle - 0 +middle - 1 +outer - 2 +middle - 0 +middle - 1 +EOT +, + 'Test changing at 0 on top level block', + ), + array( + 'outer', + array('VARIABLE' => 'changed'), + array('S_ROW_NUM' => 2), + 'change', + <<<EOT +outer - 0 +middle - 0 +middle - 1 +outer - 1 +middle - 0 +middle - 1 +outer - 2 - changed +middle - 0 +middle - 1 +EOT +, + 'Test changing at KEY on top level block', + ), + array( + 'outer.middle', + array('VARIABLE' => 'before'), + false, + 'insert', + <<<EOT +outer - 0 +middle - 0 +middle - 1 +outer - 1 +middle - 0 +middle - 1 +outer - 2 +middle - 0 - before +middle - 1 +middle - 2 +EOT +, + 'Test inserting before on middle level block', + ), + array( + 'outer.middle', + array('VARIABLE' => 'after'), + true, + 'insert', + <<<EOT +outer - 0 +middle - 0 +middle - 1 +outer - 1 +middle - 0 +middle - 1 +outer - 2 +middle - 0 +middle - 1 +middle - 2 - after +EOT +, + 'Test inserting after on middle level block', + ), + array( + 'outer[1].middle', array('VARIABLE' => 'pos #1'), + 1, + 'insert', + <<<EOT +outer - 0 +middle - 0 +middle - 1 +outer - 1 +middle - 0 +middle - 1 - pos #1 +middle - 2 +outer - 2 +middle - 0 +middle - 1 +EOT +, + 'Test inserting at 1 on middle level block', + ), + array( + 'outer[].middle', + array('VARIABLE' => 'changed'), 0, 'change', <<<EOT -outer - 0 - pos #1 +outer - 0 middle - 0 middle - 1 outer - 1 middle - 0 middle - 1 outer - 2 +middle - 0 - changed +middle - 1 +EOT +, + 'Test changing at beginning of last top level block', + ), + array( + 'outer.middle', + array('VARIABLE' => 'changed'), + array('S_ROW_NUM' => 1), + 'change', + <<<EOT +outer - 0 +middle - 0 +middle - 1 +outer - 1 middle - 0 middle - 1 +outer - 2 +middle - 0 +middle - 1 - changed EOT , - 'Test inserting at 1 on top level block', + 'Test changing at beginning of last top level block', ), ); } @@ -601,8 +718,55 @@ EOT $expect = 'outer - 0[outer|4]outer - 1[outer|4]middle - 0[middle|1]outer - 2 - test[outer|4]middle - 0[middle|2]middle - 1[middle|2]outer - 3[outer|4]middle - 0[middle|3]middle - 1[middle|3]middle - 2[middle|3]'; $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Ensuring S_NUM_ROWS is correct after modification'); + + $this->template->alter_block_array('outer.middle', array()); + + $expect = 'outer - 0[outer|4]outer - 1[outer|4]middle - 0[middle|1]outer - 2 - test[outer|4]middle - 0[middle|2]middle - 1[middle|2]outer - 3[outer|4]middle - 0[middle|4]middle - 1[middle|4]middle - 2[middle|4]middle - 3[middle|4]'; + $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Ensuring S_NUM_ROWS is correct after insertion at middle level'); + + $this->template->alter_block_array('outer.middle', array('VARIABLE' => 'test'), 2, 'change'); + + $expect = 'outer - 0[outer|4]outer - 1[outer|4]middle - 0[middle|1]outer - 2 - test[outer|4]middle - 0[middle|2]middle - 1[middle|2]outer - 3[outer|4]middle - 0[middle|4]middle - 1[middle|4]middle - 2 - test[middle|4]middle - 3[middle|4]'; + $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Ensuring S_NUM_ROWS is correct after modification at middle level'); } + public function test_find_key_index() + { + $this->template->set_filenames(array('test' => 'loop_nested.html')); + + $this->template->assign_var('TEST_MORE', true); + + // @todo Change this + $this->template->assign_block_vars('outer', array('VARIABLE' => 'zero')); + $this->template->assign_block_vars('outer', array('VARIABLE' => 'one')); + $this->template->assign_block_vars('outer.middle', array('VARIABLE' => '1A')); + $this->template->assign_block_vars('outer', array('VARIABLE' => 'two')); + $this->template->assign_block_vars('outer.middle', array('VARIABLE' => '2A')); + $this->template->assign_block_vars('outer.middle', array('VARIABLE' => '2B')); + $this->template->assign_block_vars('outer', array('VARIABLE' => 'three')); + $this->template->assign_block_vars('outer.middle', array('VARIABLE' => '3A')); + $this->template->assign_block_vars('outer.middle', array('VARIABLE' => '3B')); + $this->template->assign_block_vars('outer.middle', array('VARIABLE' => '3C')); + + $expect = 'outer - 0 - zero[outer|4]outer - 1 - one[outer|4]middle - 0 - 1A[middle|1]outer - 2 - two[outer|4]middle - 0 - 2A[middle|2]middle - 1 - 2B[middle|2]outer - 3 - three[outer|4]middle - 0 - 3A[middle|3]middle - 1 - 3B[middle|3]middle - 2 - 3C[middle|3]'; + $this->assertEquals($expect, str_replace(array("\n", "\r", "\t"), '', $this->display('test')), 'Ensuring template is built correctly before modification'); + + $this->template->find_key_index('outer', false); + + $this->assertEquals(0, $this->template->find_key_index('outer', false), 'Find index at the beginning of outer loop'); + $this->assertEquals(1, $this->template->find_key_index('outer', 1), 'Find index by index in outer loop'); + $this->assertEquals(2, $this->template->find_key_index('outer', array('VARIABLE' => 'two')), 'Find index by key in outer loop'); + $this->assertEquals(3, $this->template->find_key_index('outer', true), 'Find index at the end of outer loop'); + $this->assertEquals(false, $this->template->find_key_index('outer', 7), 'Find index out of bounds of outer loop'); + + $this->assertEquals(false, $this->template->find_key_index('outer[0].middle', false), 'Find index at the beginning of middle loop, no middle block'); + $this->assertEquals(false, $this->template->find_key_index('outer[1].middle', 1), 'Find index by index in inner loop, out of bounds'); + $this->assertEquals(1, $this->template->find_key_index('outer[2].middle', array('VARIABLE' => '2B')), 'Find index by key in middle loop'); + $this->assertEquals(2, $this->template->find_key_index('outer.middle', true), 'Find index at the end of middle loop'); + + $this->assertEquals(false, $this->template->find_key_index('outer.wrong', true), 'Wrong middle block name'); + $this->assertEquals(false, $this->template->find_key_index('wrong.middle', false), 'Wrong outer block name'); + } public function assign_block_vars_array_data() { return array( diff --git a/tests/version/version_test.php b/tests/version/version_test.php index 528f1602d6..0ed0fcb589 100644 --- a/tests/version/version_test.php +++ b/tests/version/version_test.php @@ -332,4 +332,496 @@ class phpbb_version_helper_test extends phpbb_test_case $this->assertSame($expected, $version_helper->get_latest_on_current_branch()); } + + public function get_update_on_branch_data() + { + return array( + array( + '1.0.0', + array( + '1.0' => array( + 'current' => '1.0.1', + ), + '1.1' => array( + 'current' => '1.1.1', + ), + ), + array( + 'current' => '1.0.1', + ), + ), + array( + '1.0.1', + array( + '1.0' => array( + 'current' => '1.0.1', + ), + '1.1' => array( + 'current' => '1.1.1', + ), + ), + array(), + ), + array( + '1.0.1-a1', + array( + '1.0' => array( + 'current' => '1.0.1-a2', + ), + '1.1' => array( + 'current' => '1.1.0', + ), + ), + array( + 'current' => '1.0.1-a2', + ), + ), + array( + '1.1.0', + array( + '1.0' => array( + 'current' => '1.0.1', + ), + '1.1' => array( + 'current' => '1.1.1', + ), + ), + array( + 'current' => '1.1.1', + ), + ), + array( + '1.1.1', + array( + '1.0' => array( + 'current' => '1.0.1', + ), + '1.1' => array( + 'current' => '1.1.1', + ), + ), + array(), + ), + array( + '1.1.0-a1', + array( + '1.0' => array( + 'current' => '1.0.1', + ), + '1.1' => array( + 'current' => '1.1.0-a2', + ), + ), + array( + 'current' => '1.1.0-a2', + ), + ), + array( + '1.1.0', + array(), + array(), + ), + // Latest safe release is 1.0.1 + array( + '1.0.0', + array( + '1.0' => array( + 'current' => '1.0.1', + 'security' => '1.0.1', + ), + '1.1' => array( + 'current' => '1.1.1', + ), + ), + array( + 'current' => '1.0.1', + 'security' => '1.0.1', + ), + ), + // Latest safe release is 1.0.0 + array( + '1.0.0', + array( + '1.0' => array( + 'current' => '1.0.1', + 'security' => '1.0.0', + ), + '1.1' => array( + 'current' => '1.1.1', + ), + ), + array( + 'current' => '1.0.1', + 'security' => '1.0.0', + ), + ), + // Latest safe release is 1.1.0 + array( + '1.0.0', + array( + '1.0' => array( + 'current' => '1.0.1', + 'security' => '1.1.0', + ), + '1.1' => array( + 'current' => '1.1.1', + ), + ), + array( + 'current' => '1.1.1', + ), + ), + // Latest 1.0 release is EOL + array( + '1.0.0', + array( + '1.0' => array( + 'current' => '1.0.1', + 'eol' => true, + ), + '1.1' => array( + 'current' => '1.1.1', + ), + ), + array( + 'current' => '1.1.1', + ), + ), + // All are EOL -- somewhat undefined behavior + array( + '1.0.0', + array( + '1.0' => array( + 'current' => '1.0.1', + 'eol' => true, + ), + '1.1' => array( + 'current' => '1.1.1', + 'eol' => true, + ), + ), + array(), + ), + ); + } + + /** + * @dataProvider get_update_on_branch_data + */ + public function test_get_update_on_branch($current_version, $versions, $expected) + { + $version_helper = $this + ->getMockBuilder('\phpbb\version_helper') + ->setMethods(array( + 'get_versions_matching_stability', + )) + ->setConstructorArgs(array( + $this->cache, + new \phpbb\config\config(array( + 'version' => $current_version, + )), + new \phpbb\file_downloader(), + new \phpbb\user('\phpbb\datetime'), + )) + ->getMock() + ; + + $version_helper->expects($this->any()) + ->method('get_versions_matching_stability') + ->will($this->returnValue($versions)); + + $this->assertSame($expected, $version_helper->get_update_on_branch()); + } + + public function get_ext_update_on_branch_data() + { + return array( + // Single branch, check version for current branch + array( + '3.1.0', + '1.0.0', + array( + '3.1' => array( + 'current' => '1.0.1', + ), + ), + array( + 'current' => '1.0.1', + ), + ), + array( + '3.1.0', + '1.0.1', + array( + '3.1' => array( + 'current' => '1.0.1', + ), + ), + array(), + ), + array( + '3.2.0', + '1.0.0', + array( + '3.2' => array( + 'current' => '1.1.1', + ), + ), + array( + 'current' => '1.1.1', + ), + ), + array( + '3.2.0', + '1.1.1', + array( + '3.2' => array( + 'current' => '1.1.1', + ), + ), + array(), + ), + // Single branch, check for newest version when branches don't match up + array( + '3.1.0', + '1.0.0', + array( + '3.2' => array( + 'current' => '1.1.1', + ), + ), + array( + 'current' => '1.1.1', + ), + ), + array( + '3.1.0', + '1.1.1', + array( + '3.2' => array( + 'current' => '1.1.1', + ), + ), + array(), + ), + array( + '3.2.0', + '1.0.0', + array( + '3.1' => array( + 'current' => '1.0.1', + ), + ), + array( + 'current' => '1.0.1', + ), + ), + array( + '3.2.0', + '1.0.1', + array( + '3.1' => array( + 'current' => '1.0.1', + ), + ), + array(), + ), + array( + '3.3.0', + '1.0.0', + array( + '3.2' => array( + 'current' => '1.1.1', + ), + ), + array( + 'current' => '1.1.1', + ), + ), + array( + '3.3.0', + '1.1.1', + array( + '3.2' => array( + 'current' => '1.1.1', + ), + ), + array(), + ), + // Multiple branches, check version for current branch + array( + '3.1.0', + '1.0.0', + array( + '3.1' => array( + 'current' => '1.0.1', + ), + '3.2' => array( + 'current' => '1.1.1', + ), + ), + array( + 'current' => '1.0.1', + ), + ), + array( + '3.1.0', + '1.0.1', + array( + '3.1' => array( + 'current' => '1.0.1', + ), + '3.2' => array( + 'current' => '1.1.1', + ), + ), + array(), + ), + array( + '3.1.0', + '1.1.1', + array( + '3.1' => array( + 'current' => '1.0.1', + ), + '3.2' => array( + 'current' => '1.1.1', + ), + ), + array(), + ), + array( + '3.2.0', + '1.0.0', + array( + '3.1' => array( + 'current' => '1.0.1', + ), + '3.2' => array( + 'current' => '1.1.1', + ), + ), + array( + 'current' => '1.1.1', + ), + ), + array( + '3.2.0', + '1.0.1', + array( + '3.1' => array( + 'current' => '1.0.1', + ), + '3.2' => array( + 'current' => '1.1.1', + ), + ), + array( + 'current' => '1.1.1', + ), + ), + array( + '3.2.0', + '1.1.1', + array( + '3.1' => array( + 'current' => '1.0.1', + ), + '3.2' => array( + 'current' => '1.1.1', + ), + ), + array(), + ), + // Multiple branches, check for newest version when branches don't match up + array( + '3.3.0', + '1.0.0', + array( + '3.1' => array( + 'current' => '1.0.1', + ), + '3.2' => array( + 'current' => '1.1.1', + ), + ), + array( + 'current' => '1.1.1', + ), + ), + array( + '3.3.0', + '1.0.1', + array( + '3.1' => array( + 'current' => '1.0.1', + ), + '3.2' => array( + 'current' => '1.1.1', + ), + ), + array( + 'current' => '1.1.1', + ), + ), + array( + '3.3.0', + '1.1.0', + array( + '3.1' => array( + 'current' => '1.0.1', + ), + '3.2' => array( + 'current' => '1.1.1', + ), + ), + array( + 'current' => '1.1.1', + ), + ), + array( + '3.3.0', + '1.1.1', + array( + '3.1' => array( + 'current' => '1.0.1', + ), + '3.2' => array( + 'current' => '1.1.1', + ), + ), + array(), + ), + ); + } + + /** + * @dataProvider get_ext_update_on_branch_data + */ + public function test_get_ext_update_on_branch($phpbb_version, $ext_version, $versions, $expected) + { + $version_helper = $this + ->getMockBuilder('\phpbb\version_helper') + ->setMethods(array( + 'get_versions_matching_stability', + )) + ->setConstructorArgs(array( + $this->cache, + new \phpbb\config\config(array( + 'version' => $phpbb_version, + )), + new \phpbb\file_downloader(), + new \phpbb\user('\phpbb\datetime'), + )) + ->getMock() + ; + + $version_helper->expects($this->any()) + ->method('get_versions_matching_stability') + ->will($this->returnValue($versions)); + + $version_helper->set_current_version($ext_version); + + $this->assertSame($expected, $version_helper->get_ext_update_on_branch()); + } } |