function get_my_group($uid, $limit = 0)
 {
     $list = array();
     $uid = jfilter($uid, 'int');
     if ($uid > 0 && jallow($uid)) {
         if ($limit < 1) {
             $cache_key = $this->table . '-get_my_group-' . $uid;
             $cache_time = 300;
             if (false !== ($list = cache_db('mget', $cache_key))) {
                 return $list;
             }
         }
         $limit = jfilter($limit, 'int');
         $p = array('uid' => $uid, 'sql_order' => '`count` DESC, `order` ASC, `id` ASC', 'result_count' => $limit > 0 ? $limit : 999);
         $rets = $this->db->get($p);
         $list = array();
         if ($rets['list']) {
             foreach ($rets['list'] as $row) {
                 $list[$row['id']] = $row;
             }
         }
         if ($cache_time > 0) {
             cache_db('mset', $cache_key, $list, $cache_time);
         }
     }
     return $list;
 }
 function get($p = array())
 {
     $uid = (int) $p['uid'];
     $uid = $uid > 0 ? $uid : MEMBER_ID;
     if ($uid < 1) {
         return jerror('获取用户粉丝列表数据时,UID不能为空或您没有登录系统', -1);
     }
     $member = jsg_member_info($uid);
     if (empty($member)) {
         return jerror('您要查看的用户已经不存在了,UID错误', -2);
     }
     $count = (int) $member['fans_count'];
     if ($count < 1) {
         return array();
     }
     $page_num = 10;
     if (isset($p['page_num'])) {
         $page_num = (int) $p['page_num'];
         if ($page_num < 1 || $page_num > 100) {
             return jerror('请设置每页显示的数量在 1 ~ 100 之间', -3);
         }
     }
     $ps = array('result_count' => $count, 'page_num' => $page_num, 'page_url' => $p['page_url'], 'sql_field' => ' M.* ', 'sql_table' => ' `' . DB::table($this->db->table_name($uid)) . '` AS BF LEFT JOIN `' . DB::table('members') . '` AS M ON M.`uid`=BF.`touid` ', 'sql_where' => " BF.`uid`='{$uid}' AND M.`uid` IS NOT NULL ", 'sql_order' => ' BF.`dateline` DESC ', 'result_list_row_make_func' => 'jsg_member_make', 'result_list_make_func' => 'buddy_follow_html');
     if (true === IN_JISHIGOU_WAP) {
         unset($ps['result_list_make_func']);
     }
     if (jallow($uid)) {
         if ($member['fans_new'] > 0) {
             jlogic('member')->clean_new_remind('fans_new', $uid);
         }
         if ($p['nickname']) {
             $nickname = jfilter($p['nickname'], 'txt');
             if (strlen($nickname) < 3 || strlen($nickname) > 15) {
                 return jerror('搜索用户昵称时,字数请控制在 3 ~ 15 个字符之间', -4);
             }
             unset($ps['result_count']);
             $ps['cache_time'] = 600;
             $ps['sql_where'] .= ' AND ' . build_like_query(' M.`nickname` ', $nickname);
         }
         if ($p['order'] && in_array($p['order'], array('lastpost', 'fans_count'))) {
             $p['sql_order'] = ' M.`' . $p['order'] . '` DESC ';
         }
     }
     $rets = $this->db->get($ps);
     if (is_array($rets)) {
         $rets['member'] = $member;
     }
     if (true === IN_JISHIGOU_WAP) {
         if ($rets['list']) {
             $rets['list'] = buddy_follow_html($rets['list'], 'uid', 'wap_follow_html');
         }
         $rets = wap_iconv($rets);
     }
     return $rets;
 }
 public function get_member_vest($uid, $is_admin = 0)
 {
     $rets = array();
     $uid = (int) $uid;
     if ($uid > 0 && ($is_admin || jallow($uid))) {
         $useruid = $this->db->val(array('uid' => $uid), 'useruid');
         if ($useruid > 0) {
             $sql = " select mv.`uid` , mv.`useruid` , m.`username` , m.`nickname` from `" . TABLE_PREFIX . "members_vest` mv\r\n\t\t\t\t\t\t left join `" . TABLE_PREFIX . "members` m on m.`uid` = mv.`uid`\r\n\t\t\t\t\t\t where `useruid` = '{$useruid}' ";
             $query = DB::query($sql);
             while ($rs = DB::fetch($query)) {
                 $rs['face'] = face_get($rs['uid']);
                 $rets[$rs['uid']] = $rs;
             }
         }
     }
     return $rets;
 }
            echo $val['tid'];
            ?>
,'add');return false;">收藏</a></span> <?php 
        }
        ?>
 <?php 
    }
    ?>
 <a href="index.php?mod=topic&code=<?php 
    echo $val['tid'];
    ?>
" target="_blank" title="去<?php 
    echo $this->Config['changeword']["n_weibo"];
    ?>
详细页面浏览">详情</a> <?php 
    if (jallow($val['uid'])) {
        ?>
 <?php 
        if ($this->Code > 0 || in_array($this->Code, array('list_reply', 'do_add'))) {
            $eid = 'reply_list';
        } else {
            $eid = 'topic_list';
        }
        ?>
 <a href="javascript:void(0)" onclick="deleteTopic(<?php 
        echo $val['tid'];
        ?>
,'<?php 
        echo $eid;
        ?>
_<?php 
Example #5
0
 function attachs_list($num = 10, $where = '')
 {
     $total_attach = DB::result_first("SELECT count(*) FROM " . DB::table('topic_attach') . " WHERE tid>0 {$where}");
     $page_arr = page($total_attach, $num, 'index.php?mod=attach', array('return' => 'array'));
     $limit_sql = $page_arr['limit'];
     $attachs = array();
     $query = DB::query("SELECT * FROM " . DB::table('topic_attach') . " WHERE tid>0 {$where} ORDER BY id DESC {$limit_sql}");
     $candown = jclass('member')->HasPermission('uploadattach', 'down');
     $canviewtype = array('doc', 'ppt', 'pdf', 'xls', 'txt', 'docx', 'xlsx', 'pptx');
     while ($value = DB::fetch($query)) {
         $value['manage'] = jallow($value[uid]) ? true : false;
         $value['filesize'] = $value['filesize'] > 1024 * 1024 ? round($value['filesize'] / (1024 * 1024), 2) . 'MB' : ($value['filesize'] == 0 ? '未知' : round($value['filesize'] / 1024, 1) . 'KB');
         $value['dateline'] = my_date_format2($value['dateline']);
         $value['img'] = 'images/filetype/' . $value['filetype'] . '.gif';
         $value['url'] = ($value['site_url'] ? $value['site_url'] : $GLOBALS['_J']['site_url']) . '/' . str_replace('./', '', $value['file']);
         $value['onlineview'] = $candown && in_array($value['filetype'], $canviewtype) && $value['score'] == 0 ? $value['url'] : '';
         $attachs[$value['id']] = $value;
     }
     $return = array('list' => $attachs);
     $return['page'] = $page_arr ? $page_arr : $pagenum;
     return $return;
 }
Example #6
0
 function DeleteToBox($ids, $managetype = 1, $score = 0)
 {
     if (MEMBER_ID < 1) {
         return '游客不能执行此操作';
     }
     if (!function_exists('item_topic_from')) {
         jfunc('item');
     }
     if (is_numeric($ids)) {
         $where = " where tid = '{$ids}' ";
     } elseif (is_array($ids)) {
         $where = " where tid in ('" . implode("'.'", $ids) . "') ";
     } elseif (is_string($ids)) {
         $where = $ids;
     } else {
         return '所指定的微博有误。';
     }
     if (!$ids) {
         return '微博已经不存在了';
     }
     $tbs = array('topic_recommend' => 'tid');
     $query = DB::query("select * from " . TABLE_PREFIX . "topic {$where} ");
     $topics = array();
     while ($rs = DB::fetch($query)) {
         if ($rs['item'] == 'channel' && $rs['item_id'] > 0) {
             $rs = item_topic_from($rs);
         }
         if (!(jallow($rs['uid']) || $rs['ismanager'])) {
             return '您没有权限执行此操作';
         }
         $topics[$rs['tid']] = $rs;
     }
     if (count($topics) < 1) {
         return '微博已经不存在了.';
     }
     foreach ($topics as $value) {
         $tid = $value['tid'] = (int) $value['tid'];
         if ($value['tid'] < 1) {
             continue;
         }
         jtable('topic')->rm($value['tid']);
         $value['managetype'] = $managetype;
         $value['content'] = addslashes($value['content']);
         $value['content2'] = addslashes($value['content2']);
         jtable('topic_verify')->insert($value);
         if ($value['imageid']) {
             DB::query("update " . TABLE_PREFIX . "topic_image set `tid`='-1' where `id` in ({$value['imageid']})");
         }
         if ($value['attachid']) {
             DB::query("update " . TABLE_PREFIX . "topic_attach set `tid`='-1' where `id` in ({$value['attachid']})");
         }
         if ($GLOBALS['_J']['config']['extcredits_enable'] && $value['uid'] > 0) {
             if ($value['uid'] == MEMBER_ID) {
                 update_credits_by_action('topic_del', $value['uid']);
             } else {
                 $credit_logic = jlogic('credits');
                 $rule = $credit_logic->GetRule('topic_del');
                 $credit_logic->UpdateCreditsByRule($rule, $value['uid'], 1, $score);
                 $data = array('uid' => $value['uid'], 'rid' => 0, 'relatedid' => MEMBER_ID, 'dateline' => time(), 'remark' => "删除微博 【微博ID:{$tid}】");
                 foreach ($GLOBALS['_J']['config']['credits']['ext'] as $key => $value) {
                     if ($value['enable'] == 1 && $score != 0) {
                         $data[$key] = $score;
                     }
                     if ($value['enable'] == 1 && $score == 0) {
                         $data[$key] = $rule[$key];
                     }
                 }
                 jtable('credits_log')->insert($data);
             }
             if ($value['item'] == 'channel' && $value['item_id'] > 0 && ($value['type'] == 'first' || $value['type'] == 'channel')) {
                 $credits_itemid = jlogic('channel')->is_update_credits_byid($value['item_id'], 0);
                 if ($credits_itemid) {
                     update_credits_by_action('_D' . crc32($credits_itemid), $value['uid']);
                 }
             }
         }
         if ($tbs) {
             foreach ($tbs as $k => $vs) {
                 $vs = (array) $vs;
                 foreach ($vs as $v) {
                     DB::query("delete from `" . TABLE_PREFIX . "{$k}` where `{$v}`='{$tid}'", "SKIP_ERROR");
                 }
             }
         }
     }
 }
Example #7
0
 function DeleteMusic()
 {
     if ($this->ID > 0) {
         $sql = "select * from `" . TABLE_PREFIX . "topic_music` where `id`='" . $this->ID . "' ";
         $query = $this->DatabaseHandler->Query($sql);
         $topic_music = $query->GetRow();
     }
     if (!$topic_music) {
         response_text("音乐已经不存在了");
     }
     if (jallow($topic_music['uid'])) {
         $sql = "delete from `" . TABLE_PREFIX . "topic_music` where `id`='{$this->ID}'";
         $this->DatabaseHandler->Query($sql);
         $updata = "update `" . TABLE_PREFIX . "topic` set `musicid`='0' where `tid`='{$topic_music['tid']}'";
         $result = $this->DatabaseHandler->Query($updata);
     } else {
         response_text("您没有删除这个音乐的权限");
     }
 }
Example #8
0
 function delete($ids)
 {
     $sparecredit = $spaces = $polls = $newpids = array();
     $delnum = 0;
     if (!is_array($ids)) {
         $ids = (array) $ids;
     }
     $query = DB::query("SELECT * FROM " . DB::table('vote') . " WHERE vid IN (" . jimplode($ids) . ")");
     while ($value = DB::fetch($query)) {
         if (jallow($value['uid'])) {
             $polls[] = $value;
             update_credits_by_action('vote_del', $value['uid']);
         }
     }
     if (empty($polls)) {
         return false;
     }
     foreach ($polls as $key => $value) {
         $newpids[] = $value['vid'];
     }
     DB::query("DELETE FROM " . DB::table('vote') . " WHERE vid IN (" . jimplode($newpids) . ")");
     DB::query("DELETE FROM " . DB::table('vote_field') . " WHERE vid IN (" . jimplode($newpids) . ")");
     DB::query("DELETE FROM " . DB::table('vote_option') . " WHERE vid IN (" . jimplode($newpids) . ")");
     DB::query("DELETE FROM " . DB::table('vote_user') . " WHERE vid IN (" . jimplode($newpids) . ")");
     $pic_arr = array();
     $query = DB::query(" select * from " . DB::table('vote_image') . " WHERE vid IN (" . jimplode($newpids) . ")");
     while ($rs = DB::fetch($query)) {
         if ($rs['picurl']) {
             unlink($rs['picurl']);
         }
     }
     DB::query(" delete from " . DB::table('vote_image') . " WHERE vid IN (" . jimplode($newpids) . ")");
     $tids = array();
     $query = DB::query("SELECT tid FROM " . DB::table('topic_vote') . " WHERE item_id IN (" . jimplode($newpids) . ") ");
     while ($value = DB::fetch($query)) {
         $tids[] = $value['tid'];
     }
     if (!empty($tids)) {
         $topic_reply_ids = array();
         $query = DB::query("SELECT tid,type FROM " . DB::table('topic') . " WHERE tid IN(" . jimplode($tids) . ")");
         while ($value = DB::fetch($query)) {
             if ($value['type'] == 'reply') {
                 $topic_reply_ids[] = $value['tid'];
             }
         }
         if (!empty($topic_reply_ids)) {
             $TopicLogic = jlogic('topic');
             $TopicLogic->Delete($topic_reply_ids);
         }
         DB::query("DELETE FROM " . DB::table('topic_vote') . " WHERE item_id IN (" . jimplode($newpids) . ") ");
     }
     return $polls;
 }
Example #9
0
 function follow_vote()
 {
     $uid = jget('uid', 'int', 'P');
     $vid = jget('vid', 'int', 'P');
     $follow = jget('follow', 'int', 'P');
     if ($vid > 0 && jallow($uid)) {
         $this->VoteLogic->update_vote_user(array('vid' => $vid, 'uid' => $uid), array('follow_vote' => $follow));
     }
 }
    function get($p = array())
    {
        $uid = (int) $p['uid'];
        $uid = $uid > 0 ? $uid : MEMBER_ID;
        if ($uid < 1) {
            return jerror('获取用户关注列表数据时,UID不能为空或您没有登录系统', -1);
        }
        $member = jsg_member_info($uid);
        if (empty($member)) {
            return jerror('您要查看的用户已经不存在了,UID错误', -2);
        }
        $count = (int) $member['follow_count'];
        if ($count < 1) {
            return array();
        }
        $page_num = 20;
        if (isset($p['page_num'])) {
            $page_num = (int) $p['page_num'];
            if ($page_num < 1 || $page_num > 200) {
                return jerror('请设置每页显示的数量在 1 ~ 200 之间', -3);
            }
        }
        $ps = array('result_count' => $count, 'page_num' => $page_num, 'page_url' => $p['page_url'], 'sql_field' => ' BF.`remark`, BF.`gids`, M.* ', 'sql_table' => ' `' . DB::table($this->db->table_name($uid)) . '` AS BF LEFT JOIN `' . DB::table('members') . '` AS M ON M.`uid`=BF.`touid` ', 'sql_where' => " BF.`uid`='{$uid}' AND M.`uid` IS NOT NULL ", 'result_list_row_make_func' => 'jsg_member_make', 'result_list_make_func' => 'buddy_follow_html');
        if (true === IN_JISHIGOU_WAP) {
            unset($ps['result_list_make_func']);
        }
        $group = array();
        $group_list = array();
        if (jallow($uid)) {
            $group_list = jlogic('buddy_follow_group')->get_my_group($uid);
            if ($p['nickname']) {
                $nickname = jfilter($p['nickname'], 'txt');
                if (strlen($nickname) < 3 || strlen($nickname) > 15) {
                    return jerror('搜索用户昵称时,字数请控制在 3 ~ 15 个字符之间', -4);
                }
                unset($ps['result_count']);
                $ps['cache_time'] = 600;
                $ps['sql_where'] .= ' AND ' . build_like_query(' M.`nickname` ', $nickname);
            } elseif ($p['gid']) {
                $gid = (int) $p['gid'];
                $group = jlogic('buddy_follow_group')->get_my_group_info($uid, $gid);
                if (empty($group)) {
                    return jerror('请指定一个正确的分组GID', -5);
                }
                $ps['result_count'] = $group['count'];
                $ps['sql_table'] = ' `' . DB::table(jtable('buddy_follow_group_relation')->table_name($uid)) . '` AS BFGR
					LEFT JOIN `' . DB::table('members') . '` AS M
						ON M.`uid` = BFGR.`touid`
					LEFT JOIN `' . DB::table($this->db->table_name($uid)) . '` AS BF
						ON (BF.`uid`="' . $uid . '" AND BF.`touid`=M.`uid`) ';
                $ps['sql_where'] = ' BFGR.`gid`="' . $gid . '" AND BFGR.`uid`="' . $uid . '" AND M.`uid` IS NOT NULL ';
                $ps['sql_order'] = ' BFGR.`dateline` DESC ';
            }
            if ($p['order'] && in_array($p['order'], array('lastpost', 'fans_count'))) {
                $p['sql_order'] = ' M.`' . $p['order'] . '` DESC ';
            }
        }
        $rets = $this->db->get($ps);
        if (is_array($rets)) {
            $rets['member'] = $member;
            $rets['group'] = $group;
            $rets['group_list'] = $group_list;
            if ($rets['list'] && $group_list) {
                foreach ($rets['list'] as $k => $v) {
                    if ($v['gids']) {
                        $rets['list'][$k]['buddy_group_list'] = jlogic('buddy_follow_group')->get_group_list($v['gids'], $group_list);
                    }
                }
            }
        }
        if (true === IN_JISHIGOU_WAP) {
            if ($rets['list']) {
                $rets['list'] = buddy_follow_html($rets['list'], 'uid', 'wap_follow_html');
            }
            $rets = wap_iconv($rets);
        }
        return $rets;
    }