Example #1
0
 /**	 
  * delete a preview picture of a content
  * @param string $format
  * @param string $contentid
  * @param string $previewid
  * @return string xml/json
  */
 private function contentpreviewdelete($format, $contentid, $previewid)
 {
     $user = $this->checkpassword(true);
     $this->checktrafficlimit($user);
     $content = addslashes($contentid);
     $preview = addslashes($previewid);
     // fetch data
     $con = new OCSContent();
     if ($con->load($content)) {
         if ($con->is_preview_available($previewid)) {
             if ($con->is_owned(OCSUser::id())) {
                 $con->previewdelete($content, $preview);
                 $txt = $this->generatexml($format, 'ok', 100, '');
             } else {
                 $txt = $this->generatexml($format, 'failed', 101, 'no permission to change content');
             }
         } else {
             $txt = $this->generatexml($format, 'failed', 102, 'preview not found');
         }
     }
     echo $txt;
 }