1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-09 10:16:36 +02:00

redirect header changes

git-svn-id: file:///svn/phpbb/branches/phpBB-2_0_0@3154 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen
2002-11-30 21:37:45 +00:00
parent 6de7055e80
commit 4ef1441bea
16 changed files with 71 additions and 127 deletions

View File

@@ -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;
}
?>

View File

@@ -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) )

View File

@@ -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