From 1b0821a11baf7e15686dae9c2648878a826be80e Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sat, 18 Jun 2011 01:02:58 +0200 Subject: [PATCH 1/3] [ticket/10223] requiring the new startup.php file conditionally. Added a function for this which we can potentially apply to more of the files in the installer and database updater. PHPBB3-10223 --- phpBB/install/database_update.php | 24 +++++++++++++++++++----- phpBB/install/index.php | 24 +++++++++++++++++++----- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index e9213cac9d..0d424d0d88 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -34,7 +34,24 @@ define('IN_INSTALL', true); $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); -require($phpbb_root_path . 'includes/startup.' . $phpEx); +function phpbb_require_updated($path, $optional = false) +{ + global $phpbb_root_path; + + $new_path = $phpbb_root_path . 'install/update/new/' . $path; + $old_path = $phpbb_root_path . $path; + + if (file_exists($new_path)) + { + require($new_path); + } + else if (file_exists($old_path) || !$optional) + { + require($old_path); + } +} + +phpbb_require_updated('includes/startup.' . $phpEx); $updates_to_version = UPDATES_TO_VERSION; $debug_from_version = DEBUG_FROM_VERSION; @@ -72,10 +89,7 @@ require($phpbb_root_path . 'includes/auth.' . $phpEx); require($phpbb_root_path . 'includes/functions.' . $phpEx); -if (file_exists($phpbb_root_path . 'includes/functions_content.' . $phpEx)) -{ - require($phpbb_root_path . 'includes/functions_content.' . $phpEx); -} +phpbb_require_updated($phpbb_root_path . 'includes/functions_content.' . $phpEx, true); require($phpbb_root_path . 'includes/functions_admin.' . $phpEx); require($phpbb_root_path . 'includes/constants.' . $phpEx); diff --git a/phpBB/install/index.php b/phpBB/install/index.php index ff6a297022..c82c3dbc13 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -24,7 +24,24 @@ if (version_compare(PHP_VERSION, '4.3.3') < 0) die('You are running an unsupported PHP version. Please upgrade to PHP 4.3.3 or higher before trying to install phpBB 3.0'); } -require($phpbb_root_path . 'includes/startup.' . $phpEx); +function phpbb_require_updated($path, $optional = false) +{ + global $phpbb_root_path; + + $new_path = $phpbb_root_path . 'install/update/new/' . $path; + $old_path = $phpbb_root_path . $path; + + if (file_exists($new_path)) + { + require($new_path); + } + else if (file_exists($old_path) || !$optional) + { + require($old_path); + } +} + +phpbb_require_updated('includes/startup.' . $phpEx); // Try to override some limits - maybe it helps some... @set_time_limit(0); @@ -57,10 +74,7 @@ else // Include essential scripts require($phpbb_root_path . 'includes/functions.' . $phpEx); -if (file_exists($phpbb_root_path . 'includes/functions_content.' . $phpEx)) -{ - require($phpbb_root_path . 'includes/functions_content.' . $phpEx); -} +phpbb_require_updated($phpbb_root_path . 'includes/functions_content.' . $phpEx, true); include($phpbb_root_path . 'includes/auth.' . $phpEx); include($phpbb_root_path . 'includes/session.' . $phpEx); From d3f1b6029248d20d4a3a4bc2f3684f8aad88559d Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sat, 18 Jun 2011 23:48:37 +0200 Subject: [PATCH 2/3] [ticket/10223] Check optional before file_exists and correct require path PHPBB3-10223 --- phpBB/install/database_update.php | 4 ++-- phpBB/install/index.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 0d424d0d88..337f08b626 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -45,7 +45,7 @@ function phpbb_require_updated($path, $optional = false) { require($new_path); } - else if (file_exists($old_path) || !$optional) + else if (!$optional || file_exists($old_path)) { require($old_path); } @@ -89,7 +89,7 @@ require($phpbb_root_path . 'includes/auth.' . $phpEx); require($phpbb_root_path . 'includes/functions.' . $phpEx); -phpbb_require_updated($phpbb_root_path . 'includes/functions_content.' . $phpEx, true); +phpbb_require_updated('includes/functions_content.' . $phpEx, true); require($phpbb_root_path . 'includes/functions_admin.' . $phpEx); require($phpbb_root_path . 'includes/constants.' . $phpEx); diff --git a/phpBB/install/index.php b/phpBB/install/index.php index c82c3dbc13..5189cbfc8e 100644 --- a/phpBB/install/index.php +++ b/phpBB/install/index.php @@ -35,7 +35,7 @@ function phpbb_require_updated($path, $optional = false) { require($new_path); } - else if (file_exists($old_path) || !$optional) + else if (!$optional || file_exists($old_path)) { require($old_path); } @@ -74,7 +74,7 @@ else // Include essential scripts require($phpbb_root_path . 'includes/functions.' . $phpEx); -phpbb_require_updated($phpbb_root_path . 'includes/functions_content.' . $phpEx, true); +phpbb_require_updated('includes/functions_content.' . $phpEx, true); include($phpbb_root_path . 'includes/auth.' . $phpEx); include($phpbb_root_path . 'includes/session.' . $phpEx); From d37e8dd6d38bc288ae9179389ac845cab1f61386 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Sun, 19 Jun 2011 00:13:33 +0200 Subject: [PATCH 3/3] [ticket/10223] The search fid parameter is an array of forums not just an id PHPBB3-10223 --- phpBB/viewforum.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index fff5be69d3..cfdc90c947 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -267,7 +267,7 @@ $post_alt = ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->lang['FORUM_LO // Display active topics? $s_display_active = ($forum_data['forum_type'] == FORUM_CAT && ($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS)) ? true : false; -$s_search_hidden_fields = array('fid' => $forum_id); +$s_search_hidden_fields = array('fid' => array($forum_id)); if ($_SID) { $s_search_hidden_fields['sid'] = $_SID;