Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 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;
 }
Ejemplo n.º 3
0
 function DoLogin()
 {
     $this->Username = wap_iconv($this->Username, 'utf-8', $this->Config['charset'], 1);
     $this->Password = wap_iconv($this->Password, 'utf-8', $this->Config['charset'], 1);
     if ($this->Username == "" || $this->Password == "") {
         $this->Messager("无法登录,用户名或密码不能为空", 'index.php?mod=login');
     }
     $username = $this->Username;
     $password = $this->Password;
     if ($this->Config['reg_email_verify'] == '1') {
         $member_info = DB::fetch_first("select `uid`,`username` from " . DB::table('members') . " where `username`='{$username}' limit 0,1");
         if ($member_info) {
             $member_validate = DB::fetch_first("select `uid`,`status` from " . DB::table('member_validate') . " where `uid`='{$member_info['uid']}' ");
         }
         if ($member_validate) {
             if ($member_validate['status'] != '1') {
                 $this->Messager("必须完成邮件激活,才能正常访问!进入注册时填写的邮箱激活即可。", 'index.php?mod=login');
             }
         }
     }
     $referer = jget('referer');
     if (!$referer) {
         $referer = jsg_getcookie('referer');
     }
     $rets = jsg_member_login($username, $password);
     if ($rets['uid'] < 1) {
         $this->Messager(wap_iconv($rets['error']), null);
     }
     $uid = $rets['uid'];
     if ($this->Config['extcredits_enable'] && $rets['uid'] > 0) {
         update_credits_by_action('login', $rets['uid']);
     }
     $redirecto = $referer ? $referer : referer('index.php');
     if (strpos($redirecto, 'login') !== false) {
         $redirecto = "index.php?mod=topic&code=myhome";
     }
     if ($this->Post['loginType'] == 'share') {
         $redirecto = $this->Post['return_url'];
     }
     $this->Messager('登录成功', $redirecto, 0);
 }
Ejemplo n.º 4
0
 function View()
 {
     $uid = MEMBER_ID;
     $member = $this->_topicLogicGetMember($uid);
     $params = array();
     $tag = get_safe_code($this->Code);
     if (!$tag) {
         $this->Messager("请输入正确的链接地址", null);
     }
     $f_rets = filter($tag, 0, 0);
     if ($f_rets && $f_rets['error']) {
         $this->Messager("输入的话题  " . $f_rets['msg'], null);
     }
     $sql = "select * from `" . TABLE_PREFIX . "tag` where `name`='" . addslashes($tag) . "'";
     $query = $this->DatabaseHandler->Query($sql);
     $tag_info = $query->GetRow();
     $tag_id = $tag_info['id'];
     $total_record = $tag_info['topic_count'];
     $this->TopicLogic = jlogic('topic');
     if ($total_record > 0) {
         $params['tag_id'] = $tag_id;
         $query_link = "index.php?mod=" . ($_GET['mod_original'] ? get_safe_code($_GET['mod_original']) : $this->Module) . ($tag ? "&amp;code=" . urlencode($tag) : "");
         $per_page_num = 10;
         $page_arr = wap_page($total_record, $per_page_num, $query_link, array('return' => "Array"));
         $sql = "select `item_id` from `" . TABLE_PREFIX . "topic_tag` where `tag_id`='{$tag_id}' order by `item_id` desc {$page_arr['limit']}";
         $query = $this->DatabaseHandler->Query($sql);
         $topic_ids = array();
         while (false != ($row = $query->GetRow())) {
             $topic_ids[$row['item_id']] = $row['item_id'];
         }
         Load::logic("topic_list");
         $TopicListLogic = new TopicListLogic();
         $options = array('limit' => $per_page_num, 'order' => " dateline DESC ", 'type' => get_topic_type(), 'tid' => $topic_ids);
         $info = $TopicListLogic->get_data($options, 'wap');
         $topic_list = array();
         if (!empty($info)) {
             $topic_list = wap_iconv($info['list']);
         }
         $topic_list_count = 0;
         if ($topic_list) {
             $parent_id_list = array();
             foreach ($topic_list as $row) {
                 if (0 < ($p = (int) $row['parent_id'])) {
                     $parent_id_list[$p] = $p;
                 }
                 if (0 < ($p = (int) $row['top_parent_id'])) {
                     $parent_id_list[$p] = $p;
                 }
                 unset($topic_ids[$row['tid']]);
                 $topic_list_count++;
             }
             if ($topic_ids) {
                 $topic_ids_count = count($topic_ids);
                 $total_record = $total_record - $topic_ids_count;
                 $sql = "delete from `" . TABLE_PREFIX . "topic_tag` where `item_id` in('" . implode("','", $topic_ids) . "')";
                 $this->DatabaseHandler->Query($sql);
                 $sql = "update `" . TABLE_PREFIX . "tag` set `topic_count`=`topic_count`-{$topic_ids_count} where `id`='{$tag_info['id']}'";
                 if ($total_record >= 0 && $tag_info) {
                     $this->DatabaseHandler->Query($sql);
                 }
             }
             if ($parent_id_list) {
                 $parent_list = $this->_topicLogicGet($parent_id_list);
             }
         }
     }
     $show_config = jconf::get('show');
     $is_favorite = false;
     if ($tag_info) {
         if (MEMBER_ID > 0) {
             $is_favorite = jlogic('tag_favorite')->info($tag, MEMBER_ID);
         }
         $tag_favorite_list = jlogic('tag_favorite')->favorite_users($tag, 12, '`uid`, `username`, `nickname`, `face_url`, `face`, `ucuid`');
     }
     $tag = wap_iconv($tag);
     $tag_value = '#' . $tag . '#';
     $topic_count = $tag_info['topic_count'];
     $this->Title = $tag;
     include template('tag_list_topic_box');
 }
Ejemplo n.º 5
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;
 }
Ejemplo n.º 6
0
 function DoModify()
 {
     if (MEMBER_ID < 1) {
         $this->Messager('请先登录,游客不能执行此操作');
     }
     $tid = jget('tid', 'int');
     if ($tid < 1) {
         $this->Messager('请指定要编辑的微博');
     }
     $topic_info = jlogic('topic')->Get($tid);
     if (!$topic_info) {
         $this->Messager('您要编辑的微博已经不存在了');
     }
     if (jdisallow($topic_info['uid'])) {
         $this->Messager('您没有权限编辑该微博');
     }
     if ($this->Get['tid'] > 0) {
         $action = 'index.php?mod=topic&amp;code=modify';
         $topiclist = $this->_topicLogicGet($tid);
         if ($topiclist == false) {
             $this->Messager("您要编辑的微博信息已经不存在!", 'index.php?mod=topic&code=myhome');
         }
         $row = DB::fetch_first("select * from " . TABLE_PREFIX . "topic where `tid`='{$tid}'");
         $topiclist['content'] = $row['content'] . $row['content2'];
         $topiclist['content'] = preg_replace('~<U ([0-9a-zA-Z]+)>(.+?)</U>~', '', $topiclist['content']);
         $topiclist['content'] = strip_tags($topiclist['content']);
         if ('both' == $topiclist['type'] || 'forward' == $topiclist['type']) {
             $topiclist['content'] = $this->TopicLogic->GetForwardContent($topiclist['content']);
         }
         $topiclist['content'] = wap_iconv($topiclist['content']);
         $this->Title = cut_str(strip_tags($topiclist['content']), 50) . " ";
         $return_messager = $this->Get['return'];
         include template('topic_modify');
     } else {
         $tid = (int) $this->Post['tid'];
         $imageid = (int) $this->Post['imageid'];
         $attachid = (int) $this->Post['attachid'];
         $content = strip_tags($this->Post['content']);
         $sql = "select * from `" . TABLE_PREFIX . "topic` where `tid`='{$tid}'";
         $query = $this->DatabaseHandler->Query($sql);
         $topiclist = $query->GetRow();
         $content = wap_iconv($content, 'utf-8', $this->Config['charset'], 1);
         if (empty($content)) {
             $return_messager = "modify_content_null";
             $this->Messager(NULL, 'index.php?mod=topic&code=modify&tid=' . $tid . '&return=' . $return_messager);
         }
         $modify_result = $this->TopicLogic->Modify($tid, $content, $imageid, $attachid);
         if (is_array($modify_result)) {
             $this->Messager('编辑成功', 'index.php?mod=topic&code=modify&tid=' . $tid);
         } else {
             $this->Messager("编辑失败", 'index.php?mod=topic&code=modify&tid=' . $tid);
         }
     }
 }
Ejemplo n.º 7
0
 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;
 }
Ejemplo n.º 8
0
/**
 * [JishiGou] (C)2005 - 2099 Cenwor Inc.
 *
 * This is NOT a freeware, use is subject to license terms
 *
 * @Filename wap_global.func.php $
 *
 * @Author http://www.jishigou.net $
 *
 * @Date 2014-01-03 17:38:36 2110477426 1492392824 6427 $
 */
function wap_page($total_record, $per_page_num, $url = '', $_config = array(), $per_page_nums = "")
{
    $SystemConfig = jconf::get();
    $result = array();
    $url = wap_iconv($url);
    $total_record = intval($total_record);
    $per_page_num = intval($per_page_num);
    if ($per_page_num < 1) {
        $per_page_num = 10;
    }
    $config['total_page'] = max(0, (int) (isset($_config['total_page']) ? $_config['total_page'] : $SystemConfig['total_page_default']));
    $config['page_display'] = isset($_config['page_display']) ? (int) $_config['page_display'] : 3;
    $config['char'] = isset($_config['char']) ? (string) $_config['char'] : ' ';
    $config['url_postfix'] = isset($_config['url_postfix']) ? (string) $_config['url_postfix'] : '';
    $config['extra'] = isset($_config['extra']) ? (string) $_config['extra'] : '';
    $config['idencode'] = (bool) $_config['idencode'];
    $config['var'] = isset($_config['var']) ? (string) $_config['var'] : 'page';
    $config['return'] = isset($_config['return']) ? (string) $_config['return'] : 'html';
    extract($config);
    $total_page = ceil($total_record / $per_page_num);
    if ($config['total_page'] > 1 && $total_page > $config['total_page']) {
        $total_page = $config['total_page'];
    }
    $result['total_page'] = $total_page;
    $current_page = $_GET[$var] ? $_GET[$var] : $_POST[$var];
    $current_page = max(1, (int) (true == $idencode ? iddecode($current_page) : $current_page));
    $current_page = $total_page > 0 && $current_page > $total_page ? $total_page : $current_page;
    $result['current_page'] = $current_page;
    $result['title_postfix'] = $current_page > 1 ? "_第{$current_page}页" : "";
    $result['offset'] = (int) (($current_page - 1) * $per_page_num);
    $result['limit'] = " LIMIT " . $result['offset'] . ",{$per_page_num} ";
    if (isset($result[$return])) {
        return $result[$return];
    }
    if ('' == $url) {
        $request = count($_POST) ? array_merge($_GET, $_POST) : $_GET;
        $query_string = '';
        foreach ($request as $_var => $_val) {
            if (is_string($_val) && $var !== $_var) {
                $query_string .= "&{$_var}=" . urlencode($_val);
            }
        }
        $url = '?' . ($result['query_string'] = trim($query_string, '&'));
    }
    $p_val = "V01001page10010V";
    if ('/#' != $url) {
        $url = '' == $url ? "?{$var}={$p_val}" : ($url_no_page = false !== strpos($url, "&{$var}=") ? preg_replace("/\\&?{$var}\\=[^\\&]*/i", '', $url) : $url) . "&amp;{$var}={$p_val}";
        if ($jishigou_rewrite) {
            $url_no_page = $jishigou_rewrite->formatURL($url_no_page, false);
            $url = $jishigou_rewrite->formatURL($url, false);
        }
    } else {
        $url_no_page = $url;
    }
    $result['url'] = $url;
    if (isset($result[$return])) {
        return $result[$return];
    }
    $html = '';
    if ($total_record > $per_page_num) {
        $halfper = (int) ($config['page_display'] / 2);
        $html = $current_page - 1 >= 1 ? "\n<a href='{$url_no_page}{$url_postfix}'  {$extra}>首页</a>{$char}\n<a href='" . (1 == ($previous_page = $current_page - 1) ? $url_no_page : str_replace($p_val, true === $idencode ? idencode($previous_page) : $previous_page, $url)) . "{$url_postfix}' {$extra}>上一页</a>{$char}" : "首页{$char}上一页{$char}";
        for ($i = $current_page - $halfper, $i > 0 or $i = 1, $j = $current_page + $halfper, $j < $total_page or $j = $total_page; $i <= $j; $i++) {
            $html .= $i == $current_page ? "\n<B>" . $i . "</B>{$char}" : "\n<a href='" . (1 == $i ? $url_no_page : str_replace($p_val, true === $idencode ? idencode($i) : $i, $url)) . "{$url_postfix}'  {$extra}>" . $i . "</a>{$char}";
        }
        $html .= ($next_page = $current_page + 1) > $total_page ? "下一页{$char}尾页" : "\n<a href='" . str_replace($p_val, true === $idencode ? idencode($next_page) : $next_page, $url) . "{$url_postfix}'  {$extra}>下一页</a>{$char}\n<a href='" . str_replace($p_val, true === $idencode ? idencode($total_page) : $total_page, $url) . "{$url_postfix}'  {$extra}>尾页</a>";
        if (!empty($per_page_nums)) {
            $per_page_num_list = is_array($per_page_nums) ? $per_page_nums : explode(" ", $per_page_nums);
            $current_url = str_replace($p_val, true === $idencode ? idencode($current_page) : $current_page, $url) . $url_postfix;
            $pn_postfix = $jishigou_rewrite ? $jishigou_rewrite->argSeparator . "pn" . $jishigou_rewrite->varSeparator : "&pn=";
            $per_page_num_select = "<select name='per_page_num' onchange=\"window.location='{$current_url}{$pn_postfix}'+this.value\">";
            foreach ($per_page_num_list as $_per_page_num) {
                $selected = $_per_page_num == $per_page_num ? "selected" : "";
                $per_page_num_select .= "<option value={$_per_page_num} {$selected}>{$_per_page_num}";
            }
            $per_page_num_select .= "</select>";
        } else {
            $per_page_num_select = "<B>{$per_page_num}</B>";
        }
        $html = "<div id='page'>{$html}</div>";
    }
    $result['html'] = $html;
    if (isset($result[$return])) {
        return $result[$return];
    }
    return $result;
}
Ejemplo n.º 9
0
 function _TopicListLogic($param = '')
 {
     $data = $this->TopicListLogic->get_recd_list($param);
     if ($data) {
         $data = wap_iconv($data);
     }
     return $data;
 }
Ejemplo n.º 10
0
 function DoModifyProfile()
 {
     if (MEMBER_ID < 1) {
         $this->Messager("请先<a href='index.php?mod=login'>点此登录</a>或者<a href='index.php?mod=member'>点此注册</a>一个帐号", 'index.php?mod=login');
     }
     foreach ($this->Post as $key => $val) {
         $key = strip_tags($key);
         $val = strip_tags($val);
         $this->Post[$key] = $val;
     }
     $member = $this->Member;
     $member = wap_iconv($member);
     $nickname = trim($this->Post['nickname']);
     $gender = in_array($gender = (int) $this->Post['gender'], array(1, 2)) ? $gender : 0;
     $aboutme = strlen($aboutme = trim(strip_tags($this->Post['aboutme']))) > 255 ? cutstr($aboutme, 254) . '' : $aboutme;
     $signature = strlen($signature = trim(strip_tags($this->Post['signature']))) > 48 ? cutstr($signature, 48) . '' : $signature;
     if ($filter_msg = filter($aboutme)) {
         $this->Messager($filter_msg, 'index.php?mod=settings');
     }
     if ($filter_msg = filter($signature)) {
         $this->Messager($filter_msg, 'index.php?mod=settings');
     }
     if ($filter_msg = filter($nickname)) {
         $this->Messager($filter_msg, 'index.php?mod=settings');
     }
     $sql = "select `uid`,`nickname`,`validate` from `" . TABLE_PREFIX . "members` where `nickname`='{$nickname}'";
     $query = $this->DatabaseHandler->Query($sql);
     $nickname_exists = $query->GetRow();
     if ($nickname_exists && $nickname_exists['uid'] != MEMBER_ID) {
         $this->Messager("姓名/昵称(<b>{$nickname}</b>)已经存在,请选择其它姓名/昵称", 'index.php?mod=settings&code=nick');
     }
     $arr = array('gender' => $gender ? $gender : $member['gender'], 'nickname' => $nickname ? $nickname : $member['nickname'], 'aboutme' => $aboutme ? addslashes($aboutme) : $member['aboutme'], 'signature' => $signature ? addslashes($signature) : $member['signature']);
     $arr = wap_iconv($arr, 'utf-8', $this->Config['charset'], 1);
     $this->_update($arr);
     $arr1 = array();
     $sql = "select * from `" . TABLE_PREFIX . "memberfields` where `uid`='" . MEMBER_ID . "'";
     $query = $this->DatabaseHandler->Query($sql);
     $memberfields = $query->GetRow();
     if (!$memberfields['validate_true_name'] && $this->Post['validate_true_name']) {
         $arr1['validate_true_name'] = $this->Post['validate_true_name'];
     }
     if (!$memberfields['validate_card_type'] && $this->Post['validate_card_type']) {
         $arr1['validate_card_type'] = $this->Post['validate_card_type'];
     }
     if (!$memberfields['validate_card_id'] && $this->Post['validate_card_id']) {
         $arr1['validate_card_id'] = $this->Post['validate_card_id'];
     }
     if ($arr1) {
         $sets = array();
         if (is_array($arr1)) {
             foreach ($arr1 as $key => $val) {
                 $val = addslashes($val);
                 $sets[$key] = "`{$key}`='{$val}'";
             }
         }
         $sql = "update `" . TABLE_PREFIX . "memberfields` set " . implode(" , ", $sets) . " where `uid`='" . MEMBER_ID . "'";
         $this->DatabaseHandler->Query($sql);
     }
     $this->Messager("修改成功", 'index.php?mod=settings&code=base&uid=' . $member['uid']);
 }
Ejemplo n.º 11
0
    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;
    }
Ejemplo n.º 12
0
 function DoSend()
 {
     if (MEMBER_ID < 1) {
         $this->Messager("请先<a href='index.php?mod=login'>点此登录</a>或者<a href='index.php?mod=member'>点此注册</a>一个帐号", 'index.php?mod=login');
     }
     if ($this->MemberHandler->HasPermission($this->Module, $this->Code) == false) {
         $this->Messager($this->MemberHandler->GetError(), null);
     }
     $this->Post['message'] = jpost('message', 'txt');
     $pm_message = array("to_user" => wap_iconv($this->Post['to_user'], 'utf-8', $this->Config['charset'], 1), "message" => wap_iconv($this->Post['message'], 'utf-8', $this->Config['charset'], 1));
     $uid = (int) $this->Post['uid'];
     load::logic('pm');
     $PmLogic = new PmLogic();
     $return = $PmLogic->pmSend($pm_message);
     switch ($return) {
         case '1':
             $this->Messager("内容不能为空");
             break;
         case '2':
             $this->Messager("收件人不能为空");
             break;
         case '3':
             $this->Messager("收件人不存在");
             break;
         case '4':
             $this->Messager("消息已经保存草稿箱", "index.php?mod=pm&code=list&folder=outbox");
             break;
         case '5':
             $this->Messager("信息不存在或已删除");
         case '6':
             $this->Messager("所在用户组没有发私信的权限");
         default:
             if ($return && is_string($return)) {
                 $return = wap_iconv($return);
                 $this->Messager($return);
             }
             break;
     }
     if ($uid > 0) {
         $this->Messager("消息已发送成功", "index.php?mod=pm&code=view&uid={$uid}");
     } else {
         $this->Messager("消息已发送成功", "index.php?mod=pm");
     }
 }