Example #1
0
 public function remove($content)
 {
     $person = OCSUser::id();
     EDatabase::q("DELETE FROM ocs_fan WHERE person={$person} and content={$content}");
     //part needed for activity
     $con = new OCSContent();
     $con->load($content);
     OCSActivity::add(OCSUser::id(), 10, OCSUser::login() . " is no longer fan of " . $con->name);
 }
Example #2
0
 /**	 
  * delete a content
  * @param string $format
  * @param string $contentid
  * @return string xml/json
  */
 private function contentdelete($format, $contentid)
 {
     $user = $this->checkpassword(true);
     $this->checktrafficlimit($user);
     $content = addslashes($contentid);
     // fetch data
     $con = new OCSContent();
     if (!$con->load($content)) {
         $txt = $this->generatexml($format, 'failed', 101, 'no permission to change content');
     } else {
         if (!$con->is_owned(OCSUser::id())) {
             $txt = $this->generatexml($format, 'failed', 101, 'no permission to change content');
         } else {
             $con->delete();
             $txt = $this->generatexml($format, 'ok', 100, '');
         }
     }
     echo $txt;
 }