function getTopicList() { $item = trim($this->Post['item']); $item_id = intval(trim($this->Post['item_id'])); if ($item_id < 1) { exit; } jfunc('app'); $ret = app_check($item, $item_id); if (!$ret) { exit; } $gets = array('mod' => $item, 'code' => $this->Post['oc'], 'vid' => $item_id); $page_url = 'index.php?' . url_implode($gets); $where = ''; if ($item == 'qun') { $where = " type !='reply' "; } $options = array('where' => $where, 'page' => true, 'perpage' => 5, 'page_url' => $page_url); $topic_info = app_get_topic_list($item, $item_id, $options); $topic_list = array(); if (!empty($topic_info)) { $topic_list = $topic_info['list']; $page_arr['html'] = $topic_info['page']['html']; if ($item == 'live' || $item == 'talk') { $no_from = false; } else { $no_from = true; } if ($item == 'qun') { $allow_list_manage = true; $no_from = false; include template('qun/topic_list_ajax'); } else { include template('topic_list_ajax'); } } exit; }
function add() { if (MEMBER_ID < 1) { Mobile::error('No Login', 410); } if ($this->MemberHandler->HasPermission($this->Module, $this->Code) == false) { Mobile::error('No Permission', 411); } $content = trim(strip_tags($this->Post['content'])); if (!$content) { Mobile::error('No Content', 420); } $topic_type = $this->Post['topictype']; if ('both' == $topic_type) { $type = 'both'; } elseif ('reply' == $topic_type) { $type = 'reply'; } elseif ('forward' == $topic_type) { $type = 'forward'; } elseif ('qun' == $topic_type) { $type = 'qun'; } elseif ('personal' == $topic_type) { $type = 'personal'; } elseif (is_numeric($topic_type)) { $type = 'first'; } else { $type = 'first'; } $totid = max(0, (int) $this->Post['totid']); $imageid = $this->Upload(); $videoid = max(0, (int) $this->Post['videoid']); $longtextid = max(0, (int) $this->Post['longtextid']); $subjectid = max(0, (int) $this->Post['subjectid']); $from = trim(strtolower($this->Post['from'])); $item = trim($this->Post['item']); $item_id = intval(trim($this->Post['item_id'])); if (!empty($item_id)) { jfunc('app'); $ret = app_check($item, $item_id); if (!$ret) { $item = ''; $item_id = 0; } } else { $item = ''; $item_id = 0; } $data = array('content' => $content, 'totid' => $totid, 'imageid' => $imageid, 'videoid' => $videoid, 'from' => empty($from) ? 'mobile' : $from, 'type' => $type, 'item' => $item, 'item_id' => $item_id, 'longtextid' => $longtextid, 'subjectid' => $subjectid); $return = $this->TopicLogic->Add($data); if (is_array($return) && $return['tid'] > 0) { Mobile::success('Publish Success' . $subjectid, 200); } else { $return = is_string($return) ? $return : (is_array($return) ? implode("", $return) : "Unkown Error"); Mobile::output($return, 'Error', 430); } }
function Do_forward() { if (MEMBER_ID < 1) { response_text("请登录"); } if ($this->MemberHandler->HasPermission('topic', 'forward') == false) { response_text("您的角色没有转发的权限"); } $content = strip_tags($this->Post['content']); $totid = (int) $this->Post['tid']; $imageid = trim($this->Post['imageid']); $attachid = trim($this->Post['attachid']); $type = $this->Post['topictype']; $from = 'web'; if ($this->Config['seccode_enable']) { $YXM_check = jlogic('seccode')->topiccheckYXM($type); if ($YXM_check && $this->yxm_title && $this->Config['seccode_pub_key'] && $this->Config['seccode_pri_key']) { $YinXiangMa_response = jlogic('seccode')->CheckYXM(@$_POST['YinXiangMa_challenge'], @$_POST['YXM_level'][0], @$_POST['YXM_input_result']); if ($YinXiangMa_response != "true") { response_text("验证码输入错误"); } } } $is_reward = $this->Post['is_reward']; $item = trim($this->Post['item']); $item_id = intval(trim($this->Post['item_id'])); #为有奖转发添加小尾巴 if ($is_reward) { $reward = jlogic("reward")->getRewardInfo($is_reward); foreach ($reward["rules"]["user"] as $value) { $uid = DB::result_first("select uid from `" . TABLE_PREFIX . "members` where nickname = '{$value['nickname']}' "); !$uid || buddy_add($uid); } } if (!empty($item_id)) { jfunc('app'); $ret = app_check($item, $item_id); if (!$ret) { $item = ''; $item_id = 0; } else { $from = $item; } } else { $item = ''; $item_id = 0; } $data = array('content' => $content, 'totid' => $totid, 'imageid' => $imageid, 'attachid' => $attachid, 'from' => $from, 'type' => $type, 'item' => $item, 'item_id' => $item_id, 'is_reward' => $is_reward); $return = $this->TopicLogic->Add($data); if (is_array($return) && $return['tid'] > 0) { response_text('<success></success>'); } else { $return = is_string($return) ? "[转发失败]" . $return : (is_array($return) ? "[转发成功]但" . implode("", $return) : "未知错误"); response_text("{$return}"); } }