Check XML is present, and also do need-privileges response.

This commit is contained in:
Andrew McMillan 2010-03-05 12:18:09 +13:00
parent dc72ddf3a8
commit da6e9a07e2

View File

@ -3,11 +3,23 @@
* We support both LOCK and UNLOCK methods in this function
*/
require_once('XMLDocument.php');
$reply = new XMLDocument(array( 'DAV:' => '' ));
if ( ! $request->AllowedTo('write') ) {
$request->DoResponse( 403, translate("You do not have sufficient access to lock that") );
$request->NeedPrivilege( 'write', $request->path );
}
if ( ! isset($request->xml_tags) ) {
if ( isset($request->lock_token) ) {
// It's OK for LOCK refresh requests to be empty.
$request->xml_tags = array();
}
else {
$request->XMLResponse( 400, new XMLElement( 'error', new XMLElement('missing-xml-for-request'), $reply->GetXmlNsArray() ) );
}
}
require_once("XMLElement.php");
$unsupported = array();
$lockinfo = array();