function TagSearch() { $per_page_num = 10; $topic_parent_disable = false; $query_link = 'index.php?mod=search&code=tag'; $tag = trim(get_param('tag')); if ($tag) { $tag = get_safe_code($tag); $tag = $this->_filterKeyword($tag); $search_keyword = $tag; $_GET['highlight'] = $search_keyword; $cache_time = 600; $cache_key = "tag-search-{$tag}"; if (false === ($topic_ids = cache_db('mget', $cache_key))) { $sql = "select `id` from `" . TABLE_PREFIX . "tag` WHERE " . build_like_query('`name`', $tag) . " ORDER BY `last_post` DESC LIMIT {$this->cache_ids_limit} "; $query = $this->DatabaseHandler->Query($sql); $tag_id = array(); while (false != ($row = $query->GetRow())) { $tag_id[$row['id']] = $row['id']; } $topic_ids = array(); if ($tag_id) { $sql = "SELECT `item_id` FROM `" . TABLE_PREFIX . "topic_tag` WHERE `tag_id` in(" . jimplode($tag_id) . ") ORDER BY `item_id` DESC LIMIT {$this->cache_ids_limit} "; $query = $this->DatabaseHandler->Query($sql); while (false != ($row = $query->GetRow())) { $topic_ids[$row['item_id']] = $row['item_id']; } } cache_db('mset', $cache_key, $topic_ids, $cache_time); } $topic_ids = filter_tids($topic_ids); if ($topic_ids) { $where = " `tid` in('" . implode("','", $topic_ids) . "') "; } $query_link .= "&tag=" . urlencode($tag); } if ($where) { $options = array('where' => $where, 'type' => get_topic_type(), 'order' => ' `dateline` desc ', 'page_url' => $query_link, 'perpage' => $per_page_num); $info = $this->TopicListLogic->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); } } } $member = jsg_member_info(MEMBER_ID); if ($member['medal_id']) { $medal_list = $this->TopicLogic->GetMedal($member['medal_id'], $member['uid']); } $this->Title = "话题搜索"; include template('social/search_list'); }
) <?php } else { ?> <?php } ?> </a></span></li> <li class="o_line_l">|</li> <?php } ?> <?php if (!isset($root_type) || isset($root_type) && in_array($root_type, get_topic_type('forward'))) { ?> <li> <?php if ((in_array($val['type'], get_topic_type('forward')) || $this->Module == 'qun') && !($val['managetype'] == 2 || $val['managetype'] == 8)) { ?> <?php $not_allow_forward = 0; ?> <span <?php if (MEMBER_ID < 1) { ?> onclick="ShowLoginDialog();" <?php } ?> > <a href="javascript:void(0);" onclick="get_forward_choose(<?php echo $val['tid']; ?>
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 ? "&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'); }
function search($param) { $max_tid = intval($param['max_tid']); $perpage = intval($param['perpage']); if (isset($param['topic_parent_disable'])) { $topic_parent_disable = (bool) $param['topic_parent_disable']; } else { $topic_parent_disable = false; } $topic_list_get = false; $options = array(); if ($perpage > 0) { $options['perpage'] = $perpage; } $limit = intval($param['limit']); if ($limit > 0) { $options['limit'] = $limit; } $keyword = trim($param['q']); $keyword = get_safe_code($keyword); if ($keyword) { $search_keyword = $keyword; $_GET['highlight'] = $search_keyword; $where_list['keyword'] = build_like_query('`content`,`content2`', $keyword); } if ($where_list) { $where = empty($where_list) ? '' : ' ' . implode(' AND ', $where_list) . ' '; $options = array('where' => $where, 'type' => get_topic_type(), 'order' => ' `dateline` desc ', 'limit' => $limit); if ($max_tid > 0) { $where = " tid<'{$max_tid}' "; if (empty($options['where'])) { $options['where'] = $where; } else { $options['where'] .= " AND " . $where; } } $info = $this->TopicListLogic->get_data($options); $topic_list = array(); $total_record = 0; if (!empty($info)) { $topic_list = $info['list']; $topic_list = array_values($topic_list); $total_record = $info['count']; $page_arr = $info['page']; } $topic_list_count = 0; if ($topic_list) { $topic_list_count = count($topic_list); if (!$topic_parent_disable) { $parent_list = $this->TopicLogic->GetParentTopic($topic_list); } $tmp_ary = $topic_list; $tmp_topic = array_pop($tmp_ary); $max_tid = $tmp_topic['tid']; $result = array('total_record' => $total_record, 'topic_list' => $topic_list, 'parent_list' => $parent_list, 'max_tid' => $max_tid, 'next_page' => 0); if (!empty($page_arr)) { $result['next_page'] = $page_arr['current_page'] + 1; } return $result; } } return 400; }
function Hot() { $title = '广场'; $uid = MEMBER_ID; $member = $this->_member($uid); $per_page_num = $this->ShowConfig['topic_new']['topic']; if ($per_page_num < 1) { $per_page_num = 20; } $cache_time = max(0, (int) $this->CacheConfig['topic_new']["topic"]); $query_link = "index.php?mod=" . ($_GET['mod_original'] ? get_safe_code($_GET['mod_original']) : $this->Module) . ($this->Code ? "&code={$this->Code}" : ""); if ($per_page_num > 0) { $options = array('cache_time' => $cache_time, 'cache_key' => 'topic-newtopic-wap', 'page_url' => $query_link, 'perpage' => $per_page_num, 'order' => " dateline DESC ", 'type' => get_topic_type()); if ($this->Get['type'] == 'recd') { $hb_type = 'recd'; $info = jlogic('topic_list')->get_recd_list($options, 'wap'); } else { $hb_type = 'topic_new'; if ($this->Config['only_show_vip_topic']) { $title = '最新V博'; $options['uid'] = jsg_get_vip_uids(); if ($options['uid']) { $info = jlogic('topic_list')->get_data($options, 'wap'); } else { $info = array(); } } else { $info = jlogic('topic_list')->get_data($options, 'wap'); } } $topics = array(); $total_record = 0; if (!empty($info)) { $topics = wap_iconv($info['list']); $total_record = $info['count']; $page_arr = $info['page']; } } $parent_id_list = array(); if ($topics) { foreach ($topics 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; } } } if ($parent_id_list) { $parent_list = $this->_topicLogicGet($parent_id_list); } $topic_new_hb = 'hb'; $this->Title = $title; include template('topic_new'); }
function get_data($param, $caller = "web") { $cache_time = max(0, (int) $param['cache_time']); if ($cache_time) { $cache_key = $param['cache_key'] ? $param['cache_key'] : 'topic-list-get-data-' . md5(serialize($param)) . "-{$caller}"; } $where = $order = ""; $tids = $uids = $usernames = $roottids = $totids = $touids = $tousernames = $types = $item_ids = array(); $tids = $this->_process_param($param['tid']); $uids = $this->_process_param($param['uid']); $content = trim($param['content']); $content2 = trim($param['content2']); $kw_content = trim($param['kw_content']); $filter = trim($param['filter']); $roottids = $this->_process_param($param['roottid']); $dateline = isset($param['dateline']) ? intval($param['dateline']) : 0; $lastupdate = isset($param['lastupdate']) ? intval($param['lastupdate']) : 0; $from = trim($param['from']); $types = $this->_process_param($param['type']); $item_ids = $this->_process_param($param['item_id']); $item = trim($param['item']); $sys_def_uid_flg = false; $param['my_uid'] = intval($param['my_uid']); $my_uid = $param['my_uid']; $perm_sql = ''; if (empty($types)) { if (!empty($uids)) { $public_con = get_topic_type(); $perm_sql .= " uid IN(" . jimplode($uids) . ") AND `type` IN(" . jimplode($public_con) . ") "; } } else { $perm_sql = " `type` IN(" . jimplode($types) . ") "; if (!empty($uids) && !$sys_def_uid_flg) { $perm_sql .= " AND uid IN(" . jimplode($uids) . ") "; } } $filter_sql = $this->filter($filter); $where_sql = ($perm_sql ? " AND {$perm_sql} " : '') . (isset($param['tid']) ? ' AND `tid` IN (' . jimplode($tids) . ') ' : '') . ($roottids ? ' AND roottid IN (' . jimplode($roottids) . ') ' : '') . ($from ? " AND `from`='{$from}' " : '') . ($item_ids ? " AND `item_id` IN (" . jimplode($item_ids) . ") " : '') . ($item ? " AND `item`='{$item}' " : '') . ($content ? " AND `content`='{$content}' " : '') . ($content2 ? " AND `content2`='{$content2}' " : '') . ($filter_sql ? ' and ' . $filter_sql : ''); if ($dateline) { $where_sql .= " AND `dateline`>{$dateline} "; } if ($lastupdate) { $where_sql .= " AND `lastupdate`>{$lastupdate} "; } if ($kw_content) { $where_sql .= " AND `tid` IN (" . jimplode($this->get_tids_by_keyword($kw_content)) . ") "; } if (!empty($param['where'])) { $where_sql .= " AND {$param['where']} "; } if (!empty($param['order'])) { $order = " ORDER BY {$param['order']} "; } else { $order = " ORDER BY `dateline` DESC "; } $where_sql = " WHERE 1 {$where_sql} "; $total_record = max(0, (int) $param['count']); if ($total_record < 1) { if (!$cache_time || false === ($total_record = cache_db('mget', $cache_key . '-total_record'))) { $table = isset($param['table']) ? $param['table'] : 'topic'; $sql = " select count(*) from " . DB::table($table) . " {$where_sql} "; $total_record = DB::result_first($sql); if ($cache_time) { cache_db('mset', $cache_key . '-total_record', $total_record, $cache_time); } } } #if NEDU if (defined('NEDU_MOYO')) { if ($param['@nedu~get~count'] == 921) { return (int) $total_record; } } #endif if ($total_record > 0) { $limit_sql = ''; if ($param['perpage'] && (!$param['count'] || $param['page_force'])) { if ($caller == 'web') { $page_arr = page($total_record, $param['perpage'], $param['page_url'], array('return' => 'array', 'extra' => $param['page_extra'])); } else { if ($caller == "wap") { $page_arr = wap_page($total_record, $param['perpage'], $param['page_url'], array('return' => 'array')); } } $limit_sql = $page_arr['limit']; } else { if (!empty($param['limit'])) { if (strpos(strtolower($param['limit']), 'limit') !== false) { $limit_sql = " {$param['limit']} "; } else { $limit_sql = " LIMIT {$param['limit']} "; } } elseif ($param['count']) { $limit_sql = " LIMIT {$total_record} "; } } $condition = " {$where_sql} {$order} {$limit_sql} "; $fields = isset($param['fields']) ? $param['fields'] : ' * '; $table = isset($param['table']) ? $param['table'] : ''; $proc_func = isset($param['proc_func']) ? trim($param['proc_func']) : 'Make'; if (!$cache_time || false === ($topic_list = cache_db('mget', $cache_key . '-topic_list-' . $limit_sql))) { if (!$table && !isset($param['fields']) && isset($param['tid']) && ($param['page'] || $param['count'])) { $topic_list = $this->TopicLogic->Get($tids); } else { $topic_list = $this->TopicLogic->Get($condition, $fields, $proc_func, $table); } if (empty($topic_list)) { return false; } if ($cache_time) { cache_db('mset', $cache_key . '-topic_list-' . $limit_sql, $topic_list, $cache_time); } } if ($GLOBALS['_J']['config']['is_topic_user_follow'] && !$GLOBALS['_J']['disable_user_follow']) { $topic_list = buddy_follow_html($topic_list, 'uid', 'wap' == $caller ? 'wap_follow_html' : 'follow_html2'); } $list = array('list' => $topic_list, 'count' => $total_record); $list['page'] = $page_arr ? $page_arr : $param['page']; return $list; } return false; }
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); }
public function new_tc($p) { $member = jsg_member_info(MEMBER_ID); $province_id = max(0, (int) $p['province_id']); $city_id = max(0, (int) $p['city_id']); $area_id = max(0, (int) $p['area_id']); if ($province_id < 1) { if ($province = $member['province']) { $province_id = jlogic('common_district')->get_id_by_name($province); if ($province_id > 0 && ($city = $member['city'])) { $city_id = jlogic('common_district')->get_id_by_name($city); if ($city_id > 0) { $area = $member['area']; } } } } else { $province = jlogic('common_district')->get_name_by_id($province_id); if ($province && $city_id > 0) { $city = jlogic('common_district')->get_name_by_id($city_id); if ($city && $area_id > 0) { $area = jlogic('common_district')->get_name_by_id($area_id); } } } $ps = array('cache_time' => max(0, (int) $p['cache_time']), 'cache_key' => 'topic-new_tc-' . "{$province}-{$city}-{$area}", 'page_url' => $p['page_url'], 'province' => $province, 'city' => $city, 'area' => $area, 'type' => get_topic_type(), 'vip' => $GLOBALS['_J']['config']['only_show_vip_topic']); if (isset($p['perpage'])) { $ps['perpage'] = (int) $p['perpage']; if ($ps['perpage'] < 1) { $ps['perpage'] = 20; } } $rets = jlogic('topic_list')->get_tc_data($ps); if (is_array($rets)) { $rets['province'] = $province; $rets['city'] = $city; $rets['area'] = $area; $rets['province_id'] = $province_id; $rets['city_id'] = $city_id; $rets['area_id'] = $area_id; if ($member) { $rets['member'] = $member; } if ($rets['list']) { $rets['parent_list'] = jlogic('topic')->get_parent_list($rets['list']); $rets['relate_list'] = jlogic('topic')->get_relate_list($rets['list']); if ($GLOBALS['_J']['plugins']['func']['printtopic']) { foreach ($rets['list'] as $row) { jlogic('plugin')->hookscript('printtopic', 'funcs', $row, 'printtopic'); } } } } return $rets; }
function normalIndex() { if (MEMBER_ID > 0) { $member = jsg_member_info(MEMBER_ID); if ($member) { header('Location: index.php?mod=topic'); exit; } } $username = jget('username') ? jget('username') : (jget('email') ? jget('email') : $this->Config['changeword']['username']); $this->ShowConfig = jconf::get('show'); $this->CacheConfig = jconf::get('cache'); $limit = $this->ShowConfig['topic_index']['guanzhu']; if ($limit > 0) { $cache_id = "index/r_users"; if (false === ($r_users = cache_file('get', $cache_id))) { $r_users = jlogic('topic')->GetMember("where face !='' order by `fans_count` desc limit {$limit}", "`uid`,`ucuid`,`username`,`face_url`,`face`,`fans_count`,`validate`,`validate_category`,`nickname`"); cache_file('set', $cache_id, $r_users, $this->CacheConfig['topic_index']['guanzhu']); } } $day2_r_users = jlogic('member')->get_member_by_topic($this->ShowConfig['topic_index']['new_user'], $this->CacheConfig['topic_index']['new_user']); $r_tags = $this->_recommendTag(2, $this->ShowConfig['topic_index']['hot_tag'], $this->CacheConfig['topic_index']['hot_tag']); $recommend_count = 0; if ($this->ShowConfig['topic_index']['recommend_topic']) { $cache_id = "index/recommend_topics"; if (false === ($cache_recommend_topics = cache_file('get', $cache_id))) { $TopicListLogic = jlogic('topic_list'); $type_sql = jimplode(get_topic_type()); $fields = " a.* "; $vip_t = $vip_w = ''; if ($this->Config['only_show_vip_topic']) { $vip_t = ', ' . DB::table('members') . ' m '; $vip_w = ' and m.uid=a.uid and m.validate="1" '; } $table = " " . DB::table("topic") . " a,(SELECT uid, max(dateline) max_dateline FROM " . DB::table("topic") . " WHERE type IN(" . $type_sql . ") GROUP BY uid) b {$vip_t} "; $where = " WHERE a.uid = b.uid AND a.dateline = b.max_dateline AND a.type IN({$type_sql}) {$vip_w} ORDER BY a.dateline DESC LIMIT {$this->ShowConfig['topic_index']['recommend_topic']}"; $recommend_topics = jlogic('topic')->Get($where, $fields, 'Make', $table); $parent_list = jlogic('topic')->GetParentTopic($recommend_topics); $cache_recommend_topics = array('recommend_topics' => $recommend_topics, 'parent_list' => $parent_list); cache_file('set', $cache_id, $cache_recommend_topics, $this->CacheConfig['topic_index']['recommend_topic']); } else { $recommend_topics = $cache_recommend_topics['recommend_topics']; $parent_list = $cache_recommend_topics['parent_list']; } $recommend_count = count($recommend_topics); } include template('login/login_index'); }
function View() { $params = array(); $content_dstr = $this->Config['in_publish_notice_str']; $content_ostr = $this->Config['on_publish_notice_str']; $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']; $tag_count = $tag_info['tag_count']; $TopicLogic = jlogic('topic'); Load::logic("topic_list"); $TopicListLogic = new TopicListLogic(); $params['tag_id'] = $tag_id; $this->Get['type'] = in_array($this->Get['type'], array('pic', 'video', 'music')) ? $this->Get['type'] : ''; $gets = array('mod' => $_GET['mod_original'] ? get_safe_code($_GET['mod_original']) : $this->Module, 'code' => $this->Code ? $tag : "", 'type' => $this->Get['type'], 'view' => $this->Get['view']); $query_link = "index.php?" . url_implode($gets); unset($gets['type']); $type_url = "index.php?" . url_implode($gets); $per_page_num = max(0, (int) $this->ShowConfig['tag_view']['tag']); $options = array('type' => get_topic_type(), 'filter' => $this->Get['type']); $view = trim($this->Get['view']); if ($tag_id > 0 && $per_page_num > 0) { if ($view == 'recd') { $p = array('where' => " tr.recd <= 2 AND tr.item='tag' AND tr.item_id='{$tag_id}' ", 'perpage' => $per_page_num, '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']; } } else { if (empty($this->Get['type'])) { $rets = jtable('topic_tag')->get_ids(array('tag_id' => $tag_id, 'sql_order' => ' `item_id` DESC ', 'result_count' => $total_record, 'per_page_num' => $per_page_num, 'page_url' => $query_link), 'item_id', 1); $total_record = $rets['count']; $page_arr = $rets['page']; $topic_list = $total_record > 0 && $rets['ids'] ? $TopicLogic->Get($rets['ids']) : array(); } else { $sql = "select `item_id` from `" . TABLE_PREFIX . "topic_tag` where `tag_id`='{$tag_id}' 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; $options['filter'] = trim($this->Get['type']); $options['page_url'] = $query_link; $options['perpage'] = $per_page_num; $info = $TopicListLogic->get_data($options); $topic_list = array(); if (!empty($info)) { $topic_list = $info['list']; if (isset($info['page'])) { $page_arr = $info['page']; $total_record = $info['count']; } } } } if ($topic_list) { $parent_list = $TopicLogic->GetParentTopic($topic_list); } } if (!$topic_list) { $total_record = 0; } $show_config = jconf::get('show'); $day1_r_tags = cache_file('get', "misc/recommendTopicTag-1-{$show_config['topic_index']['hot_tag']}"); $day7_r_tags = cache_file('get', "misc/recommendTopicTag-7-{$show_config['topic_index']['hot_tag']}"); $is_favorite = false; if ($tag_info) { if (MEMBER_ID > 0) { $is_favorite = jlogic('tag_favorite')->info($tag, MEMBER_ID); } $tag_favorite_count = jtable('tag_favorite')->count(array('tag' => $tag)); if ($tag_favorite_count > 0) { $tag_favorite_list = jlogic('tag_favorite')->favorite_users($tag, 12); } } $my_favorite_tags = jlogic('tag_favorite')->my_favorite(MEMBER_ID, 12); $tag_extra = array(); if ($tag_info && $tag_info['extra']) { Load::logic('tag_extra'); $TagExtraLogic = new TagExtraLogic(); $tag_extra_info = $TagExtraLogic->get_info($tag_info['id']); $tag_extra = $tag_extra_info['data']; } $_GET['searchKeyword'] = $this->Title = $tag; $this->MetaKeywords = $tag; $content = "#{$tag}#"; if (MEMBER_ID > 0) { $member = jsg_member_info(MEMBER_ID); if ($member['medal_id']) { $medal_list = $this->TopicLogic->GetMedal($member['medal_id'], $member['uid']); } } include template('tag/tag_list_topic_box'); }