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
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;
$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;
nickname varchar(64) primary key comment 'nickname',
hostname varchar(255) unique key comment 'alternate hostname if any',
pathname varchar(255) unique key comment 'alternate pathname if any',
- sitename varchar(255) comment 'display name',
+
dbhost varchar(255) comment 'database host',
dbuser varchar(255) comment 'database username',
dbpass varchar(255) comment 'database password',
dbname varchar(255) comment 'database name',
+ sitename varchar(255) comment 'display name',
+ theme varchar(255) comment 'theme name',
+ logo varchar(255) comment 'site logo',
+
created datetime not null comment 'date this record was created',
modified timestamp comment 'date this record was modified'