function DoReport() { $url = get_param('url'); $report_url = get_param('report_url'); $url = get_safe_code(urldecode(urldecode($url ? $url : $report_url))); $data = array('uid' => MEMBER_ID, 'username' => MEMBER_NAME, 'ip' => $GLOBALS['_J']['client_ip'], 'reason' => (int) get_param('report_reason'), 'content' => strip_tags(get_param('report_content')), 'url' => strip_tags(urldecode($url)), 'dateline' => time()); $result = jtaboe('report')->insert($data); $this->Messager("举报成功"); }
function getMemberList($param) { $member_list = array(); $where_sql = " 1 "; $order_sql = " regdate DESC "; $max_id = intval($param['max_id']); $limit = intval($param['limit']); if (empty($limit)) { $limit = 20; } $nickname = trim($param['nickname']); if (!empty($nickname)) { $nickname = get_safe_code($nickname); $where_sql .= " AND " . build_like_query("nickname", $nickname) . " "; } $sql = "select count(*) from `" . TABLE_PREFIX . "members` WHERE {$where_sql}"; $total_record = DB::result_first($sql); if ($total_record > 0) { if ($max_id > 0) { $where_sql .= " AND uid < {$max_id} "; } $sql = "select `uid`,`ucuid`,`username`,`nickname`,`face_url`,`face`,`fans_count`,`topic_count`,`province`,`city`,`validate`\r\n\t\t\t\t\tfrom `" . TABLE_PREFIX . "members`\r\n\t\t\t\t\tWHERE {$where_sql}\r\n\t\t\t\t\tORDER BY {$order_sql}\r\n\t\t\t\t\tLIMIT {$limit} "; $query = DB::query($sql); $uids = array(); while ($row = DB::fetch($query)) { $row['face'] = face_get($row); $member_list[] = $row; $uids[$row['uid']] = $row['uid']; } if ($uids && MEMBER_ID > 0) { $friendships = array(-1 => 1, 0 => 0, 1 => 2, 2 => 0, 3 => 4); $_tmp_arr = buddy_follow_html($member_list); foreach ($_tmp_arr as $k => $row) { $member_list[$k]['friendship'] = $friendships[$row['is_follow_relation']]; } unset($_tmp_arr); } $member_list = array_values($member_list); $tmp_ary = $member_list; $tmp = array_pop($tmp_ary); $max_id = $tmp['uid']; $ret = array('member_list' => $member_list, 'total_record' => $total_record, 'list_count' => count($member_list), 'max_id' => $max_id); return $ret; } return 400; }
function getUserInfo() { Mobile::is_login(); $uid = trim($this->Get['uid']); $nick = get_safe_code(trim($this->Get['nick'])); if (!empty($uid) && $uid > 0) { $member = DB::fetch_first("SELECT * FROM " . DB::table('members') . " WHERE uid='{$uid}'"); } else { if (!empty($nick)) { $member = DB::fetch_first("SELECT * FROM " . DB::table('members') . " WHERE nickname='{$nick}'"); } } if (empty($member)) { Mobile::error("No User", 300); } $ret = array('uid' => $member['uid'], 'nick' => $member['nickname'], 'gender' => $member['gender'], 'face' => face_get($member), 'face_original' => face_get($member, 'big'), 'signature' => $member['signature'], 'province' => $member['province'], 'city' => $member['city'], 'fans_num' => $member['fans_count'], 'follower_num' => $member['follow_count'], 'mblog_num' => $member['topic_count'], 'topic_num' => $member['tag_favorite_count']); Mobile::output($ret); }
function Main() { $member = $this->_topicLogicGetMember(MEMBER_ID); $topic_selected = 'pm'; $per_page_num = 20; $query_link = "index.php?mod=" . ($_GET['mod_original'] ? get_safe_code($_GET['mod_original']) : $this->Module) . ($this->Code ? "&code={$this->Code}&folder=inbox" : ""); if ($member['newpm']) { jlogic('member')->clean_new_remind('newpm', $member['uid']); } load::logic('pm'); $PmLogic = new PmLogic(); $folder = "inbox"; $page['per_page_num'] = 20; $page['query_link'] = $query_link; $return_arr = $PmLogic->getPmList($folder, $page); $page_html = $return_arr['page_arr']['html']; $pm_list = $return_arr['pm_list']; $pm_hb = 'hb'; $this->Title = '我的私信'; include template('pm_list'); }
function City() { $pid = (int) $this->Get['pid']; $cid = (int) $this->Get['cid']; if ($cid) { $province_ary = DB::fetch_first("SELECT *\r\n\t\t\t\t\t\tFROM " . DB::table('common_district') . "\r\n\t\t\t\t\t\twhere `id` = '{$pid}' "); $province_id = $province_ary['id']; $province_name = $province_ary['name']; $city_where_list = "where `upid` = '{$pid}'"; $city_ary = $this->ValidateLogic->CategoryCityList($city_where_list); $city_name = $city_ary[$cid]['name']; $config = jconf::get(); $people_config = $config['validate_people_setting']; $cat_where = "where `is_push` = 2"; $cat_member_limit = $people_config['proviect_user_limit'] ? $people_config['proviect_user_limit'] : 20; $cat_member = $this->ValidateLogic->CategoryUserList($cat_where, $cat_member_limit, $people_config['proviect_user_orderby']); $cat_member_list = $cat_member['member']; $cat_member_uids = $cat_member['uids']; $member_num = 30; $query_link = "index.php?mod=" . ($_GET['mod_original'] ? get_safe_code($_GET['mod_original']) : $this->Module) . ($this->Code ? "&code={$this->Code}&pid={$this->Get['pid']}&cid={$this->Get['cid']}" : ""); $where_list['city'] = build_like_query('city', $city_name); $where = ' where ' . implode(' AND ', $where_list) . ' and `validate` !="" '; $members = $this->_memberlist($where, $member_num, 'fans_count', $query_link); $member_list = $members['member']; $page_html = $members['pagearr']['html']; } $this->Title = "名人堂"; include template("people/people_city_view"); }
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 PmList() { load::logic('pm'); $PmLogic = new PmLogic(); $member = jsg_member_info(MEMBER_ID); $folder = $this->Get['folder'] ? $this->Get['folder'] : 'inbox'; $read = get_param('read'); $TopicLogic = jlogic('topic'); if ($member['medal_id']) { $medal_list = $TopicLogic->GetMedal($member['medal_id'], $member['uid']); } $topic_selected = 'pm'; if ($member['newpm']) { jlogic('member')->clean_new_remind('newpm', $member['uid']); } $page['per_page_num'] = 20; $return_arr = array(); if ($folder == 'inbox') { $query_link = "index.php?mod=" . ($_GET['mod_original'] ? get_safe_code($_GET['mod_original']) : $this->Module) . ($this->Code ? "&code={$this->Code}&folder=inbox" : "") . ($read ? "&read=1" : ""); $page['query_link'] = $query_link; $page['read'] = $read; $return_arr = $PmLogic->getPmList($folder, $page); $this->Title = '我的私信'; } elseif ($folder == 'outbox') { $query_link = "mod=pm&code=list&folder=outbox"; $page['query_link'] = $query_link; $return_arr = $PmLogic->getPmList($folder, $page); $this->Title = '草稿箱'; } extract($return_arr); $left_menu = $this->LeftMenu(); include template('pm/pm_list'); }
function upload($p) { $sys_config = jconf::get(); if (!$_FILES[$p['field']] || !$_FILES[$p['field']]['name']) { return array('error' => 'attach is empty', 'code' => -1); } $itemid = is_numeric($p['itemid']) ? $p['itemid'] : 0; $item = ''; if ($itemid > 0) { $item = $p['item']; } $uid = (int) ($p['uid'] ? $p['uid'] : MEMBER_ID); if ($uid < 1 || false == ($member_info = jsg_member_info($uid))) { return array('error' => 'uid is invalid', 'code' => -2); } $_FILES[$p['field']]['name'] = get_safe_code($_FILES[$p['field']]['name']); $att_id = $this->add($uid, $member_info['nickname'], $item, $itemid); if ($att_id < 1) { return array('error' => 'write database is invalid', 'code' => -3); } $filetype = end(explode('.', $_FILES[$p['field']]['name'])); $att_name = $att_id . '.' . $filetype; $att_path = RELATIVE_ROOT_PATH . 'data/attachs/topic/' . face_path($att_id); $att_file = $att_path . $att_name; if (!is_dir($att_path)) { jio()->MakeDir($att_path); } jupload()->init($att_path, $p['field'], false, true); jupload()->setMaxSize($sys_config['attach_size_limit']); jupload()->setNewName($att_name); $ret = jupload()->doUpload(); if (!$ret) { $this->delete($att_id); $rets = jupload()->getError(); $ret = $rets ? implode(" ", (array) $rets) : 'image upload is invalid'; return array('error' => $ret, 'code' => -5); } $site_url = ''; if ($sys_config['ftp_on']) { $ftp_key = randgetftp(); $get_ftps = jconf::get('ftp'); $site_url = $get_ftps[$ftp_key]['attachurl']; $ftp_result = ftpcmd('upload', $att_file, '', $ftp_key); if ($ftp_result > 0) { jio()->DeleteFile($att_file); $att_file = $site_url . '/' . str_replace('./', '', $att_file); } } $att_size = filesize($att_file); $p = array('id' => $att_id, 'site_url' => $site_url, 'photo' => $att_file, 'name' => $_FILES[$p['field']]['name'], 'filesize' => $att_size, 'filetype' => $filetype, 'tid' => max(0, (int) $p['tid']), 'uid' => $uid, 'username' => $member_info['nickname'], 'dateline' => (int) time()); $this->modify($p); return $p; }
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 Seach() { $per_page_num = 6; $query_link = 'index.php?mod=user_tag&code=seach'; $order = " order by `fans_count` desc "; $tag_name = trim($this->Get['k']); $tag_name = get_safe_code($tag_name); if (empty($tag_name)) { $this->Messager("请输入需要查找的标签", -1); } if ($tag_name) { if (strlen($tag_name) < 2) { $this->Messager("请输入至少2个字符的关键词", -1); } $where_list['tag_name'] = "`tag_name`='" . addslashes("{$tag_name}") . "'"; $query_link .= "&k=" . urlencode($tag_name); } if ($where_list) { $where = empty($where_list) ? null : ' WHERE ' . implode(' AND ', $where_list) . ' '; $sql = "select * from `" . TABLE_PREFIX . "user_tag_fields` {$where} "; $query = $this->DatabaseHandler->Query($sql); $uids = array(); $user_tag_fields = array(); while (false != ($row = $query->GetRow())) { $user_tag_fields[] = $row; $uids[$row['uid']] = $row['uid']; } if (empty($uids)) { include template('social/search_list'); } } $member_list = array(); if ($uids) { $sql = "select count(*) as `total_record` from `" . TABLE_PREFIX . "members` where `uid` in (" . jimplode($uids) . ")"; $total_record = DB::result_first($sql); if ($total_record > 0) { $_config = array('return' => 'array'); $page_arr = page($total_record, $per_page_num, $query_link, $_config); $sql = "select `uid`,`ucuid`,`username`,`nickname`,`face_url`,`face`,`fans_count`,`topic_count`,`province`,`city`,`validate` from `" . TABLE_PREFIX . "members` where `uid` in(" . jimplode($uids) . ") {$order} {$page_arr['limit']}"; $query = $this->DatabaseHandler->Query($sql); $uids = array(); while (false != ($row = $query->GetRow())) { $row['face'] = face_get($row); $member_list[$row['uid']] = $row; $uids[$row['uid']] = $row['uid']; } if ($uids && MEMBER_ID > 0) { $member_list = buddy_follow_html($member_list); } } $sql = "select * from `" . TABLE_PREFIX . "user_tag_fields` where `uid` in (" . jimplode($uids) . ")"; $query = $this->DatabaseHandler->Query($sql); $member_tag = array(); while (false != ($row = $query->GetRow())) { $member_tag[] = $row; } } $sql = "select * from `" . TABLE_PREFIX . "user_tag_fields` where `uid` = '" . MEMBER_ID . "'"; $query = $this->DatabaseHandler->Query($sql); $mytag = array(); $mytag_ids = array(); while (false != ($row = $query->GetRow())) { $mytag[] = $row; $mytag_ids[$row['tag_id']] = $row['tag_id']; } $this->Title = "个人标签 - {$tag_name}"; include template('social/search_list'); }
function SearchImageByBaiDu() { $word = jget('word'); $word = get_safe_code($word); if (!$word) { exit('请输入搜索关键词'); } $page = jget('page', 'int'); $page = $page > 0 && $page < 30 ? $page : 0; $per = jget('per', 'int'); $per = $per > 0 && $per < 30 ? $per : 6; if (false === ($data = cache_file('get', $cache_id = "misc/image/search_by_baidu-" . substr(md5($word), -16) . "-{$per}-{$page}"))) { $word = str_replace(' ', '+', $word); $url = "http:/" . "/image.baidu.com/i?tn=baiduimagejson&ct=201326592&cl=2&lm=-1&st=-1&fm=result&fr=&sf=1&fmq=1349413075627_R&pv=&ic=0&nc=1&z=&se=1&showtab=0&fb=0&width=&height=&face=0&istype=2&word={$word}&rn={$per}&pn=" . $page * $per; $data = file_get_contents($url); cache_file('set', $cache_id, $data, 86400); } response_text($data); }
function Tag() { $limit = intval($this->Get['limit']); $tag = trim($this->Get['q']); if (empty($tag)) { exit; } if (empty($limit)) { $limit = 10; } $order_sql = " ORDER BY total_count DESC "; $tag = get_safe_code($tag); if ($tag) { $where_sql = " " . build_like_query("name", $tag) . " "; $query = DB::query("SELECT id,name\r\n\t\t\t\t\t\t\t\tFROM " . DB::table('tag') . "\r\n\t\t\t\t\t\t\t\tWHERE {$where_sql}\r\n\t\t\t\t\t\t\t\t{$order_sql}\r\n\t\t\t\t\t\t\t\tLIMIT {$limit} "); while ($value = DB::fetch($query)) { echo $value['id'] . '|' . $value['name'] . "\n"; } } exit; }
function jsg_member_info_by_mod() { $ret = array(); $mr = $_POST['mod_original'] ? $_POST['mod_original'] : $_GET['mod_original']; if ($mr) { $mr = get_safe_code($mr); $ret = jsg_member_info($mr, 'username'); if (!$ret) { $ret = jsg_member_info($mr, is_numeric($mr) ? 'uid' : 'nickname'); } } return $ret; }
function View() { $view_rets = jlogic('topic')->check_view($this->ID); if ($view_rets['error']) { $this->Messager($view_rets['result'], null); } $per_page_num = 20; $query_link = "index.php?mod=" . ($_GET['mod_original'] ? get_safe_code($_GET['mod_original']) : $this->Module) . ($this->Code ? "&code={$this->Code}" : ""); $topic_info = jlogic('longtext')->get_info($this->ID, array('type' => 'artZoom2')); if ($topic_info['longtextid'] > 0) { $topic_info['content'] = nl2br($topic_info['content']); } $allow_op = 1; if ($topic_info['item'] == 'qun' && !empty($topic_info['item_id'])) { Load::logic('qun'); $QunLogic = new QunLogic(); $qun_info = $QunLogic->get_qun_info($topic_info['item_id']); if (!empty($qun_info)) { $qun_info['icon'] = $QunLogic->qun_avatar($qun_info['qid'], 's'); $allow_op = $is_qun_member = $QunLogic->is_qun_member($topic_info['item_id'], MEMBER_ID); } } else { if ($topic_info['type'] == 'reply') { $roottid = $topic_info['roottid']; if (empty($roottid)) { $root_type = 'reply'; } else { $root_type = DB::result_first("SELECT type FROM " . DB::table('topic') . " WHERE tid='{$roottid}'"); } } else { $root_type = $topic_info['type']; } } $parent_list = $t_parent_list = $t_relate_list = array(); if ($topic_info['parent_id']) { $parent_id_list = array($topic_info['parent_id'], $topic_info['top_parent_id']); if ($parent_id_list) { $t_parent_list[$topic_info['top_parent_id']] = jlogic('longtext')->get_info($topic_info['top_parent_id'], array('type' => 'artZoom2')); } } if ($topic_info['relateid'] > 0) { $t_relate_list = jlogic('longtext')->get_info($topic_info['relateid']); } if ($topic_info['digcounts'] > 0) { $dig_users = array(); $user = $this->TopicLogic->GetDigUids($topic_info['tid']); if (!$user || count($user) != $topic_info['digcounts']) { $query = DB::query("SELECT uid FROM `" . TABLE_PREFIX . "topic_dig`\tWHERE tid = '" . $topic_info['tid'] . "' ORDER BY id DESC"); while ($rs = DB::fetch($query)) { $user[$rs['uid']] = $rs['uid']; } } $dig_users = $this->TopicLogic->GetMember($user, "`uid`,`username`,`nickname`,`face`"); foreach ($dig_users as $k => $v) { array_splice($dig_users[$k], 4, 3); } $listotherdig = true; } if ($topic_info['replys'] > 0) { $total_record = $topic_info['replys']; $p = array('perpage' => $per_page_num, 'result_count' => $total_record); $orderby = jget('orderby'); if ('dig' == $orderby) { $p['sql_order'] = ' `digcounts` DESC, `lastdigtime` DESC '; } elseif ('post' == $orderby) { $p['sql_order'] = ' `dateline` DESC '; } else { $p['sql_order'] = ' `dateline` ASC '; } $reply_list_ajax_disable = 1; $rets = jtable('topic_relation')->get_list($topic_info['tid'], $p); $page_arr = $reply_list = array(); if ($rets) { $page_arr = $rets['page']; $reply_list = $rets['list']; $total_record = $rets['count']; $parent_list = $rets['parent_list']; } $relate_reply = array(); if ($reply_list) { if ($topic_info['relateid'] > 0) { if ($reply_list[$topic_info['relateid']]) { $relate_reply[$topic_info['relateid']] = $reply_list[$topic_info['relateid']]; unset($reply_list[$topic_info['relateid']]); } else { $relate_reply[$topic_info['relateid']] = jlogic('longtext')->get_info($topic_info['relateid']); } if (in_array($topic_info['channel_type'], array('ask', 'idea'))) { $relate_reply[$topic_info['relateid']]['ch_ty_css'] = ($topic_info['channel_type'] ? $topic_info['channel_type'] : 'default') . '_relate_mark'; } } $ajaxkey = array(); $ajaxnum = 10; if (count($reply_list) > $ajaxnum) { $topic_keys = array_keys($reply_list); $reply_list = array_slice($reply_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; } if ($relate_reply) { $reply_list = array_merge($relate_reply, $reply_list); } } } if ($t_parent_list) { foreach ($t_parent_list as $k => $v) { if (!isset($parent_list[$k])) { $parent_list[$k] = $v; } } } if (MEMBER_ID > 0) { $sql = "select * from `" . TABLE_PREFIX . "topic_favorite` where `uid`='" . MEMBER_ID . "' and `tid`='{$topic_info['tid']}'"; $query = $this->DatabaseHandler->Query($sql); $is_favorite = $query->GetRow(); } $member = $this->_member($topic_info['uid']); $member_medal = $member; if ($member_medal['medal_id']) { $medal_list = $this->_Medal($member_medal['medal_id'], $member_medal['uid']); } $titletopicname = $topic_info['anonymous'] ? '匿名发布' : $member['nickname']; $this->Title = cut_str(strip_tags($topic_info['content']), 50) . " - {$titletopicname}的微博"; $Keywords = array(); if (strpos($topic_info['content'], '#')) { preg_match_all('~\\#([^\\#\\s\'\\"\\/\\<\\>\\?\\\\]+?)\\#~', strip_tags($topic_info['content']), $Keywords); } if (is_array($Keywords[1]) && count($Keywords[1])) { $this->MetaKeywords = implode(',', $Keywords[1]); } $this->MetaDescription = cutstr(strip_tags($topic_info['content']), 140); if (MEMBER_ID != $member['uid']) { $this->_initTheme($member); } $topic_view = 1; $this->item = $topic_info['item']; $this->item_id = $topic_info['item_id']; include template('topic_view'); }
function _memberlist($where = '', $limit = 20) { $per_page_num = $limit; $query_link = "admin.php?mod=" . ($_GET['mod_original'] ? get_safe_code($_GET['mod_original']) : $this->Module) . ($this->Code ? "&code={$this->Code}&ids={$this->Get['ids']}" : ""); $sql = " select count(*) as `total_record` from `" . TABLE_PREFIX . "members` {$where} "; $total_record = DB::result_first($sql); $page_arr = page($total_record, $per_page_num, $query_link, array('return' => 'array')); $wherelist = " {$where} {$page_arr['limit']} "; $members = $this->TopicLogic->GetMember($wherelist, "`uid`,`ucuid`,`nickname`,`validate`"); $ret_ary = array('member_list' => $members, 'page_list' => $page_arr); return $ret_ary; }
function view() { $uid = MEMBER_ID; $qid = intval(trim($this->Get['qid'])); $tag = get_safe_code($this->Get['tag']); $view = trim($this->Get['view']); $qun_info = $this->QunLogic->get_qun_info($qid); if ($qun_info['qun_theme_id']) { $this->Config['qun_theme_id'] = $qun_info['qun_theme_id']; $this->Config['theme_id'] = ''; $this->Config['theme_bg_image'] = ''; $this->Config['theme_bg_color'] = ''; $this->Config['theme_text_color'] = ''; $this->Config['theme_link_color'] = ''; $this->Config['theme_bg_image_type'] = ''; $this->Config['theme_bg_repeat'] = ''; $this->Config['theme_bg_fixed'] = ''; } if (empty($qun_info)) { $this->Messager("当前" . $this->Config[changeword][weiqun] . "不存在或者已经被删除了", 'index.php?mod=qun'); } if (!empty($tag)) { $qun_info['icon'] = $this->QunLogic->qun_avatar($qun_info['qid'], 's'); } else { $qun_info['icon'] = $this->QunLogic->qun_avatar($qun_info['qid'], 'b'); } $active = array(); $topic_list = array(); $get_topic_flg = true; $this->item_id = $qid; $params['code'] = $this->item; $cat_ary = $this->QunLogic->get_category(); $top_cat = array(); $sub_cat = array(); if ($cat_ary['second'][$qun_info['cat_id']]) { $sub_cat = array('cat_name' => $cat_ary['second'][$qun_info['cat_id']]['cat_name'], 'cat_id' => $qun_info['cat_id']); $parent_id = $cat_ary['second'][$qun_info['cat_id']]['parent_id']; $top_cat = array('cat_name' => $cat_ary['first'][$parent_id]['cat_name'], 'cat_id' => $parent_id); } else { $top_cat = array('cat_name' => $cat_ary['first'][$qun_info['cat_id']]['cat_name'], 'cat_id' => $qun_info['cat_id']); } $founder_info = $this->TopicLogic->GetMember($qun_info['founderuid']); $qun_admin_list = $this->QunLogic->get_admin_list($qid); $tag_ary = $this->QunLogic->get_qun_tag($qid); $recd_event_list = $this->QunLogic->getRecdEventList($qid); $recd_vote_list = $this->QunLogic->getRecdVoteList($qid); $followme_nums = $this->QunLogic->followme_nums($qid, MEMBER_ID); $perm = $this->QunLogic->chk_perm($qid, MEMBER_ID); $status = ''; $allow_list_manage = false; if (in_array($perm, array(1, 2, 4)) || MEMBER_ROLE_TYPE == 'admin') { $status = 'isgroupuser'; $allow_list_manage = true; } jfunc('app'); $gets = array('mod' => 'qun', 'type' => $this->Get['type'], 'qid' => $qid, 'tag' => $this->Get['tag'], 'code' => $this->Code); $page_url = 'index.php?' . url_implode($gets); $where = " type!='reply' "; if ($this->Get['type']) { if ('pic' == $this->Get['type']) { $where = " `imageid` > 0 "; } else { if ('video' == $this->Get['type']) { $where = " `videoid` > 0 "; } else { if ('music' == $this->Get['type']) { $where = " `musicid` > 0 "; } else { $this->Get['type'] = ''; } } } } if (!empty($tag)) { $sql = "SELECT * FROM " . DB::table('tag') . " WHERE name='" . addslashes($tag) . "'"; $tag_info = DB::fetch_first($sql); $tag_id = $tag_info['id']; $sql = "SELECT item_id FROM " . DB::table('topic_tag') . " WHERE tag_id='{$tag_id}' "; $query = DB::query($sql); $topic_ids = array(); while ($row = DB::fetch($query)) { $topic_ids[$row['item_id']] = $row['item_id']; } if (!empty($topic_ids)) { $where .= " AND tid IN(" . jimplode($topic_ids) . ") "; } $content = "#{$tag}#"; $view = 'tag'; } else { if ($view == "newreply") { $type_where = ' AND ' . $where; $per_page_num = $this->ShowConfig['qun']['topic_reply'] ? $this->ShowConfig['qun']['topic_reply'] : 10; $count = DB::result_first("SELECT COUNT(*)\r\n\t\t\t\t\t\t\t\t\t\t\tFROM " . DB::table('topic') . "\r\n\t\t\t\t\t\t\t\t\t\t\tWhere `replys` > 0 AND item='qun' AND item_id='{$qid}' {$type_where}"); if ($count > 0) { $page_arr = page($count, $per_page_num, $page_url, array('return' => 'array')); $condition = " WHERE `replys` > 0 AND item='qun' AND item_id='{$qid}' {$type_where} ORDER BY `lastupdate` DESC {$page_arr['limit']}"; $topic_list = $this->TopicLogic->Get($condition); } $get_topic_flg = false; } else { if ($view == 'recd') { Load::logic('topic_list'); $TopicListLogic = new TopicListLogic(); $p = array('where' => " tr.recd <= 2 AND tr.item='qun' AND tr.item_id='{$qid}' ", 'perpage' => $per_page_num, 'filter' => $this->Get['type']); $info = $TopicListLogic->get_recd_list($p); if (!empty($info)) { $count = $info['count']; $topic_list = $info['list']; $page_arr = $info['page']; } $get_topic_flg = false; } elseif ($view == 'event') { $param = array('qid' => $qid, 'where' => " a.item = 'qun' and a.item_id = '{$qid}' ", 'page' => true, 'perpage' => 10, 'page_url' => 'index.php?mod=qun&view=event&qid=' . $qid); load::logic('event'); $EventLogic = new EventLogic(); $return = $EventLogic->getEventInfo($param); $count = $return['count'] ? $return['count'] : 0; $event = $return['event_list']; $page_arr = $return['page']; $get_topic_flg = false; } elseif ($view == 'vote') { load::logic('vote'); $VoteLogic = new VoteLogic(); $param = array('where' => " v.item = 'qun' and v.item_id = '{$qid}' ", 'order' => " order by v.dateline ", 'page' => true, 'perpage' => 10, 'page_url' => 'index.php?mod=qun&view=vote&qid=' . $qid); $return = $VoteLogic->find($param); $count = $return['count'] ? $return['count'] : 0; if (!empty($return)) { $vote_list = $return['vote_list']; $page_arr['html'] = $return['page']['html']; $uid_ary = $return['uids']; } if (!empty($uid_ary)) { $members = $this->TopicLogic->GetMember($uid_ary); } $get_topic_flg = false; } elseif ($view == 'image') { $param = array('item' => 'qun', 'itemid' => $qid, 'page' => true, 'per_page_num' => 20, 'page_url' => 'index.php?mod=qun&view=image&qid=' . $qid); $return = jlogic('image')->get($param); $count = $return['count'] ? $return['count'] : 0; $image_list = $return['list']; $page_arr['html'] = $return['page']['html']; $get_topic_flg = false; } elseif ($view == 'attach' && $this->Config['qun_attach_enable']) { global $attach_list; $type = $this->Get['type']; load::logic('attach'); $AttachLogic = new AttachLogic(); $param = array('item' => 'qun', 'itemid' => $qid, 'page' => true, 'per_page_num' => 20, 'page_url' => 'index.php?mod=qun&view=attach&qid=' . $qid . '&type=' . $type); if ($type) { if ('hot' == $type) { $param['order'] = " order by download DESC "; } else { if ('new' == $type) { $param['order'] = " order by id DESC "; } } } $return = $AttachLogic->get($param); $count = $return['count'] ? $return['count'] : 0; $attach_list = $return['list']; $page_arr['html'] = $return['page']['html']; $get_topic_flg = false; } else { $view = 'newtopic'; } } $active[$view] = "class='current'"; } if ($get_topic_flg) { $options = array('where' => $where, 'page' => true, 'perpage' => $this->ShowConfig['qun']['topic_new'] ? $this->ShowConfig['qun']['topic_new'] : 10, 'page_url' => $page_url); $topic_info = app_get_topic_list($this->item, $qid, $options); if (!empty($topic_info)) { $topic_list = $topic_info['list']; $page_arr['html'] = $topic_info['page']['html']; } } $topic_list_count = count($topic_list); $parent_list = $this->_get_parent_topic($topic_list); $gets = array('item' => $this->item, 'item_id' => $qid); $member =& $this->my; if (!$this->Config['acceleration_mode'] && $member['medal_id']) { $medal_list = $this->TopicLogic->GetMedal($member['medal_id'], $member['uid']); } $set_qun_closed = 1; if (empty($tag)) { $new_members = $this->QunLogic->get_new_member_list($qid); $this->Title = $this->Config[changeword][weiqun] . ' - ' . $qun_info['name']; include template('qun/view'); } else { $this->Title = $this->Config[changeword][weiqun] . ' - ' . $qun_info['name'] . ' - ' . $tag; include template('qun/tag_view'); } }
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 upload($p = array()) { $sys_config = jconf::get(); if ($sys_config['image_uploadify_queue_size_limit'] > 0 && $this->upload_count >= $sys_config['image_uploadify_queue_size_limit']) { return array('error' => 'image upload limit', 'code' => 0); } $pic_url = $p['pic_url'] && false !== strpos($p['pic_url'], ':/' . '/') ? $p['pic_url'] : ''; $p['pic_field'] = $p['pic_field'] ? $p['pic_field'] : 'topic'; $pic_field = $p['pic_field'] && $_FILES[$p['pic_field']] ? $p['pic_field'] : ''; if (!$pic_url && !$pic_field) { return array('error' => 'pic is empty', 'code' => -1); } $itemid = is_numeric($p['itemid']) ? $p['itemid'] : 0; $albumid = is_numeric($p['albumid']) ? $p['albumid'] : 0; $item = ''; if ($itemid > 0) { $item = $p['item']; } $uid = (int) ($p['uid'] ? $p['uid'] : MEMBER_ID); if ($uid < 1 || false == ($member_info = jsg_member_info($uid))) { return array('error' => 'uid is invalid', 'code' => -2); } $image_id = $this->add($uid, $member_info['nickname'], $item, $itemid, $albumid); if ($image_id < 1) { return array('error' => 'write database is invalid', 'code' => -3); } $image_path = RELATIVE_ROOT_PATH . 'images/topic/' . face_path($image_id); $image_name = $image_id . "_o.jpg"; $image_file = $image_path . $image_name; $image_file_small = $image_path . $image_id . "_s.jpg"; $image_file_middle = $image_path . $image_id . "_m.jpg"; $image_file_photo = $image_path . $image_id . "_p.jpg"; $image_file_temp = $image_path . $image_id . "_t.jpg"; if (!is_dir($image_path)) { jio()->MakeDir($image_path); } if ($pic_field) { if (empty($_FILES) || !$_FILES[$pic_field]['name']) { return array('error' => 'FILES is empty', 'code' => -4); } $_FILES[$pic_field]['name'] = get_safe_code($_FILES[$pic_field]['name']); jupload()->init($image_path, $pic_field, true, false); jupload()->setMaxSize($sys_config['image_size']); jupload()->setNewName($image_name); $ret = jupload()->doUpload(); if (!$ret) { $this->delete($image_id); $rets = jupload()->getError(); $ret = $rets ? implode(" ", (array) $rets) : 'image upload is invalid'; return array('error' => $ret, 'code' => -5); } } elseif ($pic_url) { $temp_image = dfopen($pic_url); if ($temp_image) { jio()->WriteFile($image_file, $temp_image); } else { return array('error' => 'image download is invalid', 'code' => -6); } } if (!is_image($image_file)) { jio()->DeleteFile($image_file); return array('error' => 'image file is invalid', 'code' => -7); } @copy($image_file, $image_file_temp); list($image_width, $image_height, $image_type, $image_attr) = getimagesize($image_file); $thumbwidth = min($sys_config['thumbwidth'], $image_width); $thumbheight = min($sys_config['thumbheight'], $image_width); $maxw = $sys_config['maxthumbwidth']; $maxh = $sys_config['maxthumbheight']; $result = makethumb($image_file, $image_file_small, $thumbwidth, $thumbheight, $maxw, $maxh, 0, 0, 0, 0, $sys_config['thumb_cut_type'], $sys_config['image_thumb_quality']); clearstatcache(); if (!is_file($image_file)) { @copy($image_file_temp, $image_file); } $iw = $image_width; $ih = $image_height; if (!$sys_config['thumb_cut_type']) { if ($image_width != $image_height) { if ($maxw > 300 && $maxh > 300 && ($iw > $maxw || $ih > $maxh)) { list($iw, $ih) = getimagesize($image_file); } $src_x = $src_y = 0; $src_w = $src_h = min($iw, $ih); if ($iw > $ih) { $src_x = round(($iw - $ih) / 2); } else { $src_y = round(($ih - $iw) / 2); } $result = makethumb($image_file, $image_file_small, $thumbwidth, $thumbheight, 0, 0, $src_x, $src_y, $src_w, $src_h, 0, $sys_config['image_thumb_quality']); } clearstatcache(); if (!$result && !is_file($image_file_small)) { @copy($image_file_temp, $image_file_small); } } $image_width_p = (int) $sys_config['image_width_p']; if ($image_width_p < 1) { $image_width_p = 280; } if ($iw > $image_width_p) { $p_width = $image_width_p; $p_height = round($ih * $image_width_p / $iw); $result = makethumb($image_file, $image_file_photo, $p_width, $p_height, 0, 0, 0, 0, 0, 0, 0, $sys_config['image_thumb_quality']); } clearstatcache(); if ($iw <= $image_width_p || !$result && !is_file($image_file_photo)) { @copy($image_file_temp, $image_file_photo); } if ($sys_config['watermark_enable']) { $this->watermark($image_file, array('member_info' => $member_info, 'image_thumb_quality' => $sys_config['image_thumb_quality'])); clearstatcache(); if (!is_file($image_file)) { @copy($image_file_temp, $image_file); } } $site_url = ''; if ($sys_config['ftp_on']) { $ftp_key = randgetftp(); $get_ftps = jconf::get('ftp'); $site_url = $get_ftps[$ftp_key]['attachurl']; $ftp_result = ftpcmd('upload', $image_file, '', $ftp_key); if ($ftp_result > 0) { ftpcmd('upload', $image_file_small, '', $ftp_key); ftpcmd('upload', $image_file_photo, '', $ftp_key); jio()->DeleteFile($image_file); jio()->DeleteFile($image_file_small); jio()->DeleteFile($image_file_photo); $image_file_small = $site_url . '/' . str_replace('./', '', $image_file_small); } } $image_size = filesize($image_file); $name = addslashes(basename($_FILES[$pic_field]['name'])); $p = array('id' => $image_id, 'site_url' => $site_url, 'photo' => $image_file, 'name' => $name, 'filesize' => $image_size, 'width' => $image_width, 'height' => $image_height, 'tid' => max(0, (int) $p['tid']), 'image_url' => $pic_url); $this->modify($p); jio()->DeleteFile($image_file_temp); $p['src'] = $image_file_small; $this->upload_count += 1; return $p; }
function iframe_recommend() { $ids = (int) (jget('ids') ? jget('ids') : jget('id')); if ($ids < 1) { exit('ids is empty'); } $sql = " select * from `" . TABLE_PREFIX . "share` where `id` = '{$ids}' "; $query = $this->DatabaseHandler->Query($sql); $sharelist = $query->GetRow(); if (!$sharelist) { exit('ids is invalid'); } $share = @unserialize($sharelist['show_style']); $topic_charset = $share['topic_charset']; $share['limit'] = max(0, (int) $share['limit']); if ($share['limit'] < 1 || $share['limit'] > 200) { $share['limit'] = 20; } $share['string'] = max(0, (int) $share['string']); $order = ' `dateline` DESC '; $condition = ''; $rets = $topic_list = array(); if ('live' == $sharelist['type']) { $rr = jlogic('live')->get_script_out_list(1, $share['limit'], $share['string']); $rets = $live_list = $rr; } else { $user_topic_list = ''; if ('topic' == $sharelist['type']) { $nickname = ''; if ($sharelist['nickname']) { $nickname = $sharelist['nickname']; } else { $nickname = get_safe_code(jget('nickname')); } if ($nickname) { $ns = explode('|', $nickname); $uids = jtable('members')->get_ids(array('nickname' => $ns, 'result_count' => count($ns)), 'uid'); if (!$uids) { exit('nickname is invalid'); } $user_topic_list = " `uid` IN (" . jimplode($uids) . ") "; } } $tag_condition = ''; if ('tag' == $sharelist['type']) { $tag = ''; if ($sharelist['tag']) { $tag = $sharelist['tag']; } else { $tag = get_safe_code(jget('tag')); } if ($tag) { $ts = explode('|', $tag); $tagids = jtable('tag')->get_ids(array('name' => $ts, 'result_count' => count($ts)), 'id'); if (!$tagids) { exit('tag is invalid'); } $tids = jtable('topic_tag')->get_ids(array('tag_id' => $tagids, 'result_count' => $share['limit'], 'sql_order' => ' `dateline` DESC '), 'item_id'); if ($tids) { $tag_condition = " `tid` IN (" . jimplode($tids) . ") "; $topic_list = jlogic('topic')->Get($tids); } } } $channel_condition = ''; if ('channel' == $sharelist['type']) { $cids = array(); if ($share['channel']['name']) { $cname = $share['channel']['name']; } else { $channel_id = jget('channel_id', 'int'); if ($channel_id > 0) { $cids[$channel_id] = $channel_id; } else { $cname = jget('channel') ? jget('channel') : (jget('channel_name') ? jget('channel_name') : jget('ch_name')); } } if ($cname) { $ns = explode('|', $cname); $cids = jtable('channel')->get_ids(array('ch_name' => $ns, 'result_count' => count($ns)), 'ch_id'); if (!$cids) { exit('channel is invalid'); } } if ($cids) { $condition = " `item`='channel' AND `item_id` IN(" . jimplode($cids) . ") "; } } if ('recommend' == $sharelist['type']) { $p = array('sql_order' => ' `dateline` DESC ', 'result_count' => $share['limit']); $its = array(); $item = $share['recommend']['item']; if ($item) { $its = $share['recommend']['item_id']; } else { $item = jget('item', 'txt'); $its = jget('item_id', 'txt'); } if (in_array($item, array('qun', 'channel')) && $its) { ${$item_id . '_id'} = $its; $p['item_id'] = explode('|', $its); $p['item'] = $item; } $tids = jtable('topic_recommend')->get_ids($p, 'tid'); if ($tids) { $topic_list = jlogic('topic')->Get($tids); } foreach ($topic_list as $key_one => $topic_one) { $sql = " select r_title from `" . TABLE_PREFIX . "topic_recommend` where tid = " . $topic_one['tid']; $topic_list[$key_one]['recd_title'] = DB::result_first($sql); } } if ('live_weibo' == $sharelist['type']) { $live_id = (int) $share['live_weibo']['item_id']; $live_item = $share['live_weibo']['item']; if ($live_id > 0) { $live_info = jlogic('live')->id2liveinfo($live_id); $live_uids = array(); foreach ($live_info['all'] as $k => $v) { $live_uids[$k] = $k; } $p = array('limit' => $share['limit']); if ('live_all' == $live_item) { } elseif ('live_other' == $live_item) { $p['where'] = ' `uid` NOT IN (' . jimplode($live_uids) . ') '; } else { $p['where'] = " `uid` IN (" . jimplode($live_uids) . ") "; } jfunc('app'); $rets = app_get_topic_list('live', $live_id, $p); $topic_list = $rets['list']; } } if ($tag_condition) { $condition = " {$tag_condition} AND `type` = 'first' "; } elseif ($user_topic_list) { $condition = " {$user_topic_list} AND `type` = 'first' "; } if (!$condition) { $condition = " `type` = 'first' "; } $gorder = jget('order'); $where = " WHERE {$condition} ORDER BY {$order} LIMIT {$share['limit']} "; if (!$topic_list) { $topic_list = $this->TopicLogic->Get($where); } if ($topic_list) { if (!$share['hold_tags']) { foreach ($topic_list as $k => $v) { $topic_list[$k]['content'] = stripslashes($topic_list[$k]['content']); $topic_list[$k]['content'] = strip_tags($topic_list[$k]['content']); if ($share['string'] > 0) { $topic_list[$k]['content'] = cut_str($topic_list[$k]['content'], $share['string']); $topic_list[$k]['recd_title'] = cut_str($topic_list[$k]['recd_title'], $share['string']); } } } } $rets = $topic_list; } $output = jget('output'); if ('json' == $output) { $rets = array_values($rets); $rets = array_iconv($this->Config['charset'], 'utf-8', $rets); echo json_encode($rets); } else { ob_start(); include template('share/sharetemp_' . $ids); $content = ob_get_contents(); ob_clean(); $content = str_replace(array("\r\n", "\n", "\r"), "", $content); $content = str_replace("'", "\\'", $content); $content = str_replace("/http", "http", $content); $content = str_replace("index.php?", $this->Config['site_url'] . '/index.php?', $content); $content = str_replace($this->Config['site_url'] . "/" . $this->Config['site_url'], $this->Config['site_url'], $content); #开启伪静态以后加网址 $content = str_replace('href="/', 'href="' . $this->Config['site_url'] . '/', $content); $content = str_replace('target="_blank"', "", $content); $content = str_replace('<a ', '<a target="_blank" ', $content); $content = preg_replace(array("/[\r\n]+/s", "/\\>\\s+\\</", "/\\>\\s+/", "/\\s+\\</"), array("", "><", ">", "<"), $content); if (strtoupper($this->Config['charset']) != strtoupper($share['topic_charset'])) { @header('Content-Type: text/html; charset=' . $share['topic_charset']); $content = array_iconv($this->Config['charset'], $share['topic_charset'], $content); } if ('iframe' == $output) { echo $content; } else { echo "document.write('{$content}');"; } } exit; }
function UserGroupList() { if (MEMBER_ID < 1) { $this->Messager("请先<a href='index.php?mod=login'>点此登录</a>或者<a href='index.php?mod=member'>点此注册</a>一个帐号", 'index.php', 0); } $member = jsg_member_info(MEMBER_ID); if (!$member) { $this->Messager('用户已经不存在了'); } $page_arr = array(); $grouplist = array(); $total_record = 0; $per_page_num = 15; $query_link = "index.php?mod=" . ($_GET['mod_original'] ? get_safe_code($_GET['mod_original']) : $this->Module) . ($this->Code ? "&code={$this->Code}&ids={$this->Get['ids']}" : ""); $p = array('uid' => MEMBER_ID, 'sql_order' => ' `id` DESC ', 'per_page_num' => $per_page_num, 'page_link' => $page_link); $rets = jtable('buddy_follow_group')->get($p); if ($rets) { $page_arr = $rets['page']; $total_record = $rets['count']; $grouplist = $rets['list']; } $this->Title = '管理分组'; include template('other/group'); }
function Attach() { $item = $this->Get['aitem']; $itemid = max(0, (int) $this->Get['aitemid']); $this->_init_auth(); $field = 'topic'; if (empty($_FILES) || !$_FILES[$field]['name']) { $this->_attach_error('FILES is empty'); } $_FILES[$field]['name'] = get_safe_code($_FILES[$field]['name']); $_FILES[$field]['name'] = jaddslashes($_FILES[$field]['name']); $uid = jget('topic_uid', 'int') > 0 ? jget('topic_uid', 'int') : MEMBER_ID; $username = jget('topic_uid', 'int') > 0 ? '' : MEMBER_NICKNAME; $category = ''; if (jget('attch_category') > 0) { $category = jlogic('attach_category')->get_attacht_cat(jget('attch_category')); } $attach_id = $this->AttachLogic->add($uid, $username, $item, $itemid, $category); if (jget('attch_category') > 0) { $this->auto_add_weibo($attach_id, $_FILES[$field]['name']); } if ($attach_id < 1) { $this->_attach_error('write database is invalid'); } $this->AttachLogic->clear_invalid(); $attach_size = min(is_numeric($this->Config['attach_size_limit']) ? $this->Config['attach_size_limit'] : 1024, 51200); $attach_path = RELATIVE_ROOT_PATH . 'data/attachs/' . $field . '/' . face_path($attach_id); $attach_type = strtolower(end(explode('.', $_FILES[$field]['name']))); $attach_name = $attach_id . '.' . $attach_type; $attach_file = $attach_path . $attach_name; if (!is_dir($attach_path)) { jio()->MakeDir($attach_path); } jupload()->init($attach_path, $field, false, true); jupload()->setMaxSize($attach_size); jupload()->setNewName($attach_name); $ret = jupload()->doUpload(); if ($ret) { $ret = true; } if (!$ret) { jio()->DeleteFile($attach_file); $this->DatabaseHandler->Query("delete from " . TABLE_PREFIX . "topic_attach where `id`='{$attach_id}'"); $rets = jupload()->getError(); $ret = $rets ? implode(" ", (array) $rets) : 'attach file is invalid'; $this->_attach_error($ret); } $attach_size = filesize($attach_file); $site_url = ''; if ($this->Config['ftp_on']) { $ftp_key = randgetftp(); $get_ftps = jconf::get('ftp'); $site_url = $get_ftps[$ftp_key]['attachurl']; $ftp_result = ftpcmd('upload', $attach_file, '', $ftp_key); if ($ftp_result > 0) { jio()->DeleteFile($attach_file); } } $name = addslashes($_FILES[$field]['name']); $p = array('id' => $attach_id, 'site_url' => $site_url, 'file' => $attach_file, 'name' => $name, 'filetype' => $attach_type, 'filesize' => $attach_size); $this->AttachLogic->modify($p); update_credits_by_action('attach_add', $uid); $retval = array('id' => $attach_id, 'src' => 'images/filetype/' . $attach_type . '.gif', 'name' => $name); $this->_attach_result('ok', $retval); }
function _input($var = null, $is_utf8 = 0, $ifemptyval = null) { $val = get_param($var); if ($is_utf8) { $val = get_safe_code($val); } if (!$val) { $val = $ifemptyval; } return $val; }
function QunSearch() { $qun_setting = $this->Config['qun_setting']; if (!$qun_setting['qun_open']) { $this->Messager("当前站点没有开放" . $this->Config[changeword][weiqun] . "功能"); } $perpage = 10; $q = trim($this->Get['q']); $q = get_safe_code($q); $gets = array('mod' => 'search', 'code' => 'qun', 'q' => $this->Get['q']); $page_url = 'index.php?' . url_implode($gets); $count = 0; if (!empty($q)) { $q = $this->_filterKeyword($q); $search_keyword = $q; $QunLogic = jlogic('qun'); $where = ' gview_perm=0 AND ' . build_like_query('name', $q) . ' '; $order = " ORDER BY dateline DESC "; $cache_time = 3600; if ($cache_time > 0) { $cache_key = "qun-search-{$q}"; if (false === ($qids = cache_db('mget', $cache_key))) { $query = DB::query("SELECT `qid` FROM " . DB::table('qun') . " WHERE {$where} {$order} LIMIT {$this->cache_ids_limit} "); $qids = array(); while (false != ($row = DB::fetch($query))) { $qids[$row['qid']] = $row['qid']; } cache_db('mset', $cache_key, $qids, $cache_time); } $where = $qids ? " `gview_perm`='0' AND `qid` IN ('" . implode("','", $qids) . "') " : ""; } $qun_list = array(); if ($where) { $count = DB::result_first("SELECT COUNT(*) FROM " . DB::table('qun') . " WHERE {$where}"); if ($count > 0) { $page_arr = page($count, $perpage, $page_url, array('return' => 'array')); $query = DB::query("SELECT * FROM " . DB::table('qun') . " WHERE {$where} {$order} {$page_arr['limit']}"); while ($value = DB::fetch($query)) { if (empty($value['icon'])) { $value['icon'] = $QunLogic->qun_avatar($value['qid'], 's'); } $value['dateline'] = my_date_format2($value['dateline']); $qun_list[] = $value; } } } } $member = jsg_member_info(MEMBER_ID); if ($member['medal_id']) { $medal_list = $this->TopicLogic->GetMedal($member['medal_id'], $member['uid']); } $this->Title = $this->Config[changeword][weiqun] . '搜索'; include template('social/search_list'); }
function DoRecommend() { $act = $this->Post['act'] ? $this->Post['act'] : $this->Get['act']; $timestamp = time(); $uid = MEMBER_ID; $username = MEMBER_NAME; $hot_tag_recommend_config = jconf::get('hot_tag_recommend'); $messager = ""; if ('delete' == $act) { $hot_tag_recommend = $hot_tag_recommend_config; $id = max(0, (int) get_param('id')); $info = DB::fetch_first("select * from " . TABLE_PREFIX . "tag_recommend where `id`='{$id}'"); if (!$info) { $this->Messager("你要删除的内容已经不存在了"); } $name = $info['name']; DB::query("delete from " . TABLE_PREFIX . "tag_recommend where `id`='{$id}'"); DB::query("update " . TABLE_PREFIX . "tag set `status`=0 where `name`='{$name}'"); $messager = "删除成功"; } else { $_arr = $this->Post['hot_tag_recommend']; if ($_arr) { $name = $_arr['name'] ? $_arr['name'] : "热门话题推荐"; $num = min(20, max(1, (int) $_arr['num'])); $hot_tag_recommend = array('enable' => $_arr['enable'] ? 1 : 0, 'name' => $name, 'num' => $num, 'time' => time()); if ($_arr['list']) { $_list = $this->Post['_list']; foreach ($_arr['list'] as $k => $v) { if ($v != $_list[$k]) { $v['enable'] = $v['enable'] ? 1 : 0; $_sets = array(); foreach ($v as $_k => $_v) { if ($_v != $_list[$k][$_k]) { $_sets[$_k] = "`{$_k}`='{$_v}'"; } } if ($_sets) { $_sets['last_update'] = "`last_update`='{$timestamp}'"; DB::query("update " . TABLE_PREFIX . "tag_recommend set " . implode(" , ", $_sets) . " where `id`='{$k}'"); if ($v['enable'] != $_list[$k]['enable']) { DB::query("update " . TABLE_PREFIX . "tag set `status`='{$v['enable']}' where `name`='{$v['name']}'"); } } } } } } else { $hot_tag_recommend = $hot_tag_recommend_config; } $_new_arr = $this->Post['hot_tag_recommend_new']; foreach ($_new_arr as $k => $v) { if ($name = get_safe_code($v['name'])) { if (DB::fetch_first("select * from " . TABLE_PREFIX . "tag_recommend where `name`='{$name}'")) { continue; } if (false == DB::fetch_first("select * from " . TABLE_PREFIX . "tag where `name`='{$name}'")) { jtable('tag')->insert(array('name' => $name, 'user_id' => MEMBER_ID, 'username' => MEMBER_NAME, 'dateline' => TIMESTAMP, 'last_post' => TIMESTAMP)); } $_enable = $v['enable'] ? 1 : 0; $desc = $v['desc']; $order = (int) $v['order']; DB::query("insert into " . TABLE_PREFIX . "tag_recommend (`enable`,`name`,`desc`,`order`,`dateline`,`uid`,`username`) values ('{$_enable}','{$name}','{$desc}','{$order}','{$timestamp}','{$uid}','{$username}')"); DB::query("update " . TABLE_PREFIX . "tag set `status`='{$_enable}' where `name`='{$name}'"); } } $messager = "设置成功"; } if (false == jpost('is_ajax')) { if ($hot_tag_recommend) { $__list = array(); if ($hot_tag_recommend['num'] > 0) { $sql = "select tr.*,t.id as tag_id,t.topic_count from " . TABLE_PREFIX . "tag_recommend tr left join " . TABLE_PREFIX . "tag t on t.name=tr.name where tr.enable=1 order by `order` desc , `id` desc limit {$hot_tag_recommend['num']}"; $query = $this->DatabaseHandler->Query($sql); while (false != ($row = $query->GetRow())) { $__list[$row['id']] = $row; } } $hot_tag_recommend['list'] = $__list; if ($hot_tag_recommend_config != $hot_tag_recommend) { jconf::set('hot_tag_recommend', $hot_tag_recommend); if ($hot_tag_recommend['enable'] != $this->Config['hot_tag_recommend_enable']) { $config = array(); $config['hot_tag_recommend_enable'] = $hot_tag_recommend['enable']; jconf::update($config); } } } $this->Messager($messager); } else { json_result($messager); } }
function Main() { if ($this->MemberHandler->HasPermission($this->Module, $this->Code) == false) { $this->Messager($this->MemberHandler->GetError(), null); } $act_list = array(); if ($this->Config['company_enable']) { $act_list['company'] = '同单位'; } if (!$this->Config['profile_search_close']) { $act_list['search'] = '同城用户'; } if (!$this->Config['profile_maybe_friend_close']) { $act_list['maybe_friend'] = '同兴趣'; } if (!$this->Config['profile_usertag_close']) { $act_list['usertag'] = '同类人'; } if (!$this->Config['profile_role_close']) { $act_list['role'] = '同分组'; } if (false == jconf::get('invite', 'link_display_none')) { $act_list['invite'] = '邀请好友'; } $act = $this->Code; $member = $this->Member; if ($member['medal_id']) { $medal_list = $this->TopicLogic->GetMedal($member['medal_id'], $member['uid']); } $member_nickname = $member['nickname']; if ('invite' == $act) { $sql = "delete from `" . TABLE_PREFIX . "invite` where `fuid`<'1' and `dateline`>'0' and `dateline`<'" . (time() - 86400 * 7) . "'"; $this->DatabaseHandler->Query($sql); $sql = "select count(*) as my_invite_count from `" . TABLE_PREFIX . "invite` where `uid`='{$member['uid']}'"; $query = $this->DatabaseHandler->Query($sql); $row = $query->GetRow(); $my_invite_count = $row['my_invite_count']; $can_invite_count = max(0, $this->Config['invite_count_max'] - $my_invite_count); if ($my_invite_count > 0) { $per_page_num = 5; $query_link = "index.php?mod=" . ($_GET['mod_original'] ? get_safe_code($_GET['mod_original']) : $this->Module) . ($this->Code ? "&code={$this->Code}" : ""); $_config = array('return' => 'array'); $page_arr = page($my_invite_count, $per_page_num, $query_link, $_config); $sql = "select i.*,m.province,m.city,m.topic_count,m.fans_count,m.nickname as fusername from `" . TABLE_PREFIX . "invite` i\r\n\t\t\t\t\t\tleft join `" . TABLE_PREFIX . "members` m on m.uid = i.fuid\r\n\t\t\t\t\t \twhere i.`uid`='{$member['uid']}' order by i.`id` desc {$page_arr['limit']}"; $query = $this->DatabaseHandler->Query($sql); $invite_list = array(); while (false != ($row = $query->GetRow())) { $row['from_area'] = $row['province'] ? $row['province'] . ' ' . $row['city'] : '无'; $row['face'] = face_get($row['fuid']); $invite_list[] = $row; } $invite_list = buddy_follow_html($invite_list, 'fuid'); } $MEMBER_INVITE_CODE = ''; if (!$this->Config['invite_count_max'] || $this->Config['invite_count_max'] > $member['invite_count']) { $MEMBER_INVITE_CODE = $member['invitecode']; } if (!$MEMBER_INVITE_CODE) { $MEMBER_INVITE_CODE = random(16); $sql = "update `" . TABLE_PREFIX . "members` set `invitecode`='{$MEMBER_INVITE_CODE}' where `uid`='" . MEMBER_ID . "'"; $this->DatabaseHandler->Query($sql); } $inviteURL = "index.php?mod=member&code=" . urlencode(MEMBER_ID . "_" . $MEMBER_INVITE_CODE); $inviteURL = get_invite_url($inviteURL, $this->Config['site_url']); $invite = jconf::get('invite'); $invite_msg = empty($invite) ? '' : jstripslashes($invite['invite_msg']); if (!empty($invite_msg)) { $replaces = array('nickname' => $member['nickname'], 'inviteurl' => $inviteURL, 'invite_num' => $this->Config['invite_limit'], 'site_name' => $this->Config['site_name']); foreach ($replaces as $key => $val) { $invite_msg = str_replace("#" . $key . "#", $val, $invite_msg); } } } elseif ('maybe_friend' == $act) { $my_favorite_tags = jlogic('tag_favorite')->my_favorite_tags(MEMBER_ID, 20); if ($my_favorite_tags) { $uids = jlogic('tag_favorite')->favorite_uids($my_favorite_tags, 30); if ($uids) { $p = array('uid' => MEMBER_ID, 'touid' => $uids, 'result_count' => count($uids)); $buddyids = get_buddyids($p); $sql = "select `uid`,`ucuid`,`username`,`face_url`,`face`,`province`,`city`,`fans_count`,`topic_count`,`validate`,`nickname` from `" . TABLE_PREFIX . "members` where `uid` in('" . implode("','", $uids) . "')"; $query = $this->DatabaseHandler->Query($sql); $member_list = array(); while (false != ($row = $query->GetRow())) { $buddy_status = isset($buddyids[$row['uid']]); if (!$buddy_status && MEMBER_ID != $row['uid']) { $row['follow_html'] = follow_html($row['uid'], $buddy_status); $row = jsg_member_make($row); $member_list[$row['uid']] = $row; $tag_favorite_uids[$row['uid']] = $row['uid']; } } } } $user_favorite = array(); if ($tag_favorite_uids) { $user_favorite = jlogic('tag_favorite')->my_favorite($tag_favorite_uids, 100); } } elseif ('usertag' == $act) { $per_page_num = 10; $query_link = 'index.php?mod=profile&code=usertag'; $order = " order by `fans_count` desc "; $sql = "select * from `" . TABLE_PREFIX . "user_tag_fields` where `uid` = '" . MEMBER_ID . "'"; $query = $this->DatabaseHandler->Query($sql); $mytag = array(); $user_tagid = array(); while (false != ($row = $query->GetRow())) { $mytag[] = $row; $user_tagid[$row['tag_id']] = $row['tag_id']; } if ($user_tagid) { $sql = "select * from `" . TABLE_PREFIX . "user_tag_fields` where `uid` != '" . MEMBER_ID . "' and `tag_id` in (" . jimplode($user_tagid) . ") "; $query = $this->DatabaseHandler->Query($sql); $member_uids = array(); while (false != ($row = $query->GetRow())) { $member_uids[$row['uid']] = $row['uid']; } $where = $where_list = " where `uid` in (" . jimplode($member_uids) . ")"; } if ($member_uids) { $member_list = array(); $sql = "select count(*) as `total_record` from `" . TABLE_PREFIX . "members` {$where}"; $total_record = DB::result_first($sql); if ($total_record > 0) { $_config = array('return' => 'array'); $page_arr = page($total_record, $per_page_num, $query_link, $_config); $member_list = $this->TopicLogic->GetMember("{$where} {$order} {$page_arr['limit']}", "`uid`,`ucuid`,`username`,`nickname`,`face_url`,`face`,`fans_count`,`topic_count`,`province`,`city`,`validate`"); $member_list = buddy_follow_html($member_list); } $sql = "select * from `" . TABLE_PREFIX . "user_tag_fields` {$where}"; $query = $this->DatabaseHandler->Query($sql); $member_tag = array(); while (false != ($row = $query->GetRow())) { $member_tag[] = $row; } } $mytag = $this->_MyUserTag(MEMBER_ID); } else { $per_page_num = 10; $query_link = 'index.php?mod=profile&code=' . $act; $where_list = array(); if ('search' == $act) { $province_name = $member['province']; $city_name = $member['city']; $area_name = $member['area']; $street_name = $member['street']; $province = $this->Get['province']; $city = $this->Get['city']; $area = $this->Get['area']; $street = $this->Get['street']; if ($province) { $province_name = DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '{$province}'"); if ($city) { $city_name = DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '{$city}'"); if ($area) { $area_name = DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '{$area}'"); if ($street) { $street_name = DB::result_first("select name from " . TABLE_PREFIX . "common_district where id = '{$street}'"); } else { $street_name = ''; } } else { $area_name = ''; $street_name = ''; } } else { $city_name = ''; $area_name = ''; $street_name = ''; } } if (empty($where_list)) { if ($province_name) { $where_list['province'] = "`province`='" . addslashes("{$province_name}") . "'"; $query_link .= "&province=" . $province; if ($city_name) { $where_list['city'] = "`city`='" . addslashes("{$city_name}") . "'"; $query_link .= "&city=" . $city; if ($area_name) { $where_list['area'] = "`area`='" . addslashes("{$area_name}") . "'"; $query_link .= "&area=" . $area; if ($street_name) { $where_list['street'] = "`street`='" . addslashes("{$street_name}") . "'"; $query_link .= "&street=" . $street; } } } } } $query = $this->DatabaseHandler->Query("select * from " . TABLE_PREFIX . "common_district where `upid` = '0' order by list"); while ($rsdb = $query->GetRow()) { $province_arr[$rsdb['id']]['value'] = $rsdb['id']; $province_arr[$rsdb['id']]['name'] = $rsdb['name']; if ($member['province'] == $rsdb['name']) { $province_id = $rsdb['id']; } } $province_id = $province ? $province : $province_id; $province_list = jform()->Select("province", $province_arr, $province_id, "onchange=\"changeProvince();\""); $hid_area = ''; $hid_city = ''; $hid_street = ''; if (!$province && $province_id) { if ($member['city']) { $hid_city = DB::result_first("select id from " . TABLE_PREFIX . "common_district where name = '{$member['city']}' and upid = '{$province_id}'"); } if ($hid_city) { if ($member['area']) { $hid_area = DB::result_first("select id from " . TABLE_PREFIX . "common_district where name = '{$member['area']}' and upid = '{$hid_city}'"); } if ($hid_area) { if ($member['street']) { $hid_street = DB::result_first("select id from " . TABLE_PREFIX . "common_district where name = '{$member['street']}' and upid = '{$hid_area}'"); } } } } $hid_city = $city ? $city : $hid_city; $hid_area = $area ? $area : $hid_area; $hid_street = $street ? $street : $hid_street; } elseif ('company' == $act && $this->Config['company_enable'] && @is_file(ROOT_PATH . 'include/logic/cp.logic.php')) { global $_J; $companyid = jget('companyid', 'int'); $departmentid = jget('departmentid', 'int'); $jobid = jget('jobid', 'int'); if ($companyid < 1 && $departmentid < 1 && $jobid < 1) { $companyid = (int) $_J['member']['companyid']; $departmentid = (int) $_J['member']['departmentid']; $jobid = (int) $_J['member']['jobid']; } $company_list = jlogic('cp')->get_cp_html($companyid); if ($this->Config['department_enable']) { $department_list = jlogic('cp')->get_cp_html($departmentid, 'department', $companyid); } $job_list = jlogic('job')->get_job_select($jobid); if ($companyid > 0) { $where_list['company'] = "`companyid`='" . $companyid . "'"; $query_link .= '&companyid=' . $companyid; } if ($departmentid > 0) { $where_list['department'] = "`departmentid`='" . $departmentid . "'"; $query_link .= '&departmentid=' . $departmentid; } if ($jobid > 0) { $where_list['job'] = "`jobid`='" . $jobid . "'"; $query_link .= '&jobid=' . $jobid; } } else { global $_J; $roleid = $this->Get['roleid'] ? (int) $this->Get['roleid'] : ($_J['role_id'] ? $_J['role_id'] : 0); $roles = jlogic('channel')->get_user_role(); $role_list = jform()->Select("roleid", $roles, $roleid, ""); if ($roleid) { $where_list['role'] = "`role_id`='" . $roleid . "'"; $query_link .= "&roleid=" . $roleid; } } $member_list = array(); if ($where_list) { $where = empty($where_list) ? null : ' WHERE ' . implode(' AND ', $where_list) . ' '; $order = " order by `uid` desc "; $sql = "select count(*) as `total_record` from `" . TABLE_PREFIX . "members` {$where} "; $total_record = DB::result_first($sql); if ($total_record > 0) { $_config = array('return' => 'array'); $page_arr = page($total_record, $per_page_num, $query_link, $_config); $uids = array(); $member_list = $this->TopicLogic->GetMember("{$where} {$order} {$page_arr['limit']}", "`uid`,`ucuid`,`username`,`nickname`,`face_url`,`face`,`fans_count`,`topic_count`,`province`,`city`,`aboutme`"); foreach ($member_list as $_m) { $uids[$_m['uid']] = $_m['uid']; } if ($uids && MEMBER_ID > 0) { $member_list = buddy_follow_html($member_list); $province = isset($_GET['province']) ? $province : $member['province']; $city = isset($_GET['city']) ? $city : $member['city']; $sql = "select * from (select * from `" . TABLE_PREFIX . "topic` where `uid` in (" . jimplode($uids) . ") and `type` != 'reply' order by `dateline` desc) a group by `uid` "; $query = $this->DatabaseHandler->Query($sql); $tids = array(); while (false != ($row = $query->GetRow())) { $tids[$row['tid']] = $row['tid']; } $topic_list = $this->TopicLogic->Get($tids); } } } $gender_radio = jform()->Radio('gender', array(0 => array('name' => '不限', 'value' => 0), 1 => array('name' => '男', 'value' => 1), 2 => array('name' => '女', 'value' => 2)), $gender); } $this->Title = $act_list[$act]; include template('social/profile_main'); }
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'); }