function Topic() { if (MEMBER_ID < 1) { response_text('您是游客,没有权限举报'); } $tid = jget('totid', 'int', 'P'); $report_reason = $this->Post['report_reason']; $report_content = $this->Post['report_content']; $data = array('uid' => MEMBER_ID, 'username' => MEMBER_NICKNAME, 'ip' => $GLOBALS['_J']['client_ip'], 'reason' => (int) $report_reason, 'content' => strip_tags($report_content), 'tid' => (int) $tid, 'dateline' => time()); $result = jtable('report')->insert($data); if ($notice_to_admin = $this->Config['notice_to_admin']) { $message = "用户" . MEMBER_NICKNAME . "举报了微博ID:{$tid}(" . $data['content'] . "),<a href='admin.php?mod=report&code=report_manage' target='_blank'>点击</a>进入管理。"; $pm_post = array('message' => $message, 'to_user' => str_replace('|', ',', $notice_to_admin)); $admin_info = DB::fetch_first('select `uid`,`username`,`nickname` from `' . TABLE_PREFIX . 'members` where `uid` = 1'); load::logic('pm'); $PmLogic = new PmLogic(); $PmLogic->pmSend($pm_post, $admin_info['uid'], $admin_info['username'], $admin_info['nickname']); } response_text('举报成功'); }
function view() { $uid = MEMBER_ID; $qid = intval(trim($this->Get['qid'])); $tag = get_safe_code($this->Get['tag']); $view = trim($this->Get['view']); $qun_info = $this->QunLogic->get_qun_info($qid); if ($qun_info['qun_theme_id']) { $this->Config['qun_theme_id'] = $qun_info['qun_theme_id']; $this->Config['theme_id'] = ''; $this->Config['theme_bg_image'] = ''; $this->Config['theme_bg_color'] = ''; $this->Config['theme_text_color'] = ''; $this->Config['theme_link_color'] = ''; $this->Config['theme_bg_image_type'] = ''; $this->Config['theme_bg_repeat'] = ''; $this->Config['theme_bg_fixed'] = ''; } if (empty($qun_info)) { $this->Messager("当前" . $this->Config[changeword][weiqun] . "不存在或者已经被删除了", 'index.php?mod=qun'); } if (!empty($tag)) { $qun_info['icon'] = $this->QunLogic->qun_avatar($qun_info['qid'], 's'); } else { $qun_info['icon'] = $this->QunLogic->qun_avatar($qun_info['qid'], 'b'); } $active = array(); $topic_list = array(); $get_topic_flg = true; $this->item_id = $qid; $params['code'] = $this->item; $cat_ary = $this->QunLogic->get_category(); $top_cat = array(); $sub_cat = array(); if ($cat_ary['second'][$qun_info['cat_id']]) { $sub_cat = array('cat_name' => $cat_ary['second'][$qun_info['cat_id']]['cat_name'], 'cat_id' => $qun_info['cat_id']); $parent_id = $cat_ary['second'][$qun_info['cat_id']]['parent_id']; $top_cat = array('cat_name' => $cat_ary['first'][$parent_id]['cat_name'], 'cat_id' => $parent_id); } else { $top_cat = array('cat_name' => $cat_ary['first'][$qun_info['cat_id']]['cat_name'], 'cat_id' => $qun_info['cat_id']); } $founder_info = $this->TopicLogic->GetMember($qun_info['founderuid']); $qun_admin_list = $this->QunLogic->get_admin_list($qid); $tag_ary = $this->QunLogic->get_qun_tag($qid); $recd_event_list = $this->QunLogic->getRecdEventList($qid); $recd_vote_list = $this->QunLogic->getRecdVoteList($qid); $followme_nums = $this->QunLogic->followme_nums($qid, MEMBER_ID); $perm = $this->QunLogic->chk_perm($qid, MEMBER_ID); $status = ''; $allow_list_manage = false; if (in_array($perm, array(1, 2, 4)) || MEMBER_ROLE_TYPE == 'admin') { $status = 'isgroupuser'; $allow_list_manage = true; } jfunc('app'); $gets = array('mod' => 'qun', 'type' => $this->Get['type'], 'qid' => $qid, 'tag' => $this->Get['tag'], 'code' => $this->Code); $page_url = 'index.php?' . url_implode($gets); $where = " type!='reply' "; if ($this->Get['type']) { if ('pic' == $this->Get['type']) { $where = " `imageid` > 0 "; } else { if ('video' == $this->Get['type']) { $where = " `videoid` > 0 "; } else { if ('music' == $this->Get['type']) { $where = " `musicid` > 0 "; } else { $this->Get['type'] = ''; } } } } if (!empty($tag)) { $sql = "SELECT * FROM " . DB::table('tag') . " WHERE name='" . addslashes($tag) . "'"; $tag_info = DB::fetch_first($sql); $tag_id = $tag_info['id']; $sql = "SELECT item_id FROM " . DB::table('topic_tag') . " WHERE tag_id='{$tag_id}' "; $query = DB::query($sql); $topic_ids = array(); while ($row = DB::fetch($query)) { $topic_ids[$row['item_id']] = $row['item_id']; } if (!empty($topic_ids)) { $where .= " AND tid IN(" . jimplode($topic_ids) . ") "; } $content = "#{$tag}#"; $view = 'tag'; } else { if ($view == "newreply") { $type_where = ' AND ' . $where; $per_page_num = $this->ShowConfig['qun']['topic_reply'] ? $this->ShowConfig['qun']['topic_reply'] : 10; $count = DB::result_first("SELECT COUNT(*)\r\n\t\t\t\t\t\t\t\t\t\t\tFROM " . DB::table('topic') . "\r\n\t\t\t\t\t\t\t\t\t\t\tWhere `replys` > 0 AND item='qun' AND item_id='{$qid}' {$type_where}"); if ($count > 0) { $page_arr = page($count, $per_page_num, $page_url, array('return' => 'array')); $condition = " WHERE `replys` > 0 AND item='qun' AND item_id='{$qid}' {$type_where} ORDER BY `lastupdate` DESC {$page_arr['limit']}"; $topic_list = $this->TopicLogic->Get($condition); } $get_topic_flg = false; } else { if ($view == 'recd') { Load::logic('topic_list'); $TopicListLogic = new TopicListLogic(); $p = array('where' => " tr.recd <= 2 AND tr.item='qun' AND tr.item_id='{$qid}' ", 'perpage' => $per_page_num, 'filter' => $this->Get['type']); $info = $TopicListLogic->get_recd_list($p); if (!empty($info)) { $count = $info['count']; $topic_list = $info['list']; $page_arr = $info['page']; } $get_topic_flg = false; } elseif ($view == 'event') { $param = array('qid' => $qid, 'where' => " a.item = 'qun' and a.item_id = '{$qid}' ", 'page' => true, 'perpage' => 10, 'page_url' => 'index.php?mod=qun&view=event&qid=' . $qid); load::logic('event'); $EventLogic = new EventLogic(); $return = $EventLogic->getEventInfo($param); $count = $return['count'] ? $return['count'] : 0; $event = $return['event_list']; $page_arr = $return['page']; $get_topic_flg = false; } elseif ($view == 'vote') { load::logic('vote'); $VoteLogic = new VoteLogic(); $param = array('where' => " v.item = 'qun' and v.item_id = '{$qid}' ", 'order' => " order by v.dateline ", 'page' => true, 'perpage' => 10, 'page_url' => 'index.php?mod=qun&view=vote&qid=' . $qid); $return = $VoteLogic->find($param); $count = $return['count'] ? $return['count'] : 0; if (!empty($return)) { $vote_list = $return['vote_list']; $page_arr['html'] = $return['page']['html']; $uid_ary = $return['uids']; } if (!empty($uid_ary)) { $members = $this->TopicLogic->GetMember($uid_ary); } $get_topic_flg = false; } elseif ($view == 'image') { $param = array('item' => 'qun', 'itemid' => $qid, 'page' => true, 'per_page_num' => 20, 'page_url' => 'index.php?mod=qun&view=image&qid=' . $qid); $return = jlogic('image')->get($param); $count = $return['count'] ? $return['count'] : 0; $image_list = $return['list']; $page_arr['html'] = $return['page']['html']; $get_topic_flg = false; } elseif ($view == 'attach' && $this->Config['qun_attach_enable']) { global $attach_list; $type = $this->Get['type']; load::logic('attach'); $AttachLogic = new AttachLogic(); $param = array('item' => 'qun', 'itemid' => $qid, 'page' => true, 'per_page_num' => 20, 'page_url' => 'index.php?mod=qun&view=attach&qid=' . $qid . '&type=' . $type); if ($type) { if ('hot' == $type) { $param['order'] = " order by download DESC "; } else { if ('new' == $type) { $param['order'] = " order by id DESC "; } } } $return = $AttachLogic->get($param); $count = $return['count'] ? $return['count'] : 0; $attach_list = $return['list']; $page_arr['html'] = $return['page']['html']; $get_topic_flg = false; } else { $view = 'newtopic'; } } $active[$view] = "class='current'"; } if ($get_topic_flg) { $options = array('where' => $where, 'page' => true, 'perpage' => $this->ShowConfig['qun']['topic_new'] ? $this->ShowConfig['qun']['topic_new'] : 10, 'page_url' => $page_url); $topic_info = app_get_topic_list($this->item, $qid, $options); if (!empty($topic_info)) { $topic_list = $topic_info['list']; $page_arr['html'] = $topic_info['page']['html']; } } $topic_list_count = count($topic_list); $parent_list = $this->_get_parent_topic($topic_list); $gets = array('item' => $this->item, 'item_id' => $qid); $member =& $this->my; if (!$this->Config['acceleration_mode'] && $member['medal_id']) { $medal_list = $this->TopicLogic->GetMedal($member['medal_id'], $member['uid']); } $set_qun_closed = 1; if (empty($tag)) { $new_members = $this->QunLogic->get_new_member_list($qid); $this->Title = $this->Config[changeword][weiqun] . ' - ' . $qun_info['name']; include template('qun/view'); } else { $this->Title = $this->Config[changeword][weiqun] . ' - ' . $qun_info['name'] . ' - ' . $tag; include template('qun/tag_view'); } }
function getSignTag() { if (MEMBER_ID < 1) { exit; } $is_tag = 1; load::logic('other'); $OtherLogic = new OtherLogic(); $tag_arr = $OtherLogic->getSignTag(); include template('admin/resultList'); }
function delete() { $ids = array(); $up_ids = array(); $id = (int) $this->Get['id']; if ($id) { $ids[] = $id; } if ($this->Post['cronssubmit']) { $ids = $this->Post['ids']; $up_ids = $this->Post['up_id']; $vid = $this->Post['vid']; } if (!empty($vid)) { $this->DatabaseHandler->Query("update " . TABLE_PREFIX . "event set recd = 0 where id in ('" . implode("','", $vid) . "')"); foreach ($vid as $val) { if (!in_array($val, $ids) && in_array($val, $up_ids)) { $this->DatabaseHandler->Query("update " . TABLE_PREFIX . "event set recd = 1 where id = '{$val}' "); } } } load::logic('event'); $eventLogic = new EventLogic(); if ($ids) { foreach ($ids as $val) { $eventLogic->delEvent($val, 1); } } $this->Messager("操作成功"); }
function doForceOut() { $nickname_arr = array(); $member_list = array(); $force_out_list = array(); if ('admin' != MEMBER_ROLE_TYPE) { json_error("您没有封杀用户的权限"); } $cause = trim($this->Post['cause']); $role_id = (int) $this->Post['role_id']; $nickname = trim($this->Post['name']); $nickname_arr = explode(",", $nickname); load::logic('topic_manage'); $TopicManageLogic = new TopicManageLogic(); $ret = $TopicManageLogic->doForceOut($nickname_arr, $cause, $role_id); $ret_arr = array(1 => '管理员不能放入封杀组', 2 => '封杀成功'); json_result($ret_arr[$ret]); }
function addModule() { $post = $this->Post; if ($post['chk']) { foreach ($post['chk'] as $value) { unset($post['theme'][$value]); } } load::logic('qun'); $QunLogic = new QunLogic(); $return = $QunLogic->checkThemeId($post['theme']); if ($return == 1) { $this->Messager("模块ID不能同名"); } jconf::set('qun_module', $post['theme']); $this->Messager("设置成功"); }
function DoSend($folder = '') { if (MEMBER_ID < 1) { $this->Messager("请先<a href='index.php?mod=login'>点此登录</a>或者<a href='index.php?mod=member'>点此注册</a>一个帐号", 'index.php?mod=login'); } $this->Post['message'] = jpost('message', 'txt'); load::logic('pm'); $PmLogic = new PmLogic(); $return = $PmLogic->pmSend($this->Post); switch ($return) { case '1': $this->Messager("内容不能为空"); break; case '2': $this->Messager("收件人不能为空"); break; case '3': $this->Messager("收件人不存在"); break; case '4': $this->Messager("消息已经保存草稿箱", "index.php?mod=pm&code=list&folder=outbox"); break; case '5': $this->Messager("信息不存在或已删除"); case '6': $this->Messager("所在用户组没有发私信的权限"); case '7': default: if ($return && is_string($return)) { $this->Messager($return); } break; } $folder = $folder ? $folder : 'inbox'; $this->Messager(NULL, "index.php?mod=pm&code=list&folder={$folder}"); }
function create() { $tab = jget('tab') ? jget('tab') : 'word'; $this->Title = "我的投票"; if (MEMBER_ID < 1) { $this->Messager("你需要先登录才能继续本操作", 'index.php?mod=login'); } if (MEMBER_ROLE_TYPE != 'admin') { load::logic('vote'); $VoteLogic = new VoteLogic(); $is_allowed = $VoteLogic->allowedCreate(MEMBER_ID); } if ($is_allowed) { $this->Messager($is_allowed); } $max_option = 50; $perpage = 10; $options = range(1, $perpage); $exp_info = $this->VoteLogic->get_publish_form_param(); extract($exp_info); $member = $this->TopicLogic->GetMember(MEMBER_ID); if ($member['medal_id']) { $medal_list = $this->TopicLogic->GetMedal($member['medal_id'], $member['uid']); } for ($i = 0; $i < $perpage; $i++) { $opts[$i]['picurl'] = 'images/none.png'; } include template('vote/vote_create'); }
function DoAdd() { if (MEMBER_ID < 1) { exit("请先登录或者注册一个帐号"); } if ($this->Config['seccode_enable'] > 1 && $this->Config['seccode_sms'] && $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") { exit("验证码输入错误"); } } if ($this->MemberHandler->HasPermission($this->Module, $this->Code) == false) { exit($this->MemberHandler->GetError()); } load::logic('pm'); $PmLogic = new PmLogic(); $pmid = $this->Post['pmid']; if ($che = $this->Post['che']) { $this->Post['to_user'] = implode(",", $che); } $this->Post['message'] = jpost('message', 'txt'); if ($pmid > 0) { $return = $PmLogic->pmSendAgain($this->Post); } else { $return = $PmLogic->pmSend($this->Post); } switch ($return) { case '1': exit("内容不能为空"); case '2': exit("收件人不能为空"); case '3': exit("收件人不存在"); case '4': exit("消息已经保存草稿箱"); case '5': exit("信息不存在或已删除"); case '6': exit("所在用户组没有发私信的权限"); default: if ($return && is_string($return)) { exit($return); } return ''; } }
function create($post, &$ret) { $r = $this->chk_post($post); if ($r != 1) { return $r; } $ret['subject'] = $post['subject']; $setarr = array('uid' => $post['uid'], 'username' => $post['username'], 'subject' => $post['subject'], 'maxchoice' => $post['maxchoice'], 'multiple' => $post['maxchoice'] > 1 ? 1 : 0, 'is_view' => $post['is_view'], 'expiration' => $post['expiration'], 'dateline' => TIMESTAMP, 'postip' => $GLOBALS['_J']['client_ip'], 'item' => $post['item'], 'item_id' => $post['item_id'], 'verify' => isset($post['verify']) ? 0 : 1, 'tab' => isset($post['tab']) && $post['tab'] == 'pic' ? 1 : 0); $setarr['time_val'] = max(0, (int) $post['time_val']); $setarr['time_unit'] = in_array($post['time_unit'], array('y', 'm', 'd', 'h', 'i', 's')) ? $post['time_unit'] : 'h'; $setarr['vote_limit'] = max(0, min(100, (int) $post['vote_limit'])); $vid = DB::insert('vote', $setarr, true); $ret['vid'] = $vid; if ($setarr['verify'] == 0) { if ($notice_to_admin = $GLOBALS['_J']['config']['notice_to_admin']) { $pm_post = array('message' => MEMBER_NICKNAME . "发布了一个投票进入待审核状态,<a href='admin.php?mod=vote&code=verify' target='_blank'>点击</a>进入审核。", 'to_user' => str_replace('|', ',', $notice_to_admin)); $admin_info = DB::fetch_first('select `uid`,`username`,`nickname` from `' . TABLE_PREFIX . 'members` where `uid` = 1'); load::logic('pm'); $PmLogic = new PmLogic(); $PmLogic->pmSend($pm_post, $admin_info['uid'], $admin_info['username'], $admin_info['nickname']); } } $setarr = array('vid' => $vid, 'message' => $post['message'], 'option' => addslashes(serialize($post['preview']))); DB::insert('vote_field', $setarr); if ($post['item'] == 'qun' && $post['item_id']) { $qun_vote = array('qid' => $post['item_id'], 'vid' => $vid, 'recd' => 0); DB::insert('qun_vote', $qun_vote); } $optionarr = array(); $pid_arr = array(); foreach ($post['newoption'] as $key => $value) { $pid = $value['pid'] ? $value['pid'] : 0; $optionarr[] = "('{$vid}', '{$value['option']}' , '{$pid}')"; if ($pid > 0) { $pid_arr[] = $pid; } } if ($pid_arr) { DB::query(" update `" . TABLE_PREFIX . "vote_image` set `vid` = '{$vid}' where `id` in ('" . implode("','", $pid_arr) . "')"); } DB::query("INSERT INTO " . DB::table('vote_option') . "\r\n\t\t\t\t (`vid` , `option` , `pid`) VALUES " . implode(',', $optionarr)); update_credits_by_action('vote_add', $post['uid']); return 1; }
function onLoadPic() { if (!$this->MemberHandler->HasPermission($this->Module, 'create')) { js_alert_output($this->MemberHandler->GetError()); } $id = jget('id', 'int'); $file_name = 'pic' . $id; if (MEMBER_ROLE_TYPE != 'admin' && !$is_allowed) { load::logic('vote'); $VoteLogic = new VoteLogic(); $is_allowed = $VoteLogic->allowedCreate(MEMBER_ID); } if ($is_allowed) { js_alert_output($is_allowed); } if ($_FILES[$file_name]['name']) { $name = time() . MEMBER_ID; $image_name = $name . "_b.jpg"; $image_path = RELATIVE_ROOT_PATH . 'images/vote/'; $image_file = $image_path . $image_name; $image_th_file = $image_path . $name . "_th.jpg"; if (!is_dir($image_path)) { jio()->MakeDir($image_path); } jupload()->init($image_path, $file_name, true); jupload()->setNewName($image_name); $result = jupload()->doUpload(); if ($result) { $result = is_image($image_file); } if (!$result) { unlink($image_file); echo "<script language='Javascript'>"; echo "parent.document.getElementById('message').style.display='block';"; echo "parent.document.getElementById('uploading').style.display='none';"; echo "parent.document.getElementById('message').innerHTML='图片上载失败'"; echo "</script>"; exit; } image_thumb($image_file, $image_th_file, 100, 100, 1, 0, 0); if ($this->Config['ftp_on']) { $ftp_key = randgetftp(); $get_ftps = jconf::get('ftp'); $face_url = $get_ftps[$ftp_key]['attachurl']; $ftp_result = ftpcmd('upload', $image_file, '', $ftp_key); if ($ftp_result > 0) { jio()->DeleteFile($image_file); $image_file = $face_url . '/' . str_replace('./', '', $image_file); } $ftp_result = ftpcmd('upload', $image_th_file, '', $ftp_key); if ($ftp_result > 0) { jio()->DeleteFile($image_th_file); $image_th_file = $face_url . '/' . str_replace('./', '', $image_th_file); } } #插入数据库 $image_id = $this->VoteLogic->insert_vote_img(MEMBER_ID, $image_th_file, $image_file); echo "<script language='Javascript'>"; echo "parent.document.getElementById('pic_show_{$id}').src='{$image_th_file}';"; echo "parent.document.getElementById('pic_id_{$id}').value='{$image_id}';"; echo "</script>"; exit; } }
function SendPm() { if (!$this->IDS) { $this->Messager('请选择要发送私信的对象', -1); } $pm_content = $this->Post['pm_content']; if (!$pm_content) { $this->Messager('私信内容不能为空', -1); } $nickname_arr = array(); $sql = "select `nickname` from `" . TABLE_PREFIX . "members` where `uid` in ('" . implode("','", $this->IDS) . "')"; $query = DB::query($sql); while (false != ($row = DB::fetch($query))) { $nickname_arr[] = $row['nickname']; } load::logic("pm"); $PmLogic = new PmLogic(); $post = array(); if ($nickname_arr) { $post['to_user'] = implode(",", $nickname_arr); $post['message'] = $pm_content; $PmLogic->pmSend($post); } $this->Messager('发送成功'); }
function DoModify() { $uid = (int) $this->Post['uid']; $is_pm_notice = (int) $this->Post['is_pm_notice']; $is_audit = $this->Post['is_audit']; $category_fid = (int) $this->Post['category_fid']; $category_id = (int) $this->Post['category_id']; $audit_info = $this->Post['to_message']; if (!$category_fid || !$category_id) { $this->Messager("请确认认证类别", -1); } $validate_info = $this->Post['validate_info']; $sql = "update `" . TABLE_PREFIX . "validate_category_fields`\r\n\t\t\t\tset `audit_info` = '{$audit_info}',\r\n\t\t\t\t\t`category_fid` = '{$category_fid}',\r\n\t\t\t\t\t`category_id` = '{$category_id}',\r\n\t\t\t\t\t`is_audit` = '{$is_audit}',\r\n\t\t\t\t\t`is_push` = 0\r\n\t\t\t\twhere `uid` = '{$uid}'"; $update = $this->DatabaseHandler->Query($sql); if ($is_audit == 1) { update_credits_by_action('vip', $uid); $to_user = DB::result_first("select `nickname` from `" . TABLE_PREFIX . "members` where `uid` = '{$uid}'"); $pm_post = array('message' => '您的V认证申请已经通过。', 'to_user' => $to_user); jlogic('pm')->pmSend($pm_post); } if ($is_audit != 1) { $sql = "update `" . TABLE_PREFIX . "members` set `validate`='0',`validate_category`='0' where `uid`='{$uid}'"; $this->DatabaseHandler->Query($sql); if ($is_pm_notice) { $message = $this->Post['to_message'] ? $this->Post['to_message'] : "没有理由!"; $data = array('to_user' => $this->Post['nickname'], 'message' => "您的身份验证不通过,拒绝理由:" . $message); load::logic('pm'); $PmLogic = new PmLogic(); $return = $PmLogic->pmSend($data); } $this->Messager('已设置为审核未通过', 'admin.php?mod=vipintro'); } $member_extra = ''; if ($this->Post['member_extra']) { $member_extra = @serialize($this->Post['member_extra']); } $sql = "update `" . TABLE_PREFIX . "members` set `validate`='{$category_fid}',`validate_category` = '{$category_id}' where `uid`='{$uid}'"; $this->DatabaseHandler->Query($sql); $sql = "update `" . TABLE_PREFIX . "memberfields` set `validate_true_name`='{$this->Post['validate_true_name']}' ,`validate_card_id` = '{$this->Post['validate_card_id']}' ,`validate_card_type` = '{$this->Post['validate_card_type']}' , `validate_remark` = '{$validate_info}',`validate_extra` = '{$member_extra}' where `uid` = '{$uid}'"; $update = $this->DatabaseHandler->Query($sql); $category_count = DB::result_first("SELECT count(*) FROM " . DB::table('validate_category_fields') . " where `category_fid` = '{$category_fid}' "); $subclass_count = DB::result_first("SELECT count(*) FROM " . DB::table('validate_category_fields') . " where `category_id` = '{$category_id}' "); $sql = "update `" . TABLE_PREFIX . "validate_category` set `num`='{$category_count}' where `id`='{$category_fid}'"; $this->DatabaseHandler->Query($sql); $sql = "update `" . TABLE_PREFIX . "validate_category` set `num`='{$subclass_count}' where `id`='{$category_id}'"; $this->DatabaseHandler->Query($sql); $this->Messager('审核成功', 'admin.php?mod=vipintro'); }
function DoSend() { if (MEMBER_ID < 1) { $this->Messager("请先<a href='index.php?mod=login'>点此登录</a>或者<a href='index.php?mod=member'>点此注册</a>一个帐号", 'index.php?mod=login'); } if ($this->MemberHandler->HasPermission($this->Module, $this->Code) == false) { $this->Messager($this->MemberHandler->GetError(), null); } $this->Post['message'] = jpost('message', 'txt'); $pm_message = array("to_user" => wap_iconv($this->Post['to_user'], 'utf-8', $this->Config['charset'], 1), "message" => wap_iconv($this->Post['message'], 'utf-8', $this->Config['charset'], 1)); $uid = (int) $this->Post['uid']; load::logic('pm'); $PmLogic = new PmLogic(); $return = $PmLogic->pmSend($pm_message); switch ($return) { case '1': $this->Messager("内容不能为空"); break; case '2': $this->Messager("收件人不能为空"); break; case '3': $this->Messager("收件人不存在"); break; case '4': $this->Messager("消息已经保存草稿箱", "index.php?mod=pm&code=list&folder=outbox"); break; case '5': $this->Messager("信息不存在或已删除"); case '6': $this->Messager("所在用户组没有发私信的权限"); default: if ($return && is_string($return)) { $return = wap_iconv($return); $this->Messager($return); } break; } if ($uid > 0) { $this->Messager("消息已发送成功", "index.php?mod=pm&code=view&uid={$uid}"); } else { $this->Messager("消息已发送成功", "index.php?mod=pm"); } }
function Add($datas, $totid = 0, $imageid = 0, $attachid = 0, $from = 'web', $type = "first", $uid = 0, $item = '', $item_id = 0, $from_queue = false) { if ($GLOBALS['_J']['config']['wqueue_enabled'] && !$from_queue) { isset($datas['content']) && ($datas['content'] = base64_encode($datas['content'])); $wq_data = array('datas' => $datas, 'totid' => $totid, 'imageid' => $imageid, 'attachid' => $attachid, 'from' => $from, 'type' => $type, 'uid' => $uid ? $uid : (isset($datas['uid']) ? $datas['uid'] : MEMBER_ID), 'item' => $item ? $item : (isset($datas['item']) ? $datas['item'] : ''), 'item_id' => $item_id ? $item_id : (isset($datas['item_id']) ? $datas['item_id'] : 0)); $wq_ds = base64_encode(serialize($wq_data)); $wq_url = 'http:/' . '/' . $GLOBALS['_J']['config']['wqueue']['host'] . '/?name=' . $GLOBALS['_J']['config']['wqueue']['name'] . '&opt=put&auth=' . $GLOBALS['_J']['config']['wqueue']['auth'] . '&data=' . $wq_ds; $wq_r = dfopen($wq_url); if (strstr($wq_r, 'HTTPSQS_PUT_OK')) { return array(); } } elseif ($from_queue) { } if (is_array($datas) && count($datas)) { $ks = array('tid' => 1, 'uid' => 1, 'content' => 1, 'imageid' => 1, 'attachid' => 1, 'videoid' => 1, 'musicid' => 1, 'longtextid' => 1, 'totid' => 1, 'touid' => 1, 'dateline' => 1, 'from' => 1, 'type' => 1, 'item_id' => 1, 'item' => 1, 'postip' => 1, 'timestamp' => 1, 'managetype' => 1, 'checkfilter' => 1, 'verify' => 1, 'design' => 1, 'xiami_id' => 1, 'is_reward' => 1); foreach ($datas as $k => $v) { if (isset($ks[$k])) { ${$k} = $v; } } $pverify = $datas['pverify']; } else { $content = $datas; } $is_verify = $pverify || $GLOBALS['_J']['config']['verify'] ? true : false; $content = $this->_content_strip($content); $content_length = strlen($content); if ($content_length < 2) { return "内容不允许为空"; } if ($this->_len2 > 0 && $content_length > $this->_len2) { $content = cut_str($content, $this->_len2, ''); } if (!$checkfilter) { $f_rets = filter($content); if ($f_rets) { if ($f_rets['verify']) { $is_verify = true; } elseif ($f_rets['error']) { return $f_rets['msg']; } } } else { if ($is_verify && 'verify' == $verify && true === IN_JISHIGOU_ADMIN) { $is_verify = false; } } $totid = max(0, (int) $totid); $data = array(); if ($managetype) { $data['managetype'] = $managetype; } $is_new = 1; if ($tid) { $is_new = 0; $data['tid'] = $tid; } $parents = ''; $_froms = array('web' => 1, 'wap' => 1, 'mobile' => 1, 'sms' => 1, 'qq' => 1, 'msn' => 1, 'api' => 1, 'sina' => 1, 'qqwb' => 1, 'vote' => 1, 'qun' => 1, 'wechat' => 1, 'fenlei' => 1, 'event' => 1, 'android' => 1, 'iphone' => 1, 'ipad' => 1, 'pad' => 1, 'androidpad' => 1, 'reward' => 1); $from = $from && $_froms[$from] ? $from : 'web'; if (empty($item) || $item_id < 0) { if (!is_numeric($type)) { $_types = array('first' => 1, 'forward' => 1, 'reply' => 1, 'both' => 1); $type = $totid < 1 && $type && isset($_types[$type]) ? 'first' : $type; if (empty($type)) { $type = 'first'; } } } $data['from'] = $from; if (($type == 'forward' || $type == 'both') && $item == 'qun') { $data['type'] = $item; } else { $data['type'] = $type; } if ($item == 'channel' && $item_id > 0) { $channeldata = jlogic('channel')->id2category($item_id); if ($channeldata) { if ($channeldata['purpostview']) { $data['type'] = 'channel'; } if ($channeldata['topictype']) { $data['managetype'] = $channeldata['topictype']; } unset($channeldata); } } $data['uid'] = $uid = max(0, (int) ($uid ? $uid : MEMBER_ID)); $data['videoid'] = $videoid = max(0, (int) $videoid); $data['longtextid'] = $longtextid = max(0, (int) $longtextid); $timestamp = (int) ($timestamp ? $timestamp : $dateline); $data['dateline'] = $data['lastupdate'] = $timestamp = $dateline = $timestamp > 0 ? $timestamp : TIMESTAMP; $data['totid'] = $totid; $data['touid'] = $touid; $data['anonymous'] = $GLOBALS['_J']['config']['anonymous_enable'] ? $datas['anonymous'] : 0; $data['item'] = $item; $data['item_id'] = $item_id; $member = $this->GetMember($data['uid']); if (!$member) { return "用户不存在"; } if ($item == 'qun' && $item_id > 0) { $qun_closed = DB::result_first("SELECT closed FROM " . DB::table('qun') . " WHERE qid='{$item_id}'"); if ($qun_closed) { return "当前" . $GLOBALS['_J']['config']['changeword']['weiqun'] . "已经关闭,你无法发布内容"; } $r = $this->is_qun_member($item_id, $uid); if (!$r) { return "你没有权限进行当前操作"; } } if ($item == 'channel' && $item_id > 0) { $can_pub_topic = jlogic('channel')->can_pub_topic($item_id); if (!$can_pub_topic) { return "你没有权限进行当前操作"; } } if ($item == 'company' && $item_id > 0) { if ($GLOBALS['_J']['config']['company_enable']) { $my_companyid = $GLOBALS['_J']['member']['companyid']; $can_pub_cp_topic = false; if ($item_id == $my_companyid) { $can_pub_cp_topic = true; } elseif (@is_file(ROOT_PATH . 'include/logic/cp.logic.php') && $member['companyid'] > 0) { $is_my_cpid = jlogic('cp')->is_cp_company($item_id); if ($is_my_cpid) { $can_pub_cp_topic = true; } } if (!$can_pub_cp_topic) { return "你没有权限进行当前操作"; } } else { $item = ''; $item_id = 0; $data['type'] = 'first'; } } if ($GLOBALS['_J']['config']['add_topic_need_face'] && !$member['__face__']) { return "本站需上传头像才可互动。"; } $MemberHandler =& Obj::registry('MemberHandler'); if ($MemberHandler) { if (!in_array($type, array('both', 'reply', 'forward'))) { if (!$MemberHandler->HasPermission('topic', 'add', 0, $member)) { if (true !== IN_JISHIGOU_SMS) { return $MemberHandler->GetError(); } } } else { if (('reply' == $type || 'both' == $type) && !$MemberHandler->HasPermission('topic', 'reply', 0, $member)) { return $MemberHandler->GetError(); } elseif (('forward' == $type || 'both' == $type) && !$MemberHandler->HasPermission('topic', 'forward', 0, $member)) { return $MemberHandler->GetError(); } } } if (MEMBER_ROLE_TYPE != 'admin') { if ($GLOBALS['_J']['config']['topic_vip'] == 1) { if (!$member['validate']) { return "非V认证用户无法发布信息"; } } elseif ($GLOBALS['_J']['config']['topic_vip'] == 2) { $to_verify = 1; if (!$member['validate']) { $f_rets['vip'] = 1; $f_rets['msg'] = '非V认证用户发言内容进入<a href="index.php?mod=' . $member['uid'] . '&type=my_verify" target="_blank">待审核</a>, <a href="' . $GLOBALS['_J']['config']['site_url'] . '/index.php?mod=other&code=vip_intro" target="_blank">点击申请认证</a>'; $is_verify = true; } } } $data['username'] = $username = $member['username']; $topic_content_id = abs(crc32(md5($content))); if (!$verify) { if ($GLOBALS['_J']['config']['lastpost_time'] > 0 && !in_array($data['from'], array('sina', 'qqwb')) && $timestamp - $member['lastpost'] < $GLOBALS['_J']['config']['lastpost_time']) { return "您发布的太快了,请在<b>{$GLOBALS['_J']['config']['lastpost_time']}</b>秒后再发布"; } } #if NEDU if (defined('NEDU_MOYO')) { if (false != ($deny = nlogic('feeds.app.jsg')->topic_publish_denied($data))) { return $deny; } } #endif if ($imageid) { if ($verify) { $data['imageid'] = $imageid; } else { $data['imageid'] = $imageid = jlogic('image')->get_ids($imageid, $data['uid']); } } if ($attachid) { if ($verify) { $data['attachid'] = $attachid; } else { $data['attachid'] = $attachid = jlogic('attach')->get_ids($attachid, $data['uid']); } } $data['musicid'] = $musicid; if ($xiami_id > 0) { $musicid = $data['musicid'] = jtable('topic_music')->insert(array('uid' => $data['uid'], 'username' => $data['username'], 'dateline' => $timestamp, 'xiami_id' => $xiami_id), true); } $topic_more = array(); $parents = ''; $data['roottid'] = 0; if ($totid > 0) { $content = $this->GetForwardContent($content); $_type_names = array('both' => '转发和评论', 'forward' => '转发', 'reply' => '评论'); $_type_name = $_type_names[$type]; $to_topic = $row = $this->Get($totid); if (!$to_topic) { return "对不起,由于原微博已删除,不能{$_type_name}"; } if (('reply' == $type || 'both' == $type) && ($rets = jsg_role_check_allow('topic_reply', $row['uid'], $data['uid']))) { return $rets['error']; } elseif (('forward' == $type || 'both' == $type) && ($rets = jsg_role_check_allow('topic_forward', $row['uid'], $data['uid']))) { return $rets['error']; } $topic_more = $this->GetMore($totid); $data['totid'] = $row['tid']; $data['touid'] = $row['uid']; $data['tousername'] = $row['nickname']; $parents = $topic_more['parents'] ? $topic_more['parents'] . ',' . $totid : $totid; $data['roottid'] = $topic_more['parents'] ? substr($parents, 0, strpos($parents, ',')) : $totid; $root_topic = $this->Get($data['roottid']); if ($root_topic['item'] == 'qun' && $root_topic['item_id'] > 0) { $qun_closed = DB::result_first("SELECT closed FROM " . DB::table('qun') . " WHERE qid='{$root_topic['item_id']}'"); if ($qun_closed) { return "当前" . $GLOBALS['_J']['config'][changeword][weiqun] . "已经关闭,你无法发布内容"; } } if ($data['totid'] != $data['roottid']) { $rrow = $this->Get($data['roottid']); if (!$rrow) { return "对不起,由于原始微博已删除,不能{$_type_name}"; } if (('reply' == $type || 'both' == $type) && ($rets = jsg_role_check_allow('topic_reply', $rrow['uid'], $data['uid']))) { return $rets['error']; } elseif (('forward' == $type || 'both' == $type) && ($rets = jsg_role_check_allow('topic_forward', $rrow['uid'], $data['uid']))) { return $rets['error']; } if ('forward' == $type || 'both' == $type) { $content .= $this->ForwardSeprator . "{$row['nickname']} : " . addslashes($this->_content_strip($row['raw_content'])); } } } $_process_result = $this->_process_content($content, $data); $longtext = $_content = $_process_result['content']; $at_uids = $_process_result['at_uids']; $tags = $_process_result['tags']; $urls = $_process_result['urls']; unset($data['longtextid']); if (jstrlen($_content) > $this->_len) { $_content = cut_str($_content, $this->_len, ''); $_content = $this->_content_end($_content); if (strlen($longtext) > strlen($_content)) { $longtextid = 0; if ($is_verify) { $longtextid = jlogic('longtext')->Add($longtext, $data['uid']); } $longtextid = $longtextid > 0 ? $longtextid : TIMESTAMP; $data['longtextid'] = $longtextid; } } if (!$GLOBALS['_J']['config']['clear_format_open']) { $_content = $this->clearFormat($_content); } else { $_content = preg_replace('/\\n{3,}/', '\\n\\n', $_content); $_content = nl2br($_content); } if (strlen($_content) > 255) { $_content = cut_str($_content, 254 * 2, ''); $data['content'] = cut_str($_content, 255, ''); $data['content2'] = substr($_content, strlen($data['content'])); } else { $data['content'] = $_content; } $data['postip'] = $postip ? $postip : $GLOBALS['_J']['client_ip']; $data['post_ip_port'] = $GLOBALS['_J']['client_ip_port']; if ($is_verify) { $sql = "insert into `" . TABLE_PREFIX . "topic_verify` (`" . implode("`,`", array_keys($data)) . "`) values ('" . implode("','", $data) . "')"; DB::query($sql); $topic_id = $data['tid'] = $tid = DB::insert_id(); if ($imageid) { DB::query("update " . TABLE_PREFIX . "topic_image set `tid`='-1' where `id` in ({$imageid})"); } if ($attachid) { DB::query("update " . TABLE_PREFIX . "topic_attach set `tid`='-1' where `id` in ({$attachid})"); } if ($urls) { $date = $data; $date['id'] = $data['tid']; $date['tid'] = -1; $this->_process_urls($date, $urls, false, 'topic_verify'); } if ($notice_to_admin = $GLOBALS['_J']['config']['notice_to_admin']) { $pm_post = array('message' => $member['nickname'] . "有一条微博进入待审核状态,<a href='admin.php?jump_url=admin.php?mod=topic&code=verify' target='_blank'>点击</a>进入审核。", 'to_user' => str_replace('|', ',', $notice_to_admin)); $admin_info = DB::fetch_first('select `uid`,`username`,`nickname` from `' . TABLE_PREFIX . 'members` where `uid` = 1'); load::logic('pm'); $PmLogic = new PmLogic(); $PmLogic->pmSend($pm_post, $admin_info['uid'], $admin_info['username'], $admin_info['nickname']); } if ($f_rets['verify'] || $f_rets['vip']) { return array($f_rets['msg']); } } else { $tid = jtable('topic')->insert($data, true); if ($tid < 1) { return "未知的错误"; } $topic_id = $data['tid'] = $tid; if (is_array($datas) && isset($datas['relateid'])) { $relateid = $datas['relateid'] ? $datas['relateid'] : 0; $featureid = $datas['featureid'] ? $datas['featureid'] : 0; if ($relateid) { DB::query("update `" . TABLE_PREFIX . "topic` set `relateid`='{$tid}',`featureid`='{$featureid}' where `tid`='{$relateid}'"); $pmtoinfo = jlogic('topic')->Get($relateid, '`uid`,`item_id`,`relateid`,`featureid`', ''); $ch_typeinfo = jlogic('channel')->get_channel_typeinfo_byid($pmtoinfo['item_id']); $msg = '您提出的'; $msg .= $ch_typeinfo['channel_type'] == 'ask' ? '问题' : '建议'; $msg .= $pmtoinfo['relateid'] == 0 ? ',已经有了答复' : '重新给予了答复'; if ($featureid != $pmtoinfo['featureid']) { $msg .= ',状态变更为“' . ($ch_typeinfo['feature'][$featureid] ? $ch_typeinfo['feature'][$featureid] : '等待处理') . '”'; } postpmsms($pmtoinfo['uid'], $relateid, $msg); } } if ($is_new) { if (!empty($item) && $item_id > 0 && !($design == 'design' || $design == 'btn_wyfx')) { jfunc('app'); $param = array('item' => $item, 'item_id' => $item_id, 'tid' => $tid, 'uid' => $data['uid']); if ($item == 'talk') { $param['touid'] = $touid; $param['totid'] = $totid; } app_add_relation($param); unset($param); } jtable('topic_more')->add($tid, $parents, $longtext); } jtable('member_topic')->add($tid); if ($parents && 'first' != $data['type']) { jtable('topic_relation')->add($tid, $parents); } $p = array('uid' => $data['uid'], 'lastactivity' => $data['lastupdate'], 'lastpost' => $data['lastupdate'], 'last_topic_content_id' => $topic_content_id); if ('reply' != $data['type']) { $p['+@topic_count'] = 1; } jtable('members')->update($p); if ($at_uids) { $this->_process_at_uids($data, $at_uids); ios_push_msg($at_uids, '你有新消息:1条@我'); } if ($totid > 0 && $parents) { $this->_process_reply($data); ios_push_msg($totid, '你有新消息:1条评论'); } if ($urls) { $this->_process_urls($data, $urls); } if ($imageid) { jlogic('image')->set_tid($imageid, $tid); } if ($attachid) { jlogic('attach')->set_tid($attachid, $tid); } if ($musicid) { $sql = "update `" . TABLE_PREFIX . "topic_music` set `tid` = '{$tid}' where `id` = '{$musicid}' "; DB::query($sql); } if ($data['videoid'] > 0) { $sql = "update `" . TABLE_PREFIX . "topic_video` set `tid`='{$tid}' where `id`='{$data['videoid']}'"; DB::query($sql); } #有奖转发判断 if ($is_reward) { $allowed_reward = 1; $reward_info = jlogic('reward')->getRewardInfo($is_reward); if ($reward_info['rules']) { foreach ($reward_info['rules'] as $key => $val) { if ($allowed_reward == 0) { break; } switch ($key) { case 'at_num': if ($val > count($at_uids)) { $allowed_reward = 0; } break; case 'user': $my_buddyids = get_buddyids($data['uid']); if (!$my_buddyids) { $allowed_reward = 0; break; } foreach ($val as $re_uid => $re_name) { if ($re_uid == $data['uid']) { continue; } if (!in_array($re_uid, $my_buddyids)) { $allowed_reward = 0; break; } } break; case 'tag': foreach ($val as $re_tag) { if (!$tags) { $allowed_reward = 0; break; } if (!in_array($re_tag, $tags)) { $allowed_reward = 0; break; } } break; default: break; } } } #超时转发也不可进入有奖转发名单 if (TIMESTAMP > $reward_info['tot']) { $allowed_reward = 0; } #记录有奖转发 DB::query(" insert into `" . TABLE_PREFIX . "reward_user` (`uid`,`tid`,`rid`,`on`,`dateline`) values('{$data['uid']}','{$tid}','{$is_reward}','{$allowed_reward}','" . TIMESTAMP . "')"); DB::query(" update `" . TABLE_PREFIX . "reward` set `f_num` = `f_num`+1,`a_num`=`a_num`+{$allowed_reward} where `id` = '{$is_reward}' "); } if ($item == 'qun' && ($data['type'] == 'qun' || $data['type'] == 'first')) { if (!empty($item_id)) { $query = DB::query("SELECT uid FROM " . DB::table('qun_user') . " WHERE qid='{$item_id}'"); $uids = array(); while ($value = DB::fetch($query)) { if ($value['uid'] != $uid) { $uids[$value['uid']] = $value['uid']; } } if (!empty($uids)) { DB::query("UPDATE " . DB::table('members') . "\r\n\t \t\t\t\t\t SET qun_new=qun_new+1\r\n\t \t\t\t\t\t WHERE uid IN(" . jimplode($uids) . ")"); } } } if ($item == 'channel' && $item_id > 0 && ($data['type'] == 'first' || $data['type'] == 'channel')) { if (!empty($item_id)) { $query = DB::query("SELECT uid FROM " . DB::table('buddy_channel') . " WHERE ch_id='{$item_id}'"); $uids = array(); while ($value = DB::fetch($query)) { if ($value['uid'] != $uid) { $uids[$value['uid']] = $value['uid']; } } if (!empty($uids)) { DB::query("UPDATE " . DB::table('members') . "\r\n\t \t\t\t\t\t SET channel_new=channel_new+1\r\n\t \t\t\t\t\t WHERE uid IN(" . jimplode($uids) . ")"); } } if ($GLOBALS['_J']['config']['extcredits_enable'] && $data['uid'] > 0) { $credits_itemid = jlogic('channel')->is_update_credits_byid($item_id); if ($credits_itemid) { update_credits_by_action('_C' . crc32($credits_itemid), $data['uid']); } } } if ($item == 'company' && $item_id > 0 && $data['type'] == 'company') { $query = DB::query("SELECT uid FROM " . DB::table('members') . " WHERE companyid='{$item_id}'"); $uids = array(); while ($value = DB::fetch($query)) { if ($value['uid'] != $uid) { $uids[$value['uid']] = $value['uid']; } } $query = DB::query("SELECT uid FROM " . DB::table('cp_user') . " WHERE companyid='{$item_id}'"); while ($value = DB::fetch($query)) { if ($value['uid'] != $uid) { $uids[$value['uid']] = $value['uid']; } } if (!empty($uids)) { DB::query("UPDATE " . DB::table('members') . " SET company_new=company_new+1 WHERE uid IN(" . jimplode($uids) . ")"); } } $update_credits = false; if ($tags) { Load::logic('tag'); $TagLogic = new TagLogic('topic'); $TagLogic->Add(array('item_id' => $tid, 'tag' => $tags), false); if ($GLOBALS['_J']['config']['extcredits_enable'] && $data['uid'] > 0) { if (is_array($tags) && count($tags)) { if ($GLOBALS['_J']['config']['sign']['sign_enable'] && jtable('sign_tag')->is_sign_tag($tags)) { $sign_credits = update_credits_by_action('_S', $data['uid']); } if (!$sign_credits['updatecredit']) { foreach ($tags as $_t) { if ($_t) { $update_credits = update_credits_by_action('_T' . crc32($_t), $data['uid']) || $update_credits; } } } } } jlogic('tag_favorite')->topic_new($tags, $data['uid']); } if ($GLOBALS['_J']['config']['extcredits_enable']) { if (!$update_credits && !$sign_credits && $data['uid'] > 0) { if ($totid > 0) { update_credits_by_action('reply', $data['uid']); } else { update_credits_by_action('topic', $data['uid']); } } } if ($GLOBALS['_J']['config']['imjiqiren_enable'] && imjiqiren_init()) { $to_admin_robot = jconf::get('imjiqiren', 'admin_qq_robots'); if ($to_admin_robot) { imjiqiren_send_message($to_admin_robot, 'to_admin_robot', array('site_url' => $GLOBALS['_J']['config']['site_url'], 'username' => $data['username'], 'content' => $data['content'], 'topic_id' => $topic_id)); } } if ($GLOBALS['_J']['config']['sms_enable'] && sms_init()) { $to_admin_mobile = jconf::get('sms', 'admin_mobile'); if ($to_admin_mobile) { sms_send_message($to_admin_mobile, 'to_admin_mobile', array('site_url' => $GLOBALS['_J']['config']['site_url'], 'username' => $data['username'], 'content' => $data['content'], 'topic_id' => $topic_id)); } } if (@is_file(ROOT_PATH . 'include/logic/cp.logic.php') && $GLOBALS['_J']['config']['company_enable'] && $member['companyid'] > 0) { $CpLogic = jlogic('cp'); $update_companyid = $member['companyid']; $update_departmentid = $member['departmentid']; if ($item = 'company' && $item_id > 0 && $update_companyid != $item_id) { $cp_company_info = $CpLogic->get_cp_row_bycompany($item_id); if ($cp_company_info) { $update_companyid = $member['companyid']; $update_departmentid = $member['departmentid']; } } $CpLogic->update('company', $update_companyid, 0, 1); if ($update_departmentid > 0) { $CpLogic->update('department', $update_departmentid, 0, 1); } } $feed_action = ''; if (in_array($data['type'], array('first', 'reply', 'forward', 'both'))) { $feed_action = $data['type']; if ($feed_action == 'first') { $feed_action = 'post'; } elseif ($feed_action == 'both') { $feed_action = 'reply'; } } if ($feed_action) { $feed_msg = cut_str($data['content'], 30, ''); feed_msg('channel', $feed_action, $tid, $feed_msg, $item_id, $data['anonymous']); } $this->_syn_to($data); } if ($GLOBALS['_J']['plugins']['func']['posttopic']) { hookscript('posttopic', 'funcs', array('param' => array($data['tid']), 'step' => 'post'), 'posttopic'); } if ('reply' != $data['type']) { cache_db('rm', "{$data['uid']}-topic-%", 1); jtable('topic')->archive($data['tid']); } $this->cache_rm($data['tid']); #if NEDU defined('NEDU_MOYO') && nfevent('jsg.logic.topic.add', null, $data); #endif return $data; }
function createEvent($post, $item = '', $item_id = 0, $verify = 1) { if ($this->allowedCreate(MEMBER_ID)) { return 0; } $item_id = max(0, (int) $item_id); $qua_arr = array(); if ($post['qua'] == 'qua') { if ($post['fans']) { $qua_arr['fans_num'] = (int) $post['fans_num']; } if ($post['same_city']) { $qua_arr['same_city'] = 1; } if ($post['inqun']) { $qua_arr['inqun'] = $post['inqun']; } } $qualification = serialize($qua_arr); $need_app_info = $post['info'] ? serialize($post['info']) : serialize(array()); $postman = MEMBER_ID; if ($post['money_r'] == 'money') { $money = is_numeric($post['money']) ? $post['money'] : 0; } else { $money = 0; } $time = TIMESTAMP; $fromt = strtotime($post['fromt'] . " " . $post['hour_select_from'] . ":" . $post['min_select_from']); $tot = strtotime($post['tot'] . " " . $post['hour_select_to'] . ":" . $post['min_select_to']); $post['content1'] = strip_tags(str_replace('\\"', '"', $post['content1'])); if ($post['act']) { if (jdisallow()) { return array(); } $post['id'] = (int) $post['id']; $sql = "update " . TABLE_PREFIX . "event\r\n\t \t\t\tset\r\n\t \t\t\t type_id = '{$post['type']}',\r\n\t \t\t\t title = '{$post['name']}',\r\n\t \t\t\t fromt = '{$fromt}',\r\n\t \t\t\t tot = '{$tot}',\r\n\t \t\t\t content = '{$post['content1']}',\r\n\t \t\t\t image = '{$post['hid_pic']}',\r\n\t \t\t\t province_id = '{$post['province']}',\r\n\t \t\t\t area_id = '{$post['area']}',\r\n\t \t\t\t city_id = '{$post['city']}',\r\n\t \t\t\t address = '{$post['address']}',\r\n\t \t\t\t money = '{$money}',\r\n\t \t\t\t lasttime = '{$time}',\r\n\t \t\t\t qualification = '{$qualification}',\r\n\t \t\t\t postip = '" . $GLOBALS['_J']['client_ip'] . "',\r\n\t \t\t\t need_app_info = '{$need_app_info}'\r\n\t \t\t\twhere id = '{$post[id]}'"; DB::query($sql); $values = array('id' => $post[id]); return $values; } $sql = "insert into " . TABLE_PREFIX . "event (\r\n\t \t\t\ttype_id,title,fromt,tot,content,\r\n\t \t\t\timage,province_id,area_id,city_id,address,money,\r\n\t \t\t\tpostman,posttime,lasttime,qualification,need_app_info,verify,postip,item,item_id\r\n\t ) values (\r\n\t \t\t\t'{$post['type']}','{$post['name']}','{$fromt}','{$tot}','{$post['content1']}',\r\n\t \t\t\t'{$post['hid_pic']}','{$post['province']}','{$post['area']}','{$post['city']}','{$post['address']}',{$money},\r\n\t \t\t\t'{$postman}',{$time},{$time},'{$qualification}','{$need_app_info}',{$verify},'" . $GLOBALS['_J']['client_ip'] . "','{$item}','{$item_id}'\r\n\t )"; DB::query($sql); $id = DB::insert_id(); if ($item == 'qun' && $item_id) { DB::query("insert into `" . TABLE_PREFIX . "qun_event` (`qid`,`eid`) values ('{$item_id}','{$id}')"); } if ($verify == 0) { if ($notice_to_admin = $GLOBALS['_J']['config']['notice_to_admin']) { $pm_post = array('message' => MEMBER_NICKNAME . "发布了一个活动进入待审核状态,<a href='admin.php?mod=event&code=verify' target='_blank'>点击</a>进入审核。", 'to_user' => str_replace('|', ',', $notice_to_admin)); $admin_info = DB::fetch_first('select `uid`,`username`,`nickname` from `' . TABLE_PREFIX . 'members` where `uid` = 1'); load::logic('pm'); $PmLogic = new PmLogic(); $PmLogic->pmSend($pm_post, $admin_info['uid'], $admin_info['username'], $admin_info['nickname']); } } return $id; }
function need_info() { load::logic('event'); $EventLogic = new EventLogic(); $id = (int) $this->Get['id']; $post = $this->Post; $profile = jlogic('member_profile')->getProfile(); $event_info = $EventLogic->get_event_info($id); $qua = $event_info['need_app_info']; $qua_info = unserialize($qua); $qua_arr = array(); $time = TIMESTAMP; if ($qua_info) { foreach ($qua_info as $key => $val) { if (!$post[$val]) { json_error("请输入" . $profile[$val]['title']); } if ($profile[$val]['formtype'] == 'select' && $profile[$val]['choices']) { $choices = explode("\r\n", $profile[$val]['choices']); foreach ($choices as $v) { list($v1, $v2) = explode("|", $v); $v2 || ($v2 = $v1); $new_choices[$v1] = $v2; } if ($new_choices[$post[$val]]) { $post[$val] = $new_choices[$post[$val]]; } unset($new_choices); } $qua_arr[$profile[$val]['title']] = $post[$val]; } } $qua_arr['留言'] = $post['content']; $qua = serialize($qua_arr); $EventLogic->doApp($id, $qua); json_result("1"); }
function BatchProcess() { load::logic('topic_manage'); $TopicManage = new TopicManageLogic(); $PmLogic = load::logic('pm', 1); $managetype = get_param('managetype'); foreach ($managetype as $key => $val) { if (!$key || !$val) { continue; } $sql = "select r.*,m.nickname,t.tid as ttid,t.content as tcontent from `" . TABLE_PREFIX . "report` r\r\n\t\t\t\t\tleft join `" . TABLE_PREFIX . "members` m on m.uid = r.uid\r\n\t\t\t\t\tleft join `" . TABLE_PREFIX . "topic` t on t.tid = r.tid\r\n\t\t\t\t\twhere r.id = '{$key}'"; $query = $this->DatabaseHandler->Query($sql); $report = $query->GetRow(); $this->DatabaseHandler->Query("delete from `" . TABLE_PREFIX . "report` where id = '{$key}' "); if (!$report['ttid']) { continue; } $TopicManage->doManage($report['ttid'], $val); $do = $val == 1 ? '正常显示' : '删除微博'; $pm_post = array('message' => '管理员<a href="index.php?mod=' . MEMBER_ID . '" href="_blank">' . MEMBER_NICKNAME . '</a>已对您举报的微博【' . cut_str($report['tcontent'], 20) . '】做了' . $do . '的处理,感谢你对本站维护做出的贡献。', 'to_user' => $report['nickname']); $PmLogic->pmSend($pm_post); } $this->Messager("操作成功"); }
function editEvent() { $id = (int) $this->Get['id']; load::logic('event'); $EventLogic = new EventLogic(); $postman = $EventLogic->get_postman($id); if ($postman != MEMBER_ID) { $this->Messager("你无权修改该活动"); } $free = 'checked'; $all = 'checked'; $info = array(); $info = jconf::get('profileeventinfo'); $val = array(); if ($id) { $act = "edit"; $val = $EventLogic->get_event_info($id); $item_id = $val['item_id']; $title = $val['title']; $moneys = $val['money']; $content = $val['content']; $address = $val['address']; if ($val['image']) { $image = $val['image']; } $edit_fromt = date("Y-m-d", $val['fromt']); $edit_fromt_h = date("H", $val['fromt']); $edit_fromt_i = date("i", $val['fromt']); $edit_tot = date("Y-m-d", $val['tot']); $edit_tot_h = date("H", $val['tot']); $edit_tot_i = date("i", $val['tot']); if ($val['money']) { $money = 'checked'; $free = ''; } else { $money = ''; $free = 'checked'; } $qualification = unserialize($val['qualification']); if (count($qualification)) { $qua = "checked"; $all = ""; if ($qualification['fans_num']) { $fans = "checked"; $fans_num = $qualification['fans_num']; } if ($qualification['same_city']) { $same_city = "checked"; } if ($qualification['inqun']) { $inqun = " checked "; } } $need_app_info = unserialize($val['need_app_info']); if (count($need_app_info)) { foreach ($need_app_info as $value) { $info[$value]['checked'] = "checked"; } } } $rs = $EventLogic->get_event_type(TRUE); $event_type = jform()->Select("type", $rs, $val['type_id']); $province = $EventLogic->get_province(); $province_id = $val['province_id']; $hid_province = $province_id; $province_list = jform()->Select("province", $province, $province_id, "onchange=\"changeProvince();\""); $city_id = $val['city_id']; $hid_city = $city_id; $area_id = $val['area_id']; $hid_area = $area_id; $fromt = $edit_fromt ? $edit_fromt : my_date_format(TIMESTAMP, 'Y-m-d'); $edit_fromt_h = $edit_fromt_h ? $edit_fromt_h : false; $edit_fromt_i = $edit_fromt_i ? $edit_fromt_i : false; $hour_select_from = mk_time_select('hour', $edit_fromt_h, 'hour_select_from'); $min_select_from = mk_time_select('min', $edit_fromt_i, 'min_select_from'); $tot = $edit_tot ? $edit_tot : my_date_format(TIMESTAMP + 7 * 24 * 3600, 'Y-m-d'); $edit_tot_h = $edit_tot_h ? $edit_tot_h : false; $edit_tot_i = $edit_tot_i ? $edit_tot_i : false; $hour_select_to = mk_time_select('hour', $edit_tot_h, 'hour_select_to'); $min_select_to = mk_time_select('min', $edit_tot_i, 'min_select_to'); $member = $this->Member; $this->Title = "修改活动"; include template('event/event_create'); }
function VipIntro() { if (MEMBER_ID < 1) { $this->Messager("请先<a href='index.php?mod=login'>点此登录</a>或者<a href='index.php?mod=member'>点此注册</a>一个帐号", 'index.php?mod=member&code-login', 3); } $member = jsg_member_info(MEMBER_ID); $notUpToStandardVipConditions = $this->CheckVipCpnditions(); if (!$notUpToStandardVipConditions) { Load::logic('validate_category'); $this->ValidateLogic = new ValidateLogic($this); $is_card_pic = $this->Config['card_pic_enable']['is_card_pic']; if ($this->Post['postFlag']) { $validate_info = $this->Post['validate_remark']; $validate_info = trim(strip_tags((string) $validate_info)); if (empty($validate_info)) { $this->Messager('认证说明不能为空', -1); } $f_rets = filter($validate_info); if ($f_rets && $f_rets['error']) { $this->Messager($f_rets['msg'], -1); } $category_fid = $this->Post['category_fid']; $category_id = $this->Post['category_id']; if (empty($category_fid) || empty($category_id)) { $this->Messager('认证类别不能为空', -1); } $city = (int) $this->Post['city']; if ($city < 1) { $this->Messager('请填写所在区域', -1); } $validate_true_name = strip_tags(jpost('validate_true_name', 'txt')); if (empty($validate_true_name)) { $this->Messager('真实姓名不能为空', -1); } $validate_card_type = jpost('validate_card_type', 'txt'); if (empty($validate_card_type)) { $this->Messager('证件类型不能为空', -1); } $validate_card_id = strip_tags(jpost('validate_card_id', 'txt')); if (empty($validate_card_id)) { $this->Messager('证件号码不能为空', -1); } if ($is_card_pic) { $field = 'card_pic'; if (empty($_FILES) || !$_FILES[$field]['name']) { $this->Messager("请上传证件图片", -1); } } $data = array('uid' => MEMBER_ID, 'category_fid' => (int) $this->Post['category_fid'], 'category_id' => (int) $this->Post['category_id'], 'province' => jpost('province', 'txt'), 'city' => jpost('city', 'txt'), 'is_audit' => 0, 'dateline' => TIMESTAMP); $return_info = $this->ValidateLogic->Member_Validate_Add($data); if ($return_info['ids']) { if ($is_card_pic) { $image_id = $return_info['ids']; if (empty($_FILES) || !$_FILES[$field]['name']) { $this->Messager("请上传证件图片", -1); } $image_path = RELATIVE_ROOT_PATH . 'images/' . $field . '/' . $image_id . '/'; $image_name = $image_id . "_o.jpg"; $image_file = $image_path . $image_name; $image_file_small = $image_path . $image_id . "_s.jpg"; if (!is_dir($image_path)) { jio()->MakeDir($image_path); } jupload()->init($image_path, $field, true); jupload()->setNewName($image_name); $result = jupload()->doUpload(); if ($result) { $result = is_image($image_file); } if (!$result) { $this->Messager("上传图片失败", -1); } list($w, $h) = getimagesize($image_file); if ($w > 601) { $tow = 599; $toh = round($tow * ($h / $w)); $result = makethumb($image_file, $image_file, $tow, $toh); if (!$result) { jio()->DeleteFile($image_file); js_alert_output('大图片缩略失败'); } } $image_file = addslashes($image_file); $validate_card_pic = " `validate_card_pic` = '{$image_file}' ,"; } $sql = "update " . TABLE_PREFIX . "memberfields\r\n\t\t\t\t\t\tset {$validate_card_pic}\r\n\t\t\t\t\t\t\t`validate_remark` = '" . jpost('validate_remark', 'txt') . "' ,\r\n\t\t\t\t\t\t\t`validate_true_name`='" . jpost('validate_true_name', 'txt') . "' ,\r\n\t\t\t\t\t\t\t`validate_card_id` = '" . jpost('validate_card_id', 'txt') . "' ,\r\n\t\t\t\t\t\t\t`validate_card_type` = '" . jpost('validate_card_type', 'txt') . "'\r\n\t\t\t\t\t\twhere `uid`='" . MEMBER_ID . "'"; $this->DatabaseHandler->Query($sql); if ($notice_to_admin = $this->Config['notice_to_admin']) { $message = "用户" . MEMBER_NICKNAME . "申请了身份认证,<a href='admin.php?mod=vipintro&code=vipintro_manage' target='_blank'>点击</a>进入审核。"; $pm_post = array('message' => $message, 'to_user' => str_replace('|', ',', $notice_to_admin)); $admin_info = DB::fetch_first('select `uid`,`username`,`nickname` from `' . TABLE_PREFIX . 'members` where `uid` = 1'); load::logic('pm'); $PmLogic = new PmLogic(); $PmLogic->pmSend($pm_post, $admin_info['uid'], $admin_info['username'], $admin_info['nickname']); } } if ($return_info['msg_info']) { $this->Messager($return_info['msg_info']); } } $sql = "select * from `" . TABLE_PREFIX . "validate_category_fields` where `uid`='" . MEMBER_ID . "' "; $query = $this->DatabaseHandler->Query($sql); $validate_info = $query->GetRow(); $sql = "select * from `" . TABLE_PREFIX . "memberfields` where `uid`='" . MEMBER_ID . "'"; $query = $this->DatabaseHandler->Query($sql); $memberfields = $query->GetRow(); $memberfields['validate_card_type'] = $memberfields['validate_card_type'] ? $memberfields['validate_card_type'] : '未知'; $dateline = date('Y-m-d', $validate_info['dateline']); if (empty($validate_info['uid']) || $validate_info['is_audit'] == -1) { if (!$memberfields) { $memberfields = array(); $memberfields['uid'] = $member['uid']; $sql = "insert into `" . TABLE_PREFIX . "memberfields` (`uid`) values ('{$member['uid']}')"; $this->DatabaseHandler->Query($sql); } $_options = array('0' => array('name' => '请选择', 'value' => '0'), '身份证' => array('name' => '身份证', 'value' => '身份证'), '学生证' => array('name' => '学生证', 'value' => '学生证'), '军官证' => array('name' => '军官证', 'value' => '军官证'), '护照' => array('name' => '护照', 'value' => '护照'), '营业执照' => array('name' => '营业执照', 'value' => '营业执照'), '官方公函' => array('name' => '官方公函', 'value' => '官方公函'), '其他' => array('name' => '其他', 'value' => '其他')); $select_value = $memberfields['validate_card_type'] ? $memberfields['validate_card_type'] : "身份证"; $validate_card_type_select = jform()->Select('validate_card_type', $_options, $select_value); $query = $this->DatabaseHandler->Query("select * from " . TABLE_PREFIX . "common_district where `upid` = '0' order by list"); while ($rsdb = $query->GetRow()) { $province[$rsdb['id']]['value'] = $rsdb['id']; $province[$rsdb['id']]['name'] = $rsdb['name']; if ($member['province'] == $rsdb['name']) { $province_id = $rsdb['id']; } } $province_list = jform()->Select("province", $province, $province_id, "onchange=\"changeProvince();\""); $member_city = DB::fetch_first("SELECT * FROM " . DB::table('common_district') . " WHERE `name`='{$member['city']}'"); } $where_list = " `category_id` = '' "; $query = DB::query("SELECT *\r\n\t\t\t\t\t\t\tFROM " . DB::table('validate_category') . "\r\n\t\t\t\t\t\t\twhere {$where_list} ORDER BY id ASC"); $category_list = array(); while ($value = DB::fetch($query)) { $category_list[] = $value; } if ($this->Post['category_fid']) { $sub_category_list = $this->ValidateLogic->Small_CategoryList($this->Post['category_fid']); } } $this->Title = "{$this->Config['site_name']}身份验证"; include template('other/topic_vip'); }
function delete_qun($qid, $cat_id) { $where_sql = " qid='{$qid}' "; DB::query("DELETE FROM " . DB::table('qun') . " WHERE {$where_sql}"); DB::query("DELETE FROM " . DB::table('qun_user') . " WHERE {$where_sql}"); $this->delete_tag_relation($qid); $info = DB::fetch_first("SELECT icon FROM " . DB::table('qun') . " WHERE qid='{$qid}'"); if (!empty($info['icon'])) { unlink($this->qun_avatar($qid, 's')); unlink($this->qun_avatar($qid, 'b')); } DB::query("DELETE FROM " . DB::table('qun_announcement') . " WHERE qid='{$qid}'"); $cat_ary = $this->get_category(); $top_cat_id = $cat_ary['second'][$cat_id]['parent_id']; DB::query("UPDATE " . DB::table('qun_category') . "\r\n\t\t\t\t SET qun_num = if(qun_num>0,qun_num-1,0)\r\n\t\t\t\t WHERE cat_id IN('{$cat_id}','{$top_cat_id}') "); $this->update_category_cache(); load::logic('event'); $EventLogic = new EventLogic(); $eid_arr = array(); $query = DB::query("SELECT eid FROM " . DB::table('qun_event') . " WHERE qid='{$qid}'"); while ($val = DB::fetch($query)) { $eid_arr[$val['eid']] = $val['eid']; } foreach ($eid_arr as $key => $eid) { $EventLogic->delEvent($eid); } $tids = array(); $query = DB::query("SELECT tid FROM " . DB::table('topic_qun') . " WHERE item_id='{$qid}'"); while ($value = DB::fetch($query)) { $tids[] = $value['tid']; } if (!empty($tids)) { DB::query("DELETE FROM " . DB::table('topic_qun') . " WHERE item_id='{$qid}'"); $where_sql = " tid IN(" . jimplode($tids) . ") "; DB::query("DELETE FROM " . DB::table('topic') . " WHERE {$where_sql} "); } }
function Delete() { $ids = (array) ($this->Post['ids'] ? $this->Post['ids'] : $this->Get['ids']); if (!$ids) { $this->Messager("请指定要删除的对象"); } $pmid_list = jimplode($ids); load::logic('pm'); $PmLogic = new PmLogic(); $query = $this->DatabaseHandler->Query("select distinct msgfromid,msgtoid,plid from " . TABLE_PREFIX . "pms where pmid in ({$pmid_list})"); $sql = "delete from `" . TABLE_PREFIX . "pms` where `pmid` in ({$pmid_list})"; $this->DatabaseHandler->Query($sql); while ($rsdb = $query->GetRow()) { $PmLogic->setNewList($rsdb['msgfromid'], $rsdb['msgtoid'], $rsdb['plid']); if ($rsdb['msgfromid'] != $rsdb['msgtoid']) { $PmLogic->setNewList($rsdb['msgtoid'], $rsdb['msgfromid'], $rsdb['plid']); } } $this->Messager($return ? $return : "操作成功"); }