/** * Flattens a processed response object to headers and body. * * Takes a given {@link ezcWebdavDisplayInformation} object and returns an * array containg the headers and body it represents. * * The returned information can be processed (send out to the client) by * {@link ezcWebdavTransport::sendResponse()}. * * @param ezcWebdavDisplayInformation $info * @return ezcWebdavOutputResult */ protected function flattenResponse(ezcWebdavDisplayInformation $info) { $output = parent::flattenResponse($info); // Add MS specific header $output->headers['MS-Author-Via'] = 'DAV'; // MS seems always want it this way, even when we do not support // locking $output->headers['DAV'] = '1, 2'; // Add date namespace to response elements for MS clients // // Mimic Apache mod_dav behaviour for DAV: namespace $output->body = preg_replace('(<D:response([^>]*)>)', '<D:response\\1 xmlns:lp1="DAV:" xmlns:lp2="http://apache.org/dav/props/" xmlns:ns0="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/">', $output->body); // Set creationdate namespace $output->body = preg_replace('(<D:creationdate([^>]*)>)', '<D:creationdate\\1 ns0:dt="dateTime.tz">', $output->body); // Set getlastmodified namespace $output->body = preg_replace('(<D:getlastmodified([^>]*)>)', '<D:getlastmodified\\1 ns0:dt="dateTime.rfc1123">', $output->body); // Put some elements in DAV: namespace with other namespace identifier // to mimic Apache mod_dav behaviour for DAV: namespace $output->body = preg_replace('(D:(resourcetype|creationdate|getlastmodified|getetag)([^>]*))', 'lp1:\\1\\2', $output->body); // Remove all unessecary whitespaces $output->body = preg_replace('(>\\s+<)', '><', $output->body); // MS IE7 requires a newline after the XML. $output->body .= "\n"; return $output; }
/** * Flattens a processed response object to headers and body. * * Takes a given {@link ezcWebdavDisplayInformation} object and returns an * array containg the headers and body it represents. * * The returned information can be processed (send out to the client) by * {@link ezcWebdavTransport::sendResponse()}. * * @param ezcWebdavDisplayInformation $info * @return ezcWebdavOutputResult */ protected function flattenResponse(ezcWebdavDisplayInformation $info) { $output = parent::flattenResponse($info); // Add MS specific header $output->headers['MS-Author-Via'] = 'DAV'; // MS seems always want it this way, even when we do not support // locking $output->headers['DAV'] = '1, 2'; if ($info instanceof ezcWebdavXmlDisplayInformation) { // Only mangle output if XML is to be sent (which does not include // GET of XML files, but only response XML). $this->mangleXml($output); } return $output; }
public function flattenResponse(ezcWebdavDisplayInformation $info) { return parent::flattenResponse($info); }