summaryrefslogtreecommitdiff
path: root/classes/Status_network.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-01-09 16:19:45 -0800
committerEvan Prodromou <evan@status.net>2010-01-09 16:19:45 -0800
commit5ca41b68703e8d8e41325ab4dd9c798946fc7a10 (patch)
tree9f7f2b671af205835e38b3399ef5321c3b2f270f /classes/Status_network.php
parented5828f30ea0f7a30e01d407058990b06164c6f3 (diff)
redirect to sitename.wildcard for SSL
Diffstat (limited to 'classes/Status_network.php')
-rw-r--r--classes/Status_network.php18
1 files changed, 12 insertions, 6 deletions
diff --git a/classes/Status_network.php b/classes/Status_network.php
index b3117640d..8dff879df 100644
--- a/classes/Status_network.php
+++ b/classes/Status_network.php
@@ -150,9 +150,18 @@ class Status_network extends DB_DataObject
}
if (!empty($sn)) {
- if (!empty($sn->hostname) && 0 != strcasecmp($sn->hostname, $servername)) {
- $sn->redirectToHostname();
+
+ // Redirect to the right URL
+
+ if (!empty($sn->hostname) &&
+ empty($SERVER['HTTPS']) &&
+ 0 != strcasecmp($sn->hostname, $servername)) {
+ $sn->redirectTo('http://'.$sn->hostname.$_SERVER['REQUEST_URI']);
+ } else if (!empty($SERVER['HTTPS']) &&
+ 0 != strcasecmp($sn->sitename.'.'.$wildcard, $servername)) {
+ $sn->redirectTo('https://'.$sn->sitename.'.'.$wildcard.$_SERVER['REQUEST_URI']);
}
+
$dbhost = (empty($sn->dbhost)) ? 'localhost' : $sn->dbhost;
$dbuser = (empty($sn->dbuser)) ? $sn->nickname : $sn->dbuser;
$dbpass = $sn->dbpass;
@@ -179,11 +188,8 @@ class Status_network extends DB_DataObject
// (C) 2006 by Heiko Richler http://www.richler.de/
// LGPL
- function redirectToHostname()
+ function redirectTo($destination)
{
- $destination = 'http://'.$this->hostname;
- $destination .= $_SERVER['REQUEST_URI'];
-
$old = 'http'.
(($_SERVER['HTTPS'] == 'on') ? 'S' : '').
'://'.