mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-08-31 18:46:02 +00:00
Refactoring to simplify XMLResponse output.
This commit is contained in:
parent
e3ee397008
commit
902219d154
@ -456,6 +456,19 @@ class CalDAVRequest
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an XML Response. This function will never return.
|
||||
*
|
||||
* @param int $status The HTTP status to respond
|
||||
* @param XMLElement $xmltree An XMLElement tree to be rendered
|
||||
*/
|
||||
function XMLResponse( $status, $xmltree ) {
|
||||
$xmldoc = $xmltree->Render(0,'<?xml version="1.0" encoding="utf-8" ?>');
|
||||
$etag = md5($xmldoc);
|
||||
header("ETag: \"$etag\"");
|
||||
$request->DoResponse( $status, $xmldoc, 'text/xml; charset="utf-8"' );
|
||||
exit(0); // Unecessary, but might clarify things
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility function we call when we have a simple status-based response to
|
||||
|
||||
@ -377,9 +377,6 @@ for ( $i=0; $i <= $reportnum; $i++ ) {
|
||||
}
|
||||
$multistatus = new XMLElement( "multistatus", $responses, array('xmlns'=>'DAV:') );
|
||||
|
||||
$xmldoc = $multistatus->Render(0,'<?xml version="1.0" encoding="utf-8" ?>');
|
||||
$etag = md5($xmldoc);
|
||||
header("ETag: \"$etag\"");
|
||||
$request->DoResponse( 207, $xmldoc, 'text/xml; charset="utf-8"' );
|
||||
$request->XMLResponse( 207, $multistatus );
|
||||
|
||||
?>
|
||||
Loading…
x
Reference in New Issue
Block a user