openrat-webdav

git clone http://git.code.weiherhei.de/openrat-webdav.git
Log | Files | Refs | README

DELETE.class.php (1584B)


      1 <?php
      2 
      3 class DAV_DELETE extends DAV
      4 {
      5 
      6 		
      7 	/**
      8 	 * Deletion.
      9 	 */		
     10 	public function execute()
     11 	{
     12 		if	( $this->readonly )
     13 		{
     14 			$this->httpForbidden(); // Kein Schreibzugriff erlaubt
     15 		}
     16 		else
     17 		{
     18 			if	( ! $this->request->exists() )
     19 			{
     20 				// Nicht existente URIs kann man auch nicht loeschen.
     21 				$this->httpStatus('404 Not Found' );
     22 			}
     23 			else
     24 			{
     25 			    switch( $this->request->type )
     26                 {
     27                     case URIParser::ROOT:
     28                         $this->httpForbidden();
     29                         break;
     30 
     31                     case URIParser::PROJECT:
     32                         // Dangerous - but possible.
     33                         $this->client->projectDelete($this->request->projectid);
     34                         break;
     35 
     36                     case URIParser::FOLDER:
     37                         $this->client->folderDelete($this->request->objectid);
     38                         break;
     39 
     40                     case 'page':
     41                         $this->client->pageDelete($this->request->objectid);
     42                         break;
     43 
     44                     case 'file':
     45                         $this->client->fileDelete($this->request->objectid);
     46                         break;
     47 
     48                     case 'image':
     49                         $this->client->imageDelete($this->request->objectid);
     50                         break;
     51 
     52                     case 'text':
     53                         $this->client->textDelete($this->request->objectid);
     54                         break;
     55 
     56                     default:
     57                         $this->httpForbidden();
     58                 }
     59 			}
     60 
     61 		}
     62 	}
     63 
     64 }