From 5a429ee61e54f78da1120395c05d9fb5a2af7d04 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 1 Feb 2010 01:14:06 +0000 Subject: [PATCH 001/393] Change version numbers to 3.0.7 and 3.0.8-dev in preparation for development on next release git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10468 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/INSTALL.html | 4 ++-- phpBB/includes/constants.php | 2 +- phpBB/install/database_update.php | 2 +- phpBB/install/schemas/schema_data.sql | 2 +- phpBB/styles/prosilver/imageset/imageset.cfg | 22 +++++++++---------- phpBB/styles/prosilver/style.cfg | 10 ++++----- phpBB/styles/prosilver/template/template.cfg | 10 ++++----- phpBB/styles/prosilver/theme/theme.cfg | 12 +++++----- phpBB/styles/subsilver2/imageset/imageset.cfg | 14 ++++++------ phpBB/styles/subsilver2/style.cfg | 10 ++++----- phpBB/styles/subsilver2/template/template.cfg | 10 ++++----- phpBB/styles/subsilver2/theme/theme.cfg | 12 +++++----- 12 files changed, 55 insertions(+), 55 deletions(-) diff --git a/phpBB/docs/INSTALL.html b/phpBB/docs/INSTALL.html index c297abe267..c924bb6078 100644 --- a/phpBB/docs/INSTALL.html +++ b/phpBB/docs/INSTALL.html @@ -273,7 +273,7 @@

This package is meant for those wanting to only replace changed files from a previous version to the latest version. This package normally contains the changed files from up to five previous versions.

-

This package contains a number of archives, each contains the files changed from a given release to the latest version. You should select the appropriate archive for your current version, e.g. if you currently have 3.0.5 you should select the phpBB-3.0.5_to_3.0.6.zip/tar.gz file.

+

This package contains a number of archives, each contains the files changed from a given release to the latest version. You should select the appropriate archive for your current version, e.g. if you currently have 3.0.5 you should select the phpBB-3.0.6_to_3.0.7.zip/tar.gz file.

The directory structure has been preserved enabling you (if you wish) to simply upload the contents of the archive to the appropriate location on your server, i.e. simply overwrite the existing files with the new versions. Do not forget that if you have installed any MODs these files will overwrite the originals possibly destroying them in the process. You will need to re-add MODs to any affected file before uploading.

@@ -285,7 +285,7 @@

The patch file is one solution for those with many Modifications (MODs) or other changes who do not want to re-add them back to all the changed files if they use the method explained above. To use this you will need command line access to a standard UNIX type patch application. If you do not have access to such an application but still want to use this update approach, we strongly recommend the Automatic update package explained below. It is also the recommended update method.

-

A number of patch files are provided to allow you to update from previous stable releases. Select the correct patch, e.g. if your current version is 3.0.5 you need the phpBB-3.0.5_to_3.0.6.patch file. Place the correct patch in the parent directory containing the phpBB3 core files (i.e. index.php, viewforum.php, etc.). With this done you should run the following command: patch -cl -d [PHPBB DIRECTORY] -p1 < [PATCH NAME] (where PHPBB DIRECTORY is the directory name your phpBB Installation resides in, for example phpBB3, and where PATCH NAME is the relevant filename of the selected patch file). This should complete quickly, hopefully without any HUNK FAILED comments.

+

A number of patch files are provided to allow you to update from previous stable releases. Select the correct patch, e.g. if your current version is 3.0.6 you need the phpBB-3.0.6_to_3.0.7.patch file. Place the correct patch in the parent directory containing the phpBB3 core files (i.e. index.php, viewforum.php, etc.). With this done you should run the following command: patch -cl -d [PHPBB DIRECTORY] -p1 < [PATCH NAME] (where PHPBB DIRECTORY is the directory name your phpBB Installation resides in, for example phpBB3, and where PATCH NAME is the relevant filename of the selected patch file). This should complete quickly, hopefully without any HUNK FAILED comments.

If you do get failures you should look at using the Changed files only package to replace the files which failed to patch, please note that you will need to manually re-add any Modifications (MODs) to these particular files. Alternatively if you know how you can examine the .rej files to determine what failed where and make manual adjustments to the relevant source.

diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 398611d24e..f58b29d232 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -25,7 +25,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -define('PHPBB_VERSION', '3.0.6'); +define('PHPBB_VERSION', '3.0.7'); // QA-related // define('PHPBB_QA', 1); diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index c7205de89d..4efc52088f 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -8,7 +8,7 @@ * */ -$updates_to_version = '3.0.7-dev'; +$updates_to_version = '3.0.8-dev'; // Enter any version to update from to test updates. The version within the db will not be updated. $debug_from_version = false; diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index b8455f3347..cb704cad7c 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -241,7 +241,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page', 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 ('version', '3.0.6'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.7'); 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/styles/prosilver/imageset/imageset.cfg b/phpBB/styles/prosilver/imageset/imageset.cfg index c838dffd03..7fc8274ad2 100644 --- a/phpBB/styles/prosilver/imageset/imageset.cfg +++ b/phpBB/styles/prosilver/imageset/imageset.cfg @@ -2,8 +2,8 @@ # phpBB Imageset Configuration File # # @package phpBB3 -# @copyright (c) 2006 phpBB Group -# @license http://opensource.org/licenses/gpl-license.php GNU Public License +# @copyright (c) 2006 phpBB Group +# @license http://opensource.org/licenses/gpl-license.php GNU Public License # # # At the left is the name, please do not change this @@ -11,23 +11,23 @@ # For on/off options the valid values are on, off, 1, 0, true and false # # Values get trimmed, if you want to add a space in front or at the end of -# the value, then enclose the value with single or double quotes. +# the value, then enclose the value with single or double quotes. # Single and double quotes do not need to be escaped. # -# +# # General Information about this style name = prosilver copyright = © phpBB Group, 2007 -version = 3.0.6 +version = 3.0.7 # Images img_site_logo = site_logo.gif*52*139 -img_poll_left = -img_poll_center = -img_poll_right = -img_icon_friend = -img_icon_foe = +img_poll_left = +img_poll_center = +img_poll_right = +img_icon_friend = +img_icon_foe = img_forum_link = forum_link.gif*27*27 img_forum_read = forum_read.gif*27*27 @@ -111,6 +111,6 @@ img_icon_topic_newest = icon_topic_newest.gif*9*11 img_icon_topic_reported = icon_topic_reported.gif*14*16 img_icon_topic_unapproved = icon_topic_unapproved.gif*14*16 -img_icon_user_profile = +img_icon_user_profile = img_icon_user_warn = icon_user_warn.gif*20*20 diff --git a/phpBB/styles/prosilver/style.cfg b/phpBB/styles/prosilver/style.cfg index 219106e9b6..8b660c969e 100644 --- a/phpBB/styles/prosilver/style.cfg +++ b/phpBB/styles/prosilver/style.cfg @@ -2,8 +2,8 @@ # phpBB Style Configuration File # # @package phpBB3 -# @copyright (c) 2005 phpBB Group -# @license http://opensource.org/licenses/gpl-license.php GNU Public License +# @copyright (c) 2005 phpBB Group +# @license http://opensource.org/licenses/gpl-license.php GNU Public License # # # At the left is the name, please do not change this @@ -11,12 +11,12 @@ # For on/off options the valid values are on, off, 1, 0, true and false # # Values get trimmed, if you want to add a space in front or at the end of -# the value, then enclose the value with single or double quotes. +# the value, then enclose the value with single or double quotes. # Single and double quotes do not need to be escaped. # -# +# # General Information about this style name = prosilver copyright = © phpBB Group, 2007 -version = 3.0.6 \ No newline at end of file +version = 3.0.7 \ No newline at end of file diff --git a/phpBB/styles/prosilver/template/template.cfg b/phpBB/styles/prosilver/template/template.cfg index 22328dd50b..03b61e1003 100644 --- a/phpBB/styles/prosilver/template/template.cfg +++ b/phpBB/styles/prosilver/template/template.cfg @@ -2,8 +2,8 @@ # phpBB Template Configuration File # # @package phpBB3 -# @copyright (c) 2006 phpBB Group -# @license http://opensource.org/licenses/gpl-license.php GNU Public License +# @copyright (c) 2006 phpBB Group +# @license http://opensource.org/licenses/gpl-license.php GNU Public License # # # At the left is the name, please do not change this @@ -11,15 +11,15 @@ # For on/off options the valid values are on, off, 1, 0, true and false # # Values get trimmed, if you want to add a space in front or at the end of -# the value, then enclose the value with single or double quotes. +# the value, then enclose the value with single or double quotes. # Single and double quotes do not need to be escaped. # -# +# # General Information about this template name = prosilver copyright = © phpBB Group, 2007 -version = 3.0.6 +version = 3.0.7 # Defining a different template bitfield template_bitfield = lNg= diff --git a/phpBB/styles/prosilver/theme/theme.cfg b/phpBB/styles/prosilver/theme/theme.cfg index 91a35bbcc8..8b7916a144 100644 --- a/phpBB/styles/prosilver/theme/theme.cfg +++ b/phpBB/styles/prosilver/theme/theme.cfg @@ -2,8 +2,8 @@ # phpBB Theme Configuration File # # @package phpBB3 -# @copyright (c) 2006 phpBB Group -# @license http://opensource.org/licenses/gpl-license.php GNU Public License +# @copyright (c) 2006 phpBB Group +# @license http://opensource.org/licenses/gpl-license.php GNU Public License # # # At the left is the name, please do not change this @@ -11,22 +11,22 @@ # For on/off options the valid values are on, off, 1, 0, true and false # # Values get trimmed, if you want to add a space in front or at the end of -# the value, then enclose the value with single or double quotes. +# the value, then enclose the value with single or double quotes. # Single and double quotes do not need to be escaped. # # Available and used values: # parse_css_file -# +# # General Information about this theme name = prosilver copyright = © phpBB Group, 2007 -version = 3.0.6 +version = 3.0.7 # Some configuration options # -# You have to turn this option on if you want to use the +# You have to turn this option on if you want to use the # path template variables ({T_IMAGESET_PATH} for example) within # your css file. # This is mostly the case if you want to use language specific diff --git a/phpBB/styles/subsilver2/imageset/imageset.cfg b/phpBB/styles/subsilver2/imageset/imageset.cfg index 97fd0d8949..7709070734 100644 --- a/phpBB/styles/subsilver2/imageset/imageset.cfg +++ b/phpBB/styles/subsilver2/imageset/imageset.cfg @@ -2,8 +2,8 @@ # phpBB Imageset Configuration File # # @package phpBB3 -# @copyright (c) 2005 phpBB Group -# @license http://opensource.org/licenses/gpl-license.php GNU Public License +# @copyright (c) 2005 phpBB Group +# @license http://opensource.org/licenses/gpl-license.php GNU Public License # # # At the left is the name, please do not change this @@ -11,7 +11,7 @@ # For on/off options the valid values are on, off, 1, 0, true and false # # Values get trimmed, if you want to add a space in front or at the end of -# the value, then enclose the value with single or double quotes. +# the value, then enclose the value with single or double quotes. # Single and double quotes do not need to be escaped. # # @@ -19,9 +19,9 @@ # General Information about this style name = subsilver2 copyright = © phpBB Group, 2003 -version = 3.0.6 +version = 3.0.7 -# Images +# Images img_site_logo = site_logo.gif*94*170 img_upload_bar = upload_bar.gif*16*280 img_poll_left = poll_left.gif*12*4 @@ -81,8 +81,8 @@ img_global_unread_mine = announce_unread_mine.gif*18*19 img_global_unread_locked = announce_unread_locked.gif*18*19 img_global_unread_locked_mine = announce_unread_locked_mine.gif*18*19 -img_subforum_read = -img_subforum_unread = +img_subforum_read = +img_subforum_unread = img_pm_read = topic_read.gif*18*19 img_pm_unread = topic_unread.gif*18*19 diff --git a/phpBB/styles/subsilver2/style.cfg b/phpBB/styles/subsilver2/style.cfg index 5eaaac782d..86b5b8a4e8 100644 --- a/phpBB/styles/subsilver2/style.cfg +++ b/phpBB/styles/subsilver2/style.cfg @@ -2,8 +2,8 @@ # phpBB Style Configuration File # # @package phpBB3 -# @copyright (c) 2005 phpBB Group -# @license http://opensource.org/licenses/gpl-license.php GNU Public License +# @copyright (c) 2005 phpBB Group +# @license http://opensource.org/licenses/gpl-license.php GNU Public License # # # At the left is the name, please do not change this @@ -11,12 +11,12 @@ # For on/off options the valid values are on, off, 1, 0, true and false # # Values get trimmed, if you want to add a space in front or at the end of -# the value, then enclose the value with single or double quotes. +# the value, then enclose the value with single or double quotes. # Single and double quotes do not need to be escaped. # -# +# # General Information about this style name = subsilver2 copyright = © 2005 phpBB Group -version = 3.0.6 +version = 3.0.7 diff --git a/phpBB/styles/subsilver2/template/template.cfg b/phpBB/styles/subsilver2/template/template.cfg index 106eae28e6..b6765268bc 100644 --- a/phpBB/styles/subsilver2/template/template.cfg +++ b/phpBB/styles/subsilver2/template/template.cfg @@ -2,8 +2,8 @@ # phpBB Template Configuration File # # @package phpBB3 -# @copyright (c) 2005 phpBB Group -# @license http://opensource.org/licenses/gpl-license.php GNU Public License +# @copyright (c) 2005 phpBB Group +# @license http://opensource.org/licenses/gpl-license.php GNU Public License # # # At the left is the name, please do not change this @@ -11,13 +11,13 @@ # For on/off options the valid values are on, off, 1, 0, true and false # # Values get trimmed, if you want to add a space in front or at the end of -# the value, then enclose the value with single or double quotes. +# the value, then enclose the value with single or double quotes. # Single and double quotes do not need to be escaped. # -# +# # General Information about this template name = subsilver2 copyright = © phpBB Group, 2003 -version = 3.0.6 +version = 3.0.7 diff --git a/phpBB/styles/subsilver2/theme/theme.cfg b/phpBB/styles/subsilver2/theme/theme.cfg index 57b7fa8c63..7f6bfd9a12 100644 --- a/phpBB/styles/subsilver2/theme/theme.cfg +++ b/phpBB/styles/subsilver2/theme/theme.cfg @@ -2,8 +2,8 @@ # phpBB Theme Configuration File # # @package phpBB3 -# @copyright (c) 2005 phpBB Group -# @license http://opensource.org/licenses/gpl-license.php GNU Public License +# @copyright (c) 2005 phpBB Group +# @license http://opensource.org/licenses/gpl-license.php GNU Public License # # # At the left is the name, please do not change this @@ -11,22 +11,22 @@ # For on/off options the valid values are on, off, 1, 0, true and false # # Values get trimmed, if you want to add a space in front or at the end of -# the value, then enclose the value with single or double quotes. +# the value, then enclose the value with single or double quotes. # Single and double quotes do not need to be escaped. # # Available and used values: # parse_css_file -# +# # General Information about this theme name = subsilver2 copyright = © phpBB Group, 2003 -version = 3.0.6 +version = 3.0.7 # Some configuration options # -# You have to turn this option on if you want to use the +# You have to turn this option on if you want to use the # path template variables ({T_IMAGESET_PATH} for example) within # your css file. # This is mostly the case if you want to use language specific From f90bab90c742fbbff89a9b9ae78b7c921a6e139c Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 1 Feb 2010 01:18:21 +0000 Subject: [PATCH 002/393] Change version number to 3.0.8-dev in preparation for development on next release git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10469 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/schemas/schema_data.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index cb704cad7c..38088b291d 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -241,7 +241,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page', 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 ('version', '3.0.7'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.8-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'); From 6b519c8bdfc5338f71967ee6cbdc53262afc3396 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Mon, 1 Feb 2010 22:14:04 +0000 Subject: [PATCH 003/393] Slight performance optimisation for r9624 refs #54265 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10470 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/cache.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/cache.php b/phpBB/includes/cache.php index a0142292ed..c760c20d52 100644 --- a/phpBB/includes/cache.php +++ b/phpBB/includes/cache.php @@ -82,9 +82,11 @@ class cache extends acm $result = $db->sql_query($sql); $censors = array(); + $unicode = ((version_compare(PHP_VERSION, '5.1.0', '>=') || (version_compare(PHP_VERSION, '5.0.0-dev', '<=') && version_compare(PHP_VERSION, '4.4.0', '>='))) && @preg_match('/\p{L}/u', 'a') !== false) ? true : false; + while ($row = $db->sql_fetchrow($result)) { - if ((version_compare(PHP_VERSION, '5.1.0', '>=') || (version_compare(PHP_VERSION, '5.0.0-dev', '<=') && version_compare(PHP_VERSION, '4.4.0', '>='))) && @preg_match('/\p{L}/u', 'a') !== false) + if ($unicode) { $censors['match'][] = '#(? Date: Thu, 4 Feb 2010 00:04:25 +0000 Subject: [PATCH 004/393] Bug #38765 - Unify BBCode selection across browsers git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10472 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/styles/prosilver/template/editor.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 9f6b886932..43f4311600 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -153,6 +153,7 @@
  • [Fix] Fix language string for PM-Reports refering to post-data. (Bug #54745)
  • [Fix] Do not store email templates in database. (Bug #54505)
  • [Fix] Fix javascript bug in the smilies ACP. (Bug #55725)
  • +
  • [Fix] Unify BBCode Selection across browsers. (Bug #38765)
  • [Change] Move redirect into a hidden field to avoid issues with mod_security. (Bug #54145)
  • [Change] Log activation through inactive users ACP. (Bug #30145)
  • [Change] Send time of last item instead of current time in ATOM Feeds. (Bug #53305)
  • diff --git a/phpBB/styles/prosilver/template/editor.js b/phpBB/styles/prosilver/template/editor.js index 1699f783d5..98dab5d7c8 100644 --- a/phpBB/styles/prosilver/template/editor.js +++ b/phpBB/styles/prosilver/template/editor.js @@ -323,8 +323,8 @@ function mozWrap(txtarea, open, close) var s3 = (txtarea.value).substring(selEnd, selLength); txtarea.value = s1 + open + s2 + close + s3; - txtarea.selectionStart = selEnd + open.length + close.length; - txtarea.selectionEnd = txtarea.selectionStart; + txtarea.selectionStart = selStart + open.length; + txtarea.selectionEnd = selEnd + open.length; txtarea.focus(); txtarea.scrollTop = scrollTop; From 99c608e88c267e0fa7517da196e1701ba163c26a Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Thu, 4 Feb 2010 00:40:19 +0000 Subject: [PATCH 005/393] Bug #57265 - Convertors cannot read configuration files git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10473 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_convert.php | 18 ++++++++++++++++-- phpBB/install/convertors/convert_phpbb20.php | 11 ++++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 43f4311600..b6b2503968 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -154,6 +154,7 @@
  • [Fix] Do not store email templates in database. (Bug #54505)
  • [Fix] Fix javascript bug in the smilies ACP. (Bug #55725)
  • [Fix] Unify BBCode Selection across browsers. (Bug #38765)
  • +
  • [Fix] Allow convertors to read in configuration from files. (Bug #57265) (patch by Dicky)
  • [Change] Move redirect into a hidden field to avoid issues with mod_security. (Bug #54145)
  • [Change] Log activation through inactive users ACP. (Bug #30145)
  • [Change] Send time of last item instead of current time in ATOM Feeds. (Bug #53305)
  • diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 82ec114c09..8a1d07c8e5 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -1232,6 +1232,11 @@ function get_config() $convert->p_master->error($user->lang['FILE_NOT_FOUND'] . ': ' . $filename, __LINE__, __FILE__); } + if (isset($convert->config_schema['array_name'])) + { + unset($convert->config_schema['array_name']); + } + $convert_config = extract_variables_from_file($filename); if (!empty($convert->config_schema['array_name'])) { @@ -1264,6 +1269,7 @@ function restore_config($schema) global $db, $config; $convert_config = get_config(); + foreach ($schema['settings'] as $config_name => $src) { if (preg_match('/(.*)\((.*)\)/', $src, $m)) @@ -1274,8 +1280,16 @@ function restore_config($schema) } else { - $config_value = (isset($convert_config[$src])) ? $convert_config[$src] : ''; - } + if ($schema['table_format'] != 'file' || empty($schema['array_name'])) + { + $config_value = (isset($convert_config[$src])) ? $convert_config[$src] : ''; + } + else if (!empty($schema['array_name'])) + { + $src_ary = $schema['array_name']; + $config_value = (isset($convert_config[$src_ary][$src])) ? $convert_config[$src_ary][$src] : ''; + } + } if ($config_value !== '') { diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php index 5a6603883b..1d6b79bbec 100644 --- a/phpBB/install/convertors/convert_phpbb20.php +++ b/phpBB/install/convertors/convert_phpbb20.php @@ -32,7 +32,7 @@ unset($dbpasswd); $convertor_data = array( 'forum_name' => 'phpBB 2.0.x', 'version' => '1.0.3', - 'phpbb_version' => '3.0.6', + 'phpbb_version' => '3.0.7', 'author' => 'phpBB Group', 'dbms' => $dbms, 'dbhost' => $dbhost, @@ -78,6 +78,15 @@ $tables = array( * * 'table_format' can take the value 'file' to indicate a config file. In this case array_name * is set to indicate the name of the array the config values are stored in +* Example of using a file: +* $config_schema = array( +* 'table_format' => 'file', +* 'filename' => 'NAME OF FILE', // If the file is not in the root directory, the path needs to be added with no leading slash +* 'array_name' => 'NAME OF ARRAY', // Only used if the configuration file stores the setting in an array. +* 'settings' => array( +* 'board_email' => 'SUPPORT_EMAIL', // target config name => source target name +* ) +* ); * 'table_format' can be an array if the values are stored in a table which is an assosciative array * (as per phpBB 2.0.x) * If left empty, values are assumed to be stored in a table where each config setting is From 8adf583bdf3f8d00bbeab0ac0dbfdd49c58d80cd Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Thu, 4 Feb 2010 01:04:52 +0000 Subject: [PATCH 006/393] Bug #38765 - Unify BBCode selection across browsers (also needs fixing in subsilver2) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10474 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/styles/subsilver2/template/editor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/subsilver2/template/editor.js b/phpBB/styles/subsilver2/template/editor.js index b4a426df4e..0c48c93ad3 100644 --- a/phpBB/styles/subsilver2/template/editor.js +++ b/phpBB/styles/subsilver2/template/editor.js @@ -276,8 +276,8 @@ function mozWrap(txtarea, open, close) var s3 = (txtarea.value).substring(selEnd, selLength); txtarea.value = s1 + open + s2 + close + s3; - txtarea.selectionStart = selEnd + open.length + close.length; - txtarea.selectionEnd = txtarea.selectionStart; + txtarea.selectionStart = selStart + open.length; + txtarea.selectionEnd = selEnd + open.length; txtarea.focus(); txtarea.scrollTop = scrollTop; From 52c13bc7416111c764550e47fd86159d8f3f937b Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 6 Feb 2010 21:07:25 +0000 Subject: [PATCH 007/393] Add 'Changes since 3.0.7' section to Changelog. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10477 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index b6b2503968..6b7edf6465 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -53,6 +53,7 @@
    1. Changelog
        +
      1. Changes since 3.0.7
      2. Changes since 3.0.6
      3. Changes since 3.0.5
      4. Changes since 3.0.4
      5. @@ -86,7 +87,14 @@
        -

        1.i. Changes since 3.0.6

        + +

        1.i. Changes since 3.0.7

        + +
          +
        • +
        + +

        1.ii. Changes since 3.0.6

        • [Fix] Allow ban reason and length to be selected and copied in ACP and subsilver2 MCP. (Bug #51095)
        • @@ -176,7 +184,7 @@
        • [Feature] Ability to use HTTP authentication in ATOM feeds by passing the GET parameter "auth=http".
        -

        1.ii. Changes since 3.0.5

        +

        1.iii. Changes since 3.0.5

        • [Fix] Allow whitespaces in avatar gallery names. (Bug #44955)
        • @@ -398,7 +406,7 @@
        • [Feature] Send anonymous statistical information to phpBB on installation and update (optional).
        -

        1.iii. Changes since 3.0.4

        +

        1.iv. Changes since 3.0.4

        • [Fix] Delete user entry from ban list table upon user deletion (Bug #40015 - Patch by TerraFrost)
        • @@ -487,7 +495,7 @@
        • [Sec] Only use forum id supplied for posting if global announcement detected. (Reported by nickvergessen)
        -

        1.iv. Changes since 3.0.3

        +

        1.v. Changes since 3.0.3

        • [Fix] Allow mixed-case template directories to be inherited (Bug #36725)
        • @@ -519,7 +527,7 @@
        • [Sec] Ask for forum password if post within passworded forum quoted in private message. (Reported by nickvergessen)
        -

        1.v. Changes since 3.0.2

        +

        1.vi. Changes since 3.0.2

        • [Fix] Correctly set topic starter if first post in topic removed (Bug #30575 - Patch by blueray2048)
        • @@ -618,7 +626,7 @@
        • [Sec Precaution] Stricter validation of the HTTP_HOST header (Thanks to Techie-Micheal et al for pointing out possible issues in derived code)
        -

        1.vi. Changes since 3.0.1

        +

        1.vii. Changes since 3.0.1

        • [Fix] Ability to set permissions on non-mysql dbms (Bug #24955)
        • @@ -666,7 +674,7 @@
        • [Sec] Only allow urls gone through redirect() being used within login_box(). (thanks nookieman)
        -

        1.vii Changes since 3.0.0

        +

        1.viii Changes since 3.0.0

        • [Change] Validate birthdays (Bug #15004)
        • @@ -737,7 +745,7 @@
        • [Fix] Find and display colliding usernames correctly when converting from one database to another (Bug #23925)
        -

        1.viii. Changes since 3.0.RC8

        +

        1.ix. Changes since 3.0.RC8

        • [Fix] Cleaned usernames contain only single spaces, so "a_name" and "a__name" are treated as the same name (Bug #15634)
        • @@ -746,7 +754,7 @@
        • [Fix] Call garbage_collection() within database updater to correctly close connections (affects Oracle for example)
        -

        1.ix. Changes since 3.0.RC7

        +

        1.x. Changes since 3.0.RC7

        • [Fix] Fixed MSSQL related bug in the update system
        • @@ -781,7 +789,7 @@
        • [Fix] No duplication of active topics (Bug #15474)
        -

        1.x. Changes since 3.0.RC6

        +

        1.xi. Changes since 3.0.RC6

        • [Fix] Submitting language changes using acp_language (Bug #14736)
        • @@ -791,7 +799,7 @@
        • [Fix] Able to request new password (Bug #14743)
        -

        1.xi. Changes since 3.0.RC5

        +

        1.xii. Changes since 3.0.RC5

        • [Feature] Removing constant PHPBB_EMBEDDED in favor of using an exit_handler(); the constant was meant to achive this more or less.
        • @@ -854,7 +862,7 @@
        • [Sec] New password hashing mechanism for storing passwords (#i42)
        -

        1.xii. Changes since 3.0.RC4

        +

        1.xiii. Changes since 3.0.RC4

        • [Fix] MySQL, PostgreSQL and SQLite related database fixes (Bug #13862)
        • @@ -905,7 +913,7 @@
        • [Fix] odbc_autocommit causing existing result sets to be dropped (Bug #14182)
        -

        1.xiii. Changes since 3.0.RC3

        +

        1.xiv. Changes since 3.0.RC3

        • [Fix] Fixing some subsilver2 and prosilver style issues
        • @@ -1014,7 +1022,7 @@
        -

        1.xiv. Changes since 3.0.RC2

        +

        1.xv. Changes since 3.0.RC2

        • [Fix] Re-allow searching within the memberlist
        • @@ -1060,7 +1068,7 @@
        -

        1.xv. Changes since 3.0.RC1

        +

        1.xvi. Changes since 3.0.RC1

        • [Fix] (X)HTML issues within the templates (Bug #11255, #11255)
        • From aec50a43281ecb65698f373329e6af6e91570a53 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 6 Feb 2010 21:19:40 +0000 Subject: [PATCH 008/393] Fix Bug #57385 Correctly sort database backup file list by date on database restore page. Take admin's time zone settings into account when listing database backup files. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10478 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 3 ++- phpBB/includes/acp/acp_database.php | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 6b7edf6465..8bd8934eb0 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -91,7 +91,8 @@

          1.i. Changes since 3.0.7

            -
          • +
          • [Fix] Correctly sort database backup file list by date on database restore page. (Bug #57385)
          • +
          • [Fix] Take admin's time zone settings into account when listing database backup files. (Bug #57385)

          1.ii. Changes since 3.0.6

          diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index 5d7450bdfd..7b734da2af 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -435,7 +435,7 @@ class acp_database { if (in_array($matches[2], $methods)) { - $backup_files[gmdate("d-m-Y H:i:s", $matches[1])] = $file; + $backup_files[(int) $matches[1]] = $file; } } } @@ -450,7 +450,7 @@ class acp_database { $template->assign_block_vars('files', array( 'FILE' => $file, - 'NAME' => $name, + 'NAME' => $user->format_date($name, 'd-m-Y H:i:s', true), 'SUPPORTED' => true, )); } From c0836e8835f0b3105baecdc710cd101920d8339b Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 7 Feb 2010 00:20:46 +0000 Subject: [PATCH 009/393] Bug #13181 - Honor minimum and maximum password length in generated passwords as much as we can. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10479 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/ucp/ucp_remind.php | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 8bd8934eb0..dd4ffbb4d1 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -93,6 +93,7 @@
          • [Fix] Correctly sort database backup file list by date on database restore page. (Bug #57385)
          • [Fix] Take admin's time zone settings into account when listing database backup files. (Bug #57385)
          • +
          • [Fix] Honor minimum and maximum password length in generated passwords as much as we can. (Bug #13181)

          1.ii. Changes since 3.0.6

          diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php index df6733d038..f9b792de20 100644 --- a/phpBB/includes/ucp/ucp_remind.php +++ b/phpBB/includes/ucp/ucp_remind.php @@ -77,11 +77,12 @@ class ucp_remind $server_url = generate_board_url(); - $key_len = 54 - strlen($server_url); - $key_len = max(6, $key_len); // we want at least 6 - $key_len = ($config['max_pass_chars']) ? min($key_len, $config['max_pass_chars']) : $key_len; // we want at most $config['max_pass_chars'] - $user_actkey = substr(gen_rand_string(10), 0, $key_len); - $user_password = gen_rand_string(8); + // Make password at least 8 characters long, make it longer if admin wants to. + // gen_rand_string() however has a limit of 12 or 13. + $user_password = gen_rand_string(max(8, rand((int) $config['min_pass_chars'], (int) $config['max_pass_chars']))); + + // For the activation key a random length between 6 and 10 will do. + $user_actkey = gen_rand_string(rand(6, 10)); $sql = 'UPDATE ' . USERS_TABLE . " SET user_newpasswd = '" . $db->sql_escape(phpbb_hash($user_password)) . "', user_actkey = '" . $db->sql_escape($user_actkey) . "' From 4bb3266cc62003d5bd6fafda03a5582ea06250e9 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 7 Feb 2010 00:27:00 +0000 Subject: [PATCH 010/393] Bug #57345 - No longer return the character O in generated random strings and passwords. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10480 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index dd4ffbb4d1..4248dd3761 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -94,6 +94,7 @@
        • [Fix] Correctly sort database backup file list by date on database restore page. (Bug #57385)
        • [Fix] Take admin's time zone settings into account when listing database backup files. (Bug #57385)
        • [Fix] Honor minimum and maximum password length in generated passwords as much as we can. (Bug #13181)
        • +
        • [Fix] No longer return the character O in generated random strings and passwords. (Bug #57345)

        1.ii. Changes since 3.0.6

        diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 823c71dbf0..23221c69ea 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -202,7 +202,7 @@ function set_config_count($config_name, $increment, $is_dynamic = false) function gen_rand_string($num_chars = 8) { $rand_str = unique_id(); - $rand_str = str_replace('0', 'Z', strtoupper(base_convert($rand_str, 16, 35))); + $rand_str = str_replace(array('0', 'O'), array('Z', 'Y'), strtoupper(base_convert($rand_str, 16, 34))); return substr($rand_str, 0, $num_chars); } From 64b4a8bd445283e036d8f6c1c8fdd9b9b5907d23 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 7 Feb 2010 00:50:21 +0000 Subject: [PATCH 011/393] No longer needed, as of r10480. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10481 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 821896f32a..a3d47b5b59 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -124,7 +124,7 @@ $lang = array_merge($lang, array( 'COMMA_SEPARATOR' => ', ', // Used in pagination of ACP & prosilver, use localised comma if appropriate, eg: Ideographic or Arabic 'CONFIRM' => 'Confirm', 'CONFIRM_CODE' => 'Confirmation code', - 'CONFIRM_CODE_EXPLAIN' => 'Enter the code exactly as it appears. All letters are case insensitive, there is no zero.', + 'CONFIRM_CODE_EXPLAIN' => 'Enter the code exactly as it appears. All letters are case insensitive.', 'CONFIRM_CODE_WRONG' => 'The confirmation code you entered was incorrect.', 'CONFIRM_OPERATION' => 'Are you sure you wish to carry out this operation?', 'CONGRATULATIONS' => 'Congratulations to', From d26f66703b0164c5cdd9dc4abf77450faf53ba41 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Sun, 7 Feb 2010 01:04:10 +0000 Subject: [PATCH 012/393] Fix #57395, a regression from r10427 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10482 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/functions_admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index a1bc2e7795..ff291fbe8a 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -102,7 +102,7 @@ function make_forum_select($select_id = false, $ignore_id = false, $ignore_acl = { $disabled = true; } - else if (!$only_acl_post && !$auth->acl_gets(array('a_forum', 'a_forumadd', 'a_forumdel'), $row['forum_id'])) + else if (!$only_acl_post && !$auth->acl_gets(array('f_list', 'a_forum', 'a_forumadd', 'a_forumdel'), $row['forum_id'])) { $disabled = true; } From 037aea067b5e2200c52413f8b397665bf93b385e Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 8 Feb 2010 16:43:39 +0000 Subject: [PATCH 013/393] Fix Bug #57455 - Fix problems with firebird by no longer using 'count' as a column alias. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10484 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_icons.php | 5 +++-- phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php | 4 ++-- phpBB/includes/functions_posting.php | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 4248dd3761..7092d6683b 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -166,6 +166,7 @@
      6. [Fix] Fix javascript bug in the smilies ACP. (Bug #55725)
      7. [Fix] Unify BBCode Selection across browsers. (Bug #38765)
      8. [Fix] Allow convertors to read in configuration from files. (Bug #57265) (patch by Dicky)
      9. +
      10. [Fix] Fix problems with firebird by no longer using 'count' as a column alias. (Bug #57455)
      11. [Change] Move redirect into a hidden field to avoid issues with mod_security. (Bug #54145)
      12. [Change] Log activation through inactive users ACP. (Bug #30145)
      13. [Change] Send time of last item instead of current time in ATOM Feeds. (Bug #53305)
      14. diff --git a/phpBB/includes/acp/acp_icons.php b/phpBB/includes/acp/acp_icons.php index e1deb7e533..3d64a2acda 100644 --- a/phpBB/includes/acp/acp_icons.php +++ b/phpBB/includes/acp/acp_icons.php @@ -941,11 +941,12 @@ class acp_icons { global $db; - $sql = "SELECT COUNT(*) AS count + $sql = "SELECT COUNT(*) AS item_count FROM $table"; $result = $db->sql_query($sql); - $item_count = (int) $db->sql_fetchfield('count'); + $item_count = (int) $db->sql_fetchfield('item_count'); $db->sql_freeresult($result); + return $item_count; } } diff --git a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php index ef4d8e9fac..49a64b9339 100644 --- a/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_captcha_qa_plugin.php @@ -137,14 +137,14 @@ class phpbb_captcha_qa return false; } - $sql = 'SELECT COUNT(question_id) as count + $sql = 'SELECT COUNT(question_id) AS question_count FROM ' . CAPTCHA_QUESTIONS_TABLE . " WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'"; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $db->sql_freeresult($result); - return ((bool) $row['count']); + return ((bool) $row['question_count']); } /** diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 0a31ea49a8..49ea382411 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -46,7 +46,7 @@ function generate_smilies($mode, $forum_id) page_header($user->lang['SMILIES']); - $sql = 'SELECT COUNT(smiley_id) AS count + $sql = 'SELECT COUNT(smiley_id) AS item_count FROM ' . SMILIES_TABLE . ' GROUP BY smiley_url'; $result = $db->sql_query($sql, 3600); From e3b07a88f4aa32d2a2afc441359c2488e1ffaed8 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 8 Feb 2010 16:49:21 +0000 Subject: [PATCH 014/393] Let's adjust those to the format of the other entries. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10485 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 7092d6683b..7d15cfff07 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -152,7 +152,7 @@
      15. [Fix] Properly paginate unapproved posts in the MCP. (Bug #56285)
      16. [Fix] Do not duplicate previous/next links in pagination text of moderator logs and user notes in MCP for subsilver2. (Bug #55045)
      17. [Fix] Do not automatically unsubscribe users from topics, when email and jabber is disabled.
      18. -
      19. [Fix] Don't send activation email when user tries to change email without permission (fix by nrohler). (Bug #56335)
      20. +
      21. [Fix] Don't send activation email when user tries to change email without permission. (Bug #56335 - Fix by nrohler)
      22. [Fix] Replace hard coded "px" with translated language-string. (Bug #52495)
      23. [Fix] Correctly hover list menu in UCP and MCP for RTL languages. (Bug #49945)
      24. [Fix] Correctly orientate quoted text image on RTL languages. (Bug #33745)
      25. @@ -165,7 +165,7 @@
      26. [Fix] Do not store email templates in database. (Bug #54505)
      27. [Fix] Fix javascript bug in the smilies ACP. (Bug #55725)
      28. [Fix] Unify BBCode Selection across browsers. (Bug #38765)
      29. -
      30. [Fix] Allow convertors to read in configuration from files. (Bug #57265) (patch by Dicky)
      31. +
      32. [Fix] Allow convertors to read in configuration from files. (Bug #57265 - Patch by Dicky)
      33. [Fix] Fix problems with firebird by no longer using 'count' as a column alias. (Bug #57455)
      34. [Change] Move redirect into a hidden field to avoid issues with mod_security. (Bug #54145)
      35. [Change] Log activation through inactive users ACP. (Bug #30145)
      36. From 964e9cf3ef31ff95cc675e02f24c54455859ec76 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 8 Feb 2010 23:58:37 +0000 Subject: [PATCH 015/393] Make those warnings more consistent. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10487 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/acp/board.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 9bb76cd354..daf83cfda0 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -391,7 +391,7 @@ $lang = array_merge($lang, array( 'LDAP_NO_EMAIL' => 'The specified e-mail attribute does not exist.', 'LDAP_NO_IDENTITY' => 'Could not find a login identity for %s.', 'LDAP_PASSWORD' => 'LDAP password', - 'LDAP_PASSWORD_EXPLAIN' => 'Leave blank to use anonymous binding. Else fill in the password for the above user. Required for Active Directory Servers. WARNING: This password will be stored as plain text in the database visible to everybody who can access your database or who can view this configuration page.', + 'LDAP_PASSWORD_EXPLAIN' => 'Leave blank to use anonymous binding. Else fill in the password for the above user. Required for Active Directory Servers.
        Warning: This password will be stored as plain text in the database visible to everybody who can access your database or who can view this configuration page.', 'LDAP_PORT' => 'LDAP server port', 'LDAP_PORT_EXPLAIN' => 'Optionally you can specify a port which should be used to connect to the LDAP server instead of the default port 389.', 'LDAP_SERVER' => 'LDAP server name', @@ -503,7 +503,7 @@ $lang = array_merge($lang, array( 'SMTP_DIGEST_MD5' => 'DIGEST-MD5', 'SMTP_LOGIN' => 'LOGIN', 'SMTP_PASSWORD' => 'SMTP password', - 'SMTP_PASSWORD_EXPLAIN' => 'Only enter a password if your SMTP server requires it. Warning: this password is stored as plain text in the database.', + 'SMTP_PASSWORD_EXPLAIN' => 'Only enter a password if your SMTP server requires it.
        Warning: This password will be stored as plain text in the database visible to everybody who can access your database or who can view this configuration page.', 'SMTP_PLAIN' => 'PLAIN', 'SMTP_POP_BEFORE_SMTP' => 'POP-BEFORE-SMTP', 'SMTP_PORT' => 'SMTP server port', @@ -526,7 +526,7 @@ $lang = array_merge($lang, array( 'JAB_PACKAGE_SIZE' => 'Jabber package size', 'JAB_PACKAGE_SIZE_EXPLAIN' => 'This is the number of messages sent in one package. If set to 0 the message is sent immediately and will not be queued for later sending.', 'JAB_PASSWORD' => 'Jabber password', - 'JAB_PASSWORD_EXPLAIN' => 'Warning: this password is stored as plain text in the database.', + 'JAB_PASSWORD_EXPLAIN' => 'Warning: This password will be stored as plain text in the database visible to everybody who can access your database or who can view this configuration page.', 'JAB_PORT' => 'Jabber port', 'JAB_PORT_EXPLAIN' => 'Leave blank unless you know it is not port 5222.', 'JAB_SERVER' => 'Jabber server', From 6c321c53a1ebd495518738157dc3a2bf8c0701e1 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 9 Feb 2010 14:10:42 +0000 Subject: [PATCH 016/393] Fix Bug #57505 - Replace button2 with btnlite, button2 doesn't exist. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10488 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/styles/subsilver2/template/mcp_logs.html | 2 +- phpBB/styles/subsilver2/template/mcp_notes_user.html | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 7d15cfff07..876b8b1a61 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -95,6 +95,7 @@
      37. [Fix] Take admin's time zone settings into account when listing database backup files. (Bug #57385)
      38. [Fix] Honor minimum and maximum password length in generated passwords as much as we can. (Bug #13181)
      39. [Fix] No longer return the character O in generated random strings and passwords. (Bug #57345)
      40. +
      41. [Fix] Some XHTML corrections in subsilver2. (Bug #57505)
      42. 1.ii. Changes since 3.0.6

        diff --git a/phpBB/styles/subsilver2/template/mcp_logs.html b/phpBB/styles/subsilver2/template/mcp_logs.html index 6b78df3e5e..8b69197b0f 100644 --- a/phpBB/styles/subsilver2/template/mcp_logs.html +++ b/phpBB/styles/subsilver2/template/mcp_logs.html @@ -22,7 +22,7 @@ - {L_SEARCH_KEYWORDS}:   + {L_SEARCH_KEYWORDS}:   {L_DISPLAY_LOG}: {S_SELECT_SORT_DAYS} {L_SORT_BY} {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR}  diff --git a/phpBB/styles/subsilver2/template/mcp_notes_user.html b/phpBB/styles/subsilver2/template/mcp_notes_user.html index 522c19fa05..4ee3f9e04e 100644 --- a/phpBB/styles/subsilver2/template/mcp_notes_user.html +++ b/phpBB/styles/subsilver2/template/mcp_notes_user.html @@ -55,7 +55,7 @@ - {L_SEARCH_KEYWORDS}:   + {L_SEARCH_KEYWORDS}:   {L_DISPLAY_LOG}: {S_SELECT_SORT_DAYS} {L_SORT_BY}: {S_SELECT_SORT_KEY} {S_SELECT_SORT_DIR}  From 1802b9ff9286a7fc24493e71b3432816cbdbfcd8 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 11 Feb 2010 00:02:51 +0000 Subject: [PATCH 017/393] Support for Microsoft's Native SQL Server Driver for PHP - Patch by Chris Pucci at Microsoft [Bug #57055] If you are using SQL Server, please try to test this new dbal so we can safely include it in 3.0.8. If you want to try it on a current phpBB version you can apply the latest version of the patch to your board which you can find attached to the bug tracker ticket (look in the comments for the latest version, the one in the ticket itself is outdated): http://www.phpbb.com/bugs/phpbb3/ticket.php?ticket_id=57055 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10489 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_database.php | 102 +++++ phpBB/includes/cache.php | 1 + phpBB/includes/db/db_tools.php | 51 ++- phpBB/includes/db/mssqlnative.php | 608 +++++++++++++++++++++++++ phpBB/includes/functions_admin.php | 1 + phpBB/includes/functions_convert.php | 1 + phpBB/includes/functions_install.php | 12 + phpBB/includes/message_parser.php | 1 + phpBB/install/database_update.php | 51 ++- phpBB/install/install_convert.php | 2 + phpBB/install/install_install.php | 3 +- phpBB/install/schemas/mssql_schema.sql | 8 - phpBB/language/en/install.php | 2 + 14 files changed, 829 insertions(+), 15 deletions(-) create mode 100644 phpBB/includes/db/mssqlnative.php diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 876b8b1a61..6121d8ad1a 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -96,6 +96,7 @@
      43. [Fix] Honor minimum and maximum password length in generated passwords as much as we can. (Bug #13181)
      44. [Fix] No longer return the character O in generated random strings and passwords. (Bug #57345)
      45. [Fix] Some XHTML corrections in subsilver2. (Bug #57505)
      46. +
      47. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
      48. 1.ii. Changes since 3.0.6

        diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index 7b734da2af..abfad2b90b 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -109,6 +109,7 @@ class acp_database case 'mssql': case 'mssql_odbc': + case 'mssqlnative': $extractor = new mssql_extractor($download, $store, $format, $filename, $time); break; @@ -138,6 +139,7 @@ class acp_database case 'mssql': case 'mssql_odbc': + case 'mssqlnative': $extractor->flush('TRUNCATE TABLE ' . $table_name . "GO\n"); break; @@ -1509,6 +1511,10 @@ class mssql_extractor extends base_extractor { $this->write_data_mssql($table_name); } + else if($db->sql_layer === 'mssqlnative') + { + $this->write_data_mssqlnative($table_name); + } else { $this->write_data_odbc($table_name); @@ -1608,7 +1614,103 @@ class mssql_extractor extends base_extractor } $this->flush($sql_data); } + + function write_data_mssqlnative($table_name) + { + global $db; + $ary_type = $ary_name = $meta_array = array(); + $ident_set = false; + $sql_data = ''; + // Grab all of the data from current table. + $sql = "SELECT * FROM $table_name"; + $result = $db->sql_query($sql); + + $retrieved_data = $db->mssqlnative_num_rows($result); + + $meta_array = sqlsrv_field_metadata($result); + $i_num_fields = sqlsrv_num_fields($result); + + for ($i = 0; $i < $i_num_fields; $i++) + { + $info = $db->mssqlnative_fieldInfo($table_name, $meta_array[$i]['Name']); + $ary_type[$i] = $info->type(); + $ary_name[$i] = $info->name(); + } + + if ($retrieved_data) + { + $sql = "SELECT 1 as has_identity + FROM INFORMATION_SCHEMA.COLUMNS + WHERE COLUMNPROPERTY(object_id('$table_name'), COLUMN_NAME, 'IsIdentity') = 1"; + $result2 = $db->sql_query($sql); + $row2 = $db->sql_fetchrow($result2); + + if (!empty($row2['has_identity'])) + { + $sql_data .= "\nSET IDENTITY_INSERT $table_name ON\nGO\n"; + $ident_set = true; + } + $db->sql_freeresult($result2); + } + + while ($row = $db->sql_fetchrow($result)) + { + $schema_vals = $schema_fields = array(); + + // Build the SQL statement to recreate the data. + for ($i = 0; $i < $i_num_fields; $i++) + { + $str_val = $row[$ary_name[$i]]; + + if (preg_match('#char|text|bool|varbinary#i', $ary_type[$i])) + { + $str_quote = ''; + $str_empty = "''"; + $str_val = sanitize_data_mssql(str_replace("'", "''", $str_val)); + } + else if (preg_match('#date|timestamp#i', $ary_type[$i])) + { + if (empty($str_val)) + { + $str_quote = ''; + } + else + { + $str_quote = "'"; + } + } + else + { + $str_quote = ''; + $str_empty = 'NULL'; + } + + if (empty($str_val) && $str_val !== '0' && !(is_int($str_val) || is_float($str_val))) + { + $str_val = $str_empty; + } + + $schema_vals[$i] = $str_quote . $str_val . $str_quote; + $schema_fields[$i] = $ary_name[$i]; + } + + // Take the ordered fields and their associated data and build it + // into a valid sql statement to recreate that field in the data. + $sql_data .= "INSERT INTO $table_name (" . implode(', ', $schema_fields) . ') VALUES (' . implode(', ', $schema_vals) . ");\nGO\n"; + + $this->flush($sql_data); + $sql_data = ''; + } + $db->sql_freeresult($result); + + if ($retrieved_data && $ident_set) + { + $sql_data .= "\nSET IDENTITY_INSERT $table_name OFF\nGO\n"; + } + $this->flush($sql_data); + } + function write_data_odbc($table_name) { global $db; diff --git a/phpBB/includes/cache.php b/phpBB/includes/cache.php index c760c20d52..6b1e078ca4 100644 --- a/phpBB/includes/cache.php +++ b/phpBB/includes/cache.php @@ -299,6 +299,7 @@ class cache extends acm { case 'mssql': case 'mssql_odbc': + case 'mssqlnative': $sql = 'SELECT user_id, bot_agent, bot_ip FROM ' . BOTS_TABLE . ' WHERE bot_active = 1 diff --git a/phpBB/includes/db/db_tools.php b/phpBB/includes/db/db_tools.php index 7123c83e51..819ef69c96 100644 --- a/phpBB/includes/db/db_tools.php +++ b/phpBB/includes/db/db_tools.php @@ -160,6 +160,36 @@ class phpbb_db_tools 'VARBINARY' => '[varchar] (255)', ), + 'mssqlnative' => array( + 'INT:' => '[int]', + 'BINT' => '[float]', + 'UINT' => '[int]', + 'UINT:' => '[int]', + 'TINT:' => '[int]', + 'USINT' => '[int]', + 'BOOL' => '[int]', + 'VCHAR' => '[varchar] (255)', + 'VCHAR:' => '[varchar] (%d)', + 'CHAR:' => '[char] (%d)', + 'XSTEXT' => '[varchar] (1000)', + 'STEXT' => '[varchar] (3000)', + 'TEXT' => '[varchar] (8000)', + 'MTEXT' => '[text]', + 'XSTEXT_UNI'=> '[varchar] (100)', + 'STEXT_UNI' => '[varchar] (255)', + 'TEXT_UNI' => '[varchar] (4000)', + 'MTEXT_UNI' => '[text]', + 'TIMESTAMP' => '[int]', + 'DECIMAL' => '[float]', + 'DECIMAL:' => '[float]', + 'PDECIMAL' => '[float]', + 'PDECIMAL:' => '[float]', + 'VCHAR_UNI' => '[varchar] (255)', + 'VCHAR_UNI:'=> '[varchar] (%d)', + 'VCHAR_CI' => '[varchar] (255)', + 'VARBINARY' => '[varchar] (255)', + ), + 'oracle' => array( 'INT:' => 'number(%d)', 'BINT' => 'number(20)', @@ -261,7 +291,7 @@ class phpbb_db_tools * A list of supported DBMS. We change this class to support more DBMS, the DBMS itself only need to follow some rules. * @var array */ - var $supported_dbms = array('firebird', 'mssql', 'mysql_40', 'mysql_41', 'oracle', 'postgres', 'sqlite'); + var $supported_dbms = array('firebird', 'mssql', 'mssqlnative', 'mysql_40', 'mysql_41', 'oracle', 'postgres', 'sqlite'); /** * This is set to true if user only wants to return the 'to-be-executed' SQL statement(s) (as an array). @@ -307,6 +337,10 @@ class phpbb_db_tools $this->sql_layer = 'mssql'; break; + case 'mssqlnative': + $this->sql_layer = 'mssqlnative'; + break; + default: $this->sql_layer = $this->db->sql_layer; break; @@ -368,6 +402,7 @@ class phpbb_db_tools switch ($this->sql_layer) { case 'mssql': + case 'mssqlnative': $table_sql = 'CREATE TABLE [' . $table_name . '] (' . "\n"; break; @@ -386,6 +421,7 @@ class phpbb_db_tools switch ($this->sql_layer) { case 'mssql': + case 'mssqlnative': $columns[] = "\t [{$column_name}] " . $prepared_column['column_type_sql_default']; break; @@ -425,6 +461,7 @@ class phpbb_db_tools break; case 'mssql': + case 'mssqlnative': $table_sql .= "\n) ON [PRIMARY]" . (($create_textimage) ? ' TEXTIMAGE_ON [PRIMARY]' : ''); $statements[] = $table_sql; break; @@ -453,6 +490,7 @@ class phpbb_db_tools case 'firebird': case 'mssql': + case 'mssqlnative': // We need the data here $old_return_statements = $this->return_statements; $this->return_statements = true; @@ -970,6 +1008,7 @@ class phpbb_db_tools // same deal with PostgreSQL, we must perform more complex operations than // we technically could case 'mssql': + case 'mssqlnative': $sql = "SELECT c.name FROM syscolumns c LEFT JOIN sysobjects o ON c.id = o.id @@ -1187,6 +1226,7 @@ class phpbb_db_tools break; case 'mssql': + case 'mssqlnative': $sql .= " {$column_type} "; $sql_default = " {$column_type} "; @@ -1335,6 +1375,7 @@ class phpbb_db_tools break; case 'mssql': + case 'mssqlnative': $statements[] = 'ALTER TABLE [' . $table_name . '] ADD [' . $column_name . '] ' . $column_data['column_type_sql_default']; break; @@ -1455,6 +1496,7 @@ class phpbb_db_tools break; case 'mssql': + case 'mssqlnative': $statements[] = 'ALTER TABLE [' . $table_name . '] DROP COLUMN [' . $column_name . ']'; break; @@ -1549,6 +1591,7 @@ class phpbb_db_tools switch ($this->sql_layer) { case 'mssql': + case 'mssqlnative': $statements[] = 'DROP INDEX ' . $table_name . '.' . $index_name; break; @@ -1652,6 +1695,7 @@ class phpbb_db_tools break; case 'mssql': + case 'mssqlnative': $sql = "ALTER TABLE [{$table_name}] WITH NOCHECK ADD "; $sql .= "CONSTRAINT [PK_{$table_name}] PRIMARY KEY CLUSTERED ("; $sql .= '[' . implode("],\n\t\t[", $column) . ']'; @@ -1745,6 +1789,7 @@ class phpbb_db_tools break; case 'mssql': + case 'mssqlnative': $statements[] = 'CREATE UNIQUE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ') ON [PRIMARY]'; break; } @@ -1774,6 +1819,7 @@ class phpbb_db_tools break; case 'mssql': + case 'mssqlnative': $statements[] = 'CREATE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ') ON [PRIMARY]'; break; } @@ -1791,7 +1837,7 @@ class phpbb_db_tools { $index_array = array(); - if ($this->sql_layer == 'mssql') + if ($this->sql_layer == 'mssql' || $this->sql_layer == 'mssqlnative') { $sql = "EXEC sp_statistics '$table_name'"; $result = $this->db->sql_query($sql); @@ -1900,6 +1946,7 @@ class phpbb_db_tools break; case 'mssql': + case 'mssqlnative': $statements[] = 'ALTER TABLE [' . $table_name . '] ALTER COLUMN [' . $column_name . '] ' . $column_data['column_type_sql']; if (!empty($column_data['default'])) diff --git a/phpBB/includes/db/mssqlnative.php b/phpBB/includes/db/mssqlnative.php new file mode 100644 index 0000000000..c3657d2708 --- /dev/null +++ b/phpBB/includes/db/mssqlnative.php @@ -0,0 +1,608 @@ +m_cursor = 0; + $this->m_rows = array(); + $this->m_num_fields = sqlsrv_num_fields($queryresult); + $this->m_field_meta = sqlsrv_field_metadata($queryresult); + + while ($row = sqlsrv_fetch_array($queryresult, SQLSRV_FETCH_ASSOC)) + { + if ($row !== null) + { + foreach($row as $k => $v) + { + if (is_object($v) && method_exists($v, 'format')) + { + $row[$k] = $v->format("Y-m-d\TH:i:s\Z"); + } + } + $this->m_rows[] = $row;//read results into memory, cursors are not supported + } + } + + $this->m_row_count = count($this->m_rows); + sqlsrv_free_stmt($queryresult); + } + + private function array_to_obj($array, &$obj) + { + foreach ($array as $key => $value) + { + if (is_array($value)) + { + $obj->$key = new stdClass(); + array_to_obj($value, $obj->$key); + } + else + { + $obj->$key = $value; + } + } + return $obj; + } + + public function fetch($mode = SQLSRV_FETCH_BOTH, $object_class = 'stdClass') + { + if ($this->m_cursor >= $this->m_row_count || $this->m_row_count == 0) + { + return false; + } + + $ret = false; + $arr_num = array(); + + if ($mode == SQLSRV_FETCH_NUMERIC || $mode == SQLSRV_FETCH_BOTH) + { + foreach($this->m_rows[$this->m_cursor] as $key => $value) + { + $arr_num[] = $value; + } + } + + switch ($mode) + { + case SQLSRV_FETCH_ASSOC: + $ret = $this->m_rows[$this->m_cursor]; + break; + case SQLSRV_FETCH_NUMERIC: + $ret = $arr_num; + break; + case 'OBJECT': + $ret = $this->array_to_obj($this->m_rows[$this->m_cursor], $o = new $object_class); + break; + case SQLSRV_FETCH_BOTH: + default: + $ret = $this->m_rows[$this->m_cursor] + $arr_num; + break; + } + $this->m_cursor++; + return $ret; + } + + public function get($pos, $fld) + { + return $this->m_rows[$pos][$fld]; + } + + public function num_rows() + { + return $this->m_row_count; + } + + public function seek($iRow) + { + $this->m_cursor = min($iRow, $this->m_row_count); + } + + public function num_fields() + { + return $this->m_num_fields; + } + + public function field_name($nr) + { + $arr_keys = array_keys($this->m_rows[0]); + return $arr_keys[$nr]; + } + + public function field_type($nr) + { + $i = 0; + $int_type = -1; + $str_type = ''; + + foreach ($this->m_field_meta as $meta) + { + if ($nr == $i) + { + $int_type = $meta['Type']; + break; + } + $i++; + } + + //http://msdn.microsoft.com/en-us/library/cc296183.aspx contains type table + switch ($int_type) + { + case SQLSRV_SQLTYPE_BIGINT: $str_type = 'bigint'; break; + case SQLSRV_SQLTYPE_BINARY: $str_type = 'binary'; break; + case SQLSRV_SQLTYPE_BIT: $str_type = 'bit'; break; + case SQLSRV_SQLTYPE_CHAR: $str_type = 'char'; break; + case SQLSRV_SQLTYPE_DATETIME: $str_type = 'datetime'; break; + case SQLSRV_SQLTYPE_DECIMAL/*($precision, $scale)*/: $str_type = 'decimal'; break; + case SQLSRV_SQLTYPE_FLOAT: $str_type = 'float'; break; + case SQLSRV_SQLTYPE_IMAGE: $str_type = 'image'; break; + case SQLSRV_SQLTYPE_INT: $str_type = 'int'; break; + case SQLSRV_SQLTYPE_MONEY: $str_type = 'money'; break; + case SQLSRV_SQLTYPE_NCHAR/*($charCount)*/: $str_type = 'nchar'; break; + case SQLSRV_SQLTYPE_NUMERIC/*($precision, $scale)*/: $str_type = 'numeric'; break; + case SQLSRV_SQLTYPE_NVARCHAR/*($charCount)*/: $str_type = 'nvarchar'; break; + case SQLSRV_SQLTYPE_NTEXT: $str_type = 'ntext'; break; + case SQLSRV_SQLTYPE_REAL: $str_type = 'real'; break; + case SQLSRV_SQLTYPE_SMALLDATETIME: $str_type = 'smalldatetime'; break; + case SQLSRV_SQLTYPE_SMALLINT: $str_type = 'smallint'; break; + case SQLSRV_SQLTYPE_SMALLMONEY: $str_type = 'smallmoney'; break; + case SQLSRV_SQLTYPE_TEXT: $str_type = 'text'; break; + case SQLSRV_SQLTYPE_TIMESTAMP: $str_type = 'timestamp'; break; + case SQLSRV_SQLTYPE_TINYINT: $str_type = 'tinyint'; break; + case SQLSRV_SQLTYPE_UNIQUEIDENTIFIER: $str_type = 'uniqueidentifier'; break; + case SQLSRV_SQLTYPE_UDT: $str_type = 'UDT'; break; + case SQLSRV_SQLTYPE_VARBINARY/*($byteCount)*/: $str_type = 'varbinary'; break; + case SQLSRV_SQLTYPE_VARCHAR/*($charCount)*/: $str_type = 'varchar'; break; + case SQLSRV_SQLTYPE_XML: $str_type = 'xml'; break; + default: $str_type = $int_type; + } + return $str_type; + } + + public function free() + { + unset($this->m_rows); + return; + } +} + +/** +* @package dbal +*/ +class dbal_mssqlnative extends dbal +{ + var $m_insert_id = NULL; + var $last_query_text = ''; + + /** + * Connect to server + */ + function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) + { + # Test for driver support, to avoid suppressed fatal error + if (!function_exists('sqlsrv_connect')) + { + trigger_error('Native MS SQL Server driver for PHP is missing or needs to be updated. Version 1.1 or later is required to install phpBB3. You can download the driver from: http://www.microsoft.com/sqlserver/2005/en/us/PHP-Driver.aspx\n', E_USER_ERROR); + } + + //set up connection variables + $this->persistency = $persistency; + $this->user = $sqluser; + $this->dbname = $database; + $port_delimiter = (defined('PHP_OS') && substr(PHP_OS, 0, 3) === 'WIN') ? ',' : ':'; + $this->server = $sqlserver . (($port) ? $port_delimiter . $port : ''); + + //connect to database + error_reporting(E_ALL); + $this->db_connect_id = sqlsrv_connect($this->server, array( + 'Database' => $this->dbname, + 'UID' => $this->user, + 'PWD' => $sqlpassword + )); + + return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error(''); + } + + /** + * Version information about used database + * @param bool $raw if true, only return the fetched sql_server_version + * @return string sql server version + */ + function sql_server_info($raw = false) + { + global $cache; + + if (empty($cache) || ($this->sql_server_version = $cache->get('mssql_version')) === false) + { + $arr_server_info = sqlsrv_server_info($this->db_connect_id); + $this->sql_server_version = $arr_server_info['SQLServerVersion']; + + if (!empty($cache)) + { + $cache->put('mssql_version', $this->sql_server_version); + } + } + + if ($raw) + { + return $this->sql_server_version; + } + + return ($this->sql_server_version) ? 'MSSQL
        ' . $this->sql_server_version : 'MSSQL'; + } + + /** + * SQL Transaction + * @access private + */ + function _sql_transaction($status = 'begin') + { + switch ($status) + { + case 'begin': + return sqlsrv_begin_transaction($this->db_connect_id); + break; + + case 'commit': + return sqlsrv_commit($this->db_connect_id); + break; + + case 'rollback': + return sqlsrv_rollback($this->db_connect_id); + break; + } + return true; + } + + /** + * Base query method + * + * @param string $query Contains the SQL query which shall be executed + * @param int $cache_ttl Either 0 to avoid caching or the time in seconds which the result shall be kept in cache + * @return mixed When casted to bool the returned value returns true on success and false on failure + * + * @access public + */ + function sql_query($query = '', $cache_ttl = 0) + { + if ($query != '') + { + global $cache; + + // EXPLAIN only in extra debug mode + if (defined('DEBUG_EXTRA')) + { + $this->sql_report('start', $query); + } + + $this->last_query_text = $query; + $this->query_result = ($cache_ttl && method_exists($cache, 'sql_load')) ? $cache->sql_load($query) : false; + $this->sql_add_num_queries($this->query_result); + + if ($this->query_result === false) + { + if (($this->query_result = @sqlsrv_query($this->db_connect_id, $query)) === false) + { + $this->sql_error($query); + } + + if (defined('DEBUG_EXTRA')) + { + $this->sql_report('stop', $query); + } + + if ($cache_ttl && method_exists($cache, 'sql_save')) + { + $this->open_queries[(int) $this->query_result] = $this->query_result; + $cache->sql_save($query, $this->query_result, $cache_ttl); + } + else if (strpos($query, 'SELECT') === 0 && $this->query_result) + { + $this->open_queries[(int) $this->query_result] = $this->query_result; + } + } + else if (defined('DEBUG_EXTRA')) + { + $this->sql_report('fromcache', $query); + } + } + else + { + return false; + } + return $this->query_result; + } + + /** + * Build LIMIT query + */ + function _sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0) + { + $this->query_result = false; + + if ($offset === false || $offset == 0) + { + if (strpos($query, "SELECT") === false) + { + $query = "TOP {$total} " . $query; + } + else + { + $query = preg_replace('/SELECT(\s*DISTINCT)?/Dsi', 'SELECT$1 TOP '.$total, $query); + } + } + else + { + $query = preg_replace('/SELECT(\s*DISTINCT)?/Dsi', 'SELECT$1 TOP(10000000) ', $query); + $query = 'SELECT * + FROM (SELECT sub2.*, ROW_NUMBER() OVER(ORDER BY sub2.line2) AS line3 + FROM (SELECT 1 AS line2, sub1.* FROM (' . $query . ') AS sub1) as sub2) AS sub3 + WHERE line3 BETWEEN ' . ($offset+1) . ' AND ' . ($offset + $total); + } + + $result = $this->sql_query($query, $cache_ttl); + + return $result; + } + + /** + * Return number of affected rows + */ + function sql_affectedrows() + { + return ($this->db_connect_id) ? @sqlsrv_rows_affected($this->db_connect_id) : false; + } + + /** + * Fetch current row + */ + function sql_fetchrow($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if (isset($cache->sql_rowset[$query_id])) + { + return $cache->sql_fetchrow($query_id); + } + + if ($query_id === false) + { + return false; + } + + $row = @sqlsrv_fetch_array($query_id, SQLSRV_FETCH_ASSOC); + + // I hope i am able to remove this later... hopefully only a PHP or MSSQL bug + if ($row) + { + foreach ($row as $key => $value) + { + $row[$key] = ($value === ' ' || $value === NULL) ? '' : $value; + } + } + return $row; + } + + /** + * Seek to given row number + * rownum is zero-based + */ + function sql_rowseek($rownum, &$query_id) + { + global $cache; + + if (isset($cache->sql_rowset[$query_id])) + { + return $cache->sql_rowseek($rownum, $query_id); + } + + $seek = new result_mssqlnative($query_id); + $row = $seek->seek($rownum); + return ($row = $seek->fetch()) ? $row : false; + } + + /** + * Get last inserted id after insert statement + */ + function sql_nextid() + { + $result_id = @sqlsrv_query($this->db_connect_id, 'SELECT @@IDENTITY'); + + if ($result_id !== false) + { + $row = @sqlsrv_fetch_array($result_id); + $id = $row[0]; + @sqlsrv_free_stmt($result_id); + return $id; + } + else + { + return false; + } + } + + /** + * Free sql result + */ + function sql_freeresult($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if (isset($cache->sql_rowset[$query_id])) + { + return $cache->sql_freeresult($query_id); + } + + if (isset($this->open_queries[$query_id])) + { + unset($this->open_queries[$query_id]); + return @sqlsrv_free_stmt($query_id); + } + return false; + } + + /** + * Escape string used in sql query + */ + function sql_escape($msg) + { + return str_replace(array("'", "\0"), array("''", ''), $msg); + } + + /** + * Build LIKE expression + * @access private + */ + function _sql_like_expression($expression) + { + return $expression . " ESCAPE '\\'"; + } + + /** + * return sql error array + * @access private + */ + function _sql_error() + { + $errors = @sqlsrv_errors(SQLSRV_ERR_ERRORS); + $error_message = ''; + + if ($errors != null) + { + foreach ($errors as $error) + { + $error_message .= "SQLSTATE: ".$error[ 'SQLSTATE']."\n"; + $error_message .= "code: ".$error[ 'code']."\n"; + $error_message .= "message: ".$error[ 'message']."\n"; + } + $this->last_error_result = $error_message; + $error = $this->last_error_result; + } + else + { + $error = (isset($this->last_error_result) && $this->last_error_result) ? $this->last_error_result : array(); + } + return $error; + } + + /** + * Build db-specific query data + * @access private + */ + function _sql_custom_build($stage, $data) + { + return $data; + } + + /** + * Close sql connection + * @access private + */ + function _sql_close() + { + return @sqlsrv_close($this->db_connect_id); + } + + /** + * Build db-specific report + * @access private + */ + function _sql_report($mode, $query = '') + { + switch ($mode) + { + case 'start': + $html_table = false; + @sqlsrv_query($this->db_connect_id, 'SET SHOWPLAN_TEXT ON;'); + if ($result = @sqlsrv_query($this->db_connect_id, $query)) + { + @sqlsrv_next_result($result); + while ($row = @sqlsrv_fetch_array($result)) + { + $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); + } + } + @sqlsrv_query($this->db_connect_id, 'SET SHOWPLAN_TEXT OFF;'); + @sqlsrv_free_stmt($result); + + if ($html_table) + { + $this->html_hold .= ''; + } + break; + + case 'fromcache': + $endtime = explode(' ', microtime()); + $endtime = $endtime[0] + $endtime[1]; + + $result = @sqlsrv_query($this->db_connect_id, $query); + while ($void = @sqlsrv_fetch_array($result)) + { + // Take the time spent on parsing rows into account + } + @sqlsrv_free_stmt($result); + + $splittime = explode(' ', microtime()); + $splittime = $splittime[0] + $splittime[1]; + + $this->sql_report('record_fromcache', $query, $endtime, $splittime); + + break; + } + } + + /** + * Utility method used to retrieve number of rows + * Emulates mysql_num_rows + * Used in acp_database.php -> write_data_mssqlnative() + */ + function mssqlnative_num_rows($res) + { + if ($res !== false) + { + $row = new result_mssqlnative($res); + $num_rows = $row->num_rows(); + return $num_rows; + } + else + { + return false; + } + } +} + +?> \ No newline at end of file diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index ff291fbe8a..ea64bb3beb 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -3041,6 +3041,7 @@ function get_database_size() case 'mssql': case 'mssql_odbc': + case 'mssqlnative': $sql = 'SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize FROM sysfiles'; $result = $db->sql_query($sql, 7200); diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 8a1d07c8e5..8b3c6ea8db 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -1643,6 +1643,7 @@ function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting = ACL_NO) case 'mssql': case 'sqlite': + case 'mssqlnative': $sql = implode(' UNION ALL ', preg_replace('#^(.*?)$#', 'SELECT \1', $sql_subary)); break; diff --git a/phpBB/includes/functions_install.php b/phpBB/includes/functions_install.php index 1b9c66fc84..992e8d6bb0 100644 --- a/phpBB/includes/functions_install.php +++ b/phpBB/includes/functions_install.php @@ -95,6 +95,16 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20 'AVAILABLE' => true, '2.0.x' => true, ), + 'mssqlnative' => array( + 'LABEL' => 'MS SQL Server 2005+ [ Native ]', + 'SCHEMA' => 'mssql', + 'MODULE' => 'sqlsrv', + 'DELIM' => 'GO', + 'COMMENTS' => 'remove_comments', + 'DRIVER' => 'mssqlnative', + 'AVAILABLE' => true, + '2.0.x' => false, + ), 'oracle' => array( 'LABEL' => 'Oracle', 'SCHEMA' => 'oracle', @@ -220,6 +230,7 @@ function get_tables($db) case 'mssql': case 'mssql_odbc': + case 'mssqlnative': $sql = "SELECT name FROM sysobjects WHERE type='U'"; @@ -313,6 +324,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, case 'mssql': case 'mssql_odbc': + case 'mssqlnative': $prefix_length = 90; break; diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 8979511d9a..50aad8588a 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -1284,6 +1284,7 @@ class parse_message extends bbcode_firstpass { case 'mssql': case 'mssql_odbc': + case 'mssqlnative': $sql = 'SELECT * FROM ' . SMILIES_TABLE . ' ORDER BY LEN(code) DESC'; diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 4efc52088f..055fa78995 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1743,7 +1743,37 @@ class updater_db_tools 'VCHAR_CI' => '[varchar] (255)', 'VARBINARY' => '[varchar] (255)', ), - + + 'mssqlnative' => array( + 'INT:' => '[int]', + 'BINT' => '[float]', + 'UINT' => '[int]', + 'UINT:' => '[int]', + 'TINT:' => '[int]', + 'USINT' => '[int]', + 'BOOL' => '[int]', + 'VCHAR' => '[varchar] (255)', + 'VCHAR:' => '[varchar] (%d)', + 'CHAR:' => '[char] (%d)', + 'XSTEXT' => '[varchar] (1000)', + 'STEXT' => '[varchar] (3000)', + 'TEXT' => '[varchar] (8000)', + 'MTEXT' => '[text]', + 'XSTEXT_UNI'=> '[varchar] (100)', + 'STEXT_UNI' => '[varchar] (255)', + 'TEXT_UNI' => '[varchar] (4000)', + 'MTEXT_UNI' => '[text]', + 'TIMESTAMP' => '[int]', + 'DECIMAL' => '[float]', + 'DECIMAL:' => '[float]', + 'PDECIMAL' => '[float]', + 'PDECIMAL:' => '[float]', + 'VCHAR_UNI' => '[varchar] (255)', + 'VCHAR_UNI:'=> '[varchar] (%d)', + 'VCHAR_CI' => '[varchar] (255)', + 'VARBINARY' => '[varchar] (255)', + ), + 'oracle' => array( 'INT:' => 'number(%d)', 'BINT' => 'number(20)', @@ -1845,7 +1875,7 @@ class updater_db_tools * A list of supported DBMS. We change this class to support more DBMS, the DBMS itself only need to follow some rules. * @var array */ - var $supported_dbms = array('firebird', 'mssql', 'mysql_40', 'mysql_41', 'oracle', 'postgres', 'sqlite'); + var $supported_dbms = array('firebird', 'mssql', 'mssqlnative', 'mysql_40', 'mysql_41', 'oracle', 'postgres', 'sqlite'); /** * This is set to true if user only wants to return the 'to-be-executed' SQL statement(s) (as an array). @@ -1890,6 +1920,10 @@ class updater_db_tools case 'mssql_odbc': $this->sql_layer = 'mssql'; break; + + case 'mssqlnative': + $this->sql_layer = 'mssqlnative'; + break; default: $this->sql_layer = $this->db->sql_layer; @@ -2322,6 +2356,7 @@ class updater_db_tools // same deal with PostgreSQL, we must perform more complex operations than // we technically could case 'mssql': + case 'mssqlnative': $sql = "SELECT c.name FROM syscolumns c LEFT JOIN sysobjects o ON c.id = o.id @@ -2425,7 +2460,7 @@ class updater_db_tools */ function sql_index_exists($table_name, $index_name) { - if ($this->sql_layer == 'mssql') + if ($this->sql_layer == 'mssql' || $this->sql_layer == 'mssqlnative') { $sql = "EXEC sp_statistics '$table_name'"; $result = $this->db->sql_query($sql); @@ -2530,7 +2565,7 @@ class updater_db_tools */ function sql_unique_index_exists($table_name, $index_name) { - if ($this->sql_layer == 'mssql') + if ($this->sql_layer == 'mssql' || $this->sql_layer == 'mssqlnative') { $sql = "EXEC sp_statistics '$table_name'"; $result = $this->db->sql_query($sql); @@ -2769,6 +2804,7 @@ class updater_db_tools break; case 'mssql': + case 'mssqlnative': $sql .= " {$column_type} "; $sql_default = " {$column_type} "; @@ -2918,6 +2954,7 @@ class updater_db_tools break; case 'mssql': + case 'mssqlnative': // Does not support AFTER, only through temporary table $statements[] = 'ALTER TABLE [' . $table_name . '] ADD [' . $column_name . '] ' . $column_data['column_type_sql_default']; break; @@ -3042,6 +3079,7 @@ class updater_db_tools break; case 'mssql': + case 'mssqlnative': $statements[] = 'ALTER TABLE [' . $table_name . '] DROP COLUMN [' . $column_name . ']'; break; @@ -3136,6 +3174,7 @@ class updater_db_tools switch ($this->sql_layer) { case 'mssql': + case 'mssqlnative': $statements[] = 'DROP INDEX ' . $table_name . '.' . $index_name; break; @@ -3172,6 +3211,7 @@ class updater_db_tools break; case 'mssql': + case 'mssqlnative': $sql = "ALTER TABLE [{$table_name}] WITH NOCHECK ADD "; $sql .= "CONSTRAINT [PK_{$table_name}] PRIMARY KEY CLUSTERED ("; $sql .= '[' . implode("],\n\t\t[", $column) . ']'; @@ -3265,6 +3305,7 @@ class updater_db_tools break; case 'mssql': + case 'mssqlnative': $statements[] = 'CREATE UNIQUE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ') ON [PRIMARY]'; break; } @@ -3294,6 +3335,7 @@ class updater_db_tools break; case 'mssql': + case 'mssqlnative': $statements[] = 'CREATE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ') ON [PRIMARY]'; break; } @@ -3326,6 +3368,7 @@ class updater_db_tools break; case 'mssql': + case 'mssqlnative': $statements[] = 'ALTER TABLE [' . $table_name . '] ALTER COLUMN [' . $column_name . '] ' . $column_data['column_type_sql']; if (!empty($column_data['default'])) diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php index 7f1b9de5b6..06c3a8b4a6 100644 --- a/phpBB/install/install_convert.php +++ b/phpBB/install/install_convert.php @@ -1248,6 +1248,7 @@ class install_convert extends module { case 'mssql': case 'mssql_odbc': + case 'mssqlnative': $db->sql_query('SET IDENTITY_INSERT ' . $schema['target'] . ' ON'); break; } @@ -1375,6 +1376,7 @@ class install_convert extends module { case 'mssql': case 'mssql_odbc': + case 'mssqlnative': $db->sql_query('SET IDENTITY_INSERT ' . $schema['target'] . ' OFF'); break; diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 1cc1365752..f4989b5bd7 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1203,6 +1203,7 @@ class install_install extends module { case 'mssql': case 'mssql_odbc': + case 'mssqlnative': $sql_query = preg_replace('#\# MSSQL IDENTITY (phpbb_[a-z_]+) (ON|OFF) \##s', 'SET IDENTITY_INSERT \1 \2;', $sql_query); break; @@ -1375,7 +1376,7 @@ class install_install extends module $sql_ary[] = 'UPDATE ' . $data['table_prefix'] . "config SET config_value = 'phpbb_captcha_gd' WHERE config_name = 'captcha_plugin'"; - + $sql_ary[] = 'UPDATE ' . $data['table_prefix'] . "config SET config_value = '1' WHERE config_name = 'captcha_gd'"; diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql index 960c6eeaed..0827b14cc2 100644 --- a/phpBB/install/schemas/mssql_schema.sql +++ b/phpBB/install/schemas/mssql_schema.sql @@ -4,9 +4,6 @@ */ -BEGIN TRANSACTION -GO - /* Table: 'phpbb_attachments' */ @@ -1733,8 +1730,3 @@ ALTER TABLE [phpbb_zebra] WITH NOCHECK ADD ) ON [PRIMARY] GO - - -COMMIT -GO - diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 9543c712da..1c27e2f40d 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -147,6 +147,7 @@ $lang = array_merge($lang, array( 'DLL_MBSTRING' => 'Multi-byte character support', 'DLL_MSSQL' => 'MSSQL Server 2000+', 'DLL_MSSQL_ODBC' => 'MSSQL Server 2000+ via ODBC', + 'DLL_MSSQLNATIVE' => 'MSSQL Server 2005+ [ Native ]', 'DLL_MYSQL' => 'MySQL', 'DLL_MYSQLI' => 'MySQL with MySQLi Extension', 'DLL_ORACLE' => 'Oracle', @@ -214,6 +215,7 @@ $lang = array_merge($lang, array(
      49. SQLite 2.8.2+
      50. Firebird 2.1+
      51. MS SQL Server 2000 or above (directly or via ODBC)
      52. +
      53. MS SQL Server 2005 or above (native)
      54. Oracle
      55. From 7332b3b741332479726ebb203f821eab5186cb3b Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 11 Feb 2010 00:05:32 +0000 Subject: [PATCH 018/393] Forgot to properly update the file header of mssqlnative.php, revising r10489 [Bug #57055] git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10490 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/db/mssqlnative.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/db/mssqlnative.php b/phpBB/includes/db/mssqlnative.php index c3657d2708..08ee70907c 100644 --- a/phpBB/includes/db/mssqlnative.php +++ b/phpBB/includes/db/mssqlnative.php @@ -2,10 +2,12 @@ /** * * @package dbal +* @version $Id$ +* @copyright (c) 2010 phpBB Group +* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* * This is the MS SQL Server Native database abstraction layer. * PHP mssql native driver required. -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License * @author Chris Pucci * */ From c6e176d88edb882a1cc02a4f6d83114554b38121 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 15 Feb 2010 15:04:44 +0000 Subject: [PATCH 019/393] Add sql_bit_or() dbal method. Add ability to enable quick reply in all forums. -- Voila ;-) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10491 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_board.php | 23 +++++++++++++++++++++-- phpBB/includes/db/dbal.php | 18 ++++++++++++++++++ phpBB/includes/db/firebird.php | 5 +++++ phpBB/includes/db/oracle.php | 5 +++++ phpBB/includes/functions_admin.php | 20 ++++++++++++++++++++ phpBB/language/en/acp/board.php | 1 + 7 files changed, 71 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 6121d8ad1a..4b614ea0f5 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -97,6 +97,7 @@
      56. [Fix] No longer return the character O in generated random strings and passwords. (Bug #57345)
      57. [Fix] Some XHTML corrections in subsilver2. (Bug #57505)
      58. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
      59. +
      60. [Feature] Add ability to enable quick reply in all forums.
      61. 1.ii. Changes since 3.0.6

        diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 20a63e646e..7b37510229 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -34,7 +34,7 @@ class acp_board $user->add_lang('acp/board'); $action = request_var('action', ''); - $submit = (isset($_POST['submit'])) ? true : false; + $submit = (isset($_POST['submit']) || isset($_POST['allow_quick_reply_enable'])) ? true : false; $form_key = 'acp_board'; add_form_key($form_key); @@ -89,7 +89,7 @@ class acp_board 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_birthdays' => array('lang' => 'ALLOW_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'custom', 'method' => 'quick_reply', 'explain' => true), 'legend2' => 'ACP_LOAD_SETTINGS', 'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), @@ -472,6 +472,11 @@ class acp_board if ($submit) { set_config($config_name, $config_value); + + if ($config_name == 'allow_quick_reply' && isset($_POST['allow_quick_reply_enable'])) + { + enable_bitfield_column_flag(FORUMS_TABLE, 'forum_flags', log(FORUM_FLAG_QUICK_REPLY, 2)); + } } } @@ -858,6 +863,20 @@ class acp_board return h_radio('config[board_disable]', $radio_ary, $value) . '
        '; } + /** + * Global quick reply enable/disable setting and button to enable in all forums + */ + function quick_reply($value, $key) + { + global $user; + + $radio_ary = array(1 => 'YES', 0 => 'NO'); + + return h_radio('config[allow_quick_reply]', $radio_ary, $value) . + '

        '; + } + + /** * Select default dateformat */ diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php index a962696bb8..eeddf1f41b 100644 --- a/phpBB/includes/db/dbal.php +++ b/phpBB/includes/db/dbal.php @@ -429,6 +429,24 @@ class dbal return $column_name . ' & ' . (1 << $bit) . (($compare) ? ' ' . $compare : ''); } + /** + * Run binary OR operator on DB column. + * Results in sql statement: "{$column_name} | (1 << {$bit}) {$compare}" + * + * @param string $column_name The column name to use + * @param int $bit The value to use for the OR operator, will be converted to (1 << $bit). Is used by options, using the number schema... 0, 1, 2...29 + * @param string $compare Any custom SQL code after the check (for example "= 0") + */ + function sql_bit_or($column_name, $bit, $compare = '') + { + if (method_exists($this, '_sql_bit_or')) + { + return $this->_sql_bit_or($column_name, $bit, $compare); + } + + return $column_name . ' | ' . (1 << $bit) . (($compare) ? ' ' . $compare : ''); + } + /** * Run more than one insert statement. * diff --git a/phpBB/includes/db/firebird.php b/phpBB/includes/db/firebird.php index fb1ef44c55..e554b0f2fb 100644 --- a/phpBB/includes/db/firebird.php +++ b/phpBB/includes/db/firebird.php @@ -451,6 +451,11 @@ class dbal_firebird extends dbal return 'BIN_AND(' . $column_name . ', ' . (1 << $bit) . ')' . (($compare) ? ' ' . $compare : ''); } + function _sql_bit_or($column_name, $bit, $compare = '') + { + return 'BIN_OR(' . $column_name . ', ' . (1 << $bit) . ')' . (($compare) ? ' ' . $compare : ''); + } + /** * return sql error array * @access private diff --git a/phpBB/includes/db/oracle.php b/phpBB/includes/db/oracle.php index 63cdb7126d..55b3599800 100644 --- a/phpBB/includes/db/oracle.php +++ b/phpBB/includes/db/oracle.php @@ -622,6 +622,11 @@ class dbal_oracle extends dbal return 'BITAND(' . $column_name . ', ' . (1 << $bit) . ')' . (($compare) ? ' ' . $compare : ''); } + function _sql_bit_or($column_name, $bit, $compare = '') + { + return 'BITOR(' . $column_name . ', ' . (1 << $bit) . ')' . (($compare) ? ' ' . $compare : ''); + } + /** * return sql error array * @access private diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index ea64bb3beb..955ef4df58 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -3309,4 +3309,24 @@ function obtain_latest_version_info($force_update = false, $warn_fail = false, $ return $info; } +/** + * Enables a particular flag in a bitfield column of a given table. + * + * @param string $table_name The table to update + * @param string $column_name The column containing a bitfield to update + * @param int $flag The binary flag which is OR-ed with the current column value + * @param string $sql_more This string is attached to the sql query generated to update the table. + * + * @return void + */ +function enable_bitfield_column_flag($table_name, $column_name, $flag, $sql_more = '') +{ + global $db; + + $sql = 'UPDATE ' . $table_name . ' + SET ' . $column_name . ' = ' . $db->sql_bit_or($column_name, $flag) . ' + ' . $sql_more; + $db->sql_query($sql); +} + ?> \ No newline at end of file diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index daf83cfda0..878199f7d3 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -74,6 +74,7 @@ $lang = array_merge($lang, array( 'ALLOW_PM_REPORT_EXPLAIN' => 'If this setting is enabled, users have the option of reporting a private message they have received or sent to the board’s moderators. These private messages will then be visible in the Moderator Control Panel.', 'ALLOW_QUICK_REPLY' => 'Allow quick reply', 'ALLOW_QUICK_REPLY_EXPLAIN' => 'This setting defines if quick reply is enabled or not. If this setting is enabled, forums need to have their quick reply option enabled too.', + 'ALLOW_QUICK_REPLY_BUTTON' => 'Submit and enable quick reply in all forums', 'ALLOW_SIG' => 'Allow signatures', 'ALLOW_SIG_BBCODE' => 'Allow BBCode in user signatures', 'ALLOW_SIG_FLASH' => 'Allow use of [FLASH] BBCode tag in user signatures', From a0531a990b1b5a7cffbe98a8cd48b8a30b2da8a0 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 16 Feb 2010 10:42:24 +0000 Subject: [PATCH 020/393] r10491 - Also in the Post Settings section. Thanks leviatan21 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10492 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_board.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 7b37510229..a5feac1902 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -173,7 +173,7 @@ class acp_board 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'enable_post_confirm' => array('lang' => 'VISUAL_CONFIRM_POST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'custom', 'method' => 'quick_reply', 'explain' => true), 'legend2' => 'POSTING', 'bump_type' => false, From 68393ecc1cfd9cd9934e4e1f8767bb18e833abcd Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 16 Feb 2010 20:42:55 +0000 Subject: [PATCH 021/393] Fix Bug #57825 - Small language correction for the FAQ page. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10493 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/language/en/help_faq.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 4b614ea0f5..0204a1f3e8 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -96,6 +96,7 @@
      62. [Fix] Honor minimum and maximum password length in generated passwords as much as we can. (Bug #13181)
      63. [Fix] No longer return the character O in generated random strings and passwords. (Bug #57345)
      64. [Fix] Some XHTML corrections in subsilver2. (Bug #57505)
      65. +
      66. [Fix] Small language correction for the FAQ page. (Bug #57825)
      67. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
      68. [Feature] Add ability to enable quick reply in all forums.
      69. diff --git a/phpBB/language/en/help_faq.php b/phpBB/language/en/help_faq.php index 93ea1be5c8..c76c281df5 100644 --- a/phpBB/language/en/help_faq.php +++ b/phpBB/language/en/help_faq.php @@ -116,7 +116,7 @@ $help = array( ), array( 0 => 'How do I edit or delete a post?', - 1 => 'Unless you are a board administrator or moderator, you can only edit or delete your own posts. You can edit a post by clicking the edit button for the relevant post, sometimes for only a limited time after the post was made. If someone has already replied to the post, you will find a small piece of text output below the post when you return to the topic which lists the number of times you edited it along with the date and time. This will only appear if someone has made a reply; it will not appear if a moderator or administrator edited the post, though they may leave a note as to why they’ve edited the post at their own digression. Please note that normal users cannot delete a post once someone has replied.' + 1 => 'Unless you are a board administrator or moderator, you can only edit or delete your own posts. You can edit a post by clicking the edit button for the relevant post, sometimes for only a limited time after the post was made. If someone has already replied to the post, you will find a small piece of text output below the post when you return to the topic which lists the number of times you edited it along with the date and time. This will only appear if someone has made a reply; it will not appear if a moderator or administrator edited the post, though they may leave a note as to why they’ve edited the post at their own discretion. Please note that normal users cannot delete a post once someone has replied.' ), array( 0 => 'How do I add a signature to my post?', From e1ae09a7873817f37ef89b21985fd40822103ecc Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 17 Feb 2010 09:59:04 +0000 Subject: [PATCH 022/393] Let's fix #57825 in 3.0.7. - r10493 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10494 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 0204a1f3e8..bc692519bd 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -96,7 +96,6 @@
      70. [Fix] Honor minimum and maximum password length in generated passwords as much as we can. (Bug #13181)
      71. [Fix] No longer return the character O in generated random strings and passwords. (Bug #57345)
      72. [Fix] Some XHTML corrections in subsilver2. (Bug #57505)
      73. -
      74. [Fix] Small language correction for the FAQ page. (Bug #57825)
      75. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
      76. [Feature] Add ability to enable quick reply in all forums.
      77. @@ -171,6 +170,7 @@
      78. [Fix] Unify BBCode Selection across browsers. (Bug #38765)
      79. [Fix] Allow convertors to read in configuration from files. (Bug #57265 - Patch by Dicky)
      80. [Fix] Fix problems with firebird by no longer using 'count' as a column alias. (Bug #57455)
      81. +
      82. [Fix] Small language correction for the FAQ page. (Bug #57825)
      83. [Change] Move redirect into a hidden field to avoid issues with mod_security. (Bug #54145)
      84. [Change] Log activation through inactive users ACP. (Bug #30145)
      85. [Change] Send time of last item instead of current time in ATOM Feeds. (Bug #53305)
      86. From c0e9bc51265193fa495c0a6ae8b62273b5e30ec7 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 17 Feb 2010 12:49:05 +0000 Subject: [PATCH 023/393] Bug #57795 - [Fix] Restrict search for language/../iso.txt to folders. Authorised by: bantu git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10496 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_language.php | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index bc692519bd..85cbb47d3c 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -171,6 +171,7 @@
      87. [Fix] Allow convertors to read in configuration from files. (Bug #57265 - Patch by Dicky)
      88. [Fix] Fix problems with firebird by no longer using 'count' as a column alias. (Bug #57455)
      89. [Fix] Small language correction for the FAQ page. (Bug #57825)
      90. +
      91. [Fix] Restrict search for language/../iso.txt to folders. (Bug #57795)
      92. [Change] Move redirect into a hidden field to avoid issues with mod_security. (Bug #54145)
      93. [Change] Log activation through inactive users ACP. (Bug #30145)
      94. [Change] Send time of last item instead of current time in ATOM Feeds. (Bug #53305)
      95. diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php index 8ca45a27f6..fedae6fe67 100644 --- a/phpBB/includes/acp/acp_language.php +++ b/phpBB/includes/acp/acp_language.php @@ -1120,6 +1120,11 @@ class acp_language { while (($file = readdir($dp)) !== false) { + if (!is_dir($phpbb_root_path . 'language/' . $file)) + { + continue; + } + if ($file[0] != '.' && file_exists("{$phpbb_root_path}language/$file/iso.txt")) { if (!in_array($file, $installed)) From 68cac354aac9df3866944685186733c4d7305aee Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 17 Feb 2010 12:58:52 +0000 Subject: [PATCH 024/393] Add 3.0.7-RC1 to the updater. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10497 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 055fa78995..909c390a9e 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -906,6 +906,9 @@ function database_update_info() ), ), ), + + // No changes from 3.0.7-RC1 to 3.0.7 + '3.0.7-RC1' => array(), ); } @@ -1597,6 +1600,10 @@ function change_database_data(&$no_updates, $version) $no_updates = false; break; + + // No changes from 3.0.7-RC1 to 3.0.7 + case '3.0.7-RC1': + break; } } From 30b83896a1718400307de7d531c16a152c0f6668 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 18 Feb 2010 01:17:30 +0000 Subject: [PATCH 025/393] Fix Bug #57755 - Make user_email_hash() function independent from system's architecture. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10499 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions.php | 4 ++-- phpBB/includes/functions_convert.php | 4 +++- phpBB/install/database_update.php | 28 ++++++++++++++++++++++++++++ 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 85cbb47d3c..5b2dba6825 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -172,6 +172,7 @@
      96. [Fix] Fix problems with firebird by no longer using 'count' as a column alias. (Bug #57455)
      97. [Fix] Small language correction for the FAQ page. (Bug #57825)
      98. [Fix] Restrict search for language/../iso.txt to folders. (Bug #57795)
      99. +
      100. [Fix] Make user_email_hash() function independent from system's architecture. (Bug #57755)
      101. [Change] Move redirect into a hidden field to avoid issues with mod_security. (Bug #54145)
      102. [Change] Log activation through inactive users ACP. (Bug #30145)
      103. [Change] Send time of last item instead of current time in ATOM Feeds. (Bug #53305)
      104. diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 23221c69ea..913b1c0fa0 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -556,11 +556,11 @@ function _hash_crypt_private($password, $setting, &$itoa64) * * @param string $email Email address * -* @return string Big Integer +* @return string Unsigned Big Integer */ function phpbb_email_hash($email) { - return crc32(strtolower($email)) . strlen($email); + return sprintf('%u', crc32(strtolower($email))) . strlen($email); } /** diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 8b3c6ea8db..0fdae9b274 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -205,10 +205,12 @@ function get_group_id($group_name) /** * Generate the email hash stored in the users table +* +* Note: Deprecated, calls should directly go to phpbb_email_hash() */ function gen_email_hash($email) { - return (crc32(strtolower($email)) . strlen($email)); + return phpbb_email_hash($email); } /** diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 909c390a9e..29d82be987 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1603,6 +1603,34 @@ function change_database_data(&$no_updates, $version) // No changes from 3.0.7-RC1 to 3.0.7 case '3.0.7-RC1': + + $sql = 'SELECT user_id, user_email, user_email_hash + FROM ' . USERS_TABLE . ' + WHERE user_type <> ' . USER_IGNORE . " + AND user_email <> ''"; + $result = $db->sql_query($sql); + + $i = 0; + while ($row = $db->sql_fetchrow($result)) + { + $user_email_hash = phpbb_email_hash($row['user_email']); + + if ($user_email_hash != $row['user_email_hash']) + { + $sql_ary = array( + 'user_email_hash' => $user_email_hash, + ); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_id = ' . (int) $row['user_id']; + __sql($sql, $errored, $error_ary, ($i % 100 == 0)); + + ++$i; + } + } + $db->sql_freeresult($result); + break; } } From 9bcb25cd100ee898124294f0c13a4b724892926e Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 18 Feb 2010 01:23:31 +0000 Subject: [PATCH 026/393] We can put the fix for #57505 into 3.0.7 because we have to regenerate the packages with the template changes anyway. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10500 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 5b2dba6825..411e399124 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -95,7 +95,6 @@
      105. [Fix] Take admin's time zone settings into account when listing database backup files. (Bug #57385)
      106. [Fix] Honor minimum and maximum password length in generated passwords as much as we can. (Bug #13181)
      107. [Fix] No longer return the character O in generated random strings and passwords. (Bug #57345)
      108. -
      109. [Fix] Some XHTML corrections in subsilver2. (Bug #57505)
      110. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
      111. [Feature] Add ability to enable quick reply in all forums.
      112. @@ -112,7 +111,7 @@
      113. [Fix] Do not link to user profile in ATOM feed entry if post has been made by the guest user. (Bug #54275)
      114. [Fix] Make word censoring case insensitive. (Bug #54265)
      115. [Fix] Fulltext-MySQL search for keywords and username at the same time. (Bug #54325)
      116. -
      117. [Fix] Various XHTML and CSS mistakes in prosilver. (Bugs #54705, #55895)
      118. +
      119. [Fix] Various XHTML and CSS mistakes in prosilver and subsilver2. (Bugs #54705, #55895, #57505)
      120. [Fix] Correctly show topic ATOM feed link when only post id is specified. (Bug #53025)
      121. [Fix] Cleanly handle forum/topic not found in ATOM Feeds. (Bug #54295)
      122. [Fix] PHP 5.3 compatibility: Check if function dl() exists before calling it. (Bug #54665)
      123. From c02fedb6c7a80da0be5bd84fe512b3ba6df9f9ee Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 18 Feb 2010 02:01:32 +0000 Subject: [PATCH 027/393] Revising r10499, #57755 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10503 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 29d82be987..5cb2cd28cc 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1601,7 +1601,7 @@ function change_database_data(&$no_updates, $version) $no_updates = false; break; - // No changes from 3.0.7-RC1 to 3.0.7 + // Changes from 3.0.7-RC1 to 3.0.7 case '3.0.7-RC1': $sql = 'SELECT user_id, user_email, user_email_hash @@ -1624,13 +1624,15 @@ function change_database_data(&$no_updates, $version) $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . (int) $row['user_id']; - __sql($sql, $errored, $error_ary, ($i % 100 == 0)); + _sql($sql, $errored, $error_ary, ($i % 100 == 0)); ++$i; } } $db->sql_freeresult($result); + $no_updates = false; + break; } } From 576722cead7f2de34db3e5a853662bca0e0601da Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 18 Feb 2010 02:06:20 +0000 Subject: [PATCH 028/393] Adding 3.0.7-RC2 to database updater git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10504 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 5cb2cd28cc..4db78331bd 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -907,8 +907,10 @@ function database_update_info() ), ), - // No changes from 3.0.7-RC1 to 3.0.7 + // No changes from 3.0.7-RC1 to 3.0.7-RC2 '3.0.7-RC1' => array(), + // No changes from 3.0.7-RC2 to 3.0.7 + '3.0.7-RC2' => array(), ); } @@ -1601,7 +1603,7 @@ function change_database_data(&$no_updates, $version) $no_updates = false; break; - // Changes from 3.0.7-RC1 to 3.0.7 + // Changes from 3.0.7-RC1 to 3.0.7-RC2 case '3.0.7-RC1': $sql = 'SELECT user_id, user_email, user_email_hash @@ -1634,6 +1636,10 @@ function change_database_data(&$no_updates, $version) $no_updates = false; break; + + // No changes from 3.0.7-RC2 to 3.0.7 + case '3.0.7-RC2': + break; } } From d49806a04356c1aa51e4a45911df850f4318b6a5 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Thu, 18 Feb 2010 04:57:23 +0000 Subject: [PATCH 029/393] #57715 - Correct behavior of "force_approved_state" when value is false. (Merging r10507 into branches/phpBB-3_0_0) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10508 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 3 ++- phpBB/posting.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 411e399124..eb8d65a4ef 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -171,7 +171,8 @@
      124. [Fix] Fix problems with firebird by no longer using 'count' as a column alias. (Bug #57455)
      125. [Fix] Small language correction for the FAQ page. (Bug #57825)
      126. [Fix] Restrict search for language/../iso.txt to folders. (Bug #57795)
      127. -
      128. [Fix] Make user_email_hash() function independent from system's architecture. (Bug #57755)
      129. +
      130. [Fix] Make user_email_hash() function independent from system's architecture. (Bug #57755)
      131. +
      132. [Fix] Correct behavior of "force_approved_state" when value is false. (Bug #57715)
      133. [Change] Move redirect into a hidden field to avoid issues with mod_security. (Bug #54145)
      134. [Change] Log activation through inactive users ACP. (Bug #30145)
      135. [Change] Send time of last item instead of current time in ATOM Feeds. (Bug #53305)
      136. diff --git a/phpBB/posting.php b/phpBB/posting.php index d5a46db9f9..6a95dce489 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1113,7 +1113,7 @@ if ($submit || $preview || $refresh) } // Check the permissions for post approval. Moderators are not affected. - if ((!$auth->acl_get('f_noapprove', $data['forum_id']) && !$auth->acl_get('m_approve', $data['forum_id'])) || !empty($post_data['force_approved_state'])) + if ((!$auth->acl_get('f_noapprove', $data['forum_id']) && !$auth->acl_get('m_approve', $data['forum_id']) && empty($data['force_approved_state'])) || (isset($data['force_approved_state']) && !$data['force_approved_state'])) { meta_refresh(10, $redirect_url); $message = ($mode == 'edit') ? $user->lang['POST_EDITED_MOD'] : $user->lang['POST_STORED_MOD']; From 14b5aab07feda92f405adc699499438e40e3f371 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 20 Feb 2010 00:02:56 +0000 Subject: [PATCH 030/393] Firebird based board can now access their global announcements, took a while to discover this one. #57525 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10509 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/viewtopic.php | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index eb8d65a4ef..7a2c551af7 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -173,6 +173,7 @@
      137. [Fix] Restrict search for language/../iso.txt to folders. (Bug #57795)
      138. [Fix] Make user_email_hash() function independent from system's architecture. (Bug #57755)
      139. [Fix] Correct behavior of "force_approved_state" when value is false. (Bug #57715)
      140. +
      141. [Fix] Global announcements could not be accessed on a board using Firebird as the database server. (Bug #57525)
      142. [Change] Move redirect into a hidden field to avoid issues with mod_security. (Bug #54145)
      143. [Change] Log activation through inactive users ACP. (Bug #30145)
      144. [Change] Send time of last item instead of current time in ATOM Feeds. (Bug #53305)
      145. diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 8f42342a87..29c4e5cdc1 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -186,6 +186,13 @@ $sql_array = array( 'FROM' => array(FORUMS_TABLE => 'f'), ); +// Firebird handles two columns of the same name a little differently, this +// addresses that by forcing the forum_id to come from the forums table. +if ($db->sql_layer === 'firebird') +{ + $sql_array['SELECT'] = 'f.forum_id AS forum_id, ' . $sql_array['SELECT']; +} + // The FROM-Order is quite important here, else t.* columns can not be correctly bound. if ($post_id) { From 14e21a1a387d23ca83902922dc63fe9c4e940ab0 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Sat, 20 Feb 2010 16:18:28 +0000 Subject: [PATCH 031/393] warn users about TEXT git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10511 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/confirm_bbcode.html | 22 +++ phpBB/includes/acp/acp_bbcodes.php | 210 +++++++++++++++------------- phpBB/language/en/acp/posting.php | 3 + 3 files changed, 138 insertions(+), 97 deletions(-) create mode 100755 phpBB/adm/style/confirm_bbcode.html diff --git a/phpBB/adm/style/confirm_bbcode.html b/phpBB/adm/style/confirm_bbcode.html new file mode 100755 index 0000000000..52a6523984 --- /dev/null +++ b/phpBB/adm/style/confirm_bbcode.html @@ -0,0 +1,22 @@ + + +
        +
        +

        {L_WARNING}

        +

        {MESSAGE_TEXT}

        +
        +
        + + + {S_HIDDEN_FIELDS} + +
        +   + +
        + +
        + +
        + + diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index b827d1107e..681794c972 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -33,7 +33,7 @@ class acp_bbcodes // Set up general vars $action = request_var('action', ''); $bbcode_id = request_var('bbcode', 0); - + $this->tpl_name = 'acp_bbcodes'; $this->page_title = 'ACP_BBCODES'; $form_key = 'acp_bbcodes'; @@ -123,122 +123,138 @@ class acp_bbcodes case 'modify': case 'create': - - $data = $this->build_regexp($bbcode_match, $bbcode_tpl); - - // Make sure the user didn't pick a "bad" name for the BBCode tag. - $hard_coded = array('code', 'quote', 'quote=', 'attachment', 'attachment=', 'b', 'i', 'url', 'url=', 'img', 'size', 'size=', 'color', 'color=', 'u', 'list', 'list=', 'email', 'email=', 'flash', 'flash='); - - if (($action == 'modify' && strtolower($data['bbcode_tag']) !== strtolower($row['bbcode_tag'])) || ($action == 'create')) + + $warn_text = preg_match('%<[^>]*\{text[\d]*\}[^>]*>%i', $bbcode_tpl); + if (!$warn_text || confirm_box(true)) { - $sql = 'SELECT 1 as test - FROM ' . BBCODES_TABLE . " - WHERE LOWER(bbcode_tag) = '" . $db->sql_escape(strtolower($data['bbcode_tag'])) . "'"; - $result = $db->sql_query($sql); - $info = $db->sql_fetchrow($result); - $db->sql_freeresult($result); + $data = $this->build_regexp($bbcode_match, $bbcode_tpl); - // Grab the end, interrogate the last closing tag - if ($info['test'] === '1' || in_array(strtolower($data['bbcode_tag']), $hard_coded) || (preg_match('#\[/([^[]*)]$#', $bbcode_match, $regs) && in_array(strtolower($regs[1]), $hard_coded))) + // Make sure the user didn't pick a "bad" name for the BBCode tag. + $hard_coded = array('code', 'quote', 'quote=', 'attachment', 'attachment=', 'b', 'i', 'url', 'url=', 'img', 'size', 'size=', 'color', 'color=', 'u', 'list', 'list=', 'email', 'email=', 'flash', 'flash='); + + if (($action == 'modify' && strtolower($data['bbcode_tag']) !== strtolower($row['bbcode_tag'])) || ($action == 'create')) { - trigger_error($user->lang['BBCODE_INVALID_TAG_NAME'] . adm_back_link($this->u_action), E_USER_WARNING); - } - } + $sql = 'SELECT 1 as test + FROM ' . BBCODES_TABLE . " + WHERE LOWER(bbcode_tag) = '" . $db->sql_escape(strtolower($data['bbcode_tag'])) . "'"; + $result = $db->sql_query($sql); + $info = $db->sql_fetchrow($result); + $db->sql_freeresult($result); - if (substr($data['bbcode_tag'], -1) === '=') - { - $test = substr($data['bbcode_tag'], 0, -1); - } - else - { - $test = $data['bbcode_tag']; - } - - if (!preg_match('%\\[' . $test . '[^]]*].*?\\[/' . $test . ']%s', $bbcode_match)) - { - trigger_error($user->lang['BBCODE_OPEN_ENDED_TAG'] . adm_back_link($this->u_action), E_USER_WARNING); - } - - if (strlen($data['bbcode_tag']) > 16) - { - trigger_error($user->lang['BBCODE_TAG_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); - } - - if (strlen($bbcode_match) > 4000) - { - trigger_error($user->lang['BBCODE_TAG_DEF_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); - } - - - if (strlen($bbcode_helpline) > 255) - { - trigger_error($user->lang['BBCODE_HELPLINE_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); - } - - $sql_ary = array( - 'bbcode_tag' => $data['bbcode_tag'], - 'bbcode_match' => $bbcode_match, - 'bbcode_tpl' => $bbcode_tpl, - 'display_on_posting' => $display_on_posting, - 'bbcode_helpline' => $bbcode_helpline, - 'first_pass_match' => $data['first_pass_match'], - 'first_pass_replace' => $data['first_pass_replace'], - 'second_pass_match' => $data['second_pass_match'], - 'second_pass_replace' => $data['second_pass_replace'] - ); - - if ($action == 'create') - { - $sql = 'SELECT MAX(bbcode_id) as max_bbcode_id - FROM ' . BBCODES_TABLE; - $result = $db->sql_query($sql); - $row = $db->sql_fetchrow($result); - $db->sql_freeresult($result); - - if ($row) - { - $bbcode_id = $row['max_bbcode_id'] + 1; - - // Make sure it is greater than the core bbcode ids... - if ($bbcode_id <= NUM_CORE_BBCODES) + // Grab the end, interrogate the last closing tag + if ($info['test'] === '1' || in_array(strtolower($data['bbcode_tag']), $hard_coded) || (preg_match('#\[/([^[]*)]$#', $bbcode_match, $regs) && in_array(strtolower($regs[1]), $hard_coded))) { - $bbcode_id = NUM_CORE_BBCODES + 1; + trigger_error($user->lang['BBCODE_INVALID_TAG_NAME'] . adm_back_link($this->u_action), E_USER_WARNING); } } + + if (substr($data['bbcode_tag'], -1) === '=') + { + $test = substr($data['bbcode_tag'], 0, -1); + } else { - $bbcode_id = NUM_CORE_BBCODES + 1; + $test = $data['bbcode_tag']; } - if ($bbcode_id > 1511) + if (!preg_match('%\\[' . $test . '[^]]*].*?\\[/' . $test . ']%s', $bbcode_match)) { - trigger_error($user->lang['TOO_MANY_BBCODES'] . adm_back_link($this->u_action), E_USER_WARNING); + trigger_error($user->lang['BBCODE_OPEN_ENDED_TAG'] . adm_back_link($this->u_action), E_USER_WARNING); } - $sql_ary['bbcode_id'] = (int) $bbcode_id; + if (strlen($data['bbcode_tag']) > 16) + { + trigger_error($user->lang['BBCODE_TAG_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); + } - $db->sql_query('INSERT INTO ' . BBCODES_TABLE . $db->sql_build_array('INSERT', $sql_ary)); - $cache->destroy('sql', BBCODES_TABLE); + if (strlen($bbcode_match) > 4000) + { + trigger_error($user->lang['BBCODE_TAG_DEF_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + + if (strlen($bbcode_helpline) > 255) + { + trigger_error($user->lang['BBCODE_HELPLINE_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); + } - $lang = 'BBCODE_ADDED'; - $log_action = 'LOG_BBCODE_ADD'; + $sql_ary = array( + 'bbcode_tag' => $data['bbcode_tag'], + 'bbcode_match' => $bbcode_match, + 'bbcode_tpl' => $bbcode_tpl, + 'display_on_posting' => $display_on_posting, + 'bbcode_helpline' => $bbcode_helpline, + 'first_pass_match' => $data['first_pass_match'], + 'first_pass_replace' => $data['first_pass_replace'], + 'second_pass_match' => $data['second_pass_match'], + 'second_pass_replace' => $data['second_pass_replace'] + ); + + if ($action == 'create') + { + $sql = 'SELECT MAX(bbcode_id) as max_bbcode_id + FROM ' . BBCODES_TABLE; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $bbcode_id = $row['max_bbcode_id'] + 1; + + // Make sure it is greater than the core bbcode ids... + if ($bbcode_id <= NUM_CORE_BBCODES) + { + $bbcode_id = NUM_CORE_BBCODES + 1; + } + } + else + { + $bbcode_id = NUM_CORE_BBCODES + 1; + } + + if ($bbcode_id > 1511) + { + trigger_error($user->lang['TOO_MANY_BBCODES'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $sql_ary['bbcode_id'] = (int) $bbcode_id; + + $db->sql_query('INSERT INTO ' . BBCODES_TABLE . $db->sql_build_array('INSERT', $sql_ary)); + $cache->destroy('sql', BBCODES_TABLE); + + $lang = 'BBCODE_ADDED'; + $log_action = 'LOG_BBCODE_ADD'; + } + else + { + $sql = 'UPDATE ' . BBCODES_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE bbcode_id = ' . $bbcode_id; + $db->sql_query($sql); + $cache->destroy('sql', BBCODES_TABLE); + + $lang = 'BBCODE_EDITED'; + $log_action = 'LOG_BBCODE_EDIT'; + } + + add_log('admin', $log_action, $data['bbcode_tag']); + + trigger_error($user->lang[$lang] . adm_back_link($this->u_action)); } else - { - $sql = 'UPDATE ' . BBCODES_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' - WHERE bbcode_id = ' . $bbcode_id; - $db->sql_query($sql); - $cache->destroy('sql', BBCODES_TABLE); - - $lang = 'BBCODE_EDITED'; - $log_action = 'LOG_BBCODE_EDIT'; + { + confirm_box(false, $user->lang['BBCODE_DANGER'], build_hidden_fields(array( + 'action' => $action, + 'bbcode' => $bbcode_id, + 'bbcode_match' => $bbcode_match, + 'bbcode_tpl' => htmlspecialchars($bbcode_tpl), + 'bbcode_helpline' => $bbcode_helpline, + 'display_on_posting' => $display_on_posting, + )) + , 'confirm_bbcode.html'); } - add_log('admin', $log_action, $data['bbcode_tag']); - - trigger_error($user->lang[$lang] . adm_back_link($this->u_action)); - break; case 'delete': diff --git a/phpBB/language/en/acp/posting.php b/phpBB/language/en/acp/posting.php index 531e07f7ef..74cd29ffee 100644 --- a/phpBB/language/en/acp/posting.php +++ b/phpBB/language/en/acp/posting.php @@ -41,6 +41,9 @@ $lang = array_merge($lang, array( 'ACP_BBCODES_EXPLAIN' => 'BBCode is a special implementation of HTML offering greater control over what and how something is displayed. From this page you can add, remove and edit custom BBCodes.', 'ADD_BBCODE' => 'Add a new BBCode', + 'BBCODE_DANGER' => 'The BBCode you are trying to add seems to use a {TEXT} token inside a HTML attribute. This is a possible XSS security issue. Try using the more restrictive {SIMPLETEXT} type instead. Only proceed if you understand the risks involved and you consider the use of {TEXT} absolutely unavoidable.', + 'BBCODE_DANGER_PROCEED' => 'Proceed', //'I understand the risk', + 'BBCODE_ADDED' => 'BBCode added successfully.', 'BBCODE_EDITED' => 'BBCode edited successfully.', 'BBCODE_NOT_EXIST' => 'The BBCode you selected does not exist.', From a4727a0f816f67d2fb4a7f7dcf18aedf5278bc62 Mon Sep 17 00:00:00 2001 From: Yuriy Rusko Date: Sat, 20 Feb 2010 22:36:22 +0000 Subject: [PATCH 032/393] Bugs #53925 and #52085 - Language fixes related to the quick reply settings git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10514 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/acp/board.php | 2 +- phpBB/language/en/acp/forums.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 878199f7d3..7f07237fbf 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -73,7 +73,7 @@ $lang = array_merge($lang, array( 'ALLOW_PM_REPORT' => 'Allow users to report private messages', 'ALLOW_PM_REPORT_EXPLAIN' => 'If this setting is enabled, users have the option of reporting a private message they have received or sent to the board’s moderators. These private messages will then be visible in the Moderator Control Panel.', 'ALLOW_QUICK_REPLY' => 'Allow quick reply', - 'ALLOW_QUICK_REPLY_EXPLAIN' => 'This setting defines if quick reply is enabled or not. If this setting is enabled, forums need to have their quick reply option enabled too.', + 'ALLOW_QUICK_REPLY_EXPLAIN' => 'This switch allows for the quick reply to be disabled board-wide. When enabled, forum specific settings will be used to determine whether the quick reply is displayed in individual forums.', 'ALLOW_QUICK_REPLY_BUTTON' => 'Submit and enable quick reply in all forums', 'ALLOW_SIG' => 'Allow signatures', 'ALLOW_SIG_BBCODE' => 'Allow BBCode in user signatures', diff --git a/phpBB/language/en/acp/forums.php b/phpBB/language/en/acp/forums.php index 86ce5f5ac8..eab027f295 100644 --- a/phpBB/language/en/acp/forums.php +++ b/phpBB/language/en/acp/forums.php @@ -66,7 +66,7 @@ $lang = array_merge($lang, array( 'ENABLE_POST_REVIEW' => 'Enable post review', 'ENABLE_POST_REVIEW_EXPLAIN' => 'If set to yes users are able to review their post if new posts were made to the topic while users wrote theirs. This should be disabled for chat forums.', 'ENABLE_QUICK_REPLY' => 'Enable quick reply', - 'ENABLE_QUICK_REPLY_EXPLAIN' => 'If set to yes users get a quick reply box for this forum. If the global option for quick reply is disabled or the forum not postable to the quick reply box will not be displayed, even if set to yes here.', + 'ENABLE_QUICK_REPLY_EXPLAIN' => 'Enables the quick reply in this forum. This setting is not considered if the quick reply is disabled board wide. The quick reply will only be displayed for users who have permission to post in this forum.', 'ENABLE_RECENT' => 'Display active topics', 'ENABLE_RECENT_EXPLAIN' => 'If set to yes topics made to this forum will be shown in the active topics list.', 'ENABLE_TOPIC_ICONS' => 'Enable topic icons', From 6b99b85c8f2f366d8e5e3e2855d77b0832d141d7 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 21 Feb 2010 01:31:10 +0000 Subject: [PATCH 033/393] BBCode parser now uses the user object for all settings rather than taking some from the template object [Bug #57365] git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10515 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/bbcode.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 7a2c551af7..57716a9350 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -174,6 +174,7 @@
      146. [Fix] Make user_email_hash() function independent from system's architecture. (Bug #57755)
      147. [Fix] Correct behavior of "force_approved_state" when value is false. (Bug #57715)
      148. [Fix] Global announcements could not be accessed on a board using Firebird as the database server. (Bug #57525)
      149. +
      150. [Fix] BBCode parser now uses the user object for all settings rather than taking some from the template object (Bug #57365)
      151. [Change] Move redirect into a hidden field to avoid issues with mod_security. (Bug #54145)
      152. [Change] Log activation through inactive users ACP. (Bug #30145)
      153. [Change] Send time of last item instead of current time in ATOM Feeds. (Bug #53305)
      154. diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index f58852c00b..e41053d936 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -137,7 +137,7 @@ class bbcode if (!@file_exists($this->template_filename)) { - if (isset($template->orig_tpl_inherits_id) && $template->orig_tpl_inherits_id) + if (isset($user->theme['template_inherits_id']) && $user->theme['template_inherits_id']) { $this->template_filename = $phpbb_root_path . 'styles/' . $user->theme['template_inherit_path'] . '/template/bbcode.html'; if (!@file_exists($this->template_filename)) From 22621e043963dca078580eaf61b45c5022ca79e1 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Sun, 21 Feb 2010 11:33:29 +0000 Subject: [PATCH 034/393] Enter stage left: the INTTEXT token git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10516 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 3 +++ phpBB/includes/acp/acp_bbcodes.php | 8 +++++++- phpBB/includes/bbcode.php | 2 +- phpBB/language/en/acp/posting.php | 5 +++-- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 57716a9350..cfd8a2fafd 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -193,7 +193,10 @@
      155. [Change] Tweak Q&A CAPTCHA garbage collection.
      156. [Change] Show a proper preview for the Q&A CAPTCHA. (Bug #56365)
      157. [Change] Speed up topic move operation by adding an index for topic_id on the topics track table. (Bug #56545)
      158. +
      159. [Change] Warn users about potentially dangerous BBcodes.
      160. [Feature] Ability to use HTTP authentication in ATOM feeds by passing the GET parameter "auth=http".
      161. +
      162. [Feature] Add INTTEXT token type to custom bbcodes to allow non-ASCII letters in html attributes.
      163. +

        1.iii. Changes since 3.0.5

        diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index 681794c972..ab042f15bf 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -315,6 +315,7 @@ class acp_bbcodes { $bbcode_match = trim($bbcode_match); $bbcode_tpl = trim($bbcode_tpl); + $utf8 = strpos($bbcode_match, 'INTTEXT') !== false; $fp_match = preg_quote($bbcode_match, '!'); $fp_replace = preg_replace('#^\[(.*?)\]#', '[$1:$uid]', $bbcode_match); @@ -342,6 +343,9 @@ class acp_bbcodes 'SIMPLETEXT' => array( '!([a-zA-Z0-9-+.,_ ]+)!' => "$1" ), + 'INTTEXT' => array( + '!([\p{L}\p{N}+-,_.\s]+)!u' => "$1" + ), 'IDENTIFIER' => array( '!([a-zA-Z0-9-_]+)!' => "$1" ), @@ -359,6 +363,7 @@ class acp_bbcodes 'EMAIL' => '(' . get_preg_expression('email') . ')', 'TEXT' => '(.*?)', 'SIMPLETEXT' => '([a-zA-Z0-9-+.,_ ]+)', + 'INTTEXT' => '([\p{L}\p{N}+-,_.\s]+)', 'IDENTIFIER' => '([a-zA-Z0-9-_]+)', 'COLOR' => '([a-zA-Z]+|#[0-9abcdefABCDEF]+)', 'NUMBER' => '([0-9]+)', @@ -366,7 +371,8 @@ class acp_bbcodes $pad = 0; $modifiers = 'i'; - + $modifiers .= ($utf8) ? 'u' : ''; + if (preg_match_all('/\{(' . implode('|', array_keys($tokens)) . ')[0-9]*\}/i', $bbcode_match, $m)) { foreach ($m[0] as $n => $token) diff --git a/phpBB/includes/bbcode.php b/phpBB/includes/bbcode.php index e41053d936..d77bb3c4a7 100644 --- a/phpBB/includes/bbcode.php +++ b/phpBB/includes/bbcode.php @@ -360,7 +360,7 @@ class bbcode // In order to use templates with custom bbcodes we need // to replace all {VARS} to corresponding backreferences // Note that backreferences are numbered from bbcode_match - if (preg_match_all('/\{(URL|LOCAL_URL|EMAIL|TEXT|SIMPLETEXT|IDENTIFIER|COLOR|NUMBER)[0-9]*\}/', $rowset[$bbcode_id]['bbcode_match'], $m)) + if (preg_match_all('/\{(URL|LOCAL_URL|EMAIL|TEXT|SIMPLETEXT|INTTEXT|IDENTIFIER|COLOR|NUMBER)[0-9]*\}/', $rowset[$bbcode_id]['bbcode_match'], $m)) { foreach ($m[0] as $i => $tok) { diff --git a/phpBB/language/en/acp/posting.php b/phpBB/language/en/acp/posting.php index 74cd29ffee..443f4a3ea2 100644 --- a/phpBB/language/en/acp/posting.php +++ b/phpBB/language/en/acp/posting.php @@ -41,7 +41,7 @@ $lang = array_merge($lang, array( 'ACP_BBCODES_EXPLAIN' => 'BBCode is a special implementation of HTML offering greater control over what and how something is displayed. From this page you can add, remove and edit custom BBCodes.', 'ADD_BBCODE' => 'Add a new BBCode', - 'BBCODE_DANGER' => 'The BBCode you are trying to add seems to use a {TEXT} token inside a HTML attribute. This is a possible XSS security issue. Try using the more restrictive {SIMPLETEXT} type instead. Only proceed if you understand the risks involved and you consider the use of {TEXT} absolutely unavoidable.', + 'BBCODE_DANGER' => 'The BBCode you are trying to add seems to use a {TEXT} token inside a HTML attribute. This is a possible XSS security issue. Try using the more restrictive {SIMPLETEXT} or {INTTEXT} types instead. Only proceed if you understand the risks involved and you consider the use of {TEXT} absolutely unavoidable.', 'BBCODE_DANGER_PROCEED' => 'Proceed', //'I understand the risk', 'BBCODE_ADDED' => 'BBCode added successfully.', @@ -76,8 +76,9 @@ $lang = array_merge($lang, array( 'TOO_MANY_BBCODES' => 'You cannot create any more BBCodes. Please remove one or more BBCodes then try again.', 'tokens' => array( - 'TEXT' => 'Any text, including foreign characters, numbers, etc… You should not use this token in HTML tags. Instead try to use IDENTIFIER or SIMPLETEXT.', + 'TEXT' => 'Any text, including foreign characters, numbers, etc… You should not use this token in HTML tags. Instead try to use IDENTIFIER, INTTEXT or SIMPLETEXT.', 'SIMPLETEXT' => 'Characters from the latin alphabet (A-Z), numbers, spaces, commas, dots, minus, plus, hyphen and underscore', + 'INTTEXT' => 'Unicode letter characters, numbers, spaces, commas, dots, minus, plus, hyphen, underscore and whitespaces.', 'IDENTIFIER' => 'Characters from the latin alphabet (A-Z), numbers, hyphen and underscore', 'NUMBER' => 'Any series of digits', 'EMAIL' => 'A valid e-mail address', From e01171ca85e09b10a93337c9a88022545dee23c1 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Mon, 22 Feb 2010 00:57:01 +0000 Subject: [PATCH 035/393] General errors can't be logged if there isn't a database connection, introduced in r9924 #57975 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10518 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index cfd8a2fafd..7a67093c5e 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -175,6 +175,7 @@
      164. [Fix] Correct behavior of "force_approved_state" when value is false. (Bug #57715)
      165. [Fix] Global announcements could not be accessed on a board using Firebird as the database server. (Bug #57525)
      166. [Fix] BBCode parser now uses the user object for all settings rather than taking some from the template object (Bug #57365)
      167. +
      168. [Fix] Ensure a database connection is available before logging general errors. (Bug #57975)
      169. [Change] Move redirect into a hidden field to avoid issues with mod_security. (Bug #54145)
      170. [Change] Log activation through inactive users ACP. (Bug #30145)
      171. [Change] Send time of last item instead of current time in ATOM Feeds. (Bug #53305)
      172. diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 913b1c0fa0..364c8f4e9e 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3531,7 +3531,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) } } - if (defined('DEBUG') || defined('IN_CRON') || defined('IMAGE_OUTPUT')) + if ((defined('DEBUG') || defined('IN_CRON') || defined('IMAGE_OUTPUT')) && isset($db)) { // let's avoid loops $db->sql_return_on_error(true); From e8f01ff74b58d9d73ff3c32507d843b8b14d92e5 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 22 Feb 2010 19:33:27 +0000 Subject: [PATCH 036/393] We have to use a 'snapshot' of the function there, because it might not be available yet. - Bug #57755 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10520 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/install/database_update.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 4db78331bd..df8aadfdb2 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1615,7 +1615,9 @@ function change_database_data(&$no_updates, $version) $i = 0; while ($row = $db->sql_fetchrow($result)) { - $user_email_hash = phpbb_email_hash($row['user_email']); + // Snapshot of the phpbb_email_hash() function + // We cannot call it directly because the auto updater updates the DB first. :/ + $user_email_hash = sprintf('%u', crc32(strtolower($row['user_email']))) . strlen($row['user_email']); if ($user_email_hash != $row['user_email_hash']) { From 83cf74de2b509ea367d93ad3f9a3a43d24ed012b Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 23 Feb 2010 15:07:58 +0000 Subject: [PATCH 037/393] Fixing the code changes from diff building script: When an edit was detected as replacing an empty line by diff it would get dropped from the code changes git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10522 89ea8834-ac86-4346-8a33-228a782c2dd0 --- build/diff_class.php | 62 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 14 deletions(-) diff --git a/build/diff_class.php b/build/diff_class.php index 0d7c2dcd3a..4625ffde24 100644 --- a/build/diff_class.php +++ b/build/diff_class.php @@ -1181,7 +1181,19 @@ class BBCodeDiffFormatter extends DiffFormatter $text = implode('', $order_array['find_c']); if ($text === "\n" || $text === "\t" || $text === '') { - return true; + if (isset($order_array['first_find_c'][0]) && + is_array($order_array['first_find_c'][0]) && + trim(implode('', $order_array['first_find_c'][0])) != '' && + isset($order_array['replace'])) + { + $order_array['add'] = $order_array['replace']; + unset($order_array['replace']); + // this is actually an after add + } + else + { + return true; + } } } @@ -1223,18 +1235,42 @@ class BBCodeDiffFormatter extends DiffFormatter $text = implode('', $order_array['find_c']); if ($text === "\n" || $text === "\t" || $text === '') { - continue; + // no real find, use first_find_c if possible! + //var_dump($order_array); + if (is_array($order_array['first_find_c'][0])) + { + $order_array['find_c'] = $order_array['first_find_c'][0]; + } + else + { + if (isset($order_array['replace']) || isset($order_array['add']) || isset($order_array['delete'])) + { + echo "skipped an edit!\n"; + var_dump($order_array); + } + continue; + } } - - if (strlen(implode('', $order_array['find_c'])) < 50 && is_array($order_array['first_find_c'][0])) + else { - $html .= "#\n#-----[ FIND ]---------------------------------------------\n# Around Line {$ybeg}\n"; - $html .= implode("", $order_array['first_find_c'][0]); - $html .= "\n"; - $ybeg += sizeof($order_array['first_find_c'][0]); + if (strlen(implode('', $order_array['find_c'])) < 50 && is_array($order_array['first_find_c'][0])) + { + $html .= "#\n#-----[ FIND ]---------------------------------------------\n# Around Line {$ybeg}\n"; + $html .= implode("", $order_array['first_find_c'][0]); + $html .= "\n"; + $ybeg += sizeof($order_array['first_find_c'][0]); + } } } + // still here but nothing to do? what the heck? + if (!isset($order_array['replace']) && !isset($order_array['add']) && !isset($order_array['delete'])) + { + echo "skipped an edit!\n"; + var_dump($order_array); + continue; + } + if (sizeof($order_array['find_c'])) { $html .= "#\n#-----[ FIND ]---------------------------------------------\n# Around Line {$ybeg}\n"; @@ -1309,7 +1345,7 @@ class BBCodeDiffFormatter extends DiffFormatter { if (isset($hunk['a']) && isset($hunk['d'])) { - /* if (sizeof($hunk['a']) == 1 && sizeof($hunk['d']) == 1) + /**/ if (sizeof($hunk['a']) == 1 && sizeof($hunk['d']) == 1) { if (preg_match('/\* @version \$Id:.+\$$/', $hunk['a'][0]) && preg_match('/\* @version \$Id:.+\$$/', $hunk['d'][0])) { @@ -1318,7 +1354,7 @@ class BBCodeDiffFormatter extends DiffFormatter $reorder = true; continue; } - }*/ + }/**/ // Compare the add and replace one... $string_1 = rtrim(trim(implode('', $hunk['a']))); @@ -1349,7 +1385,7 @@ class BBCodeDiffFormatter extends DiffFormatter { if (isset($hunk['a']) && isset($hunk['d'])) { - /* if (sizeof($hunk['a']) == 1 && sizeof($hunk['d']) == 1) + /**/ if (sizeof($hunk['a']) == 1 && sizeof($hunk['d']) == 1) { if (preg_match('/\* @version \$Id:.+\$$/', $hunk['a'][0]) && preg_match('/\* @version \$Id:.+\$$/', $hunk['d'][0])) { @@ -1358,7 +1394,7 @@ class BBCodeDiffFormatter extends DiffFormatter $reorder = true; continue; } - }*/ + }/**/ // Compare the add and replace one... $string_1 = rtrim(trim(implode('', $hunk['a']))); @@ -1673,5 +1709,3 @@ class MODXDiffFormatter extends BBCodeDiffFormatter { } } - -?> \ No newline at end of file From 2c3c97b8eeb5ba55d9200efa030b21b52ceff5ee Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 23 Feb 2010 16:18:57 +0000 Subject: [PATCH 038/393] merge r10513 into 3.0 branch: propdel git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10525 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/confirm_bbcode.html | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 phpBB/adm/style/confirm_bbcode.html diff --git a/phpBB/adm/style/confirm_bbcode.html b/phpBB/adm/style/confirm_bbcode.html old mode 100755 new mode 100644 From 2ec1d9238878fe3838f296e77cd05493e19e38ab Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 23 Feb 2010 18:52:06 +0000 Subject: [PATCH 039/393] Fix Bug #57375 - Do not delete unrelated attachments when deleting empty forums. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10526 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_admin.php | 13 +++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 7a67093c5e..136f53864f 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -176,6 +176,7 @@
      173. [Fix] Global announcements could not be accessed on a board using Firebird as the database server. (Bug #57525)
      174. [Fix] BBCode parser now uses the user object for all settings rather than taking some from the template object (Bug #57365)
      175. [Fix] Ensure a database connection is available before logging general errors. (Bug #57975)
      176. +
      177. [Fix] Do not delete unrelated attachments when deleting empty forums. (Bug #57375)
      178. [Change] Move redirect into a hidden field to avoid issues with mod_security. (Bug #54145)
      179. [Change] Log activation through inactive users ACP. (Bug #30145)
      180. [Change] Send time of last item instead of current time in ATOM Feeds. (Bug #53305)
      181. diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 955ef4df58..93244be55c 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -913,7 +913,13 @@ function delete_attachments($mode, $ids, $resync = true) { global $db, $config; - if (is_array($ids) && sizeof($ids)) + // 0 is as bad as an empty array + if (empty($ids)) + { + return false; + } + + if (is_array($ids)) { $ids = array_unique($ids); $ids = array_map('intval', $ids); @@ -923,11 +929,6 @@ function delete_attachments($mode, $ids, $resync = true) $ids = array((int) $ids); } - if (!sizeof($ids)) - { - return false; - } - $sql_where = ''; switch ($mode) From 47ce0f2a93ebe00c11c9951447693e922221be2e Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 23 Feb 2010 23:35:48 +0000 Subject: [PATCH 040/393] Update: Store expected resulting file contents in cache and do not suggest further merges if the contents match, also fixes infinite merge loop [Bug #54075] If you were trying to update from 3.0.5 to 3.0.6 but were presented with a dialogue suggesting to merge the same file over and over take the install/install_update.php from 3.0.7-RC2 or current svn, and replace your 3.0.5 one with it. It works fine in 3.0.5. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10528 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/install/install_update.php | 105 +++++++++++++++++++++++-------- 2 files changed, 81 insertions(+), 25 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 136f53864f..34cf58464f 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -177,6 +177,7 @@
      182. [Fix] BBCode parser now uses the user object for all settings rather than taking some from the template object (Bug #57365)
      183. [Fix] Ensure a database connection is available before logging general errors. (Bug #57975)
      184. [Fix] Do not delete unrelated attachments when deleting empty forums. (Bug #57375)
      185. +
      186. [Fix] Update: Store expected resulting file contents in cache and do not suggest further merges if the contents match, also fixes infinite merge loop (Bug #54075)
      187. [Change] Move redirect into a hidden field to avoid issues with mod_security. (Bug #54145)
      188. [Change] Log activation through inactive users ACP. (Bug #30145)
      189. [Change] Send time of last item instead of current time in ATOM Feeds. (Bug #53305)
      190. diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 9f5a428029..a5e54a354a 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -240,6 +240,7 @@ class install_update extends module // Make sure the update list is destroyed. $cache->destroy('_update_list'); $cache->destroy('_diff_files'); + $cache->destroy('_expected_files'); break; case 'version_check': @@ -312,7 +313,14 @@ class install_update extends module case 'file_check': - // Make sure the previous file collection is no longer valid... + // retrieve info on what changes should have already been made to the files. + $expected_files = $cache->get('_expected_files'); + if (!$expected_files) + { + $expected_files = array(); + } + + // Now make sure the previous file collection is no longer valid... $cache->destroy('_diff_files'); $this->page_title = 'STAGE_FILE_CHECK'; @@ -349,7 +357,7 @@ class install_update extends module if ($get_new_list) { - $this->get_update_structure($update_list); + $this->get_update_structure($update_list, $expected_files); $cache->put('_update_list', $update_list); // Refresh the page if we are still not finished... @@ -384,6 +392,8 @@ class install_update extends module ); } + $new_expected_files = array(); + // Now assign the list to the template foreach ($update_list as $status => $filelist) { @@ -419,29 +429,38 @@ class install_update extends module $diff_url = append_sid($this->p_master->module_url, "mode=$mode&sub=file_check&action=diff&status=$status&file=" . urlencode($file_struct['filename'])); - $template->assign_block_vars($status, array( - 'STATUS' => $status, + if (isset($file_struct['as_expected']) && $file_struct['as_expected']) + { + $new_expected_files[$file_struct['filename']] = $expected_files[$file_struct['filename']]; + } + else + { + $template->assign_block_vars($status, array( + 'STATUS' => $status, - 'FILENAME' => $filename, - 'DIR_PART' => $dir_part, - 'FILE_PART' => $file_part, - 'NUM_CONFLICTS' => (isset($file_struct['conflicts'])) ? $file_struct['conflicts'] : 0, + 'FILENAME' => $filename, + 'DIR_PART' => $dir_part, + 'FILE_PART' => $file_part, + 'NUM_CONFLICTS' => (isset($file_struct['conflicts'])) ? $file_struct['conflicts'] : 0, - 'S_CUSTOM' => ($file_struct['custom']) ? true : false, - 'S_BINARY' => $s_binary, - 'CUSTOM_ORIGINAL' => ($file_struct['custom']) ? $file_struct['original'] : '', + 'S_CUSTOM' => ($file_struct['custom']) ? true : false, + 'S_BINARY' => $s_binary, + 'CUSTOM_ORIGINAL' => ($file_struct['custom']) ? $file_struct['original'] : '', - 'U_SHOW_DIFF' => $diff_url, - 'L_SHOW_DIFF' => ($status != 'up_to_date') ? $user->lang['SHOW_DIFF_' . strtoupper($status)] : '', + 'U_SHOW_DIFF' => $diff_url, + 'L_SHOW_DIFF' => ($status != 'up_to_date') ? $user->lang['SHOW_DIFF_' . strtoupper($status)] : '', - 'U_VIEW_MOD_FILE' => $diff_url . '&op=' . MERGE_MOD_FILE, - 'U_VIEW_NEW_FILE' => $diff_url . '&op=' . MERGE_NEW_FILE, - 'U_VIEW_NO_MERGE_MOD' => $diff_url . '&op=' . MERGE_NO_MERGE_MOD, - 'U_VIEW_NO_MERGE_NEW' => $diff_url . '&op=' . MERGE_NO_MERGE_NEW, - )); + 'U_VIEW_MOD_FILE' => $diff_url . '&op=' . MERGE_MOD_FILE, + 'U_VIEW_NEW_FILE' => $diff_url . '&op=' . MERGE_NEW_FILE, + 'U_VIEW_NO_MERGE_MOD' => $diff_url . '&op=' . MERGE_NO_MERGE_MOD, + 'U_VIEW_NO_MERGE_NEW' => $diff_url . '&op=' . MERGE_NO_MERGE_NEW, + )); + } } } + $cache->put('_expected_files', $new_expected_files); + $all_up_to_date = true; foreach ($update_list as $status => $filelist) { @@ -617,6 +636,7 @@ class install_update extends module // Before we do anything, let us diff the files and store the raw file information "somewhere" $get_files = false; $file_list = $cache->get('_diff_files'); + $expected_files = $cache->get('_expected_files'); if ($file_list === false || $file_list['status'] != -1) { @@ -632,6 +652,11 @@ class install_update extends module ); } + if (!isset($expected_files) || $expected_files === false) + { + $expected_files = array(); + } + $processed = 0; foreach ($update_list as $status => $files) { @@ -645,6 +670,7 @@ class install_update extends module // Skip this file if the user selected to not update it if (in_array($file_struct['filename'], $no_update)) { + $expected_files[$file_struct['filename']] = false; continue; } @@ -676,6 +702,15 @@ class install_update extends module return; } + if (file_exists($phpbb_root_path . $file_struct['filename'])) + { + $contents = file_get_contents($phpbb_root_path . $file_struct['filename']); + if (isset($expected_files[$file_struct['filename']]) && md5($contents) == $expected_files[$file_struct['filename']]) + { + continue; + } + } + $original_filename = ($file_struct['custom']) ? $file_struct['original'] : $file_struct['filename']; switch ($status) @@ -702,6 +737,7 @@ class install_update extends module break; } + $expected_files[$file_struct['filename']] = md5($contents); $file_list[$file_struct['filename']] = '_file_' . md5($file_struct['filename']); $cache->put($file_list[$file_struct['filename']], base64_encode($contents)); @@ -747,6 +783,7 @@ class install_update extends module break; } + $expected_files[$file_struct['filename']] = md5($contents); $file_list[$file_struct['filename']] = '_file_' . md5($file_struct['filename']); $cache->put($file_list[$file_struct['filename']], base64_encode($contents)); @@ -757,6 +794,7 @@ class install_update extends module } } } + $cache->put('_expected_files', $expected_files); } $file_list['status'] = -1; @@ -1217,7 +1255,7 @@ class install_update extends module /** * Collect all file status infos we need for the update by diffing all files */ - function get_update_structure(&$update_list) + function get_update_structure(&$update_list, $expected_files) { global $phpbb_root_path, $phpEx, $user; @@ -1303,7 +1341,7 @@ class install_update extends module else { // not modified? - $this->make_update_diff($update_list, $file, $file); + $this->make_update_diff($update_list, $file, $file, $expected_files); } $num_bytes_processed += (file_exists($this->new_location . $file)) ? filesize($this->new_location . $file) : 100 * 1024; @@ -1344,17 +1382,34 @@ class install_update extends module /** * Compare files for storage in update_list */ - function make_update_diff(&$update_list, $original_file, $file, $custom = false) + function make_update_diff(&$update_list, $original_file, $file, $expected_files, $custom = false) { global $phpbb_root_path, $user; - $update_ary = array('filename' => $file, 'custom' => $custom); + $update_ary = array('filename' => $file, 'custom' => $custom, 'as_expected' => false); if ($custom) { $update_ary['original'] = $original_file; } + if (file_exists($phpbb_root_path . $file)) + { + $content = file_get_contents($phpbb_root_path . $file); + + if (isset($expected_files[$file]) && // the user already selected what to do with this file + ($expected_files[$file] === false || // the user wanted this file to stay the same, so just assume it's alright + $expected_files[$file] === md5($content))) + { + // the file contains what it was supposed to contain after the merge + $update_ary['as_expected'] = true; + $update_ary['was_ignored'] = ($expected_files[$file] === false); + $update_list['up_to_date'][] = $update_ary; + + return; + } + } + // we only want to know if the files are successfully merged and newlines could result in errors (duplicate addition of lines and such things) // Therefore we check for empty diffs with two methods, preserving newlines and not preserving them (which mostly works best, therefore the first option) @@ -1364,7 +1419,7 @@ class install_update extends module { $tmp = array( 'file1' => file_get_contents($this->new_location . $original_file), - 'file2' => file_get_contents($phpbb_root_path . $file), + 'file2' => $content, ); // We need to diff the contents here to make sure the file is really the one we expect @@ -1403,7 +1458,7 @@ class install_update extends module { $tmp = array( 'file1' => file_get_contents($this->old_location . $original_file), - 'file2' => file_get_contents($phpbb_root_path . $file), + 'file2' => $content, ); // We need to diff the contents here to make sure the file is really the one we expect @@ -1414,7 +1469,7 @@ class install_update extends module $tmp = array( 'file1' => file_get_contents($this->new_location . $original_file), - 'file2' => file_get_contents($phpbb_root_path . $file), + 'file2' => $content, ); $diff = new diff($tmp['file1'], $tmp['file2'], $preserve_cr); From 8f5155d272f53c538d4a3df113207d57004e0bf2 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Tue, 23 Feb 2010 23:49:15 +0000 Subject: [PATCH 041/393] Quick reply enable button was merged into 3.0.7: r10491, r10492 and r10529 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10530 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 34cf58464f..bbd6259ae7 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -96,7 +96,6 @@
      191. [Fix] Honor minimum and maximum password length in generated passwords as much as we can. (Bug #13181)
      192. [Fix] No longer return the character O in generated random strings and passwords. (Bug #57345)
      193. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
      194. -
      195. [Feature] Add ability to enable quick reply in all forums.
      196. 1.ii. Changes since 3.0.6

        @@ -199,6 +198,7 @@
      197. [Change] Warn users about potentially dangerous BBcodes.
      198. [Feature] Ability to use HTTP authentication in ATOM feeds by passing the GET parameter "auth=http".
      199. [Feature] Add INTTEXT token type to custom bbcodes to allow non-ASCII letters in html attributes.
      200. +
      201. [Feature] Add ability to enable quick reply in all forums.
      202. From 9e64c3bd84b9b595da54c6463e068ca8b84e1ee0 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Thu, 25 Feb 2010 00:18:30 +0000 Subject: [PATCH 042/393] Bug #56965 - Allow redirect() to redirect across directories. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10536 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions.php | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index bbd6259ae7..b0f1bd518d 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -95,6 +95,7 @@
      203. [Fix] Take admin's time zone settings into account when listing database backup files. (Bug #57385)
      204. [Fix] Honor minimum and maximum password length in generated passwords as much as we can. (Bug #13181)
      205. [Fix] No longer return the character O in generated random strings and passwords. (Bug #57345)
      206. +
      207. [Fix] Allow redirect() function to redirect across directories. (Bug #56965)
      208. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
      209. diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 364c8f4e9e..38f910974a 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2336,6 +2336,19 @@ function redirect($url, $return = false, $disable_cd_check = false) // Relative uri $pathinfo = pathinfo($url); + if (!$disable_cd_check && !file_exists($pathinfo['dirname'])) + { + $url = str_replace('../', '', $url); + $pathinfo = pathinfo($url); + + if (!file_exists($pathinfo['dirname'])) + { + // fallback to "last known user page" + $url = generate_board_url() . '/' . $user->page['page']; + break; + } + } + // Is the uri pointing to the current directory? if ($pathinfo['dirname'] == '.') { From e57981d1f55932cacfd0d4f11c7a69e5d1195bc4 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 25 Feb 2010 10:33:06 +0000 Subject: [PATCH 043/393] Fix Bug #57875 - We have to add the paragraph tags there. Patch by HardStyle, Regression from r10096. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10537 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/docs/CHANGELOG.html | 2 +- phpBB/styles/prosilver/template/viewforum_body.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index b0f1bd518d..8829f0abfe 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -111,7 +111,7 @@
      210. [Fix] Do not link to user profile in ATOM feed entry if post has been made by the guest user. (Bug #54275)
      211. [Fix] Make word censoring case insensitive. (Bug #54265)
      212. [Fix] Fulltext-MySQL search for keywords and username at the same time. (Bug #54325)
      213. -
      214. [Fix] Various XHTML and CSS mistakes in prosilver and subsilver2. (Bugs #54705, #55895, #57505)
      215. +
      216. [Fix] Various XHTML and CSS mistakes in prosilver and subsilver2. (Bugs #54705, #55895, #57505, #57875 - Patch by HardStyle)
      217. [Fix] Correctly show topic ATOM feed link when only post id is specified. (Bug #53025)
      218. [Fix] Cleanly handle forum/topic not found in ATOM Feeds. (Bug #54295)
      219. [Fix] PHP 5.3 compatibility: Check if function dl() exists before calling it. (Bug #54665)
      220. diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index 3f8921c6d3..cc38ed9d2b 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -6,7 +6,7 @@
        {FORUM_DESC}
        - {L_MODERATOR}{L_MODERATORS}: {MODERATORS} +

        {L_MODERATOR}{L_MODERATORS}: {MODERATORS}

        From cdc96b0c7d87b3db7a8192b62ffb95044a24434f Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 25 Feb 2010 10:51:35 +0000 Subject: [PATCH 044/393] Bug #58085 - Add terminating semicolons to JavaScript code found by JSLint. Patch by nn- git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10539 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/adm/style/editor.js | 4 ++-- phpBB/docs/CHANGELOG.html | 1 + phpBB/styles/prosilver/template/editor.js | 10 +++++----- phpBB/styles/subsilver2/template/editor.js | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/phpBB/adm/style/editor.js b/phpBB/adm/style/editor.js index cd4e75f51f..7e3ce1c708 100644 --- a/phpBB/adm/style/editor.js +++ b/phpBB/adm/style/editor.js @@ -152,7 +152,7 @@ function insert_text(text, spaces, popup) var sel_start = textarea.selectionStart; var sel_end = textarea.selectionEnd; - mozWrap(textarea, text, '') + mozWrap(textarea, text, ''); textarea.selectionStart = sel_start + text.length; textarea.selectionEnd = sel_end + text.length; } @@ -269,7 +269,7 @@ function mozWrap(txtarea, open, close) } var s1 = (txtarea.value).substring(0,selStart); - var s2 = (txtarea.value).substring(selStart, selEnd) + var s2 = (txtarea.value).substring(selStart, selEnd); var s3 = (txtarea.value).substring(selEnd, selLength); txtarea.value = s1 + open + s2 + close + s3; diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 8829f0abfe..4e9adaa1f9 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -96,6 +96,7 @@
      221. [Fix] Honor minimum and maximum password length in generated passwords as much as we can. (Bug #13181)
      222. [Fix] No longer return the character O in generated random strings and passwords. (Bug #57345)
      223. [Fix] Allow redirect() function to redirect across directories. (Bug #56965)
      224. +
      225. [Fix] Add terminating semicolons to JavaScript code. (Bug #58085 - Patch by nn-)
      226. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
      227. diff --git a/phpBB/styles/prosilver/template/editor.js b/phpBB/styles/prosilver/template/editor.js index 98dab5d7c8..9c2691db8d 100644 --- a/phpBB/styles/prosilver/template/editor.js +++ b/phpBB/styles/prosilver/template/editor.js @@ -157,7 +157,7 @@ function insert_text(text, spaces, popup) var sel_start = textarea.selectionStart; var sel_end = textarea.selectionEnd; - mozWrap(textarea, text, '') + mozWrap(textarea, text, ''); textarea.selectionStart = sel_start + text.length; textarea.selectionEnd = sel_end + text.length; } @@ -259,7 +259,7 @@ function addquote(post_id, username) var lines = split_lines(theSelection); for (i = 0; i < lines.length; i++) { - insert_text('> ' + lines[i] + '\n') + insert_text('> ' + lines[i] + '\n'); } } } @@ -289,7 +289,7 @@ function split_lines(text) if (splitAt == -1) { splitLines[j] = line; - j++ + j++; } else { @@ -298,7 +298,7 @@ function split_lines(text) j++; } } - while(splitAt != -1) + while(splitAt != -1); } } return splitLines; @@ -319,7 +319,7 @@ function mozWrap(txtarea, open, close) } var s1 = (txtarea.value).substring(0,selStart); - var s2 = (txtarea.value).substring(selStart, selEnd) + var s2 = (txtarea.value).substring(selStart, selEnd); var s3 = (txtarea.value).substring(selEnd, selLength); txtarea.value = s1 + open + s2 + close + s3; diff --git a/phpBB/styles/subsilver2/template/editor.js b/phpBB/styles/subsilver2/template/editor.js index 0c48c93ad3..2d157caada 100644 --- a/phpBB/styles/subsilver2/template/editor.js +++ b/phpBB/styles/subsilver2/template/editor.js @@ -156,7 +156,7 @@ function insert_text(text, spaces, popup) var sel_start = textarea.selectionStart; var sel_end = textarea.selectionEnd; - mozWrap(textarea, text, '') + mozWrap(textarea, text, ''); textarea.selectionStart = sel_start + text.length; textarea.selectionEnd = sel_end + text.length; } @@ -272,7 +272,7 @@ function mozWrap(txtarea, open, close) } var s1 = (txtarea.value).substring(0,selStart); - var s2 = (txtarea.value).substring(selStart, selEnd) + var s2 = (txtarea.value).substring(selStart, selEnd); var s3 = (txtarea.value).substring(selEnd, selLength); txtarea.value = s1 + open + s2 + close + s3; From c2f2bff2aecf642c8d6b9915e15a54d140728eee Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Thu, 25 Feb 2010 21:48:21 +0000 Subject: [PATCH 045/393] only whitespaces, not newlines git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10540 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_bbcodes.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index ab042f15bf..1e3316c998 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -344,7 +344,7 @@ class acp_bbcodes '!([a-zA-Z0-9-+.,_ ]+)!' => "$1" ), 'INTTEXT' => array( - '!([\p{L}\p{N}+-,_.\s]+)!u' => "$1" + '!([\p{L}\p{N}+-,_. ]+)!u' => "$1" ), 'IDENTIFIER' => array( '!([a-zA-Z0-9-_]+)!' => "$1" @@ -363,7 +363,7 @@ class acp_bbcodes 'EMAIL' => '(' . get_preg_expression('email') . ')', 'TEXT' => '(.*?)', 'SIMPLETEXT' => '([a-zA-Z0-9-+.,_ ]+)', - 'INTTEXT' => '([\p{L}\p{N}+-,_.\s]+)', + 'INTTEXT' => '([\p{L}\p{N}+-,_. ]+)', 'IDENTIFIER' => '([a-zA-Z0-9-_]+)', 'COLOR' => '([a-zA-Z]+|#[0-9abcdefABCDEF]+)', 'NUMBER' => '([0-9]+)', From f03e986f811748066796ac37bceb4b5e3a07c003 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 26 Feb 2010 08:35:41 +0000 Subject: [PATCH 046/393] possible cause of #58055 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10542 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_bbcodes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index 1e3316c998..03c6c900de 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -420,7 +420,7 @@ class acp_bbcodes } $fp_match = '!' . $fp_match . '!' . $modifiers; - $sp_match = '!' . $sp_match . '!s'; + $sp_match = '!' . $sp_match . '!s' . (($utf8) ? 'u' : ''); if (strpos($fp_match, 'e') !== false) { From 204b5f579ea66bae0791d26f93388b3cf0d223d2 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 26 Feb 2010 20:32:00 +0000 Subject: [PATCH 047/393] okay, minus should work now #58055 git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10544 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_bbcodes.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index 03c6c900de..688816d6e3 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -344,7 +344,7 @@ class acp_bbcodes '!([a-zA-Z0-9-+.,_ ]+)!' => "$1" ), 'INTTEXT' => array( - '!([\p{L}\p{N}+-,_. ]+)!u' => "$1" + '!([\p{L}\p{N}-+,_. ]+)!u' => "$1" ), 'IDENTIFIER' => array( '!([a-zA-Z0-9-_]+)!' => "$1" @@ -363,7 +363,7 @@ class acp_bbcodes 'EMAIL' => '(' . get_preg_expression('email') . ')', 'TEXT' => '(.*?)', 'SIMPLETEXT' => '([a-zA-Z0-9-+.,_ ]+)', - 'INTTEXT' => '([\p{L}\p{N}+-,_. ]+)', + 'INTTEXT' => '([\p{L}\p{N}-+,_. ]+)', 'IDENTIFIER' => '([a-zA-Z0-9-_]+)', 'COLOR' => '([a-zA-Z]+|#[0-9abcdefABCDEF]+)', 'NUMBER' => '([0-9]+)', From c115ad2b8f7dc004a4de5fa61a5dd091dbf7b48a Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Sat, 27 Feb 2010 11:09:23 +0000 Subject: [PATCH 048/393] #58055 again git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10546 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_bbcodes.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index 688816d6e3..8f955c4709 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -344,7 +344,7 @@ class acp_bbcodes '!([a-zA-Z0-9-+.,_ ]+)!' => "$1" ), 'INTTEXT' => array( - '!([\p{L}\p{N}-+,_. ]+)!u' => "$1" + '!([\p{L}\p{N}\-+,_. ]+)!u' => "$1" ), 'IDENTIFIER' => array( '!([a-zA-Z0-9-_]+)!' => "$1" @@ -363,7 +363,7 @@ class acp_bbcodes 'EMAIL' => '(' . get_preg_expression('email') . ')', 'TEXT' => '(.*?)', 'SIMPLETEXT' => '([a-zA-Z0-9-+.,_ ]+)', - 'INTTEXT' => '([\p{L}\p{N}-+,_. ]+)', + 'INTTEXT' => '([\p{L}\p{N}\-+,_. ]+)', 'IDENTIFIER' => '([a-zA-Z0-9-_]+)', 'COLOR' => '([a-zA-Z]+|#[0-9abcdefABCDEF]+)', 'NUMBER' => '([0-9]+)', From bba33ead30a243a6df1377b2ae0fa56337bacc7c Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sat, 27 Feb 2010 18:04:32 +0000 Subject: [PATCH 049/393] Updating the create_schema_files.php file to reflect the minor mssql schema change introduced in r10489 (implementing mssql native driver support - Bug #57055) git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10548 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/create_schema_files.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/phpBB/develop/create_schema_files.php b/phpBB/develop/create_schema_files.php index 03932bcc13..0515d801f2 100644 --- a/phpBB/develop/create_schema_files.php +++ b/phpBB/develop/create_schema_files.php @@ -266,7 +266,8 @@ foreach ($supported_dbms as $dbms) case 'mssql': $line = "/*\n\n \$I" . "d: $\n\n*/\n\n"; - $line .= "BEGIN TRANSACTION\nGO\n\n"; + // no need to do this, no transaction support for schema changes + //$line .= "BEGIN TRANSACTION\nGO\n\n"; break; case 'oracle': @@ -749,7 +750,8 @@ foreach ($supported_dbms as $dbms) switch ($dbms) { case 'mssql': - $line = "\nCOMMIT\nGO\n\n"; + // No need to do this, no transaction support for schema changes + //$line = "\nCOMMIT\nGO\n\n"; break; case 'sqlite': From e5c6cac09a13498aec3649ca0ea8324055381d55 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sat, 27 Feb 2010 21:19:43 +0000 Subject: [PATCH 050/393] After generating all packages go through the full installs and make sure the files do not contain any errors [Bug #58255] 3.0.7-RC2 contains an image file missing one byte (icon_textbox_search.gif) you can take it from an previous phpBB3 release, it was not changed. git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10549 89ea8834-ac86-4346-8a33-228a782c2dd0 --- build/compare.sh | 39 +++++++++++++++++++++++++++++++++++++++ build/package.php | 5 +++++ 2 files changed, 44 insertions(+) create mode 100755 build/compare.sh diff --git a/build/compare.sh b/build/compare.sh new file mode 100755 index 0000000000..df442fd4c7 --- /dev/null +++ b/build/compare.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +orig_dir="../../phpBB" + + +rm -rf test_release_files +mkdir test_release_files +cd test_release_files + +for ext in "tar.bz2" "zip" +do + cp "../new_version/release_files/$1.$ext" ./ + + if [ "$ext" = "tar.bz2" ] + then + command="tar -xjf" + else + command="unzip -q" + fi + + $command "$1.$ext" + + for file in `find phpBB3 -name '.svn' -prune -o -type f -print` + do + orig_file="${file/#phpBB3/$orig_dir}" + diff_result=`diff $orig_file $file` + + if [ -n "$diff_result" ] + then + echo "Difference in package $1.$ext" + echo $diff_result + fi + done + + rm -rf phpBB3 +done + +cd .. +rm -rf test_release_files + diff --git a/build/package.php b/build/package.php index 50a9e76ab7..0620d4c6c2 100755 --- a/build/package.php +++ b/build/package.php @@ -518,4 +518,9 @@ foreach ($compress_programs as $extension => $compress_command) $package->run_command('md5sum ./release_files/' . $package->get('release_filename') . '.' . $extension . ' > ./release_files/' . $package->get('release_filename') . '.' . $extension . '.md5'); } +// verify results +chdir($package->locations['root']); +$package->begin_status('********** Verifying packages **********'); +$package->run_command('./compare.sh ' . $package->package_infos['release_filename']); + echo "Done.\n"; From 5bd9d461e0b8eeeb49d57443bd726476fcd38e70 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sat, 27 Feb 2010 23:57:13 +0000 Subject: [PATCH 051/393] Make the new {INTTEXT} work on pcre installations without utf8 support, it only matches ascii characters & numbers there. [Bug #58055] git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10551 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/includes/acp/acp_bbcodes.php | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/phpBB/includes/acp/acp_bbcodes.php b/phpBB/includes/acp/acp_bbcodes.php index 8f955c4709..2b706394c4 100644 --- a/phpBB/includes/acp/acp_bbcodes.php +++ b/phpBB/includes/acp/acp_bbcodes.php @@ -33,7 +33,7 @@ class acp_bbcodes // Set up general vars $action = request_var('action', ''); $bbcode_id = request_var('bbcode', 0); - + $this->tpl_name = 'acp_bbcodes'; $this->page_title = 'ACP_BBCODES'; $form_key = 'acp_bbcodes'; @@ -123,7 +123,7 @@ class acp_bbcodes case 'modify': case 'create': - + $warn_text = preg_match('%<[^>]*\{text[\d]*\}[^>]*>%i', $bbcode_tpl); if (!$warn_text || confirm_box(true)) { @@ -171,8 +171,8 @@ class acp_bbcodes { trigger_error($user->lang['BBCODE_TAG_DEF_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); } - - + + if (strlen($bbcode_helpline) > 255) { trigger_error($user->lang['BBCODE_HELPLINE_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); @@ -243,7 +243,7 @@ class acp_bbcodes trigger_error($user->lang[$lang] . adm_back_link($this->u_action)); } else - { + { confirm_box(false, $user->lang['BBCODE_DANGER'], build_hidden_fields(array( 'action' => $action, 'bbcode' => $bbcode_id, @@ -317,6 +317,17 @@ class acp_bbcodes $bbcode_tpl = trim($bbcode_tpl); $utf8 = strpos($bbcode_match, 'INTTEXT') !== false; + // make sure we have utf8 support + $utf8_pcre_properties = false; + if (version_compare(PHP_VERSION, '5.1.0', '>=') || (version_compare(PHP_VERSION, '5.0.0-dev', '<=') && version_compare(PHP_VERSION, '4.4.0', '>='))) + { + // While this is the proper range of PHP versions, PHP may not be linked with the bundled PCRE lib and instead with an older version + if (@preg_match('/\p{L}/u', 'a') !== false) + { + $utf8_pcre_properties = true; + } + } + $fp_match = preg_quote($bbcode_match, '!'); $fp_replace = preg_replace('#^\[(.*?)\]#', '[$1:$uid]', $bbcode_match); $fp_replace = preg_replace('#\[/(.*?)\]$#', '[/$1:$uid]', $fp_replace); @@ -344,7 +355,7 @@ class acp_bbcodes '!([a-zA-Z0-9-+.,_ ]+)!' => "$1" ), 'INTTEXT' => array( - '!([\p{L}\p{N}\-+,_. ]+)!u' => "$1" + ($utf8_pcre_properties) ? '!([\p{L}\p{N}\-+,_. ]+)!u' : '!([a-zA-Z0-9\-+,_. ]+)!u' => "$1" ), 'IDENTIFIER' => array( '!([a-zA-Z0-9-_]+)!' => "$1" @@ -363,7 +374,7 @@ class acp_bbcodes 'EMAIL' => '(' . get_preg_expression('email') . ')', 'TEXT' => '(.*?)', 'SIMPLETEXT' => '([a-zA-Z0-9-+.,_ ]+)', - 'INTTEXT' => '([\p{L}\p{N}\-+,_. ]+)', + 'INTTEXT' => ($utf8_pcre_properties) ? '([\p{L}\p{N}\-+,_. ]+)' : '([a-zA-Z0-9\-+,_. ]+)', 'IDENTIFIER' => '([a-zA-Z0-9-_]+)', 'COLOR' => '([a-zA-Z]+|#[0-9abcdefABCDEF]+)', 'NUMBER' => '([0-9]+)', @@ -371,8 +382,8 @@ class acp_bbcodes $pad = 0; $modifiers = 'i'; - $modifiers .= ($utf8) ? 'u' : ''; - + $modifiers .= ($utf8 && $utf8_pcre_properties) ? 'u' : ''; + if (preg_match_all('/\{(' . implode('|', array_keys($tokens)) . ')[0-9]*\}/i', $bbcode_match, $m)) { foreach ($m[0] as $n => $token) From d62068cfadcc1478a2f8dd6e7da81dea6cee71ff Mon Sep 17 00:00:00 2001 From: Yuriy Rusko Date: Sun, 28 Feb 2010 21:01:16 +0000 Subject: [PATCH 052/393] #58285 - Language pack fix git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@10556 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/language/en/acp/board.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 7f07237fbf..ce57b07eae 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -85,7 +85,7 @@ $lang = array_merge($lang, array( 'ALLOW_SMILIES' => 'Allow smilies', 'ALLOW_TOPIC_NOTIFY' => 'Allow subscribing to topics', 'BOARD_PM' => 'Private messaging', - 'BOARD_PM_EXPLAIN' => 'Enable or disable private messaging for all users.', + 'BOARD_PM_EXPLAIN' => 'Enable private messaging for all users.', )); // Avatar Settings From 2f6c8a0164e08a66505bf322781b4ebce488e3bc Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Tue, 2 Mar 2010 19:30:37 +0000 Subject: [PATCH 053/393] Missed one half of bug #54855 whoops --- phpBB/docs/CHANGELOG.html | 1 + phpBB/language/en/email/admin_welcome_inactive.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 4e9adaa1f9..53863da302 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -97,6 +97,7 @@
      228. [Fix] No longer return the character O in generated random strings and passwords. (Bug #57345)
      229. [Fix] Allow redirect() function to redirect across directories. (Bug #56965)
      230. [Fix] Add terminating semicolons to JavaScript code. (Bug #58085 - Patch by nn-)
      231. +
      232. [Fix] Minor language fixes. (Bug #54855)
      233. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
      234. diff --git a/phpBB/language/en/email/admin_welcome_inactive.txt b/phpBB/language/en/email/admin_welcome_inactive.txt index e0970d3ff3..30b3aae852 100644 --- a/phpBB/language/en/email/admin_welcome_inactive.txt +++ b/phpBB/language/en/email/admin_welcome_inactive.txt @@ -10,7 +10,7 @@ Username: {USERNAME} Board URL: {U_BOARD} ---------------------------- -Your account is currently inactive and will need to be approved by an administrator before you can log in. Another email will be sent when this has occured. +Your account is currently inactive and will need to be approved by an administrator before you can log in. Another email will be sent when this has occurred. Your password has been securely stored in our database and cannot be retrieved. In the event that it is forgotten, you will be able to reset it using the email address associated with your account. From 5003595ed6f05de7b6c50973aa26bb573d365caa Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Tue, 2 Mar 2010 19:30:37 +0000 Subject: [PATCH 054/393] Missed one half of bug #54855 whoops --- phpBB/docs/CHANGELOG.html | 1 + phpBB/language/en/email/admin_welcome_inactive.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 4e9adaa1f9..53863da302 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -97,6 +97,7 @@
      235. [Fix] No longer return the character O in generated random strings and passwords. (Bug #57345)
      236. [Fix] Allow redirect() function to redirect across directories. (Bug #56965)
      237. [Fix] Add terminating semicolons to JavaScript code. (Bug #58085 - Patch by nn-)
      238. +
      239. [Fix] Minor language fixes. (Bug #54855)
      240. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
      241. diff --git a/phpBB/language/en/email/admin_welcome_inactive.txt b/phpBB/language/en/email/admin_welcome_inactive.txt index e0970d3ff3..30b3aae852 100644 --- a/phpBB/language/en/email/admin_welcome_inactive.txt +++ b/phpBB/language/en/email/admin_welcome_inactive.txt @@ -10,7 +10,7 @@ Username: {USERNAME} Board URL: {U_BOARD} ---------------------------- -Your account is currently inactive and will need to be approved by an administrator before you can log in. Another email will be sent when this has occured. +Your account is currently inactive and will need to be approved by an administrator before you can log in. Another email will be sent when this has occurred. Your password has been securely stored in our database and cannot be retrieved. In the event that it is forgotten, you will be able to reset it using the email address associated with your account. From 93a2407f6549a0236741973c1fdc980539ce6c0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20A=2E=20Ruszczy=C5=84ski?= Date: Tue, 2 Mar 2010 20:36:26 +0100 Subject: [PATCH 055/393] Bug #54945 again: MySQL 4 does not support aggregation in ORDER BY. Moved the MIN(smiley_order) to the SELECT column list now, so it can be used for sorting on MySQL 4, but also still works on MSSQL, which the bug was originally about. --- phpBB/includes/functions_posting.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 49ea382411..21c5fe7aca 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -85,10 +85,10 @@ function generate_smilies($mode, $forum_id) if ($mode == 'window') { - $sql = 'SELECT smiley_url, MIN(emotion) as emotion, MIN(code) AS code, smiley_width, smiley_height + $sql = 'SELECT smiley_url, MIN(emotion) as emotion, MIN(code) AS code, smiley_width, smiley_height, MIN(smiley_order) AS min_smiley_order FROM ' . SMILIES_TABLE . ' GROUP BY smiley_url, smiley_width, smiley_height - ORDER BY MIN(smiley_order)'; + ORDER BY min_smiley_order'; $result = $db->sql_query_limit($sql, $config['smilies_per_page'], $start, 3600); } else From 965ab55394f1da50b58cb88ac1bd18c92329c2c8 Mon Sep 17 00:00:00 2001 From: Cullen Walsh Date: Tue, 2 Mar 2010 12:22:11 -0800 Subject: [PATCH 056/393] Parse urls in signature taking into account the allow_sig_links config option introduced in phpBB 3.0.6, per bug #57105 --- phpBB/posting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/posting.php b/phpBB/posting.php index 6a95dce489..5f27b61aae 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1152,7 +1152,7 @@ if (!sizeof($error) && $preview) $parse_sig->bbcode_bitfield = $preview_signature_bitfield; // Not sure about parameters for bbcode/smilies/urls... in signatures - $parse_sig->format_display($config['allow_sig_bbcode'], true, $config['allow_sig_smilies']); + $parse_sig->format_display($config['allow_sig_bbcode'], $config['allow_sig_links'], $config['allow_sig_smilies']); $preview_signature = $parse_sig->message; unset($parse_sig); } From b85384506991c4f656e1b1992e0c714704758196 Mon Sep 17 00:00:00 2001 From: Cullen Walsh Date: Tue, 2 Mar 2010 13:01:05 -0800 Subject: [PATCH 057/393] Oops, forgot the changelog for #57105 --- phpBB/docs/CHANGELOG.html | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 53863da302..3042027e83 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -98,6 +98,7 @@
      242. [Fix] Allow redirect() function to redirect across directories. (Bug #56965)
      243. [Fix] Add terminating semicolons to JavaScript code. (Bug #58085 - Patch by nn-)
      244. [Fix] Minor language fixes. (Bug #54855)
      245. +
      246. [Fix] Parsing urls in signatures properly uses config settings. (Bug #57105)
      247. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
      248. From 7f991e848042fe43849d4e2e31bbf9c7ff3afce3 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 5 Mar 2010 18:51:30 +0100 Subject: [PATCH 058/393] Fix Bug #58595 - ATOM Feed exposes forum content under some circumstances. --- phpBB/docs/CHANGELOG.html | 1 + phpBB/feed.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 3042027e83..112e8451cd 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -99,6 +99,7 @@
      249. [Fix] Add terminating semicolons to JavaScript code. (Bug #58085 - Patch by nn-)
      250. [Fix] Minor language fixes. (Bug #54855)
      251. [Fix] Parsing urls in signatures properly uses config settings. (Bug #57105)
      252. +
      253. [Fix] Do not expose forum content of forums with ACL entries but no actual permission in ATOM Feeds. (Bug #58595)
      254. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
      255. diff --git a/phpBB/feed.php b/phpBB/feed.php index 1832efbc61..a42aa42a7f 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -522,7 +522,7 @@ class phpbb_feed_base if (!isset($forum_ids)) { - $forum_ids = array_keys($auth->acl_getf('f_read')); + $forum_ids = array_keys($auth->acl_getf('f_read', true)); } return $forum_ids; From f0a82396d48829a623ca716dc8c7d95e6aed2941 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 5 Mar 2010 20:50:56 +0100 Subject: [PATCH 059/393] Mark the bugfix #58595 as a security fix --- phpBB/docs/CHANGELOG.html | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 112e8451cd..0897328949 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -53,6 +53,7 @@
        1. Changelog
            +
          1. Changes since 3.0.7-PL1
          2. Changes since 3.0.7
          3. Changes since 3.0.6
          4. Changes since 3.0.5
          5. @@ -88,7 +89,7 @@
            -

            1.i. Changes since 3.0.7

            +

            1.i. Changes since 3.0.7-PL1

            • [Fix] Correctly sort database backup file list by date on database restore page. (Bug #57385)
            • @@ -99,10 +100,15 @@
            • [Fix] Add terminating semicolons to JavaScript code. (Bug #58085 - Patch by nn-)
            • [Fix] Minor language fixes. (Bug #54855)
            • [Fix] Parsing urls in signatures properly uses config settings. (Bug #57105)
            • -
            • [Fix] Do not expose forum content of forums with ACL entries but no actual permission in ATOM Feeds. (Bug #58595)
            • [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
            +

            1.i. Changes since 3.0.7

            + +
              +
            • [Sec] Do not expose forum content of forums with ACL entries but no actual permission in ATOM Feeds. (Bug #58595)
            • +
            +

            1.ii. Changes since 3.0.6

              From 0307d1f4aad7f3caca5146689c792584b5918c9a Mon Sep 17 00:00:00 2001 From: Cullen Walsh Date: Tue, 2 Mar 2010 13:01:05 -0800 Subject: [PATCH 060/393] Oops, forgot the changelog for #57105 --- phpBB/docs/CHANGELOG.html | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 53863da302..3042027e83 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -98,6 +98,7 @@
            • [Fix] Allow redirect() function to redirect across directories. (Bug #56965)
            • [Fix] Add terminating semicolons to JavaScript code. (Bug #58085 - Patch by nn-)
            • [Fix] Minor language fixes. (Bug #54855)
            • +
            • [Fix] Parsing urls in signatures properly uses config settings. (Bug #57105)
            • [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
            From 9d005973b0b31077a81243d7573734bb63af2a27 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Fri, 5 Mar 2010 20:54:16 +0100 Subject: [PATCH 061/393] [bug/51555] proposed fix for bug #51555 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 3042027e83..d31e094f93 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -99,6 +99,7 @@
          6. [Fix] Add terminating semicolons to JavaScript code. (Bug #58085 - Patch by nn-)
          7. [Fix] Minor language fixes. (Bug #54855)
          8. [Fix] Parsing urls in signatures properly uses config settings. (Bug #57105)
          9. +
          10. [Fix] Allow multibyte keys in request_var(). (Bug #51555)
          11. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
          12. diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 38f910974a..917433a970 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -114,7 +114,7 @@ function request_var($var_name, $default, $multibyte = false, $cookie = false) { $_v = null; } - set_var($_k, $_k, $sub_key_type); + set_var($_k, $_k, $sub_key_type, $multibyte); set_var($var[$k][$_k], $_v, $sub_type, $multibyte); } } From 5cfa3544334907f7b5eac6b2cc5f38ab067db634 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Fri, 5 Mar 2010 20:34:28 +0100 Subject: [PATCH 062/393] [bug/12531] proposed solution for bug #12531 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions_compress.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 3042027e83..4227ff08fb 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -99,6 +99,7 @@
          13. [Fix] Add terminating semicolons to JavaScript code. (Bug #58085 - Patch by nn-)
          14. [Fix] Minor language fixes. (Bug #54855)
          15. [Fix] Parsing urls in signatures properly uses config settings. (Bug #57105)
          16. +
          17. [Fix] Prevent wrong tar archive type detection. (Bug #12531)
          18. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
          19. diff --git a/phpBB/includes/functions_compress.php b/phpBB/includes/functions_compress.php index f17c780a65..f422eaa8c1 100644 --- a/phpBB/includes/functions_compress.php +++ b/phpBB/includes/functions_compress.php @@ -502,8 +502,8 @@ class compress_tar extends compress function compress_tar($mode, $file, $type = '') { $type = (!$type) ? $file : $type; - $this->isgz = (strpos($type, '.tar.gz') !== false || strpos($type, '.tgz') !== false) ? true : false; - $this->isbz = (strpos($type, '.tar.bz2') !== false) ? true : false; + $this->isgz = preg_match('#(\.tar\.gz|\.tgz)$#', $type); + $this->isbz = preg_match('#\.tar\.bz2$#', $type); $this->mode = &$mode; $this->file = &$file; From 865123ffda92eeaba487f4e45342e1d8ef18fa6f Mon Sep 17 00:00:00 2001 From: David Ward Date: Sun, 7 Mar 2010 10:00:15 -0700 Subject: [PATCH 063/393] [bug/58755] Fix a redirection bug that can occur after login This issue affects any forum (i.e. https://myforum/phpBB3/) where: - the forum is located in a directory underneath the web root (i.e., NOT https://myforum/) - a user accesses the forum with a URI pointing to a directory rather than a script (i.e., NOT https://myforum/phpBB3/index.php) - the URI used ends in a slash (i.e., NOT https://myforum/phpBB3) If these conditions are met, after successful login the user is redirected to an invalid URI (i.e., https://myforum/phpBB3/phpBB3?sid=). This change fixes extract_current_page() to handle the case correctly where the URI ends in a slash and is not the web root. So after successful login, the redirection back to the main page will work (i.e., https://myforum/phpBB3/?sid=) --- phpBB/includes/session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 11f1896332..1a302d5991 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -83,7 +83,7 @@ class session $query_string = trim(implode('&', $use_args)); // basenamed page name (for example: index.php) - $page_name = basename($script_name); + $page_name = (substr($script_name, -1, 1) == '/') ? '' : basename($script_name); $page_name = urlencode(htmlspecialchars($page_name)); // current directory within the phpBB root (for example: adm) From c52a7e9a083d1bbd68f515bfdec2dbe1ebdef954 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 7 Mar 2010 21:54:56 +0100 Subject: [PATCH 064/393] Adding the bugfix for #58755 to the changelog. --- phpBB/docs/CHANGELOG.html | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index e54c4fd9bb..213e8fd9e0 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -101,6 +101,7 @@
          20. [Fix] Minor language fixes. (Bug #54855)
          21. [Fix] Parsing urls in signatures properly uses config settings. (Bug #57105)
          22. [Fix] Allow multibyte keys in request_var(). (Bug #51555)
          23. +
          24. [Fix] Correct redirection after login to forum not in web root (Bug #58755)
          25. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
          26. From d0d1ab54710f7a7f3426b2bcdfd63e9df24c046e Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Mon, 8 Mar 2010 00:41:42 +0100 Subject: [PATCH 065/393] Adding a branchname prepare-commit-msg hook Git supports several hooks, some of which are client-side. The prepare-commit-msg hook is run right after a `git commit` call, before the editor is opened. This allows the initial message to be altered. This hook will check if the current branch name begins with `bug/`, in which case it will prepend `[$branchname]` to the commit message. This makes it easier to create proper commit messages. http://wiki.phpbb.com/Git#Commit_Messages For more information refer to the hook source. --- git-tools/hooks/prepare-commit-msg | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 git-tools/hooks/prepare-commit-msg diff --git a/git-tools/hooks/prepare-commit-msg b/git-tools/hooks/prepare-commit-msg new file mode 100755 index 0000000000..284354081e --- /dev/null +++ b/git-tools/hooks/prepare-commit-msg @@ -0,0 +1,24 @@ +#!/bin/sh +# +# A hook to add [$branch] to the beginning of a commit message +# if certain conditions are met. +# +# This is a prepare-commit-msg hook. +# +# To install this you can either copy or symlink it to +# $GIT_DIR/hooks, example: +# +# ln -s ../../git-tools/hooks/prepare-commit-msg \\ +# .git/hooks/prepare-commit-msg +# +# Make sure it is executable. + +# strip off ref: refs/heads/ +branch="$(cat $GIT_DIR/HEAD | sed 's/ref: refs\/heads\///g')" + +# * only run when normal commit is made (without -m or -F; +# not a merge, etc.) +# * also make sure the branch name begins with bug/ +if [ "$2" = "" ] && [ $(echo "$branch" | grep -e '^bug/') ]; then + echo "[$branch] $(cat $1)" > "$1" +fi From 0a6db697e6f50551270c7bc3e61fb587b7043099 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Mon, 8 Mar 2010 01:04:33 +0100 Subject: [PATCH 066/393] Add feature/ support to branchname hook The previously introduced branchname hook now will also use feature/ branch names, in addition to the existing bug/. --- git-tools/hooks/prepare-commit-msg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git-tools/hooks/prepare-commit-msg b/git-tools/hooks/prepare-commit-msg index 284354081e..e1e05d67b8 100755 --- a/git-tools/hooks/prepare-commit-msg +++ b/git-tools/hooks/prepare-commit-msg @@ -18,7 +18,7 @@ branch="$(cat $GIT_DIR/HEAD | sed 's/ref: refs\/heads\///g')" # * only run when normal commit is made (without -m or -F; # not a merge, etc.) -# * also make sure the branch name begins with bug/ -if [ "$2" = "" ] && [ $(echo "$branch" | grep -e '^bug/') ]; then +# * also make sure the branch name begins with bug/ or feature/ +if [ "$2" = "" ] && [ $(echo "$branch" | grep -e '^\(bug\|feature\)/') ]; then echo "[$branch] $(cat $1)" > "$1" fi From 60bd1edcb5e5992e6e693d0f68db47e678f7d54a Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Wed, 10 Mar 2010 16:24:19 +0100 Subject: [PATCH 067/393] [develop-olympus] Backported 3.1 unit tests to 3.0. Start adding unit tests for bugs you fix! Tests for anything are welcome really. We have to work on these a lot. --- tests/all_tests.php | 54 ++ tests/request/all_tests.php | 41 ++ tests/request/request_var.php | 180 ++++++ tests/security/all_tests.php | 86 +++ tests/security/extract_current_page.php | 53 ++ tests/security/redirect.php | 58 ++ tests/template/all_tests.php | 40 ++ tests/template/template.php | 671 ++++++++++++++++++++ tests/template/templates/_dummy_include.php | 3 + tests/template/templates/basic.html | 20 + tests/template/templates/define.html | 8 + tests/template/templates/expressions.html | 86 +++ tests/template/templates/if.html | 11 + tests/template/templates/include.html | 1 + tests/template/templates/includephp.html | 1 + tests/template/templates/lang.html | 3 + tests/template/templates/loop.html | 21 + tests/template/templates/loop_advanced.html | 19 + tests/template/templates/loop_nested.html | 8 + tests/template/templates/loop_vars.html | 21 + tests/template/templates/php.html | 1 + tests/template/templates/variable.html | 1 + tests/test_framework/framework.php | 36 ++ tests/test_framework/phpbb_test_case.php | 37 ++ tests/text_processing/all_tests.php | 41 ++ tests/text_processing/make_clickable.php | 106 ++++ tests/utf/all_tests.php | 43 ++ tests/utf/utf8_clean_string_test.php | 32 + tests/utf/utf8_wordwrap_test.php | 84 +++ 29 files changed, 1766 insertions(+) create mode 100644 tests/all_tests.php create mode 100644 tests/request/all_tests.php create mode 100644 tests/request/request_var.php create mode 100644 tests/security/all_tests.php create mode 100644 tests/security/extract_current_page.php create mode 100644 tests/security/redirect.php create mode 100644 tests/template/all_tests.php create mode 100644 tests/template/template.php create mode 100644 tests/template/templates/_dummy_include.php create mode 100644 tests/template/templates/basic.html create mode 100644 tests/template/templates/define.html create mode 100644 tests/template/templates/expressions.html create mode 100644 tests/template/templates/if.html create mode 100644 tests/template/templates/include.html create mode 100644 tests/template/templates/includephp.html create mode 100644 tests/template/templates/lang.html create mode 100644 tests/template/templates/loop.html create mode 100644 tests/template/templates/loop_advanced.html create mode 100644 tests/template/templates/loop_nested.html create mode 100644 tests/template/templates/loop_vars.html create mode 100644 tests/template/templates/php.html create mode 100644 tests/template/templates/variable.html create mode 100644 tests/test_framework/framework.php create mode 100644 tests/test_framework/phpbb_test_case.php create mode 100644 tests/text_processing/all_tests.php create mode 100644 tests/text_processing/make_clickable.php create mode 100644 tests/utf/all_tests.php create mode 100644 tests/utf/utf8_clean_string_test.php create mode 100644 tests/utf/utf8_wordwrap_test.php diff --git a/tests/all_tests.php b/tests/all_tests.php new file mode 100644 index 0000000000..1ed6126e80 --- /dev/null +++ b/tests/all_tests.php @@ -0,0 +1,54 @@ +addTest(phpbb_utf_all_tests::suite()); + $suite->addTest(phpbb_request_all_tests::suite()); + $suite->addTest(phpbb_security_all_tests::suite()); + $suite->addTest(phpbb_template_all_tests::suite()); + $suite->addTest(phpbb_text_processing_all_tests::suite()); + + return $suite; + } +} + +if (PHPUnit_MAIN_METHOD == 'phpbb_all_tests::main') +{ + phpbb_all_tests::main(); +} + diff --git a/tests/request/all_tests.php b/tests/request/all_tests.php new file mode 100644 index 0000000000..1ee3029b36 --- /dev/null +++ b/tests/request/all_tests.php @@ -0,0 +1,41 @@ +addTestSuite('phpbb_request_request_var_test'); + + return $suite; + } +} + +if (PHPUnit_MAIN_METHOD == 'phpbb_request_all_tests::main') +{ + phpbb_request_all_tests::main(); +} + diff --git a/tests/request/request_var.php b/tests/request/request_var.php new file mode 100644 index 0000000000..b1dacef3fd --- /dev/null +++ b/tests/request/request_var.php @@ -0,0 +1,180 @@ +unset_variables($variable_name); + + $_POST[$variable_name] = $variable_value; + $_REQUEST[$variable_name] = $variable_value; + + $result = request_var($variable_name, $default, $multibyte); + + $label = 'Requesting POST variable, converting from ' . gettype($variable_value) . ' to ' . gettype($default) . (($multibyte) ? ' multibyte' : ''); + $this->assertEquals($expected, $result, $label); + } + + /** + * @dataProvider request_variables + */ + public function test_get($variable_value, $default, $multibyte, $expected) + { + $variable_name = 'name'; + $this->unset_variables($variable_name); + + $_GET[$variable_name] = $variable_value; + $_REQUEST[$variable_name] = $variable_value; + + $result = request_var($variable_name, $default, $multibyte); + + $label = 'Requesting GET variable, converting from ' . gettype($variable_value) . ' to ' . gettype($default) . (($multibyte) ? ' multibyte' : ''); + $this->assertEquals($expected, $result, $label); + } + + /** + * @dataProvider request_variables + */ + public function test_cookie($variable_value, $default, $multibyte, $expected) + { + $variable_name = 'name'; + $this->unset_variables($variable_name); + + $_GET[$variable_name] = false; + $_POST[$variable_name] = false; + $_REQUEST[$variable_name] = false; + $_COOKIE[$variable_name] = $variable_value; + + $result = request_var($variable_name, $default, $multibyte, true); + + $label = 'Requesting COOKIE variable, converting from ' . gettype($variable_value) . ' to ' . gettype($default) . (($multibyte) ? ' multibyte' : ''); + $this->assertEquals($expected, $result, $label); + } + + /** + * Helper for unsetting globals + */ + private function unset_variables($var) + { + unset($_GET[$var], $_POST[$var], $_REQUEST[$var], $_COOKIE[$var]); + } + + public static function request_variables() + { + return array( + // strings + array('abc', '', false, 'abc'), + array(' some spaces ', '', true, 'some spaces'), + array("\r\rsome\rcarriage\r\rreturns\r", '', true, "some\ncarriage\n\nreturns"), + array("\n\nsome\ncarriage\n\nreturns\n", '', true, "some\ncarriage\n\nreturns"), + array("\r\n\r\nsome\r\ncarriage\r\n\r\nreturns\r\n", '', true, "some\ncarriage\n\nreturns"), + array("we\xC2\xA1rd\xE1\x9A\x80ch\xCE\xB1r\xC2\xADacters", '', true, "we\xC2\xA1rd\xE1\x9A\x80ch\xCE\xB1r\xC2\xADacters"), + array("we\xC2\xA1rd\xE1\x9A\x80ch\xCE\xB1r\xC2\xADacters", '', false, "we??rd???ch??r??acters"), + array("Some \"entities\" like &", '', true, "Some <html> "entities" like &"), + + // integers + array('1234', 0, false, 1234), + array('abc', 12, false, 0), + array('324abc', 0, false, 324), + + // string to array + array('123', array(0), false, array()), + array('123', array(''), false, array()), + + // 1 dimensional arrays + array( + // input: + array('123', 'abc'), + // default: + array(''), + false, + // expected: + array('123', 'abc') + ), + array( + // input: + array('123', 'abc'), + // default: + array(999), + false, + // expected: + array(123, 0) + ), + array( + // input: + array('xyz' => '123', 'abc' => 'abc'), + // default: + array('' => ''), + false, + // expected: + array('xyz' => '123', 'abc' => 'abc') + ), + array( + // input: + array('xyz' => '123', 'abc' => 'abc'), + // default: + array('' => 0), + false, + // expected: + array('xyz' => 123, 'abc' => 0) + ), + + // 2 dimensional arrays + array( + // input: + '', + // default: + array(array(0)), + false, + // expected: + array() + ), + array( + // input: + array( + 'xyz' => array('123', 'def'), + 'abc' => 'abc' + ), + // default: + array('' => array('')), + false, + // expected: + array( + 'xyz' => array('123', 'def'), + 'abc' => array() + ) + ), + array( + // input: + array( + 'xyz' => array('123', 'def'), + 'abc' => 'abc' + ), + // default: + array('' => array(0)), + false, + // expected: + array( + 'xyz' => array(123, 0), + 'abc' => array() + ) + ), + ); + } + +} + diff --git a/tests/security/all_tests.php b/tests/security/all_tests.php new file mode 100644 index 0000000000..8e3916733f --- /dev/null +++ b/tests/security/all_tests.php @@ -0,0 +1,86 @@ + gzip,deflate + [HTTP_ACCEPT_CHARSET] => ISO-8859-1,utf-8;q=0.7,*;q=0.7 + DOCUMENT_ROOT] => /var/www/ + [SCRIPT_FILENAME] => /var/www/tests/index.php +*/ + + // Set no user and trick a bit to circumvent errors + $user = new user(); + $user->lang = true; + $user->browser = (!empty($_SERVER['HTTP_USER_AGENT'])) ? htmlspecialchars((string) $_SERVER['HTTP_USER_AGENT']) : ''; + $user->referer = (!empty($_SERVER['HTTP_REFERER'])) ? htmlspecialchars((string) $_SERVER['HTTP_REFERER']) : ''; + $user->forwarded_for = (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) ? (string) $_SERVER['HTTP_X_FORWARDED_FOR'] : ''; + $user->host = (!empty($_SERVER['HTTP_HOST'])) ? (string) strtolower($_SERVER['HTTP_HOST']) : ((!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME')); + $user->page = session::extract_current_page($phpbb_root_path); + } + + protected function tearDown() + { + global $user; + $user = NULL; + } + + public static function main() + { + PHPUnit_TextUI_TestRunner::run(self::suite()); + } + + public static function suite() + { + // I bet there is a better method calling this... :) + $suite = new phpbb_security_all_tests('phpBB Security Fixes'); + + $suite->addTestSuite('phpbb_security_extract_current_page_test'); + $suite->addTestSuite('phpbb_security_redirect_test'); + + return $suite; + } +} + +if (PHPUnit_MAIN_METHOD == 'phpbb_security_all_tests::main') +{ + phpbb_security_all_tests::main(); +} diff --git a/tests/security/extract_current_page.php b/tests/security/extract_current_page.php new file mode 100644 index 0000000000..8c72fe1440 --- /dev/null +++ b/tests/security/extract_current_page.php @@ -0,0 +1,53 @@ +', 'mark=forums&x=%22%3E%3Cscript%3Ealert(/XSS/);%3C/script%3E'), + array('http://localhost/phpBB/index.php', 'mark=forums&x=%22%3E%3Cscript%3Ealert(/XSS/);%3C/script%3E', 'mark=forums&x=%22%3E%3Cscript%3Ealert(/XSS/);%3C/script%3E'), + ); + } + + /** + * @dataProvider security_variables + */ + public function test_query_string_php_self($url, $query_string, $expected) + { + $_SERVER['PHP_SELF'] = $url; + $_SERVER['QUERY_STRING'] = $query_string; + + $result = session::extract_current_page('./'); + + $label = 'Running extract_current_page on ' . $query_string . ' with PHP_SELF filled.'; + $this->assertEquals($expected, $result['query_string'], $label); + } + + /** + * @dataProvider security_variables + */ + public function test_query_string_request_uri($url, $query_string, $expected) + { + $_SERVER['REQUEST_URI'] = $url . '?' . $query_string; + $_SERVER['QUERY_STRING'] = $query_string; + + $result = session::extract_current_page('./'); + + $label = 'Running extract_current_page on ' . $query_string . ' with REQUEST_URI filled.'; + $this->assertEquals($expected, $result['query_string'], $label); + } +} + diff --git a/tests/security/redirect.php b/tests/security/redirect.php new file mode 100644 index 0000000000..37b0a5bb41 --- /dev/null +++ b/tests/security/redirect.php @@ -0,0 +1,58 @@ + redirect(), expected triggered error (else false), expected returned result url (else false)) + return array( + array('data://x', false, 'http://localhost/phpBB'), + array('bad://localhost/phpBB/index.php', 'Tried to redirect to potentially insecure url.', false), + array('http://www.otherdomain.com/somescript.php', false, 'http://localhost/phpBB'), + array("http://localhost/phpBB/memberlist.php\n\rConnection: close", 'Tried to redirect to potentially insecure url.', false), + array('javascript:test', false, 'http://localhost/phpBB/../tests/javascript:test'), + array('http://localhost/phpBB/index.php;url=', 'Tried to redirect to potentially insecure url.', false), + ); + } + + protected function setUp() + { + $GLOBALS['config'] = array( + 'force_server_vars' => '0', + ); + } + + /** + * @dataProvider provider + */ + public function test_redirect($test, $expected_error, $expected_result) + { + global $user; + + if ($expected_error !== false) + { + $this->setExpectedTriggerError(E_USER_ERROR, $expected_error); + } + + $result = redirect($test, true); + + // only verify result if we did not expect an error + if ($expected_error === false) + { + $this->assertEquals($expected_result, $result); + } + } +} + diff --git a/tests/template/all_tests.php b/tests/template/all_tests.php new file mode 100644 index 0000000000..ea258c1680 --- /dev/null +++ b/tests/template/all_tests.php @@ -0,0 +1,40 @@ +addTestSuite('phpbb_template_template_test'); + + return $suite; + } +} + +if (PHPUnit_MAIN_METHOD == 'phpbb_template_all_tests::main') +{ + phpbb_template_all_tests::main(); +} diff --git a/tests/template/template.php b/tests/template/template.php new file mode 100644 index 0000000000..df12f92046 --- /dev/null +++ b/tests/template/template.php @@ -0,0 +1,671 @@ +assertTrue($this->template->display($handle, false)); + + // reset error level + error_reporting($error_level); + + return self::trim_template_result(ob_get_clean()); + } + + private static function trim_template_result($result) + { + return str_replace("\n\n", "\n", implode("\n", array_map('trim', explode("\n", trim($result))))); + } + + private function setup_engine() + { + $this->template_path = dirname(__FILE__) . '/templates'; + $this->template = new template(); + $this->template->set_custom_template($this->template_path, 'tests'); + } + + protected function setUp() + { + // Test the engine can be used + $this->setup_engine(); + + if (!is_writable(dirname($this->template->cachepath))) + { + $this->markTestSkipped("Template cache directory is not writable."); + } + + foreach (glob($this->template->cachepath . '*') as $file) + { + unlink($file); + } + + $GLOBALS['config'] = array( + 'load_tplcompile' => true, + 'tpl_allow_php' => false, + ); + } + + protected function tearDown() + { + if (is_object($this->template)) + { + foreach (glob($this->template->cachepath . '*') as $file) + { + unlink($file); + } + } + } + + /** + * @todo put test data into templates/xyz.test + */ + public static function template_data() + { + return array( + /* + array( + '', // File + array(), // vars + array(), // block vars + array(), // destroy + '', // Expected result + ), + */ + array( + 'basic.html', + array(), + array(), + array(), + "pass\npass\n", + ), + array( + 'variable.html', + array('VARIABLE' => 'value'), + array(), + array(), + 'value', + ), + array( + 'if.html', + array(), + array(), + array(), + '0', + ), + array( + 'if.html', + array('S_VALUE' => true), + array(), + array(), + "1\n0", + ), + array( + 'if.html', + array('S_VALUE' => true, 'S_OTHER_VALUE' => true), + array(), + array(), + '1', + ), + array( + 'if.html', + array('S_VALUE' => false, 'S_OTHER_VALUE' => true), + array(), + array(), + '2', + ), + array( + 'loop.html', + array(), + array(), + array(), + "noloop\nnoloop", + ), + array( + 'loop.html', + array(), + array('loop' => array(array())), + array(), + "loop\nloop", + ), + array( + 'loop.html', + array(), + array('loop' => array(array(), array()), 'loop.block' => array(array())), + array(), + "loop\nloop\nloop\nloop", + ), + array( + 'loop.html', + array(), + array('loop' => array(array(), array()), 'loop.block' => array(array()), 'block' => array(array(), array())), + array(), + "loop\nloop\nloop\nloop\nloop#0-block#0\nloop#0-block#1\nloop#1-block#0\nloop#1-block#1", + ), + array( + 'loop_vars.html', + array(), + array('loop' => array(array('VARIABLE' => 'x'))), + array(), + "first\n0\nx\nset\nlast", + ),/* no nested top level loops + array( + 'loop_vars.html', + array(), + array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y'))), + array(), + "first\n0\n0\n2\nx\nset\n1\n1\n2\ny\nset\nlast", + ), + array( + 'loop_vars.html', + array(), + array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())), + array(), + "first\n0\n0\n2\nx\nset\n1\n1\n2\ny\nset\nlast\n0\n\n1\nlast inner\ninner loop", + ),*/ + array( + 'loop_advanced.html', + array(), + array('loop' => array(array(), array(), array(), array(), array(), array(), array())), + array(), + "101234561\nx\n101234561\nx\n101234561\nx\n1234561\nx\n1\nx\n101\nx\n234\nx\n10\nx\n561\nx\n561", + ), + array( + 'define.html', + array(), + array('loop' => array(array(), array(), array(), array(), array(), array(), array()), 'test' => array(array()), 'test.deep' => array(array()), 'test.deep.defines' => array(array())), + array(), + "xyz\nabc", + ), + array( + 'expressions.html', + array(), + array(), + array(), + trim(str_repeat("pass", 39)), + ), + array( + 'php.html', + array(), + array(), + array(), + '', + ), + array( + 'include.html', + array('VARIABLE' => 'value'), + array(), + array(), + 'value', + ), + array( + 'loop_vars.html', + array(), + array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())), + array('loop'), + '', + ),/* no top level nested loops + array( + 'loop_vars.html', + array(), + array('loop' => array(array('VARIABLE' => 'x'), array('VARIABLE' => 'y')), 'loop.inner' => array(array(), array())), + array('loop.inner'), + "first\n0\n0\n2\nx\nset\n1\n1\n2\ny\nset\nlast", + ),*/ + array( + 'lang.html', + array(), + array(), + array(), + "{ VARIABLE }\n{ VARIABLE }", + ), + array( + 'lang.html', + array('L_VARIABLE' => "Value'"), + array(), + array(), + "Value'\nValue\'", + ), + array( + 'lang.html', + array('LA_VARIABLE' => "Value'"), + array(), + array(), + "{ VARIABLE }\nValue'", + ), + ); + } + + public function test_missing_file() + { + $filename = 'file_not_found.html'; + + $this->template->set_filenames(array('test' => $filename)); + $this->assertFileNotExists($this->template_path . '/' . $filename, 'Testing missing file, file cannot exist'); + + $expecting = sprintf('template->_tpl_load_file(): File %s does not exist or is empty', realpath($this->template_path) . '/' . $filename); + $this->setExpectedTriggerError(E_USER_ERROR, $expecting); + + $this->display('test'); + } + + public function test_empty_file() + { + $expecting = 'template->set_filenames: Empty filename specified for test'; + + $this->setExpectedTriggerError(E_USER_ERROR, $expecting); + $this->template->set_filenames(array('test' => '')); + } + + public function test_invalid_handle() + { + $expecting = 'template->_tpl_load(): No file specified for handle test'; + $this->setExpectedTriggerError(E_USER_ERROR, $expecting); + + $this->display('test'); + } + + private function run_template($file, array $vars, array $block_vars, array $destroy, $expected, $cache_file) + { + $this->template->set_filenames(array('test' => $file)); + $this->template->assign_vars($vars); + + foreach ($block_vars as $block => $loops) + { + foreach ($loops as $_vars) + { + $this->template->assign_block_vars($block, $_vars); + } + } + + foreach ($destroy as $block) + { + $this->template->destroy_block_vars($block); + } + + try + { + $this->assertEquals($expected, $this->display('test'), "Testing $file"); + $this->assertFileExists($cache_file); + } + catch (ErrorException $e) + { + if (file_exists($cache_file)) + { + copy($cache_file, str_replace('ctpl_', 'tests_ctpl_', $cache_file)); + } + + throw $e; + } + + // For debugging + if (self::PRESERVE_CACHE) + { + copy($cache_file, str_replace('ctpl_', 'tests_ctpl_', $cache_file)); + } + } + + /** + * @dataProvider template_data + */ + public function test_template($file, array $vars, array $block_vars, array $destroy, $expected) + { + global $phpEx; + $cache_file = $this->template->cachepath . str_replace('/', '.', $file) . '.' . $phpEx; + + $this->assertFileNotExists($cache_file); + + $this->run_template($file, $vars, $block_vars, $destroy, $expected, $cache_file); + + // Reset the engine state + $this->setup_engine(); + + $this->run_template($file, $vars, $block_vars, $destroy, $expected, $cache_file); + } + + /** + * @dataProvider template_data + */ + public function test_assign_display($file, array $vars, array $block_vars, array $destroy, $expected) + { + $this->template->set_filenames(array( + 'test' => $file, + 'container' => 'variable.html', + )); + $this->template->assign_vars($vars); + + foreach ($block_vars as $block => $loops) + { + foreach ($loops as $_vars) + { + $this->template->assign_block_vars($block, $_vars); + } + } + + foreach ($destroy as $block) + { + $this->template->destroy_block_vars($block); + } + + $this->assertEquals($expected, self::trim_template_result($this->template->assign_display('test')), "Testing assign_display($file)"); + + $this->template->assign_display('test', 'VARIABLE', false); + $this->assertEquals($expected, $this->display('container'), "Testing assign_display($file)"); + } + + public function test_php() + { + global $phpEx; + + $GLOBALS['config']['tpl_allow_php'] = true; + + $cache_file = $this->template->cachepath . 'php.html.' . $phpEx; + + $this->assertFileNotExists($cache_file); + + $this->run_template('php.html', array(), array(), array(), 'test', $cache_file); + + $GLOBALS['config']['tpl_allow_php'] = false; + } + + public function test_includephp() + { + $this->markTestIncomplete('Include PHP test file paths are broken'); + + $GLOBALS['config']['tpl_allow_php'] = true; + + $cache_file = $this->template->cachepath . 'includephp.html.' . PHP_EXT; + + $cwd = getcwd(); + chdir(dirname(__FILE__) . '/templates'); + + $this->run_template('includephp.html', array(), array(), array(), 'testing included php', $cache_file); + + $this->template->set_filenames(array('test' => 'includephp.html')); + $this->assertEquals('testing included php', $this->display('test'), "Testing $file"); + + chdir($cwd); + + $GLOBALS['config']['tpl_allow_php'] = false; + } + + public static function alter_block_array_data() + { + return array( + array( + 'outer', + array('VARIABLE' => 'before'), + false, + 'insert', + << 'after'), + true, + 'insert', + << 'pos #1'), + 1, + 'insert', + << 'pos #1'), + 0, + 'change', + << 'before'), + false, + 'insert', + << 'after'), + true, + 'insert', + << 'pos #1'), + 1, + 'insert', + << 'before'), + false, + 'insert', + << 'before'), + false, + 'insert', + << 'before'), + false, + 'insert', + <<markTestIncomplete('Alter Block Test is broken'); + + $this->template->set_filenames(array('test' => 'loop_nested.html')); + + // @todo Change this + $this->template->assign_block_vars('outer', array()); + $this->template->assign_block_vars('outer.middle', array()); + $this->template->assign_block_vars('outer.middle', array()); + $this->template->assign_block_vars('outer', array()); + $this->template->assign_block_vars('outer.middle', array()); + $this->template->assign_block_vars('outer.middle', array()); + $this->template->assign_block_vars('outer.middle', array()); + $this->template->assign_block_vars('outer', array()); + $this->template->assign_block_vars('outer.middle', array()); + $this->template->assign_block_vars('outer.middle', array()); + + $this->assertEquals("outer - 0/3\nmiddle - 0/2\nmiddle - 1/2\nouter - 1/3\nmiddle - 0/3\nmiddle - 1/3\nmiddle - 2/3\nouter - 2/3\nmiddle - 0/2\nmiddle - 1/2", $this->display('test'), 'Ensuring template is built correctly before modification'); + + $this->template->alter_block_array($alter_block, $vararray, $key, $mode); + $this->assertEquals($expect, $this->display('test'), $description); + } +} + diff --git a/tests/template/templates/_dummy_include.php b/tests/template/templates/_dummy_include.php new file mode 100644 index 0000000000..1de5dddf59 --- /dev/null +++ b/tests/template/templates/_dummy_include.php @@ -0,0 +1,3 @@ + +fail + + +pass + + +fail + +fail + +pass + + +fail + +pass + + + diff --git a/tests/template/templates/define.html b/tests/template/templates/define.html new file mode 100644 index 0000000000..82237d21a3 --- /dev/null +++ b/tests/template/templates/define.html @@ -0,0 +1,8 @@ + +{$VALUE} + +{$VALUE} + +{$VALUE} + + diff --git a/tests/template/templates/expressions.html b/tests/template/templates/expressions.html new file mode 100644 index 0000000000..c40d967dab --- /dev/null +++ b/tests/template/templates/expressions.html @@ -0,0 +1,86 @@ +passfail + +failpass + +failpass + +passfail + +failpass + +passfail + +failpass + +passfail + +passfail + +passfail + + +passfail + +passfail + +passfail + +passfail + + +passfail + +passfail + + +passfail + +passfail + +passfail + +passfail + +passfail + +passfail + + +passfail + +passfail + + +passfail + +passfail + +passfail + +passfail + +passfail + +passfail + + +passfail + +passfail + + +passfail + +passfail + + +passfail + +passfail + +passfail + + +passfail + +passfail diff --git a/tests/template/templates/if.html b/tests/template/templates/if.html new file mode 100644 index 0000000000..c502e52f51 --- /dev/null +++ b/tests/template/templates/if.html @@ -0,0 +1,11 @@ + +1 + +2 + +0 + + + +0 + diff --git a/tests/template/templates/include.html b/tests/template/templates/include.html new file mode 100644 index 0000000000..730d713d65 --- /dev/null +++ b/tests/template/templates/include.html @@ -0,0 +1 @@ + diff --git a/tests/template/templates/includephp.html b/tests/template/templates/includephp.html new file mode 100644 index 0000000000..3e13fa33fa --- /dev/null +++ b/tests/template/templates/includephp.html @@ -0,0 +1 @@ + diff --git a/tests/template/templates/lang.html b/tests/template/templates/lang.html new file mode 100644 index 0000000000..2b5ea1cafe --- /dev/null +++ b/tests/template/templates/lang.html @@ -0,0 +1,3 @@ +{L_VARIABLE} + +{LA_VARIABLE} diff --git a/tests/template/templates/loop.html b/tests/template/templates/loop.html new file mode 100644 index 0000000000..de1a10004d --- /dev/null +++ b/tests/template/templates/loop.html @@ -0,0 +1,21 @@ + +loop + +noloop + + + +loop + +noloop + + + +loop + + + + +loop#{loop.S_ROW_COUNT}-block#{block.S_ROW_COUNT} + + diff --git a/tests/template/templates/loop_advanced.html b/tests/template/templates/loop_advanced.html new file mode 100644 index 0000000000..c75fe55f03 --- /dev/null +++ b/tests/template/templates/loop_advanced.html @@ -0,0 +1,19 @@ +{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW} +x +{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW} +x +{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW} +x +{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW} +x +{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW} +x +{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW} +x +{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW} +x +{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW} +x +{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW} +x +{loop.S_FIRST_ROW}{loop.S_ROW_COUNT}{loop.S_LAST_ROW} diff --git a/tests/template/templates/loop_nested.html b/tests/template/templates/loop_nested.html new file mode 100644 index 0000000000..571df97b4c --- /dev/null +++ b/tests/template/templates/loop_nested.html @@ -0,0 +1,8 @@ + + {outer.S_BLOCK_NAME} - {outer.S_ROW_NUM}/{outer.S_NUM_ROWS} - {outer.VARIABLE} + + + {middle.S_BLOCK_NAME} - {middle.S_ROW_NUM}/{middle.S_NUM_ROWS} - {middle.VARIABLE} + + + diff --git a/tests/template/templates/loop_vars.html b/tests/template/templates/loop_vars.html new file mode 100644 index 0000000000..4f02fd2e6c --- /dev/null +++ b/tests/template/templates/loop_vars.html @@ -0,0 +1,21 @@ + +first + +{loop.S_ROW_COUNT} + +{loop.VARIABLE} + +set + + +last + + + +{inner.S_ROW_COUNT} + +last inner + + + +inner loop diff --git a/tests/template/templates/php.html b/tests/template/templates/php.html new file mode 100644 index 0000000000..07a260cdb3 --- /dev/null +++ b/tests/template/templates/php.html @@ -0,0 +1 @@ +echo "test"; diff --git a/tests/template/templates/variable.html b/tests/template/templates/variable.html new file mode 100644 index 0000000000..f68f91597c --- /dev/null +++ b/tests/template/templates/variable.html @@ -0,0 +1 @@ +{VARIABLE} diff --git a/tests/test_framework/framework.php b/tests/test_framework/framework.php new file mode 100644 index 0000000000..5913d20ca0 --- /dev/null +++ b/tests/test_framework/framework.php @@ -0,0 +1,36 @@ += 6.0.0 we do not need some code +if (version_compare(PHP_VERSION, '6.0.0-dev', '>=')) +{ + define('STRIP', false); +} +else +{ + @set_magic_quotes_runtime(0); + define('STRIP', (get_magic_quotes_gpc()) ? true : false); +} + +require_once $phpbb_root_path . 'includes/constants.php'; + +// require at least PHPUnit 3.3.0 +require_once 'PHPUnit/Runner/Version.php'; +if (version_compare(PHPUnit_Runner_Version::id(), '3.3.0', '<')) +{ + trigger_error('PHPUnit >= 3.3.0 required'); +} + +require_once 'PHPUnit/Framework.php'; +require_once 'test_framework/phpbb_test_case.php'; diff --git a/tests/test_framework/phpbb_test_case.php b/tests/test_framework/phpbb_test_case.php new file mode 100644 index 0000000000..3cf2a9d442 --- /dev/null +++ b/tests/test_framework/phpbb_test_case.php @@ -0,0 +1,37 @@ +expectedTriggerError = true; + $this->setExpectedException($exceptionName, (string) $message, $errno); + } +} diff --git a/tests/text_processing/all_tests.php b/tests/text_processing/all_tests.php new file mode 100644 index 0000000000..5e759c72ee --- /dev/null +++ b/tests/text_processing/all_tests.php @@ -0,0 +1,41 @@ +addTestSuite('phpbb_text_processing_make_clickable_test'); + + return $suite; + } +} + +if (PHPUnit_MAIN_METHOD == 'phpbb_text_processing_all_tests::main') +{ + phpbb_text_processing_all_tests::main(); +} + diff --git a/tests/text_processing/make_clickable.php b/tests/text_processing/make_clickable.php new file mode 100644 index 0000000000..a667dd705e --- /dev/null +++ b/tests/text_processing/make_clickable.php @@ -0,0 +1,106 @@ + whether it should work + $prefix_texts = array( + '' => true, + "np \n" => true, + 'bp text ' => true, + 'cp text>' => true, + 'ep text.' => array('w' => false), // doesn't work for www. type urls, but for everything else + ); + $suffix_texts = array( + '' => true, + "\n ns" => true, + ' bs text.' => true, + '>cs text' => true, + '"ds text' => true, + '. es text.' => true, + ', fs text.' => true, + ); + + $urls = array( + 'http://example.com' => array('tag' => 'm', 'url' => false, 'text' => false), // false means same as key + 'http://example.com/' => array('tag' => 'm', 'url' => false, 'text' => false), + 'http://example.com/path?query=abc' => array('tag' => 'm', 'url' => false, 'text' => false), + 'http://example.com/1' => array('tag' => 'm', 'url' => false, 'text' => false), + 'http://example.com/some/very/long/path/with/over/55/characters?and=a&long=query&too=1' => array('tag' => 'm', 'url' => false, 'text' => 'http://example.com/some/very/long/path/ ... uery&too=1'), + 'http://localhost' => array('tag' => 'm', 'url' => false, 'text' => false), + 'http://localhost/#abc' => array('tag' => 'm', 'url' => false, 'text' => false), + + 'www.example.com/path/' => array('tag' => 'w', 'url' => 'http://www.example.com/path/', 'text' => false), + 'randomwww.example.com/path/' => false, + + 'http://thisdomain.org' => array('tag' => 'm', 'url' => false, 'text' => false), + 'http://thisdomain.org/' => array('tag' => 'm', 'url' => false, 'text' => false), + 'http://thisdomain.org/1' => array('tag' => 'l', 'url' => false, 'text' => '1'), + 'http://thisdomain.org/path/some?query=abc#test' => array('tag' => 'l', 'url' => false, 'text' => 'path/some?query=abc#test'), + + 'javascript:www.example.com/' => false, + ); + + $test_data = array(); + + // run the test for each combination + foreach ($prefix_texts as $prefix => $prefix_success) + { + foreach ($suffix_texts as $suffix => $suffix_success) + { + foreach ($urls as $url => $url_type) + { + $input = $prefix . $url . $suffix; + // no valid url => no change + $output = $input; + + if ( + ($prefix_success && $suffix_success && is_array($url_type)) && + // handle except syntax for prefix/suffix + (!is_array($prefix_success) || !isset($prefix_success[$url_type['tag']]) || $prefix_success[$url_type['tag']] == true) && + (!is_array($suffix_success) || !isset($suffix_success[$url_type['tag']]) || $suffix_success[$url_type['tag']] == true) + ) + { + // false means it's the same as the url, less typing + $url_type['url'] = ($url_type['url']) ? $url_type['url'] : $url; + $url_type['text'] = ($url_type['text']) ? $url_type['text'] : $url; + + $class = ($url_type['tag'] === 'l') ? 'postlink-local' : 'postlink'; + + // replace the url with the desired output format + $output = $prefix . '' . $url_type['text'] . '' . $suffix; + } + $test_data[] = array($input, $output); + } + } + } + + return $test_data; + } + + /** + * @dataProvider make_clickable_data + */ + public function test_make_clickable($input, $expected) + { + $result = make_clickable($input, 'http://thisdomain.org'); + + $label = 'Making text clickable: ' . $input; + $this->assertEquals($expected, $result, $label); + } + +} + diff --git a/tests/utf/all_tests.php b/tests/utf/all_tests.php new file mode 100644 index 0000000000..0d5d44d695 --- /dev/null +++ b/tests/utf/all_tests.php @@ -0,0 +1,43 @@ +addTestSuite('phpbb_utf_utf8_wordwrap_test'); + $suite->addTestSuite('phpbb_utf_utf8_clean_string_test'); + + return $suite; + } +} + +if (PHPUnit_MAIN_METHOD == 'phpbb_utf_all_tests::main') +{ + phpbb_utf_all_tests::main(); +} + diff --git a/tests/utf/utf8_clean_string_test.php b/tests/utf/utf8_clean_string_test.php new file mode 100644 index 0000000000..870ad76fc4 --- /dev/null +++ b/tests/utf/utf8_clean_string_test.php @@ -0,0 +1,32 @@ +assertEquals($output, utf8_clean_string($input), $label); + } +} + diff --git a/tests/utf/utf8_wordwrap_test.php b/tests/utf/utf8_wordwrap_test.php new file mode 100644 index 0000000000..ef1165a897 --- /dev/null +++ b/tests/utf/utf8_wordwrap_test.php @@ -0,0 +1,84 @@ +assertEquals($php_wordwrap, $phpbb_utf8_wordwrap, "Checking ASCII standard behaviour with length 20"); + + $php_wordwrap = wordwrap($text, 30, "
            \n"); + $phpbb_utf8_wordwrap = utf8_wordwrap($text, 30, "
            \n"); + $this->assertEquals($php_wordwrap, $phpbb_utf8_wordwrap, "Checking ASCII special break string with length 30"); + + $text = 'A very long woooooooooooord.'; + + $php_wordwrap = wordwrap($text, 8, "\n"); + $phpbb_utf8_wordwrap = utf8_wordwrap($text, 8, "\n"); + $this->assertEquals($php_wordwrap, $phpbb_utf8_wordwrap, 'Checking ASCII not cutting long words'); + + $php_wordwrap = wordwrap($text, 8, "\n", true); + $phpbb_utf8_wordwrap = utf8_wordwrap($text, 8, "\n", true); + $this->assertEquals($php_wordwrap, $phpbb_utf8_wordwrap, 'Checking ASCII cutting long words'); + } + + /** + * Helper function that generates meaningless greek text + */ + private function turn_into_greek($string) + { + $greek_chars = array("\xCE\x90", "\xCE\x91", "\xCE\x92", "\xCE\x93", "\xCE\x94", "\xCE\x95", "\xCE\x96", "\xCE\x97", "\xCE\x98", "\xCE\x99"); + + $greek = ''; + for ($i = 0, $n = strlen($string); $i < $n; $i++) + { + // replace each number with the character from the array + if (ctype_digit($string[$i])) + { + $greek .= $greek_chars[(int) $string[$i]]; + } + else + { + $greek .= $string[$i]; + } + } + + return $greek; + } + + public function test_utf8_wordwrap_utf8() + { + $text = "0123456 0123 012345 01234"; + $greek = $this->turn_into_greek($text); + + $expected = $this->turn_into_greek(wordwrap($text, 10)); + $phpbb_utf8_wordwrap = utf8_wordwrap($greek, 10); + $this->assertEquals($expected, $phpbb_utf8_wordwrap, 'Checking UTF-8 standard behaviour with length 10'); + } + + public function test_utf8_wordwrap_utf8_cut() + { + $text = "0123456 0123 012345 01234"; + $greek = $this->turn_into_greek($text); + + $expected = $this->turn_into_greek(wordwrap($text, 5, "\n", true)); + $phpbb_utf8_wordwrap = utf8_wordwrap($greek, 5, "\n", true); + $this->assertEquals($expected, $phpbb_utf8_wordwrap, 'Checking UTF-8 cutting long words'); + } +} + From db8c557e4c6fee0a66c78863d4082dc17ff22d57 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Wed, 10 Mar 2010 20:07:10 +0100 Subject: [PATCH 068/393] [git-tools] pre-commit hook for syntax checking This pre-commit hook utilises PHP's command-line -l (lint) option, which checks for syntax errors. In case of an error the commit is rejected and the error displayed. Testing is welcome. --- git-tools/hooks/pre-commit | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 git-tools/hooks/pre-commit diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit new file mode 100755 index 0000000000..4a070d130c --- /dev/null +++ b/git-tools/hooks/pre-commit @@ -0,0 +1,44 @@ +#!/bin/sh +# +# A hook to disallow php syntax errors to be committed +# by running php -l (lint) on them. It requires php-cli +# to be installed. +# +# This is a pre-commit hook. +# +# To install this you can either copy or symlink it to +# $GIT_DIR/hooks, example: +# +# ln -s ../../git-tools/hooks/pre-commit \\ +# .git/hooks/pre-commit + +# necessary check for initial commit +if git rev-parse --verify HEAD >/dev/null 2>&1 +then + against=HEAD +else + # Initial commit: diff against an empty tree object + against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 +fi + +error=0 + +# get a list of staged .php files, omitting file removals +IFS=" " +for file in $(git diff --cached --name-status $against | grep -v -E '^D' | cut -f2 | grep -E '\.php$') +do + # store lint result in a temp file + tempfile="/tmp/$(basename $0).$$.tmp" + if ! php -l "$file" >/dev/null 2>"$tempfile" + then + error=1 + cat "$tempfile" + fi + rm -f "$tempfile" +done +unset IFS + +if [ $error -eq 1 ] +then + exit 1 +fi From 6df10358aa7f9c544b188b51d6d1e8b3e66c8a28 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Wed, 10 Mar 2010 21:37:55 +0100 Subject: [PATCH 069/393] [git-tools] use mktemp in pre-commit (thanks nn-) --- git-tools/hooks/pre-commit | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit index 4a070d130c..937d2d2dc0 100755 --- a/git-tools/hooks/pre-commit +++ b/git-tools/hooks/pre-commit @@ -28,13 +28,12 @@ IFS=" " for file in $(git diff --cached --name-status $against | grep -v -E '^D' | cut -f2 | grep -E '\.php$') do # store lint result in a temp file - tempfile="/tmp/$(basename $0).$$.tmp" + tempfile=$(mktemp -t "$(basename $0).XXXXXX") if ! php -l "$file" >/dev/null 2>"$tempfile" then error=1 cat "$tempfile" fi - rm -f "$tempfile" done unset IFS From f9192bed79c2d5a0c1e8388bcdc35be3d21aa9a8 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Thu, 11 Mar 2010 19:44:21 +0100 Subject: [PATCH 070/393] [git-tools] Some pre-commit enhancements, abolish tempfile --- git-tools/hooks/pre-commit | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit index 937d2d2dc0..6129470196 100755 --- a/git-tools/hooks/pre-commit +++ b/git-tools/hooks/pre-commit @@ -12,6 +12,8 @@ # ln -s ../../git-tools/hooks/pre-commit \\ # .git/hooks/pre-commit +PHP_BIN=php + # necessary check for initial commit if git rev-parse --verify HEAD >/dev/null 2>&1 then @@ -27,12 +29,10 @@ error=0 IFS=" " for file in $(git diff --cached --name-status $against | grep -v -E '^D' | cut -f2 | grep -E '\.php$') do - # store lint result in a temp file - tempfile=$(mktemp -t "$(basename $0).XXXXXX") - if ! php -l "$file" >/dev/null 2>"$tempfile" + # hide output, but show errors + if ! $PHP_BIN -l "$file" >/dev/null then error=1 - cat "$tempfile" fi done unset IFS From d07e152ea7e820c5a0e47aeb8004fa0b5621a314 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 13 Mar 2010 01:54:04 +0000 Subject: [PATCH 071/393] [bug/58025] Search robots are now redirected if they send a SID in the request Previously search robots could stumble upon a board link somewhere on the web containing a SID they'd follow it and end up indexing that page with the SID in the request URI, this fix prevents that by redirecting them to the same URI just without the SID. --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/session.php | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 7b8d8f63f2..7df49bd81b 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -103,6 +103,7 @@
          27. [Fix] Allow multibyte keys in request_var(). (Bug #51555)
          28. [Fix] Prevent wrong tar archive type detection. (Bug #12531)
          29. [Fix] Correct redirection after login to forum not in web root (Bug #58755)
          30. +
          31. [Fix] Redirect search engines that access pages with SIDs in the URL. (Bug #58025)
          32. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
          33. diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 1a302d5991..8beb0161f9 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -608,6 +608,12 @@ class session } else { + // Bot user, if they have a SID in the Request URI we need to get rid of it + // otherwise they'll index this page with the SID, duplicate content oh my! + if (isset($_GET['sid'])) + { + redirect(build_url(array('sid'))); + } $this->data['session_last_visit'] = $this->time_now; } From 4349bec316e93ed6feac3ad7e56e54b6320aa960 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 13 Mar 2010 11:37:06 +0100 Subject: [PATCH 072/393] [bug/59135] Fix open_basedir issues when accessing styles- and language-management. (Bug #59135) introduced in r10496 and r10360/r10361 --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_language.php | 4 ++-- phpBB/includes/acp/acp_styles.php | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 7b8d8f63f2..e6cefc15c4 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -103,6 +103,7 @@
          34. [Fix] Allow multibyte keys in request_var(). (Bug #51555)
          35. [Fix] Prevent wrong tar archive type detection. (Bug #12531)
          36. [Fix] Correct redirection after login to forum not in web root (Bug #58755)
          37. +
          38. [Fix] Fix open_basedir issues when accessing styles- and language-management. (Bug #59135)
          39. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
          40. diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php index fedae6fe67..c2cb2f9c11 100644 --- a/phpBB/includes/acp/acp_language.php +++ b/phpBB/includes/acp/acp_language.php @@ -1120,12 +1120,12 @@ class acp_language { while (($file = readdir($dp)) !== false) { - if (!is_dir($phpbb_root_path . 'language/' . $file)) + if ($file[0] == '.' || !is_dir($phpbb_root_path . 'language/' . $file)) { continue; } - if ($file[0] != '.' && file_exists("{$phpbb_root_path}language/$file/iso.txt")) + if (file_exists("{$phpbb_root_path}language/$file/iso.txt")) { if (!in_array($file, $installed)) { diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index d2a0f9210f..3310560c73 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -643,13 +643,13 @@ parse_css_file = {PARSE_CSS_FILE} { while (($file = readdir($dp)) !== false) { - if (!is_dir($phpbb_root_path . 'styles/' . $file)) + if ($file[0] == '.' || !is_dir($phpbb_root_path . 'styles/' . $file)) { continue; } $subpath = ($mode != 'style') ? "$mode/" : ''; - if ($file[0] != '.' && file_exists("{$phpbb_root_path}styles/$file/$subpath$mode.cfg")) + if (file_exists("{$phpbb_root_path}styles/$file/$subpath$mode.cfg")) { if ($cfg = file("{$phpbb_root_path}styles/$file/$subpath$mode.cfg")) { From 6a9304021f41cd8319ccb009bb24792ffc5438bc Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sat, 13 Mar 2010 13:04:44 +0100 Subject: [PATCH 073/393] [git-tools] Improvements on prepare-commt-msg hook prepare-commit-hook now uses `git symbolic-ref HEAD` instead of reading $GIT_DIR/HEAD directly. This seems to be a more portable solution. Thanks to Chris (cs278/ToonArmy) for the suggestion. --- git-tools/hooks/prepare-commit-msg | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/git-tools/hooks/prepare-commit-msg b/git-tools/hooks/prepare-commit-msg index e1e05d67b8..354b539cc1 100755 --- a/git-tools/hooks/prepare-commit-msg +++ b/git-tools/hooks/prepare-commit-msg @@ -10,15 +10,25 @@ # # ln -s ../../git-tools/hooks/prepare-commit-msg \\ # .git/hooks/prepare-commit-msg -# -# Make sure it is executable. -# strip off ref: refs/heads/ -branch="$(cat $GIT_DIR/HEAD | sed 's/ref: refs\/heads\///g')" +# get branch name +branch="$(git symbolic-ref HEAD)" +# exit if no branch name is present +# (eg. detached HEAD) +if [ $? -ne 0 ] +then + exit +fi + +# strip off refs/heads/ +branch="$(echo "$branch" | sed "s/refs\/heads\///g")" + +# add [branchname] to commit message # * only run when normal commit is made (without -m or -F; # not a merge, etc.) # * also make sure the branch name begins with bug/ or feature/ -if [ "$2" = "" ] && [ $(echo "$branch" | grep -e '^\(bug\|feature\)/') ]; then - echo "[$branch] $(cat $1)" > "$1" +if [ "$2" = "" ] && [ $(echo "$branch" | grep -e "^\(bug\|feature\)/") ] +then + echo "[$branch] $(cat "$1")" > "$1" fi From 144effd74cf52a71a62e127276d78f56eab41835 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Mon, 15 Mar 2010 22:48:53 -0500 Subject: [PATCH 074/393] Allow setting parent forums regardless of permission settings. (Bug #58415) --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/acp/acp_forums.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 53863da302..560e1e9013 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -98,6 +98,7 @@
          41. [Fix] Allow redirect() function to redirect across directories. (Bug #56965)
          42. [Fix] Add terminating semicolons to JavaScript code. (Bug #58085 - Patch by nn-)
          43. [Fix] Minor language fixes. (Bug #54855)
          44. +
          45. [Fix] Allow setting parent forums regardless of permission settings. (Bug #57415)
          46. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
          47. diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index bde59ec870..5a5adc57ae 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -407,7 +407,7 @@ class acp_forums $exclude_forums[] = $row['forum_id']; } - $parents_list = make_forum_select($forum_data['parent_id'], $exclude_forums, false, false, false); + $parents_list = make_forum_select($forum_data['parent_id'], $exclude_forums, true, false, false); $forum_data['forum_password_confirm'] = $forum_data['forum_password']; } @@ -416,7 +416,7 @@ class acp_forums $this->page_title = 'CREATE_FORUM'; $forum_id = $this->parent_id; - $parents_list = make_forum_select($this->parent_id, false, false, false, false); + $parents_list = make_forum_select($this->parent_id, false, true, false, false); // Fill forum data with default values if (!$update) From ae48c8ee9ecf7866e4fe1ca4d3390d69a1adc2b4 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Wed, 17 Mar 2010 21:04:54 +0100 Subject: [PATCH 075/393] [git-tools] Improvements for the pre-commit hook One major issue with the pre-hook so far was partially staged files, because it used filenames for php lint. These changes will make the hook read the file contents from the index instead. Great thanks to David Soria Parra. --- git-tools/hooks/pre-commit | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit index 6129470196..1c67a0f3e3 100755 --- a/git-tools/hooks/pre-commit +++ b/git-tools/hooks/pre-commit @@ -25,12 +25,35 @@ fi error=0 -# get a list of staged .php files, omitting file removals -IFS=" " -for file in $(git diff --cached --name-status $against | grep -v -E '^D' | cut -f2 | grep -E '\.php$') +IFS=$'\n' +# get a list of staged files +for line in $(git diff-index --cached --full-index $against) do - # hide output, but show errors - if ! $PHP_BIN -l "$file" >/dev/null + # split needed values + sha=$(echo $line | cut -d' ' -f4) + temp=$(echo $line | cut -d' ' -f5) + status=$(echo $temp | cut -d' ' -f1) + filename=$(echo $temp | cut -d' ' -f2) + + # file extension + ext=$(echo $filename | sed 's/^.*\.//') + + # only check files with php extension + if [ $ext != "php" ] + then + continue + fi + + # do not check deleted files + if [ $status = "D" ] + then + continue + fi + + # check the staged file content for syntax errors + # using php -l (lint) + git cat-file -p $sha | $PHP_BIN -l >/dev/null + if [ $? -ne 0 ] then error=1 fi From 559313eda60459ed7b73e790257321402824d35c Mon Sep 17 00:00:00 2001 From: mrkurt Date: Wed, 17 Mar 2010 06:08:52 -0500 Subject: [PATCH 076/393] [feature/memcache-multi-server] Adding support for multiple memcache servers to acm_memcache.php You can define multiple memcache servers in your config using this format: host::port,host::port,host::port Example: @define(PHPBB_ACM_MEMCACHE, '127.0.0.1::11211,10.0.0.2::11211,memcache1::11211' --- phpBB/includes/acm/acm_memcache.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acm/acm_memcache.php b/phpBB/includes/acm/acm_memcache.php index 52b8832749..5a96509d38 100644 --- a/phpBB/includes/acm/acm_memcache.php +++ b/phpBB/includes/acm/acm_memcache.php @@ -37,6 +37,11 @@ if (!defined('PHPBB_ACM_MEMCACHE_HOST')) define('PHPBB_ACM_MEMCACHE_HOST', 'localhost'); } +if (!defined('PHPBB_ACM_MEMCACHE')){ + //can define multiple servers with host1::port1,host2::port2 format + define('PHPBB_ACM_MEMCACHE', PHPBB_ACM_MEMCACHE_HOST . '::' . PHPBB_ACM_MEMCACHE_PORT); +} + /** * ACM for Memcached * @package acm @@ -54,7 +59,10 @@ class acm extends acm_memory parent::acm_memory(); $this->memcache = new Memcache; - $this->memcache->connect(PHPBB_ACM_MEMCACHE_HOST, PHPBB_ACM_MEMCACHE_PORT); + foreach(explode(',', PHPBB_ACM_MEMCACHE) as $u){ + $parts = explode('::', $u); + $this->memcache->addServer($parts[0], $parts[1]); + } $this->flags = (PHPBB_ACM_MEMCACHE_COMPRESS) ? MEMCACHE_COMPRESSED : 0; } @@ -125,4 +133,4 @@ class acm extends acm_memory } } -?> \ No newline at end of file +?> From c57c1f3fc606665fad6b31993c4a1481018b0915 Mon Sep 17 00:00:00 2001 From: mrkurt Date: Thu, 18 Mar 2010 06:08:24 -0500 Subject: [PATCH 077/393] [feature/memcache-multi-server] Changing format for multiple memcache hosts. Fixing code style issues in changes. Host and ports are now represented like this in config: host1/port1,host2/port2,host3/port3 --- phpBB/includes/acm/acm_memcache.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/phpBB/includes/acm/acm_memcache.php b/phpBB/includes/acm/acm_memcache.php index 5a96509d38..e54fa36c38 100644 --- a/phpBB/includes/acm/acm_memcache.php +++ b/phpBB/includes/acm/acm_memcache.php @@ -37,9 +37,10 @@ if (!defined('PHPBB_ACM_MEMCACHE_HOST')) define('PHPBB_ACM_MEMCACHE_HOST', 'localhost'); } -if (!defined('PHPBB_ACM_MEMCACHE')){ - //can define multiple servers with host1::port1,host2::port2 format - define('PHPBB_ACM_MEMCACHE', PHPBB_ACM_MEMCACHE_HOST . '::' . PHPBB_ACM_MEMCACHE_PORT); +if (!defined('PHPBB_ACM_MEMCACHE')) +{ + //can define multiple servers with host1/port1,host2/port2 format + define('PHPBB_ACM_MEMCACHE', PHPBB_ACM_MEMCACHE_HOST . '/' . PHPBB_ACM_MEMCACHE_PORT); } /** @@ -59,9 +60,10 @@ class acm extends acm_memory parent::acm_memory(); $this->memcache = new Memcache; - foreach(explode(',', PHPBB_ACM_MEMCACHE) as $u){ - $parts = explode('::', $u); - $this->memcache->addServer($parts[0], $parts[1]); + foreach(explode(',', PHPBB_ACM_MEMCACHE) as $u) + { + $parts = explode('/', $u); + $this->memcache->addServer(trim($parts[0]), trim($parts[1])); } $this->flags = (PHPBB_ACM_MEMCACHE_COMPRESS) ? MEMCACHE_COMPRESSED : 0; } From f7c41e1db71a7ad0941d0d1cf13564f1bd0bbd6a Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 18 Mar 2010 17:09:18 +0100 Subject: [PATCH 078/393] [feature/arstechnica/memcache-multi-server] Add memcache-multi-server to the changelog. --- phpBB/docs/CHANGELOG.html | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index e5dcd82806..3f457efb69 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -105,6 +105,7 @@
          48. [Fix] Correct redirection after login to forum not in web root (Bug #58755)
          49. [Fix] Allow setting parent forums regardless of permission settings. (Bug #57415)
          50. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
          51. +
          52. [Feature] The memcache acm plugin now supports multiple memcache servers.
          53. 1.i. Changes since 3.0.7

            From a3a8fb989cd01d9b4156041870069ebcb7e057dd Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 18 Mar 2010 17:22:30 +0000 Subject: [PATCH 079/393] [bug/59465] Removes start=0 from URLs used by viewtopic and viewforum. Having start=0 makes search engines index the page twice once with and once without the start=0 parameter. This results in duplicate results in the search results. Patch contributed by nn-. --- phpBB/viewforum.php | 6 +++--- phpBB/viewtopic.php | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 95c142d865..72b5074351 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -151,7 +151,7 @@ $template->set_filenames(array( make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"), $forum_id); $template->assign_vars(array( - 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id&start=$start"), + 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . (($start == 0) ? '' : "&start=$start")), )); // Not postable forum or showing active topics? @@ -302,7 +302,7 @@ $template->assign_vars(array( 'S_WATCH_FORUM_LINK' => $s_watching_forum['link'], 'S_WATCH_FORUM_TITLE' => $s_watching_forum['title'], 'S_WATCHING_FORUM' => $s_watching_forum['is_watching'], - 'S_FORUM_ACTION' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id&start=$start"), + 'S_FORUM_ACTION' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . (($start == 0) ? '' : "&start=$start")), 'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && $config['load_search']) ? true : false, 'S_SEARCHBOX_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx", 'fid[]=' . $forum_id), 'S_SINGLE_MODERATOR' => (!empty($moderators[$forum_id]) && sizeof($moderators[$forum_id]) > 1) ? false : true, @@ -311,7 +311,7 @@ $template->assign_vars(array( 'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&i=main&mode=forum_view", true, $user->session_id) : '', 'U_POST_NEW_TOPIC' => ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=post&f=' . $forum_id) : '', - 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . "&start=$start"), + 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($start == 0) ? '' : "&start=$start")), 'U_MARK_TOPICS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'hash=' . generate_link_hash('global') . "&f=$forum_id&mark=topics") : '', )); diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 29c4e5cdc1..8e0521522d 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -477,7 +477,7 @@ if ($start < 0 || $start >= $total_posts) } // General Viewtopic URL for return links -$viewtopic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')); +$viewtopic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')); // Are we watching this topic? $s_watching_topic = array( @@ -601,7 +601,7 @@ $template->assign_vars(array( 'PAGINATION' => $pagination, 'PAGE_NUMBER' => on_page($total_posts, $config['posts_per_page'], $start), 'TOTAL_POSTS' => ($total_posts == 1) ? $user->lang['VIEW_TOPIC_POST'] : sprintf($user->lang['VIEW_TOPIC_POSTS'], $total_posts), - 'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=topic_view&f=$forum_id&t=$topic_id&start=$start" . ((strlen($u_sort_param)) ? "&$u_sort_param" : ''), true, $user->session_id) : '', + 'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=topic_view&f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . ((strlen($u_sort_param)) ? "&$u_sort_param" : ''), true, $user->session_id) : '', 'MODERATORS' => (isset($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id])) ? implode(', ', $forum_moderators[$forum_id]) : '', 'POST_IMG' => ($topic_data['forum_status'] == ITEM_LOCKED) ? $user->img('button_topic_locked', 'FORUM_LOCKED') : $user->img('button_topic_new', 'POST_NEW_TOPIC'), @@ -630,9 +630,9 @@ $template->assign_vars(array( 'S_SELECT_SORT_KEY' => $s_sort_key, 'S_SELECT_SORT_DAYS' => $s_limit_days, 'S_SINGLE_MODERATOR' => (!empty($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id]) > 1) ? false : true, - 'S_TOPIC_ACTION' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start"), + 'S_TOPIC_ACTION' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start")), 'S_TOPIC_MOD' => ($topic_mod != '') ? '' : '', - 'S_MOD_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&t=$topic_id&start=$start&quickmod=1&redirect=" . urlencode(str_replace('&', '&', $viewtopic_url)), true, $user->session_id), + 'S_MOD_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . "&quickmod=1&redirect=" . urlencode(str_replace('&', '&', $viewtopic_url)), true, $user->session_id), 'S_VIEWTOPIC' => true, 'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && $config['load_search']) ? true : false, @@ -722,7 +722,7 @@ if (!empty($topic_data['poll_start'])) if (!sizeof($voted_id) || sizeof($voted_id) > $topic_data['poll_max_options'] || in_array(VOTE_CONVERTED, $cur_voted_id) || !check_form_key('posting')) { - $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start"); + $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start")); meta_refresh(5, $redirect_url); if (!sizeof($voted_id)) @@ -805,7 +805,7 @@ if (!empty($topic_data['poll_start'])) //, topic_last_post_time = ' . time() . " -- for bumping topics with new votes, ignore for now $db->sql_query($sql); - $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&start=$start"); + $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start")); meta_refresh(5, $redirect_url); trigger_error($user->lang['VOTE_SUBMITTED'] . '

            ' . sprintf($user->lang['RETURN_TOPIC'], '', '')); From 492063cec63fe3665406a74e74265c1a7dd5c295 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 18 Mar 2010 20:27:18 +0000 Subject: [PATCH 080/393] [bug/59465] Remove start=0 from topic pagination links. Patch once again by nn-. --- phpBB/includes/functions_display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index f49aa42324..ea77551fc4 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -660,7 +660,7 @@ function topic_generate_pagination($replies, $url) $times = 1; for ($j = 0; $j < $replies + 1; $j += $per_page) { - $pagination .= '' . $times . ''; + $pagination .= '' . $times . ''; if ($times == 1 && $total_pages > 5) { $pagination .= ' ... '; From b64686073aaeb00feaf9d285c8cf62f3e677544b Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 6 Mar 2010 18:02:26 +0000 Subject: [PATCH 081/393] [bug/58685] Correct spelling errors in append_sid() comments. --- phpBB/includes/functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 917433a970..ce1f5f5462 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2139,8 +2139,8 @@ function append_sid($url, $params = false, $is_amp = true, $session_id = false) { global $_SID, $_EXTRA_URL, $phpbb_hook; - // Developers using the hook function need to globalise the $_SID and $_EXTRA_URL on their own and also handle it appropiatly. - // They could mimick most of what is within this function + // Developers using the hook function need to globalise the $_SID and $_EXTRA_URL on their own and also handle it appropriately. + // They could mimic most of what is within this function if (!empty($phpbb_hook) && $phpbb_hook->call_hook(__FUNCTION__, $url, $params, $is_amp, $session_id)) { if ($phpbb_hook->hook_return(__FUNCTION__)) From eca2db4afefdfbb256d61fae3f942835848f04e0 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Wed, 17 Mar 2010 23:24:34 -0500 Subject: [PATCH 082/393] [bug/56965] Redirect fails with directory traversal Correct invalid r10536 with a boolean flag. Note that this fix for the bug will not actually correct the redirects, it will only prevent phpBB from redirecting outside $phpbb_root_path when redirect()'s third argument is not provided. --- phpBB/includes/functions.php | 100 +++++++++++++++++++---------------- 1 file changed, 53 insertions(+), 47 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 38f910974a..be949a1258 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2297,6 +2297,8 @@ function redirect($url, $return = false, $disable_cd_check = false) { global $db, $cache, $config, $user, $phpbb_root_path; + $failover_flag = false; + if (empty($user->lang)) { $user->add_lang('common'); @@ -2344,66 +2346,70 @@ function redirect($url, $return = false, $disable_cd_check = false) if (!file_exists($pathinfo['dirname'])) { // fallback to "last known user page" + // at least this way we know the user does not leave the phpBB root $url = generate_board_url() . '/' . $user->page['page']; - break; + $failover_flag = true; } } - // Is the uri pointing to the current directory? - if ($pathinfo['dirname'] == '.') + if (!$failover_flag) { - $url = str_replace('./', '', $url); - - // Strip / from the beginning - if ($url && substr($url, 0, 1) == '/') + // Is the uri pointing to the current directory? + if ($pathinfo['dirname'] == '.') { - $url = substr($url, 1); - } + $url = str_replace('./', '', $url); - if ($user->page['page_dir']) - { - $url = generate_board_url() . '/' . $user->page['page_dir'] . '/' . $url; + // Strip / from the beginning + if ($url && substr($url, 0, 1) == '/') + { + $url = substr($url, 1); + } + + if ($user->page['page_dir']) + { + $url = generate_board_url() . '/' . $user->page['page_dir'] . '/' . $url; + } + else + { + $url = generate_board_url() . '/' . $url; + } } else { + // Used ./ before, but $phpbb_root_path is working better with urls within another root path + $root_dirs = explode('/', str_replace('\\', '/', phpbb_realpath($phpbb_root_path))); + $page_dirs = explode('/', str_replace('\\', '/', phpbb_realpath($pathinfo['dirname']))); + $intersection = array_intersect_assoc($root_dirs, $page_dirs); + + $root_dirs = array_diff_assoc($root_dirs, $intersection); + $page_dirs = array_diff_assoc($page_dirs, $intersection); + + $dir = str_repeat('../', sizeof($root_dirs)) . implode('/', $page_dirs); + + // Strip / from the end + if ($dir && substr($dir, -1, 1) == '/') + { + $dir = substr($dir, 0, -1); + } + + // Strip / from the beginning + if ($dir && substr($dir, 0, 1) == '/') + { + $dir = substr($dir, 1); + } + + $url = str_replace($pathinfo['dirname'] . '/', '', $url); + + // Strip / from the beginning + if (substr($url, 0, 1) == '/') + { + $url = substr($url, 1); + } + + $url = (!empty($dir) ? $dir . '/' : '') . $url; $url = generate_board_url() . '/' . $url; } } - else - { - // Used ./ before, but $phpbb_root_path is working better with urls within another root path - $root_dirs = explode('/', str_replace('\\', '/', phpbb_realpath($phpbb_root_path))); - $page_dirs = explode('/', str_replace('\\', '/', phpbb_realpath($pathinfo['dirname']))); - $intersection = array_intersect_assoc($root_dirs, $page_dirs); - - $root_dirs = array_diff_assoc($root_dirs, $intersection); - $page_dirs = array_diff_assoc($page_dirs, $intersection); - - $dir = str_repeat('../', sizeof($root_dirs)) . implode('/', $page_dirs); - - // Strip / from the end - if ($dir && substr($dir, -1, 1) == '/') - { - $dir = substr($dir, 0, -1); - } - - // Strip / from the beginning - if ($dir && substr($dir, 0, 1) == '/') - { - $dir = substr($dir, 1); - } - - $url = str_replace($pathinfo['dirname'] . '/', '', $url); - - // Strip / from the beginning - if (substr($url, 0, 1) == '/') - { - $url = substr($url, 1); - } - - $url = (!empty($dir) ? $dir . '/' : '') . $url; - $url = generate_board_url() . '/' . $url; - } } // Make sure no linebreaks are there... to prevent http response splitting for PHP < 4.4.2 From c71b1245ecf60d7b8b1143b1f558fcd2a974383a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 26 Mar 2010 14:46:18 +0100 Subject: [PATCH 083/393] [develop-olympus] Make this test run on windows with backslash-paths. --- tests/template/template.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/template/template.php b/tests/template/template.php index df12f92046..145fe8de61 100644 --- a/tests/template/template.php +++ b/tests/template/template.php @@ -264,7 +264,7 @@ class phpbb_template_template_test extends phpbb_test_case $this->template->set_filenames(array('test' => $filename)); $this->assertFileNotExists($this->template_path . '/' . $filename, 'Testing missing file, file cannot exist'); - $expecting = sprintf('template->_tpl_load_file(): File %s does not exist or is empty', realpath($this->template_path) . '/' . $filename); + $expecting = sprintf('template->_tpl_load_file(): File %s does not exist or is empty', realpath($this->template_path . '/../') . '/templates/' . $filename); $this->setExpectedTriggerError(E_USER_ERROR, $expecting); $this->display('test'); From 94bc65e2038407b8b6d2b23c195b232e07208d22 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 26 Mar 2010 16:39:37 +0100 Subject: [PATCH 084/393] [feature/dbal-tests] Added database test & refactored test framework There is now a phpbb_database_test_case which can be used as a base class for tests that require database access. You have to set up a test_config.php file in your tests/ directory containing host, user, pass etc. Extra test functionality has been moved to phpbb_test_case_helpers to provide the same functionality in database tests and regular tests without duplicating the code. This is achieved through delegation of method calls. --- tests/test_framework/framework.php | 3 + .../phpbb_database_test_case.php | 42 ++++++++++ tests/test_framework/phpbb_test_case.php | 32 +++----- .../phpbb_test_case_helpers.php | 82 +++++++++++++++++++ 4 files changed, 138 insertions(+), 21 deletions(-) create mode 100644 tests/test_framework/phpbb_database_test_case.php create mode 100644 tests/test_framework/phpbb_test_case_helpers.php diff --git a/tests/test_framework/framework.php b/tests/test_framework/framework.php index 5913d20ca0..abdcd1ad79 100644 --- a/tests/test_framework/framework.php +++ b/tests/test_framework/framework.php @@ -33,4 +33,7 @@ if (version_compare(PHPUnit_Runner_Version::id(), '3.3.0', '<')) } require_once 'PHPUnit/Framework.php'; +require_once 'PHPUnit/Extensions/Database/TestCase.php'; +require_once 'test_framework/phpbb_test_case_helpers.php'; require_once 'test_framework/phpbb_test_case.php'; +require_once 'test_framework/phpbb_database_test_case.php'; diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php new file mode 100644 index 0000000000..f0aa54ec8d --- /dev/null +++ b/tests/test_framework/phpbb_database_test_case.php @@ -0,0 +1,42 @@ +test_case_helpers) + { + $this->test_case_helpers = new phpbb_test_case_helpers($this); + } + } + + public function getConnection() + { + $this->init_test_case_helpers(); + $database_config = $this->test_case_helpers->get_database_config(); + + $pdo = new PDO('mysql:host=' . $database_config['dbhost'] . ';dbname=' . $database_config['dbname'], $database_config['dbuser'], $database_config['dbpasswd']); + return $this->createDefaultDBConnection($pdo, 'testdb'); + } + + public function new_dbal() + { + $this->init_test_case_helpers(); + return $this->test_case_helpers->new_dbal(); + } + + public function setExpectedTriggerError($errno, $message = '') + { + $this->init_test_case_helpers(); + $this->test_case_helpers->setExpectedTriggerError($errno, $message); + } +} diff --git a/tests/test_framework/phpbb_test_case.php b/tests/test_framework/phpbb_test_case.php index 3cf2a9d442..af867b29ff 100644 --- a/tests/test_framework/phpbb_test_case.php +++ b/tests/test_framework/phpbb_test_case.php @@ -9,29 +9,19 @@ class phpbb_test_case extends PHPUnit_Framework_TestCase { - protected $expectedTriggerError = false; + protected $test_case_helpers; + + public function init_test_case_helpers() + { + if (!$this->test_case_helpers) + { + $this->test_case_helpers = new phpbb_test_case_helpers($this); + } + } public function setExpectedTriggerError($errno, $message = '') { - $exceptionName = ''; - switch ($errno) - { - case E_NOTICE: - case E_STRICT: - PHPUnit_Framework_Error_Notice::$enabled = true; - $exceptionName = 'PHPUnit_Framework_Error_Notice'; - break; - - case E_WARNING: - PHPUnit_Framework_Error_Warning::$enabled = true; - $exceptionName = 'PHPUnit_Framework_Error_Warning'; - break; - - default: - $exceptionName = 'PHPUnit_Framework_Error'; - break; - } - $this->expectedTriggerError = true; - $this->setExpectedException($exceptionName, (string) $message, $errno); + $this->init_test_case_helpers(); + $this->test_case_helpers->setExpectedTriggerError($errno, $message); } } diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php new file mode 100644 index 0000000000..27a730e2dd --- /dev/null +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -0,0 +1,82 @@ +test_case = $test_case; + } + + public function get_database_config() + { + if (!file_exists('test_config.php')) + { + trigger_error("You have to create a test_config.php like this: + $dbms, + 'dbhost' => $dbhost, + 'dbport' => $dbport, + 'dbname' => $dbname, + 'dbuser' => $dbuser, + 'dbpasswd' => $dbpasswd, + ); + } + + public function new_dbal() + { + global $phpbb_root_path, $phpEx; + $config = $this->get_database_config(); + + require_once '../phpBB/includes/db/' . $config['dbms'] . '.php'; + $dbal = 'dbal_' . $config['dbms']; + $db = new $dbal(); + $db->sql_connect($config['dbhost'], $config['dbuser'], $config['dbpasswd'], $config['dbname'], $config['dbport']); + + return $db; + } + + public function setExpectedTriggerError($errno, $message = '') + { + $exceptionName = ''; + switch ($errno) + { + case E_NOTICE: + case E_STRICT: + PHPUnit_Framework_Error_Notice::$enabled = true; + $exceptionName = 'PHPUnit_Framework_Error_Notice'; + break; + + case E_WARNING: + PHPUnit_Framework_Error_Warning::$enabled = true; + $exceptionName = 'PHPUnit_Framework_Error_Warning'; + break; + + default: + $exceptionName = 'PHPUnit_Framework_Error'; + break; + } + $this->expectedTriggerError = true; + $this->test_case->setExpectedException($exceptionName, (string) $message, $errno); + } +} From af654814f63e05be5236075f06943062be007072 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 26 Mar 2010 16:41:19 +0100 Subject: [PATCH 085/393] [feature/dbal-tests] Added tests for dbal fetchrow and fetchfield. --- tests/all_tests.php | 2 ++ tests/dbal/all_tests.php | 40 ++++++++++++++++++++++++++++ tests/dbal/dbal.php | 43 +++++++++++++++++++++++++++++++ tests/dbal/fixtures/two_users.xml | 15 +++++++++++ 4 files changed, 100 insertions(+) create mode 100644 tests/dbal/all_tests.php create mode 100644 tests/dbal/dbal.php create mode 100644 tests/dbal/fixtures/two_users.xml diff --git a/tests/all_tests.php b/tests/all_tests.php index 1ed6126e80..e693427809 100644 --- a/tests/all_tests.php +++ b/tests/all_tests.php @@ -22,6 +22,7 @@ require_once 'request/all_tests.php'; require_once 'security/all_tests.php'; require_once 'template/all_tests.php'; require_once 'text_processing/all_tests.php'; +require_once 'dbal/all_tests.php'; // exclude the test directory from code coverage reports PHPUnit_Util_Filter::addDirectoryToFilter('./'); @@ -42,6 +43,7 @@ class phpbb_all_tests $suite->addTest(phpbb_security_all_tests::suite()); $suite->addTest(phpbb_template_all_tests::suite()); $suite->addTest(phpbb_text_processing_all_tests::suite()); + $suite->addTest(phpbb_dbal_all_tests::suite()); return $suite; } diff --git a/tests/dbal/all_tests.php b/tests/dbal/all_tests.php new file mode 100644 index 0000000000..7aee0f6b16 --- /dev/null +++ b/tests/dbal/all_tests.php @@ -0,0 +1,40 @@ +addTestSuite('phpbb_dbal_test'); + + return $suite; + } +} + +if (PHPUnit_MAIN_METHOD == 'phpbb_dbal_all_tests::main') +{ + phpbb_dbal_all_tests::main(); +} diff --git a/tests/dbal/dbal.php b/tests/dbal/dbal.php new file mode 100644 index 0000000000..a77279105f --- /dev/null +++ b/tests/dbal/dbal.php @@ -0,0 +1,43 @@ +createXMLDataSet(dirname(__FILE__).'/fixtures/two_users.xml'); + } + + public function test_select_row() + { + $db = $this->new_dbal(); + + $result = $db->sql_query('SELECT username_clean + FROM phpbb_users + WHERE user_id = 2'); + $row = $db->sql_fetchrow($result); + + $this->assertEquals(array('username_clean' => 'foobar'), $row); + } + + public function test_select_field() + { + $db = $this->new_dbal(); + + $result = $db->sql_query('SELECT username_clean + FROM phpbb_users + WHERE user_id = 2'); + + $this->assertEquals('foobar', $db->sql_fetchfield('username_clean')); + } +} + diff --git a/tests/dbal/fixtures/two_users.xml b/tests/dbal/fixtures/two_users.xml new file mode 100644 index 0000000000..255f061bd4 --- /dev/null +++ b/tests/dbal/fixtures/two_users.xml @@ -0,0 +1,15 @@ + + + + user_id + username_clean + + 1 + barfoo + + + 2 + foobar + +
            +
            From a7581085e002035ab5c516fe91fe4ece57087267 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 26 Mar 2010 17:37:01 +0100 Subject: [PATCH 086/393] [feature/dbal-tests] Load phpbb-schema after creating the connection to the database --- .../phpbb_database_test_case.php | 49 ++++++++++++++++++- .../phpbb_test_case_helpers.php | 7 ++- 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index f0aa54ec8d..4f017f08d0 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -19,12 +19,59 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test } } + function split_sql_file($sql, $delimiter) + { + $sql = str_replace("\r" , '', $sql); + $data = preg_split('/' . preg_quote($delimiter, '/') . '$/m', $sql); + + $data = array_map('trim', $data); + + // The empty case + $end_data = end($data); + + if (empty($end_data)) + { + unset($data[key($data)]); + } + + return $data; + } + public function getConnection() { + static $already_connected; + $this->init_test_case_helpers(); $database_config = $this->test_case_helpers->get_database_config(); - $pdo = new PDO('mysql:host=' . $database_config['dbhost'] . ';dbname=' . $database_config['dbname'], $database_config['dbuser'], $database_config['dbpasswd']); + if ($already_connected) + { + $pdo = new PDO('mysql:host=' . $database_config['dbhost'] . ';dbname=' . $database_config['dbname'], $database_config['dbuser'], $database_config['dbpasswd']); + } + else + { + $pdo = new PDO('mysql:host=' . $database_config['dbhost'] . ';', $database_config['dbuser'], $database_config['dbpasswd']); + + try + { + $pdo->exec('DROP DATABASE ' . $database_config['dbname']); + } + catch (PDOException $e){} // ignore non existent db + + $pdo->exec('CREATE DATABASE ' . $database_config['dbname']); + + $pdo = new PDO('mysql:host=' . $database_config['dbhost'] . ';dbname=' . $database_config['dbname'], $database_config['dbuser'], $database_config['dbpasswd']); + + $sql_query = $this->split_sql_file(file_get_contents('../phpBB/install/schemas/mysql_41_schema.sql'), ';'); + + foreach ($sql_query as $sql) + { + $pdo->exec($sql); + } + + $already_connected = true; + } + return $this->createDefaultDBConnection($pdo, 'testdb'); } diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index 27a730e2dd..f9ab750218 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -23,13 +23,16 @@ class phpbb_test_case_helpers if (!file_exists('test_config.php')) { trigger_error("You have to create a test_config.php like this: - Date: Fri, 26 Mar 2010 21:02:56 +0100 Subject: [PATCH 087/393] [feature/dbal-tests] Tests for $db->sql_query_limit() --- tests/dbal/dbal.php | 44 ++++++++++++++++++- .../{two_users.xml => three_users.xml} | 4 ++ 2 files changed, 47 insertions(+), 1 deletion(-) rename tests/dbal/fixtures/{two_users.xml => three_users.xml} (77%) diff --git a/tests/dbal/dbal.php b/tests/dbal/dbal.php index a77279105f..72e399adbe 100644 --- a/tests/dbal/dbal.php +++ b/tests/dbal/dbal.php @@ -14,7 +14,7 @@ class phpbb_dbal_test extends phpbb_database_test_case { public function getDataSet() { - return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/two_users.xml'); + return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/three_users.xml'); } public function test_select_row() @@ -39,5 +39,47 @@ class phpbb_dbal_test extends phpbb_database_test_case $this->assertEquals('foobar', $db->sql_fetchfield('username_clean')); } + + public static function query_limit_data() + { + return array( + array(0, 0, array(array('username_clean' => 'barfoo'), + array('username_clean' => 'foobar'), + array('username_clean' => 'bertie'))), + array(0, 1, array(array('username_clean' => 'foobar'), + array('username_clean' => 'bertie'))), + array(1, 0, array(array('username_clean' => 'barfoo'))), + array(1, 1, array(array('username_clean' => 'foobar'))), + array(1, 2, array(array('username_clean' => 'bertie'))), + array(2, 0, array(array('username_clean' => 'barfoo'), + array('username_clean' => 'foobar'))), + array(2, 2, array(array('username_clean' => 'bertie'))), + array(2, 5, array()), + array(10, 1, array(array('username_clean' => 'foobar'), + array('username_clean' => 'bertie'))), + array(10, 5, array()), + ); + } + + /** + * @dataProvider query_limit_data + */ + public function test_query_limit($total, $offset, $expected) + { + $db = $this->new_dbal(); + + $result = $db->sql_query_limit('SELECT username_clean + FROM phpbb_users + ORDER BY user_id', $total, $offset); + + $ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $ary[] = $row; + } + $db->sql_freeresult($result); + + $this->assertEquals($expected, $ary); + } } diff --git a/tests/dbal/fixtures/two_users.xml b/tests/dbal/fixtures/three_users.xml similarity index 77% rename from tests/dbal/fixtures/two_users.xml rename to tests/dbal/fixtures/three_users.xml index 255f061bd4..fff26d2b3f 100644 --- a/tests/dbal/fixtures/two_users.xml +++ b/tests/dbal/fixtures/three_users.xml @@ -11,5 +11,9 @@ 2 foobar + + 3 + bertie + From 147d6fd590b0ff0bbed153fd33dcead494f822d0 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 26 Mar 2010 22:33:54 +0100 Subject: [PATCH 088/393] [feature/dbal-tests] Make some tests for return_on_error on SELECT-queries --- tests/dbal/dbal.php | 226 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 213 insertions(+), 13 deletions(-) diff --git a/tests/dbal/dbal.php b/tests/dbal/dbal.php index 72e399adbe..0239f91a2d 100644 --- a/tests/dbal/dbal.php +++ b/tests/dbal/dbal.php @@ -17,27 +17,116 @@ class phpbb_dbal_test extends phpbb_database_test_case return $this->createXMLDataSet(dirname(__FILE__).'/fixtures/three_users.xml'); } - public function test_select_row() + public static function return_on_error_select_data() { - $db = $this->new_dbal(); - - $result = $db->sql_query('SELECT username_clean - FROM phpbb_users - WHERE user_id = 2'); - $row = $db->sql_fetchrow($result); - - $this->assertEquals(array('username_clean' => 'foobar'), $row); + return array( + array('phpbb_users', "username_clean = 'bertie'", array(array('username_clean' => 'bertie'))), + array('phpbb_users', "username_clean = 'phpBB'", array()), + array('phpbb_users', 'username_clean syntax_error', false), + array('phpbb_users', 'column_not_exists = 2', false), + array('table_not_exists', 'column_not_exists = 2', false), + ); } - public function test_select_field() + /** + * @dataProvider return_on_error_select_data + */ + public function test_return_on_error_select($table, $where, $expected) + { + $db = $this->new_dbal(); + + $db->sql_return_on_error(true); + + $result = $db->sql_query('SELECT username_clean + FROM ' . $table . ' + WHERE ' . $where . ' + ORDER BY user_id ASC'); + + $db->sql_return_on_error(false); + + $this->assertEquals($expected, $db->sql_fetchrowset($result)); + } + + public static function fetchrow_data() + { + return array( + array('', array(array('username_clean' => 'barfoo'), + array('username_clean' => 'foobar'), + array('username_clean' => 'bertie'))), + array('user_id = 2', array(array('username_clean' => 'foobar'))), + array("username_clean = 'bertie'", array(array('username_clean' => 'bertie'))), + array("username_clean = 'phpBB'", array()), + ); + } + + /** + * @dataProvider fetchrow_data + */ + public function test_fetchrow($where, $expected) { $db = $this->new_dbal(); $result = $db->sql_query('SELECT username_clean FROM phpbb_users - WHERE user_id = 2'); + ' . (($where) ? ' WHERE ' . $where : '') . ' + ORDER BY user_id ASC'); - $this->assertEquals('foobar', $db->sql_fetchfield('username_clean')); + $ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $ary[] = $row; + } + $db->sql_freeresult($result); + + $this->assertEquals($expected, $ary); + } + + /** + * @dataProvider fetchrow_data + */ + public function test_fetchrowset($where, $expected) + { + $db = $this->new_dbal(); + + $result = $db->sql_query('SELECT username_clean + FROM phpbb_users + ' . (($where) ? ' WHERE ' . $where : '') . ' + ORDER BY user_id ASC'); + + $this->assertEquals($expected, $db->sql_fetchrowset($result)); + + $db->sql_freeresult($result); + } + + public static function fetchfield_data() + { + return array( + array('', array('barfoo', 'foobar', 'bertie')), + array('user_id = 2', array('foobar')), + array("username_clean = 'bertie'", array('bertie')), + ); + } + + /** + * @dataProvider fetchfield_data + */ + public function test_fetchfield($where, $expected) + { + $db = $this->new_dbal(); + + $result = $db->sql_query('SELECT username_clean + FROM phpbb_users + ' . (($where) ? ' WHERE ' . $where : '') . ' + ORDER BY user_id ASC'); + + $ary = array(); + while ($row = $db->sql_fetchfield('username_clean')) + { + $ary[] = $row; + } + $db->sql_freeresult($result); + + $this->assertEquals($expected, $ary); } public static function query_limit_data() @@ -70,7 +159,7 @@ class phpbb_dbal_test extends phpbb_database_test_case $result = $db->sql_query_limit('SELECT username_clean FROM phpbb_users - ORDER BY user_id', $total, $offset); + ORDER BY user_id ASC', $total, $offset); $ary = array(); while ($row = $db->sql_fetchrow($result)) @@ -81,5 +170,116 @@ class phpbb_dbal_test extends phpbb_database_test_case $this->assertEquals($expected, $ary); } + + public static function like_expression_data() + { + // * = any_char; # = one_char + return array( + array('barfoo', array(array('username_clean' => 'barfoo'))), + array('bar', array()), + array('bar*', array(array('username_clean' => 'barfoo'))), + array('*bar*', array(array('username_clean' => 'barfoo'), + array('username_clean' => 'foobar'))), + array('*b*', array(array('username_clean' => 'barfoo'), + array('username_clean' => 'foobar'), + array('username_clean' => 'bertie'))), + array('b*r', array()), + array('b*e', array(array('username_clean' => 'bertie'))), + array('#b*e', array()), + array('b####e', array(array('username_clean' => 'bertie'))), + ); + } + + /** + * @dataProvider like_expression_data + */ + public function test_like_expression($like_expression, $expected) + { + $db = $this->new_dbal(); + + $like_expression = str_replace('*', $db->any_char, $like_expression); + $like_expression = str_replace('#', $db->one_char, $like_expression); + $where = ($like_expression) ? 'username_clean ' . $db->sql_like_expression($like_expression) : ''; + + $result = $db->sql_query('SELECT username_clean + FROM phpbb_users + ' . (($where) ? ' WHERE ' . $where : '') . ' + ORDER BY user_id ASC'); + + $this->assertEquals($expected, $db->sql_fetchrowset($result)); + + $db->sql_freeresult($result); + } + + public static function in_set_data() + { + return array( + array('user_id', 3, false, false, array(array('username_clean' => 'bertie'))), + array('user_id', 3, false, true, array(array('username_clean' => 'bertie'))), + array('user_id', 3, true, false, array(array('username_clean' => 'barfoo'), + array('username_clean' => 'foobar'))), + array('user_id', 3, true, true, array(array('username_clean' => 'barfoo'), + array('username_clean' => 'foobar'))), + array('user_id', '3', false, false, array(array('username_clean' => 'bertie'))), + array('user_id', '3', false, true, array(array('username_clean' => 'bertie'))), + array('user_id', '3', true, false, array(array('username_clean' => 'barfoo'), + array('username_clean' => 'foobar'))), + array('user_id', '3', true, true, array(array('username_clean' => 'barfoo'), + array('username_clean' => 'foobar'))), + array('user_id', array(3), false, false, array(array('username_clean' => 'bertie'))), + array('user_id', array(3), false, true, array(array('username_clean' => 'bertie'))), + array('user_id', array(3), true, false, array(array('username_clean' => 'barfoo'), + array('username_clean' => 'foobar'))), + array('user_id', array(3), true, true, array(array('username_clean' => 'barfoo'), + array('username_clean' => 'foobar'))), + array('user_id', array(1, 3), false, false, array(array('username_clean' => 'barfoo'), + array('username_clean' => 'bertie'))), + array('user_id', array(1, 3), false, true, array(array('username_clean' => 'barfoo'), + array('username_clean' => 'bertie'))), + array('user_id', array(1, 3), true, false, array(array('username_clean' => 'foobar'))), + array('user_id', array(1, 3), true, true, array(array('username_clean' => 'foobar'))), + array('user_id', '', false, false, array()), + array('user_id', '', false, true, array()), + array('user_id', '', true, false, array(array('username_clean' => 'barfoo'), + array('username_clean' => 'foobar'), + array('username_clean' => 'bertie'))), + array('user_id', '', true, true, array(array('username_clean' => 'barfoo'), + array('username_clean' => 'foobar'), + array('username_clean' => 'bertie'))), + array('user_id', array(), false, false, false, true), + array('user_id', array(), false, true, array()), + array('user_id', array(), true, false, false, true), + array('user_id', array(), true, true, array(array('username_clean' => 'barfoo'), + array('username_clean' => 'foobar'), + array('username_clean' => 'bertie'))), + ); + } + + /** + * @dataProvider in_set_data + */ + public function test_in_set($field, $array, $negate, $allow_empty_set, $expected, $catch_error = false) + { + $db = $this->new_dbal(); + + if ($catch_error) + { + $db->sql_return_on_error(true); + } + + $result = $db->sql_query('SELECT username_clean + FROM phpbb_users + WHERE ' . $db->sql_in_set($field, $array, $negate, $allow_empty_set) . ' + ORDER BY user_id ASC'); + + if ($catch_error) + { + $db->sql_return_on_error(falsee); + } + + $this->assertEquals($expected, $db->sql_fetchrowset($result)); + + $db->sql_freeresult($result); + } } From 53d316dc9ea34b1228591aa9cee766b2ec8abdc7 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 27 Mar 2010 10:21:16 +0100 Subject: [PATCH 089/393] [feature/dbal-tests] Make some tests for build_array_data on SELECT --- tests/dbal/dbal.php | 49 ++++++++++++- .../phpbb_database_test_case.php | 69 ++++++++++++++++++- 2 files changed, 114 insertions(+), 4 deletions(-) diff --git a/tests/dbal/dbal.php b/tests/dbal/dbal.php index 0239f91a2d..f90b5efeb5 100644 --- a/tests/dbal/dbal.php +++ b/tests/dbal/dbal.php @@ -246,12 +246,14 @@ class phpbb_dbal_test extends phpbb_database_test_case array('user_id', '', true, true, array(array('username_clean' => 'barfoo'), array('username_clean' => 'foobar'), array('username_clean' => 'bertie'))), - array('user_id', array(), false, false, false, true), array('user_id', array(), false, true, array()), - array('user_id', array(), true, false, false, true), array('user_id', array(), true, true, array(array('username_clean' => 'barfoo'), array('username_clean' => 'foobar'), array('username_clean' => 'bertie'))), + + // These here would throw errors and therefor $result should be false. + array('user_id', array(), false, false, false, true), + array('user_id', array(), true, false, false, true), ); } @@ -274,7 +276,48 @@ class phpbb_dbal_test extends phpbb_database_test_case if ($catch_error) { - $db->sql_return_on_error(falsee); + $db->sql_return_on_error(false); + } + + $this->assertEquals($expected, $db->sql_fetchrowset($result)); + + $db->sql_freeresult($result); + } + + public static function build_array_data() + { + return array( + array(array('username_clean' => 'barfoo'), array(array('username_clean' => 'barfoo'))), + array(array('username_clean' => 'barfoo', 'user_id' => 1), array(array('username_clean' => 'barfoo'))), + array(array('username_clean' => 'barfoo', 'user_id' => 2), array()), + + // These here would throw errors and therefor $result should be false. + array(array(), false, true), + array('no_array', false, true), + array(0, false, true), + ); + } + + /** + * @dataProvider build_array_data + */ + public function test_build_array($assoc_ary, $expected, $catch_error = false) + { + $db = $this->new_dbal(); + + if ($catch_error) + { + $db->sql_return_on_error(true); + } + + $result = $db->sql_query('SELECT username_clean + FROM phpbb_users + WHERE ' . $db->sql_build_array('SELECT', $assoc_ary) . ' + ORDER BY user_id ASC'); + + if ($catch_error) + { + $db->sql_return_on_error(false); } $this->assertEquals($expected, $db->sql_fetchrowset($result)); diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index 4f017f08d0..547ee6404e 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -19,6 +19,57 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test } } + function get_dbms_data($dbms) + { + $available_dbms = array( + 'firebird' => array( + 'SCHEMA' => 'firebird', + 'DELIM' => ';;', + ), + 'mysqli' => array( + 'SCHEMA' => 'mysql_41', + 'DELIM' => ';', + ), + 'mysql' => array( + 'SCHEMA' => 'mysql', + 'DELIM' => ';', + ), + 'mssql' => array( + 'SCHEMA' => 'mssql', + 'DELIM' => 'GO', + ), + 'mssql_odbc'=> array( + 'SCHEMA' => 'mssql', + 'DELIM' => 'GO', + ), + 'mssqlnative' => array( + 'SCHEMA' => 'mssql', + 'DELIM' => 'GO', + ), + 'oracle' => array( + 'SCHEMA' => 'oracle', + 'DELIM' => '/', + ), + 'postgres' => array( + 'SCHEMA' => 'postgres', + 'DELIM' => ';', + ), + 'sqlite' => array( + 'SCHEMA' => 'sqlite', + 'DELIM' => ';', + ), + ); + + if (isset($available_dbms[$dbms])) + { + return $available_dbms[$dbms]; + } + else + { + trigger_error('Database unsupported', E_USER_ERROR); + } + } + function split_sql_file($sql, $delimiter) { $sql = str_replace("\r" , '', $sql); @@ -62,7 +113,23 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test $pdo = new PDO('mysql:host=' . $database_config['dbhost'] . ';dbname=' . $database_config['dbname'], $database_config['dbuser'], $database_config['dbpasswd']); - $sql_query = $this->split_sql_file(file_get_contents('../phpBB/install/schemas/mysql_41_schema.sql'), ';'); + $dbms_data = $this->get_dbms_data($database_config['dbms']); + if ($database_config['dbms'] == 'mysql') + { + $pdo->exec('SELECT VERSION() AS version'); + $row = $sth->fetch(PDO::FETCH_ASSOC); + if (version_compare($row['version'], '4.1.3', '>=')) + { + $dbms_data['SCHEMA'] .= '_41'; + } + else + { + $dbms_data['SCHEMA'] .= '_40'; + } + unset($row); + } + + $sql_query = $this->split_sql_file(file_get_contents("../phpBB/install/schemas/{$dbms_data['SCHEMA']}_schema.sql"), $dbms_data['DELIM']); foreach ($sql_query as $sql) { From 6cfb4c82dd4f81cade9b75fb730ebe8c2343b709 Mon Sep 17 00:00:00 2001 From: "U-H-PC\\H" Date: Sun, 28 Mar 2010 14:17:42 +0200 Subject: [PATCH 090/393] [bug/58465] The redirect hidden field is now XHTML conform The result of build_url was falsely un-entitized. --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/functions.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 08f8be32fd..fabf2dad4f 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -105,6 +105,7 @@
          54. [Fix] Correct redirection after login to forum not in web root (Bug #58755)
          55. [Fix] Allow setting parent forums regardless of permission settings. (Bug #57415)
          56. [Fix] Redirect search engines that access pages with SIDs in the URL. (Bug #58025)
          57. +
          58. [Fix] Fix incorrect ampersand encoding in redirect parameter. (Bug #58465)
          59. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
          60. [Feature] The memcache acm plugin now supports multiple memcache servers.
          61. diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 5878c1977d..4f52c7c2ce 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4257,7 +4257,7 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 'S_TOPIC_ID' => $topic_id, 'S_LOGIN_ACTION' => ((!defined('ADMIN_START')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login') : append_sid("index.$phpEx", false, true, $user->session_id)), - 'S_LOGIN_REDIRECT' => build_hidden_fields(array('redirect' => str_replace('&', '&', build_url()))), + 'S_LOGIN_REDIRECT' => build_hidden_fields(array('redirect' => build_url())), 'S_ENABLE_FEEDS' => ($config['feed_enable']) ? true : false, 'S_ENABLE_FEEDS_OVERALL' => ($config['feed_overall']) ? true : false, From 9be61f9e53fef972e8f3b37186050814a9488790 Mon Sep 17 00:00:00 2001 From: "U-H-PC\\H" Date: Sun, 28 Mar 2010 14:37:31 +0200 Subject: [PATCH 091/393] [bug/59425] Correctly check for double inclusion in captcha garbage collection The check to avoid the double inclusion of the captcha factory class in the garbage collection code was faulty, checking for "captcha_factory" instead of "phpbb_captcha_factory". TerryE pointed the problem out, thanks! --- phpBB/docs/CHANGELOG.html | 1 + phpBB/includes/session.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 08f8be32fd..1cdbe310e8 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -101,6 +101,7 @@
          62. [Fix] Minor language fixes. (Bug #54855)
          63. [Fix] Parsing urls in signatures properly uses config settings. (Bug #57105)
          64. [Fix] Allow multibyte keys in request_var(). (Bug #51555)
          65. +
          66. [Fix] Fix inclusion check for captcha garbage collection (Bug #59425)
          67. [Fix] Prevent wrong tar archive type detection. (Bug #12531)
          68. [Fix] Correct redirection after login to forum not in web root (Bug #58755)
          69. [Fix] Allow setting parent forums regardless of permission settings. (Bug #57415)
          70. diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 8beb0161f9..0a01b4e73b 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -983,7 +983,7 @@ class session } // only called from CRON; should be a safe workaround until the infrastructure gets going - if (!class_exists('captcha_factory')) + if (!class_exists('phpbb_captcha_factory')) { include($phpbb_root_path . "includes/captcha/captcha_factory." . $phpEx); } From 2b696cc632b917c4d49330966ddb1dee639a22fe Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 1 Apr 2010 13:11:18 +0200 Subject: [PATCH 092/393] [bug/9108] Fix table binding issues with PostgreSQL in board-wide feed. (Old Bug #58425) The order in the FROM clause is important. The posts table has to be the last one in the chain, so it can be correctly bound with the forums table in the LEFT JOIN. This only affects the overall feed (board-wide feed). All the other feeds are unaffected. --- phpBB/docs/CHANGELOG.html | 1 + phpBB/feed.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 5e6a0dbd86..e9b0f3804f 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -107,6 +107,7 @@
          71. [Fix] Allow setting parent forums regardless of permission settings. (Bug #57415)
          72. [Fix] Redirect search engines that access pages with SIDs in the URL. (Bug #58025)
          73. [Fix] Fix incorrect ampersand encoding in redirect parameter. (Bug #58465)
          74. +
          75. [Fix] Fix table binding issues with PostgreSQL in board-wide feed. (Bug #58425)
          76. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
          77. [Feature] The memcache acm plugin now supports multiple memcache servers.
          78. diff --git a/phpBB/feed.php b/phpBB/feed.php index a42aa42a7f..4ce983a967 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -783,8 +783,8 @@ class phpbb_feed_overall extends phpbb_feed_post_base 'p.post_id, p.topic_id, p.post_time, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' . 'u.username, u.user_id', 'FROM' => array( - POSTS_TABLE => 'p', USERS_TABLE => 'u', + POSTS_TABLE => 'p', ), 'LEFT_JOIN' => array( array( From 23beaceadd38f694ca2eea3110a20db48328e6ce Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 1 Apr 2010 18:59:26 +0200 Subject: [PATCH 093/393] [feature/dbal-tests] Fix whitespace and line endings. --- tests/dbal/fixtures/three_users.xml | 38 +++++++++---------- .../phpbb_database_test_case.php | 4 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/tests/dbal/fixtures/three_users.xml b/tests/dbal/fixtures/three_users.xml index fff26d2b3f..a6789f4a01 100644 --- a/tests/dbal/fixtures/three_users.xml +++ b/tests/dbal/fixtures/three_users.xml @@ -1,19 +1,19 @@ - - - - user_id - username_clean - - 1 - barfoo - - - 2 - foobar - - - 3 - bertie - -
            -
            + + + + user_id + username_clean + + 1 + barfoo + + + 2 + foobar + + + 3 + bertie + +
            +
            diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index 547ee6404e..84635fc24d 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -45,7 +45,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test 'mssqlnative' => array( 'SCHEMA' => 'mssql', 'DELIM' => 'GO', - ), + ), 'oracle' => array( 'SCHEMA' => 'oracle', 'DELIM' => '/', @@ -108,7 +108,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test $pdo->exec('DROP DATABASE ' . $database_config['dbname']); } catch (PDOException $e){} // ignore non existent db - + $pdo->exec('CREATE DATABASE ' . $database_config['dbname']); $pdo = new PDO('mysql:host=' . $database_config['dbhost'] . ';dbname=' . $database_config['dbname'], $database_config['dbuser'], $database_config['dbpasswd']); From 53ab8886b1a3a98291627e2baab94ec86c7df685 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 1 Apr 2010 19:08:11 +0200 Subject: [PATCH 094/393] [feature/dbal-tests] Make the PDO prefix depend on the dbms. The database base test will need a few more changes to run on all the databases we support. But those really need to be made on a system where they run and can be tested. Patches welcome! --- .../test_framework/phpbb_database_test_case.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index 84635fc24d..a80f03b749 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -25,38 +25,47 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test 'firebird' => array( 'SCHEMA' => 'firebird', 'DELIM' => ';;', + 'PDO' => 'firebird', ), 'mysqli' => array( 'SCHEMA' => 'mysql_41', 'DELIM' => ';', + 'PDO' => 'mysql', ), 'mysql' => array( 'SCHEMA' => 'mysql', 'DELIM' => ';', + 'PDO' => 'mysql', ), 'mssql' => array( 'SCHEMA' => 'mssql', 'DELIM' => 'GO', + 'PDO' => 'odbc', ), 'mssql_odbc'=> array( 'SCHEMA' => 'mssql', 'DELIM' => 'GO', + 'PDO' => 'odbc', ), 'mssqlnative' => array( 'SCHEMA' => 'mssql', 'DELIM' => 'GO', + 'PDO' => 'odbc', ), 'oracle' => array( 'SCHEMA' => 'oracle', 'DELIM' => '/', + 'PDO' => 'oci', ), 'postgres' => array( 'SCHEMA' => 'postgres', 'DELIM' => ';', + 'PDO' => 'pgsql', ), 'sqlite' => array( 'SCHEMA' => 'sqlite', 'DELIM' => ';', + 'PDO' => 'sqlite', ), ); @@ -95,13 +104,15 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test $this->init_test_case_helpers(); $database_config = $this->test_case_helpers->get_database_config(); + $dbms_data = $this->get_dbms_data($database_config['dbms']); + if ($already_connected) { - $pdo = new PDO('mysql:host=' . $database_config['dbhost'] . ';dbname=' . $database_config['dbname'], $database_config['dbuser'], $database_config['dbpasswd']); + $pdo = new PDO($dbms_data['PDO'] . ':host=' . $database_config['dbhost'] . ';dbname=' . $database_config['dbname'], $database_config['dbuser'], $database_config['dbpasswd']); } else { - $pdo = new PDO('mysql:host=' . $database_config['dbhost'] . ';', $database_config['dbuser'], $database_config['dbpasswd']); + $pdo = new PDO($dbms_data['PDO'] . ':host=' . $database_config['dbhost'] . ';', $database_config['dbuser'], $database_config['dbpasswd']); try { @@ -113,7 +124,6 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test $pdo = new PDO('mysql:host=' . $database_config['dbhost'] . ';dbname=' . $database_config['dbname'], $database_config['dbuser'], $database_config['dbpasswd']); - $dbms_data = $this->get_dbms_data($database_config['dbms']); if ($database_config['dbms'] == 'mysql') { $pdo->exec('SELECT VERSION() AS version'); From 2bbfa9c29f4ce33d25e58c550540e236a4ee3c1a Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 1 Apr 2010 19:15:34 +0200 Subject: [PATCH 095/393] [feature/dbal-tests] Only output the missing config error message once. The error message was also not properly escaping the variables, thus producing an incorrect example configuration file. --- .../phpbb_test_case_helpers.php | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index f9ab750218..0c5932e1ad 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -20,16 +20,28 @@ class phpbb_test_case_helpers public function get_database_config() { + static $show_error = true; + if (!file_exists('test_config.php')) { + if ($show_error) + { + $show_error = false; + } + else + { + $this->test_case->markTestSkipped('Missing test_config.php: See first error.'); + return; + } + trigger_error("You have to create a test_config.php like this: \" Date: Fri, 2 Apr 2010 00:35:48 +0200 Subject: [PATCH 096/393] [feature/dbal-tests] Fix mysql (not mysqli) dbal test. Correctly determine MySQL version from the database. --- tests/test_framework/phpbb_database_test_case.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index a80f03b749..d2ebe4c30e 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -126,8 +126,9 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test if ($database_config['dbms'] == 'mysql') { - $pdo->exec('SELECT VERSION() AS version'); + $sth = $pdo->query('SELECT VERSION() AS version'); $row = $sth->fetch(PDO::FETCH_ASSOC); + if (version_compare($row['version'], '4.1.3', '>=')) { $dbms_data['SCHEMA'] .= '_41'; @@ -136,7 +137,8 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test { $dbms_data['SCHEMA'] .= '_40'; } - unset($row); + + unset($row, $sth); } $sql_query = $this->split_sql_file(file_get_contents("../phpBB/install/schemas/{$dbms_data['SCHEMA']}_schema.sql"), $dbms_data['DELIM']); From 4a2a84d7a2d024c8ada93a7b23a8ef01141656b8 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 2 Apr 2010 00:40:49 +0200 Subject: [PATCH 097/393] [feature/dbal-tests] Remove hardcoded 'mysql' from PDO DSN in DBAL test. --- tests/test_framework/phpbb_database_test_case.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index d2ebe4c30e..d558874c6f 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -122,7 +122,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test $pdo->exec('CREATE DATABASE ' . $database_config['dbname']); - $pdo = new PDO('mysql:host=' . $database_config['dbhost'] . ';dbname=' . $database_config['dbname'], $database_config['dbuser'], $database_config['dbpasswd']); + $pdo = new PDO($dbms_data['PDO'] . ':host=' . $database_config['dbhost'] . ';dbname=' . $database_config['dbname'], $database_config['dbuser'], $database_config['dbpasswd']); if ($database_config['dbms'] == 'mysql') { From a06ec8c7fd3313acb9a69de6ac51f4486b5f79a3 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 3 Apr 2010 01:51:37 +0100 Subject: [PATCH 098/393] [git-tools] This script requires bash to run, so point directly to bash. --- git-tools/hooks/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit index 1c67a0f3e3..929789e312 100755 --- a/git-tools/hooks/pre-commit +++ b/git-tools/hooks/pre-commit @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # A hook to disallow php syntax errors to be committed # by running php -l (lint) on them. It requires php-cli From 5568b2134bfc8aa477d92e573d8a7d3d13264b44 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 3 Apr 2010 01:53:12 +0100 Subject: [PATCH 099/393] [git-tools] Display what parse errors were found. --- git-tools/hooks/pre-commit | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit index 929789e312..a7deea43c5 100755 --- a/git-tools/hooks/pre-commit +++ b/git-tools/hooks/pre-commit @@ -24,6 +24,7 @@ else fi error=0 +errors="" IFS=$'\n' # get a list of staged files @@ -52,15 +53,19 @@ do # check the staged file content for syntax errors # using php -l (lint) - git cat-file -p $sha | $PHP_BIN -l >/dev/null + result=$(git cat-file -p $sha | $PHP_BIN -l) if [ $? -ne 0 ] then error=1 + # Swap back in correct filenames + errors+=${result//in - on/"$filename"} fi done unset IFS if [ $error -eq 1 ] then + echo -e "PHP Syntax check failed:"; + echo -e "$errors" | grep "^Parse error:" exit 1 fi From b6920b7ca8a6859bf9f76247b882dbd9331a9c78 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 3 Apr 2010 02:12:21 +0100 Subject: [PATCH 100/393] [git-tools] Use env to find the correct paths to binaries. --- git-tools/hooks/pre-commit | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit index a7deea43c5..151c604c30 100755 --- a/git-tools/hooks/pre-commit +++ b/git-tools/hooks/pre-commit @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # A hook to disallow php syntax errors to be committed # by running php -l (lint) on them. It requires php-cli @@ -53,7 +53,7 @@ do # check the staged file content for syntax errors # using php -l (lint) - result=$(git cat-file -p $sha | $PHP_BIN -l) + result=$(git cat-file -p $sha | /usr/bin/env $PHP_BIN -l) if [ $? -ne 0 ] then error=1 From 3e5236dcd62f1d0b18cd3c92661a2287b5bbf2d6 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 3 Apr 2010 02:13:48 +0100 Subject: [PATCH 101/393] [git-tools] Prepend the branch to the commit message for all branches. --- git-tools/hooks/prepare-commit-msg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-tools/hooks/prepare-commit-msg b/git-tools/hooks/prepare-commit-msg index 354b539cc1..033cb187c7 100755 --- a/git-tools/hooks/prepare-commit-msg +++ b/git-tools/hooks/prepare-commit-msg @@ -28,7 +28,7 @@ branch="$(echo "$branch" | sed "s/refs\/heads\///g")" # * only run when normal commit is made (without -m or -F; # not a merge, etc.) # * also make sure the branch name begins with bug/ or feature/ -if [ "$2" = "" ] && [ $(echo "$branch" | grep -e "^\(bug\|feature\)/") ] +if [ "$2" = "" ] then echo "[$branch] $(cat "$1")" > "$1" fi From 8d0c0dcbcd890871f5b057afb8abb7fce0465b2f Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 8 Mar 2010 00:02:46 +0100 Subject: [PATCH 102/393] [bug/58695] Only show unapproved posts in ATOM Feeds for moderators (Bug #58695) --- phpBB/docs/CHANGELOG.html | 1 + phpBB/feed.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 7b8d8f63f2..e3b20acad2 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -103,6 +103,7 @@
          79. [Fix] Allow multibyte keys in request_var(). (Bug #51555)
          80. [Fix] Prevent wrong tar archive type detection. (Bug #12531)
          81. [Fix] Correct redirection after login to forum not in web root (Bug #58755)
          82. +
          83. [Fix] Only show unapproved posts in ATOM Feeds for moderators (Bug #58695)
          84. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
          85. diff --git a/phpBB/feed.php b/phpBB/feed.php index a42aa42a7f..e0365462a0 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -535,7 +535,7 @@ class phpbb_feed_base if (!isset($forum_ids)) { - $forum_ids = array_keys($auth->acl_getf('m_approve')); + $forum_ids = array_keys($auth->acl_getf('m_approve', true)); } return $forum_ids; @@ -994,7 +994,7 @@ class phpbb_feed_topic extends phpbb_feed_post_base if (!$this->topic_data['topic_approved']) { // Also require m_approve - $in_fid_ary = array_intersect($in_fid_ary, array_keys($auth->acl_getf('m_approve'))); + $in_fid_ary = array_intersect($in_fid_ary, array_keys($auth->acl_getf('m_approve', true))); if (empty($in_fid_ary)) { From 0d4daeb615ed35dc4ded54dd2034df6317837a77 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 8 Mar 2010 11:56:20 +0100 Subject: [PATCH 103/393] [bug/58695] Use method to get forums where user is moderator, thanks to bantu for the hint --- phpBB/feed.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/feed.php b/phpBB/feed.php index e0365462a0..d52d3e6c8b 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -994,7 +994,7 @@ class phpbb_feed_topic extends phpbb_feed_post_base if (!$this->topic_data['topic_approved']) { // Also require m_approve - $in_fid_ary = array_intersect($in_fid_ary, array_keys($auth->acl_getf('m_approve', true))); + $in_fid_ary = array_intersect($in_fid_ary, $this->get_moderator_approve_forums()); if (empty($in_fid_ary)) { From 492d86000e768a1381cf88f5cd599a193427fbe1 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 7 Mar 2010 13:16:11 +0100 Subject: [PATCH 104/393] [bug/58745] Correctly close user-delete-form in ACP User Overview (Bug #58745) --- phpBB/adm/style/acp_users_overview.html | 2 +- phpBB/docs/CHANGELOG.html | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/adm/style/acp_users_overview.html b/phpBB/adm/style/acp_users_overview.html index d48cfa57be..7d9a0f27d3 100644 --- a/phpBB/adm/style/acp_users_overview.html +++ b/phpBB/adm/style/acp_users_overview.html @@ -148,6 +148,6 @@ {S_FORM_TOKEN}

            - + diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 3042027e83..5299adcc8c 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -99,6 +99,7 @@
          86. [Fix] Add terminating semicolons to JavaScript code. (Bug #58085 - Patch by nn-)
          87. [Fix] Minor language fixes. (Bug #54855)
          88. [Fix] Parsing urls in signatures properly uses config settings. (Bug #57105)
          89. +
          90. [Fix] Correctly close user-delete-form in ACP User Overview (Bug #58745)
          91. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
          92. From 738914ac838b8c9c95c97b0ad5b11fea6fda9cc7 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 3 Apr 2010 13:11:23 +0200 Subject: [PATCH 105/393] [bug/58745] Correct changelog message --- phpBB/docs/CHANGELOG.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 5299adcc8c..5bd003eb40 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -99,7 +99,7 @@
          93. [Fix] Add terminating semicolons to JavaScript code. (Bug #58085 - Patch by nn-)
          94. [Fix] Minor language fixes. (Bug #54855)
          95. [Fix] Parsing urls in signatures properly uses config settings. (Bug #57105)
          96. -
          97. [Fix] Correctly close user-delete-form in ACP User Overview (Bug #58745)
          98. +
          99. [Fix] Various XHTML mistakes in ACP (Bug #58745)
          100. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
          101. From 8091e3166630c70310908668c4d35d1d8d948e0f Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sat, 3 Apr 2010 21:53:09 +0200 Subject: [PATCH 106/393] [git-tools] do not display stderr --- git-tools/hooks/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit index 151c604c30..c8d78ed490 100755 --- a/git-tools/hooks/pre-commit +++ b/git-tools/hooks/pre-commit @@ -53,7 +53,7 @@ do # check the staged file content for syntax errors # using php -l (lint) - result=$(git cat-file -p $sha | /usr/bin/env $PHP_BIN -l) + result=$(git cat-file -p $sha | /usr/bin/env $PHP_BIN -l 2>/dev/null) if [ $? -ne 0 ] then error=1 From 11de6a46b10c5bdb77b2ee7f9e970b849e0f4d74 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sat, 3 Apr 2010 22:06:25 +0200 Subject: [PATCH 107/393] [git-tools] add note about PHP_BIN using env --- git-tools/hooks/pre-commit | 1 + 1 file changed, 1 insertion(+) diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit index c8d78ed490..23ab8d6cdb 100755 --- a/git-tools/hooks/pre-commit +++ b/git-tools/hooks/pre-commit @@ -12,6 +12,7 @@ # ln -s ../../git-tools/hooks/pre-commit \\ # .git/hooks/pre-commit +# NOTE: this is run through /usr/bin/env PHP_BIN=php # necessary check for initial commit From 46f85329da850bd9ed3c4b83c708683bbf0dcb91 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 9 Mar 2010 19:27:32 +0100 Subject: [PATCH 108/393] [feature/unapproved-posts-in-feed] View note for moderators on unapproved posts/topics with unapproved posts in ATOM Feed --- phpBB/docs/CHANGELOG.html | 1 + phpBB/feed.php | 33 ++++++++++++++++++++++++--------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 7b8d8f63f2..2207be14ad 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -103,6 +103,7 @@
          102. [Fix] Allow multibyte keys in request_var(). (Bug #51555)
          103. [Fix] Prevent wrong tar archive type detection. (Bug #12531)
          104. [Fix] Correct redirection after login to forum not in web root (Bug #58755)
          105. +
          106. [Fix] View note for moderators on unapproved posts/topics with unapproved posts in ATOM Feed
          107. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
          108. diff --git a/phpBB/feed.php b/phpBB/feed.php index a42aa42a7f..575e937330 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -541,6 +541,19 @@ class phpbb_feed_base return $forum_ids; } + function is_moderator_approve_forum($forum_id) + { + $forum_ids = $this->get_moderator_approve_forums(); + + if (!$forum_id) + { + // Global announcement, your a moderator in any forum than it's okay. + return (sizeof($forum_ids) > 0) ? true : false; + } + + return (in_array($forum_id, $forum_ids)) ? true : false; + } + function get_excluded_forums() { global $db, $cache; @@ -677,7 +690,8 @@ class phpbb_feed_post_base extends phpbb_feed_base if ($config['feed_item_statistics']) { $item_row['statistics'] = $user->lang['POSTED'] . ' ' . $user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row) - . ' ' . $this->separator_stats . ' ' . $user->format_date($row['post_time']); + . ' ' . $this->separator_stats . ' ' . $user->format_date($row['post_time']) + . (($this->is_moderator_approve_forum($row['forum_id']) && !$row['post_approved']) ? ' ' . $this->separator_stats . ' ' . $user->lang['POST_UNAPPROVED'] : ''); } } } @@ -719,8 +733,9 @@ class phpbb_feed_topic_base extends phpbb_feed_base { $item_row['statistics'] = $user->lang['POSTED'] . ' ' . $user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row) . ' ' . $this->separator_stats . ' ' . $user->format_date($row[$this->get('date')]) - . ' ' . $this->separator_stats . ' ' . $user->lang['REPLIES'] . ' ' . $row['topic_replies'] - . ' ' . $this->separator_stats . ' ' . $user->lang['VIEWS'] . ' ' . $row['topic_views']; + . ' ' . $this->separator_stats . ' ' . $user->lang['REPLIES'] . ' ' . (($this->is_moderator_approve_forum($row['forum_id'])) ? $row['topic_replies_real'] : $row['topic_replies']) + . ' ' . $this->separator_stats . ' ' . $user->lang['VIEWS'] . ' ' . $row['topic_views'] + . (($this->is_moderator_approve_forum($row['forum_id']) && ($row['topic_replies_real'] != $row['topic_replies'])) ? ' ' . $this->separator_stats . ' ' . $user->lang['POSTS_UNAPPROVED'] : ''); } } } @@ -780,7 +795,7 @@ class phpbb_feed_overall extends phpbb_feed_post_base // Get the actual data $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, ' . - 'p.post_id, p.topic_id, p.post_time, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' . + 'p.post_id, p.topic_id, p.post_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' . 'u.username, u.user_id', 'FROM' => array( POSTS_TABLE => 'p', @@ -912,7 +927,7 @@ class phpbb_feed_forum extends phpbb_feed_post_base } $this->sql = array( - 'SELECT' => 'p.post_id, p.topic_id, p.post_time, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' . + 'SELECT' => 'p.post_id, p.topic_id, p.post_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' . 'u.username, u.user_id', 'FROM' => array( POSTS_TABLE => 'p', @@ -1077,7 +1092,7 @@ class phpbb_feed_topic extends phpbb_feed_post_base global $auth, $db; $this->sql = array( - 'SELECT' => 'p.post_id, p.post_time, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' . + 'SELECT' => 'p.post_id, p.post_time, p.post_approved, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' . 'u.username, u.user_id', 'FROM' => array( POSTS_TABLE => 'p', @@ -1241,7 +1256,7 @@ class phpbb_feed_news extends phpbb_feed_topic_base $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, - t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_views, t.topic_time, + t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_time, p.post_id, p.post_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url', 'FROM' => array( TOPICS_TABLE => 't', @@ -1314,7 +1329,7 @@ class phpbb_feed_topics extends phpbb_feed_topic_base $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, - t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_views, t.topic_time, + t.topic_id, t.topic_title, t.topic_poster, t.topic_first_poster_name, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_time, p.post_id, p.post_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url', 'FROM' => array( TOPICS_TABLE => 't', @@ -1412,7 +1427,7 @@ class phpbb_feed_topics_active extends phpbb_feed_topic_base $this->sql = array( 'SELECT' => 'f.forum_id, f.forum_name, - t.topic_id, t.topic_title, t.topic_replies, t.topic_views, + t.topic_id, t.topic_title, t.topic_replies, t.topic_replies_real, t.topic_views, t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_post_time, p.post_id, p.post_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url', 'FROM' => array( From 9b596faa3976fb17c13eb4c8d604c9e388f47209 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 10 Mar 2010 01:37:35 +0100 Subject: [PATCH 109/393] [feature/unapproved-posts-in-feed] Increase performance of is_moderator_approve_forum() as per bantu --- phpBB/feed.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/phpBB/feed.php b/phpBB/feed.php index 575e937330..4eb70c76c8 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -543,15 +543,20 @@ class phpbb_feed_base function is_moderator_approve_forum($forum_id) { - $forum_ids = $this->get_moderator_approve_forums(); + static $forum_ids; + + if (!isset($forum_ids)) + { + $forum_ids = array_flip($this->get_moderator_approve_forums()); + } if (!$forum_id) { // Global announcement, your a moderator in any forum than it's okay. - return (sizeof($forum_ids) > 0) ? true : false; + return (!empty($forum_ids)) ? true : false; } - return (in_array($forum_id, $forum_ids)) ? true : false; + return (isset($forum_ids[$forum_id])) ? true : false; } function get_excluded_forums() From 19c7ea3c16ceb616cfea4c1c4a160bd36c6a713b Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 10 Mar 2010 01:39:45 +0100 Subject: [PATCH 110/393] [feature/unapproved-posts-in-feed] Little changelog correction --- phpBB/docs/CHANGELOG.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 2207be14ad..b42edfd928 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -103,8 +103,8 @@
          109. [Fix] Allow multibyte keys in request_var(). (Bug #51555)
          110. [Fix] Prevent wrong tar archive type detection. (Bug #12531)
          111. [Fix] Correct redirection after login to forum not in web root (Bug #58755)
          112. -
          113. [Fix] View note for moderators on unapproved posts/topics with unapproved posts in ATOM Feed
          114. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
          115. +
          116. [Feature] Show note for moderators on unapproved posts/topics with unapproved posts in ATOM Feed (Bug #9511)
          117. 1.i. Changes since 3.0.7

            From 5f044a015e622881126a55483de1f680abe29a17 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 4 Apr 2010 02:03:23 +0200 Subject: [PATCH 111/393] [bug/9512] Fix dead link in MCP on reports for global announcements in prosilver. (Bug #9512) --- phpBB/docs/CHANGELOG.html | 1 + phpBB/styles/prosilver/template/mcp_reports.html | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index ba79660646..4be97e3860 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -109,6 +109,7 @@
          118. [Fix] Fix incorrect ampersand encoding in redirect parameter. (Bug #58465)
          119. [Fix] Fix open_basedir issues when accessing styles- and language-management. (Bug #59135)
          120. [Fix] Fix table binding issues with PostgreSQL in board-wide feed. (Bug #58425)
          121. +
          122. [Fix] Fix dead link in MCP on reports for global announcements in prosilver. (Bug #9512)
          123. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
          124. [Feature] The memcache acm plugin now supports multiple memcache servers.
          125. diff --git a/phpBB/styles/prosilver/template/mcp_reports.html b/phpBB/styles/prosilver/template/mcp_reports.html index 649154deb4..eefb24ee91 100644 --- a/phpBB/styles/prosilver/template/mcp_reports.html +++ b/phpBB/styles/prosilver/template/mcp_reports.html @@ -54,7 +54,7 @@
            {postrow.REPORTER_FULL} « {postrow.REPORT_TIME}
            - {L_FORUM}: {postrow.FORUM_NAME}
            + {L_FORUM}: {postrow.FORUM_NAME}{postrow.FORUM_NAME}
            From 39f26c5cfde3fc018332f379f9b7449a5f1da537 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 4 Apr 2010 11:51:34 +0200 Subject: [PATCH 112/393] [bug/9047] Use correct forum_id to generate the active topics list. (Bug #9047) --- phpBB/docs/CHANGELOG.html | 1 + phpBB/viewforum.php | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index ba79660646..61e2f01ed8 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -109,6 +109,7 @@
          126. [Fix] Fix incorrect ampersand encoding in redirect parameter. (Bug #58465)
          127. [Fix] Fix open_basedir issues when accessing styles- and language-management. (Bug #59135)
          128. [Fix] Fix table binding issues with PostgreSQL in board-wide feed. (Bug #58425)
          129. +
          130. [Fix] Fix broken links for reports on active topics, when the topic is in a subforum. (Bug #9047)
          131. [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
          132. [Feature] The memcache acm plugin now supports multiple memcache servers.
          133. diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 95c142d865..5fb91c0292 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -592,12 +592,14 @@ if (sizeof($topic_list)) { $row = &$rowset[$topic_id]; + $topic_forum_id = ($row['forum_id']) ? (int) $row['forum_id'] : $forum_id; + // This will allow the style designer to output a different header // or even separate the list of announcements from sticky and normal topics $s_type_switch_test = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0; // Replies - $replies = ($auth->acl_get('m_approve', $forum_id)) ? $row['topic_replies_real'] : $row['topic_replies']; + $replies = ($auth->acl_get('m_approve', $topic_forum_id)) ? $row['topic_replies_real'] : $row['topic_replies']; if ($row['topic_status'] == ITEM_MOVED) { @@ -614,16 +616,16 @@ if (sizeof($topic_list)) topic_status($row, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type); // Generate all the URIs ... - $view_topic_url_params = 'f=' . (($row['forum_id']) ? $row['forum_id'] : $forum_id) . '&t=' . $topic_id; + $view_topic_url_params = 'f=' . $topic_forum_id . '&t=' . $topic_id; $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params); - $topic_unapproved = (!$row['topic_approved'] && $auth->acl_get('m_approve', (($row['forum_id']) ? $row['forum_id'] : $forum_id))) ? true : false; - $posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', (($row['forum_id']) ? $row['forum_id'] : $forum_id))) ? true : false; + $topic_unapproved = (!$row['topic_approved'] && $auth->acl_get('m_approve', $topic_forum_id)) ? true : false; + $posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $topic_forum_id)) ? true : false; $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&t=$topic_id", true, $user->session_id) : ''; // Send vars to template $template->assign_block_vars('topicrow', array( - 'FORUM_ID' => $forum_id, + 'FORUM_ID' => $topic_forum_id, 'TOPIC_ID' => $topic_id, 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), @@ -651,13 +653,13 @@ if (sizeof($topic_list)) 'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '', 'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '', 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '', - 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $topic_forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', 'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '', 'S_TOPIC_TYPE' => $row['topic_type'], 'S_USER_POSTED' => (isset($row['topic_posted']) && $row['topic_posted']) ? true : false, 'S_UNREAD_TOPIC' => $unread_topic, - 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_get('m_report', $forum_id)) ? true : false, + 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_get('m_report', $topic_forum_id)) ? true : false, 'S_TOPIC_UNAPPROVED' => $topic_unapproved, 'S_POSTS_UNAPPROVED' => $posts_unapproved, 'S_HAS_POLL' => ($row['poll_start']) ? true : false, @@ -672,7 +674,7 @@ if (sizeof($topic_list)) 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), 'U_VIEW_TOPIC' => $view_topic_url, - 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=reports&f=' . $forum_id . '&t=' . $topic_id, true, $user->session_id), + 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=reports&f=' . $topic_forum_id . '&t=' . $topic_id, true, $user->session_id), 'U_MCP_QUEUE' => $u_mcp_queue, 'S_TOPIC_TYPE_SWITCH' => ($s_type_switch == $s_type_switch_test) ? -1 : $s_type_switch_test) From 584206b8ae356face0e9d4fcc1674e882e77b5fa Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 2 Apr 2010 00:35:48 +0200 Subject: [PATCH 113/393] [feature/dbal-tests] Fix mysql (not mysqli) dbal test. Correctly determine MySQL version from the database. --- tests/test_framework/phpbb_database_test_case.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index a80f03b749..d2ebe4c30e 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -126,8 +126,9 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test if ($database_config['dbms'] == 'mysql') { - $pdo->exec('SELECT VERSION() AS version'); + $sth = $pdo->query('SELECT VERSION() AS version'); $row = $sth->fetch(PDO::FETCH_ASSOC); + if (version_compare($row['version'], '4.1.3', '>=')) { $dbms_data['SCHEMA'] .= '_41'; @@ -136,7 +137,8 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test { $dbms_data['SCHEMA'] .= '_40'; } - unset($row); + + unset($row, $sth); } $sql_query = $this->split_sql_file(file_get_contents("../phpBB/install/schemas/{$dbms_data['SCHEMA']}_schema.sql"), $dbms_data['DELIM']); From eaa591046f0016763105d9025db9a36255b3d4bd Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 2 Apr 2010 00:40:49 +0200 Subject: [PATCH 114/393] [feature/dbal-tests] Remove hardcoded 'mysql' from PDO DSN in DBAL test. --- tests/test_framework/phpbb_database_test_case.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index d2ebe4c30e..d558874c6f 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -122,7 +122,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test $pdo->exec('CREATE DATABASE ' . $database_config['dbname']); - $pdo = new PDO('mysql:host=' . $database_config['dbhost'] . ';dbname=' . $database_config['dbname'], $database_config['dbuser'], $database_config['dbpasswd']); + $pdo = new PDO($dbms_data['PDO'] . ':host=' . $database_config['dbhost'] . ';dbname=' . $database_config['dbname'], $database_config['dbuser'], $database_config['dbpasswd']); if ($database_config['dbms'] == 'mysql') { From 02aed4b66f736ae0b78ba5971aa9f392749488e9 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 8 Apr 2010 14:55:51 +0200 Subject: [PATCH 115/393] [feature/webpi] Package files for Microsoft Web Platform Installer --- build/webpi/install/mssql.sql | 39 ++++++ build/webpi/install/mysql.sql | Bin 0 -> 732 bytes build/webpi/manifest.xml | 13 ++ build/webpi/parameters.xml | 226 ++++++++++++++++++++++++++++++++++ 4 files changed, 278 insertions(+) create mode 100644 build/webpi/install/mssql.sql create mode 100644 build/webpi/install/mysql.sql create mode 100644 build/webpi/manifest.xml create mode 100644 build/webpi/parameters.xml diff --git a/build/webpi/install/mssql.sql b/build/webpi/install/mssql.sql new file mode 100644 index 0000000000..390b4ffc02 --- /dev/null +++ b/build/webpi/install/mssql.sql @@ -0,0 +1,39 @@ +/**********************************************************************/ +/* Install.SQL */ +/* Creates a login and makes the user a member of db roles */ +/* */ +/**********************************************************************/ + +-- Declare variables for database name, username and password +DECLARE @dbName sysname, + @dbUser sysname, + @dbPwd nvarchar(max); + +-- Set variables for database name, username and password +SET @dbName = 'PlaceHolderForDb'; +SET @dbUser = 'PlaceHolderForUser'; +SET @dbPwd = 'PlaceHolderForPassword'; + +DECLARE @cmd nvarchar(max) + +-- Create login +IF( SUSER_SID(@dbUser) is null ) +BEGIN + print '-- Creating login ' + SET @cmd = N'CREATE LOGIN ' + quotename(@dbUser) + N' WITH PASSWORD ='''+ replace(@dbPwd, '''', '''''') + N'''' + EXEC(@cmd) +END + +-- Create database user and map to login +-- and add user to the datareader, datawriter, ddladmin and securityadmin roles +-- +SET @cmd = N'USE ' + quotename(@DBName) + N'; +IF( NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = ''' + replace(@dbUser, '''', '''''') + N''')) +BEGIN + print ''-- Creating user''; + CREATE USER ' + quotename(@dbUser) + N' FOR LOGIN ' + quotename(@dbUser) + N'; + print ''-- Adding user''; + EXEC sp_addrolemember ''db_owner'', ''' + replace(@dbUser, '''', '''''') + N'''; +END' +EXEC(@cmd) +GO diff --git a/build/webpi/install/mysql.sql b/build/webpi/install/mysql.sql new file mode 100644 index 0000000000000000000000000000000000000000..ca9d1b2f839525829b8dd7338e6f6536c499a0b4 GIT binary patch literal 732 zcmb`FOH0F05QWcL@ITyz5Oq-$+_`B?ng@ioG>Pa+)VLFbw(7rEzqvQ4wWZm}Fv%p$ zIdkUm`O&J@L{4)(>t2s~QlS^(j%cZjc&StmI>HWh;62qsGZ2QdD1jkWOKeOfC`WWd zRI9-q%pG>8SFJp++u%z)GA1`D+2;Ick!CRuoe9vvy7B?^9KQHSG^owa? literal 0 HcmV?d00001 diff --git a/build/webpi/manifest.xml b/build/webpi/manifest.xml new file mode 100644 index 0000000000..1ecae7bae6 --- /dev/null +++ b/build/webpi/manifest.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/build/webpi/parameters.xml b/build/webpi/parameters.xml new file mode 100644 index 0000000000..03d269f3eb --- /dev/null +++ b/build/webpi/parameters.xml @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 839f464b787e35e64480e598b16beab9b0ab37e8 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 8 Apr 2010 16:59:15 +0200 Subject: [PATCH 116/393] [feature/webpi] Add WebPI support to the build script. --- build/package.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build/package.php b/build/package.php index 7cb30bd493..a0da6404c6 100755 --- a/build/package.php +++ b/build/package.php @@ -518,6 +518,14 @@ foreach ($compress_programs as $extension => $compress_command) $package->run_command('md5sum ./release_files/' . $package->get('release_filename') . '.' . $extension . ' > ./release_files/' . $package->get('release_filename') . '.' . $extension . '.md5'); } +// Microsoft Web PI packaging +$package->begin_status('Packaging phpBB for Microsoft WebPI'); +$file = './release_files/' . $package->get('release_filename') . '.webpi.zip'; +$package->run_command("rm -v $file"); +$package->run_command('cp -p ./release_files/' . $package->get('release_filename') . ".zip $file"); +$package->run_command('cd ./../webpi && ' . $compress_programs['zip'] . " ./../new_version/$file *"); +$package->run_command("md5sum $file > $file.md5"); + // verify results chdir($package->locations['root']); $package->begin_status('********** Verifying packages **********'); From f9946de5b3ab09f395578e2a468adddb7e0e26dc Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 8 Apr 2010 16:56:24 +0100 Subject: [PATCH 117/393] [feature/webpi] Fix messed up line endings --- build/webpi/install/mysql.sql | Bin 732 -> 350 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/build/webpi/install/mysql.sql b/build/webpi/install/mysql.sql index ca9d1b2f839525829b8dd7338e6f6536c499a0b4..8efdd053ff54eb12eb6d22e8ed36a7f0bd15c2ca 100644 GIT binary patch literal 350 zcma)&&2GXl5QLw=?=T0X6b=X^Zn~AiG2p8E-+s*5 zj&fy~piJ`^5ZxXHH$szzEG^cn%?6VOWJJnx%Z&%uI;N?;(v*`!XPa+)VLFbw(7rEzqvQ4wWZm}Fv%p$ zIdkUm`O&J@L{4)(>t2s~QlS^(j%cZjc&StmI>HWh;62qsGZ2QdD1jkWOKeOfC`WWd zRI9-q%pG>8SFJp++u%z)GA1`D+2;Ick!CRuoe9vvy7B?^9KQHSG^owa? From a2fe71a6d3b999b30103876d9756d5415c428d7f Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 8 Apr 2010 17:01:10 +0100 Subject: [PATCH 118/393] [feature/webpi] Hopefully finally fix this --- build/webpi/install/mysql.sql | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/build/webpi/install/mysql.sql b/build/webpi/install/mysql.sql index 8efdd053ff..8c1ae2e550 100644 --- a/build/webpi/install/mysql.sql +++ b/build/webpi/install/mysql.sql @@ -1 +1,15 @@ -USE PlaceHolderForDb$$ DROP PROCEDURE IF EXISTS add_user $$ CREATE PROCEDURE add_user() BEGIN DECLARE EXIT HANDLER FOR 1044 BEGIN END; GRANT ALL PRIVILEGES ON PlaceHolderForDb.* to 'PlaceHolderForUser'@'PlaceHolderForServer' IDENTIFIED BY 'PlaceHolderForPassword'; FLUSH PRIVILEGES; END $$ CALL add_user() $$ DROP PROCEDURE IF EXISTS add_user $$ \ No newline at end of file +USE PlaceHolderForDb$$ + +DROP PROCEDURE IF EXISTS add_user $$ + +CREATE PROCEDURE add_user() +BEGIN +DECLARE EXIT HANDLER FOR 1044 BEGIN END; +GRANT ALL PRIVILEGES ON PlaceHolderForDb.* to 'PlaceHolderForUser'@'PlaceHolderForServer' IDENTIFIED BY 'PlaceHolderForPassword'; +FLUSH PRIVILEGES; +END +$$ + +CALL add_user() $$ + +DROP PROCEDURE IF EXISTS add_user $$ From cc127d8217559a744ce4f6837d6fae4332db6fb1 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 8 Apr 2010 17:23:15 +0100 Subject: [PATCH 119/393] [feature/webpi] Web PI supports UNIX line endings so we'll remove them --- build/webpi/install/mssql.sql | 78 +++--- build/webpi/install/mysql.sql | 30 +-- build/webpi/manifest.xml | 26 +- build/webpi/parameters.xml | 452 +++++++++++++++++----------------- 4 files changed, 293 insertions(+), 293 deletions(-) diff --git a/build/webpi/install/mssql.sql b/build/webpi/install/mssql.sql index 390b4ffc02..9c0b46678a 100644 --- a/build/webpi/install/mssql.sql +++ b/build/webpi/install/mssql.sql @@ -1,39 +1,39 @@ -/**********************************************************************/ -/* Install.SQL */ -/* Creates a login and makes the user a member of db roles */ -/* */ -/**********************************************************************/ - --- Declare variables for database name, username and password -DECLARE @dbName sysname, - @dbUser sysname, - @dbPwd nvarchar(max); - --- Set variables for database name, username and password -SET @dbName = 'PlaceHolderForDb'; -SET @dbUser = 'PlaceHolderForUser'; -SET @dbPwd = 'PlaceHolderForPassword'; - -DECLARE @cmd nvarchar(max) - --- Create login -IF( SUSER_SID(@dbUser) is null ) -BEGIN - print '-- Creating login ' - SET @cmd = N'CREATE LOGIN ' + quotename(@dbUser) + N' WITH PASSWORD ='''+ replace(@dbPwd, '''', '''''') + N'''' - EXEC(@cmd) -END - --- Create database user and map to login --- and add user to the datareader, datawriter, ddladmin and securityadmin roles --- -SET @cmd = N'USE ' + quotename(@DBName) + N'; -IF( NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = ''' + replace(@dbUser, '''', '''''') + N''')) -BEGIN - print ''-- Creating user''; - CREATE USER ' + quotename(@dbUser) + N' FOR LOGIN ' + quotename(@dbUser) + N'; - print ''-- Adding user''; - EXEC sp_addrolemember ''db_owner'', ''' + replace(@dbUser, '''', '''''') + N'''; -END' -EXEC(@cmd) -GO +/**********************************************************************/ +/* Install.SQL */ +/* Creates a login and makes the user a member of db roles */ +/* */ +/**********************************************************************/ + +-- Declare variables for database name, username and password +DECLARE @dbName sysname, + @dbUser sysname, + @dbPwd nvarchar(max); + +-- Set variables for database name, username and password +SET @dbName = 'PlaceHolderForDb'; +SET @dbUser = 'PlaceHolderForUser'; +SET @dbPwd = 'PlaceHolderForPassword'; + +DECLARE @cmd nvarchar(max) + +-- Create login +IF( SUSER_SID(@dbUser) is null ) +BEGIN + print '-- Creating login ' + SET @cmd = N'CREATE LOGIN ' + quotename(@dbUser) + N' WITH PASSWORD ='''+ replace(@dbPwd, '''', '''''') + N'''' + EXEC(@cmd) +END + +-- Create database user and map to login +-- and add user to the datareader, datawriter, ddladmin and securityadmin roles +-- +SET @cmd = N'USE ' + quotename(@DBName) + N'; +IF( NOT EXISTS (SELECT * FROM sys.database_principals WHERE name = ''' + replace(@dbUser, '''', '''''') + N''')) +BEGIN + print ''-- Creating user''; + CREATE USER ' + quotename(@dbUser) + N' FOR LOGIN ' + quotename(@dbUser) + N'; + print ''-- Adding user''; + EXEC sp_addrolemember ''db_owner'', ''' + replace(@dbUser, '''', '''''') + N'''; +END' +EXEC(@cmd) +GO diff --git a/build/webpi/install/mysql.sql b/build/webpi/install/mysql.sql index 8c1ae2e550..5c9d8cd922 100644 --- a/build/webpi/install/mysql.sql +++ b/build/webpi/install/mysql.sql @@ -1,15 +1,15 @@ -USE PlaceHolderForDb$$ - -DROP PROCEDURE IF EXISTS add_user $$ - -CREATE PROCEDURE add_user() -BEGIN -DECLARE EXIT HANDLER FOR 1044 BEGIN END; -GRANT ALL PRIVILEGES ON PlaceHolderForDb.* to 'PlaceHolderForUser'@'PlaceHolderForServer' IDENTIFIED BY 'PlaceHolderForPassword'; -FLUSH PRIVILEGES; -END -$$ - -CALL add_user() $$ - -DROP PROCEDURE IF EXISTS add_user $$ +USE PlaceHolderForDb$$ + +DROP PROCEDURE IF EXISTS add_user $$ + +CREATE PROCEDURE add_user() +BEGIN +DECLARE EXIT HANDLER FOR 1044 BEGIN END; +GRANT ALL PRIVILEGES ON PlaceHolderForDb.* to 'PlaceHolderForUser'@'PlaceHolderForServer' IDENTIFIED BY 'PlaceHolderForPassword'; +FLUSH PRIVILEGES; +END +$$ + +CALL add_user() $$ + +DROP PROCEDURE IF EXISTS add_user $$ diff --git a/build/webpi/manifest.xml b/build/webpi/manifest.xml index 1ecae7bae6..947377893b 100644 --- a/build/webpi/manifest.xml +++ b/build/webpi/manifest.xml @@ -1,13 +1,13 @@ - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + diff --git a/build/webpi/parameters.xml b/build/webpi/parameters.xml index 03d269f3eb..770cabf95b 100644 --- a/build/webpi/parameters.xml +++ b/build/webpi/parameters.xml @@ -1,226 +1,226 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 5a3ec9901d7384d99e77c8db1b9f6b4498a79273 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Fri, 9 Apr 2010 10:30:35 -0400 Subject: [PATCH 120/393] [git-tools] Changed pre-commit hook to use sh instead of bash --- git-tools/hooks/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit index 23ab8d6cdb..5f75381155 100755 --- a/git-tools/hooks/pre-commit +++ b/git-tools/hooks/pre-commit @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh # # A hook to disallow php syntax errors to be committed # by running php -l (lint) on them. It requires php-cli From 9afe2c9b6e9b414889f8642e719308afa434bc40 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Fri, 9 Apr 2010 10:43:54 -0400 Subject: [PATCH 121/393] [git-tools] Adjusted pre-commit hook to run under freebsd /bin/sh. --- git-tools/hooks/pre-commit | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit index 5f75381155..835b28aec3 100755 --- a/git-tools/hooks/pre-commit +++ b/git-tools/hooks/pre-commit @@ -27,7 +27,10 @@ fi error=0 errors="" -IFS=$'\n' +# dash does not support $'\n': +# http://forum.soft32.com/linux2/Bug-409179-DASH-Settings-IFS-work-properly-ftopict70039.html +IFS=' +' # get a list of staged files for line in $(git diff-index --cached --full-index $against) do @@ -59,7 +62,7 @@ do then error=1 # Swap back in correct filenames - errors+=${result//in - on/"$filename"} + errors=$(echo "$errors"; echo "$result" |sed -e "s:in - on:in $filename on:g") fi done unset IFS From 9674214b2ffd3fc98e707ffa8f9b8b9eaef054da Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sat, 10 Apr 2010 05:43:26 -0400 Subject: [PATCH 122/393] [git-tools] Use @ instead of : in sed command in pre-commit hook for wider compatibility. --- git-tools/hooks/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit index 835b28aec3..9719b91746 100755 --- a/git-tools/hooks/pre-commit +++ b/git-tools/hooks/pre-commit @@ -62,7 +62,7 @@ do then error=1 # Swap back in correct filenames - errors=$(echo "$errors"; echo "$result" |sed -e "s:in - on:in $filename on:g") + errors=$(echo "$errors"; echo "$result" |sed -e "s@in - on@in $filename on@g") fi done unset IFS From b22a651c5c8651e13acf9acfeb73a02b1ae3c5c8 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 15 Apr 2010 23:00:27 +0100 Subject: [PATCH 123/393] [feature/webpi] Validate inline with MSSQL password policy. --- build/webpi/parameters.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/webpi/parameters.xml b/build/webpi/parameters.xml index 770cabf95b..994247e48e 100644 --- a/build/webpi/parameters.xml +++ b/build/webpi/parameters.xml @@ -116,12 +116,12 @@ + validationString = "^.*(?=.{8,})(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).*$" /> Date: Sun, 18 Apr 2010 15:13:53 +0200 Subject: [PATCH 124/393] [ticket/9548] Delete user quicktool drop down should have an empty or invalid selection as the default PHPBB3-9548 --- phpBB/adm/style/acp_users_overview.html | 2 +- phpBB/includes/acp/acp_users.php | 33 +++++++++++++++---------- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/phpBB/adm/style/acp_users_overview.html b/phpBB/adm/style/acp_users_overview.html index 7d9a0f27d3..911dcad293 100644 --- a/phpBB/adm/style/acp_users_overview.html +++ b/phpBB/adm/style/acp_users_overview.html @@ -140,7 +140,7 @@ {L_DELETE_USER}

            {L_DELETE_USER_EXPLAIN}
            -
            +

            diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 4905840e02..a9d104f0d7 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -191,24 +191,31 @@ class acp_users trigger_error($user->lang['CANNOT_REMOVE_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } - if (confirm_box(true)) + if ($delete_type) { - user_delete($delete_type, $user_id, $user_row['username']); + if (confirm_box(true)) + { + user_delete($delete_type, $user_id, $user_row['username']); - add_log('admin', 'LOG_USER_DELETED', $user_row['username']); - trigger_error($user->lang['USER_DELETED'] . adm_back_link($this->u_action)); + add_log('admin', 'LOG_USER_DELETED', $user_row['username']); + trigger_error($user->lang['USER_DELETED'] . adm_back_link($this->u_action)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'update' => true, + 'delete' => 1, + 'delete_type' => $delete_type)) + ); + } } else { - confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( - 'u' => $user_id, - 'i' => $id, - 'mode' => $mode, - 'action' => $action, - 'update' => true, - 'delete' => 1, - 'delete_type' => $delete_type)) - ); + trigger_error($user->lang['NO_MODE'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } } From b3028567c82aca21675b323198eb5476d9885d99 Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 2 May 2010 14:50:33 +0800 Subject: [PATCH 125/393] [ticket/9567] Newly registered users group description rewording. Reword 'NEW_MEMBER_GROUP_DEFAULT_EXPLAIN' language entry to make it more linguistically correct. PHPBB3-9567 --- phpBB/language/en/acp/board.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index ce57b07eae..52389d85b9 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -211,7 +211,7 @@ $lang = array_merge($lang, array( 'NEW_MEMBER_POST_LIMIT' => 'New member post limit', 'NEW_MEMBER_POST_LIMIT_EXPLAIN' => 'New members are within the Newly Registered Users group until they reach this number of posts. You can use this group to keep them from using the PM system or to review their posts. A value of 0 disables this feature.', 'NEW_MEMBER_GROUP_DEFAULT' => 'Set Newly Registered Users group to default', - 'NEW_MEMBER_GROUP_DEFAULT_EXPLAIN' => 'If set to yes and a new member post limit is specified newly registered users will be not only put into the Newly Registered Users group, but this group also being their default one. This may come in handy if you want to assign a group default rank and/or avatar the user then inherits.', + 'NEW_MEMBER_GROUP_DEFAULT_EXPLAIN' => 'If set to yes, and a new member post limit is specified, newly registered users will not only be put into the Newly Registered Users group, but this group will also be their default one. This may come in handy if you want to assign a group default rank and/or avatar the user then inherits.', 'ACC_ADMIN' => 'By Admin', 'ACC_DISABLE' => 'Disable', From abacc2d07d1f62db3aaebff1d37099c6511d0595 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 21 Apr 2010 20:48:38 +0200 Subject: [PATCH 126/393] [ticket/9170] Unable to get image size in img bbcode when URL has multiple parameters. Since we htmlspecialchars() all input we have to htmlspecialchars_decode() before passing the URL along to getimagesize(). PHPBB3-9170 --- phpBB/includes/message_parser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 50aad8588a..952b55cc8c 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -300,7 +300,7 @@ class bbcode_firstpass extends bbcode if ($config['max_' . $this->mode . '_img_height'] || $config['max_' . $this->mode . '_img_width']) { - $stats = @getimagesize($in); + $stats = @getimagesize(htmlspecialchars_decode($in)); if ($stats === false) { From fd23bccd4d279e902d0b609cee71f09750d364a7 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 2 May 2010 23:44:42 +0200 Subject: [PATCH 127/393] [develop-olympus] Basic gitignore file for cache files and backups. --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..3e0f454e0c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +phpBB/cache/*.php +*~ \ No newline at end of file From cdd9ecdd68c8b0240a121a9bc07fd366a99bd1b3 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 8 Apr 2010 10:08:18 +0200 Subject: [PATCH 128/393] [ticket/9520] Add some default web.config files for IIS. These deny access to the various directories written to by phpBB. PHPBB3-9520 --- phpBB/cache/web.config | 13 +++++++++++++ phpBB/files/web.config | 13 +++++++++++++ phpBB/images/avatars/upload/web.config | 13 +++++++++++++ phpBB/store/web.config | 13 +++++++++++++ 4 files changed, 52 insertions(+) create mode 100644 phpBB/cache/web.config create mode 100644 phpBB/files/web.config create mode 100644 phpBB/images/avatars/upload/web.config create mode 100644 phpBB/store/web.config diff --git a/phpBB/cache/web.config b/phpBB/cache/web.config new file mode 100644 index 0000000000..278494bafc --- /dev/null +++ b/phpBB/cache/web.config @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/phpBB/files/web.config b/phpBB/files/web.config new file mode 100644 index 0000000000..278494bafc --- /dev/null +++ b/phpBB/files/web.config @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/phpBB/images/avatars/upload/web.config b/phpBB/images/avatars/upload/web.config new file mode 100644 index 0000000000..278494bafc --- /dev/null +++ b/phpBB/images/avatars/upload/web.config @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/phpBB/store/web.config b/phpBB/store/web.config new file mode 100644 index 0000000000..278494bafc --- /dev/null +++ b/phpBB/store/web.config @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file From 9ac7c492ed5c0537cb34dc3a21d9b9b612d0e091 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 15 Apr 2010 23:12:14 +0100 Subject: [PATCH 129/393] [ticket/9520] Add suggested web.config for root files as suggested by Microsoft. PHPBB3-9520 --- phpBB/web.config | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 phpBB/web.config diff --git a/phpBB/web.config b/phpBB/web.config new file mode 100644 index 0000000000..7f2b40ec1b --- /dev/null +++ b/phpBB/web.config @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + From e11e53e11bd7ea67fe0b7b0145fe2941ca86fb84 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Wed, 28 Apr 2010 19:13:01 +0100 Subject: [PATCH 130/393] [ticket/9520] Removed per directory web.config files. These use the IIS rewriter to reject requests, Microsoft have suggested we just use a single web.config with the builtin request filter. PHPBB3-9520 --- phpBB/cache/web.config | 13 ------------- phpBB/files/web.config | 13 ------------- phpBB/images/avatars/upload/web.config | 13 ------------- phpBB/store/web.config | 13 ------------- 4 files changed, 52 deletions(-) delete mode 100644 phpBB/cache/web.config delete mode 100644 phpBB/files/web.config delete mode 100644 phpBB/images/avatars/upload/web.config delete mode 100644 phpBB/store/web.config diff --git a/phpBB/cache/web.config b/phpBB/cache/web.config deleted file mode 100644 index 278494bafc..0000000000 --- a/phpBB/cache/web.config +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/phpBB/files/web.config b/phpBB/files/web.config deleted file mode 100644 index 278494bafc..0000000000 --- a/phpBB/files/web.config +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/phpBB/images/avatars/upload/web.config b/phpBB/images/avatars/upload/web.config deleted file mode 100644 index 278494bafc..0000000000 --- a/phpBB/images/avatars/upload/web.config +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/phpBB/store/web.config b/phpBB/store/web.config deleted file mode 100644 index 278494bafc..0000000000 --- a/phpBB/store/web.config +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file From 8612fc23d4d7ca90ea80e5a12e7bd51ed315e0dd Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Wed, 28 Apr 2010 19:20:54 +0100 Subject: [PATCH 131/393] [ticket/9520] New web.config file as suggested by Microsoft using request filter PHPBB3-9520 --- phpBB/web.config | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/phpBB/web.config b/phpBB/web.config index 7f2b40ec1b..e374e611f6 100644 --- a/phpBB/web.config +++ b/phpBB/web.config @@ -1,17 +1,25 @@ - - - - - - - - - - - - + + + + + + ­ + + + + + + + + + + + + + + From 43f47dba4c8e43b286391748763c00d3e949564b Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Wed, 28 Apr 2010 19:22:10 +0100 Subject: [PATCH 132/393] [ticket/9520] Additionally filter requests for {common,config}.php PHPBB3-9520 --- phpBB/web.config | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpBB/web.config b/phpBB/web.config index e374e611f6..128fe3c98f 100644 --- a/phpBB/web.config +++ b/phpBB/web.config @@ -7,6 +7,8 @@ ­ + + From 171807213f431f9b4c028a5c5e1b079600d7fc52 Mon Sep 17 00:00:00 2001 From: Rob House <> Date: Sat, 1 May 2010 01:30:51 +0100 Subject: [PATCH 133/393] [ticket/9582] Custom profile fields cannot be created under MSSQL native. PHPBB3-9565 PHPBB3-9582 --- phpBB/includes/acp/acp_profile.php | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index fc08c7e8e8..2288a0728b 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -1480,6 +1480,7 @@ class acp_profile case 'mssql': case 'mssql_odbc': + case 'mssqlnative': // We are defining the biggest common value, because of the possibility to edit the min/max values of each field. $sql = 'ALTER TABLE [' . PROFILE_FIELDS_DATA_TABLE . "] ADD [$field_ident] "; From 57394261364f9fdddded08964d2b7e3842057b2a Mon Sep 17 00:00:00 2001 From: Rob House <> Date: Sat, 1 May 2010 01:37:01 +0100 Subject: [PATCH 134/393] [ticket/9582] Unable to edit CPFs from UCP under MSSQL native driver. PHPBB3-9566 PHPBB3-9582 --- phpBB/includes/functions_profile_fields.php | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/includes/functions_profile_fields.php b/phpBB/includes/functions_profile_fields.php index 61e3587158..fa1cc98e10 100644 --- a/phpBB/includes/functions_profile_fields.php +++ b/phpBB/includes/functions_profile_fields.php @@ -366,6 +366,7 @@ class custom_profile case 'sqlite': case 'mssql': case 'mssql_odbc': + case 'mssqlnative': $right_delim = ']'; $left_delim = '['; break; From a20576fdd46d1fddb0dbdaca1a537e44cb7ebb10 Mon Sep 17 00:00:00 2001 From: Rob House <> Date: Sat, 1 May 2010 01:41:06 +0100 Subject: [PATCH 135/393] [ticket/9582] Removing a report reason leaves reports with an unknown reason under MSSQL native. PHPBB3-9564 PHPBB3-9582 --- phpBB/includes/acp/acp_reasons.php | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/includes/acp/acp_reasons.php b/phpBB/includes/acp/acp_reasons.php index 8d7bc88769..dbc9fcb6cc 100644 --- a/phpBB/includes/acp/acp_reasons.php +++ b/phpBB/includes/acp/acp_reasons.php @@ -233,6 +233,7 @@ class acp_reasons // Standard? What's that? case 'mssql': case 'mssql_odbc': + case 'mssqlnative': // Change the reports using this reason to 'other' $sql = "DECLARE @ptrval binary(16) From e95faaeb6845fb999a130497e954ff98d2515f43 Mon Sep 17 00:00:00 2001 From: Rob House <> Date: Sat, 1 May 2010 01:58:50 +0100 Subject: [PATCH 136/393] [ticket/9582] Advanced search cannot be accessed using MSSQL native. PHPBB3-9562 PHPBB3-9582 --- phpBB/search.php | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/search.php b/phpBB/search.php index ab2221a96e..7a9ab82f93 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -1155,6 +1155,7 @@ if ($auth->acl_get('a_search')) case 'mssql': case 'mssql_odbc': + case 'mssqlnative': $sql = 'SELECT search_time, search_keywords FROM ' . SEARCH_RESULTS_TABLE . ' WHERE DATALENGTH(search_keywords) > 0 From 11d097fc1a1bc2e539922cfa5d078bbcb74d4da8 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 1 May 2010 02:15:58 +0100 Subject: [PATCH 137/393] [ticket/9582] MSSQL native backups can now be restored. PHPBB3-9583 PHPBB3-9582 --- phpBB/includes/acp/acp_database.php | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index abfad2b90b..0582d6204e 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -394,6 +394,7 @@ class acp_database case 'mssql': case 'mssql_odbc': + case 'mssqlnative': while (($sql = $fgetd($fp, "GO\n", $read, $seek, $eof)) !== false) { $db->sql_query($sql); From 3e9d15a25d21197a8bb9336058219bbfe4bd2d0a Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 5 Apr 2010 02:20:56 +0200 Subject: [PATCH 138/393] [ticket/9176] Take current board timezone settings into account when setting board date format. PHPBB3-9176 --- phpBB/includes/acp/acp_board.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index a5feac1902..7680d8996c 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -888,8 +888,8 @@ class acp_board $old_tz = $user->timezone; $old_dst = $user->dst; - $user->timezone = $config['board_timezone']; - $user->dst = $config['board_dst']; + $user->timezone = $config['board_timezone'] * 3600; + $user->dst = $config['board_dst'] * 3600; $dateformat_options = ''; From d19565756add78e246f193b4cffd104836b87fb4 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 6 Apr 2010 15:30:54 +0200 Subject: [PATCH 139/393] [feature/remote_upload-filesize] When transferring files from a remote webserver, abort the transfer as soon as the allowed filesize has been exceeded. PHPBB3-9517 --- phpBB/includes/functions_upload.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php index 054af29045..40872f0425 100644 --- a/phpBB/includes/functions_upload.php +++ b/phpBB/includes/functions_upload.php @@ -775,7 +775,18 @@ class fileupload { if ($get_info) { - $data .= @fread($fsock, 1024); + $block = @fread($fsock, 1024); + $filesize += strlen($block); + + if ($this->max_filesize && $filesize > $this->max_filesize) + { + $max_filesize = get_formatted_filesize($this->max_filesize, false); + + $file = new fileerror(sprintf($user->lang[$this->error_prefix . 'WRONG_FILESIZE'], $max_filesize['value'], $max_filesize['unit'])); + return $file; + } + + $data .= $block; } else { From e4398ef42e8b50978f23cfb6c9145763ab0156ae Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 6 Apr 2010 15:34:05 +0200 Subject: [PATCH 140/393] [feature/remote_upload-filesize] Also check HTTP content-length before actually starting the file transfer. PHPBB3-9517 --- phpBB/includes/functions_upload.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php index 40872f0425..51fed45ebd 100644 --- a/phpBB/includes/functions_upload.php +++ b/phpBB/includes/functions_upload.php @@ -802,6 +802,18 @@ class fileupload { $upload_ary['type'] = rtrim(str_replace('content-type: ', '', strtolower($line))); } + else if ($this->max_filesize && stripos($line, 'content-length: ') !== false) + { + $length = (int) str_replace('content-length: ', '', strtolower($line)); + + if ($length && $length > $this->max_filesize) + { + $max_filesize = get_formatted_filesize($this->max_filesize, false); + + $file = new fileerror(sprintf($user->lang[$this->error_prefix . 'WRONG_FILESIZE'], $max_filesize['value'], $max_filesize['unit'])); + return $file; + } + } else if (stripos($line, '404 not found') !== false) { $file = new fileerror($user->lang[$this->error_prefix . 'URL_NOT_FOUND']); From 3a515bffb924130d5824d40ab250832a43e1db5b Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sun, 25 Apr 2010 09:39:16 -0400 Subject: [PATCH 141/393] [ticket/6726] Added localhost/127.0.0.1 note to database server hostname explanation in install language. When using PostgreSQL adapter and connecting to local database server, use localhost to connect via UNIX domain socket and 127.0.0.1 to connect via TCP. PHPBB3-6726 --- phpBB/language/en/install.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 1c27e2f40d..8515739dc9 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -128,7 +128,7 @@ $lang = array_merge($lang, array( 'DB_ERR_QUERY_FIRST_TABLE' => 'Error while executing query_first, %s (“%s”).', 'DB_ERR_SELECT' => 'Error while running SELECT query.', 'DB_HOST' => 'Database server hostname or DSN', - 'DB_HOST_EXPLAIN' => 'DSN stands for Data Source Name and is relevant only for ODBC installs.', + 'DB_HOST_EXPLAIN' => 'DSN stands for Data Source Name and is relevant only for ODBC installs. On PostgreSQL, use localhost to connect to the local server via UNIX domain socket and 127.0.0.1 to connect via TCP.', 'DB_NAME' => 'Database name', 'DB_PASSWORD' => 'Database password', 'DB_PORT' => 'Database server port', From 9ce0873bd1dadac9ebd1a74d857f71c43166fa05 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 14 May 2010 02:10:50 +0200 Subject: [PATCH 142/393] [ticket/9514] Correctly delete big datasets when deleting a forum including topics/posts on non-MySQL databases. PHPBB3-9514 --- phpBB/includes/acp/acp_forums.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 5a5adc57ae..54bf905374 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -1705,6 +1705,9 @@ class acp_forums ) ); + // Amount of rows we select and delete in one iteration. + $batch_size = 500; + foreach ($tables_ary as $field => $tables) { $start = 0; @@ -1714,7 +1717,7 @@ class acp_forums $sql = "SELECT $field FROM " . POSTS_TABLE . ' WHERE forum_id = ' . $forum_id; - $result = $db->sql_query_limit($sql, 500, $start); + $result = $db->sql_query_limit($sql, $batch_size, $start); $ids = array(); while ($row = $db->sql_fetchrow($result)) @@ -1733,7 +1736,7 @@ class acp_forums } } } - while ($row); + while (sizeof($ids) == $batch_size); } unset($ids); From 970848409d40040b3fdc07f45183935f7419b527 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 6 Apr 2010 17:56:54 +0200 Subject: [PATCH 143/393] [ticket/9518] Correctly create new connection on PostgreSQL when new connection is forced. pg_connect() takes an integer as the second parameter, but we were passing a boolean parameter. The function especially requires passing the PGSQL_CONNECT_FORCE_NEW constant if a new connection is to be forced. Passing 0 as the second parameter for 'do not force a new connection' doesn't work as expected, hence we're calling the function without a second parameter in this case. PHPBB3-9518 --- phpBB/includes/db/postgres.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php index d117e8c948..b3139b3d79 100644 --- a/phpBB/includes/db/postgres.php +++ b/phpBB/includes/db/postgres.php @@ -76,7 +76,14 @@ class dbal_postgres extends dbal $this->persistency = $persistency; - $this->db_connect_id = ($this->persistency) ? @pg_pconnect($connect_string, $new_link) : @pg_connect($connect_string, $new_link); + if ($this->persistency) + { + $this->db_connect_id = (!$new_link) ? @pg_pconnect($connect_string) : @pg_pconnect($connect_string, PGSQL_CONNECT_FORCE_NEW); + } + else + { + $this->db_connect_id = (!$new_link) ? @pg_connect($connect_string) : @pg_connect($connect_string, PGSQL_CONNECT_FORCE_NEW); + } if ($this->db_connect_id) { From cb642cff1175a4c381e4dd9e5348e44cc7e33f9d Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 12 Apr 2010 21:00:24 +0200 Subject: [PATCH 144/393] [ticket/9526] If an admin changes a user's 'user_allow_viewonline' flag to 'hide me' the admin usually wants that user to be hidden immediately. We therefore have to update his session if one exists. In the UCP this is not necessary, because there is code in $user->setup() that updates the session table on the next page reload. Since we cannot tell if the user generally wants to be hidden or the user only wants to be hidden for one session, we only update the session table when setting the flag to 'hide me', but not 'show me' - equivalent to how it works in the UCP. If the user is a bot we however also update the session when setting the flag to 'show me' because bots cannot login at all. PHPBB3-9526 --- phpBB/includes/acp/acp_users.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 4905840e02..cc196a5869 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1550,6 +1550,31 @@ class acp_users WHERE user_id = $user_id"; $db->sql_query($sql); + // Check if user has an active session + if ($user_row['session_id']) + { + // We'll update the session if user_allow_viewonline has changed and the user is a bot + // Or if it's a regular user and the admin set it to hide the session + if ($user_row['user_allow_viewonline'] != $sql_ary['user_allow_viewonline'] && $user_row['user_type'] == USER_IGNORE + || $user_row['user_allow_viewonline'] && !$sql_ary['user_allow_viewonline']) + { + // We also need to check if the user has the permission to cloak. + $user_auth = new auth(); + $user_auth->acl($user_row); + + $session_sql_ary = array( + 'session_viewonline' => ($user_auth->acl_get('u_hideonline')) ? $sql_ary['user_allow_viewonline'] : true, + ); + + $sql = 'UPDATE ' . SESSIONS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $session_sql_ary) . " + WHERE session_user_id = $user_id"; + $db->sql_query($sql); + + unset($user_auth); + } + } + trigger_error($user->lang['USER_PREFS_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); } From 823f2571f5443e3529327047f0d50d0955a4be45 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 12 Apr 2010 21:08:55 +0200 Subject: [PATCH 145/393] [ticket/9536] Small improvement for query against user/session tables when managing users from the ACP. There can be multiple entries in the session table for one user_id. We only need and also only fetch one. Using LIMIT 1 should therefore increase performance slightly. This is especially true when editing the anonymous user account because the session table can have many entries for the user_id ANONYMOUS. PHPBB3-9536 --- phpBB/includes/acp/acp_users.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 4905840e02..98409c7c0b 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -105,7 +105,7 @@ class acp_users LEFT JOIN ' . SESSIONS_TABLE . ' s ON (s.session_user_id = u.user_id) WHERE u.user_id = ' . $user_id . ' ORDER BY s.session_time DESC'; - $result = $db->sql_query($sql); + $result = $db->sql_query_limit($sql, 1); $user_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); @@ -2084,7 +2084,7 @@ class acp_users LEFT JOIN ' . SESSIONS_TABLE . ' s ON (s.session_user_id = u.user_id) WHERE u.user_id = ' . $user_id . ' ORDER BY s.session_time DESC'; - $result = $db->sql_query($sql); + $result = $db->sql_query_limit($sql, 1); $user_row = $db->sql_fetchrow($result); $db->sql_freeresult($result); } From 032a9f58f9ce4dd9777f30a8856fb49e340df179 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 14 May 2010 02:33:31 +0200 Subject: [PATCH 146/393] [ticket/9173] No longer limit scope of numbers we store in the config table on PostgreSQL and Firebird when using set_config_count(). Since we're using a VARCHAR(255) column to store the numbers we have to CAST the varchar string to a type we can do maths on. Using int4 or integer as the type however limits the scope to 4-byte-integer = 32-bit. Using DECIMAL(255, 0) allows the 'full' scope of decimals in varchar(255). PHPBB3-9173 --- phpBB/includes/functions.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 4f52c7c2ce..026496bfb3 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -175,11 +175,8 @@ function set_config_count($config_name, $increment, $is_dynamic = false) switch ($db->sql_layer) { case 'firebird': - $sql_update = 'CAST(CAST(config_value as integer) + ' . (int) $increment . ' as VARCHAR(255))'; - break; - case 'postgres': - $sql_update = 'int4(config_value) + ' . (int) $increment; + $sql_update = 'CAST(CAST(config_value as DECIMAL(255, 0)) + ' . (int) $increment . ' as VARCHAR(255))'; break; // MySQL, SQlite, mssql, mssql_odbc, oracle From 99482e95557026e9562825cda8eebe61ed880c01 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 13 May 2010 13:28:55 +0200 Subject: [PATCH 147/393] [ticket/9598] checkdnsrr() is now available on Windows with PHP 5.3 or later. Change if block order to always call checkdnsrr() if the function is available. PHPBB3-9598 --- phpBB/includes/functions.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 4f52c7c2ce..c88e434b4b 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3409,13 +3409,14 @@ function phpbb_checkdnsrr($host, $type = '') { $type = (!$type) ? 'MX' : $type; - if (DIRECTORY_SEPARATOR == '\\') + // Call checkdnsrr() if available. This is also the case on Windows with PHP 5.3 or later. + if (function_exists('checkdnsrr')) + { + // The dot indicates to search the DNS root (helps those having DNS prefixes on the same domain) + return checkdnsrr($host . '.', $type); + } + else if (DIRECTORY_SEPARATOR == '\\' && function_exists('exec')) { - if (!function_exists('exec')) - { - return NULL; - } - // @exec('nslookup -retry=1 -timout=1 -type=' . escapeshellarg($type) . ' ' . escapeshellarg($host), $output); @exec('nslookup -type=' . escapeshellarg($type) . ' ' . escapeshellarg($host) . '.', $output); @@ -3441,11 +3442,6 @@ function phpbb_checkdnsrr($host, $type = '') return false; } - else if (function_exists('checkdnsrr')) - { - // The dot indicates to search the DNS root (helps those having DNS prefixes on the same domain) - return (checkdnsrr($host . '.', $type)) ? true : false; - } return NULL; } From 58dc5a191c0203ea6d98c37df26b0830b3bf8203 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 11 Apr 2010 20:42:49 +0200 Subject: [PATCH 148/393] [ticket/7717] Localise default extension groups for attachments PHPBB3-7717 --- phpBB/includes/acp/acp_attachments.php | 9 +++++- phpBB/install/database_update.php | 41 +++++++++++++++++++++++++- phpBB/language/en/acp/attachments.php | 12 +++++++- phpBB/language/en/install.php | 10 ------- 4 files changed, 59 insertions(+), 13 deletions(-) diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php index 25e51814c4..980558c830 100644 --- a/phpBB/includes/acp/acp_attachments.php +++ b/phpBB/includes/acp/acp_attachments.php @@ -90,6 +90,7 @@ class acp_attachments $s_assigned_groups = array(); while ($row = $db->sql_fetchrow($result)) { + $row['group_name'] = (isset($user->lang['EXT_GROUP_' . $row['group_name']])) ? $user->lang['EXT_GROUP_' . $row['group_name']] : $row['group_name']; $s_assigned_groups[$row['cat_id']][] = $row['group_name']; } $db->sql_freeresult($result); @@ -494,6 +495,10 @@ class acp_attachments $sql = 'SELECT group_id FROM ' . EXTENSION_GROUPS_TABLE . " WHERE LOWER(group_name) = '" . $db->sql_escape(utf8_strtolower($new_group_name)) . "'"; + if ($group_id) + { + $sql .= ' AND group_id <> ' . $group_id; + } $result = $db->sql_query($sql); if ($db->sql_fetchrow($result)) @@ -551,6 +556,7 @@ class acp_attachments $group_id = $db->sql_nextid(); } + $group_name = (isset($user->lang['EXT_GROUP_' . $group_name])) ? $user->lang['EXT_GROUP_' . $group_name] : $group_name; add_log('admin', 'LOG_ATTACH_EXTGROUP_' . strtoupper($action), $group_name); } @@ -858,7 +864,7 @@ class acp_attachments 'U_EDIT' => $this->u_action . "&action=edit&g={$row['group_id']}", 'U_DELETE' => $this->u_action . "&action=delete&g={$row['group_id']}", - 'GROUP_NAME' => $row['group_name'], + 'GROUP_NAME' => (isset($user->lang['EXT_GROUP_' . $row['group_name']])) ? $user->lang['EXT_GROUP_' . $row['group_name']] : $row['group_name'], 'CATEGORY' => $cat_lang[$row['cat_id']], ) ); @@ -1118,6 +1124,7 @@ class acp_attachments $group_name = array(); while ($row = $db->sql_fetchrow($result)) { + $row['group_name'] = (isset($user->lang['EXT_GROUP_' . $row['group_name']])) ? $user->lang['EXT_GROUP_' . $row['group_name']] : $row['group_name']; $group_name[] = $row; } $db->sql_freeresult($result); diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 7af0c86314..47d261dc46 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -913,6 +913,8 @@ function database_update_info() '3.0.7-RC2' => array(), // No changes from 3.0.7 to 3.0.7-PL1 '3.0.7' => array(), + // No changes from 3.0.7-PL1 to 3.0.8-RC1 + '3.0.7-PL1' => array(), ); } @@ -923,7 +925,7 @@ function database_update_info() *****************************************************************************/ function change_database_data(&$no_updates, $version) { - global $db, $errored, $error_ary, $config, $phpbb_root_path, $phpEx; + global $db, $errored, $error_ary, $config, $phpbb_root_path, $phpEx, $user; switch ($version) { @@ -1648,6 +1650,43 @@ function change_database_data(&$no_updates, $version) // No changes from 3.0.7 to 3.0.7-PL1 case '3.0.7': break; + + // Changes from 3.0.7-PL1 to 3.0.8-RC1 + case '3.0.7-PL1': + $user->add_lang('acp/attachments'); + $extension_groups = array( + $user->lang['EXT_GROUP_ARCHIVES'] => 'ARCHIVES', + $user->lang['EXT_GROUP_DOCUMENTS'] => 'DOCUMENTS', + $user->lang['EXT_GROUP_DOWNLOADABLE_FILES'] => 'DOWNLOADABLE_FILES', + $user->lang['EXT_GROUP_FLASH_FILES'] => 'FLASH_FILES', + $user->lang['EXT_GROUP_IMAGES'] => 'IMAGES', + $user->lang['EXT_GROUP_PLAIN_TEXT'] => 'PLAIN_TEXT', + $user->lang['EXT_GROUP_QUICKTIME_MEDIA'] => 'QUICKTIME_MEDIA', + $user->lang['EXT_GROUP_REAL_MEDIA'] => 'REAL_MEDIA', + $user->lang['EXT_GROUP_WINDOWS_MEDIA'] => 'WINDOWS_MEDIA', + ); + + $sql = 'SELECT group_id, group_name + FROM ' . EXTENSION_GROUPS_TABLE; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if (isset($extension_groups[$row['group_name']])) + { + $sql_ary = array( + 'group_name' => $extension_groups[$row['group_name']], + ); + $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE group_id = ' . (int) $row['group_id']; + _sql($sql, $errored, $error_ary); + } + } + $db->sql_freeresult($result); + + + $no_updates = false; + break; } } diff --git a/phpBB/language/en/acp/attachments.php b/phpBB/language/en/acp/attachments.php index f6369b6739..1821b8c867 100644 --- a/phpBB/language/en/acp/attachments.php +++ b/phpBB/language/en/acp/attachments.php @@ -85,7 +85,7 @@ $lang = array_merge($lang, array( 'DISPLAY_INLINED_EXPLAIN' => 'If set to No image attachments will show as a link.', 'DISPLAY_ORDER' => 'Attachment display order', 'DISPLAY_ORDER_EXPLAIN' => 'Display attachments ordered by time.', - + 'EDIT_EXTENSION_GROUP' => 'Edit extension group', 'EXCLUDE_ENTERED_IP' => 'Enable this to exclude the entered IP/hostname.', 'EXCLUDE_FROM_ALLOWED_IP' => 'Exclude IP from allowed IPs/hostnames', @@ -97,6 +97,16 @@ $lang = array_merge($lang, array( 'EXTENSION_GROUP_DELETED' => 'Extension group successfully deleted.', 'EXTENSION_GROUP_EXIST' => 'The extension group %s already exists.', + 'EXT_GROUP_ARCHIVES' => 'Archives', + 'EXT_GROUP_DOCUMENTS' => 'Documents', + 'EXT_GROUP_DOWNLOADABLE_FILES' => 'Downloadable Files', + 'EXT_GROUP_FLASH_FILES' => 'Flash Files', + 'EXT_GROUP_IMAGES' => 'Images', + 'EXT_GROUP_PLAIN_TEXT' => 'Plain Text', + 'EXT_GROUP_QUICKTIME_MEDIA' => 'Quicktime Media', + 'EXT_GROUP_REAL_MEDIA' => 'Real Media', + 'EXT_GROUP_WINDOWS_MEDIA' => 'Windows Media', + 'GO_TO_EXTENSIONS' => 'Go to extension management screen', 'GROUP_NAME' => 'Group name', diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 1c27e2f40d..095a966f6d 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -586,16 +586,6 @@ $lang = array_merge($lang, array( 'DEFAULT_INSTALL_POST' => 'This is an example post in your phpBB3 installation. Everything seems to be working. You may delete this post if you like and continue to set up your board. During the installation process your first category and your first forum are assigned an appropriate set of permissions for the predefined usergroups administrators, bots, global moderators, guests, registered users and registered COPPA users. If you also choose to delete your first category and your first forum, do not forget to assign permissions for all these usergroups for all new categories and forums you create. It is recommended to rename your first category and your first forum and copy permissions from these while creating new categories and forums. Have fun!', - 'EXT_GROUP_ARCHIVES' => 'Archives', - 'EXT_GROUP_DOCUMENTS' => 'Documents', - 'EXT_GROUP_DOWNLOADABLE_FILES' => 'Downloadable Files', - 'EXT_GROUP_FLASH_FILES' => 'Flash Files', - 'EXT_GROUP_IMAGES' => 'Images', - 'EXT_GROUP_PLAIN_TEXT' => 'Plain Text', - 'EXT_GROUP_QUICKTIME_MEDIA' => 'Quicktime Media', - 'EXT_GROUP_REAL_MEDIA' => 'Real Media', - 'EXT_GROUP_WINDOWS_MEDIA' => 'Windows Media', - 'FORUMS_FIRST_CATEGORY' => 'Your first category', 'FORUMS_TEST_FORUM_DESC' => 'Description of your first forum.', 'FORUMS_TEST_FORUM_TITLE' => 'Your first forum', From e3ba934cd7b0325a5fdc444aace0e13d8c84fc59 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 10 Apr 2010 19:28:53 +0200 Subject: [PATCH 149/393] [ticket/8894] Fix JavaScript-Error and hide Quote-Button on topic review if BBCodes are not allowed. PHPBB3-8894 --- phpBB/includes/ucp/ucp_pm_compose.php | 2 +- phpBB/posting.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php index 4d72d45f81..b596e72c41 100644 --- a/phpBB/includes/ucp/ucp_pm_compose.php +++ b/phpBB/includes/ucp/ucp_pm_compose.php @@ -1054,7 +1054,7 @@ function compose_pm($id, $mode, $action) 'S_COMPOSE_PM' => true, 'S_EDIT_POST' => ($action == 'edit'), 'S_SHOW_PM_ICONS' => $s_pm_icons, - 'S_BBCODE_ALLOWED' => $bbcode_status, + 'S_BBCODE_ALLOWED' => ($bbcode_status) ? 1 : 0, 'S_BBCODE_CHECKED' => ($bbcode_checked) ? ' checked="checked"' : '', 'S_SMILIES_ALLOWED' => $smilies_status, 'S_SMILIES_CHECKED' => ($smilies_checked) ? ' checked="checked"' : '', diff --git a/phpBB/posting.php b/phpBB/posting.php index 5f27b61aae..1f593df561 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1420,7 +1420,7 @@ $template->assign_vars(array( 'S_DISPLAY_USERNAME' => (!$user->data['is_registered'] || ($mode == 'edit' && $post_data['poster_id'] == ANONYMOUS)) ? true : false, 'S_SHOW_TOPIC_ICONS' => $s_topic_icons, 'S_DELETE_ALLOWED' => ($mode == 'edit' && (($post_id == $post_data['topic_last_post_id'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id) && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time'])) || $auth->acl_get('m_delete', $forum_id))) ? true : false, - 'S_BBCODE_ALLOWED' => $bbcode_status, + 'S_BBCODE_ALLOWED' => ($bbcode_status) ? 1 : 0, 'S_BBCODE_CHECKED' => ($bbcode_checked) ? ' checked="checked"' : '', 'S_SMILIES_ALLOWED' => $smilies_status, 'S_SMILIES_CHECKED' => ($smilies_checked) ? ' checked="checked"' : '', From d8b5594c14f6d2cc297484153d093606c45c6d03 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 12 Apr 2010 20:53:57 +0200 Subject: [PATCH 150/393] [ticket/9119] Respect language selection on automated update. PHPBB3-9119 --- phpBB/install/install_update.php | 52 +++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index a5e54a354a..e717fe3dd4 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -72,7 +72,7 @@ class install_update extends module function main($mode, $sub) { - global $template, $phpEx, $phpbb_root_path, $user, $db, $config, $cache, $auth; + global $template, $phpEx, $phpbb_root_path, $user, $db, $config, $cache, $auth, $language; $this->tpl_name = 'install_update'; $this->page_title = 'UPDATE_INSTALLATION'; @@ -119,7 +119,17 @@ class install_update extends module $user->session_begin(); $auth->acl($user->data); - $user->setup('install'); + // Overwrite user's language with the selected one. + // Config needs to be changed to ensure that guests also get the selected language. + $config_default_lang = $config['default_lang']; + $config['default_lang'] = $language; + $user->data['user_lang'] = $language; + + $user->setup(array('common', 'acp/common', 'acp/board', 'install', 'posting')); + + // Reset the default_lang + $config['default_lang'] = $config_default_lang; + unset($config_default_lang); // If we are within the intro page we need to make sure we get up-to-date version info if ($sub == 'intro') @@ -133,6 +143,14 @@ class install_update extends module // still, the acp template is never stored in the database $user->theme['template_storedb'] = false; + $template->assign_vars(array( + 'S_USER_LANG' => $user->lang['USER_LANG'], + 'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'], + 'S_CONTENT_ENCODING' => 'UTF-8', + 'S_CONTENT_FLOW_BEGIN' => ($user->lang['DIRECTION'] == 'ltr') ? 'left' : 'right', + 'S_CONTENT_FLOW_END' => ($user->lang['DIRECTION'] == 'ltr') ? 'right' : 'left', + )); + // Get current and latest version if (($latest_version = $cache->get('_version_info')) === false) { @@ -234,7 +252,7 @@ class install_update extends module $template->assign_vars(array( 'S_INTRO' => true, - 'U_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&sub=version_check"), + 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=version_check"), )); // Make sure the update list is destroyed. @@ -250,8 +268,8 @@ class install_update extends module 'S_UP_TO_DATE' => $up_to_date, 'S_VERSION_CHECK' => true, - 'U_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&sub=file_check"), - 'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&sub=update_db"), + 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"), + 'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_db"), 'LATEST_VERSION' => $this->latest_version, 'CURRENT_VERSION' => $this->current_version) @@ -305,8 +323,8 @@ class install_update extends module 'S_DB_UPDATE' => true, 'S_DB_UPDATE_FINISHED' => ($config['version'] == $this->update_info['version']['to']) ? true : false, 'U_DB_UPDATE' => append_sid($phpbb_root_path . 'install/database_update.' . $phpEx, 'type=1&language=' . $user->data['user_lang']), - 'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&sub=update_db"), - 'U_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&sub=file_check"), + 'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_db"), + 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"), )); break; @@ -363,7 +381,7 @@ class install_update extends module // Refresh the page if we are still not finished... if ($update_list['status'] != -1) { - $refresh_url = append_sid($this->p_master->module_url, "mode=$mode&sub=file_check"); + $refresh_url = append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"); meta_refresh(2, $refresh_url); $template->assign_vars(array( @@ -427,7 +445,7 @@ class install_update extends module $file_part = $filename; } - $diff_url = append_sid($this->p_master->module_url, "mode=$mode&sub=file_check&action=diff&status=$status&file=" . urlencode($file_struct['filename'])); + $diff_url = append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check&action=diff&status=$status&file=" . urlencode($file_struct['filename'])); if (isset($file_struct['as_expected']) && $file_struct['as_expected']) { @@ -475,9 +493,9 @@ class install_update extends module 'S_FILE_CHECK' => true, 'S_ALL_UP_TO_DATE' => $all_up_to_date, 'S_VERSION_UP_TO_DATE' => $up_to_date, - 'U_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&sub=file_check"), - 'U_UPDATE_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&sub=update_files"), - 'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&sub=update_db"), + 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check"), + 'U_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_files"), + 'U_DB_UPDATE_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_db"), )); if ($all_up_to_date) @@ -690,7 +708,7 @@ class install_update extends module $params[] = 'download=1'; } - $redirect_url = append_sid($this->p_master->module_url, "mode=$mode&sub=update_files&" . implode('&', $params)); + $redirect_url = append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_files&" . implode('&', $params)); meta_refresh(3, $redirect_url); $template->assign_vars(array( @@ -831,7 +849,7 @@ class install_update extends module $template->assign_vars(array( 'S_DOWNLOAD_FILES' => true, - 'U_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&sub=update_files"), + 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_files"), 'RADIO_BUTTONS' => $radio_buttons, 'S_HIDDEN_FIELDS' => $s_hidden_fields) ); @@ -945,8 +963,8 @@ class install_update extends module 'S_FTP_UPLOAD' => true, 'UPLOAD_METHOD' => $method, - 'U_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&sub=update_files"), - 'U_DOWNLOAD_METHOD' => append_sid($this->p_master->module_url, "mode=$mode&sub=update_files&download=1"), + 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_files"), + 'U_DOWNLOAD_METHOD' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=update_files&download=1"), 'S_HIDDEN_FIELDS' => $s_hidden_fields, )); @@ -1079,7 +1097,7 @@ class install_update extends module $template->assign_vars(array( 'S_UPLOAD_SUCCESS' => true, - 'U_ACTION' => append_sid($this->p_master->module_url, "mode=$mode&sub=file_check")) + 'U_ACTION' => append_sid($this->p_master->module_url, "language=$language&mode=$mode&sub=file_check")) ); return; } From 97d180ab6620531ee6081fd652e4d51258a4aa1a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 10 Apr 2010 16:52:13 +0200 Subject: [PATCH 151/393] [ticket/9146] Fix double occurring tabindex="6" in prosilver's QR PHPBB3-9146 --- phpBB/styles/prosilver/template/quickreply_editor.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/quickreply_editor.html b/phpBB/styles/prosilver/template/quickreply_editor.html index 8a5b8aeb16..ea07c2e6d8 100644 --- a/phpBB/styles/prosilver/template/quickreply_editor.html +++ b/phpBB/styles/prosilver/template/quickreply_editor.html @@ -61,7 +61,7 @@ {S_FORM_TOKEN} {QR_HIDDEN_FIELDS}   -   +   {L_COLLAPSE_QR}

            From 18e0b07487d4195f7d979214be2900f36a943a61 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 11 Apr 2010 00:31:19 +0200 Subject: [PATCH 152/393] [ticket/9528] Also fall back to bbcode-less quotes for PMs, when bbcodes are disabled. PHPBB3-9528 --- phpBB/styles/prosilver/template/ucp_pm_history.html | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phpBB/styles/prosilver/template/ucp_pm_history.html b/phpBB/styles/prosilver/template/ucp_pm_history.html index 88efcf95be..bcd6a75397 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_history.html +++ b/phpBB/styles/prosilver/template/ucp_pm_history.html @@ -5,6 +5,11 @@
            +
            From a3874c2cd6fb614d1c6aee3e9aa9b3eeb5d345cf Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 11 Apr 2010 00:43:44 +0200 Subject: [PATCH 153/393] [ticket/9529] Topic review is not showing all selected posts. PHPBB3-9529 --- phpBB/includes/functions_posting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 21c5fe7aca..4cb3941ce0 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1146,7 +1146,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id } } - unset($rowset[$i]); + unset($rowset[$post_list[$i]]); } if ($mode == 'topic_review') From d8b4c0db0cfd8fc4fb655020b7e9743c04d64df9 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 14 Apr 2010 00:59:28 +0200 Subject: [PATCH 154/393] [ticket/9546] Also delete bookmarks, when a topic is deleted. PHPBB3-9546 --- phpBB/includes/functions_admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 93244be55c..13c2acfd24 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -675,7 +675,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s $db->sql_transaction('begin'); - $table_ary = array(TOPICS_TRACK_TABLE, TOPICS_POSTED_TABLE, POLL_VOTES_TABLE, POLL_OPTIONS_TABLE, TOPICS_WATCH_TABLE, TOPICS_TABLE); + $table_ary = array(BOOKMARKS_TABLE, TOPICS_TRACK_TABLE, TOPICS_POSTED_TABLE, POLL_VOTES_TABLE, POLL_OPTIONS_TABLE, TOPICS_WATCH_TABLE, TOPICS_TABLE); foreach ($table_ary as $table) { From 36c19869865a8f46d9fa980b90db6d5283238bac Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 14 May 2010 02:59:00 +0200 Subject: [PATCH 155/393] [ticket/9545] Initial forum should display active topics by default. The initial forum 'Your first forum' should show topics (especially the 'Welcome to phpBB3' topic) in the active topics list after installing phpBB because this is the default setting for new forums (but not categories). The default database column value for forum_flags is 32 = FORUM_FLAG_POST_REVIEW, we therefore have to explicitly set forum_flags to FORUM_FLAG_POST_REVIEW + FORUM_FLAG_ACTIVE_TOPICS = 48 for this forum. PHPBB3-9545 --- phpBB/install/schemas/schema_data.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index 38088b291d..e815615eef 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -509,7 +509,7 @@ INSERT INTO phpbb_styles_theme (theme_name, theme_copyright, theme_path, theme_s # -- Forums INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts, forum_topics, forum_topics_real, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed, forum_parents) VALUES ('{L_FORUMS_FIRST_CATEGORY}', '', 1, 4, 0, 0, 1, 1, 1, 1, 2, 'Admin', 'AA0000', 972086460, '', '', '', '', '', '', '', 0, 0, ''); -INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts, forum_topics, forum_topics_real, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour, forum_last_post_subject, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed, forum_parents) VALUES ('{L_FORUMS_TEST_FORUM_TITLE}', '{L_FORUMS_TEST_FORUM_DESC}', 2, 3, 1, 1, 1, 1, 1, 1, 2, 'Admin', 'AA0000', '{L_TOPICS_TOPIC_TITLE}', 972086460, '', '', '', '', '', '', '', 0, 0, ''); +INSERT INTO phpbb_forums (forum_name, forum_desc, left_id, right_id, parent_id, forum_type, forum_posts, forum_topics, forum_topics_real, forum_last_post_id, forum_last_poster_id, forum_last_poster_name, forum_last_poster_colour, forum_last_post_subject, forum_last_post_time, forum_link, forum_password, forum_image, forum_rules, forum_rules_link, forum_rules_uid, forum_desc_uid, prune_days, prune_viewed, forum_parents, forum_flags) VALUES ('{L_FORUMS_TEST_FORUM_TITLE}', '{L_FORUMS_TEST_FORUM_DESC}', 2, 3, 1, 1, 1, 1, 1, 1, 2, 'Admin', 'AA0000', '{L_TOPICS_TOPIC_TITLE}', 972086460, '', '', '', '', '', '', '', 0, 0, '', 48); # -- Users / Anonymous user INSERT INTO phpbb_users (user_type, group_id, username, username_clean, user_regdate, user_password, user_email, user_lang, user_style, user_rank, user_colour, user_posts, user_permissions, user_ip, user_birthday, user_lastpage, user_last_confirm_key, user_post_sortby_type, user_post_sortby_dir, user_topic_sortby_type, user_topic_sortby_dir, user_avatar, user_sig, user_sig_bbcode_uid, user_from, user_icq, user_aim, user_yim, user_msnm, user_jabber, user_website, user_occ, user_interests, user_actkey, user_newpasswd, user_allow_massemail) VALUES (2, 1, 'Anonymous', 'anonymous', 0, '', '', 'en', 1, 0, '', 0, '', '', '', '', '', 't', 'a', 't', 'd', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 0); From ed0a26ab16282c3e053df46fa3a33185654642b4 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Wed, 5 May 2010 09:39:47 -0500 Subject: [PATCH 156/393] [ticket/9510] Unable to copy permissions from and to forums you cannot see This commit fixes the bug mentioned, plus a large number of regressions caused by changing the behavior of make_forum_select() (in svn r10427, dated Jan 18, 2010). It also rolls back the changes from branch "bug/58415", which are no longer needed. PHPBB3-9510 --- phpBB/includes/functions_admin.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 13c2acfd24..4cd2962e3b 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -96,16 +96,12 @@ function make_forum_select($select_id = false, $ignore_id = false, $ignore_acl = $right = $row['right_id']; $disabled = false; - if (!$ignore_acl && $auth->acl_get('f_list', $row['forum_id'])) + if (!$ignore_acl && $auth->acl_gets(array('f_list', 'a_forum', 'a_forumadd', 'a_forumdel'), $row['forum_id'])) { if ($only_acl_post && !$auth->acl_get('f_post', $row['forum_id']) || (!$auth->acl_get('m_approve', $row['forum_id']) && !$auth->acl_get('f_noapprove', $row['forum_id']))) { $disabled = true; } - else if (!$only_acl_post && !$auth->acl_gets(array('f_list', 'a_forum', 'a_forumadd', 'a_forumdel'), $row['forum_id'])) - { - $disabled = true; - } } else if (!$ignore_acl) { From e6b9178c4439f14b085470f7f16c1fee67262296 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Wed, 5 May 2010 10:23:40 -0500 Subject: [PATCH 157/393] [ticket/9510] Unable to copy permissions from and to forums you cannot see This commit fixes the bug mentioned, plus a large number of regressions caused by changing the behavior of make_forum_select() (in svn r10427, dated Jan 18, 2010). It also rolls back the changes from branch "bug/58415", which are no longer needed. PHPBB3-9510 --- phpBB/includes/acp/acp_forums.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 54bf905374..7b7671573e 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -407,7 +407,7 @@ class acp_forums $exclude_forums[] = $row['forum_id']; } - $parents_list = make_forum_select($forum_data['parent_id'], $exclude_forums, true, false, false); + $parents_list = make_forum_select($forum_data['parent_id'], $exclude_forums, false, false, false); $forum_data['forum_password_confirm'] = $forum_data['forum_password']; } @@ -416,7 +416,7 @@ class acp_forums $this->page_title = 'CREATE_FORUM'; $forum_id = $this->parent_id; - $parents_list = make_forum_select($this->parent_id, false, true, false, false); + $parents_list = make_forum_select($this->parent_id, false, false, false, false); // Fill forum data with default values if (!$update) From 1d2b4ffc651bc1f39849c643e69193926611f2ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20A=2E=20Ruszczy=C5=84ski?= Date: Fri, 9 Apr 2010 14:08:20 +0200 Subject: [PATCH 158/393] [ticket/9524] IPv6 regex does not match all valid IPv6 addresses starting with :: :: can replace 1 or more groups (not 2 or more) PHPBB3-9524 --- phpBB/develop/regex.php | 5 +++-- phpBB/includes/functions.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/phpBB/develop/regex.php b/phpBB/develop/regex.php index 4498204b4a..8165ba1f21 100644 --- a/phpBB/develop/regex.php +++ b/phpBB/develop/regex.php @@ -18,14 +18,15 @@ $ls32 = "(?:$h16:$h16|$ipv4)"; $ipv6_construct = array( array(false, '', '{6}', $ls32), - array(false, '::', '{5}', $ls32), + array(false, '::', '{0,5}', "(?:$h16(?::$h16)?|$ipv4)"), array('', ':', '{4}', $ls32), array('{1,2}', ':', '{3}', $ls32), array('{1,3}', ':', '{2}', $ls32), array('{1,4}', ':', '', $ls32), array('{1,5}', ':', false, $ls32), array('{1,6}', ':', false, $h16), - array('{1,7}', ':', false, '') + array('{1,7}', ':', false, ''), + array(false, '::', false, '') ); $ipv6 = '(?:'; diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 38f910974a..e8f45b654f 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3332,7 +3332,7 @@ function get_preg_expression($mode) break; case 'ipv6': - return '#^(?:(?:(?:[\dA-F]{1,4}:){6}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:::(?:[\dA-F]{1,4}:){5}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:):(?:[\dA-F]{1,4}:){4}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,2}:(?:[\dA-F]{1,4}:){3}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,3}:(?:[\dA-F]{1,4}:){2}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,4}:(?:[\dA-F]{1,4}:)(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,5}:(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,6}:[\dA-F]{1,4})|(?:(?:[\dA-F]{1,4}:){1,7}:))$#i'; + return '#^(?:(?:(?:[\dA-F]{1,4}:){6}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:::(?:[\dA-F]{1,4}:){0,5}(?:[\dA-F]{1,4}(?::[\dA-F]{1,4})?|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:):(?:[\dA-F]{1,4}:){4}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,2}:(?:[\dA-F]{1,4}:){3}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,3}:(?:[\dA-F]{1,4}:){2}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,4}:(?:[\dA-F]{1,4}:)(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,5}:(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,6}:[\dA-F]{1,4})|(?:(?:[\dA-F]{1,4}:){1,7}:)|(?:::))$#i'; break; case 'url': From 41498fe3ee0d4be0fe00d726942495acf05a7333 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 11 Apr 2010 21:02:37 +0200 Subject: [PATCH 159/393] [ticket/9535] Correctly set margin of textarea in ACP > Users signature for RTL languages. PHPBB3-9535 --- phpBB/adm/style/acp_users_signature.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/adm/style/acp_users_signature.html b/phpBB/adm/style/acp_users_signature.html index 0ea5328c3c..6317a375b4 100644 --- a/phpBB/adm/style/acp_users_signature.html +++ b/phpBB/adm/style/acp_users_signature.html @@ -93,8 +93,8 @@ // ]]> -
            -
            +
            +
            @@ -105,7 +105,7 @@
            -
            {L_OPTIONS}: {BBCODE_STATUS} :: {IMG_STATUS} :: {FLASH_STATUS} :: {URL_STATUS} :: {SMILIES_STATUS}
            +
            {L_OPTIONS}: {BBCODE_STATUS} :: {IMG_STATUS} :: {FLASH_STATUS} :: {URL_STATUS} :: {SMILIES_STATUS}
            From 0da86964d5a5890667d500e5d1699a56aef8a168 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 12 Apr 2010 19:33:13 +0200 Subject: [PATCH 160/393] [ticket/9535] Fix some more rtl margin issues. PHPBB3-9535 --- phpBB/adm/style/permission_mask.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/adm/style/permission_mask.html b/phpBB/adm/style/permission_mask.html index fb4d3ef143..e29609b8b6 100644 --- a/phpBB/adm/style/permission_mask.html +++ b/phpBB/adm/style/permission_mask.html @@ -40,7 +40,7 @@
            -
            +
            {L_NO_ROLE_AVAILABLE}
            @@ -118,7 +118,7 @@
            -
            +

            {L_APPLY_PERMISSIONS_EXPLAIN}

            From 9fa8bb82e4a9f8b9e6c8b6f51699a3c517c85bf2 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 12 Apr 2010 20:56:09 +0200 Subject: [PATCH 161/393] [ticket/9535] Also fix the margin in the install_update.html PHPBB3-9535 --- phpBB/adm/style/install_update.html | 38 ++++++++++++++--------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/phpBB/adm/style/install_update.html b/phpBB/adm/style/install_update.html index 4b89537acb..22d21d8314 100644 --- a/phpBB/adm/style/install_update.html +++ b/phpBB/adm/style/install_update.html @@ -200,7 +200,7 @@ {L_STATUS_UP_TO_DATE}
            -
            {up_to_date.FILENAME}
            +
            {up_to_date.FILENAME}
            @@ -218,11 +218,11 @@
            {new.DIR_PART}
            {new.FILE_PART}

            {L_FILE_USED}: {new.CUSTOM_ORIGINAL}
            -
            +
            [{new.L_SHOW_DIFF}]{L_BINARY_FILE}
            -
            +
            @@ -242,9 +242,9 @@
            {not_modified.DIR_PART}
            {not_modified.FILE_PART}

            {L_FILE_USED}: {not_modified.CUSTOM_ORIGINAL}
            -
            [{not_modified.L_SHOW_DIFF}]{L_BINARY_FILE}
            +
            [{not_modified.L_SHOW_DIFF}]{L_BINARY_FILE}
            -
            +
            @@ -263,22 +263,22 @@
            {modified.DIR_PART}
            {modified.FILE_PART}

            {L_FILE_USED}: {modified.CUSTOM_ORIGINAL}
            -
             
            +
             
            -
            +
            -
            [{modified.L_SHOW_DIFF}]{L_BINARY_FILE}
            +
            [{modified.L_SHOW_DIFF}]{L_BINARY_FILE}
            -
            [{L_SHOW_DIFF_FINAL}] 
            +
            [{L_SHOW_DIFF_FINAL}] 
            -
            [{L_SHOW_DIFF_FINAL}] 
            +
            [{L_SHOW_DIFF_FINAL}] 
            @@ -296,11 +296,11 @@
            {new_conflict.DIR_PART}
            {new_conflict.FILE_PART}

            {L_FILE_USED}: {new_conflict.CUSTOM_ORIGINAL}
            -
            +
            [{new_conflict.L_SHOW_DIFF}]{L_BINARY_FILE}
            -
            +
            @@ -320,35 +320,35 @@
            {L_FILE_USED}: {conflict.CUSTOM_ORIGINAL}
            {L_NUM_CONFLICTS}: {conflict.NUM_CONFLICTS} -
            +
            [{L_DOWNLOAD_CONFLICTS}]
            {L_DOWNLOAD_CONFLICTS_EXPLAIN} {L_BINARY_FILE}
            -
            +
            -
             
            +
             
            -
            [{L_SHOW_DIFF_MODIFIED}]
            +
            [{L_SHOW_DIFF_MODIFIED}]
            -
            [{L_SHOW_DIFF_MODIFIED}]
            +
            [{L_SHOW_DIFF_MODIFIED}]
            -
            [{L_SHOW_DIFF_FINAL}]
            +
            [{L_SHOW_DIFF_FINAL}]
            -
            [{L_SHOW_DIFF_FINAL}]
            +
            [{L_SHOW_DIFF_FINAL}]
            From d555e83b80b79f7afd1730b50502105a2c2f76d2 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 14 May 2010 13:23:16 +0200 Subject: [PATCH 162/393] [ticket/9547] Use separate constants for display/enable active topics. Split S_DISPLAY_ACTIVE_TOPICS into S_DISPLAY_ACTIVE_TOPICS and S_ENABLE_ACTIVE_TOPICS so we have correct default values when changing the forum type. PHPBB3-9547 --- phpBB/adm/style/acp_forums.html | 4 ++-- phpBB/includes/acp/acp_forums.php | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/phpBB/adm/style/acp_forums.html b/phpBB/adm/style/acp_forums.html index 937a288cb2..9f9216a068 100644 --- a/phpBB/adm/style/acp_forums.html +++ b/phpBB/adm/style/acp_forums.html @@ -189,8 +189,8 @@ {L_GENERAL_FORUM_SETTINGS}

            {L_DISPLAY_ACTIVE_TOPICS_EXPLAIN}
            -
            -
            +
            +
            diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 54bf905374..e13af0e858 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -169,7 +169,7 @@ class acp_forums $forum_data['forum_status'] = ITEM_UNLOCKED; } - $forum_data['show_active'] = ($forum_data['forum_type'] == FORUM_POST) ? request_var('display_recent', true) : request_var('display_active', true); + $forum_data['show_active'] = ($forum_data['forum_type'] == FORUM_POST) ? request_var('display_recent', true) : request_var('display_active', false); // Get data for forum rules if specified... if ($forum_data['forum_rules']) @@ -639,7 +639,8 @@ class acp_forums 'S_PRUNE_OLD_POLLS' => ($forum_data['forum_flags'] & FORUM_FLAG_PRUNE_POLL) ? true : false, 'S_PRUNE_ANNOUNCE' => ($forum_data['forum_flags'] & FORUM_FLAG_PRUNE_ANNOUNCE) ? true : false, 'S_PRUNE_STICKY' => ($forum_data['forum_flags'] & FORUM_FLAG_PRUNE_STICKY) ? true : false, - 'S_DISPLAY_ACTIVE_TOPICS' => ($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS) ? true : false, + 'S_DISPLAY_ACTIVE_TOPICS' => ($forum_data['forum_type'] == FORUM_POST) ? ($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS) : true, + 'S_ENABLE_ACTIVE_TOPICS' => ($forum_data['forum_type'] == FORUM_CAT) ? ($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS) : false, 'S_ENABLE_POST_REVIEW' => ($forum_data['forum_flags'] & FORUM_FLAG_POST_REVIEW) ? true : false, 'S_ENABLE_QUICK_REPLY' => ($forum_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) ? true : false, 'S_CAN_COPY_PERMISSIONS' => ($action != 'edit' || empty($forum_id) || ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth'))) ? true : false, From fe9c5019b672f26453df55c1a7f6bf876f56da3d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 11 Apr 2010 01:30:56 +0200 Subject: [PATCH 163/393] [ticket/9531] BBCode-less quotes fallback-option is missing "Author wrote:" line when quoting from topic-review. PHPBB3-9531 --- phpBB/posting.php | 2 +- phpBB/styles/prosilver/template/editor.js | 3 ++- phpBB/styles/prosilver/template/posting_topic_review.html | 2 +- phpBB/styles/prosilver/template/ucp_pm_history.html | 2 +- phpBB/styles/subsilver2/template/posting_topic_review.html | 2 +- phpBB/styles/subsilver2/template/ucp_pm_history.html | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/phpBB/posting.php b/phpBB/posting.php index 5f27b61aae..2948d7a764 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1258,7 +1258,7 @@ if ($mode == 'quote' && !$submit && !$preview && !$refresh) $message = $quote_string . $message; $message = str_replace("\n", "\n" . $quote_string, $message); - $message_parser->message = $post_data['quote_username'] . " " . $user->lang['WROTE'] . " :\n" . $message . "\n"; + $message_parser->message = $post_data['quote_username'] . " " . $user->lang['WROTE'] . ":\n" . $message . "\n"; } } diff --git a/phpBB/styles/prosilver/template/editor.js b/phpBB/styles/prosilver/template/editor.js index 9c2691db8d..c4c3483766 100644 --- a/phpBB/styles/prosilver/template/editor.js +++ b/phpBB/styles/prosilver/template/editor.js @@ -194,7 +194,7 @@ function attach_inline(index, filename) /** * Add quote text to message */ -function addquote(post_id, username) +function addquote(post_id, username, l_wrote) { var message_name = 'message_' + post_id; var theSelection = ''; @@ -256,6 +256,7 @@ function addquote(post_id, username) } else { + insert_text(username + ' ' + l_wrote + ':' + '\n'); var lines = split_lines(theSelection); for (i = 0; i < lines.length; i++) { diff --git a/phpBB/styles/prosilver/template/posting_topic_review.html b/phpBB/styles/prosilver/template/posting_topic_review.html index 0d68a02758..879e6bb7fc 100644 --- a/phpBB/styles/prosilver/template/posting_topic_review.html +++ b/phpBB/styles/prosilver/template/posting_topic_review.html @@ -24,7 +24,7 @@
            diff --git a/phpBB/styles/prosilver/template/ucp_pm_history.html b/phpBB/styles/prosilver/template/ucp_pm_history.html index 88efcf95be..410228536d 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_history.html +++ b/phpBB/styles/prosilver/template/ucp_pm_history.html @@ -12,7 +12,7 @@
            diff --git a/phpBB/styles/subsilver2/template/posting_topic_review.html b/phpBB/styles/subsilver2/template/posting_topic_review.html index d1af72b522..c252f7d8e9 100644 --- a/phpBB/styles/subsilver2/template/posting_topic_review.html +++ b/phpBB/styles/subsilver2/template/posting_topic_review.html @@ -31,7 +31,7 @@   {L_POST_SUBJECT}:  {topic_review_row.POST_SUBJECT} -  {QUOTE_IMG} +  {QUOTE_IMG} diff --git a/phpBB/styles/subsilver2/template/ucp_pm_history.html b/phpBB/styles/subsilver2/template/ucp_pm_history.html index cb87d1892a..3f326257fc 100644 --- a/phpBB/styles/subsilver2/template/ucp_pm_history.html +++ b/phpBB/styles/subsilver2/template/ucp_pm_history.html @@ -54,7 +54,7 @@ {L_VIEW_PM} - + From d147bdcd73cea2dd43e54526e589f7aee6f34d4c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 11 Apr 2010 01:37:42 +0200 Subject: [PATCH 164/393] [ticket/9530] Subsilver2 is missing BBCode-less quotes fallback-option when bbcodes are disabled. PHPBB3-9530 --- phpBB/styles/subsilver2/template/editor.js | 52 ++++++++++++++++++- .../template/posting_topic_review.html | 5 ++ .../subsilver2/template/ucp_pm_history.html | 5 ++ 3 files changed, 61 insertions(+), 1 deletion(-) diff --git a/phpBB/styles/subsilver2/template/editor.js b/phpBB/styles/subsilver2/template/editor.js index 2d157caada..37c6360cb5 100644 --- a/phpBB/styles/subsilver2/template/editor.js +++ b/phpBB/styles/subsilver2/template/editor.js @@ -6,6 +6,7 @@ // Startup variables var imageTag = false; var theSelection = false; +var bbcodeEnabled = true; // Check for Browser & Platform for PC & IE specific bits // More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html @@ -250,12 +251,61 @@ function addquote(post_id, username) if (theSelection) { - insert_text('[quote="' + username + '"]' + theSelection + '[/quote]'); + if (bbcodeEnabled) + { + insert_text('[quote="' + username + '"]' + theSelection + '[/quote]'); + } + else + { + var lines = split_lines(theSelection); + for (i = 0; i < lines.length; i++) + { + insert_text('> ' + lines[i] + '\n'); + } + } } return; } + +function split_lines(text) +{ + var lines = text.split('\n'); + var splitLines = new Array(); + var j = 0; + for(i = 0; i < lines.length; i++) + { + if (lines[i].length <= 80) + { + splitLines[j] = lines[i]; + j++; + } + else + { + var line = lines[i]; + do + { + var splitAt = line.indexOf(' ', 80); + + if (splitAt == -1) + { + splitLines[j] = line; + j++; + } + else + { + splitLines[j] = line.substring(0, splitAt); + line = line.substring(splitAt); + j++; + } + } + while(splitAt != -1); + } + } + return splitLines; +} + /** * From http://www.massless.org/mozedit/ */ diff --git a/phpBB/styles/subsilver2/template/posting_topic_review.html b/phpBB/styles/subsilver2/template/posting_topic_review.html index d1af72b522..b241362a22 100644 --- a/phpBB/styles/subsilver2/template/posting_topic_review.html +++ b/phpBB/styles/subsilver2/template/posting_topic_review.html @@ -1,3 +1,8 @@ + diff --git a/phpBB/styles/subsilver2/template/ucp_pm_history.html b/phpBB/styles/subsilver2/template/ucp_pm_history.html index cb87d1892a..7027d4533d 100644 --- a/phpBB/styles/subsilver2/template/ucp_pm_history.html +++ b/phpBB/styles/subsilver2/template/ucp_pm_history.html @@ -1,3 +1,8 @@ +
            From a11fa9c7383dfd34015391092f785f4f47fa8a5d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 11 Apr 2010 01:39:10 +0200 Subject: [PATCH 165/393] [ticket/9530] The prosilver problem in #9531 exists in subsilver2 editor.js PHPBB3-9530 --- phpBB/styles/subsilver2/template/editor.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/styles/subsilver2/template/editor.js b/phpBB/styles/subsilver2/template/editor.js index 37c6360cb5..54bd3450d0 100644 --- a/phpBB/styles/subsilver2/template/editor.js +++ b/phpBB/styles/subsilver2/template/editor.js @@ -196,7 +196,7 @@ function attach_inline(index, filename) /** * Add quote text to message */ -function addquote(post_id, username) +function addquote(post_id, username, l_wrote) { var message_name = 'message_' + post_id; var theSelection = ''; @@ -257,6 +257,7 @@ function addquote(post_id, username) } else { + insert_text(username + ' ' + l_wrote + ':' + '\n'); var lines = split_lines(theSelection); for (i = 0; i < lines.length; i++) { From 82ce29ac5855f13e803556b14960af3b759dc14b Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Thu, 22 Apr 2010 07:25:28 -0400 Subject: [PATCH 166/393] [ticket/7782] Send 404 HTTP code when a nonexistent user/forum/topic is requested. PHPBB3-7782 --- phpBB/includes/functions.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 4f52c7c2ce..3886640b41 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3628,6 +3628,11 @@ function msg_handler($errno, $msg_text, $errfile, $errline) $user->setup(); } + if ($msg_text == 'NO_FORUM' || $msg_text == 'NO_TOPIC' || $msg_text == 'NO_USER') + { + header("HTTP/1.x 404 Not Found"); + } + $msg_text = (!empty($user->lang[$msg_text])) ? $user->lang[$msg_text] : $msg_text; $msg_title = (!isset($msg_title)) ? $user->lang['INFORMATION'] : ((!empty($user->lang[$msg_title])) ? $user->lang[$msg_title] : $msg_title); From cc8d22bed6bdba0a8f5797eef3627a62c240a48f Mon Sep 17 00:00:00 2001 From: Mark Date: Wed, 31 Mar 2010 14:44:39 +0200 Subject: [PATCH 167/393] [feature/notify_status] Define'd constants for notify_status define'd constants NOTIFY_YES, NOTIFY_NO to replace magic numbers in forums_watch table and topics_watch table PHPBB3-9179 --- phpBB/includes/constants.php | 5 +++++ phpBB/includes/functions_display.php | 6 +++--- phpBB/includes/functions_posting.php | 16 ++++++++-------- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index 8d31eaba7f..a3da196cf8 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -117,6 +117,11 @@ define('NOTIFY_EMAIL', 0); define('NOTIFY_IM', 1); define('NOTIFY_BOTH', 2); +// Notify status +define('NOTIFY_YES', 0); +define('NOTIFY_NO', 1); + + // Email Priority Settings define('MAIL_LOW_PRIORITY', 4); define('MAIL_NORMAL_PRIORITY', 3); diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index ea77551fc4..ec348138f5 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1112,10 +1112,10 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, { $is_watching = true; - if ($notify_status) + if ($notify_status != NOTIFY_YES) { $sql = 'UPDATE ' . $table_sql . " - SET notify_status = 0 + SET notify_status = " . NOTIFY_YES . " WHERE $where_sql = $match_id AND user_id = $user_id"; $db->sql_query($sql); @@ -1134,7 +1134,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $is_watching = true; $sql = 'INSERT INTO ' . $table_sql . " (user_id, $where_sql, notify_status) - VALUES ($user_id, $match_id, 0)"; + VALUES ($user_id, $match_id, " . NOTIFY_YES . ')'; $db->sql_query($sql); $message = $user->lang['ARE_WATCHING_' . strtoupper($mode)] . '

            ' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '', ''); } diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 4cb3941ce0..7242e7987b 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1201,8 +1201,8 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id FROM ' . (($topic_notification) ? TOPICS_WATCH_TABLE : FORUMS_WATCH_TABLE) . ' w, ' . USERS_TABLE . ' u WHERE w.' . (($topic_notification) ? 'topic_id' : 'forum_id') . ' = ' . (($topic_notification) ? $topic_id : $forum_id) . " AND w.user_id NOT IN ($sql_ignore_users) - AND w.notify_status = 0 - AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ') + AND w.notify_status = " . NOTIFY_YES . ' + AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ') AND u.user_id = w.user_id'; $result = $db->sql_query($sql); @@ -1234,8 +1234,8 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id FROM ' . FORUMS_WATCH_TABLE . ' fw, ' . USERS_TABLE . " u WHERE fw.forum_id = $forum_id AND fw.user_id NOT IN ($sql_ignore_users) - AND fw.notify_status = 0 - AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ') + AND fw.notify_status = " . NOTIFY_YES . ' + AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ') AND u.user_id = fw.user_id'; $result = $db->sql_query($sql); @@ -1344,8 +1344,8 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id if (!empty($update_notification['topic'])) { - $sql = 'UPDATE ' . TOPICS_WATCH_TABLE . " - SET notify_status = 1 + $sql = 'UPDATE ' . TOPICS_WATCH_TABLE . ' + SET notify_status = ' . NOTIFY_NO . " WHERE topic_id = $topic_id AND " . $db->sql_in_set('user_id', $update_notification['topic']); $db->sql_query($sql); @@ -1353,8 +1353,8 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id if (!empty($update_notification['forum'])) { - $sql = 'UPDATE ' . FORUMS_WATCH_TABLE . " - SET notify_status = 1 + $sql = 'UPDATE ' . FORUMS_WATCH_TABLE . ' + SET notify_status = ' . NOTIFY_NO . " WHERE forum_id = $forum_id AND " . $db->sql_in_set('user_id', $update_notification['forum']); $db->sql_query($sql); From 6d7e30ae995fe0791c2bced0974b0445fa769ee9 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 10 Apr 2010 18:49:01 +0200 Subject: [PATCH 168/393] [develop-olympus] Move rxu and nickvergessen to Developers --- phpBB/docs/AUTHORS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/AUTHORS b/phpBB/docs/AUTHORS index e886cd5a89..84677c4e15 100644 --- a/phpBB/docs/AUTHORS +++ b/phpBB/docs/AUTHORS @@ -29,14 +29,14 @@ phpBB Developers: A_Jelly_Doughnut (Josh Woody) DavidMJ (David M.) dhn (Dominik Dröscher) kellanved (Henry Sudhof) + nickvergessen (Joas Schilling) + rxu (Ruslan Uzdenov) Terrafrost (Jim Wigginton) ToonArmy (Chris Smith) Contributions by: Brainy (Cullen Walsh) leviatan21 (Gabriel Vazquez) - nickvergessen (Joas Schilling) Raimon (Raimon Meuldijk) - rxu (Ruslan Uzdenov) Xore (Robert Hetzler) From 327f9afbc0e015864c64b29b412e03142f40ca16 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 16 May 2010 23:05:13 +0200 Subject: [PATCH 169/393] [ticket/8792] Add LDAP_SEARCH_FAILED string for when ldap_search() fails. No longer use LDAP_NO_SERVER_CONNECTION in case ldap_search() fails. Add and use LDAP_SEARCH_FAILED instead, so users can tell the difference between ldap_connect() failing and ldap_search() failing. PHPBB3-8792 --- phpBB/includes/auth/auth_ldap.php | 2 +- phpBB/language/en/common.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/auth/auth_ldap.php b/phpBB/includes/auth/auth_ldap.php index a6092baba5..e8c957aaa3 100644 --- a/phpBB/includes/auth/auth_ldap.php +++ b/phpBB/includes/auth/auth_ldap.php @@ -74,7 +74,7 @@ function init_ldap() if ($search === false) { - return $user->lang['LDAP_NO_SERVER_CONNECTION']; + return $user->lang['LDAP_SEARCH_FAILED']; } $result = @ldap_get_entries($ldap, $search); diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index a3d47b5b59..325a20bf02 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -295,6 +295,7 @@ $lang = array_merge($lang, array( 'LAST_VISIT' => 'Last visit', 'LDAP_NO_LDAP_EXTENSION' => 'LDAP extension not available.', 'LDAP_NO_SERVER_CONNECTION' => 'Could not connect to LDAP server.', + 'LDAP_SEARCH_FAILED' => 'An error occured while searching the LDAP directory.', 'LEGEND' => 'Legend', 'LOCATION' => 'Location', 'LOCK_POST' => 'Lock post', From c1a4cb1d01dc19650219566b60671abc767af662 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sun, 16 May 2010 18:24:26 -0400 Subject: [PATCH 170/393] [ticket/7782] Send status line using refactored download/file.php logic. PHPBB3-7782 --- phpBB/download/file.php | 10 +--------- phpBB/includes/functions.php | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 00b8e2e656..2154847865 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -670,15 +670,7 @@ function set_modified_headers($stamp, $browser) { if ($last_load !== false && $last_load >= $stamp) { - if (substr(strtolower(@php_sapi_name()),0,3) === 'cgi') - { - // in theory, we shouldn't need that due to php doing it. Reality offers a differing opinion, though - header('Status: 304 Not Modified', true, 304); - } - else - { - header('HTTP/1.0 304 Not Modified', true, 304); - } + send_status_line(304, 'Not Modified'); // seems that we need those too ... browsers header('Pragma: public'); header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', time() + 31536000)); diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index cd8447a2a3..bc7c426e44 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2578,6 +2578,27 @@ function meta_refresh($time, $url, $disable_cd_check = false) return $url; } +function send_status_line($code, $message) +{ + if (substr(strtolower(@php_sapi_name()),0,3) === 'cgi') + { + // in theory, we shouldn't need that due to php doing it. Reality offers a differing opinion, though + header("Status: $code $message", true, $code); + } + else + { + if (isset($_SERVER['HTTP_VERSION'])) + { + $version = $_SERVER['HTTP_VERSION']; + } + else + { + $version = 'HTTP/1.0'; + } + header("$version $code $message", true, $code); + } +} + //Form validation @@ -3623,7 +3644,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) if ($msg_text == 'NO_FORUM' || $msg_text == 'NO_TOPIC' || $msg_text == 'NO_USER') { - header("HTTP/1.x 404 Not Found"); + send_status_line(404, 'Not Found'); } $msg_text = (!empty($user->lang[$msg_text])) ? $user->lang[$msg_text] : $msg_text; From 691f682fc2a69fed28bdca76f714d20be9277af6 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sun, 16 May 2010 19:52:01 -0400 Subject: [PATCH 171/393] [ticket/7782] Added phpdoc comment for send_status_line function. PHPBB3-7782 --- phpBB/includes/functions.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index bc7c426e44..178bb3ff3f 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2578,6 +2578,26 @@ function meta_refresh($time, $url, $disable_cd_check = false) return $url; } +/** +* Outputs correct status line header. +* +* Depending on php sapi one of the two following forms is used: +* +* Status: 404 Not Found +* +* HTTP/1.x 404 Not Found +* +* HTTP version is taken from HTTP_VERSION environment variable, +* and defaults to 1.0. +* +* Sample usage: +* +* send_status_line(404, 'Not Found'); +* +* @param int $code HTTP status code +* @param string $message Message for the status code +* @return void +*/ function send_status_line($code, $message) { if (substr(strtolower(@php_sapi_name()),0,3) === 'cgi') From d721e94b888b657c8e36729db2c455812308cdc3 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Mon, 17 May 2010 02:01:13 -0400 Subject: [PATCH 172/393] [ticket/7782] Added spaces. PHPBB3-7782 --- phpBB/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 178bb3ff3f..862ab3b367 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2600,7 +2600,7 @@ function meta_refresh($time, $url, $disable_cd_check = false) */ function send_status_line($code, $message) { - if (substr(strtolower(@php_sapi_name()),0,3) === 'cgi') + if (substr(strtolower(@php_sapi_name()), 0, 3) === 'cgi') { // in theory, we shouldn't need that due to php doing it. Reality offers a differing opinion, though header("Status: $code $message", true, $code); From af21e38c1d6f3fd738c97bd6cf0f96285c0b35aa Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 17 May 2010 08:54:51 +0200 Subject: [PATCH 173/393] [ticket/9611] Make length of activation keys variable between 6 and 10. PHPBB3-9611 --- phpBB/includes/acp/acp_users.php | 5 +---- phpBB/includes/ucp/ucp_profile.php | 5 +---- phpBB/includes/ucp/ucp_register.php | 6 +----- phpBB/includes/ucp/ucp_remind.php | 2 +- 4 files changed, 4 insertions(+), 14 deletions(-) diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 7914edd056..cc0f3d4cde 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -314,10 +314,7 @@ class acp_users $server_url = generate_board_url(); - $user_actkey = gen_rand_string(10); - $key_len = 54 - (strlen($server_url)); - $key_len = ($key_len > 6) ? $key_len : 6; - $user_actkey = substr($user_actkey, 0, $key_len); + $user_actkey = gen_rand_string(mt_rand(6, 10)); $email_template = ($user_row['user_type'] == USER_NORMAL) ? 'user_reactivate_account' : 'user_resend_inactive'; if ($user_row['user_type'] == USER_NORMAL) diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index f4f4abad4a..6b255e81a0 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -141,10 +141,7 @@ class ucp_profile $server_url = generate_board_url(); - $user_actkey = gen_rand_string(10); - $key_len = 54 - (strlen($server_url)); - $key_len = ($key_len > 6) ? $key_len : 6; - $user_actkey = substr($user_actkey, 0, $key_len); + $user_actkey = gen_rand_string(mt_rand(6, 10)); $messenger = new messenger(false); diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index 9656a4a3af..7fd99da55a 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -286,11 +286,7 @@ class ucp_register $config['require_activation'] == USER_ACTIVATION_SELF || $config['require_activation'] == USER_ACTIVATION_ADMIN) && $config['email_enable']) { - $user_actkey = gen_rand_string(10); - $key_len = 54 - (strlen($server_url)); - $key_len = ($key_len < 6) ? 6 : $key_len; - $user_actkey = substr($user_actkey, 0, $key_len); - + $user_actkey = gen_rand_string(mt_rand(6, 10)); $user_type = USER_INACTIVE; $user_inactive_reason = INACTIVE_REGISTER; $user_inactive_time = time(); diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php index f9b792de20..0042cd9df7 100644 --- a/phpBB/includes/ucp/ucp_remind.php +++ b/phpBB/includes/ucp/ucp_remind.php @@ -82,7 +82,7 @@ class ucp_remind $user_password = gen_rand_string(max(8, rand((int) $config['min_pass_chars'], (int) $config['max_pass_chars']))); // For the activation key a random length between 6 and 10 will do. - $user_actkey = gen_rand_string(rand(6, 10)); + $user_actkey = gen_rand_string(mt_rand(6, 10)); $sql = 'UPDATE ' . USERS_TABLE . " SET user_newpasswd = '" . $db->sql_escape(phpbb_hash($user_password)) . "', user_actkey = '" . $db->sql_escape($user_actkey) . "' From c2b29c317f2d3bf41ed737c9eb3d49bce41ec432 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 17 May 2010 09:40:32 +0200 Subject: [PATCH 174/393] [ticket/9612] Introduce new function gen_rand_string_friendly(). Introduce new function gen_rand_string_friendly() for user friendly random strings like passwords and captcha codes. Strings generated by gen_rand_string_friendly() will not contain the characters 0 and O. By adding a new function we can increase the entropy of strings generated by gen_rand_string() by putting 0 and O back in. PHPBB3-9612 --- .../captcha/plugins/captcha_abstract.php | 8 ++++---- phpBB/includes/functions.php | 17 +++++++++++++++++ phpBB/includes/ucp/ucp_remind.php | 2 +- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/captcha/plugins/captcha_abstract.php b/phpBB/includes/captcha/plugins/captcha_abstract.php index e7b8742b05..21cacd730c 100644 --- a/phpBB/includes/captcha/plugins/captcha_abstract.php +++ b/phpBB/includes/captcha/plugins/captcha_abstract.php @@ -59,7 +59,7 @@ class phpbb_default_captcha { global $user; - $this->code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); + $this->code = gen_rand_string_friendly(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); $this->seed = hexdec(substr(unique_id(), 4, 10)); // compute $seed % 0x7fffffff @@ -235,7 +235,7 @@ class phpbb_default_captcha { global $db, $user; - $this->code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); + $this->code = gen_rand_string_friendly(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); $this->confirm_id = md5(unique_id($user->ip)); $this->seed = hexdec(substr(unique_id(), 4, 10)); $this->solved = 0; @@ -259,7 +259,7 @@ class phpbb_default_captcha { global $db, $user; - $this->code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); + $this->code = gen_rand_string_friendly(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); $this->seed = hexdec(substr(unique_id(), 4, 10)); $this->solved = 0; // compute $seed % 0x7fffffff @@ -281,7 +281,7 @@ class phpbb_default_captcha { global $db, $user; - $this->code = gen_rand_string(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); + $this->code = gen_rand_string_friendly(mt_rand(CAPTCHA_MIN_CHARS, CAPTCHA_MAX_CHARS)); $this->seed = hexdec(substr(unique_id(), 4, 10)); $this->solved = 0; // compute $seed % 0x7fffffff diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index cd8447a2a3..2b5b8e6092 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -195,10 +195,27 @@ function set_config_count($config_name, $increment, $is_dynamic = false) /** * Generates an alphanumeric random string of given length +* +* @return string */ function gen_rand_string($num_chars = 8) +{ + // [a, z] + [0, 9] = 36 + return strtoupper(base_convert(unique_id(), 16, 36)); +} + +/** +* Generates a user-friendly alphanumeric random string of given length +* We remove 0 and O so users cannot confuse those in passwords etc. +* +* @return string +*/ +function gen_rand_string_friendly($num_chars = 8) { $rand_str = unique_id(); + + // Remove Z and Y from the base_convert(), replace 0 with Z and O with Y + // [a, z] + [0, 9] - {z, y} = [a, z] + [0, 9] - {0, o} = 34 $rand_str = str_replace(array('0', 'O'), array('Z', 'Y'), strtoupper(base_convert($rand_str, 16, 34))); return substr($rand_str, 0, $num_chars); diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php index 0042cd9df7..cb89ad99be 100644 --- a/phpBB/includes/ucp/ucp_remind.php +++ b/phpBB/includes/ucp/ucp_remind.php @@ -79,7 +79,7 @@ class ucp_remind // Make password at least 8 characters long, make it longer if admin wants to. // gen_rand_string() however has a limit of 12 or 13. - $user_password = gen_rand_string(max(8, rand((int) $config['min_pass_chars'], (int) $config['max_pass_chars']))); + $user_password = gen_rand_string_friendly(max(8, mt_rand((int) $config['min_pass_chars'], (int) $config['max_pass_chars']))); // For the activation key a random length between 6 and 10 will do. $user_actkey = gen_rand_string(mt_rand(6, 10)); From d819ee343a3a6dc6282f709e67454cd2f0d1afcf Mon Sep 17 00:00:00 2001 From: rxu Date: Mon, 17 May 2010 21:14:02 +0800 Subject: [PATCH 175/393] [ticket/9606] Optimize unread search option. Get rid of redundant SQL query in search.php that should increase performance slightly. PHPBB3-9606 --- phpBB/includes/functions.php | 7 ++++--- phpBB/search.php | 19 +++++++------------ 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index cd8447a2a3..f783694db1 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -1660,10 +1660,11 @@ function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_lis * @param string $sql_extra Extra WHERE SQL statement * @param string $sql_sort ORDER BY SQL sorting statement * @param string $sql_limit Limits the size of unread topics list, 0 for unlimited query +* @param string $sql_limit_offset Sets the offset of the first row to search, 0 to search from the start * * @return array[int][int] Topic ids as keys, mark_time of topic as value */ -function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $sql_limit = 1001) +function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $sql_limit = 1001, $sql_limit_offset = 0) { global $config, $db, $user; @@ -1709,7 +1710,7 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s ); $sql = $db->sql_build_query('SELECT', $sql_array); - $result = $db->sql_query_limit($sql, $sql_limit); + $result = $db->sql_query_limit($sql, $sql_limit, $sql_limit_offset); while ($row = $db->sql_fetchrow($result)) { @@ -1742,7 +1743,7 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s WHERE t.topic_last_post_time > ' . $user_lastmark . " $sql_extra $sql_sort"; - $result = $db->sql_query_limit($sql, $sql_limit); + $result = $db->sql_query_limit($sql, $sql_limit, $sql_limit_offset); while ($row = $db->sql_fetchrow($result)) { diff --git a/phpBB/search.php b/phpBB/search.php index 7a9ab82f93..1e1e42d01f 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -387,18 +387,6 @@ if ($keywords || $author || $author_id || $search_id || $submit) gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); $s_sort_key = $s_sort_dir = $u_sort_param = $s_limit_days = ''; - - $unread_list = array(); - $unread_list = get_unread_topics($user->data['user_id'], $sql_where, $sql_sort); - - if (!empty($unread_list)) - { - $sql = 'SELECT t.topic_id - FROM ' . TOPICS_TABLE . ' t - WHERE ' . $db->sql_in_set('t.topic_id', array_keys($unread_list)) . " - $sql_sort"; - $field = 'topic_id'; - } break; case 'newposts': @@ -476,6 +464,13 @@ if ($keywords || $author || $author_id || $search_id || $submit) $total_match_count = sizeof($id_ary) + $start; $id_ary = array_slice($id_ary, 0, $per_page); } + else if ($search_id == 'unreadposts') + { + $id_ary = array_keys(get_unread_topics($user->data['user_id'], $sql_where, $sql_sort, 1001 - $start, $start)); + + $total_match_count = sizeof($id_ary) + $start; + $id_ary = array_slice($id_ary, 0, $per_page); + } else { $search_id = ''; From c185e45e09032e3ac32149a91f0133deb425acaa Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Mon, 17 May 2010 14:14:53 -0400 Subject: [PATCH 176/393] [ticket/7782] Return 404 HTTP status code for nonexistent attachments. PHPBB3-7782 --- phpBB/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 862ab3b367..3e80f93114 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3662,7 +3662,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) $user->setup(); } - if ($msg_text == 'NO_FORUM' || $msg_text == 'NO_TOPIC' || $msg_text == 'NO_USER') + if ($msg_text == 'ERROR_NO_ATTACHMENT' || $msg_text == 'NO_FORUM' || $msg_text == 'NO_TOPIC' || $msg_text == 'NO_USER') { send_status_line(404, 'Not Found'); } From 877d852a5290ffddf24fb33a3e8264dd5ccd234c Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 24 May 2010 20:12:34 +0200 Subject: [PATCH 177/393] [ticket/9605] Wrong class added to topiclist, when there's no announcement topic. Just added a check whether the type is announcement or higher. PHPBB3-9605 --- phpBB/styles/prosilver/template/viewforum_body.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index cc38ed9d2b..1c9ec7bc4a 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -122,7 +122,7 @@ -
            +
            • From b6df5bdb14615dfdd3b41651934575882a1455c5 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 24 May 2010 23:32:18 +0200 Subject: [PATCH 178/393] [ticket/8936] Subsilver2 missing reply-to-all feature. PHPBB3-8936 --- phpBB/styles/subsilver2/template/ucp_pm_message_footer.html | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/styles/subsilver2/template/ucp_pm_message_footer.html b/phpBB/styles/subsilver2/template/ucp_pm_message_footer.html index 314d03caf3..d1ef5ebd10 100644 --- a/phpBB/styles/subsilver2/template/ucp_pm_message_footer.html +++ b/phpBB/styles/subsilver2/template/ucp_pm_message_footer.html @@ -14,6 +14,7 @@ {L_PRINT_PM} | {L_FORWARD_PM} + | {L_REPLY_TO_ALL} From c7a25c58b893fc72ffb3746374ece9de1d388531 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 24 May 2010 23:59:28 +0200 Subject: [PATCH 179/393] [ticket/9587] Prosilver overrides reCaptcha class. PHPBB3-9587 --- phpBB/styles/prosilver/theme/forms.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phpBB/styles/prosilver/theme/forms.css b/phpBB/styles/prosilver/theme/forms.css index 4db342661c..4516c7fcd2 100644 --- a/phpBB/styles/prosilver/theme/forms.css +++ b/phpBB/styles/prosilver/theme/forms.css @@ -96,6 +96,11 @@ fieldset.fields1 div { margin-bottom: 3px; } +/* Set it back to 0px for the reCaptcha divs: PHPBB3-9587 */ +fieldset.fields1 #recaptcha_widget_div div { + margin-bottom: 0px; +} + /* Specific layout 2 */ fieldset.fields2 dt { width: 15em; From 222173adae59af660c18ce89c606b3ee212d9a4a Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 9 Apr 2010 00:39:12 +0200 Subject: [PATCH 180/393] [ticket/9626] Adding tests for regular expressions. Adding tests for the IPv6 regular expression returned by get_preg_expression() PHPBB3-9626 --- tests/all_tests.php | 2 + tests/regex/all_tests.php | 40 ++++++++++++++++++ tests/regex/ipv6.php | 85 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 127 insertions(+) create mode 100644 tests/regex/all_tests.php create mode 100644 tests/regex/ipv6.php diff --git a/tests/all_tests.php b/tests/all_tests.php index e693427809..7894d688ee 100644 --- a/tests/all_tests.php +++ b/tests/all_tests.php @@ -23,6 +23,7 @@ require_once 'security/all_tests.php'; require_once 'template/all_tests.php'; require_once 'text_processing/all_tests.php'; require_once 'dbal/all_tests.php'; +require_once 'regex/all_tests.php'; // exclude the test directory from code coverage reports PHPUnit_Util_Filter::addDirectoryToFilter('./'); @@ -44,6 +45,7 @@ class phpbb_all_tests $suite->addTest(phpbb_template_all_tests::suite()); $suite->addTest(phpbb_text_processing_all_tests::suite()); $suite->addTest(phpbb_dbal_all_tests::suite()); + $suite->addTest(phpbb_regex_all_tests::suite()); return $suite; } diff --git a/tests/regex/all_tests.php b/tests/regex/all_tests.php new file mode 100644 index 0000000000..aeb242b78b --- /dev/null +++ b/tests/regex/all_tests.php @@ -0,0 +1,40 @@ +addTestSuite('phpbb_ipv6_test'); + + return $suite; + } +} + +if (PHPUnit_MAIN_METHOD == 'phpbb_regex_all_tests::main') +{ + phpbb_regex_all_tests::main(); +} diff --git a/tests/regex/ipv6.php b/tests/regex/ipv6.php new file mode 100644 index 0000000000..7b0a48833f --- /dev/null +++ b/tests/regex/ipv6.php @@ -0,0 +1,85 @@ +regex = get_preg_expression('ipv6'); + } + + public function positive_match_data() + { + return array( + // Full length IPv6 address + array('2001:0db8:85a3:0000:0000:8a2e:0370:1337'), + + // No leading zeroes in the group + array('2001:db8:85a3:0:0:8a2e:370:1337'), + array('2001:db8:85a3:c:d:8a2e:370:1337'), + + // Consecutive all-zero groups + array('2001:db8:85a3::8a2e:370:1337'), + + // Last 32bit in dotted quad notation + array('2001:db8:0:1::192.168.0.2'), + + // Mapped IPv4 + array('::ffff:c000:280'), + array('::ffff:192.0.2.128'), + + // More tests + array('::'), + array('0:0:0:0:0:0:0:0'), + + array('::1'), + array('0:0::0:0:1'), + array('0:0:0:0:0:0:0:1'), + ); + } + + public function negative_match_data() + { + return array( + // IPv4 address + array('192.168.0.2'), + + // Out of hex scope + array('abcd:efgh:0000::0'), + + // Double :: + array('2001::23de::2002'), + + // Too many blocks + array('2001:0db8:85a3:08d3:1319:8a2e:0370:1337:4430'), + ); + } + + /** + * @dataProvider positive_match_data + */ + public function test_positive_match($address) + { + $this->assertEquals(1, preg_match($this->regex, $address)); + } + + /** + * @dataProvider negative_match_data + */ + public function test_negative_match($address) + { + $this->assertEquals(0, preg_match($this->regex, $address)); + } +} + From 1c59f3dbd0e27be2057dc32344421e82122276ca Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 9 Apr 2010 00:54:19 +0200 Subject: [PATCH 181/393] [ticket/9626] Adding tests for the IPv4 regular expression. PHPBB3-9626 --- tests/regex/all_tests.php | 2 ++ tests/regex/ipv4.php | 72 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 tests/regex/ipv4.php diff --git a/tests/regex/all_tests.php b/tests/regex/all_tests.php index aeb242b78b..32cd9a3a4e 100644 --- a/tests/regex/all_tests.php +++ b/tests/regex/all_tests.php @@ -15,6 +15,7 @@ if (!defined('PHPUnit_MAIN_METHOD')) require_once 'test_framework/framework.php'; require_once 'PHPUnit/TextUI/TestRunner.php'; +require_once 'regex/ipv4.php'; require_once 'regex/ipv6.php'; class phpbb_regex_all_tests @@ -28,6 +29,7 @@ class phpbb_regex_all_tests { $suite = new PHPUnit_Framework_TestSuite('phpBB Regular Expressions'); + $suite->addTestSuite('phpbb_ipv4_test'); $suite->addTestSuite('phpbb_ipv6_test'); return $suite; diff --git a/tests/regex/ipv4.php b/tests/regex/ipv4.php new file mode 100644 index 0000000000..5ffc700831 --- /dev/null +++ b/tests/regex/ipv4.php @@ -0,0 +1,72 @@ +regex = get_preg_expression('ipv4'); + } + + public function positive_match_data() + { + return array( + array('0.0.0.0'), + array('127.0.0.1'), + array('192.168.0.1'), + array('255.255.255.255'), + ); + } + + public function negative_match_data() + { + return array( + // IPv6 addresses + array('2001:0db8:85a3:0000:0000:8a2e:0370:1337'), + array('2001:db8:85a3:c:d:8a2e:370:1337'), + array('2001:db8:85a3::8a2e:370:1337'), + array('2001:db8:0:1::192.168.0.2'), + array('0:0:0:0:0:0:0:1'), + array('0:0::0:0:1'), + array('::1'), + + // Out of scope + array('255.255.255.256'), + + // Other tests + array('a.b.c.d'), + array('11.22.33.'), + array('11.22.33'), + array('11.22'), + array('11'), + ); + } + + /** + * @dataProvider positive_match_data + */ + public function test_positive_match($address) + { + $this->assertEquals(1, preg_match($this->regex, $address)); + } + + /** + * @dataProvider negative_match_data + */ + public function test_negative_match($address) + { + $this->assertEquals(0, preg_match($this->regex, $address)); + } +} + From 12e92fc45e7c023122d0c52d94fc49710ca6d4dd Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 9 Apr 2010 14:51:16 +0200 Subject: [PATCH 182/393] [ticket/9626] More IPv6 regex tests. PHPBB3-9626 --- tests/regex/ipv6.php | 70 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 64 insertions(+), 6 deletions(-) diff --git a/tests/regex/ipv6.php b/tests/regex/ipv6.php index 7b0a48833f..3f62f65f49 100644 --- a/tests/regex/ipv6.php +++ b/tests/regex/ipv6.php @@ -24,6 +24,10 @@ class phpbb_ipv6_test extends phpbb_test_case return array( // Full length IPv6 address array('2001:0db8:85a3:0000:0000:8a2e:0370:1337'), + array('0000:0000:0000:0000:0000:0000:0000:0001'), + array('3FFE:0b00:0000:0000:0001:0000:0000:000a'), + array('3ffe:0b00:0000:0000:0001:0000:0000:000a'), + array('2002:0db8:0000:0000:0000:dead:1337:d00d'), // No leading zeroes in the group array('2001:db8:85a3:0:0:8a2e:370:1337'), @@ -31,38 +35,92 @@ class phpbb_ipv6_test extends phpbb_test_case // Consecutive all-zero groups array('2001:db8:85a3::8a2e:370:1337'), + array('1::2:3:4:5:6:7'), + array('1::2:3:4:5:6'), + array('1::2:3:4:5'), + array('1::2:3:4'), + array('1::2:3'), + array('1::2'), // Last 32bit in dotted quad notation array('2001:db8:0:1::192.168.0.2'), - // Mapped IPv4 - array('::ffff:c000:280'), - array('::ffff:192.0.2.128'), + // IPv4-compatible IPv6 address + array('::13.1.68.3'), + array('0:0:0:0:0:0:13.1.68.3'), - // More tests + // IPv4-mapped IPv6 address + array('::ffff:c000:280'), + array('::ffff:c000:0280'), + array('::ffff:192.0.2.128'), + array('0:0:0:0:0:ffff:c000:280'), + array('0:0:0:0:0:ffff:c000:0280'), + array('0:0:0:0:0:ffff:192.0.2.128'), + array('0000:0000:0000:0000:0000:ffff:c000:280'), + array('0000:0000:0000:0000:0000:ffff:c000:0280'), + array('0000:0000:0000:0000:0000:ffff:192.0.2.128'), + + // No trailing zeroes + array('fe80::'), + array('2002::'), + array('2001:db8::'), + array('2001:0db8:1234::'), + array('1:2:3:4:5:6::'), + array('1:2:3:4:5::'), + array('1:2:3:4::'), + array('1:2:3::'), + array('1:2::'), + + // No leading zeroes + array('::2:3:4:5:6:7:8'), + array('::2:3:4:5:6:7'), + array('::2:3:4:5:6'), + array('::2:3:4:5'), + array('::2:3:4'), + array('::2:3'), + array('::1'), + array('::8'), + array('::c'), + array('::abcd'), + + // All zeroes array('::'), array('0:0:0:0:0:0:0:0'), + array('0000:0000:0000:0000:0000:0000:0000:0000'), - array('::1'), + // More tests + array('2::10'), array('0:0::0:0:1'), array('0:0:0:0:0:0:0:1'), + array('::ffff:0:0'), ); } public function negative_match_data() { return array( + // Empty address + array(''), + // IPv4 address array('192.168.0.2'), - // Out of hex scope + // Out of scope array('abcd:efgh:0000::0'), + array('::ffff:192.168.255.256'), // Double :: array('2001::23de::2002'), + array('3ffe:b00::1::b'), + array('::1111:2222:3333:4444:5555:6666::'), // Too many blocks array('2001:0db8:85a3:08d3:1319:8a2e:0370:1337:4430'), + + // More tests + array('02001:0000:1234:0000:0000:C1C0:ABCD:9876'), + array('2001:0000:1234: 0000:0000:C1C0:ABCD:9876'), + array('::ffff:192x168.255.255'), ); } From 6a5ad05d8a15c0d4f6be2413190c5a2fdc270f5d Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 14 Apr 2010 02:27:07 +0200 Subject: [PATCH 183/393] [ticket/9626] A few tests for the email regular expression. PHPBB3-9626 --- tests/regex/all_tests.php | 2 + tests/regex/email.php | 78 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 tests/regex/email.php diff --git a/tests/regex/all_tests.php b/tests/regex/all_tests.php index 32cd9a3a4e..0e193620e1 100644 --- a/tests/regex/all_tests.php +++ b/tests/regex/all_tests.php @@ -15,6 +15,7 @@ if (!defined('PHPUnit_MAIN_METHOD')) require_once 'test_framework/framework.php'; require_once 'PHPUnit/TextUI/TestRunner.php'; +require_once 'regex/email.php'; require_once 'regex/ipv4.php'; require_once 'regex/ipv6.php'; @@ -29,6 +30,7 @@ class phpbb_regex_all_tests { $suite = new PHPUnit_Framework_TestSuite('phpBB Regular Expressions'); + $suite->addTestSuite('phpbb_email_test'); $suite->addTestSuite('phpbb_ipv4_test'); $suite->addTestSuite('phpbb_ipv6_test'); diff --git a/tests/regex/email.php b/tests/regex/email.php new file mode 100644 index 0000000000..37fb9d81d0 --- /dev/null +++ b/tests/regex/email.php @@ -0,0 +1,78 @@ +regex = '#^' . get_preg_expression('email') . '$#i'; + } + + public function positive_match_data() + { + return array( + array('nobody@phpbb.com'), + array('Nobody@sub.phpbb.com'), + array('alice.bob@foo.phpbb.com'), + array('alice-foo@bar.phpbb.com'), + array('alice_foo@bar.phpbb.com'), + array('alice+tag@foo.phpbb.com'), + array('alice&tag@foo.phpbb.com'), + + //array('"John Doe"@example.com'), + //array('Alice@[192.168.2.1]'), // IPv4 + //array('Bob@[2001:0db8:85a3:08d3:1319:8a2e:0370:7344]'), // IPv6 + ); + } + + public function negative_match_data() + { + return array( + array('foo.example.com'), // @ is missing + array('.foo.example.com'), // . as first character + array('Foo.@example.com'), // . is last in local part + array('foo..123@example.com'), // . doubled + array('a@b@c@example.com'), // @ doubled + + array('()[]\;:,<>@example.com'), // invalid characters + array('abc(def@example.com'), // invalid character ( + array('abc)def@example.com'), // invalid character ) + array('abc[def@example.com'), // invalid character [ + array('abc]def@example.com'), // invalid character ] + array('abc\def@example.com'), // invalid character \ + array('abc;def@example.com'), // invalid character ; + array('abc:def@example.com'), // invalid character : + array('abc,def@example.com'), // invalid character , + array('abcdef@example.com'), // invalid character > + ); + } + + /** + * @dataProvider positive_match_data + */ + public function test_positive_match($email) + { + $this->assertEquals(1, preg_match($this->regex, $email)); + } + + /** + * @dataProvider negative_match_data + */ + public function test_negative_match($address) + { + $this->assertEquals(0, preg_match($this->regex, $email)); + } +} + From 646b16f5db0ce68c69b520670b366dd61bfa03c1 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 17 May 2010 10:28:44 +0200 Subject: [PATCH 184/393] [ticket/9626] Add missing class prefix. PHPBB3-9626 --- tests/regex/all_tests.php | 6 +++--- tests/regex/email.php | 2 +- tests/regex/ipv4.php | 2 +- tests/regex/ipv6.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/regex/all_tests.php b/tests/regex/all_tests.php index 0e193620e1..f2a23a0f98 100644 --- a/tests/regex/all_tests.php +++ b/tests/regex/all_tests.php @@ -30,9 +30,9 @@ class phpbb_regex_all_tests { $suite = new PHPUnit_Framework_TestSuite('phpBB Regular Expressions'); - $suite->addTestSuite('phpbb_email_test'); - $suite->addTestSuite('phpbb_ipv4_test'); - $suite->addTestSuite('phpbb_ipv6_test'); + $suite->addTestSuite('phpbb_regex_email_test'); + $suite->addTestSuite('phpbb_regex_ipv4_test'); + $suite->addTestSuite('phpbb_regex_ipv6_test'); return $suite; } diff --git a/tests/regex/email.php b/tests/regex/email.php index 37fb9d81d0..b1519dfa5f 100644 --- a/tests/regex/email.php +++ b/tests/regex/email.php @@ -10,7 +10,7 @@ require_once 'test_framework/framework.php'; require_once '../phpBB/includes/functions.php'; -class phpbb_email_test extends phpbb_test_case +class phpbb_regex_email_test extends phpbb_test_case { protected $regex; diff --git a/tests/regex/ipv4.php b/tests/regex/ipv4.php index 5ffc700831..9d131ad0ca 100644 --- a/tests/regex/ipv4.php +++ b/tests/regex/ipv4.php @@ -10,7 +10,7 @@ require_once 'test_framework/framework.php'; require_once '../phpBB/includes/functions.php'; -class phpbb_ipv4_test extends phpbb_test_case +class phpbb_regex_ipv4_test extends phpbb_test_case { protected $regex; diff --git a/tests/regex/ipv6.php b/tests/regex/ipv6.php index 3f62f65f49..3d7a72e492 100644 --- a/tests/regex/ipv6.php +++ b/tests/regex/ipv6.php @@ -10,7 +10,7 @@ require_once 'test_framework/framework.php'; require_once '../phpBB/includes/functions.php'; -class phpbb_ipv6_test extends phpbb_test_case +class phpbb_regex_ipv6_test extends phpbb_test_case { protected $regex; From aaaa4f9abe8665946b79cc55bf3a4d7e0133b6c9 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 19 May 2010 16:56:45 +0200 Subject: [PATCH 185/393] [ticket/9626] Adding tests for the URL regular expression. PHPBB3-9626 --- tests/regex/all_tests.php | 2 ++ tests/regex/url.php | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 tests/regex/url.php diff --git a/tests/regex/all_tests.php b/tests/regex/all_tests.php index f2a23a0f98..316a9d4a58 100644 --- a/tests/regex/all_tests.php +++ b/tests/regex/all_tests.php @@ -18,6 +18,7 @@ require_once 'PHPUnit/TextUI/TestRunner.php'; require_once 'regex/email.php'; require_once 'regex/ipv4.php'; require_once 'regex/ipv6.php'; +require_once 'regex/url.php'; class phpbb_regex_all_tests { @@ -33,6 +34,7 @@ class phpbb_regex_all_tests $suite->addTestSuite('phpbb_regex_email_test'); $suite->addTestSuite('phpbb_regex_ipv4_test'); $suite->addTestSuite('phpbb_regex_ipv6_test'); + $suite->addTestSuite('phpbb_regex_url_test'); return $suite; } diff --git a/tests/regex/url.php b/tests/regex/url.php new file mode 100644 index 0000000000..678b7d108f --- /dev/null +++ b/tests/regex/url.php @@ -0,0 +1,34 @@ +assertEquals($expected, preg_match('#^' . get_preg_expression('url') . '$#i', $url)); + } +} From 9e2499385590248c2ba9c932463e5cf7d5c74109 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 26 May 2010 01:38:19 +0200 Subject: [PATCH 186/393] [ticket/9135] Fix report-icon for moderators in PM folders. There was a S_TOPIC_REPORTED switch in the template of prosilver, which should indicate whether the PM is reported. But the variable was neither filled, nor named correctly. Now it is filled with a boolean and a link to the report is displayed for permitted users. PHPBB3-9135 --- phpBB/includes/ucp/ucp_pm_viewfolder.php | 26 ++++++++++++++++++- phpBB/language/en/common.php | 1 + .../prosilver/template/ucp_pm_viewfolder.html | 2 +- .../template/ucp_pm_viewfolder.html | 3 +++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/ucp/ucp_pm_viewfolder.php b/phpBB/includes/ucp/ucp_pm_viewfolder.php index 665dd2c83f..6b7172ca2b 100644 --- a/phpBB/includes/ucp/ucp_pm_viewfolder.php +++ b/phpBB/includes/ucp/ucp_pm_viewfolder.php @@ -170,10 +170,12 @@ function view_folder($id, $mode, $folder_id, $folder) 'ATTACH_ICON_IMG' => ($auth->acl_get('u_pm_download') && $row['message_attachment'] && $config['allow_pm_attach']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', 'S_PM_DELETED' => ($row['pm_deleted']) ? true : false, + 'S_PM_REPORTED' => (isset($row['report_id'])) ? true : false, 'S_AUTHOR_DELETED' => ($row['author_id'] == ANONYMOUS) ? true : false, 'U_VIEW_PM' => ($row['pm_deleted']) ? '' : $view_message_url, 'U_REMOVE_PM' => ($row['pm_deleted']) ? $remove_message_url : '', + 'U_MCP_REPORT' => (isset($row['report_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=pm_reports&mode=pm_report_details&r=' . $row['report_id']) : '', 'RECIPIENTS' => ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) ? implode(', ', $address_list[$message_id]) : '') ); } @@ -183,6 +185,7 @@ function view_folder($id, $mode, $folder_id, $folder) 'S_SHOW_RECIPIENTS' => ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) ? true : false, 'S_SHOW_COLOUR_LEGEND' => true, + 'REPORTED_IMG' => $user->img('icon_topic_reported', 'PM_REPORTED'), 'S_PM_ICONS' => ($config['enable_pm_icons']) ? true : false) ); } @@ -502,7 +505,7 @@ function get_pm_from($folder_id, $folder, $user_id) $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction; } - $sql = 'SELECT t.*, p.root_level, p.message_time, p.message_subject, p.icon_id, p.to_address, p.message_attachment, p.bcc_address, u.username, u.username_clean, u.user_colour + $sql = 'SELECT t.*, p.root_level, p.message_time, p.message_subject, p.icon_id, p.to_address, p.message_attachment, p.bcc_address, u.username, u.username_clean, u.user_colour, p.message_reported FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . " u WHERE t.user_id = $user_id AND p.author_id = u.user_id @@ -512,13 +515,34 @@ function get_pm_from($folder_id, $folder, $user_id) ORDER BY $sql_sort_order"; $result = $db->sql_query_limit($sql, $sql_limit, $sql_start); + $pm_reported = array(); while ($row = $db->sql_fetchrow($result)) { $rowset[$row['msg_id']] = $row; $pm_list[] = $row['msg_id']; + if ($row['message_reported']) + { + $pm_reported[] = $row['msg_id']; + } } $db->sql_freeresult($result); + // Fetch the report_ids, if there are any reported pms. + if (!empty($pm_reported) && $auth->acl_getf_global('m_report')) + { + $sql = 'SELECT pm_id, report_id + FROM ' . REPORTS_TABLE . ' + WHERE report_closed = 0 + AND ' . $db->sql_in_set('pm_id', $pm_reported); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $rowset[$row['pm_id']]['report_id'] = $row['report_id']; + } + $db->sql_freeresult($result); + } + $pm_list = ($store_reverse) ? array_reverse($pm_list) : $pm_list; return array( diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index a3d47b5b59..a4e58f038e 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -420,6 +420,7 @@ $lang = array_merge($lang, array( 'PIXEL' => 'px', 'PLAY_QUICKTIME_FILE' => 'Play Quicktime file', 'PM' => 'PM', + 'PM_REPORTED' => 'Click to view report', 'POSTING_MESSAGE' => 'Posting message in %s', 'POSTING_PRIVATE_MESSAGE' => 'Composing private message', 'POST' => 'Post', diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html b/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html index 7b309a74f7..d7e02e405e 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html @@ -71,7 +71,7 @@
              {L_PM_FROM_REMOVED_AUTHOR} - {REPORTED_IMG} {messagerow.ATTACH_ICON_IMG}
              + {REPORTED_IMG} {messagerow.ATTACH_ICON_IMG}
              {L_MESSAGE_TO} {messagerow.RECIPIENTS}{L_MESSAGE_BY_AUTHOR} {messagerow.MESSAGE_AUTHOR_FULL} » {messagerow.SENT_TIME}
              {L_SENT_AT}: {messagerow.SENT_TIME}
              diff --git a/phpBB/styles/subsilver2/template/ucp_pm_viewfolder.html b/phpBB/styles/subsilver2/template/ucp_pm_viewfolder.html index 1663502865..f0b076edb2 100644 --- a/phpBB/styles/subsilver2/template/ucp_pm_viewfolder.html +++ b/phpBB/styles/subsilver2/template/ucp_pm_viewfolder.html @@ -81,6 +81,9 @@ {messagerow.SUBJECT} + + {REPORTED_IMG}  +
              {L_PM_FROM_REMOVED_AUTHOR} From 4746a60d221d2e32c98eff1f44d996bf7296e737 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 27 May 2010 15:17:03 +0200 Subject: [PATCH 187/393] [ticket/9094] Hide "Copy permissions" message, when permissions were copied. When creating a forum, you afterwards read "Forum created successfully. Now you are able to set permissions for this forum.", also when you already copied the permissions from another forum. PHPBB3-9094 --- phpBB/includes/acp/acp_forums.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 541a514bef..6261f866bb 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -190,12 +190,14 @@ class acp_forums $forum_perm_from = request_var('forum_perm_from', 0); $cache->destroy('sql', FORUMS_TABLE); + $copied_permissions = false; // Copy permissions? if ($forum_perm_from && $forum_perm_from != $forum_data['forum_id'] && ($action != 'edit' || empty($forum_id) || ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth')))) { copy_forum_permissions($forum_perm_from, $forum_data['forum_id'], ($action == 'edit') ? true : false); cache_moderators(); + $copied_permissions = true; } /* Commented out because of questionable UI workflow - re-visit for 3.0.7 else if (!$this->parent_id && $action != 'edit' && $auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth')) @@ -211,13 +213,13 @@ class acp_forums $message = ($action == 'add') ? $user->lang['FORUM_CREATED'] : $user->lang['FORUM_UPDATED']; // Redirect to permissions - if ($auth->acl_get('a_fauth')) + if ($auth->acl_get('a_fauth') && !$copied_permissions) { $message .= '

              ' . sprintf($user->lang['REDIRECT_ACL'], '', ''); } // redirect directly to permission settings screen if authed - if ($action == 'add' && !$forum_perm_from && $auth->acl_get('a_fauth')) + if ($action == 'add' && !$copied_permissions && $auth->acl_get('a_fauth')) { meta_refresh(4, append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url)); } From 160d1bfd07ce016e34b52588bcbf4c7c71bd7fb0 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 28 May 2010 13:03:56 +0200 Subject: [PATCH 188/393] [ticket/9578] ACP Posting tab is missing "Post settings" module. PHPBB3-9578 --- phpBB/includes/acp/info/acp_board.php | 2 +- phpBB/install/database_update.php | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/acp/info/acp_board.php b/phpBB/includes/acp/info/acp_board.php index 58b650650c..3e18f55940 100644 --- a/phpBB/includes/acp/info/acp_board.php +++ b/phpBB/includes/acp/info/acp_board.php @@ -24,7 +24,7 @@ class acp_board_info 'features' => array('title' => 'ACP_BOARD_FEATURES', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')), 'avatar' => array('title' => 'ACP_AVATAR_SETTINGS', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')), 'message' => array('title' => 'ACP_MESSAGE_SETTINGS', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION', 'ACP_MESSAGES')), - 'post' => array('title' => 'ACP_POST_SETTINGS', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')), + 'post' => array('title' => 'ACP_POST_SETTINGS', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION', 'ACP_MESSAGES')), 'signature' => array('title' => 'ACP_SIGNATURE_SETTINGS', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')), 'feed' => array('title' => 'ACP_FEED_SETTINGS', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')), 'registration' => array('title' => 'ACP_REGISTER_SETTINGS', 'auth' => 'acl_a_board', 'cat' => array('ACP_BOARD_CONFIGURATION')), diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 47d261dc46..917a5401e5 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1684,6 +1684,19 @@ function change_database_data(&$no_updates, $version) } $db->sql_freeresult($result); + // Install modules + $modules_to_install = array( + 'post' => array( + 'base' => 'board', + 'class' => 'acp', + 'title' => 'ACP_POST_SETTINGS', + 'auth' => 'acl_a_board', + 'cat' => 'ACP_MESSAGES', + 'after' => array('message', 'ACP_MESSAGE_SETTINGS') + ), + ); + + _add_modules($modules_to_install); $no_updates = false; break; From 4637709f0a3701bdc3b44efeb08c919f73a3cb1e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 28 May 2010 13:13:53 +0200 Subject: [PATCH 189/393] [ticket/9628] _add_module 'after'-parameter does not work correctly. The modules were grouped by left_id so num_modules is always one (hopefully), but the number of rows is the actual value we'd like to know. Removing the GROUP BY resolves the issue. PHPBB3-9628 --- phpBB/install/database_update.php | 1 - 1 file changed, 1 deletion(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 47d261dc46..145b6b50ae 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -685,7 +685,6 @@ function _add_modules($modules_to_install) WHERE module_class = '" . $db->sql_escape($module_data['class']) . "' AND parent_id = {$parent_id} AND left_id BETWEEN {$first_left_id} AND {$module_row['left_id']} - GROUP BY left_id ORDER BY left_id"; $result = $db->sql_query($sql); $steps = (int) $db->sql_fetchfield('num_modules'); From 801a44b3f0701fc4ccf726c66a4aa0d44ca10f11 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 28 May 2010 14:25:56 +0200 Subject: [PATCH 190/393] [ticket/9147] "Change topic type"-option "Normal" always selected. PHPBB3-9147 --- phpBB/includes/functions_posting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 7242e7987b..f6f90575d4 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -348,7 +348,7 @@ function posting_gen_topic_types($forum_id, $cur_topic_type = POST_NORMAL) { $topic_type_array = array_merge(array(0 => array( 'VALUE' => POST_NORMAL, - 'S_CHECKED' => ($topic_type == POST_NORMAL) ? ' checked="checked"' : '', + 'S_CHECKED' => ($cur_topic_type == POST_NORMAL) ? ' checked="checked"' : '', 'L_TOPIC_TYPE' => $user->lang['POST_NORMAL'])), $topic_type_array From 491fc0516e8f0f43be153bb5a527805037466301 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 16 May 2010 23:43:54 +0200 Subject: [PATCH 191/393] [ticket/9179] Remove unnecessary newline. cc8d22bed6bdba0a8f5797eef3627a62c240a48f added one empty line too much. PHPBB3-9179 --- phpBB/includes/constants.php | 1 - 1 file changed, 1 deletion(-) diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index a3da196cf8..ff572869e2 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -121,7 +121,6 @@ define('NOTIFY_BOTH', 2); define('NOTIFY_YES', 0); define('NOTIFY_NO', 1); - // Email Priority Settings define('MAIL_LOW_PRIORITY', 4); define('MAIL_NORMAL_PRIORITY', 3); From b4df815547a7b19e6cba72c61b2397baec82858d Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Mon, 31 May 2010 23:41:13 -0500 Subject: [PATCH 192/393] [ticket/9633] Newly Registered Group Colour not used in "Our Newest Member" Due to an oversight, the default group was not properly checked in the user_add function. This fix corrects the check. No other changes are needed because they go direct to the database, this one used an array in memory. PHPBB3-9633 --- phpBB/includes/functions_user.php | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 21e82030ee..271542efdd 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -297,6 +297,7 @@ function user_add($user_row, $cp_data = false) if ($config['new_member_group_default']) { group_user_add($add_group_id, $user_id, false, false, true); + $user_row['group_id'] = $add_group_id; } else { From 879bc89524aa98874d6de45dc057cb7ff45bd7ed Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 8 Jun 2010 19:27:55 +0200 Subject: [PATCH 193/393] [ticket/9643] Only split $port from $sqlserver, if it's not an IPv6 address. PHPBB3-9643 --- phpBB/includes/db/postgres.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php index b3139b3d79..2a885f1d04 100644 --- a/phpBB/includes/db/postgres.php +++ b/phpBB/includes/db/postgres.php @@ -46,7 +46,10 @@ class dbal_postgres extends dbal if ($sqlserver) { - if (strpos($sqlserver, ':') !== false) + // $sqlserver can carry a port separated by : for compatibility reasons + // If $sqlserver has more than one : it's probably an IPv6 address. + // In this case we only allow passing a port via the $port variable. + if (substr_count($sqlserver, ':') === 1) { list($sqlserver, $port) = explode(':', $sqlserver); } From bb32daab6352fc24c944aa3258ae1f59f6025a93 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Tue, 4 May 2010 10:39:22 -0400 Subject: [PATCH 194/393] [ticket/9589] Added sample nginx configuration file for phpbb. PHPBB3-9589 --- phpBB/docs/nginx.conf.sample | 70 ++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 phpBB/docs/nginx.conf.sample diff --git a/phpBB/docs/nginx.conf.sample b/phpBB/docs/nginx.conf.sample new file mode 100644 index 0000000000..a22a126ff4 --- /dev/null +++ b/phpBB/docs/nginx.conf.sample @@ -0,0 +1,70 @@ +# Sample nginx configuration file for phpBB. +# Global settings have been removed, copy them +# from your system's nginx.conf. +# Tested with nginx 0.8.35. + +http { + # Compression - requires gzip and gzip static modules. + gzip on; + gzip_static on; + gzip_vary on; + gzip_http_version 1.1; + gzip_min_length 700; + gzip_comp_level 6; + gzip_disable "MSIE [1-6]\."; + + # Catch-all server for requests to invalid hosts. + # Also catches vulnerability scanners probing IP addresses. + # Should be first. + server { + listen 80; + server_name bogus; + return 444; + root /var/empty; + } + + # If you have domains with and without www prefix, + # redirect one to the other. + server { + listen 80; + server_name myforums.com; + rewrite ^(.*)$ http://www.myforums.com$1 permanent; + } + + # The actual board domain. + server { + listen 80; + server_name www.myforums.com; + + root /path/to/phpbb; + + location / { + # phpbb uses index.htm + index index.php index.html index.htm; + } + + # Deny access to internal phpbb files. + location ~ /(config\.php|common\.php|includes|cache|files|store|images/avatars/upload) { + deny all; + } + + # Pass the php scripts to fastcgi server specified in upstream declaration. + location ~ \.php$ { + fastcgi_pass php; + # Necessary for php. + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + # Unmodified fastcgi_params from nginx distribution. + include fastcgi_params; + } + + # Deny access to version control system directories. + location ~ /\.svn|/\.git { + deny all; + } + } + + # If running php as fastcgi, specify php upstream. + upstream php { + server unix:/tmp/php.sock; + } +} From 30891ffb465f9745a6cd3c05957226ef0e600d94 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 4 Apr 2010 16:34:29 +0200 Subject: [PATCH 195/393] [ticket/9167] Remove shadow topics from remaining forums when deleting a forum including posts. The function delete_topic_shadows() had to be reimplemented. It was there but it was completly broken and hasn't been used at all. PHPBB3-9167 --- phpBB/includes/acp/acp_forums.php | 3 + phpBB/includes/functions_admin.php | 88 +++++++++++++++++------------- 2 files changed, 53 insertions(+), 38 deletions(-) diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 6261f866bb..ef3be980a8 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -1642,6 +1642,9 @@ class acp_forums delete_attachments('topic', $topic_ids, false); + // Delete shadow topics pointing to topics in this forum + delete_topic_shadows($forum_id); + // Before we remove anything we make sure we are able to adjust the post counts later. ;) $sql = 'SELECT poster_id FROM ' . POSTS_TABLE . ' diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 4cd2962e3b..7053640104 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -1125,53 +1125,65 @@ function delete_attachments($mode, $ids, $resync = true) } /** -* Remove topic shadows +* Deletes shadow topics pointing to a specified forum. +* +* @param int $forum_id The forum id +* @param string $sql_more Additional WHERE statement, e.g. t.topic_time < (time() - 1234) +* @param bool $auto_sync Will call sync() if this is true +* +* @return array Array with affected forums +* +* @author bantu */ -function delete_topic_shadows($max_age, $forum_id = '', $auto_sync = true) +function delete_topic_shadows($forum_id, $sql_more = '', $auto_sync = true) { - $where = (is_array($forum_id)) ? 'AND ' . $db->sql_in_set('t.forum_id', array_map('intval', $forum_id)) : (($forum_id) ? 'AND t.forum_id = ' . (int) $forum_id : ''); + global $db; - switch ($db->sql_layer) + if (!$forum_id) { - case 'mysql4': - case 'mysqli': - $sql = 'DELETE t.* - FROM ' . TOPICS_TABLE . ' t, ' . TOPICS_TABLE . ' t2 - WHERE t.topic_moved_id = t2.topic_id - AND t.topic_time < ' . (time() - $max_age) - . $where; - $db->sql_query($sql); - break; - - default: - $sql = 'SELECT t.topic_id - FROM ' . TOPICS_TABLE . ' t, ' . TOPICS_TABLE . ' t2 - WHERE t.topic_moved_id = t2.topic_id - AND t.topic_time < ' . (time() - $max_age) - . $where; - $result = $db->sql_query($sql); - - $topic_ids = array(); - while ($row = $db->sql_fetchrow($result)) - { - $topic_ids[] = $row['topic_id']; - } - $db->sql_freeresult($result); - - if (sizeof($topic_ids)) - { - $sql = 'DELETE FROM ' . TOPICS_TABLE . ' - WHERE ' . $db->sql_in_set('topic_id', $topic_ids); - $db->sql_query($sql); - } - break; + // Nothing to do. + return; } + // Set of affected forums we have to resync + $sync_forum_ids = array(); + + // Amount of topics we select and delete at once. + $batch_size = 500; + + do + { + $sql = 'SELECT t2.forum_id, t2.topic_id + FROM ' . TOPICS_TABLE . ' t2, ' . TOPICS_TABLE . ' t + WHERE t2.topic_moved_id = t.topic_id + AND t.forum_id = ' . (int) $forum_id . ' + ' . (($sql_more) ? 'AND ' . $sql_more : ''); + $result = $db->sql_query_limit($sql, $batch_size); + + $topic_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $topic_ids[] = (int) $row['topic_id']; + + $sync_forum_ids[(int) $row['forum_id']] = (int) $row['forum_id']; + } + $db->sql_freeresult($result); + + if (!empty($topic_ids)) + { + $sql = 'DELETE FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_ids); + $db->sql_query($sql); + } + } + while (sizeof($topic_ids) == $batch_size); + if ($auto_sync) { - $where_type = ($forum_id) ? 'forum_id' : ''; - sync('forum', $where_type, $forum_id, true, true); + sync('forum', 'forum_id', $sync_forum_ids, true, true); } + + return $sync_forum_ids; } /** From 38fc35a497e375797afdce6bc3cba952b9ed5344 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 4 Apr 2010 18:50:23 +0200 Subject: [PATCH 196/393] [ticket/9167] Detect and remove any dead left over shadow topics on update. PHPBB3-9167 --- phpBB/install/database_update.php | 45 +++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 47d261dc46..7b27363125 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1684,6 +1684,51 @@ function change_database_data(&$no_updates, $version) } $db->sql_freeresult($result); + // Delete shadow topics pointing to not existing topics + $batch_size = 500; + + // Set of affected forums we have to resync + $sync_forum_ids = array(); + + do + { + $sql_array = array( + 'SELECT' => 't1.topic_id, t1.forum_id', + 'FROM' => array( + TOPICS_TABLE => 't1', + ), + 'LEFT_JOIN' => array( + array( + 'FROM' => array(TOPICS_TABLE => 't2'), + 'ON' => 't1.topic_moved_id = t2.topic_id', + ), + ), + 'WHERE' => 't1.topic_moved_id <> 0 + AND t2.topic_id IS NULL', + ); + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query_limit($sql, $batch_size); + + $topic_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $topic_ids[] = (int) $row['topic_id']; + + $sync_forum_ids[(int) $row['forum_id']] = (int) $row['forum_id']; + } + $db->sql_freeresult($result); + + if (!empty($topic_ids)) + { + $sql = 'DELETE FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_ids); + $db->sql_query($sql); + } + } + while (sizeof($topic_ids) == $batch_size); + + // Sync the forums we have deleted shadow topics from. + sync('forum', 'forum_id', $sync_forum_ids, true, true); $no_updates = false; break; From e942af533165dd3ef5236ef6b6a7499613b26693 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Sun, 13 Jun 2010 19:18:35 -0500 Subject: [PATCH 197/393] [ticket/9132] Oracle CLOB support is broken, preventing storage of long strings This reverts Oracle support to the state it was in prior to phpBB 3.0.6. That is, storage of long strings works again (e.g. posts > 4 KB), but the database backup/restore functionality is broken. We feel that the ability to store long strings is more important than the DB restore, since Oracle 10g itself provides tools for backing up databases. PHPBB3-9132 --- phpBB/includes/db/oracle.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phpBB/includes/db/oracle.php b/phpBB/includes/db/oracle.php index 55b3599800..5a9b18abf0 100644 --- a/phpBB/includes/db/oracle.php +++ b/phpBB/includes/db/oracle.php @@ -261,6 +261,10 @@ class dbal_oracle extends dbal { $cols = explode(', ', $regs[2]); +/* The code inside this comment block breaks clob handling, but does allow the + database restore script to work. If you want to allow no posts longer than 4KB + and/or need the db restore script, uncomment this. + preg_match_all('/\'(?:[^\']++|\'\')*+\'|[\d-.]+/', $regs[3], $vals, PREG_PATTERN_ORDER); if (sizeof($cols) !== sizeof($vals)) @@ -310,6 +314,7 @@ class dbal_oracle extends dbal $vals = array(0 => $vals); } +*/ $inserts = $vals[0]; unset($vals); From 46cae83264905a25e47355dfb7923df2d9ec252f Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 14 Jun 2010 22:27:23 +0200 Subject: [PATCH 198/393] [ticket/9655] Pass E_USER_WARNING, so it doesn't look like a successful action. PHPBB3-9655 --- phpBB/includes/acp/acp_captcha.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_captcha.php b/phpBB/includes/acp/acp_captcha.php index 56a57e319c..1893eed14f 100644 --- a/phpBB/includes/acp/acp_captcha.php +++ b/phpBB/includes/acp/acp_captcha.php @@ -89,14 +89,14 @@ class acp_captcha } else { - trigger_error($user->lang['CAPTCHA_UNAVAILABLE'] . adm_back_link($this->u_action)); + trigger_error($user->lang['CAPTCHA_UNAVAILABLE'] . adm_back_link($this->u_action), E_USER_WARNING); } } trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); } else if ($submit) { - trigger_error($user->lang['FORM_INVALID'] . adm_back_link()); + trigger_error($user->lang['FORM_INVALID'] . adm_back_link(), E_USER_WARNING); } else { From d6551b123367a0b5ae86ae53819280b0b32d8440 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Tue, 25 May 2010 13:01:32 -0500 Subject: [PATCH 199/393] [ticket/9623] Proper UTF8 encoding for usernames in pruning section The username textboxes were not being properly encoded in UTF8. PHPBB3-9623 --- phpBB/includes/acp/acp_prune.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/acp/acp_prune.php b/phpBB/includes/acp/acp_prune.php index 7eeb37133f..ffe20f86f5 100644 --- a/phpBB/includes/acp/acp_prune.php +++ b/phpBB/includes/acp/acp_prune.php @@ -315,8 +315,8 @@ class acp_prune 'mode' => $mode, 'prune' => 1, - 'users' => request_var('users', '', true), - 'username' => request_var('username', '', true), + 'users' => utf8_normalize_nfc(request_var('users', '', true)), + 'username' => utf8_normalize_nfc(request_var('username', '', true)), 'email' => request_var('email', ''), 'joined_select' => request_var('joined_select', ''), 'joined' => request_var('joined', ''), @@ -369,7 +369,7 @@ class acp_prune { global $user, $db; - $users = request_var('users', '', true); + $users = utf8_normalize_nfc(request_var('users', '', true)); if ($users) { @@ -378,7 +378,7 @@ class acp_prune } else { - $username = request_var('username', '', true); + $username = utf8_normalize_nfc(request_var('username', '', true)); $email = request_var('email', ''); $joined_select = request_var('joined_select', 'lt'); From e66c089626eb1bd24751893778b04c941dcf1cf8 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 15 Jun 2010 20:11:00 +0200 Subject: [PATCH 200/393] [ticket/9112] Make sure current user can see most active forum/topic. PHPBB3-9112 --- phpBB/includes/functions_display.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index ea77551fc4..8d25ec3c34 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -969,11 +969,16 @@ function display_user_activity(&$userdata) $forum_ary = array_unique($forum_ary); $forum_sql = (sizeof($forum_ary)) ? 'AND ' . $db->sql_in_set('forum_id', $forum_ary, true) : ''; + $fid_m_approve = $auth->acl_getf('m_approve', true); + $sql_m_approve = (!empty($fid_m_approve)) ? 'OR ' . $db->sql_in_set('forum_id', array_keys($fid_m_approve)) : ''; + // Obtain active forum $sql = 'SELECT forum_id, COUNT(post_id) AS num_posts FROM ' . POSTS_TABLE . ' WHERE poster_id = ' . $userdata['user_id'] . " AND post_postcount = 1 + AND (post_approved = 1 + $sql_m_approve) $forum_sql GROUP BY forum_id ORDER BY num_posts DESC"; @@ -996,6 +1001,8 @@ function display_user_activity(&$userdata) FROM ' . POSTS_TABLE . ' WHERE poster_id = ' . $userdata['user_id'] . " AND post_postcount = 1 + AND (post_approved = 1 + $sql_m_approve) $forum_sql GROUP BY topic_id ORDER BY num_posts DESC"; From 82db1c9c50eeac0c18a62f062c12f3f0846a4961 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 17 Jun 2010 15:56:25 +0200 Subject: [PATCH 201/393] [ticket/9605] Wrong class added to topiclist, when there's no announcement topic. Compare the topic_type on their real value, to ensure there is no MOD causing problems, because of a new topic-type. PHPBB3-9605 --- phpBB/styles/prosilver/template/viewforum_body.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index 1c9ec7bc4a..309375c269 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -122,12 +122,12 @@ -
              +
              • -
                {L_ACTIVE_TOPICS}{L_ANNOUNCEMENTS}{L_TOPICS}
                +
                {L_ACTIVE_TOPICS}{L_ANNOUNCEMENTS}{L_TOPICS}
                {L_REPLIES}
                {L_VIEWS}
                {L_LAST_POST}
                @@ -137,7 +137,7 @@
                  -
                • +
                • style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;" title="{topicrow.TOPIC_FOLDER_IMG_ALT}">{NEWEST_POST_IMG} {topicrow.TOPIC_TITLE} {topicrow.UNAPPROVED_IMG} From b03a7a2c833037e6924b622b56b79778052ecd73 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 27 Mar 2010 14:21:19 +0100 Subject: [PATCH 202/393] [feature/dbal-tests] Fix SQL-ERROR: invalid input syntax for integer: "" PHPBB3-9625 --- tests/dbal/dbal.php | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/tests/dbal/dbal.php b/tests/dbal/dbal.php index f90b5efeb5..02fe8c29a9 100644 --- a/tests/dbal/dbal.php +++ b/tests/dbal/dbal.php @@ -21,10 +21,7 @@ class phpbb_dbal_test extends phpbb_database_test_case { return array( array('phpbb_users', "username_clean = 'bertie'", array(array('username_clean' => 'bertie'))), - array('phpbb_users', "username_clean = 'phpBB'", array()), array('phpbb_users', 'username_clean syntax_error', false), - array('phpbb_users', 'column_not_exists = 2', false), - array('table_not_exists', 'column_not_exists = 2', false), ); } @@ -103,7 +100,6 @@ class phpbb_dbal_test extends phpbb_database_test_case return array( array('', array('barfoo', 'foobar', 'bertie')), array('user_id = 2', array('foobar')), - array("username_clean = 'bertie'", array('bertie')), ); } @@ -138,7 +134,6 @@ class phpbb_dbal_test extends phpbb_database_test_case array(0, 1, array(array('username_clean' => 'foobar'), array('username_clean' => 'bertie'))), array(1, 0, array(array('username_clean' => 'barfoo'))), - array(1, 1, array(array('username_clean' => 'foobar'))), array(1, 2, array(array('username_clean' => 'bertie'))), array(2, 0, array(array('username_clean' => 'barfoo'), array('username_clean' => 'foobar'))), @@ -180,9 +175,6 @@ class phpbb_dbal_test extends phpbb_database_test_case array('bar*', array(array('username_clean' => 'barfoo'))), array('*bar*', array(array('username_clean' => 'barfoo'), array('username_clean' => 'foobar'))), - array('*b*', array(array('username_clean' => 'barfoo'), - array('username_clean' => 'foobar'), - array('username_clean' => 'bertie'))), array('b*r', array()), array('b*e', array(array('username_clean' => 'bertie'))), array('#b*e', array()), @@ -220,11 +212,11 @@ class phpbb_dbal_test extends phpbb_database_test_case array('username_clean' => 'foobar'))), array('user_id', 3, true, true, array(array('username_clean' => 'barfoo'), array('username_clean' => 'foobar'))), - array('user_id', '3', false, false, array(array('username_clean' => 'bertie'))), - array('user_id', '3', false, true, array(array('username_clean' => 'bertie'))), - array('user_id', '3', true, false, array(array('username_clean' => 'barfoo'), + array('username_clean', 'bertie', false, false, array(array('username_clean' => 'bertie'))), + array('username_clean', 'bertie', false, true, array(array('username_clean' => 'bertie'))), + array('username_clean', 'bertie', true, false, array(array('username_clean' => 'barfoo'), array('username_clean' => 'foobar'))), - array('user_id', '3', true, true, array(array('username_clean' => 'barfoo'), + array('username_clean', 'bertie', true, true, array(array('username_clean' => 'barfoo'), array('username_clean' => 'foobar'))), array('user_id', array(3), false, false, array(array('username_clean' => 'bertie'))), array('user_id', array(3), false, true, array(array('username_clean' => 'bertie'))), @@ -238,12 +230,12 @@ class phpbb_dbal_test extends phpbb_database_test_case array('username_clean' => 'bertie'))), array('user_id', array(1, 3), true, false, array(array('username_clean' => 'foobar'))), array('user_id', array(1, 3), true, true, array(array('username_clean' => 'foobar'))), - array('user_id', '', false, false, array()), - array('user_id', '', false, true, array()), - array('user_id', '', true, false, array(array('username_clean' => 'barfoo'), + array('username_clean', '', false, false, array()), + array('username_clean', '', false, true, array()), + array('username_clean', '', true, false, array(array('username_clean' => 'barfoo'), array('username_clean' => 'foobar'), array('username_clean' => 'bertie'))), - array('user_id', '', true, true, array(array('username_clean' => 'barfoo'), + array('username_clean', '', true, true, array(array('username_clean' => 'barfoo'), array('username_clean' => 'foobar'), array('username_clean' => 'bertie'))), array('user_id', array(), false, true, array()), From 539ae0ffafb7981e5d1918183044487f8a6c3a9e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 13 Apr 2010 20:12:09 +0200 Subject: [PATCH 203/393] [feature/dbal-tests] Insert data PHPBB3-9625 --- tests/dbal/dbal.php | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/dbal/dbal.php b/tests/dbal/dbal.php index 02fe8c29a9..98f31d9398 100644 --- a/tests/dbal/dbal.php +++ b/tests/dbal/dbal.php @@ -316,5 +316,39 @@ class phpbb_dbal_test extends phpbb_database_test_case $db->sql_freeresult($result); } + + public static function build_array_insert_data() + { + return array( + array(array( + 'config_name' => 'test_version', + 'config_value' => '0.0.0', + 'is_dynamic' => 1, + )), + array(array( + 'config_name' => 'second config', + 'config_value' => '10', + 'is_dynamic' => 0, + )), + ); + } + + /** + * @dataProvider build_array_insert_data + */ + public function test_build_array_insert($sql_ary) + { + $db = $this->new_dbal(); + + $result = $db->sql_query('INSERT INTO phpbb_config ' . $db->sql_build_array('INSERT', $sql_ary)); + + $result = $db->sql_query_limit("SELECT * + FROM phpbb_config + WHERE config_name = '" . $sql_ary['config_name'] . "'", 1); + + $this->assertEquals($sql_ary, $db->sql_fetchrow($result)); + + $db->sql_freeresult($result); + } } From c4b0814c62c592c85a4b960f1b62891e640f9a66 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 13 Apr 2010 20:12:54 +0200 Subject: [PATCH 204/393] [feature/dbal-tests] Delete data PHPBB3-9625 --- tests/dbal/dbal.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/dbal/dbal.php b/tests/dbal/dbal.php index 98f31d9398..2ca352e2c6 100644 --- a/tests/dbal/dbal.php +++ b/tests/dbal/dbal.php @@ -350,5 +350,35 @@ class phpbb_dbal_test extends phpbb_database_test_case $db->sql_freeresult($result); } + + public static function delete_data() + { + return array( + array("WHERE config_name = 'test_version'", array(array( + 'config_name' => 'second config', + 'config_value' => '10', + 'is_dynamic' => 0, + ))), + array('', array()), + ); + } + + /** + * @dataProvider delete_data + */ + public function test_delete($where, $expected) + { + $db = $this->new_dbal(); + + $result = $db->sql_query('DELETE FROM phpbb_config + ' . $where); + + $result = $db->sql_query('SELECT * + FROM phpbb_config'); + + $this->assertEquals($expected, $db->sql_fetchrowset($result)); + + $db->sql_freeresult($result); + } } From d9c2e6cbcf7d7d3938656e4490aaf117a97e3448 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 13 Apr 2010 20:13:41 +0200 Subject: [PATCH 205/393] [feature/dbal-tests] Multi insert PHPBB3-9625 --- tests/dbal/dbal.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/dbal/dbal.php b/tests/dbal/dbal.php index 2ca352e2c6..9db11fb3d5 100644 --- a/tests/dbal/dbal.php +++ b/tests/dbal/dbal.php @@ -380,5 +380,31 @@ class phpbb_dbal_test extends phpbb_database_test_case $db->sql_freeresult($result); } + + public function test_multiple_insert() + { + $db = $this->new_dbal(); + + $batch_ary = array(); + $batch_ary[] = array( + 'config_name' => 'batch one', + 'config_value' => 'b1', + 'is_dynamic' => 0, + ); + $batch_ary[] = array( + 'config_name' => 'batch two', + 'config_value' => 'b2', + 'is_dynamic' => 1, + ); + + $result = $db->sql_multi_insert('phpbb_config', $batch_ary); + + $result = $db->sql_query('SELECT * + FROM phpbb_config'); + + $this->assertEquals($batch_ary, $db->sql_fetchrowset($result)); + + $db->sql_freeresult($result); + } } From e3420de295fdc1e4301882b9b764b9732669a7d0 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 13 Apr 2010 20:23:46 +0200 Subject: [PATCH 206/393] [feature/dbal-tests] Update data PHPBB3-9625 --- tests/dbal/dbal.php | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/tests/dbal/dbal.php b/tests/dbal/dbal.php index 9db11fb3d5..2eec4363f8 100644 --- a/tests/dbal/dbal.php +++ b/tests/dbal/dbal.php @@ -406,5 +406,47 @@ class phpbb_dbal_test extends phpbb_database_test_case $db->sql_freeresult($result); } + + public static function update_data() + { + return array( + array(array('config_value' => '20', 'is_dynamic' => 0), " WHERE config_name = 'batch one'", array(array( + 'config_name' => 'batch one', + 'config_value' => '20', + 'is_dynamic' => 0, + ), array( + 'config_name' => 'batch two', + 'config_value' => 'b2', + 'is_dynamic' => 1, + ))), + array(array('config_value' => '0', 'is_dynamic' => 1), '', array(array( + 'config_name' => 'batch one', + 'config_value' => '0', + 'is_dynamic' => 1, + ), array( + 'config_name' => 'batch two', + 'config_value' => '0', + 'is_dynamic' => 1, + ))), + ); + } + + /** + * @dataProvider update_data + */ + public function test_update($sql_ary, $where, $expected) + { + $db = $this->new_dbal(); + + $result = $db->sql_query('UPDATE phpbb_config + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . $where); + + $result = $db->sql_query('SELECT * + FROM phpbb_config'); + + $this->assertEquals($expected, $db->sql_fetchrowset($result)); + + $db->sql_freeresult($result); + } } From ef69f226989442d5fda08fa193f81242e7312ab8 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 17 Jun 2010 15:57:02 +0200 Subject: [PATCH 207/393] [feature/dbal-tests] Follow the coding guidelines and ... resolved a bug caused by a missing order-by. PHPBB3-9625 --- tests/dbal/dbal.php | 138 ++++++++++++++++++++++++++++---------------- 1 file changed, 88 insertions(+), 50 deletions(-) diff --git a/tests/dbal/dbal.php b/tests/dbal/dbal.php index 2eec4363f8..1cce891ca9 100644 --- a/tests/dbal/dbal.php +++ b/tests/dbal/dbal.php @@ -302,10 +302,11 @@ class phpbb_dbal_test extends phpbb_database_test_case $db->sql_return_on_error(true); } - $result = $db->sql_query('SELECT username_clean + $sql = 'SELECT username_clean FROM phpbb_users WHERE ' . $db->sql_build_array('SELECT', $assoc_ary) . ' - ORDER BY user_id ASC'); + ORDER BY user_id ASC'; + $result = $db->sql_query($sql); if ($catch_error) { @@ -340,11 +341,13 @@ class phpbb_dbal_test extends phpbb_database_test_case { $db = $this->new_dbal(); - $result = $db->sql_query('INSERT INTO phpbb_config ' . $db->sql_build_array('INSERT', $sql_ary)); + $sql = 'INSERT INTO phpbb_config ' . $db->sql_build_array('INSERT', $sql_ary); + $result = $db->sql_query($sql); - $result = $db->sql_query_limit("SELECT * + $sql = "SELECT * FROM phpbb_config - WHERE config_name = '" . $sql_ary['config_name'] . "'", 1); + WHERE config_name = '" . $sql_ary['config_name'] . "'"; + $result = $db->sql_query_limit($sql, 1); $this->assertEquals($sql_ary, $db->sql_fetchrow($result)); @@ -354,12 +357,20 @@ class phpbb_dbal_test extends phpbb_database_test_case public static function delete_data() { return array( - array("WHERE config_name = 'test_version'", array(array( - 'config_name' => 'second config', - 'config_value' => '10', - 'is_dynamic' => 0, - ))), - array('', array()), + array( + "WHERE config_name = 'test_version'", + array( + array( + 'config_name' => 'second config', + 'config_value' => '10', + 'is_dynamic' => 0, + ), + ), + ), + array( + '', + array(), + ), ); } @@ -370,11 +381,13 @@ class phpbb_dbal_test extends phpbb_database_test_case { $db = $this->new_dbal(); - $result = $db->sql_query('DELETE FROM phpbb_config - ' . $where); + $sql = 'DELETE FROM phpbb_config + ' . $where; + $result = $db->sql_query($sql); - $result = $db->sql_query('SELECT * - FROM phpbb_config'); + $sql = 'SELECT * + FROM phpbb_config'; + $result = $db->sql_query($sql); $this->assertEquals($expected, $db->sql_fetchrowset($result)); @@ -385,22 +398,25 @@ class phpbb_dbal_test extends phpbb_database_test_case { $db = $this->new_dbal(); - $batch_ary = array(); - $batch_ary[] = array( - 'config_name' => 'batch one', - 'config_value' => 'b1', - 'is_dynamic' => 0, - ); - $batch_ary[] = array( - 'config_name' => 'batch two', - 'config_value' => 'b2', - 'is_dynamic' => 1, + $batch_ary = array( + array( + 'config_name' => 'batch one', + 'config_value' => 'b1', + 'is_dynamic' => 0, + ), + array( + 'config_name' => 'batch two', + 'config_value' => 'b2', + 'is_dynamic' => 1, + ), ); $result = $db->sql_multi_insert('phpbb_config', $batch_ary); - $result = $db->sql_query('SELECT * - FROM phpbb_config'); + $sql = 'SELECT * + FROM phpbb_config + ORDER BY config_name ASC'; + $result = $db->sql_query($sql); $this->assertEquals($batch_ary, $db->sql_fetchrowset($result)); @@ -410,24 +426,44 @@ class phpbb_dbal_test extends phpbb_database_test_case public static function update_data() { return array( - array(array('config_value' => '20', 'is_dynamic' => 0), " WHERE config_name = 'batch one'", array(array( - 'config_name' => 'batch one', - 'config_value' => '20', - 'is_dynamic' => 0, - ), array( - 'config_name' => 'batch two', - 'config_value' => 'b2', - 'is_dynamic' => 1, - ))), - array(array('config_value' => '0', 'is_dynamic' => 1), '', array(array( - 'config_name' => 'batch one', - 'config_value' => '0', - 'is_dynamic' => 1, - ), array( - 'config_name' => 'batch two', - 'config_value' => '0', - 'is_dynamic' => 1, - ))), + array( + array( + 'config_value' => '20', + 'is_dynamic' => 0, + ), + " WHERE config_name = 'batch one'", + array( + array( + 'config_name' => 'batch one', + 'config_value' => '20', + 'is_dynamic' => 0, + ), + array( + 'config_name' => 'batch two', + 'config_value' => 'b2', + 'is_dynamic' => 1, + ), + ), + ), + array( + array( + 'config_value' => '0', + 'is_dynamic' => 1, + ), + '', + array( + array( + 'config_name' => 'batch one', + 'config_value' => '0', + 'is_dynamic' => 1, + ), + array( + 'config_name' => 'batch two', + 'config_value' => '0', + 'is_dynamic' => 1, + ), + ), + ), ); } @@ -438,15 +474,17 @@ class phpbb_dbal_test extends phpbb_database_test_case { $db = $this->new_dbal(); - $result = $db->sql_query('UPDATE phpbb_config - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . $where); + $sql = 'UPDATE phpbb_config + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . $where; + $result = $db->sql_query($sql); - $result = $db->sql_query('SELECT * - FROM phpbb_config'); + $sql = 'SELECT * + FROM phpbb_config + ORDER BY config_name ASC'; + $result = $db->sql_query($sql); $this->assertEquals($expected, $db->sql_fetchrowset($result)); $db->sql_freeresult($result); } } - From 4bc215823520157baf1dcb41c0773f373731b0c6 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 17 Jun 2010 16:55:21 +0200 Subject: [PATCH 208/393] [ticket/9587] Replace '0px' with '0'. This has been introduced by merge of c7a25c58b893fc72ffb3746374ece9de1d388531, which was not supposed to be merged. 1b2a65333b5be1f6086bbd1d438e061041bd2b75 was supposed to be merged instead. PHPBB3-9587 --- phpBB/styles/prosilver/theme/forms.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/theme/forms.css b/phpBB/styles/prosilver/theme/forms.css index 4516c7fcd2..4e48a93a55 100644 --- a/phpBB/styles/prosilver/theme/forms.css +++ b/phpBB/styles/prosilver/theme/forms.css @@ -98,7 +98,7 @@ fieldset.fields1 div { /* Set it back to 0px for the reCaptcha divs: PHPBB3-9587 */ fieldset.fields1 #recaptcha_widget_div div { - margin-bottom: 0px; + margin-bottom: 0; } /* Specific layout 2 */ From 6221ba4dd172428cf10eedad429a76d390aa2219 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 20 Jun 2010 13:38:36 +0200 Subject: [PATCH 209/393] [ticket/9665] Allow preview of signature when it is the string "0". Since only the SIGNATURE_PREVIEW parameter is evaluated in the templates will not allow the signature to be "0". however does allow "0". PHPBB3-9665 --- phpBB/styles/prosilver/template/ucp_profile_signature.html | 2 +- phpBB/styles/subsilver2/template/ucp_profile_signature.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/prosilver/template/ucp_profile_signature.html b/phpBB/styles/prosilver/template/ucp_profile_signature.html index 5d25d2d9f4..ab23b84076 100644 --- a/phpBB/styles/prosilver/template/ucp_profile_signature.html +++ b/phpBB/styles/prosilver/template/ucp_profile_signature.html @@ -4,7 +4,7 @@

                  {L_TITLE}

                  - +

                  {L_SIGNATURE_PREVIEW}

                  diff --git a/phpBB/styles/subsilver2/template/ucp_profile_signature.html b/phpBB/styles/subsilver2/template/ucp_profile_signature.html index 2b396ea0df..a33726e166 100644 --- a/phpBB/styles/subsilver2/template/ucp_profile_signature.html +++ b/phpBB/styles/subsilver2/template/ucp_profile_signature.html @@ -93,7 +93,7 @@
            - + From 52c3b51c95b408a284bd278379679ad00a2151af Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 14 Jun 2010 22:34:31 +0200 Subject: [PATCH 210/393] [ticket/9656] Remove @ from phpinfo() to get correct error_reporting value. PHPBB3-9656 --- phpBB/includes/acp/acp_php_info.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_php_info.php b/phpBB/includes/acp/acp_php_info.php index 9935c0466e..0499095004 100644 --- a/phpBB/includes/acp/acp_php_info.php +++ b/phpBB/includes/acp/acp_php_info.php @@ -35,9 +35,9 @@ class acp_php_info $this->tpl_name = 'acp_php_info'; $this->page_title = 'ACP_PHP_INFO'; - + ob_start(); - @phpinfo(INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES | INFO_VARIABLES); + phpinfo(INFO_GENERAL | INFO_CONFIGURATION | INFO_MODULES | INFO_VARIABLES); $phpinfo = ob_get_clean(); $phpinfo = trim($phpinfo); From ac45f07402314b20bf7211ae9c63396d44c174ef Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 13 Jun 2010 20:31:33 +0200 Subject: [PATCH 211/393] [ticket/9653] Valid XHTML with code BBCode in subsilver2 viewtopic signatures PHPBB3-9653 --- phpBB/styles/subsilver2/template/viewtopic_body.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/styles/subsilver2/template/viewtopic_body.html b/phpBB/styles/subsilver2/template/viewtopic_body.html index 8f01c64c0e..bba00ce685 100644 --- a/phpBB/styles/subsilver2/template/viewtopic_body.html +++ b/phpBB/styles/subsilver2/template/viewtopic_body.html @@ -238,7 +238,7 @@

            {L_DOWNLOAD_NOTICE}
            -
            _________________
            {postrow.SIGNATURE}
            +

            _________________
            {postrow.SIGNATURE}
            From 38cc9ce72fd09423b53de5c78a0332fd7ee8eadf Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Mon, 28 Jun 2010 17:37:45 +0200 Subject: [PATCH 212/393] [task/set-permissions] shell script to set file permissions PHPBB3-9689 --- phpBB/develop/set_permissions.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100755 phpBB/develop/set_permissions.sh diff --git a/phpBB/develop/set_permissions.sh b/phpBB/develop/set_permissions.sh new file mode 100755 index 0000000000..879b94e518 --- /dev/null +++ b/phpBB/develop/set_permissions.sh @@ -0,0 +1,9 @@ +#!/bin/sh +# set permissions required for installation + +dir=$(dirname $0) + +for file in cache files store config.php images/avatars/upload +do + chmod a+w $dir/../$file +done From 32882fd798ae0fe7e51f5c7ef2ff8501a5b57251 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 1 Jul 2010 23:29:25 +0200 Subject: [PATCH 213/393] [ticket/9694] Make sure string offset 0 exists to avoid E_NOTICE message. PHPBB3-9694 --- phpBB/download/file.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 2154847865..03a37a58b4 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -61,7 +61,7 @@ if (isset($_GET['avatar'])) $avatar_group = false; $exit = false; - if ($filename[0] === 'g') + if (isset($filename[0]) && $filename[0] === 'g') { $avatar_group = true; $filename = substr($filename, 1); From 881c74688bc41d83c00db8c96715dc48d06c9d3d Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 1 Jul 2010 23:30:48 +0200 Subject: [PATCH 214/393] [ticket/9694] Call error_reporting() in download/file.php when in avatar mode. PHPBB3-9694 --- phpBB/download/file.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 03a37a58b4..97f4ff3c8a 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -31,6 +31,12 @@ else if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT' if (isset($_GET['avatar'])) { + if (!defined('E_DEPRECATED')) + { + define('E_DEPRECATED', 8192); + } + error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED); + require($phpbb_root_path . 'config.' . $phpEx); if (!defined('PHPBB_INSTALLED') || empty($dbms) || empty($acm_type)) From 0e93d8386bef21f2af5647bf13e9ba68156cf7da Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Thu, 1 Jul 2010 17:16:37 -0500 Subject: [PATCH 215/393] [ticket/9695] Correct the improper display of user input in mcp_ban.php Correct the improper display of "ban_reason" and "ban_give_reason" in mcp_ban.php PHPBB3-9695 --- phpBB/adm/style/acp_ban.html | 6 +++--- phpBB/includes/acp/acp_ban.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/adm/style/acp_ban.html b/phpBB/adm/style/acp_ban.html index 539e8032dd..cf44f4aaa7 100644 --- a/phpBB/adm/style/acp_ban.html +++ b/phpBB/adm/style/acp_ban.html @@ -31,9 +31,9 @@ function display_details(option) { - document.getElementById('acp_unban').unbangivereason.value = ban_give_reason[option]; - document.getElementById('acp_unban').unbanreason.value = ban_reason[option]; - document.getElementById('acp_unban').unbanlength.value = ban_length[option]; + document.getElementById('acp_unban').unbangivereason.innerHTML = ban_give_reason[option]; + document.getElementById('acp_unban').unbanreason.innerHTML = ban_reason[option]; + document.getElementById('acp_unban').unbanlength.innerHTML = ban_length[option]; } // ]]> diff --git a/phpBB/includes/acp/acp_ban.php b/phpBB/includes/acp/acp_ban.php index 3198376584..a7ea57b753 100644 --- a/phpBB/includes/acp/acp_ban.php +++ b/phpBB/includes/acp/acp_ban.php @@ -224,7 +224,7 @@ class acp_ban $template->assign_block_vars('ban_reason', array( 'BAN_ID' => $ban_id, 'REASON' => $reason, - 'A_REASON' => addslashes(htmlspecialchars_decode($reason)), + 'A_REASON' => addslashes($reason), )); } } @@ -236,7 +236,7 @@ class acp_ban $template->assign_block_vars('ban_give_reason', array( 'BAN_ID' => $ban_id, 'REASON' => $reason, - 'A_REASON' => addslashes(htmlspecialchars_decode($reason)), + 'A_REASON' => addslashes($reason), )); } } From 0db657381b4e20c0fd1ccb8c4c8e6a52b55b127d Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 2 Jul 2010 12:28:06 +0200 Subject: [PATCH 216/393] [ticket/9697] Backlink broken when the select parent forum does not exist. PHPBB3-9697 --- phpBB/includes/acp/acp_forums.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 6261f866bb..f2f1bd80e2 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -983,7 +983,7 @@ class acp_forums if (!$row) { - trigger_error($user->lang['PARENT_NOT_EXIST'] . adm_back_link($this->u_action . '&' . $this->parent_id), E_USER_WARNING); + trigger_error($user->lang['PARENT_NOT_EXIST'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); } if ($row['forum_type'] == FORUM_LINK) From 24cc3fd0f941ec2ea8a1a75f7b3a811d9438f359 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Sat, 3 Jul 2010 21:21:22 -0500 Subject: [PATCH 217/393] [ticket/9703] Correct database leak where deleting user did not rm some PM data Users' PM rules and PM folders were being left intact when deleting them. PHPBB3-9703 --- phpBB/includes/functions_user.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 271542efdd..93e4e6db07 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -528,7 +528,7 @@ function user_delete($mode, $user_id, $post_username = false) $db->sql_transaction('begin'); - $table_ary = array(USERS_TABLE, USER_GROUP_TABLE, TOPICS_WATCH_TABLE, FORUMS_WATCH_TABLE, ACL_USERS_TABLE, TOPICS_TRACK_TABLE, TOPICS_POSTED_TABLE, FORUMS_TRACK_TABLE, PROFILE_FIELDS_DATA_TABLE, MODERATOR_CACHE_TABLE, DRAFTS_TABLE, BOOKMARKS_TABLE, SESSIONS_KEYS_TABLE); + $table_ary = array(USERS_TABLE, USER_GROUP_TABLE, TOPICS_WATCH_TABLE, FORUMS_WATCH_TABLE, ACL_USERS_TABLE, TOPICS_TRACK_TABLE, TOPICS_POSTED_TABLE, FORUMS_TRACK_TABLE, PROFILE_FIELDS_DATA_TABLE, MODERATOR_CACHE_TABLE, DRAFTS_TABLE, BOOKMARKS_TABLE, SESSIONS_KEYS_TABLE, PRIVMSGS_FOLDER_TABLE, PRIVMSGS_RULES_TABLE); foreach ($table_ary as $table) { From 097854ca8594676439dd8aab740674c717dda4cd Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sun, 25 Apr 2010 10:37:34 -0400 Subject: [PATCH 218/393] [ticket/9570] Changed "system" to "guest" timezone in ACP, added explanation. PHPBB3-9570 --- phpBB/includes/acp/acp_board.php | 2 +- phpBB/language/en/acp/board.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 7680d8996c..927e72010e 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -58,7 +58,7 @@ class acp_board 'board_disable_msg' => false, 'default_lang' => array('lang' => 'DEFAULT_LANGUAGE', 'validate' => 'lang', 'type' => 'select', 'function' => 'language_select', 'params' => array('{CONFIG_VALUE}'), 'explain' => false), 'default_dateformat' => array('lang' => 'DEFAULT_DATE_FORMAT', 'validate' => 'string', 'type' => 'custom', 'method' => 'dateformat_select', 'explain' => true), - 'board_timezone' => array('lang' => 'SYSTEM_TIMEZONE', 'validate' => 'string', 'type' => 'select', 'function' => 'tz_select', 'params' => array('{CONFIG_VALUE}', 1), 'explain' => false), + 'board_timezone' => array('lang' => 'SYSTEM_TIMEZONE', 'validate' => 'string', 'type' => 'select', 'function' => 'tz_select', 'params' => array('{CONFIG_VALUE}', 1), 'explain' => true), 'board_dst' => array('lang' => 'SYSTEM_DST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'default_style' => array('lang' => 'DEFAULT_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array('{CONFIG_VALUE}', false), 'explain' => false), 'override_user_style' => array('lang' => 'OVERRIDE_STYLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 52389d85b9..80db81653d 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -50,7 +50,8 @@ $lang = array_merge($lang, array( 'SITE_DESC' => 'Site description', 'SITE_NAME' => 'Site name', 'SYSTEM_DST' => 'Enable Summer Time/DST', - 'SYSTEM_TIMEZONE' => 'System timezone', + 'SYSTEM_TIMEZONE' => 'Guest timezone', + 'SYSTEM_TIMEZONE_EXPLAIN' => 'Timezone to use for displaying times to users who are not logged in (guests, bots). Logged in users set their timezone during registration and can change it in user control panel.', 'WARNINGS_EXPIRE' => 'Warning duration', 'WARNINGS_EXPIRE_EXPLAIN' => 'Number of days that will elapse before the warning will automatically expire from a user’s record.', )); From b64f456c40f5c0c5e5438fea8a864934e3b3fcf8 Mon Sep 17 00:00:00 2001 From: Richard Foote Date: Tue, 6 Jul 2010 14:43:50 +0200 Subject: [PATCH 219/393] [ticket/9659] Signature options in set_user_options The phpBB3 defaults are being used. PHPBB3-9659 --- phpBB/includes/functions_convert.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index 0fdae9b274..c035fd3739 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -1025,6 +1025,9 @@ function set_user_options() 'bbcode' => array('bit' => 8, 'default' => 1), 'smilies' => array('bit' => 9, 'default' => 1), 'popuppm' => array('bit' => 10, 'default' => 0), + 'sig_bbcode' => array('bit' => 15, 'default' => 1), + 'sig_smilies' => array('bit' => 16, 'default' => 1), + 'sig_links' => array('bit' => 17, 'default' => 1), ); $option_field = 0; From 030f9c03c66950d4ec94567108f4baa8da709ab6 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Sat, 8 May 2010 16:41:18 -0400 Subject: [PATCH 220/393] [ticket/9593] A readme file for unit tests and running unit tests. Added a readme file explaining prerequisites for unit tests, and how to run unit tests. PHPBB3-9593 --- tests/RUNNING_TESTS.txt | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/RUNNING_TESTS.txt diff --git a/tests/RUNNING_TESTS.txt b/tests/RUNNING_TESTS.txt new file mode 100644 index 0000000000..f1b40f71ad --- /dev/null +++ b/tests/RUNNING_TESTS.txt @@ -0,0 +1,33 @@ +Running Tests +------------- + +Prerequisites +------------- + +PHPUnit +======= + +phpBB unit tests use PHPUnit framework. Version 3.3 or better is required +to run the tests. PHPUnit prefers to be installed via PEAR; refer to +http://www.phpunit.de/ for more information. + +PHP extensions +============== + +Unit tests use several PHP extensions that board code does not use. Currently +the following PHP extensions must be installed and enabled to run unit tests: + +- ctype + +Running +------- + +Once the prerequisites are installed, run the tests from tests directory: + +$ phpunit all_tests.php + +More Information +---------------- + +Further information is available on phpbb wiki: +http://wiki.phpbb.com/display/DEV/Unit+Tests From e130a6bad94f534b3e573efcdb2b94332426598e Mon Sep 17 00:00:00 2001 From: Thatbitextra Date: Wed, 28 Apr 2010 16:57:16 -0400 Subject: [PATCH 221/393] [ticket/9451] Add optional $can_upload parameter to avatar_process_user(). Avoid unnecessary overhead in avatar_process_user() by optionally passing in the value of $can_upload. PHPBB3-9451 --- phpBB/includes/acp/acp_users.php | 2 +- phpBB/includes/functions_user.php | 7 +++++-- phpBB/includes/ucp/ucp_profile.php | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 7914edd056..3a405da825 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1706,7 +1706,7 @@ class acp_users trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } - if (avatar_process_user($error, $user_row)) + if (avatar_process_user($error, $user_row, $can_upload)) { trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_row['user_id'])); } diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 271542efdd..d2c3df7c4d 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -2284,7 +2284,7 @@ function avatar_get_dimensions($avatar, $avatar_type, &$error, $current_x = 0, $ /** * Uploading/Changing user avatar */ -function avatar_process_user(&$error, $custom_userdata = false) +function avatar_process_user(&$error, $custom_userdata = false, $can_upload = null) { global $config, $phpbb_root_path, $auth, $user, $db; @@ -2323,7 +2323,10 @@ function avatar_process_user(&$error, $custom_userdata = false) $avatar_select = basename(request_var('avatar_select', '')); // Can we upload? - $can_upload = ($config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $change_avatar && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; + if (is_null($can_upload)) + { + $can_upload = ($config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $change_avatar && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; + } if ((!empty($_FILES['uploadfile']['name']) || $data['uploadurl']) && $can_upload) { diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index f4f4abad4a..363a4803b6 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -572,7 +572,7 @@ class ucp_profile { if (check_form_key('ucp_avatar')) { - if (avatar_process_user($error)) + if (avatar_process_user($error, false, $can_upload)) { meta_refresh(3, $this->u_action); $message = $user->lang['PROFILE_UPDATED'] . '

            ' . sprintf($user->lang['RETURN_UCP'], '', ''); From d00f2ec1832f6c391a1526a1263d45ed98d17e23 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Sat, 3 Jul 2010 22:12:25 -0500 Subject: [PATCH 222/393] [ticket/9690] Add forthcoming Bing Bot to list of recognized bots Microsoft will rename MSN Bot to Bing Bot later this year, and change its user agent. This updates phpBB to be aware of Bing Bot PHPBB3-9690 --- phpBB/install/database_update.php | 52 +++++++++++++++++++++++++++++++ phpBB/install/install_install.php | 1 + 2 files changed, 53 insertions(+) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 47d261dc46..708abcb64d 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1685,6 +1685,58 @@ function change_database_data(&$no_updates, $version) $db->sql_freeresult($result); + // add Bing Bot + $sql = 'SELECT group_id, group_colour + FROM ' . GROUPS_TABLE . " + WHERE group_name = 'BOTS'"; + $result = $db->sql_query($sql); + $group_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$group_row) + { + // default fallback, should never get here + $group_row['group_id'] = 6; + $group_row['group_colour'] = '9E8DA7'; + } + + if (!function_exists('user_add')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + $bot_name = 'Bing [Bot]'; + $bot_agent = 'bingbot/'; + $bot_ip = ''; + + $user_row = array( + 'user_type' => USER_IGNORE, + 'group_id' => $group_row['group_id'], + 'username' => $bot_name, + 'user_regdate' => time(), + 'user_password' => '', + 'user_colour' => $group_row['group_colour'], + 'user_email' => '', + 'user_lang' => $config['default_lang'], + 'user_style' => $config['default_style'], + 'user_timezone' => 0, + 'user_dateformat' => $config['default_dateformat'], + 'user_allow_massemail' => 0, + ); + + $user_id = user_add($user_row); + + $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'bot_active' => 1, + 'bot_name' => (string) $bot_name, + 'user_id' => (int) $user_id, + 'bot_agent' => (string) $bot_agent, + 'bot_ip' => (string) $bot_ip, + )); + + _sql($sql, $errored, $error_ary); + // end Bing Bot addition + $no_updates = false; break; } diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index f4989b5bd7..4c22db07b2 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -2108,6 +2108,7 @@ class install_install extends module 'Alta Vista [Bot]' => array('Scooter/', ''), 'Ask Jeeves [Bot]' => array('Ask Jeeves', ''), 'Baidu [Spider]' => array('Baiduspider+(', ''), + 'Bing [Bot]' => array('bingbot/', ''), 'Exabot [Bot]' => array('Exabot/', ''), 'FAST Enterprise [Crawler]' => array('FAST Enterprise Crawler', ''), 'FAST WebCrawler [Crawler]' => array('FAST-WebCrawler/', ''), From 9764a3213842cefea3641b2f29b58f345b578d69 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Wed, 7 Jul 2010 23:04:46 +0100 Subject: [PATCH 223/393] [ticket/9712] Future dates can be formatted as 'less than one minute ago' PHPBB3-9712 --- phpBB/includes/session.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 0a01b4e73b..e157053e61 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -2134,9 +2134,9 @@ class user extends session // Zone offset $zone_offset = $this->timezone + $this->dst; - // Show date <= 1 hour ago as 'xx min ago' + // Show date <= 1 hour ago as 'xx min ago' but not greater than 60 seconds in the future // A small tolerence is given for times in the future but in the same minute are displayed as '< than a minute ago' - if ($delta <= 3600 && ($delta >= -5 || (($now / 60) % 60) == (($gmepoch / 60) % 60)) && $date_cache[$format]['is_short'] !== false && !$forcedate && isset($this->lang['datetime']['AGO'])) + if ($delta <= 3600 && $delta > -60 && ($delta >= -5 || (($now / 60) % 60) == (($gmepoch / 60) % 60)) && $date_cache[$format]['is_short'] !== false && !$forcedate && isset($this->lang['datetime']['AGO'])) { return $this->lang(array('datetime', 'AGO'), max(0, (int) floor($delta / 60))); } From 58cb46d344685c7bba4579e5b693ec448877d7cd Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Thu, 8 Jul 2010 09:15:03 +0200 Subject: [PATCH 224/393] [ticket/9704] Fix minor typo in coding guidelines. PHPBB3-9704 --- phpBB/docs/coding-guidelines.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 7f747e09e2..1978a0a307 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -288,7 +288,7 @@ PHPBB_QA (Set board to QA-Mode, which means the updater also c
            -

            Please note that these Guidelines applies to all php, html, javascript and css files.

            +

            Please note that these guidelines apply to all php, html, javascript and css files.

            2.i. Variable/Function Naming

            From ae967d16f1ad584d7e03b4466e6cc3d1d067dea6 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Mon, 5 Jul 2010 22:22:25 -0500 Subject: [PATCH 225/393] [ticket/9650] Do not allow banning the anonymous user by username Banning anonymous can result in bad things, like not being able to log in. However, it was possible until now. PHPBB3-9650 --- phpBB/includes/acp/acp_users.php | 5 +++++ phpBB/includes/functions_user.php | 7 ++++--- phpBB/language/en/acp/users.php | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 7914edd056..2843480c04 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -231,6 +231,11 @@ class acp_users trigger_error($user->lang['CANNOT_BAN_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); } + if ($user_id == ANONYMOUS) + { + trigger_error($user->lang['CANNOT_BAN_ANONYMOUS'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + if ($user_row['user_type'] == USER_FOUNDER) { trigger_error($user->lang['CANNOT_BAN_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 271542efdd..8d2fa14a4b 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -837,14 +837,15 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas FROM ' . USERS_TABLE . ' WHERE ' . $db->sql_in_set('username_clean', $sql_usernames); - // Do not allow banning yourself + // Do not allow banning yourself, the guest account, or founders. + $non_bannable = array($user->data['user_id'], ANONYMOUS); if (sizeof($founder)) { - $sql .= ' AND ' . $db->sql_in_set('user_id', array_merge(array_keys($founder), array($user->data['user_id'])), true); + $sql .= ' AND ' . $db->sql_in_set('user_id', array_merge(array_keys($founder), $non_bannable), true); } else { - $sql .= ' AND user_id <> ' . $user->data['user_id']; + $sql .= ' AND ' . $db->sql_in_set('user_id', $non_bannable, true); } $result = $db->sql_query($sql); diff --git a/phpBB/language/en/acp/users.php b/phpBB/language/en/acp/users.php index 8d9bf0d486..eda9659795 100644 --- a/phpBB/language/en/acp/users.php +++ b/phpBB/language/en/acp/users.php @@ -42,6 +42,7 @@ $lang = array_merge($lang, array( 'BAN_ALREADY_ENTERED' => 'The ban had been previously entered successfully. The ban list has not been updated.', 'BAN_SUCCESSFUL' => 'Ban entered successfully.', + 'CANNOT_BAN_ANONYMOUS' => 'You are not allowed to ban the anonymous account. Permissions for anonymous users can be set under the Permissions tab.', 'CANNOT_BAN_FOUNDER' => 'You are not allowed to ban founder accounts.', 'CANNOT_BAN_YOURSELF' => 'You are not allowed to ban yourself.', 'CANNOT_DEACTIVATE_BOT' => 'You are not allowed to deactivate bot accounts. Please deactivate the bot within the bots page instead.', From c6c4d01fe9619a1db585b7446343517762cd18b1 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 8 Jul 2010 20:26:50 +0200 Subject: [PATCH 226/393] [ticket/9714] Use correct variable name in email regular expression tests. PHPBB3-9714 --- tests/regex/email.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/regex/email.php b/tests/regex/email.php index b1519dfa5f..85b6406ffc 100644 --- a/tests/regex/email.php +++ b/tests/regex/email.php @@ -70,7 +70,7 @@ class phpbb_regex_email_test extends phpbb_test_case /** * @dataProvider negative_match_data */ - public function test_negative_match($address) + public function test_negative_match($email) { $this->assertEquals(0, preg_match($this->regex, $email)); } From fc89d5d7db46dc4a25a0443f38c37710542e5923 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 8 Jul 2010 21:13:17 +0200 Subject: [PATCH 227/393] [ticket/9677] Subsilver2 is missing the bbcode-helpline for inline-attachments. PHPBB3-9677 --- phpBB/styles/subsilver2/template/posting_buttons.html | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/styles/subsilver2/template/posting_buttons.html b/phpBB/styles/subsilver2/template/posting_buttons.html index 0aab79b7aa..2fff9c1991 100644 --- a/phpBB/styles/subsilver2/template/posting_buttons.html +++ b/phpBB/styles/subsilver2/template/posting_buttons.html @@ -19,6 +19,7 @@ o: '{LA_BBCODE_O_HELP}', p: '{LA_BBCODE_P_HELP}', w: '{LA_BBCODE_W_HELP}', + a: '{LA_BBCODE_A_HELP}', s: '{LA_BBCODE_S_HELP}', f: '{LA_BBCODE_F_HELP}', e: '{LA_BBCODE_E_HELP}', From df99bdbd53d29b97012e04ac32fa815620e426ed Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 8 Jul 2010 21:22:54 +0200 Subject: [PATCH 228/393] [ticket/9678] Flash attachments are not displayed in subsilver2. PHPBB3-9678 --- phpBB/styles/subsilver2/template/attachment.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/subsilver2/template/attachment.html b/phpBB/styles/subsilver2/template/attachment.html index d54994fe67..833bd4d55f 100644 --- a/phpBB/styles/subsilver2/template/attachment.html +++ b/phpBB/styles/subsilver2/template/attachment.html @@ -58,13 +58,13 @@ - + - + From bbc3105466ccd43d94423325a68c626c76dec5f9 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Thu, 8 Jul 2010 22:44:28 +0200 Subject: [PATCH 229/393] [ticket/9701] Prevent notices from being hidden by template tests The template tests disable NOTICEs for the duration of template execution since the current version of the template engine does not generate sufficiently clean code. The error level is reset aftwards, however that part is skipped when trigger_error is called which is converted into a regular exception by PHPUnit and passed down until caught. Such exceptions are now caught to reset the error level, and then the exception is rethrown. This uncovered another issue in the template tests which only passed because NOTICEs were unintentionally disabled at this point. assign_display is also required to operate without NOTICEs. The respective code has been added around its callee as well. However no handling of exceptions takes place there. If another test checking for errors in that function is ever added similar catch logic will have to be added there. PHPBB3-9701 --- tests/template/template.php | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/tests/template/template.php b/tests/template/template.php index 145fe8de61..024d3712f7 100644 --- a/tests/template/template.php +++ b/tests/template/template.php @@ -26,12 +26,24 @@ class phpbb_template_template_test extends phpbb_test_case error_reporting($error_level & ~E_NOTICE); ob_start(); - $this->assertTrue($this->template->display($handle, false)); + + try + { + $this->assertTrue($this->template->display($handle, false)); + } + catch (Exception $exception) + { + // reset the error level even when an error occured + // PHPUnit turns trigger_error into exceptions as well + error_reporting($error_level); + throw $exception; + } + + $result = self::trim_template_result(ob_get_clean()); // reset error level error_reporting($error_level); - - return self::trim_template_result(ob_get_clean()); + return $result; } private static function trim_template_result($result) @@ -368,9 +380,15 @@ class phpbb_template_template_test extends phpbb_test_case $this->template->destroy_block_vars($block); } + $error_level = error_reporting(); + error_reporting($error_level & ~E_NOTICE); + $this->assertEquals($expected, self::trim_template_result($this->template->assign_display('test')), "Testing assign_display($file)"); $this->template->assign_display('test', 'VARIABLE', false); + + error_reporting($error_level); + $this->assertEquals($expected, $this->display('container'), "Testing assign_display($file)"); } From ed44235d26180c539eaf7af5e5b15c7fcb96ce45 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 27 Jun 2010 21:07:38 +0200 Subject: [PATCH 230/393] [ticket/9534] Adding support for IPv6 addresses in user_ipwhois(). whois.arin.net does currently not refer to other servers (using ReferralServer) when queried for an IPv6 address. whois.sixxs.net however works in this case. This also adds '.' to the hostname to make sure we're querying the dns root. PHPBB3-9534 --- phpBB/includes/functions_user.php | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 6f6d7526b7..c2ea8445d1 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1235,16 +1235,29 @@ function user_unban($mode, $ban) */ function user_ipwhois($ip) { - $ipwhois = ''; - - // Check IP - // Only supporting IPv4 at the moment... - if (empty($ip) || !preg_match(get_preg_expression('ipv4'), $ip)) + if (empty($ip)) { return ''; } - if (($fsk = @fsockopen('whois.arin.net', 43))) + if (preg_match(get_preg_expression('ipv4'), $ip)) + { + // IPv4 address + $whois_host = 'whois.arin.net.'; + } + else if (preg_match(get_preg_expression('ipv6'), $ip)) + { + // IPv6 address + $whois_host = 'whois.sixxs.net.'; + } + else + { + return ''; + } + + $ipwhois = ''; + + if (($fsk = @fsockopen($whois_host, 43))) { // CRLF as per RFC3912 fputs($fsk, "$ip\r\n"); @@ -1257,7 +1270,7 @@ function user_ipwhois($ip) $match = array(); - // Test for referrals from ARIN to other whois databases, roll on rwhois + // Test for referrals from $whois_host to other whois databases, roll on rwhois if (preg_match('#ReferralServer: whois://(.+)#im', $ipwhois, $match)) { if (strpos($match[1], ':') !== false) @@ -1285,7 +1298,7 @@ function user_ipwhois($ip) @fclose($fsk); } - // Use the result from ARIN if we don't get any result here + // Use the result from $whois_host if we don't get any result here $ipwhois = (empty($buffer)) ? $ipwhois : $buffer; } From c0183cabd09994839170238fd5e2a87f1b48880b Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 27 Jun 2010 21:25:43 +0200 Subject: [PATCH 231/393] [ticket/9534] Update function documentation for user_ipwhois(). PHPBB3-9534 --- phpBB/includes/functions_user.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index c2ea8445d1..467668d3ee 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1229,9 +1229,13 @@ function user_unban($mode, $ban) } /** -* Whois facility +* Internet Protocol Address Whois +* RFC3912: WHOIS Protocol Specification * -* @link http://tools.ietf.org/html/rfc3912 RFC3912: WHOIS Protocol Specification +* @param string $ip Ip address, either IPv4 or IPv6. +* +* @return string Empty string if not a valid ip address. +* Otherwise make_clickable()'ed whois result. */ function user_ipwhois($ip) { From c40b2c76015094283aa87f6b3c6ddea283bf3e42 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Sun, 30 May 2010 12:24:56 -0500 Subject: [PATCH 232/393] [ticket/9629] Allow style.php to retrieve its session ID from cookies style.php takes a session ID to ensure it gets the right language for a user, but that session ID is always passed in GET. This allows change allows the SID to be read from the cookie, and theoretically makes it friendlier for caching engines like Varnish. PHPBB3-9629 --- phpBB/includes/functions.php | 2 +- phpBB/style.php | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 3f097f171f..9c74a524ee 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4318,7 +4318,7 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 'T_ICONS_PATH' => "{$web_path}{$config['icons_path']}/", 'T_RANKS_PATH' => "{$web_path}{$config['ranks_path']}/", 'T_UPLOAD_PATH' => "{$web_path}{$config['upload_path']}/", - 'T_STYLESHEET_LINK' => (!$user->theme['theme_storedb']) ? "{$web_path}styles/" . $user->theme['theme_path'] . '/theme/stylesheet.css' : append_sid("{$phpbb_root_path}style.$phpEx", 'id=' . $user->theme['style_id'] . '&lang=' . $user->data['user_lang'], true, $user->session_id), + 'T_STYLESHEET_LINK' => (!$user->theme['theme_storedb']) ? "{$web_path}styles/" . $user->theme['theme_path'] . '/theme/stylesheet.css' : append_sid("{$phpbb_root_path}style.$phpEx", 'id=' . $user->theme['style_id'] . '&lang=' . $user->data['user_lang']), 'T_STYLESHEET_NAME' => $user->theme['theme_name'], 'T_THEME_NAME' => $user->theme['theme_path'], diff --git a/phpBB/style.php b/phpBB/style.php index fa77815670..8ca1751391 100644 --- a/phpBB/style.php +++ b/phpBB/style.php @@ -45,15 +45,8 @@ if (!empty($load_extensions) && function_exists('dl')) } } - -$sid = (isset($_GET['sid']) && !is_array($_GET['sid'])) ? htmlspecialchars($_GET['sid']) : ''; $id = (isset($_GET['id'])) ? intval($_GET['id']) : 0; -if (strspn($sid, 'abcdefABCDEF0123456789') !== strlen($sid)) -{ - $sid = ''; -} - // This is a simple script to grab and output the requested CSS data stored in the DB // We include a session_id check to try and limit 3rd party linking ... unless they // happen to have a current session it will output nothing. We will also cache the @@ -81,6 +74,20 @@ if ($id) $config = $cache->obtain_config(); $user = false; + // try to get a session ID from REQUEST array + $sid = request_var('sid', ''); + + if (!$sid) + { + // if that failed, then look in the cookies + $sid = request_var($config['cookie_name'] . '_sid', '', false, true); + } + + if (strspn($sid, 'abcdefABCDEF0123456789') !== strlen($sid)) + { + $sid = ''; + } + if ($sid) { $sql = 'SELECT u.user_id, u.user_lang From 9c61455d264d92194f66549d244ec68cdb3c9ead Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Sun, 6 Jun 2010 08:42:27 -0500 Subject: [PATCH 233/393] [ticket/9637] Do not cache SQL server version in all cases Because the existing cache is global, there is no way to differentiate between each of two databases which may be two different DBAL objects pointing to servers with wildly different versions of an RDBMS. phpBB only has this situation in the UCF, thus only one file changed outside the DBAL. I have added a second optional parameter, $use_cache to each of the implementations of dbal::sql_server_info() PHPBB3-9637 --- phpBB/includes/db/firebird.php | 11 ++++++++++- phpBB/includes/db/mssql.php | 7 ++++--- phpBB/includes/db/mssql_odbc.php | 7 ++++--- phpBB/includes/db/mssqlnative.php | 7 ++++--- phpBB/includes/db/mysql.php | 7 ++++--- phpBB/includes/db/mysqli.php | 8 ++++---- phpBB/includes/db/oracle.php | 10 +++++++++- phpBB/includes/db/postgres.php | 7 ++++--- phpBB/includes/db/sqlite.php | 11 ++++++++--- phpBB/install/install_convert.php | 2 +- 10 files changed, 52 insertions(+), 25 deletions(-) diff --git a/phpBB/includes/db/firebird.php b/phpBB/includes/db/firebird.php index e554b0f2fb..6f60dd5dad 100644 --- a/phpBB/includes/db/firebird.php +++ b/phpBB/includes/db/firebird.php @@ -63,10 +63,19 @@ class dbal_firebird extends dbal /** * Version information about used database * @param bool $raw if true, only return the fetched sql_server_version + * @param bool $use_cache forced to false for Interbase * @return string sql server version */ - function sql_server_info($raw = false) + function sql_server_info($raw = false, $use_cache = true) { + /** + * force $use_cache false. I didn't research why the caching code there is no caching code + * but I assume its because the IB extension provides a direct method to access it + * without a query. + */ + + $use_cache = false; + if ($this->service_handle !== false && function_exists('ibase_server_info')) { return @ibase_server_info($this->service_handle, IBASE_SVC_SERVER_VERSION); diff --git a/phpBB/includes/db/mssql.php b/phpBB/includes/db/mssql.php index 7134574691..6899a73902 100644 --- a/phpBB/includes/db/mssql.php +++ b/phpBB/includes/db/mssql.php @@ -65,13 +65,14 @@ class dbal_mssql extends dbal /** * Version information about used database * @param bool $raw if true, only return the fetched sql_server_version + * @param bool $use_cache If true, it is safe to retrieve the value from the cache * @return string sql server version */ - function sql_server_info($raw = false) + function sql_server_info($raw = false, $use_cache = true) { global $cache; - if (empty($cache) || ($this->sql_server_version = $cache->get('mssql_version')) === false) + if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('mssql_version')) === false) { $result_id = @mssql_query("SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY('productlevel'), SERVERPROPERTY('edition')", $this->db_connect_id); @@ -84,7 +85,7 @@ class dbal_mssql extends dbal $this->sql_server_version = ($row) ? trim(implode(' ', $row)) : 0; - if (!empty($cache)) + if (!empty($cache) && $use_cache) { $cache->put('mssql_version', $this->sql_server_version); } diff --git a/phpBB/includes/db/mssql_odbc.php b/phpBB/includes/db/mssql_odbc.php index 14c4831010..75a080b1b7 100644 --- a/phpBB/includes/db/mssql_odbc.php +++ b/phpBB/includes/db/mssql_odbc.php @@ -76,13 +76,14 @@ class dbal_mssql_odbc extends dbal /** * Version information about used database * @param bool $raw if true, only return the fetched sql_server_version + * @param bool $use_cache If true, it is safe to retrieve the value from the cache * @return string sql server version */ - function sql_server_info($raw = false) + function sql_server_info($raw = false, $use_cache = true) { global $cache; - if (empty($cache) || ($this->sql_server_version = $cache->get('mssqlodbc_version')) === false) + if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('mssqlodbc_version')) === false) { $result_id = @odbc_exec($this->db_connect_id, "SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY('productlevel'), SERVERPROPERTY('edition')"); @@ -95,7 +96,7 @@ class dbal_mssql_odbc extends dbal $this->sql_server_version = ($row) ? trim(implode(' ', $row)) : 0; - if (!empty($cache)) + if (!empty($cache) && $use_cache) { $cache->put('mssqlodbc_version', $this->sql_server_version); } diff --git a/phpBB/includes/db/mssqlnative.php b/phpBB/includes/db/mssqlnative.php index 08ee70907c..98e22d4412 100644 --- a/phpBB/includes/db/mssqlnative.php +++ b/phpBB/includes/db/mssqlnative.php @@ -232,18 +232,19 @@ class dbal_mssqlnative extends dbal /** * Version information about used database * @param bool $raw if true, only return the fetched sql_server_version + * @param bool $use_cache If true, it is safe to retrieve the value from the cache * @return string sql server version */ - function sql_server_info($raw = false) + function sql_server_info($raw = false, $use_cache = true) { global $cache; - if (empty($cache) || ($this->sql_server_version = $cache->get('mssql_version')) === false) + if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('mssql_version')) === false) { $arr_server_info = sqlsrv_server_info($this->db_connect_id); $this->sql_server_version = $arr_server_info['SQLServerVersion']; - if (!empty($cache)) + if (!empty($cache) && $use_cache) { $cache->put('mssql_version', $this->sql_server_version); } diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php index 0487dfa6d2..1e24c79577 100644 --- a/phpBB/includes/db/mysql.php +++ b/phpBB/includes/db/mysql.php @@ -96,13 +96,14 @@ class dbal_mysql extends dbal /** * Version information about used database * @param bool $raw if true, only return the fetched sql_server_version + * @param bool $use_cache If true, it is safe to retrieve the value from the cache * @return string sql server version */ - function sql_server_info($raw = false) + function sql_server_info($raw = false, $use_cache = true) { global $cache; - if (empty($cache) || ($this->sql_server_version = $cache->get('mysql_version')) === false) + if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('mysql_version')) === false) { $result = @mysql_query('SELECT VERSION() AS version', $this->db_connect_id); $row = @mysql_fetch_assoc($result); @@ -110,7 +111,7 @@ class dbal_mysql extends dbal $this->sql_server_version = $row['version']; - if (!empty($cache)) + if (!empty($cache) && $use_cache) { $cache->put('mysql_version', $this->sql_server_version); } diff --git a/phpBB/includes/db/mysqli.php b/phpBB/includes/db/mysqli.php index f0e58fd148..862d62f4ba 100644 --- a/phpBB/includes/db/mysqli.php +++ b/phpBB/includes/db/mysqli.php @@ -80,14 +80,14 @@ class dbal_mysqli extends dbal /** * Version information about used database - * @param bool $raw if true, only return the fetched sql_server_version + * @param bool $use_cache If true, it is safe to retrieve the value from the cache * @return string sql server version */ - function sql_server_info($raw = false) + function sql_server_info($raw = false, $use_cache = true) { global $cache; - if (empty($cache) || ($this->sql_server_version = $cache->get('mysqli_version')) === false) + if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('mysqli_version')) === false) { $result = @mysqli_query($this->db_connect_id, 'SELECT VERSION() AS version'); $row = @mysqli_fetch_assoc($result); @@ -95,7 +95,7 @@ class dbal_mysqli extends dbal $this->sql_server_version = $row['version']; - if (!empty($cache)) + if (!empty($cache) && $use_cache) { $cache->put('mysqli_version', $this->sql_server_version); } diff --git a/phpBB/includes/db/oracle.php b/phpBB/includes/db/oracle.php index 55b3599800..25df029ea3 100644 --- a/phpBB/includes/db/oracle.php +++ b/phpBB/includes/db/oracle.php @@ -56,10 +56,18 @@ class dbal_oracle extends dbal /** * Version information about used database * @param bool $raw if true, only return the fetched sql_server_version + * @param bool $use_cache forced to false for Oracle * @return string sql server version */ - function sql_server_info($raw = false) + function sql_server_info($raw = false, $use_cache = true) { + /** + * force $use_cache false. I didn't research why the caching code below is commented out + * but I assume its because the Oracle extension provides a direct method to access it + * without a query. + */ + + $use_cache = false; /* global $cache; diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php index b3139b3d79..079419ff20 100644 --- a/phpBB/includes/db/postgres.php +++ b/phpBB/includes/db/postgres.php @@ -105,13 +105,14 @@ class dbal_postgres extends dbal /** * Version information about used database * @param bool $raw if true, only return the fetched sql_server_version + * @param bool $use_cache If true, it is safe to retrieve the value from the cache * @return string sql server version */ - function sql_server_info($raw = false) + function sql_server_info($raw = false, $use_cache = true) { global $cache; - if (empty($cache) || ($this->sql_server_version = $cache->get('pgsql_version')) === false) + if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('pgsql_version')) === false) { $query_id = @pg_query($this->db_connect_id, 'SELECT VERSION() AS version'); $row = @pg_fetch_assoc($query_id, null); @@ -119,7 +120,7 @@ class dbal_postgres extends dbal $this->sql_server_version = (!empty($row['version'])) ? trim(substr($row['version'], 10)) : 0; - if (!empty($cache)) + if (!empty($cache) && $use_cache) { $cache->put('pgsql_version', $this->sql_server_version); } diff --git a/phpBB/includes/db/sqlite.php b/phpBB/includes/db/sqlite.php index 288f6e0992..8de72fd394 100644 --- a/phpBB/includes/db/sqlite.php +++ b/phpBB/includes/db/sqlite.php @@ -50,19 +50,24 @@ class dbal_sqlite extends dbal /** * Version information about used database * @param bool $raw if true, only return the fetched sql_server_version + * @param bool $use_cache if true, it is safe to retrieve the stored value from the cache * @return string sql server version */ - function sql_server_info($raw = false) + function sql_server_info($raw = false, $use_cache = true) { global $cache; - if (empty($cache) || ($this->sql_server_version = $cache->get('sqlite_version')) === false) + if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('sqlite_version')) === false) { $result = @sqlite_query('SELECT sqlite_version() AS version', $this->db_connect_id); $row = @sqlite_fetch_array($result, SQLITE_ASSOC); $this->sql_server_version = (!empty($row['version'])) ? $row['version'] : 0; - $cache->put('sqlite_version', $this->sql_server_version); + + if (!empty($cache) && $use_cache) + { + $cache->put('sqlite_version', $this->sql_server_version); + } } return ($raw) ? $this->sql_server_version : 'SQLite ' . $this->sql_server_version; diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php index 06c3a8b4a6..8c3ffd61a8 100644 --- a/phpBB/install/install_convert.php +++ b/phpBB/install/install_convert.php @@ -685,7 +685,7 @@ class install_convert extends module // Thanks MySQL, for silently converting... case 'mysql': case 'mysql4': - if (version_compare($src_db->sql_server_info(true), '4.1.3', '>=')) + if (version_compare($src_db->sql_server_info(true, false), '4.1.3', '>=')) { $convert->mysql_convert = true; } From b939ce5940688430adb5fb54dda00e971b4eec49 Mon Sep 17 00:00:00 2001 From: Adam Reyher Date: Sun, 2 May 2010 23:07:44 -0400 Subject: [PATCH 234/393] [ticket/9012] Adjust shadow topic title to the title at the time it was moved. Moved topics which have their title changed in the new forum will now show the old title in the original viewforum instead of the new title. PHPBB3-9012 --- phpBB/viewforum.php | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index d18508ccbc..5f33b7565f 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -508,6 +508,7 @@ if (sizeof($shadow_topic_list)) 'topic_moved_id' => $rowset[$orig_topic_id]['topic_moved_id'], 'topic_status' => $rowset[$orig_topic_id]['topic_status'], 'topic_type' => $rowset[$orig_topic_id]['topic_type'], + 'topic_title' => $rowset[$orig_topic_id]['topic_title'], )); // Shadow topics are never reported From 5d9948e39c4add6c16d81699d91433d3805f2db9 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 18 May 2010 17:27:21 +0200 Subject: [PATCH 235/393] [ticket/9531] BBCode-less quotes fallback-option is missing "Author wrote:" When quoting from the topic-review the statement "Author wrote:" is missing. The fix for this was not complete: Now it's backwards compatibile and uses the LA_ for the language variables. PHPBB3-9531 --- phpBB/styles/prosilver/template/editor.js | 6 ++++++ phpBB/styles/prosilver/template/posting_topic_review.html | 2 +- phpBB/styles/prosilver/template/ucp_pm_history.html | 2 +- phpBB/styles/subsilver2/template/editor.js | 6 ++++++ phpBB/styles/subsilver2/template/posting_topic_review.html | 2 +- phpBB/styles/subsilver2/template/ucp_pm_history.html | 2 +- 6 files changed, 16 insertions(+), 4 deletions(-) diff --git a/phpBB/styles/prosilver/template/editor.js b/phpBB/styles/prosilver/template/editor.js index c4c3483766..ddc862bb8c 100644 --- a/phpBB/styles/prosilver/template/editor.js +++ b/phpBB/styles/prosilver/template/editor.js @@ -200,6 +200,12 @@ function addquote(post_id, username, l_wrote) var theSelection = ''; var divarea = false; + if (l_wrote === undefined) + { + // Backwards compatibility + l_wrote = 'wrote'; + } + if (document.all) { divarea = document.all[message_name]; diff --git a/phpBB/styles/prosilver/template/posting_topic_review.html b/phpBB/styles/prosilver/template/posting_topic_review.html index 879e6bb7fc..a05f057e21 100644 --- a/phpBB/styles/prosilver/template/posting_topic_review.html +++ b/phpBB/styles/prosilver/template/posting_topic_review.html @@ -24,7 +24,7 @@
            diff --git a/phpBB/styles/prosilver/template/ucp_pm_history.html b/phpBB/styles/prosilver/template/ucp_pm_history.html index 32b8072082..c555e90640 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_history.html +++ b/phpBB/styles/prosilver/template/ucp_pm_history.html @@ -17,7 +17,7 @@
            diff --git a/phpBB/styles/subsilver2/template/editor.js b/phpBB/styles/subsilver2/template/editor.js index 54bd3450d0..e340bc74b5 100644 --- a/phpBB/styles/subsilver2/template/editor.js +++ b/phpBB/styles/subsilver2/template/editor.js @@ -202,6 +202,12 @@ function addquote(post_id, username, l_wrote) var theSelection = ''; var divarea = false; + if (l_wrote === undefined) + { + // Backwards compatibility + l_wrote = 'wrote'; + } + if (document.all) { divarea = document.all[message_name]; diff --git a/phpBB/styles/subsilver2/template/posting_topic_review.html b/phpBB/styles/subsilver2/template/posting_topic_review.html index 5456ad09b6..54bbf6e553 100644 --- a/phpBB/styles/subsilver2/template/posting_topic_review.html +++ b/phpBB/styles/subsilver2/template/posting_topic_review.html @@ -36,7 +36,7 @@
            - +
            {L_SIGNATURE_PREVIEW}
              {L_POST_SUBJECT}:  {topic_review_row.POST_SUBJECT} {QUOTE_IMG} {QUOTE_IMG}
            diff --git a/phpBB/styles/subsilver2/template/ucp_pm_history.html b/phpBB/styles/subsilver2/template/ucp_pm_history.html index d11822cc39..53391b30c9 100644 --- a/phpBB/styles/subsilver2/template/ucp_pm_history.html +++ b/phpBB/styles/subsilver2/template/ucp_pm_history.html @@ -59,7 +59,7 @@ {L_VIEW_PM} - + From a0b9f7806a6c3b08dd2c7e9cccfc7f742e42be1d Mon Sep 17 00:00:00 2001 From: Cullen Walsh Date: Sun, 11 Jul 2010 15:18:21 -0700 Subject: [PATCH 236/393] [ticket/9715] Extend email unit tests Adding more email tests for a wider range of valid email formats. PHPBB3-9715 --- tests/regex/email.php | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/tests/regex/email.php b/tests/regex/email.php index b1519dfa5f..8658b8af36 100644 --- a/tests/regex/email.php +++ b/tests/regex/email.php @@ -33,6 +33,27 @@ class phpbb_regex_email_test extends phpbb_test_case //array('"John Doe"@example.com'), //array('Alice@[192.168.2.1]'), // IPv4 //array('Bob@[2001:0db8:85a3:08d3:1319:8a2e:0370:7344]'), // IPv6 + + // http://fightingforalostcause.net/misc/2006/compare-email-regex.php + array('l3tt3rsAndNumb3rs@domain.com'), + array('has-dash@domain.com'), + array('hasApostrophe.o\'leary@domain.org'), + array('uncommonTLD@domain.museum'), + array('uncommonTLD@domain.travel'), + array('uncommonTLD@domain.mobi'), + array('countryCodeTLD@domain.uk'), + array('countryCodeTLD@domain.rw'), + array('numbersInDomain@911.com'), + array('underscore_inLocal@domain.net'), + array('IPInsteadOfDomain@127.0.0.1'), + array('IPAndPort@127.0.0.1:25'), + array('subdomain@sub.domain.com'), + array('local@dash-inDomain.com'), + array('dot.inLocal@foo.com'), + array('a@singleLetterLocal.org'), + array('singleLetterDomain@x.org'), + array('&*=?^+{}\'~@validCharsInLocal.net'), + array('foor@bar.newTLD'), ); } @@ -56,6 +77,26 @@ class phpbb_regex_email_test extends phpbb_test_case array('abc,def@example.com'), // invalid character , array('abcdef@example.com'), // invalid character > + + // http://fightingforalostcause.net/misc/2006/compare-email-regex.php + array('missingDomain@.com'), + array('@missingLocal.org'), + array('missingatSign.net'), + array('missingDot@com'), + array('two@@signs.com'), + array('colonButNoPort@127.0.0.1:'), + array(''), + array('someone-else@127.0.0.1.26'), + array('.localStartsWithDot@domain.com'), + array('localEndsWithDot.@domain.com'), + array('two..consecutiveDots@domain.com'), + array('domainStartsWithDash@-domain.com'), + array('domainEndsWithDash@domain-.com'), + array('numbersInTLD@domain.c0m'), + array('missingTLD@domain.'), + array('! "#$%(),/;<>[]`|@invalidCharsInLocal.org'), + array('invalidCharsInDomain@! "#$%(),/;<>_[]`|.org'), + array('local@SecondLevelDomainNamesAreInvalidIfTheyAreLongerThan64Charactersss.org'), ); } @@ -70,7 +111,7 @@ class phpbb_regex_email_test extends phpbb_test_case /** * @dataProvider negative_match_data */ - public function test_negative_match($address) + public function test_negative_match($email) { $this->assertEquals(0, preg_match($this->regex, $email)); } From 593e193bdc7bab20ec8460348b2fe597355dccda Mon Sep 17 00:00:00 2001 From: Cullen Walsh Date: Sun, 11 Jul 2010 15:35:31 -0700 Subject: [PATCH 237/393] [ticket/9715] Better email regex Using email regex created by James Watts and Francisco Jose Martin Moreno. This passes many more tests for RFC valid emails. PHPBB3-9715 --- phpBB/includes/functions.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 9c74a524ee..bc3d721de5 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3355,7 +3355,9 @@ function get_preg_expression($mode) switch ($mode) { case 'email': - return '(?:[a-z0-9\'\.\-_\+\|]++|&)+@[a-z0-9\-]+\.(?:[a-z0-9\-]+\.)*[a-z]+'; + // Regex written by James Watts and Francisco Jose Martin Moreno + // http://fightingforalostcause.net/misc/2006/compare-email-regex.php + return '([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*(?:[\w\!\#$\%\'\*\+\-\/\=\?\^\`{\|\}\~]|&)+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)'; break; case 'bbcode_htm': From 2ba6360e439386a8e56d93a88ecaefb3c0f5904c Mon Sep 17 00:00:00 2001 From: Gabriel Vazquez Date: Tue, 6 Jul 2010 12:03:02 +0200 Subject: [PATCH 238/393] [ticket/9140] Check current board version in incremental update packages Since we do not want to limit the updater functionality we only display a prominent warning when the current board version does not match the version the update files are meant to update from. PHPBB3-9140 --- phpBB/install/install_update.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index e717fe3dd4..6184cbbc33 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -192,6 +192,17 @@ class install_update extends module return; } + // Check if the update files are actually meant to update from the current version + if ($config['version'] != $this->update_info['version']['from']) + { + $this->unequal_version = true; + + $template->assign_vars(array( + 'S_ERROR' => true, + 'ERROR_MSG' => sprintf($user->lang['INCOMPATIBLE_UPDATE_FILES'], $config['version'], $this->update_info['version']['from'], $this->update_info['version']['to']), + )); + } + // Check if the update files stored are for the latest version... if ($this->latest_version != $this->update_info['version']['to']) { From f0509e4620643549caa7a486d54b12d53617ab94 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Tue, 22 Jun 2010 14:42:02 +0200 Subject: [PATCH 239/393] [task/git-tools] append ticket id to git log message PHPBB3-9770 --- git-tools/hooks/prepare-commit-msg | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/git-tools/hooks/prepare-commit-msg b/git-tools/hooks/prepare-commit-msg index 033cb187c7..ab01f49b5a 100755 --- a/git-tools/hooks/prepare-commit-msg +++ b/git-tools/hooks/prepare-commit-msg @@ -32,3 +32,10 @@ if [ "$2" = "" ] then echo "[$branch] $(cat "$1")" > "$1" fi + +if (echo $branch | grep '^ticket/') +then + ticket_id="$(echo $branch | sed "s/ticket\///g")" + echo >> "$1" + echo "PHPBB3-$ticket_id" >> "$1" +fi From 6b2f4b6a850493fa0277ae38ee816d7c5a3a2311 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Tue, 22 Jun 2010 16:42:29 +0200 Subject: [PATCH 240/393] [task/git-tools] move ticket id appending to commit-msg hook PHPBB3-9770 --- git-tools/hooks/commit-msg | 24 ++++++++++++++++++++++++ git-tools/hooks/prepare-commit-msg | 7 ------- 2 files changed, 24 insertions(+), 7 deletions(-) create mode 100755 git-tools/hooks/commit-msg diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg new file mode 100755 index 0000000000..db31d93698 --- /dev/null +++ b/git-tools/hooks/commit-msg @@ -0,0 +1,24 @@ +#!/bin/sh +# +# A hook to append PHPBB3- to ticket/ +# branches. +# +# This is a commit-msg hook. +# +# To install this you can either copy or symlink it to +# $GIT_DIR/hooks, example: +# +# ln -s ../../git-tools/hooks/commit-msg \\ +# .git/hooks/commit-msg + +if grep '^\[ticket/' "$1" +then + # get branch name + branch="$(git symbolic-ref HEAD)" + + # strip off refs/heads/ticket + ticket_id="$(echo "$branch" | sed "s/refs\/heads\/ticket\///g")" + + echo >> "$1" + echo "PHPBB3-$ticket_id" >> "$1" +fi diff --git a/git-tools/hooks/prepare-commit-msg b/git-tools/hooks/prepare-commit-msg index ab01f49b5a..033cb187c7 100755 --- a/git-tools/hooks/prepare-commit-msg +++ b/git-tools/hooks/prepare-commit-msg @@ -32,10 +32,3 @@ if [ "$2" = "" ] then echo "[$branch] $(cat "$1")" > "$1" fi - -if (echo $branch | grep '^ticket/') -then - ticket_id="$(echo $branch | sed "s/ticket\///g")" - echo >> "$1" - echo "PHPBB3-$ticket_id" >> "$1" -fi From 14e5da90c3d84cb089e1df4d7a0ac7a34a0fbeba Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sat, 26 Jun 2010 13:38:50 +0200 Subject: [PATCH 241/393] [task/git-tools] add install and uninstall scripts for hooks PHPBB3-9769 --- git-tools/hooks/install | 17 +++++++++++++++++ git-tools/hooks/uninstall | 16 ++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100755 git-tools/hooks/install create mode 100755 git-tools/hooks/uninstall diff --git a/git-tools/hooks/install b/git-tools/hooks/install new file mode 100755 index 0000000000..a42c55a769 --- /dev/null +++ b/git-tools/hooks/install @@ -0,0 +1,17 @@ +#!/bin/sh +# +# Script to install the git hooks +# by symlinking them into the .git/hooks directory +# +# Usage (from within git-tools/hooks): +# ./install + +dir=$(dirname $0) + +for file in $(ls $dir) +do + if [ $file != "install" ] && [ $file != "uninstall" ] + then + ln -s "../../git-tools/hooks/$file" "$dir/../../.git/hooks/$file" + fi +done diff --git a/git-tools/hooks/uninstall b/git-tools/hooks/uninstall new file mode 100755 index 0000000000..1b3b7fd2c9 --- /dev/null +++ b/git-tools/hooks/uninstall @@ -0,0 +1,16 @@ +#!/bin/sh +# +# Script to uninstall the git hooks +# +# Usage (from within git-tools/hooks): +# ./uninstall + +dir=$(dirname $0) + +for file in $(ls $dir) +do + if [ $file != "install" ] && [ $file != "uninstall" ] + then + rm -f "$dir/../../.git/hooks/$file" + fi +done From 54713dcdc7abc897fa16209c837c2181eb89ad9c Mon Sep 17 00:00:00 2001 From: Patrick W Date: Mon, 12 Jul 2010 02:04:29 +0100 Subject: [PATCH 242/393] [ticket/9761] Reworded quote nesting depth ACP option to match the behaviour The nesting depth applies per quote block, not per post which the previous label and description indicated. PHPBB3-9761 --- phpBB/language/en/acp/board.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 8b12a926b0..ac0ddf1b73 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -177,8 +177,8 @@ $lang = array_merge($lang, array( 'MIN_CHAR_LIMIT_EXPLAIN' => 'The minimum number of characters the user need to enter within a post/private message.', 'POSTING' => 'Posting', 'POSTS_PER_PAGE' => 'Posts per page', - 'QUOTE_DEPTH_LIMIT' => 'Maximum nested quotes per post', - 'QUOTE_DEPTH_LIMIT_EXPLAIN' => 'Maximum number of nested quotes in a post. Set to 0 for unlimited depth.', + 'QUOTE_DEPTH_LIMIT' => 'Maximum nesting depth for quotes', + 'QUOTE_DEPTH_LIMIT_EXPLAIN' => 'Maximum quote nesting depth in a post. Set to 0 for unlimited depth.', 'SMILIES_LIMIT' => 'Maximum smilies per post', 'SMILIES_LIMIT_EXPLAIN' => 'Maximum number of smilies in a post. Set to 0 for unlimited smilies.', 'SMILIES_PER_PAGE' => 'Smilies per page', From 954b3c348454ee41eb8da189794ac34ffdd4a115 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 2 Jul 2010 09:08:46 +0200 Subject: [PATCH 243/393] [ticket/7720] Fix alternative image-description for unread posts. Changed the wrong word "new" to "unread" as that is, what we show with the red-icons, not whether the post is new or not. Language variables were kept for backwards compatibility. PHPBB3-7720 --- phpBB/includes/functions_display.php | 6 +-- phpBB/includes/mcp/mcp_post.php | 2 +- phpBB/includes/mcp/mcp_queue.php | 2 +- phpBB/includes/mcp/mcp_reports.php | 2 +- phpBB/includes/mcp/mcp_topic.php | 2 +- phpBB/includes/ucp/ucp_main.php | 4 +- phpBB/index.php | 8 ++-- phpBB/language/en/acp/styles.php | 44 +++++++++---------- phpBB/language/en/common.php | 9 ++-- phpBB/language/en/viewforum.php | 13 ++++-- .../subsilver2/template/index_body.html | 6 +-- .../subsilver2/template/viewforum_body.html | 18 ++++---- phpBB/viewforum.php | 16 +++---- phpBB/viewtopic.php | 2 +- 14 files changed, 71 insertions(+), 63 deletions(-) diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 5e6239b070..2de7e1b169 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -396,7 +396,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod } else { - $folder_alt = ($forum_unread) ? 'NEW_POSTS' : 'NO_NEW_POSTS'; + $folder_alt = ($forum_unread) ? 'UNREAD_POSTS' : 'NO_UNREAD_POSTS'; } // Create last post link information, if appropriate @@ -425,7 +425,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $s_subforums_list = array(); foreach ($subforums_list as $subforum) { - $s_subforums_list[] = '' . $subforum['name'] . ''; + $s_subforums_list[] = '' . $subforum['name'] . ''; } $s_subforums_list = (string) implode(', ', $s_subforums_list); $catless = ($row['parent_id'] == $root_data['forum_id']) ? true : false; @@ -854,7 +854,7 @@ function topic_status(&$topic_row, $replies, $unread_topic, &$folder_img, &$fold $folder_img = ($unread_topic) ? $folder_new : $folder; - $folder_alt = ($unread_topic) ? 'NEW_POSTS' : (($topic_row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS'); + $folder_alt = ($unread_topic) ? 'UNREAD_POSTS' : (($topic_row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_UNREAD_POSTS'); // Posted image? if (!empty($topic_row['topic_posted']) && $topic_row['topic_posted']) diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index fa44e006dd..1fbedbac4f 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -200,7 +200,7 @@ function mcp_post_details($id, $mode, $action) 'U_VIEW_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']), 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']), - 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'), + 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'), 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '", ''), 'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], '', ''), diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 8d9ece5205..f84a8c5f07 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -196,7 +196,7 @@ class mcp_queue 'U_VIEW_POST' => $post_url, 'U_VIEW_TOPIC' => $topic_url, - 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'), + 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'), 'RETURN_QUEUE' => sprintf($user->lang['RETURN_QUEUE'], '", ''), 'RETURN_POST' => sprintf($user->lang['RETURN_POST'], '', ''), diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index e19fe96963..39d9fbd4af 100644 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -205,7 +205,7 @@ class mcp_reports 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']), 'EDIT_IMG' => $user->img('icon_post_edit', $user->lang['EDIT_POST']), - 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'), + 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'), 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', $user->lang['POST_UNAPPROVED']), 'RETURN_REPORTS' => sprintf($user->lang['RETURN_REPORTS'], '', ''), diff --git a/phpBB/includes/mcp/mcp_topic.php b/phpBB/includes/mcp/mcp_topic.php index 9779478330..76cd9beb92 100644 --- a/phpBB/includes/mcp/mcp_topic.php +++ b/phpBB/includes/mcp/mcp_topic.php @@ -237,7 +237,7 @@ function mcp_topic_view($id, $mode, $action) 'POST_ID' => $row['post_id'], 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '', ''), - 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'), + 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'), 'S_POST_REPORTED' => ($row['post_reported']) ? true : false, 'S_POST_UNAPPROVED' => ($row['post_approved']) ? false : true, diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index 6ac2412ef0..a6f71669ce 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -119,7 +119,7 @@ class ucp_main $unread_topic = (isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false; $folder_img = ($unread_topic) ? $folder_new : $folder; - $folder_alt = ($unread_topic) ? 'NEW_POSTS' : (($row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_NEW_POSTS'); + $folder_alt = ($unread_topic) ? 'UNREAD_POSTS' : (($row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_UNREAD_POSTS'); if ($row['topic_status'] == ITEM_LOCKED) { @@ -318,7 +318,7 @@ class ucp_main else { $folder_image = ($unread_forum) ? 'forum_unread' : 'forum_read'; - $folder_alt = ($unread_forum) ? 'NEW_POSTS' : 'NO_NEW_POSTS'; + $folder_alt = ($unread_forum) ? 'UNREAD_POSTS' : 'NO_UNREAD_POSTS'; } // Create last post link information, if appropriate diff --git a/phpBB/index.php b/phpBB/index.php index c3dbbd346e..cc83641acd 100644 --- a/phpBB/index.php +++ b/phpBB/index.php @@ -115,10 +115,10 @@ $template->assign_vars(array( 'LEGEND' => $legend, 'BIRTHDAY_LIST' => $birthday_list, - 'FORUM_IMG' => $user->img('forum_read', 'NO_NEW_POSTS'), - 'FORUM_NEW_IMG' => $user->img('forum_unread', 'NEW_POSTS'), - 'FORUM_LOCKED_IMG' => $user->img('forum_read_locked', 'NO_NEW_POSTS_LOCKED'), - 'FORUM_NEW_LOCKED_IMG' => $user->img('forum_unread_locked', 'NO_NEW_POSTS_LOCKED'), + 'FORUM_IMG' => $user->img('forum_read', 'NO_UNREAD_POSTS'), + 'FORUM_UNREAD_IMG' => $user->img('forum_unread', 'UNREAD_POSTS'), + 'FORUM_LOCKED_IMG' => $user->img('forum_read_locked', 'NO_UNREAD_POSTS_LOCKED'), + 'FORUM_UNREAD_LOCKED_IMG' => $user->img('forum_unread_locked', 'UNREAD_POSTS_LOCKED'), 'S_LOGIN_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'), 'S_DISPLAY_BIRTHDAY_LIST' => ($config['load_birthdays']) ? true : false, diff --git a/phpBB/language/en/acp/styles.php b/phpBB/language/en/acp/styles.php index 247d8a4140..951c69f915 100644 --- a/phpBB/language/en/acp/styles.php +++ b/phpBB/language/en/acp/styles.php @@ -165,11 +165,11 @@ $lang = array_merge($lang, array( 'IMG_FORUM_READ' => 'Forum', 'IMG_FORUM_READ_LOCKED' => 'Forum locked', 'IMG_FORUM_READ_SUBFORUM' => 'Subforum', - 'IMG_FORUM_UNREAD' => 'Forum new posts', - 'IMG_FORUM_UNREAD_LOCKED' => 'Forum new posts locked', - 'IMG_FORUM_UNREAD_SUBFORUM' => 'Subforum new posts', + 'IMG_FORUM_UNREAD' => 'Forum unread posts', + 'IMG_FORUM_UNREAD_LOCKED' => 'Forum unread posts locked', + 'IMG_FORUM_UNREAD_SUBFORUM' => 'Subforum unread posts', 'IMG_SUBFORUM_READ' => 'Legend subforum', - 'IMG_SUBFORUM_UNREAD' => 'Legend subforum new posts', + 'IMG_SUBFORUM_UNREAD' => 'Legend subforum unread posts', 'IMG_TOPIC_MOVED' => 'Topic moved', @@ -180,39 +180,39 @@ $lang = array_merge($lang, array( 'IMG_TOPIC_READ_LOCKED' => 'Topic locked', 'IMG_TOPIC_READ_LOCKED_MINE' => 'Topic locked posted to', - 'IMG_TOPIC_UNREAD' => 'Topic new posts', - 'IMG_TOPIC_UNREAD_MINE' => 'Topic posted to new', - 'IMG_TOPIC_UNREAD_HOT' => 'Topic popular new posts', - 'IMG_TOPIC_UNREAD_HOT_MINE' => 'Topic popular posted to new', - 'IMG_TOPIC_UNREAD_LOCKED' => 'Topic locked new', - 'IMG_TOPIC_UNREAD_LOCKED_MINE' => 'Topic locked posted to new', + 'IMG_TOPIC_UNREAD' => 'Topic unread posts', + 'IMG_TOPIC_UNREAD_MINE' => 'Topic posted to unread', + 'IMG_TOPIC_UNREAD_HOT' => 'Topic popular unread posts', + 'IMG_TOPIC_UNREAD_HOT_MINE' => 'Topic popular posted to unread', + 'IMG_TOPIC_UNREAD_LOCKED' => 'Topic locked unread', + 'IMG_TOPIC_UNREAD_LOCKED_MINE' => 'Topic locked posted to unread', 'IMG_STICKY_READ' => 'Sticky topic', 'IMG_STICKY_READ_MINE' => 'Sticky topic posted to', 'IMG_STICKY_READ_LOCKED' => 'Sticky topic locked', 'IMG_STICKY_READ_LOCKED_MINE' => 'Sticky topic locked posted to', - 'IMG_STICKY_UNREAD' => 'Sticky topic new posts', - 'IMG_STICKY_UNREAD_MINE' => 'Sticky topic posted to new', - 'IMG_STICKY_UNREAD_LOCKED' => 'Sticky topic locked new posts', - 'IMG_STICKY_UNREAD_LOCKED_MINE' => 'Sticky topic locked posted to new', + 'IMG_STICKY_UNREAD' => 'Sticky topic unread posts', + 'IMG_STICKY_UNREAD_MINE' => 'Sticky topic posted to unread', + 'IMG_STICKY_UNREAD_LOCKED' => 'Sticky topic locked unread posts', + 'IMG_STICKY_UNREAD_LOCKED_MINE' => 'Sticky topic locked posted to unread', 'IMG_ANNOUNCE_READ' => 'Announcement', 'IMG_ANNOUNCE_READ_MINE' => 'Announcement posted to', 'IMG_ANNOUNCE_READ_LOCKED' => 'Announcement locked', 'IMG_ANNOUNCE_READ_LOCKED_MINE' => 'Announcement locked posted to', - 'IMG_ANNOUNCE_UNREAD' => 'Announcement new posts', - 'IMG_ANNOUNCE_UNREAD_MINE' => 'Announcement posted to new', - 'IMG_ANNOUNCE_UNREAD_LOCKED' => 'Announcement locked new posts', - 'IMG_ANNOUNCE_UNREAD_LOCKED_MINE' => 'Announcement locked posted to new', + 'IMG_ANNOUNCE_UNREAD' => 'Announcement unread posts', + 'IMG_ANNOUNCE_UNREAD_MINE' => 'Announcement posted to unread', + 'IMG_ANNOUNCE_UNREAD_LOCKED' => 'Announcement locked unread posts', + 'IMG_ANNOUNCE_UNREAD_LOCKED_MINE' => 'Announcement locked posted to unread', 'IMG_GLOBAL_READ' => 'Global', 'IMG_GLOBAL_READ_MINE' => 'Global posted to', 'IMG_GLOBAL_READ_LOCKED' => 'Global locked', 'IMG_GLOBAL_READ_LOCKED_MINE' => 'Global locked posted to', - 'IMG_GLOBAL_UNREAD' => 'Global new posts', - 'IMG_GLOBAL_UNREAD_MINE' => 'Global posted to new', - 'IMG_GLOBAL_UNREAD_LOCKED' => 'Global locked new posts', - 'IMG_GLOBAL_UNREAD_LOCKED_MINE' => 'Global locked posted to new', + 'IMG_GLOBAL_UNREAD' => 'Global unread posts', + 'IMG_GLOBAL_UNREAD_MINE' => 'Global posted to unread', + 'IMG_GLOBAL_UNREAD_LOCKED' => 'Global locked unread posts', + 'IMG_GLOBAL_UNREAD_LOCKED_MINE' => 'Global locked posted to unread', 'IMG_PM_READ' => 'Read private message', 'IMG_PM_UNREAD' => 'Unread private message', diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index 03986c0361..bc38c1563d 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -347,8 +347,8 @@ $lang = array_merge($lang, array( 'NEW_MESSAGES' => 'New messages', 'NEW_PM' => '%d new message', 'NEW_PMS' => '%d new messages', - 'NEW_POST' => 'New post', - 'NEW_POSTS' => 'New posts', + 'NEW_POST' => 'New post', // Not used anymore + 'NEW_POSTS' => 'New posts', // Not used anymore 'NEXT' => 'Next', // Used in pagination 'NEXT_STEP' => 'Next', 'NEVER' => 'Never', @@ -381,7 +381,7 @@ $lang = array_merge($lang, array( 'NO_MODERATORS' => 'There are no moderators.', 'NO_NEW_MESSAGES' => 'No new messages', 'NO_NEW_PM' => '0 new messages', - 'NO_NEW_POSTS' => 'No new posts', + 'NO_NEW_POSTS' => 'No new posts', // Not used anymore 'NO_ONLINE_USERS' => 'No registered users', 'NO_POSTS' => 'No posts', 'NO_POSTS_TIME_FRAME' => 'No posts exist inside this topic for the selected time frame.', @@ -395,6 +395,7 @@ $lang = array_merge($lang, array( 'NO_TOPICS' => 'There are no topics or posts in this forum.', 'NO_TOPICS_TIME_FRAME' => 'No topics exist inside this forum for the selected time frame.', 'NO_UNREAD_PM' => '0 unread messages', + 'NO_UNREAD_POSTS' => 'No unread posts', 'NO_UPLOAD_FORM_FOUND' => 'Upload initiated but no valid file upload form found.', 'NO_USER' => 'The requested user does not exist.', 'NO_USERS' => 'The requested users do not exist.', @@ -641,6 +642,8 @@ $lang = array_merge($lang, array( 'UNREAD_MESSAGES' => 'Unread messages', 'UNREAD_PM' => '%d unread message', 'UNREAD_PMS' => '%d unread messages', + 'UNREAD_POST' => 'Unread post', + 'UNREAD_POSTS' => 'Unread posts', 'UNWATCHED_FORUMS' => 'You are no longer subscribed to the selected forums.', 'UNWATCHED_TOPICS' => 'You are no longer subscribed to the selected topics.', 'UNWATCHED_FORUMS_TOPICS' => 'You are no longer subscribed to the selected entries.', diff --git a/phpBB/language/en/viewforum.php b/phpBB/language/en/viewforum.php index 546f91587d..d2fae20c62 100644 --- a/phpBB/language/en/viewforum.php +++ b/phpBB/language/en/viewforum.php @@ -48,16 +48,21 @@ $lang = array_merge($lang, array( 'MARK_TOPICS_READ' => 'Mark topics read', - 'NEW_POSTS_HOT' => 'New posts [ Popular ]', - 'NEW_POSTS_LOCKED' => 'New posts [ Locked ]', - 'NO_NEW_POSTS_HOT' => 'No new posts [ Popular ]', - 'NO_NEW_POSTS_LOCKED' => 'No new posts [ Locked ]', + 'NEW_POSTS_HOT' => 'New posts [ Popular ]', // Not used anymore + 'NEW_POSTS_LOCKED' => 'New posts [ Locked ]', // Not used anymore + 'NO_NEW_POSTS_HOT' => 'No new posts [ Popular ]', // Not used anymore + 'NO_NEW_POSTS_LOCKED' => 'No new posts [ Locked ]', // Not used anymore 'NO_READ_ACCESS' => 'You do not have the required permissions to read topics within this forum.', + 'NO_UNREAD_POSTS_HOT' => 'No unread posts [ Popular ]', + 'NO_UNREAD_POSTS_LOCKED' => 'No unread posts [ Locked ]', 'POST_FORUM_LOCKED' => 'Forum is locked', 'TOPICS_MARKED' => 'The topics for this forum have now been marked read.', + 'UNREAD_POSTS_HOT' => 'Unread posts [ Popular ]', + 'UNREAD_POSTS_LOCKED' => 'Unread posts [ Locked ]', + 'VIEW_FORUM' => 'View forum', 'VIEW_FORUM_TOPIC' => '1 topic', 'VIEW_FORUM_TOPICS' => '%d topics', diff --git a/phpBB/styles/subsilver2/template/index_body.html b/phpBB/styles/subsilver2/template/index_body.html index 863e4f7bee..8faf76e9ee 100644 --- a/phpBB/styles/subsilver2/template/index_body.html +++ b/phpBB/styles/subsilver2/template/index_body.html @@ -89,11 +89,11 @@ - - + + - + diff --git a/phpBB/styles/subsilver2/template/viewforum_body.html b/phpBB/styles/subsilver2/template/viewforum_body.html index 387a749e24..6511fa5349 100644 --- a/phpBB/styles/subsilver2/template/viewforum_body.html +++ b/phpBB/styles/subsilver2/template/viewforum_body.html @@ -281,31 +281,31 @@ @@ -365,8 +365,8 @@   -   -   +   +     From 105de6b637898cbbeae88909baf04706c856e839 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Thu, 29 Apr 2010 10:10:35 -0400 Subject: [PATCH 332/393] [ticket/7417] Focus search keywords field when prosilver search page is loaded. PHPBB3-7417 --- phpBB/styles/prosilver/template/search_body.html | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/search_body.html b/phpBB/styles/prosilver/template/search_body.html index 612641b141..6616b95a73 100644 --- a/phpBB/styles/prosilver/template/search_body.html +++ b/phpBB/styles/prosilver/template/search_body.html @@ -1,5 +1,11 @@ + +

            {L_SEARCH}

            @@ -119,4 +125,4 @@ - \ No newline at end of file + From 6e9cf09adbc79d8327b1817096c3b16f50fc80d9 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Thu, 29 Apr 2010 10:17:16 -0400 Subject: [PATCH 333/393] [ticket/7417] Focus username field when prosilver login page is loaded. PHPBB3-7417 --- phpBB/styles/prosilver/template/login_body.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/phpBB/styles/prosilver/template/login_body.html b/phpBB/styles/prosilver/template/login_body.html index e52ccd6434..26e425a1d0 100644 --- a/phpBB/styles/prosilver/template/login_body.html +++ b/phpBB/styles/prosilver/template/login_body.html @@ -1,5 +1,11 @@ + +
            From 940191973fdbffffe51baf1dc5e6abc5bcdf0d75 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Thu, 29 Apr 2010 10:38:28 -0400 Subject: [PATCH 334/393] [ticket/7417] Also focus search keywords and username in subsilver2. PHPBB3-7417 --- .../subsilver2/template/login_body.html | 19 ++++++++++++++++++- .../subsilver2/template/search_body.html | 19 ++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/subsilver2/template/login_body.html b/phpBB/styles/subsilver2/template/login_body.html index 503de9e69e..90bbf8c139 100644 --- a/phpBB/styles/subsilver2/template/login_body.html +++ b/phpBB/styles/subsilver2/template/login_body.html @@ -88,4 +88,21 @@
            - \ No newline at end of file + + + diff --git a/phpBB/styles/subsilver2/template/search_body.html b/phpBB/styles/subsilver2/template/search_body.html index a0ec30e9ba..763a229c83 100644 --- a/phpBB/styles/subsilver2/template/search_body.html +++ b/phpBB/styles/subsilver2/template/search_body.html @@ -75,4 +75,21 @@
            - \ No newline at end of file + + + From 07a8d5a3dd44ea859c721b159a1fe9927dd78a7c Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Thu, 14 Oct 2010 19:04:19 +0200 Subject: [PATCH 335/393] [ticket/9162] Prevent notice on unset poll title Regression from a81c857c96ee1a2a9be559ff3c9b71ca9514287e PHPBB3-9162 --- phpBB/posting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/posting.php b/phpBB/posting.php index 853ac18aad..f775699cee 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1300,7 +1300,7 @@ $attachment_data = $message_parser->attachment_data; $filename_data = $message_parser->filename_data; $post_data['post_text'] = $message_parser->message; -if (sizeof($post_data['poll_options']) || $post_data['poll_title']) +if (sizeof($post_data['poll_options']) || !empty($post_data['poll_title'])) { $message_parser->message = $post_data['poll_title']; $message_parser->bbcode_uid = $post_data['bbcode_uid']; From 880bace3554370167be705378ebf5b320cb78b16 Mon Sep 17 00:00:00 2001 From: rxu Date: Sat, 16 Oct 2010 20:46:38 +0800 Subject: [PATCH 336/393] [ticket/9840] Display view unread posts link for guests. Display view unread posts link for guests if applicable. PHPBB3-9840 --- phpBB/includes/functions.php | 2 +- phpBB/styles/prosilver/template/index_body.html | 2 +- phpBB/styles/subsilver2/template/overall_header.html | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 9aec98dce2..e154aa44b0 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4466,7 +4466,7 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 'S_ENABLE_FEEDS_TOPICS_ACTIVE' => ($config['feed_topics_active']) ? true : false, 'S_ENABLE_FEEDS_NEWS' => ($s_feed_news) ? true : false, - 'S_LOAD_UNREADS' => ($config['load_unreads_search']) ? true : false, + 'S_LOAD_UNREADS' => ($config['load_unreads_search'] && ($config['load_anon_lastread'] || $user->data['is_registered'])) ? true : false, 'T_THEME_PATH' => "{$web_path}styles/" . $user->theme['theme_path'] . '/theme', 'T_TEMPLATE_PATH' => "{$web_path}styles/" . $user->theme['template_path'] . '/template', diff --git a/phpBB/styles/prosilver/template/index_body.html b/phpBB/styles/prosilver/template/index_body.html index af2077141c..d4d50a11c0 100644 --- a/phpBB/styles/prosilver/template/index_body.html +++ b/phpBB/styles/prosilver/template/index_body.html @@ -6,7 +6,7 @@ diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html index 37691d4f1c..a8a53abd24 100644 --- a/phpBB/styles/subsilver2/template/overall_header.html +++ b/phpBB/styles/subsilver2/template/overall_header.html @@ -201,8 +201,8 @@ function marklist(id, name, state) From 5d9aef47949ff3539db40fc2316293888c91d77c Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sat, 16 Oct 2010 23:01:03 +0200 Subject: [PATCH 337/393] [task/phing-build] Added a build.xml configuration for phing. The current state of the phing build script allowed the removal of some code from the old packaging process written entirely in PHP. Further simplifcations of the PHP code and additions to the phing build file will follow. PHPBB3-9849 --- build/build.xml | 144 +++++++++++++++++++++++++++++++++ build/build_helper.php | 175 +---------------------------------------- build/package.php | 152 +++-------------------------------- 3 files changed, 159 insertions(+), 312 deletions(-) create mode 100644 build/build.xml diff --git a/build/build.xml b/build/build.xml new file mode 100644 index 0000000000..9517c33a8e --- /dev/null +++ b/build/build.xml @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/build_helper.php b/build/build_helper.php index 2bae32218b..94fc0ff3b5 100644 --- a/build/build_helper.php +++ b/build/build_helper.php @@ -14,10 +14,6 @@ class build_package var $old_packages; var $versions; var $locations; - var $clean_directory_structure; - var $files_to_copy; - var $files_to_remove; - var $remove_from_diff_structure; // -c - context diff // -r - compare recursive @@ -53,11 +49,11 @@ class build_package $this->package_infos = array( 'package_name' => 'phpBB3', 'name_prefix' => 'phpbb', - 'simple_name' => 'phpbb' . str_replace('.', '', $_latest), + 'simple_name' => 'release-' . $_latest, 'new_version_number' => $_latest, 'short_version_number' => str_replace('.', '', $_latest), 'release_filename' => 'phpBB-' . $_latest, - 'last_version' => 'phpbb' . str_replace('.', '', $_before), + 'last_version' => 'release-' . $_before, 'last_version_number' => $_before, ); @@ -78,112 +74,7 @@ class build_package continue; } - $this->old_packages['phpbb' . str_replace('.', '', $package_version)] = $package_version . '_to_'; - } - - // We need to make sure this is up to date with the latest version - $this->clean_directory_structure = array( - 'adm' => array( - 'images' => '', - 'style' => '', - ), - 'cache' => '', - 'docs' => '', - 'download' => '', - 'files' => '', - 'images' => array( - 'avatars' => array( - 'gallery' => '', - 'upload' => '', - ), - 'icons' => array( - 'misc' => '', - 'smile' => '', - ), - 'ranks' => '', - 'smilies' => '', - 'upload_icons' => '', - ), - 'includes' => array( - 'acm' => '', - 'acp' => array( - 'info' => '', - ), - 'auth' => '', - 'captcha' => array( - 'plugins' => '', - ), - 'diff' => '', - 'db' => '', - 'hooks' => '', - 'mcp' => array( - 'info' => '', - ), - 'questionnaire' => '', - 'search' => '', - 'ucp' => array( - 'info' => '', - ), - 'utf' => array( - 'data' => '', - ), - ), - 'install' => array( - 'convertors'=> '', - 'schemas' => '', -// 'data' => '', - ), - 'language' => array( - 'en' => array( - 'acp' => '', - 'email' => '', - 'mods' => '', - ), - ), - 'store' => '', - 'styles' => array( - 'subsilver2' => array( - 'imageset' => array( - 'en' => '', - ), - 'template' => '', - 'theme' => array( - 'images' => '', - ), - ), - 'prosilver' => array( - 'imageset' => array( - 'en' => '', - ), - 'template' => '', - 'theme' => array( - 'images' => '', - ), - ), - ), - ); - - // Files to remove (not include within package) - $this->files_to_remove = array(); //array('includes/utf/data/recode_cjk.php'); - - // Files within the main directory to copy - do not include config.php - $this->files_to_copy = array( - '.htaccess', 'common.php', 'cron.php', 'faq.php', 'feed.php', 'index.php', 'mcp.php', 'memberlist.php', 'posting.php', 'report.php', - 'search.php', 'style.php', 'ucp.php', 'viewforum.php', 'viewonline.php', 'viewtopic.php' - ); - - // These files/directories will be removed and not used for creating the patch files - $this->remove_from_diff_structure = array( - 'config.php', 'cache', 'docs', 'files', 'install', 'store', 'develop' - ); - - // Writeable directories - $this->writeable = array('cache', 'store', 'images/avatars/upload', 'files'); - - // Fill the rest of the files_to_copy array - foreach ($this->clean_directory_structure as $cur_dir => $dir_struct) - { - $this->_fill_files_to_copy($this->locations['new_version'] . $cur_dir, $cur_dir, $dir_struct); + $this->old_packages['release-' . $package_version] = $package_version . '_to_'; } } @@ -192,66 +83,6 @@ class build_package return $this->package_infos[$var]; } - function _fill_files_to_copy($directory, $cur_dir, $dir_struct) - { - $dh = opendir($directory); - - while ($file = readdir($dh)) - { - if (is_file($directory . '/' . $file) && $file != '.' && $file != '..') - { - $_loc = str_replace($this->locations['new_version'], '', $directory . '/' . $file); - - if (in_array($_loc, $this->files_to_remove)) - { - continue; - } - - $this->files_to_copy[] = $cur_dir . '/' . $file; - } - } - closedir($dh); - - if (is_array($dir_struct)) - { - foreach ($dir_struct as $_cur_dir => $_dir_struct) - { - $this->_fill_files_to_copy($directory . '/' . $_cur_dir, $cur_dir . '/' . $_cur_dir, $_dir_struct); - } - } - } - - function adjust_permissions($directory) - { - $dh = opendir($directory); - - while ($file = readdir($dh)) - { - if ($file == '.' || $file == '..' || $file == '.svn') - { - continue; - } - - // If file, then 644 - if (is_file($directory . '/' . $file)) - { - chmod($directory . '/' . $file, 0644); - } - else if (is_dir($directory . '/' . $file)) - { - $_loc = str_replace($this->package_infos['dest_dir'] . '/', '', $directory . '/' . $file); - - // If directory is within the writeable chmod to 777, else 755 - $mode = (in_array($_loc, $this->writeable)) ? 0777 : 0755; - chmod($directory . '/' . $file, $mode); - - // Now traverse to the directory - $this->adjust_permissions($directory . '/' . $file); - } - } - closedir($dh); - } - function begin_status($headline) { if ($this->status_begun) diff --git a/build/package.php b/build/package.php index a0da6404c6..2615d983b2 100755 --- a/build/package.php +++ b/build/package.php @@ -9,14 +9,17 @@ * */ -// The only thing i need to adjust. ;) -// Please always add the latest version number to the end -// Only have 5 releases here... -// If RC8 drops remove the install/data directory -//$versions = array('3.0.2', '3.0.3-RC1', '3.0.3', '3.0.4-RC1', '3.0.4', '3.0.5-RC1', '3.0.5', '3.0.6-RC1', '3.0.6-RC2', '3.0.6-RC3'); -//$versions = array('3.0.2', '3.0.3', '3.0.4', '3.0.5', '3.0.6', '3.0.7-RC1', '3.0.7'); -$versions = array('3.0.2', '3.0.3', '3.0.4', '3.0.5', '3.0.6', '3.0.7-RC1', '3.0.7-RC2', '3.0.7', '3.0.7-PL1'); -$verbose = false; +//$versions = array('3.0.2', '3.0.3', '3.0.4', '3.0.5', '3.0.6', '3.0.7-RC1', '3.0.7-RC2', '3.0.7', '3.0.7-PL1'); + +if ($_SERVER['argc'] < 2) +{ + die("Please specify a list of versions as the first argument (e.g. package.php '1.0.0, 1.0.1, 1.0.2')."); +} + +$versions = explode(',', $_SERVER['argv'][1]); +$versions = array_map('trim', $versions); + +$verbose = true; require('build_helper.php'); @@ -25,130 +28,6 @@ $package = new build_package($versions, $verbose); echo "Building Release Packages\n"; echo "Now all three package types (patch, files, release) are built as well as the update package (update).\n"; -$package->begin_status('Remove temporary files'); - -// Cleanup... -$package->run_command('rm -Rv ' . $package->get('dest_dir')); -$package->run_command('rm -Rv ' . $package->get('diff_dir')); -$package->run_command('rm -Rv ' . $package->get('patch_directory')); -$package->run_command('rm -Rv ' . $package->get('files_directory')); -$package->run_command('rm -Rv ' . $package->get('update_directory')); -$package->run_command('rm -Rv ' . $package->get('release_directory')); - -$package->begin_status('Create new directories'); - -// Make sure the directories got removed -while (file_exists($package->get('update_directory'))) -{ - sleep(1); -} - -if (!file_exists($package->get('dest_dir'))) -{ - $package->run_command('mkdir ' . $package->get('dest_dir')); -} - -if (!file_exists($package->get('diff_dir'))) -{ - $package->run_command('mkdir ' . $package->get('diff_dir')); -} - -if (!file_exists($package->get('patch_directory'))) -{ - $package->run_command('mkdir ' . $package->get('patch_directory')); -} - -if (!file_exists($package->get('files_directory'))) -{ - $package->run_command('mkdir ' . $package->get('files_directory')); -} - -if (!file_exists($package->get('update_directory'))) -{ - $package->run_command('mkdir ' . $package->get('update_directory')); -} - -if (!file_exists($package->get('release_directory'))) -{ - $package->run_command('mkdir ' . $package->get('release_directory')); -} - -$package->begin_status('Copy release files to clean release directory'); - -// Create config.php file -$package->run_command('touch ' . $package->get('dest_dir') . '/config.php'); -//$package->run_command('sudo chown www-data:www-data ' . $package->get('dest_dir') . '/config.php'); - -// Create new directory structure -foreach ($package->clean_directory_structure as $dir => $dir_struct) -{ - $package->create_directory($package->get('dest_dir') . '/' . $dir, $dir_struct); -} - -// First step is to copy the new version over (clean structure) -foreach ($package->files_to_copy as $file) -{ - $source_file = $package->locations['new_version'] . $file; - $dest_file = $package->get('dest_dir') . '/' . $file; - - $package->run_command("cp -p $source_file $dest_file"); -} - -// fix line endings -chdir($package->get('dest_dir')); -$package->run_command($package->locations['new_version'] . 'develop/fix_files.sh'); - -// Now clean up the permissions -$package->begin_status('Adjust permissions'); - -$package->adjust_permissions($package->get('dest_dir')); - -// Now create a version for diffing the version - copy the tree over to old_versions... -$package->begin_status('Create diff directory for obtaining file differences'); - -$package->run_command('cp -Rp ' . $package->get('dest_dir') . '/* ' . $package->get('diff_dir')); -$package->run_command('cp -Rp ' . $package->get('dest_dir') . '/.htaccess ' . $package->get('diff_dir')); - -// Cleanup diff directory (only contents to diff) -foreach ($package->remove_from_diff_structure as $remove_dir) -{ - $package->run_command('rm -Rv ' . $package->get('diff_dir') . '/' . $remove_dir); -} - -// Now, first of all we need to rebuild all old packages we want to support -foreach ($package->old_packages as $package_name => $tag_name) -{ - $package->begin_status('Create old packages directory for diffing to ' . $package_name); - - chdir($package->locations['old_versions']); - - if (is_dir($package->locations['old_versions'] . $package_name)) - { - $package->run_command('rm -Rv ' . $package->locations['old_versions'] . $package_name); - } - - // Now, create a new one... - $tag_name = 'release_' . str_replace(array('.', '_to_'), array('_', ''), $tag_name); - - $package->run_command('svn export --non-interactive http://code.phpbb.com/svn/phpbb/tags/' . $tag_name . '/phpBB/ ' . $package_name); - - $location = $package->locations['old_versions'] . $package_name; - chdir($location . '/'); - - $package->run_command($package->locations['new_version'] . 'develop/fix_files.sh'); - - // Now clean up the permissions - $package->begin_status('Adjust permissions for package ' . $package_name); - - $package->adjust_permissions($location); - - // Cleanup diff directory (only contents to diff) - foreach ($package->remove_from_diff_structure as $remove_dir) - { - $package->run_command('rm -Rv ' . $location . '/' . $remove_dir); - } -} - // Go trough all versions making a diff if we even have old versions // For phpBB 3.0.x we might choose a different update method, rendering the things below useless... if (sizeof($package->old_packages)) @@ -160,10 +39,7 @@ if (sizeof($package->old_packages)) foreach ($package->old_packages as $_package_name => $dest_package_filename) { - $package->begin_status('Creating patch/diff files for phpBB-' . $dest_package_filename . $package->get('new_version_number')); - - $dest_package_filename = $package->get('patch_directory') . '/phpBB-' . $dest_package_filename . $package->get('new_version_number') . '.patch'; - $package->run_command('diff ' . $package->diff_options . ' ' . $_package_name . ' ' . $package->get('simple_name') . ' > ' . $dest_package_filename); + $package->begin_status('Parsing patch/diff files for phpBB-' . $dest_package_filename . $package->get('new_version_number')); // Parse this diff to determine file changes from the checked versions and save them $diff_file_changes[$_package_name] = $package->collect_diff_files($dest_package_filename, $_package_name); @@ -404,7 +280,6 @@ if (sizeof($package->old_packages)) foreach ($compress_programs as $extension => $compress_command) { $package->begin_status('Packaging phpBB Patch Files for ' . $extension); - $package->run_command('rm -v ../release_files/' . $package->get('release_filename') . '-patch.' . $extension); // Build Package $package->run_command($compress_command . ' ../release_files/' . $package->get('release_filename') . '-patch.' . $extension . ' *'); @@ -420,7 +295,6 @@ if (sizeof($package->old_packages)) { $package->begin_status('Packaging phpBB Files for ' . $extension); - $package->run_command('rm -v ../release_files/' . $package->get('release_filename') . '-files.' . $extension); $package->run_command('mkdir ' . $package->get('files_directory') . '/release'); $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/docs ' . $package->get('files_directory') . '/release'); $package->run_command('cp -Rp ' . $package->get('dest_dir') . '/install ' . $package->get('files_directory') . '/release'); @@ -457,7 +331,6 @@ if (sizeof($package->old_packages)) $package->begin_status('Packaging phpBB Update for ' . $extension); - $package->run_command('rm -v ../release_files/' . $package->get('release_filename') . '-update.' . $extension); $package->run_command('mkdir ' . $package->get('update_directory') . '/release'); // Pack update files @@ -521,7 +394,6 @@ foreach ($compress_programs as $extension => $compress_command) // Microsoft Web PI packaging $package->begin_status('Packaging phpBB for Microsoft WebPI'); $file = './release_files/' . $package->get('release_filename') . '.webpi.zip'; -$package->run_command("rm -v $file"); $package->run_command('cp -p ./release_files/' . $package->get('release_filename') . ".zip $file"); $package->run_command('cd ./../webpi && ' . $compress_programs['zip'] . " ./../new_version/$file *"); $package->run_command("md5sum $file > $file.md5"); From e2d57fb4daa43ddaf4114cec7a3133750e07fea8 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 17 Oct 2010 12:25:20 +0100 Subject: [PATCH 338/393] [ticket/7332] Fix post details expand link rendering on Webkit. PHPBB3-7332 --- phpBB/styles/prosilver/template/mcp_post.html | 2 +- phpBB/styles/prosilver/theme/content.css | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/mcp_post.html b/phpBB/styles/prosilver/template/mcp_post.html index dab2d572a9..04e24cd1f9 100644 --- a/phpBB/styles/prosilver/template/mcp_post.html +++ b/phpBB/styles/prosilver/template/mcp_post.html @@ -54,7 +54,7 @@ - {L_EXPAND_VIEW} + {L_EXPAND_VIEW}

            {POST_SUBJECT}

            diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index dfe00371e4..64beb97a37 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -307,6 +307,11 @@ div[class].topic-actions { max-height: 300px; } +#expand +{ + clear: both; +} + /* Content container styles ----------------------------------------*/ .content { From e195c91b1df2098443310716a679cf9ad168dedd Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 17 Oct 2010 23:10:49 +0200 Subject: [PATCH 339/393] [ticket/9855] Make tests run under PHPUnit 3.5. PHPBB3-9855 --- tests/all_tests.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/all_tests.php b/tests/all_tests.php index bae7725ee7..d1d711c4d7 100644 --- a/tests/all_tests.php +++ b/tests/all_tests.php @@ -28,7 +28,14 @@ require_once 'network/all_tests.php'; require_once 'random/all_tests.php'; // exclude the test directory from code coverage reports -PHPUnit_Util_Filter::addDirectoryToFilter('./'); +if (version_compare(PHPUnit_Runner_Version::id(), '3.5.0') >= 0) +{ + PHP_CodeCoverage_Filter::getInstance()->addDirectoryToBlacklist('./'); +} +else +{ + PHPUnit_Util_Filter::addDirectoryToFilter('./'); +} class phpbb_all_tests { From d56bf3b0604a8b7699cbd2b4cf7104e7344608bf Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 17 Oct 2010 23:32:57 +0200 Subject: [PATCH 340/393] [ticket/9855] Do not include the PHPUnit Framework manually on 3.5+. PHPBB3-9855 --- tests/test_framework/framework.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/test_framework/framework.php b/tests/test_framework/framework.php index abdcd1ad79..3a11cc6df9 100644 --- a/tests/test_framework/framework.php +++ b/tests/test_framework/framework.php @@ -32,8 +32,12 @@ if (version_compare(PHPUnit_Runner_Version::id(), '3.3.0', '<')) trigger_error('PHPUnit >= 3.3.0 required'); } -require_once 'PHPUnit/Framework.php'; -require_once 'PHPUnit/Extensions/Database/TestCase.php'; +if (version_compare(PHPUnit_Runner_Version::id(), '3.5.0', '<')) +{ + require_once 'PHPUnit/Framework.php'; + require_once 'PHPUnit/Extensions/Database/TestCase.php'; +} + require_once 'test_framework/phpbb_test_case_helpers.php'; require_once 'test_framework/phpbb_test_case.php'; require_once 'test_framework/phpbb_database_test_case.php'; From d6aa25ede149a2d483b064f5ce96abcf49458ee3 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 18 Oct 2010 10:59:00 +0200 Subject: [PATCH 341/393] [ticket/9853] Change recaptcha theme from default to 'clean'. Change recaptcha theme to 'clean' to better coordinate with the color schemes of prosilver and subsilver2. The default red theme doesn't really fit prosilver and subsilver2. PHPBB3-9853 --- phpBB/styles/prosilver/template/captcha_recaptcha.html | 1 + phpBB/styles/subsilver2/template/captcha_recaptcha.html | 1 + 2 files changed, 2 insertions(+) diff --git a/phpBB/styles/prosilver/template/captcha_recaptcha.html b/phpBB/styles/prosilver/template/captcha_recaptcha.html index 97d2cda28e..51a1615bd5 100644 --- a/phpBB/styles/prosilver/template/captcha_recaptcha.html +++ b/phpBB/styles/prosilver/template/captcha_recaptcha.html @@ -16,6 +16,7 @@ // {$CAPTCHA_TAB_INDEX}10 }; // ]]> diff --git a/phpBB/styles/subsilver2/template/captcha_recaptcha.html b/phpBB/styles/subsilver2/template/captcha_recaptcha.html index 3776c77ea4..ec09b28ef5 100644 --- a/phpBB/styles/subsilver2/template/captcha_recaptcha.html +++ b/phpBB/styles/subsilver2/template/captcha_recaptcha.html @@ -9,6 +9,7 @@ // {$CAPTCHA_TAB_INDEX}10 }; // ]]> From 6236cfc9face1ece52a7f8897cbdf0ce2f831f78 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 18 Oct 2010 11:24:04 +0200 Subject: [PATCH 342/393] [ticket/9101] Remove misleading 'below' from RECAPTCHA_EXPLAIN. Remove misleading 'below' from RECAPTCHA_EXPLAIN because recaptcha is actually displayed to the side. PHPBB3-9101 --- phpBB/language/en/captcha_recaptcha.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/captcha_recaptcha.php b/phpBB/language/en/captcha_recaptcha.php index 897e8a4979..463bfffe0d 100644 --- a/phpBB/language/en/captcha_recaptcha.php +++ b/phpBB/language/en/captcha_recaptcha.php @@ -46,7 +46,7 @@ $lang = array_merge($lang, array( 'RECAPTCHA_PRIVATE' => 'Private reCaptcha key', 'RECAPTCHA_PRIVATE_EXPLAIN' => 'Your private reCaptcha key. Keys can be obtained on reCaptcha.net.', - 'RECAPTCHA_EXPLAIN' => 'In an effort to prevent automatic submissions, we require that you enter both of the words displayed below into the text field underneath.', + 'RECAPTCHA_EXPLAIN' => 'In an effort to prevent automatic submissions, we require that you enter both of the words displayed into the text field underneath.', )); ?> \ No newline at end of file From b6a60d4d64abc78d5e3e3899e912e31499dc73f9 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 25 Jun 2010 01:43:58 +0200 Subject: [PATCH 343/393] [ticket/9509] The VCS is now git Partially cherry-picked from 163a0974. PHPBB3-9509 --- phpBB/docs/coding-guidelines.html | 123 ++++-------------------------- 1 file changed, 15 insertions(+), 108 deletions(-) diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 1978a0a307..83bd229c8c 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -90,7 +90,7 @@
          134. VCS Guidelines
            1. Repository structure
            2. -
            3. Commit messages
            4. +
            5. Commit Messages and Repository Rules
          135. Guidelines Changelog
          136. @@ -2326,126 +2326,33 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
            -

            The version control system for phpBB3 is subversion. The repository is available at http://code.phpbb.com/svn/phpbb.

            +

            The version control system for phpBB3 is git. The repository is available at http://github.com/phpbb/phpbb3.

            7.i. Repository Structure

              -
            • trunk
              The latest unstable development version with new features etc. Contains the actual board in /trunk/phpBB
            • -
            • branches
              Development branches of stable phpBB releases. Copied from /trunk at the time of release. +
            • develop
              The latest unstable development version with new features etc.
            • +
            • develop-*
              Development branches of stable phpBB releases. Branched off of develop at the time of feature freeze.
                -
              • phpBB3.0/branches/phpBB-3_0_0/phpBB
                Development branch of the stable 3.0 line. Bug fixes are applied here.
              • -
              • phpBB2/branches/phpBB-2_0_0/phpBB
                Old phpBB2 development branch.
              • +
              • phpBB3.0develop-olympus
                Development branch of the stable 3.0 line. Bug fixes are applied here.
              • +
              • phpBB3.1develop-ascraeus
                Development branch of the stable 3.1 line. Bug fixes are applied here.
            • -
            • tags
              Released versions. Copies of trunk or the respective branch, made at the time of release. +
            • master
              A branch containing all stable phpBB3 release points
            • +
            • tags
              Released versions. Stable ones get merged into the master branch.
                -
              • /tags/release_3_0_BX
                Beta release X of the 3.0 line.
              • -
              • /tags/release_3_0_RCX
                Release candidate X of the 3.0 line.
              • -
              • /tags/release_3_0_X-RCY
                Release candidate Y of the stable 3.0.X release.
              • -
              • /tags/release_3_0_X
                Stable 3.0.X release.
              • -
              • /tags/release_2_0_X
                Old stable 2.0.X release.
              • +
              • release-3.Y-BX
                Beta release X of the 3.Y line.
              • +
              • release-3.Y-RCX
                Release candidate X of the 3.Y line.
              • +
              • release-3.Y.Z-RCX
                Release candidate X of the stable 3.Y.Z release.
              • +
              • release-3.0.X
                Stable 3.0.X release.
              • +
              • release-2.0.X
                Old stable 2.0.X release.
            -

            7.ii. Commit Messages

            - -

            The commit message should contain a brief explanation of all changes made within the commit. Often identical to the changelog entry. A bug ticket can be referenced by specifying the ticket ID with a hash, e.g. #12345. A reference to another revision should simply be prefixed with r, e.g. r12345.

            - -

            Junior Developers need to have their patches approved by a development team member first. The commit message must end in a line with the following format:

            - -
            -Authorised by: developer1[, developer2[, ...]]
            -	
            - -
            - - - -
            -
            - -
            - -

            8. Guidelines Changelog

            -
            -
            - -
            -

            Revision 10007

            - - - -

            Revision 9817

            - -
              -
            • Added VCS section.
            • -
            - -

            Revision 8732

            - - - -

            Revision 8596+

            - -
              -
            • Removed sql_build_array('MULTI_INSERT'... statements.
            • -
            • Added sql_multi_insert() explanation.
            • -
            - -

            Revision 1.31

            - -
              -
            • Added add_form_key and check_form_key.
            • -
            - -

            Revision 1.24

            - - - -

            Revision 1.16

            - - - -

            Revision 1.11-1.15

            - -
              -
            • Various document formatting, spelling, punctuation, grammar bugs.
            • -
            - -

            Revision 1.9-1.10

            - - - -

            Revision 1.8

            - - - -

            Revision 1.5

            - - +

            7.ii. Commit Messages and Reposiory Rules

            +

            Information on repository rules, such as commit messages can be found at http://wiki.phpbb.com/display/DEV/Git

            .
            From b27b69cf375df2374a280dba5d14a257dae25365 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 19 Oct 2010 12:22:07 +0200 Subject: [PATCH 344/393] [ticket/9857] Remove visible $Id$ from phpBB/docs files. PHPBB3-9857 --- phpBB/docs/auth_api.html | 2 +- phpBB/docs/coding-guidelines.html | 2 +- phpBB/docs/hook_system.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/docs/auth_api.html b/phpBB/docs/auth_api.html index c83aaadc2d..a33a0840f6 100644 --- a/phpBB/docs/auth_api.html +++ b/phpBB/docs/auth_api.html @@ -241,7 +241,7 @@ $auth_admin = new auth_admin();
            diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 1978a0a307..c9b34886df 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -2475,7 +2475,7 @@ Authorised by: developer1[, developer2[, ...]] diff --git a/phpBB/docs/hook_system.html b/phpBB/docs/hook_system.html index b23ebab869..1bf4630a9f 100644 --- a/phpBB/docs/hook_system.html +++ b/phpBB/docs/hook_system.html @@ -875,7 +875,7 @@ function phpbb_hook_register(&$hook) From 9950fa34c6b3a0aeac6140e0b8eb671529824ea4 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Sun, 17 Oct 2010 15:47:41 -0500 Subject: [PATCH 345/393] [ticket/9854] Revise docs/auth_api.html to add more methods Notably, the auth_admin class is still missing documentation. PHPBB3-9854 --- phpBB/docs/auth_api.html | 48 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/auth_api.html b/phpBB/docs/auth_api.html index c83aaadc2d..50d73d4485 100644 --- a/phpBB/docs/auth_api.html +++ b/phpBB/docs/auth_api.html @@ -61,6 +61,9 @@
          137. acl_getf
          138. acl_getf_global
          139. acl_cache
          140. +
          141. acl_clear_prefetch
          142. +
          143. acl_get_list
          144. +
          145. Miscellaneous
          146. Admin related functions
          147. @@ -176,7 +179,7 @@ array(forum_id1 => array(option => integer), This method is used to find out whether a user has a permission in at least one forum or globally. This method is similar to checking whether acl_getf(option, true) returned one or more forums but it's faster. It should be called in the following way:

            -$result = acl_getf_global(option)
            +$result = $auth->acl_getf_global(option)
             	

            As with the previous methods option is a string specifying the permission which has to be checked.

            @@ -187,6 +190,49 @@ $result = acl_getf_global(option)

            This should be considered a private method and not be called externally. It handles the generation of the user_permissions data from the basic user and group authorisation data. When necessary this method is called automatically by acl.

            +

            2.vii. acl_clear_prefetch

            + +

            This method clears the user_permissions column in the users table for the given user. If the user ID passed is zero, the permissions cache is cleared for all users. This method should be called whenever permissions are set.

            + +
            +// clear stored permissions for user 2
            +$user_id = 2;
            +$auth->acl_clear_prefetch($user_id);
            +
            + +

            This method returns void.

            + +

            2.viii. acl_get_list

            + +

            This method returns an an array describing which users have permissions in given fora. The resultant array contains an entry for permission that every user has in every forum when no arguments are passed.

            + +
            +$user_id = array(2, 53);
            +$permissions = array('f_list', 'f_read');
            +$forum_id = array(1, 2, 3);
            +$result = $auth->acl_get_list($user_id, $permissions, $forum_id);
            +
            + +

            The parameters may be of the following legal types:

            +
              +
            • $user_id: false, int, array(int, int, int, ...)
            • +
            • $permissions: false, string, array(string, string, ...)
            • +
            • $forum_id: false, int, array(int, int, int, ...)
            • +
            + +

            2.ix. Miscellaneous

            + +

            There are other methods defined in the auth class which serve mostly as private methods, but are available for use if needed. Each of them is used to pull data directly from the database tables. They are:

            +
              +
            • function acl_group_raw_data($group_id = false, $opts = false, $forum_id = false)
            • +
            • function acl_user_raw_data($user_id = false, $opts = false, $forum_id = false)
            • +
            • function acl_raw_data_single_user($user_id)
            • +
            • function acl_raw_data($user_id = false, $opts = false, $forum_id = false)
            • +
            • function acl_role_data($user_type, $role_type, $ug_id = false, $forum_id = false)
            • +
            + +

            Of these, acl_raw_data is the most general, but the others will be faster if you need a smaller amount of data.

            + From 5ad5930c8f664035c92453230489b1dbbc5acbab Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Tue, 19 Oct 2010 13:45:50 +0200 Subject: [PATCH 346/393] [ticket/9509] Close anchor tag in coding guidelines Thanks Andreas. PHPBB3-9509 --- phpBB/docs/coding-guidelines.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 83bd229c8c..ae6cbaacbc 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -2352,7 +2352,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))

            7.ii. Commit Messages and Reposiory Rules

            -

            Information on repository rules, such as commit messages can be found at http://wiki.phpbb.com/display/DEV/Git

            . +

            Information on repository rules, such as commit messages can be found at http://wiki.phpbb.com/display/DEV/Git

            . From c4dfe24feca3c47fab40548554a125ad55da6b70 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Tue, 19 Oct 2010 13:51:47 +0200 Subject: [PATCH 347/393] [ticket/9509] Remove section 8 from index Thanks Andreas. PHPBB3-9509 --- phpBB/docs/coding-guidelines.html | 1 - 1 file changed, 1 deletion(-) diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index ae6cbaacbc..e9b222858d 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -93,7 +93,6 @@
          148. Commit Messages and Repository Rules
          149. -
          150. Guidelines Changelog
          151. Copyright and disclaimer
          152. From b9afa26280bcb2aa6d11f8b15faec4aad23dced8 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Thu, 21 Oct 2010 10:22:03 +0200 Subject: [PATCH 348/393] [ticket/9807] Update existing module permissions in database PHPBB3-9807 --- phpBB/install/database_update.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 019469b061..ce0e9a6480 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1697,6 +1697,14 @@ function change_database_data(&$no_updates, $version) _add_modules($modules_to_install); + // update + $sql = 'UPDATE ' . MODULES_TABLE . ' + SET module_auth = \'cfg_allow_avatar && (cfg_allow_avatar_local || cfg_allow_avatar_remote || cfg_allow_avatar_upload || cfg_allow_avatar_remote_upload)\' + WHERE module_class = \'ucp\' + AND module_basename = \'profile\' + AND module_mode = \'avatar\''; + _sql($sql, $errored, $error_ary); + // add Bing Bot $sql = 'SELECT group_id, group_colour FROM ' . GROUPS_TABLE . " From 294c2c63c0d283ec5efd118657ecf795b6a45aa9 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 21 Oct 2010 20:31:00 +0200 Subject: [PATCH 349/393] [ticket/9595] List min/max characters indexed by search for mysql_fulltext. PHPBB3-9595 --- phpBB/includes/search/fulltext_mysql.php | 8 ++++++++ phpBB/language/en/acp/search.php | 2 ++ 2 files changed, 10 insertions(+) diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php index 0be3a10e5f..29cdd8ee9a 100644 --- a/phpBB/includes/search/fulltext_mysql.php +++ b/phpBB/includes/search/fulltext_mysql.php @@ -919,6 +919,14 @@ class fulltext_mysql extends search_backend

            ' . $user->lang['FULLTEXT_MYSQL_MBSTRING_EXPLAIN'] . '
            ' . (($this->mbstring_regex) ? $user->lang['YES'] : $user->lang['NO']). '
            +
            +

            ' . $user->lang['FULLTEXT_MYSQL_MIN_SEARCH_CHARS_EXPLAIN'] . '
            +
            ' . $config['fulltext_mysql_min_word_len'] . '
            +
            +
            +

            ' . $user->lang['FULLTEXT_MYSQL_MAX_SEARCH_CHARS_EXPLAIN'] . '
            +
            ' . $config['fulltext_mysql_max_word_len'] . '
            +
            '; // These are fields required in the config table diff --git a/phpBB/language/en/acp/search.php b/phpBB/language/en/acp/search.php index 88eed9d948..a7d687d7c2 100644 --- a/phpBB/language/en/acp/search.php +++ b/phpBB/language/en/acp/search.php @@ -59,6 +59,8 @@ $lang = array_merge($lang, array( 'FULLTEXT_MYSQL_PCRE' => 'Support for non-latin UTF-8 characters using PCRE:', 'FULLTEXT_MYSQL_MBSTRING_EXPLAIN' => 'If PCRE does not have unicode character properties, the search backend will try to use mbstring’s regular expression engine.', 'FULLTEXT_MYSQL_PCRE_EXPLAIN' => 'This search backend requires PCRE unicode character properties, only available in PHP 4.4, 5.1 and above, if you want to search for non-latin characters.', + 'FULLTEXT_MYSQL_MIN_SEARCH_CHARS_EXPLAIN' => 'Words with at least this many characters will be indexed for searching. You or your host can only change this setting by changing the mysql configuration.', + 'FULLTEXT_MYSQL_MAX_SEARCH_CHARS_EXPLAIN' => 'Words with no more than this many characters will be indexed for searching. You or your host can only change this setting by changing the mysql configuration.', 'GENERAL_SEARCH_SETTINGS' => 'General search settings', 'GO_TO_SEARCH_INDEX' => 'Go to search index page', From 5c5b0fc4beeb51288e3ec83f6b253f1d4134f50d Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 25 Oct 2010 03:27:38 +0200 Subject: [PATCH 350/393] [ticket/9686] Fix mssqlnative database data export We require version 1.1 of the sqlsrv extension anyway so the regular sqlsrv_num_rows can be used instead of buffering the result. The result buffer (class result_mssqlnative) should never automatically free the resource it receives - we consistently close resources using sql_freeresult(). PHPBB3-9686 --- phpBB/includes/acp/acp_database.php | 54 +++++++++++++++++------------ phpBB/includes/db/mssqlnative.php | 20 ++++++++--- 2 files changed, 46 insertions(+), 28 deletions(-) diff --git a/phpBB/includes/acp/acp_database.php b/phpBB/includes/acp/acp_database.php index 0582d6204e..193dd001c0 100644 --- a/phpBB/includes/acp/acp_database.php +++ b/phpBB/includes/acp/acp_database.php @@ -1619,41 +1619,48 @@ class mssql_extractor extends base_extractor function write_data_mssqlnative($table_name) { global $db; - $ary_type = $ary_name = $meta_array = array(); + $ary_type = $ary_name = array(); $ident_set = false; $sql_data = ''; // Grab all of the data from current table. $sql = "SELECT * FROM $table_name"; + $db->mssqlnative_set_query_options(array('Scrollable' => SQLSRV_CURSOR_STATIC)); $result = $db->sql_query($sql); - $retrieved_data = $db->mssqlnative_num_rows($result); + $retrieved_data = $db->mssqlnative_num_rows($result); - $meta_array = sqlsrv_field_metadata($result); - $i_num_fields = sqlsrv_num_fields($result); - + if (!$retrieved_data) + { + $db->sql_freeresult($result); + return; + } + + $sql = "SELECT * FROM $table_name"; + $result_fields = $db->sql_query_limit($sql, 1); + + $row = new result_mssqlnative($result_fields); + $i_num_fields = $row->num_fields(); + for ($i = 0; $i < $i_num_fields; $i++) { - $info = $db->mssqlnative_fieldInfo($table_name, $meta_array[$i]['Name']); - $ary_type[$i] = $info->type(); - $ary_name[$i] = $info->name(); + $ary_type[$i] = $row->field_type($i); + $ary_name[$i] = $row->field_name($i); } + $db->sql_freeresult($result_fields); + + $sql = "SELECT 1 as has_identity + FROM INFORMATION_SCHEMA.COLUMNS + WHERE COLUMNPROPERTY(object_id('$table_name'), COLUMN_NAME, 'IsIdentity') = 1"; + $result2 = $db->sql_query($sql); + $row2 = $db->sql_fetchrow($result2); - if ($retrieved_data) + if (!empty($row2['has_identity'])) { - $sql = "SELECT 1 as has_identity - FROM INFORMATION_SCHEMA.COLUMNS - WHERE COLUMNPROPERTY(object_id('$table_name'), COLUMN_NAME, 'IsIdentity') = 1"; - $result2 = $db->sql_query($sql); - $row2 = $db->sql_fetchrow($result2); - - if (!empty($row2['has_identity'])) - { - $sql_data .= "\nSET IDENTITY_INSERT $table_name ON\nGO\n"; - $ident_set = true; - } - $db->sql_freeresult($result2); + $sql_data .= "\nSET IDENTITY_INSERT $table_name ON\nGO\n"; + $ident_set = true; } + $db->sql_freeresult($result2); while ($row = $db->sql_fetchrow($result)) { @@ -1664,7 +1671,8 @@ class mssql_extractor extends base_extractor { $str_val = $row[$ary_name[$i]]; - if (preg_match('#char|text|bool|varbinary#i', $ary_type[$i])) + // defaults to type number - better quote just to be safe, so check for is_int too + if (is_int($ary_type[$i]) || preg_match('#char|text|bool|varbinary#i', $ary_type[$i])) { $str_quote = ''; $str_empty = "''"; @@ -1705,7 +1713,7 @@ class mssql_extractor extends base_extractor } $db->sql_freeresult($result); - if ($retrieved_data && $ident_set) + if ($ident_set) { $sql_data .= "\nSET IDENTITY_INSERT $table_name OFF\nGO\n"; } diff --git a/phpBB/includes/db/mssqlnative.php b/phpBB/includes/db/mssqlnative.php index 44d5722e4f..d6ac3b3acc 100644 --- a/phpBB/includes/db/mssqlnative.php +++ b/phpBB/includes/db/mssqlnative.php @@ -51,7 +51,6 @@ class result_mssqlnative } $this->m_row_count = count($this->m_rows); - sqlsrv_free_stmt($queryresult); } private function array_to_obj($array, &$obj) @@ -199,6 +198,7 @@ class dbal_mssqlnative extends dbal { var $m_insert_id = NULL; var $last_query_text = ''; + var $query_options = array(); /** * Connect to server @@ -308,10 +308,12 @@ class dbal_mssqlnative extends dbal if ($this->query_result === false) { - if (($this->query_result = @sqlsrv_query($this->db_connect_id, $query)) === false) + if (($this->query_result = @sqlsrv_query($this->db_connect_id, $query, array(), $this->query_options)) === false) { $this->sql_error($query); } + // reset options for next query + $this->query_options = array(); if (defined('DEBUG_EXTRA')) { @@ -598,20 +600,28 @@ class dbal_mssqlnative extends dbal * Utility method used to retrieve number of rows * Emulates mysql_num_rows * Used in acp_database.php -> write_data_mssqlnative() + * Requires a static or keyset cursor to be definde via + * mssqlnative_set_query_options() */ function mssqlnative_num_rows($res) { if ($res !== false) { - $row = new result_mssqlnative($res); - $num_rows = $row->num_rows(); - return $num_rows; + return sqlsrv_num_rows($res); } else { return false; } } + + /** + * Allows setting mssqlnative specific query options passed to sqlsrv_query as 4th parameter. + */ + function mssqlnative_set_query_options($options) + { + $this->query_options = $options; + } } ?> \ No newline at end of file From ee846c461c6f0d4ec02dcefa6c82090587bc7012 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 22 Oct 2010 19:11:18 +0200 Subject: [PATCH 351/393] [task/mssql-db-tests] Use a simple getter for test case helpers. Calling initialisation to then use the member directly seems more complicated than just having a method that returns the instance or creates it if necessary. PHPBB3-9868 --- tests/test_framework/phpbb_database_test_case.php | 13 ++++++------- tests/test_framework/phpbb_test_case.php | 7 ++++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index f6bf420ebc..c183c61f91 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -11,12 +11,14 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test { protected $test_case_helpers; - public function init_test_case_helpers() + public function get_test_case_helpers() { if (!$this->test_case_helpers) { $this->test_case_helpers = new phpbb_test_case_helpers($this); } + + return $this->test_case_helpers; } public function get_dbms_data($dbms) @@ -113,8 +115,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test { static $already_connected; - $this->init_test_case_helpers(); - $database_config = $this->test_case_helpers->get_database_config(); + $database_config = $this->get_test_case_helpers()->get_database_config(); $dbms_data = $this->get_dbms_data($database_config['dbms']); @@ -189,13 +190,11 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test public function new_dbal() { - $this->init_test_case_helpers(); - return $this->test_case_helpers->new_dbal(); + return $this->get_test_case_helpers()->new_dbal(); } public function setExpectedTriggerError($errno, $message = '') { - $this->init_test_case_helpers(); - $this->test_case_helpers->setExpectedTriggerError($errno, $message); + $this->get_test_case_helpers()->setExpectedTriggerError($errno, $message); } } diff --git a/tests/test_framework/phpbb_test_case.php b/tests/test_framework/phpbb_test_case.php index af867b29ff..fe90d321dc 100644 --- a/tests/test_framework/phpbb_test_case.php +++ b/tests/test_framework/phpbb_test_case.php @@ -11,17 +11,18 @@ class phpbb_test_case extends PHPUnit_Framework_TestCase { protected $test_case_helpers; - public function init_test_case_helpers() + public function get_test_case_helpers() { if (!$this->test_case_helpers) { $this->test_case_helpers = new phpbb_test_case_helpers($this); } + + return $this->test_case_helpers; } public function setExpectedTriggerError($errno, $message = '') { - $this->init_test_case_helpers(); - $this->test_case_helpers->setExpectedTriggerError($errno, $message); + $this->get_test_case_helpers()->setExpectedTriggerError($errno, $message); } } From 9dbbfea5fd31e40acc6fb4a195795b3e285a5b56 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 22 Oct 2010 19:27:41 +0200 Subject: [PATCH 352/393] [task/mssql-db-tests] No longer display an error when skipping db tests. Tests are run with sqlite by default now anyway, so in the majority of cases the error message explaining how to set up database test running will not be displayed anyway. Database tests are now generally simply skipped if no configuration can be found. The RUNNING_TESTS.txt file explains how to set them up however, and more info is available on the wiki. The get_database_config method was moved from test_case_helpers to database_test_case because it has no general purpose. PHPBB3-9868 --- tests/RUNNING_TESTS.txt | 30 ++++++-- .../phpbb_database_test_case.php | 48 ++++++++++++- .../phpbb_test_case_helpers.php | 68 ------------------- 3 files changed, 70 insertions(+), 76 deletions(-) diff --git a/tests/RUNNING_TESTS.txt b/tests/RUNNING_TESTS.txt index f1b40f71ad..a5d3111242 100644 --- a/tests/RUNNING_TESTS.txt +++ b/tests/RUNNING_TESTS.txt @@ -1,33 +1,51 @@ Running Tests -------------- +============= Prerequisites -------------- +============= PHPUnit -======= +------- phpBB unit tests use PHPUnit framework. Version 3.3 or better is required to run the tests. PHPUnit prefers to be installed via PEAR; refer to http://www.phpunit.de/ for more information. PHP extensions -============== +-------------- Unit tests use several PHP extensions that board code does not use. Currently the following PHP extensions must be installed and enabled to run unit tests: - ctype +Database Tests +-------------- +By default all tests requiring a database connection will use sqlite. If you +do not have sqlite installed the tests will be skipped. If you wish to run the +tests on a different database you have to create a test_config.php file within +your tests directory following the same format as phpBB's config.php. An example +for mysqli can be found below. More information on configuration options can be +found on the wiki (see below). + + $dbms, + 'dbhost' => $dbhost, + 'dbport' => $dbport, + 'dbname' => $dbname, + 'dbuser' => $dbuser, + 'dbpasswd' => $dbpasswd, + ); + } + else if (extension_loaded('sqlite') && version_compare(PHPUnit_Runner_Version::id(), '3.4.15', '>=')) + { + // Silently use sqlite + return array( + 'dbms' => 'sqlite', + 'dbhost' => 'phpbb_unit_tests.sqlite2', // filename + 'dbport' => '', + 'dbname' => '', + 'dbuser' => '', + 'dbpasswd' => '', + ); + } + else + { + $this->markTestSkipped('Missing test_config.php: See first error.'); + } + } + // NOTE: This function is not the same as split_sql_file from functions_install public function split_sql_file($sql, $dbms) { @@ -115,7 +150,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test { static $already_connected; - $database_config = $this->get_test_case_helpers()->get_database_config(); + $database_config = $this->get_database_config(); $dbms_data = $this->get_dbms_data($database_config['dbms']); @@ -190,7 +225,16 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test public function new_dbal() { - return $this->get_test_case_helpers()->new_dbal(); + global $phpbb_root_path, $phpEx; + + $config = $this->get_database_config(); + + require_once '../phpBB/includes/db/' . $config['dbms'] . '.php'; + $dbal = 'dbal_' . $config['dbms']; + $db = new $dbal(); + $db->sql_connect($config['dbhost'], $config['dbuser'], $config['dbpasswd'], $config['dbname'], $config['dbport']); + + return $db; } public function setExpectedTriggerError($errno, $message = '') diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index 7c026e496e..0acdce32e0 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -18,74 +18,6 @@ class phpbb_test_case_helpers $this->test_case = $test_case; } - public function get_database_config() - { - static $show_error = true; - - if (file_exists('test_config.php')) - { - include('test_config.php'); - - return array( - 'dbms' => $dbms, - 'dbhost' => $dbhost, - 'dbport' => $dbport, - 'dbname' => $dbname, - 'dbuser' => $dbuser, - 'dbpasswd' => $dbpasswd, - ); - } - else if (extension_loaded('sqlite') && version_compare(PHPUnit_Runner_Version::id(), '3.4.15', '>=')) - { - // Silently use sqlite - return array( - 'dbms' => 'sqlite', - 'dbhost' => 'phpbb_unit_tests.sqlite2', // filename - 'dbport' => '', - 'dbname' => '', - 'dbuser' => '', - 'dbpasswd' => '', - ); - } - else - { - if ($show_error) - { - $show_error = false; - } - else - { - $this->test_case->markTestSkipped('Missing test_config.php: See first error.'); - return; - } - - trigger_error("You have to create a test_config.php like this: -\"get_database_config(); - - require_once '../phpBB/includes/db/' . $config['dbms'] . '.php'; - $dbal = 'dbal_' . $config['dbms']; - $db = new $dbal(); - $db->sql_connect($config['dbhost'], $config['dbuser'], $config['dbpasswd'], $config['dbname'], $config['dbport']); - - return $db; - } - public function setExpectedTriggerError($errno, $message = '') { $exceptionName = ''; From a397f81a2bc03019910c088376cf563d05dadf93 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 22 Oct 2010 19:50:43 +0200 Subject: [PATCH 353/393] [task/mssql-db-tests] Allow test configuration with environment variables. To allow execution of the tests with different configurations without having to use the test_config.php file, environment variables of the form PHPBB_TEST_ can now be used, e.g. PHPBB_TEST_DBMS to set the variables otherwise expected in test_config.php PHPBB3-9868 --- tests/RUNNING_TESTS.txt | 8 +++++++- tests/test_framework/phpbb_database_test_case.php | 13 ++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/RUNNING_TESTS.txt b/tests/RUNNING_TESTS.txt index a5d3111242..74a0635c1a 100644 --- a/tests/RUNNING_TESTS.txt +++ b/tests/RUNNING_TESTS.txt @@ -36,13 +36,19 @@ found on the wiki (see below). $dbuser = 'user'; $dbpasswd = 'password'; +Alternatively you can specify parameters in the environment, so e.g. the following +will run phpunit with the same parameters as in the shown test_config.php file: + + $ PHPBB_TEST_DBMS='mysqli' PHPBB_TEST_DBHOST='localhost' \ + PHPBB_TEST_DBNAME='database' PHPBB_TEST_DBUSER='user' \ + PHPBB_TEST_DBPASSWD='password' phpunit all_tests.php Running ======= Once the prerequisites are installed, run the tests from tests directory: -$ phpunit all_tests.php + $ phpunit all_tests.php More Information ================ diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index 33dbce709b..8b96298b6a 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -85,7 +85,18 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test { static $show_error = true; - if (file_exists('test_config.php')) + if (isset($_SERVER['PHPBB_TEST_DBMS'])) + { + return array( + 'dbms' => isset($_SERVER['PHPBB_TEST_DBMS']) ? $_SERVER['PHPBB_TEST_DBMS'] : '', + 'dbhost' => isset($_SERVER['PHPBB_TEST_DBHOST']) ? $_SERVER['PHPBB_TEST_DBHOST'] : '', + 'dbport' => isset($_SERVER['PHPBB_TEST_DBPORT']) ? $_SERVER['PHPBB_TEST_DBPORT'] : '', + 'dbname' => isset($_SERVER['PHPBB_TEST_DBNAME']) ? $_SERVER['PHPBB_TEST_DBNAME'] : '', + 'dbuser' => isset($_SERVER['PHPBB_TEST_DBUSER']) ? $_SERVER['PHPBB_TEST_DBUSER'] : '', + 'dbpasswd' => isset($_SERVER['PHPBB_TEST_DBPASSWD']) ? $_SERVER['PHPBB_TEST_DBPASSWD'] : '', + ); + } + else if (file_exists('test_config.php')) { include('test_config.php'); From 832035f744f8fc42f1ac491d6847dca06b9c837b Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 22 Oct 2010 20:34:52 +0200 Subject: [PATCH 354/393] [task/mssql-db-tests] Refactored getConnection into multiple smaller parts. This is a first step to simplify the extraction of database specific code parts into separate classes. PHPBB3-9868 --- .../phpbb_database_test_case.php | 161 +++++++++++------- 1 file changed, 97 insertions(+), 64 deletions(-) diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index 8b96298b6a..49121b8f8d 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -83,8 +83,6 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test public function get_database_config() { - static $show_error = true; - if (isset($_SERVER['PHPBB_TEST_DBMS'])) { return array( @@ -157,76 +155,111 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test return $data; } + /** + * Returns a PDO connection for the configured database. + * + * @param array $config The database configuration + * @param array $dbms Information on the used DBMS. + * @param bool $use_db Whether the DSN should be tied to a + * particular database making it impossible + * to delete that database. + * @return PDO The PDO database connection. + */ + public function new_pdo($config, $dbms, $delete_db) + { + $dsn = $dbms['PDO'] . ':'; + + switch ($config['dbms']) + { + case 'sqlite': + $dsn .= $config['dbhost']; + break; + + default: + $dsn .= 'host=' . $config['dbhost']; + + if ($use_db) + { + $dsn .= ';dbname=' . $config['dbname']; + } + break; + } + + $pdo = new PDO($dsn, $config['dbuser'], $config['dbpasswd']);; + + // good for debug + // $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + + return $pdo; + } + + private function recreate_db($config, $dbms) + { + switch ($config['dbms']) + { + case 'sqlite': + if (file_exists($config['dbhost'])) + { + unlink($config['dbhost']); + } + break; + + default: + $pdo = $this->new_pdo($config, $dbms, false); + + try + { + $pdo->exec('DROP DATABASE ' . $config['dbname']); + } + catch (PDOException $e){} // ignore non existent db + + $pdo->exec('CREATE DATABASE ' . $config['dbname']); + break; + } + } + + private function load_schema($pdo, $config, $dbms) + { + if ($config['dbms'] == 'mysql') + { + $sth = $pdo->query('SELECT VERSION() AS version'); + $row = $sth->fetch(PDO::FETCH_ASSOC); + + if (version_compare($row['version'], '4.1.3', '>=')) + { + $dbms['SCHEMA'] .= '_41'; + } + else + { + $dbms['SCHEMA'] .= '_40'; + } + } + + $sql = $this->split_sql_file(file_get_contents("../phpBB/install/schemas/{$dbms['SCHEMA']}_schema.sql"), $config['dbms']); + + foreach ($sql as $query) + { + $pdo->exec($query); + } + } + public function getConnection() { static $already_connected; - $database_config = $this->get_database_config(); + $config = $this->get_database_config(); + $dbms = $this->get_dbms_data($config['dbms']); - $dbms_data = $this->get_dbms_data($database_config['dbms']); - - if ($already_connected) + if (!$already_connected) { - if ($database_config['dbms'] == 'sqlite') - { - $pdo = new PDO($dbms_data['PDO'] . ':' . $database_config['dbhost']); - } - else - { - $pdo = new PDO($dbms_data['PDO'] . ':host=' . $database_config['dbhost'] . ';dbname=' . $database_config['dbname'], $database_config['dbuser'], $database_config['dbpasswd']); - } + $this->recreate_db($config, $dbms); } - else + + $pdo = $this->new_pdo($config, $dbms, true); + + if (!$already_connected) { - if ($database_config['dbms'] == 'sqlite') - { - // delete existing database - if (file_exists($database_config['dbhost'])) - { - unlink($database_config['dbhost']); - } - - $pdo = new PDO($dbms_data['PDO'] . ':' . $database_config['dbhost']); - } - else - { - $pdo = new PDO($dbms_data['PDO'] . ':host=' . $database_config['dbhost'] . ';', $database_config['dbuser'], $database_config['dbpasswd']);try - { - $pdo->exec('DROP DATABASE ' . $database_config['dbname']); - } - catch (PDOException $e){} // ignore non existent db - - $pdo->exec('CREATE DATABASE ' . $database_config['dbname']); - - $pdo = new PDO($dbms_data['PDO'] . ':host=' . $database_config['dbhost'] . ';dbname=' . $database_config['dbname'], $database_config['dbuser'], $database_config['dbpasswd']); - } - - // good for debug - // $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - - if ($database_config['dbms'] == 'mysql') - { - $sth = $pdo->query('SELECT VERSION() AS version'); - $row = $sth->fetch(PDO::FETCH_ASSOC); - - if (version_compare($row['version'], '4.1.3', '>=')) - { - $dbms_data['SCHEMA'] .= '_41'; - } - else - { - $dbms_data['SCHEMA'] .= '_40'; - } - - unset($row, $sth); - } - - $sql_query = $this->split_sql_file(file_get_contents("../phpBB/install/schemas/{$dbms_data['SCHEMA']}_schema.sql"), $database_config['dbms']); - - foreach ($sql_query as $sql) - { - $pdo->exec($sql); - } + $this->load_schema($pdo, $config, $dbms); $already_connected = true; } From 801f66b4a2b6caae7b818a1aecb1c70d6ae155bb Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 22 Oct 2010 21:00:15 +0200 Subject: [PATCH 355/393] [task/mssql-db-tests] Add support for odbc & sqlsrv PDO test connections PHPBB3-9868 --- .../phpbb_database_test_case.php | 100 ++++++++++++++++-- 1 file changed, 94 insertions(+), 6 deletions(-) diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index 49121b8f8d..de9a91fa45 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -52,7 +52,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test 'mssqlnative' => array( 'SCHEMA' => 'mssql', 'DELIM' => 'GO', - 'PDO' => 'odbc', + 'PDO' => 'sqlsrv', ), 'oracle' => array( 'SCHEMA' => 'oracle', @@ -145,7 +145,8 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test if ($dbms == 'sqlite') { - // trim # off query to satisfy sqlite + // remove comment lines starting with # - they are not proper sqlite + // syntax and break sqlite2 foreach ($data as $i => $query) { $data[$i] = preg_replace('/^#.*$/m', "\n", $query); @@ -155,6 +156,66 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test return $data; } + /** + * Retrieves a list of all tables from the database. + * + * @param PDO $pdo + * @param string $dbms + * @return array(string) + */ + function get_tables($pdo, $dbms) + { + switch ($pdo) + { + case 'mysql': + case 'mysql4': + case 'mysqli': + $sql = 'SHOW TABLES'; + break; + + case 'sqlite': + $sql = 'SELECT name + FROM sqlite_master + WHERE type = "table"'; + break; + + case 'mssql': + case 'mssql_odbc': + case 'mssqlnative': + $sql = "SELECT name + FROM sysobjects + WHERE type='U'"; + break; + + case 'postgres': + $sql = 'SELECT relname + FROM pg_stat_user_tables'; + break; + + case 'firebird': + $sql = 'SELECT rdb$relation_name + FROM rdb$relations + WHERE rdb$view_source is null + AND rdb$system_flag = 0'; + break; + + case 'oracle': + $sql = 'SELECT table_name + FROM USER_TABLES'; + break; + } + + $result = $pdo->query($sql); + + $tables = array(); + while ($row = $result->fetch(PDO::FETCH_NUM)) + { + $tables[] = current($row); + } + + return $tables; + } + /** * Returns a PDO connection for the configured database. * @@ -165,16 +226,32 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test * to delete that database. * @return PDO The PDO database connection. */ - public function new_pdo($config, $dbms, $delete_db) + public function new_pdo($config, $dbms, $use_db) { $dsn = $dbms['PDO'] . ':'; - switch ($config['dbms']) + switch ($dbms['PDO']) { - case 'sqlite': + case 'sqlite2': $dsn .= $config['dbhost']; break; + case 'sqlsrv': + // prefix the hostname (or DSN) with Server= so using just (local)\SQLExpress + // works for example, further parameters can still be appended using ;x=y + $dsn .= 'Server='; + // no break -> rest like ODBC + case 'odbc': + // for ODBC assume dbhost is a suitable DSN + // e.g. Driver={SQL Server Native Client 10.0};Server=(local)\SQLExpress; + $dsn .= $config['dbhost']; + + if ($use_db) + { + $dsn .= ';Database=' . $config['dbname']; + } + break; + default: $dsn .= 'host=' . $config['dbhost']; @@ -211,7 +288,18 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test { $pdo->exec('DROP DATABASE ' . $config['dbname']); } - catch (PDOException $e){} // ignore non existent db + catch (PDOException $e) + { + // try to delete all tables if dropping the database was not possible. + foreach ($this->get_tables() as $table) + { + try + { + $pdo->exec('DROP TABLE ' . $table); + } + catch (PDOException $e){} // ignore non-existent tables + } + } $pdo->exec('CREATE DATABASE ' . $config['dbname']); break; From ee0993a8a6725bbacc341f50e37710b51df4ea5c Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 25 Oct 2010 15:50:09 +0200 Subject: [PATCH 356/393] [task/mssql-db-tests] sql_query_limit must return all results when total = 0 PHPBB3-9868 --- phpBB/includes/db/mssqlnative.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/db/mssqlnative.php b/phpBB/includes/db/mssqlnative.php index 44d5722e4f..93a8f91613 100644 --- a/phpBB/includes/db/mssqlnative.php +++ b/phpBB/includes/db/mssqlnative.php @@ -347,7 +347,8 @@ class dbal_mssqlnative extends dbal { $this->query_result = false; - if ($offset === false || $offset == 0) + // total == 0 means all results - not zero results + if ($offset == 0 && $total !== 0) { if (strpos($query, "SELECT") === false) { @@ -358,13 +359,21 @@ class dbal_mssqlnative extends dbal $query = preg_replace('/SELECT(\s*DISTINCT)?/Dsi', 'SELECT$1 TOP '.$total, $query); } } - else + else if ($offset > 0) { $query = preg_replace('/SELECT(\s*DISTINCT)?/Dsi', 'SELECT$1 TOP(10000000) ', $query); $query = 'SELECT * FROM (SELECT sub2.*, ROW_NUMBER() OVER(ORDER BY sub2.line2) AS line3 - FROM (SELECT 1 AS line2, sub1.* FROM (' . $query . ') AS sub1) as sub2) AS sub3 - WHERE line3 BETWEEN ' . ($offset+1) . ' AND ' . ($offset + $total); + FROM (SELECT 1 AS line2, sub1.* FROM (' . $query . ') AS sub1) as sub2) AS sub3'; + + if ($total > 0) + { + $query .= ' WHERE line3 BETWEEN ' . ($offset+1) . ' AND ' . ($offset + $total); + } + else + { + $query .= ' WHERE line3 > ' . $offset; + } } $result = $this->sql_query($query, $cache_ttl); @@ -614,4 +623,4 @@ class dbal_mssqlnative extends dbal } } -?> \ No newline at end of file +?> From 9b4da986536e0bce0359d300df84fb03e265ef53 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 25 Oct 2010 16:17:29 +0200 Subject: [PATCH 357/393] [task/mssql-db-tests] PHPUnit output got stuck after unterminated ob_start. PHPBB3-9868 --- tests/template/template.php | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/template/template.php b/tests/template/template.php index 024d3712f7..0c2ca8a032 100644 --- a/tests/template/template.php +++ b/tests/template/template.php @@ -36,6 +36,7 @@ class phpbb_template_template_test extends phpbb_test_case // reset the error level even when an error occured // PHPUnit turns trigger_error into exceptions as well error_reporting($error_level); + ob_end_clean(); throw $exception; } From fa8dca2400f1bef5e3faa43e491a5e2c15eafe11 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 25 Oct 2010 19:20:51 +0200 Subject: [PATCH 358/393] [task/mssql-db-tests] Split up database tests into SELECT and write operations SELECT is based on the user table fixture, write (INSERT/UPDATE/DELETE) is tested using the config table fixture. PHPBB3-9868 --- tests/dbal/all_tests.php | 6 +- tests/dbal/fixtures/config.xml | 18 ++ tests/dbal/{dbal.php => select.php} | 172 +----------------- tests/dbal/write.php | 172 ++++++++++++++++++ .../phpbb_database_test_case.php | 10 +- 5 files changed, 200 insertions(+), 178 deletions(-) create mode 100644 tests/dbal/fixtures/config.xml rename tests/dbal/{dbal.php => select.php} (74%) create mode 100644 tests/dbal/write.php diff --git a/tests/dbal/all_tests.php b/tests/dbal/all_tests.php index 7aee0f6b16..cfa8176246 100644 --- a/tests/dbal/all_tests.php +++ b/tests/dbal/all_tests.php @@ -15,7 +15,8 @@ if (!defined('PHPUnit_MAIN_METHOD')) require_once 'test_framework/framework.php'; require_once 'PHPUnit/TextUI/TestRunner.php'; -require_once 'dbal/dbal.php'; +require_once 'dbal/select.php'; +require_once 'dbal/write.php'; class phpbb_dbal_all_tests { @@ -28,7 +29,8 @@ class phpbb_dbal_all_tests { $suite = new PHPUnit_Framework_TestSuite('phpBB Database Abstraction Layer'); - $suite->addTestSuite('phpbb_dbal_test'); + $suite->addTestSuite('phpbb_dbal_select_test'); + $suite->addTestSuite('phpbb_dbal_write_test'); return $suite; } diff --git a/tests/dbal/fixtures/config.xml b/tests/dbal/fixtures/config.xml new file mode 100644 index 0000000000..019f582a91 --- /dev/null +++ b/tests/dbal/fixtures/config.xml @@ -0,0 +1,18 @@ + + +
            {FORUM_NEW_IMG}{L_NEW_POSTS}{FORUM_UNREAD_IMG}{L_UNREAD_POSTS}    {FORUM_IMG}{L_NO_NEW_POSTS}{L_NO_UNREAD_POSTS}    {FORUM_LOCKED_IMG} {L_FORUM_LOCKED} - - + + - + - - + + - + - - + + - + diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index d18508ccbc..ee098c9f4a 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -273,16 +273,16 @@ $template->assign_vars(array( 'POST_IMG' => ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->img('button_topic_locked', $post_alt) : $user->img('button_topic_new', $post_alt), 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), - 'FOLDER_IMG' => $user->img('topic_read', 'NO_NEW_POSTS'), - 'FOLDER_NEW_IMG' => $user->img('topic_unread', 'NEW_POSTS'), - 'FOLDER_HOT_IMG' => $user->img('topic_read_hot', 'NO_NEW_POSTS_HOT'), - 'FOLDER_HOT_NEW_IMG' => $user->img('topic_unread_hot', 'NEW_POSTS_HOT'), - 'FOLDER_LOCKED_IMG' => $user->img('topic_read_locked', 'NO_NEW_POSTS_LOCKED'), - 'FOLDER_LOCKED_NEW_IMG' => $user->img('topic_unread_locked', 'NEW_POSTS_LOCKED'), + 'FOLDER_IMG' => $user->img('topic_read', 'NO_UNREAD_POSTS'), + 'FOLDER_UNREAD_IMG' => $user->img('topic_unread', 'UNREAD_POSTS'), + 'FOLDER_HOT_IMG' => $user->img('topic_read_hot', 'NO_UNREAD_POSTS_HOT'), + 'FOLDER_HOT_UNREAD_IMG' => $user->img('topic_unread_hot', 'UNREAD_POSTS_HOT'), + 'FOLDER_LOCKED_IMG' => $user->img('topic_read_locked', 'NO_UNREAD_POSTS_LOCKED'), + 'FOLDER_LOCKED_UNREAD_IMG' => $user->img('topic_unread_locked', 'UNREAD_POSTS_LOCKED'), 'FOLDER_STICKY_IMG' => $user->img('sticky_read', 'POST_STICKY'), - 'FOLDER_STICKY_NEW_IMG' => $user->img('sticky_unread', 'POST_STICKY'), + 'FOLDER_STICKY_UNREAD_IMG' => $user->img('sticky_unread', 'POST_STICKY'), 'FOLDER_ANNOUNCE_IMG' => $user->img('announce_read', 'POST_ANNOUNCEMENT'), - 'FOLDER_ANNOUNCE_NEW_IMG' => $user->img('announce_unread', 'POST_ANNOUNCEMENT'), + 'FOLDER_ANNOUNCE_UNREAD_IMG'=> $user->img('announce_unread', 'POST_ANNOUNCEMENT'), 'FOLDER_MOVED_IMG' => $user->img('topic_moved', 'TOPIC_MOVED'), 'REPORTED_IMG' => $user->img('icon_topic_reported', 'TOPIC_REPORTED'), 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'TOPIC_UNAPPROVED'), diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 8e0521522d..8926d5a40b 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1513,7 +1513,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'EDIT_REASON' => $row['post_edit_reason'], 'BUMPED_MESSAGE' => $l_bumped_by, - 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'NEW_POST') : $user->img('icon_post_target', 'POST'), + 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'), 'POST_ICON_IMG' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['img'] : '', 'POST_ICON_IMG_WIDTH' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['width'] : '', 'POST_ICON_IMG_HEIGHT' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['height'] : '', From 8690d25b4fab47853bcab46fc07ee577569c6822 Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Fri, 2 Jul 2010 13:41:52 +0200 Subject: [PATCH 244/393] [ticket/9504] Allow whitespaces in gallery avatars Gallery avatars are discovered on the server filesystem; to allow linking to the images, the filenames are urlencoded before being written to the database. However, getimagesize needs the decoded filename as input. PHPBB3-9504 --- phpBB/includes/functions_user.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 271542efdd..f58e19ddbe 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -2348,7 +2348,7 @@ function avatar_process_user(&$error, $custom_userdata = false) } else { - list($sql_ary['user_avatar_width'], $sql_ary['user_avatar_height']) = getimagesize($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category . '/' . $sql_ary['user_avatar']); + list($sql_ary['user_avatar_width'], $sql_ary['user_avatar_height']) = getimagesize($phpbb_root_path . $config['avatar_gallery_path'] . '/' . $category . '/' . urldecode($sql_ary['user_avatar'])); $sql_ary['user_avatar'] = $category . '/' . $sql_ary['user_avatar']; } } From 1363ee109ba5e8fece57b296d745f8488f1c79d0 Mon Sep 17 00:00:00 2001 From: rxu Date: Thu, 15 Jul 2010 20:34:12 +0800 Subject: [PATCH 245/393] [ticket/9658] Optimize topic splitting. Split topics takes too long in some cases because of wrong variables or arrays values types adjustment. Cast values representing topic and forum ids as int. PHPBB3-9658 --- phpBB/includes/functions_admin.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 4cd2962e3b..89892feb30 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -573,8 +573,8 @@ function move_posts($post_ids, $topic_id, $auto_sync = true) while ($row = $db->sql_fetchrow($result)) { - $forum_ids[] = $row['forum_id']; - $topic_ids[] = $row['topic_id']; + $forum_ids[] = (int) $row['forum_id']; + $topic_ids[] = (int) $row['topic_id']; } $db->sql_freeresult($result); @@ -591,7 +591,7 @@ function move_posts($post_ids, $topic_id, $auto_sync = true) } $sql = 'UPDATE ' . POSTS_TABLE . ' - SET forum_id = ' . $forum_row['forum_id'] . ", topic_id = $topic_id + SET forum_id = ' . (int) $forum_row['forum_id'] . ", topic_id = $topic_id WHERE " . $db->sql_in_set('post_id', $post_ids); $db->sql_query($sql); @@ -602,7 +602,7 @@ function move_posts($post_ids, $topic_id, $auto_sync = true) if ($auto_sync) { - $forum_ids[] = $forum_row['forum_id']; + $forum_ids[] = (int) $forum_row['forum_id']; sync('topic_reported', 'topic_id', $topic_ids); sync('topic_attachment', 'topic_id', $topic_ids); From 16c95b4f8394e65faa34380640c892b1f99be1ed Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Sun, 18 Jul 2010 11:51:13 -0500 Subject: [PATCH 246/393] [ticket/9727] Smiley Path replacement in feeds is too generic The smiley path replacement in the feeds was too broad: any post content containing "./" was changed to the fully qualified board URL. This broke CSS for example. PHPBB3-9727 --- phpBB/feed.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/feed.php b/phpBB/feed.php index 88c30c5d4f..c4b71f3a26 100644 --- a/phpBB/feed.php +++ b/phpBB/feed.php @@ -276,8 +276,8 @@ function feed_generate_content($content, $uid, $bitfield, $options) // Add newlines $content = str_replace('
            ', '
            ' . "\n", $content); - // Relative Path to Absolute path, Windows style - $content = str_replace('./', $board_url . '/', $content); + // Convert smiley Relative paths to Absolute path, Windows style + $content = str_replace($phpbb_root_path . $config['smilies_path'], $board_url . '/' . $config['smilies_path'], $content); // Remove "Select all" link and mouse events $content = str_replace('' . $user->lang['SELECT_ALL_CODE'] . '', '', $content); From 875fcda506563d41a53f1d1ec3530662df975b81 Mon Sep 17 00:00:00 2001 From: Tabitha Backoff Date: Mon, 26 Apr 2010 07:45:31 -0400 Subject: [PATCH 247/393] [ticket/9099] Add missing commas in acp language. PHPBB3-9099 --- phpBB/language/en/acp/board.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 80db81653d..ce0b81530d 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -393,7 +393,7 @@ $lang = array_merge($lang, array( 'LDAP_NO_EMAIL' => 'The specified e-mail attribute does not exist.', 'LDAP_NO_IDENTITY' => 'Could not find a login identity for %s.', 'LDAP_PASSWORD' => 'LDAP password', - 'LDAP_PASSWORD_EXPLAIN' => 'Leave blank to use anonymous binding. Else fill in the password for the above user. Required for Active Directory Servers.
            Warning: This password will be stored as plain text in the database visible to everybody who can access your database or who can view this configuration page.', + 'LDAP_PASSWORD_EXPLAIN' => 'Leave blank to use anonymous binding. Else fill in the password for the above user. Required for Active Directory Servers.
            Warning: This password will be stored as plain text in the database, visible to everybody who can access your database or who can view this configuration page.', 'LDAP_PORT' => 'LDAP server port', 'LDAP_PORT_EXPLAIN' => 'Optionally you can specify a port which should be used to connect to the LDAP server instead of the default port 389.', 'LDAP_SERVER' => 'LDAP server name', @@ -505,7 +505,7 @@ $lang = array_merge($lang, array( 'SMTP_DIGEST_MD5' => 'DIGEST-MD5', 'SMTP_LOGIN' => 'LOGIN', 'SMTP_PASSWORD' => 'SMTP password', - 'SMTP_PASSWORD_EXPLAIN' => 'Only enter a password if your SMTP server requires it.
            Warning: This password will be stored as plain text in the database visible to everybody who can access your database or who can view this configuration page.', + 'SMTP_PASSWORD_EXPLAIN' => 'Only enter a password if your SMTP server requires it.
            Warning: This password will be stored as plain text in the database, visible to everybody who can access your database or who can view this configuration page.', 'SMTP_PLAIN' => 'PLAIN', 'SMTP_POP_BEFORE_SMTP' => 'POP-BEFORE-SMTP', 'SMTP_PORT' => 'SMTP server port', @@ -528,7 +528,7 @@ $lang = array_merge($lang, array( 'JAB_PACKAGE_SIZE' => 'Jabber package size', 'JAB_PACKAGE_SIZE_EXPLAIN' => 'This is the number of messages sent in one package. If set to 0 the message is sent immediately and will not be queued for later sending.', 'JAB_PASSWORD' => 'Jabber password', - 'JAB_PASSWORD_EXPLAIN' => 'Warning: This password will be stored as plain text in the database visible to everybody who can access your database or who can view this configuration page.', + 'JAB_PASSWORD_EXPLAIN' => 'Warning: This password will be stored as plain text in the database, visible to everybody who can access your database or who can view this configuration page.', 'JAB_PORT' => 'Jabber port', 'JAB_PORT_EXPLAIN' => 'Leave blank unless you know it is not port 5222.', 'JAB_SERVER' => 'Jabber server', From 72dddf3aa3f900a5623410ffb4e44295251c4754 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 22 Jul 2010 00:31:13 +0200 Subject: [PATCH 248/393] [ticket/9744] Fix mistyped word 'then' in FAQ. It should be 'than'. PHPBB3-9744 --- phpBB/language/en/help_faq.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/help_faq.php b/phpBB/language/en/help_faq.php index c76c281df5..3b7dc02d3f 100644 --- a/phpBB/language/en/help_faq.php +++ b/phpBB/language/en/help_faq.php @@ -128,7 +128,7 @@ $help = array( ), array( 0 => 'Why can’t I add more poll options?', - 1 => 'The limit for poll options is set by the board administrator. If you feel you need to add more options to your poll then the allowed amount, contact the board administrator.' + 1 => 'The limit for poll options is set by the board administrator. If you feel you need to add more options to your poll than the allowed amount, contact the board administrator.' ), array( 0 => 'How do I edit or delete a poll?', From afff4f79232233a4c6d3a5bcca6946bf9b92d0db Mon Sep 17 00:00:00 2001 From: Nick Anderegg Date: Wed, 28 Apr 2010 17:05:12 -0400 Subject: [PATCH 249/393] [ticket/9068] Added a missing comma in acp load settings explanation text. PHPBB3-9068 --- phpBB/language/en/acp/board.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 80db81653d..91ee422a58 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -360,7 +360,7 @@ $lang = array_merge($lang, array( 'RECOMPILE_STYLES' => 'Recompile stale style components', 'RECOMPILE_STYLES_EXPLAIN' => 'Check for updated style components on filesystem and recompile.', 'YES_ANON_READ_MARKING' => 'Enable topic marking for guests', - 'YES_ANON_READ_MARKING_EXPLAIN' => 'Stores read/unread status information for guests. If disabled posts are always read for guests.', + 'YES_ANON_READ_MARKING_EXPLAIN' => 'Stores read/unread status information for guests. If disabled, posts are always marked read for guests.', 'YES_BIRTHDAYS' => 'Enable birthday listing', 'YES_BIRTHDAYS_EXPLAIN' => 'If disabled the birthday listing is no longer displayed. To let this setting take effect the birthday feature needs to be enabled too.', 'YES_JUMPBOX' => 'Enable display of jumpbox', From c284ffade9bce9da06f8d4bc0d2344c09d2d6223 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Wed, 21 Jul 2010 22:42:44 -0500 Subject: [PATCH 250/393] [ticket/9722] Adjust "New Topic" title attribute for consistency in prosilver Title attribute was being applied to a
            at the top of the page and to an at the bottom of the page. Now both being applied to the
            . PHPBB3-9722 --- phpBB/styles/prosilver/template/viewforum_body.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index 309375c269..12073a39d2 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -39,7 +39,7 @@ From 2f312b2175fd0ff13cb18d499b01a7092a2ad4d4 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Thu, 22 Jul 2010 10:44:31 -0500 Subject: [PATCH 251/393] [ticket/9559] Do not override queue package size in the case of an overflow This reverts r8025 to includes/functions_messenger.php. That code caused problems on hosters with email limits less than package_size*2.5. And it isn't desirable in general to over-ride the admin's configuration options. PHPBB3-9559 --- phpBB/includes/functions_messenger.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 99883cd9ca..bb0d88ec1b 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -671,11 +671,18 @@ class queue $package_size = $data_ary['package_size']; $num_items = (!$package_size || sizeof($data_ary['data']) < $package_size) ? sizeof($data_ary['data']) : $package_size; + /* + * This code is commented out because it causes problems on some web hosts. + * The core problem is rather restrictive email sending limits. + * This code is nly useful if you have no such restrictions from the + * web host and the package size setting is wrong. + // If the amount of emails to be sent is way more than package_size than we need to increase it to prevent backlogs... if (sizeof($data_ary['data']) > $package_size * 2.5) { $num_items = sizeof($data_ary['data']); } + */ switch ($object) { From e5d5d581727ce61e653fdfc9a30effb69799aac5 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 23 Jul 2010 12:48:01 +0200 Subject: [PATCH 252/393] [ticket/9091] Extract IPv4 address from addresses mapped into IPv6. PHPBB3-9091 --- phpBB/includes/session.php | 11 +++++++++++ phpBB/install/database_update.php | 1 + phpBB/install/install_install.php | 1 + 3 files changed, 13 insertions(+) diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index e157053e61..2ee9365631 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -285,6 +285,17 @@ class session break; } + // Quick check for IPv4-mapped address in IPv6 + if (stripos($ip, '::ffff:') === 0) + { + $ipv4 = substr($ip, 7); + + if (preg_match(get_preg_expression('ipv4'), $ipv4)) + { + $ip = $ipv4; + } + } + // Use the last in chain $this->ip = $ip; } diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 83bbbf4577..4524dd20bf 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -119,6 +119,7 @@ $db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false); unset($dbpasswd); $user->ip = (!empty($_SERVER['REMOTE_ADDR'])) ? htmlspecialchars($_SERVER['REMOTE_ADDR']) : ''; +$user->ip = (stripos($user->ip, '::ffff:') === 0) ? substr($user->ip, 7) : $user->ip; $sql = "SELECT config_value FROM " . CONFIG_TABLE . " diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 4c22db07b2..2800c26609 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -1236,6 +1236,7 @@ class install_install extends module $current_time = time(); $user_ip = (!empty($_SERVER['REMOTE_ADDR'])) ? htmlspecialchars($_SERVER['REMOTE_ADDR']) : ''; + $user_ip = (stripos($user_ip, '::ffff:') === 0) ? substr($user_ip, 7) : $user_ip; if ($data['script_path'] !== '/') { From aca0e024faeca67ba5927b9f9ec495d5f687850d Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 23 Jul 2010 18:39:12 +0200 Subject: [PATCH 253/393] [ticket/9702] Take user's timezone settings into account when banning Until -> PHPBB3-9702 --- phpBB/includes/functions_user.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 0b26f28864..d9c7d1f2aa 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -766,7 +766,8 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas if (sizeof($ban_other) == 3 && ((int)$ban_other[0] < 9999) && (strlen($ban_other[0]) == 4) && (strlen($ban_other[1]) == 2) && (strlen($ban_other[2]) == 2)) { - $ban_end = max($current_time, gmmktime(0, 0, 0, (int)$ban_other[1], (int)$ban_other[2], (int)$ban_other[0])); + $time_offset = (isset($user->timezone) && isset($user->dst)) ? (int) $user->timezone + (int) $user->dst : 0; + $ban_end = max($current_time, gmmktime(0, 0, 0, (int)$ban_other[1], (int)$ban_other[2], (int)$ban_other[0]) - $time_offset); } else { From 2f67eafd347134aa05483f44d969128211431b1b Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 23 Jul 2010 19:50:17 +0200 Subject: [PATCH 254/393] [ticket/9503] Show 'No subject specified' in 'Posts awaiting approval'. Show 'No subject specified' in 'Posts awaiting approval' if post subject is empty. PHPBB3-9503 --- phpBB/includes/mcp/mcp_queue.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index f84a8c5f07..179623a8ed 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -428,7 +428,7 @@ class mcp_queue 'POST_ID' => $row['post_id'], 'FORUM_NAME' => (!$global_topic) ? $forum_names[$row['forum_id']] : $user->lang['GLOBAL_ANNOUNCEMENT'], - 'POST_SUBJECT' => $row['post_subject'], + 'POST_SUBJECT' => ($row['post_subject'] != '') ? $row['post_subject'] : $user->lang['NO_SUBJECT'], 'TOPIC_TITLE' => $row['topic_title'], 'POST_TIME' => $user->format_date($row['post_time'])) ); From 95e0340daf8ef9cc5426e4b61a7b292ae57443e6 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 23 Jul 2010 20:30:21 +0200 Subject: [PATCH 255/393] [ticket/9644] Check $mode before calling user_notification() from submit_post() PHPBB3-9644 --- phpBB/includes/functions_posting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index f6f90575d4..919412dd67 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -2583,7 +2583,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u } // Send Notifications - if ($mode != 'edit' && $mode != 'delete' && $post_approval) + if (($mode == 'reply' || $mode == 'quote' || $mode == 'post') && $post_approval) { user_notification($mode, $subject, $data['topic_title'], $data['forum_name'], $data['forum_id'], $data['topic_id'], $data['post_id']); } From 66fc086742d052cada3e582f6a08ca48bd0b0714 Mon Sep 17 00:00:00 2001 From: Richard Foote Date: Sat, 24 Jul 2010 11:47:36 +0200 Subject: [PATCH 256/393] [ticket/9748] Replace
            before converting < and > to their entities. PHPBB3-9748 --- phpBB/install/convertors/functions_phpbb20.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/install/convertors/functions_phpbb20.php b/phpBB/install/convertors/functions_phpbb20.php index b80c7673e3..78224dd5da 100644 --- a/phpBB/install/convertors/functions_phpbb20.php +++ b/phpBB/install/convertors/functions_phpbb20.php @@ -1239,9 +1239,9 @@ function phpbb_prepare_message($message) // Already the new user id ;) $user_id = $convert->row['poster_id']; + $message = str_replace('
            ', "\n", $message); $message = str_replace('<', '<', $message); $message = str_replace('>', '>', $message); - $message = str_replace('
            ', "\n", $message); // make the post UTF-8 $message = phpbb_set_encoding($message); From 4d0a53b5ee88b9a5a810eb3bcb5cee35659ee5aa Mon Sep 17 00:00:00 2001 From: rxu Date: Sun, 25 Jul 2010 16:57:00 +0800 Subject: [PATCH 257/393] [ticket/9747] Improve word censor. Better handling of the asterisk inside censor pattern like 'bad*word' etc. PHPBB3-9747 --- phpBB/includes/cache.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/cache.php b/phpBB/includes/cache.php index 6b1e078ca4..b50fab4ca2 100644 --- a/phpBB/includes/cache.php +++ b/phpBB/includes/cache.php @@ -88,7 +88,14 @@ class cache extends acm { if ($unicode) { - $censors['match'][] = '#(? Date: Mon, 26 Jul 2010 13:25:13 -0500 Subject: [PATCH 258/393] [ticket/9499] Unify definition of dE() and other javascript functions dE() was defined differently in the ACP and in prosilver. Other javascript in editor.js files has also been unified (taking the prosilver implementation as cannonical) PHPBB3-9499 --- phpBB/adm/style/editor.js | 15 ++++++++++----- phpBB/styles/prosilver/template/forum_fn.js | 13 +++++++++---- phpBB/styles/subsilver2/template/editor.js | 5 +++-- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/phpBB/adm/style/editor.js b/phpBB/adm/style/editor.js index 7e3ce1c708..217aa699e2 100644 --- a/phpBB/adm/style/editor.js +++ b/phpBB/adm/style/editor.js @@ -46,7 +46,11 @@ function initInsertions() { textarea.focus(); baseHeight = doc.selection.createRange().duplicate().boundingHeight; - // document.body.focus(); + + if (!document.forms[form_name]) + { + document.body.focus(); + } } } @@ -230,6 +234,7 @@ function addquote(post_id, username) theSelection = theSelection.replace(/<\;/ig, '<'); theSelection = theSelection.replace(/>\;/ig, '>'); theSelection = theSelection.replace(/&\;/ig, '&'); + theSelection = theSelection.replace(/ \;/ig, ' '); } else if (document.all) { @@ -273,8 +278,8 @@ function mozWrap(txtarea, open, close) var s3 = (txtarea.value).substring(selEnd, selLength); txtarea.value = s1 + open + s2 + close + s3; - txtarea.selectionStart = selEnd + open.length + close.length; - txtarea.selectionEnd = txtarea.selectionStart; + txtarea.selectionStart = selStart + open.length; + txtarea.selectionEnd = selEnd + open.length; txtarea.focus(); txtarea.scrollTop = scrollTop; @@ -327,8 +332,8 @@ function colorPalette(dir, width, height) for (b = 0; b < 5; b++) { color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]); - document.write('
            '); } diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index 6fb3778952..4a85858df5 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -98,16 +98,21 @@ function viewableArea(e, itself) /** * Set display of page element * s[-1,0,1] = hide,toggle display,show +* type = string: inline, block, inline-block or other CSS "display" type */ -function dE(n, s) +function dE(n, s, type) { - var e = document.getElementById(n); + if (!type) + { + type = 'block'; + } + var e = document.getElementById(n); if (!s) { - s = (e.style.display == '' || e.style.display == 'block') ? -1 : 1; + s = (e.style.display == '' || e.style.display == type) ? -1 : 1; } - e.style.display = (s == 1) ? 'block' : 'none'; + e.style.display = (s == 1) ? type : 'none'; } /** diff --git a/phpBB/styles/subsilver2/template/editor.js b/phpBB/styles/subsilver2/template/editor.js index e340bc74b5..cd22812bab 100644 --- a/phpBB/styles/subsilver2/template/editor.js +++ b/phpBB/styles/subsilver2/template/editor.js @@ -240,6 +240,7 @@ function addquote(post_id, username, l_wrote) theSelection = theSelection.replace(/<\;/ig, '<'); theSelection = theSelection.replace(/>\;/ig, '>'); theSelection = theSelection.replace(/&\;/ig, '&'); + theSelection = theSelection.replace(/ \;/ig, ' '); } else if (document.all) { @@ -387,8 +388,8 @@ function colorPalette(dir, width, height) for (b = 0; b < 5; b++) { color = String(numberList[r]) + String(numberList[g]) + String(numberList[b]); - document.write(''); } From 843d6e53fb7fe234878b5022dae133fb32b84a86 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 26 Jul 2010 23:57:22 +0200 Subject: [PATCH 259/393] [ticket/9754] Populate S_USER_POSTED variable with correct value in search.php PHPBB3-9754 --- phpBB/search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/search.php b/phpBB/search.php index 1e1e42d01f..ab6339eef7 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -891,7 +891,7 @@ if ($keywords || $author || $author_id || $search_id || $submit) 'S_TOPIC_GLOBAL' => (!$forum_id) ? true : false, 'S_TOPIC_TYPE' => $row['topic_type'], - 'S_USER_POSTED' => (!empty($row['mark_type'])) ? true : false, + 'S_USER_POSTED' => (!empty($row['topic_posted'])) ? true : false, 'S_UNREAD_TOPIC' => $unread_topic, 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_get('m_report', $forum_id)) ? true : false, From 8ea0309ed1e72023cab9daef407005511e99ac14 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Thu, 29 Jul 2010 10:01:35 -0500 Subject: [PATCH 260/393] [ticket/9679] phpBB offers to notify poster even if notification is disabled The "notify user" check box would not do anything if checked in this case, but it was still presented. The checkbox is now only shown if there are notification options enabled. PHPBB3-9679 --- phpBB/includes/mcp/mcp_queue.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index f84a8c5f07..e43881fab2 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -691,16 +691,19 @@ function approve_post($post_id_list, $id, $mode) { $show_notify = false; - foreach ($post_info as $post_data) + if ($config['email_enable'] || $config['jab_enable']) { - if ($post_data['poster_id'] == ANONYMOUS) + foreach ($post_info as $post_data) { - continue; - } - else - { - $show_notify = true; - break; + if ($post_data['poster_id'] == ANONYMOUS) + { + continue; + } + else + { + $show_notify = true; + break; + } } } From ac56b71c3ede46ab839ff77a0b324ef746d90cb0 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Thu, 29 Jul 2010 10:13:17 -0500 Subject: [PATCH 261/393] [ticket/9749] Fulltext mysql unexpected behavior on entering a dash in query The Fulltext_mysql class had different behavior when a dash was entered in the search query than the fulltext_native class. Specifically, a dash was automatically turned into boolean NOT even when the user wanted to search for legitimate hyphenated words like farty-pants PHPBB3-9749 --- phpBB/includes/search/fulltext_mysql.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php index da3833754e..0be3a10e5f 100644 --- a/phpBB/includes/search/fulltext_mysql.php +++ b/phpBB/includes/search/fulltext_mysql.php @@ -122,7 +122,7 @@ class fulltext_mysql extends search_backend if ($terms == 'all') { - $match = array('#\sand\s#iu', '#\sor\s#iu', '#\snot\s#iu', '#\+#', '#-#', '#\|#'); + $match = array('#\sand\s#iu', '#\sor\s#iu', '#\snot\s#iu', '#(^|\s)\+#', '#(^|\s)-#', '#(^|\s)\|#'); $replace = array(' +', ' |', ' -', ' +', ' -', ' |'); $keywords = preg_replace($match, $replace, $keywords); From 15d7010d4605a5f8d0082299a904ed54ad002618 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Thu, 29 Jul 2010 13:19:19 -0500 Subject: [PATCH 262/393] [ticket/9757] Fix empty template variable {HISTORY_TITLE} The template variable {HISTORY_TITLE} was always being set to the empty string. It is now filled with the title of the currently displayed message. It is not showed in prosilver or subsilver2 for aesthetic reasons (title is already prominent) PHPBB3-9757 --- phpBB/includes/functions_privmsgs.php | 4 ++-- phpBB/styles/prosilver/template/ucp_pm_history.html | 2 +- phpBB/styles/subsilver2/template/ucp_pm_history.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 4fc5034f7b..c4cbb7ca1e 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1751,6 +1751,8 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode return false; } + $title = $row['message_subject']; + $rowset = array(); $bbcode_bitfield = ''; $folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm') . '&folder='; @@ -1774,8 +1776,6 @@ function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode while ($row = $db->sql_fetchrow($result)); $db->sql_freeresult($result); - $title = $row['message_subject']; - if (sizeof($rowset) == 1 && !$in_post_mode) { return false; diff --git a/phpBB/styles/prosilver/template/ucp_pm_history.html b/phpBB/styles/prosilver/template/ucp_pm_history.html index c555e90640..9051eb2ee0 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_history.html +++ b/phpBB/styles/prosilver/template/ucp_pm_history.html @@ -1,7 +1,7 @@

            {L_EXPAND_VIEW} - {L_MESSAGE_HISTORY}: {HISTORY_TITLE} + {L_MESSAGE_HISTORY}:

            diff --git a/phpBB/styles/subsilver2/template/ucp_pm_history.html b/phpBB/styles/subsilver2/template/ucp_pm_history.html index 53391b30c9..8754acaaa2 100644 --- a/phpBB/styles/subsilver2/template/ucp_pm_history.html +++ b/phpBB/styles/subsilver2/template/ucp_pm_history.html @@ -6,7 +6,7 @@
            {FOLDER_NEW_IMG}{L_NEW_POSTS}{FOLDER_UNREAD_IMG}{L_UNREAD_POSTS}    {FOLDER_IMG}{L_NO_NEW_POSTS}{L_NO_UNREAD_POSTS}    {FOLDER_ANNOUNCE_IMG} {L_ICON_ANNOUNCEMENT}
            {FOLDER_HOT_NEW_IMG}{L_NEW_POSTS_HOT}{FOLDER_HOT_UNREAD_IMG}{L_UNREAD_POSTS_HOT}    {FOLDER_HOT_IMG}{L_NO_NEW_POSTS_HOT}{L_NO_UNREAD_POSTS_HOT}    {FOLDER_STICKY_IMG} {L_ICON_STICKY}
            {FOLDER_LOCKED_NEW_IMG}{L_NEW_POSTS_LOCKED}{FOLDER_LOCKED_UNREAD_IMG}{L_UNREAD_POSTS_LOCKED}    {FOLDER_LOCKED_IMG}{L_NO_NEW_POSTS_LOCKED}{L_NO_UNREAD_POSTS_LOCKED}    {FOLDER_MOVED_IMG} {L_TOPIC_MOVED}'); - document.write('#' + color + ''); + document.write(''); + document.write('#' + color + ''); document.writeln(''); - document.write('#' + color + ''); + document.write(''); + document.write('#' + color + ''); document.writeln('
            - +
            {L_MESSAGE_HISTORY} - {HISTORY_TITLE}{L_MESSAGE_HISTORY}
            From 47557fd4d2037915845f9fcfe863cea539eea7ac Mon Sep 17 00:00:00 2001 From: Henry Sudhof Date: Thu, 8 Apr 2010 00:04:47 +0200 Subject: [PATCH 263/393] [ticket/9521] Fix error reporting for the native SQL Server plugin. The native SQL Server plugin used to return an error string when calling sql_error. However, some error condition checks are done using is_array. This patch wraps the error into an array to follow the error logic used elsewhere. PHPBB3-9521 --- phpBB/includes/db/mssqlnative.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) mode change 100644 => 100755 phpBB/includes/db/mssqlnative.php diff --git a/phpBB/includes/db/mssqlnative.php b/phpBB/includes/db/mssqlnative.php old mode 100644 new mode 100755 index 08ee70907c..76595ca873 --- a/phpBB/includes/db/mssqlnative.php +++ b/phpBB/includes/db/mssqlnative.php @@ -502,6 +502,7 @@ class dbal_mssqlnative extends dbal { $errors = @sqlsrv_errors(SQLSRV_ERR_ERRORS); $error_message = ''; + $code = 0; if ($errors != null) { @@ -509,6 +510,7 @@ class dbal_mssqlnative extends dbal { $error_message .= "SQLSTATE: ".$error[ 'SQLSTATE']."\n"; $error_message .= "code: ".$error[ 'code']."\n"; + $code = $error['code']; $error_message .= "message: ".$error[ 'message']."\n"; } $this->last_error_result = $error_message; @@ -518,7 +520,11 @@ class dbal_mssqlnative extends dbal { $error = (isset($this->last_error_result) && $this->last_error_result) ? $this->last_error_result : array(); } - return $error; + + return array( + 'message' => $error, + 'code' => $code, + ); } /** From 8045f63b4122f79c549a436851059c670d13ce44 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 2 Aug 2010 11:35:38 +0200 Subject: [PATCH 264/393] [ticket/9743] Fix background of top2-class in prosilver for RTL-languages. PHPBB3-9743 --- phpBB/styles/prosilver/theme/bidi.css | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/styles/prosilver/theme/bidi.css b/phpBB/styles/prosilver/theme/bidi.css index 109312ac1b..f441784d85 100644 --- a/phpBB/styles/prosilver/theme/bidi.css +++ b/phpBB/styles/prosilver/theme/bidi.css @@ -236,6 +236,7 @@ } .rtl a.top2 { + background-position: 100% 50%; padding-left: 0; padding-right: 15px; } From 3e111bb41ad6a2ea954dd52bcf78b954114c37e9 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 14 May 2010 03:21:08 +0200 Subject: [PATCH 265/393] [ticket/9599] Adding network function tests. PHPBB3-9599 --- tests/all_tests.php | 2 ++ tests/network/all_tests.php | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 tests/network/all_tests.php diff --git a/tests/all_tests.php b/tests/all_tests.php index 7894d688ee..8dc07872e8 100644 --- a/tests/all_tests.php +++ b/tests/all_tests.php @@ -24,6 +24,7 @@ require_once 'template/all_tests.php'; require_once 'text_processing/all_tests.php'; require_once 'dbal/all_tests.php'; require_once 'regex/all_tests.php'; +require_once 'network/all_tests.php'; // exclude the test directory from code coverage reports PHPUnit_Util_Filter::addDirectoryToFilter('./'); @@ -46,6 +47,7 @@ class phpbb_all_tests $suite->addTest(phpbb_text_processing_all_tests::suite()); $suite->addTest(phpbb_dbal_all_tests::suite()); $suite->addTest(phpbb_regex_all_tests::suite()); + $suite->addTest(phpbb_network_all_tests::suite()); return $suite; } diff --git a/tests/network/all_tests.php b/tests/network/all_tests.php new file mode 100644 index 0000000000..07a7e57d48 --- /dev/null +++ b/tests/network/all_tests.php @@ -0,0 +1,36 @@ + Date: Fri, 14 May 2010 03:57:17 +0200 Subject: [PATCH 266/393] [ticket/9599] Adding tests for phpbb_checkdnsrr(). Tests for existing and non-existing records of the types: MX, A, AAAA, NS, CNAME, TXT PHPBB3-9599 --- tests/network/all_tests.php | 4 +++ tests/network/checkdnsrr.php | 63 ++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 tests/network/checkdnsrr.php diff --git a/tests/network/all_tests.php b/tests/network/all_tests.php index 07a7e57d48..b500647f81 100644 --- a/tests/network/all_tests.php +++ b/tests/network/all_tests.php @@ -15,6 +15,8 @@ if (!defined('PHPUnit_MAIN_METHOD')) require_once 'test_framework/framework.php'; require_once 'PHPUnit/TextUI/TestRunner.php'; +require_once 'network/checkdnsrr.php'; + class phpbb_network_all_tests { public static function main() @@ -26,6 +28,8 @@ class phpbb_network_all_tests { $suite = new PHPUnit_Framework_TestSuite('phpBB Network Functions'); + $suite->addTestSuite('phpbb_network_checkdnsrr_test'); + return $suite; } } diff --git a/tests/network/checkdnsrr.php b/tests/network/checkdnsrr.php new file mode 100644 index 0000000000..57fe2761cc --- /dev/null +++ b/tests/network/checkdnsrr.php @@ -0,0 +1,63 @@ +assertEquals($expected, phpbb_checkdnsrr($host, $type)); + } +} From 24e23755cfe57afcf3125ba9c684b32942425696 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 19 May 2010 17:42:44 +0200 Subject: [PATCH 267/393] [ticket/9599] Reimplement phpbb_checkdnsrr() function. Use gethostbyname(), checkdnsrr(), dns_get_record() or nslookup via exec(). PHPBB3-9599 --- phpBB/includes/functions.php | 171 +++++++++++++++++++++++++++++++---- 1 file changed, 153 insertions(+), 18 deletions(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index bc3d721de5..a61c28cb23 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3440,26 +3440,110 @@ function short_ipv6($ip, $length) /** * Wrapper for php's checkdnsrr function. * -* The windows failover is from the php manual -* Please make sure to check the return value for === true and === false, since NULL could -* be returned too. +* @param string $host Fully-Qualified Domain Name +* @param string $type Resource record type to lookup +* Supported types are: MX (default), A, AAAA, NS, TXT, CNAME +* Other types may work or may not work * -* @return true if entry found, false if not, NULL if this function is not supported by this environment +* @return mixed true if entry found, +* false if entry not found, +* null if this function is not supported by this environment +* +* Since null can also be returned, you probably want to compare the result +* with === true or === false, +* +* @author bantu */ -function phpbb_checkdnsrr($host, $type = '') +function phpbb_checkdnsrr($host, $type = 'MX') { - $type = (!$type) ? 'MX' : $type; - - // Call checkdnsrr() if available. This is also the case on Windows with PHP 5.3 or later. - if (function_exists('checkdnsrr')) + // The dot indicates to search the DNS root (helps those having DNS prefixes on the same domain) + if (substr($host, -1) == '.') { - // The dot indicates to search the DNS root (helps those having DNS prefixes on the same domain) - return checkdnsrr($host . '.', $type); + $host_fqdn = $host; + $host = substr($host, 0, -1); } - else if (DIRECTORY_SEPARATOR == '\\' && function_exists('exec')) + else { - // @exec('nslookup -retry=1 -timout=1 -type=' . escapeshellarg($type) . ' ' . escapeshellarg($host), $output); - @exec('nslookup -type=' . escapeshellarg($type) . ' ' . escapeshellarg($host) . '.', $output); + $host_fqdn = $host . '.'; + } + // $host has format some.host.example.com + // $host_fqdn has format some.host.example.com. + + // If we're looking for an A record we can use gethostbyname() + if ($type == 'A' && function_exists('gethostbyname')) + { + return (@gethostbyname($host_fqdn) == $host_fqdn) ? false : true; + } + + // checkdnsrr() is available on Windows since PHP 5.3, + // but until 5.3.3 it only works for MX records + // See: http://bugs.php.net/bug.php?id=51844 + + // Call checkdnsrr() if + // we're looking for an MX record or + // we're not on Windows or + // we're running a PHP version where #51844 has been fixed + + // checkdnsrr() supports AAAA since 5.0.0 + // checkdnsrr() supports TXT since 5.2.4 + if ( + ($type == 'MX' || DIRECTORY_SEPARATOR != '\\' || version_compare(PHP_VERSION, '5.3.3', '>=')) && + ($type != 'AAAA' || version_compare(PHP_VERSION, '5.0.0', '>=')) && + ($type != 'TXT' || version_compare(PHP_VERSION, '5.2.4', '>=')) && + function_exists('checkdnsrr') + ) + { + return checkdnsrr($host_fqdn, $type); + } + + // dns_get_record() is available since PHP 5; since PHP 5.3 also on Windows, + // but on Windows it does not work reliable for AAAA records before PHP 5.3.1 + + // Call dns_get_record() if + // we're not looking for an AAAA record or + // we're not on Windows or + // we're running a PHP version where AAAA lookups work reliable + if ( + ($type != 'AAAA' || DIRECTORY_SEPARATOR != '\\' || version_compare(PHP_VERSION, '5.3.1', '>=')) && + function_exists('dns_get_record') + ) + { + // dns_get_record() expects an integer as second parameter + // We have to convert the string $type to the corresponding integer constant. + $type_constant = 'DNS_' . $type; + $type_param = (defined($type_constant)) ? constant($type_constant) : DNS_ANY; + + // dns_get_record() might throw E_WARNING and return false for records that do not exist + $resultset = @dns_get_record($host_fqdn, $type_param); + + if (empty($resultset) || !is_array($resultset)) + { + return false; + } + else if ($type_param == DNS_ANY) + { + // $resultset is a non-empty array + return true; + } + + foreach ($resultset as $result) + { + if ( + isset($result['host']) && $result['host'] == $host && + isset($result['type']) && $result['type'] == $type + ) + { + return true; + } + } + + return false; + } + + // If we're on Windows we can still try to call nslookup via exec() as a last resort + if (DIRECTORY_SEPARATOR == '\\' && function_exists('exec')) + { + @exec('nslookup -type=' . escapeshellarg($type) . ' ' . escapeshellarg($host_fqdn), $output); // If output is empty, the nslookup failed if (empty($output)) @@ -3469,15 +3553,66 @@ function phpbb_checkdnsrr($host, $type = '') foreach ($output as $line) { - if (!trim($line)) + $line = trim($line); + + if (empty($line)) { continue; } - // Valid records begin with host name: - if (strpos($line, $host) === 0) + // Squash tabs and multiple whitespaces to a single whitespace. + $line = preg_replace('/\s+/', ' ', $line); + + switch ($type) { - return true; + case 'MX': + if (stripos($line, "$host MX") === 0) + { + return true; + } + break; + + case 'NS': + if (stripos($line, "$host nameserver") === 0) + { + return true; + } + break; + + case 'TXT': + if (stripos($line, "$host text") === 0) + { + return true; + } + break; + + case 'CNAME': + if (stripos($line, "$host canonical name") === 0) + { + return true; + } + + default: + case 'A': + case 'AAAA': + if (!empty($host_matches)) + { + // Second line + if (stripos($line, "Address: ") === 0) + { + return true; + } + else + { + $host_matches = false; + } + } + else if (stripos($line, "Name: $host") === 0) + { + // First line + $host_matches = true; + } + break; } } From dd63f57344321a47eac235005ff9975aafa3051e Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 4 Aug 2010 12:35:19 +0200 Subject: [PATCH 268/393] [ticket/9615] magic_quotes_gpc: call stripslashes() before utf8_basename() When magic_quotes_gpc is 'On' it also affects the $_FILES array and a filename like 'bantu"s testfile.txt' will be returned as 'bantu\"s testfile.txt'. Because utf8_basename() also strips off anything before the last backslash the filename was returned as '"s testfile.txt'. Calling stripslashes() before utf8_basename() solves the problem. PHPBB3-9615 --- phpBB/includes/functions_upload.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php index 51fed45ebd..7f09cc1640 100644 --- a/phpBB/includes/functions_upload.php +++ b/phpBB/includes/functions_upload.php @@ -58,8 +58,9 @@ class filespec $this->filename = $upload_ary['tmp_name']; $this->filesize = $upload_ary['size']; - $name = trim(utf8_htmlspecialchars(utf8_basename($upload_ary['name']))); - $this->realname = $this->uploadname = (STRIP) ? stripslashes($name) : $name; + $name = (STRIP) ? stripslashes($upload_ary['name']) : $upload_ary['name']; + $name = trim(utf8_htmlspecialchars(utf8_basename($name))); + $this->realname = $this->uploadname = $name; $this->mimetype = $upload_ary['type']; // Opera adds the name to the mime type From 76348ce43f0dc657182746d185f9882d3349cd2c Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 8 Aug 2010 14:02:34 +0100 Subject: [PATCH 269/393] [ticket/9760] Remove unrestricted wildcards from search terms. Wildcards without any further result restrictions will cause phpBB to search for everything, potentially allowing a DoS attack against the DB server by any user who can use the search system. PHPBB3-9760 --- phpBB/includes/search/fulltext_native.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/search/fulltext_native.php b/phpBB/includes/search/fulltext_native.php index c89e92711e..727e3aaffb 100644 --- a/phpBB/includes/search/fulltext_native.php +++ b/phpBB/includes/search/fulltext_native.php @@ -83,7 +83,9 @@ class fulltext_native extends search_backend { global $db, $user, $config; - $keywords = trim($this->cleanup($keywords, '+-|()*')); + $tokens = '+-|()*'; + + $keywords = trim($this->cleanup($keywords, $tokens)); // allow word|word|word without brackets if ((strpos($keywords, ' ') === false) && (strpos($keywords, '|') !== false) && (strpos($keywords, '(') === false)) @@ -114,6 +116,15 @@ class fulltext_native extends search_backend case ' ': $keywords[$i] = '|'; break; + case '*': + if ($i === 0 || ($keywords[$i - 1] !== '*' && strcspn($keywords[$i - 1], $tokens) === 0)) + { + if ($i === $n - 1 || ($keywords[$i + 1] !== '*' && strcspn($keywords[$i + 1], $tokens) === 0)) + { + $keywords = substr($keywords, 0, $i) . substr($keywords, $i + 1); + } + } + break; } } else From 013f0b62b8094ac537dc5aa025d82d9cb59250f1 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 8 Aug 2010 16:14:05 +0100 Subject: [PATCH 270/393] [ticket/9771] Remove query string parameters that have no name. PHPBB3-9771 --- phpBB/includes/functions.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index bc3d721de5..4c461b5ee8 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2519,6 +2519,11 @@ function build_url($strip_vars = false) $key = $arguments[0]; unset($arguments[0]); + if ($key === '') + { + continue; + } + $query[$key] = implode('=', $arguments); } From 42e7c8a44099f16c8695c3870ac3f8abcbb89a21 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 8 Aug 2010 22:49:48 +0100 Subject: [PATCH 271/393] [ticket/7332] Collapse post details content down to a maximum of 300px heigh The MCP post details can be difficult to use if the post is particularly long this change shrinks the post area to a maximum of 300 pixels, like the topic review, making it easier to access the functions beneath the post content. PHPBB3-7332 --- phpBB/styles/prosilver/template/mcp_post.html | 4 +++- phpBB/styles/prosilver/theme/content.css | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/phpBB/styles/prosilver/template/mcp_post.html b/phpBB/styles/prosilver/template/mcp_post.html index 0265d7ce12..dab2d572a9 100644 --- a/phpBB/styles/prosilver/template/mcp_post.html +++ b/phpBB/styles/prosilver/template/mcp_post.html @@ -54,6 +54,8 @@ + {L_EXPAND_VIEW} +

            {POST_SUBJECT}

            @@ -84,7 +86,7 @@

            -
            +
            {POST_PREVIEW}
            diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index 417537e660..dfe00371e4 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -298,6 +298,15 @@ div[class].topic-actions { display: none; } +/* MCP Post details +----------------------------------------*/ +#post_details +{ + /* This will only work in IE7+, plus the others */ + overflow: auto; + max-height: 300px; +} + /* Content container styles ----------------------------------------*/ .content { From b7a1add009ec36ca1143fa75ebda828d0fdead80 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 8 Aug 2010 22:54:21 +0100 Subject: [PATCH 272/393] [ticket/7332] Redirect users back to post details when performing actions. Moderators are redirected to the index page of the MCP after locking a post, a better location would be to direct them back to the post details. PHPBB3-7332 --- phpBB/includes/mcp/mcp_post.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index 1fbedbac4f..7098b4bbce 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -176,7 +176,7 @@ function mcp_post_details($id, $mode, $action) } $template->assign_vars(array( - 'U_MCP_ACTION' => "$url&i=main&quickmod=1", // Use this for mode paramaters + 'U_MCP_ACTION' => "$url&i=main&quickmod=1&mode=post_details", // Use this for mode paramaters 'U_POST_ACTION' => "$url&i=$id&mode=post_details", // Use this for action parameters 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p=$post_id&f={$post_info['forum_id']}"), From bfa7b287344462bbd6f8a0f02810f7a6b225f65a Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 8 Jul 2010 00:27:45 +0100 Subject: [PATCH 273/393] [task/git-tools] Append ticket identifier to commit message prior to editing. PHPBB3-9770 --- git-tools/hooks/commit-msg | 24 ------------------------ git-tools/hooks/prepare-commit-msg | 10 +++++++++- 2 files changed, 9 insertions(+), 25 deletions(-) delete mode 100755 git-tools/hooks/commit-msg diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg deleted file mode 100755 index db31d93698..0000000000 --- a/git-tools/hooks/commit-msg +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# -# A hook to append PHPBB3- to ticket/ -# branches. -# -# This is a commit-msg hook. -# -# To install this you can either copy or symlink it to -# $GIT_DIR/hooks, example: -# -# ln -s ../../git-tools/hooks/commit-msg \\ -# .git/hooks/commit-msg - -if grep '^\[ticket/' "$1" -then - # get branch name - branch="$(git symbolic-ref HEAD)" - - # strip off refs/heads/ticket - ticket_id="$(echo "$branch" | sed "s/refs\/heads\/ticket\///g")" - - echo >> "$1" - echo "PHPBB3-$ticket_id" >> "$1" -fi diff --git a/git-tools/hooks/prepare-commit-msg b/git-tools/hooks/prepare-commit-msg index 033cb187c7..2bf25e58a4 100755 --- a/git-tools/hooks/prepare-commit-msg +++ b/git-tools/hooks/prepare-commit-msg @@ -30,5 +30,13 @@ branch="$(echo "$branch" | sed "s/refs\/heads\///g")" # * also make sure the branch name begins with bug/ or feature/ if [ "$2" = "" ] then - echo "[$branch] $(cat "$1")" > "$1" + tail=""; + + # Branch is prefixed with 'ticket/', append ticket ID to message + if [ "$branch" != "${branch##ticket/}" ]; + then + tail="\n\nPHPBB3-${branch##ticket/}"; + fi + + echo "[$branch]$tail $(cat "$1")" > "$1" fi From 66e58234ecf05a4c9cbc401490c602694c920ed4 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 8 Jul 2010 01:03:43 +0100 Subject: [PATCH 274/393] [task/git-tools] Beginnings of a syntax checking hook. Currently this hook checks line length is less than or equal to 80 characters. PHPBB3-9768 --- git-tools/hooks/commit-msg | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 git-tools/hooks/commit-msg diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg new file mode 100755 index 0000000000..be1923ab6b --- /dev/null +++ b/git-tools/hooks/commit-msg @@ -0,0 +1,26 @@ +#!/bin/sh +# +# A hook to check syntax of a phpBB3 commit message, per: +# * +# * +# +# This is a commit-msg hook. +# +# To install this you can either copy or symlink it to +# $GIT_DIR/hooks, example: +# +# ln -s ../../git-tools/hooks/commit-msg \\ +# .git/hooks/commit-msg + +status=0; + +if [ "$(wc --max-line-length "$1" | cut -f1 -d" ")" -gt 80 ] +then + echo "The following lines are greater than 80 characters long:\n"; + + grep -nE '.{81,}' "$1"; + + status=1; +fi + +exit $status; From db13dc2d433ad635b8de3454292362d681a92fb4 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Mon, 12 Jul 2010 02:04:29 +0100 Subject: [PATCH 275/393] [task/git-tools] Vastly expanded commit-msg hook. This updated hook supports validates each line of the commit message confirms to the phpBB standards [1], there are two git config options which adjust the behaviour of the hook. They are: * phpbb.hooks.commit-msg.fatal: Set to false for the hook to allow commits with malformed structure, useful if you'll be squashing or editing the commits later. True is the default value. * phpbb.hooks.commit-msg.debug: Any integer value greater than 0 will increase the debugging verbosity of the hook, the default value is 0. [1] http://wiki.phpbb.com/display/DEV/Git PHPBB3-9768 --- git-tools/hooks/commit-msg | 229 ++++++++++++++++++++++++++++++++++++- 1 file changed, 224 insertions(+), 5 deletions(-) diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg index be1923ab6b..894e67aa09 100755 --- a/git-tools/hooks/commit-msg +++ b/git-tools/hooks/commit-msg @@ -12,15 +12,234 @@ # ln -s ../../git-tools/hooks/commit-msg \\ # .git/hooks/commit-msg -status=0; +config_ns="phpbb.hooks.commit-msg"; + +if [ "$(git config --bool $config_ns.fatal)" = "false" ] +then + fatal=0; +else + fatal=1; +fi + +debug_level=$(git config --int $config_ns.debug || echo 0); + +# Error codes +ERR_LENGTH=1; +ERR_HEADER=2; +ERR_EMPTY=3; +ERR_DESCRIPTION=4; +ERR_FOOTER=5; +ERR_EOF=6; +ERR_UNKNOWN=42; + +debug() +{ + local level; + + level=$1; + shift; + + if [ $debug_level -ge $level ] + then + echo $@; + fi +} + +quit() +{ + if [ $1 -gt 0 ] && [ $1 -ne $ERR_UNKNOWN ] && [ $fatal -eq 0 ] + then + exit 0; + else + exit $1; + fi +} if [ "$(wc --max-line-length "$1" | cut -f1 -d" ")" -gt 80 ] then - echo "The following lines are greater than 80 characters long:\n"; + echo "The following lines are greater than 80 characters long:\n" >&2; - grep -nE '.{81,}' "$1"; + grep -nE '.{81,}' "$1" >&2; - status=1; + quit $ERR_LENGTH; fi -exit $status; +lines=$(wc --lines "$1" | cut -f1 -d" "); +expecting=header; +in_description=0; +in_empty=0; +ticket=0; +branch_regex="[a-z]+[a-z0-9-]*[a-z0-9]+"; +i=1; +tickets=""; + +while [ $i -le $lines ] +do + # Grab the line we are studying + line=$(head -n$i "$1" | tail -n1); + + debug 1 "==> [$i] $line (description: $in_description, empty: $in_empty)"; + + err=$ERR_UNKNOWN; + + if [ -z "$expecting" ] + then + quit $err; + fi + + debug 2 "Expecting: $expecting"; + + # Loop over each of the expected line formats + for expect in $expecting + do + # Reset the error code each iteration + err=$ERR_UNKNOWN; + + # Test for validity of each line format + # This is done first so $? contains the result + case $expect in + "header") + err=$ERR_HEADER; + echo "$line" | grep -Eq "^\[(ticket/[0-9]+|feature/$branch_regex|task/$branch_regex)\] [A-Z].+$" + ;; + "empty") + err=$ERR_EMPTY; + echo "$line" | grep -Eq "^$" + ;; + "description") + err=$ERR_DESCRIPTION; + # Free flow text, the line length was constrained by the initial check + echo "$line" | grep -Eq "^.+$"; + ;; + "footer") + err=$ERR_FOOTER; + # Each ticket is on its own line + echo "$line" | grep -Eq "^PHPBB3-[0-9]+$"; + ;; + "eof") + err=$ERR_EOF; + # Should not end up here + false + ;; + *) + echo "Unrecognised token $expect" >&2; + quit $err; + ;; + esac + + # Preserve the result of the line check + result=$?; + + debug 2 "$expect - '$line' - $result"; + + if [ $result -eq 0 ] + then + # Break out the loop on success + # otherwise roll on round and keep looking for a match + break; + fi + done + + if [ $result -eq 0 ] + then + # Have we switched out of description mode? + if [ $in_description -eq 1 ] && [ "$expect" != "description" ] && [ "$expect" != "empty" ] + then + # Yes, okay we need to backtrace one line and reanalyse + in_description=0; + i=$(( $i - $in_empty )); + + # Reset the empty counter + in_empty=0; + continue; + fi + + # Successful match, but on which line format + case $expect in + "header") + expecting="empty eof"; + + echo "$line" | grep -Eq "^\[ticket/[0-9]+\]$" && ( + ticket=$(echo "$line" | sed 's,\[ticket/\([0-9]*\)\].*,\1,'); + ) + ;; + "empty") + # Description might have empty lines as spacing + expecting="footer description"; + in_empty=$(($in_empty + 1)); + + if [ $in_description -eq 1 ] + then + expecting="$expecting empty"; + fi + ;; + "description") + expecting="description empty eof"; + in_description=1; + ;; + "footer") + expecting="footer eof"; + if [ "$tickets" = "" ] + then + tickets="$line"; + else + tickets="$tickets $line"; + fi + ;; + *) + echo "Unrecognised token $expect" >&2; + quit 254; + ;; + esac + + if [ "$expect" != "empty" ] + then + in_empty=0; + fi + + debug 3 "Now expecting: $expecting"; + else + # None of the expected line formats matched + # Guess we'll call it a day here then + echo "Syntax error on line $i:" >&2; + echo ">> $line" >&2; + echo -n "Expecting: " >&2; + echo "$expecting" | sed 's/ /, /g' >&2; + exit $err; + fi + + i=$(( $i + 1 )); +done + +# If EOF is expected exit cleanly +echo "$expecting" | grep -q "eof" || ( + # Unexpected EOF, error + echo "Unexpected EOF encountered" >&2; + quit $ERR_EOF; +) && ( + # Do post scan checks + if [ ! -z "$tickets" ] + then + # Check for duplicate tickets + dupes=$(echo "$tickets" | sed 's/ /\n/g' | sort | uniq -d); + + if [ ! -z "$dupes" ] + then + echo "The following tickets are repeated:" >&2; + echo "$dupes" | sed 's/ /\n/g;s/^/* /g' >&2; + quit $ERR_FOOTER; + fi + fi + # Check the branch ticket is mentioned, doesn't make sense otherwise + if [ $ticket -gt 0 ] + then + echo "$tickets" | grep -Eq "\bPHPBB3-$ticket\b" || ( + echo "Ticket ID [$ticket] of branch missing from list of tickets:" >&2; + echo "$tickets" | sed 's/ /\n/g;s/^/* /g' >&2; + quit $ERR_FOOTER; + ) || exit $?; + fi + # Got here okay exit to reality + exit 0; +); +exit $?; From a9046e5608ed362c7123cb006adab7102cd58e63 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Mon, 12 Jul 2010 02:04:29 +0100 Subject: [PATCH 276/393] [task/git-tools] Adjust the hook to enforce that a ticket is always mentioned PHPBB3-9768 --- git-tools/hooks/commit-msg | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg index 894e67aa09..b04a761c29 100755 --- a/git-tools/hooks/commit-msg +++ b/git-tools/hooks/commit-msg @@ -157,7 +157,7 @@ do # Successful match, but on which line format case $expect in "header") - expecting="empty eof"; + expecting="empty"; echo "$line" | grep -Eq "^\[ticket/[0-9]+\]$" && ( ticket=$(echo "$line" | sed 's,\[ticket/\([0-9]*\)\].*,\1,'); @@ -174,7 +174,7 @@ do fi ;; "description") - expecting="description empty eof"; + expecting="description empty"; in_description=1; ;; "footer") From e17ffa01e6f536b0868106405993361f1d978706 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Mon, 12 Jul 2010 02:04:29 +0100 Subject: [PATCH 277/393] [task/git-tools] Ignore git commit message comments Git commit message comments can be contained anywhere in the message and this change ignores where they appear. PHPBB3-9768 --- git-tools/hooks/commit-msg | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg index b04a761c29..d6ad57a38a 100755 --- a/git-tools/hooks/commit-msg +++ b/git-tools/hooks/commit-msg @@ -87,6 +87,12 @@ do quit $err; fi + if [ "${expecting#comment}" = "$expecting" ] + then + # Prefix comments to the expected tokens list + expecting="comment $expecting"; + fi + debug 2 "Expecting: $expecting"; # Loop over each of the expected line formats @@ -121,6 +127,9 @@ do # Should not end up here false ;; + "comment") + echo "$line" | grep -Eq "^#"; + ;; *) echo "Unrecognised token $expect" >&2; quit $err; @@ -143,7 +152,7 @@ do if [ $result -eq 0 ] then # Have we switched out of description mode? - if [ $in_description -eq 1 ] && [ "$expect" != "description" ] && [ "$expect" != "empty" ] + if [ $in_description -eq 1 ] && [ "$expect" != "description" ] && [ "$expect" != "empty" ] && [ "$expect" != "comment" ] then # Yes, okay we need to backtrace one line and reanalyse in_description=0; @@ -186,6 +195,9 @@ do tickets="$tickets $line"; fi ;; + "comment") + # Comments should expect the same thing again + ;; *) echo "Unrecognised token $expect" >&2; quit 254; From 4c95ed0eeb497d3febe3169614e9385cefa648d2 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 10 Aug 2010 16:11:39 +0200 Subject: [PATCH 278/393] [ticket/9519] Replace remaining is_writable() calls with phpbb_is_writable(). acm_memory.php is untested. install/install_convert.php and includes/functions_convert.php are going to be tested and committed afterwards. PHPBB3-9519 --- phpBB/includes/acm/acm_file.php | 4 ++-- phpBB/includes/acm/acm_memory.php | 2 +- phpBB/includes/acp/acp_attachments.php | 2 +- phpBB/includes/acp/acp_groups.php | 2 +- phpBB/includes/acp/acp_styles.php | 12 ++++++------ phpBB/includes/acp/acp_users.php | 2 +- phpBB/includes/functions_user.php | 2 +- phpBB/includes/ucp/ucp_groups.php | 2 +- phpBB/includes/ucp/ucp_profile.php | 2 +- phpBB/install/install_install.php | 4 ++-- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/phpBB/includes/acm/acm_file.php b/phpBB/includes/acm/acm_file.php index 5a758aa2bb..add065ead1 100644 --- a/phpBB/includes/acm/acm_file.php +++ b/phpBB/includes/acm/acm_file.php @@ -79,7 +79,7 @@ class acm if (!$this->_write('data_global')) { // Now, this occurred how often? ... phew, just tell the user then... - if (!@is_writable($this->cache_dir)) + if (!phpbb_is_writable($this->cache_dir)) { // We need to use die() here, because else we may encounter an infinite loop (the message handler calls $cache->unload()) die($this->cache_dir . ' is NOT writable.'); @@ -707,7 +707,7 @@ class acm */ function remove_file($filename, $check = false) { - if ($check && !@is_writable($this->cache_dir)) + if ($check && !phpbb_is_writable($this->cache_dir)) { // E_USER_ERROR - not using language entry - intended. trigger_error('Unable to remove files within ' . $this->cache_dir . '. Please check directory permissions.', E_USER_ERROR); diff --git a/phpBB/includes/acm/acm_memory.php b/phpBB/includes/acm/acm_memory.php index efbfd4dd62..4e0f35f157 100644 --- a/phpBB/includes/acm/acm_memory.php +++ b/phpBB/includes/acm/acm_memory.php @@ -407,7 +407,7 @@ class acm_memory */ function remove_file($filename, $check = false) { - if ($check && !@is_writable($this->cache_dir)) + if ($check && !phpbb_is_writable($this->cache_dir)) { // E_USER_ERROR - not using language entry - intended. trigger_error('Unable to remove files within ' . $this->cache_dir . '. Please check directory permissions.', E_USER_ERROR); diff --git a/phpBB/includes/acp/acp_attachments.php b/phpBB/includes/acp/acp_attachments.php index 980558c830..fc5f44e14f 100644 --- a/phpBB/includes/acp/acp_attachments.php +++ b/phpBB/includes/acp/acp_attachments.php @@ -1222,7 +1222,7 @@ class acp_attachments return; } - if (!is_writable($phpbb_root_path . $upload_dir)) + if (!phpbb_is_writable($phpbb_root_path . $upload_dir)) { $error[] = sprintf($user->lang['NO_WRITE_UPLOAD'], $upload_dir); return; diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index 3df61ff4e2..60512c67b8 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -49,7 +49,7 @@ class acp_groups // Clear some vars - $can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false; + $can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false; $group_row = array(); // Grab basic data for group, if group_id is set and exists diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 3310560c73..34bb7534f0 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -748,7 +748,7 @@ parse_css_file = {PARSE_CSS_FILE} $additional = ''; // If the template is stored on the filesystem try to write the file else store it in the database - if (!$safe_mode && !$template_info['template_storedb'] && file_exists($file) && @is_writable($file)) + if (!$safe_mode && !$template_info['template_storedb'] && file_exists($file) && phpbb_is_writable($file)) { if (!($fp = @fopen($file, 'wb'))) { @@ -1155,7 +1155,7 @@ parse_css_file = {PARSE_CSS_FILE} $message = $user->lang['THEME_UPDATED']; // If the theme is stored on the filesystem try to write the file else store it in the database - if (!$safe_mode && !$theme_info['theme_storedb'] && file_exists($file) && @is_writable($file)) + if (!$safe_mode && !$theme_info['theme_storedb'] && file_exists($file) && phpbb_is_writable($file)) { if (!($fp = @fopen($file, 'wb'))) { @@ -2246,7 +2246,7 @@ parse_css_file = {PARSE_CSS_FILE} { // a rather elaborate check we have to do here once to avoid trouble later $check = "{$phpbb_root_path}styles/" . $style_row["{$mode}_path"] . (($mode === 'theme') ? '/theme/stylesheet.css' : '/template'); - if (($style_row["{$mode}_storedb"] != $store_db) && !$store_db && ($safe_mode || !@is_writable($check))) + if (($style_row["{$mode}_storedb"] != $store_db) && !$store_db && ($safe_mode || !phpbb_is_writable($check))) { $error[] = $user->lang['EDIT_' . strtoupper($mode) . '_STORED_DB']; $store_db = 1; @@ -2326,7 +2326,7 @@ parse_css_file = {PARSE_CSS_FILE} { $theme_data = $this->db_theme_data($style_row); } - else if (!$store_db && !$safe_mode && @is_writable("{$phpbb_root_path}styles/{$style_row['theme_path']}/theme/stylesheet.css")) + else if (!$store_db && !$safe_mode && phpbb_is_writable("{$phpbb_root_path}styles/{$style_row['theme_path']}/theme/stylesheet.css")) { $store_db = 1; $theme_data = $style_row['theme_data']; @@ -2357,7 +2357,7 @@ parse_css_file = {PARSE_CSS_FILE} } else { - if (!$store_db && !$safe_mode && @is_writable("{$phpbb_root_path}styles/{$style_row['template_path']}/template")) + if (!$store_db && !$safe_mode && phpbb_is_writable("{$phpbb_root_path}styles/{$style_row['template_path']}/template")) { $err = $this->store_in_fs('template', $style_row['template_id']); if ($err) @@ -3728,7 +3728,7 @@ parse_css_file = {PARSE_CSS_FILE} $store_db = 0; $error = array(); - if (!$safe_mode && @is_writable("{$phpbb_root_path}styles/{$path}/template")) + if (!$safe_mode && phpbb_is_writable("{$phpbb_root_path}styles/{$path}/template")) { $sql = 'SELECT * FROM ' . STYLES_TEMPLATE_DATA_TABLE . " diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 1f10893781..f6c386bf71 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1701,7 +1701,7 @@ class acp_users include($phpbb_root_path . 'includes/functions_display.' . $phpEx); include($phpbb_root_path . 'includes/functions_user.' . $phpEx); - $can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false; + $can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false; if ($submit) { diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 6f6d7526b7..06e66b2fff 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -2326,7 +2326,7 @@ function avatar_process_user(&$error, $custom_userdata = false, $can_upload = nu // Can we upload? if (is_null($can_upload)) { - $can_upload = ($config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $change_avatar && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; + $can_upload = ($config['allow_avatar_upload'] && file_exists($phpbb_root_path . $config['avatar_path']) && phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && $change_avatar && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; } if ((!empty($_FILES['uploadfile']['name']) || $data['uploadurl']) && $can_upload) diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index 423d9b718a..1c055a4823 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -490,7 +490,7 @@ class ucp_groups $avatar_select = basename(request_var('avatar_select', '')); $category = basename(request_var('category', '')); - $can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false; + $can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && $file_uploads) ? true : false; // Did we submit? if ($update) diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index 363a4803b6..9790cab81f 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -564,7 +564,7 @@ class ucp_profile $avatar_select = basename(request_var('avatar_select', '')); $category = basename(request_var('category', '')); - $can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && @is_writable($phpbb_root_path . $config['avatar_path']) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; + $can_upload = (file_exists($phpbb_root_path . $config['avatar_path']) && phpbb_is_writable($phpbb_root_path . $config['avatar_path']) && $auth->acl_get('u_chgavatar') && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')) ? true : false; add_form_key('ucp_avatar'); diff --git a/phpBB/install/install_install.php b/phpBB/install/install_install.php index 4c22db07b2..6c23460de9 100644 --- a/phpBB/install/install_install.php +++ b/phpBB/install/install_install.php @@ -486,7 +486,7 @@ class install_install extends module $write = $exists = true; if (file_exists($phpbb_root_path . $dir)) { - if (!@is_writable($phpbb_root_path . $dir)) + if (!phpbb_is_writable($phpbb_root_path . $dir)) { $write = false; } @@ -906,7 +906,7 @@ class install_install extends module $config_data .= '?' . '>'; // Done this to prevent highlighting editors getting confused! // Attempt to write out the config file directly. If it works, this is the easiest way to do it ... - if ((file_exists($phpbb_root_path . 'config.' . $phpEx) && is_writable($phpbb_root_path . 'config.' . $phpEx)) || is_writable($phpbb_root_path)) + if ((file_exists($phpbb_root_path . 'config.' . $phpEx) && phpbb_is_writable($phpbb_root_path . 'config.' . $phpEx)) || phpbb_is_writable($phpbb_root_path)) { // Assume it will work ... if nothing goes wrong below $written = true; From 884cc2ac9b49ba88e448764b5e91cb99cf79df81 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 13 Aug 2010 16:40:56 +0200 Subject: [PATCH 279/393] [ticket/9519] Replace remaining is_writable() calls with phpbb_is_writable(). includes/functions_convert.php and install/install_convert.php tested by Dicky. PHPBB3-9519 --- phpBB/includes/functions_convert.php | 6 +++--- phpBB/install/install_convert.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/includes/functions_convert.php b/phpBB/includes/functions_convert.php index c035fd3739..9e26043b39 100644 --- a/phpBB/includes/functions_convert.php +++ b/phpBB/includes/functions_convert.php @@ -2306,7 +2306,7 @@ function copy_file($src, $trg, $overwrite = false, $die_on_failure = true, $sour } } - if (!is_writable($path)) + if (!phpbb_is_writable($path)) { @chmod($path, 0777); } @@ -2341,7 +2341,7 @@ function copy_dir($src, $trg, $copy_subdirs = true, $overwrite = false, $die_on_ @chmod($trg_path, 0777); } - if (!@is_writable($trg_path)) + if (!phpbb_is_writable($trg_path)) { $bad_dirs[] = path($config['script_path']) . $trg; } @@ -2408,7 +2408,7 @@ function copy_dir($src, $trg, $copy_subdirs = true, $overwrite = false, $die_on_ @chmod($trg_path . $dir, 0777); } - if (!@is_writable($trg_path . $dir)) + if (!phpbb_is_writable($trg_path . $dir)) { $bad_dirs[] = $trg . $dir; $bad_dirs[] = $trg_path . $dir; diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php index 8c3ffd61a8..814b50cf68 100644 --- a/phpBB/install/install_convert.php +++ b/phpBB/install/install_convert.php @@ -835,7 +835,7 @@ class install_convert extends module $this->p_master->error($user->lang['DEV_NO_TEST_FILE'], __LINE__, __FILE__); } - if (!$local_path || !@is_writable($phpbb_root_path . $local_path)) + if (!$local_path || !phpbb_is_writable($phpbb_root_path . $local_path)) { if (!$local_path) { From 89b35f7ab9e9dc425d7fcac9cca3ea71da24b8d3 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 13 Aug 2010 17:10:35 +0200 Subject: [PATCH 280/393] [ticket/9519] Replace remaining is_writable() calls with phpbb_is_writable(). PHPBB3-9519 --- phpBB/adm/index.php | 2 +- phpBB/includes/functions.php | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index 26f934f6bf..4c568cf441 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -533,7 +533,7 @@ function validate_config_vars($config_vars, &$cfg_array, &$error) // Check if the path is writable if ($config_definition['validate'] == 'wpath' || $config_definition['validate'] == 'rwpath') { - if (file_exists($phpbb_root_path . $cfg_array[$config_name]) && !@is_writable($phpbb_root_path . $cfg_array[$config_name])) + if (file_exists($phpbb_root_path . $cfg_array[$config_name]) && !phpbb_is_writable($phpbb_root_path . $cfg_array[$config_name])) { $error[] = sprintf($user->lang['DIRECTORY_NOT_WRITABLE'], $cfg_array[$config_name]); } diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index bc3d721de5..ba20b60737 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -701,7 +701,7 @@ function phpbb_chmod($filename, $perms = CHMOD_READ) clearstatcache(); - if (is_readable($filename) && is_writable($filename)) + if (is_readable($filename) && phpbb_is_writable($filename)) { break; } @@ -711,7 +711,7 @@ function phpbb_chmod($filename, $perms = CHMOD_READ) clearstatcache(); - if ((!($perms & CHMOD_READ) || is_readable($filename)) && (!($perms & CHMOD_WRITE) || is_writable($filename))) + if ((!($perms & CHMOD_READ) || is_readable($filename)) && (!($perms & CHMOD_WRITE) || phpbb_is_writable($filename))) { break; } @@ -721,7 +721,7 @@ function phpbb_chmod($filename, $perms = CHMOD_READ) clearstatcache(); - if ((!($perms & CHMOD_READ) || is_readable($filename)) && (!($perms & CHMOD_WRITE) || is_writable($filename))) + if ((!($perms & CHMOD_READ) || is_readable($filename)) && (!($perms & CHMOD_WRITE) || phpbb_is_writable($filename))) { break; } From 91a60aa878e703ff9af714e0316828216d3dcfa3 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 19 Aug 2010 11:00:42 -0400 Subject: [PATCH 281/393] [ticket/7716] Data too long for column 'message_subject' PHPBB3-7716 --- phpBB/includes/functions_privmsgs.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index c4cbb7ca1e..ec05a2a555 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1316,6 +1316,10 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) // Recipient Information $recipients = $to = $bcc = array(); + // First of all make sure the subject are having the correct length. + // To achieve this without cutting off between special chars we convert to an array and then count the elements. + $subject = truncate_string($subject); + if ($mode != 'edit') { // Build Recipient List From 90d8fc7e869852bb5a6beadc63c52ea9cdb51adf Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Wed, 18 Aug 2010 22:52:26 -0400 Subject: [PATCH 282/393] [ticket/9777] Print error message in pre-commit hook when php is not installed. PHPBB3-9777 --- git-tools/hooks/pre-commit | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/git-tools/hooks/pre-commit b/git-tools/hooks/pre-commit index 9719b91746..4d03359773 100755 --- a/git-tools/hooks/pre-commit +++ b/git-tools/hooks/pre-commit @@ -27,6 +27,13 @@ fi error=0 errors="" +if ! which $PHP_BIN >/dev/null 2>&1 +then + echo "PHP Syntax check failed:" + echo "PHP binary does not exist or is not in path: $PHP_BIN" + exit 1 +fi + # dash does not support $'\n': # http://forum.soft32.com/linux2/Bug-409179-DASH-Settings-IFS-work-properly-ftopict70039.html IFS=' From 44125f5533394e7d317b851111d6396c7567f3bd Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 19 Aug 2010 12:22:18 -0400 Subject: [PATCH 283/393] [ticket/9104] Safari does not display box headers correctly in the ACP. PHPBB3-9104 --- phpBB/adm/style/admin.css | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/phpBB/adm/style/admin.css b/phpBB/adm/style/admin.css index 5f1f01c0a9..4c3fa51af3 100644 --- a/phpBB/adm/style/admin.css +++ b/phpBB/adm/style/admin.css @@ -670,14 +670,10 @@ legend { position: relative; text-transform: none; line-height: 1.2em; - top: 0; + top: -.2em; vertical-align: middle; } -/* Hide from macIE \*/ -legend { top: -1.2em; } -/* end */ - * html legend { margin: 0 0 -10px -7px; line-height: 1em; From 5e330044b87190dcdb66aa3c83932a4c16627692 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 19 Aug 2010 12:30:24 -0400 Subject: [PATCH 284/393] [ticket/9519] Replace remaining is_writable() calls with phpbb_is_writable(). In the ACM-Modules we need to check whether the function is loaded, before we use it, as this is not the case from download/file.php in avatar-mode. PHPBB3-9519 --- phpBB/includes/acm/acm_file.php | 12 ++++++++++++ phpBB/includes/acm/acm_memory.php | 6 ++++++ 2 files changed, 18 insertions(+) diff --git a/phpBB/includes/acm/acm_file.php b/phpBB/includes/acm/acm_file.php index add065ead1..5c1876d006 100644 --- a/phpBB/includes/acm/acm_file.php +++ b/phpBB/includes/acm/acm_file.php @@ -78,6 +78,12 @@ class acm if (!$this->_write('data_global')) { + if (!function_exists('phpbb_is_writable')) + { + global $phpbb_root_path; + include($phpbb_root_path . 'includes/functions.' . $phpEx); + } + // Now, this occurred how often? ... phew, just tell the user then... if (!phpbb_is_writable($this->cache_dir)) { @@ -707,6 +713,12 @@ class acm */ function remove_file($filename, $check = false) { + if (!function_exists('phpbb_is_writable')) + { + global $phpbb_root_path, $phpEx; + include($phpbb_root_path . 'includes/functions.' . $phpEx); + } + if ($check && !phpbb_is_writable($this->cache_dir)) { // E_USER_ERROR - not using language entry - intended. diff --git a/phpBB/includes/acm/acm_memory.php b/phpBB/includes/acm/acm_memory.php index 4e0f35f157..2936ea0bae 100644 --- a/phpBB/includes/acm/acm_memory.php +++ b/phpBB/includes/acm/acm_memory.php @@ -407,6 +407,12 @@ class acm_memory */ function remove_file($filename, $check = false) { + if (!function_exists('phpbb_is_writable')) + { + global $phpbb_root_path, $phpEx; + include($phpbb_root_path . 'includes/functions.' . $phpEx); + } + if ($check && !phpbb_is_writable($this->cache_dir)) { // E_USER_ERROR - not using language entry - intended. From cc9a1952d968c3c83e8d331cb005468848c936e1 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 19 Aug 2010 23:48:25 -0400 Subject: [PATCH 285/393] [ticket/9635] Useless parameter $data['post_time'] in function submit_post. PHPBB3-9635 --- phpBB/includes/functions_posting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index f6f90575d4..5e25648eb8 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -2537,7 +2537,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u if ($mode == 'post' || $mode == 'reply' || $mode == 'quote') { // Mark this topic as posted to - markread('post', $data['forum_id'], $data['topic_id'], $data['post_time']); + markread('post', $data['forum_id'], $data['topic_id']); } // Mark this topic as read From 932b35ab7a9f586e6a9b00416a8f4caf47e39630 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 20 Aug 2010 13:41:06 -0400 Subject: [PATCH 286/393] [ticket/9782] Board disable radio set on when server load high PHPBB3-9782 --- phpBB/includes/session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index e157053e61..79023cc7bc 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -1831,7 +1831,7 @@ class user extends session // Is load exceeded? if ($config['limit_load'] && $this->load !== false) { - if ($this->load > floatval($config['limit_load']) && !defined('IN_LOGIN')) + if ($this->load > floatval($config['limit_load']) && !defined('IN_LOGIN') && !defined('IN_ADMIN')) { // Set board disabled to true to let the admins/mods get the proper notification $config['board_disable'] = '1'; From b73d45ffc8f35ae2112d5c4bb80dcdac0d5ce6ae Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Mon, 16 Aug 2010 22:49:14 +0100 Subject: [PATCH 287/393] [ticket/7972] Copying topics in the MCP now indexes the new topic. PHPBB3-7972 --- phpBB/includes/mcp/mcp_main.php | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/phpBB/includes/mcp/mcp_main.php b/phpBB/includes/mcp/mcp_main.php index 80c3559649..d5551f5114 100644 --- a/phpBB/includes/mcp/mcp_main.php +++ b/phpBB/includes/mcp/mcp_main.php @@ -1048,6 +1048,35 @@ function mcp_fork_topic($topic_ids) $total_posts = 0; $new_topic_id_list = array(); + if ($topic_data['enable_indexing']) + { + // Select the search method and do some additional checks to ensure it can actually be utilised + $search_type = basename($config['search_type']); + + if (!file_exists($phpbb_root_path . 'includes/search/' . $search_type . '.' . $phpEx)) + { + trigger_error('NO_SUCH_SEARCH_MODULE'); + } + + if (!class_exists($search_type)) + { + include("{$phpbb_root_path}includes/search/$search_type.$phpEx"); + } + + $error = false; + $search = new $search_type($error); + $search_mode = 'post'; + + if ($error) + { + trigger_error($error); + } + } + else + { + $search_type = false; + } + foreach ($topic_data as $topic_id => $topic_row) { $sql_ary = array( @@ -1158,6 +1187,12 @@ function mcp_fork_topic($topic_ids) // Copy whether the topic is dotted markread('post', $to_forum_id, $new_topic_id, 0, $row['poster_id']); + if ($search_type) + { + $search->index($search_mode, $sql_ary['post_id'], $sql_ary['post_text'], $sql_ary['post_subject'], $sql_ary['poster_id'], ($topic_row['topic_type'] == POST_GLOBAL) ? 0 : $to_forum_id); + $search_mode = 'reply'; // After one we index replies + } + // Copy Attachments if ($row['post_attachment']) { From d53312174169f311714da389b6a36fe6a4bc8f9a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 20 Aug 2010 09:21:15 -0400 Subject: [PATCH 288/393] [ticket/9780] Add length check back to gen_rand_string(). PHPBB3-9780 --- phpBB/includes/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 980a26d525..36b9e18176 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -201,7 +201,7 @@ function set_config_count($config_name, $increment, $is_dynamic = false) function gen_rand_string($num_chars = 8) { // [a, z] + [0, 9] = 36 - return strtoupper(base_convert(unique_id(), 16, 36)); + return substr(strtoupper(base_convert(unique_id(), 16, 36)), 0, $num_chars); } /** From c901a9eb70b9d66966f853b0381e05bc9f50fb00 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Fri, 20 Aug 2010 14:22:56 -0500 Subject: [PATCH 289/393] [ticket/9662] Search flood interval no longer applies to non-keyword searches The search interval was not consistently applied to "special" searches like "unread posts" and "view your topics." Now the special searches are always exempt from the flood interval. PHPBB3-9662 --- phpBB/search.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/search.php b/phpBB/search.php index 1e1e42d01f..96f320fe9f 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -81,9 +81,10 @@ if ($user->load && $config['limit_search_load'] && ($user->load > doubleval($con trigger_error('NO_SEARCH_TIME'); } -// Check flood limit ... if applicable +// It is applicable if the configuration setting is non-zero, and the user cannot +// ignore the flood setting, and the search is a keyword search. $interval = ($user->data['user_id'] == ANONYMOUS) ? $config['search_anonymous_interval'] : $config['search_interval']; -if ($interval && !$auth->acl_get('u_ignoreflood')) +if ($interval && !in_array($search_id, array('unreadposts', 'unanswered', 'active_topics', 'egosearch')) && !$auth->acl_get('u_ignoreflood')) { if ($user->data['user_last_search'] > time() - $interval) { From e09d6c6d7139375d8b645664bef295c82d585653 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 20 Aug 2010 21:12:18 +0200 Subject: [PATCH 290/393] [ticket/9780] Adding unit tests for gen_rand_string(). PHPBB3-9780 --- tests/all_tests.php | 2 + tests/random/all_tests.php | 40 ++++++++++++++++++++ tests/random/gen_rand_string.php | 63 ++++++++++++++++++++++++++++++++ 3 files changed, 105 insertions(+) create mode 100644 tests/random/all_tests.php create mode 100644 tests/random/gen_rand_string.php diff --git a/tests/all_tests.php b/tests/all_tests.php index 8dc07872e8..bae7725ee7 100644 --- a/tests/all_tests.php +++ b/tests/all_tests.php @@ -25,6 +25,7 @@ require_once 'text_processing/all_tests.php'; require_once 'dbal/all_tests.php'; require_once 'regex/all_tests.php'; require_once 'network/all_tests.php'; +require_once 'random/all_tests.php'; // exclude the test directory from code coverage reports PHPUnit_Util_Filter::addDirectoryToFilter('./'); @@ -48,6 +49,7 @@ class phpbb_all_tests $suite->addTest(phpbb_dbal_all_tests::suite()); $suite->addTest(phpbb_regex_all_tests::suite()); $suite->addTest(phpbb_network_all_tests::suite()); + $suite->addTest(phpbb_random_all_tests::suite()); return $suite; } diff --git a/tests/random/all_tests.php b/tests/random/all_tests.php new file mode 100644 index 0000000000..c6ffe78024 --- /dev/null +++ b/tests/random/all_tests.php @@ -0,0 +1,40 @@ +addTestSuite('phpbb_random_gen_rand_string_test'); + + return $suite; + } +} + +if (PHPUnit_MAIN_METHOD == 'phpbb_random_all_tests::main') +{ + phpbb_random_all_tests::main(); +} diff --git a/tests/random/gen_rand_string.php b/tests/random/gen_rand_string.php new file mode 100644 index 0000000000..cd58d14ed3 --- /dev/null +++ b/tests/random/gen_rand_string.php @@ -0,0 +1,63 @@ +assertTrue($random_string_length >= self::MIN_STRING_LENGTH); + $this->assertTrue($random_string_length <= $num_chars); + $this->assertRegExp('#^[A-Z0-9]+$#', $random_string); + } + } + } + + public function test_gen_rand_string_friendly() + { + for ($tests = 0; $tests <= self::TEST_COUNT; ++$tests) + { + for ($num_chars = self::MIN_STRING_LENGTH; $num_chars <= self::MAX_STRING_LENGTH; ++$num_chars) + { + $random_string = gen_rand_string_friendly($num_chars); + $random_string_length = strlen($random_string); + + $this->assertTrue($random_string_length >= self::MIN_STRING_LENGTH); + $this->assertTrue($random_string_length <= $num_chars); + $this->assertRegExp('#^[A-NP-Z1-9]+$#', $random_string); + } + } + } +} From c3a5fd30eea8b5426adfc9318d6e6b89616bc071 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Fri, 20 Aug 2010 15:37:48 -0500 Subject: [PATCH 291/393] [ticket/9646] Honor CSS comments in @import statements Add a basic CSS comment parser that allows comments to prevent loading an @import statement. For simplicity, only whitespace is allowed between /* and the @import. Also adjust regex to not parse improper quotation marks. PHPBB3-9646 PHPBB3-8169 --- phpBB/includes/acp/acp_styles.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 3310560c73..95b700c876 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -2531,13 +2531,21 @@ parse_css_file = {PARSE_CSS_FILE} // Match CSS imports $matches = array(); - preg_match_all('/@import url\(["\'](.*)["\']\);/i', $stylesheet, $matches); + preg_match_all('/@import url\((["\'])(.*)\1\);/i', $stylesheet, $matches); + + // remove commented stylesheets (very simple parser, allows only whitespace + // around an @import statement) + preg_match_all('#/\*\s*@import url\((["\'])(.*)\1\);\s\*/#i', $stylesheet, $commented); + $matches[2] = array_diff($matches[2], $commented[2]); if (sizeof($matches)) { foreach ($matches[0] as $idx => $match) { - $stylesheet = str_replace($match, acp_styles::load_css_file($theme_row['theme_path'], $matches[1][$idx]), $stylesheet); + if (isset($matches[2][$idx])) + { + $stylesheet = str_replace($match, acp_styles::load_css_file($theme_row['theme_path'], $matches[2][$idx]), $stylesheet); + } } } From 2455a744e67dc2d0bbdf699af2d699b94aed3ad6 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 19 Aug 2010 11:00:42 -0400 Subject: [PATCH 292/393] [ticket/7716] Data too long for column 'message_subject' PHPBB3-7716 --- phpBB/includes/functions_privmsgs.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index c4cbb7ca1e..4c34bc92ca 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1380,6 +1380,9 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) } } + // First of all make sure the subject are having the correct length. + $subject = truncate_string($subject); + $db->sql_transaction('begin'); $sql = ''; From 32bffe1a3219b7360fbace7f8f8596b38dfcccf6 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 21 Aug 2010 21:25:34 +0200 Subject: [PATCH 293/393] Revert "[ticket/7716] Data too long for column 'message_subject'" This reverts commit 91a60aa878e703ff9af714e0316828216d3dcfa3. --- phpBB/includes/functions_privmsgs.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index ec05a2a555..c4cbb7ca1e 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1316,10 +1316,6 @@ function submit_pm($mode, $subject, &$data, $put_in_outbox = true) // Recipient Information $recipients = $to = $bcc = array(); - // First of all make sure the subject are having the correct length. - // To achieve this without cutting off between special chars we convert to an array and then count the elements. - $subject = truncate_string($subject); - if ($mode != 'edit') { // Build Recipient List From 3cbcff56b20d384c92bbf9a627a8878a364e0597 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sun, 22 Aug 2010 11:16:19 -0400 Subject: [PATCH 294/393] [ticket/7296] Exporting styles to tar creates corrupted archives. Add the folders to the archive before putting the files inside, seems to break the tar-archives. PHPBB3-7296 --- phpBB/includes/acp/acp_styles.php | 5 ----- phpBB/includes/functions_compress.php | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 3310560c73..0b4cf2a024 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -2040,23 +2040,18 @@ parse_css_file = {PARSE_CSS_FILE} { case 'tar': $ext = '.tar'; - $mimetype = 'x-tar'; - $compress = 'compress_tar'; break; case 'zip': $ext = '.zip'; - $mimetype = 'zip'; break; case 'tar.gz': $ext = '.tar.gz'; - $mimetype = 'x-gzip'; break; case 'tar.bz2': $ext = '.tar.bz2'; - $mimetype = 'x-bzip2'; break; default: diff --git a/phpBB/includes/functions_compress.php b/phpBB/includes/functions_compress.php index f422eaa8c1..455debd939 100644 --- a/phpBB/includes/functions_compress.php +++ b/phpBB/includes/functions_compress.php @@ -53,13 +53,18 @@ class compress $filelist = filelist("$phpbb_root_path$src", '', '*'); krsort($filelist); + /** + * Commented out, as adding the folders produces corrupted archives if ($src_path) { $this->data($src_path, '', true, stat("$phpbb_root_path$src")); } + */ foreach ($filelist as $path => $file_ary) { + /** + * Commented out, as adding the folders produces corrupted archives if ($path) { // Same as for src_path @@ -68,6 +73,7 @@ class compress $this->data("$src_path$path", '', true, stat("$phpbb_root_path$src$path")); } + */ foreach ($file_ary as $file) { From 889eace41c6221ece47256dde94f8ca99affc4a0 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 22 Aug 2010 20:26:18 +0200 Subject: [PATCH 295/393] [ticket/9785] Allow users to request new passwords when board is disabled. PHPBB3-9785 --- phpBB/ucp.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/ucp.php b/phpBB/ucp.php index 994fe064a1..f5a2ec9648 100644 --- a/phpBB/ucp.php +++ b/phpBB/ucp.php @@ -22,7 +22,7 @@ require($phpbb_root_path . 'includes/functions_module.' . $phpEx); $id = request_var('i', ''); $mode = request_var('mode', ''); -if ($mode == 'login' || $mode == 'logout' || $mode == 'confirm') +if (in_array($mode, array('login', 'logout', 'confirm', 'sendpassword', 'activate'))) { define('IN_LOGIN', true); } From aa4519fb44f4ff83e923c6cc4d5bde3f20082340 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 20 Aug 2010 12:15:23 -0400 Subject: [PATCH 296/393] [ticket/7260] Don't delete poll if one exists and editing user lacks permission PHPBB3-7260 --- phpBB/posting.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/phpBB/posting.php b/phpBB/posting.php index df063ef391..8cacac2910 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -402,6 +402,16 @@ if ($post_data['poll_start']) $db->sql_freeresult($result); } +$original_poll_data = array( + 'poll_title' => $post_data['poll_title'], + 'poll_length' => $post_data['poll_length'], + 'poll_max_options' => $post_data['poll_max_options'], + 'poll_option_text' => implode("\n", $post_data['poll_options']), + 'poll_start' => $post_data['poll_start'], + 'poll_last_vote' => $post_data['poll_last_vote'], + 'poll_vote_change' => $post_data['poll_vote_change'], +); + $orig_poll_options_size = sizeof($post_data['poll_options']); $message_parser = new parse_message(); @@ -912,6 +922,22 @@ if ($submit || $preview || $refresh) $message_parser->warn_msg[] = $user->lang['NO_DELETE_POLL_OPTIONS']; }*/ } + else if (!$auth->acl_get('f_poll', $forum_id) && ($mode == 'edit') && ($post_id == $post_data['topic_first_post_id']) && ($original_poll_data['poll_title'] != '')) + { + // We have a poll but the editing user is not permitted to create/edit it. + // So we just keep the original poll-data. + $poll = array_merge($original_poll_data, array( + 'enable_bbcode' => $post_data['enable_bbcode'], + 'enable_urls' => $post_data['enable_urls'], + 'enable_smilies' => $post_data['enable_smilies'], + 'img_status' => $img_status, + )); + + $message_parser->parse_poll($poll); + + $post_data['poll_options'] = (isset($poll['poll_options'])) ? $poll['poll_options'] : ''; + $post_data['poll_title'] = (isset($poll['poll_title'])) ? $poll['poll_title'] : ''; + } else { $poll = array(); From 50c6af0216d81b1bbc591e8af768799f1dee48d2 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Mon, 23 Aug 2010 06:24:13 +0100 Subject: [PATCH 297/393] [ticket/7369] CPF date should always render the users selection. CPF render code was incorrectly adding the users timezone offset instead of removing it to compensate for the addition made in user::format_date(). PHPBB3-7369 --- phpBB/includes/functions_profile_fields.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/functions_profile_fields.php b/phpBB/includes/functions_profile_fields.php index fa1cc98e10..3937cf9c21 100644 --- a/phpBB/includes/functions_profile_fields.php +++ b/phpBB/includes/functions_profile_fields.php @@ -543,8 +543,9 @@ class custom_profile else if ($day && $month && $year) { global $user; - // d/m/y 00:00 GMT isn't necessarily on the same d/m/y in the user's timezone, so add the timezone seconds - return $user->format_date(gmmktime(0, 0, 0, $month, $day, $year) + $user->timezone + $user->dst, $user->lang['DATE_FORMAT'], true); + // Date should display as the same date for every user regardless of timezone, so remove offset + // to compensate for the offset added by user::format_date() + return $user->format_date(gmmktime(0, 0, 0, $month, $day, $year) - ($user->timezone + $user->dst), $user->lang['DATE_FORMAT'], true); } return $value; From 3afd2c6948e777fde2f43f00bff1659f2691f4d8 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 27 Aug 2010 00:13:15 +0200 Subject: [PATCH 298/393] [ticket/9793] Make sure send_status_line() is defined when in avatar mode. When download/file.php is in avatar mode set_modified_headers() can be called, which then calls send_status_line() which is not available because includes/functions.php is not included in avatar mode. We also load includes/functions.php in the bootstrap now to solve this problem. Regression from c1a4cb1d01dc19650219566b60671abc767af662. PHPBB3-9793 PHPBB3-7782 --- phpBB/download/file.php | 1 + 1 file changed, 1 insertion(+) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 97f4ff3c8a..1f2cee4d95 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -48,6 +48,7 @@ if (isset($_GET['avatar'])) require($phpbb_root_path . 'includes/cache.' . $phpEx); require($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); require($phpbb_root_path . 'includes/constants.' . $phpEx); + require($phpbb_root_path . 'includes/functions.' . $phpEx); $db = new $sql_db(); $cache = new cache(); From 2a59e6d4864a993842167a40a9762702ad58db12 Mon Sep 17 00:00:00 2001 From: Josh Woody Date: Sun, 22 Aug 2010 15:28:05 -0500 Subject: [PATCH 299/393] [ticket/9772] Unify permissions for sending email when board_email_form is off Sending email via memberlist.php was limited to users having u_sendemail. When board_email_form is disabled, no such requirement was enforced. This is now changed. PHPBB3-9772 --- phpBB/includes/ucp/ucp_pm_viewmessage.php | 2 +- phpBB/memberlist.php | 2 +- phpBB/viewtopic.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/ucp/ucp_pm_viewmessage.php b/phpBB/includes/ucp/ucp_pm_viewmessage.php index 26968e1382..16700c490c 100644 --- a/phpBB/includes/ucp/ucp_pm_viewmessage.php +++ b/phpBB/includes/ucp/ucp_pm_viewmessage.php @@ -309,7 +309,7 @@ function get_user_information($user_id, $user_row) get_user_rank($user_row['user_rank'], $user_row['user_posts'], $user_row['rank_title'], $user_row['rank_image'], $user_row['rank_image_src']); - if (!empty($user_row['user_allow_viewemail']) || $auth->acl_get('a_email')) + if ((!empty($user_row['user_allow_viewemail']) && $auth->acl_get('u_sendemail')) || $auth->acl_get('a_email')) { $user_row['email'] = ($config['board_email_form'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=email&u=$user_id") : ((($config['board_hide_emails'] && !$auth->acl_get('a_email')) || empty($user_row['user_email'])) ? '' : 'mailto:' . $user_row['user_email']); } diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index b46230b10a..2fa2d11ee1 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -1607,7 +1607,7 @@ function show_profile($data, $user_notes_enabled = false, $warn_user_enabled = f $rank_title = $rank_img = $rank_img_src = ''; get_user_rank($data['user_rank'], (($user_id == ANONYMOUS) ? false : $data['user_posts']), $rank_title, $rank_img, $rank_img_src); - if (!empty($data['user_allow_viewemail']) || $auth->acl_get('a_user')) + if ((!empty($data['user_allow_viewemail']) && $auth->acl_get('u_sendemail')) || $auth->acl_get('a_user')) { $email = ($config['board_email_form'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=email&u=' . $user_id) : (($config['board_hide_emails'] && !$auth->acl_get('a_user')) ? '' : 'mailto:' . $data['user_email']); } diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 8926d5a40b..498088c5c8 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1146,7 +1146,7 @@ while ($row = $db->sql_fetchrow($result)) get_user_rank($row['user_rank'], $row['user_posts'], $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']); - if (!empty($row['user_allow_viewemail']) || $auth->acl_get('a_email')) + if ((!empty($row['user_allow_viewemail']) && $auth->acl_get('u_sendemail')) || $auth->acl_get('a_email')) { $user_cache[$poster_id]['email'] = ($config['board_email_form'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=email&u=$poster_id") : (($config['board_hide_emails'] && !$auth->acl_get('a_email')) ? '' : 'mailto:' . $row['user_email']); } From c71236ff4d55605ce037c2f0c8b8fb3791f86ee0 Mon Sep 17 00:00:00 2001 From: rxu Date: Tue, 24 Aug 2010 21:53:10 +0800 Subject: [PATCH 300/393] [ticket/9117] Wrong redirection after login. Go easy way for now - just place S_LOGIN_REDIRECT before S_HIDDEN_FIELDS so the last value override the previous one. PHPBB3-9117 --- phpBB/styles/prosilver/template/login_body.html | 2 +- phpBB/styles/subsilver2/template/login_body.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/prosilver/template/login_body.html b/phpBB/styles/prosilver/template/login_body.html index fe111aaa45..e52ccd6434 100644 --- a/phpBB/styles/prosilver/template/login_body.html +++ b/phpBB/styles/prosilver/template/login_body.html @@ -32,11 +32,11 @@ + {S_LOGIN_REDIRECT}
             
            {S_HIDDEN_FIELDS}
            - {S_LOGIN_REDIRECT}
            diff --git a/phpBB/styles/subsilver2/template/login_body.html b/phpBB/styles/subsilver2/template/login_body.html index 51f7068b5f..503de9e69e 100644 --- a/phpBB/styles/subsilver2/template/login_body.html +++ b/phpBB/styles/subsilver2/template/login_body.html @@ -72,12 +72,12 @@ +{S_LOGIN_REDIRECT}
            colspan="2" align="center">{S_HIDDEN_FIELDS}
            {S_FORM_TOKEN} -{S_LOGIN_REDIRECT}
            From f1d50057975695137d44f5f4b4c035e70d878657 Mon Sep 17 00:00:00 2001 From: rxu Date: Mon, 17 May 2010 22:50:03 +0800 Subject: [PATCH 301/393] [ticket/9613] Implement a load switch for unread posts search feature. Since unread posts search can produce a high server load in certain circumstances, we implement a switch for ACP "Load settings" to have an option to disable this type of search. PHPBB3-9613 --- phpBB/includes/acp/acp_board.php | 1 + phpBB/includes/functions.php | 2 ++ phpBB/language/en/acp/board.php | 1 + phpBB/language/en/search.php | 1 + phpBB/search.php | 14 +++++++++++--- phpBB/styles/prosilver/template/index_body.html | 2 +- .../styles/subsilver2/template/overall_header.html | 2 +- 7 files changed, 18 insertions(+), 5 deletions(-) diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index 927e72010e..ba3d5b58f7 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -319,6 +319,7 @@ class acp_board 'load_online_guests' => array('lang' => 'YES_ONLINE_GUESTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_onlinetrack' => array('lang' => 'YES_ONLINE_TRACK', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'load_unreads_search' => array('lang' => 'YES_UNREADS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_moderators' => array('lang' => 'YES_MODERATORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_user_activity' => array('lang' => 'LOAD_USER_ACTIVITY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index c4ff998e69..efa835574d 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4465,6 +4465,8 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0 'S_ENABLE_FEEDS_TOPICS_ACTIVE' => ($config['feed_topics_active']) ? true : false, 'S_ENABLE_FEEDS_NEWS' => ($s_feed_news) ? true : false, + 'S_LOAD_UNREADS' => ($config['load_unreads_search']) ? true : false, + 'T_THEME_PATH' => "{$web_path}styles/" . $user->theme['theme_path'] . '/theme', 'T_TEMPLATE_PATH' => "{$web_path}styles/" . $user->theme['template_path'] . '/template', 'T_SUPER_TEMPLATE_PATH' => (isset($user->theme['template_inherit_path']) && $user->theme['template_inherit_path']) ? "{$web_path}styles/" . $user->theme['template_inherit_path'] . '/template' : "{$web_path}styles/" . $user->theme['template_path'] . '/template', diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index ac0ddf1b73..9fb02f629f 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -375,6 +375,7 @@ $lang = array_merge($lang, array( 'YES_POST_MARKING_EXPLAIN' => 'Indicates whether user has posted to a topic.', 'YES_READ_MARKING' => 'Enable server-side topic marking', 'YES_READ_MARKING_EXPLAIN' => 'Stores read/unread status information in the database rather than a cookie.', + 'YES_UNREADS' => 'Enable search of unread posts', )); // Auth settings diff --git a/phpBB/language/en/search.php b/phpBB/language/en/search.php index be92391a4e..67b21edba8 100644 --- a/phpBB/language/en/search.php +++ b/phpBB/language/en/search.php @@ -62,6 +62,7 @@ $lang = array_merge($lang, array( 'NO_SEARCH' => 'Sorry but you are not permitted to use the search system.', 'NO_SEARCH_RESULTS' => 'No suitable matches were found.', 'NO_SEARCH_TIME' => 'Sorry but you cannot use search at this time. Please try again in a few minutes.', + 'NO_SEARCH_UNREADS' => 'Sorry but search for unread posts is not permitted.', 'WORD_IN_NO_POST' => 'No posts were found because the word %s is not contained in any post.', 'WORDS_IN_NO_POST' => 'No posts were found because the words %s are not contained in any post.', diff --git a/phpBB/search.php b/phpBB/search.php index 1e1e42d01f..9952f5c744 100644 --- a/phpBB/search.php +++ b/phpBB/search.php @@ -61,10 +61,18 @@ if ($search_id == 'egosearch') } } -// Search for unread posts needs user to be logged in if topics tracking for guests is disabled -if ($search_id == 'unreadposts' && !$config['load_anon_lastread'] && !$user->data['is_registered']) +// Search for unread posts needs to be allowed and user to be logged in if topics tracking for guests is disabled +if ($search_id == 'unreadposts') { - login_box('', $user->lang['LOGIN_EXPLAIN_UNREADSEARCH']); + if (!$config['load_unreads_search']) + { + $template->assign_var('S_NO_SEARCH', true); + trigger_error('NO_SEARCH_UNREADS'); + } + else if (!$config['load_anon_lastread'] && !$user->data['is_registered']) + { + login_box('', $user->lang['LOGIN_EXPLAIN_UNREADSEARCH']); + } } // Is user able to search? Has search been disabled? diff --git a/phpBB/styles/prosilver/template/index_body.html b/phpBB/styles/prosilver/template/index_body.html index 17790eb78a..af2077141c 100644 --- a/phpBB/styles/prosilver/template/index_body.html +++ b/phpBB/styles/prosilver/template/index_body.html @@ -6,7 +6,7 @@ diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html index 963f5160dd..37691d4f1c 100644 --- a/phpBB/styles/subsilver2/template/overall_header.html +++ b/phpBB/styles/subsilver2/template/overall_header.html @@ -202,7 +202,7 @@ function marklist(id, name, state) From b83163634f98de0e76e5332c1e4511dbc1483e56 Mon Sep 17 00:00:00 2001 From: rxu Date: Sat, 21 Aug 2010 01:26:23 +0800 Subject: [PATCH 302/393] [ticket/9613] Fix missing database part for unread posts search load switch. A record for load_unreads_search parameter had to be added to CONFIG_TABLE. PHPBB3-9613 --- phpBB/install/database_update.php | 3 +++ phpBB/install/schemas/schema_data.sql | 1 + 2 files changed, 4 insertions(+) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index fec09f89db..a5457c722f 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1795,6 +1795,9 @@ function change_database_data(&$no_updates, $version) // Sync the forums we have deleted shadow topics from. sync('forum', 'forum_id', $sync_forum_ids, true, true); + // Unread posts search load switch + set_config('load_unreads_search', '1'); + $no_updates = false; break; } diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index e815615eef..a25b68ba39 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -168,6 +168,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_online_time', INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_onlinetrack', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_search', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_tplcompile', '0'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_unreads_search', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('load_user_activity', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_attachments', '3'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_attachments_pm', '1'); From f9764c684ffb147a07cff472c82789b142845481 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 29 Aug 2010 16:50:57 +0200 Subject: [PATCH 303/393] [ticket/9613] Slightly update language strings. PHPBB3-9613 --- phpBB/includes/acp/acp_board.php | 2 +- phpBB/language/en/acp/board.php | 2 +- phpBB/language/en/search.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php index ba3d5b58f7..a5e80e1f6d 100644 --- a/phpBB/includes/acp/acp_board.php +++ b/phpBB/includes/acp/acp_board.php @@ -319,7 +319,7 @@ class acp_board 'load_online_guests' => array('lang' => 'YES_ONLINE_GUESTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_onlinetrack' => array('lang' => 'YES_ONLINE_TRACK', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), - 'load_unreads_search' => array('lang' => 'YES_UNREADS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'load_unreads_search' => array('lang' => 'YES_UNREAD_SEARCH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_moderators' => array('lang' => 'YES_MODERATORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), 'load_user_activity' => array('lang' => 'LOAD_USER_ACTIVITY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php index 9fb02f629f..77deba6e19 100644 --- a/phpBB/language/en/acp/board.php +++ b/phpBB/language/en/acp/board.php @@ -375,7 +375,7 @@ $lang = array_merge($lang, array( 'YES_POST_MARKING_EXPLAIN' => 'Indicates whether user has posted to a topic.', 'YES_READ_MARKING' => 'Enable server-side topic marking', 'YES_READ_MARKING_EXPLAIN' => 'Stores read/unread status information in the database rather than a cookie.', - 'YES_UNREADS' => 'Enable search of unread posts', + 'YES_UNREAD_SEARCH' => 'Enable search for unread posts', )); // Auth settings diff --git a/phpBB/language/en/search.php b/phpBB/language/en/search.php index 67b21edba8..d93fe6b56a 100644 --- a/phpBB/language/en/search.php +++ b/phpBB/language/en/search.php @@ -62,7 +62,7 @@ $lang = array_merge($lang, array( 'NO_SEARCH' => 'Sorry but you are not permitted to use the search system.', 'NO_SEARCH_RESULTS' => 'No suitable matches were found.', 'NO_SEARCH_TIME' => 'Sorry but you cannot use search at this time. Please try again in a few minutes.', - 'NO_SEARCH_UNREADS' => 'Sorry but search for unread posts is not permitted.', + 'NO_SEARCH_UNREADS' => 'Sorry but searching for unread posts has been disabled on this board.', 'WORD_IN_NO_POST' => 'No posts were found because the word %s is not contained in any post.', 'WORDS_IN_NO_POST' => 'No posts were found because the words %s are not contained in any post.', From fdd04eef49198ea40e0977431c6f490bfeb34f9f Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Thu, 2 Sep 2010 20:15:33 +0200 Subject: [PATCH 304/393] [ticket/9800] Update tracker URL in docs/README.html PHPBB3-9800 --- phpBB/docs/README.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/docs/README.html b/phpBB/docs/README.html index 3510bc448e..bb88fdc01f 100644 --- a/phpBB/docs/README.html +++ b/phpBB/docs/README.html @@ -242,7 +242,7 @@

            The phpBB Group uses a bug tracking system to store, list and manage all reported bugs, it can be found at the location listed below. Please DO NOT post bug reports to our forums, they will be locked. In addition please DO NOT use the bug tracker for support requests. Posting such a request will only see you directed to the support forums (while taking time away from working on real bugs).

            -

            http://www.phpbb.com/bugs/

            +

            http://tracker.phpbb.com/

            While we very much appreciate receiving bug reports (the more reports the more stable phpBB will be) we ask you carry out a few steps before adding new entries:

            From bb191a1d696994c1d27bbd0457457cf538dff7ee Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Thu, 2 Sep 2010 19:38:34 +0200 Subject: [PATCH 305/393] [ticket/8944] Add index length to CREATE INDEX for MySQL4 in database_update Fixes following SQL error when updating the database to 3.0.6. BLOB column 'post_username' used in key specification without a key length PHPBB3-8944 --- phpBB/install/database_update.php | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index fec09f89db..019469b061 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -880,7 +880,7 @@ function database_update_info() 'pm_id' => array('pm_id'), ), POSTS_TABLE => array( - 'post_username' => array('post_username'), + 'post_username' => array('post_username:255'), ), ), ), @@ -2141,7 +2141,7 @@ class updater_db_tools * drop_columns: Removing/Dropping columns * add_primary_keys: adding primary keys * add_unique_index: adding an unique index - * add_index: adding an index + * add_index: adding an index (can be column:index_size if you need to provide size) * * The values are in this format: * {TABLE NAME} => array( @@ -3520,6 +3520,12 @@ class updater_db_tools { $statements = array(); + // remove index length unless MySQL4 + if ('mysql_40' != $this->sql_layer) + { + $column = preg_replace('#:.*$#', '', $column); + } + switch ($this->sql_layer) { case 'firebird': @@ -3530,6 +3536,16 @@ class updater_db_tools break; case 'mysql_40': + // add index size to definition as required by MySQL4 + foreach ($column as $i => $col) + { + if (false !== strpos($col, ':')) + { + list($col, $index_size) = explode(':', $col); + $column[$i] = "$col($index_size)"; + } + } + // no break case 'mysql_41': $statements[] = 'CREATE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; break; From 58bdd91d616c7c9117c22722bbd93f4c58d5bacf Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Fri, 3 Sep 2010 22:38:58 +0200 Subject: [PATCH 306/393] [ticket/9039] Make mssqlnative.php non-executable PHPBB3-9039 --- phpBB/includes/db/mssqlnative.php | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 phpBB/includes/db/mssqlnative.php diff --git a/phpBB/includes/db/mssqlnative.php b/phpBB/includes/db/mssqlnative.php old mode 100755 new mode 100644 From e7b86871f077bb0d9ad819a6405607232fdd078f Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sun, 5 Sep 2010 03:14:27 +0200 Subject: [PATCH 307/393] [ticket/8944] Patch db_tools to support index length for MySQL4 --- phpBB/includes/db/db_tools.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/db/db_tools.php b/phpBB/includes/db/db_tools.php index 819ef69c96..f4b181c6ad 100644 --- a/phpBB/includes/db/db_tools.php +++ b/phpBB/includes/db/db_tools.php @@ -611,7 +611,7 @@ class phpbb_db_tools * drop_columns: Removing/Dropping columns * add_primary_keys: adding primary keys * add_unique_index: adding an unique index - * add_index: adding an index + * add_index: adding an index (can be column:index_size if you need to provide size) * * The values are in this format: * {TABLE NAME} => array( @@ -1804,6 +1804,12 @@ class phpbb_db_tools { $statements = array(); + // remove index length unless MySQL4 + if ('mysql_40' != $this->sql_layer) + { + $column = preg_replace('#:.*$#', '', $column); + } + switch ($this->sql_layer) { case 'firebird': @@ -1814,6 +1820,16 @@ class phpbb_db_tools break; case 'mysql_40': + // add index size to definition as required by MySQL4 + foreach ($column as $i => $col) + { + if (false !== strpos($col, ':')) + { + list($col, $index_size) = explode(':', $col); + $column[$i] = "$col($index_size)"; + } + } + // no break case 'mysql_41': $statements[] = 'CREATE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; break; From a27811b1d4d82f34c145978f3dbac3e2b54ed1ca Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Tue, 7 Sep 2010 22:13:10 +0200 Subject: [PATCH 308/393] [ticket/9807] Hide avatar tab in UCP when avatars are disabled PHPBB3-9807 --- phpBB/includes/ucp/info/ucp_profile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/ucp/info/ucp_profile.php b/phpBB/includes/ucp/info/ucp_profile.php index 03a4c81f46..d19b80f4c0 100644 --- a/phpBB/includes/ucp/info/ucp_profile.php +++ b/phpBB/includes/ucp/info/ucp_profile.php @@ -22,7 +22,7 @@ class ucp_profile_info 'modes' => array( 'profile_info' => array('title' => 'UCP_PROFILE_PROFILE_INFO', 'auth' => '', 'cat' => array('UCP_PROFILE')), 'signature' => array('title' => 'UCP_PROFILE_SIGNATURE', 'auth' => '', 'cat' => array('UCP_PROFILE')), - 'avatar' => array('title' => 'UCP_PROFILE_AVATAR', 'auth' => '', 'cat' => array('UCP_PROFILE')), + 'avatar' => array('title' => 'UCP_PROFILE_AVATAR', 'auth' => 'cfg_allow_avatar && (cfg_allow_avatar_local || cfg_allow_avatar_remote || cfg_allow_avatar_upload || cfg_allow_avatar_remote_upload)', 'cat' => array('UCP_PROFILE')), 'reg_details' => array('title' => 'UCP_PROFILE_REG_DETAILS', 'auth' => '', 'cat' => array('UCP_PROFILE')), ), ); From 8ce2f63d73f8f3b5fec220448ca060c43733840f Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Tue, 7 Sep 2010 23:35:47 +0100 Subject: [PATCH 309/393] [task/git-tools] Solve dependency on the GNU wc --max-line-length option PHPBB3-9808 --- git-tools/hooks/commit-msg | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg index d6ad57a38a..91951b05c2 100755 --- a/git-tools/hooks/commit-msg +++ b/git-tools/hooks/commit-msg @@ -55,11 +55,12 @@ quit() fi } -if [ "$(wc --max-line-length "$1" | cut -f1 -d" ")" -gt 80 ] +msg=$(grep -nE '.{81,}' "$1"); + +if [ $? -eq 0 ] then echo "The following lines are greater than 80 characters long:\n" >&2; - - grep -nE '.{81,}' "$1" >&2; + echo $msg >&2; quit $ERR_LENGTH; fi From e08e1e0d9a7c529dbec47705beb2a7384a0e4300 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Tue, 7 Sep 2010 23:36:33 +0100 Subject: [PATCH 310/393] [task/git-tools] Change the GNU --lines argument to the POSIX -l Changed to awk which handles the formatting differences between the two versions of wc -- BSD version prefixes the output with spaces, the GNU version does not. PHPBB3-9808 --- git-tools/hooks/commit-msg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-tools/hooks/commit-msg b/git-tools/hooks/commit-msg index 91951b05c2..a6777ff9c9 100755 --- a/git-tools/hooks/commit-msg +++ b/git-tools/hooks/commit-msg @@ -65,7 +65,7 @@ then quit $ERR_LENGTH; fi -lines=$(wc --lines "$1" | cut -f1 -d" "); +lines=$(wc -l "$1" | awk '{ print $1; }'); expecting=header; in_description=0; in_empty=0; From 264ef66c5c5b5498df2a04e011ed0127c6fe4324 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sat, 6 Mar 2010 18:15:55 +0000 Subject: [PATCH 311/393] [ticket/8935] Prevent setting maximum avatar dimensions less than the minimums. This change actually applies to any configruation setting that is a pair of values one representing the maximum and one minimum. This change enforces that the maximum value cannot be less than the minimum value. PHPBB3-8935 --- phpBB/adm/index.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/phpBB/adm/index.php b/phpBB/adm/index.php index 4c568cf441..92bcf90039 100644 --- a/phpBB/adm/index.php +++ b/phpBB/adm/index.php @@ -432,6 +432,20 @@ function validate_config_vars($config_vars, &$cfg_array, &$error) { $error[] = sprintf($user->lang['SETTING_TOO_BIG'], $user->lang[$config_definition['lang']], $validator[$max]); } + + if (strpos($config_name, '_max') !== false) + { + // Min/max pairs of settings should ensure that min <= max + // Replace _max with _min to find the name of the minimum + // corresponding configuration variable + $min_name = str_replace('_max', '_min', $config_name); + + if (isset($cfg_array[$min_name]) && is_numeric($cfg_array[$min_name]) && $cfg_array[$config_name] < $cfg_array[$min_name]) + { + // A minimum value exists and the maximum value is less than it + $error[] = sprintf($user->lang['SETTING_TOO_LOW'], $user->lang[$config_definition['lang']], (int) $cfg_array[$min_name]); + } + } break; // Absolute path From a235f770f6ca28f176ac4833a3bdeb81cbec7563 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 10 Sep 2010 04:09:30 -0700 Subject: [PATCH 312/393] [ticket/9810] Hide "Select All" of code bbcode on print page PHPBB3-9810 --- phpBB/styles/prosilver/theme/print.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpBB/styles/prosilver/theme/print.css b/phpBB/styles/prosilver/theme/print.css index 6dfb5c4726..68600b030b 100644 --- a/phpBB/styles/prosilver/theme/print.css +++ b/phpBB/styles/prosilver/theme/print.css @@ -140,3 +140,5 @@ div.spacer { clear: both; } /* Accessibility tweaks: Mozilla.org */ .skip_link { display: none; } + +dl.codebox dt { display: none; } \ No newline at end of file From bef108a5cc1cc80068f7066b5c18c5631b8dbc32 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 11 Sep 2010 21:55:11 +0200 Subject: [PATCH 313/393] [ticket/9609] Change header() calls setting HTTP status to send_status_line(). PHPBB3-9609 --- phpBB/download/file.php | 14 +++++++------- phpBB/includes/functions.php | 7 ++++--- phpBB/includes/session.php | 6 +++--- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/phpBB/download/file.php b/phpBB/download/file.php index 1f2cee4d95..5f45b88359 100644 --- a/phpBB/download/file.php +++ b/phpBB/download/file.php @@ -77,7 +77,7 @@ if (isset($_GET['avatar'])) // '==' is not a bug - . as the first char is as bad as no dot at all if (strpos($filename, '.') == false) { - header('HTTP/1.0 403 Forbidden'); + send_status_line(403, 'Forbidden'); $exit = true; } @@ -91,7 +91,7 @@ if (isset($_GET['avatar'])) if (!$exit && !in_array($ext, array('png', 'gif', 'jpg', 'jpeg'))) { // no way such an avatar could exist. They are not following the rules, stop the show. - header("HTTP/1.0 403 Forbidden"); + send_status_line(403, 'Forbidden'); $exit = true; } @@ -101,7 +101,7 @@ if (isset($_GET['avatar'])) if (!$filename) { // no way such an avatar could exist. They are not following the rules, stop the show. - header("HTTP/1.0 403 Forbidden"); + send_status_line(403, 'Forbidden'); } else { @@ -199,7 +199,7 @@ else $row['forum_id'] = false; if (!$auth->acl_get('u_pm_download')) { - header('HTTP/1.0 403 Forbidden'); + send_status_line(403, 'Forbidden'); trigger_error('SORRY_AUTH_VIEW_ATTACH'); } @@ -222,7 +222,7 @@ else if (!$allowed) { - header('HTTP/1.0 403 Forbidden'); + send_status_line(403, 'Forbidden'); trigger_error('ERROR_NO_ATTACHMENT'); } } @@ -237,7 +237,7 @@ else if (!download_allowed()) { - header('HTTP/1.0 403 Forbidden'); + send_status_line(403, 'Forbidden'); trigger_error($user->lang['LINKAGE_FORBIDDEN']); } @@ -383,7 +383,7 @@ function send_avatar_to_browser($file, $browser) } else { - header('HTTP/1.0 404 Not Found'); + send_status_line(404, 'Not Found'); } } diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index c4ff998e69..91edddf5d2 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3753,7 +3753,7 @@ function msg_handler($errno, $msg_text, $errfile, $errline) } // Do not send 200 OK, but service unavailable on errors - header('HTTP/1.1 503 Service Unavailable'); + send_status_line(503, 'Service Unavailable'); garbage_collection(); @@ -4223,7 +4223,8 @@ function phpbb_http_login($param) } else if ($auth_result['status'] == LOGIN_ERROR_ATTEMPTS) { - header('HTTP/1.0 401 Unauthorized'); + send_status_line(401, 'Unauthorized'); + trigger_error('NOT_AUTHORISED'); } } @@ -4235,7 +4236,7 @@ function phpbb_http_login($param) $param['auth_message'] = preg_replace('/[\x80-\xFF]/', '?', $param['auth_message']); header('WWW-Authenticate: Basic realm="' . $param['auth_message'] . '"'); - header('HTTP/1.0 401 Unauthorized'); + send_status_line(401, 'Unauthorized'); trigger_error('NOT_AUTHORISED'); } diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 79023cc7bc..aa2293c630 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -748,7 +748,7 @@ class session if ((int) $row['sessions'] > (int) $config['active_sessions']) { - header('HTTP/1.1 503 Service Unavailable'); + send_status_line(503, 'Service Unavailable'); trigger_error('BOARD_UNAVAILABLE'); } } @@ -1821,7 +1821,7 @@ class user extends session { if ($this->data['is_bot']) { - header('HTTP/1.1 503 Service Unavailable'); + send_status_line(503, 'Service Unavailable'); } $message = (!empty($config['board_disable_msg'])) ? $config['board_disable_msg'] : 'BOARD_DISABLE'; @@ -1840,7 +1840,7 @@ class user extends session { if ($this->data['is_bot']) { - header('HTTP/1.1 503 Service Unavailable'); + send_status_line(503, 'Service Unavailable'); } trigger_error('BOARD_UNAVAILABLE'); } From 4fd45adfc5717d3215aa961c83257fa19da7e570 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Fri, 30 Apr 2010 23:23:11 +0200 Subject: [PATCH 314/393] [ticket/9592] Test suite does not run on SQlite PHPBB3-9592 --- .../phpbb_database_test_case.php | 58 +++++++++++++++---- 1 file changed, 47 insertions(+), 11 deletions(-) diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index d558874c6f..a38f6719b3 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -65,7 +65,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test 'sqlite' => array( 'SCHEMA' => 'sqlite', 'DELIM' => ';', - 'PDO' => 'sqlite', + 'PDO' => 'sqlite2', ), ); @@ -79,7 +79,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test } } - function split_sql_file($sql, $delimiter) + function split_sql_file($sql, $delimiter, $dbms) { $sql = str_replace("\r" , '', $sql); $data = preg_split('/' . preg_quote($delimiter, '/') . '$/m', $sql); @@ -94,6 +94,21 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test unset($data[key($data)]); } + if ($dbms == 'sqlite') + { + // trim # off query to satisfy sqlite + foreach ($data as $i => $query) + { + $lines = explode("\n", $query); + foreach ($lines as $j => $line) + if (strpos($line, '#') === 0) + { + unset($lines[$j]); + } + $data[$i] = implode("\n", $lines); + } + } + return $data; } @@ -108,21 +123,42 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test if ($already_connected) { - $pdo = new PDO($dbms_data['PDO'] . ':host=' . $database_config['dbhost'] . ';dbname=' . $database_config['dbname'], $database_config['dbuser'], $database_config['dbpasswd']); + if ($database_config['dbms'] == 'sqlite') + { + $pdo = new PDO($dbms_data['PDO'] . ':' . $database_config['dbhost']); + } + else + { + $pdo = new PDO($dbms_data['PDO'] . ':host=' . $database_config['dbhost'] . ';dbname=' . $database_config['dbname'], $database_config['dbuser'], $database_config['dbpasswd']); + } } else { - $pdo = new PDO($dbms_data['PDO'] . ':host=' . $database_config['dbhost'] . ';', $database_config['dbuser'], $database_config['dbpasswd']); - - try + if ($database_config['dbms'] == 'sqlite') { - $pdo->exec('DROP DATABASE ' . $database_config['dbname']); + // delete existing database + if (file_exists($database_config['dbhost'])) + { + unlink($database_config['dbhost']); + } + + $pdo = new PDO($dbms_data['PDO'] . ':' . $database_config['dbhost']); } - catch (PDOException $e){} // ignore non existent db + else + { + $pdo = new PDO($dbms_data['PDO'] . ':host=' . $database_config['dbhost'] . ';', $database_config['dbuser'], $database_config['dbpasswd']);try + { + $pdo->exec('DROP DATABASE ' . $database_config['dbname']); + } + catch (PDOException $e){} // ignore non existent db - $pdo->exec('CREATE DATABASE ' . $database_config['dbname']); + $pdo->exec('CREATE DATABASE ' . $database_config['dbname']); - $pdo = new PDO($dbms_data['PDO'] . ':host=' . $database_config['dbhost'] . ';dbname=' . $database_config['dbname'], $database_config['dbuser'], $database_config['dbpasswd']); + $pdo = new PDO($dbms_data['PDO'] . ':host=' . $database_config['dbhost'] . ';dbname=' . $database_config['dbname'], $database_config['dbuser'], $database_config['dbpasswd']); + } + + // good for debug + // $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); if ($database_config['dbms'] == 'mysql') { @@ -141,7 +177,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test unset($row, $sth); } - $sql_query = $this->split_sql_file(file_get_contents("../phpBB/install/schemas/{$dbms_data['SCHEMA']}_schema.sql"), $dbms_data['DELIM']); + $sql_query = $this->split_sql_file(file_get_contents("../phpBB/install/schemas/{$dbms_data['SCHEMA']}_schema.sql"), $dbms_data['DELIM'], $database_config['dbms']); foreach ($sql_query as $sql) { From 566ddf8a4b743a6d2d308c8fed912c354372d916 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sun, 12 Sep 2010 00:51:27 +0200 Subject: [PATCH 315/393] [ticket/9592] Remove test cases for empty IN() They failed under SQLite because SQLite accepts empty IN() syntax. PHPBB3-9592 --- tests/dbal/dbal.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/dbal/dbal.php b/tests/dbal/dbal.php index 1cce891ca9..663323ad61 100644 --- a/tests/dbal/dbal.php +++ b/tests/dbal/dbal.php @@ -244,8 +244,9 @@ class phpbb_dbal_test extends phpbb_database_test_case array('username_clean' => 'bertie'))), // These here would throw errors and therefor $result should be false. - array('user_id', array(), false, false, false, true), - array('user_id', array(), true, false, false, true), + // Removing for now because SQLite accepts empty IN() syntax + /*array('user_id', array(), false, false, false, true), + array('user_id', array(), true, false, false, true),*/ ); } From 20505ff326e98cdab6c09adc4fa554dae4221aeb Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sun, 12 Sep 2010 14:21:25 +0200 Subject: [PATCH 316/393] [ticket/9816] Remove config.php from repository PHPBB3-9816 --- .gitignore | 4 +++- phpBB/config.php | 0 2 files changed, 3 insertions(+), 1 deletion(-) delete mode 100644 phpBB/config.php diff --git a/.gitignore b/.gitignore index 3e0f454e0c..3590226920 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ phpBB/cache/*.php -*~ \ No newline at end of file +phpBB/config.php +tests/test_config.php +*~ diff --git a/phpBB/config.php b/phpBB/config.php deleted file mode 100644 index e69de29bb2..0000000000 From 47769529595a81fe2063fc0222036192f0aa4e62 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Tue, 7 Sep 2010 16:10:29 +0200 Subject: [PATCH 317/393] [ticket/9804] Update docs/AUTHORS. Move DavidMJ, add evil<3. PHPBB3-9804 --- phpBB/docs/AUTHORS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/docs/AUTHORS b/phpBB/docs/AUTHORS index 84677c4e15..d6af9d1db9 100644 --- a/phpBB/docs/AUTHORS +++ b/phpBB/docs/AUTHORS @@ -26,8 +26,8 @@ phpBB Developers: A_Jelly_Doughnut (Josh Woody) Acyd Burn (Meik Sievertsen) [Lead 09/2005 - 01/2010] APTX (Marek A. R.) bantu (Andreas Fischer) - DavidMJ (David M.) dhn (Dominik Dröscher) + evil<3 (Igor Wiedler) kellanved (Henry Sudhof) nickvergessen (Joas Schilling) rxu (Ruslan Uzdenov) @@ -49,6 +49,7 @@ phpBB Lead Developer: psoTFX (Paul S. Owen) [2001 - 09/2005] phpBB Developers: Ashe (Ludovic Arnaud) [10/2002 - 11/2003, 06/2006 - 10/2006] BartVB (Bart van Bragt) [11/2000 - 03/2006] + DavidMJ (David M.) [12/2005 - 08/2009] GrahamJE (Graham Eames) [09/2005 - 11/2006] Vic D'Elfant (Vic D'Elfant) [04/2007 - 04/2009] From a81c857c96ee1a2a9be559ff3c9b71ca9514287e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 14 Sep 2010 13:20:38 +0200 Subject: [PATCH 318/393] [ticket/9162] BBCode in poll options is broken, when posting without question. PHPBB3-9162 --- phpBB/posting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/posting.php b/phpBB/posting.php index 8cacac2910..7c36f40ca7 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1297,7 +1297,7 @@ $attachment_data = $message_parser->attachment_data; $filename_data = $message_parser->filename_data; $post_data['post_text'] = $message_parser->message; -if (sizeof($post_data['poll_options']) && $post_data['poll_title']) +if (sizeof($post_data['poll_options']) || $post_data['poll_title']) { $message_parser->message = $post_data['poll_title']; $message_parser->bbcode_uid = $post_data['bbcode_uid']; From ffd9437948e4e5cb20005f8f60913f8d80805995 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 14 Sep 2010 13:10:50 +0200 Subject: [PATCH 319/393] [ticket/9820] phpBB Debug Error when trying to post a new topic. Regression from aa4519fb44f4ff83e923c6cc4d5bde3f20082340 PHPBB3-9820 PHPBB3-7260 --- phpBB/posting.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/phpBB/posting.php b/phpBB/posting.php index 8cacac2910..a793159a2d 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -402,15 +402,18 @@ if ($post_data['poll_start']) $db->sql_freeresult($result); } -$original_poll_data = array( - 'poll_title' => $post_data['poll_title'], - 'poll_length' => $post_data['poll_length'], - 'poll_max_options' => $post_data['poll_max_options'], - 'poll_option_text' => implode("\n", $post_data['poll_options']), - 'poll_start' => $post_data['poll_start'], - 'poll_last_vote' => $post_data['poll_last_vote'], - 'poll_vote_change' => $post_data['poll_vote_change'], -); +if ($mode == 'edit') +{ + $original_poll_data = array( + 'poll_title' => $post_data['poll_title'], + 'poll_length' => $post_data['poll_length'], + 'poll_max_options' => $post_data['poll_max_options'], + 'poll_option_text' => implode("\n", $post_data['poll_options']), + 'poll_start' => $post_data['poll_start'], + 'poll_last_vote' => $post_data['poll_last_vote'], + 'poll_vote_change' => $post_data['poll_vote_change'], + ); +} $orig_poll_options_size = sizeof($post_data['poll_options']); From a4742f795e8e20abeec915059f018dbe001383d7 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Wed, 15 Sep 2010 08:28:46 +0200 Subject: [PATCH 320/393] [ticket/9592] Slight adjustments to simplify db test cases PHPBB3-9592 --- .../phpbb_database_test_case.php | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index a38f6719b3..f6bf420ebc 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -19,7 +19,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test } } - function get_dbms_data($dbms) + public function get_dbms_data($dbms) { $available_dbms = array( 'firebird' => array( @@ -79,10 +79,13 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test } } - function split_sql_file($sql, $delimiter, $dbms) + // NOTE: This function is not the same as split_sql_file from functions_install + public function split_sql_file($sql, $dbms) { + $dbms_data = $this->get_dbms_data($dbms); + $sql = str_replace("\r" , '', $sql); - $data = preg_split('/' . preg_quote($delimiter, '/') . '$/m', $sql); + $data = preg_split('/' . preg_quote($dbms_data['DELIM'], '/') . '$/m', $sql); $data = array_map('trim', $data); @@ -99,13 +102,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test // trim # off query to satisfy sqlite foreach ($data as $i => $query) { - $lines = explode("\n", $query); - foreach ($lines as $j => $line) - if (strpos($line, '#') === 0) - { - unset($lines[$j]); - } - $data[$i] = implode("\n", $lines); + $data[$i] = preg_replace('/^#.*$/m', "\n", $query); } } @@ -177,7 +174,7 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test unset($row, $sth); } - $sql_query = $this->split_sql_file(file_get_contents("../phpBB/install/schemas/{$dbms_data['SCHEMA']}_schema.sql"), $dbms_data['DELIM'], $database_config['dbms']); + $sql_query = $this->split_sql_file(file_get_contents("../phpBB/install/schemas/{$dbms_data['SCHEMA']}_schema.sql"), $database_config['dbms']); foreach ($sql_query as $sql) { From ac753fa8536b5d4a2e5a7d86e7fa922eb56ed561 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 16 Sep 2010 00:03:52 +0200 Subject: [PATCH 321/393] [ticket/9825] Unit tests: Use sqlite when possible and no test_config exists. PHPBB3-9825 --- .../phpbb_test_case_helpers.php | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/tests/test_framework/phpbb_test_case_helpers.php b/tests/test_framework/phpbb_test_case_helpers.php index 0c5932e1ad..7c026e496e 100644 --- a/tests/test_framework/phpbb_test_case_helpers.php +++ b/tests/test_framework/phpbb_test_case_helpers.php @@ -22,7 +22,32 @@ class phpbb_test_case_helpers { static $show_error = true; - if (!file_exists('test_config.php')) + if (file_exists('test_config.php')) + { + include('test_config.php'); + + return array( + 'dbms' => $dbms, + 'dbhost' => $dbhost, + 'dbport' => $dbport, + 'dbname' => $dbname, + 'dbuser' => $dbuser, + 'dbpasswd' => $dbpasswd, + ); + } + else if (extension_loaded('sqlite') && version_compare(PHPUnit_Runner_Version::id(), '3.4.15', '>=')) + { + // Silently use sqlite + return array( + 'dbms' => 'sqlite', + 'dbhost' => 'phpbb_unit_tests.sqlite2', // filename + 'dbport' => '', + 'dbname' => '', + 'dbuser' => '', + 'dbpasswd' => '', + ); + } + else { if ($show_error) { @@ -46,16 +71,6 @@ class phpbb_test_case_helpers NOTE: The database is dropped and recreated with the phpbb-db-schema! Do NOT specify a database with important data.", E_USER_ERROR); } - include('test_config.php'); - - return array( - 'dbms' => $dbms, - 'dbhost' => $dbhost, - 'dbport' => $dbport, - 'dbname' => $dbname, - 'dbuser' => $dbuser, - 'dbpasswd' => $dbpasswd, - ); } public function new_dbal() From 6bfae1cd1a575ed61222a7cf2cb800f4e051a88c Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Thu, 16 Sep 2010 21:57:25 +0200 Subject: [PATCH 322/393] [ticket/9830] Redirect to install directly when config.php does not exist. PHPBB3-9830 --- phpBB/common.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/phpBB/common.php b/phpBB/common.php index 9b6913e95f..c8b2fb9609 100644 --- a/phpBB/common.php +++ b/phpBB/common.php @@ -123,13 +123,11 @@ if (defined('IN_CRON')) $phpbb_root_path = dirname(__FILE__) . DIRECTORY_SEPARATOR; } -if (!file_exists($phpbb_root_path . 'config.' . $phpEx)) +if (file_exists($phpbb_root_path . 'config.' . $phpEx)) { - die("

            The config.$phpEx file could not be found.

            Click here to install phpBB

            "); + require($phpbb_root_path . 'config.' . $phpEx); } -require($phpbb_root_path . 'config.' . $phpEx); - if (!defined('PHPBB_INSTALLED')) { // Redirect the user to the installer From 81d3f382a9207b68721cdc6449d18aa8e88abea1 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Thu, 16 Sep 2010 23:16:30 +0200 Subject: [PATCH 323/393] [ticket/9825] Add unit test config and db to gitignore PHPBB3-9825 --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 3e0f454e0c..2b9eef7fce 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ phpBB/cache/*.php -*~ \ No newline at end of file +tests/phpbb_unit_tests.sqlite2 +tests/test_config.php +*~ From 68b35b584536170759675204d738f9ead883a4f2 Mon Sep 17 00:00:00 2001 From: Cristian Rodriguez Date: Sun, 11 Apr 2010 23:48:52 +0200 Subject: [PATCH 324/393] [ticket/9829] Fix error in recaptcha validation. The recaptcha plugin falsely accepted error responses by recaptcha as valid solutions. PHPBB3-9829 --- phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php index 0f0bfc4156..ea171dbe2c 100644 --- a/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php +++ b/phpBB/includes/captcha/plugins/phpbb_recaptcha_plugin.php @@ -314,10 +314,7 @@ class phpbb_recaptcha extends phpbb_default_captcha } else { - if ($answers[1] === 'incorrect-captcha-sol') - { - return $user->lang['RECAPTCHA_INCORRECT']; - } + return $user->lang['RECAPTCHA_INCORRECT']; } } From f6700815a84c32cbd74f2288a80b54ac4303ae5e Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Tue, 21 Sep 2010 00:53:30 +0200 Subject: [PATCH 325/393] [ticket/9804] Account evil3 renamed to igorw, adjust AUTHORS PHPBB3-9804 --- phpBB/docs/AUTHORS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/docs/AUTHORS b/phpBB/docs/AUTHORS index d6af9d1db9..b3166313c3 100644 --- a/phpBB/docs/AUTHORS +++ b/phpBB/docs/AUTHORS @@ -27,7 +27,7 @@ phpBB Developers: A_Jelly_Doughnut (Josh Woody) APTX (Marek A. R.) bantu (Andreas Fischer) dhn (Dominik Dröscher) - evil<3 (Igor Wiedler) + igorw (Igor Wiedler) kellanved (Henry Sudhof) nickvergessen (Joas Schilling) rxu (Ruslan Uzdenov) From d485664404d44bb371fd9b8a5b23ad8327cea302 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 15 Oct 2010 16:47:21 +0200 Subject: [PATCH 326/393] [ticket/9698] Add .htaccess to the includes subdirectory. Add .htaccess to the includes folder to prevent full path disclosure when running PHP 5.3. When the error_reporting setting in php.ini contains the E_DEPRECATED error level, the PHP parser throws an error message containing the local filesystem path when accessing one of the captcha plugins directly. This is because the captcha plugins return explicit references for PHP 4 compatibility. PHPBB3-9698 --- phpBB/includes/.htaccess | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 phpBB/includes/.htaccess diff --git a/phpBB/includes/.htaccess b/phpBB/includes/.htaccess new file mode 100644 index 0000000000..4128d345ab --- /dev/null +++ b/phpBB/includes/.htaccess @@ -0,0 +1,4 @@ + + Order Allow,Deny + Deny from All + From 59e62d271c3ba97784e2c7e1a9928600e0d2c1f6 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 15 Oct 2010 17:57:43 +0200 Subject: [PATCH 327/393] [ticket/9822] Correct some style related ACP explain statements. Remove "Additionally, if you have permission you can elect to remove the set from the filesystem." because that functionality is not implemented. Also remove unnecessary "When the imageset is deleted it is gone for good." statement, "It is recommended that you first export your set for possible future use." should be clear enough. PHPBB3-9822 --- phpBB/language/en/acp/styles.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/language/en/acp/styles.php b/phpBB/language/en/acp/styles.php index 951c69f915..f161a7e6e6 100644 --- a/phpBB/language/en/acp/styles.php +++ b/phpBB/language/en/acp/styles.php @@ -76,13 +76,13 @@ $lang = array_merge($lang, array( 'DEACTIVATE_DEFAULT' => 'You cannot deactivate the default style.', 'DELETE_FROM_FS' => 'Delete from filesystem', 'DELETE_IMAGESET' => 'Delete imageset', - 'DELETE_IMAGESET_EXPLAIN' => 'Here you can remove the selected imageset from the database. Additionally, if you have permission you can elect to remove the set from the filesystem. Please note that there is no undo capability. When the imageset is deleted it is gone for good. It is recommended that you first export your set for possible future use.', + 'DELETE_IMAGESET_EXPLAIN' => 'Here you can remove the selected imageset from the database. Please note that there is no undo capability. It is recommended that you first export your set for possible future use.', 'DELETE_STYLE' => 'Delete style', - 'DELETE_STYLE_EXPLAIN' => 'Here you can remove the selected style. You cannot remove all the style elements from here. These must be deleted individually via their respective forms. Take care in deleting styles there is no undo facility.', + 'DELETE_STYLE_EXPLAIN' => 'Here you can remove the selected style. You cannot remove all the style elements from here. These must be deleted individually via their respective forms. Take care when deleting styles, there is no undo facility.', 'DELETE_TEMPLATE' => 'Delete template', - 'DELETE_TEMPLATE_EXPLAIN' => 'Here you can remove the selected template set from the database. Additionally, if you have permission you can elect to remove the set from the filesystem. Please note that there is no undo capability. When the templates are deleted they are gone for good. It is recommended that you first export your set for possible future use.', + 'DELETE_TEMPLATE_EXPLAIN' => 'Here you can remove the selected template set from the database. Please note that there is no undo capability. It is recommended that you first export your set for possible future use.', 'DELETE_THEME' => 'Delete theme', - 'DELETE_THEME_EXPLAIN' => 'Here you can remove the selected theme from the database. Additionally, if you have permission you can elect to remove the theme from the filesystem. Please note that there is no undo capability. When the theme is deleted it is gone for good. It is recommended that you first export your theme for possible future use.', + 'DELETE_THEME_EXPLAIN' => 'Here you can remove the selected theme from the database. Please note that there is no undo capability. It is recommended that you first export your theme for possible future use.', 'DETAILS' => 'Details', 'DIMENSIONS_EXPLAIN' => 'Selecting yes here will include width/height parameters.', From 32ee8955b2e3bb2b1e26c5f12b315c9a6c02cbcf Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 15 Oct 2010 18:08:43 +0200 Subject: [PATCH 328/393] [ticket/9848] Add avatars, attachments and store files to .gitignore. PHPBB3-9848 --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index b825007244..871d17b386 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ *~ phpBB/cache/*.php phpBB/config.php +phpBB/files/* +phpBB/images/avatars/upload/* +phpBB/store/* tests/phpbb_unit_tests.sqlite2 tests/test_config.php From 0452da2bf1f93dc8d9ea5c73f1276a5976eaca7d Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 15 Oct 2010 18:54:44 +0200 Subject: [PATCH 329/393] [ticket/7538] Limit user_login_attempts to prevent SQL errors. PHPBB3-7538 --- phpBB/includes/auth/auth_db.php | 6 ++++-- phpBB/includes/constants.php | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/phpBB/includes/auth/auth_db.php b/phpBB/includes/auth/auth_db.php index 73c4f92976..e04a6307e9 100644 --- a/phpBB/includes/auth/auth_db.php +++ b/phpBB/includes/auth/auth_db.php @@ -134,7 +134,8 @@ function login_db(&$username, &$password) // increase login attempt count to make sure this cannot be exploited $sql = 'UPDATE ' . USERS_TABLE . ' SET user_login_attempts = user_login_attempts + 1 - WHERE user_id = ' . $row['user_id']; + WHERE user_id = ' . (int) $row['user_id'] . ' + AND user_login_attempts < ' . LOGIN_ATTEMPTS_MAX; $db->sql_query($sql); return array( @@ -194,7 +195,8 @@ function login_db(&$username, &$password) // Password incorrect - increase login attempts $sql = 'UPDATE ' . USERS_TABLE . ' SET user_login_attempts = user_login_attempts + 1 - WHERE user_id = ' . $row['user_id']; + WHERE user_id = ' . (int) $row['user_id'] . ' + AND user_login_attempts < ' . LOGIN_ATTEMPTS_MAX; $db->sql_query($sql); // Give status about wrong password... diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index ff572869e2..ebaa342f54 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -69,6 +69,10 @@ define('LOGIN_ERROR_ATTEMPTS', 13); define('LOGIN_ERROR_EXTERNAL_AUTH', 14); define('LOGIN_ERROR_PASSWORD_CONVERT', 15); +// Maximum login attempts +// The value is arbitrary, but it has to fit into the user_login_attempts field. +define('LOGIN_ATTEMPTS_MAX', 100); + // Group settings define('GROUP_OPEN', 0); define('GROUP_CLOSED', 1); From 2c4c1f925768285995020e08b0e5d13c51a5c388 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 29 Aug 2010 19:46:49 +0200 Subject: [PATCH 330/393] [ticket/9664] Resolve conflict with accesskey="t", change addlitsitem to "y". PHPBB3-9664 --- phpBB/adm/style/acp_users_signature.html | 2 +- phpBB/styles/prosilver/template/posting_buttons.html | 2 +- phpBB/styles/subsilver2/template/posting_buttons.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/phpBB/adm/style/acp_users_signature.html b/phpBB/adm/style/acp_users_signature.html index 6317a375b4..69c6d8f3fb 100644 --- a/phpBB/adm/style/acp_users_signature.html +++ b/phpBB/adm/style/acp_users_signature.html @@ -56,7 +56,7 @@ - + diff --git a/phpBB/styles/prosilver/template/posting_buttons.html b/phpBB/styles/prosilver/template/posting_buttons.html index 4d866681f0..5d21229611 100644 --- a/phpBB/styles/prosilver/template/posting_buttons.html +++ b/phpBB/styles/prosilver/template/posting_buttons.html @@ -79,7 +79,7 @@ - + diff --git a/phpBB/styles/subsilver2/template/posting_buttons.html b/phpBB/styles/subsilver2/template/posting_buttons.html index 2fff9c1991..621fa87fd4 100644 --- a/phpBB/styles/subsilver2/template/posting_buttons.html +++ b/phpBB/styles/subsilver2/template/posting_buttons.html @@ -45,7 +45,7 @@ - + From 931bd25e34a96dbe31089dc76dd2122ef9397279 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 15 Oct 2010 19:35:40 +0200 Subject: [PATCH 331/393] [ticket/9841] Change "Save" to "Save draft", "Load" to "Load draft". This has confused people that are less familiar with phpBB or web applications in general. "Save draft" should make it clear that a draft is being saved, but it is still short enough to be used in a button. PHPBB3-9841 --- phpBB/styles/prosilver/template/posting_editor.html | 4 ++-- phpBB/styles/subsilver2/template/posting_body.html | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/phpBB/styles/prosilver/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html index 9476242d11..5f7fb8408e 100644 --- a/phpBB/styles/prosilver/template/posting_editor.html +++ b/phpBB/styles/prosilver/template/posting_editor.html @@ -187,8 +187,8 @@
            {S_HIDDEN_ADDRESS_FIELD} {S_HIDDEN_FIELDS} -   -   +   +   onclick="document.getElementById('postform').action += '#preview';" />    diff --git a/phpBB/styles/subsilver2/template/posting_body.html b/phpBB/styles/subsilver2/template/posting_body.html index 963e6fe966..0021cd2eb3 100644 --- a/phpBB/styles/subsilver2/template/posting_body.html +++ b/phpBB/styles/subsilver2/template/posting_body.html @@ -342,8 +342,8 @@
              -   -   +   +    
            + config_name + config_value + is_dynamic + + config1 + foo + 0 + + + config2 + bar + 1 + +
            + diff --git a/tests/dbal/dbal.php b/tests/dbal/select.php similarity index 74% rename from tests/dbal/dbal.php rename to tests/dbal/select.php index 663323ad61..70f27549d2 100644 --- a/tests/dbal/dbal.php +++ b/tests/dbal/select.php @@ -10,7 +10,7 @@ require_once 'test_framework/framework.php'; require_once '../phpBB/includes/functions.php'; -class phpbb_dbal_test extends phpbb_database_test_case +class phpbb_dbal_select_test extends phpbb_database_test_case { public function getDataSet() { @@ -318,174 +318,4 @@ class phpbb_dbal_test extends phpbb_database_test_case $db->sql_freeresult($result); } - - public static function build_array_insert_data() - { - return array( - array(array( - 'config_name' => 'test_version', - 'config_value' => '0.0.0', - 'is_dynamic' => 1, - )), - array(array( - 'config_name' => 'second config', - 'config_value' => '10', - 'is_dynamic' => 0, - )), - ); - } - - /** - * @dataProvider build_array_insert_data - */ - public function test_build_array_insert($sql_ary) - { - $db = $this->new_dbal(); - - $sql = 'INSERT INTO phpbb_config ' . $db->sql_build_array('INSERT', $sql_ary); - $result = $db->sql_query($sql); - - $sql = "SELECT * - FROM phpbb_config - WHERE config_name = '" . $sql_ary['config_name'] . "'"; - $result = $db->sql_query_limit($sql, 1); - - $this->assertEquals($sql_ary, $db->sql_fetchrow($result)); - - $db->sql_freeresult($result); - } - - public static function delete_data() - { - return array( - array( - "WHERE config_name = 'test_version'", - array( - array( - 'config_name' => 'second config', - 'config_value' => '10', - 'is_dynamic' => 0, - ), - ), - ), - array( - '', - array(), - ), - ); - } - - /** - * @dataProvider delete_data - */ - public function test_delete($where, $expected) - { - $db = $this->new_dbal(); - - $sql = 'DELETE FROM phpbb_config - ' . $where; - $result = $db->sql_query($sql); - - $sql = 'SELECT * - FROM phpbb_config'; - $result = $db->sql_query($sql); - - $this->assertEquals($expected, $db->sql_fetchrowset($result)); - - $db->sql_freeresult($result); - } - - public function test_multiple_insert() - { - $db = $this->new_dbal(); - - $batch_ary = array( - array( - 'config_name' => 'batch one', - 'config_value' => 'b1', - 'is_dynamic' => 0, - ), - array( - 'config_name' => 'batch two', - 'config_value' => 'b2', - 'is_dynamic' => 1, - ), - ); - - $result = $db->sql_multi_insert('phpbb_config', $batch_ary); - - $sql = 'SELECT * - FROM phpbb_config - ORDER BY config_name ASC'; - $result = $db->sql_query($sql); - - $this->assertEquals($batch_ary, $db->sql_fetchrowset($result)); - - $db->sql_freeresult($result); - } - - public static function update_data() - { - return array( - array( - array( - 'config_value' => '20', - 'is_dynamic' => 0, - ), - " WHERE config_name = 'batch one'", - array( - array( - 'config_name' => 'batch one', - 'config_value' => '20', - 'is_dynamic' => 0, - ), - array( - 'config_name' => 'batch two', - 'config_value' => 'b2', - 'is_dynamic' => 1, - ), - ), - ), - array( - array( - 'config_value' => '0', - 'is_dynamic' => 1, - ), - '', - array( - array( - 'config_name' => 'batch one', - 'config_value' => '0', - 'is_dynamic' => 1, - ), - array( - 'config_name' => 'batch two', - 'config_value' => '0', - 'is_dynamic' => 1, - ), - ), - ), - ); - } - - /** - * @dataProvider update_data - */ - public function test_update($sql_ary, $where, $expected) - { - $db = $this->new_dbal(); - - $sql = 'UPDATE phpbb_config - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . $where; - $result = $db->sql_query($sql); - - $sql = 'SELECT * - FROM phpbb_config - ORDER BY config_name ASC'; - $result = $db->sql_query($sql); - - $this->assertEquals($expected, $db->sql_fetchrowset($result)); - - $db->sql_freeresult($result); - } } diff --git a/tests/dbal/write.php b/tests/dbal/write.php new file mode 100644 index 0000000000..01deacda69 --- /dev/null +++ b/tests/dbal/write.php @@ -0,0 +1,172 @@ +createXMLDataSet(dirname(__FILE__).'/fixtures/config.xml'); + } + + public static function build_array_insert_data() + { + return array( + array(array( + 'config_name' => 'test_version', + 'config_value' => '0.0.0', + 'is_dynamic' => 1, + )), + array(array( + 'config_name' => 'second config', + 'config_value' => '10', + 'is_dynamic' => 0, + )), + ); + } + + /** + * @dataProvider build_array_insert_data + */ + public function test_build_array_insert($sql_ary) + { + $db = $this->new_dbal(); + + $sql = 'INSERT INTO phpbb_config ' . $db->sql_build_array('INSERT', $sql_ary); + $result = $db->sql_query($sql); + + $sql = "SELECT * + FROM phpbb_config + WHERE config_name = '" . $sql_ary['config_name'] . "'"; + $result = $db->sql_query_limit($sql, 1); + + $this->assertEquals($sql_ary, $db->sql_fetchrow($result)); + + $db->sql_freeresult($result); + } + + public function test_delete() + { + $db = $this->new_dbal(); + + $sql = "DELETE FROM phpbb_config + WHERE config_name = 'config1'"; + $result = $db->sql_query($sql); + + $sql = 'SELECT * + FROM phpbb_config'; + $result = $db->sql_query($sql); + $rows = $db->sql_fetchrowset($result); + + $this->assertEquals(1, sizeof($rows)); + $this->assertEquals('config2', $rows[0]['config_name']); + + $db->sql_freeresult($result); + } + + public function test_multiple_insert() + { + $db = $this->new_dbal(); + + // empty the table + $sql = 'DELETE FROM phpbb_config'; + $db->sql_query($sql); + + $batch_ary = array( + array( + 'config_name' => 'batch one', + 'config_value' => 'b1', + 'is_dynamic' => 0, + ), + array( + 'config_name' => 'batch two', + 'config_value' => 'b2', + 'is_dynamic' => 1, + ), + ); + + $result = $db->sql_multi_insert('phpbb_config', $batch_ary); + + $sql = 'SELECT * + FROM phpbb_config + ORDER BY config_name ASC'; + $result = $db->sql_query($sql); + + $this->assertEquals($batch_ary, $db->sql_fetchrowset($result)); + + $db->sql_freeresult($result); + } + + public static function update_data() + { + return array( + array( + array( + 'config_value' => '23', + 'is_dynamic' => 0, + ), + " WHERE config_name = 'config1'", + array( + array( + 'config_name' => 'config1', + 'config_value' => '23', + 'is_dynamic' => 0, + ), + array( + 'config_name' => 'config2', + 'config_value' => 'bar', + 'is_dynamic' => 1, + ), + ), + ), + array( + array( + 'config_value' => '0', + 'is_dynamic' => 1, + ), + '', + array( + array( + 'config_name' => 'config1', + 'config_value' => '0', + 'is_dynamic' => 1, + ), + array( + 'config_name' => 'config2', + 'config_value' => '0', + 'is_dynamic' => 1, + ), + ), + ), + ); + } + + /** + * @dataProvider update_data + */ + public function test_update($sql_ary, $where, $expected) + { + $db = $this->new_dbal(); + + $sql = 'UPDATE phpbb_config + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . $where; + $result = $db->sql_query($sql); + + $sql = 'SELECT * + FROM phpbb_config + ORDER BY config_name ASC'; + $result = $db->sql_query($sql); + + $this->assertEquals($expected, $db->sql_fetchrowset($result)); + + $db->sql_freeresult($result); + } +} diff --git a/tests/test_framework/phpbb_database_test_case.php b/tests/test_framework/phpbb_database_test_case.php index de9a91fa45..a64bae8c57 100644 --- a/tests/test_framework/phpbb_database_test_case.php +++ b/tests/test_framework/phpbb_database_test_case.php @@ -9,6 +9,8 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_TestCase { + private static $already_connected; + protected $test_case_helpers; public function get_test_case_helpers() @@ -333,23 +335,21 @@ abstract class phpbb_database_test_case extends PHPUnit_Extensions_Database_Test public function getConnection() { - static $already_connected; - $config = $this->get_database_config(); $dbms = $this->get_dbms_data($config['dbms']); - if (!$already_connected) + if (!self::$already_connected) { $this->recreate_db($config, $dbms); } $pdo = $this->new_pdo($config, $dbms, true); - if (!$already_connected) + if (!self::$already_connected) { $this->load_schema($pdo, $config, $dbms); - $already_connected = true; + self::$already_connected = true; } return $this->createDefaultDBConnection($pdo, 'testdb'); From 76e8a9466ef3227337dd18faf9b623195af00364 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Mon, 25 Oct 2010 19:22:57 +0200 Subject: [PATCH 359/393] [task/mssql-db-tests] Remove MS SQL helper values from SELECT LIMIT results. PHPBB3-9868 --- phpBB/includes/db/mssqlnative.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/db/mssqlnative.php b/phpBB/includes/db/mssqlnative.php index 93a8f91613..1e0a8077e7 100644 --- a/phpBB/includes/db/mssqlnative.php +++ b/phpBB/includes/db/mssqlnative.php @@ -413,13 +413,18 @@ class dbal_mssqlnative extends dbal $row = @sqlsrv_fetch_array($query_id, SQLSRV_FETCH_ASSOC); - // I hope i am able to remove this later... hopefully only a PHP or MSSQL bug if ($row) { foreach ($row as $key => $value) { $row[$key] = ($value === ' ' || $value === NULL) ? '' : $value; } + + // remove helper values from LIMIT queries + if (isset($row['line2'])) + { + unset($row['line2'], $row['line3']); + } } return $row; } From 257e264af74e57b55238de18f1f97e0e5b7a299a Mon Sep 17 00:00:00 2001 From: rxu Date: Wed, 20 Oct 2010 00:25:31 +0800 Subject: [PATCH 360/393] [ticket/9478] Validate maximum number of allowed recipients per PM value. Do not allow to enter the value larger than it's allowed by MySQL mediumnt(8). PHPBB3-9478 --- phpBB/includes/acp/acp_groups.php | 9 +++++++++ phpBB/language/en/common.php | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index 60512c67b8..486616c33d 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -394,6 +394,15 @@ class acp_groups } } + // Validate the length of "Maximum number of allowed recipients per private message" setting. + // We use 16777215 as a maximum because it matches MySQL unsigned mediumint maximum value + // which is the lowest amongst DBMSes supported by phpBB3 + if ($max_recipients_error = validate_data($submit_ary, array('max_recipients' => array('num', false, 0, 16777215)))) + { + // Replace "error" string with its real, localised form + $error = array_merge($error, array_map(array(&$user, 'lang'), $max_recipients_error)); + } + if (!sizeof($error)) { // Only set the rank, colour, etc. if it's changed or if we're adding a new diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index bc38c1563d..e79e5a6de3 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -566,6 +566,9 @@ $lang = array_merge($lang, array( 'TEST_CONNECTION' => 'Test connection', 'THE_TEAM' => 'The team', 'TIME' => 'Time', + + 'TOO_LARGE' => 'The value you entered is too large.', + 'TOO_LARGE_MAX_RECIPIENTS' => 'The value of Maximum number of allowed recipients per private message setting you entered is too large.', 'TOO_LONG' => 'The value you entered is too long.', @@ -608,6 +611,9 @@ $lang = array_merge($lang, array( 'TOO_SHORT_EMAIL_CONFIRM' => 'The e-mail address confirmation you entered is too short.', 'TOO_SHORT_WEBSITE' => 'The website address you entered is too short.', 'TOO_SHORT_YIM' => 'The Yahoo! Messenger name you entered is too short.', + + 'TOO_SMALL' => 'The value you entered is too small.', + 'TOO_SMALL_MAX_RECIPIENTS' => 'The value of Maximum number of allowed recipients per private message setting you entered is too small.', 'TOPIC' => 'Topic', 'TOPICS' => 'Topics', From 01ef46a510c067d7699a3495ca533aee5f112ae4 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Tue, 20 Apr 2010 06:53:52 -0400 Subject: [PATCH 361/393] [ticket/9061] Fixed a race condition in queue locking. Changed queue locking to cover all queue file operations, in particular the check for queue file existince and inclusion of queue file must be done under one lock. Also refactored queue locking and unlocking into separate methods. PHPBB3-9061 --- phpBB/includes/functions_messenger.php | 81 ++++++++++++++++++++------ 1 file changed, 62 insertions(+), 19 deletions(-) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index 99883cd9ca..f22a77cf3c 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -631,6 +631,58 @@ class queue $this->data[$object]['data'][] = $scope; } + /** + * Obtains exclusive lock on queue cache file. + * Returns resource representing the lock + */ + function lock() + { + // For systems that can't have two processes opening + // one file for writing simultaneously + if (file_exists($this->cache_file . '.lock')) + { + $mode = 'rb'; + } + else + { + $mode = 'wb'; + } + $lock_fp = @fopen($this->cache_file . '.lock', $mode); + // Two processes may attempt to create lock file at the same time. + // Have the losing process try opening the lock file again for reading + // on the assumption that the winning process created it + if (!$lock_fp && $mode == 'wb') + { + // Assign to $mode for the check in chmod below + $mode = 'rb'; + $lock_fp = @fopen($this->cache_file . '.lock', $mode); + } + if ($lock_fp && $mode == 'wb') + { + // Only need to set mode when the lock file is written + @chmod($this->cache_file . '.lock', 0666); + } + if ($lock_fp) + { + @flock($lock_fp, LOCK_EX); + } + return $lock_fp; + } + + /** + * Releases lock on queue cache file, using resource obtained from lock() + */ + function unlock($lock_fp) + { + // lock() will return null if opening lock file, and thus locking, failed. + // Accept null values here so that client code does not need to check them + if ($lock_fp) + { + @flock($lock_fp, LOCK_UN); + fclose($lock_fp); + } + } + /** * Process queue * Using lock file @@ -639,24 +691,16 @@ class queue { global $db, $config, $phpEx, $phpbb_root_path, $user; + $lock_fp = $this->lock(); + set_config('last_queue_run', time(), true); - // Delete stale lock file - if (file_exists($this->cache_file . '.lock') && !file_exists($this->cache_file)) + if (!file_exists($this->cache_file) || filemtime($this->cache_file) > time() - $config['queue_interval']) { - @unlink($this->cache_file . '.lock'); + $this->unlock($lock_fp); return; } - if (!file_exists($this->cache_file) || (file_exists($this->cache_file . '.lock') && filemtime($this->cache_file) > time() - $config['queue_interval'])) - { - return; - } - - $fp = @fopen($this->cache_file . '.lock', 'wb'); - fclose($fp); - @chmod($this->cache_file . '.lock', 0777); - include($this->cache_file); foreach ($this->queue_data as $object => $data_ary) @@ -713,6 +757,7 @@ class queue break; default: + $this->unlock($lock_fp); return; } @@ -738,8 +783,6 @@ class queue if (!$result) { - @unlink($this->cache_file . '.lock'); - messenger::error('EMAIL', $err_msg); continue 2; } @@ -783,16 +826,14 @@ class queue { if ($fp = @fopen($this->cache_file, 'wb')) { - @flock($fp, LOCK_EX); fwrite($fp, "queue_data = unserialize(" . var_export(serialize($this->queue_data), true) . ");\n\n?>"); - @flock($fp, LOCK_UN); fclose($fp); phpbb_chmod($this->cache_file, CHMOD_READ | CHMOD_WRITE); } } - @unlink($this->cache_file . '.lock'); + $this->unlock($lock_fp); } /** @@ -805,6 +846,8 @@ class queue return; } + $lock_fp = $this->lock(); + if (file_exists($this->cache_file)) { include($this->cache_file); @@ -824,13 +867,13 @@ class queue if ($fp = @fopen($this->cache_file, 'w')) { - @flock($fp, LOCK_EX); fwrite($fp, "queue_data = unserialize(" . var_export(serialize($this->data), true) . ");\n\n?>"); - @flock($fp, LOCK_UN); fclose($fp); phpbb_chmod($this->cache_file, CHMOD_READ | CHMOD_WRITE); } + + $this->unlock($lock_fp); } } From 981970024701bd1e740056c595c959afd5a85ba0 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Thu, 9 Sep 2010 20:05:11 +0100 Subject: [PATCH 362/393] [ticket/9061] Simplify conditional statements by reworking the logic. PHPBB3-9061 --- phpBB/includes/functions_messenger.php | 30 +++++++++++++++----------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/phpBB/includes/functions_messenger.php b/phpBB/includes/functions_messenger.php index f22a77cf3c..227df95ac5 100644 --- a/phpBB/includes/functions_messenger.php +++ b/phpBB/includes/functions_messenger.php @@ -647,25 +647,31 @@ class queue { $mode = 'wb'; } + $lock_fp = @fopen($this->cache_file . '.lock', $mode); - // Two processes may attempt to create lock file at the same time. - // Have the losing process try opening the lock file again for reading - // on the assumption that the winning process created it - if (!$lock_fp && $mode == 'wb') + + if ($mode == 'wb') { - // Assign to $mode for the check in chmod below - $mode = 'rb'; - $lock_fp = @fopen($this->cache_file . '.lock', $mode); - } - if ($lock_fp && $mode == 'wb') - { - // Only need to set mode when the lock file is written - @chmod($this->cache_file . '.lock', 0666); + if (!$lock_fp) + { + // Two processes may attempt to create lock file at the same time. + // Have the losing process try opening the lock file again for reading + // on the assumption that the winning process created it + $mode = 'rb'; + $lock_fp = @fopen($this->cache_file . '.lock', $mode); + } + else + { + // Only need to set mode when the lock file is written + @chmod($this->cache_file . '.lock', 0666); + } } + if ($lock_fp) { @flock($lock_fp, LOCK_EX); } + return $lock_fp; } From a009614afb74d31cb790fcdddfbcbcf4ce20fab1 Mon Sep 17 00:00:00 2001 From: narqelion <> Date: Thu, 28 Oct 2010 22:25:10 +0200 Subject: [PATCH 363/393] [ticket/9835] subsilver2: Don't show "To prevent automated ..." when logging in This makes subsilver2 consistent with prosilver. PHPBB3-9835 --- phpBB/styles/subsilver2/template/captcha_default.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpBB/styles/subsilver2/template/captcha_default.html b/phpBB/styles/subsilver2/template/captcha_default.html index e0116ae42c..4c65f81643 100644 --- a/phpBB/styles/subsilver2/template/captcha_default.html +++ b/phpBB/styles/subsilver2/template/captcha_default.html @@ -1,9 +1,11 @@ {L_CONFIRM_CODE} + {L_CONFIRM_EXPLAIN} + {L_CONFIRM_CODE} From ec3dac0595ea1a6c7071f16fca9e3373bd4027d4 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sat, 30 Oct 2010 11:52:41 +0200 Subject: [PATCH 364/393] [ticket/9075] CPF Numbers fields: Prevent SQL error on registration page. When an administrator set a numbers field to default to 'not specified', a SQL error was caused on the registration page because it was tried to insert an empty string into an integer column. Because the column already supports NULL values, empty strings are now converted to NULL for custom profile fields of the type 'Numbers' before insertion into the data table. PHPBB3-9075 --- phpBB/includes/functions_profile_fields.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/phpBB/includes/functions_profile_fields.php b/phpBB/includes/functions_profile_fields.php index 3937cf9c21..78fe049f40 100644 --- a/phpBB/includes/functions_profile_fields.php +++ b/phpBB/includes/functions_profile_fields.php @@ -878,6 +878,11 @@ class custom_profile $now = getdate(); $row['field_default_value'] = sprintf('%2d-%2d-%4d', $now['mday'], $now['mon'], $now['year']); } + else if ($row['field_default_value'] === '' && $row['field_type'] == FIELD_INT) + { + // We cannot insert an empty string into an integer column. + $row['field_default_value'] = NULL; + } $cp_data['pf_' . $row['field_ident']] = (in_array($row['field_type'], array(FIELD_TEXT, FIELD_STRING))) ? $row['lang_default_value'] : $row['field_default_value']; } From 857271ebbd7568b6a38fe35b2947ec3a0124128b Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Tue, 2 Nov 2010 07:49:40 +0100 Subject: [PATCH 365/393] [ticket/9850] Display upgrade instructions for feature release in acp PHPBB3-9850 --- phpBB/adm/style/acp_update.html | 6 ++++++ phpBB/includes/acp/acp_update.php | 10 ++++++++++ phpBB/includes/functions_admin.php | 2 +- phpBB/language/en/install.php | 1 + 4 files changed, 18 insertions(+), 1 deletion(-) diff --git a/phpBB/adm/style/acp_update.html b/phpBB/adm/style/acp_update.html index 34d4f6934e..a87366a78b 100644 --- a/phpBB/adm/style/acp_update.html +++ b/phpBB/adm/style/acp_update.html @@ -18,6 +18,12 @@
            + +
            +

            {UPGRADE_INSTRUCTIONS}

            +
            + +
            diff --git a/phpBB/includes/acp/acp_update.php b/phpBB/includes/acp/acp_update.php index 3204e0204e..b0ce8f1084 100644 --- a/phpBB/includes/acp/acp_update.php +++ b/phpBB/includes/acp/acp_update.php @@ -51,6 +51,14 @@ class acp_update $announcement_url = (strpos($announcement_url, '&') === false) ? str_replace('&', '&', $announcement_url) : $announcement_url; $update_link = append_sid($phpbb_root_path . 'install/index.' . $phpEx, 'mode=update'); + // next feature release + $next_feature_version = $next_feature_announcement_url = false; + if (isset($info[2]) && trim($info[2]) !== '') + { + $next_feature_version = trim($info[2]); + $next_feature_announcement_url = trim($info[3]); + } + // Determine automatic update... $sql = 'SELECT config_value FROM ' . CONFIG_TABLE . " @@ -74,8 +82,10 @@ class acp_update 'LATEST_VERSION' => $latest_version, 'CURRENT_VERSION' => $config['version'], 'AUTO_VERSION' => $version_update_from, + 'NEXT_FEATURE_VERSION' => $next_feature_version, 'UPDATE_INSTRUCTIONS' => sprintf($user->lang['UPDATE_INSTRUCTIONS'], $announcement_url, $update_link), + 'UPGRADE_INSTRUCTIONS' => $next_feature_version ? $user->lang('UPGRADE_INSTRUCTIONS', $next_feature_version, $next_feature_announcement_url) : false, )); } } diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 3178d35c34..2aa12adb2e 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -3299,7 +3299,7 @@ function obtain_latest_version_info($force_update = false, $warn_fail = false, $ $errstr = ''; $errno = 0; - $info = get_remote_file('www.phpbb.com', '/updatecheck', + $info = get_remote_file('version.phpbb.com', '/phpbb', ((defined('PHPBB_QA')) ? '30x_qa.txt' : '30x.txt'), $errstr, $errno); if ($info === false) diff --git a/phpBB/language/en/install.php b/phpBB/language/en/install.php index 4e58de8d90..14923e836e 100644 --- a/phpBB/language/en/install.php +++ b/phpBB/language/en/install.php @@ -559,6 +559,7 @@ $lang = array_merge($lang, array( 'UPDATING_DATA' => 'Updating data', 'UPDATING_TO_LATEST_STABLE' => 'Updating database to latest stable release', 'UPDATED_VERSION' => 'Updated version', + 'UPGRADE_INSTRUCTIONS' => 'A new feature release %1$s is available. Please read the release announcement to learn about what it has to offer, and how to upgrade.', 'UPLOAD_METHOD' => 'Upload method', 'UPDATE_DB_SUCCESS' => 'Database update was successful.', From 3b7414fca8576213f074095ff14118f5be3f8d9d Mon Sep 17 00:00:00 2001 From: Adam Reyher Date: Wed, 15 Sep 2010 23:59:18 -0400 Subject: [PATCH 366/393] [ticket/9827] No longer emulate Internet Explorer 7 when using IE9. The IE9 beta fixes the IE8 textarea width bug which required IE7 emulation in phpBB's styles. Emulation should only occur when using IE8 now. PHPBB3-9827 --- phpBB/styles/prosilver/template/overall_header.html | 2 +- phpBB/styles/subsilver2/template/overall_header.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index 8f4ac19fb8..44857dbc41 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -11,7 +11,7 @@ - + {META} {SITENAME} • <!-- IF S_IN_MCP -->{L_MCP} • <!-- ELSEIF S_IN_UCP -->{L_UCP} • <!-- ENDIF -->{PAGE_TITLE} diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html index a8a53abd24..874beb8e2b 100644 --- a/phpBB/styles/subsilver2/template/overall_header.html +++ b/phpBB/styles/subsilver2/template/overall_header.html @@ -11,7 +11,7 @@ - + {META} {SITENAME} • <!-- IF S_IN_MCP -->{L_MCP} • <!-- ELSEIF S_IN_UCP -->{L_UCP} • <!-- ENDIF -->{PAGE_TITLE} From 2299c401378f4dc424aa512a3b4f22bc1c6c513a Mon Sep 17 00:00:00 2001 From: narqelion <> Date: Sun, 7 Nov 2010 00:13:01 +0100 Subject: [PATCH 367/393] [ticket/9879] Spelling, punctuation and grammar update for the Q&A CAPTCHA. Fixed spelling, punctuation and grammar as well as removed registration specific language from plugin as it can be/is used for form submissions other than registration. PHPBB3-9879 --- phpBB/language/en/captcha_qa.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/phpBB/language/en/captcha_qa.php b/phpBB/language/en/captcha_qa.php index 5cd822b3c4..20bed34158 100644 --- a/phpBB/language/en/captcha_qa.php +++ b/phpBB/language/en/captcha_qa.php @@ -37,8 +37,8 @@ if (empty($lang) || !is_array($lang)) $lang = array_merge($lang, array( 'CAPTCHA_QA' => 'Q&A CAPTCHA', - 'CONFIRM_QUESTION_EXPLAIN' => 'This question is a means of identifying and preventing automated submissions.', - 'CONFIRM_QUESTION_WRONG' => 'You have provided an invalid answer to the confirmation question.', + 'CONFIRM_QUESTION_EXPLAIN' => 'This question is a means of preventing automated form submissions by spambots.', + 'CONFIRM_QUESTION_WRONG' => 'You have provided an invalid answer to the question.', 'QUESTION_ANSWERS' => 'Answers', 'ANSWERS_EXPLAIN' => 'Please enter valid answers to the question, one per line.', @@ -47,15 +47,15 @@ $lang = array_merge($lang, array( 'ANSWER' => 'Answer', 'EDIT_QUESTION' => 'Edit Question', 'QUESTIONS' => 'Questions', - 'QUESTIONS_EXPLAIN' => 'During registration, users will be asked one of the questions specified here. To use this plugin, at least one question must be set in the default language. These questions should be easy for your target audience to answer, but beyond the ability of a bot capable of running a Google™ search. Using a large and regulary changed set of questions will yield the best results. Enable the strict setting if your question relies on punctuation or capitalisation.', + 'QUESTIONS_EXPLAIN' => 'For every form submission where you have enabled the Q & A CAPTCHA, users will be asked one of the questions specified here. To use this plugin at least one question must be set in the default language. These questions should be easy for your target audience to answer but beyond the ability of a bot capable of running a Google™ search. Using a large and regularly changed set of questions will yield the best results. Enable the strict setting if your question relies on mixed case, punctuation or whitespace.', 'QUESTION_DELETED' => 'Question deleted', 'QUESTION_LANG' => 'Language', - 'QUESTION_LANG_EXPLAIN' => 'The language that this question and its answers are written in.', + 'QUESTION_LANG_EXPLAIN' => 'The language this question and its answers are written in.', 'QUESTION_STRICT' => 'Strict check', - 'QUESTION_STRICT_EXPLAIN' => 'If enabled, capitalisation and whitespace will also be enforced.', + 'QUESTION_STRICT_EXPLAIN' => 'Enable to enforce mixed case, punctuation and whitespace.', 'QUESTION_TEXT' => 'Question', - 'QUESTION_TEXT_EXPLAIN' => 'The question that will be asked on registration.', + 'QUESTION_TEXT_EXPLAIN' => 'The question presented to the user.', 'QA_ERROR_MSG' => 'Please fill in all fields and enter at least one answer.', 'QA_LAST_QUESTION' => 'You cannot delete all questions while the plugin is active.', From 5d9a9d68744e083997dea9ea9773b98241109b79 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Sun, 7 Nov 2010 00:35:11 +0100 Subject: [PATCH 368/393] [ticket/9879] Fix markup and use Q&A instead of Q & A for consistency. PHPBB3-9879 --- phpBB/language/en/captcha_qa.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/language/en/captcha_qa.php b/phpBB/language/en/captcha_qa.php index 20bed34158..f503a1ac40 100644 --- a/phpBB/language/en/captcha_qa.php +++ b/phpBB/language/en/captcha_qa.php @@ -47,7 +47,7 @@ $lang = array_merge($lang, array( 'ANSWER' => 'Answer', 'EDIT_QUESTION' => 'Edit Question', 'QUESTIONS' => 'Questions', - 'QUESTIONS_EXPLAIN' => 'For every form submission where you have enabled the Q & A CAPTCHA, users will be asked one of the questions specified here. To use this plugin at least one question must be set in the default language. These questions should be easy for your target audience to answer but beyond the ability of a bot capable of running a Google™ search. Using a large and regularly changed set of questions will yield the best results. Enable the strict setting if your question relies on mixed case, punctuation or whitespace.', + 'QUESTIONS_EXPLAIN' => 'For every form submission where you have enabled the Q&A CAPTCHA, users will be asked one of the questions specified here. To use this plugin at least one question must be set in the default language. These questions should be easy for your target audience to answer but beyond the ability of a bot capable of running a Google™ search. Using a large and regularly changed set of questions will yield the best results. Enable the strict setting if your question relies on mixed case, punctuation or whitespace.', 'QUESTION_DELETED' => 'Question deleted', 'QUESTION_LANG' => 'Language', 'QUESTION_LANG_EXPLAIN' => 'The language this question and its answers are written in.', From e1aff2841bba09651c68ce02e6db8ecbcc010652 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 7 Nov 2010 02:06:53 +0100 Subject: [PATCH 369/393] [task/phing-build] Automatically trigger build_diff The build_diff script generates MOD format change descriptions for language and style files. It is automatically triggered by phin with the correct version numbers now so it does not need to be changed anymore. PHPBB3-9849 --- build/build.xml | 9 +++++++-- build/build_diff.php | 31 +++++++++++++++++++------------ 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/build/build.xml b/build/build.xml index 9517c33a8e..04dca6cafa 100644 --- a/build/build.xml +++ b/build/build.xml @@ -3,9 +3,11 @@ - + + + @@ -25,6 +27,7 @@ + @@ -36,6 +39,7 @@ + @@ -104,7 +108,8 @@ - + + - + diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 36dc3d037c..877c0e32ec 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -53,7 +53,7 @@
            1. Changelog
                -
              1. Changes since 3.0.7-PL1
              2. +
              3. Changes since 3.0.7-PL1
              4. Changes since 3.0.7
              5. Changes since 3.0.6
              6. Changes since 3.0.5
              7. @@ -89,42 +89,445 @@
                -

                1.i. Changes since 3.0.7-PL1

                +

                1.i. Changes since 3.0.7-PL1

                -
                  -
                • [Fix] Correctly sort database backup file list by date on database restore page. (Bug #57385)
                • -
                • [Fix] Take admin's time zone settings into account when listing database backup files. (Bug #57385)
                • -
                • [Fix] Honor minimum and maximum password length in generated passwords as much as we can. (Bug #13181)
                • -
                • [Fix] No longer return the character O in generated random strings and passwords. (Bug #57345)
                • -
                • [Fix] Allow redirect() function to redirect across directories. (Bug #56965)
                • -
                • [Fix] Add terminating semicolons to JavaScript code. (Bug #58085 - Patch by nn-)
                • -
                • [Fix] Minor language fixes. (Bug #54855)
                • -
                • [Fix] Parsing urls in signatures properly uses config settings. (Bug #57105)
                • -
                • [Fix] Allow multibyte keys in request_var(). (Bug #51555)
                • -
                • [Fix] Fix inclusion check for captcha garbage collection (Bug #59425)
                • -
                • [Fix] Prevent wrong tar archive type detection. (Bug #12531)
                • -
                • [Fix] Correct redirection after login to forum not in web root (Bug #58755)
                • -
                • [Fix] Allow setting parent forums regardless of permission settings. (Bug #57415)
                • -
                • [Fix] Redirect search engines that access pages with SIDs in the URL. (Bug #58025)
                • -
                • [Fix] Fix incorrect ampersand encoding in redirect parameter. (Bug #58465)
                • -
                • [Fix] Fix open_basedir issues when accessing styles- and language-management. (Bug #59135)
                • -
                • [Fix] Fix table binding issues with PostgreSQL in board-wide feed. (Bug #58425)
                • -
                • [Fix] Only show unapproved posts in ATOM Feeds for moderators (Bug #58695)
                • -
                • [Fix] Various XHTML mistakes in ACP (Bug #58745)
                • -
                • [Fix] Fix dead link in MCP on reports for global announcements in prosilver. (Bug #9512)
                • -
                • [Fix] Fix broken links for reports on active topics, when the topic is in a subforum. (Bug #9047)
                • -
                • [Feature] Support for Microsoft's Native SQL Server Driver for PHP (Bug #57055 - Patch by Chris Pucci at Microsoft)
                • -
                • [Feature] The memcache acm plugin now supports multiple memcache servers.
                • -
                • [Feature] Show note for moderators on unapproved posts/topics with unapproved posts in ATOM Feed (Bug #9511)
                • -
                +

                Bug +

                +
                  +
                • [PHPBB3-4923] - compress_tar incorrectly determines type +
                • +
                • [PHPBB3-5164] - Honor minimum and maximum password length in generated passwords as much as possible. +
                • +
                • [PHPBB3-6726] - Connecting to PostgreSQL using 'localhost' doesn't try to use a TCP connection +
                • +
                • [PHPBB3-6747] - word censoring * does not handle space for two or more words +
                • +
                • [PHPBB3-7260] - Do not delete polls if one exists and editing user lacks permissions +
                • +
                • [PHPBB3-7296] - Style export to tar(.*) does not work +
                • +
                • [PHPBB3-7369] - Custom Profile dates display incorrectly +
                • +
                • [PHPBB3-7417] - Search keywords field does not initially get focus +
                • +
                • [PHPBB3-7538] - Query exceeds maximum value for user_login_attempts +
                • +
                • [PHPBB3-7716] - Data too long for column 'message_subject' +
                • +
                • [PHPBB3-7717] - Use user's language for standard-extensions-group name +
                • +
                • [PHPBB3-7720] - Fix alternative image-description for unread posts. +
                • +
                • [PHPBB3-7782] - Send HTTP 404 if topic, forum or user do not exist +
                • +
                • [PHPBB3-7972] - Copied topics are not indexed +
                • +
                • [PHPBB3-8169] - Parse CSS Regex accepts invalid code +
                • +
                • [PHPBB3-8792] - Misleading error message in auth_ldap.php, function init_ldap() +
                • +
                • [PHPBB3-8894] - JavaScript error and visible quote button on topic review if BBCodes disallowed +
                • +
                • [PHPBB3-8924] - spelling in admin_welcome_inactive.txt +
                • +
                • [PHPBB3-8929] - MS SQL error on view all smilies after 3.0.6 upgrade +
                • +
                • [PHPBB3-8935] - able to set minimal avatar size larger than maximum +
                • +
                • [PHPBB3-8944] - Error on database update (must specify size of index on MySQL4) +
                • +
                • [PHPBB3-9012] - Retain original topic title in shadow topic when moving a topic and editing the title. +
                • +
                • [PHPBB3-9034] - Redirect() fails with directory traversal +
                • +
                • [PHPBB3-9047] - Active topics and reported posts +
                • +
                • [PHPBB3-9049] - Password reminder system generates confusable passwords +
                • +
                • [PHPBB3-9053] - Correctly sort database backup file list by date on database restore page +
                • +
                • [PHPBB3-9061] - Race condition in queue locking +
                • +
                • [PHPBB3-9068] - Grammatical Error under Load Settings +
                • +
                • [PHPBB3-9075] - Missing / bad default values of CPFs result in SQL errors on registration of new users +
                • +
                • [PHPBB3-9091] - Wrong IP checking for IPv4 addresses mapped into IPv6 +
                • +
                • [PHPBB3-9094] - Hide "Copy permissions" message, when permissions were copied. +
                • +
                • [PHPBB3-9095] - Misleading setting text for CAPTCHA +
                • +
                • [PHPBB3-9099] - Missing comma in PASSWORD_EXPLAIN acp language strings +
                • +
                • [PHPBB3-9101] - Bad text placement for reCAPTCHA description +
                • +
                • [PHPBB3-9104] - Safari does not display box headers correctly in the ACP. +
                • +
                • [PHPBB3-9107] - Can't Set Parent Forum +
                • +
                • [PHPBB3-9108] - RSS feeds does not work on Postgres +
                • +
                • [PHPBB3-9112] - Most active forum post count does not respect m_approve permission +
                • +
                • [PHPBB3-9114] - Recent bug fix for smilies causing problems on older MySQL versions +
                • +
                • [PHPBB3-9117] - Wrong redirection after login +
                • +
                • [PHPBB3-9119] - Language selection is disregarded in automatic update +
                • +
                • [PHPBB3-9120] - Typo fix in a comment in functions.php +
                • +
                • [PHPBB3-9121] - Forum feed shows posts that are currently on the moderation queue +
                • +
                • [PHPBB3-9125] - ACP User Overview: Unmatched </form> tag when viewing own user +
                • +
                • [PHPBB3-9126] - Invalid redirection after login to forum not in web root +
                • +
                • [PHPBB3-9132] - Oracle CLOB support is broken, preventing storage of long strings +
                • +
                • [PHPBB3-9135] - Fix report-icon for moderators in PM folders. +
                • +
                • [PHPBB3-9140] - Check current board version in incremental update packages +
                • +
                • [PHPBB3-9145] - Fix open_basedir issues when accessing styles- and language-management +
                • +
                • [PHPBB3-9146] - Quick-Reply tabindex="6" set twice +
                • +
                • [PHPBB3-9147] - "Change topic type"-option "Normal" always selected. +
                • +
                • [PHPBB3-9154] - Correctly check for double inclusion in captcha garbage collection +
                • +
                • [PHPBB3-9158] - viewforum/viewtopic pages unnecessarily duplicated with start=0 +
                • +
                • [PHPBB3-9162] - BBCode in poll options is broken, when posting without question. +
                • +
                • [PHPBB3-9167] - Remove shadow topics from remaining forums when deleting a forum including posts +
                • +
                • [PHPBB3-9170] - Unable to get image size in img bbcode when URL has multiple parameters. +
                • +
                • [PHPBB3-9173] - sql_config_count() artificially limits number scope to 4byte-integer on PostgreSQL and Firebird +
                • +
                • [PHPBB3-9176] - When setting the board's date format the board's timezone settings aren't taken into account +
                • +
                • [PHPBB3-9451] - Unnecessary overhead in avatar_process_user function +
                • +
                • [PHPBB3-9478] - Validate maximum number of allowed recipients per PM value +
                • +
                • [PHPBB3-9495] - Loginbox <input /> redirect breaks xHTML +
                • +
                • [PHPBB3-9499] - Javascript function dE does not correctly detect element visibility +
                • +
                • [PHPBB3-9504] - Allow gallery avatars with whitespaces in the filename +
                • +
                • [PHPBB3-9509] - phpBB Coding Guidelines state subversion as the version control system for phpBB +
                • +
                • [PHPBB3-9510] - Unable to copy permissions from and to forums you cannot see +
                • +
                • [PHPBB3-9512] - Fix dead link in MCP on reports for global announcements in prosilver. +
                • +
                • [PHPBB3-9514] - Correctly delete big datasets when deleting a forum including topics/posts on non-MySQL databases +
                • +
                • [PHPBB3-9518] - Postgres DBAL does not correctly create a new database connection when passing $new_link as true +
                • +
                • [PHPBB3-9519] - Replace remaining is_writable() calls with phpbb_is_writable(). +
                • +
                • [PHPBB3-9521] - MSSQL error reporting returns String instead of an error +
                • +
                • [PHPBB3-9524] - IPv6 regular expression does not match addresses starting in :: +
                • +
                • [PHPBB3-9526] - User Preference to hide online status does not work for bots +
                • +
                • [PHPBB3-9528] - Quoting in a PM does not fall back to bbcode-less quotes using "> " when bbcodes are disabled +
                • +
                • [PHPBB3-9529] - Topic review does not display all selected posts +
                • +
                • [PHPBB3-9530] - subsilver2 missing fallback option on quoting when bbcodes are disabled +
                • +
                • [PHPBB3-9531] - BBCode-less fall back option for quotes is missing "Author wrote:" line when quoting from topic-review. +
                • +
                • [PHPBB3-9535] - Incorrect margins in RTL languages: signatures, permission ACP & updater +
                • +
                • [PHPBB3-9545] - 'Your first forum' should have 'Display active topics:' set to 'Yes' +
                • +
                • [PHPBB3-9546] - Moving all posts from one topic to another does not delete bookmarks +
                • +
                • [PHPBB3-9547] - Changing forum type applies FORUM_FLAG_ACTIVE_TOPICS to new forum type. +
                • +
                • [PHPBB3-9548] - Delete user quicktool drop down should have an empty or invalid selection as the default +
                • +
                • [PHPBB3-9559] - Messenger Queue Batch Size configuration option is overridden +
                • +
                • [PHPBB3-9567] - Newly registered users group ACP wording +
                • +
                • [PHPBB3-9582] - Missing MSSQL native driver case statements +
                • +
                • [PHPBB3-9587] - Prosilver overrides reCaptcha class. +
                • +
                • [PHPBB3-9592] - Test suite does not run on SQLite +
                • +
                • [PHPBB3-9593] - Missing documentation for running unit tests +
                • +
                • [PHPBB3-9599] - Windows workaround for checkdnsrr() returns wrong results +
                • +
                • [PHPBB3-9605] - Wrong class added to topiclist, when there's no announcement topic. +
                • +
                • [PHPBB3-9615] - When attaching a file whose name contains quotes, filename before last quote is cut off in display +
                • +
                • [PHPBB3-9623] - Strings not properly normalized - acp_prune.php +
                • +
                • [PHPBB3-9626] - Regular expressions from get_preg_expression() are untested. +
                • +
                • [PHPBB3-9628] - Add module function does not correctly insert a module after the specified one +
                • +
                • [PHPBB3-9633] - Newly registered users group color is not used in Our Newest Member +
                • +
                • [PHPBB3-9635] - Useless parameter $data['post_time'] in function submit_post. +
                • +
                • [PHPBB3-9637] - SET NAMES 'BINARY' error in convertor +
                • +
                • [PHPBB3-9643] - DB connection error when $dbhost is an IPv6 address +
                • +
                • [PHPBB3-9644] - submit_post shows support for options that cause a trigger_error in the call to user_notification +
                • +
                • [PHPBB3-9646] - Cant hide/outcomment @import in stylesheet.css +
                • +
                • [PHPBB3-9650] - It should not be possible to ban Anonymous +
                • +
                • [PHPBB3-9653] - xhtml errors in subsilver2 when using the bbcodes code and quote in signatures +
                • +
                • [PHPBB3-9655] - Selecting an unavailable captcha plugin looks like a successful action +
                • +
                • [PHPBB3-9656] - PHP Information in ACP always lists error_reporting as 0 +
                • +
                • [PHPBB3-9658] - Optimize topic splitting +
                • +
                • [PHPBB3-9662] - Search interval applied inconsistently +
                • +
                • [PHPBB3-9664] - Another duplicate accesskey: t = top and list item +
                • +
                • [PHPBB3-9665] - Signature "0" cannot be previewed +
                • +
                • [PHPBB3-9677] - Subsilver2 is missing the bbcode-helpline for inline-attachments. +
                • +
                • [PHPBB3-9678] - Flash attachments are not displayed in subsilver2. +
                • +
                • [PHPBB3-9679] - "Notify User" checkbox appears in MCP Queue even if no notification methods are enabled +
                • +
                • [PHPBB3-9686] - Unable to create data backup using the mssqlnative DBAL +
                • +
                • [PHPBB3-9694] - Calling download/file.php with empty avatar parameter can throw an E_NOTICE message +
                • +
                • [PHPBB3-9695] - Bad Display of User Input - mcp_ban +
                • +
                • [PHPBB3-9696] - Installation of phpBB with SQLite fails +
                • +
                • [PHPBB3-9697] - Backlink broken when the select parent forum does not exist. +
                • +
                • [PHPBB3-9698] - Returning result of new by reference is deprecated in php 5.3 +
                • +
                • [PHPBB3-9702] - "Ban until (date)" appears to be based on UTC time instead of local time +
                • +
                • [PHPBB3-9703] - Removing a user does not remove their private message folders or rules +
                • +
                • [PHPBB3-9704] - Coding guidelines typo +
                • +
                • [PHPBB3-9712] - Future dates display as "less than one minute ago" +
                • +
                • [PHPBB3-9714] - "Undefined variable: email" in email regular expression unit tests +
                • +
                • [PHPBB3-9715] - Fix email address regular expression or adjust email regular expression unit tests +
                • +
                • [PHPBB3-9722] - "New Topic" button title attribute mismatch in prosilver's viewforum +
                • +
                • [PHPBB3-9727] - Feed replaces ./ with board URL +
                • +
                • [PHPBB3-9743] - Fix background-position of top2-class in prosilver for RTL-languages. +
                • +
                • [PHPBB3-9744] - Mistyped word 'then' in FAQ. It should be 'than'. +
                • +
                • [PHPBB3-9748] - <br /> not being replaced in prepare_message +
                • +
                • [PHPBB3-9749] - fulltext_mysql.php overreacts on + and - characters in search words +
                • +
                • [PHPBB3-9752] - Misleading text when using Q&A CAPTCHA +
                • +
                • [PHPBB3-9754] - Template variable S_USER_POSTED always set to false in search.php +
                • +
                • [PHPBB3-9757] - Empty template variable HISTORY_TITLE in ucp_pm_history +
                • +
                • [PHPBB3-9760] - Fulltext native search, wildcard * does not get escaped leading to long execution time +
                • +
                • [PHPBB3-9761] - Quote nesting depth explanation is misleading +
                • +
                • [PHPBB3-9771] - build_url() doesn't ignore empty parameters +
                • +
                • [PHPBB3-9772] - Under some circumstances, email addresses are shown to undesired users +
                • +
                • [PHPBB3-9780] - gen_rand_string() not respecting $num_chars parameter anymore. +
                • +
                • [PHPBB3-9782] - Board disable radio in Board-Settings set on when server load high +
                • +
                • [PHPBB3-9793] - Undefined function send_status_line() in download/file.php when in avatar mode. +
                • +
                • [PHPBB3-9807] - Avatar tab displays when avatars are disabled +
                • +
                • [PHPBB3-9810] - Clicking on "Select All" of code tag on print page results in a javascript error when using prosilver +
                • +
                • [PHPBB3-9820] - Fix undefined indexes when trying to post a new topic +
                • +
                • [PHPBB3-9822] - Can not delete style-components from the file-system as per explanation. +
                • +
                • [PHPBB3-9829] - Recaptcha plugin result interpretation fault +
                • +
                • [PHPBB3-9835] - Login Confirm Explain Not Working +
                • +
                • [PHPBB3-9840] - Display view unread posts link for guests +
                • +
                • [PHPBB3-9841] - Change "Save" button to "Save draft" +
                • +
                • [PHPBB3-9854] - Auth API documentation is incomplete +
                • +
                • [PHPBB3-9855] - Tests don't run on PHPUnit 3.5 +
                • +
                • [PHPBB3-9879] - captcha_qa.php spelling, punctuation and grammar errors +
                • +
                -

                1.i. Changes since 3.0.7

                +

                Improvement +

                +
                  +
                • [PHPBB3-7332] - MCP post details usability +
                • +
                • [PHPBB3-8709] - Multibyte keys in request_var not possible +
                • +
                • [PHPBB3-8936] - subsilver2 missing reply-to-all feature +
                • +
                • [PHPBB3-9088] - Add missing semicolons in js files +
                • +
                • [PHPBB3-9179] - improve quasi-documentation of notify_status values +
                • +
                • [PHPBB3-9503] - Posts with empty titles in moderation queue are not easily approved +
                • +
                • [PHPBB3-9534] - user_ipwhois() does not support IPv6 addresses +
                • +
                • [PHPBB3-9536] - Small improvement for query against sessions table in acp_users.php +
                • +
                • [PHPBB3-9553] - Make git hooks run with /bin/sh instead of bash +
                • +
                • [PHPBB3-9570] - Change "system timezone" to "guest timezone" in acp, add explanation +
                • +
                • [PHPBB3-9578] - ACP Posting tab is missing "Post settings" module. +
                • +
                • [PHPBB3-9589] - Sample nginx configuration file +
                • +
                • [PHPBB3-9595] - Search settings in ACP: Add information on minimum word size indexed when using Fulltext MySQL backend +
                • +
                • [PHPBB3-9598] - Call checkdnsrr() on Windows with PHP 5.3 +
                • +
                • [PHPBB3-9609] - Use send_status_line instead of calling header +
                • +
                • [PHPBB3-9611] - Increase entropy in activation keys +
                • +
                • [PHPBB3-9612] - Split gen_rand_string() into gen_rand_string() and gen_rand_string_friendly() +
                • +
                • [PHPBB3-9629] - sid parameter forced for style.php makes caching difficult +
                • +
                • [PHPBB3-9659] - Default phpBB signature user_options need to be set for convertors +
                • +
                • [PHPBB3-9690] - MSN Bot will become Bing Bot +
                • +
                • [PHPBB3-9777] - Print useful error message in pre-commit hook when php is not installed. +
                • +
                • [PHPBB3-9785] - Not able to recover a password when board disabled +
                • +
                • [PHPBB3-9825] - Run tests on sqlite if available and no test db configured +
                • +
                • [PHPBB3-9827] - IE9 Beta fixes IE8 textarea bug +
                • +
                • [PHPBB3-9830] - Awkward message when config.php is missing +
                • +
                • [PHPBB3-9850] - Allow version checker to display information on multiple releases +
                • +
                • [PHPBB3-9853] - Change default reCAPTCHA theme in Prosilver & Subsilver2 to better coordinate with style color scheme +
                • +
                • [PHPBB3-9880] - Rename all mentions of CAPTCHA or visual confirmation to anti-bot +
                • +
                + +

                New Feature +

                +
                  +
                • [PHPBB3-9039] - Native SQL Server Support mssqlnative.php +
                • +
                • [PHPBB3-9511] - View note for moderators on unapproved posts/topics with unapproved posts in ATOM Feed. +
                • +
                + +

                Task +

                +
                  +
                • [PHPBB3-9520] - Add web.config files for IIS +
                • +
                • [PHPBB3-9625] - Update database UNIT-test +
                • +
                • [PHPBB3-9701] - Enable notices in unit tests +
                • +
                • [PHPBB3-9768] - Create git commit-msg hook that verifies the commit message conforms to our standards +
                • +
                • [PHPBB3-9769] - Add install and uninstall scripts for the git hooks +
                • +
                • [PHPBB3-9770] - Git commit message should be prefilled with branch and ticket information +
                • +
                • [PHPBB3-9800] - Update tracker URL in docs/README.html +
                • +
                • [PHPBB3-9804] - Update docs/AUTHORS (DavidMJ & igorw) +
                • +
                • [PHPBB3-9808] - Git commit message hook depends on GNU wc +
                • +
                • [PHPBB3-9816] - Remove config.php from git repository +
                • +
                • [PHPBB3-9848] - Add phpBB data files to .gitignore. +
                • +
                • [PHPBB3-9849] - Create build script using phing +
                • +
                • [PHPBB3-9857] - Remove visible $Id$ from docs files. +
                • +
                • [PHPBB3-9868] - Make the test suite run and pass using the mssqlnative driver +
                • +
                + +

                Sub-task +

                +
                  +
                • [PHPBB3-9517] - Remote avatar upload does not check the filesize before and during transfer. +
                • +
                • [PHPBB3-9562] - Advanced Search is inaccessible using the mssqlnative DBAL +
                • +
                • [PHPBB3-9564] - Reported messages are not assigned the default report reason when a reason is removed from the ACP using the mssqlnative DBAL +
                • +
                • [PHPBB3-9565] - It is impossible to create a custom profile field using the mssqlnative DBAL +
                • +
                • [PHPBB3-9566] - Two debug notices are displayed when setting a custom profile field though the UCP using the mssqlnative DBAL +
                • +
                • [PHPBB3-9583] - MSSQL native backups cannot be restored +
                • +
                • [PHPBB3-9606] - Drop redundant SQL query for unreads fetching +
                • +
                • [PHPBB3-9613] - Implement a load switch for unreads search feature. +
                • +
                • [PHPBB3-9817] - Make build script create blank config.php +
                • +
                + + +

                1.ii. Changes since 3.0.7

                • [Sec] Do not expose forum content of forums with ACL entries but no actual permission in ATOM Feeds. (Bug #58595)
                -

                1.ii. Changes since 3.0.6

                +

                1.iii. Changes since 3.0.6

                • [Fix] Allow ban reason and length to be selected and copied in ACP and subsilver2 MCP. (Bug #51095)
                • @@ -228,7 +631,7 @@
                -

                1.iii. Changes since 3.0.5

                +

                1.iv. Changes since 3.0.5

                • [Fix] Allow whitespaces in avatar gallery names. (Bug #44955)
                • @@ -450,7 +853,7 @@
                • [Feature] Send anonymous statistical information to phpBB on installation and update (optional).
                -

                1.iv. Changes since 3.0.4

                +

                1.v. Changes since 3.0.4

                • [Fix] Delete user entry from ban list table upon user deletion (Bug #40015 - Patch by TerraFrost)
                • @@ -539,7 +942,7 @@
                • [Sec] Only use forum id supplied for posting if global announcement detected. (Reported by nickvergessen)
                -

                1.v. Changes since 3.0.3

                +

                1.vi. Changes since 3.0.3

                • [Fix] Allow mixed-case template directories to be inherited (Bug #36725)
                • @@ -571,7 +974,7 @@
                • [Sec] Ask for forum password if post within passworded forum quoted in private message. (Reported by nickvergessen)
                -

                1.vi. Changes since 3.0.2

                +

                1.vii. Changes since 3.0.2

                • [Fix] Correctly set topic starter if first post in topic removed (Bug #30575 - Patch by blueray2048)
                • @@ -670,7 +1073,7 @@
                • [Sec Precaution] Stricter validation of the HTTP_HOST header (Thanks to Techie-Micheal et al for pointing out possible issues in derived code)
                -

                1.vii. Changes since 3.0.1

                +

                1.viii. Changes since 3.0.1

                • [Fix] Ability to set permissions on non-mysql dbms (Bug #24955)
                • @@ -718,7 +1121,7 @@
                • [Sec] Only allow urls gone through redirect() being used within login_box(). (thanks nookieman)
                -

                1.viii Changes since 3.0.0

                +

                1.ix Changes since 3.0.0

                • [Change] Validate birthdays (Bug #15004)
                • @@ -789,7 +1192,7 @@
                • [Fix] Find and display colliding usernames correctly when converting from one database to another (Bug #23925)
                -

                1.ix. Changes since 3.0.RC8

                +

                1.x. Changes since 3.0.RC8

                • [Fix] Cleaned usernames contain only single spaces, so "a_name" and "a__name" are treated as the same name (Bug #15634)
                • @@ -798,7 +1201,7 @@
                • [Fix] Call garbage_collection() within database updater to correctly close connections (affects Oracle for example)
                -

                1.x. Changes since 3.0.RC7

                +

                1.xi. Changes since 3.0.RC7

                • [Fix] Fixed MSSQL related bug in the update system
                • @@ -833,7 +1236,7 @@
                • [Fix] No duplication of active topics (Bug #15474)
                -

                1.xi. Changes since 3.0.RC6

                +

                1.xii. Changes since 3.0.RC6

                • [Fix] Submitting language changes using acp_language (Bug #14736)
                • @@ -843,7 +1246,7 @@
                • [Fix] Able to request new password (Bug #14743)
                -

                1.xii. Changes since 3.0.RC5

                +

                1.xiii. Changes since 3.0.RC5

                • [Feature] Removing constant PHPBB_EMBEDDED in favor of using an exit_handler(); the constant was meant to achive this more or less.
                • @@ -906,7 +1309,7 @@
                • [Sec] New password hashing mechanism for storing passwords (#i42)
                -

                1.xiii. Changes since 3.0.RC4

                +

                1.xiv. Changes since 3.0.RC4

                • [Fix] MySQL, PostgreSQL and SQLite related database fixes (Bug #13862)
                • @@ -957,7 +1360,7 @@
                • [Fix] odbc_autocommit causing existing result sets to be dropped (Bug #14182)
                -

                1.xiv. Changes since 3.0.RC3

                +

                1.xv. Changes since 3.0.RC3

                • [Fix] Fixing some subsilver2 and prosilver style issues
                • @@ -1066,7 +1469,7 @@
                -

                1.xv. Changes since 3.0.RC2

                +

                1.xvi. Changes since 3.0.RC2

                • [Fix] Re-allow searching within the memberlist
                • @@ -1112,7 +1515,7 @@
                -

                1.xvi. Changes since 3.0.RC1

                +

                1.xvii. Changes since 3.0.RC1

                • [Fix] (X)HTML issues within the templates (Bug #11255, #11255)
                • diff --git a/phpBB/docs/INSTALL.html b/phpBB/docs/INSTALL.html index 982c28571e..5857163759 100644 --- a/phpBB/docs/INSTALL.html +++ b/phpBB/docs/INSTALL.html @@ -273,7 +273,7 @@

                  This package is meant for those wanting to only replace changed files from a previous version to the latest version. This package normally contains the changed files from up to five previous versions.

                  -

                  This package contains a number of archives, each contains the files changed from a given release to the latest version. You should select the appropriate archive for your current version, e.g. if you currently have 3.0.6 you should select the phpBB-3.0.6_to_3.0.7-PL1.zip/tar.gz file.

                  +

                  This package contains a number of archives, each contains the files changed from a given release to the latest version. You should select the appropriate archive for your current version, e.g. if you currently have 3.0.7-PL1 you should select the phpBB-3.0.7-PL1_to_3.0.8.zip/tar.gz file.

                  The directory structure has been preserved enabling you (if you wish) to simply upload the contents of the archive to the appropriate location on your server, i.e. simply overwrite the existing files with the new versions. Do not forget that if you have installed any MODs these files will overwrite the originals possibly destroying them in the process. You will need to re-add MODs to any affected file before uploading.

                  @@ -285,7 +285,7 @@

                  The patch file is one solution for those with many Modifications (MODs) or other changes who do not want to re-add them back to all the changed files if they use the method explained above. To use this you will need command line access to a standard UNIX type patch application. If you do not have access to such an application but still want to use this update approach, we strongly recommend the Automatic update package explained below. It is also the recommended update method.

                  -

                  A number of patch files are provided to allow you to update from previous stable releases. Select the correct patch, e.g. if your current version is 3.0.5 you need the phpBB-3.0.6_to_3.0.7-PL1.patch file. Place the correct patch in the parent directory containing the phpBB3 core files (i.e. index.php, viewforum.php, etc.). With this done you should run the following command: patch -cl -d [PHPBB DIRECTORY] -p1 < [PATCH NAME] (where PHPBB DIRECTORY is the directory name your phpBB Installation resides in, for example phpBB3, and where PATCH NAME is the relevant filename of the selected patch file). This should complete quickly, hopefully without any HUNK FAILED comments.

                  +

                  A number of patch files are provided to allow you to update from previous stable releases. Select the correct patch, e.g. if your current version is 3.0.5 you need the phpBB-3.0.7-PL1_to_3.0.8.patch file. Place the correct patch in the parent directory containing the phpBB3 core files (i.e. index.php, viewforum.php, etc.). With this done you should run the following command: patch -cl -d [PHPBB DIRECTORY] -p1 < [PATCH NAME] (where PHPBB DIRECTORY is the directory name your phpBB Installation resides in, for example phpBB3, and where PATCH NAME is the relevant filename of the selected patch file). This should complete quickly, hopefully without any HUNK FAILED comments.

                  If you do get failures you should look at using the Changed files only package to replace the files which failed to patch, please note that you will need to manually re-add any Modifications (MODs) to these particular files. Alternatively if you know how you can examine the .rej files to determine what failed where and make manual adjustments to the relevant source.

                  diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index ebaa342f54..a4635895b0 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -25,7 +25,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -define('PHPBB_VERSION', '3.0.7-PL1'); +define('PHPBB_VERSION', '3.0.8-RC1'); // QA-related // define('PHPBB_QA', 1); diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php index dfade990d2..efe2bc2962 100644 --- a/phpBB/install/convertors/convert_phpbb20.php +++ b/phpBB/install/convertors/convert_phpbb20.php @@ -32,7 +32,7 @@ unset($dbpasswd); $convertor_data = array( 'forum_name' => 'phpBB 2.0.x', 'version' => '1.0.3', - 'phpbb_version' => '3.0.7-PL1', + 'phpbb_version' => '3.0.8', 'author' => 'phpBB Group', 'dbms' => $dbms, 'dbhost' => $dbhost, diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index e65237266b..86b83bb542 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -8,7 +8,7 @@ * */ -$updates_to_version = '3.0.8-dev'; +$updates_to_version = '3.0.8-RC1'; // Enter any version to update from to test updates. The version within the db will not be updated. $debug_from_version = false; @@ -3754,4 +3754,4 @@ class updater_db_tools } } -?> \ No newline at end of file +?> diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index a25b68ba39..f1f482b66d 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -242,7 +242,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page', 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 ('version', '3.0.8-dev'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.8-RC1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_expire_days', '90'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('warnings_gc', '14400'); diff --git a/phpBB/styles/prosilver/imageset/imageset.cfg b/phpBB/styles/prosilver/imageset/imageset.cfg index 7fc8274ad2..bbafe5e26d 100644 --- a/phpBB/styles/prosilver/imageset/imageset.cfg +++ b/phpBB/styles/prosilver/imageset/imageset.cfg @@ -19,7 +19,7 @@ # General Information about this style name = prosilver copyright = © phpBB Group, 2007 -version = 3.0.7 +version = 3.0.8 # Images img_site_logo = site_logo.gif*52*139 diff --git a/phpBB/styles/prosilver/style.cfg b/phpBB/styles/prosilver/style.cfg index 8b660c969e..7f7e677993 100644 --- a/phpBB/styles/prosilver/style.cfg +++ b/phpBB/styles/prosilver/style.cfg @@ -19,4 +19,4 @@ # General Information about this style name = prosilver copyright = © phpBB Group, 2007 -version = 3.0.7 \ No newline at end of file +version = 3.0.8 \ No newline at end of file diff --git a/phpBB/styles/prosilver/template/template.cfg b/phpBB/styles/prosilver/template/template.cfg index 03b61e1003..0dd4150266 100644 --- a/phpBB/styles/prosilver/template/template.cfg +++ b/phpBB/styles/prosilver/template/template.cfg @@ -19,7 +19,7 @@ # General Information about this template name = prosilver copyright = © phpBB Group, 2007 -version = 3.0.7 +version = 3.0.8 # Defining a different template bitfield template_bitfield = lNg= diff --git a/phpBB/styles/prosilver/theme/theme.cfg b/phpBB/styles/prosilver/theme/theme.cfg index 8b7916a144..83f3120829 100644 --- a/phpBB/styles/prosilver/theme/theme.cfg +++ b/phpBB/styles/prosilver/theme/theme.cfg @@ -21,7 +21,7 @@ # General Information about this theme name = prosilver copyright = © phpBB Group, 2007 -version = 3.0.7 +version = 3.0.8 # Some configuration options diff --git a/phpBB/styles/subsilver2/imageset/imageset.cfg b/phpBB/styles/subsilver2/imageset/imageset.cfg index 7709070734..ce0c859193 100644 --- a/phpBB/styles/subsilver2/imageset/imageset.cfg +++ b/phpBB/styles/subsilver2/imageset/imageset.cfg @@ -19,7 +19,7 @@ # General Information about this style name = subsilver2 copyright = © phpBB Group, 2003 -version = 3.0.7 +version = 3.0.8 # Images img_site_logo = site_logo.gif*94*170 diff --git a/phpBB/styles/subsilver2/style.cfg b/phpBB/styles/subsilver2/style.cfg index 86b5b8a4e8..b8ddd6deec 100644 --- a/phpBB/styles/subsilver2/style.cfg +++ b/phpBB/styles/subsilver2/style.cfg @@ -19,4 +19,4 @@ # General Information about this style name = subsilver2 copyright = © 2005 phpBB Group -version = 3.0.7 +version = 3.0.8 diff --git a/phpBB/styles/subsilver2/template/template.cfg b/phpBB/styles/subsilver2/template/template.cfg index b6765268bc..edfc2d43f2 100644 --- a/phpBB/styles/subsilver2/template/template.cfg +++ b/phpBB/styles/subsilver2/template/template.cfg @@ -19,5 +19,5 @@ # General Information about this template name = subsilver2 copyright = © phpBB Group, 2003 -version = 3.0.7 +version = 3.0.8 diff --git a/phpBB/styles/subsilver2/theme/theme.cfg b/phpBB/styles/subsilver2/theme/theme.cfg index 7f6bfd9a12..a6ac5f337c 100644 --- a/phpBB/styles/subsilver2/theme/theme.cfg +++ b/phpBB/styles/subsilver2/theme/theme.cfg @@ -21,7 +21,7 @@ # General Information about this theme name = subsilver2 copyright = © phpBB Group, 2003 -version = 3.0.7 +version = 3.0.8 # Some configuration options From b88f35caef616a3bded1193c67f7b84086644ff5 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 8 Nov 2010 23:22:06 +0100 Subject: [PATCH 381/393] [ticket/9888] Update fails when Bing [Bot] was already added to the users table Added a check whether the user already exists before we try to add it. PHPBB3-9888 --- phpBB/install/database_update.php | 99 +++++++++++++++++-------------- 1 file changed, 55 insertions(+), 44 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index e65237266b..b3ae38a7b6 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1707,55 +1707,66 @@ function change_database_data(&$no_updates, $version) _sql($sql, $errored, $error_ary); // add Bing Bot - $sql = 'SELECT group_id, group_colour - FROM ' . GROUPS_TABLE . " - WHERE group_name = 'BOTS'"; + $bot_name = 'Bing [Bot]'; + $bot_name_clean = utf8_clean_string($bot_name); + + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . " + WHERE username_clean = '" . $db->sql_escape($bot_name_clean) . "'"; $result = $db->sql_query($sql); - $group_row = $db->sql_fetchrow($result); + $bing_already_added = (bool) $db->sql_fetchfield('user_id'); $db->sql_freeresult($result); - if (!$group_row) + if (!$bing_already_added) { - // default fallback, should never get here - $group_row['group_id'] = 6; - $group_row['group_colour'] = '9E8DA7'; + $bot_agent = 'bingbot/'; + $bot_ip = ''; + $sql = 'SELECT group_id, group_colour + FROM ' . GROUPS_TABLE . " + WHERE group_name = 'BOTS'"; + $result = $db->sql_query($sql); + $group_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$group_row) + { + // default fallback, should never get here + $group_row['group_id'] = 6; + $group_row['group_colour'] = '9E8DA7'; + } + + if (!function_exists('user_add')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + $user_row = array( + 'user_type' => USER_IGNORE, + 'group_id' => $group_row['group_id'], + 'username' => $bot_name, + 'user_regdate' => time(), + 'user_password' => '', + 'user_colour' => $group_row['group_colour'], + 'user_email' => '', + 'user_lang' => $config['default_lang'], + 'user_style' => $config['default_style'], + 'user_timezone' => 0, + 'user_dateformat' => $config['default_dateformat'], + 'user_allow_massemail' => 0, + ); + + $user_id = user_add($user_row); + + $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'bot_active' => 1, + 'bot_name' => (string) $bot_name, + 'user_id' => (int) $user_id, + 'bot_agent' => (string) $bot_agent, + 'bot_ip' => (string) $bot_ip, + )); + + _sql($sql, $errored, $error_ary); } - - if (!function_exists('user_add')) - { - include($phpbb_root_path . 'includes/functions_user.' . $phpEx); - } - - $bot_name = 'Bing [Bot]'; - $bot_agent = 'bingbot/'; - $bot_ip = ''; - - $user_row = array( - 'user_type' => USER_IGNORE, - 'group_id' => $group_row['group_id'], - 'username' => $bot_name, - 'user_regdate' => time(), - 'user_password' => '', - 'user_colour' => $group_row['group_colour'], - 'user_email' => '', - 'user_lang' => $config['default_lang'], - 'user_style' => $config['default_style'], - 'user_timezone' => 0, - 'user_dateformat' => $config['default_dateformat'], - 'user_allow_massemail' => 0, - ); - - $user_id = user_add($user_row); - - $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array( - 'bot_active' => 1, - 'bot_name' => (string) $bot_name, - 'user_id' => (int) $user_id, - 'bot_agent' => (string) $bot_agent, - 'bot_ip' => (string) $bot_ip, - )); - - _sql($sql, $errored, $error_ary); // end Bing Bot addition // Delete shadow topics pointing to not existing topics From d722eeb64b0a8906ae62e814156de3582c16b820 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 8 Nov 2010 23:03:20 +0100 Subject: [PATCH 382/393] [ticket/9886] Update fails on PostgreSQL because of an error in _add_module PHPBB3-9886 --- phpBB/install/database_update.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index e65237266b..fd7591268d 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -685,8 +685,7 @@ function _add_modules($modules_to_install) FROM ' . MODULES_TABLE . " WHERE module_class = '" . $db->sql_escape($module_data['class']) . "' AND parent_id = {$parent_id} - AND left_id BETWEEN {$first_left_id} AND {$module_row['left_id']} - ORDER BY left_id"; + AND left_id BETWEEN {$first_left_id} AND {$module_row['left_id']}"; $result = $db->sql_query($sql); $steps = (int) $db->sql_fetchfield('num_modules'); $db->sql_freeresult($result); From c9c19874d6de1af67d4240ff85618dd16ee57b29 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Tue, 9 Nov 2010 21:03:29 +0100 Subject: [PATCH 383/393] [ticket/9884] Reduce queue interval to 60 seconds, email package size to 20 PHPBB3-9884 --- phpBB/install/database_update.php | 11 +++++++++++ phpBB/install/schemas/schema_data.sql | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 46b74c884c..8d67d2353d 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1840,6 +1840,17 @@ function change_database_data(&$no_updates, $version) // Unread posts search load switch set_config('load_unreads_search', '1'); + // Reduce queue interval to 60 seconds, email package size to 20 + if ($config['queue_interval'] == 600) + { + set_config('queue_interval', '60'); + } + + if ($config['email_package_size'] == 50) + { + set_config('email_package_size', '20'); + } + $no_updates = false; break; } diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index f1f482b66d..cbee2c9ba1 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -94,7 +94,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('delete_time', '0') INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_check_mx', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_enable', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_function_name', 'mail'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_package_size', '50'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('email_package_size', '20'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_confirm', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_pm_icons', '1'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('enable_post_confirm', '1'); @@ -209,7 +209,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_msgs', '50' INSERT INTO phpbb_config (config_name, config_value) VALUES ('pm_max_recipients', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('posts_per_page', '10'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('print_pm', '1'); -INSERT INTO phpbb_config (config_name, config_value) VALUES ('queue_interval', '600'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('queue_interval', '60'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('ranks_path', 'images/ranks'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('require_activation', '0'); INSERT INTO phpbb_config (config_name, config_value) VALUES ('referer_validation', '1'); From 88602d138c1b108bdd7901cef48f66e9ed5ef229 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Wed, 10 Nov 2010 16:27:25 +0100 Subject: [PATCH 384/393] [develop-olympus] Updating changelog with latest changes for 3.0.8-RC1 --- phpBB/docs/CHANGELOG.html | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index 877c0e32ec..f50e5a062f 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -114,8 +114,6 @@
                • [PHPBB3-7716] - Data too long for column 'message_subject'
                • -
                • [PHPBB3-7717] - Use user's language for standard-extensions-group name -
                • [PHPBB3-7720] - Fix alternative image-description for unread posts.
                • [PHPBB3-7782] - Send HTTP 404 if topic, forum or user do not exist @@ -386,12 +384,24 @@
                • [PHPBB3-9841] - Change "Save" button to "Save draft"
                • +
                • [PHPBB3-9847] - Language typo and written form (British/American) +
                • [PHPBB3-9854] - Auth API documentation is incomplete
                • [PHPBB3-9855] - Tests don't run on PHPUnit 3.5
                • [PHPBB3-9879] - captcha_qa.php spelling, punctuation and grammar errors
                • +
                • [PHPBB3-9883] - CAPTCHA uses american english +
                • +
                • [PHPBB3-9884] - Massive email delays +
                • +
                • [PHPBB3-9885] - Default file extension groups not properly updated by database updater. +
                • +
                • [PHPBB3-9886] - Database updater does not run on PostgreSQL because of an error in _add_module() +
                • +
                • [PHPBB3-9888] - Update fails when Bing [Bot] was already added to the users table +

                Improvement @@ -399,6 +409,8 @@
                • [PHPBB3-7332] - MCP post details usability
                • +
                • [PHPBB3-7717] - Use user's language for standard-extensions-group name +
                • [PHPBB3-8709] - Multibyte keys in request_var not possible
                • [PHPBB3-8936] - subsilver2 missing reply-to-all feature From 9d55794e33c32a94f3630a2708c288c7b8ea6eef Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 10 Nov 2010 17:56:05 +0100 Subject: [PATCH 385/393] [ticket/9891] Updater drops language-selection after database-update PHPBB3-9891 --- phpBB/install/database_update.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 95f7cdae87..01e8ef7658 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -477,7 +477,7 @@ else

                  -

                  " class="button1">

                  +

                  " class="button1">

                  Date: Wed, 10 Nov 2010 18:26:02 +0100 Subject: [PATCH 386/393] [ticket/9140] Check current board version in incremental update packages We need to use $this->current_version in this case instead of $config['version']. Otherwise the message will be displayed after the database got updated from database_update.php. Using PHPBB_VERSION from includes/constants.php is not the right selection either, because than the message is displayed after the files got updated and are checked one last time. PHPBB3-9140 --- phpBB/install/install_update.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/install/install_update.php b/phpBB/install/install_update.php index 6184cbbc33..ec76f2a407 100644 --- a/phpBB/install/install_update.php +++ b/phpBB/install/install_update.php @@ -193,13 +193,13 @@ class install_update extends module } // Check if the update files are actually meant to update from the current version - if ($config['version'] != $this->update_info['version']['from']) + if ($this->current_version != $this->update_info['version']['from']) { $this->unequal_version = true; $template->assign_vars(array( 'S_ERROR' => true, - 'ERROR_MSG' => sprintf($user->lang['INCOMPATIBLE_UPDATE_FILES'], $config['version'], $this->update_info['version']['from'], $this->update_info['version']['to']), + 'ERROR_MSG' => sprintf($user->lang['INCOMPATIBLE_UPDATE_FILES'], $this->current_version, $this->update_info['version']['from'], $this->update_info['version']['to']), )); } From 7b4cdc94a850c95582557d22ea7fd97e716734c7 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Wed, 10 Nov 2010 19:01:54 +0100 Subject: [PATCH 387/393] [develop-olympus] Updating changelog for last minute 3.0.8-RC1 fixes. --- phpBB/docs/CHANGELOG.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index f50e5a062f..f5d6da94b9 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -402,6 +402,8 @@
                • [PHPBB3-9888] - Update fails when Bing [Bot] was already added to the users table
                • +
                • [PHPBB3-9891] - Updater drops language-selection after database-update +

                Improvement From 291a1fff1f8db54a0d2c59faa689f23f3e35f4fe Mon Sep 17 00:00:00 2001 From: Ruslan Uzdenov Date: Mon, 15 Nov 2010 23:27:57 +0100 Subject: [PATCH 388/393] [ticket/9903] Fix XSS in BBcode-parser's Flash-BBcode. Fix XSS in Flash-BBcode by validating that the supplied argument is a URL. PHPBB3-9903 --- phpBB/includes/message_parser.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 952b55cc8c..b2d0b6c566 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -352,6 +352,15 @@ class bbcode_firstpass extends bbcode return '[flash=' . $width . ',' . $height . ']' . $in . '[/flash]'; } + $in = str_replace(' ', '%20', $in); + + // Make sure $in is a URL. + if (!preg_match('#^' . get_preg_expression('url') . '$#i', $in) && + !preg_match('#^' . get_preg_expression('www_url') . '$#i', $in)) + { + return '[flash=' . $width . ',' . $height . ']' . $in . '[/flash]'; + } + // Apply the same size checks on flash files as on images if ($config['max_' . $this->mode . '_img_height'] || $config['max_' . $this->mode . '_img_width']) { From 859149f5c36c1ebd437f43de940528d25931d6fd Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Thu, 11 Nov 2010 23:41:01 +0100 Subject: [PATCH 389/393] [ticket/9509] Fix a typo and wrong period placement Thanks to Michael C. for spotting this. PHPBB3-9509 --- phpBB/docs/coding-guidelines.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpBB/docs/coding-guidelines.html b/phpBB/docs/coding-guidelines.html index 76afc79f99..5a73554741 100644 --- a/phpBB/docs/coding-guidelines.html +++ b/phpBB/docs/coding-guidelines.html @@ -2349,9 +2349,9 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2)) -

                7.ii. Commit Messages and Reposiory Rules

                +

                7.ii. Commit Messages and Repository Rules

                -

                Information on repository rules, such as commit messages can be found at http://wiki.phpbb.com/display/DEV/Git

                . +

                Information on repository rules, such as commit messages can be found at http://wiki.phpbb.com/display/DEV/Git.

                From 6c45754a439ad26d5c0b0cf139c30ac34efda255 Mon Sep 17 00:00:00 2001 From: RMcGirr83 Date: Thu, 11 Nov 2010 19:03:21 -0500 Subject: [PATCH 390/393] [ticket/9899] Change recaptcha theme from default to 'clean' in the ACP. Change recaptcha theme from default to 'clean' in the ACP to better match the administration control panel. Follow up to d6aa25ede149a2d483b064f5ce96abcf49458ee3. PHPBB3-9899 --- phpBB/adm/style/captcha_recaptcha.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpBB/adm/style/captcha_recaptcha.html b/phpBB/adm/style/captcha_recaptcha.html index 702a4a1099..586c494868 100644 --- a/phpBB/adm/style/captcha_recaptcha.html +++ b/phpBB/adm/style/captcha_recaptcha.html @@ -4,7 +4,8 @@ From e043dc316ab323d874d6c75c6c6fa59c9adaf761 Mon Sep 17 00:00:00 2001 From: Chris Sfanos Date: Fri, 19 Nov 2010 10:19:17 +0100 Subject: [PATCH 391/393] [ticket/9904] Update WebPI Parameters.xml to work with WebMatrix. PHPBB3-9904 --- build/webpi/parameters.xml | 112 +++++++++++++++++++++++-------------- 1 file changed, 71 insertions(+), 41 deletions(-) diff --git a/build/webpi/parameters.xml b/build/webpi/parameters.xml index 994247e48e..be4d374632 100644 --- a/build/webpi/parameters.xml +++ b/build/webpi/parameters.xml @@ -9,7 +9,7 @@ scope="iisapp" match="phpBB3" /> - + + match="phpBB3/cache$" /> + match="phpBB3/files$" /> + match="phpBB3/store$" /> + match="phpBB3/images/avatars/upload$" /> + match="phpBB3/config.php$" /> - + + + + + + + + + name="SQL DatabaseName" description="Database name for your application." defaultValue="phpbb" tags="SQL, dbName"> - + + + + + @@ -113,9 +114,13 @@ scope="install/mssql.sql" match="PlaceHolderForUser" /> - + + + + + @@ -129,10 +134,16 @@ match="PlaceHolderForPassword" /> + + + + + + + + + + + + @@ -171,22 +188,13 @@ scope="install/mysql.sql" match="PlaceHolderForDb" /> - - + + + - - - @@ -196,6 +204,10 @@ scope="install/mysql.sql" match="PlaceHolderForUser" /> + + + + + + + + + + + + + + + Date: Mon, 15 Nov 2010 22:49:28 +0100 Subject: [PATCH 392/393] [ticket/9903] Script for detecting potentially malicious flash bbcodes PHPBB3-9903 --- phpBB/develop/check_flash_bbcodes.php | 163 ++++++++++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 phpBB/develop/check_flash_bbcodes.php diff --git a/phpBB/develop/check_flash_bbcodes.php b/phpBB/develop/check_flash_bbcodes.php new file mode 100644 index 0000000000..b0fa399209 --- /dev/null +++ b/phpBB/develop/check_flash_bbcodes.php @@ -0,0 +1,163 @@ + ''"; + + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + $uid = $row[$uid_field]; + + // thanks support toolkit + $content = html_entity_decode_utf8($row[$content_field]); + set_var($content, $content, 'string', true); + $content = utf8_normalize_nfc($content); + + $bitfield_data = $row[$bitfield_field]; + + if (!is_valid_flash_bbcode($content, $uid) && has_flash_enabled($bitfield_data)) + { + $ids[] = (int) $row[$id_field]; + } + } + $db->sql_freeresult($result); + + return $ids; +} + +function get_flash_regex($uid) +{ + return "#\[flash=([0-9]+),([0-9]+):$uid\](.*?)\[/flash:$uid\]#"; +} + +// extract all valid flash bbcodes +// check if the bbcode content is a valid URL for each match +function is_valid_flash_bbcode($cleaned_content, $uid) +{ + $regex = get_flash_regex($uid); + + $url_regex = get_preg_expression('url'); + $www_url_regex = get_preg_expression('www_url'); + + if (preg_match_all($regex, $cleaned_content, $matches)) + { + foreach ($matches[3] as $flash_url) + { + if (!preg_match("#^($url_regex|$www_url_regex)$#i", $flash_url)) + { + return false; + } + } + } + + return true; +} + +// check if a bitfield includes flash +// 11 = flash bit +function has_flash_enabled($bitfield_data) +{ + $bitfield = new bitfield($bitfield_data); + return $bitfield->get(11); +} + +// taken from support toolkit +function html_entity_decode_utf8($string) +{ + static $trans_tbl; + + // replace numeric entities + $string = preg_replace('~&#x([0-9a-f]+);~ei', 'code2utf8(hexdec("\\1"))', $string); + $string = preg_replace('~&#([0-9]+);~e', 'code2utf8(\\1)', $string); + + // replace literal entities + if (!isset($trans_tbl)) + { + $trans_tbl = array(); + + foreach (get_html_translation_table(HTML_ENTITIES) as $val=>$key) + $trans_tbl[$key] = utf8_encode($val); + } + return strtr($string, $trans_tbl); +} + +// taken from support toolkit +// Returns the utf string corresponding to the unicode value (from php.net, courtesy - romans@void.lv) +function code2utf8($num) +{ + if ($num < 128) return chr($num); + if ($num < 2048) return chr(($num >> 6) + 192) . chr(($num & 63) + 128); + if ($num < 65536) return chr(($num >> 12) + 224) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); + if ($num < 2097152) return chr(($num >> 18) + 240) . chr((($num >> 12) & 63) + 128) . chr((($num >> 6) & 63) + 128) . chr(($num & 63) + 128); + return ''; +} From af4c2a3eb15fc4318b23dcb7794c230cf3ec2a0f Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Fri, 19 Nov 2010 11:36:14 +0100 Subject: [PATCH 393/393] [prep-release-3.0.8] Incrementing version number to 3.0.8 and update changelog --- build/build.xml | 6 +++--- phpBB/docs/CHANGELOG.html | 12 ++++++++++++ phpBB/includes/constants.php | 2 +- phpBB/install/database_update.php | 16 +++++++++++----- phpBB/install/schemas/schema_data.sql | 2 +- 5 files changed, 28 insertions(+), 10 deletions(-) diff --git a/build/build.xml b/build/build.xml index 69caa897c3..bf77d82f6c 100644 --- a/build/build.xml +++ b/build/build.xml @@ -2,9 +2,9 @@ - - - + + + diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html index f5d6da94b9..66915b18fa 100644 --- a/phpBB/docs/CHANGELOG.html +++ b/phpBB/docs/CHANGELOG.html @@ -90,6 +90,12 @@

                1.i. Changes since 3.0.7-PL1

                +

                Security +

                +
                  +
                • [PHPBB3-9903] - Execute javascript in [flash=] BBCode +
                • +

                Bug

                @@ -404,6 +410,8 @@
              8. [PHPBB3-9891] - Updater drops language-selection after database-update
              9. +
              10. [PHPBB3-9509] - phpBB Coding Guidelines state subversion as the version control system for phpBB +
              11. Improvement @@ -467,6 +475,8 @@
              12. [PHPBB3-9880] - Rename all mentions of CAPTCHA or visual confirmation to anti-bot
              13. +
              14. [PHPBB3-9899] - Change the style in the ACP for the recaptcha to match that displayed on prosilver +
              15. New Feature @@ -509,6 +519,8 @@
              16. [PHPBB3-9868] - Make the test suite run and pass using the mssqlnative driver
              17. +
              18. [PHPBB3-9904] - Update WebPI Parameters.xml +
              19. Sub-task diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php index a4635895b0..af2a6ebd24 100644 --- a/phpBB/includes/constants.php +++ b/phpBB/includes/constants.php @@ -25,7 +25,7 @@ if (!defined('IN_PHPBB')) */ // phpBB Version -define('PHPBB_VERSION', '3.0.8-RC1'); +define('PHPBB_VERSION', '3.0.8'); // QA-related // define('PHPBB_QA', 1); diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 01e8ef7658..0ec9f24190 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -8,7 +8,7 @@ * */ -$updates_to_version = '3.0.8-RC1'; +$updates_to_version = '3.0.8'; // Enter any version to update from to test updates. The version within the db will not be updated. $debug_from_version = false; @@ -914,6 +914,8 @@ function database_update_info() '3.0.7' => array(), // No changes from 3.0.7-PL1 to 3.0.8-RC1 '3.0.7-PL1' => array(), + // No changes from 3.0.8-RC1 to 3.0.8 + '3.0.8-RC1' => array(), ); } @@ -1672,7 +1674,7 @@ function change_database_data(&$no_updates, $version) "{$phpbb_root_path}language/$lang_dir/install.$phpEx", "{$phpbb_root_path}language/$lang_dir/acp/attachments.$phpEx", ); - + foreach ($lang_files as $lang_file) { if (!file_exists($lang_file)) @@ -1852,6 +1854,10 @@ function change_database_data(&$no_updates, $version) $no_updates = false; break; + + // No changes from 3.0.8-RC1 to 3.0.8 + case '3.0.8-RC1': + break; } } @@ -1998,7 +2004,7 @@ class updater_db_tools 'VCHAR_CI' => '[varchar] (255)', 'VARBINARY' => '[varchar] (255)', ), - + 'mssqlnative' => array( 'INT:' => '[int]', 'BINT' => '[float]', @@ -2028,7 +2034,7 @@ class updater_db_tools 'VCHAR_CI' => '[varchar] (255)', 'VARBINARY' => '[varchar] (255)', ), - + 'oracle' => array( 'INT:' => 'number(%d)', 'BINT' => 'number(20)', @@ -2175,7 +2181,7 @@ class updater_db_tools case 'mssql_odbc': $this->sql_layer = 'mssql'; break; - + case 'mssqlnative': $this->sql_layer = 'mssqlnative'; break; diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index cbee2c9ba1..e3c9d1e13a 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -242,7 +242,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('topics_per_page', 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 ('version', '3.0.8-RC1'); +INSERT INTO phpbb_config (config_name, config_value) VALUES ('version', '3.0.8'); 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');