diff options
83 files changed, 1417 insertions, 324 deletions
diff --git a/build/build.xml b/build/build.xml index dbf16acfeb..ec94cf3ea6 100644 --- a/build/build.xml +++ b/build/build.xml @@ -2,9 +2,9 @@ <project name="phpBB" description="The phpBB forum software" default="all" basedir="../"> <!-- a few settings for the build --> - <property name="newversion" value="3.1.0-b4-dev" /> - <property name="prevversion" value="3.1.0-b3" /> - <property name="olderversions" value="3.0.12, 3.1.0-a1, 3.1.0-a2, 3.1.0-a3, 3.1.0-b1, 3.1.0-b2" /> + <property name="newversion" value="3.1.0-b5-dev" /> + <property name="prevversion" value="3.1.0-b4" /> + <property name="olderversions" value="3.0.12, 3.1.0-a1, 3.1.0-a2, 3.1.0-a3, 3.1.0-b1, 3.1.0-b2, 3.1.0-b3" /> <!-- no configuration should be needed beyond this point --> <property name="oldversions" value="${olderversions}, ${prevversion}" /> diff --git a/phpBB/adm/style/admin.js b/phpBB/adm/style/admin.js index 7bda86e1e3..a839e7e0e2 100644 --- a/phpBB/adm/style/admin.js +++ b/phpBB/adm/style/admin.js @@ -75,7 +75,7 @@ function parse_document(container) var cell = $(this), colspan = parseInt(cell.attr('colspan')), dfn = cell.attr('data-dfn'), - text = dfn ? dfn : cell.text().trim(); + text = dfn ? dfn : $.trim(cell.text()); if (text == ' ') text = ''; colspan = isNaN(colspan) || colspan < 1 ? 1 : colspan; @@ -114,7 +114,7 @@ function parse_document(container) cells.each(function() { var cell = $(this), colspan = parseInt(cell.attr('colspan')), - text = cell.text().trim(); + text = $.trim(cell.text()); if (headersLength <= column) { return; diff --git a/phpBB/config/console.yml b/phpBB/config/console.yml index 56bf99390a..a102a8c609 100644 --- a/phpBB/config/console.yml +++ b/phpBB/config/console.yml @@ -46,6 +46,15 @@ services: tags: - { name: console.command } + console.command.cron.run: + class: phpbb\console\command\cron\run + arguments: + - @cron.manager + - @cron.lock_db + - @user + tags: + - { name: console.command } + console.command.db.migrate: class: phpbb\console\command\db\migrate arguments: diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index 4de47f750f..3bd9182924 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -170,6 +170,7 @@ services: - @dbal.conn - @config - @filesystem + - @user - %tables.ext% - %core.root_path% - %core.php_ext% diff --git a/phpBB/cron.php b/phpBB/cron.php index e070c8f5fb..8bb49bd5d2 100644 --- a/phpBB/cron.php +++ b/phpBB/cron.php @@ -37,73 +37,33 @@ function output_image() flush(); } -function do_cron($cron_lock, $run_tasks) -{ - global $config; - - foreach ($run_tasks as $task) - { - if (defined('DEBUG') && $config['use_system_cron']) - { - echo "[phpBB cron] Running task '{$task->get_name()}'\n"; - } - - $task->run(); - } - - // Unloading cache and closing db after having done the dirty work. - $cron_lock->release(); - garbage_collection(); -} - // Thanks to various fatal errors and lack of try/finally, it is quite easy to leave // the cron lock locked, especially when working on cron-related code. // // Attempt to alleviate the problem by doing setup outside of the lock as much as possible. -// -// If DEBUG is defined and cron lock cannot be obtained, a message will be printed. -if (!$config['use_system_cron']) -{ - $cron_type = request_var('cron_type', ''); +$cron_type = request_var('cron_type', ''); - // Comment this line out for debugging so the page does not return an image. - output_image(); -} +// Comment this line out for debugging so the page does not return an image. +output_image(); $cron_lock = $phpbb_container->get('cron.lock_db'); if ($cron_lock->acquire()) { $cron = $phpbb_container->get('cron.manager'); - if ($config['use_system_cron']) - { - $run_tasks = $cron->find_all_ready_tasks(); - } - else + $task = $cron->find_task($cron_type); + if ($task) { - // If invalid task is specified, empty $run_tasks is passed to do_cron which then does nothing - $run_tasks = array(); - $task = $cron->find_task($cron_type); - if ($task) + if ($task->is_parametrized()) { - if ($task->is_parametrized()) - { - $task->parse_parameters($request); - } - if ($task->is_ready()) - { - $run_tasks = array($task); - } + $task->parse_parameters($request); + } + if ($task->is_ready()) + { + $task->run(); + garbage_collection(); } } - - do_cron($cron_lock, $run_tasks); -} -else -{ - if (defined('DEBUG')) - { - echo "Could not obtain cron lock.\n"; - } + $cron_lock->release(); } diff --git a/phpBB/develop/strip_icc_profiles.sh b/phpBB/develop/strip_icc_profiles.sh index 779c7ffca7..b11a63616b 100755 --- a/phpBB/develop/strip_icc_profiles.sh +++ b/phpBB/develop/strip_icc_profiles.sh @@ -1,7 +1,12 @@ #!/bin/sh # -# @copyright (c) 2014 phpBB Group -# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +# 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. # if [ "$#" -ne 1 ] diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 36d0ccf68d..ab3a42206e 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -46,6 +46,7 @@ <ol> <li><a href="#changelog">Changelog</a> <ol style="list-style-type: lower-roman;"> + <li><a href="#v310b3">Changes since 3.1.0-b3</a></li> <li><a href="#v310b2">Changes since 3.1.0-b2</a></li> <li><a href="#v310b1">Changes since 3.1.0-b1</a></li> <li><a href="#v310a3">Changes since 3.1.0-a3</a></li> @@ -92,7 +93,114 @@ <div class="content"> - <a name="v310b2"></a><h3>1.i. Changes since 3.1.0-b2</h3> + <a name="v310b3"></a><h3>1.i. Changes since 3.1.0-b3</h3> + + <h4>Bug</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10176">PHPBB3-10176</a>] - Imageset Appearance Problem with Google Chrome Browser. </li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11226">PHPBB3-11226</a>] - filespec::move_file() from functions_upload.php does not error correctly</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11232">PHPBB3-11232</a>] - prosilver ajax.js does not respect PHPBB_USE_BOARD_URL_PATH</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11366">PHPBB3-11366</a>] - Add "MOD Version Check" for extensions to the core</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11497">PHPBB3-11497</a>] - The extension finder keeps state, so should be instantiated on each container request, not reset manually</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12025">PHPBB3-12025</a>] - Post Preview no longer shows UNAUTHORISED_BBCODE warning for disallowed BBcodes</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12074">PHPBB3-12074</a>] - Enabling/Disabling/Data deleting of an extension should generate a log entry</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12174">PHPBB3-12174</a>] - "Download all attachments" link displayed when the topic has attachments in hidden posts only</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12185">PHPBB3-12185</a>] - Topic header in viewforum too small for translation</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12270">PHPBB3-12270</a>] - Approving a topic triggers wrong notification</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12275">PHPBB3-12275</a>] - core.modify_username_string is not triggered everytime</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12332">PHPBB3-12332</a>] - Attachments with long file names break the Uploader layout</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12357">PHPBB3-12357</a>] - generate_smilies() does not work for routes</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12402">PHPBB3-12402</a>] - CAPTCHA plugin migration fails to detect missing plugins</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12415">PHPBB3-12415</a>] - Use private message instead of "pm" accronym in cpf visibility options</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12421">PHPBB3-12421</a>] - We try to display attachments in feed even for users who don't have the right to see them</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12428">PHPBB3-12428</a>] - Incorrect from version in database update log entry</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12434">PHPBB3-12434</a>] - No error message with Plupload except for files without extension</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12435">PHPBB3-12435</a>] - purge_notifications() fails for disabled extensions</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12440">PHPBB3-12440</a>] - Change URL in browsers addressbar when a view=unread#unread link was used</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12451">PHPBB3-12451</a>] - posting.php TOO_FEW_CHARS_LIMIT should be split for plurals</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12459">PHPBB3-12459</a>] - Unapproved posts/topics are not correctly handled in feeds</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12460">PHPBB3-12460</a>] - Soft deleted posts/topics are not correctly handled in feeds</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12461">PHPBB3-12461</a>] - Statistics are wrong for topic's based feeds</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12476">PHPBB3-12476</a>] - purge_cache should increase asset version</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12486">PHPBB3-12486</a>] - "Risky" tests from phpunit 4.1</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12491">PHPBB3-12491</a>] - Conflict between USERNAME_FULL in functions.php and mcp_notes.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12493">PHPBB3-12493</a>] - User can not send PMs to users with PMs disabled, but PM button is visible on posts</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12498">PHPBB3-12498</a>] - IE8 displays avatar in header with wrong width</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12499">PHPBB3-12499</a>] - Incorrect call to phpbb\log\log::add() in db:migrate console command</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12500">PHPBB3-12500</a>] - user.img does not set a title attribute for resulting span</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12501">PHPBB3-12501</a>] - Weird post attachment behavior in MCP report details</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12503">PHPBB3-12503</a>] - All test cases should extend phpbb_test_case instead of PHPUnit_Framework_TestCase</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12504">PHPBB3-12504</a>] - Avatar manager test is using undefined variables</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12509">PHPBB3-12509</a>] - Extentions can't send email with new notification system</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12510">PHPBB3-12510</a>] - build_url() is not encoding url entities</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12511">PHPBB3-12511</a>] - Missing language strings in memberlist group view for mobile prosilver</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12513">PHPBB3-12513</a>] - simple_headers do not support extension loaded CSS stylesheets</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12517">PHPBB3-12517</a>] - Missing argument in call to log.add() in prune_shadow_topics.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12519">PHPBB3-12519</a>] - m_approve language update from soft delete patch got nucked by a merge conflict</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12520">PHPBB3-12520</a>] - Can not move text with the mouse anymore in post-box when attachments are allowed</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12522">PHPBB3-12522</a>] - Add parameter description in guesser_interface</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12525">PHPBB3-12525</a>] - CONTACT_USER used with username</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12526">PHPBB3-12526</a>] - "Undefined index: filesize" error thrown when editing a PM with attachments</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12527">PHPBB3-12527</a>] - Remove translation editor from ACP</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12529">PHPBB3-12529</a>] - phpbb\controller\resolver::getController doesn't use $phpbb_root_path to check if the template dir exist</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12533">PHPBB3-12533</a>] - The notification link should fill the parent li-container in the notifications dialog</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12534">PHPBB3-12534</a>] - Enabling and disabling extensions should not abuse the red errorbox</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12536">PHPBB3-12536</a>] - Get Versions Should Not Require Both Stable and Unstable Branches</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12540">PHPBB3-12540</a>] - WRONG_FILESIZE contains broken placeholders</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12543">PHPBB3-12543</a>] - Enter key no longer works in posting when attachment error is triggered</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12547">PHPBB3-12547</a>] - Rename jquery.js to jquery.min.js in assets directory</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12548">PHPBB3-12548</a>] - [RTL] - Posting button icons should display on left side of text</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12549">PHPBB3-12549</a>] - [RTL] - Forumlist/topiclist <dfn> tags should not be visible</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12550">PHPBB3-12550</a>] - [RTL] - Last post column breaks into second line</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12551">PHPBB3-12551</a>] - [RTL] - Breadcrumb separator does not display correctly</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12561">PHPBB3-12561</a>] - Create_schema_files.php should process colum "after" instead of adding it to the JSON</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12570">PHPBB3-12570</a>] - db_text throws an error, when set() is called with the current value</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12572">PHPBB3-12572</a>] - JavaScript console throws error when alert message title is not defined (core.js bug)</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12580">PHPBB3-12580</a>] - :link Pseudo causing over specificity issues in the theme</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12586">PHPBB3-12586</a>] - \phpbb\extension\manager::all_available() should only locate ext files two levels deep and ignore dot-files/folders</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12594">PHPBB3-12594</a>] - File headers, credit lines, etc. should reflect updated legal info</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12600">PHPBB3-12600</a>] - The cli command extension:show is broken</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12604">PHPBB3-12604</a>] - Notifications Dropdown Padding Broken When Empty</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12611">PHPBB3-12611</a>] - phpBB Group copyright notice should be removed from all images</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12614">PHPBB3-12614</a>] - Do not hide post buttons before hovering over post</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12621">PHPBB3-12621</a>] - schema.json is not up to date with migration files</li> + </ul> + <h4>Improvement</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-9388">PHPBB3-9388</a>] - use DOM scripting to hide unnecessary input fields</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11163">PHPBB3-11163</a>] - Include ext/ directory in installation and update packages</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12155">PHPBB3-12155</a>] - Use CSS instead of translated images for the mini post buttons</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12407">PHPBB3-12407</a>] - Allow changing of post_data and other variables with core.posting_modify_template_vars</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12431">PHPBB3-12431</a>] - Add has_poll icon to topiclists</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12433">PHPBB3-12433</a>] - QUOTE_DEPTH_EXCEEDED needs a different string for '1'</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12488">PHPBB3-12488</a>] - Add user warning indication to viewtopic posts</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12507">PHPBB3-12507</a>] - Add console command to purge the cache</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12518">PHPBB3-12518</a>] - Allow extensions to overwrite CANNOT_EDIT_* checks in posting.php and viewtopic.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12523">PHPBB3-12523</a>] - Add search_results.html template events search_results_topic_(before/after)</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12524">PHPBB3-12524</a>] - Add search.php core event to modify search results rowset</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12531">PHPBB3-12531</a>] - Restore default topic title links in subsilver2</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12555">PHPBB3-12555</a>] - Make use of canonical urls to avoid duplicate content</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12583">PHPBB3-12583</a>] - Add event core.mcp_warn_post_before/after</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12584">PHPBB3-12584</a>] - Add event core.mcp_warn_user_before/after</li> + </ul> + <h4>Sub-task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12576">PHPBB3-12576</a>] - Remove cron from common.php</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12585">PHPBB3-12585</a>] - Don't check the cron on each page load</li> + </ul> + <h4>Task</h4> + <ul> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10839">PHPBB3-10839</a>] - Remove phpunit.xml.functional and always include functional tests</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12384">PHPBB3-12384</a>] - Run Travis CI HHVM tests against MySQLi instead of MySQL</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12495">PHPBB3-12495</a>] - Add Sami to composer dependencies and build script</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12544">PHPBB3-12544</a>] - Update Plupload to 2.1.2</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12582">PHPBB3-12582</a>] - Strip away copyrighted ICC profile from images</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12592">PHPBB3-12592</a>] - Run mysql driver on Travis CI</li> + <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12603">PHPBB3-12603</a>] - Remove hook_system.html from docs</li> + </ul> + + + <a name="v310b2"></a><h3>1.ii. Changes since 3.1.0-b2</h3> <h4>Bug</h4> <ul> @@ -257,7 +365,7 @@ </ul> - <a name="v310b1"></a><h3>1.ii. Changes since 3.1.0-b1</h3> + <a name="v310b1"></a><h3>1.iii. Changes since 3.1.0-b1</h3> <h4>Bug</h4> <ul> @@ -325,7 +433,7 @@ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12302">PHPBB3-12302</a>] - Upgrade composer.phar to 1.0.0-alpha8</li> </ul> - <a name="v310a3"></a><h3>1.iii. Changes since 3.1.0-a3</h3> + <a name="v310a3"></a><h3>1.iv. Changes since 3.1.0-a3</h3> <h4>Bug</h4> <ul> @@ -472,7 +580,7 @@ </ul> - <a name="v310a2"></a><h3>1.iv. Changes since 3.1.0-a2</h3> + <a name="v310a2"></a><h3>1.v. Changes since 3.1.0-a2</h3> <h4>Bug</h4> <ul> @@ -580,7 +688,7 @@ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-12147">PHPBB3-12147</a>] - Remove Travis CI notification configuration</li> </ul> - <a name="v310a1"></a><h3>1.v. Changes since 3.1.0-a1</h3> + <a name="v310a1"></a><h3>1.vi. Changes since 3.1.0-a1</h3> <h4>Bug</h4> <ul> @@ -656,7 +764,7 @@ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11998">PHPBB3-11998</a>] - Add console / command line client environment </li> </ul> - <a name="v30x"></a><h3>1.vi. Changes since 3.0.x</h3> + <a name="v30x"></a><h3>1.vii. Changes since 3.0.x</h3> <h4>Bug</h4> <ul> @@ -1337,7 +1445,7 @@ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11913">PHPBB3-11913</a>] - Apply reorganisation of download.phpbb.com to build_announcement.php</li> </ul> - <a name="v3011"></a><h3>1.vii. Changes since 3.0.11</h3> + <a name="v3011"></a><h3>1.viii. Changes since 3.0.11</h3> <h4>Bug</h4> <ul> @@ -1492,7 +1600,7 @@ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-11753">PHPBB3-11753</a>] - Upgrade mysql_upgrader.php schema data.</li> </ul> - <a name="v3010"></a><h3>1.viii. Changes since 3.0.10</h3> + <a name="v3010"></a><h3>1.ix. Changes since 3.0.10</h3> <h4>Bug</h4> <ul> @@ -1617,7 +1725,7 @@ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10909">PHPBB3-10909</a>] - Update Travis Test Configuration: Travis no longer supports PHP 5.3.2</li> </ul> - <a name="v309"></a><h3>1.ix. Changes since 3.0.9</h3> + <a name="v309"></a><h3>1.x. Changes since 3.0.9</h3> <h4>Bug</h4> <ul> @@ -1753,7 +1861,7 @@ <li>[<a href="http://tracker.phpbb.com/browse/PHPBB3-10480">PHPBB3-10480</a>] - Automate changelog building</li> </ul> - <a name="v308"></a><h3>1.x. Changes since 3.0.8</h3> + <a name="v308"></a><h3>1.xi. Changes since 3.0.8</h3> <h4> Bug </h4> @@ -2121,7 +2229,7 @@ </ul> - <a name="v307-PL1"></a><h3>1.xi. Changes since 3.0.7-PL1</h3> + <a name="v307-PL1"></a><h3>1.xii. Changes since 3.0.7-PL1</h3> <h4> Security </h4> <ul> @@ -2579,13 +2687,13 @@ </ul> - <a name="v307"></a><h3>1.xii. Changes since 3.0.7</h3> + <a name="v307"></a><h3>1.xiii. Changes since 3.0.7</h3> <ul> <li>[Sec] Do not expose forum content of forums with ACL entries but no actual permission in ATOM Feeds. (Bug #58595)</li> </ul> - <a name="v306"></a><h3>1.xiii. Changes since 3.0.6</h3> + <a name="v306"></a><h3>1.xiv. Changes since 3.0.6</h3> <ul> <li>[Fix] Allow ban reason and length to be selected and copied in ACP and subsilver2 MCP. (Bug #51095)</li> @@ -2689,7 +2797,7 @@ </ul> - <a name="v305"></a><h3>1.xiv. Changes since 3.0.5</h3> + <a name="v305"></a><h3>1.xv. Changes since 3.0.5</h3> <ul> <li>[Fix] Allow whitespaces in avatar gallery names. (Bug #44955)</li> @@ -2911,7 +3019,7 @@ <li>[Feature] Send anonymous statistical information to phpBB on installation and update (optional).</li> </ul> - <a name="v304"></a><h3>1.xv. Changes since 3.0.4</h3> + <a name="v304"></a><h3>1.xvi. Changes since 3.0.4</h3> <ul> <li>[Fix] Delete user entry from ban list table upon user deletion (Bug #40015 - Patch by TerraFrost)</li> @@ -3000,7 +3108,7 @@ <li>[Sec] Only use forum id supplied for posting if global announcement detected. (Reported by nickvergessen)</li> </ul> - <a name="v303"></a><h3>1.xvi. Changes since 3.0.3</h3> + <a name="v303"></a><h3>1.xvii. Changes since 3.0.3</h3> <ul> <li>[Fix] Allow mixed-case template directories to be inherited (Bug #36725)</li> @@ -3032,7 +3140,7 @@ <li>[Sec] Ask for forum password if post within passworded forum quoted in private message. (Reported by nickvergessen)</li> </ul> - <a name="v302"></a><h3>1.xvii. Changes since 3.0.2</h3> + <a name="v302"></a><h3>1.xviii. Changes since 3.0.2</h3> <ul> <li>[Fix] Correctly set topic starter if first post in topic removed (Bug #30575 - Patch by blueray2048)</li> @@ -3131,7 +3239,7 @@ <li>[Sec Precaution] Stricter validation of the HTTP_HOST header (Thanks to Techie-Micheal et al for pointing out possible issues in derived code)</li> </ul> - <a name="v301"></a><h3>1.xviii. Changes since 3.0.1</h3> + <a name="v301"></a><h3>1.xix. Changes since 3.0.1</h3> <ul> <li>[Fix] Ability to set permissions on non-mysql dbms (Bug #24955)</li> @@ -3179,7 +3287,7 @@ <li>[Sec] Only allow urls gone through redirect() being used within login_box(). (thanks nookieman)</li> </ul> - <a name="v300"></a><h3>1.xix. Changes since 3.0.0</h3> + <a name="v300"></a><h3>1.xx. Changes since 3.0.0</h3> <ul> <li>[Change] Validate birthdays (Bug #15004)</li> @@ -3250,7 +3358,7 @@ <li>[Fix] Find and display colliding usernames correctly when converting from one database to another (Bug #23925)</li> </ul> - <a name="v30rc8"></a><h3>1.xx. Changes since 3.0.RC8</h3> + <a name="v30rc8"></a><h3>1.xxi. Changes since 3.0.RC8</h3> <ul> <li>[Fix] Cleaned usernames contain only single spaces, so "a_name" and "a__name" are treated as the same name (Bug #15634)</li> @@ -3259,7 +3367,7 @@ <li>[Fix] Call garbage_collection() within database updater to correctly close connections (affects Oracle for example)</li> </ul> - <a name="v30rc7"></a><h3>1.xxi. Changes since 3.0.RC7</h3> + <a name="v30rc7"></a><h3>1.xxii. Changes since 3.0.RC7</h3> <ul> <li>[Fix] Fixed MSSQL related bug in the update system</li> @@ -3294,7 +3402,7 @@ <li>[Fix] No duplication of active topics (Bug #15474)</li> </ul> - <a name="v30rc6"></a><h3>1.xxii. Changes since 3.0.RC6</h3> + <a name="v30rc6"></a><h3>1.xxiii. Changes since 3.0.RC6</h3> <ul> <li>[Fix] Submitting language changes using acp_language (Bug #14736)</li> @@ -3304,7 +3412,7 @@ <li>[Fix] Able to request new password (Bug #14743)</li> </ul> - <a name="v30rc5"></a><h3>1.xxiii. Changes since 3.0.RC5</h3> + <a name="v30rc5"></a><h3>1.xxiv. Changes since 3.0.RC5</h3> <ul> <li>[Feature] Removing constant PHPBB_EMBEDDED in favor of using an exit_handler(); the constant was meant to achive this more or less.</li> @@ -3367,7 +3475,7 @@ <li>[Sec] New password hashing mechanism for storing passwords (#i42)</li> </ul> - <a name="v30rc4"></a><h3>1.xxiv. Changes since 3.0.RC4</h3> + <a name="v30rc4"></a><h3>1.xxv. Changes since 3.0.RC4</h3> <ul> <li>[Fix] MySQL, PostgreSQL and SQLite related database fixes (Bug #13862)</li> @@ -3418,7 +3526,7 @@ <li>[Fix] odbc_autocommit causing existing result sets to be dropped (Bug #14182)</li> </ul> - <a name="v30rc3"></a><h3>1.xxv. Changes since 3.0.RC3</h3> + <a name="v30rc3"></a><h3>1.xxvi. Changes since 3.0.RC3</h3> <ul> <li>[Fix] Fixing some subsilver2 and prosilver style issues</li> @@ -3527,7 +3635,7 @@ </ul> - <a name="v30rc2"></a><h3>1.xxvi. Changes since 3.0.RC2</h3> + <a name="v30rc2"></a><h3>1.xxvii. Changes since 3.0.RC2</h3> <ul> <li>[Fix] Re-allow searching within the memberlist</li> @@ -3573,7 +3681,7 @@ </ul> - <a name="v30rc1"></a><h3>1.xxvii. Changes since 3.0.RC1</h3> + <a name="v30rc1"></a><h3>1.xxviii. Changes since 3.0.RC1</h3> <ul> <li>[Fix] (X)HTML issues within the templates (Bug #11255, #11255)</li> diff --git a/phpBB/docs/CREDITS.txt b/phpBB/docs/CREDITS.txt index 8c98843df5..a4ba4cb87c 100644 --- a/phpBB/docs/CREDITS.txt +++ b/phpBB/docs/CREDITS.txt @@ -3,7 +3,7 @@ * phpBB © Copyright phpBB Limited 2003-2014 * http://www.phpbb.com * -* phpBB is free software. You can redistribute it and/or modify it +* phpBB is free software. You can redistribute it and/or modify it * under the terms of the GNU General Public License, version 2 (GPL-2.0) * as published by the Free Software Foundation. * @@ -63,7 +63,7 @@ phpBB Developers: A_Jelly_Doughnut (Josh Woody) [01/2010 - 11/2010] Vic D'Elfant (Vic D'Elfant) [04/2007 - 04/2009] Major contributions by: leviatan21 (Gabriel Vazquez) - Neothermic (Ashley Pinner) + NeoThermic (Ashley Pinner) Raimon (Raimon Meuldijk) Xore (Robert Hetzler) diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 43417d0078..173c7e5441 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -127,7 +127,7 @@ * * This file is part of the phpBB Forum Software package. * -* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @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 diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php index 88b6a9c270..3d3cfb7f16 100644 --- a/phpBB/includes/acp/acp_extensions.php +++ b/phpBB/includes/acp/acp_extensions.php @@ -70,7 +70,7 @@ class acp_extensions // If they've specified an extension, let's load the metadata manager and validate it. if ($ext_name) { - $md_manager = new \phpbb\extension\metadata_manager($ext_name, $config, $phpbb_extension_manager, $template, $phpbb_root_path); + $md_manager = new \phpbb\extension\metadata_manager($ext_name, $config, $phpbb_extension_manager, $template, $user, $phpbb_root_path); try { diff --git a/phpBB/includes/acp/acp_logs.php b/phpBB/includes/acp/acp_logs.php index 4322cd006d..80dee1d620 100644 --- a/phpBB/includes/acp/acp_logs.php +++ b/phpBB/includes/acp/acp_logs.php @@ -54,28 +54,26 @@ class acp_logs { if (confirm_box(true)) { - $where_sql = ''; + $conditions = array(); if ($deletemark && sizeof($marked)) { - $sql_in = array(); - foreach ($marked as $mark) - { - $sql_in[] = $mark; - } - $where_sql = ' AND ' . $db->sql_in_set('log_id', $sql_in); - unset($sql_in); + $conditions['log_id'] = array('IN' => $marked); } - if ($where_sql || $deleteall) + if ($deleteall) { - $sql = 'DELETE FROM ' . LOG_TABLE . " - WHERE log_type = {$this->log_type} - $where_sql"; - $db->sql_query($sql); + if ($sort_days) + { + $conditions['log_time'] = array('>=', time() - ($sort_days * 86400)); + } - add_log('admin', 'LOG_CLEAR_' . strtoupper($mode)); + $keywords = utf8_normalize_nfc(request_var('keywords', '', true)); + $conditions['keywords'] = $keywords; } + + $phpbb_log = $phpbb_container->get('log'); + $phpbb_log->delete($mode, $conditions); } else { diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 602067a0e7..cf18cafe90 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -28,7 +28,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -define('PHPBB_VERSION', '3.1.0-b4-dev'); +define('PHPBB_VERSION', '3.1.0-b5-dev'); // QA-related // define('PHPBB_QA', 1); diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 3000a18668..2d3ac62f86 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -3030,7 +3030,7 @@ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port } else if (stripos($line, '404 not found') !== false) { - $errstr = $user->lang('FILE_NOT_FOUND', $filename); + $errstr = $user->lang('FILE_NOT_FOUND', $filename); return false; } } diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index e157a2bd0f..d4e7fecbff 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1657,7 +1657,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u if ($user->data['user_id'] != $poster_id) { $log_subject = ($subject) ? $subject : $data['topic_title']; - add_log('mod', $data['forum_id'], $data['topic_id'], 'LOG_POST_EDITED', $log_subject, (!empty($username)) ? $username : $user->lang['GUEST']); + add_log('mod', $data['forum_id'], $data['topic_id'], 'LOG_POST_EDITED', $log_subject, (!empty($username)) ? $username : $user->lang['GUEST'], $data['post_edit_reason']); } if (!isset($sql_data[POSTS_TABLE]['sql'])) diff --git a/phpBB/includes/mcp/mcp_logs.php b/phpBB/includes/mcp/mcp_logs.php index c55f56ae0c..2945e1ec8a 100644 --- a/phpBB/includes/mcp/mcp_logs.php +++ b/phpBB/includes/mcp/mcp_logs.php @@ -36,7 +36,7 @@ class mcp_logs function main($id, $mode) { global $auth, $db, $user, $template; - global $config, $phpbb_root_path, $phpEx, $phpbb_container; + global $config, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_log; $user->add_lang('acp/common'); @@ -114,27 +114,33 @@ class mcp_logs { if ($deletemark && sizeof($marked)) { - $sql = 'DELETE FROM ' . LOG_TABLE . ' - WHERE log_type = ' . LOG_MOD . ' - AND ' . $db->sql_in_set('forum_id', $forum_list) . ' - AND ' . $db->sql_in_set('log_id', $marked); - $db->sql_query($sql); + $conditions = array( + 'forum_id' => $forum_list, + 'log_id' => array('IN' => $marked), + ); - add_log('admin', 'LOG_CLEAR_MOD'); + $phpbb_log->delete('mod', $conditions); } else if ($deleteall) { - $sql = 'DELETE FROM ' . LOG_TABLE . ' - WHERE log_type = ' . LOG_MOD . ' - AND ' . $db->sql_in_set('forum_id', $forum_list); + $keywords = utf8_normalize_nfc(request_var('keywords', '', true)); + + $conditions = array( + 'forum_id' => $forum_list, + 'keywords' => $keywords, + ); + + if ($sort_days) + { + $conditions['log_time'] = array('>=', time() - ($sort_days * 86400)); + } if ($mode == 'topic_logs') { - $sql .= ' AND topic_id = ' . $topic_id; + $conditions['topic_logs'] = $topic_id; } - $db->sql_query($sql); - add_log('admin', 'LOG_CLEAR_MOD'); + $phpbb_log->delete('mod', $conditions); } } else diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index c504da0aeb..9d1afb7dc5 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -123,7 +123,7 @@ class mcp_main trigger_error('NO_TOPIC_SELECTED'); } - mcp_delete_topic($topic_ids, $soft_delete, ($soft_delete) ? $request->variable('delete_reason', '', true) : ''); + mcp_delete_topic($topic_ids, $soft_delete, $request->variable('delete_reason', '', true)); break; case 'delete_post': @@ -140,7 +140,7 @@ class mcp_main trigger_error('NO_POST_SELECTED'); } - mcp_delete_post($post_ids, $soft_delete, ($soft_delete) ? $request->variable('delete_reason', '', true) : ''); + mcp_delete_post($post_ids, $soft_delete, $request->variable('delete_reason', '', true)); break; case 'restore_topic': @@ -787,12 +787,12 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '' $return = $phpbb_content_visibility->set_topic_visibility(ITEM_DELETED, $topic_id, $row['forum_id'], $user->data['user_id'], time(), $soft_delete_reason); if (!empty($return)) { - add_log('mod', $row['forum_id'], $topic_id, 'LOG_SOFTDELETE_TOPIC', $row['topic_title'], $row['topic_first_poster_name']); + add_log('mod', $row['forum_id'], $topic_id, 'LOG_SOFTDELETE_TOPIC', $row['topic_title'], $row['topic_first_poster_name'], $soft_delete_reason); } } else { - add_log('mod', $row['forum_id'], $topic_id, 'LOG_DELETE_TOPIC', $row['topic_title'], $row['topic_first_poster_name']); + add_log('mod', $row['forum_id'], $topic_id, 'LOG_DELETE_TOPIC', $row['topic_title'], $row['topic_first_poster_name'], $soft_delete_reason); } } } @@ -826,7 +826,6 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '' 'S_TOPIC_MODE' => true, 'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id), 'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id), - 'S_DELETE_REASON' => $auth->acl_get('m_softdelete', $forum_id), )); $l_confirm = (sizeof($topic_ids) == 1) ? 'DELETE_TOPIC' : 'DELETE_TOPICS'; @@ -947,7 +946,7 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', foreach ($approve_log as $row) { $post_username = ($row['poster_id'] == ANONYMOUS && !empty($row['post_username'])) ? $row['post_username'] : $row['username']; - add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_SOFTDELETE_POST', $row['post_subject'], $post_username); + add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_SOFTDELETE_POST', $row['post_subject'], $post_username, $soft_delete_reason); } $topic_id = $request->variable('t', 0); @@ -990,7 +989,7 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', foreach ($post_data as $id => $row) { $post_username = ($row['poster_id'] == ANONYMOUS && !empty($row['post_username'])) ? $row['post_username'] : $row['username']; - add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_DELETE_POST', $row['post_subject'], $post_username); + add_log('mod', $row['forum_id'], $row['topic_id'], 'LOG_DELETE_POST', $row['post_subject'], $post_username, $soft_delete_reason); } // Now delete the posts, topics and forums are automatically resync'ed @@ -1063,7 +1062,6 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', 'S_SOFTDELETED' => $only_softdeleted, 'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id), 'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id), - 'S_DELETE_REASON' => $auth->acl_get('m_softdelete', $forum_id), )); $l_confirm = (sizeof($post_ids) == 1) ? 'DELETE_POST' : 'DELETE_POSTS'; diff --git a/phpBB/includes/startup.php b/phpBB/includes/startup.php index 65a193193a..50fcd11bee 100644 --- a/phpBB/includes/startup.php +++ b/phpBB/includes/startup.php @@ -177,7 +177,11 @@ else { if (!file_exists($phpbb_root_path . 'vendor/autoload.php')) { - trigger_error('You have not set up composer dependencies. See http://getcomposer.org/.', E_USER_ERROR); + trigger_error( + 'Composer dependencies have not been set up yet, run ' . + "'php ../composer.phar install' from the phpBB directory to do so.", + E_USER_ERROR + ); } require($phpbb_root_path . 'vendor/autoload.php'); } diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 53c69ceeb7..fc568abc68 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -283,7 +283,7 @@ function view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row) $contact_fields = array( array( 'ID' => 'pm', - 'NAME' => $user->lang['PRIVATE_MESSAGE'], + 'NAME' => $user->lang['SEND_PRIVATE_MESSAGE'], 'U_CONTACT' => $u_pm, ), array( diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php index 0c2d4ebf74..7daacf92f4 100644 --- a/phpBB/install/convertors/convert_phpbb20.php +++ b/phpBB/install/convertors/convert_phpbb20.php @@ -37,7 +37,7 @@ $dbms = phpbb_convert_30_dbms_to_31($dbms); $convertor_data = array( 'forum_name' => 'phpBB 2.0.x', 'version' => '1.0.3', - 'phpbb_version' => '3.1.0-b3', + 'phpbb_version' => '3.1.0-b4', 'author' => '<a href="https://www.phpbb.com/">phpBB Limited</a>', 'dbms' => $dbms, 'dbhost' => $dbhost, diff --git a/phpBB/install/schemas/schema.json b/phpBB/install/schemas/schema.json index 176691f1a6..f684fddc25 100644 --- a/phpBB/install/schemas/schema.json +++ b/phpBB/install/schemas/schema.json @@ -942,6 +942,10 @@ "BOOL", 0 ], + "group_skip_auth": [ + "BOOL", + 0 + ], "group_name": [ "VCHAR_CI", "" @@ -1009,12 +1013,7 @@ "group_max_recipients": [ "UINT", 0 - ], - "group_skip_auth": { - "0": "BOOL", - "1": 0, - "after": "group_founder_manage" - } + ] }, "PRIMARY_KEY": "group_id", "KEYS": { diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 7afed448ad..e335c1f9ba 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -272,7 +272,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('tpl_allow_php', '0 INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_icons_path', 'images/upload_icons'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('upload_path', 'files'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('use_system_cron', '0'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.1.0-b4-dev'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.1.0-b5-dev'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_expire_days', '90'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_gc', '14400'); diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index e2f89839c5..5e4961c435 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -461,7 +461,7 @@ $lang = array_merge($lang, array( 'UPLOAD_ICONS_PATH' => 'Extension group icons storage path', 'UPLOAD_ICONS_PATH_EXPLAIN' => 'Path under your phpBB root directory, e.g. <samp>images/upload_icons</samp>.', 'USE_SYSTEM_CRON' => 'Run periodic tasks from system cron', - 'USE_SYSTEM_CRON_EXPLAIN' => 'When off, phpBB will arrange for periodic tasks to be run automatically. When on, phpBB will not schedule any periodic tasks by itself; a system administrator must arrange for <code>cron.php</code> to be invoked by the system cron facility at regular intervals (e.g. every 5 minutes).', + 'USE_SYSTEM_CRON_EXPLAIN' => 'When off, phpBB will arrange for periodic tasks to be run automatically. When on, phpBB will not schedule any periodic tasks by itself; a system administrator must arrange for <code>bin/phpbbcli.php cron:run</code> to be run by the system cron facility at regular intervals (e.g. every 5 minutes).', )); // Security Settings diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php index d340e467be..838a73caed 100644 --- a/phpBB/language/en/acp/common.php +++ b/phpBB/language/en/acp/common.php @@ -223,8 +223,14 @@ $lang = array_merge($lang, array( 'BACK' => 'Back', + 'CLI_DESCRIPTION_CRON_RUN' => 'Runs all ready cron tasks.', + 'CLI_DESCRIPTION_CRON_RUN_ARGUMENT_1' => 'Name of the task to be run', + 'COLOUR_SWATCH' => 'Web-safe colour swatch', 'CONFIG_UPDATED' => 'Configuration updated successfully.', + 'CRON_LOCK_ERROR' => 'Could not obtain cron lock.', + 'CRON_NO_SUCH_TASK' => 'Could not find cron task “%s”.', + 'CRON_NO_TASK' => 'No cron tasks need to be run right now.', 'DEACTIVATE' => 'Deactivate', 'DIRECTORY_DOES_NOT_EXIST' => 'The entered path “%s” does not exist.', @@ -285,6 +291,7 @@ $lang = array_merge($lang, array( 'REMIND' => 'Remind', 'RESYNC' => 'Resynchronise', + 'RUNNING_TASK' => 'Running task: %s.', 'SELECT_ANONYMOUS' => 'Select anonymous user', 'SELECT_OPTION' => 'Select option', @@ -541,9 +548,9 @@ $lang = array_merge($lang, array( 'LOG_APPROVE_TOPIC' => '<strong>Approved topic</strong><br />» %s', 'LOG_BUMP_TOPIC' => '<strong>User bumped topic</strong><br />» %s', - 'LOG_DELETE_POST' => '<strong>Deleted post “%1$s” written by</strong><br />» %2$s', + 'LOG_DELETE_POST' => '<strong>Deleted post “%1$s” written by “%2$s” for the following reason</strong><br />» %3$s', 'LOG_DELETE_SHADOW_TOPIC' => '<strong>Deleted shadow topic</strong><br />» %s', - 'LOG_DELETE_TOPIC' => '<strong>Deleted topic “%1$s” written by</strong><br />» %2$s', + 'LOG_DELETE_TOPIC' => '<strong>Deleted topic “%1$s” written by “%2$s” for the following reason</strong><br />» %3$s', 'LOG_FORK' => '<strong>Copied topic</strong><br />» from %s', 'LOG_LOCK' => '<strong>Locked topic</strong><br />» %s', 'LOG_LOCK_POST' => '<strong>Locked post</strong><br />» %s', @@ -553,13 +560,13 @@ $lang = array_merge($lang, array( 'LOG_PM_REPORT_DELETED' => '<strong>Deleted PM report</strong><br />» %s', 'LOG_POST_APPROVED' => '<strong>Approved post</strong><br />» %s', 'LOG_POST_DISAPPROVED' => '<strong>Disapproved post “%1$s” written by “%3$s” for the following reason</strong><br />» %2$s', - 'LOG_POST_EDITED' => '<strong>Edited post “%1$s” written by</strong><br />» %2$s', + 'LOG_POST_EDITED' => '<strong>Edited post “%1$s” written by “%2$s” for the following reason</strong><br />» %3$s', 'LOG_POST_RESTORED' => '<strong>Restored post</strong><br />» %s', 'LOG_REPORT_CLOSED' => '<strong>Closed report</strong><br />» %s', 'LOG_REPORT_DELETED' => '<strong>Deleted report</strong><br />» %s', 'LOG_RESTORE_TOPIC' => '<strong>Restored topic “%1$s” written by</strong><br />» %2$s', - 'LOG_SOFTDELETE_POST' => '<strong>Soft deleted post “%1$s” written by</strong><br />» %2$s', - 'LOG_SOFTDELETE_TOPIC' => '<strong>Soft deleted topic “%1$s” written by</strong><br />» %2$s', + 'LOG_SOFTDELETE_POST' => '<strong>Soft deleted post “%1$s” written by “%2$s” for the following reason</strong><br />» %3$s', + 'LOG_SOFTDELETE_TOPIC' => '<strong>Soft deleted topic “%1$s” written by “%2$s” for the following reason</strong><br />» %3$s', 'LOG_SPLIT_DESTINATION' => '<strong>Moved split posts</strong><br />» to %s', 'LOG_SPLIT_SOURCE' => '<strong>Split posts</strong><br />» from %s', diff --git a/phpBB/language/en/acp/extensions.php b/phpBB/language/en/acp/extensions.php index e9f1c3ac5c..6ec722bb78 100644 --- a/phpBB/language/en/acp/extensions.php +++ b/phpBB/language/en/acp/extensions.php @@ -117,4 +117,7 @@ $lang = array_merge($lang, array( 'VERSIONCHECK_FORCE_UPDATE_ALL' => 'Re-Check all versions', 'FORCE_UNSTABLE' => 'Always check for unstable versions', 'EXTENSIONS_VERSION_CHECK_SETTINGS' => 'Version check settings', + + 'META_FIELD_NOT_SET' => 'Required meta field %s has not been set.', + 'META_FIELD_INVALID' => 'Meta field %s is invalid.', )); diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 5e524a6164..2020783100 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -231,6 +231,8 @@ $lang = array_merge($lang, array( 'FILESIZE' => 'File size', 'FILEDATE' => 'File date', 'FILE_COMMENT' => 'File comment', + 'FILE_CONTENT_ERR' => 'Could not read the contents of file: %s', + 'FILE_JSON_DECODE_ERR' => 'Failed to decode json file: %s', 'FILE_NOT_FOUND' => 'The requested file could not be found: %s', 'FIND_USERNAME' => 'Find a member', 'FOLDER' => 'Folder', diff --git a/phpBB/phpbb/avatar/driver/local.php b/phpBB/phpbb/avatar/driver/local.php index 00e519e3f2..c9e6781205 100644 --- a/phpBB/phpbb/avatar/driver/local.php +++ b/phpBB/phpbb/avatar/driver/local.php @@ -36,7 +36,7 @@ class local extends \phpbb\avatar\driver\driver public function prepare_form($request, $template, $user, $row, &$error) { $avatar_list = $this->get_avatar_list($user); - $category = $request->variable('avatar_local_cat', ''); + $category = $request->variable('avatar_local_cat', key($avatar_list)); foreach ($avatar_list as $cat => $null) { diff --git a/phpBB/phpbb/console/command/cron/run.php b/phpBB/phpbb/console/command/cron/run.php new file mode 100644 index 0000000000..1029a2e085 --- /dev/null +++ b/phpBB/phpbb/console/command/cron/run.php @@ -0,0 +1,176 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited +* @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\cron; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; + +class run extends \phpbb\console\command\command +{ + /** @var \phpbb\cron\manager */ + protected $cron_manager; + + /** @var \phpbb\lock\db */ + protected $lock_db; + + /** @var \phpbb\user */ + protected $user; + + /** + * Construct method + * + * @param \phpbb\cron\manager $cron_manager The cron manager containing + * the cron tasks to be executed. + * @param \phpbb\lock\db $lock_db The lock for accessing database. + * @param \phobb\user $user The user object (used to get language information) + */ + public function __construct(\phpbb\cron\manager $cron_manager, \phpbb\lock\db $lock_db, \phpbb\user $user) + { + $this->cron_manager = $cron_manager; + $this->lock_db = $lock_db; + $this->user = $user; + parent::__construct(); + } + + /** + * Sets the command name and description + * + * @return null + */ + protected function configure() + { + $this + ->setName('cron:run') + ->setDescription($this->user->lang('CLI_DESCRIPTION_CRON_RUN')) + ->addArgument('name', InputArgument::OPTIONAL, $this->user->lang('CLI_DESCRIPTION_CRON_RUN_ARGUMENT_1')) + ; + } + + /** + * Executes the command cron:run. + * + * Tries to acquire the cron lock, then if no argument has been given runs all ready cron tasks. + * If the cron lock can not be obtained, an error message is printed + * and the exit status is set to 1. + * If the verbose option is specified, each start of a task is printed. + * Otherwise there is no output. + * If an argument is given to the command, only the task whose name matches the + * argument will be started. If verbose option is specified, + * an info message containing the name of the task is printed. + * If no task matches the argument given, an error message is printed + * and the exit status is set to 2. + * + * @param InputInterface $input The input stream used to get the argument and verboe option. + * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. + * + * @return int 0 if all is ok, 1 if a lock error occured and 2 if no task matching the argument was found. + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + if ($this->lock_db->acquire()) + { + $task_name = $input->getArgument('name'); + if ($task_name) + { + $exit_status = $this->run_one($input, $output, $task_name); + } + else + { + $exit_status = $this->run_all($input, $output); + } + + $this->lock_db->release(); + return $exit_status; + } + else + { + $output->writeln('<error>' . $this->user->lang('CRON_LOCK_ERROR') . '</error>'); + return 1; + } + } + + /* + * Executes all ready cron tasks. + * + * If verbose mode is set, an info message will be printed if there is no task to + * be run, or else for each starting task. + * + * @see execute + * @param InputInterface $input The input stream used to get the argument and verbose option. + * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. + * @return int 0 + */ + protected function run_all(InputInterface $input, OutputInterface $output) + { + $run_tasks = $this->cron_manager->find_all_ready_tasks(); + + if ($run_tasks) + { + foreach ($run_tasks as $task) + { + if ($input->getOption('verbose')) + { + $output->writeln('<info>' . $this->user->lang('RUNNING_TASK', $task->get_name()) . '</info>'); + } + + $task->run(); + } + } + else + { + if ($input->getOption('verbose')) + { + $output->writeln('<info>' . $this->user->lang('CRON_NO_TASK') . '</info>'); + } + } + + return 0; + } + + /* + * Executes a given cron task, if it is ready. + * + * If there is a task whose name matches $task_name, it is run and 0 is returned. + * and if verbose mode is set, print an info message with the name of the task. + * If there is no task matching $task_name, the function prints an error message + * and returns with status 2. + * + * @see execute + * @param string $task_name The name of the task that should be run. + * @param InputInterface $input The input stream used to get the argument and verbose option. + * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. + * @return int 0 if all is well, 2 if no task matches $task_name. + */ + protected function run_one(InputInterface $input, OutputInterface $output, $task_name) + { + $task = $this->cron_manager->find_task($task_name); + if ($task) + { + if ($input->getOption('verbose')) + { + $output->writeln('<info>' . $this->user->lang('RUNNING_TASK', $task_name) . '</info>'); + } + + $task->run(); + return 0; + } + else + { + $output->writeln('<error>' . $this->user->lang('CRON_NO_SUCH_TASK', $task_name) . '</error>'); + return 2; + } + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/beta4.php b/phpBB/phpbb/db/migration/data/v310/beta4.php new file mode 100644 index 0000000000..3e91d95178 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/beta4.php @@ -0,0 +1,33 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class beta4 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\beta3', + '\phpbb\db\migration\data\v310\extensions_version_check_force_unstable', + '\phpbb\db\migration\data\v310\reset_missing_captcha_plugin', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.1.0-b4')), + ); + } +} diff --git a/phpBB/phpbb/db/migration/data/v310/extensions_version_check_force_unstable.php b/phpBB/phpbb/db/migration/data/v310/extensions_version_check_force_unstable.php index 5941c3aa54..1d6276f484 100644 --- a/phpBB/phpbb/db/migration/data/v310/extensions_version_check_force_unstable.php +++ b/phpBB/phpbb/db/migration/data/v310/extensions_version_check_force_unstable.php @@ -1,9 +1,13 @@ <?php /** * -* @package migration -* @copyright (c) 2012 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* 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. * */ diff --git a/phpBB/phpbb/extension/finder.php b/phpBB/phpbb/extension/finder.php index 71a5542b67..6f2408094e 100644 --- a/phpBB/phpbb/extension/finder.php +++ b/phpBB/phpbb/extension/finder.php @@ -465,6 +465,10 @@ class finder } else if ($directory && $directory[0] === '/') { + if (!$is_dir) + { + $path .= substr($directory, 1); + } $directory_pattern = '^' . preg_quote(str_replace('/', DIRECTORY_SEPARATOR, $directory) . DIRECTORY_SEPARATOR, '#'); } else @@ -477,45 +481,56 @@ class finder } $directory_pattern = '#' . $directory_pattern . '#'; - $iterator = new \RecursiveIteratorIterator( - new \phpbb\recursive_dot_prefix_filter_iterator( - new \RecursiveDirectoryIterator( - $path, - \FilesystemIterator::SKIP_DOTS - ) - ), - \RecursiveIteratorIterator::SELF_FIRST - ); - - foreach ($iterator as $file_info) + if (is_dir($path)) { - $filename = $file_info->getFilename(); - - if ($file_info->isDir() == $is_dir) + $iterator = new \RecursiveIteratorIterator( + new \phpbb\recursive_dot_prefix_filter_iterator( + new \RecursiveDirectoryIterator( + $path, + \FilesystemIterator::SKIP_DOTS + ) + ), + \RecursiveIteratorIterator::SELF_FIRST + ); + + foreach ($iterator as $file_info) { - if ($is_dir) + $filename = $file_info->getFilename(); + + if ($file_info->isDir() == $is_dir) { - $relative_path = $iterator->getInnerIterator()->getSubPath() . DIRECTORY_SEPARATOR . basename($filename) . DIRECTORY_SEPARATOR; - if ($relative_path[0] !== DIRECTORY_SEPARATOR) + if ($is_dir) { - $relative_path = DIRECTORY_SEPARATOR . $relative_path; + $relative_path = $iterator->getInnerIterator()->getSubPath() . DIRECTORY_SEPARATOR . basename($filename) . DIRECTORY_SEPARATOR; + if ($relative_path[0] !== DIRECTORY_SEPARATOR) + { + $relative_path = DIRECTORY_SEPARATOR . $relative_path; + } + } + else + { + $relative_path = $iterator->getInnerIterator()->getSubPathname(); + if ($directory && $directory[0] === '/') + { + $relative_path = str_replace('/', DIRECTORY_SEPARATOR, $directory) . DIRECTORY_SEPARATOR . $relative_path; + } + else + { + $relative_path = DIRECTORY_SEPARATOR . $relative_path; + } } - } - else - { - $relative_path = DIRECTORY_SEPARATOR . $iterator->getInnerIterator()->getSubPathname(); - } - if ((!$suffix || substr($relative_path, -strlen($suffix)) === $suffix) && - (!$prefix || substr($filename, 0, strlen($prefix)) === $prefix) && - (!$directory || preg_match($directory_pattern, $relative_path))) - { - $files[] = array( - 'named_path' => str_replace(DIRECTORY_SEPARATOR, '/', $location . $name . substr($relative_path, 1)), - 'ext_name' => $ext_name, - 'path' => str_replace(array(DIRECTORY_SEPARATOR, $this->phpbb_root_path), array('/', ''), $file_info->getPath()) . '/', - 'filename' => $filename, - ); + if ((!$suffix || substr($relative_path, -strlen($suffix)) === $suffix) && + (!$prefix || substr($filename, 0, strlen($prefix)) === $prefix) && + (!$directory || preg_match($directory_pattern, $relative_path))) + { + $files[] = array( + 'named_path' => str_replace(DIRECTORY_SEPARATOR, '/', $location . $name . substr($relative_path, 1)), + 'ext_name' => $ext_name, + 'path' => str_replace(array(DIRECTORY_SEPARATOR, $this->phpbb_root_path), array('/', ''), $file_info->getPath()) . '/', + 'filename' => $filename, + ); + } } } } diff --git a/phpBB/phpbb/extension/manager.php b/phpBB/phpbb/extension/manager.php index 0bfec23573..cd7289e085 100644 --- a/phpBB/phpbb/extension/manager.php +++ b/phpBB/phpbb/extension/manager.php @@ -26,6 +26,7 @@ class manager protected $db; protected $config; protected $cache; + protected $user; protected $php_ext; protected $extensions; protected $extension_table; @@ -37,25 +38,27 @@ class manager * * @param ContainerInterface $container A container * @param \phpbb\db\driver\driver_interface $db A database connection - * @param \phpbb\config\config $config \phpbb\config\config + * @param \phpbb\config\config $config Config object * @param \phpbb\filesystem $filesystem + * @param \phpbb\user $user User object * @param string $extension_table The name of the table holding extensions * @param string $phpbb_root_path Path to the phpbb includes directory. - * @param string $php_ext php file extension + * @param string $php_ext php file extension, defaults to php * @param \phpbb\cache\driver\driver_interface $cache A cache instance or null * @param string $cache_name The name of the cache variable, defaults to _ext */ - public function __construct(ContainerInterface $container, \phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\filesystem $filesystem, $extension_table, $phpbb_root_path, $php_ext = 'php', \phpbb\cache\driver\driver_interface $cache = null, $cache_name = '_ext') + public function __construct(ContainerInterface $container, \phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\filesystem $filesystem, \phpbb\user $user, $extension_table, $phpbb_root_path, $php_ext = 'php', \phpbb\cache\driver\driver_interface $cache = null, $cache_name = '_ext') { + $this->cache = $cache; + $this->cache_name = $cache_name; + $this->config = $config; $this->container = $container; - $this->phpbb_root_path = $phpbb_root_path; $this->db = $db; - $this->config = $config; - $this->cache = $cache; + $this->extension_table = $extension_table; $this->filesystem = $filesystem; + $this->phpbb_root_path = $phpbb_root_path; $this->php_ext = $php_ext; - $this->extension_table = $extension_table; - $this->cache_name = $cache_name; + $this->user = $user; $this->extensions = ($this->cache) ? $this->cache->get($this->cache_name) : false; @@ -150,7 +153,7 @@ class manager */ public function create_extension_metadata_manager($name, \phpbb\template\template $template) { - return new \phpbb\extension\metadata_manager($name, $this->config, $this, $template, $this->phpbb_root_path); + return new \phpbb\extension\metadata_manager($name, $this->config, $this, $template, $this->user, $this->phpbb_root_path); } /** diff --git a/phpBB/phpbb/extension/metadata_manager.php b/phpBB/phpbb/extension/metadata_manager.php index 047f0ca54c..5c4e8fbf00 100644 --- a/phpBB/phpbb/extension/metadata_manager.php +++ b/phpBB/phpbb/extension/metadata_manager.php @@ -37,6 +37,12 @@ class metadata_manager protected $template; /** + * phpBB User instance + * @var \phpbb\user + */ + protected $user; + + /** * phpBB root path * @var string */ @@ -65,15 +71,17 @@ class 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 phpBBb extension manager - * @param \phpbb\template\template $template phpBB Template instance + * @param \phpbb\extension\manager $extension_manager An instance of the phpBB extension manager + * @param \phpbb\template\template $template phpBB Template instance + * @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_root_path) + public function __construct($ext_name, \phpbb\config\config $config, \phpbb\extension\manager $extension_manager, \phpbb\template\template $template, \phpbb\user $user, $phpbb_root_path) { $this->config = $config; $this->extension_manager = $extension_manager; $this->template = $template; + $this->user = $user; $this->phpbb_root_path = $phpbb_root_path; $this->ext_name = $ext_name; @@ -141,7 +149,7 @@ class metadata_manager if (!file_exists($this->metadata_file)) { - throw new \phpbb\extension\exception('The required file does not exist: ' . $this->metadata_file); + throw new \phpbb\extension\exception($this->user->lang('FILE_NOT_FOUND', $this->metadata_file)); } } @@ -154,18 +162,18 @@ class metadata_manager { if (!file_exists($this->metadata_file)) { - throw new \phpbb\extension\exception('The required file does not exist: ' . $this->metadata_file); + throw new \phpbb\extension\exception($this->user->lang('FILE_NOT_FOUND', $this->metadata_file)); } else { if (!($file_contents = file_get_contents($this->metadata_file))) { - throw new \phpbb\extension\exception('file_get_contents failed on ' . $this->metadata_file); + throw new \phpbb\extension\exception($this->user->lang('FILE_CONTENT_ERR', $this->metadata_file)); } if (($metadata = json_decode($file_contents, true)) === null) { - throw new \phpbb\extension\exception('json_decode failed on ' . $this->metadata_file); + throw new \phpbb\extension\exception($this->user->lang('FILE_JSON_DECODE_ERR', $this->metadata_file)); } $this->metadata = $metadata; @@ -224,12 +232,12 @@ class metadata_manager { if (!isset($this->metadata[$name])) { - throw new \phpbb\extension\exception("Required meta field '$name' has not been set."); + throw new \phpbb\extension\exception($this->user->lang('META_FIELD_NOT_SET', $name)); } if (!preg_match($fields[$name], $this->metadata[$name])) { - throw new \phpbb\extension\exception("Meta field '$name' is invalid."); + throw new \phpbb\extension\exception($this->user->lang('META_FIELD_INVALID', $name)); } } break; @@ -247,14 +255,14 @@ class metadata_manager { if (empty($this->metadata['authors'])) { - throw new \phpbb\extension\exception("Required meta field 'authors' has not been set."); + throw new \phpbb\extension\exception($this->user->lang('META_FIELD_NOT_SET', 'authors')); } foreach ($this->metadata['authors'] as $author) { if (!isset($author['name'])) { - throw new \phpbb\extension\exception("Required meta field 'author name' has not been set."); + throw new \phpbb\extension\exception($this->user->lang('META_FIELD_NOT_SET', 'author name')); } } diff --git a/phpBB/phpbb/log/log.php b/phpBB/phpbb/log/log.php index d83fa90a8e..10efe5fd1c 100644 --- a/phpBB/phpbb/log/log.php +++ b/phpBB/phpbb/log/log.php @@ -332,6 +332,99 @@ class log implements \phpbb\log\log_interface } /** + * {@inheritDoc} + */ + public function delete($mode, $conditions = array()) + { + switch ($mode) + { + case 'admin': + $log_type = LOG_ADMIN; + break; + + case 'mod': + $log_type = LOG_MOD; + break; + + case 'user': + $log_type = LOG_USERS; + break; + + case 'users': + $log_type = LOG_USERS; + break; + + case 'critical': + $log_type = LOG_CRITICAL; + break; + + default: + $log_type = false; + } + + /** + * Allows to modify log data before we delete it from the database + * + * NOTE: if sql_ary does not contain a log_type value, the entry will + * not be deleted in the database. So ensure to set it, if needed. + * + * @event core.delete_log + * @var string mode Mode of the entry we log + * @var string log_type Type ID of the log (should be different than false) + * @var array conditions An array of conditions, 3 different forms are accepted + * 1) <key> => <value> transformed into 'AND <key> = <value>' (value should be an integer) + * 2) <key> => array(<operator>, <value>) transformed into 'AND <key> <operator> <value>' (values can't be an array) + * 3) <key> => array('IN' => array(<values>)) transformed into 'AND <key> IN <values>' + * A special field, keywords, can also be defined. In this case only the log entries that have the keywords in log_operation or log_data will be deleted. + * @since 3.1.0-b4 + */ + $vars = array( + 'mode', + 'log_type', + 'conditions', + ); + extract($this->dispatcher->trigger_event('core.delete_log', compact($vars))); + + if ($log_type === false) + { + return; + } + + $sql_where = 'WHERE log_type = ' . $log_type; + + if (isset($conditions['keywords'])) + { + $sql_where .= $this->generate_sql_keyword($conditions['keywords'], ''); + + unset($conditions['keywords']); + } + + foreach ($conditions as $field => $field_value) + { + $sql_where .= ' AND '; + + if (is_array($field_value) && sizeof($field_value) == 2 && !is_array($field_value[1])) + { + $sql_where .= $field . ' ' . $field_value[0] . ' ' . $field_value[1]; + } + else if (is_array($field_value) && isset($field_value['IN']) && is_array($field_value['IN'])) + { + $sql_where .= $this->db->sql_in_set($field, $field_value['IN']); + } + else + { + $sql_where .= $field . ' = ' . $field_value; + } + } + + $sql = 'DELETE FROM ' . LOG_TABLE . " + $sql_where"; + $this->db->sql_query($sql); + + $this->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_CLEAR_' . strtoupper($mode)); + } + + /** * Grab the logs from the database * * {@inheritDoc} @@ -638,11 +731,13 @@ class log implements \phpbb\log\log_interface /** * Generates a sql condition for the specified keywords * - * @param string $keywords The keywords the user specified to search for + * @param string $keywords The keywords the user specified to search for + * @param string $table_alias The alias of the logs' table ('l.' by default) + * @param string $statement_operator The operator used to prefix the statement ('AND' by default) * * @return string Returns the SQL condition searching for the keywords */ - protected function generate_sql_keyword($keywords) + protected function generate_sql_keyword($keywords, $table_alias = 'l.', $statement_operator = 'AND') { // Use no preg_quote for $keywords because this would lead to sole // backslashes being added. We also use an OR connection here for @@ -687,12 +782,12 @@ class log implements \phpbb\log\log_interface } } - $sql_keywords = 'AND ('; + $sql_keywords = ' ' . $statement_operator . ' ('; if (!empty($operations)) { - $sql_keywords .= $this->db->sql_in_set('l.log_operation', $operations) . ' OR '; + $sql_keywords .= $this->db->sql_in_set($table_alias . 'log_operation', $operations) . ' OR '; } - $sql_lower = $this->db->sql_lower_text('l.log_data'); + $sql_lower = $this->db->sql_lower_text($table_alias . 'log_data'); $sql_keywords .= " $sql_lower " . implode(" OR $sql_lower ", $keywords) . ')'; } diff --git a/phpBB/phpbb/log/log_interface.php b/phpBB/phpbb/log/log_interface.php index 2a44ebecb6..5932f722aa 100644 --- a/phpBB/phpbb/log/log_interface.php +++ b/phpBB/phpbb/log/log_interface.php @@ -69,6 +69,18 @@ interface log_interface public function add($mode, $user_id, $log_ip, $log_operation, $log_time = false, $additional_data = array()); /** + * Delete entries in the logs + * + * @param string $mode The mode defines which log_type is used and from which log the entries are deleted + * @param array $conditions An array of conditions, 3 different forms are accepted + * 1) <key> => <value> transformed into 'AND <key> = <value>' (value should be an integer) + * 2) <key> => array(<operator>, <value>) transformed into 'AND <key> <operator> <value>' (values can't be an array) + * 3) <key> => array('IN' => array(<values>)) transformed into 'AND <key> IN <values>' + * A special field, keywords, can also be defined. In this case only the log entries that have the keywords in log_operation or log_data will be deleted. + */ + public function delete($mode, $conditions = array()); + + /** * Grab the logs from the database * * @param string $mode The mode defines which log_type is used and ifrom which log the entry is retrieved diff --git a/phpBB/phpbb/log/null.php b/phpBB/phpbb/log/null.php index 7b11cc9e21..baa78895ea 100644 --- a/phpBB/phpbb/log/null.php +++ b/phpBB/phpbb/log/null.php @@ -51,6 +51,13 @@ class null implements log_interface /** * {@inheritdoc} */ + public function delete($mode, $conditions = array()) + { + } + + /** + * {@inheritdoc} + */ public function get_logs($mode, $count_logs = true, $limit = 0, $offset = 0, $forum_id = 0, $topic_id = 0, $user_id = 0, $log_time = 0, $sort_by = 'l.log_time DESC', $keywords = '') { return array(); diff --git a/phpBB/posting.php b/phpBB/posting.php index d3015c6eb6..60bb595da6 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1546,6 +1546,7 @@ $page_data = array( 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', 'TOPIC_TIME_LIMIT' => (int) $post_data['topic_time_limit'], 'EDIT_REASON' => $request->variable('edit_reason', ''), + 'SHOW_PANEL' => $request->variable('show_panel', ''), 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id"), 'U_VIEW_TOPIC' => ($mode != 'post') ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id") : '', 'U_PROGRESS_BAR' => append_sid("{$phpbb_root_path}posting.$phpEx", "f=$forum_id&mode=popup"), @@ -1571,7 +1572,6 @@ $page_data = array( 'S_LOCK_POST_ALLOWED' => ($mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? true : false, 'S_LOCK_POST_CHECKED' => ($lock_post_checked) ? ' checked="checked"' : '', 'S_SOFTDELETE_CHECKED' => ($mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED) ? ' checked="checked"' : '', - 'S_DELETE_REASON' => ($mode == 'edit' && $auth->acl_get('m_softdelete', $forum_id)) ? true : false, 'S_SOFTDELETE_ALLOWED' => ($mode == 'edit' && $phpbb_content_visibility->can_soft_delete($forum_id, $post_data['poster_id'], $lock_post_checked)) ? true : false, 'S_RESTORE_ALLOWED' => $auth->acl_get('m_approve', $forum_id), 'S_IS_DELETED' => ($mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED) ? true : false, @@ -1781,14 +1781,14 @@ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_sof if ($next_post_id === false) { - add_log('mod', $forum_id, $topic_id, (($is_soft) ? 'LOG_SOFTDELETE_TOPIC' : 'LOG_DELETE_TOPIC'), $post_data['topic_title'], $post_username); + add_log('mod', $forum_id, $topic_id, (($is_soft) ? 'LOG_SOFTDELETE_TOPIC' : 'LOG_DELETE_TOPIC'), $post_data['topic_title'], $post_username, $soft_delete_reason); $meta_info = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id"); $message = $user->lang['POST_DELETED']; } else { - add_log('mod', $forum_id, $topic_id, (($is_soft) ? 'LOG_SOFTDELETE_POST' : 'LOG_DELETE_POST'), $post_data['post_subject'], $post_username); + add_log('mod', $forum_id, $topic_id, (($is_soft) ? 'LOG_SOFTDELETE_POST' : 'LOG_DELETE_POST'), $post_data['post_subject'], $post_username, $soft_delete_reason); $meta_info = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&p=$next_post_id") . "#p$next_post_id"; $message = $user->lang['POST_DELETED']; @@ -1812,14 +1812,12 @@ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_sof $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)); - $display_reason = $auth->acl_get('m_softdelete', $forum_id) || ($can_delete && $can_softdelete); $template->assign_vars(array( 'S_SOFTDELETED' => $post_data['post_visibility'] == ITEM_DELETED, 'S_CHECKED_PERMANENT' => $request->is_set_post('delete_permanent') ? ' checked="checked"' : '', 'S_ALLOWED_DELETE' => $can_delete, 'S_ALLOWED_SOFTDELETE' => $can_softdelete, - 'S_DELETE_REASON' => $display_reason, )); $l_confirm = 'DELETE_POST'; diff --git a/phpBB/styles/prosilver/style.cfg b/phpBB/styles/prosilver/style.cfg index b4a96cd811..f3dd72cb52 100644 --- a/phpBB/styles/prosilver/style.cfg +++ b/phpBB/styles/prosilver/style.cfg @@ -21,8 +21,8 @@ # General Information about this style name = prosilver copyright = © phpBB Limited, 2007 -style_version = 3.1.0-b3 -phpbb_version = 3.1.0-b3 +style_version = 3.1.0-b4 +phpbb_version = 3.1.0-b4 # Defining a different template bitfield # template_bitfield = lNg= diff --git a/phpBB/styles/prosilver/template/confirm_delete_body.html b/phpBB/styles/prosilver/template/confirm_delete_body.html index 2d4dde5cd5..f164b5f357 100644 --- a/phpBB/styles/prosilver/template/confirm_delete_body.html +++ b/phpBB/styles/prosilver/template/confirm_delete_body.html @@ -2,23 +2,19 @@ <form action="{S_CONFIRM_ACTION}" method="post"> <p>{MESSAGE_TEXT}</p> - <!-- IF not S_SOFTDELETED and (S_DELETE_REASON or (S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE)) --> - <!-- IF S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE --> - <label> - <strong>{L_DELETE_PERMANENTLY}{L_COLON}</strong> - <input id="delete_permanent" name="delete_permanent" type="checkbox" value="1" {S_CHECKED_PERMANENT} /> - <!-- IF S_TOPIC_MODE -->{L_DELETE_TOPIC_PERMANENTLY}<!-- ELSE -->{L_DELETE_POST_PERMANENTLY}<!-- ENDIF --> - </label> - <!-- ENDIF --> - - <!-- IF S_DELETE_REASON --> - <label for="delete_reason"> - <strong>{L_DELETE_REASON}{L_COLON}</strong><br /><span>{L_DELETE_REASON_EXPLAIN}</span><br /> - <input type="text" name="delete_reason" value="" class="inputbox autowidth" maxlength="120" size="45" /> - </label> - <!-- ENDIF --> + <!-- IF not S_SOFTDELETED and S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE --> + <label> + <strong>{L_DELETE_PERMANENTLY}{L_COLON}</strong> + <input id="delete_permanent" name="delete_permanent" type="checkbox" value="1" {S_CHECKED_PERMANENT} /> + <!-- IF S_TOPIC_MODE -->{L_DELETE_TOPIC_PERMANENTLY}<!-- ELSE -->{L_DELETE_POST_PERMANENTLY}<!-- ENDIF --> + </label> <!-- ENDIF --> + <label for="delete_reason"> + <strong>{L_DELETE_REASON}{L_COLON}</strong><br /><span>{L_DELETE_REASON_EXPLAIN}</span><br /> + <input type="text" name="delete_reason" value="" class="inputbox autowidth" maxlength="120" size="45" /> + </label> + <fieldset class="submit-buttons"> <input type="button" name="confirm" value="{L_YES}" class="button1" /> <input type="button" name="cancel" value="{L_NO}" class="button2" /> @@ -37,9 +33,8 @@ <p>{MESSAGE_TEXT}</p> - <!-- IF not S_SOFTDELETED and (S_DELETE_REASON or (S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE)) --> <fieldset class="fields1"> - <!-- IF S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE --> + <!-- IF not S_SOFTDELETED and S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE --> <dl> <dt><label for="delete_permanent">{L_DELETE_PERMANENTLY}{L_COLON}</label></dt> <dd> @@ -51,14 +46,11 @@ </dl> <!-- ENDIF --> - <!-- IF S_DELETE_REASON --> - <dl> - <dt><label for="delete_reason">{L_DELETE_REASON}{L_COLON}</label><br /><span>{L_DELETE_REASON_EXPLAIN}</span></dt> - <dd><input type="text" name="delete_reason" id="delete_reason" value="" class="inputbox autowidth" maxlength="120" size="45" /></dd> - </dl> - <!-- ENDIF --> + <dl> + <dt><label for="delete_reason">{L_DELETE_REASON}{L_COLON}</label><br /><span>{L_DELETE_REASON_EXPLAIN}</span></dt> + <dd><input type="text" name="delete_reason" id="delete_reason" value="" class="inputbox autowidth" maxlength="120" size="45" /></dd> + </dl> </fieldset> - <!-- ENDIF --> <fieldset class="submit-buttons"> {S_HIDDEN_FIELDS} diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index a4ede51f4b..ef7ca23ef4 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -117,6 +117,7 @@ jQuery(document).ready(function() { if (typeof(p) === 'string') { show_panel = p; } + $('input[name="show_panel"]').val(show_panel); for (i = 0; i < panels.length; i++) { jQuery('#' + panels[i]).css('display', panels[i] === show_panel ? 'block' : 'none'); @@ -517,7 +518,7 @@ function parse_document(container) block = $this.find('dt .responsive-show:last-child'); } else { - first = (block.text().trim().length == 0); + first = ($.trim(block.text()).length == 0); } // Copy contents of each column @@ -570,7 +571,7 @@ function parse_document(container) block = $this.find('dt .responsive-show:last-child'); } else { - first = (block.text().trim().length == 0); + first = ($.trim(block.text()).length == 0); } // Copy contents of each column @@ -648,7 +649,7 @@ function parse_document(container) cells.each(function() { var cell = $(this), colspan = parseInt(cell.attr('colspan')), - text = cell.text().trim(); + text = $.trim(cell.text()); if (headersLength <= column) { return; diff --git a/phpBB/styles/prosilver/template/overall_footer.html b/phpBB/styles/prosilver/template/overall_footer.html index 28ed215662..e9c95aa799 100644 --- a/phpBB/styles/prosilver/template/overall_footer.html +++ b/phpBB/styles/prosilver/template/overall_footer.html @@ -33,7 +33,7 @@ </div> <div> - <a id="bottom" accesskey="z"></a> + <a id="bottom" class="anchor" accesskey="z"></a> <!-- IF not S_IS_BOT -->{RUN_CRON_TASK}<!-- ENDIF --> </div> diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index d18fff6bb0..e5371e792e 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -57,7 +57,7 @@ <!-- EVENT overall_header_body_before --> <div id="wrap"> - <a id="top" accesskey="t"></a> + <a id="top" class="anchor" accesskey="t"></a> <div id="page-header"> <div class="headerbar"> <div class="inner"> @@ -89,7 +89,7 @@ <!-- EVENT overall_header_page_body_before --> - <a id="start_here"></a> + <a id="start_here" class="anchor"></a> <div id="page-body"> <!-- IF S_BOARD_DISABLED and S_USER_LOGGED_IN and (U_MCP or U_ACP) --> <div id="information" class="rules"> diff --git a/phpBB/styles/prosilver/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html index e311b85cbe..081c267a94 100644 --- a/phpBB/styles/prosilver/template/posting_editor.html +++ b/phpBB/styles/prosilver/template/posting_editor.html @@ -99,7 +99,7 @@ <!-- ENDIF --> <!-- IF not S_PRIVMSGS and not S_SHOW_DRAFTS and not $SIG_EDIT eq 1 --> - <div id="tabs" class="sub-panels" data-show-panel="options-panel"> + <div id="tabs" class="sub-panels" data-show-panel="<!-- IF SHOW_PANEL -->{SHOW_PANEL}<!-- ELSE -->options-panel<!-- ENDIF -->"> <ul> <li id="options-panel-tab" class="activetab"><a href="#tabs" data-subpanel="options-panel"><span>{L_OPTIONS}</span></a></li> <!-- IF S_SHOW_ATTACH_BOX --> diff --git a/phpBB/styles/prosilver/template/posting_layout.html b/phpBB/styles/prosilver/template/posting_layout.html index 4ef0954200..630afdb832 100644 --- a/phpBB/styles/prosilver/template/posting_layout.html +++ b/phpBB/styles/prosilver/template/posting_layout.html @@ -68,6 +68,7 @@ <!-- DEFINE $EXTRA_POSTING_OPTIONS = 1 --> <!-- INCLUDE posting_editor.html --> + <input type="hidden" name="show_panel" value="options-panel" /> {S_FORM_TOKEN} </div> </div> diff --git a/phpBB/styles/prosilver/template/simple_header.html b/phpBB/styles/prosilver/template/simple_header.html index 48f6cc87da..d31dd32cf6 100644 --- a/phpBB/styles/prosilver/template/simple_header.html +++ b/phpBB/styles/prosilver/template/simple_header.html @@ -35,5 +35,5 @@ <!-- EVENT simple_header_body_before --> <div id="simple-wrap"> - <a id="top" accesskey="t"></a> + <a id="top" class="anchor" accesskey="t"></a> <div id="page-body"> diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html b/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html index 551e58f62f..ce0f4941a5 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewmessage_print.html @@ -11,7 +11,7 @@ </head> <body id="phpbb"> <div id="wrap"> - <a id="top" accesskey="t"></a> + <a id="top" class="anchor" accesskey="t"></a> <div id="page-header"> <h1>{SITENAME}</h1> diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index 21fc725cf7..fb0b9733e7 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -117,7 +117,7 @@ <!-- BEGIN postrow --> <!-- EVENT viewtopic_body_postrow_post_before --> - <!-- IF postrow.S_FIRST_UNREAD --><a id="unread" data-url="{postrow.U_MINI_POST}"></a><!-- ENDIF --> + <!-- IF postrow.S_FIRST_UNREAD --><a id="unread" class="anchor" data-url="{postrow.U_MINI_POST}"></a><!-- ENDIF --> <div id="p{postrow.POST_ID}" class="post <!-- IF postrow.S_ROW_COUNT is odd -->bg1<!-- ELSE -->bg2<!-- ENDIF --><!-- IF postrow.S_UNREAD_POST --> unreadpost<!-- ENDIF --><!-- IF postrow.S_POST_REPORTED --> reported<!-- ENDIF --><!-- IF postrow.S_POST_DELETED --> deleted<!-- ENDIF --><!-- IF postrow.S_ONLINE and not postrow.S_POST_HIDDEN --> online<!-- ENDIF --><!-- IF postrow.POSTER_WARNINGS --> warned<!-- ENDIF -->"> <div class="inner"> diff --git a/phpBB/styles/prosilver/template/viewtopic_print.html b/phpBB/styles/prosilver/template/viewtopic_print.html index 98308c4adc..5c44f58adb 100644 --- a/phpBB/styles/prosilver/template/viewtopic_print.html +++ b/phpBB/styles/prosilver/template/viewtopic_print.html @@ -11,7 +11,7 @@ </head> <body id="phpbb"> <div id="wrap"> - <a id="top" accesskey="t"></a> + <a id="top" class="anchor" accesskey="t"></a> <div id="page-header"> <h1>{SITENAME}</h1> diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index 0dc10db5b7..8c1c2c3926 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -37,7 +37,7 @@ ul.topiclist dt { } ul.topiclist.missing-column dt { - margin-right: -330px; + margin-right: -345px; } ul.topiclist.two-long-columns dt { @@ -55,7 +55,7 @@ ul.topiclist dt .list-inner { } ul.topiclist.missing-column dt .list-inner { - margin-right: 330px; + margin-right: 345px; } ul.topiclist.two-long-columns dt .list-inner { diff --git a/phpBB/styles/prosilver/theme/links.css b/phpBB/styles/prosilver/theme/links.css index ff6df7c9a7..86cdf9c10e 100644 --- a/phpBB/styles/prosilver/theme/links.css +++ b/phpBB/styles/prosilver/theme/links.css @@ -228,3 +228,7 @@ a.feed-icon-forum { float: right; margin: 3px; } + +a.anchor { + display: block; +} diff --git a/phpBB/styles/subsilver2/style.cfg b/phpBB/styles/subsilver2/style.cfg index d7cab8ead0..b9e77bfb4f 100644 --- a/phpBB/styles/subsilver2/style.cfg +++ b/phpBB/styles/subsilver2/style.cfg @@ -21,8 +21,8 @@ # General Information about this style name = subsilver2 copyright = © 2005 phpBB Limited -style_version = 3.1.0-b3 -phpbb_version = 3.1.0-b3 +style_version = 3.1.0-b4 +phpbb_version = 3.1.0-b4 # Defining a different template bitfield # template_bitfield = lNg= diff --git a/phpBB/styles/subsilver2/template/confirm_delete_body.html b/phpBB/styles/subsilver2/template/confirm_delete_body.html index 9e416f5195..18df397fc3 100644 --- a/phpBB/styles/subsilver2/template/confirm_delete_body.html +++ b/phpBB/styles/subsilver2/template/confirm_delete_body.html @@ -14,26 +14,23 @@ <p class="gen">{MESSAGE_TEXT}</p> <br /> - <!-- IF not S_SOFTDELETED and (S_DELETE_REASON or (S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE)) --> - <table border="0" width="90%" cellspacing="2" cellpadding="1"> - <!-- IF S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE --> - <tr> - <td class="row1" width="22%"><b class="gen">{L_DELETE_PERMANENTLY}{L_COLON}</b></td> - <td class="row1" width="78%"> - <input id="delete_permanent" name="delete_permanent" type="checkbox" value="1" {S_CHECKED_PERMANENT} /> - <!-- IF S_TOPIC_MODE -->{L_DELETE_TOPIC_PERMANENTLY}<!-- ELSE -->{L_DELETE_POST_PERMANENTLY}<!-- ENDIF --> - </td> - </tr> - <!-- ENDIF --> - <!-- IF S_DELETE_REASON --> - <tr> - <td class="row1" valign="top"><span class="gen"><b>{L_DELETE_REASON}{L_COLON}</b></span><br /><span class="gensmall">{L_DELETE_REASON_EXPLAIN}</span></td> - <td class="row1"><input type="text" name="delete_reason" value="" class="inputbox autowidth" maxlength="120" size="45" /></td> - </tr> - <!-- ENDIF --> - </table> - <br /> + <table border="0" width="90%" cellspacing="2" cellpadding="1"> + <!-- IF not S_SOFTDELETED and S_ALLOWED_DELETE and S_ALLOWED_SOFTDELETE --> + <tr> + <td class="row1" width="22%"><b class="gen">{L_DELETE_PERMANENTLY}{L_COLON}</b></td> + <td class="row1" width="78%"> + <input id="delete_permanent" name="delete_permanent" type="checkbox" value="1" {S_CHECKED_PERMANENT} /> + <!-- IF S_TOPIC_MODE -->{L_DELETE_TOPIC_PERMANENTLY}<!-- ELSE -->{L_DELETE_POST_PERMANENTLY}<!-- ENDIF --> + </td> + </tr> <!-- ENDIF --> + <tr> + <td class="row1" valign="top"><span class="gen"><b>{L_DELETE_REASON}{L_COLON}</b></span><br /><span class="gensmall">{L_DELETE_REASON_EXPLAIN}</span></td> + <td class="row1"><input type="text" name="delete_reason" value="" class="inputbox autowidth" maxlength="120" size="45" /></td> + </tr> + </table> + <br /> + {S_HIDDEN_FIELDS} <input type="submit" name="confirm" value="{L_YES}" class="btnmain" /> <input type="submit" name="cancel" value="{L_NO}" class="btnlite" /> diff --git a/phpBB/styles/subsilver2/template/faq_body.html b/phpBB/styles/subsilver2/template/faq_body.html index 22c4145a20..b3c41e932a 100644 --- a/phpBB/styles/subsilver2/template/faq_body.html +++ b/phpBB/styles/subsilver2/template/faq_body.html @@ -1,6 +1,6 @@ <!-- INCLUDE overall_header.html --> -<a name="faqtop"></a> +<a name="faqtop" class="anchor"></a> <div id="pagecontent"> @@ -38,7 +38,7 @@ <!-- ELSE --> <td class="row2" valign="top"> <!-- ENDIF --> - <div class="postbody"><a name="f{faq_block.S_ROW_COUNT}r{faq_block.faq_row.S_ROW_COUNT}"></a><b>» {faq_block.faq_row.FAQ_QUESTION}</b></div> + <div class="postbody"><a name="f{faq_block.S_ROW_COUNT}r{faq_block.faq_row.S_ROW_COUNT}" class="anchor"></a><b>» {faq_block.faq_row.FAQ_QUESTION}</b></div> <div class="postbody">{faq_block.faq_row.FAQ_ANSWER}</div> <p class="gensmall"><a href="#faqtop">{L_BACK_TO_TOP}</a></p> </td> diff --git a/phpBB/styles/subsilver2/template/mcp_post.html b/phpBB/styles/subsilver2/template/mcp_post.html index 0f000ca931..f5052ee2d0 100644 --- a/phpBB/styles/subsilver2/template/mcp_post.html +++ b/phpBB/styles/subsilver2/template/mcp_post.html @@ -144,7 +144,7 @@ <!-- IF S_TOPIC_REVIEW --><!-- INCLUDE posting_topic_review.html --><!-- ENDIF --> <!-- ELSE --> <!-- IF S_CAN_LOCK_POST or S_CAN_DELETE_POST or S_CAN_CHGPOSTER --> - <br /><a name="mod"></a> + <br /><a name="mod" class="anchor"></a> <table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg"> <tr> @@ -166,7 +166,7 @@ <!-- ENDIF --> <!-- IF S_CAN_VIEWIP --> - <br /><a name="ip"></a> + <br /><a name="ip" class="anchor"></a> <table width="100%" cellpadding="3" cellspacing="1" border="0" class="tablebg"> <tr> diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html index b4a2fa5b59..314e284155 100644 --- a/phpBB/styles/subsilver2/template/overall_header.html +++ b/phpBB/styles/subsilver2/template/overall_header.html @@ -140,7 +140,7 @@ function marklist(id, name, state) <!-- EVENT overall_header_body_before --> -<a name="top"></a> +<a name="top" class="anchor"></a> <div id="wrapheader"> diff --git a/phpBB/styles/subsilver2/template/posting_review.html b/phpBB/styles/subsilver2/template/posting_review.html index baf159aecd..c118499564 100644 --- a/phpBB/styles/subsilver2/template/posting_review.html +++ b/phpBB/styles/subsilver2/template/posting_review.html @@ -23,7 +23,7 @@ <td colspan="2">{post_review_row.L_IGNORE_POST}</td> <!-- ELSE --> - <td rowspan="2" align="{S_CONTENT_FLOW_BEGIN}" valign="top"><a id="pr{post_review_row.POST_ID}"></a> + <td rowspan="2" align="{S_CONTENT_FLOW_BEGIN}" valign="top"><a id="pr{post_review_row.POST_ID}" class="anchor"></a> <table width="150" cellspacing="0" cellpadding="4" border="0"> <tr> <td align="center"><b class="postauthor">{post_review_row.POST_AUTHOR_FULL}</b></td> diff --git a/phpBB/styles/subsilver2/template/posting_topic_review.html b/phpBB/styles/subsilver2/template/posting_topic_review.html index 23ea56a216..20976861fc 100644 --- a/phpBB/styles/subsilver2/template/posting_topic_review.html +++ b/phpBB/styles/subsilver2/template/posting_topic_review.html @@ -23,7 +23,7 @@ <!-- IF topic_review_row.S_IGNORE_POST --> <td colspan="2">{topic_review_row.L_IGNORE_POST}</td> <!-- ELSE --> - <td rowspan="2" align="{S_CONTENT_FLOW_BEGIN}" valign="top"><a id="pr{topic_review_row.POST_ID}"></a> + <td rowspan="2" align="{S_CONTENT_FLOW_BEGIN}" valign="top"><a id="pr{topic_review_row.POST_ID}" class="anchor"></a> <table width="150" cellspacing="0"> <tr> <td align="center"><b class="postauthor"<!-- IF topic_review_row.POST_AUTHOR_COLOUR --> style="color: {topic_review_row.POST_AUTHOR_COLOUR}"<!-- ENDIF -->>{topic_review_row.POST_AUTHOR}</b></td> diff --git a/phpBB/styles/subsilver2/template/search_results.html b/phpBB/styles/subsilver2/template/search_results.html index 3649bb9633..23d0b3a146 100644 --- a/phpBB/styles/subsilver2/template/search_results.html +++ b/phpBB/styles/subsilver2/template/search_results.html @@ -97,7 +97,7 @@ <!-- IF searchresults.S_IGNORE_POST --> <td class="gensmall" colspan="2" height="25" align="center">{searchresults.L_IGNORE_POST}</td> <!-- ELSE --> - <td colspan="2" height="25"><p class="topictitle"><a name="p{searchresults.POST_ID}" id="p{searchresults.POST_ID}"></a> {L_FORUM}{L_COLON} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a> {L_TOPIC}{L_COLON} <a href="{searchresults.U_VIEW_TOPIC}">{searchresults.TOPIC_TITLE}</a> </p></td> + <td colspan="2" height="25"><p class="topictitle"><a name="p{searchresults.POST_ID}" id="p{searchresults.POST_ID}" class="anchor"></a> {L_FORUM}{L_COLON} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a> {L_TOPIC}{L_COLON} <a href="{searchresults.U_VIEW_TOPIC}">{searchresults.TOPIC_TITLE}</a> </p></td> </tr> <tr class="row1"> <td width="150" align="center" valign="middle"><b class="postauthor">{searchresults.POST_AUTHOR_FULL}</b></td> diff --git a/phpBB/styles/subsilver2/template/simple_header.html b/phpBB/styles/subsilver2/template/simple_header.html index 36ac149691..faeeaea3d5 100644 --- a/phpBB/styles/subsilver2/template/simple_header.html +++ b/phpBB/styles/subsilver2/template/simple_header.html @@ -18,5 +18,5 @@ <body class="{S_CONTENT_DIRECTION} {BODY_CLASS}"> <!-- EVENT simple_header_body_before --> -<a name="top"></a> +<a name="top" class="anchor"></a> <div id="wrapcentre"> diff --git a/phpBB/styles/subsilver2/template/ucp_pm_history.html b/phpBB/styles/subsilver2/template/ucp_pm_history.html index ad06da2b7e..c07edb0f68 100644 --- a/phpBB/styles/subsilver2/template/ucp_pm_history.html +++ b/phpBB/styles/subsilver2/template/ucp_pm_history.html @@ -18,7 +18,7 @@ </tr> <!-- BEGIN history_row --> <!-- IF history_row.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF --> - <td rowspan="2" align="{S_CONTENT_FLOW_BEGIN}" valign="top"><a name="{history_row.MSG_ID}"></a> + <td rowspan="2" align="{S_CONTENT_FLOW_BEGIN}" valign="top"><a name="{history_row.MSG_ID}" class="anchor"></a> <table width="150" cellspacing="0"> <tr> <td align="center" colspan="2"><span class="postauthor">{history_row.MESSAGE_AUTHOR_FULL}</span></td> diff --git a/phpBB/styles/subsilver2/template/viewtopic_body.html b/phpBB/styles/subsilver2/template/viewtopic_body.html index 0c7900076b..8f83bfbea6 100644 --- a/phpBB/styles/subsilver2/template/viewtopic_body.html +++ b/phpBB/styles/subsilver2/template/viewtopic_body.html @@ -141,8 +141,8 @@ <!-- IF postrow.S_POST_HIDDEN --> <td class="gensmall" colspan="2" height="25" align="center"> - <!-- IF postrow.S_FIRST_UNREAD --><a id="unread" data-url="{postrow.U_MINI_POST}"></a><!-- ENDIF --> - <a name="p{postrow.POST_ID}"></a> + <!-- IF postrow.S_FIRST_UNREAD --><a id="unread" class="anchor" data-url="{postrow.U_MINI_POST}"></a><!-- ENDIF --> + <a name="p{postrow.POST_ID}" class="anchor"></a> <!-- IF postrow.S_POST_HIDDEN --> <!-- IF postrow.S_POST_DELETED --> {postrow.L_POST_DELETED_MESSAGE} @@ -155,7 +155,7 @@ <!-- ELSE --> <td align="center" valign="middle"> - <!-- IF postrow.S_FIRST_UNREAD --><a id="unread" data-url="{postrow.U_MINI_POST}"></a><!-- ENDIF --><a name="p{postrow.POST_ID}"></a> + <!-- IF postrow.S_FIRST_UNREAD --><a id="unread" class="anchor" data-url="{postrow.U_MINI_POST}"></a><!-- ENDIF --><a name="p{postrow.POST_ID}" class="anchor"></a> <b class="postauthor"<!-- IF postrow.POST_AUTHOR_COLOUR --> style="color: {postrow.POST_AUTHOR_COLOUR}"<!-- ENDIF -->>{postrow.POST_AUTHOR}</b> </td> <td width="100%" height="25"> diff --git a/phpBB/styles/subsilver2/theme/stylesheet.css b/phpBB/styles/subsilver2/theme/stylesheet.css index ea8e660e30..e69eec4f14 100644 --- a/phpBB/styles/subsilver2/theme/stylesheet.css +++ b/phpBB/styles/subsilver2/theme/stylesheet.css @@ -458,6 +458,10 @@ th a:hover { text-decoration: underline; } +a.anchor { + display: block; +} + /* Form Elements ------------ */ diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 385a4cfe55..789d53c676 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1809,7 +1809,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $contact_fields = array( array( 'ID' => 'pm', - 'NAME' => $user->lang['PRIVATE_MESSAGES'], + 'NAME' => $user->lang['SEND_PRIVATE_MESSAGE'], 'U_CONTACT' => $u_pm, ), array( diff --git a/tests/console/cron/fixtures/config.xml b/tests/console/cron/fixtures/config.xml new file mode 100644 index 0000000000..2cb683d409 --- /dev/null +++ b/tests/console/cron/fixtures/config.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_config"> + <column>config_name</column> + <column>config_value</column> + <column>is_dynamic</column> + </table> +</dataset> diff --git a/tests/console/cron/run_test.php b/tests/console/cron/run_test.php new file mode 100644 index 0000000000..ff251cff3c --- /dev/null +++ b/tests/console/cron/run_test.php @@ -0,0 +1,157 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +use Symfony\Component\Console\Application; +use Symfony\Component\Console\Tester\CommandTester; +use phpbb\console\command\cron\run; + +require_once dirname(__FILE__) . '/tasks/simple.php'; + +class phpbb_console_command_cron_run_test extends phpbb_database_test_case +{ + protected $db; + protected $config; + protected $lock; + protected $user; + protected $cron_manager; + protected $command_name; + protected $task; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/config.xml'); + } + + public function setUp() + { + global $db, $config, $phpbb_root_path, $phpEx; + + $db = $this->db = $this->new_dbal(); + $config = $this->config = new \phpbb\config\config(array('cron_lock' => '0')); + set_config(null, null, null, $this->config); + $this->lock = new \phpbb\lock\db('cron_lock', $this->config, $this->db); + + $this->user = $this->getMock('\phpbb\user'); + $this->user->method('lang')->will($this->returnArgument(0)); + + $this->task = new phpbb_cron_task_simple(); + $tasks = array( + $this->task, + ); + $this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $phbEx); + + $this->assertSame('0', $config['cron_lock']); + } + + public function test_normal_use() + { + $command_tester = $this->get_command_tester(); + $exit_status = $command_tester->execute(array('command' => $this->command_name)); + + $this->assertSame('', $command_tester->getDisplay()); + $this->assertSame(true, $this->task->executed); + $this->assertSame(0, $exit_status); + $this->assertSame(false, $this->lock->owns_lock()); + } + + public function test_verbose_mode() + { + $command_tester = $this->get_command_tester(); + $exit_status = $command_tester->execute(array('command' => $this->command_name, '--verbose' => true)); + + $this->assertContains('RUNNING_TASK', $command_tester->getDisplay()); + $this->assertSame(true, $this->task->executed); + $this->assertSame(0, $exit_status); + $this->assertSame(false, $this->lock->owns_lock()); + } + + public function test_error_lock() + { + $this->lock->acquire(); + $command_tester = $this->get_command_tester(); + $exit_status = $command_tester->execute(array('command' => $this->command_name)); + + $this->assertContains('CRON_LOCK_ERROR', $command_tester->getDisplay()); + $this->assertSame(false, $this->task->executed); + $this->assertSame(1, $exit_status); + } + + public function test_no_task() + { + $tasks = array( + ); + $this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $phpEx); + $command_tester = $this->get_command_tester(); + $exit_status = $command_tester->execute(array('command' => $this->command_name)); + + $this->assertSame('', $command_tester->getDisplay()); + $this->assertSame(0, $exit_status); + $this->assertSame(false, $this->lock->owns_lock()); + } + + public function test_no_task_verbose() + { + $tasks = array( + ); + $this->cron_manager = new \phpbb\cron\manager($tasks, $phpbb_root_path, $phpEx); + $command_tester = $this->get_command_tester(); + $exit_status = $command_tester->execute(array('command' => $this->command_name, '--verbose' => true)); + + $this->assertContains('CRON_NO_TASK', $command_tester->getDisplay()); + $this->assertSame(0, $exit_status); + $this->assertSame(false, $this->lock->owns_lock()); + } + + public function test_arg_valid() + { + $command_tester = $this->get_command_tester(); + $exit_status = $command_tester->execute(array('command' => $this->command_name, 'name' => 'phpbb_cron_task_simple')); + + $this->assertSame('', $command_tester->getDisplay()); + $this->assertSame(true, $this->task->executed); + $this->assertSame(0, $exit_status); + $this->assertSame(false, $this->lock->owns_lock()); + } + + public function test_arg_invalid() + { + $command_tester = $this->get_command_tester(); + $exit_status = $command_tester->execute(array('command' => $this->command_name, 'name' => 'foo')); + + $this->assertContains('CRON_NO_SUCH_TASK', $command_tester->getDisplay()); + $this->assertSame(false, $this->task->executed); + $this->assertSame(2, $exit_status); + $this->assertSame(false, $this->lock->owns_lock()); + } + + public function test_arg_valid_verbose() + { + $command_tester = $this->get_command_tester(); + $exit_status = $command_tester->execute(array('command' => $this->command_name, 'name' => 'phpbb_cron_task_simple', '--verbose' => true)); + + $this->assertContains('RUNNING_TASK', $command_tester->getDisplay()); + $this->assertSame(true, $this->task->executed); + $this->assertSame(0, $exit_status); + $this->assertSame(false, $this->lock->owns_lock()); + } + + public function get_command_tester() + { + $application = new Application(); + $application->add(new run($this->cron_manager, $this->lock, $this->user)); + + $command = $application->find('cron:run'); + $this->command_name = $command->getName(); + return new CommandTester($command); + } +} diff --git a/tests/console/cron/tasks/simple.php b/tests/console/cron/tasks/simple.php new file mode 100644 index 0000000000..194c52afe1 --- /dev/null +++ b/tests/console/cron/tasks/simple.php @@ -0,0 +1,27 @@ +<?php +/** +* +* This file is part of the phpBB Forum Software package. +* +* @copyright (c) phpBB Limited <https://www.phpbb.com> +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +class phpbb_cron_task_simple extends \phpbb\cron\task\base +{ + public $executed = false; + + public function get_name() + { + return get_class($this); + } + + public function run() + { + $this->executed = true; + } +} diff --git a/tests/dbal/migration/dummy_order.php b/tests/dbal/migration/dummy_order.php index b8590f5074..5ab8f5d129 100644 --- a/tests/dbal/migration/dummy_order.php +++ b/tests/dbal/migration/dummy_order.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* 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. * */ diff --git a/tests/dbal/migration/dummy_order_0.php b/tests/dbal/migration/dummy_order_0.php index e45bb0ad44..4caea76704 100644 --- a/tests/dbal/migration/dummy_order_0.php +++ b/tests/dbal/migration/dummy_order_0.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* 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. * */ diff --git a/tests/dbal/migration/dummy_order_1.php b/tests/dbal/migration/dummy_order_1.php index 73f043af5d..ea512765fa 100644 --- a/tests/dbal/migration/dummy_order_1.php +++ b/tests/dbal/migration/dummy_order_1.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* 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. * */ diff --git a/tests/dbal/migration/dummy_order_2.php b/tests/dbal/migration/dummy_order_2.php index 1483b98050..a7669b1ac8 100644 --- a/tests/dbal/migration/dummy_order_2.php +++ b/tests/dbal/migration/dummy_order_2.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* 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. * */ diff --git a/tests/dbal/migration/dummy_order_3.php b/tests/dbal/migration/dummy_order_3.php index 79c542e088..501db09b7e 100644 --- a/tests/dbal/migration/dummy_order_3.php +++ b/tests/dbal/migration/dummy_order_3.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* 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. * */ diff --git a/tests/dbal/migration/dummy_order_4.php b/tests/dbal/migration/dummy_order_4.php index 229a120ecf..77bb5a24b3 100644 --- a/tests/dbal/migration/dummy_order_4.php +++ b/tests/dbal/migration/dummy_order_4.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* 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. * */ diff --git a/tests/dbal/migration/dummy_order_5.php b/tests/dbal/migration/dummy_order_5.php index 04d755009d..8f92392a8b 100644 --- a/tests/dbal/migration/dummy_order_5.php +++ b/tests/dbal/migration/dummy_order_5.php @@ -1,9 +1,13 @@ <?php /** * -* @package testing -* @copyright (c) 2014 phpBB Group -* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* 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. * */ diff --git a/tests/dbal/migrator_test.php b/tests/dbal/migrator_test.php index 381fe16115..4a1d15aea4 100644 --- a/tests/dbal/migrator_test.php +++ b/tests/dbal/migrator_test.php @@ -60,12 +60,14 @@ class phpbb_dbal_migrator_test extends phpbb_database_test_case $container = new phpbb_mock_container_builder(); $container->set('migrator', $migrator); + $user = new \phpbb\user(); $this->extension_manager = new \phpbb\extension\manager( $container, $this->db, $this->config, new phpbb\filesystem(), + $user, 'phpbb_ext', dirname(__FILE__) . '/../../phpBB/', 'php', diff --git a/tests/extension/finder_test.php b/tests/extension/finder_test.php index 4ef9411557..8cc5146b33 100644 --- a/tests/extension/finder_test.php +++ b/tests/extension/finder_test.php @@ -132,6 +132,22 @@ class phpbb_extension_finder_test extends phpbb_test_case ); } + public function test_non_absolute_directory_get_classes() + { + $classes = $this->finder + ->directory('type/') + ->get_classes(); + + sort($classes); + $this->assertEquals( + array( + '\vendor2\foo\sub\type\alternative', + '\vendor2\foo\type\alternative', + ), + $classes + ); + } + public function test_sub_directory_get_classes() { $classes = $this->finder diff --git a/tests/extension/manager_test.php b/tests/extension/manager_test.php index 6acade1e87..d9f8fbd1a4 100644 --- a/tests/extension/manager_test.php +++ b/tests/extension/manager_test.php @@ -101,6 +101,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case $phpbb_root_path = __DIR__ . './../../phpBB/'; $php_ext = 'php'; $table_prefix = 'phpbb_'; + $user = new \phpbb\user(); $migrator = new \phpbb\db\migrator( $config, @@ -121,6 +122,7 @@ class phpbb_extension_manager_test extends phpbb_database_test_case $db, $config, new \phpbb\filesystem(), + $user, 'phpbb_ext', dirname(__FILE__) . '/', $php_ext, diff --git a/tests/extension/metadata_manager_test.php b/tests/extension/metadata_manager_test.php index 95544a6f7c..3678ac0a3f 100644 --- a/tests/extension/metadata_manager_test.php +++ b/tests/extension/metadata_manager_test.php @@ -77,6 +77,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $this->db, $this->config, new \phpbb\filesystem(), + $this->user, 'phpbb_ext', $this->phpbb_root_path, $this->phpEx, @@ -97,7 +98,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case } catch(\phpbb\extension\exception $e){} - $this->assertEquals((string) $e, 'The required file does not exist: ' . $this->phpbb_root_path . $this->extension_manager->get_extension_path($ext_name) . 'composer.json'); + $this->assertEquals((string) $e, $this->user->lang('FILE_NOT_FOUND', $this->phpbb_root_path . $this->extension_manager->get_extension_path($ext_name) . 'composer.json')); } // Should be the same as a direct json_decode of the composer.json file @@ -136,7 +137,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case } catch(\phpbb\extension\exception $e) { - $this->assertEquals((string) $e, 'Required meta field \'name\' has not been set.'); + $this->assertEquals((string) $e, $this->user->lang('META_FIELD_NOT_SET', 'name')); } try @@ -147,7 +148,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case } catch(\phpbb\extension\exception $e) { - $this->assertEquals((string) $e, 'Required meta field \'type\' has not been set.'); + $this->assertEquals((string) $e, $this->user->lang('META_FIELD_NOT_SET', 'type')); } try @@ -158,7 +159,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case } catch(\phpbb\extension\exception $e) { - $this->assertEquals((string) $e, 'Required meta field \'license\' has not been set.'); + $this->assertEquals((string) $e, $this->user->lang('META_FIELD_NOT_SET', 'license')); } try @@ -169,7 +170,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case } catch(\phpbb\extension\exception $e) { - $this->assertEquals((string) $e, 'Required meta field \'version\' has not been set.'); + $this->assertEquals((string) $e, $this->user->lang('META_FIELD_NOT_SET', 'version')); } try @@ -180,7 +181,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case } catch(\phpbb\extension\exception $e) { - $this->assertEquals((string) $e, 'Required meta field \'authors\' has not been set.'); + $this->assertEquals((string) $e, $this->user->lang('META_FIELD_NOT_SET', 'authors')); } $manager->merge_metadata(array( @@ -197,7 +198,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case } catch(\phpbb\extension\exception $e) { - $this->assertEquals((string) $e, 'Required meta field \'author name\' has not been set.'); + $this->assertEquals((string) $e, $this->user->lang('META_FIELD_NOT_SET', 'author name')); } } @@ -224,7 +225,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case } catch(\phpbb\extension\exception $e) { - $this->assertEquals((string) $e, 'Meta field \'name\' is invalid.'); + $this->assertEquals((string) $e, $this->user->lang('META_FIELD_INVALID', 'name')); } try @@ -235,7 +236,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case } catch(\phpbb\extension\exception $e) { - $this->assertEquals((string) $e, 'Meta field \'type\' is invalid.'); + $this->assertEquals((string) $e, $this->user->lang('META_FIELD_INVALID', 'type')); } try @@ -246,7 +247,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case } catch(\phpbb\extension\exception $e) { - $this->assertEquals((string) $e, 'Meta field \'license\' is invalid.'); + $this->assertEquals((string) $e, $this->user->lang('META_FIELD_INVALID', 'license')); } try @@ -257,7 +258,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case } catch(\phpbb\extension\exception $e) { - $this->assertEquals((string) $e, 'Meta field \'version\' is invalid.'); + $this->assertEquals((string) $e, $this->user->lang('META_FIELD_INVALID', 'version')); } } @@ -437,6 +438,7 @@ class phpbb_extension_metadata_manager_test extends phpbb_database_test_case $this->config, $this->extension_manager, $this->template, + $this->user, $this->phpbb_root_path ); } diff --git a/tests/functional/extension_acp_test.php b/tests/functional/extension_acp_test.php index 8f0f9c6700..b6dd5db708 100644 --- a/tests/functional/extension_acp_test.php +++ b/tests/functional/extension_acp_test.php @@ -180,7 +180,7 @@ class phpbb_functional_extension_acp_test extends phpbb_functional_test_case { // test2 is not available (error) $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=test2&sid=' . $this->sid); - $this->assertContains('The required file does not exist', $crawler->filter('.errorbox')->text()); + $this->assertContains($this->lang('FILE_NOT_FOUND', ''), $crawler->filter('.errorbox')->text()); // foo is not disabled (redirect to list) $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=delete_data_pre&ext_name=vendor2%2Ffoo&sid=' . $this->sid); diff --git a/tests/functional/metadata_manager_test.php b/tests/functional/metadata_manager_test.php index 020e9cd142..080822d249 100644 --- a/tests/functional/metadata_manager_test.php +++ b/tests/functional/metadata_manager_test.php @@ -82,6 +82,6 @@ class phpbb_functional_metadata_manager_test extends phpbb_functional_test_case $crawler = self::request('GET', 'adm/index.php?i=acp_extensions&mode=main&action=details&ext_name=not%2Fexists&sid=' . $this->sid); // Error message because the files do not exist - $this->assertContains('The required file does not exist:', $crawler->filter('#main')->text()); + $this->assertContains($this->lang('FILE_NOT_FOUND', ''), $crawler->filter('#main')->text()); } } diff --git a/tests/log/delete_test.php b/tests/log/delete_test.php new file mode 100644 index 0000000000..b8be15efa5 --- /dev/null +++ b/tests/log/delete_test.php @@ -0,0 +1,157 @@ +<?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/functions.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/utf/utf_tools.php'; + +class phpbb_log_delete_test extends phpbb_database_test_case +{ + protected $log; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/delete_log.xml'); + } + + protected function setUp() + { + global $phpbb_root_path, $phpEx, $db, $phpbb_dispatcher, $auth; + + $db = $this->new_dbal(); + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + $user = $this->getMock('\phpbb\user'); + $user->data['user_id'] = 1; + $auth = $this->getMock('\phpbb\auth\auth'); + + $this->log = new \phpbb\log\log($db, $user, $auth, $phpbb_dispatcher, $phpbb_root_path, 'adm/', $phpEx, LOG_TABLE); + + parent::setUp(); + } + + public function log_delete_data() + { + return array( + array( + array(1, 2), + array(16), + array(), + 'admin', + false, + 0, + 0, + 0, + 0, + 0, + 0, + 'l.log_id ASC', + '', + ), + array( + array(11), + array(), + array('keywords' => 'guest'), + 'mod', + false, + 0, + 0, + 0, + 0, + 0, + 0, + 'l.log_id ASC', + 'guest', + ), + array( + array(4, 5, 7), + array(), + array('forum_id' => 12, 'user_id' => 1), + 'mod', + false, + 0, + 0, + 12, + 0, + 1, + 0, + 'l.log_id ASC', + '', + ), + array( + array(12, 13), + array(), + array('forum_id' => array('IN' => array(14, 13))), + 'mod', + false, + 0, + 0, + array(13, 14), + 0, + 0, + 0, + 'l.log_id ASC', + '', + ), + array( + array(3, 14, 15), + array(3), + array('user_id' => array('>', 1)), + 'critical', + false, + 0, + 0, + 0, + 0, + 0, + 0, + 'l.log_id ASC', + '', + ), + array( + array(3, 14, 15), + array(), + array('keywords' => ''), + 'critical', + false, + 0, + 0, + 0, + 0, + 0, + 0, + 'l.log_id ASC', + '', + ), + ); + } + + /** + * @dataProvider log_delete_data + */ + public function test_log_delete($expected_before, $expected_after, $delete_conditions, $mode, $count_logs, $limit, $offset, $forum_id, $topic_id, $user_id, $log_time, $sort_by, $keywords) + { + $this->assertSame($expected_before, $this->get_ids($this->log->get_logs($mode, $count_logs, $limit, $offset, $forum_id, $topic_id, $user_id, $log_time, $sort_by, $keywords)), 'before'); + $this->log->delete($mode, $delete_conditions); + $this->assertSame($expected_after, $this->get_ids($this->log->get_logs($mode, $count_logs, $limit, $offset, $forum_id, $topic_id, $user_id, $log_time, $sort_by, $keywords)), 'after'); + } + + public function get_ids($logs) + { + $ids = array(); + foreach ($logs as $log_entry) + { + $ids[] = (int) $log_entry['id']; + } + return $ids; + } +} diff --git a/tests/log/fixtures/delete_log.xml b/tests/log/fixtures/delete_log.xml new file mode 100644 index 0000000000..4b2402102e --- /dev/null +++ b/tests/log/fixtures/delete_log.xml @@ -0,0 +1,232 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_log"> + <column>log_id</column> + <column>log_type</column> + <column>user_id</column> + <column>forum_id</column> + <column>topic_id</column> + <column>reportee_id</column> + <column>log_ip</column> + <column>log_time</column> + <column>log_operation</column> + <column>log_data</column> + <row> + <value>1</value> + <value>0</value> + <value>1</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value>LOG_INSTALL_INSTALLED</value> + <value>a:1:{i:0;s:9:"3.1.0-dev";}</value> + </row> + <row> + <value>2</value> + <value>0</value> + <value>1</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value>LOG_KEY_NOT_EXISTS</value> + <value>a:1:{i:0;s:15:"additional_data";}</value> + </row> + <row> + <value>3</value> + <value>2</value> + <value>1</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value>LOG_CRITICAL</value> + <value>a:1:{i:0;s:13:"critical data";}</value> + </row> + <row> + <value>4</value> + <value>1</value> + <value>1</value> + <value>12</value> + <value>34</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value>LOG_MOD</value> + <value></value> + </row> + <row> + <value>5</value> + <value>1</value> + <value>1</value> + <value>12</value> + <value>45</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value>LOG_MOD</value> + <value></value> + </row> + <row> + <value>6</value> + <value>1</value> + <value>1</value> + <value>23</value> + <value>56</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value>LOG_MOD</value> + <value></value> + </row> + <row> + <value>7</value> + <value>1</value> + <value>1</value> + <value>12</value> + <value>45</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value>LOG_MOD2</value> + <value></value> + </row> + <row> + <value>8</value> + <value>3</value> + <value>1</value> + <value>0</value> + <value>0</value> + <value>2</value> + <value>127.0.0.1</value> + <value>1</value> + <value>LOG_USER</value> + <value>a:1:{i:0;s:5:"admin";}</value> + </row> + <row> + <value>9</value> + <value>3</value> + <value>1</value> + <value>0</value> + <value>0</value> + <value>1</value> + <value>127.0.0.1</value> + <value>1</value> + <value>LOG_USER</value> + <value>a:1:{i:0;s:5:"guest";}</value> + </row> + <row> + <value>10</value> + <value>3</value> + <value>1</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value>LOG_SINGULAR_PLURAL</value> + <value>a:1:{i:0;i:2;}</value> + </row> + <row> + <value>11</value> + <value>1</value> + <value>1</value> + <value>15</value> + <value>3</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value>LOG_MOD3</value> + <value>a:1:{i:0;s:5:"guest";}</value> + </row> + <row> + <value>12</value> + <value>1</value> + <value>1</value> + <value>13</value> + <value>0</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value></value> + <value></value> + </row> + <row> + <value>13</value> + <value>1</value> + <value>1</value> + <value>14</value> + <value>0</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value></value> + <value></value> + </row> + <row> + <value>14</value> + <value>2</value> + <value>2</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value></value> + <value></value> + </row> + <row> + <value>15</value> + <value>2</value> + <value>2</value> + <value>0</value> + <value>0</value> + <value>0</value> + <value>127.0.0.1</value> + <value>1</value> + <value></value> + <value></value> + </row> + </table> + <table name="phpbb_users"> + <column>user_id</column> + <column>username</column> + <column>username_clean</column> + <column>user_permissions</column> + <column>user_sig</column> + <row> + <value>1</value> + <value>Anonymous</value> + <value>Anonymous</value> + <value></value> + <value></value> + </row> + <row> + <value>2</value> + <value>admin</value> + <value>admin</value> + <value></value> + <value></value> + </row> + </table> + <table name="phpbb_topics"> + <column>topic_id</column> + <column>forum_id</column> + <row> + <value>34</value> + <value>12</value> + </row> + <row> + <value>45</value> + <value>12</value> + </row> + <row> + <value>56</value> + <value>23</value> + </row> + </table> +</dataset> diff --git a/tests/test_framework/phpbb_functional_test_case.php b/tests/test_framework/phpbb_functional_test_case.php index 0bfdfa57ac..182ffaaaf7 100644 --- a/tests/test_framework/phpbb_functional_test_case.php +++ b/tests/test_framework/phpbb_functional_test_case.php @@ -203,12 +203,14 @@ class phpbb_functional_test_case extends phpbb_test_case ); $container = new phpbb_mock_container_builder(); $container->set('migrator', $migrator); + $user = new \phpbb\user(); $extension_manager = new \phpbb\extension\manager( $container, $db, $config, new phpbb\filesystem(), + $user, self::$config['table_prefix'] . 'ext', dirname(__FILE__) . '/', $phpEx, diff --git a/travis/check-image-icc-profiles.sh b/travis/check-image-icc-profiles.sh index fa9300012a..31848dc9e7 100755 --- a/travis/check-image-icc-profiles.sh +++ b/travis/check-image-icc-profiles.sh @@ -1,7 +1,12 @@ #!/bin/bash # -# @copyright (c) 2014 phpBB Group -# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +# This file is part of the phpBB Forum Software package. +# +# @copyright (c) phpBB Limited <https://www.phpbb.com> +# @license GNU General Public License, version 2 (GPL-2.0) +# +# For full copyright and license information, please see +# the docs/CREDITS.txt file. # set -e diff --git a/travis/setup-exiftool.sh b/travis/setup-exiftool.sh index 55bcda6c9f..04999b8600 100755 --- a/travis/setup-exiftool.sh +++ b/travis/setup-exiftool.sh @@ -1,7 +1,12 @@ #!/bin/sh # -# @copyright (c) 2014 phpBB Group -# @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +# This file is part of the phpBB Forum Software package. +# +# @copyright (c) phpBB Limited <https://www.phpbb.com> +# @license GNU General Public License, version 2 (GPL-2.0) +# +# For full copyright and license information, please see +# the docs/CREDITS.txt file. # set -e |