Пример #1
0
 function testDefaultInputStream()
 {
     $h = fopen('php://memory', 'r+');
     fwrite($h, 'testing');
     rewind($h);
     $previousValue = Sabre_HTTP_Request::$defaultInputStream;
     Sabre_HTTP_Request::$defaultInputStream = $h;
     $this->assertEquals('testing', $this->request->getBody(true), 'We didn\'t get our testbody back');
     Sabre_HTTP_Request::$defaultInputStream = $previousValue;
 }
Пример #2
0
 /**
  * HTTP REPORT method implementation
  *
  * Although the REPORT method is not part of the standard WebDAV spec (it's from rfc3253)
  * It's used in a lot of extensions, so it made sense to implement it into the core.
  *
  * @param string $uri
  * @return void
  */
 protected function httpReport($uri)
 {
     $body = $this->httpRequest->getBody(true);
     $dom = Sabre_DAV_XMLUtil::loadDOMDocument($body);
     $reportName = Sabre_DAV_XMLUtil::toClarkNotation($dom->firstChild);
     if ($this->broadcastEvent('report', array($reportName, $dom, $uri))) {
         // If broadcastEvent returned true, it means the report was not supported
         throw new Sabre_DAV_Exception_ReportNotImplemented();
     }
 }
Пример #3
0
 /**
  * HTTP REPORT method implementation
  *
  * Although the REPORT method is not part of the standard WebDAV spec (it's from rfc3253)
  * It's used in a lot of extensions, so it made sense to implement it into the core.
  * 
  * @return void
  */
 protected function httpReport()
 {
     $body = $this->httpRequest->getBody(true);
     //We'll need to change the DAV namespace declaration to something else in order to make it parsable
     $body = preg_replace("/xmlns(:[A-Za-z0-9_]*)?=(\"|\\')DAV:(\"|\\')/", "xmlns\\1=\"urn:DAV\"", $body);
     $errorsetting = libxml_use_internal_errors(true);
     libxml_clear_errors();
     $dom = new DOMDocument();
     $dom->loadXML($body);
     $dom->preserveWhiteSpace = false;
     $namespaceUri = $dom->firstChild->namespaceURI;
     if ($namespaceUri == 'urn:DAV') {
         $namespaceUri = 'DAV:';
     }
     $reportName = '{' . $namespaceUri . '}' . $dom->firstChild->localName;
     if ($this->broadcastEvent('report', array($reportName, $dom))) {
         // If broadcastEvent returned true, it means the report was not supported
         throw new Sabre_DAV_Exception_ReportNotImplemented();
     }
 }