Exemplo n.º 1
0
 /**
  * Mount instructions method handler for directories
  *
  * @param  ilObjectDAV  dav object handler
  * @return This function does not return. It exits PHP.
  */
 private function showMountInstructions(&$objDAV, &$options)
 {
     global $lng, $ilUser;
     $path = $this->davDeslashify($options['path']);
     // The $path variable may contain a full or a shortened DAV path.
     // We convert it into an object path, which we can then use to
     // construct a new full DAV path.
     $objectPath = $this->toObjectPath($path);
     // Construct a (possibly) full DAV path from the object path.
     $fullPath = '';
     foreach ($objectPath as $object) {
         if ($object->getRefId() == 1 && $this->isFileHidden($object)) {
             // If the repository root object is hidden, we can not
             // create a full path, because nothing would appear in the
             // webfolder. We resort to a shortened path instead.
             $fullPath .= '/ref_1';
         } else {
             $fullPath .= '/' . $this->davUrlEncode($object->getResourceName());
         }
     }
     // Construct a shortened DAV path from the object path.
     $shortenedPath = '/ref_' . $objectPath[count($objectPath) - 1]->getRefId();
     if ($objDAV->isCollection()) {
         $shortenedPath .= '/';
         $fullPath .= '/';
     }
     // Prepend client id to path
     $shortenedPath = '/' . CLIENT_ID . $shortenedPath;
     $fullPath = '/' . CLIENT_ID . $fullPath;
     // Construct webfolder URI's. The URI's are used for mounting the
     // webfolder. Since mounting using URI's is not standardized, we have
     // to create different URI's for different browsers.
     $webfolderURI = $this->base_uri . $shortenedPath;
     $webfolderURI_Konqueror = ($this->isWebDAVoverHTTPS() ? "webdavs" : "webdav") . substr($this->base_uri, strrpos($this->base_uri, ':')) . $shortenedPath;
     $webfolderURI_Nautilus = ($this->isWebDAVoverHTTPS() ? "davs" : "dav") . substr($this->base_uri, strrpos($this->base_uri, ':')) . $shortenedPath;
     $webfolderURI_IE = $this->base_uri . $shortenedPath;
     $webfolderTitle = $objectPath[count($objectPath) - 1]->getResourceName();
     header('Content-Type: text/html; charset=UTF-8');
     echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
     echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN\"\n";
     echo "\t\"http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd\">\n";
     echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
     echo "  <head>\n";
     echo "  <title>" . sprintf($lng->txt('webfolder_instructions_titletext'), $webfolderTitle) . "</title>\n";
     echo "  </head>\n";
     echo "  <body>\n";
     echo ilDAVServer::_getWebfolderInstructionsFor($webfolderTitle, $webfolderURI, $webfolderURI_IE, $webfolderURI_Konqueror, $webfolderURI_Nautilus, $this->clientOS, $this->clientOSFlavor);
     echo "  </body>\n";
     echo "</html>\n";
     // Logout anonymous user to force authentication after calling mount uri
     if ($ilUser->getId() == ANONYMOUS_USER_ID) {
         $GLOBALS['ilAuth']->logout();
         session_destroy();
     }
     exit;
 }