コード例 #1
0
ファイル: forum.worker.php プロジェクト: TheDoxMedia/pgs
 private function delete_post($post_id)
 {
     if ($this->user['SiteRank'] >= 4) {
         $post = post::get($post_id);
         if ($post['postorderid'] == 0) {
             if ($this->user['Username'] == $post['author'] || $this->user['Username'] >= 4) {
                 $result = post::delete($post_id);
                 //Update thread replys count
                 thread::update_post_count($post['thread']);
                 ////Build event details to log
                 // $logEventID = '132';
                 // $logDetails = 'Forum post id:'.$post_id.' in thread id:'.$thread.' for category id:'.$category.' deleted!';
                 // $logEventAuthor = $this->user['Username'];
                 // //Write to admin log.
                 json::resp(array('success' => true, 'cat' => $post['cat'], 'thread' => $post['thread']));
             }
         } else {
             self::errorJSON('Cannot delete first post of thread, the entire thread must be deleted!');
         }
     }
 }