hostname) && 0 != strcasecmp($sn->hostname, $servername)) { $sn->redirectToHostname(); } $dbhost = (empty($sn->dbhost)) ? 'localhost' : $sn->dbhost; $dbuser = (empty($sn->dbuser)) ? $sn->nickname : $sn->dbuser; $dbpass = $sn->dbpass; $dbname = (empty($sn->dbname)) ? $sn->nickname : $sn->dbname; $config['db']['database'] = "mysqli://$dbuser:$dbpass@$dbhost/$dbname"; $config['site']['name'] = $sn->sitename; if (!empty($sn->theme)) { $config['site']['theme'] = $sn->theme; } if (!empty($sn->logo)) { $config['site']['logo'] = $sn->logo; } return $sn; } else { return null; } } // Code partially mooked from http://www.richler.de/en/php-redirect/ // (C) 2006 by Heiko Richler http://www.richler.de/ // LGPL function redirectToHostname() { $destination = 'http://'.$this->hostname; $destination .= $_SERVER['REQUEST_URI']; $old = 'http'. (($_SERVER['HTTPS'] == 'on') ? 'S' : ''). '://'. $_SERVER['HTTP_HOST']. $_SERVER['REQUEST_URI']. $_SERVER['QUERY_STRING']; if ($old == $destination) { // this would be a loop! // error_log(...) ? return false; } header('HTTP/1.1 301 Moved Permanently'); header("Location: $destination"); print "$destination\n"; exit; } }