示例#1
0
 function TopicContentView()
 {
     $TopicLogic = jlogic('topic');
     $tid = is_numeric($this->ID) ? $this->ID : 0;
     if ($tid < 1) {
         js_alert_output('ID 不能为空');
     }
     $topic_info = $TopicLogic->Get($tid);
     if (!$topic_info) {
         js_alert_output('内容已经不存在了');
     }
     $parent_list = array();
     if ($topic_info['parent_id']) {
         $parent_id_list = array($topic_info['parent_id'], $topic_info['top_parent_id']);
         if ($parent_id_list) {
             $parent_list = $TopicLogic->Get($parent_id_list);
         }
     }
     $sid = max(0, (int) ($this->Post['sid'] ? $this->Post['sid'] : $this->Get['sid']));
     if ($sid < 1 || $sid == $tid) {
         unset($sid);
     }
     $TPT_ = 'TPT_' != $this->Post['TPT_'] ? $this->Post['TPT_'] : '';
     $topic_view = $this->Post['topic_view'] ? 1 : 0;
     $together_view = 1;
     include template('topic_content_view_ajax');
 }
示例#2
0
 function ModuleObject($config)
 {
     $this->MasterObject($config);
     $this->my = $GLOBALS['_J']['member'];
     if (!MEMBER_ID && $this->Code != 'seccode') {
         js_alert_output("请先登录或者注册一个帐号");
     }
     $this->Execute();
 }
示例#3
0
 function ModuleObject(&$config)
 {
     $this->MasterObject($config);
     if (!MEMBER_ID) {
         js_alert_output("请先登录或者注册一个帐号");
     }
     Load::logic('live');
     $this->LiveLogic = new LiveLogic();
     Load::logic('talk');
     $this->TalkLogic = new TalkLogic();
     $this->Execute();
 }
示例#4
0
 function widgets()
 {
     $op_ary = array('simple_desc', 'my_qun');
     $op = $this->Get['op'];
     if (!in_array($op, $op_ary)) {
         exit;
     }
     if ($op == 'simple_desc') {
         $qid = intval($this->Get['qid']);
         if (!$this->QunLogic->is_qun_member($qid, MEMBER_ID)) {
             exit;
         }
         $qun_info = $this->QunLogic->get_qun_info($qid);
         if (!empty($qun_info)) {
             $qun_info['icon'] = $this->QunLogic->qun_avatar($qun_info['qid'], 's');
         } else {
             exit;
         }
         include template('qun/widgets_simple_desc');
     } else {
         if ($op == 'my_qun') {
             $uid = intval($this->Post['uid']);
             $where_sql = '';
             $limit_sql = '';
             $order_sql = '';
             if (!empty($uid)) {
                 $where_sql = ' AND q.gview_perm=0 ';
                 $limit_sql = ' LIMIT 12';
                 $order_sql = ' ORDER BY q.topic_num DESC,q.member_num DESC';
             } else {
                 if (MEMBER_ID < 1) {
                     js_alert_output("请先登录或者注册一个帐号");
                 }
                 $uid = MEMBER_ID;
             }
             $type = intval($this->Get['type']);
             $query = DB::query("SELECT q.qid,q.name\r\n\t\t\t\t\t\t\t\tFROM " . DB::table('qun_user') . " AS qu\r\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB::table('qun') . " AS q\r\n\t\t\t\t\t\t\t\tUSING(qid)\r\n\t\t\t\t\t\t\t\tWHERE qu.uid='{$uid}' {$where_sql}\r\n\t\t\t\t\t\t\t\t{$order_sql}\r\n\t\t\t\t\t\t\t\t{$limit_sql}");
             $myquns = array();
             while ($value = DB::fetch($query)) {
                 $value['icon'] = $this->QunLogic->qun_avatar($value['qid'], 's');
                 $myquns[] = $value;
             }
             if (!empty($uid)) {
                 include template('qun/widgets_my_qun');
             } else {
                 include template('qun/widgets_my_qun');
             }
         }
     }
 }
 function Modify()
 {
     if (MEMBER_ID < 1) {
         response_text("您没有权限编辑该附件,请您先登陆!");
     }
     $id = $modify_id = max(0, (int) $this->Post['id']);
     if ($id < 1) {
         js_alert_output('附件ID 错误');
     }
     $attach_info = $this->AttachLogic->get_info($modify_id);
     if (!$attach_info) {
         response_text('您要编辑的附件已经不存在了');
     }
     if (MEMBER_ROLE_TYPE != 'admin') {
         if (MEMBER_ID != $attach_info['uid']) {
             response_text("您没有权限编辑该附件,只有后台管理员和附件上传者可进行该操作!");
         }
     }
     include template('modify_attach_ajax');
 }
示例#6
0
 function Delete()
 {
     $tid = jget('tid', 'int');
     if ($tid < 1) {
         js_alert_output("请指定一个您要删除的话题");
     }
     $topic = $this->TopicLogic->Get($tid);
     if (!$topic) {
         js_alert_output("话题已经不存在了");
     }
     if (jdisallow($topic['uid'])) {
         js_alert_output("您无权删除该话题");
     }
     $return = $this->TopicLogic->Delete($tid);
     response_text($return . $this->js_show_msg());
 }
示例#7
0
 function Face()
 {
     if (MEMBER_ID < 1) {
         js_alert_output("请先登录或者注册一个帐号", 'alert');
     }
     $uid = jget('uid', 'int', 'G');
     $uid = $uid ? $uid : MEMBER_ID;
     $member = jsg_member_info($uid);
     if ('admin' != MEMBER_ROLE_TYPE) {
         if (!$this->Config['edit_face_enable'] && $member['__face__']) {
             js_alert_output('本站不允许用户修改头像。', 'alert');
         }
         if ($uid != MEMBER_ID) {
             js_alert_output('您没有权限修改此头像');
         }
     }
     $field = 'face';
     $temp_img_size = intval($_FILES[$field]['size'] / 1024);
     if ($temp_img_size >= 2048) {
         js_alert_output('图片文件过大,2MB以内', 'alert');
     }
     $type = trim(strtolower(end(explode(".", $_FILES[$field]['name']))));
     if ($type != 'gif' && $type != 'jpg' && $type != 'png' && $type != 'jpeg') {
         js_alert_output('图片格式不对', 'alert');
     }
     $image_name = substr(md5($_FILES[$field]['name']), -10) . ".{$type}";
     $image_path = RELATIVE_ROOT_PATH . 'images/temp/face_images/' . $image_name[0] . '/';
     $image_file = $image_path . $image_name;
     if (!is_dir($image_path)) {
         jio()->MakeDir($image_path);
     }
     jupload()->init($image_path, $field, true, false);
     jupload()->setNewName($image_name);
     $result = jupload()->doUpload();
     if ($result) {
         $result = is_image($image_file);
     }
     if (!$result) {
         js_alert_output('图片上载失败', 'alert');
     }
     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('大图片缩略失败', 'alert');
         }
     }
     $up_image_path = addslashes($image_file);
     echo "<script language='Javascript'>";
     if ($this->Post['temp_face']) {
         echo "window.parent.location.href='{$this->Config[site_url]}/index.php?mod=settings&code=face&temp_face={$up_image_path}'";
     } else {
         echo "parent.document.getElementById('cropbox').src='{$up_image_path}';";
         echo "parent.document.getElementById('img_path').value='{$up_image_path}';";
         echo "parent.document.getElementById('temp_face').value='{$up_image_path}';";
         echo "parent.document.getElementById('jcrop_init_id').onclick();";
         echo "parent.document.getElementById('cropbox_img1').value='{$up_image_path}';";
     }
     echo "</script>";
 }
示例#8
0
 function _show($is_modify = 0)
 {
     $this->_check_login();
     $longtext_info = array();
     $action = 'ajax.php?mod=longtext&code=do_add';
     if ($is_modify) {
         $action = 'ajax.php?mod=longtext&code=do_modify';
         $longtext_info = $this->LongtextLogic->get_info($this->ID);
         if (!$longtext_info) {
             js_alert_output('请指定一个正确的ID');
         }
     } else {
         $longtext = trim($this->Post['longtext'] ? $this->Post['longtext'] : $this->Get['longtext']);
         if ($longtext) {
             $longtext_info['longtext'] = $longtext;
         }
     }
     $content_id = trim($this->Post['content_id'] ? $this->Post['content_id'] : $this->Get['content_id']);
     if (!$content_id) {
         $content_id = 'i_already';
     }
     $button_id = trim($this->Post['button_id'] ? $this->Post['button_id'] : $this->Get['button_id']);
     if (!$button_id) {
         $button_id = 'publishSubmit';
     }
     $from_cls = trim($this->Post['from_cls'] ? $this->Post['from_cls'] : $this->Get['from_cls']);
     include template('topic_longtext_info_ajax');
 }
示例#9
0
 function DoVideo()
 {
     $url = $this->Post['url'];
     preg_match_all('~(?:https?\\:\\/\\/)(?:[A-Za-z0-9_\\-]+\\.)+[A-Za-z0-9]{2,4}(?:\\/[\\w\\d\\/=\\?%\\-\\&_\\~`@\\[\\]\\:\\+\\#]*(?:[^<>\'\\"\\n\\r\\t\\s])*)?~', $url, $match);
     if (empty($match)) {
         js_alert_output('输入正确的视频地址');
     }
     $ext = trim(strtolower(substr($url, strrpos($url, '.'))));
     $return = array();
     if ('.swf' == $ext) {
         $return = array('id' => $url, 'host' => 'flash', 'url' => $url, 'title' => $url);
     } else {
         $return = $this->TopicLogic->_parse_video($url);
     }
     $return_content = $return['title'] ? $return['title'] . ($this->Config['video_status'] ? "" : " {$url}") : '分享链接  ' . $url;
     $return_content = str_replace(array("\r\n", "\n\r", "\n", "\r"), " ", $return_content);
     if ($return) {
         $video_link = $return['id'];
         $video_hosts = $return['host'];
         $video_url = $return['url'];
         $video_img = '';
         if ($return['image_src']) {
             $return_video_img = $this->TopicLogic->_parse_video_image($return['image_src']);
             $return['image_local'] = $return_video_img['img'];
         }
         $video_img = $return['image_local'];
         $video_img_url = '';
         if ($video_img) {
             $video_img_url = $this->Config['ftp_on'] ? $return_video_img['url'] : "";
         }
         $timestamp = time();
         $sql = "insert into `" . TABLE_PREFIX . "topic_video`\r\n\t\t\t(`uid`,`tid`,`username`,`video_hosts`,`video_link`,`video_url`,`video_img`,`video_img_url`,`dateline`)\r\n\t\t\tvalues\r\n\t\t\t('" . MEMBER_ID . "','" . '' . "','" . MEMBER_NAME . "','" . $video_hosts . "','" . $video_link . "','" . $video_url . "','" . $video_img . "','{$video_img_url}','" . $timestamp . "')";
         $this->DatabaseHandler->Query($sql);
         $videoid = $this->DatabaseHandler->Insert_ID();
         if ($this->Config['ftp_on']) {
             $video_img = ltrim($video_img, '.');
         }
         if ($video_img) {
             $video_img_src = $video_img_url . $video_img;
         }
         if (empty($video_img_src)) {
             $video_img_src = 'images/vd.gif';
         }
         echo "<script language='Javascript'>";
         echo "parent.videoid={$videoid};";
         echo "parent.document.getElementById('upload_video_list').style.display='block';";
         echo "parent.document.getElementById('add_video').style.display='none';";
         echo "parent.document.getElementById('videoid').value='" . $videoid . "';";
         echo "parent.document.getElementById('video_img').src='" . $video_img_src . "';";
         echo "parent.document.getElementById('url').value='';";
         echo "parent.document.getElementById('i_already').value=parent.document.getElementById('i_already').value + ' " . $return_content . " ';";
         echo "parent.document.getElementById('return_ajax_video_title').innerHTML='[" . cut_str($return_content, 36) . "]';";
         echo "parent.document.getElementById('publishSubmit').disabled=false;";
         echo "parent.document.getElementById('i_already').focus();";
         echo "</script>";
     } else {
         echo "<script language='Javascript'>";
         echo "parent.document.getElementById('add_video').style.display='none';";
         echo "parent.document.getElementById('url').value='';";
         echo "if(''==parent.document.getElementById('i_already').value){parent.document.getElementById('i_already').value='" . $return_content . "';}";
         echo "parent.document.getElementById('publishSubmit').disabled=false;";
         echo "parent.document.getElementById('i_already').focus();";
         echo "</script>";
     }
 }
示例#10
0
 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');
 }
示例#11
0
function js_alert_showmsg($alert_msg)
{
    js_alert_output($alert_msg, 'show_message');
}
示例#12
0
 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;
     }
 }
示例#13
0
 function add()
 {
     $GLOBALS['disable_show_msg'] = 1;
     $response = '';
     $follow_button = $this->Post['follow_button'];
     if (MEMBER_ID < 1) {
         js_show_login('登录后才能执行此操作');
     }
     $uid = jpost('uid', 'int');
     if ($follow_button == 'channel' || $follow_button == 'channelnav') {
         $isbuddy = jlogic('channel')->channel_isbuddy($uid);
         $can_buddy = jlogic('channel')->can_view_topic($uid);
         if ($isbuddy) {
             jlogic('channel')->buddy_channel($uid, 0);
             $response = follow_channel($uid, 0);
         } else {
             if ($can_buddy) {
                 jlogic('channel')->buddy_channel($uid, 1);
                 $response = follow_channel($uid, 1);
             } else {
                 $response = '';
             }
         }
     } elseif ($this->Config['department_enable'] && $follow_button == 'department') {
         $isbuddy = DB::result_first("SELECT count(*) FROM " . DB::table('buddy_department') . " WHERE uid = '" . MEMBER_ID . "' AND did = '{$uid}'");
         if ($isbuddy) {
             DB::query("DELETE FROM " . DB::table('buddy_department') . " WHERE uid = '" . MEMBER_ID . "' AND did = '{$uid}'");
             $response = follow_department($uid, 0);
         } else {
             DB::query("INSERT INTO " . DB::table('buddy_department') . " (`uid`,`did`) values ('" . MEMBER_ID . "','{$uid}')");
             $response = follow_department($uid, 1);
         }
     } else {
         $rets = buddy_add($uid, MEMBER_ID, 1);
         if ($rets) {
             if ($rets['error']) {
                 js_alert_output($rets['error']);
             } else {
                 if ($follow_button == 'xiao') {
                     $response = follow_html2($uid, 0, 0, 0);
                 } else {
                     $response = follow_html($uid, 0, 0, 0);
                 }
             }
         } else {
             if ($follow_button == 'xiao') {
                 $response = follow_html2($uid, 1, 0, 0);
             } else {
                 $response = follow_html($uid, 1, 0, 0);
             }
         }
         $response .= '<success></success>';
         $u_nickname = DB::result_first("SELECT `nickname` FROM " . DB::table('members') . " WHERE uid = '{$uid}'");
         $response .= $u_nickname;
     }
     response_text($response);
 }