function Follow() { $member = $this->_member(); if (!$member) { $this->Messager("链接错误,请检查", 'index.php?mod=plaza'); } $member_list = array(); $per_page_num = 8; $page_link = "index.php?mod={$member['username']}&code=follow"; $count = $member['follow_count']; if ($count > 0) { $page_arr = wap_page($count, $per_page_num, $page_link, array('return' => 'Array')); $p = array('uid' => $member['uid'], 'result_count' => $count, 'sql_limit' => " {$page_arr['limit']} ", 'sql_order' => ' `dateline` DESC '); $uids = get_buddyids($p); if ($uids) { $member_list = $this->_topicLogicGetMember($uids); $member_list = buddy_follow_html($member_list, 'uid', 'wap_follow_html'); } } $this->Title = "{$member['nickname']}关注的人"; include template('topic_follow'); }
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 get_recd_list($param, $caller = 'web') { $order_sql = ' tr.recd DESC,tr.dateline DESC '; if (!empty($param['order_sql'])) { $order_sql = $param['order_sql']; } $where_sql = " tr.tid>0 "; if (!empty($param['where'])) { $where_sql .= " AND {$param['where']} "; } $where_sql .= " AND (tr.expiration>" . TIMESTAMP . " OR tr.expiration=0) "; $filter_sql = $this->filter($param['filter'], 't'); $where_sql .= empty($filter_sql) ? '' : ' AND ' . $filter_sql; $total_record = DB::result_first("SELECT COUNT(*)\r\n\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 LEFT JOIN " . DB::table('topic_recommend') . " AS tr\r\n\t\t\t\t\t\t\t\t\t\t USING(tid)\r\n\t\t\t\t\t\t\t\t\t\t WHERE {$where_sql} "); $limit_sql = ''; $topic_list = array(); if ($total_record > 0) { if ($param['perpage']) { if ($caller == 'wap') { $page_arr = wap_page($total_record, $param['perpage'], $param['page_url'], array('return' => 'array')); } else { $page_arr = page($total_record, $param['perpage'], $param['page_url'], array('return' => 'array')); } $limit_sql = $page_arr['limit']; } else { if ($param['limit']) { $limit_sql = ' LIMIT ' . $param['limit']; } } $query = DB::query("SELECT t.* FROM " . DB::table('topic') . " AS t LEFT JOIN " . DB::table('topic_recommend') . " AS tr USING(tid) WHERE {$where_sql} ORDER BY {$order_sql} {$limit_sql} "); $rec_tids = array(); while ($value = DB::fetch($query)) { $rec_tids[$value['tid']] = $value['tid']; } $topic_list = $this->TopicLogic->Get($rec_tids); $info = array('list' => $topic_list, 'count' => $total_record, 'page' => $page_arr); return $info; } return false; }