Пример #1
0
 /**
  * Returns the base URI.
  * The base URI is 'protocol://server.name:port'
  * @return string
  */
 public static function urlbase($https = null)
 {
     $cache = DAV_Cache::inst('BeeHub');
     $URLBASE = $cache->get('urlbase');
     if (is_null($URLBASE)) {
         $URLBASE = array();
     }
     if (!@$URLBASE[$https]) {
         if (true === $https || !empty($_SERVER['HTTPS']) && null === $https) {
             $tmp = 'https://';
         } else {
             $tmp = 'http://';
         }
         $tmp .= $_SERVER['SERVER_NAME'];
         $server_port = intval($_SERVER['SERVER_PORT'], 10);
         if (!empty($_SERVER['HTTPS']) && $server_port !== 443 or empty($_SERVER['HTTPS']) && $server_port !== 80) {
             if (true === $https && empty($_SERVER['HTTPS'])) {
                 $server_port += 443 - 80;
             } elseif (false === $https && !empty($_SERVER['HTTPS'])) {
                 $server_port -= 443 - 80;
             }
             $tmp .= ":{$server_port}";
         }
         $URLBASE[$https] = $tmp;
         $cache->set('urlbase', $URLBASE);
     }
     return $URLBASE[$https];
 }
Пример #2
0
 /**
  * Returns the value of the Destination header
  * @return string either an (internal) path or an external URI.
  */
 public static function destination()
 {
     $cache = DAV_Cache::inst('DAV_Request');
     $destinationCache = $cache->get('destinationCache');
     if (is_null($destinationCache)) {
         $destinationCache = @$_SERVER['HTTP_DESTINATION'] ? DAV::parseURI($_SERVER['HTTP_DESTINATION'], false) : false;
         $cache->get('destinationCache', $destinationCache);
     }
     return $destinationCache === false ? null : $destinationCache;
 }
Пример #3
0
 /**
  * Set the (requested) path
  * @param   string  $urlencodedPath  The URL encoded path
  * @return  void
  */
 public static function setPath($urlencodedPath)
 {
     $cache = DAV_Cache::inst('DAV');
     $cache->set('path', DAV::parseURI($urlencodedPath, true));
 }