summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-06-15 08:54:52 -0700
committerEvan Prodromou <evan@controlyourself.ca>2009-06-15 08:54:52 -0700
commiteb6a60ef8833d0a34768f2717f2a34fdcd52e5ce (patch)
tree1efa833549cf5eb137c78f5500c4446ae32b9df9
parent528ceec3fe351cfa3f5050159b2c9e37357e162a (diff)
updates to Status_network
-rw-r--r--classes/Status_network.php25
-rw-r--r--classes/statusnet.ini5
-rw-r--r--db/site.sql6
3 files changed, 29 insertions, 7 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
diff --git a/db/site.sql b/db/site.sql
index 660ba475b..a9f64e5a5 100644
--- a/db/site.sql
+++ b/db/site.sql
@@ -5,12 +5,16 @@ create table status_network (
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'