Example #1
0
 function addBlacklist($uid)
 {
     if ($uid == MEMBER_ID) {
         return 402;
     } else {
         $member = $this->TopicLogic->GetMember($uid);
         if (empty($member)) {
             return 300;
         }
     }
     $touid = $uid;
     $uid = MEMBER_ID;
     $count = DB::result_first("SELECT COUNT(*) FROM " . DB::table('blacklist') . " WHERE uid='{$uid}' AND touid='{$touid}'");
     if ($count == 0) {
         $sql = "insert into `" . TABLE_PREFIX . "blacklist` (`uid`,`touid`) values ('{$uid}','{$touid}')";
         DB::query($sql);
         buddy_del($touid, $uid);
         buddy_del($uid, $touid);
         return 200;
     }
     return 312;
 }
Example #2
0
 function Add_User_Follow()
 {
     $success = 0;
     $uid = MEMBER_ID;
     if ($uid < 1) {
         $msg = "请先登录或者注册一个帐号";
     } else {
         if ($this->Post['uids']) {
             $uids = $this->Post['uids'];
         }
         if ($this->Post['ids']) {
             $uids = $this->Post['ids'];
         }
         if ($this->Post['media_uids_' . $this->Post['media_id']]) {
             $uids = $this->Post['media_uids_' . $this->Post['media_id']];
         }
         if (empty($uids)) {
             $msg = "请选择你要关注的用户";
         } else {
             $uids = (array) $uids;
             $buddyids = array();
             foreach ($uids as $v) {
                 $v = (int) $v;
                 if ($v > 0) {
                     $buddyids[$v] = $v;
                 }
             }
             $GLOBALS['disable_show_msg'] = 1;
             if ('add' == $this->Post['type']) {
                 foreach ($buddyids as $bid) {
                     buddy_add($bid, $uid);
                 }
                 $success = 1;
                 $msg = "关注成功";
             } elseif ('del' == $this->Post['type']) {
                 foreach ($buddyids as $bid) {
                     buddy_del($bid, $uid);
                 }
                 $msg = "取消成功";
             }
         }
     }
     $__to = get_param('__to');
     if ('iframe' == $__to) {
         js_alert_output($msg, 'alert');
     } elseif ('json' == $__to) {
         if (!$success) {
             json_error($msg);
         } else {
             json_result($msg);
         }
     } else {
         response_text($msg);
     }
 }