function get_my_group($uid, $limit = 0) { $list = array(); $uid = jfilter($uid, 'int'); if ($uid > 0 && jallow($uid)) { if ($limit < 1) { $cache_key = $this->table . '-get_my_group-' . $uid; $cache_time = 300; if (false !== ($list = cache_db('mget', $cache_key))) { return $list; } } $limit = jfilter($limit, 'int'); $p = array('uid' => $uid, 'sql_order' => '`count` DESC, `order` ASC, `id` ASC', 'result_count' => $limit > 0 ? $limit : 999); $rets = $this->db->get($p); $list = array(); if ($rets['list']) { foreach ($rets['list'] as $row) { $list[$row['id']] = $row; } } if ($cache_time > 0) { cache_db('mset', $cache_key, $list, $cache_time); } } return $list; }
function DoClean() { $type = get_param('type'); if (!$type) { $this->Messager("请先选择要清理的缓存对象"); } $this->_removeTopicAttach(); $this->_removeTopicLongtext(); $this->_removeVoteImage(); if (in_array('data', $type)) { cache_db('clear'); jtable('failedlogins')->truncate(); DB::query("update " . TABLE_PREFIX . "members set `username`=`uid` WHERE `username`!=`uid` AND `username` REGEXP '^[0-9]*\$'"); } if (in_array('tpl', $type)) { cache_clear(); jconf::set('validate_category', array()); jlogic('credits')->rule_conf(true); } if (in_array('channel', $type)) { jlogic('channel')->update_data(); } if (in_array('album', $type)) { jlogic('image')->update_data(); } $this->Messager("已清空所有缓存"); }
function ShowReminded() { if ((int) $this->Config['ajax_topic_time'] < 1) { exit; } $uid = max(0, (int) $this->Post['uid']); if ($uid < 1) { exit; } $fcode = jpost('fcode'); $all_topic_notice = 'topicnew' == $fcode; $__my = jsg_member_info($uid); if (!$__my) { exit; } $time = TIMESTAMP; $is_uptime = $this->Post['is_uptime']; if ($is_uptime == 1) { DB::query("update `" . TABLE_PREFIX . "members` set `lastactivity`='{$time}' where `uid`='{$uid}'"); cache_db('rm', "{$uid}-topic-%", 1); echo '<success></success>'; echo "<script language='Javascript'>"; echo "listTopic(0,0);"; echo "</script>"; exit; } $total_record = jlogic('buddy')->check_new_topic($uid, 0, 0, $all_topic_notice); jsg_setcookie('topnotice', 'block'); include template('ajax_reminded'); }
function check_new_recd_topic($uid = MEMBER_ID, $tid = 0) { $uid = (int) ($uid ? $uid : MEMBER_ID); $tid = $tid ? (int) $tid : 0; if ($uid < 1) { return 0; } $info = jsg_member_info($uid); if (!$info) { return 0; } $t = $info['close_recd_time']; $cache_key = 'check_new_recd_topic-' . $t; if (false === ($row = cache_db('mget', $cache_key))) { $row = DB::fetch_first("select tid from " . TABLE_PREFIX . "topic_recommend where dateline > '{$t}' and recd=4 and (expiration>" . time() . " OR expiration=0) order by `dateline` desc limit 1"); $row = $row ? $row : array(); cache_db('mset', $cache_key, $row, 300); } if ($row && $row['tid'] && $tid != $row['tid']) { return $row['tid']; } else { return 0; } }
function _MemberList($where = '', $query_link = '', $cache_time = 0, $cache_key = '') { $cache_time = max(0, (int) $cache_time); $cache_key = $cache_key ? $cache_key : 'member-search-' . md5($where); if ($cache_time > 0) { if (false === ($rets = cache_db('mget', $cache_key))) { $uids_limit = $this->cache_ids_limit; $rets = array(); $rets['count'] = DB::result_first("SELECT COUNT(1) AS `count` FROM " . DB::table('members') . " {$where} "); $uids = array(); if ($rets['count'] > 0) { $query = DB::query("SELECT `uid` FROM " . DB::table('members') . " {$where} LIMIT {$uids_limit} "); while (false != ($row = DB::fetch($query))) { $uids[$row['uid']] = $row['uid']; } } $rets['uids'] = $uids; cache_db('mset', $cache_key, $rets, $cache_time); } $total_record = $rets['count']; $where = " WHERE `uid` IN ('" . implode("','", $rets['uids']) . "') "; } else { $total_record = DB::result_first("select count(*) as `total_record` from `" . TABLE_PREFIX . "members` {$where}"); } $return = array(); $per_page_num = 10; $order = " ORDER BY `lastactivity` DESC "; $member_list = array(); $member_tag = array(); if ($total_record > 0) { $return['total_record'] = $total_record; $page_arr = page($total_record, $per_page_num, $query_link, array('return' => 'Array')); $return['page_arr'] = $page_arr; $member_list = jlogic('topic')->GetMember(" {$where} {$order} {$page_arr['limit']} ", "`uid`,`ucuid`,`username`,`nickname`,`face_url`,`face`,`fans_count`,`topic_count`,`province`,`city`,`validate`,`validate_category`"); if ($member_list) { $member_list = buddy_follow_html($member_list); $uids = array(); foreach ($member_list as $row) { $uids[$row['uid']] = $row['uid']; } if ($uids) { $query = DB::query("SELECT * FROM " . DB::table('user_tag_fields') . " WHERE `uid` IN ('" . implode("','", $uids) . "') "); while (false != ($row = DB::fetch($query))) { $member_tag[] = $row; } } } } $return['member_list'] = $member_list; $return['member_tag'] = $member_tag; return $return; }
function getMyCommentUser($uid = MEMBER_ID, $limit = 10) { $cache_id = $uid . '-mycommentuser-7days-' . $limit; $time = TIMESTAMP; $time = $time - 7 * 86400; if (false === ($user = cache_db('get', $cache_id))) { $user = array(); $sql = "SELECT\r\n\t\t\t\t\t COUNT(*) AS mc_count,t.touid as uid,m.username,m.nickname\r\n\t\t\t\t\tFROM `" . TABLE_PREFIX . "topic` t\r\n\t\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "members m ON m.uid = t.touid\r\n\t\t\t\t\tWHERE t.`uid` = '{$uid}'\r\n\t\t\t\t\t AND t.`type` IN ('reply','both')\r\n\t\t\t\t\t AND t.dateline > {$time}\r\n\t\t\t\t\tGROUP BY t.`touid`\r\n\t\t\t\t\tORDER BY mc_count DESC\r\n\t\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; } } cache_db('set', $cache_id, $user, 3600); } return $user; }
function Main() { $options = array(); if ('topic' == $this->Get['mod'] && count($this->Get) < 2) { if (MEMBER_ID > 0) { $this->Code = 'myhome'; } else { $this->Hot(); return; } } $title = ''; $per_page_num = 10; $topic_uids = $topic_ids = $order_list = $where_list = $params = array(); $where = $order = $limit = ""; $query_link = "index.php?mod=" . ($_GET['mod_original'] ? get_safe_code($_GET['mod_original']) : $this->Module) . ($this->Code ? "&code={$this->Code}" : ""); $member = $this->_member(); if (!$member) { $this->Hot(); return; } $params['uid'] = $uid = $member['uid']; $is_personal = $uid == MEMBER_ID; $params['is_personal'] = $is_personal; $start = max(0, (int) $start); $limit = "limit {$start},{$per_page_num}"; $next = $start + $per_page_num; $params['code'] = $this->Code; if (!in_array($params['code'], array('myblog', 'myhome', 'recd'))) { $params['code'] = 'myblog'; } if (($show_topic_num = $this->ShowConfig['topic'][$params['code']]) > 0) { $per_page_num = $show_topic_num; } $options['perpage'] = $per_page_num; if ('myhome' == $params['code']) { $topic_selected = 'myhome'; if ($member['uid'] == MEMBER_ID) { $title = '我的首页'; $cache_time = 600; $cache_key = "{$uid}-topic-myhome--0"; $refresh_time = max(30, (int) $this->Config['ajax_topic_time']); if (get_param('page') < 2 && $member['lastactivity'] + $refresh_time < TIMESTAMP) { $new_topic = jlogic('buddy')->check_new_topic($uid, 1); if ($new_topic > 0) { cache_db('rm', "{$uid}-topic-%", 1); } } if (false === cache_db('get', $cache_key)) { $buddyids = get_buddyids($params['uid'], $this->Config['topic_myhome_time_limit']); if ($buddyids) { $topic_uids = array_merge($topic_uids, $buddyids); } } } else { $title = "{$member['nickname']}的微博"; } $topic_uids[$uid] = $uid; $options['uid'] = $topic_uids; } elseif ('myblog' == $params['code']) { $where = " and `type` != 'reply' "; if ($member['uid'] != MEMBER_ID) { $title = "{$member['nickname']}的微博"; } else { $title = '我的微博'; } $topic_selected = 'myblog'; $options['uid'] = $member['uid']; } if (!$topic_list_get) { $options['page_url'] = $query_link; $options['order'] = " `dateline` DESC "; if ($cache_time > 0 && $cache_key && !$options['tid']) { $options = jlogic('topic_list')->get_options($options, $cache_time, $cache_key); $options['page'] = wap_iconv($options['page']); } $info = jlogic('topic_list')->get_data($options, 'wap'); $topic_list = array(); $total_record = 0; if (!empty($info)) { $topic_list = wap_iconv($info['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_id_list = array(); foreach ($topic_list as $key => $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; } } if ($parent_id_list) { $parent_list = $this->_topicLogicGet($parent_id_list); } } } $this->Title = $title; include template('topic_index'); }
function _rm_my_cache($uid) { cache_db('mrm', $this->table . '-get_my_group-' . $uid); }
function hot_at($uid = MEMBER_ID, $limit = 10, $day = 7, $key = 'uid', $field = 'tuid') { $rets = array(); $uid = jfilter($uid, 'int'); $limit = jfilter($limit, 'int'); $day = jfilter($day, 'int'); if ($uid > 0 && $limit > 0 && $day > 0) { $cache_id = $this->cache_id("hot_at-{$field}-{$key}-{$uid}-{$limit}-{$day}"); if (false === ($rets = cache_db('mget', $cache_id))) { $gets = $this->get(array('sql_field' => " `{$field}`, COUNT(`{$field}`) AS `at_count` ", $key => $uid, '>@dateline' => TIMESTAMP - $day * 86400, 'sql_group' => " `{$field}` ", 'sql_order' => ' `at_count` DESC, `id` DESC ', 'result_count' => $limit, 'return_list' => 1)); $uids = array(); if ($gets) { $at_counts = array(); foreach ($gets as $k => $v) { $uid = (int) $v[$field]; if ($uid > 0) { $uids[$uid] = $uid; $at_counts[$uid] = $v['at_count']; } } } $rets = array(); if ($uids) { $rets = jlogic('topic')->GetMember($uids, "`uid`,`ucuid`,`username`,`nickname`,`face`,`face_url`,`fans_count`"); foreach ($rets as $k => $row) { $row['at_count'] = $at_counts[$row['uid']]; $rets[$k] = $row; } } cache_db('mset', $cache_id, $rets, 3600); } } return $rets; }
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); }
function DoList() { $options = array(); if (($per_page_num = (int) jconf::get('show', 'topic', $this->Code)) < 1) { $per_page_num = 20; } $uid = (int) get_param('uid'); $is_personal = (int) get_param('is_personal'); $tag_id = (int) get_param('tag_id'); $topic_parent_disable = false; $start = max(0, (int) $start); $limit = "limit {$start},{$per_page_num}"; $next = $start + $per_page_num; if ($tag_id > 0) { $sql = "select `item_id` from `" . TABLE_PREFIX . "topic_tag` where `tag_id`='{$tag_id}' order by `item_id` desc {$limit}"; $query = $this->DatabaseHandler->Query($sql); $topic_ids[0] = 0; while (false != ($row = $query->GetRow())) { $topic_ids[$row['item_id']] = $row['item_id']; } $options['tid'] = $topic_ids; } $options['perpage'] = $per_page_num; $tpl = 'topic_list_ajax'; if ('myhome' == $this->Code) { $uid = MEMBER_ID; $cache_time = 600; $cache_key = "{$uid}-topic-myhome--0"; $topic_myhome_time_limit = 0; if ($this->Config['topic_myhome_time_limit'] > 0) { $topic_myhome_time_limit = time() - $this->Config['topic_myhome_time_limit'] * 86400; if ($topic_myhome_time_limit > 0) { $options['dateline'] = $topic_myhome_time_limit; } } $topic_uids[$uid] = $uid; if ($is_personal) { if (false === cache_db('get', $cache_key)) { $buddyids = get_buddyids(MEMBER_ID, $this->Config['topic_myhome_time_limit']); if ($buddyids) { $topic_uids = array_merge($topic_uids, $buddyids); } } } $options['uid'] = $topic_uids; } else { if ('myat' == $this->Code) { $uid = MEMBER_ID; $rets = jtable('topic_mention')->get_ids(array('uid' => $uid, 'sql_order' => ' `id` DESC ', 'perpage' => $options['perpage'], 'page_url' => $options['page_url']), 'tid', 1); $total_record = $rets['count']; $page_arr = $rets['page']; $topic_list = $total_record > 0 && $rets['ids'] ? $this->TopicLogic->Get($rets['ids']) : array(); $topic_list_get = true; } else { if ('groupview' == $this->Code) { $gid = jget('gid', 'int'); $g_view_uids = array(); if ($gid > 0) { $ginfo = jtable('buddy_follow_group')->info($gid); if ($ginfo && $ginfo['count'] > 0 && $ginfo['uid'] == MEMBER_ID) { $groupid = $gid; $groupname = $ginfo['name']; $g_view_uids = jtable('buddy_follow_group_relation')->get_my_group_uids(MEMBER_ID, $gid); } } if ($g_view_uids) { $options['uid'] = $g_view_uids; } else { exit; } } else { if ('mylastpublish' == $this->Code) { $topic_list = $this->TopicLogic->Get(" where `uid`='" . MEMBER_ID . "' order by `dateline` desc limit 0,1 "); $temp_last_topic = end($topic_list); if ($temp_last_topic['item'] == 'reward' && !$this->item) { $this->item = 'reward'; } $no_from = false; $ref_mod = $this->Post['ref_mod']; $talk_r = $this->Post['r']; if ($talk_r == 'answer' || $talk_r == 'talk') { $tpl = 'talk_item_ajax'; } $ref_code = $this->Post['ref_code']; $no_from = $this->_no_from($ref_mod, $ref_code); $topic_list_get = true; if ($ref_mod == 'live' || $ref_mod == 'talk') { foreach ($topic_list as $key => $val) { $item = $topic_list[$key]['item']; $itemid = $topic_list[$key]['item_id']; $uid = $topic_list[$key]['uid']; $user_type = DB::result_first("SELECT type FROM " . DB::table('item_user') . " WHERE item = '{$item}' AND itemid='{$itemid}' AND uid = '{$uid}'"); $topic_list[$key]['user_css'] = $item . $user_type; if ($ref_mod == 'talk' && $user_type == 'guest') { $topic_list[$key]['user_str'] = '本期嘉宾'; } else { $topic_list[$key]['user_str'] = ' '; } } $no_mBlog_linedot2 = false; } else { $no_mBlog_linedot2 = true; } } else { if ('updatecurrent' == $this->Code) { $tid = intval($this->Post['tid']); if (empty($tid)) { exit; } $refcode = trim($this->Post['refcode']); $refmod = trim($this->Post['refmod']); $tpl = 'topic_item_ajax'; if ('topic' == $refmod && 'myfavorite' == $refcode) { $sql = "SELECT TF.dateline as favorite_time , T.*\r\n\t\t\t\t\t\tFROM " . DB::table("topic_favorite") . " AS TF\r\n\t\t\t\t\t\tLEFT JOIN " . DB::table("topic") . " AS T\r\n\t\t\t\t\t\tON T.tid=TF.tid where T.tid='{$tid}'"; $this->Code = $refcode; $topic_parent_disable = true; } else { $sql = "SELECT * FROM " . DB::table('topic') . " WHERE tid='{$tid}'"; } $data = DB::fetch_first($sql); if (empty($data)) { exit; } if (isset($data['favorite_time'])) { $data['favorite_time'] = my_date_format2($data['favorite_time']); } $val = $this->TopicLogic->Make($data, 0, array(), 0); $topic_list[] = $val; $no_from = false; if ('vote' == $refmod && 'view' == $refcode) { $no_from = true; } if ($refmod == 'qun') { $this->Module = 'qun'; } if ($refcode == 'reply_list_ajax') { $tpl = 'topic_comment_item'; $topic_parent_disable = true; $v = $val; } $topic_list_get = true; } else { if ('mycomment' == $this->Code) { $options['where'] = " `touid`='" . MEMBER_ID . "' "; } elseif ('tocomment' == $this->Code) { $title = '我评论的'; $topic_selected = 'tocomment'; $options['where'] = " `uid` = '" . MEMBER_ID . "' and `type` in ('both','reply') "; } elseif ('myblog' == $this->Code) { $options['uid'] = $uid; } else { if ('myfavorite' == $this->Code) { $uid = MEMBER_ID; $sql = "select TF.dateline as favorite_time , T.* from `" . TABLE_PREFIX . "topic_favorite` TF left join `" . TABLE_PREFIX . "topic` T on T.tid=TF.tid where TF.uid='{$uid}' order by TF.id desc {$limit}"; $query = $this->DatabaseHandler->Query($sql); while (false != ($row = $query->GetRow())) { if ($row['tid'] < 1) { continue; } $row['favorite_time'] = my_date_format2($row['favorite_time']); $topic_list[$row['tid']] = $row; } $topic_list = $this->TopicLogic->MakeAll($topic_list); $topic_list_get = true; } else { if ('favoritemy' == $this->Code) { $uid = MEMBER_ID; $sql = "select TF.dateline as favorite_time , TF.tuid , T.* from `" . TABLE_PREFIX . "topic_favorite` TF left join `" . TABLE_PREFIX . "topic` T on T.tid=TF.tid where TF.tuid='{$uid}' order by TF.id desc {$limit}"; $query = $this->DatabaseHandler->Query($sql); $tuids = array(); while (false != ($row = $query->GetRow())) { if ($row['tid'] < 1) { continue; } $row['favorite_time'] = my_date_format2($row['favorite_time']); $topic_list[$row['tid']] = $row; $tuids[$row['tuid']] = $row['tuid']; } $topic_list = $this->TopicLogic->MakeAll($topic_list); if ($tuids) { $topic_members = $this->TopicLogic->GetMember($tuids, "`uid`,`ucuid`,`username`,`nickname`,`face_url`,`face`,`validate`"); } $topic_parent_disable = true; $topic_list_get = true; } else { if ('topicnew' == $params['code']) { $title = '最新内容'; $options['where'] = ''; $orderby = in_array($this->Get['orderby'], array('post', 'dig', 'mark')) ? $this->Get['orderby'] : 'dig'; if ($orderby == 'mark') { $order = ' `lastupdate` DESC'; } elseif ($orderby == 'dig') { $order = ' `lastdigtime` DESC'; } else { $options['type'] = array('first', 'forward', 'both'); $order = ' `dateline` DESC'; } $options['order'] = $order; if ($this->Get["date"] && strtotime($this->Get["date"]) > 0) { $dateline = strtotime($this->Get["date"]); $options['where'] .= " `dateline` > '" . $dateline . "' and `dateline`<'" . ($dateline + 86400) . "'"; } else { $this->Get["date"] = date("Y-m-d", TIMESTAMP); } if (empty($options['type'])) { $options['type'] = get_topic_type(); } } } } } } } } } } #if NEDU defined('NEDU_MOYO') && nlogic('feeds.app.jsg')->on_ajax_topic_request($options); #endif if (!$topic_list_get) { if ($cache_time > 0 && $cache_key && !$options['tid']) { $options = jlogic('topic_list')->get_options($options, $cache_time, $cache_key); } $info = jlogic('topic_list')->get_data($options); $topic_list = array(); $total_record = 0; if (!empty($info)) { $topic_list = $info['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); } $relate_list = $this->TopicLogic->GetRelateTopic($topic_list); } if ($tpl == 'talk_item_ajax') { $answer_list = array(); if ($parent_list) { $answer_list = $topic_list; $topic_list = $parent_list; } foreach ($topic_list as $key => $val) { if (empty($topic_list[$key]['touid'])) { $topic_list[$key]['biank_css'] = 'talk_view_ping'; $topic_list[$key]['tubiao_css'] = 'talk_view_pin'; } else { $topic_list[$key]['biank_css'] = 'talk_view_wenda'; $topic_list[$key]['tubiao_css'] = 'talk_view_wen'; $topic_list[$key]['ask_list'] = $answer_list; foreach ($topic_list[$key]['ask_list'] as $k => $v) { $topic_list[$key]['ask_list'][$k]['tubiao_css'] = 'talk_view_da'; $topic_list[$key]['ask_list'][$k]['user_css'] = 'talkguest'; } } } } #if NEDU defined('NEDU_MOYO') && nlogic('feeds.app.jsg')->on_ajax_topic_response($topic_list, $page_arr); #endif include template($tpl); }
function delete($ids) { $p = array('ids' => $ids); $rets = $this->get($p); if (!$rets) { return 0; } $ret = 1; $tids = array(); $uids = array(); foreach ($rets['list'] as $r) { $id = $r['id']; jio()->DeleteFile(topic_image($id, 'small')); jio()->DeleteFile(topic_image($id, 'photo')); jio()->DeleteFile(topic_image($id, 'original')); DB::query("delete from " . DB::table($this->table) . " where `id`='{$id}'"); if ($r['tid'] > 0) { $tids[$r['tid']] = $r['tid']; } if ($r['uid'] > 0) { $uids[$r['uid']] = $r['uid']; } } if ($tids) { foreach ($tids as $tid) { $this->set_topic_imageid($tid); } } if ($uids) { foreach ($uids as $uid) { cache_db('rm', "{$uid}-my_image-%", 1); cache_db('rm', "{$uid}-get_photo_list-%", 1); } } return $ret; }
function may_interest_user($retry = FALSE, $getNum = 4) { $uid = MEMBER_ID; if ($uid < 1) { return array(); } $buddyids = get_buddyids($uid, $GLOBALS['_J']['config']['topic_myhome_time_limit']); $type_array = array(); if ($GLOBALS['_J']['config']['same_city']) { $type_array[] = 'city'; } if (!$retry) { $retry = $type_array = array('follow', 'tag', 'user_tag'); } else { $type_array = $retry; } $refresh_type = $type_array[array_rand($type_array, 1)]; $cache_time = 1800; $cache_key = "{$uid}-may_interest_user-" . $refresh_type; if (false === ($cache_data = cache_db('get', $cache_key))) { $uids = array(); $uids_limit = 300; if ($refresh_type == 'follow') { if ($buddyids) { $rs = array(); $imax = min(10, count($buddyids)); for ($i = 0; $i < $imax; $i++) { $bid = (int) $buddyids[array_rand($buddyids)]; if ($bid > 0 && !isset($rs[$bid])) { $rs[$bid] = 1; $p = array('uid' => $bid, 'buddy_lastuptime' => TIMESTAMP - 864000, 'result_count' => 100, 'sql_order' => ' `dateline` DESC '); $ids = get_buddyids($p); if ($ids) { $uids = array_merge($uids, $ids); $uids = array_unique($uids); if (count($uids) >= $uids_limit) { break; } } } } } } elseif ($refresh_type == 'tag') { $query = DB::query("SELECT `tag` FROM " . DB::table('tag_favorite') . " where uid='{$uid}'"); $touser_tag = array(); while ($value = DB::fetch($query)) { $touser_tag[] = $value['tag']; } if ($touser_tag) { $query = DB::query("SELECT `uid` FROM " . DB::table('tag_favorite') . " where `tag` in ('" . implode("','", $touser_tag) . "') ORDER BY `id` DESC LIMIT {$uids_limit} "); while ($value = DB::fetch($query)) { $uids[$value['uid']] = $value['uid']; } } } elseif ($refresh_type == 'user_tag') { $query = DB::query("SELECT `tag_id`,`uid` FROM " . DB::table('user_tag_fields') . " where uid='{$uid}'"); $touser_usertag_uid = array(); while ($value = DB::fetch($query)) { $touser_usertag_uid[$value['tag_id']] = $value['tag_id']; } if ($touser_usertag_uid) { $query = DB::query("SELECT `uid` FROM " . DB::table('user_tag_fields') . " where `tag_id` in ('" . implode("','", $touser_usertag_uid) . "') ORDER BY `id` DESC LIMIT {$uids_limit} "); while ($value = DB::fetch($query)) { $uids[$value['uid']] = $value['uid']; } } } elseif ($refresh_type == 'city') { $member_info = jsg_member_info($uid); if ($member_info['city']) { $query = DB::query("select `uid` from " . DB::table('members') . " where `city` = '{$member_info['city']}' ORDER BY `lastactivity` DESC LIMIT {$uids_limit} "); while ($value = DB::fetch($query)) { $uids[$value['uid']] = $value['uid']; } } } } else { $uids = $cache_data['uids']; $refresh_type = $cache_data['refresh_type']; } $member_list = array(); $black_list = array(); $query = DB::query(" select `touid` from `" . TABLE_PREFIX . "blacklist` where `uid` = '{$uid}'"); while ($rs = DB::fetch($query)) { $black_list[$rs['touid']] = $rs['touid']; } if ($uids) { if ($buddyids || $black_list) { foreach ($uids as $k => $v) { if (isset($buddyids[$v])) { unset($uids[$k]); } if (isset($black_list[$v])) { unset($uids[$k]); } if ($v == $uid) { unset($uids[$k]); } } } if ($uids) { if (false === $cache_data) { $cache_data['uids'] = $uids; $cache_data['refresh_type'] = $refresh_type; cache_db('set', $cache_key, $cache_data, $cache_time); } $rand_number = count($uids) > $getNum ? $getNum : count($uids); $rand_uids1 = array_rand($uids, $rand_number); if ($rand_uids1) { if (is_array($rand_uids1)) { foreach ($rand_uids1 as $key => $val) { $rand_uids[$val] = $uids[$val]; } } else { $rand_uids[$rand_uids1] = $uids[$rand_uids1]; } } if ($rand_uids) { $condition = " WHERE `uid` IN ('" . implode("','", $rand_uids) . "') LIMIT {$rand_number} "; $member_list = jlogic('topic')->GetMember($condition); $member_list = jlogic('buddy')->follow_html($member_list, 'uid', 'follow_html2', 0, 1); foreach ($member_list as $k => $row) { if ($row['is_follow']) { unset($member_list[$k]); } else { $_uid = $row['uid']; $count = 1; $i = 0; $moreHTML = ''; if ('follow' == $refresh_type) { $fansids = jlogic('buddy')->get_fansids(array('uid' => $_uid, 'touid' => $buddyids)); $fan_info = jtable('members')->get(array('uid' => $fansids)); foreach ($fan_info['list'] as $key => $val) { if ($i > 1) { break; } $i++; $moreHTML = $moreHTML . ($moreHTML ? "、" : '') . "<a href='index.php?mod={$val['uid']}'>{$val['nickname']}</a>"; } $count = count($fansids); } elseif ('user_tag' == $refresh_type) { $user_tag_list = array(); $query = DB::query("SELECT A.`tag_id`,A.`tag_name` FROM " . DB::table('user_tag_fields') . " A, " . DB::table('user_tag_fields') . " B WHERE A.uid='{$_uid}' AND B.uid='{$uid}' AND B.tag_id=A.tag_id"); while ($rs = DB::fetch($query)) { $user_tag_list[$rs['tag_id']] = $rs; if ($i < 2) { $moreHTML .= ($moreHTML ? '、' : '') . $rs['tag_name']; } $i++; } $count = count($user_tag_list); } elseif ('tag' == $refresh_type) { $user_tag_list = array(); $query = DB::query("SELECT A.id,A.tag FROM " . DB::table('tag_favorite') . " A, " . DB::table('tag_favorite') . " B WHERE A.uid='{$_uid}' AND B.uid='{$uid}' AND B.tag=A.tag"); while ($rs = DB::fetch($query)) { $user_tag_list[$rs['id']] = $rs; if ($i < 2) { $moreHTML .= ($moreHTML ? '、' : '') . "<a href='inde.php?mod=tag&code={$rs['tag']}'>{$rs['tag']}</a>"; } $i++; } $count = count($user_tag_list); } $row['moreHtml'] = $moreHTML; $row['count'] = $count; $row['refresh_type'] = $refresh_type; $member_list[$k] = $row; } } } } } $this->member_list = array_merge($this->member_list, $member_list); if ((!$member_list || count($this->member_list) < 5) && count($retry) > 1) { $key = array_search($refresh_type, $retry); unset($retry[$key]); $member_list = $this->may_interest_user($retry, $getNum); } return array_slice($this->member_list, 0, 5); }
function AtUser() { $limit = jget('limit', 'int'); if ($limit < 1 || $limit > 100) { $limit = 10; } $nickname = jget('q', 'txt'); $from = jget('from'); $type = jget('type'); $acode = jget('acode'); $id = jget('id', 'int'); $inkey = jget('key'); $nickname = get_safe_code($nickname); $nl = strlen($nickname); $rets = array(); $uids = array(); if ($acode == 'bud') { $uids = jtable('buddy_follow_group_relation')->get_my_group_uids(MEMBER_ID, $id); $rets = DB::fetch_all("SELECT `uid`, `nickname`, `ucuid`, `face` FROM " . DB::table('members') . " WHERE uid IN(" . jimplode($uids) . ") ORDER BY `topic_count` DESC\tLIMIT 10 "); } elseif ($acode == 'rec') { $rets = DB::fetch_all("SELECT `uid`, `nickname`, `ucuid`, `face` FROM " . DB::table('members') . " WHERE `media_id`='{$id}' ORDER BY `media_order_id` DESC\tLIMIT 10 "); } elseif ($acode == 'budn') { $buddyids = get_buddyids(array('uid' => MEMBER_ID, 'result_count' => 10, 'gids' => '')); $rets = DB::fetch_all("SELECT `uid`, `nickname`, `ucuid`, `face` FROM " . DB::table('members') . " WHERE uid IN(" . jimplode($buddyids) . ") ORDER BY `topic_count` DESC\tLIMIT 10 "); } else { if ($nl < 1 || $nl > 50) { #一周内我经常AT的人 $rets = jtable('topic_mention')->my_hot_at(MEMBER_ID, $limit); } else { $cache_id = 'ajax/misc/AtUser-' . $nickname; if (false === ($rets = cache_db('get', $cache_id))) { $where_sql = " " . build_like_query("nickname", $nickname) . " "; $rets = DB::fetch_all("SELECT `uid`, `nickname`, `ucuid`, `face`\r\n\t\t\t\t\t\t\t\t\tFROM " . DB::table('members') . "\r\n\t\t\t\t\t\t\t\t\tWHERE {$where_sql}\r\n\t\t\t\t\t\t\t\t\tORDER BY `fans_count` DESC, `lastactivity` DESC\r\n\t\t\t\t\t\t\t\t\tLIMIT {$limit} "); cache_db('set', $cache_id, $rets, 3600); } } } if ($rets) { foreach ($rets as $row) { $row = jsg_member_make($row); if ($from == 'admin') { echo "<li>{$row['nickname']}</li>"; } elseif ($from == 'web') { echo "<li onclick=\"atcin_user('{$inkey}','{$row[nickname]}','{$type}');\"><img onerror='javascript:faceError(this);' src='{$row['face']}'><span>{$row['nickname']}</span></li>"; } else { echo "{$row['nickname']}|{$row['uid']}|{$row['face']}\n"; } } } exit; }
function Main() { $code_ary = array('myblog', 'myhome', 'tag', 'qun', 'recd', 'other', 'bbs', 'cms', 'department', 'company', 'channel', 'topicnew', 'bcj'); if (!in_array($this->Code, $code_ary)) { $tos = array('new' => 'index.php?mod=plaza', 'tc' => 'index.php?mod=plaza&code=new_tc', 'hotreply' => 'index.php?mod=plaza&code=hot_reply', 'hotforward' => 'index.php?mod=plaza&code=hot_forward', 'newreply' => 'index.php?mod=plaza&code=new_reply', 'newforward' => 'index.php?mod=plaza&code=new_forward', 'top' => 'index.php?mod=top&code=member', 'channellogin' => 'index.php?mod=channel'); if (isset($tos[$this->Code])) { $this->Messager(null, $tos[$this->Code]); exit; } unset($this->Code); } $channel_enable = jconf::get('channel') ? true : false; $content_dstr = $this->Config['in_publish_notice_str']; $content_ostr = $this->Config['on_publish_notice_str']; if ('topic' == trim($this->Get['mod']) && empty($this->Get['code']) && empty($this->Get['mod_original'])) { if (MEMBER_ID > 0) { if ($this->Config['topic_home_page']) { $this->Messager(null, $this->Config['topic_home_page']); } else { $this->Code = 'myhome'; } } else { $this->Messager('请<a onclick="ShowLoginDialog();return false;" title="快捷登录" rel="nofollow" href="index.php?mod=login" >点此登录</a>, 或<a href="index.php?mod=member">点此注册</a>一个帐号', null); return; } } $member = $this->_member(); if (!$member) { $this->Messager('请<a onclick="ShowLoginDialog();return false;" title="快捷登录" rel="nofollow" href="index.php?mod=login" >点此登录</a>, 或<a href="index.php?mod=member">点此注册</a>一个帐号', null); return false; } $title = ''; $per_page_num = 20; $topic_uids = $topic_ids = $order_list = $where_list = $params = array(); $where = $order = $limit = ""; $cache_time = 0; $cache_key = ''; $options = array(); $gets = array('mod' => $_GET['mod_original'] ? get_safe_code($_GET['mod_original']) : $this->Module, 'code' => $this->Code, 'type' => $this->Get['type'], 'gid' => $this->Get['gid'], 'qid' => $this->Get['qid'], 'chid' => $this->Get['chid'], 'view' => $this->Get['view'], 'filter' => $this->Get['filter'], 'orderby' => $this->Get['orderby']); $options['page_url'] = "index.php?" . url_implode($gets); unset($gets['type']); $type_url = "index.php?" . url_implode($gets); $params['uid'] = $uid = $member['uid']; $is_personal = $uid == MEMBER_ID; $params['is_personal'] = $is_personal; $params['code'] = $this->Code; if (!in_array($params['code'], $code_ary)) { $params['code'] = 'myblog'; } $page_str = $params['code']; if ($params['code'] == 'bbs' || $params['code'] == 'cms') { $page_str = 'myhome'; } if (($show_topic_num = (int) $this->ShowConfig['topic'][$page_str]) > 0) { $per_page_num = $show_topic_num; } $options['perpage'] = $per_page_num; $groupname = ''; $groupid = 0; $TopicListLogic = jlogic('topic_list'); #if NEDU if (defined('NEDU_MOYO')) { nui('jsg')->cindex($this, $params, $topic_list_get); } #endif $sendMail = false; $checkUser = false; if ($this->Config['sendmailday'] > 0) { if (!jsg_getcookie('mail_cookie')) { jsg_setcookie('mail_cookie', TIMESTAMP, 300); $sendMail = true; } if (!jsg_getcookie('check_user')) { jsg_setcookie('check_user', TIMESTAMP, 86400); $checkUser = true; } } $tpl = 'topic_index'; if ('myhome' == $params['code']) { $tpl = 'topic_myhome'; $topic_selected = 'myhome'; $type = get_param('type'); if ($type && !in_array($type, array('pic', 'video', 'music', 'vote', 'event'))) { $type = ''; } if ($type) { $params['type'] = $type; } $gid = max(0, (int) get_param('gid')); if ($gid) { $params['gid'] = $gid; } $topic_myhome_time_limit = 0; if ($this->Config['topic_myhome_time_limit'] > 0) { $topic_myhome_time_limit = TIMESTAMP - $this->Config['topic_myhome_time_limit'] * 86400; if ($topic_myhome_time_limit > 0) { $options['dateline'] = $topic_myhome_time_limit; } } $options['uid'] = array($member['uid']); if ($member['uid'] == MEMBER_ID) { $cache_time = 600; $cache_key = "{$member['uid']}-topic-myhome-{$type}-{$gid}"; $title = '我的首页'; $refresh_time = max(30, (int) $this->Config['ajax_topic_time']); if (get_param('page') < 2 && $member['lastactivity'] + $refresh_time < TIMESTAMP) { $new_topic = jlogic('buddy')->check_new_topic($uid, 1); if ($new_topic > 0) { cache_db('rm', "{$uid}-topic-%", 1); } } if ($gid) { $group_info = jtable('buddy_follow_group')->info($gid); if (empty($group_info) || MEMBER_ID != $group_info['uid']) { $this->Messager("当前分组不存在", 'index.php?mod=myhome'); } $query_link = "index.php?mod=" . ($_GET['mod_original'] ? get_safe_code($_GET['mod_original']) : $this->Module) . ($this->Code ? "&code={$this->Code}&type={$this->Get['type']}&gid={$this->Get['gid']}" : ""); if ($group_info['count'] > 0) { $g_view_uids = jtable('buddy_follow_group_relation')->get_my_group_uids(MEMBER_ID, $gid); } $groupid = $gid; $groupname = $group_info['name']; if ($g_view_uids) { $options['uid'] = $g_view_uids; } else { $this->Messager("没有设置用户,无法查看这个组的微博", 'index.php?mod=topic&code=group&gid=' . $gid); } $active[$gid] = "current"; } else { if ($type || false === cache_db('get', $cache_key)) { $buddyids = get_buddyids($params['uid'], $this->Config['topic_myhome_time_limit']); if ($buddyids) { $options['uid'] = array_merge($options['uid'], $buddyids); } } $active['all'] = "current"; } } else { $title = "{$member['nickname']}的微博"; $this->_initTheme($member); } if ($type) { $getTypeTidReturn = $TopicListLogic->GetTypeTid($type, $options['uid'], $options); $options['tid'] = $getTypeTidReturn['tid']; $options['count'] = $getTypeTidReturn['count']; $options['limit'] = $per_page_num; } } else { if ('channel' == $params['code'] && $this->Channel_enable && $this->Config['channel_enable']) { $viewtype = jget('view'); $ch_id = jget('cid'); $title = '我的频道微博'; if ($member['uid'] != MEMBER_ID) { $this->Messager("您无权查看该页面", null); } jlogic('member')->clean_new_remind('channel_new', MEMBER_ID); $orderby = in_array($this->Get['orderby'], array('post', 'dig', 'mark', 'ldig', 'top')) ? $this->Get['orderby'] : 'dig'; $ChannelLogic = jlogic('channel'); $my_buddy_channel = $ChannelLogic->mychannel(); $cachefile = jconf::get('channel'); $channel_channels = $cachefile['channels']; $channel_ids = array(); if (empty($my_buddy_channel)) { $channel_ids = array(0); } else { $my_chs = array_keys($my_buddy_channel); foreach ($my_chs as $val) { $channel_ids = array_merge($channel_ids, (array) $channel_channels[$val]); } if (is_array($channel_ids)) { $channel_ids = array_unique($channel_ids); } } $my_cannot_view_chids = jlogic('channel')->get_my_cannot_view_chids(); if ($my_cannot_view_chids) { foreach ($channel_ids as $key => $val) { if (in_array($val, $my_cannot_view_chids)) { unset($channel_ids[$key]); } } } $options['item'] = 'channel'; $options['item_id'] = $channel_ids; $options['type'] = array('first', 'channel'); if ($orderby == 'mark') { $order = ' lastupdate DESC'; } elseif ($orderby == 'dig') { $order = ' lastdigtime DESC'; } elseif ($orderby == 'ldig') { $order = ' digcounts DESC,lastdigtime DESC'; } else { $order = ' dateline DESC'; } $options['order'] = $order; if ($orderby == 'top') { $where = $channel_ids ? "tr.item = 'channel' AND tr.item_id IN(" . implode(",", $channel_ids) . ")" : "tr.item = 'channel'"; $options = array('where' => $where, 'perpage' => $per_page_num); $info = $TopicListLogic->get_recd_list($options); if (!empty($info)) { $total_record = $info['count']; $topic_list = $info['list']; $page_arr = $info['page']; } $topic_list_get = true; } } else { if ('company' == $params['code'] && $this->Config['company_enable'] && @is_file(ROOT_PATH . 'include/logic/cp.logic.php')) { $title = '我的单位微博'; if ($member['companyid'] < 1) { $this->Messager("您还不属于任何" . $d_c_name . ",请先加入某个" . $d_c_name . "!", 'index.php?mod=settings&code=base'); } jlogic('member')->clean_new_remind('company_new', MEMBER_ID); $viewtype = jget('view'); $options['uid'] = jlogic('cp')->getcpuids('company', $member['companyid']); if ($viewtype == 'secret') { $options['type'] = 'company'; } } else { if ('bcj' == $params['code'] && $this->Channel_enable && $this->Config['channel_enable']) { $ch_id = jget('cid', 'int'); $featureid = jget('view', 'int'); if ($ch_id == 3) { $title = '建议'; } elseif ($ch_id == 2) { $title = '提问'; } else { $title = '资讯'; if (!in_array($ch_id, array('4', '6'))) { $ch_id = 5; } } if (!in_array($featureid, array('1', '2', '3'))) { $featureid = 0; } $options['item'] = 'channel'; $options['item_id'] = $ch_id; $my_cannot_view_chids = jlogic('channel')->get_my_cannot_view_chids(); if ($my_cannot_view_chids && in_array($ch_id, $my_cannot_view_chids)) { $forbidden_view = true; $options['tid'] = 0; } if (isset($_GET['view'])) { $options['where'] = " featureid = '{$featureid}' "; } $options['page_url'] .= "&cid={$ch_id}"; } else { if ('department' == $params['code']) { $tpl = 'topic_department'; $title = ($this->Config['default_department'] ? $this->Config['default_department'] : '部门') . '微博'; if ($member['uid'] != MEMBER_ID) { $this->Messager("您无权查看该页面", null); } if (!($this->Config['department_enable'] && @is_file(ROOT_PATH . 'include/logic/cp.logic.php'))) { $this->Messager("网站没有开启该功能", null); } $views = array('all', 'my', 'other'); $view = trim($this->Get['view']); if (!in_array($view, $views)) { $view = 'other'; } $active[$view] = 'current'; $dids = array(); if ($member['departmentid'] > 0) { if ($view == 'my') { $dids[] = $member['departmentid']; } else { $sql = "select did\tfrom `" . TABLE_PREFIX . "buddy_department` where `uid`='" . MEMBER_ID . "'"; $query = $this->DatabaseHandler->Query($sql); while (false != ($row = $query->GetRow())) { $dids[] = $row['did']; } if ($view == 'all') { $dids[] = $member['departmentid']; } } } if ($dids) { $sql = "select `uid` from `" . TABLE_PREFIX . "members` where `departmentid` in(" . jimplode($dids) . ")"; $query = $this->DatabaseHandler->Query($sql); $options['uid'] = array(); while (false != ($row = $query->GetRow())) { $options['uid'][] = $row['uid']; } if (false != ($type = $this->Get['type']) && 'all' != $type) { $options['tid'] = $TopicListLogic->GetTypeTid($type, $options['uid']); } } else { $options['tid'] = array(); } if ($member['departmentid']) { $department = DB::fetch_first("SELECT * FROM " . DB::table('department') . " WHERE id='" . $member['departmentid'] . "'"); } $user_lp = $this->TopicLogic->GetMember(array($department['leaderid'], $department['managerid']), "`uid`,`ucuid`,`username`,`nickname`,`face`,`face_url`,`validate`,`validate_category`,`aboutme`"); $mybuddys = (array) get_buddyids(MEMBER_ID); $user_l = $user_lp[$department['leaderid']]; if ($user_l) { $user_l['here_name'] = $department['leadername']; $user_l['follow_html'] = follow_html2($department['leaderid'], in_array($department['leaderid'], $mybuddys)); $leader_list[] = $user_l; } $user_m = $user_lp[$department['managerid']]; if ($user_m) { $user_m['here_name'] = $department['managername']; $user_m['follow_html'] = follow_html2($department['managerid'], in_array($department['managerid'], $mybuddys)); $manager_list[] = $user_m; } $CpLogic = jlogic('cp'); $department_list = $CpLogic->Getdepartment($member['companyid'], $member['departmentid']); } else { if ('tag' == $params['code']) { $tpl = 'topic_tag'; $title = '我关注的话题'; if ($member['uid'] != MEMBER_ID) { $this->Messager("您无权查看该页面", null); } $views = array('new', 'new_reply', 'my_reply', 'recd'); $view = trim($this->Get['view']); if (!in_array($view, $views)) { $view = 'new'; } $active[$view] = 'current'; $tag_ids = jlogic('tag_favorite')->my_favorite_tag_ids(MEMBER_ID); if ($tag_ids) { if ('new' == $view) { $p = $options; $p['tag_id'] = $tag_ids; $p['sql_order'] = ' `item_id` DESC '; $rets = jtable('topic_tag')->get_ids($p, 'item_id', 1); $topic_list_get = true; $total_record = $rets['count']; $page_arr = $rets['page']; $topic_list = $total_record > 0 && $rets['ids'] ? $this->TopicLogic->Get($rets['ids']) : array(); } else { $sql = "select `item_id` from `" . TABLE_PREFIX . "topic_tag` where `tag_id` in('" . implode("','", $tag_ids) . "') ORDER BY `item_id` DESC LIMIT 2000 "; $query = $this->DatabaseHandler->Query($sql); $topic_ids = array(); while (false != ($row = $query->GetRow())) { $topic_ids[$row['item_id']] = $row['item_id']; } $options['tid'] = $topic_ids; unset($topic_ids); } if ($this->Get['type']) { $options['filter'] = $this->Get['type']; } if ($view == 'new_reply') { $options['where'] = " replys>0 "; $options['order'] = " lastupdate DESC "; } else { if ($view == 'recd') { $p = array('where' => " tr.recd >= 1 AND tr.item='tag' AND tr.item_id IN(" . jimplode($tag_ids) . ") ", 'perpage' => 10, 'filter' => $this->Get['type']); $info = $TopicListLogic->get_recd_list($p); if (!empty($info)) { $total_record = $info['count']; $topic_list = $info['list']; $page_arr = $info['page']; } $topic_list_get = true; } } } else { $topic_list_get = true; } if ($GLOBALS['_J']['member']['topic_new']) { jlogic('member')->clean_new_remind('topic_new', MEMBER_ID); } } else { if ('myblog' == $params['code']) { $this->myblog_no_recommend = TRUE; $tpl = 'topic_myblog'; $where = " 1 "; $options['uid'] = array($member['uid']); if ($this->Get['type']) { if ('profile' == $this->Get['type']) { $title = $member['gender_ta'] . '的资料'; $type = 'profile'; #用户填写的自定义添加项 $member_profile = jlogic('member_profile')->getMemberProfileInfo($member['uid']); if ($member_profile) { $member = array_merge($member, $member_profile); } #用户自定义添加项的可见度 $memberProfileSet = jlogic('member_profile')->getMemberProfileSet($member['uid']); $member_info = $member; if ($member_info['gender']) { if ($member_info['gender'] == 1) { $member_info['gender'] = '男'; } elseif ($member_info['gender'] == 2) { $member_info['gender'] = '女'; } } if ($member_info['bday']) { $bdayInt = strtotime($member_info['bday']); if (!$bdayInt) { unset($member_info['bday']); } } $member_info = array_filter($member_info); $groupProfile = jconf::get('groupprofile'); foreach ($groupProfile as $key_p => $group_p) { $keys_p = array_keys($group_p['list']); foreach ($keys_p as $key_one) { if ($member_info[$key_one]) { $groupProfile[$key_p]['isProfile'] = true; } continue; } } } if ('album' == $this->Get['type']) { $this->Title = ($member['uid'] == MEMBER_ID ? '我' : $member['nickname']) . '的相册'; $nav_url = $this->Title; $uid = $member['uid']; $imgid = jget('pid'); if (isset($_GET['aid'])) { $albumid = jget('aid'); $list_type = 'image'; $albumname = jlogic('image')->getalbumname($albumid, 0, 0, $uid); if ($albumid > 0 && $albumname) { if (!jlogic('image')->checkalbumbyid($albumid)) { $this->Messager("您没有权限浏览该相册", null); } $count = jlogic('image')->albumimgnums($albumid, 1); $albuminfo = jlogic('image')->getalbumbyid('album', $albumid); if ($count != $albuminfo['picnum']) { jlogic('image')->update_album_picnum($albumid, $count); } } else { $count = jlogic('image')->albumimgnums(0, 0, $uid); } $albumname = $albumname ? $albumname : ($albumid > 0 ? '错误页面' : '默认相册'); $pernum = 9; $pagehtml = page($count, $pernum, 'index.php?mod=' . $member['username'] . '&type=album&aid=' . $albumid, array('return' => 'array')); $limit_sql = $pagehtml['limit']; if ($albumid > 0) { $myalbums = jlogic('image')->getallalbumimg($albumid, $limit_sql, 1); } else { $myalbums = jlogic('image')->getallalbumimg(0, $limit_sql, 0, $uid); } foreach ($myalbums as $key => $val) { $myalbums[$key]['pic'] = $val['site_url'] . str_replace('./', '/', str_replace('_o.jpg', '_s.jpg', $val['photo'])); $myalbums[$key]['albumname'] = $val['description'] ? cut_str($val['description'], 18) : ''; $myalbums[$key]['title'] = $val['description']; $myalbums[$key]['url'] = jurl('index.php?mod=' . $member['username'] . '&type=album&pid=' . $val['id']); $myalbums[$key]['rel'] = $val['photo'] ? $val['site_url'] . '/' . str_replace('./', '', $val['photo']) : ''; } $nav_url = '<a href="index.php?mod=' . $member['username'] . '&type=album">' . $this->Title . '</a> >> ' . $albumname; } elseif ($imgid > 0) { $content_ostr = ''; $type = 'album'; $infos = jlogic('image')->get_uploadimg_byid($imgid, $uid); $imginfo = $infos[$imgid]; if (!$imginfo) { $this->Messager("不存在该图片", null); } if ($imginfo['albumid'] > 0 && !jlogic('image')->checkalbumbyid($imginfo['albumid'])) { $this->Messager("您没有权限浏览该图片", null); } $imginfo['photo'] = $imginfo['site_url'] . '/' . str_replace('./', '', $imginfo['photo']); $albumname = $imginfo['albumid'] > 0 ? jlogic('image')->get_albumname_byid($imginfo['albumid']) : '默认相册'; $imgname = $imginfo['description'] ? cut_str($imginfo['description'], 18) : $imginfo['name']; $imgwidth = $imginfo['width'] > 580 ? 580 : $imginfo['width']; $imgheight = $imginfo['width'] > 580 ? ceil($imginfo['height'] / $imginfo['width'] * 580) : $imginfo['height']; $imgsize = $imginfo['filesize'] > 0 ? $imginfo['filesize'] < 1024 * 100 ? round($imginfo['filesize'] / 1024, 1) . 'K' : round($imginfo['filesize'] / (1024 * 1024), 1) . 'M' : '未知'; $imgtime = my_date_format($imginfo['dateline']); $imgfrom = $imginfo['tid'] > 0 ? '<a href="' . jurl('index.php?mod=topic&code=' . $imginfo['tid']) . '">微博</a>' : ($imginfo['tid'] < 0 ? '私信' : '相册'); $this->item = 'topic_image'; $this->item_id = $imgid; $albumid = $imginfo['albumid']; $h_key = 'album'; $gets = array('mod' => $member['username'], 'type' => 'album', 'pid' => $imgid); $page_url = 'index.php?' . url_implode($gets); $tids = jlogic('image')->get_topic_by_imageid($imgid); $options = array('tid' => $tids, 'perpage' => 5, 'page_url' => $page_url); $topic_info = jlogic('topic_list')->get_data($options); $topic_list = array(); if (!empty($topic_info)) { $topic_list = $topic_info['list']; $page_arr['html'] = $topic_info['page']['html']; } $albums = jlogic('image')->getalbum(); $nav_url = '<a href="index.php?mod=' . $member['username'] . '&type=album">' . $this->Title . '</a> >> <a href="index.php?mod=' . $member['username'] . '&type=album&aid=' . ($imginfo['albumid'] > 0 ? $imginfo['albumid'] : 0) . '">' . $albumname . '</a> >> ' . ($imgname ? $imgname : '图片浏览'); } else { $list_type = 'album'; $count = jlogic('image')->albumnums(1, $uid); $pernum = 8; $pagehtml = page($count, $pernum, 'index.php?mod=' . $member['username'] . '&type=album', array('return' => 'array')); $limit_sql = $pagehtml['limit']; $myalbums = jlogic('image')->getalbum($limit_sql, 1, $uid); $myalbums[0] = array('albumid' => 0, 'albumname' => '默认相册'); $purview_name = $member['uid'] == MEMBER_ID ? '我' : $member['gender_ta']; $purviewtext = array(0 => '所有人可见', 1 => '仅' . $purview_name . '关注的人可见', 2 => '仅' . $purview_name . '的粉丝可见', 3 => '仅' . $purview_name . '自己可见'); foreach ($myalbums as $key => $val) { $myalbums[$key]['pic'] = $val['pic'] ? str_replace('_o.jpg', '_s.jpg', $val['pic']) : 'images/noavatar.gif'; $myalbums[$key]['albumname'] = cut_str($val['albumname'], 18); $myalbums[$key]['title'] = $val['depict'] ? $val['depict'] : $val['albumname']; $myalbums[$key]['url'] = jurl('index.php?mod=' . $member['username'] . '&type=album&aid=' . $val['albumid']); $myalbums[$key]['id'] = $val['albumid']; $myalbums[$key]['purview'] = $purviewtext[$val['purview']]; } } } if ('mycomment' == $this->Get['type']) { $title = '评论' . $member['gender_ta'] . '的'; if ($member['uid'] < 1) { $this->Messager("您无权查看该页面", null); } if ($member['comment_new']) { jlogic('member')->clean_new_remind('comment_new', $member['uid']); } $topic_selected = 'mycomment'; $_rets = jtable('member_relation')->get_tids($member['uid'], array('perpage' => $per_page_num), 1); if ($_rets) { $topic_list = $this->TopicLogic->Get($_rets['ids']); $total_record = $_rets['count']; $page_arr = $_rets['page']; unset($_rets); } $topic_list_get = true; } if ('tocomment' == $this->Get['type']) { $tpl = 'topic_myblog'; $title = $member['gender_ta'] . '评论的'; $topic_selected = 'mycomment'; unset($options['uid']); $options['where'] = "`uid` = '{$member['uid']}' and `type` in ('both','reply')"; } if ('vote' == $this->Get['type']) { $type = 'vote'; $tpl = 'topic_vote'; $perpage = $this->ShowConfig['vote']['list']; $perpage = empty($perpage) ? 20 : $perpage; $vote_where = ' 1 '; $filter = get_param('filter'); if ($filter == 'joined') { $vids = jlogic('vote')->get_joined($member['uid']); if (!empty($vids)) { $vote_where .= " AND `v`.`vid` IN(" . jimplode($vids) . ") "; } else { $vote_where = ' 0 '; } } else { if ($filter == 'new_update') { jlogic('member')->clean_new_remind('vote_new', $uid); $vids = jlogic('vote')->get_joined($uid); if (!empty($vids)) { $vote_where .= " AND `v`.`vid` IN(" . jimplode($vids) . ") "; } $vote_where .= " OR `v`.`uid`='{$uid}' "; } else { $vote_where .= " AND `v`.`uid`='{$uid}' "; $filter = 'created'; } } $vote_order_sql = ' ORDER BY lastvote DESC '; $vote_where .= " AND v.verify = 1"; $param = array('where' => $vote_where, 'order' => $vote_order_sql, 'page' => true, 'perpage' => $perpage, 'page_url' => $options['page_url']); $vote_info = jlogic('vote')->find($param); $count = 0; $vote_list = array(); $page_arr['html'] = ''; $uid_ary = array(); if (!empty($vote_info)) { $count = $vote_info['count']; $vote_list = $vote_info['vote_list']; $page_arr['html'] = $vote_info['page']['html']; $uid_ary = $vote_info['uids']; } if (!empty($uid_ary)) { $members = $this->TopicLogic->GetMember($uid_ary); } $topic_list_get = true; } if ('event' == $this->Get['type']) { $type = 'event'; $tpl = 'topic_event'; $filter = get_param('filter'); $param = array('perpage' => "10", 'page' => true); $return = array(); if ($filter == 'joined') { $this->Title = $member['nickname'] . "参与的活动"; $param['where'] = " m.play = 1 and m.fid = '{$uid}' "; $param['order'] = " order by a.lasttime desc,a.app_num desc,a.posttime desc "; $param['page_url'] = $options['page_url']; $return = jlogic('event')->getEvents($param); } else { if ($filter == 'new_update') { jlogic('member')->clean_new_remind('event_new', $uid); $this->Title = "最近更新的活动"; $param['uid'] = $uid; $param['page_url'] = $options['page_url']; $return = jlogic('event')->getNewEvent($param); } else { $filter = 'created'; $this->Title = $member['nickname'] . "的活动"; $param['where'] = " a.postman = '{$uid}' and a.verify = 1 "; $param['order'] = " order by a.lasttime desc,a.app_num desc,a.posttime desc "; $param['page_url'] = $options['page_url']; $return = jlogic('event')->getEventInfo($param); } } $rs = $return['event_list']; $count = $return['count']; $page_arr = $return['page']; $topic_list_get = true; } if ('my_reply' == $this->Get['type']) { $title = $member['gender_ta'] . '评论的'; if ($member['uid'] != MEMBER_ID) { $this->Messager("您无权查看该页面", null); } } if ('mydig' == $this->Get['type']) { if ($member['dig_new']) { jlogic('member')->clean_new_remind('dig_new', $member['uid']); } } if (in_array($this->Get['type'], array('pic', 'video', 'music', 'attach', 'mydig', 'mydigout', 'my_reply'))) { if ($this->Get['follow'] && 'my_reply' != $this->Get['type']) { $buddyids = get_buddyids($params['uid'], $this->Config['topic_myhome_time_limit']); if ($buddyids) { $options['uid'] = $buddyids; } } $type = $dtype = $this->Get['type']; $options['get_list'] = 1; $getTypeTidReturn = $TopicListLogic->GetTypeTid($dtype, $options['uid'], $options); if (isset($getTypeTidReturn['list'])) { $topic_list = $getTypeTidReturn['list']; $total_record = $getTypeTidReturn['count']; $page_arr = $getTypeTidReturn['page']; $topic_list_get = true; } else { $options['tid'] = $getTypeTidReturn['tid']; $options['count'] = $getTypeTidReturn['count']; $options['limit'] = $per_page_num; if ($type == 'mydigout') { $options['uid'] = array(); } if ($type == 'mydig' || $type == 'mydigout') { $options['order'] = ' lastdigtime DESC '; } } } if ('forward' == $this->Get['type'] || 'first' == $this->Get['type']) { $p = $options; $p['type'] = 'forward'; if ('first' == $this->Get['type']) { $p['type'] = 'first'; } $p['sql_order'] = ' `forwards` DESC, `dateline` DESC '; if (!$p['sql_order']) { $p['sql_order'] = ' `dateline` DESC '; } $_rets = jtable('member_topic')->get_tids($member['uid'], $p, 1); $total_record = $_rets['count']; $page_arr = $_rets['page']; $topic_list = $this->TopicLogic->Get($_rets['ids']); $topic_list_get = true; } if ('my_verify' == $this->Get['type']) { $title = '审核中的微博'; if ('admin' != MEMBER_ROLE_TYPE) { if ($member['uid'] != MEMBER_ID) { $this->Messager("您无权查看该页面", -1); } } $sql = "select count(*) as `total_record` from `" . TABLE_PREFIX . "topic_verify` where managetype = 0"; $total_record = DB::result_first($sql); $page_arr = page($total_record, $per_page_num, $query_link, array('return' => "Array")); $sql = "select v.*\r\n\t\t\t\t\t\t\tfrom `" . TABLE_PREFIX . "topic_verify` v\r\n\r\n\t\t\t\t\t\t\twhere v.uid='{$uid}'\r\n\t\t\t\t\t\t\tand v.managetype = 0\r\n\t\t\t\t\t\t\torder by v.lastupdate desc {$page_arr['limit']}"; $query = $this->DatabaseHandler->Query($sql); while (false != ($row = $query->GetRow())) { if ($row['id'] < 1) { continue; } $row['tid'] = $row['id']; if ($row['longtextid']) { $row['content'] = jlogic('longtext')->longtext($row['longtextid']); unset($row['content2'], $row['longtextid']); } $topic_list[$row['id']] = $row; } $topic_list = $this->TopicLogic->MakeAll($topic_list); $topic_list_get = true; } } if ($this->Config['channel_enable']) { $myBuddyChannel = jlogic('channel')->mychannel($member['uid']); } $dateline = TIMESTAMP - 2592000; if (empty($this->Get['type']) || in_array($this->Get['type'], array('hot_reply', 'hot_forward', 'hot_dig'))) { $p = $options; $p['type'] = array('first', 'forward', 'both'); if ($this->Get['type']) { if ('hot_reply' == $this->Get['type']) { $p['>@replys'] = 0; $p['>@dateline'] = $dateline; $p['sql_order'] = ' `replys` DESC, `dateline` DESC '; } elseif ('hot_forward' == $this->Get['type']) { $p['>@forwards'] = 0; $p['>@dateline'] = $dateline; $p['sql_order'] = ' `forwards` DESC, `dateline` DESC '; } elseif ('hot_dig' == $this->Get['type']) { $p['>@digcounts'] = 0; $p['>@dateline'] = $dateline; $p['sql_order'] = ' `digcounts` DESC, `dateline` DESC '; } } if (!$p['sql_order']) { $p['sql_order'] = ' `dateline` DESC '; } $_rets = jtable('member_topic')->get_tids($member['uid'], $p, 1); $total_record = $_rets['count']; $page_arr = $_rets['page']; $topic_list = $this->TopicLogic->Get($_rets['ids']); $topic_list_get = true; $credit = jconf::get('credits'); foreach ($credit['ext'] as $key => $value) { $member['jifen'] .= $value['name'] . ':' . $member[$key] . ' '; } $title = '个人主页'; foreach ($topic_list as $key => $val) { if ($val[uid] == 0 && $val['anonymous_data'][uid] != MEMBER_ID) { unset($topic_list[$key]); } } } elseif ($this->Get['type'] == 'search' && trim($this->Get['q'])) { $_rets = jtable('topic')->get_ids(array('uid' => $member['uid'], 'like@content' => '%' . trim(jget('q')) . '%', 'sql_order' => '`dateline` desc', 'page_num' => 10), 'tid', 1); $total_record = $_rets['count']; $page_arr = $_rets['page']; $topic_list = $this->TopicLogic->Get($_rets['ids']); $topic_list_get = true; } if ($member['uid'] != MEMBER_ID) { $title = "{$member['nickname']}的微博"; $list_blacklist = is_blacklist($member['uid'], MEMBER_ID); $fg_code = 'hisblog'; $this->_initTheme($member); } else { $title = '我的微博'; $this->MetaKeywords = "{$member['nickname']}的微博"; } $buddys = array(); if (MEMBER_ID > 0 && $member['uid'] != MEMBER_ID) { $buddys = jlogic('buddy')->info($member['uid'], MEMBER_ID); $buddys['id'] = $buddys['touid']; } } else { if ('qun' == $params['code']) { $tpl = 'topic_qun'; $title = "我的" . $this->Config[changeword][weiqun]; $qun_setting = $this->Config['qun_setting']; if (!$qun_setting['qun_open']) { $this->Messager("当前站点没有开放" . $this->Config[changeword][weiqun] . "功能", null); } if (0 != $GLOBALS['_J']['member']['qun_new']) { jlogic('member')->clean_new_remind('qun_new', MEMBER_ID); } $views = array('new', 'new_reply', 'my_reply', 'recd'); $view = trim($this->Get['view']); if (!in_array($view, $views)) { $view = 'new'; } $active[$view] = "current"; $u = MEMBER_ID; if (false === ($my_qun_ids = cache_db('get', $cache_id = 'topic/' . $u . '-my_qun_ids'))) { $my_qun_ids = jtable('qun_user')->get_ids(array('uid' => $u), 'qid', 1); cache_db('set', $cache_id, $my_qun_ids, 300); } $qid_ary = $my_qun_ids['ids']; $join_qun_count = $my_qun_ids['count']; $qun_name = ''; if (!empty($qid_ary) && $join_qun_count > 0) { $where_sql = " 1 "; $order_sql = " t.dateline DESC "; $jget_type = jget('type', 'txt'); $jget_type = in_array($type, array('pic', 'video', 'music', 'vote')) ? $jget_type : ''; if ($jget_type) { if ('pic' == $jget_type) { $where_sql .= " AND t.`imageid` > 0 "; } else { if ('video' == $jget_type) { $where_sql .= " AND t.`videoid` > 0 "; } else { if ('music' == $jget_type) { $where_sql .= " AND t.`musicid` > 0 "; } else { if ('vote' == $jget_type) { $where_sql .= " AND t.item='vote' "; } else { $jget_type = ''; } } } } } $topic_get_flg = false; if ($view == 'new') { $where_sql .= " AND tq.item_id IN(" . jimplode($qid_ary) . ") "; } else { if ($view == 'new_reply') { $where_sql .= " AND tq.item_id IN(" . jimplode($qid_ary) . ") AND t.replys>0 "; $order_sql = " t.lastupdate DESC "; } else { if ($view == 'recd') { $p = array('where' => " tr.recd >= 1 AND tr.item='qun' AND tr.item_id IN(" . jimplode($qid_ary) . ") ", 'perpage' => $options['perpage'], 'filter' => $this->Get['type']); $info = $TopicListLogic->get_recd_list($p); if (!empty($info)) { $total_record = $info['count']; $topic_list = $info['list']; $page_arr = $info['page']; } $topic_get_flg = true; } } } if (!$topic_get_flg) { $total_record = DB::result_first("SELECT COUNT(*)\r\n\t\t\t\t\t\t\t\t\t\t\t FROM " . DB::table('topic') . " AS t\r\n\t\t\t\t\t\t\t\t\t\t\t LEFT JOIN " . DB::table('topic_qun') . " AS tq\r\n\t\t\t\t\t\t\t\t\t\t\t USING(tid)\r\n\t\t\t\t\t\t\t\t\t\t\t WHERE {$where_sql}"); if ($total_record > 0) { $page_arr = page($total_record, $options['perpage'], $options['page_url'], array('return' => 'array')); $query = DB::query("SELECT t.*\r\n\t\t\t\t\t\t\t\t\t\t\tFROM " . DB::table('topic') . " AS t\r\n\t\t\t\t\t\t\t\t\t\t\tLEFT JOIN " . DB::table('topic_qun') . " AS tq\r\n\t\t\t\t\t\t\t\t\t\t\tUSING(tid)\r\n\t\t\t\t\t\t\t\t\t\t\tWHERE {$where_sql}\r\n\t\t\t\t\t\t\t\t\t\t\tORDER BY {$order_sql}\r\n\t\t\t\t\t\t\t\t\t\t\t{$page_arr['limit']} "); $topic_list = array(); while ($row = DB::fetch($query)) { $topic_list[$row['tid']] = $row; } $topic_list = $this->TopicLogic->MakeAll($topic_list); } } if (0 != $GLOBALS['_J']['member']['qun_new']) { jlogic('member')->clean_new_remind('qun_new', MEMBER_ID); } } $showConfig = $this->ShowConfig; $recd_qun_limit = (int) $showConfig['page_r']['recd_qun']; if ($recd_qun_limit) { $cache_id = 'topic/hot_qun-' . $recd_qun_limit; if (false === ($hot_qun = cache_file('get', $cache_id))) { $sql = "select * from `" . TABLE_PREFIX . "qun` where `recd` = 1 order by `member_num` desc limit {$recd_qun_limit} "; $query = $this->DatabaseHandler->Query($sql); $hot_qun = array(); $qunLogic = jlogic('qun'); while (false != ($row = $query->GetRow())) { $row['icon'] = $qunLogic->qun_avatar($row['qid'], 's'); $hot_qun[] = $row; } cache_file('set', $cache_id, $hot_qun, 3600); } } $topic_list_get = true; } else { if ('recd' == $params['code']) { $title = "官方推荐"; $view = trim($this->Get['view']); $where_sql = ''; if ($view == 'new_reply') { $where_sql = ' AND t.replys>0 '; } else { $view = 'all'; } $active[$view] = 'current'; $p = array('where' => ' tr.recd > 0 ' . $where_sql, 'perpage' => $options['perpage'], 'filter' => $this->Get['type']); $info = $TopicListLogic->get_recd_list($p); if (!empty($info)) { $total_record = $info['count']; $topic_list = $info['list']; $page_arr = $info['page']; } $topic_list_get = true; } else { if ('cms' == $params['code']) { $title = "网站资讯"; $param = array('perpage' => $options['perpage'], 'page_url' => $options['page_url']); $view = 'all'; $active[$view] = 'current'; $info = array(); if ($this->Config['dedecms_enable'] && jconf::get('dedecms')) { Load::logic("topic_cms"); $TopicCmsLogic = new TopicCmsLogic(); $info = $TopicCmsLogic->get_cms($param); $cms_url = CMS_API_URL; } if (!empty($info)) { $total_record = $info['count']; $topic_list = $info['list']; $page_arr = $info['page']; } $topic_list_get = true; } else { if ('bbs' == $params['code']) { $title = "我的论坛"; $view = trim($this->Get['view']); $where_sql = ''; if ($view == 'favorites') { $where_sql = 'favorites'; } else { if ($view == 'favorite') { $where_sql = 'favorite'; } else { if ($view == 'thread') { $where_sql = 'thread'; } else { if ($view == 'reply') { $where_sql = 'reply'; } else { if ($view == 'all') { $where_sql = 'all'; } else { if ($this->Config['dzbbs_enable']) { $view = 'favorites'; $where_sql = 'favorites'; } else { $view = 'all'; $where_sql = 'all'; } } } } } } $active[$view] = 'current'; $info = array(); $param = array('where' => $where_sql, 'perpage' => $options['perpage'], 'page_url' => $options['page_url']); if ($this->Config['dzbbs_enable'] && jconf::get('dzbbs') || $this->Config['phpwind_enable'] && $this->Config['pwbbs_enable'] && jconf::get('phpwind')) { Load::logic("topic_bbs"); $TopicBbsLogic = new TopicBbsLogic(); $info = $TopicBbsLogic->get_bbs($param); $bbs_url = BBS_API_URL; } if (!empty($info)) { $total_record = $info['count']; $topic_list = $info['list']; $page_arr = $info['page']; } $topic_list_get = true; } else { if ('topicnew' == $params['code']) { $title = '最新内容'; $options['where'] = ''; $params['orderby'] = $orderby = in_array($this->Get['orderby'], array('post', 'dig', 'mark')) ? $this->Get['orderby'] : 'dig'; if ($orderby == 'mark') { $order = ' `lastupdate` DESC'; } elseif ($orderby == 'dig') { $order = ' `lastdigtime` DESC'; } else { $options['type'] = array('first', 'forward', 'both'); $order = ' `dateline` DESC'; } $options['order'] = $order; if ($this->Get["date"] && strtotime($this->Get["date"]) > 0) { $dateline = strtotime($this->Get["date"]); $options['where'] .= " `dateline` > '" . $dateline . "' and `dateline`<'" . ($dateline + 86400) . "'"; } else { $this->Get["date"] = date("Y-m-d", TIMESTAMP); } if (empty($options['type'])) { $options['type'] = get_topic_type(); } } } } } } } } } } } } } if (!$topic_list_get) { if ($cache_time > 0 && !$options['tid']) { $cache_key = $cache_key ? $cache_key : "{$member['uid']}-topic-{$params['code']}-{$params['type']}-{$params['gid']}-{$params['qid']}-{$params['view']}"; $options = $TopicListLogic->get_options($options, $cache_time, $cache_key); } $info = $TopicListLogic->get_data($options); $topic_list = array(); $total_record = 0; if (!empty($info)) { $topic_list = $info['list']; $total_record = $info['count']; if ($info['page']) { $page_arr = $info['page']; } else { $page_arr = $getTypeTidReturn['page']; } } } $topic_list_count = 0; if ($topic_list) { if ($GLOBALS['_J']['config']['is_topic_user_follow'] && !$GLOBALS['_J']['disable_user_follow']) { $topic_list = jlogic('buddy')->follow_html2($topic_list); } $topic_list_count = count($topic_list); if (!$topic_parent_disable && ('bbs' != $this->Code || 'cms' != $this->Code)) { $parent_list = $this->TopicLogic->GetParentTopic($topic_list, 'mycomment' == $this->Code); } $relate_list = $this->TopicLogic->GetRelateTopic($topic_list); } if (!in_array($params['code'], array('bbs', 'cms'))) { $ajaxkey = array(); $ajaxnum = 10; if (count($topic_list) > $ajaxnum) { $topic_keys = array_keys($topic_list); $topic_list = array_slice($topic_list, 0, $ajaxnum); array_splice($topic_keys, 0, $ajaxnum); $num = ceil(count($topic_keys) / $ajaxnum); for ($i = 0; $i < $num; $i++) { if (count($topic_keys) > $ajaxnum) { $topic_key = array_splice($topic_keys, 0, $ajaxnum); } else { $topic_key = $topic_keys; } $ajaxkey[] = base64_encode(serialize($topic_key)); } $isloading = true; } } $group_list = $grouplist2 = array(); $group_list = $this->_myGroup($member['uid']); $cut_num = 5; if ($group_list) { $group_count = count($group_list); if ($group_count > $cut_num) { $grouplist2 = array_slice($group_list, 0, $cut_num); $grouplist_more = array_slice($group_list, $cut_num); foreach ($grouplist_more as $key => $value) { if ($value['id'] == $gid) { $tmp = $grouplist2[$cut_num - 1]; $grouplist2[$cut_num - 1] = $value; $grouplist_more[] = $tmp; unset($grouplist_more[$key]); break; } } $group_list = $grouplist_more; } else { $grouplist2 = $group_list; $group_list = array(); } } if (!$this->Config['acceleration_mode']) { $member_medal = $my_member ? $my_member : $member; if ($member_medal['medal_id']) { $medal_list = $this->_Medal($member_medal['medal_id'], $member_medal['uid']); } } $exp_return = user_exp($member_medal['level'], $member_medal['credits']); if ($exp_return['exp_width'] >= 1) { $exp_width = $exp_return['exp_width']; } else { $exp_width = 0; } $nex_exp_credit = $exp_return['nex_exp_credit']; $nex_level = $exp_return['nex_exp_level']; $this->Title || ($this->Title = $title); $tpl = $tpl ? $tpl : 'topic_index'; if (in_array($tpl, array('topic_index', 'topic_myhome'))) { $tid = jlogic('buddy')->check_new_recd_topic(MEMBER_ID); if ($tid && $topic_list) { foreach ($topic_list as $key => $val) { if ($tid == $val['tid']) { unset($topic_list[$key]); } } } } $albums = jlogic('image')->getalbum(); include template($tpl); }
function followme_nums($qid, $uid = MEMBER_ID) { $num = 0; $qid = (int) $qid; $uid = (int) $uid; if ($qid > 0 && $uid > 0 && false === ($num = cache_db('mget', $cache_id = "qun/{$qid}/{$uid}-followme_nums"))) { $num = DB::result_first("SELECT COUNT(1) AS `count`\r\nFROM " . DB::table("qun_user") . " QU\r\n LEFT JOIN " . DB::table(jtable('buddy_follow')->table_name($uid)) . " BF\r\n ON QU.uid = BF.touid\r\nWHERE QU.qid = '{$qid}'\r\n AND BF.uid = '{$uid}'"); cache_db('mset', $cache_id, $num, 300); } return $num; }
function cache_rm($id, $is_key = 0) { $key = $is_key ? $id : $this->_cache_key($id); if ($key) { cache_db('mrm', $key); cache_file('rm', 'table_cache/' . $key); } }
function _rm_my_cache($uid) { cache_db('rm', 'my_tag_favorite/' . $uid . '-%', 1); cache_db('rm', 'my_favorite_tag_ids/' . $uid . '-%', 1); }