diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-06-15 08:54:52 -0700 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-06-15 08:54:52 -0700 |
commit | eb6a60ef8833d0a34768f2717f2a34fdcd52e5ce (patch) | |
tree | 1efa833549cf5eb137c78f5500c4446ae32b9df9 /classes | |
parent | 528ceec3fe351cfa3f5050159b2c9e37357e162a (diff) |
updates to Status_network
Diffstat (limited to 'classes')
-rw-r--r-- | classes/Status_network.php | 25 | ||||
-rw-r--r-- | classes/statusnet.ini | 5 |
2 files changed, 24 insertions, 6 deletions
diff --git a/classes/Status_network.php b/classes/Status_network.php index f7747f71d..d2b942bfb 100644 --- a/classes/Status_network.php +++ b/classes/Status_network.php @@ -12,11 +12,13 @@ class Status_network extends DB_DataObject public $nickname; // varchar(64) primary_key not_null public $hostname; // varchar(255) unique_key public $pathname; // varchar(255) unique_key - public $sitename; // varchar(255) public $dbhost; // varchar(255) public $dbuser; // varchar(255) public $dbpass; // varchar(255) public $dbname; // varchar(255) + public $sitename; // varchar(255) + public $theme; // varchar(255) + public $logo; // varchar(255) public $created; // datetime() not_null public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP @@ -37,13 +39,19 @@ class Status_network extends DB_DataObject return true; } - static function setupSite($servername, $pathname) + static function setupSite($servername, $pathname, $wildcard) { global $config; - $parts = explode('.', $servername); + // XXX I18N, probably not crucial for hostnames + // XXX This probably needs a tune up - $sn = Status_network::staticGet('nickname', $parts[0]); + if (0 == strncasecmp(strrev($wildcard), strrev($servername), strlen($wildcard))) { + $parts = explode('.', $servername); + $sn = Status_network::staticGet('nickname', strtolower($parts[0])); + } else { + $sn = Status_network::staticGet('hostname', strtolower($servername)); + } if (!empty($sn)) { $dbhost = (empty($sn->dbhost)) ? 'localhost' : $sn->dbhost; @@ -52,7 +60,16 @@ class Status_network extends DB_DataObject $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 true; } else { return false; diff --git a/classes/statusnet.ini b/classes/statusnet.ini index a70cd4122..8123265e4 100644 --- a/classes/statusnet.ini +++ b/classes/statusnet.ini @@ -1,13 +1,14 @@ - [status_network] nickname = 130 hostname = 2 pathname = 2 -sitename = 2 dbhost = 2 dbuser = 2 dbpass = 2 dbname = 2 +sitename = 2 +theme = 2 +logo = 2 created = 142 modified = 384 |