Return network from network setup function

Return the network from the network setup function. Also, special-case
for when we get a server name the same as the wildcard.
This commit is contained in:
Evan Prodromou 2009-06-15 13:34:52 -07:00
parent c077ad0775
commit d6ff702d7f

View File

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