示例#1
0
 private function _sns($space)
 {
     $this->load->model('sns_model');
     $name = $this->input->get('name');
     $urlrule = '';
     switch ($name) {
         case 'follow':
             // 关注列表
             $title = lang('m-360');
             $template = 'follow.html';
             break;
         case 'fans':
             // 粉丝列表
             $title = lang('m-354');
             $template = 'fans.html';
             break;
         case 'topic':
             // 话题列表
             $id = (int) $this->input->get('id');
             $topic = $this->db->where('id', $id)->get('sns_topic')->row_array();
             if (!$topic) {
                 $this->msg(lang('m-204'));
             }
             $this->template->assign(array('topic' => $topic, 'topic_sql' => 'select * from ' . $this->db->dbprefix('sns_feed') . ' where id IN (select fid from ' . $this->db->dbprefix('sns_topic_index') . ' where tid=' . $topic['id'] . ') order by inputtime desc'));
             $title = dr_lang('m-205', $topic['name']);
             $urlrule = dr_space_sns_url($space['uid'], 'topic', $id, '[page]');
             $template = 'topic.html';
             break;
         case 'show':
             // 动态详情
             $id = (int) $this->input->get('id');
             $data = dr_sns_feed($id);
             if (!$data) {
                 $this->msg(lang('m-249'));
             }
             $title = lang('m-362');
             $template = 'show_feed.html';
             $this->template->assign(array('data' => $data));
             break;
         case 'access':
             // 访客列表
             $title = lang('m-361');
             $template = 'access.html';
             break;
         default:
             // 动态列表
             $title = lang('m-362');
             $template = 'list_feed.html';
             break;
     }
     $this->template->assign(array('title' => $title, 'urlrule' => $urlrule ? $urlrule : dr_space_sns_url($space['uid'], $name, '[page]'), 'meta_title' => $title . SITE_SEOJOIN . ($space['title'] ? $space['title'] : $space['name']), 'meta_keywords' => $space['keywords'], 'meta_description' => $space['description']));
     return $template;
 }
示例#2
0
 public function comment_list()
 {
     $fid = (int) $this->input->get('id');
     $more = (int) $this->input->get('more');
     $page = max((int) $this->input->get('page'), 1);
     // 动态详情
     $data = dr_sns_feed($fid);
     if (!$data) {
         if ($this->callback) {
             exit($this->callback . '(' . json_encode(array('html' => '')) . ')');
         } else {
             exit('');
         }
     } else {
         // 显示方式
         $more = $more ? $data['comment'] > 5 ? 1 : 0 : 0;
         $pagesize = $more ? 5 : $this->pagesize;
         $this->template->assign(array('fid' => $fid, 'more' => $more, 'list' => $this->db->where('fid', $fid)->order_by('inputtime desc')->limit($pagesize, $pagesize * ($page - 1))->get('sns_comment')->result_array()));
         if ($this->callback) {
             ob_start();
             $this->template->display('sns_comment.html');
             $html = ob_get_contents();
             ob_clean();
             exit($this->callback . '(' . json_encode(array('html' => $html)) . ')');
         } else {
             $this->template->display('sns_comment.html');
         }
     }
 }
示例#3
0
文件: Sns.php 项目: xxjuan/php-coffee
 public function repost()
 {
     $id = (int) $this->input->get('id');
     if (IS_POST) {
         // 执行转发操作
         $content = trim(dr_safe_replace($this->input->post('content')));
         if (!$content) {
             exit(dr_json(0, lang('m-250')));
         }
         $this->member_model->add_sns($this->uid, $content, '', 0, $id);
         exit(dr_json(1, lang('m-251')));
         exit;
     }
     // 转发数据
     $data = dr_sns_feed($id);
     if (!$data) {
         exit(lang('m-249'));
     }
     $data = $data['repost_id'] ? dr_sns_feed($data['repost_id']) : $data;
     // 表情符号
     $this->load->helper('directory');
     $this->template->assign('emotion', directory_map(FCPATH . 'member/statics/emotions/', 1));
     $this->template->assign(array('data' => $data, 'group' => $this->db->where('uid', $this->uid)->order_by('ctime desc')->get('sns_follow_group')->result_array()));
     $this->template->display('sns_repost.html');
 }