From 9cac5c8730ad574cb4c1c9d4139a74d859215596 Mon Sep 17 00:00:00 2001 From: x2003bruneau Date: Sat, 8 Jul 2006 16:21:12 +0000 Subject: [PATCH] Do full URL redirection instead of Location: ?... This fixes behaviour of some browsers (Safari suxxx) git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@58 9869982d-c50d-0410-be91-f2a2ec7c7c7b --- Changelog | 1 + banana/banana.inc.php.in | 4 ++-- banana/misc.inc.php | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/Changelog b/Changelog index 79f5e0b..d473269 100644 --- a/Changelog +++ b/Changelog @@ -1,6 +1,7 @@ Sat, 08 Jul 2006 Florent Bruneau * Automatically set fup for crossposts + * Full URL redirection ================================================================================ VERSION 1.3 diff --git a/banana/banana.inc.php.in b/banana/banana.inc.php.in index 7ff9f5e..4f4a076 100644 --- a/banana/banana.inc.php.in +++ b/banana/banana.inc.php.in @@ -294,7 +294,7 @@ class Banana if ($this->nntp->post($msg)) { $this->spool->delid($id); $this->nntp->quit(); - header("Location: ?group=$group&first=$id"); + redirect('group=' . $group . '&first=' . $id); } else { return '

'._b_('Impossible d\'annuler le message').'

'; } @@ -425,7 +425,7 @@ class Banana $msg .= $this->custom.$this->profile['customhdr']."\n".$body; if ($this->nntp->post($msg)) { - header("Location: ?group=$group".($artid==-1 ? '' : "&first=$artid")); + redirect('group=' . $group . ($artid == -1 ? '' : '&first=' . $artid)); } else { return "

"._b_('Impossible de poster le message')."

".$this->action_showThread($group, $artid); } diff --git a/banana/misc.inc.php b/banana/misc.inc.php index f57ed8e..bea2223 100644 --- a/banana/misc.inc.php +++ b/banana/misc.inc.php @@ -30,6 +30,20 @@ function textFormat_translate($format) } } +function redirect($params) +{ + header('Location: ' . makeLink($params)); +} + +function makeLink($params) +{ + $proto = empty($_SERVER['HTTPS']) ? 'http://' : 'http://'; + $host = $_SERVER['HTTP_HOST']; + $file = $_SERVER['PHP_SELF']; + + return $proto . $host . $file . '?' . $params; +} + /******************************************************************************** * HTML STUFF * Taken from php.net -- 2.1.4