Esempio n. 1
0
 public function delete($id)
 {
     //post id
     $tid = (int) $id;
     $topic = new \CODOF\Forum\Topic($this->db);
     $topic_info = $topic->get_topic_info($tid);
     $cid = $topic_info['cat_id'];
     $tuid = $topic_info['uid'];
     if ($topic->canViewTopic($tuid, $cid, $tid) && $topic->canDeleteTopic($tuid, $cid, $tid)) {
         $isSpam = $_POST['isSpam'];
         if ($isSpam == 'yes') {
             $text = \DB::table(PREFIX . 'codo_posts AS p')->join(PREFIX . 'codo_topics AS t', 'p.topic_id', '=', 't.topic_id')->where('t.topic_id', '=', $tid)->pluck('p.imessage');
             $filter = new \CODOF\SpamFilter();
             $filter->spam($text);
         }
         //Set topic as deleted
         $topic->delete($cid, $tid);
         //update all posts linked with this topic as deleted
         $post = new \CODOF\Forum\Post($this->db);
         $post->deleteOfTopic($cid, $tid);
         echo 'success';
     } else {
         exit('access denied');
     }
 }