public static function _setMultisite() { if ((int) self::getConfig_Param('multisite', 0)) { self::$_host = JURI::getInstance()->getHost(); self::$_sites = JCckDatabase::loadObjectList('SELECT id, title, name, guest, guest_only_viewlevel, groups, viewlevels, configuration, options FROM #__cck_core_sites WHERE published = 1', 'name'); return true; } else { return false; } }
public static function _setMultisite() { if ((int) self::getConfig_Param('multisite', 0)) { $alias = ''; $host = JURI::getInstance()->getHost(); $path = JURI::getInstance()->getPath(); $host2 = ''; if ($path) { $path = substr($path, 1); $path = substr($path, 0, strpos($path, '/')); $host2 = $host . '/' . $path; } self::$_sites = JCckDatabase::loadObjectList('SELECT id, title, name, aliases, guest, guest_only_viewlevel, groups, viewlevels, configuration, options FROM #__cck_core_sites WHERE published = 1', 'name'); if (count(self::$_sites)) { $break = 0; foreach (self::$_sites as $s) { if ($s->aliases != '') { $aliases = explode('||', $s->aliases); if (count($aliases)) { foreach ($aliases as $a) { if (strpos($a, '/') !== false) { if ($a == $host2) { $alias = $a; $host = $s->name; $break = 1; break; } } else { if ($a == $host) { $alias = $a; $host = $s->name; $break = 1; break; } } } } if ($break) { break; } } } } self::$_host = $host; if (isset(self::$_sites[$host])) { self::$_sites[$host]->host = $alias ? $alias : self::$_sites[$host]->name; } return true; } else { return false; } }