DAViCal
Loading...
Searching...
No Matches
caldav-DELTICKET.php
1<?php
20dbg_error_log('DELTICKET', 'method handler');
21require_once('DAVResource.php');
22
23if ( ! $request->HavePrivilegeTo('DAV::unbind') && $request->ticket->owner() != $session->principal_id ) {
24 $request->NeedPrivilege('DAV::unbind');
25}
26
27if ( ! isset($request->ticket) ) {
28 if ( isset($_GET['ticket']) || isset($_SERVER['HTTP_TICKET']) ) {
29 $r = new DAVResource($request->path);
30 if ( ! $r->Exists() ) {
31 $request->PreconditionFailed(404,'not-found');
32 }
33 else {
34 $request->PreconditionFailed(412,'ticket-does-not-exist','The specified ticket does not exist');
35 }
36 }
37 else
38 $request->MalformedRequest('No ticket specified');
39}
40
41$qry = new AwlQuery('DELETE FROM access_ticket WHERE ticket_id=:ticket_id', array( ':ticket_id' => $request->ticket->id() ) );
42if ( $qry->Exec('DELTICKET', __LINE__, __FILE__) ) {
43 $request->DoResponse( 204 );
44}
45$request->DoResponse( 500 );