Exemplo n.º 1
0
 /**
  * Returns the base URI.
  * The base URI is 'protocol://server.name:port'
  * @return string
  */
 public static function urlbase()
 {
     if (is_null(self::$URLBASE)) {
         //DAV::debug('$_SERVER: ' . var_export($_SERVER, true));
         self::$URLBASE = empty($_SERVER['HTTPS']) ? 'http://' : 'https://';
         self::$URLBASE .= $_SERVER['SERVER_NAME'];
         if (!empty($_SERVER['HTTPS']) && $_SERVER['SERVER_PORT'] != 443 or empty($_SERVER['HTTPS']) && $_SERVER['SERVER_PORT'] != 80) {
             self::$URLBASE .= ":{$_SERVER['SERVER_PORT']}";
         }
     }
     return self::$URLBASE;
 }