summaryrefslogtreecommitdiff
path: root/classes/Status_network.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-01-11 16:28:27 -0800
committerEvan Prodromou <evan@status.net>2010-01-11 16:28:27 -0800
commitecb3abf84c8b6e868a523b8e721484cb7a4e0f63 (patch)
treec27d9b8c427e0e64b0cabe9419c640ac8b382c3b /classes/Status_network.php
parenta180658a3bfcf2b7b312058e3aa76e0e2467c2f8 (diff)
parent7e5c15fa80e23d1fb22744553156bcebad716ae8 (diff)
Merge branch '0.9.x' into inblob
Diffstat (limited to 'classes/Status_network.php')
-rw-r--r--classes/Status_network.php25
1 files changed, 18 insertions, 7 deletions
diff --git a/classes/Status_network.php b/classes/Status_network.php
index b3117640d..776f6abb0 100644
--- a/classes/Status_network.php
+++ b/classes/Status_network.php
@@ -150,9 +150,19 @@ 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->hostname, $servername) &&
+ 0 != strcasecmp($sn->nickname.'.'.$wildcard, $servername)) {
+ $sn->redirectTo('https://'.$sn->nickname.'.'.$wildcard.$_SERVER['REQUEST_URI']);
}
+
$dbhost = (empty($sn->dbhost)) ? 'localhost' : $sn->dbhost;
$dbuser = (empty($sn->dbuser)) ? $sn->nickname : $sn->dbuser;
$dbpass = $sn->dbpass;
@@ -160,7 +170,11 @@ class Status_network extends DB_DataObject
$config['db']['database'] = "mysqli://$dbuser:$dbpass@$dbhost/$dbname";
- $config['site']['name'] = $sn->sitename;
+ $config['site']['name'] = $sn->sitename;
+
+ if (!empty($sn->hostname)) {
+ $config['site']['server'] = $sn->hostname;
+ }
if (!empty($sn->theme)) {
$config['site']['theme'] = $sn->theme;
@@ -179,11 +193,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' : '').
'://'.