diff --git a/phpBB/admin/admin_styles.php b/phpBB/admin/admin_styles.php
index 90cfc04fc0..09e8917ba2 100644
--- a/phpBB/admin/admin_styles.php
+++ b/phpBB/admin/admin_styles.php
@@ -50,11 +50,9 @@ if (empty($HTTP_POST_VARS['send_file']))
require('./pagestart.' . $phpEx);
}
-if( $cancel )
+if ($cancel)
{
- $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
- header($header_location . append_sid("admin_styles.$phpEx"));
- exit;
+ redirect('admin/' . append_sid("admin_styles.$phpEx", true));
}
if( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
diff --git a/phpBB/admin/pagestart.php b/phpBB/admin/pagestart.php
index ac0831ef56..e562beb55d 100644
--- a/phpBB/admin/pagestart.php
+++ b/phpBB/admin/pagestart.php
@@ -40,9 +40,7 @@ init_userprefs($userdata);
if (!$userdata['session_logged_in'])
{
- $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
- header($header_location . '../' . append_sid("login.$phpEx?redirect=admin/"));
- exit;
+ redirect(append_sid("login.$phpEx?redirect=admin/", true));
}
else if ($userdata['user_level'] != ADMIN)
{
@@ -55,9 +53,7 @@ if ($HTTP_GET_VARS['sid'] != $userdata['session_id'])
$url = preg_replace('/\?$/', '', $url);
$url .= ((strpos($url, '?')) ? '&' : '?') . 'sid=' . $userdata['session_id'];
- $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
- header($header_location . $url);
- exit;
+ redirect($url);
}
if (empty($no_page_header))
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index 120af285ac..047d95f7b7 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -119,7 +119,7 @@ h3 {font-size:12pt;color:blue}
Fixed non-pruning of watched topics table when pruning related topics
Enable GET redirect on logout
Added check for IE6.x to viewtopic ICQ indicator javascript
-Fixed empty username quoting owith MS-SQL
+Fixed empty username quoting with MS-SQL
Fixed BBCode url, magic url and img tags to allow most chars beyond domain names
Prevent parsing of -ve size values in BBCode size tag
Back ported HTML handler from 2.2, this may impact some boards which allow complex HTML - existing parser remains but commented out
@@ -130,7 +130,8 @@ h3 {font-size:12pt;color:blue}
Fixes for paths under Apache2
Added wrap text with tag support for posting in Mozilla 1.1+
Fixed use of missing CSS classes in modcp_split, group_info_body, error_body and agreement
-
+Fixed ability of users to edit polls even after they have received votes
+Fixed header Location to be absolute URL as per HTTP 1.1 spec - noted by PhilippK
diff --git a/phpBB/groupcp.php b/phpBB/groupcp.php
index cf40a549b3..7bdd76aae4 100644
--- a/phpBB/groupcp.php
+++ b/phpBB/groupcp.php
@@ -151,15 +151,13 @@ $start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) :
//
// Default var values
//
-$header_location = ( @preg_match('/Microsoft|WebSTAR/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
$is_moderator = FALSE;
if ( isset($HTTP_POST_VARS['groupstatus']) && $group_id )
{
if ( !$userdata['session_logged_in'] )
{
- header($header_location . append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true));
- exit;
+ redirect(append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true));
}
$sql = "SELECT group_moderator
@@ -208,8 +206,7 @@ else if ( isset($HTTP_POST_VARS['joingroup']) && $group_id )
//
if ( !$userdata['session_logged_in'] )
{
- header($header_location . append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true));
- exit;
+ redirect(append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true));
}
$sql = "SELECT ug.user_id, g.group_type
@@ -310,13 +307,11 @@ else if ( isset($HTTP_POST_VARS['unsub']) || isset($HTTP_POST_VARS['unsubpending
//
if ( $cancel )
{
- header($header_location . append_sid("groupcp.$phpEx", true));
- exit;
+ redirect(append_sid("groupcp.$phpEx", true));
}
elseif ( !$userdata['session_logged_in'] )
{
- header($header_location . append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true));
- exit;
+ redirect(append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true));
}
if ( $confirm )
@@ -399,8 +394,7 @@ else if ( $group_id )
{
if ( !$userdata['session_logged_in'] )
{
- header($header_location . append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true));
- exit;
+ redirect(append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true));
}
}
@@ -461,8 +455,7 @@ else if ( $group_id )
{
if ( !$userdata['session_logged_in'] )
{
- header($header_location . append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true));
- exit;
+ redirect(append_sid("login.$phpEx?redirect=groupcp.$phpEx&" . POST_GROUPS_URL . "=$group_id", true));
}
if ( !$is_moderator )
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index afe7308625..b03e3824f8 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -690,4 +690,25 @@ if ( !function_exists(realpath) )
return $path;
}
}
-?>
+
+function redirect($url)
+{
+ global $board_config;
+
+ $server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://';
+ $server_name = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($board_config['server_name']));
+ $script_name = preg_replace('/^\/?(.*?)\/?$/', '/\1', trim($board_config['script_path']));
+ $server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) . '/' : '/';
+ $url = preg_replace('/^\/?(.*?)\/?$/', '\1', trim($url));
+
+ // If redirects don't work for you, first make sure you've entered your server (domain) name,
+ // script path, protocol (insecure (http://) or secure (https://) cookie) and port
+ // correctly in admin -> general -> configuration ... if they are fine, uncomment the following
+ // line and replace 'Location: ' . with $header_location . in the line following it.
+
+// $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
+ header('Location: ' . $server_protocol . $server_name . $script_name . $server_port . $url);
+ exit;
+}
+
+?>
\ No newline at end of file
diff --git a/phpBB/includes/functions_post.php b/phpBB/includes/functions_post.php
index 4016320f22..0828ef8794 100644
--- a/phpBB/includes/functions_post.php
+++ b/phpBB/includes/functions_post.php
@@ -303,7 +303,7 @@ function submit_post($mode, &$post_data, &$message, &$meta, &$forum_id, &$topic_
//
// Add poll
//
- if ( ( $mode == 'newtopic' || $mode == 'editpost' ) && !empty($poll_title) && count($poll_options) >= 2 )
+ if (($mode == 'newtopic' || ($mode == 'editpost' && $post_data['edit_poll'])) && !empty($poll_title) && count($poll_options) >= 2)
{
$sql = ( !$post_data['has_poll'] ) ? "INSERT INTO " . VOTE_DESC_TABLE . " (topic_id, vote_text, vote_start, vote_length) VALUES ($topic_id, '$poll_title', $current_time, " . ( $poll_length * 86400 ) . ")" : "UPDATE " . VOTE_DESC_TABLE . " SET vote_text = '$poll_title', vote_length = " . ( $poll_length * 86400 ) . " WHERE topic_id = $topic_id";
if ( !$db->sql_query($sql) )
diff --git a/phpBB/includes/usercp_email.php b/phpBB/includes/usercp_email.php
index eaa048fc50..4df0ec4bde 100644
--- a/phpBB/includes/usercp_email.php
+++ b/phpBB/includes/usercp_email.php
@@ -38,8 +38,7 @@ else
if ( !$userdata['session_logged_in'] )
{
- header('Location: ' . append_sid("login.$phpEx?redirect=profile.$phpEx&mode=email&" . POST_USERS_URL . "=$user_id", true));
- exit;
+ redirect(append_sid("login.$phpEx?redirect=profile.$phpEx&mode=email&" . POST_USERS_URL . "=$user_id", true));
}
$sql = "SELECT username, user_email, user_viewemail, user_lang
diff --git a/phpBB/login.php b/phpBB/login.php
index f824511520..d6f3ef07b0 100644
--- a/phpBB/login.php
+++ b/phpBB/login.php
@@ -40,8 +40,6 @@ init_userprefs($userdata);
// End session management
//
-$header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
-
if( isset($HTTP_POST_VARS['login']) || isset($HTTP_GET_VARS['login']) || isset($HTTP_POST_VARS['logout']) || isset($HTTP_GET_VARS['logout']) )
{
//
@@ -66,8 +64,7 @@ if( isset($HTTP_POST_VARS['login']) || isset($HTTP_GET_VARS['login']) || isset($
{
if( $row['user_level'] != ADMIN && $board_config['board_disable'] )
{
- header($header_location . append_sid("index.$phpEx", true));
- exit;
+ redirect(append_sid("index.$phpEx", true));
}
else
{
@@ -79,16 +76,8 @@ if( isset($HTTP_POST_VARS['login']) || isset($HTTP_GET_VARS['login']) || isset($
if( $session_id )
{
- if( !empty($HTTP_POST_VARS['redirect']) )
- {
- header($header_location . append_sid($HTTP_POST_VARS['redirect'], true));
- exit;
- }
- else
- {
- header($header_location . append_sid("index.$phpEx", true));
- exit;
- }
+ $url = ( !empty($HTTP_POST_VARS['redirect']) ) ? $HTTP_POST_VARS['redirect'] : "index.$phpEx";
+ redirect(append_sid($url, true));
}
else
{
@@ -133,28 +122,18 @@ if( isset($HTTP_POST_VARS['login']) || isset($HTTP_GET_VARS['login']) || isset($
if (!empty($HTTP_POST_VARS['redirect']) || !empty($HTTP_GET_VARS['redirect']))
{
- $redirect = (!empty($HTTP_POST_VARS['redirect'])) ? $HTTP_POST_VARS['redirect'] : $HTTP_GET_VARS['redirect'];
- header($header_location . append_sid($redirect, true));
- exit;
+ $url = (!empty($HTTP_POST_VARS['redirect'])) ? $HTTP_POST_VARS['redirect'] : $HTTP_GET_VARS['redirect'];
+ redirect(append_sid($url, true));
}
else
{
- header($header_location . append_sid("index.$phpEx", true));
- exit;
+ redirect(append_sid("index.$phpEx", true));
}
}
else
{
- if( !empty($HTTP_POST_VARS['redirect']) )
- {
- header($header_location . append_sid($HTTP_POST_VARS['redirect'], true));
- exit;
- }
- else
- {
- header($header_location . append_sid("index.$phpEx", true));
- exit;
- }
+ $url = ( !empty($HTTP_POST_VARS['redirect']) ) ? $HTTP_POST_VARS['redirect'] : "index.$phpEx";
+ redirect(append_sid($url, true));
}
}
else
@@ -231,10 +210,9 @@ else
}
else
{
- header($header_location . append_sid("index.$phpEx", true));
- exit;
+ redirect(append_sid("index.$phpEx", true));
}
}
-?>
+?>
\ No newline at end of file
diff --git a/phpBB/modcp.php b/phpBB/modcp.php
index 1dde498038..31e52796bb 100644
--- a/phpBB/modcp.php
+++ b/phpBB/modcp.php
@@ -171,9 +171,7 @@ if ( isset($HTTP_POST_VARS['cancel']) )
$redirect = "index.$phpEx";
}
- $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
- header($header_location . append_sid($redirect, true));
- exit;
+ redirect(append_sid($redirect, true));
}
//
diff --git a/phpBB/posting.php b/phpBB/posting.php
index 948671e42c..d5392ae153 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -116,9 +116,7 @@ if ( isset($HTTP_POST_VARS['cancel']) )
$post_append = '';
}
- $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
- header($header_location . append_sid($redirect, true) . $post_append);
- exit;
+ redirect(append_sid($redirect, true) . $post_append);
}
//
@@ -368,9 +366,7 @@ if ( !$is_auth[$is_auth_type] )
break;
}
- $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
- header($header_location . append_sid("login.$phpEx?redirect=posting.$phpEx&" . $redirect, true));
- exit;
+ redirect(append_sid("login.$phpEx?redirect=posting.$phpEx&" . $redirect, true));
}
//
@@ -1063,7 +1059,7 @@ $template->assign_vars(array(
//
// Poll entry switch/output
//
-if( ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['first_post'] ) ) && $is_auth['auth_pollcreate'] )
+if( ( $mode == 'newtopic' || ( $mode == 'editpost' && $post_data['edit_poll']) ) && $is_auth['auth_pollcreate'] )
{
$template->assign_vars(array(
'L_ADD_A_POLL' => $lang['Add_poll'],
diff --git a/phpBB/privmsg.php b/phpBB/privmsg.php
index 2e06c0408a..207ef02894 100644
--- a/phpBB/privmsg.php
+++ b/phpBB/privmsg.php
@@ -83,9 +83,7 @@ init_userprefs($userdata);
//
if ( $cancel )
{
- $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
- header($header_location . append_sid("privmsg.$phpEx?folder=$folder", true));
- exit;
+ redirect(append_sid("privmsg.$phpEx?folder=$folder", true));
}
//
@@ -183,9 +181,7 @@ else if ( $mode == 'read' )
if ( !$userdata['session_logged_in'] )
{
- $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
- header($header_location . append_sid("login.$phpEx?redirect=privmsg.$phpEx&folder=$folder&mode=$mode&" . POST_POST_URL . "=$privmsgs_id", true));
- exit;
+ redirect(append_sid("login.$phpEx?redirect=privmsg.$phpEx&folder=$folder&mode=$mode&" . POST_POST_URL . "=$privmsgs_id", true));
}
//
@@ -245,9 +241,7 @@ else if ( $mode == 'read' )
//
if ( !($privmsg = $db->sql_fetchrow($result)) )
{
- $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
- header($header_location . append_sid("privmsg.$phpEx?folder=$folder", true));
- exit;
+ redirect(append_sid("privmsg.$phpEx?folder=$folder", true));
}
$privmsg_id = $privmsg['privmsgs_id'];
@@ -648,9 +642,7 @@ else if ( ( $delete && $mark_list ) || $delete_all )
{
if ( !$userdata['session_logged_in'] )
{
- $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
- header($header_location . append_sid("login.$phpEx?redirect=privmsg.$phpEx&folder=inbox", true));
- exit;
+ redirect(append_sid("login.$phpEx?redirect=privmsg.$phpEx&folder=inbox", true));
}
if ( isset($mark_list) && !is_array($mark_list) )
{
@@ -847,9 +839,7 @@ else if ( $save && $mark_list && $folder != 'savebox' && $folder != 'outbox' )
{
if ( !$userdata['session_logged_in'] )
{
- $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
- header($header_location . append_sid("login.$phpEx?redirect=privmsg.$phpEx&folder=inbox", true));
- exit;
+ redirect(append_sid("login.$phpEx?redirect=privmsg.$phpEx&folder=inbox", true));
}
//
@@ -953,9 +943,7 @@ else if ( $submit || $refresh || $mode != '' )
if ( !$userdata['session_logged_in'] )
{
$user_id = ( isset($HTTP_GET_VARS[POST_USERS_URL]) ) ? '&' . POST_USERS_URL . '=' . intval($HTTP_GET_VARS[POST_USERS_URL]) : '';
- $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
- header($header_location . append_sid("login.$phpEx?redirect=privmsg.$phpEx&folder=$folder&mode=$mode" . $user_id, true));
- exit;
+ redirect(append_sid("login.$phpEx?redirect=privmsg.$phpEx&folder=$folder&mode=$mode" . $user_id, true));
}
//
@@ -1319,9 +1307,7 @@ else if ( $submit || $refresh || $mode != '' )
if ( !($privmsg = $db->sql_fetchrow($result)) )
{
- $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
- header($header_location . append_sid("privmsg.$phpEx?folder=$folder", true));
- exit;
+ redirect(append_sid("privmsg.$phpEx?folder=$folder", true));
}
$privmsg_subject = $privmsg['privmsgs_subject'];
@@ -1359,9 +1345,7 @@ else if ( $submit || $refresh || $mode != '' )
if ( !($privmsg = $db->sql_fetchrow($result)) )
{
- $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
- header($header_location . append_sid("privmsg.$phpEx?folder=$folder", true));
- exit;
+ redirect(append_sid("privmsg.$phpEx?folder=$folder", true));
}
$privmsg_subject = ( ( !preg_match('/^Re:/', $privmsg['privmsgs_subject']) ) ? 'Re: ' : '' ) . $privmsg['privmsgs_subject'];
@@ -1691,9 +1675,7 @@ else if ( $submit || $refresh || $mode != '' )
//
if ( !$userdata['session_logged_in'] )
{
- $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
- header($header_location . append_sid("login.$phpEx?redirect=privmsg.$phpEx&folder=inbox", true));
- exit;
+ redirect(append_sid("login.$phpEx?redirect=privmsg.$phpEx&folder=inbox", true));
}
//
diff --git a/phpBB/profile.php b/phpBB/profile.php
index d544bbd570..42211d64d9 100644
--- a/phpBB/profile.php
+++ b/phpBB/profile.php
@@ -83,9 +83,7 @@ if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
{
if ( !$userdata['session_logged_in'] && $mode == 'editprofile' )
{
- $header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
- header($header_location . append_sid("login.$phpEx?redirect=profile.$phpEx&mode=editprofile", true));
- exit;
+ redirect(append_sid("login.$phpEx?redirect=profile.$phpEx&mode=editprofile", true));
}
include($phpbb_root_path . 'includes/usercp_register.'.$phpEx);
@@ -109,9 +107,7 @@ if ( isset($HTTP_GET_VARS['mode']) || isset($HTTP_POST_VARS['mode']) )
}
else
{
- $header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
- header($header_location . append_sid("index.$phpEx", true));
- exit;
+ redirect(append_sid("index.$phpEx", true));
}
-?>
+?>
\ No newline at end of file
diff --git a/phpBB/search.php b/phpBB/search.php
index 23677fcdef..fef6219c0b 100644
--- a/phpBB/search.php
+++ b/phpBB/search.php
@@ -162,8 +162,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
}
else
{
- header("Location: login.$phpEx?redirect=search.$phpEx&search_id=newposts", true);
- exit;
+ redirect(append_sid("login.$phpEx?redirect=search.$phpEx&search_id=newposts", true));
}
$show_results = 'topics';
@@ -180,8 +179,7 @@ else if ( $search_keywords != '' || $search_author != '' || $search_id )
}
else
{
- header("Location: login.$phpEx?redirect=search.$phpEx&search_id=egosearch", true);
- exit;
+ redirect(append_sid("login.$phpEx?redirect=search.$phpEx&search_id=egosearch", true));
}
$show_results = 'topics';
diff --git a/phpBB/upgrade.php b/phpBB/upgrade.php
index c3f3ba1100..8674641b8f 100644
--- a/phpBB/upgrade.php
+++ b/phpBB/upgrade.php
@@ -37,9 +37,7 @@ if ( !defined('INSTALLING') )
if( defined("PHPBB_INSTALLED") )
{
- $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
- header($header_location . " index.$phpEx");
- exit;
+ redirect("index.$phpEx);
}
}
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index 055d801f8d..fdd9499bb8 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -103,9 +103,7 @@ if ( !$is_auth['auth_read'] || !$is_auth['auth_view'] )
if ( !$userdata['session_logged_in'] )
{
$redirect = POST_FORUM_URL . "=$forum_id" . ( ( isset($start) ) ? "&start=$start" : '' );
- $header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
- header($header_location . append_sid("login.$phpEx?redirect=viewforum.$phpEx&$redirect", true));
- exit;
+ redirect(append_sid("login.$phpEx?redirect=viewforum.$phpEx&$redirect", true));
}
//
// The user is not authed to read this forum ...
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index 3eafc37003..843a8edba6 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -58,8 +58,6 @@ if ( isset($HTTP_GET_VARS['view']) && empty($HTTP_GET_VARS[POST_POST_URL]) )
{
if ( $HTTP_GET_VARS['view'] == 'newest' )
{
- $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
-
if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid']) || isset($HTTP_GET_VARS['sid']) )
{
$session_id = isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid']) ? $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid'] : $HTTP_GET_VARS['sid'];
@@ -88,14 +86,12 @@ if ( isset($HTTP_GET_VARS['view']) && empty($HTTP_GET_VARS[POST_POST_URL]) )
$post_id = $row['post_id'];
$SID = (isset($HTTP_GET_VARS['sid'])) ? 'sid=' . $session_id : '';
- header($header_location . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=$post_id#$post_id", true));
- exit;
+ redirect(append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=$post_id#$post_id", true));
}
}
$db->sql_close();
- header($header_location . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id", true));
- exit;
+ redirect(append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id", true));
}
else if ( $HTTP_GET_VARS['view'] == 'next' || $HTTP_GET_VARS['view'] == 'previous' )
{
@@ -178,9 +174,7 @@ if( !$is_auth['auth_view'] || !$is_auth['auth_read'] )
{
$redirect = ( isset($post_id) ) ? POST_POST_URL . "=$post_id" : POST_TOPIC_URL . "=$topic_id";
$redirect .= ( isset($start) ) ? "&start=$start" : '';
- $header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
- header($header_location . append_sid("login.$phpEx?redirect=viewtopic.$phpEx&$redirect", true));
- exit;
+ redirect(append_sid("login.$phpEx?redirect=viewtopic.$phpEx&$redirect", true));
}
$message = ( !$is_auth['auth_view'] ) ? $lang['Topic_post_not_exist'] : sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']);
@@ -296,9 +290,7 @@ else
{
if ( $HTTP_GET_VARS['unwatch'] == 'topic' )
{
- $header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: ";
- header($header_location . append_sid("login.$phpEx?redirect=viewtopic.$phpEx&" . POST_TOPIC_URL . "=$topic_id&unwatch=topic", true));
- exit;
+ redirect(append_sid("login.$phpEx?redirect=viewtopic.$phpEx&" . POST_TOPIC_URL . "=$topic_id&unwatch=topic", true));
}
}
else