public function get_at_my_topic($p)
 {
     $rets = array();
     $uid = isset($p['uid']) ? (int) $p['uid'] : MEMBER_ID;
     $member = jsg_member_info($uid);
     if ($member) {
         if ($member['at_new'] > 0) {
             jlogic('member')->clean_new_remind('at_new', $member['uid']);
         }
         $rets = $this->get_at_my_tid($p, 1);
         if ($rets && is_array($rets)) {
             if (!$rets['error']) {
                 $rets['member'] = $member;
                 $rets['list'] = $rets['count'] > 0 && $rets['ids'] ? jlogic('topic')->Get($rets['ids']) : array();
                 if ($rets['list']) {
                     if ($GLOBALS['_J']['config']['is_topic_user_follow'] && !$GLOBALS['_J']['disable_user_follow']) {
                         if (true === IN_JISHIGOU_WAP) {
                             $rets['list'] = buddy_follow_html($rets['list'], 'uid', 'wap_follow_html');
                         } else {
                             $rets['list'] = jlogic('buddy')->follow_html2($rets['list']);
                         }
                     }
                     $rets['parent_list'] = jlogic('topic')->get_parent_list($rets['list']);
                 }
                 if (true === IN_JISHIGOU_WAP) {
                     $rets = wap_iconv($rets);
                 }
             }
         }
     } else {
         return jerror('您无权查看该信息,请先登录', -1);
     }
     return $rets;
 }
 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;
 }
 function CategoryUserList($where = '', $limit = '', $query_link = '', $orderby = 'uid')
 {
     $per_page_num = $limit ? $limit : 20;
     $p = array('cache_time' => 300, 'cache_file' => 1, 'sql_where' => $where, 'sql_order' => ' `id` DESC ');
     $uds = jtable('validate_category_fields')->get_ids($p, 'uid');
     if ($uds) {
         $total_record = count($uds);
         $page_arr = page($total_record, $per_page_num, $query_link, array('return' => 'array'));
         $wherelist = "where `uid` in (" . jimplode($uds) . ") and `city` !='' order by `{$orderby}` desc  {$page_arr['limit']} ";
         $TopicLogic = jlogic('topic');
         $members = $TopicLogic->GetMember($wherelist, "`uid`,`ucuid`,`media_id`,`aboutme`,`username`,`nickname`,`province`,`city`,`face_url`,`face`,`validate`");
         $members = buddy_follow_html($members, 'uid', 'follow_html2');
     }
     $user_ary = array('member' => $members, 'uids' => $uds, 'pagearr' => $page_arr);
     return $user_ary;
 }
Beispiel #4
0
 function getMemberList($param)
 {
     $member_list = array();
     $where_sql = " 1 ";
     $order_sql = " regdate DESC ";
     $max_id = intval($param['max_id']);
     $limit = intval($param['limit']);
     if (empty($limit)) {
         $limit = 20;
     }
     $nickname = trim($param['nickname']);
     if (!empty($nickname)) {
         $nickname = get_safe_code($nickname);
         $where_sql .= " AND " . build_like_query("nickname", $nickname) . " ";
     }
     $sql = "select count(*) from `" . TABLE_PREFIX . "members`  WHERE {$where_sql}";
     $total_record = DB::result_first($sql);
     if ($total_record > 0) {
         if ($max_id > 0) {
             $where_sql .= " AND uid < {$max_id} ";
         }
         $sql = "select `uid`,`ucuid`,`username`,`nickname`,`face_url`,`face`,`fans_count`,`topic_count`,`province`,`city`,`validate`\r\n\t\t\t\t\tfrom `" . TABLE_PREFIX . "members`\r\n\t\t\t\t\tWHERE {$where_sql}\r\n\t\t\t\t\tORDER BY {$order_sql}\r\n\t\t\t\t\tLIMIT {$limit} ";
         $query = DB::query($sql);
         $uids = array();
         while ($row = DB::fetch($query)) {
             $row['face'] = face_get($row);
             $member_list[] = $row;
             $uids[$row['uid']] = $row['uid'];
         }
         if ($uids && MEMBER_ID > 0) {
             $friendships = array(-1 => 1, 0 => 0, 1 => 2, 2 => 0, 3 => 4);
             $_tmp_arr = buddy_follow_html($member_list);
             foreach ($_tmp_arr as $k => $row) {
                 $member_list[$k]['friendship'] = $friendships[$row['is_follow_relation']];
             }
             unset($_tmp_arr);
         }
         $member_list = array_values($member_list);
         $tmp_ary = $member_list;
         $tmp = array_pop($tmp_ary);
         $max_id = $tmp['uid'];
         $ret = array('member_list' => $member_list, 'total_record' => $total_record, 'list_count' => count($member_list), 'max_id' => $max_id);
         return $ret;
     }
     return 400;
 }
Beispiel #5
0
 function _member($uid = 0)
 {
     $member = array();
     if ($uid < 1) {
         $member = jsg_member_info_by_mod();
         $member = wap_iconv($member);
     }
     $uid = (int) ($uid ? $uid : MEMBER_ID);
     if ($uid > 0 && !$member) {
         $member = $this->_topicLogicGetMember($uid);
     }
     if (!$member) {
         return false;
     }
     $uid = $member['uid'];
     if (MEMBER_ID > 0 && $uid != MEMBER_ID) {
         $member = buddy_follow_html($member, 'uid', 'wap_follow_html', 1);
     }
     return $member;
 }
Beispiel #6
0
 function getFansList($param)
 {
     $id = max(0, intval($param['max_id']));
     $max_id = $id + 1;
     $uid = intval($param['uid']);
     if (empty($uid)) {
         $uid = MEMBER_ID;
         $member = $this->TopicLogic->GetMember($uid);
     } else {
         $member = $this->TopicLogic->GetMember($uid);
         if (empty($member)) {
             return 300;
         }
     }
     $limit = 20;
     if ($param['limit'] > 0) {
         $limit = $param['limit'];
     }
     $count = $member['fans_count'];
     if ($count > 0) {
         $offset = $id * $limit;
         $sql = "SELECT m.uid,m.nickname,m.username,m.face,m.fans_count,m.signature,m.topic_count,m.province,m.city\r\n\t\t\t\t\tFROM " . DB::table(jtable('buddy_fans')->table_name($member['uid'])) . " AS b\r\n\t\t\t\t\tLEFT JOIN " . DB::table('members') . " AS m\r\n\t\t\t\t\tON m.`uid` = b.`touid`\r\n\t\t\t\t\twhere b.`uid`='{$member['uid']}'\r\n\t\t\t\t\tORDER BY b.`dateline` DESC\r\n\t\t\t\t\tLIMIT {$offset}, {$limit}";
         $query = DB::query($sql);
         $member_list = array();
         while ($row = DB::fetch($query)) {
             $member_list[$row['uid']] = jsg_member_make($row);
         }
         if (empty($member_list)) {
             return 401;
         } else {
             $friendships = array(-1 => 1, 0 => 0, 1 => 2, 2 => 0, 3 => 4);
             $_tmp_arr = buddy_follow_html($member_list);
             foreach ($_tmp_arr as $k => $row) {
                 $member_list[$k]['friendship'] = $friendships[$row['is_follow_relation']];
             }
             unset($_tmp_arr);
             $member_list = array_values($member_list);
             $ret = array('member_list' => $member_list, 'total_record' => $count, 'list_count' => count($member_list), 'max_id' => $max_id);
             return $ret;
         }
     }
     return 400;
 }
 public function get_favorite_me_topic($p)
 {
     $uid = isset($p['uid']) ? (int) $p['uid'] : MEMBER_ID;
     if (jdisallow($uid)) {
         return jerror('您无权查看');
     }
     $member = jsg_member_info($uid);
     if ($member['favoritemy_new'] > 0) {
         jlogic('member')->clean_new_remind('favoritemy_new', $member['uid']);
     }
     $page_num = (int) $p['page_num'];
     if ($page_num < 1) {
         $page_num = 10;
     }
     $ps = array('tuid' => $uid, 'sql_order' => ' `id` DESC ', 'page_num' => $page_num);
     if (isset($p['page_url'])) {
         $ps['page_url'] = $p['page_url'];
     }
     $rets = $this->db->get($ps);
     if (is_array($rets)) {
         $rets['member'] = $member;
         if ($rets['list']) {
             foreach ($rets['list'] as $k => $v) {
                 if ($v['tid'] < 1) {
                     continue;
                 }
                 $row = jlogic('topic')->Get($v['tid']);
                 $row['fuid'] = $v['uid'];
                 $row['favorite_time'] = my_date_format2($v['dateline']);
                 $fuids[$v['uid']] = $v['uid'];
                 $rets['list'][$k] = $row;
             }
             if ($fuids) {
                 $rets['favorite_members'] = jlogic('member')->get($fuids);
             }
             if ($GLOBALS['_J']['config']['is_topic_user_follow'] && !$GLOBALS['_J']['disable_user_follow']) {
                 if (true === IN_JISHIGOU_WAP) {
                     $rets['list'] = buddy_follow_html($rets['list'], 'uid', 'wap_follow_html');
                 } else {
                     $rets['list'] = jlogic('buddy')->follow_html2($rets['list']);
                 }
             }
             $rets['parent_list'] = jlogic('topic')->get_parent_list($rets['list']);
         }
         if (true === IN_JISHIGOU_WAP) {
             $rets = wap_iconv($rets);
         }
     }
     return $rets;
 }
Beispiel #8
0
 function _memberlist($where = '', $limit = 20, $orderby = 'uid', $query_link = '')
 {
     $per_page_num = (int) $limit;
     $cache_time = 300;
     $cache_id = jtable('members')->cache_id('people-_memberlist-count-' . md5($where));
     if (false === ($total_record = cache_file('get', $cache_id))) {
         $sql = " select count(*) as `total_record` from `" . TABLE_PREFIX . "members` {$where} ";
         $total_record = DB::result_first($sql);
         cache_file('set', $cache_id, $total_record, $cache_time);
     }
     if ($total_record > 0) {
         $page_arr = page($total_record, $per_page_num, $query_link, array('return' => 'array'));
         $wherelist = " {$where} order by `{$orderby}` desc {$page_arr['limit']} ";
         $cache_id = jtable('members')->cache_id('people-_memberlist-' . md5($wherelist));
         if (false === ($members = cache_file('get', $cache_id))) {
             $members = $this->TopicLogic->GetMember($wherelist, "`uid`,`ucuid`,`media_id`,`aboutme`,`username`,`nickname`,`face_url`,`face`,`validate`,`validate_category`,`province`,`city`");
             cache_file('set', $cache_id, $members, $cache_time);
         }
         $members = buddy_follow_html($members, 'uid', 'follow_html2');
     }
     $ret_ary = array('member' => $members, 'pagearr' => $page_arr);
     return $ret_ary;
 }
Beispiel #9
0
 function _MemberList($where = '', $query_link = '', $cache_time = 0, $cache_key = '')
 {
     $cache_time = max(0, (int) $cache_time);
     $cache_key = $cache_key ? $cache_key : 'member-search-' . md5($where);
     if ($cache_time > 0) {
         if (false === ($rets = cache_db('mget', $cache_key))) {
             $uids_limit = $this->cache_ids_limit;
             $rets = array();
             $rets['count'] = DB::result_first("SELECT COUNT(1) AS `count` FROM " . DB::table('members') . " {$where} ");
             $uids = array();
             if ($rets['count'] > 0) {
                 $query = DB::query("SELECT `uid` FROM " . DB::table('members') . " {$where} LIMIT {$uids_limit} ");
                 while (false != ($row = DB::fetch($query))) {
                     $uids[$row['uid']] = $row['uid'];
                 }
             }
             $rets['uids'] = $uids;
             cache_db('mset', $cache_key, $rets, $cache_time);
         }
         $total_record = $rets['count'];
         $where = " WHERE `uid` IN ('" . implode("','", $rets['uids']) . "') ";
     } else {
         $total_record = DB::result_first("select count(*) as `total_record` from `" . TABLE_PREFIX . "members` {$where}");
     }
     $return = array();
     $per_page_num = 10;
     $order = " ORDER BY `lastactivity` DESC ";
     $member_list = array();
     $member_tag = array();
     if ($total_record > 0) {
         $return['total_record'] = $total_record;
         $page_arr = page($total_record, $per_page_num, $query_link, array('return' => 'Array'));
         $return['page_arr'] = $page_arr;
         $member_list = jlogic('topic')->GetMember(" {$where} {$order} {$page_arr['limit']} ", "`uid`,`ucuid`,`username`,`nickname`,`face_url`,`face`,`fans_count`,`topic_count`,`province`,`city`,`validate`,`validate_category`");
         if ($member_list) {
             $member_list = buddy_follow_html($member_list);
             $uids = array();
             foreach ($member_list as $row) {
                 $uids[$row['uid']] = $row['uid'];
             }
             if ($uids) {
                 $query = DB::query("SELECT * FROM " . DB::table('user_tag_fields') . " WHERE `uid` IN ('" . implode("','", $uids) . "') ");
                 while (false != ($row = DB::fetch($query))) {
                     $member_tag[] = $row;
                 }
             }
         }
     }
     $return['member_list'] = $member_list;
     $return['member_tag'] = $member_tag;
     return $return;
 }
Beispiel #10
0
 function UserMenu()
 {
     if ($this->Post['nickname']) {
         #查找的时候会将名字加红,有<font>标签
         $this->Post['nickname'] = strip_tags($this->Post['nickname']);
         $member = jsg_member_info($this->Post['nickname'], 'nickname');
     }
     if ($this->Post['arrow'] == 'yes') {
         $arrow = true;
     }
     $uid = (int) ($this->Post['uid'] ? $this->Post['uid'] : $member['uid']);
     if ($uid < 1) {
         exit;
     }
     $buddy_info = jlogic('buddy')->info($uid, MEMBER_ID);
     $blacklist_info = jlogic('buddy')->blacklist($uid, MEMBER_ID);
     $list_members = $this->TopicLogic->GetMember($uid, "`uid`,`ucuid`,`medal_id`,`username`,`nickname`,`face`,`face_url`,`fans_count`,`topic_count`,`validate`,`validate_category`,`bday`,`gender`,`phone`,`qq`,`msn`,`aboutme`,`province`,`city`,`level`,`company`,`department`");
     $list_members['aboutme'] = cut_str($list_members['aboutme'], 54);
     $list_members = buddy_follow_html($list_members, 'uid', 'follow_html', 1);
     $follow_html = $list_members['follow_html'];
     $ProfileSet = jconf::get('profileshowincord');
     if ($ProfileSet) {
         $memberProfileSet = jlogic('member_profile')->getMemberProfileSet($uid);
         if ($memberProfileSet) {
             $member_profile = jlogic('member_profile')->getMemberProfileInfo($uid);
             if ($member_profile) {
                 $list_members = array_merge($list_members, $member_profile);
             }
         }
         unset($ProfileSet['aboutme']);
     }
     if ($list_members['gender']) {
         $list_members['gender'] = $list_members['gender'] == 1 ? '男' : '女';
     }
     $sql = "select * from `" . TABLE_PREFIX . "user_tag_fields` where `uid` = '{$uid}'";
     $query = $this->DatabaseHandler->Query($sql);
     $usertag = $query->GetAll();
     if ($GLOBALS['_J']['plugins']['func']['printuser']) {
         jlogic('plugin')->hookscript('printuser', 'funcs', $list_members, 'printuser');
     }
     include template('topic_user_card');
 }
Beispiel #11
0
 function getCommonInterestUser($uid = MEMBER_ID, $limit = 10)
 {
     $uid = max(0, (int) $uid);
     $limit = max(0, (int) $limit);
     if ($uid < 1 || $limit < 1) {
         return false;
     }
     $user = array();
     $sql = "SELECT f2.uid,COUNT(*) AS common_count ,m.username,m.nickname\r\n\t\t\t\tFROM " . TABLE_PREFIX . "tag_favorite f\r\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "tag_favorite  f2 ON f2.tag = f.tag AND f2.uid != '{$uid}'\r\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "members m ON m.uid = f2.uid\r\n\t\t\t\tWHERE f.uid = '{$uid}' and m.topic_count > 0\r\n\t\t\t\tGROUP BY f2.uid\r\n\t\t\t\tORDER BY common_count DESC\r\n\t\t\t\tlimit {$limit} ";
     $query = DB::query($sql);
     while ($rs = DB::fetch($query)) {
         $rs['face'] = face_get($rs['uid']);
         $user[$rs['uid']] = $rs;
     }
     $user = buddy_follow_html($user);
     return $user;
 }
Beispiel #12
0
 function Seach()
 {
     $per_page_num = 6;
     $query_link = 'index.php?mod=user_tag&code=seach';
     $order = " order by `fans_count` desc ";
     $tag_name = trim($this->Get['k']);
     $tag_name = get_safe_code($tag_name);
     if (empty($tag_name)) {
         $this->Messager("请输入需要查找的标签", -1);
     }
     if ($tag_name) {
         if (strlen($tag_name) < 2) {
             $this->Messager("请输入至少2个字符的关键词", -1);
         }
         $where_list['tag_name'] = "`tag_name`='" . addslashes("{$tag_name}") . "'";
         $query_link .= "&k=" . urlencode($tag_name);
     }
     if ($where_list) {
         $where = empty($where_list) ? null : ' WHERE ' . implode(' AND ', $where_list) . ' ';
         $sql = "select * from `" . TABLE_PREFIX . "user_tag_fields` {$where} ";
         $query = $this->DatabaseHandler->Query($sql);
         $uids = array();
         $user_tag_fields = array();
         while (false != ($row = $query->GetRow())) {
             $user_tag_fields[] = $row;
             $uids[$row['uid']] = $row['uid'];
         }
         if (empty($uids)) {
             include template('social/search_list');
         }
     }
     $member_list = array();
     if ($uids) {
         $sql = "select count(*) as `total_record` from `" . TABLE_PREFIX . "members` where `uid` in (" . jimplode($uids) . ")";
         $total_record = DB::result_first($sql);
         if ($total_record > 0) {
             $_config = array('return' => 'array');
             $page_arr = page($total_record, $per_page_num, $query_link, $_config);
             $sql = "select `uid`,`ucuid`,`username`,`nickname`,`face_url`,`face`,`fans_count`,`topic_count`,`province`,`city`,`validate` from `" . TABLE_PREFIX . "members` where `uid` in(" . jimplode($uids) . ") {$order} {$page_arr['limit']}";
             $query = $this->DatabaseHandler->Query($sql);
             $uids = array();
             while (false != ($row = $query->GetRow())) {
                 $row['face'] = face_get($row);
                 $member_list[$row['uid']] = $row;
                 $uids[$row['uid']] = $row['uid'];
             }
             if ($uids && MEMBER_ID > 0) {
                 $member_list = buddy_follow_html($member_list);
             }
         }
         $sql = "select * from `" . TABLE_PREFIX . "user_tag_fields` where `uid` in (" . jimplode($uids) . ")";
         $query = $this->DatabaseHandler->Query($sql);
         $member_tag = array();
         while (false != ($row = $query->GetRow())) {
             $member_tag[] = $row;
         }
     }
     $sql = "select * from `" . TABLE_PREFIX . "user_tag_fields` where `uid` = '" . MEMBER_ID . "'";
     $query = $this->DatabaseHandler->Query($sql);
     $mytag = array();
     $mytag_ids = array();
     while (false != ($row = $query->GetRow())) {
         $mytag[] = $row;
         $mytag_ids[$row['tag_id']] = $row['tag_id'];
     }
     $this->Title = "个人标签 - {$tag_name}";
     include template('social/search_list');
 }
Beispiel #13
0
function jsg_member_get($p, $mark = 1, $cache = 1)
{
    if ($cache && $p['uid'] && $p['uid'] == MEMBER_ID && $GLOBALS['_J']['member']) {
        return array('list' => array($GLOBALS['_J']['member']));
    }
    static $S_members = array();
    if ($cache) {
        $cache_id = md5(serialize($p) . $mark);
        if (isset($S_members[$cache_id])) {
            return $S_members[$cache_id];
        }
    }
    $wheres = array();
    $ws = array('uid' => 1, 'username' => 1, 'nickname' => 1, 'email' => 1, 'phone' => 1, 'province' => 1, 'city' => 1, 'role_id' => 1, 'ucuid' => 1, 'invite_uid' => 1);
    foreach ($p as $k => $v) {
        if (isset($ws[$k])) {
            $vs = (array) $v;
            $wheres[$k] = " `{$k}` IN ('" . implode("','", $vs) . "') ";
        }
    }
    $sql_where = $wheres ? " WHERE " . implode(" AND ", $wheres) : "";
    $count = max(0, (int) $p['count']);
    if ($count < 1) {
        $count = DB::result_first("SELECT COUNT(*) AS `count` FROM " . DB::table('members') . " {$sql_where} ");
    }
    $rets = array();
    if ($count > 0) {
        $page = array();
        $sql_limit = '';
        if ($p['per_page_num']) {
            $page = page($count, $p['per_page_num'], $p['page_url'], array('return' => 'Array', 'extra' => $p['page_extra']));
            $sql_limit = " {$page['limit']} ";
        } elseif ($p['limit']) {
            if (false !== strpos(strtolower($p['limit']), 'limit ')) {
                $sql_limit = " {$p['limit']} ";
            } else {
                $sql_limit = " LIMIT {$p['limit']} ";
            }
        } elseif ($p['count']) {
            $sql_limit = " LIMIT {$p['count']} ";
        }
        $sql_order = '';
        if ($p['order']) {
            if (false !== strpos(strtolower($p['order']), 'order by ')) {
                $sql_order = " {$p['order']} ";
            } else {
                $sql_order = " ORDER BY {$p['order']} ";
            }
        }
        $sql_fields = $p['fields'] ? $p['fields'] : "*";
        $query = DB::query("SELECT {$sql_fields} FROM " . DB::table('members') . " {$sql_where} {$sql_order} {$sql_limit} ");
        $list = array();
        while (false != ($r = DB::fetch($query))) {
            if ($mark) {
                $r = jsg_member_make($r);
            }
            $list[] = $r;
        }
        DB::free_result($query);
        if ($list) {
            if ($mark) {
                $list = buddy_follow_html($list, 'uid', true === IN_JISHIGOU_WAP ? 'wap_follow_html' : 'follow_html');
            }
            $rets = array('count' => $count, 'list' => $list, 'page' => $page);
        }
    }
    if ($cache && $cache_id) {
        $S_members[$cache_id] = $rets;
    }
    return $rets;
}
Beispiel #14
0
 function _member($uid = 0)
 {
     $member = array();
     if ($uid < 1) {
         $member = jsg_member_info_by_mod();
     }
     $uid = (int) ($uid ? $uid : MEMBER_ID);
     if ($uid > 0 && !$member) {
         $member = $this->TopicLogic->GetMember($uid);
     }
     if (!$member) {
         return false;
     }
     $uid = $member['uid'];
     if (!$member['follow_html'] && $uid != MEMBER_ID && MEMBER_ID > 0) {
         $member['follow_html'] = buddy_follow_html($member, 'uid', 'follow_html', 1);
     }
     if (true === UCENTER_FACE && MEMBER_ID == $uid && MEMBER_UCUID > 0 && !$member['__face__']) {
         include_once ROOT_PATH . './api/uc_client/client.php';
         $uc_check_result = uc_check_avatar(MEMBER_UCUID);
         if ($uc_check_result) {
             $this->DatabaseHandler->Query("update " . TABLE_PREFIX . "members set `face`='./images/noavatar.gif' where `uid`='{$uid}'");
         }
     }
     if ($GLOBALS['_J']['plugins']['func']['printuser']) {
         jlogic('plugin')->hookscript('printuser', 'funcs', $member, 'printuser');
     }
     return $member;
 }
    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;
    }
 function get_photo_list($param)
 {
     $sql_where = '';
     $uid = max(0, (int) $param['uid']);
     $cache_key = "{$uid}-get_photo_list-" . md5(serialize($param));
     if (false === ($info = cache_db('get', $cache_key))) {
         if ($uid > 0) {
             $uids = get_buddyids($uid, $GLOBALS['_J']['config']['topic_myhome_time_limit']);
             if ($uids) {
                 $sql_where = " AND t.uid in(" . jimplode($uids) . ") ";
             } else {
                 return array();
             }
         }
         $total_photo = (int) $param['count'];
         if ($total_photo < 1) {
             if ($param['vip']) {
                 $total_photo = DB::result_first("select count(1) as `total` from " . DB::table('topic_image') . " t left join " . DB::table('members') . " m on m.uid=t.uid where t.tid>0 and m.validate='1'" . $sql_where);
             } else {
                 $total_photo = DB::result_first("SELECT COUNT(*) FROM " . DB::table('topic_image') . " AS t WHERE t.tid > 0 " . $sql_where);
             }
         }
         $info = false;
         $limit_sql = '';
         $photo_i = 0;
         $topic_list = array();
         $user_lists = array();
         if ($total_photo > 0) {
             if ($param['perpage']) {
                 $page_arr = page($total_photo, $param['perpage'], $param['page_url'], array('return' => 'array'));
                 $limit_sql = $page_arr['limit'];
             } else {
                 if ($param['limit']) {
                     $limit_sql = ' LIMIT ' . $param['limit'];
                 } elseif ($param['count']) {
                     $limit_sql = ' LIMIT ' . $param['count'];
                 }
             }
             if ($param['vip']) {
                 $query = DB::query("SELECT t.id,t.tid,t.uid,t.name,t.width,t.height,t.dateline,tr.content,tr.content2,tr.forwards,tr.replys,tr.digcounts\r\n\t\t\t\t\t\t\t\t\tFROM " . DB::table('topic_image') . " AS t\r\n\t\t\t\t\t\t\t\t\tLEFT JOIN " . DB::table('topic') . " AS tr\r\n\t\t\t\t\t\t\t\t\tON t.tid = tr.tid\r\n\t\t\t\t\t\t\t\t\tleft join " . DB::table('members') . " as m\r\n\t\t\t\t\t\t\t\t\ton m.uid=t.uid\r\n\t\t\t\t\t\t\t\t\tWHERE t.tid > 0 and m.validate='1' " . $sql_where . "\r\n\t\t\t\t\t\t\t\t\tORDER BY t.id DESC\r\n\t\t\t\t\t\t\t\t\t{$limit_sql} ");
             } else {
                 $query = DB::query("SELECT t.id,t.tid,t.uid,t.name,t.width,t.height,t.dateline,tr.content,tr.content2,tr.forwards,tr.replys,tr.digcounts\r\n\t\t\t\t\t\t\t\t\tFROM " . DB::table('topic_image') . " AS t\r\n\t\t\t\t\t\t\t\t\tLEFT JOIN " . DB::table('topic') . " AS tr\r\n\t\t\t\t\t\t\t\t\tON t.tid = tr.tid\r\n\t\t\t\t\t\t\t\t\tWHERE t.tid > 0  " . $sql_where . "\r\n\t\t\t\t\t\t\t\t\tORDER BY t.id DESC\r\n\t\t\t\t\t\t\t\t\t{$limit_sql} ");
             }
             while ($value = DB::fetch($query)) {
                 $value['content'] .= $value['content2'];
                 $value['content'] = jhtmlspecialchars(strip_tags($value['content']));
                 if (!is_file(topic_image($value['id'], 'photo', 1))) {
                     $image_file = RELATIVE_ROOT_PATH . 'images/topic/' . face_path($value['id']) . $value['id'] . "_o.jpg";
                     $image_file_photo = RELATIVE_ROOT_PATH . 'images/topic/' . face_path($value['id']) . $value['id'] . "_p.jpg";
                     if ($value['width'] > 280) {
                         $p_width = 280;
                         $p_height = round($value['height'] * 280 / $value['width']);
                         $result = makethumb($image_file, $image_file_photo, $p_width, $p_height);
                     }
                     if ($value['width'] <= 280 || !$result && !is_file($image_file_photo)) {
                         @copy($image_file, $image_file_photo);
                     }
                 }
                 $value['photo'] = topic_image($value['id'], 'photo', 0);
                 $value['height'] = $value['width'] > 280 ? round($value['height'] * 280 / $value['width']) : $value['height'];
                 $value['width'] = $value['width'] > 280 ? 280 : $value['width'];
                 $value['dateline'] = my_date_format2($value['dateline']);
                 if (false != strpos($value['content'], '</U>')) {
                     $value['content'] = preg_replace('#\\<U(.*?)\\>(.*?)\\</U\\>#', '<a href="\\2" target="_blank">Click Here</a>', $value['content']);
                 }
                 if (false !== strpos($value['content'], 'http:/' . '/')) {
                     $value['content'] = preg_replace('~(http:/' . '/[a-z0-9-\\.\\?\\=&;_@/%#]+?)\\s+~i', '<a href="\\1" target="_blank">Click Here</a> ', $value['content']);
                     $value['content'] = preg_replace("|\\s*http:/" . "/[a-z0-9-\\.\\?\\=&;_@/%#]*\$|sim", "", $value['content']);
                 }
                 $topic_list[] = $value;
             }
             if ($topic_list) {
                 $topic_list_count = count($topic_list);
                 $topic_list = $this->TopicLogic->MakeAll($topic_list, 0);
                 $info = array('list' => $topic_list, 'count' => $param['count'] ? $topic_list_count : $total_photo, 'page' => $page_arr);
             }
         }
         cache_db('set', $cache_key, $info, $uid > 0 ? 3600 : 600);
     }
     if ($info['count'] > 0 && $info['list']) {
         if ($GLOBALS['_J']['config']['is_topic_user_follow'] && !$GLOBALS['_J']['disable_user_follow']) {
             $info['list'] = buddy_follow_html($info['list'], 'uid', 'follow_html2');
         }
         $pi = 0;
         $list = array();
         foreach ($info['list'] as $v) {
             $list[$pi++ % 3][] = $v;
         }
         $info['list'] = $list;
     }
     return $info;
 }
Beispiel #17
0
 function get_by_ids($rets)
 {
     if ($rets && is_array($rets) && !isset($rets['list']) && is_array($rets['ids'])) {
         $rets['list'] = $rets['ids'] ? $this->Get($rets['ids']) : array();
         if ($rets['list']) {
             if ($GLOBALS['_J']['config']['is_topic_user_follow'] && !$GLOBALS['_J']['disable_user_follow']) {
                 if (true === IN_JISHIGOU_WAP) {
                     $rets['list'] = buddy_follow_html($rets['list'], 'uid', 'wap_follow_html');
                 } else {
                     $rets['list'] = jlogic('buddy')->follow_html2($rets['list']);
                 }
             }
             $rets['parent_list'] = $this->get_parent_list($rets['list']);
         }
         if (true === IN_JISHIGOU_WAP) {
             $rets = wap_iconv($rets);
         }
     }
     return $rets;
 }
Beispiel #18
0
 function getMusicUser()
 {
     $code = 'at_me_user';
     $user_list = $this->TopicLogic->getMusicUser(10);
     $user_list = buddy_follow_html($user_list);
     include template("topic_right_user_ajax");
 }
Beispiel #19
0
 function Main()
 {
     if ($this->MemberHandler->HasPermission($this->Module, $this->Code) == false) {
         $this->Messager($this->MemberHandler->GetError(), null);
     }
     $act_list = array();
     if ($this->Config['company_enable']) {
         $act_list['company'] = '同单位';
     }
     if (!$this->Config['profile_search_close']) {
         $act_list['search'] = '同城用户';
     }
     if (!$this->Config['profile_maybe_friend_close']) {
         $act_list['maybe_friend'] = '同兴趣';
     }
     if (!$this->Config['profile_usertag_close']) {
         $act_list['usertag'] = '同类人';
     }
     if (!$this->Config['profile_role_close']) {
         $act_list['role'] = '同分组';
     }
     if (false == jconf::get('invite', 'link_display_none')) {
         $act_list['invite'] = '邀请好友';
     }
     $act = $this->Code;
     $member = $this->Member;
     if ($member['medal_id']) {
         $medal_list = $this->TopicLogic->GetMedal($member['medal_id'], $member['uid']);
     }
     $member_nickname = $member['nickname'];
     if ('invite' == $act) {
         $sql = "delete from `" . TABLE_PREFIX . "invite` where `fuid`<'1' and `dateline`>'0' and `dateline`<'" . (time() - 86400 * 7) . "'";
         $this->DatabaseHandler->Query($sql);
         $sql = "select count(*) as my_invite_count from `" . TABLE_PREFIX . "invite` where `uid`='{$member['uid']}'";
         $query = $this->DatabaseHandler->Query($sql);
         $row = $query->GetRow();
         $my_invite_count = $row['my_invite_count'];
         $can_invite_count = max(0, $this->Config['invite_count_max'] - $my_invite_count);
         if ($my_invite_count > 0) {
             $per_page_num = 5;
             $query_link = "index.php?mod=" . ($_GET['mod_original'] ? get_safe_code($_GET['mod_original']) : $this->Module) . ($this->Code ? "&amp;code={$this->Code}" : "");
             $_config = array('return' => 'array');
             $page_arr = page($my_invite_count, $per_page_num, $query_link, $_config);
             $sql = "select i.*,m.province,m.city,m.topic_count,m.fans_count,m.nickname as fusername from `" . TABLE_PREFIX . "invite` i\r\n\t\t\t\t\t\tleft join `" . TABLE_PREFIX . "members` m on m.uid = i.fuid\r\n\t\t\t\t\t \twhere i.`uid`='{$member['uid']}' order by i.`id` desc {$page_arr['limit']}";
             $query = $this->DatabaseHandler->Query($sql);
             $invite_list = array();
             while (false != ($row = $query->GetRow())) {
                 $row['from_area'] = $row['province'] ? $row['province'] . ' ' . $row['city'] : '无';
                 $row['face'] = face_get($row['fuid']);
                 $invite_list[] = $row;
             }
             $invite_list = buddy_follow_html($invite_list, 'fuid');
         }
         $MEMBER_INVITE_CODE = '';
         if (!$this->Config['invite_count_max'] || $this->Config['invite_count_max'] > $member['invite_count']) {
             $MEMBER_INVITE_CODE = $member['invitecode'];
         }
         if (!$MEMBER_INVITE_CODE) {
             $MEMBER_INVITE_CODE = random(16);
             $sql = "update `" . TABLE_PREFIX . "members` set `invitecode`='{$MEMBER_INVITE_CODE}' where `uid`='" . MEMBER_ID . "'";
             $this->DatabaseHandler->Query($sql);
         }
         $inviteURL = "index.php?mod=member&code=" . urlencode(MEMBER_ID . "_" . $MEMBER_INVITE_CODE);
         $inviteURL = get_invite_url($inviteURL, $this->Config['site_url']);
         $invite = jconf::get('invite');
         $invite_msg = empty($invite) ? '' : jstripslashes($invite['invite_msg']);
         if (!empty($invite_msg)) {
             $replaces = array('nickname' => $member['nickname'], 'inviteurl' => $inviteURL, 'invite_num' => $this->Config['invite_limit'], 'site_name' => $this->Config['site_name']);
             foreach ($replaces as $key => $val) {
                 $invite_msg = str_replace("#" . $key . "#", $val, $invite_msg);
             }
         }
     } elseif ('maybe_friend' == $act) {
         $my_favorite_tags = jlogic('tag_favorite')->my_favorite_tags(MEMBER_ID, 20);
         if ($my_favorite_tags) {
             $uids = jlogic('tag_favorite')->favorite_uids($my_favorite_tags, 30);
             if ($uids) {
                 $p = array('uid' => MEMBER_ID, 'touid' => $uids, 'result_count' => count($uids));
                 $buddyids = get_buddyids($p);
                 $sql = "select `uid`,`ucuid`,`username`,`face_url`,`face`,`province`,`city`,`fans_count`,`topic_count`,`validate`,`nickname` from `" . TABLE_PREFIX . "members` where `uid` in('" . implode("','", $uids) . "')";
                 $query = $this->DatabaseHandler->Query($sql);
                 $member_list = array();
                 while (false != ($row = $query->GetRow())) {
                     $buddy_status = isset($buddyids[$row['uid']]);
                     if (!$buddy_status && MEMBER_ID != $row['uid']) {
                         $row['follow_html'] = follow_html($row['uid'], $buddy_status);
                         $row = jsg_member_make($row);
                         $member_list[$row['uid']] = $row;
                         $tag_favorite_uids[$row['uid']] = $row['uid'];
                     }
                 }
             }
         }
         $user_favorite = array();
         if ($tag_favorite_uids) {
             $user_favorite = jlogic('tag_favorite')->my_favorite($tag_favorite_uids, 100);
         }
     } elseif ('usertag' == $act) {
         $per_page_num = 10;
         $query_link = 'index.php?mod=profile&code=usertag';
         $order = " order by `fans_count` desc ";
         $sql = "select * from `" . TABLE_PREFIX . "user_tag_fields` where `uid` = '" . MEMBER_ID . "'";
         $query = $this->DatabaseHandler->Query($sql);
         $mytag = array();
         $user_tagid = array();
         while (false != ($row = $query->GetRow())) {
             $mytag[] = $row;
             $user_tagid[$row['tag_id']] = $row['tag_id'];
         }
         if ($user_tagid) {
             $sql = "select * from `" . TABLE_PREFIX . "user_tag_fields` where `uid` != '" . MEMBER_ID . "' and `tag_id` in (" . jimplode($user_tagid) . ") ";
             $query = $this->DatabaseHandler->Query($sql);
             $member_uids = array();
             while (false != ($row = $query->GetRow())) {
                 $member_uids[$row['uid']] = $row['uid'];
             }
             $where = $where_list = " where `uid` in (" . jimplode($member_uids) . ")";
         }
         if ($member_uids) {
             $member_list = array();
             $sql = "select count(*) as `total_record` from `" . TABLE_PREFIX . "members` {$where}";
             $total_record = DB::result_first($sql);
             if ($total_record > 0) {
                 $_config = array('return' => 'array');
                 $page_arr = page($total_record, $per_page_num, $query_link, $_config);
                 $member_list = $this->TopicLogic->GetMember("{$where} {$order} {$page_arr['limit']}", "`uid`,`ucuid`,`username`,`nickname`,`face_url`,`face`,`fans_count`,`topic_count`,`province`,`city`,`validate`");
                 $member_list = buddy_follow_html($member_list);
             }
             $sql = "select * from `" . TABLE_PREFIX . "user_tag_fields` {$where}";
             $query = $this->DatabaseHandler->Query($sql);
             $member_tag = array();
             while (false != ($row = $query->GetRow())) {
                 $member_tag[] = $row;
             }
         }
         $mytag = $this->_MyUserTag(MEMBER_ID);
     } else {
         $per_page_num = 10;
         $query_link = 'index.php?mod=profile&code=' . $act;
         $where_list = array();
         if ('search' == $act) {
             $province_name = $member['province'];
             $city_name = $member['city'];
             $area_name = $member['area'];
             $street_name = $member['street'];
             $province = $this->Get['province'];
             $city = $this->Get['city'];
             $area = $this->Get['area'];
             $street = $this->Get['street'];
             if ($province) {
                 $province_name = DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '{$province}'");
                 if ($city) {
                     $city_name = DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '{$city}'");
                     if ($area) {
                         $area_name = DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '{$area}'");
                         if ($street) {
                             $street_name = DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '{$street}'");
                         } else {
                             $street_name = '';
                         }
                     } else {
                         $area_name = '';
                         $street_name = '';
                     }
                 } else {
                     $city_name = '';
                     $area_name = '';
                     $street_name = '';
                 }
             }
             if (empty($where_list)) {
                 if ($province_name) {
                     $where_list['province'] = "`province`='" . addslashes("{$province_name}") . "'";
                     $query_link .= "&province=" . $province;
                     if ($city_name) {
                         $where_list['city'] = "`city`='" . addslashes("{$city_name}") . "'";
                         $query_link .= "&city=" . $city;
                         if ($area_name) {
                             $where_list['area'] = "`area`='" . addslashes("{$area_name}") . "'";
                             $query_link .= "&area=" . $area;
                             if ($street_name) {
                                 $where_list['street'] = "`street`='" . addslashes("{$street_name}") . "'";
                                 $query_link .= "&street=" . $street;
                             }
                         }
                     }
                 }
             }
             $query = $this->DatabaseHandler->Query("select * from " . TABLE_PREFIX . "common_district where `upid` = '0' order by list");
             while ($rsdb = $query->GetRow()) {
                 $province_arr[$rsdb['id']]['value'] = $rsdb['id'];
                 $province_arr[$rsdb['id']]['name'] = $rsdb['name'];
                 if ($member['province'] == $rsdb['name']) {
                     $province_id = $rsdb['id'];
                 }
             }
             $province_id = $province ? $province : $province_id;
             $province_list = jform()->Select("province", $province_arr, $province_id, "onchange=\"changeProvince();\"");
             $hid_area = '';
             $hid_city = '';
             $hid_street = '';
             if (!$province && $province_id) {
                 if ($member['city']) {
                     $hid_city = DB::result_first("select id from " . TABLE_PREFIX . "common_district where name = '{$member['city']}' and upid = '{$province_id}'");
                 }
                 if ($hid_city) {
                     if ($member['area']) {
                         $hid_area = DB::result_first("select id from " . TABLE_PREFIX . "common_district where name = '{$member['area']}' and upid = '{$hid_city}'");
                     }
                     if ($hid_area) {
                         if ($member['street']) {
                             $hid_street = DB::result_first("select id from " . TABLE_PREFIX . "common_district where name = '{$member['street']}' and upid = '{$hid_area}'");
                         }
                     }
                 }
             }
             $hid_city = $city ? $city : $hid_city;
             $hid_area = $area ? $area : $hid_area;
             $hid_street = $street ? $street : $hid_street;
         } elseif ('company' == $act && $this->Config['company_enable'] && @is_file(ROOT_PATH . 'include/logic/cp.logic.php')) {
             global $_J;
             $companyid = jget('companyid', 'int');
             $departmentid = jget('departmentid', 'int');
             $jobid = jget('jobid', 'int');
             if ($companyid < 1 && $departmentid < 1 && $jobid < 1) {
                 $companyid = (int) $_J['member']['companyid'];
                 $departmentid = (int) $_J['member']['departmentid'];
                 $jobid = (int) $_J['member']['jobid'];
             }
             $company_list = jlogic('cp')->get_cp_html($companyid);
             if ($this->Config['department_enable']) {
                 $department_list = jlogic('cp')->get_cp_html($departmentid, 'department', $companyid);
             }
             $job_list = jlogic('job')->get_job_select($jobid);
             if ($companyid > 0) {
                 $where_list['company'] = "`companyid`='" . $companyid . "'";
                 $query_link .= '&companyid=' . $companyid;
             }
             if ($departmentid > 0) {
                 $where_list['department'] = "`departmentid`='" . $departmentid . "'";
                 $query_link .= '&departmentid=' . $departmentid;
             }
             if ($jobid > 0) {
                 $where_list['job'] = "`jobid`='" . $jobid . "'";
                 $query_link .= '&jobid=' . $jobid;
             }
         } else {
             global $_J;
             $roleid = $this->Get['roleid'] ? (int) $this->Get['roleid'] : ($_J['role_id'] ? $_J['role_id'] : 0);
             $roles = jlogic('channel')->get_user_role();
             $role_list = jform()->Select("roleid", $roles, $roleid, "");
             if ($roleid) {
                 $where_list['role'] = "`role_id`='" . $roleid . "'";
                 $query_link .= "&roleid=" . $roleid;
             }
         }
         $member_list = array();
         if ($where_list) {
             $where = empty($where_list) ? null : ' WHERE ' . implode(' AND ', $where_list) . ' ';
             $order = " order by `uid` desc ";
             $sql = "select count(*) as `total_record` from `" . TABLE_PREFIX . "members` {$where} ";
             $total_record = DB::result_first($sql);
             if ($total_record > 0) {
                 $_config = array('return' => 'array');
                 $page_arr = page($total_record, $per_page_num, $query_link, $_config);
                 $uids = array();
                 $member_list = $this->TopicLogic->GetMember("{$where} {$order} {$page_arr['limit']}", "`uid`,`ucuid`,`username`,`nickname`,`face_url`,`face`,`fans_count`,`topic_count`,`province`,`city`,`aboutme`");
                 foreach ($member_list as $_m) {
                     $uids[$_m['uid']] = $_m['uid'];
                 }
                 if ($uids && MEMBER_ID > 0) {
                     $member_list = buddy_follow_html($member_list);
                     $province = isset($_GET['province']) ? $province : $member['province'];
                     $city = isset($_GET['city']) ? $city : $member['city'];
                     $sql = "select * from (select * from `" . TABLE_PREFIX . "topic` where `uid` in (" . jimplode($uids) . ") and `type` != 'reply' order by `dateline` desc) a group by `uid` ";
                     $query = $this->DatabaseHandler->Query($sql);
                     $tids = array();
                     while (false != ($row = $query->GetRow())) {
                         $tids[$row['tid']] = $row['tid'];
                     }
                     $topic_list = $this->TopicLogic->Get($tids);
                 }
             }
         }
         $gender_radio = jform()->Radio('gender', array(0 => array('name' => '不限', 'value' => 0), 1 => array('name' => '男', 'value' => 1), 2 => array('name' => '女', 'value' => 2)), $gender);
     }
     $this->Title = $act_list[$act];
     include template('social/profile_main');
 }
Beispiel #20
0
 private function _get_top_member($p)
 {
     $p['cache_time'] = max(300, (int) $p['cache_time']);
     $p['sql_field'] = $p['sql_field'] ? $p['sql_field'] : ' `uid`, `ucuid`, `username`, `nickname`, 
         `face_url`, `face`, 
         `topic_count`, `fans_count`, `digcount`,
         `validate`, `validate_category`,  
         `province`, `city` ';
     $p['result_list_row_make_func'] = 'jsg_member_make';
     $p['result_list_key_is_pri'] = 1;
     $p['return_list'] = 1;
     $rets = $this->db->get($p);
     if ($rets) {
         $rets = buddy_follow_html($rets, 'uid', 'follow_html2');
         if ($GLOBALS['_J']['plugins']['func']['printuser']) {
             foreach ($rets as $row) {
                 jlogic('plugin')->hookscript('printuser', 'funcs', $row, 'printuser');
             }
         }
     }
     return $rets;
 }