/** * Get the default network * * @return object A Network object, NEVER returns null. * * @static * @access public */ public static function getDefaultNetwork() { $retval = null; $vhost = VirtualHost::getCurrentVirtualHost(); if ($vhost == null) { $vhost = VirtualHost::getDefaultVirtualHost(); } return $vhost->getDefaultNetwork(); }
*/ /* This section deals with PATHs used in URLs and local content * BASE_SSL_PATH should be used to enter SSL mode (if available) * BASE_NON_SSL_PATH should be used to break out of SSL mode of when we * explicitely do not want someting to be referenced over http * BASE_URL_PATH should be used in all other cases to avoid needless SSL warning * * */ require_once 'classes/VirtualHost.php'; /** * Check for SSL support */ try { $vhost = VirtualHost::getCurrentVirtualHost(); if ($vhost == null) { $vhost = VirtualHost::getDefaultVirtualHost(); } if ($vhost->isSSLAvailable()) { /** * @ignore */ define("SSL_AVAILABLE", true); } else { /** * @ignore */ define("SSL_AVAILABLE", false); } } catch (Exception $e) { //Leave this catch here, in case the schema update hasn't yet been done. define("SSL_AVAILABLE", false);
/** * Set as the default server * * @param VirtualHost $vhost * * @return bool True on success, false on failure */ public function setDefaultVirtualHost(VirtualHost $vhost) { $db = AbstractDb::getObject(); $vhostIdStr = $db->escapeString($vhost->getId()); // Init values $_retVal = false; if ($vhostIdStr != VirtualHost::getDefaultVirtualHost()->getId()) { $sql = "UPDATE server SET default_virtual_host = '{$vhostIdStr}';\n"; $_retVal = $db->execSqlUpdate($sql, false); $this->refresh(); } return $_retVal; }
/** * Is this vhost the server's default? * * @return bool True or false */ public function isDefaultVirtualHost() { // Init values $retVal = false; if (VirtualHost::getDefaultVirtualHost()->getId() == $this->getId()) { $retVal = true; } return $retVal; }