From c73baa8488c1a527dde71030fb4ebfd710fa6c38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emmanuel=20Beno=C3=AEt?= Date: Mon, 6 Feb 2012 15:06:16 +0100 Subject: [PATCH] Redirection fix Redirection worked fine as long as the server was using HTTP. HTTPS was a different matter entirely. Location headers will now be sent with full protocol, server name and port. --- includes/core/page.inc.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/includes/core/page.inc.php b/includes/core/page.inc.php index b9a5b47..704ec12 100644 --- a/includes/core/page.inc.php +++ b/includes/core/page.inc.php @@ -11,6 +11,9 @@ abstract class Page public function __construct( ) { $this->baseURL = dirname( $_SERVER[ 'SCRIPT_NAME' ] ); + if ( $this->baseURL == '/' ) { + $this->baseURL = ''; + } } public final function addController( Controller $controller ) @@ -52,6 +55,8 @@ abstract class Page if ( $rc{0} != '/' ) { $rc = $this->baseURL . '/' . $rc; } + $rc = ( $_SERVER[ 'HTTPS' ] ? 'https' : 'http' ) . '://' . $_SERVER[ 'SERVER_NAME' ] + . ':' . $_SERVER[ 'SERVER_PORT' ] . $rc; header( "Location: $rc" ); $rv = true; }