]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
updates to Status_network
authorEvan Prodromou <evan@controlyourself.ca>
Mon, 15 Jun 2009 15:54:52 +0000 (08:54 -0700)
committerEvan Prodromou <evan@controlyourself.ca>
Mon, 15 Jun 2009 15:54:52 +0000 (08:54 -0700)
classes/Status_network.php
classes/statusnet.ini
db/site.sql

index f7747f71d762b1e4aa6950a11611885353f17cbc..d2b942bfb1000a15bfb841490e0262901a3036fc 100644 (file)
@@ -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;
index a70cd412280a8a4da36b38fdf500489e639a2180..8123265e46c879fd6ff043a3c498d40aca82aef9 100644 (file)
@@ -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
 
index 660ba475bb586edff429a7c271e8f434c96c2e96..a9f64e5a5d0c0f9eac3a30a1255db0b03eb451d1 100644 (file)
@@ -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'