Ejemplo n.º 1
0
 function FavoriteTag()
 {
     $uid = MEMBER_ID;
     $tag = jget('tag', 'trim');
     $act = jget('act', 'trim', 'P');
     if ($uid < 1) {
         js_show_login("请先登录");
     }
     if (!$tag) {
         js_alert_showmsg('请先指定一个话题');
     }
     if ('delete' == $act) {
         jlogic('tag_favorite')->del($tag, $uid);
         js_alert_showmsg("已取消话题关注");
     } else {
         $rets = jlogic('tag_favorite')->add($tag, $uid);
         if ($rets['error'] && $rets['msg']) {
             js_alert_showmsg($rets['msg']);
         } else {
             if ('input_add' != $act) {
                 js_alert_showmsg('话题关注成功');
             } else {
                 $my_favorite_tags = jlogic('tag_favorite')->my_favorite($uid, 12);
                 include template('tag/tag_favorite_ajax');
             }
         }
     }
 }
Ejemplo n.º 2
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);
 }