Example #1
0
 function index()
 {
     $per_page_num = min(500, max(20, (int) (isset($_GET['pn']) ? $_GET['pn'] : $_GET['per_page_num'])));
     $gets = array('mod' => 'recdtopic', 'pn' => $this->Get['pn'], 'per_page_num' => $this->Get['per_page_num'], 'keyword' => $this->Get['keyword'], 'nickname' => $this->Get['nickname']);
     $page_url = 'admin.php?' . url_implode($gets);
     $where_sql = ' 1 AND tr.tid>0 ';
     $keyword = trim($this->Get['keyword']);
     if ($keyword) {
         $_GET['highlight'] = $keyword;
         $where_sql .= " AND " . build_like_query('t.content,t.content2', $keyword) . " ";
     }
     $nickname = trim($this->Get['nickname']);
     if ($nickname) {
         $sql = "select `username`,`nickname` from `" . TABLE_PREFIX . "members` where `nickname`='{$nickname}' limit 0,1";
         $query = $this->DatabaseHandler->Query($sql);
         $members = $query->GetRow();
         $where_sql .= " AND `username`='{$members['username']}' ";
     }
     $count = DB::result_first("SELECT COUNT(*)\r\n\t\t\t\t\t\t\t\t   FROM " . DB::table('topic') . " AS t\r\n\t\t\t\t\t\t\t\t   LEFT JOIN " . DB::table('topic_recommend') . " AS tr\r\n\t\t\t\t\t\t\t\t   ON t.tid=tr.tid\r\n\t\t\t\t\t\t\t\t   WHERE {$where_sql}");
     $topic_list = array();
     if ($count) {
         $page_arr = page($count, $per_page_num, $page_url, array('return' => 'array'));
         $query = DB::query("SELECT t.*,tr.dateline AS recd_time,tr.expiration,tr.r_nickname\r\n\t\t\t\t\t\t\t\tFROM  " . DB::table('topic') . " AS t\r\n\t\t\t\t\t\t\t\tLEFT JOIN " . DB::table('topic_recommend') . " AS tr\r\n\t\t\t\t\t\t\t\tON t.tid=tr.tid\r\n\t\t\t\t\t\t\t\tWHERE {$where_sql}\r\n\t\t\t\t\t\t\t\tORDER BY tr.dateline DESC\r\n\t\t\t\t\t\t\t\t{$page_arr['limit']} ");
         while ($value = DB::fetch($query)) {
             $value['recd_time'] = my_date_format2($value['recd_time']);
             $topic_list[] = $value;
         }
         $topic_list = $this->TopicLogic->MakeAll($topic_list);
     }
     include template('admin/recdtopic');
 }
Example #2
0
 function PmManage()
 {
     $per_page_num = min(500, max(20, (int) (isset($_GET['pn']) ? $_GET['pn'] : $_GET['per_page_num'])));
     $where_list = array();
     $query_link = 'admin.php?mod=pm&code=pm_manage';
     $username = trim($this->Get['username']);
     $keyword = trim($this->Get['keyword']);
     $tousername = trim($this->Get['tousername']);
     $where_list['inbox'] = " `folder` = 'inbox' ";
     if ($username) {
         $where_list['msgnickname'] = "`msgnickname`='{$username}'";
         $query_link .= "&username="******"`tonickname`='{$tousername}'";
         $query_link .= "&tousername="******"&keyword=" . urlencode($keyword);
     }
     $where = empty($where_list) ? null : ' WHERE ' . implode(' AND ', $where_list) . ' ';
     $sql = " select count(*) as `total_record` from `" . TABLE_PREFIX . "pms` {$where}";
     $result = mysql_query($sql);
     $total_records = mysql_fetch_array($result);
     $total_record = $total_records[0];
     $page_arr = page($total_record, $per_page_num, $query_link, array('return' => 'array'), '20 50 100 200,500');
     $sql = " select *,m1.nickname as msgnickname,m2.nickname as tonickname from `" . TABLE_PREFIX . "pms` p\r\n\t\t\t\t left join `" . TABLE_PREFIX . "members` m1 on m1.uid = p.msgfromid\r\n\t\t\t\t left join `" . TABLE_PREFIX . "members` m2 on m2.uid = p.msgtoid\r\n\t\t\t\t {$where} order by `pmid` desc {$page_arr['limit']} ";
     $query = $this->DatabaseHandler->Query($sql);
     $pm_list = array();
     while ($row = $query->GetRow()) {
         $pm_list[] = $row;
     }
     include template('admin/pm');
 }
 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;
 }
Example #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;
 }
Example #5
0
 function Main()
 {
     $per_page_num = min(500, max(10, (int) (isset($_GET['pn']) ? $_GET['pn'] : $_GET['per_page_num'])));
     $where_list = array();
     $query_link = 'admin.php?mod=user_tag';
     $tagname = $this->Get['tagname'];
     if ($tagname) {
         $_GET['highlight'] = $tagname;
         $where_list['keyword'] = build_like_query('name', $tagname);
         $query_link .= "&keyword=" . urlencode($tagname);
         $where = empty($where_list) ? null : ' WHERE ' . implode(' AND ', $where_list) . ' ';
     }
     $sql = " select count(*) as `total_record` from `" . TABLE_PREFIX . "user_tag` {$where}";
     $total_record = DB::result_first($sql);
     $page_arr = page($total_record, $per_page_num, $query_link, array('return' => 'array'), '20 50 100 200,500');
     $sql = "select * from `" . TABLE_PREFIX . "user_tag` {$where} order by `id` desc {$page_arr['limit']}";
     $query = $this->DatabaseHandler->Query($sql);
     $user_tag_list = array();
     while (false != ($row = $query->GetRow())) {
         $user_tag_list[] = $row;
     }
     include template('admin/user_tag');
 }
Example #6
0
 function QunSearch()
 {
     $qun_setting = $this->Config['qun_setting'];
     if (!$qun_setting['qun_open']) {
         $this->Messager("当前站点没有开放" . $this->Config[changeword][weiqun] . "功能");
     }
     $perpage = 10;
     $q = trim($this->Get['q']);
     $q = get_safe_code($q);
     $gets = array('mod' => 'search', 'code' => 'qun', 'q' => $this->Get['q']);
     $page_url = 'index.php?' . url_implode($gets);
     $count = 0;
     if (!empty($q)) {
         $q = $this->_filterKeyword($q);
         $search_keyword = $q;
         $QunLogic = jlogic('qun');
         $where = ' gview_perm=0 AND ' . build_like_query('name', $q) . ' ';
         $order = " ORDER BY dateline DESC ";
         $cache_time = 3600;
         if ($cache_time > 0) {
             $cache_key = "qun-search-{$q}";
             if (false === ($qids = cache_db('mget', $cache_key))) {
                 $query = DB::query("SELECT `qid` FROM " . DB::table('qun') . " WHERE {$where} {$order} LIMIT {$this->cache_ids_limit} ");
                 $qids = array();
                 while (false != ($row = DB::fetch($query))) {
                     $qids[$row['qid']] = $row['qid'];
                 }
                 cache_db('mset', $cache_key, $qids, $cache_time);
             }
             $where = $qids ? " `gview_perm`='0' AND `qid` IN ('" . implode("','", $qids) . "') " : "";
         }
         $qun_list = array();
         if ($where) {
             $count = DB::result_first("SELECT COUNT(*) FROM " . DB::table('qun') . " WHERE {$where}");
             if ($count > 0) {
                 $page_arr = page($count, $perpage, $page_url, array('return' => 'array'));
                 $query = DB::query("SELECT * FROM " . DB::table('qun') . " WHERE {$where} {$order} {$page_arr['limit']}");
                 while ($value = DB::fetch($query)) {
                     if (empty($value['icon'])) {
                         $value['icon'] = $QunLogic->qun_avatar($value['qid'], 's');
                     }
                     $value['dateline'] = my_date_format2($value['dateline']);
                     $qun_list[] = $value;
                 }
             }
         }
     }
     $member = jsg_member_info(MEMBER_ID);
     if ($member['medal_id']) {
         $medal_list = $this->TopicLogic->GetMedal($member['medal_id'], $member['uid']);
     }
     $this->Title = $this->Config[changeword][weiqun] . '搜索';
     include template('social/search_list');
 }
Example #7
0
 function _get_topic_list_1($key)
 {
     $ret = array();
     $akey = addslashes($key);
     $sql_where = build_like_query('`content`,`content2`', $akey);
     $cache_id = 'wall/_get_topic_list_1-' . $akey;
     if (false === ($total_record = cache_file('get', $cid = $cache_id . '-count'))) {
         $total_record = DB::result_first("select count(*) as `count` from " . DB::table('topic') . " where {$sql_where} ");
         cache_file('set', $cid, $total_record, 300);
     }
     if ($total_record > 0) {
         $per_page_num = 20;
         $query_link = "index.php?mod=wall&code=control&type=1&key=" . urlencode($key);
         $page_arr = page($total_record, $per_page_num, $query_link, array('return' => 'Array'));
         if (false === ($topic_list = cache_file('get', $cid = $cache_id . '-list-' . $page_arr['limit']))) {
             $topic_list = $this->TopicLogic->Get(" where {$sql_where} order by `dateline` desc {$page_arr[limit]}");
             cache_file('set', $cid, $topic_list, 300);
         }
         if ($topic_list) {
             $parent_list = $this->TopicLogic->GetParentTopic($topic_list);
             $ret['total_record'] = $total_record;
             $ret['page_arr'] = $page_arr;
             $ret['topic_list'] = $topic_list;
             $ret['parent_list'] = $parent_list;
         }
     }
     return $ret;
 }
Example #8
0
 function City()
 {
     $pid = (int) $this->Get['pid'];
     $cid = (int) $this->Get['cid'];
     if ($cid) {
         $province_ary = DB::fetch_first("SELECT *\r\n\t\t\t\t\t\tFROM " . DB::table('common_district') . "\r\n\t\t\t\t\t\twhere `id` = '{$pid}' ");
         $province_id = $province_ary['id'];
         $province_name = $province_ary['name'];
         $city_where_list = "where `upid` = '{$pid}'";
         $city_ary = $this->ValidateLogic->CategoryCityList($city_where_list);
         $city_name = $city_ary[$cid]['name'];
         $config = jconf::get();
         $people_config = $config['validate_people_setting'];
         $cat_where = "where `is_push` = 2";
         $cat_member_limit = $people_config['proviect_user_limit'] ? $people_config['proviect_user_limit'] : 20;
         $cat_member = $this->ValidateLogic->CategoryUserList($cat_where, $cat_member_limit, $people_config['proviect_user_orderby']);
         $cat_member_list = $cat_member['member'];
         $cat_member_uids = $cat_member['uids'];
         $member_num = 30;
         $query_link = "index.php?mod=" . ($_GET['mod_original'] ? get_safe_code($_GET['mod_original']) : $this->Module) . ($this->Code ? "&amp;code={$this->Code}&pid={$this->Get['pid']}&cid={$this->Get['cid']}" : "");
         $where_list['city'] = build_like_query('city', $city_name);
         $where = ' where ' . implode(' AND ', $where_list) . ' and `validate` !="" ';
         $members = $this->_memberlist($where, $member_num, 'fans_count', $query_link);
         $member_list = $members['member'];
         $page_html = $members['pagearr']['html'];
     }
     $this->Title = "名人堂";
     include template("people/people_city_view");
 }
Example #9
0
 function search($param)
 {
     $max_tid = intval($param['max_tid']);
     $perpage = intval($param['perpage']);
     if (isset($param['topic_parent_disable'])) {
         $topic_parent_disable = (bool) $param['topic_parent_disable'];
     } else {
         $topic_parent_disable = false;
     }
     $topic_list_get = false;
     $options = array();
     if ($perpage > 0) {
         $options['perpage'] = $perpage;
     }
     $limit = intval($param['limit']);
     if ($limit > 0) {
         $options['limit'] = $limit;
     }
     $keyword = trim($param['q']);
     $keyword = get_safe_code($keyword);
     if ($keyword) {
         $search_keyword = $keyword;
         $_GET['highlight'] = $search_keyword;
         $where_list['keyword'] = build_like_query('`content`,`content2`', $keyword);
     }
     if ($where_list) {
         $where = empty($where_list) ? '' : ' ' . implode(' AND ', $where_list) . ' ';
         $options = array('where' => $where, 'type' => get_topic_type(), 'order' => ' `dateline` desc ', 'limit' => $limit);
         if ($max_tid > 0) {
             $where = " tid<'{$max_tid}' ";
             if (empty($options['where'])) {
                 $options['where'] = $where;
             } else {
                 $options['where'] .= " AND " . $where;
             }
         }
         $info = $this->TopicListLogic->get_data($options);
         $topic_list = array();
         $total_record = 0;
         if (!empty($info)) {
             $topic_list = $info['list'];
             $topic_list = array_values($topic_list);
             $total_record = $info['count'];
             $page_arr = $info['page'];
         }
         $topic_list_count = 0;
         if ($topic_list) {
             $topic_list_count = count($topic_list);
             if (!$topic_parent_disable) {
                 $parent_list = $this->TopicLogic->GetParentTopic($topic_list);
             }
             $tmp_ary = $topic_list;
             $tmp_topic = array_pop($tmp_ary);
             $max_tid = $tmp_topic['tid'];
             $result = array('total_record' => $total_record, 'topic_list' => $topic_list, 'parent_list' => $parent_list, 'max_tid' => $max_tid, 'next_page' => 0);
             if (!empty($page_arr)) {
                 $result['next_page'] = $page_arr['current_page'] + 1;
             }
             return $result;
         }
     }
     return 400;
 }
 function get_tids_by_keyword($keyword, $limit = 600, $cache_time = 300)
 {
     $tids = array();
     $keyword = trim($keyword);
     $limit = max(0, (int) $limit);
     if ($keyword && $limit > 0) {
         $cache_time = max(15, (int) $cache_time);
         $cache_key = 'topic-search-' . $keyword . '-' . $limit;
         if (false === ($tids = cache_db('mget', $cache_key))) {
             $tids = jtable('topic_more')->get_ids(array('result_count' => $limit, 'sql_where' => build_like_query('`longtext`', $keyword), 'sql_order' => ' `tid` DESC '), 'tid');
             $tids = (array) ($tids ? $tids : array());
             cache_db('mset', $cache_key, $tids, $cache_time);
         }
     }
     return filter_tids($tids);
 }
Example #11
0
 function Main()
 {
     $report_config = jconf::get('report');
     $per_page_num = min(500, max(20, (int) (isset($_GET['pn']) ? $_GET['pn'] : $_GET['per_page_num'])));
     $where_list = array();
     $query_link = 'admin.php?mod=report';
     $keyword = trim($this->Get['keyword']);
     if ($keyword) {
         $_GET['highlight'] = $keyword;
         $where_list['keyword'] = build_like_query('content', $keyword);
         $query_link .= "&keyword=" . urlencode($keyword);
     }
     $username = trim($this->Get['username']);
     if ($username) {
         $where_list['username'] = "******";
         $query_link .= "&username="******" selected ";
     if ($reason) {
         $where_list['reason'] = "`reason`='{$reason}'";
         $query_link .= "&reason={$reason}";
     }
     $result = isset($this->Get['result']) ? $this->Get['result'] : '';
     $result_arr[$result] = " selected ";
     if ($result != '') {
         $where_list['result'] = "`process_result`='{$result}'";
         $query_link .= "&result={$result}";
     }
     $timefrom = $this->Get['timefrom'];
     if ($timefrom) {
         $str_time_from = strtotime($timefrom);
         $where_list['timefrom'] = "`dateline`>'{$str_time_from}'";
         $query_link .= "&timefrom=" . $timefrom;
     }
     $timeto = $this->Get['timeto'];
     if ($timeto) {
         $str_time_to = strtotime($timeto);
         $where_list['timeto'] = "`dateline`<'{$str_time_to}'";
         $query_link .= "&timeto=" . $timeto;
     }
     $where = empty($where_list) ? null : ' WHERE ' . implode(' AND ', $where_list) . ' ';
     $sql = " select count(*) as `total_record` from `" . TABLE_PREFIX . "report` {$where} ";
     $total_record = DB::result_first($sql);
     $page_arr = page($total_record, $per_page_num, $query_link, array('return' => 'array'), '20 50 100 200 500');
     $sql = " select * from `" . TABLE_PREFIX . "report` {$where} order by `id` desc {$page_arr['limit']} ";
     $query = $this->DatabaseHandler->Query($sql);
     $report_list = array();
     $TopicLogic = jlogic('topic');
     $deleted_tid = array();
     while (false != ($row = $query->GetRow())) {
         $row['topic_list'] = $TopicLogic->Get($row['tid']);
         if (!$row['topic_list']) {
             $deleted_tid[$row['id']] = $row['id'];
             continue;
         }
         if ($row['topic_list']['type'] == 'forward' && $row['topic_list']['roottid'] > 0) {
             $row['topic_list']['root_topic'] = $TopicLogic->Get($row['topic_list']['roottid']);
         }
         $row['type_show'] = $report_config['type_list'][$row['type']];
         $row['reason_show'] = $report_config['reason_list'][$row['reason']];
         $row['process_result_show'] = $report_config['process_result_list'][$row['process_result']];
         if ($row['process_time']) {
             $row['process_time'] = my_date_format($row['process_time']);
             $row['process_result_show'] = "[{$row['process_time']}]" . $row['process_result_show'];
         }
         $report_list[] = $row;
     }
     if ($deleted_tid) {
         DB::query("delete from `" . TABLE_PREFIX . "report` where id in (" . jimplode($deleted_tid) . ")");
     }
     include template('admin/report');
 }
Example #12
0
 function DoSearch()
 {
     $sql = "select * from `" . TABLE_PREFIX . "medal` ";
     $query = $this->DatabaseHandler->Query($sql);
     $medal = array();
     while (false != ($rs = $query->GetRow())) {
         $medal[$rs['id']] = $rs['medal_name'];
     }
     $credit_search_list = array();
     if ($this->Config['extcredits_enable']) {
         foreach ($this->Config['credits']['ext'] as $key => $val) {
             $credit_search_list["l[{$key}]"] = array('name' => "lower[{$key}]", 'describe' => "{$val[name]} 低于");
             $credit_search_list["h[{$key}]"] = array('name' => "higher[{$key}]", 'describe' => "{$val[name]} 高于");
         }
     }
     $where_list = array();
     if (@is_file(ROOT_PATH . 'include/logic/cp.logic.php') && $this->Config['company_enable']) {
         $companyid = (int) get_param('companyid');
         if ($companyid > 0) {
             $where_list['companyid'] = " m.companyid = '{$companyid}'";
             $cp_user_ids = $this->CpLogic->get_cp_user_uids($companyid);
         }
         $jobid = (int) get_param('jobid');
         if ($jobid > 0) {
             $where_list['jobid'] = " m.jobid = '{$jobid}'";
         }
         if ($this->Config['department_enable']) {
             $departmentid = (int) get_param('departmentid');
             if ($departmentid > 0) {
                 $where_list['departmentid'] = " m.departmentid = '{$departmentid}'";
                 $cp_user_ids = $this->CpLogic->get_cp_user_uids($departmentid, 'department');
             }
         }
     }
     $uid = (int) get_param('uid');
     if ($uid) {
         $where_list['uid'] = " m.uid = '{$uid}'";
     }
     $nickname = get_param('nickname');
     if ($nickname != '') {
         $where_list['nickname'] = build_like_query('m.nickname', $nickname);
     }
     $username = get_param('username');
     if ($username != '') {
         $where_list['username'] = build_like_query('m.username', $username);
     }
     $email = get_param('email');
     if ($email != '') {
         $where_list['email'] = build_like_query('m.email', $email);
     }
     $regip = get_param('regip');
     if ($regip != '') {
         $where_list['regip'] = " m.regip like '{$regip}%' ";
     }
     $lastip = get_param('lastip');
     if ($lastip != '') {
         $where_list['lastip'] = " m.lastip like '{$lastip}%' ";
     }
     $invite_uid = max(0, (int) get_param('invite_uid'));
     $invite_nickname = get_param('invite_nickname');
     if ('' != $invite_nickname) {
         $invite_uid = DB::result_first("select `uid` from `" . TABLE_PREFIX . "members` where `nickname`='{$invite_nickname}'");
     }
     if ($invite_uid > 0) {
         $where_list['invite_uid'] = "`invite_uid`='{$invite_uid}'";
     }
     $role_id = get_param('role_id');
     $role_ids = get_param('role_ids');
     if (is_array($role_id) and count($role_id)) {
         if ($role_id[0] != 'all') {
             $where_list['role_id'] = " `role_id` IN (" . jimplode($role_id) . ") ";
             $_GET['role_ids'] = implode(",", $role_id);
         } else {
             unset($where_list['role_id']);
         }
     } elseif (is_string($role_ids) and $role_ids) {
         $where_list['role_id'] = " m.role_id in({$role_ids})";
     }
     $order_arr = array();
     $lower = get_param('lower');
     if (is_array($lower)) {
         foreach ($lower as $field => $val) {
             if ($val != '') {
                 $where_list[$field . '_lower'] = " m.{$field}<=" . (int) $val;
                 $list["l[{$field}]"] = $val;
                 $order_arr[$field] = ' m.' . $field . ' desc ';
             }
         }
     }
     $higher = get_param('higher');
     if (is_array($higher)) {
         foreach ($higher as $field => $val) {
             if ($val != '') {
                 $where_list[$field . '_higher'] = " m.{$field}>=" . (int) $val;
                 $list["h[{$field}]"] = $val;
                 $order_arr[$field] = ' m.' . $field . ' desc ';
             }
         }
     }
     $earned = get_param('earned');
     if ($earned) {
         $medal_arr[$earned] = " selected ";
         $medal_where = " LEFT JOIN " . TABLE_PREFIX . "user_medal um ON um.uid = m.uid and um.medalid = '{$earned}' ";
         $select_sql = " ,um.dateline  ";
         $where_list['earned'] = " um.`dateline` IS NULL ";
     }
     $sql = "\r\n\t\t SELECT\r\n\t\t\t id,name,`type`\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";
     $query = $this->DatabaseHandler->Query($sql);
     while (false != ($row = $query->GetRow())) {
         $role_list[$row['id']] = $row;
     }
     $where = empty($where_list) ? null : ' WHERE ' . implode(' AND ', $where_list) . ' ';
     if ($where && $cp_user_ids) {
         $where .= ' OR uid IN(' . jimplode($cp_user_ids) . ') ';
     }
     $order_by_list = array('order_by_default' => 'uid', 'uid' => array('name' => '最新注册', 'order_by' => 'm.`uid`'), 'lastactivity' => array('name' => '最近活跃', 'order_by' => 'm.`lastactivity`'), 'credits' => array('name' => '最多积分', 'order_by' => 'm.`credits`'));
     $query_link = 'admin.php?' . ((is_array($_POST) and count($_POST)) ? http_build_query(array_merge($_GET, $_POST)) : $_SERVER['QUERY_STRING']);
     $order_arr = order($order_by_list, $query_link);
     $order_html = $order_arr['html'];
     $query_link = $order_arr['query_link'];
     $order = $order_arr['order'];
     $sql = "\r\n\t\t  SELECT\r\n\t\t\t count(1) total\r\n\t\t  FROM\r\n\t\t\t  " . TABLE_PREFIX . 'members' . " m\r\n\t\t\t  {$medal_where}\r\n\t\t\t  {$where}";
     $total = DB::result_first($sql);
     $page_num = 20;
     $pages = page($total, $page_num, $query_link, array('return' => 'array'));
     $limit = $pages['limit'];
     $sql = "\r\n\t\t  SELECT\r\n\t\t\t  m.* {$select_sql}\r\n\t\t  FROM\r\n\r\n\t\t\t  " . TABLE_PREFIX . 'members' . " m\r\n\t\t\t  {$medal_where}\r\n\t\t\t  {$where}\r\n\t\t\t  {$order}\r\n\t\t\t  {$limit}";
     $query = $this->DatabaseHandler->Query($sql);
     $uids = array();
     $invite_uids = array();
     while (false != ($row = $query->GetRow())) {
         $uids[$row['uid']] = $row['uid'];
         if ($row['invite_uid'] > 0) {
             $invite_uids[$row['invite_uid']] = $row['invite_uid'];
         }
         if ($this->Config['credits']['ext']) {
             $credit_list = array();
             $row['totle_credit'] = 0;
             foreach ($this->Config['credits']['ext'] as $key => $val) {
                 $credit_list[] = array('credit' => $row[$key], 'name' => "{$val['name']}");
                 $row['totle_credit'] = $row['totle_credit'] + $row[$key];
             }
             $row['credit'] = $credit_list;
         }
         $role = $role_list[$row['role_id']];
         if ($role != false) {
             if ($role['is_system'] == 1) {
                 $row['role_name'] = "<B>{$role['name']}</B>";
             } else {
                 $row['role_name'] = $role['name'];
             }
         }
         $member_list[$row['uid']] = $row;
     }
     $sql = "\r\n\t\t  SELECT\r\n\t\t\t `uid`,`validate_remark`\r\n\t\t  FROM\r\n\t\t\t  " . TABLE_PREFIX . 'memberfields' . "\r\n\t\t  WHERE\r\n\t\t\t  `uid` in ('" . implode("','", $uids) . "') ";
     $query = $this->DatabaseHandler->Query($sql);
     $memberfields = array();
     while (false != ($row = $query->GetRow())) {
         $member_list[$row['uid']]['validate_remark'] = $row['validate_remark'];
         $memberfields[$row['uid']] = $row;
     }
     if (@is_file(ROOT_PATH . 'include/logic/cp.logic.php') && $this->Config['company_enable']) {
         $companyselect = $this->CpLogic->get_cp_html($companyid);
         if ($this->Config['department_enable']) {
             $departmentselect = $this->CpLogic->get_cp_html($departmentid, 'department', $companyid);
         }
         $jobselect = jlogic('job')->get_job_select($jobid);
     }
     if ($invite_uids && is_array($invite_uids)) {
         $sql = "select `uid`, `nickname`, `username` from `" . TABLE_PREFIX . "members` where `uid` in (" . jimplode($invite_uids) . ") limit " . count($invite_uids);
         $query = $this->DatabaseHandler->Query($sql);
         $invite_members = array();
         while (false != ($row = $query->GetRow())) {
             $invite_members[$row['uid']] = $row;
         }
     }
     $action = 'admin.php?mod=member&code=doact';
     include template('admin/member_search_list');
 }
 public function search($keyword = '')
 {
     $rets = array();
     $keyword = jfilter($keyword, 'txt');
     $search = jconf::get('profilesearch');
     if ($keyword && $search) {
         $sql_where = build_like_query("`" . implode("`, `", array_keys($search)) . "`", $keyword);
         if ($sql_where) {
             $sql_where .= " AND `last_update`>'" . (strtotime(date('Y-m-d')) - 86400000) . "' ";
             $p = array('cache_time' => 300, 'result_count' => 300, 'sql_where' => $sql_where, 'sql_order' => ' `last_update` DESC, `uid` DESC ');
             $rets = jtable('members_profile')->get_ids($p, 'uid');
         }
     }
     return $rets;
 }
Example #14
0
 function Tag()
 {
     $limit = intval($this->Get['limit']);
     $tag = trim($this->Get['q']);
     if (empty($tag)) {
         exit;
     }
     if (empty($limit)) {
         $limit = 10;
     }
     $order_sql = " ORDER BY total_count DESC ";
     $tag = get_safe_code($tag);
     if ($tag) {
         $where_sql = " " . build_like_query("name", $tag) . " ";
         $query = DB::query("SELECT id,name\r\n\t\t\t\t\t\t\t\tFROM " . DB::table('tag') . "\r\n\t\t\t\t\t\t\t\tWHERE {$where_sql}\r\n\t\t\t\t\t\t\t\t{$order_sql}\r\n\t\t\t\t\t\t\t\tLIMIT {$limit} ");
         while ($value = DB::fetch($query)) {
             echo $value['id'] . '|' . $value['name'] . "\n";
         }
     }
     exit;
 }
    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;
    }
Example #16
0
 function Main()
 {
     $per_page_num = min(500, max(20, (int) (isset($_GET['pn']) ? $_GET['pn'] : $_GET['per_page_num'])));
     if ($_GET['pn']) {
         $pn = '&pn=' . $_GET['pn'];
     }
     $where_list = array();
     $query_link = 'admin.php?mod=topic' . $pn . '&code=' . $this->Code . '&per_page_num=' . $per_page_num;
     $type = $this->Get['type'];
     if ($type == 'first') {
         $type_arr['first'] = " selected ";
         $where_list['type'] = "`type` = '{$type}'";
         $query_link .= "&type={$type}";
     } elseif ($type == 'forward') {
         $type_arr['forward'] = " selected ";
         $where_list['type'] = "`type` in ('forward','both')";
         $query_link .= "&type={$type}";
     } elseif ($type == 'reply') {
         $type_arr['reply'] = " selected ";
         $where_list['type'] = "`type` in ('reply','both')";
         $query_link .= "&type={$type}";
     }
     $config['channel'] = jconf::get('channel');
     if ($config['channel']) {
         $channels = $channel_one = is_array($config['channel']['first']) ? $config['channel']['first'] : array();
         $channel_two = is_array($config['channel']['second']) ? $config['channel']['second'] : array();
         $channel_channels = is_array($config['channel']['channels']) ? $config['channel']['channels'] : array();
         foreach ($channel_two as $k => $v) {
             $channels[$v['parent_id']]['child'][$k] = $v;
         }
         $channel = $this->Get['channel'];
         if ($channel == 'all') {
             $sel_str = ' selected';
         } else {
             $sel_str = '';
         }
         $channel_html = '频道:<select name="channel"><option value="">请选择...</option><option value="all"' . $sel_str . '>所有频道</option>';
         foreach ($channels as $val) {
             if ($channel == $val['ch_id']) {
                 $sel_str = ' selected';
             } else {
                 $sel_str = '';
             }
             $channel_html .= '<option value="' . $val['ch_id'] . '"' . $sel_str . '>' . $val['ch_name'] . '</option>';
             if ($val['child']) {
                 foreach ($val['child'] as $v) {
                     if ($channel == $v['ch_id']) {
                         $sel_str = ' selected';
                     } else {
                         $sel_str = '';
                     }
                     $channel_html .= '<option value="' . $v['ch_id'] . '"' . $sel_str . '>|-' . $v['ch_name'] . '</option>';
                 }
             }
         }
         $channel_html .= '</select>';
         if (strlen($channel) > 0) {
             if ($channel == 'all') {
                 $where_list['channel'] = "item = 'channel' AND item_id > 0";
                 $query_link .= "&channel=all";
             } else {
                 $channel = (int) $channel;
                 $where_list['channel'] = "item = 'channel' AND item_id IN(" . jimplode($channel_channels[$channel]) . ")";
                 $query_link .= "&channel=" . $channel;
             }
         }
         unset($channel_one);
         unset($channel_two);
         unset($channel_channels);
     }
     $postip = $this->Get['postip'];
     if ($postip) {
         $where_list['postip'] = " `postip` = '{$postip}' ";
         $where_list['lastupdatef'] = " `lastupdate` > '" . strtotime(date('Y-m-d', time())) . "' ";
         $where_list['lastupdatet'] = " `lastupdate` < '" . strtotime(date('Y-m-d', strtotime('+1 day'))) . "' ";
         $where_list['managetype'] = " managetype = 0";
         $query_link .= "&postip={$postip}";
     }
     $tids = array();
     $tid = trim($this->Get['tid']);
     if ($tid) {
         $_tids = explode(" ", str_replace(array(",", "|"), " ", $tid));
         foreach ($_tids as $_tid) {
             $_tid = jfilter($_tid, 'int');
             if ($_tid > 0) {
                 $tids[$_tid] = $_tid;
             }
         }
         $total_record = count($tids);
         $query_link .= "&tid={$tid}";
     }
     $uid = 0;
     $username = jget('username', 'txt');
     if ($username) {
         $uid = jsg_member_uid($username);
         $query_link .= "&username={$username}";
     } else {
         $uid = jget('uid', 'int');
     }
     if ($uid > 0) {
         $where_list['uid'] = "`uid`='{$uid}'";
         $query_link .= "&uid={$uid}";
         $p = array('type' => 'all', 'perpage' => $per_page_num, 'page_url' => $query_link);
         $_rets = jtable('member_topic')->get_tids($uid, $p, 1);
         $tids = $_rets['ids'];
         if (!in_array($this->Code, array('verify', 'del'))) {
             $total_record = $_rets['count'];
             $page_arr = $_rets['page'];
         }
     }
     if ($tids) {
         $where_list['tid'] = "`tid` in (" . jimplode($tids) . ")";
     }
     $keyword = trim($this->Get['keyword']);
     if ($keyword) {
         $_GET['highlight'] = $keyword;
         $where_list['keyword'] = build_like_query('content,content2', $keyword);
         $query_link .= "&keyword=" . urlencode($keyword);
     }
     $nickname = trim($this->Get['nickname']);
     if ($nickname) {
         $sql = "select `uid`,`nickname` from `" . TABLE_PREFIX . "members` where `nickname`='{$nickname}' limit 0,1";
         $query = $this->DatabaseHandler->Query($sql);
         $members = $query->GetRow();
         $where_list['uid'] = "`uid`='{$members['uid']}'";
         $query_link .= "&nickname=" . urlencode($members['nickname']);
     }
     $timefrom = $this->Get['timefrom'];
     if ($timefrom) {
         $str_time_from = strtotime($timefrom);
         $where_list['timefrom'] = "`lastupdate`>'{$str_time_from}'";
         $query_link .= "&timefrom=" . $timefrom;
     }
     $timeto = $this->Get['timeto'];
     if ($timeto) {
         $str_time_to = strtotime($timeto);
         $where_list['timeto'] = "`lastupdate`<'{$str_time_to}'";
         $query_link .= "&timeto=" . $timeto;
     }
     $mtype = $this->Get['mtype'];
     if ($mtype != '') {
         if ($mtype == 1) {
             $where_list['managetype'] = " managetype != 0";
         } else {
             $where_list['managetype'] = " managetype = '{$mtype}'";
         }
         $mtype_arr[$mtype] = " selected ";
         $query_link .= "&mtype={$mtype}";
     }
     $where = empty($where_list) ? null : ' WHERE ' . implode(' AND ', $where_list) . ' ';
     if ($this->Code == 'verify' || $this->Code == 'del') {
         $template = 'topic_verify';
         $verify = 1;
         $del = (int) $this->Get['del'];
         if ($del) {
             $where = $where ? $where . " and managetype = 1 " : " where managetype = 1 ";
             $query_link .= "&del=1";
         } else {
             $where = $where ? $where . " and managetype = 0 " : " where managetype = 0 ";
         }
         $sql = " select count(*) as `total_record` from `" . TABLE_PREFIX . "topic_verify` {$where} ";
     } else {
         $template = 'topic';
         $this->Code = 'topic_manage';
         $sql = " select count(*) as `total_record` from `" . TABLE_PREFIX . "topic` {$where} ";
     }
     if (!$total_record) {
         $total_record = DB::result_first($sql);
     }
     if (!$page_arr) {
         $page_arr = page($total_record, $per_page_num, $query_link, array('return' => 'array'), '20 50 100 200 500');
     }
     $topic_list = array();
     if ($this->Code == 'verify' || $this->Code == 'del') {
         $topic_list = $this->TopicLogic->Get(" {$where} order by `dateline` desc {$page_arr['limit']} ", '*', 'Make', TABLE_PREFIX . 'topic_verify', 'id');
         $action = "admin.php?mod=topic&code=doverify";
         if ($topic_list) {
             foreach ($topic_list as $key => $val) {
                 if ($val['type'] == 'forward' && $val['roottid'] > 0) {
                     $topic_list[$key]['root_topic'] = $this->TopicLogic->Get($val['roottid']);
                 }
                 if ($val['longtextid'] > 0) {
                     $topic_list[$key]['content'] = jlogic('longtext')->longtext($val['longtextid'], $val['tid']);
                 }
             }
         }
     } else {
         if ($tids) {
             $topic_list = $this->TopicLogic->Get($tids);
         } else {
             $topic_list = $this->TopicLogic->Get(" {$where} order by `dateline` desc {$page_arr['limit']} ");
         }
         $action = "admin.php?mod=topic&code=domanage";
         if ($topic_list) {
             foreach ($topic_list as $key => $val) {
                 if ($val['managetype'] == 0 || $val['managetype'] == 1) {
                     $topic_list[$key]['manage_type'][1] = " checked ";
                 } else {
                     $topic_list[$key]['manage_type'][$val['managetype']] = " checked ";
                 }
                 if ($val['type'] == 'forward' && $val['roottid']) {
                     $topic_list[$key]['root_topic'] = $this->TopicLogic->Get($val['roottid']);
                 }
                 if ($val['longtextid'] > 0) {
                     $topic_list[$key]['content'] = jtable('topic_more')->longtext($val['tid']);
                 }
             }
         }
     }
     include template('admin/' . $template);
 }