public function doSendLZLReply($post_id, $to_f_reply_id, $to_reply_id, $to_uid, $content, $p = 1) { //确认用户已经登录 $this->requireLogin(); //写入数据库 $model = D('ForumLzlReply'); $before = getMyScore(); $result = $model->addLZLReply($post_id, $to_f_reply_id, $to_reply_id, $to_uid, op_t($content), $p); $after = getMyScore(); if (!$result) { $this->error('发布失败:' . $model->getError()); } //显示成功页面 $totalCount = D('forum_lzl_reply')->where('is_del=0 and to_f_reply_id=' . $to_f_reply_id)->count(); $limit = 5; $pageCount = ceil($totalCount / $limit); exit(json_encode(array('status' => 1, 'info' => '回复成功。' . getScoreTip($before, $after), 'url' => $pageCount))); }
function action_log_and_get_score($action = null, $model = null, $record_id = null, $user_id = null) { $score_before = getMyScore(); action_log($action, $model, $record_id, $user_id); $score_after = getMyScore(); return $score_after - $score_before; }
public function doReply($post_id, $content) { $post_id = intval($post_id); $content = $this->filterPostContent($content); //确认有权限回复 $this->requireAllowReply($post_id); //检测回复时间限制 $uid = is_login(); $near = D('ForumPostReply')->where(array('uid' => $uid))->order('create_time desc')->find(); $cha = time() - $near['create_time']; if ($cha > 10) { //添加到数据库 $model = D('ForumPostReply'); $before = getMyScore(); $tox_money_before = getMyToxMoney(); $result = $model->addReply($post_id, $content); $after = getMyScore(); $tox_money_after = getMyToxMoney(); if (!$result) { $this->error('回复失败:' . $model->getError()); } //显示成功消息 $this->success('回复成功。' . getScoreTip($before, $after) . getToxMoneyTip($tox_money_before, $tox_money_after), 'refresh'); } else { $this->error('请10秒之后再回复'); } }
public function doReply($post_id, $content) { $post_id = intval($post_id); $content = $this->filterPostContent($content); $content = filter_content($content); //确认有权限评论 $post_id = intval($post_id); $post = D('ForumPost')->where(array('id' => $post_id))->find(); if (!$post) { $this->error('帖子不存在'); } $this->requireLogin(); $this->checkAuth('Forum/Index/doReply', $post['uid'], '你没有评论贴子权限!'); //确认有权限评论 end $this->checkActionLimit('forum_post_reply', 'Forum', null, get_uid()); //添加到数据库 $model = D('ForumPostReply'); $before = getMyScore(); $result = $model->addReply($post_id, $content); $after = getMyScore(); if (!$result) { $this->error('评论失败:' . $model->getError()); } //显示成功消息 action_log('forum_post_reply', 'Forum', $result, get_uid()); $this->success('回复成功。' . getScoreTip($before, $after), 'refresh'); }
/** * 帖子回复 */ public function AddForumComment() { $aPostId = I('post.forumId', 0, 'intval'); $aContent = I('post.forumcontent', 0, 'op_t'); $post_id = $aPostId; $content = $aContent; $content = $this->filterPostContent($content); //确认有权限回复 $this->requireAllowReply($post_id); //检测回复时间限制 $uid = is_login(); $near = D('ForumPostReply')->where(array('uid' => $uid))->order('create_time desc')->find(); $cha = time() - $near['create_time']; if ($cha > 10) { //添加到数据库 $model = D('Forum/ForumPostReply'); $before = getMyScore(); // $tox_money_before = getMyToxMoney(); $result = $model->addReply($post_id, $content); $after = getMyScore(); // $tox_money_after = getMyToxMoney(); if (!$result) { $this->error('回复失败:' . $model->getError()); } //显示成功消息 $this->success('回复成功。', 'refresh'); } else { $this->error('请10秒之后再回复'); } }
/** * 发帖子功能实现 */ public function doAddPost($post_id = null, $forum_id = 0, $title, $content, $attach_ids, $isEdit = 0) { $post_id = intval($post_id); $forum_id = intval($forum_id); $title = text($title); $aSendWeibo = I('sendWeibo', 0, 'intval'); if ($attach_ids) { $img_ids = explode(',', $attach_ids); //把图片和内容结合 // dump($img_ids); foreach ($img_ids as &$v) { $v = D('Picture')->where(array('status' => 1))->getById($v); if (!is_bool(strpos($v['path'], 'http://'))) { $v = $v['path']; } else { $v = getRootUrl() . substr($v['path'], 1); } $v = '<p><img src="' . $v . '" style=""/></p><br>'; } $img_ids = implode('', $img_ids); // dump($img_ids); $content = $img_ids . $content; $contentHandler = new ContentHandlerModel(); $content = $contentHandler->filterHtmlContent($content); //把图片和内容结合END } // $content = $content;//op_h($content); //判断是不是编辑模式 $forum_id = intval($forum_id); //如果是编辑模式,确认当前用户能编辑帖子 if ($isEdit == 1) { $this->requireAllowEditPost($post_id); } //确认当前论坛能发帖 $this->requireForumAllowPublish($forum_id); if ($title == '') { $this->error('请输入标题。'); } if ($forum_id == 0) { $this->error('请选择发布的版块。'); } if (strlen($content) < 20) { $this->error('发表失败:内容长度不能小于20'); } // $content = filterBase64($content); //检测图片src是否为图片并进行过滤 // $content = filterImage($content); //写入帖子的内容 $model = M('Mob/ForumPost'); if ($isEdit == 1) { $data = array('id' => intval($post_id), 'title' => $title, 'content' => $content, 'parse' => 0, 'forum_id' => intval($forum_id)); $result = $model->editPost($data); if (!$result) { $this->error('编辑失败:' . $model->getError()); } } else { $data = array('uid' => is_login(), 'title' => $title, 'content' => $content, 'parse' => 0, 'forum_id' => $forum_id); $before = getMyScore(); $result = $model->createPost($data); $after = getMyScore(); if (!$result) { $this->error('发表失败:' . $model->getError()); } $post_id = $result; } //实现发布帖子发布图片轻博客(公共内容) $type = 'feed'; $feed_data['attach_ids'] = $attach_ids; $feed_data['attach_ids'] != false && ($type = "image"); if ($aSendWeibo == 1) { //开始发布轻博客 if ($isEdit) { M('Weibo')->addWeibo(is_login(), "我更新了帖子【" . $title . "】:" . U('postdetail', array('id' => $post_id), null, true), $type, $feed_data, $from = "手机网页版"); } else { M('Weibo')->addWeibo(is_login(), "我发表了一个新的帖子【" . $title . "】:" . U('postdetail', array('id' => $post_id), null, true), $type, $feed_data, $from = "手机网页版"); } } //显示成功消息 if ($result) { $return['status'] = 1; } else { $return['status'] = 0; $return['info'] = '发贴失败'; } $this->ajaxReturn($return); }