Exemplo n.º 1
0
 /**
  * Decodes the URLs in href attributes of PROPFIND responses.
  *
  * Konqueror does not use the <displayname> property (which is also URL
  * encoded), but the <href> tag of the response to determine the displayed
  * resource names. It expects the content to be un-encoded.
  *
  * This method calls the parent method and replaces the content of all
  * <href> elements in the DOM tree.
  * 
  * @param ezcWebdavPropFindResponse $response 
  * @return ezcWebdavXmlDisplayInformation
  */
 protected function processPropFindResponse(ezcWebdavPropFindResponse $response)
 {
     $xmlDisplayInfo = parent::processPropFindResponse($response);
     $hrefElements = $xmlDisplayInfo->body->getElementsByTagName('href');
     foreach ($hrefElements as $href) {
         $href->nodeValue = urldecode($href->nodeValue);
     }
     return $xmlDisplayInfo;
 }
Exemplo n.º 2
0
 /**
  * Post-processes <href/> XML elements to contain relative URIs.
  *
  * This is needed by Nautilus when auth is enabled.
  * 
  * @param ezcWebdavPropFindResponse $response 
  * @return ezcWebdavXmlDisplayInformation
  */
 protected function processPropFindResponse(ezcWebdavPropFindResponse $response)
 {
     $xmlDispInfo = parent::processPropFindResponse($response);
     $subResponses = $xmlDispInfo->body->getElementsByTagNameNS(ezcWebdavXmlTool::XML_DEFAULT_NAMESPACE, 'response');
     foreach ($subResponses as $subResponse) {
         $hrefs = $subResponse->getElementsByTagNameNS(ezcWebdavXmlTool::XML_DEFAULT_NAMESPACE, 'href');
         foreach ($hrefs as $href) {
             $href->nodeValue = parse_url($href->nodeValue, PHP_URL_PATH);
         }
     }
     return $xmlDispInfo;
 }
Exemplo n.º 3
0
 /**
  * Returns display information for a error response object.
  *
  * When receiving 'HTTP/1.1 404 Not Found', Konqueror (versions 3.5.8 and up)
  * requires a body. Normally the processErrorResponse functions does not
  * return a body for 404 messages, so this override method sets a body
  * for Konqueror.
  *
  * @param ezcWebdavErrorResponse $response 
  * @param bool $xml DOMDocument in result only generated of true.
  * @return ezcWebdavXmlDisplayInformation|ezcWebdavEmptyDisplayInformation
  */
 protected function processErrorResponse(ezcWebdavErrorResponse $response, $xml = false)
 {
     if ($response->status === 404) {
         $response->responseDescription = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
             <html><head>
             <title>404 Not Found</title>
             </head><body>
             <h1>Not Found</h1>
             <p>The requested URL was not found on this server.</p>
             <hr>
             </body></html>';
     }
     $xmlDisplayInfo = parent::processErrorResponse($response, $xml);
     return $xmlDisplayInfo;
 }
Exemplo n.º 4
0
    /**
     * Parses the PROPFIND request and returns a request object.
     *
     * Microsoft clients may send an empty request, so that we guess, that they
     * meant an allprop request, fill the body struct accordingly and then
     * dispatch to the original method.
     * 
     * @param string $path 
     * @param string $body 
     * @return ezcWebdavPropFindRequest
     */
    protected function parsePropFindRequest($path, $body)
    {
        // Empty request seem to actually mean an allprop request.
        if (trim($body) === '') {
            $body = '<?xml version="1.0" encoding="utf-8" ?>
<D:propfind xmlns:D="DAV:">
  <D:allprop/>
</D:propfind>';
        }
        return parent::parsePropFindRequest($path, $body);
    }
Exemplo n.º 5
0
 public function processErrorResponse(ezcWebdavErrorResponse $response, $xml = false)
 {
     return parent::processErrorResponse($response, $xml);
 }