Beispiel #1
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;
 }
 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;
 }
 function _MemberList($where = '')
 {
     $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);
         $sql = "select `uid`,`ucuid`,`username`,`nickname`,`face_url`,`face`,`fans_count`,`topic_count`,`follow_count`,`province`,`city`,`validate` from `" . TABLE_PREFIX . "members` {$where} {$order} {$page_arr['limit']}";
         $query = $this->DatabaseHandler->Query($sql);
         $uids = array();
         while (false != ($row = $query->GetRow())) {
             $row['face'] = face_get($row);
             $member_list[] = $row;
         }
     }
     return $member_list;
 }
Beispiel #4
0
 function getMusicUser($limit = 10)
 {
     $time = TIMESTAMP;
     $time = $time - 30 * 86400;
     $user = array();
     $sql = "SELECT\r\n\t\t\t\t  COUNT(*) AS m_count,t.uid,m.username,m.nickname\r\n\t\t\t\tFROM `" . TABLE_PREFIX . "topic_music` t\r\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "members m ON m.uid = t.uid\r\n\t\t\t\tWHERE t.dateline > {$time}\r\n\t\t\t\tGROUP BY t.`uid`\r\n\t\t\t\tORDER BY m_count DESC\r\n\t\t\t\tLIMIT {$limit}  ";
     $query = DB::query($sql);
     while ($rs = DB::fetch($query)) {
         if ($rs['uid'] > 0) {
             $rs['face'] = face_get($rs['uid']);
             $user[$rs['uid']] = $rs;
         }
     }
     return $user;
 }
Beispiel #5
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 #6
0
 function member_search()
 {
     $q = trim($this->Get['q']);
     $qid = intval(trim($this->Get['qid']));
     if (empty($qid)) {
         $this->Messager('错误的操作');
     }
     $qun_info = $this->QunLogic->get_qun_info($qid);
     if (empty($qun_info)) {
         $this->Messager('当前' . $this->Config[changeword][weiqun] . '不存在或者已经被删除了');
     }
     if (empty($q)) {
         $this->Messager('搜索关键字不能为空');
     }
     $perpage = 60;
     $gets = array('mod' => 'qun', 'code' => 'member_search', 'qid' => $qid, 'q' => $this->Get['q']);
     $page_url = 'index.php?' . url_implode($gets);
     $key = jstripslashes($q);
     $s_sql = addcslashes($q, '_%');
     $where_sql = " m.nickname LIKE('%{$s_sql}%') ";
     $count = DB::result_first("SELECT COUNT(*)\r\n\t\t\t\t\t\t\t\t   FROM " . DB::table('members') . " AS m\r\n\t\t\t\t\t\t\t\t   LEFT JOIN " . DB::table('qun_user') . " AS qu\r\n\t\t\t\t\t\t\t\t   ON m.uid=qu.uid\r\n\t\t\t\t\t\t\t\t   WHERE qu.qid='{$qid}' AND {$where_sql} ");
     $members = array();
     if ($count) {
         $_config = array('return' => 'array');
         $page_arr = page($count, $perpage, $page_url, $_config);
         $query = DB::query("SELECT m.nickname, m.username, m.uid, m.face\r\n\t\t\t\t\t\t\t\tFROM " . DB::table('members') . " AS m\r\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB::table('qun_user') . " AS qu\r\n\t\t\t\t\t\t\t\tON m.uid=qu.uid\r\n\t\t\t\t\t\t\t\tWHERE qu.qid='{$qid}' AND {$where_sql}\r\n\t\t\t\t\t\t\t\t{$page_arr['limit']} ");
         while ($value = DB::fetch($query)) {
             $value['face'] = face_get($value['uid']);
             $members[] = $value;
         }
     }
     $this->Title = $this->Config[changeword][weiqun] . " - " . $qun_info['name'] . "的成员";
     include_once template('qun/members');
 }
Beispiel #7
0
 function getUserInfo()
 {
     Mobile::is_login();
     $uid = trim($this->Get['uid']);
     $nick = get_safe_code(trim($this->Get['nick']));
     if (!empty($uid) && $uid > 0) {
         $member = DB::fetch_first("SELECT * FROM " . DB::table('members') . " WHERE uid='{$uid}'");
     } else {
         if (!empty($nick)) {
             $member = DB::fetch_first("SELECT * FROM " . DB::table('members') . " WHERE nickname='{$nick}'");
         }
     }
     if (empty($member)) {
         Mobile::error("No User", 300);
     }
     $ret = array('uid' => $member['uid'], 'nick' => $member['nickname'], 'gender' => $member['gender'], 'face' => face_get($member), 'face_original' => face_get($member, 'big'), 'signature' => $member['signature'], 'province' => $member['province'], 'city' => $member['city'], 'fans_num' => $member['fans_count'], 'follower_num' => $member['follow_count'], 'mblog_num' => $member['topic_count'], 'topic_num' => $member['tag_favorite_count']);
     Mobile::output($ret);
 }
Beispiel #8
0
 function _getuserfortid($tid = 0)
 {
     if ($tid > 0) {
         $user = DB::fetch_first("SELECT t.uid,m.username,m.nickname FROM " . DB::table('topic') . " AS t LEFT JOIN " . DB::table('members') . " AS m ON t.uid = m.uid WHERE t.tid='{$tid}'");
         $user['face'] = face_get($user['uid']);
         return $user;
     }
 }
Beispiel #9
0
 function face()
 {
     $info = array();
     $uid = jget('uid', 'int');
     if ($uid < 1) {
         $keys = array('nickname', 'username', 'email', 'id', 'phone');
         $val = '';
         foreach ($keys as $key) {
             $val = jget($key, 'txt');
             if ($val) {
                 break;
             }
         }
         if ($val) {
             $info = jsg_member_info($val, '');
         }
     } else {
         $info = jsg_member_info($uid);
     }
     $type = jget('type', 'txt');
     $type = in_array($type, array('small', 'middle', 'big')) ? $type : 'small';
     $face = face_get($info, $type);
     if (jget('echo')) {
         exit($face);
     } else {
         $this->Messager(null, $face);
     }
 }
Beispiel #10
0
 function DoCheckUser()
 {
     $ret = false;
     $username = trim(jget('username'));
     if (!$username) {
         json_error('请输入帐号');
     }
     #if NEDU
     if (defined('NEDU_MOYO')) {
         nlogic('user/passport')->onlogin($username);
     }
     #endif
     if ($this->Config['ldap_enable']) {
         if ($this->_is_email($username)) {
             $uid = DB::result_first(" select `uid` from `" . TABLE_PREFIX . "members` where `email` = '{$username}' ");
             $uid = $uid ? $uid : 0;
             $face = face_get($uid);
             json_result($face);
         }
         json_error('域帐号不存在');
     } else {
         $uid = jsg_member_uid($username);
         if ($uid > 0) {
             $face = face_get($uid);
             json_result($face);
         } elseif (true === UCENTER) {
             include_once ROOT_PATH . 'api/uc_client/client.php';
             if ($this->_is_email($username)) {
                 $return = uc_user_checkemail($username);
             } else {
                 $return = uc_user_checkname($username);
             }
             if ($return == '-3' || $return == '-6') {
                 json_result(face_get(0));
             }
         }
         json_error('帐号不存在');
     }
 }
Beispiel #11
0
 function getUserFansTop()
 {
     $users = array();
     $query = DB::query("SELECT uid,username,nickname FROM " . DB::table('members') . " ORDER BY fans_count DESC LIMIT 12");
     while ($value = DB::fetch($query)) {
         $value['face'] = face_get($value['uid']);
         $users[] = $value;
     }
     return $users;
 }
Beispiel #12
0
 function getAllUser($param, $type)
 {
     $where = $param['where'];
     $order = $param['order'];
     $limit_sql = $param['limit'];
     $count = DB::result_first("select count(*) from " . TABLE_PREFIX . "event_member a where {$where} ");
     if ($param['page']) {
         $_config = array('return' => 'array');
         $page_arr = page($count, $param['perpage'], $param['page_url'], $_config);
         $limit_sql = $page_arr['limit'];
     }
     $sql = "select m.uid,m.nickname,m.username,m.face,m.province,m.city,a.app_time,a.app_info,a.play_time\r\n\t    \t\tfrom " . TABLE_PREFIX . "event_member a\r\n\t    \t\tleft join " . TABLE_PREFIX . "members m on m.uid=a.fid\r\n\t    \t\twhere {$where}\r\n\t    \t\t{$order}\r\n\t    \t\t{$limit_sql} ";
     $query = DB::query($sql);
     while ($rsdb = DB::fetch($query)) {
         $rsdb['face'] = face_get($rsdb['uid']);
         if ($type == 'app') {
             $rsdb['time'] = date("Y-m-d H:i", $rsdb['app_time']);
         } else {
             $rsdb['time'] = date("Y-m-d H:i", $rsdb['play_time']);
         }
         $member[$rsdb['uid']] = $rsdb;
     }
     $return['member'] = $member;
     $return['count'] = $count;
     $return['page_arr'] = $page_arr;
     return $return;
 }
Beispiel #13
0
 function getRewardUser($param)
 {
     $where_arr = array();
     if ($param['rid']) {
         if (is_array($param['rid'])) {
             $where_arr['rid'] = " `rid` in('" . implode("','", $param['rid']) . "') ";
         }
         $where_arr['rid'] = " `rid` = '{$param['rid']}' ";
     }
     if (isset($param['on'])) {
         $where_arr['on'] = " `on` = '" . $param['on'] . "' ";
     }
     $where_sql = $where_arr ? ' where ' . implode(' and ', $where_arr) : '';
     $count = DB::result_first("select count(*) as tot_count from `" . TABLE_PREFIX . "reward_user` {$where_sql} ");
     $page_arr = array();
     if ($param['page']) {
         $_config = array('return' => 'array');
         $page_arr = page($count, $param['per_page_num'], $param['url'], $_config);
         $limit = $page_arr['limit'];
     } else {
         if ($param['limit']) {
             $limit = ' limit ' . $param['limit'] . ' ';
         } else {
             return array();
         }
     }
     $sql = " select u.uid,u.dateline,m.username,m.nickname,m.province,m.city\r\n\t\t\t\t from `" . TABLE_PREFIX . "reward_user` u\r\n\t\t\t\t left join `" . TABLE_PREFIX . "members` m on m.uid = u.uid\r\n\t\t\t\t {$where_sql}\r\n\t\t\t\t order by `dateline` DESC\r\n\t\t\t\t {$limit} ";
     $query = DB::query($sql);
     $user = array();
     while ($rs = DB::fetch($query)) {
         $rs['dateline'] = date('Y-m-d H:i:s', $rs['dateline']);
         $rs['face'] = face_get($rs['uid']);
         $user[$rs['uid']] = $rs;
     }
     $return = array('count' => $count, 'page_arr' => $page_arr, 'user' => $user);
     return $return;
 }
Beispiel #14
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 #15
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 #16
0
 function Face2UC()
 {
     if ('admin' != MEMBER_ROLE_TYPE) {
         exit;
     }
     if (true !== UCENTER) {
         $this->Messager("请先开启UC功能", null);
     }
     if (true === UCENTER_FACE) {
         $this->Messager("请先关闭UC头像功能", null);
     }
     $uc_root = $this->Get['uc_root'];
     if (false === strpos($uc_root, '/data/avatar/')) {
         $uc_root = $uc_root . '/data/avatar/';
     }
     if (!is_dir($uc_root)) {
         $this->Messager("请先设置正确的UC服务端绝对路径地址", null);
     }
     $uid_min = max(0, (int) $this->Get['uid_min']);
     $uid_max = $uid_min + 200;
     $sql = "select `uid`,`username`,`face_url`,`face`,`ucuid` from " . TABLE_PREFIX . "members where `ucuid`>'0' and `uid`>='{$uid_min}' and `uid`<'{$uid_max}' order by `uid` asc";
     $query = $this->DatabaseHandler->Query($sql);
     if ($query->GetNumRows() < 1) {
         $this->Messager("已经同步完成", null);
     }
     while (false != ($row = $query->GetRow())) {
         $row['ucuid'] = (int) $row['ucuid'];
         if ($row['ucuid'] < 1) {
             continue;
         }
         $face_s = face_get($row);
         $face_b = face_get($row, 'big');
         $uc_face_s = $uc_root . $this->uc_get_avatar($row['ucuid'], 'small');
         $uc_face_m = $uc_root . $this->uc_get_avatar($row['ucuid'], 'middle');
         $uc_face_b = $uc_root . $this->uc_get_avatar($row['ucuid'], 'big');
         if ($face_s != $face_b) {
             if (!is_dir(dirname($uc_face_s))) {
                 jio()->MakeDir(dirname($uc_face_s));
             }
             if (is_image($face_s) && !is_file($uc_face_s)) {
                 copy($face_s, $uc_face_s);
             }
             if (is_image($face_b)) {
                 if (!is_file($uc_face_m)) {
                     copy($face_b, $uc_face_m);
                 }
                 if (!is_file($uc_face_b)) {
                     copy($face_b, $uc_face_b);
                 }
             }
         }
     }
     $this->Messager("正在更新UC头像,请稍候……", "admin.php?mod=ucenter&code=face2uc&uc_root=" . urlencode($uc_root) . "&uid_min={$uid_max}");
 }
Beispiel #17
0
 function Modify()
 {
     $this->ID = $this->ID > 0 ? $this->ID : MEMBER_ID;
     if ($this->ID < 1) {
         $this->Messager("请指定一个正确的UID");
     }
     $this->Title = "编辑用户";
     $member_info = DB::fetch_first("SELECT\r\n\t\t\t *\r\n\t\t FROM\r\n\t\t\t " . TABLE_PREFIX . 'members' . " M LEFT JOIN " . TABLE_PREFIX . 'memberfields' . " MF ON(M.uid=MF.uid)\r\n\t\t WHERE\r\n\t\t\t M.uid='{$this->ID}'");
     if (!$member_info) {
         $this->Messager("用户已经不存在");
     }
     $admin_check_allow = admin_check_allow($member_info['uid']);
     $role_id = $gender = $bday = '';
     extract($member_info);
     $member_face = face_get($uid);
     $sql = "\r\n\t\t SELECT\r\n\t\t\t id,name\r\n\t\t FROM\r\n\t\t\t " . TABLE_PREFIX . 'role' . "\r\n\t\t WHERE\r\n\t\t\t `id`>1 " . (true === JISHIGOU_FOUNDER ? "" : " AND `type`='normal'");
     $query = $this->DatabaseHandler->Query($sql);
     while (false != ($row = $query->GetRow())) {
         $role_list[$row['id']] = array('name' => $row['name'], 'value' => $row['id']);
     }
     $role_select = $this->jishigou_form->Select('role_id', $role_list, $role_id, " onchange=\"showcause();\" ");
     $role_name = $role_list[$role_id]['name'] ? $role_list[$role_id]['name'] : DB::result_first("select `name` from " . DB::table('role') . " where `id`='{$role_id}'");
     $gender_radio = $this->jishigou_form->Radio('gender', array(array('name' => "男", 'value' => '1'), array('name' => "女", 'value' => '2')), $gender);
     $_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' => '驾驶证'), '其他' => array('name' => '其他', 'value' => '其他'));
     $validate_card_type_select = $this->jishigou_form->Select('validate_card_type', $_options, $member_info['validate_card_type']);
     $login_enable = jconf::get('login_enable');
     $cause = $login_enable[$role_id][$member_info['uid']]['cause'];
     $uid = $this->ID;
     if (@is_file(ROOT_PATH . 'include/logic/cp.logic.php') && $this->Config['company_enable']) {
         $companyselect = $this->CpLogic->get_cp_html($member_info['companyid']);
         if ($this->Config['department_enable']) {
             $departmentselect = $this->CpLogic->get_cp_html($member_info['departmentid'], 'department', $member_info['companyid']);
         }
         $jobselect = jlogic('job')->get_job_select($member_info['jobid']);
         $morcompanys = $this->CpLogic->get_cp_users($member_info['uid']);
     }
     #附加项目
     $groupProfile = jconf::get('groupprofile');
     $member = $member_info;
     #附加信息
     $member_profile = jlogic('member_profile')->getMemberProfileInfo($member['uid']);
     if ($member_profile) {
         $member['address'] = $member_profile['address'];
         $member = array_merge($member_profile, $member);
     }
     $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 ($province == $rsdb['name']) {
             $province_id = $rsdb['id'];
         }
     }
     $province_list = $this->jishigou_form->Select("province", $province_arr, $province_id, "onchange=\"changeProvince();\"");
     if ($province_id) {
         if ($city) {
             $hid_city = DB::result_first("select id from " . TABLE_PREFIX . "common_district where name = '{$city}' and upid = '{$province_id}'");
         }
         if ($hid_city) {
             if ($area) {
                 $hid_area = DB::result_first("select id from " . TABLE_PREFIX . "common_district where name = '{$area}' and upid = '{$hid_city}'");
             }
             if ($hid_area) {
                 if ($street) {
                     $hid_street = DB::result_first("select id from " . TABLE_PREFIX . "common_district where name = '{$street}' and upid = '{$hid_area}'");
                 }
             }
         }
     }
     $action = 'admin.php?mod=member&code=domodify';
     include template('admin/member_info');
 }
Beispiel #18
0
function jsg_member_make($row)
{
    if (isset($row['uid'])) {
        if ($row['face']) {
            $row['__face__'] = $row['face'];
        }
        if (true !== UCENTER_FACE && !$row['face']) {
            $row['face'] = $row['face_small'] = $row['face_original'] = face_get();
        } else {
            $row['face_small'] = $row['face'] = face_get($row);
            $row['face_original'] = face_get($row, 'middle');
        }
        if ($row['validate'] || $row['role_id']) {
            $row = jsg_member_make_validate($row);
        }
    }
    if (isset($row['province']) || isset($row['city'])) {
        $row['from_area'] = "{$row['province']} {$row['city']}";
    }
    if (isset($row['gender'])) {
        if ($row['gender'] == 1) {
            $row['gender_ta'] = '他';
        } else {
            $row['gender_ta'] = '她';
        }
    }
    if ($row['role_id'] > 0 && !isset($row['role_name'])) {
        $row['role_name'] = jtable('role')->get_name_by_id($row['role_id']);
    }
    return $row;
}
Beispiel #19
0
 function getNotice($page)
 {
     $return_arr = array();
     $page_arr = array();
     if ($page) {
         $sql = "select count(*) from " . TABLE_PREFIX . "pms\r\n\t\t\t\t\twhere plid = 0";
         $count = DB::result_first($sql);
         $page_arr = page($count, $page['per_page_num'], $page['query_link'], array('return' => 'array'));
         $limit = $page_arr['limit'];
     } else {
         $limit = $page['limit'];
     }
     $sql = "select * from " . TABLE_PREFIX . "pms\r\n\t\t\t\twhere plid = 0\r\n\t\t\t\torder by dateline desc {$limit} ";
     $query = $this->DatabaseHandler->Query($sql);
     $pm_list = array();
     while (false != ($row = $query->GetRow())) {
         $row['uid'] = $row['msgfromid'];
         $row['face'] = face_get($row['msgfromid']);
         $row['username'] = $row['msgfrom'];
         $row['nickname'] = $row['msgnickname'];
         $row['message'] = nl2br($row['message']);
         $nickname = $row['nickname'];
         $row = $this->msgformat($row);
         $pm_list[$row['pmid']] = $row;
     }
     $return_arr['nickname'] = $nickname;
     $return_arr['pm_list'] = $pm_list;
     $return_arr['page_arr'] = $page_arr;
     return $return_arr;
 }
Beispiel #20
0
 function ASManage()
 {
     $code = $this->Code;
     if ($code == 'signature') {
         $time = 'signtime';
     } else {
         $time = 'aboutmetime';
     }
     $action = "admin.php?mod=topic&code={$code}";
     $managetype = (array) $this->Post['managetype'];
     if ($managetype) {
         foreach ($managetype as $val => $act) {
             if ($act == 1) {
                 $sql = "update " . TABLE_PREFIX . "members set {$time} = '" . time() . "' where uid = '{$val}'";
             } else {
                 $sql = "update " . TABLE_PREFIX . "members set {$code} = '',{$time} = 0 where uid = '{$val}'";
             }
             $this->DatabaseHandler->Query($sql);
         }
         $this->Messager("操作成功");
     }
     $per_page_num = min(500, max(20, (int) (isset($_GET['pn']) ? $_GET['pn'] : $_GET['per_page_num'])));
     $query_link = 'admin.php?mod=topic&code=' . $code;
     $where = '';
     $mtype = (int) $this->Get['mtype'];
     if ($mtype) {
         $where .= " and {$time} != 0 ";
         $query_link .= "&mtype={$mtype}";
         $mtype_arr[1] = ' selected ';
     } else {
         $where .= " and {$time} = 0 ";
         $query_link .= "&mtype={$mtype}";
     }
     $nickname = $this->Get['nickname'] ? $this->Get['nickname'] : $this->Post['nickname'];
     if ($nickname) {
         $where .= " and nickname = '{$nickname}' ";
         $query_link .= "&nickname={$nickname}";
     }
     $keyword = $this->Get['keyword'] ? $this->Get['keyword'] : $this->Post['keyword'];
     if ($keyword) {
         $where .= " and {$code} like '%{$keyword}%' ";
         $query_link .= "&keyword={$keyword}";
     }
     $timefrom = $this->Get['timefrom'];
     if ($timefrom) {
         $str_time_from = strtotime($timefrom);
         $where .= " and `lastactivity`>'{$str_time_from}'";
         $query_link .= "&timefrom=" . $timefrom;
     }
     $timeto = $this->Get['timeto'];
     if ($timeto) {
         $str_time_to = strtotime($timeto);
         $where .= " and `lastactivity`<'{$str_time_to}'";
         $query_link .= "&timeto=" . $timeto;
     }
     $total_record = DB::result_first("select count(*) from " . TABLE_PREFIX . "members where {$code} != '' {$where} ");
     $page_arr = page($total_record, $per_page_num, $query_link, array('return' => 'array'), '20 50 100 200 500');
     $sql = "select uid,username,nickname,lastip,lastactivity,{$this->Code}\r\n\t\t\t\tfrom " . TABLE_PREFIX . "members\r\n\t\t\t\twhere {$code} != ''  {$where}\r\n\t\t\t\torder by lastactivity desc\r\n\t\t\t\t{$page_arr['limit']}";
     $query = $this->DatabaseHandler->Query($sql);
     $member = array();
     while (false != ($rs = $query->GetRow())) {
         $rs['face'] = face_get($rs['uid']);
         $rs['content'] = $rs[$code];
         $member[$rs['uid']] = $rs;
     }
     include template('admin/as_manage');
 }