Do full URL redirection instead of Location: ?...
authorx2003bruneau <x2003bruneau@9869982d-c50d-0410-be91-f2a2ec7c7c7b>
Sat, 8 Jul 2006 16:21:12 +0000 (16:21 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 4 Jan 2008 23:34:46 +0000 (00:34 +0100)
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
banana/banana.inc.php.in
banana/misc.inc.php

index 79f5e0b..d473269 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,7 @@
 Sat, 08 Jul 2006                    Florent Bruneau <florent.bruneau@m4x.org>
 
        * Automatically set fup for crossposts
+       * Full URL redirection
 
 ================================================================================
 VERSION 1.3
index 7ff9f5e..4f4a076 100644 (file)
@@ -294,7 +294,7 @@ class Banana
         if ($this->nntp->post($msg)) {
             $this->spool->delid($id);
             $this->nntp->quit();
-            header("Location: ?group=$group&amp;first=$id");
+            redirect('group=' . $group . '&amp;first=' . $id);
         } else {
             return '<p class="error">'._b_('Impossible d\'annuler le message').'</p>';
         }
@@ -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 "<p class=\"error\">"._b_('Impossible de poster le message')."</p>".$this->action_showThread($group, $artid);
         }
index f57ed8e..bea2223 100644 (file)
@@ -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