Example #1
0
 function View()
 {
     $uid = MEMBER_ID;
     $member = $this->_topicLogicGetMember($uid);
     $params = array();
     $tag = get_safe_code($this->Code);
     if (!$tag) {
         $this->Messager("请输入正确的链接地址", null);
     }
     $f_rets = filter($tag, 0, 0);
     if ($f_rets && $f_rets['error']) {
         $this->Messager("输入的话题  " . $f_rets['msg'], null);
     }
     $sql = "select * from `" . TABLE_PREFIX . "tag` where `name`='" . addslashes($tag) . "'";
     $query = $this->DatabaseHandler->Query($sql);
     $tag_info = $query->GetRow();
     $tag_id = $tag_info['id'];
     $total_record = $tag_info['topic_count'];
     $this->TopicLogic = jlogic('topic');
     if ($total_record > 0) {
         $params['tag_id'] = $tag_id;
         $query_link = "index.php?mod=" . ($_GET['mod_original'] ? get_safe_code($_GET['mod_original']) : $this->Module) . ($tag ? "&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');
 }
Example #2
0
 function Province()
 {
     $pid = (int) $this->Get['pid'];
     if ($pid) {
         $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}' ");
         $categoryname = $province_ary['name'];
         $province_where_list = "where `upid` = 0";
         $province_ary = $this->ValidateLogic->CategoryCityList($province_where_list);
         $city_where_list = "where `upid` = '{$pid}'";
         $is_check_user = 1;
         $city_ary = $this->ValidateLogic->CategoryCityList($city_where_list, $is_check_user);
         $config = jconf::get();
         $people_config = $config['validate_people_setting'];
         $where = "where `is_push` = 2";
         $limit = $people_config['proviect_user_limit'] ? $people_config['proviect_user_limit'] : 20;
         $members_arr = $this->ValidateLogic->CategoryUserList($where, $limit, $people_config['proviect_user_orderby']);
         $member_list = $members_arr['member'];
         $member_uids = $members_arr['uids'];
         Load::logic("topic_list");
         $TopicListLogic = new TopicListLogic($this);
         $per_page_num = $people_config['proviect_topic_limit'] ? $people_config['proviect_topic_limit'] : 10;
         $query_link = "index.php?mod=" . ($_GET['mod_original'] ? get_safe_code($_GET['mod_original']) : $this->Module) . ($this->Code ? "&amp;code={$this->Code}&d={$d}" : "");
         $options = array('perpage' => $per_page_num, 'page_url' => $query_link, 'type' => 'first', 'where' => " `uid` in('" . implode("','", $member_uids) . "') ", 'order' => "`dateline` DESC ");
         $topic_list = $TopicListLogic->get_data($options);
         if (!empty($topic_list)) {
             $page_arr = $topic_list['page'];
             $topics = $topic_list['list'];
             $total_record = $topic_list['count'];
         }
         $limit = 9;
         if ($city_ary) {
             foreach ($city_ary as $row) {
                 $where_list['city'] = build_like_query('city', $row['name']);
                 $where = ' where ' . implode(' AND ', $where_list) . ' and `validate` !="" order by `fans_count` desc limit 0,9';
                 $_list = $this->TopicLogic->GetMember($where, "`uid`,`ucuid`,`city`,`username`,`aboutme`,`nickname`,`face_url`,`face`,`validate`,`validate_category`");
                 if ($_list) {
                     foreach ($_list as $row) {
                         $row['validate_html'] = $row['validate_html'];
                         $members[] = $row;
                     }
                 }
             }
         }
     }
     $this->Title = "名人堂";
     include template("people/people_province_view");
 }
Example #3
0
 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');
     }
 }
Example #4
0
 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');
 }