aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/functions.php34
-rw-r--r--phpBB/includes/startup.php28
-rw-r--r--phpBB/install/database_update.php27
-rw-r--r--phpBB/install/index.php24
-rw-r--r--phpBB/language/en/acp/board.php2
-rw-r--r--phpBB/styles/prosilver/template/viewforum_body.html2
-rw-r--r--phpBB/styles/prosilver/template/viewtopic_body.html2
-rw-r--r--phpBB/styles/subsilver2/template/searchbox.html2
-rw-r--r--phpBB/viewforum.php4
-rw-r--r--phpBB/viewtopic.php2
10 files changed, 93 insertions, 34 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index b8d9e0b92e..d05cccc440 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -3758,25 +3758,11 @@ function msg_handler($errno, $msg_text, $errfile, $errline)
if (strpos($errfile, 'cache') === false && strpos($errfile, 'template.') === false)
{
- // flush the content, else we get a white page if output buffering is on
- if (ob_get_level() > 0)
- {
- @ob_flush();
- }
-
- // Another quick fix for those having gzip compression enabled, but do not flush if the coder wants to catch "something". ;)
- if (!empty($config['gzip_compress']))
- {
- if (@extension_loaded('zlib') && !headers_sent() && !ob_get_level())
- {
- @ob_flush();
- }
- }
-
// remove complete path to installation, with the risk of changing backslashes meant to be there
$errfile = str_replace(array(phpbb_realpath($phpbb_root_path), '\\'), array('', '/'), $errfile);
$msg_text = str_replace(array(phpbb_realpath($phpbb_root_path), '\\'), array('', '/'), $msg_text);
- echo '<b>[phpBB Debug] PHP Notice</b>: in file <b>' . $errfile . '</b> on line <b>' . $errline . '</b>: <b>' . $msg_text . '</b><br />' . "\n";
+ $error_name = ($errno === E_WARNING) ? 'PHP Warning' : 'PHP Notice';
+ echo '<b>[phpBB Debug] ' . $error_name . '</b>: in file <b>' . $errfile . '</b> on line <b>' . $errline . '</b>: <b>' . $msg_text . '</b><br />' . "\n";
// we are writing an image - the user won't see the debug, so let's place it in the log
if (defined('IMAGE_OUTPUT') || defined('IN_CRON'))
@@ -4331,7 +4317,21 @@ function page_header($page_title = '', $display_online_list = true, $item_id = 0
// gzip_compression
if ($config['gzip_compress'])
{
- if (@extension_loaded('zlib') && !headers_sent())
+ // to avoid partially compressed output resulting in blank pages in
+ // the browser or error messages, compression is disabled in a few cases:
+ //
+ // 1) if headers have already been sent, this indicates plaintext output
+ // has been started so further content must not be compressed
+ // 2) the length of the current output buffer is non-zero. This means
+ // there is already some uncompressed content in this output buffer
+ // so further output must not be compressed
+ // 3) if more than one level of output buffering is used because we
+ // cannot test all output buffer level content lengths. One level
+ // could be caused by php.ini output_buffering. Anything
+ // beyond that is manual, so the code wrapping phpBB in output buffering
+ // can easily compress the output itself.
+ //
+ if (@extension_loaded('zlib') && !headers_sent() && ob_get_level() <= 1 && ob_get_length() == 0)
{
ob_start('ob_gzhandler');
}
diff --git a/phpBB/includes/startup.php b/phpBB/includes/startup.php
index be46c17ba6..ca9665da29 100644
--- a/phpBB/includes/startup.php
+++ b/phpBB/includes/startup.php
@@ -118,5 +118,33 @@ else
define('STRIP', (get_magic_quotes_gpc()) ? true : false);
}
+// Prevent date/time functions from throwing E_WARNING on PHP 5.3 by setting a default timezone
+if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get'))
+{
+ // For PHP 5.1.0 the date/time functions have been rewritten
+ // and setting a timezone is required prior to calling any date/time function.
+
+ // Since PHP 5.2.0 calls to date/time functions without having a timezone set
+ // result in E_STRICT errors being thrown.
+ // Note: We already exclude E_STRICT errors
+ // (to be exact: they are not included in E_ALL in PHP 5.2)
+
+ // In PHP 5.3.0 the error level has been raised to E_WARNING which causes problems
+ // because we show E_WARNING errors and do not set a default timezone.
+ // This is because we have our own timezone handling and work in UTC only anyway.
+
+ // So what we basically want to do is set our timezone to UTC,
+ // but we don't know what other scripts (such as bridges) are involved,
+ // so we check whether a timezone is already set by calling date_default_timezone_get().
+
+ // Unfortunately, date_default_timezone_get() itself might throw E_WARNING
+ // if no timezone has been set, so we have to keep it quiet with @.
+
+ // date_default_timezone_get() tries to guess the correct timezone first
+ // and then falls back to UTC when everything fails.
+ // We just set the timezone to whatever date_default_timezone_get() returns.
+ date_default_timezone_set(@date_default_timezone_get());
+}
+
$starttime = explode(' ', microtime());
$starttime = $starttime[1] + $starttime[0];
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index e9213cac9d..edfc3b1027 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -34,7 +34,27 @@ 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);
+if (!function_exists('phpbb_require_updated'))
+{
+ 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 (!$optional || file_exists($old_path))
+ {
+ require($old_path);
+ }
+ }
+}
+
+phpbb_require_updated('includes/startup.' . $phpEx);
$updates_to_version = UPDATES_TO_VERSION;
$debug_from_version = DEBUG_FROM_VERSION;
@@ -72,10 +92,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('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..f534980389 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 (!$optional || file_exists($old_path))
+ {
+ 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('includes/functions_content.' . $phpEx, true);
include($phpbb_root_path . 'includes/auth.' . $phpEx);
include($phpbb_root_path . 'includes/session.' . $phpEx);
diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php
index 68474ee893..0254bff992 100644
--- a/phpBB/language/en/acp/board.php
+++ b/phpBB/language/en/acp/board.php
@@ -469,7 +469,7 @@ $lang = array_merge($lang, array(
'IP_LOGIN_LIMIT_USE_FORWARDED' => 'Limit login attempts by <var>X_FORWARDED_FOR</var> header',
'IP_LOGIN_LIMIT_USE_FORWARDED_EXPLAIN' => 'Instead of limiting login attempts by IP address they are limited by <var>X_FORWARDED_FOR</var> values. <br /><em><strong>Warning:</strong> Only enable this if you are operating a proxy server that sets <var>X_FORWARDED_FOR</var> to trustworthy values.</em>',
'MAX_LOGIN_ATTEMPTS' => 'Maximum number of login attempts per username',
- 'MAX_LOGIN_ATTEMPTS_EXPLAIN' => 'The number of login attempts allowed for a single account before the anti-spambot task is triggered. Enter 0 to prevent the anti-spambot task from being trigger for distinct user accounts.',
+ 'MAX_LOGIN_ATTEMPTS_EXPLAIN' => 'The number of login attempts allowed for a single account before the anti-spambot task is triggered. Enter 0 to prevent the anti-spambot task from being triggered for distinct user accounts.',
'NO_IP_VALIDATION' => 'None',
'NO_REF_VALIDATION' => 'None',
'PASSWORD_TYPE' => 'Password complexity',
diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html
index 6a789074b1..02f42fa097 100644
--- a/phpBB/styles/prosilver/template/viewforum_body.html
+++ b/phpBB/styles/prosilver/template/viewforum_body.html
@@ -49,7 +49,7 @@
<fieldset>
<input class="inputbox search tiny" type="text" name="keywords" id="search_keywords" size="20" value="{L_SEARCH_FORUM}" onclick="if (this.value == '{LA_SEARCH_FORUM}') this.value = '';" onblur="if (this.value == '') this.value = '{LA_SEARCH_FORUM}';" />
<input class="button2" type="submit" value="{L_SEARCH}" />
- {S_SEARCH_HIDDEN_FIELDS}
+ {S_SEARCH_LOCAL_HIDDEN_FIELDS}
</fieldset>
</form>
</div>
diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html
index 98e1988d10..32292f89ef 100644
--- a/phpBB/styles/prosilver/template/viewtopic_body.html
+++ b/phpBB/styles/prosilver/template/viewtopic_body.html
@@ -42,7 +42,7 @@
<fieldset>
<input class="inputbox search tiny" type="text" name="keywords" id="search_keywords" size="20" value="{L_SEARCH_TOPIC}" onclick="if(this.value=='{LA_SEARCH_TOPIC}')this.value='';" onblur="if(this.value=='')this.value='{LA_SEARCH_TOPIC}';" />
<input class="button2" type="submit" value="{L_SEARCH}" />
- {S_SEARCH_HIDDEN_FIELDS}
+ {S_SEARCH_LOCAL_HIDDEN_FIELDS}
</fieldset>
</form>
</div>
diff --git a/phpBB/styles/subsilver2/template/searchbox.html b/phpBB/styles/subsilver2/template/searchbox.html
index 09b87a15d8..622961c881 100644
--- a/phpBB/styles/subsilver2/template/searchbox.html
+++ b/phpBB/styles/subsilver2/template/searchbox.html
@@ -1 +1 @@
-<form method="get" name="search" action="{S_SEARCHBOX_ACTION}"><span class="gensmall">{L_SEARCH_FOR}:</span> <input class="post" type="text" name="keywords" size="20" /> <input class="btnlite" type="submit" value="{L_GO}" />{S_SEARCH_HIDDEN_FIELDS}</form>
+<form method="get" name="search" action="{S_SEARCHBOX_ACTION}"><span class="gensmall">{L_SEARCH_FOR}:</span> <input class="post" type="text" name="keywords" size="20" /> <input class="btnlite" type="submit" value="{L_GO}" />{S_SEARCH_LOCAL_HIDDEN_FIELDS}</form>
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index fff5be69d3..61ec27ed79 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;
@@ -311,7 +311,7 @@ $template->assign_vars(array(
'S_FORUM_ACTION' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . (($start == 0) ? '' : "&amp;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"),
- 'S_SEARCH_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields),
+ 'S_SEARCH_LOCAL_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields),
'S_SINGLE_MODERATOR' => (!empty($moderators[$forum_id]) && sizeof($moderators[$forum_id]) > 1) ? false : true,
'S_IS_LOCKED' => ($forum_data['forum_status'] == ITEM_LOCKED) ? true : false,
'S_VIEWFORUM' => true,
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index e4c02a88fb..08e82591de 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -646,7 +646,7 @@ $template->assign_vars(array(
'S_VIEWTOPIC' => true,
'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"),
- 'S_SEARCH_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields),
+ 'S_SEARCH_LOCAL_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields),
'S_DISPLAY_POST_INFO' => ($topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false,
'S_DISPLAY_REPLY_INFO' => ($topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false,