]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Return network from network setup function
authorEvan Prodromou <evan@controlyourself.ca>
Mon, 15 Jun 2009 20:34:52 +0000 (13:34 -0700)
committerEvan Prodromou <evan@controlyourself.ca>
Mon, 15 Jun 2009 20:34:52 +0000 (13:34 -0700)
Return the network from the network setup function. Also, special-case
for when we get a server name the same as the wildcard.

classes/Status_network.php

index d2b942bfb1000a15bfb841490e0262901a3036fc..96b6d9a05bb98e00a835a34ddd545b4693325bfb 100644 (file)
@@ -43,12 +43,19 @@ class Status_network extends DB_DataObject
     {
         global $config;
 
+        $sn = null;
+
         // XXX I18N, probably not crucial for hostnames
         // XXX This probably needs a tune up
 
         if (0 == strncasecmp(strrev($wildcard), strrev($servername), strlen($wildcard))) {
-            $parts = explode('.', $servername);
-            $sn = Status_network::staticGet('nickname', strtolower($parts[0]));
+            // special case for exact match
+            if (0 == strncmp($servername, $wildcard)) {
+                $sn = Status_network::staticGet('nickname', '');
+            } else {
+                $parts = explode('.', $servername);
+                $sn = Status_network::staticGet('nickname', strtolower($parts[0]));
+            }
         } else {
             $sn = Status_network::staticGet('hostname', strtolower($servername));
         }
@@ -70,9 +77,9 @@ class Status_network extends DB_DataObject
                 $config['site']['logo'] = $sn->logo;
             }
 
-            return true;
+            return $sn;
         } else {
-            return false;
+            return null;
         }
     }
 }