예제 #1
0
 public function delLZLReply($id)
 {
     $this->requireLogin();
     $this->checkAuth('Forum/Lzl/delLZLReply', get_expect_ids($id), '你没有删除回复的权限!');
     $this->checkActionLimit('forum_lzl_del_reply', 'Forum', null, get_uid());
     $Lzlreply = D('ForumLzlReply')->where('id=' . $id)->find();
     $data['post_reply_id'] = $Lzlreply['to_f_reply_id'];
     $res = D('ForumLzlReply')->delLZLReply($id);
     $data['lzl_reply_count'] = D('ForumLzlReply')->where('is_del=0 and to_f_reply_id=' . $data['post_reply_id'])->count();
     action_log('forum_lzl_del_reply', 'Forum', $id, get_uid());
     $res && $this->success($res, '', $data);
     !$res && $this->error('');
 }
 private function requireAllowEditPost($post_id)
 {
     $this->requirePostExists($post_id);
     $this->requireLogin();
     $this->checkAuth('Forum/Index/editPost', get_expect_ids(0, 0, $post_id, 0, 1), '没有权限编辑该帖子!');
     $this->checkActionLimit('forum_edit_post', 'Forum', $post_id, get_uid());
 }
 /**
  * @param null $reply_id
  * @param $content
  * 编辑回复
  */
 public function doReplyEdit($reply_id = null, $content)
 {
     $reply_id = intval($reply_id);
     //对帖子内容进行安全过滤
     $content = $this->filterPostContent($content);
     $content = filter_content($content);
     $this->checkAuth('Forum/Index/doReplyEdit', get_expect_ids(0, $reply_id, 0, 0, 1), '你没有编辑该评论权限!');
     if (!$content) {
         $this->error("评论内容不能为空!");
     }
     $data['content'] = $content;
     $data['update_time'] = time();
     $post_id = M('forum_post_reply')->where(array('id' => intval($reply_id), 'status' => 1))->getField('post_id');
     $reply = M('forum_post_reply')->where(array('id' => intval($reply_id)))->save($data);
     if ($reply) {
         S('post_replylist_' . $post_id, null);
         $this->success('编辑评论成功', U('Forum/Index/detail', array('id' => $post_id)));
     } else {
         $this->error("编辑评论失败");
     }
 }