예제 #1
0
 function followChannel()
 {
     if (MEMBER_ID < 1) {
         $this->Messager(NULL, jurl('index.php?mod=member'));
     }
     $menuHTML = $this->getRegiterMenu(3);
     $channelList = array();
     if ($this->Config['channel_enable'] && $this->Config['reg_step3_radio']) {
         $cachefile = jconf::get('channel');
         $channelFirst = is_array($cachefile['first']) ? $cachefile['first'] : array();
         $channelSecond = is_array($cachefile['second']) ? $cachefile['second'] : array();
         $my_channels = jlogic('channel')->mychannel(MEMBER_ID);
         if ($my_channels) {
             $my_channels_keys = array_keys($my_channels);
         }
         if ($channelFirst) {
             foreach ($channelFirst as $k => $v) {
                 $v['follow_html'] = follow_channel($v['ch_id'], $my_channels_keys ? in_array($val['parent_id'], $my_channels_keys) : 0);
                 $channelList[$k] = $v;
             }
         }
         if ($channelSecond) {
             foreach ($channelSecond as $key => $val) {
                 if ($val['ch_id'] < 0) {
                     return '';
                 }
                 if (isset($channelFirst[$val['parent_id']]) && $channelFirst[$val['parent_id']] > 0) {
                     $val['follow_html'] = follow_channel($val['ch_id'], $my_channels_keys ? in_array($val['ch_id'], $my_channels_keys) : 0);
                     $channelList[$val['parent_id']]['second'][$key] = $val;
                 }
             }
         }
     }
     if ($this->Config['reg_step4_radio']) {
         $redirect_to = jurl('index.php?mod=member&code=follow_member');
     } elseif ($this->Config['reg_step5_radio']) {
         $redirect_to = jurl('index.php?mod=member&code=add_face');
     } elseif ($this->Config['reg_step6_radio']) {
         $redirect_to = jurl('index.php?mod=member&code=member_profile');
     } elseif ($this->Config['reg_step7_radio']) {
         $redirect_to = jurl('index.php?mod=member&code=do_first_topic');
     } else {
         $redirect_to = jurl('index.php?mod=topic');
     }
     if (!$channelList) {
         $this->Messager(NULL, $redirect_to, 0);
     }
     $this->Title = '关注频道';
     include template('register/register_member_channel');
 }
예제 #2
0
 function add()
 {
     $GLOBALS['disable_show_msg'] = 1;
     $response = '';
     $follow_button = $this->Post['follow_button'];
     if (MEMBER_ID < 1) {
         js_show_login('登录后才能执行此操作');
     }
     $uid = jpost('uid', 'int');
     if ($follow_button == 'channel' || $follow_button == 'channelnav') {
         $isbuddy = jlogic('channel')->channel_isbuddy($uid);
         $can_buddy = jlogic('channel')->can_view_topic($uid);
         if ($isbuddy) {
             jlogic('channel')->buddy_channel($uid, 0);
             $response = follow_channel($uid, 0);
         } else {
             if ($can_buddy) {
                 jlogic('channel')->buddy_channel($uid, 1);
                 $response = follow_channel($uid, 1);
             } else {
                 $response = '';
             }
         }
     } elseif ($this->Config['department_enable'] && $follow_button == 'department') {
         $isbuddy = DB::result_first("SELECT count(*) FROM " . DB::table('buddy_department') . " WHERE uid = '" . MEMBER_ID . "' AND did = '{$uid}'");
         if ($isbuddy) {
             DB::query("DELETE FROM " . DB::table('buddy_department') . " WHERE uid = '" . MEMBER_ID . "' AND did = '{$uid}'");
             $response = follow_department($uid, 0);
         } else {
             DB::query("INSERT INTO " . DB::table('buddy_department') . " (`uid`,`did`) values ('" . MEMBER_ID . "','{$uid}')");
             $response = follow_department($uid, 1);
         }
     } else {
         $rets = buddy_add($uid, MEMBER_ID, 1);
         if ($rets) {
             if ($rets['error']) {
                 js_alert_output($rets['error']);
             } else {
                 if ($follow_button == 'xiao') {
                     $response = follow_html2($uid, 0, 0, 0);
                 } else {
                     $response = follow_html($uid, 0, 0, 0);
                 }
             }
         } else {
             if ($follow_button == 'xiao') {
                 $response = follow_html2($uid, 1, 0, 0);
             } else {
                 $response = follow_html($uid, 1, 0, 0);
             }
         }
         $response .= '<success></success>';
         $u_nickname = DB::result_first("SELECT `nickname` FROM " . DB::table('members') . " WHERE uid = '{$uid}'");
         $response .= $u_nickname;
     }
     response_text($response);
 }
예제 #3
0
 function getChannelAll()
 {
     $channles = array();
     $my_channels = $this->mychannel();
     $my_channels_key = array_keys($my_channels);
     $query = DB::query("SELECT ch_id,ch_name,topic_num,total_topic_num,parent_id,buddy_numbers,picture FROM " . DB::table('channel') . " ORDER BY parent_id ASC,display_order ASC");
     while ($value = DB::fetch($query)) {
         $parent_id = $value['parent_id'];
         $value['picture'] = $value['picture'] ? $value['picture'] : './images/channelimg.gif';
         unset($value['parent_id']);
         if ($value['total_topic_num'] > $value['topic_num']) {
             $value['topic_num'] = $value['total_topic_num'];
         }
         unset($value['total_topic_num']);
         $value['channel_buddy'] = follow_channel($value['ch_id'], in_array($value['ch_id'], $my_channels_key));
         if ($parent_id == 0) {
             $channles[$value['ch_id']] = $value;
         } else {
             $channles[$parent_id]['child'][$value['ch_id']] = $value;
         }
     }
     return $channles;
 }
예제 #4
0
 function main()
 {
     $member = jsg_member_info(MEMBER_ID);
     if (!($this->Channel_enable && $this->Config['channel_enable'])) {
         $this->Messager("网站没有开启频道功能", null);
     }
     $channel_id = jget('id', 'int', 'G');
     if (!$channel_id) {
         $formchannel = true;
         $channeltoptopic = jlogic('channel')->getChannelTopTopic();
         $channelrectopic = jlogic('channel')->getChannelRecTopic();
         $channellist = jlogic('channel')->getChannelAll();
         $userfanstop = jlogic('channel')->getUserFansTop();
         $this->Title = '频道首页';
         $this->MetaKeywords = '频道首页';
         $this->MetaDescription = '微博频道,频道首页';
         include template('channel/channel_index');
     } else {
         $this->Channel = $channel_id == 0 ? '' : $channel_id;
         if (MEMBER_ID > 0) {
             jlogic('member')->clean_new_remind('channel_new', MEMBER_ID);
         }
         $cachefile = jconf::get('channel');
         $channel_channels = is_array($cachefile['channels']) ? $cachefile['channels'] : array();
         $channel_types = is_array($cachefile['channel_types']) ? $cachefile['channel_types'] : array();
         $channel_template = $channel_types[$channel_id]['template'] ? $channel_types[$channel_id]['template'] : 'channel';
         $my_channels = jlogic('channel')->mychannel(MEMBER_ID);
         if (in_array($channel_id, array_keys($channel_channels))) {
             $channel_buddy = follow_channel($channel_id, in_array($channel_id, array_keys($my_channels)));
         }
         $thischannels = jlogic('channel')->getThisChannel($channel_id);
         $my_cannot_view_chids = jlogic('channel')->get_my_cannot_view_chids();
         $item_ids = $channel_channels[$channel_id] && is_array($channel_channels[$channel_id]) ? $channel_channels[$channel_id] : array(0);
         if ($my_cannot_view_chids) {
             foreach ($item_ids as $key => $val) {
                 if (in_array($val, $my_cannot_view_chids)) {
                     unset($item_ids[$key]);
                 }
             }
         }
         if (empty($item_ids)) {
             $this->Messager("您没有权限查看该频道下的微博", null);
         }
         $this->Title = $thischannels['name'] . ' - 频道 ';
         $this->MetaKeywords = $thischannels['name'];
         $this->MetaDescription = $thischannels['description'] ? $thischannels['description'] : $thischannels['name'];
         $channel_description = $thischannels['description'];
         $channel_managers = jlogic('channel')->get_channel_manager($channel_id);
         $channel_nav = $thischannels['navhtml'];
         $per_page_num = 20;
         $where = $order = '';
         $topic_type = array('first', 'channel');
         $featurelist = $channel_types[$channel_id]['feature'];
         if ($featurelist) {
             if (!$featurelist[0]) {
                 $featurelist = array(0 => '等待处理') + $featurelist;
             }
             $featureid = (int) $this->Get['view'];
             if (isset($_GET['view'])) {
                 $where = " featureid = '{$featureid}' ";
             }
         } else {
             $time = TIMESTAMP - 7 * 24 * 3600;
             $filter_view = $filter_list = $channel_buddy = '';
             $filter_list = in_array($this->Get['list'], array('pic', 'txt')) ? $this->Get['list'] : '';
             $filter_url = $filter_list ? '&list=' . $filter_list : '';
             $filter_list = $filter_list ? $filter_list : ($thischannels['list'] ? $thischannels['list'] : 'txt');
             $filter_view = in_array($this->Get['view'], array('post', 'dig', 'mark', 'ldig', 'top')) ? $this->Get['view'] : '';
             $filter_url .= $filter_view ? '&view=' . $filter_view : '';
             $filter_view = $filter_view ? $filter_view : ($thischannels['view'] ? $thischannels['view'] : 'post');
             if ($filter_view == 'mark') {
                 $order = 'lastupdate DESC';
             } elseif ($filter_view == 'dig') {
                 $where = 'digcounts > 0';
                 $order = 'lastdigtime DESC';
             } elseif ($filter_view == 'ldig') {
                 $where = 'digcounts > 0 AND lastdigtime >= ' . $time;
                 $order = 'digcounts DESC,lastdigtime DESC';
             }
         }
         if ($filter_view == 'top' && !$channel_types[$channel_id]['channel_type']) {
             $where = $item_ids ? "tr.item = 'channel' AND tr.item_id IN(" . implode(",", $item_ids) . ")" : "tr.item = 'channel'";
             $options = array('where' => $where, 'perpage' => $per_page_num, 'type' => $topic_type);
             $info = jlogic('topic_list')->get_recd_list($options);
         } else {
             $options = array('order' => $order, 'item' => 'channel', 'item_id' => $item_ids, 'where' => $where, 'perpage' => $per_page_num, 'type' => $topic_type);
             $info = jlogic('topic_list')->get_data($options);
         }
         $topics = array();
         $total_record = 0;
         if (!empty($info)) {
             $topics = $info['list'];
             $total_record = $info['count'];
             if ($info['page']) {
                 $page_arr = $info['page'];
             }
         }
         $topics_count = 0;
         if ($topics) {
             $topics_count = count($topics);
             if (!$topic_parent_disable) {
                 $parent_list = jlogic('topic')->GetParentTopic($topics, 'mycomment' == $this->Code);
             }
             $relate_list = jlogic('topic')->GetRelateTopic($topics);
         }
         if ($filter_list == 'pic' && !$channel_types[$channel_id]['channel_type']) {
             if ($page_arr['html']) {
                 $ajax_num = ceil($total_record / $per_page_num);
             }
             foreach ($topics as $key => $row) {
                 if ($row['parent_id'] || $row['top_parent_id']) {
                     unset($topics[$key]);
                 }
             }
             $topic_pic_keys = array('ji', 'shi', 'gou');
             $params['id'] = base64_encode(serialize($item_ids));
             include template('channel/channel_pic');
         } else {
             $child_channel = jlogic('channel')->get_child_channel($channel_id);
             include template('channel/' . $channel_template);
         }
     }
 }