Exemplo n.º 1
0
 /**
  * 模块内容页
  */
 protected function _show($id = NULL, $page = 1, $return = FALSE)
 {
     // 缓存查询结果
     $name = (SITE_MOBILE === TRUE ? 'm' : '') . 'show' . $this->dir . SITE_ID . $id;
     $data = $this->get_cache_data($name);
     if (!$data) {
         $this->load->model('content_model');
         $data = $this->content_model->get($id);
         if (!$data) {
             if ($return) {
                 return NULL;
             }
             $this->goto_404_page(dr_lang('mod-30', $id));
         }
         $mod = $this->get_cache('module-' . SITE_ID . '-' . $this->dir);
         if (!$mod) {
             if ($return) {
                 return NULL;
             }
             $this->msg(lang('m-148'));
         }
         // 检测转向字段
         $redirect = 0;
         foreach ($mod['field'] as $t) {
             if ($t['fieldtype'] == 'Redirect' && $data[$t['fieldname']]) {
                 $this->link->where('id', $id)->set('hits', 'hits+1', FALSE)->update(SITE_ID . '_' . $this->dir);
                 if (MODULE_HTML) {
                     $redirect = 1;
                     $data['goto_url'] = $data[$t['fieldname']];
                     break;
                 } else {
                     redirect($data[$t['fieldname']], 'location', 301);
                     exit;
                 }
             }
         }
         $cat = $mod['category'][$data['catid']];
         // 处理关键字标签
         $data['tag'] = $data['keywords'];
         if ($data['keywords']) {
             $array = explode(',', $data['keywords']);
             $data['keywords'] = array();
             foreach ($array as $t) {
                 $data['keywords'][$t] = dr_tag_url($mod, $t);
             }
         }
         // 上一篇文章
         $data['prev_page'] = $this->link->where('catid', $data['catid'])->where('id<', $id)->where('status', 9)->order_by('id desc')->limit(1)->get($this->content_model->prefix)->row_array();
         // 下一篇文章
         $data['next_page'] = $this->link->where('catid', $data['catid'])->where('id>', $id)->where('status', 9)->order_by('id asc')->limit(1)->get($this->content_model->prefix)->row_array();
         // 缓存数据
         if ($data['uid'] != $this->uid) {
             $data = $this->set_cache_data($name, $data, $mod['setting']['show_cache']);
         }
         $this->set_cache_data('hits' . $this->dir . SITE_ID . $id, $data['hits'], $mod['setting']['show_cache']);
     } else {
         $mod = $this->get_cache('module-' . SITE_ID . '-' . $this->dir);
         $cat = $mod['category'][$data['catid']];
     }
     // 拒绝访问判断
     if (isset($cat['permission'][$this->markrule]['show']) && $cat['permission'][$this->markrule]['show']) {
         if ($return) {
             return NULL;
         }
         $this->msg(lang('m-338'));
     }
     // 格式化输出自定义字段
     $fields = $mod['field'];
     $fields = $cat['field'] ? array_merge($fields, $cat['field']) : $fields;
     $fields['inputtime'] = array('fieldtype' => 'Date');
     $fields['updatetime'] = array('fieldtype' => 'Date');
     $data = $this->field_format_value($fields, $data, $page);
     // 栏目下级或者同级栏目
     list($parent, $related) = $this->_related_cat($mod, $data['catid']);
     $this->template->assign($data);
     $this->template->assign(dr_show_seo($mod, $data, $page));
     $this->template->assign(array('cat' => $cat, 'page' => $page, 'params' => array('catid' => $data['catid']), 'parent' => $parent, 'related' => $related, 'urlrule' => $this->mobile ? dr_mobile_show_url($this->dir, $id, '{page}') : dr_show_url($mod, $data, '{page}')));
     $tpl = $cat['setting']['template']['show'];
     $tpl = $tpl ? $tpl : 'show.html';
     $tpl = isset($data['template']) && strpos($data['template'], '.html') !== FALSE ? $data['template'] : $tpl;
     if (!$return) {
         $this->template->display($tpl);
     }
     // 存在转向字段时处理方式
     return array($data, $redirect ? 'go' : $tpl);
 }
Exemplo n.º 2
0
 /**
  * 模块内容页
  */
 protected function _show($id = NULL, $page = 1, $return = FALSE)
 {
     /*zjp 0810 添加网上反馈信息的提交start*/
     $type = $this->input->post('type');
     if (APP_DIR == 'question') {
         $id = $this->input->get('id');
         $this->template->assign('id', $id);
         $this->load->model("content_model");
         $data = $this->content_model->get_question($id);
         $this->template->assign('question', $data['question']);
         $this->template->assign('option', $data['option']);
         $this->template->assign('answer', $data['answer']);
         $this->template->assign('total', $data['total']);
         $title1 = $this->content_model->get_question_name($id);
         $this->template->assign('title1', $title1);
     }
     /*zjp 0810 添加网上反馈信息的提交  end*/
     //zjp添加,动态显示日期天气温度
     //$city="宜春";
     //$content = file_get_contents("http://api.map.baidu.com/telematics/v3/weather?location=宜春&output=json&ak=i8GFDZTM22uqICZbtioaVbnk");
     //$de_json = json_decode($content,TRUE);
     $id = intval($id);
     // 缓存查询结果
     $name = (SITE_MOBILE === TRUE ? 'm' : '') . 'show' . $this->dir . SITE_ID . $id;
     $data = $this->get_cache_data($name);
     if (!$data) {
         $this->load->model('content_model');
         $data = $this->content_model->get($id);
         if (!$data) {
             if ($return) {
                 return NULL;
             }
             $this->goto_404_page(dr_lang('mod-30', $id));
         }
         $mod = $this->get_cache('module-' . SITE_ID . '-' . $this->dir);
         if (!$mod) {
             if ($return) {
                 return NULL;
             }
             $this->msg(lang('m-148'));
         }
         // 检测转向字段
         $redirect = 0;
         foreach ($mod['field'] as $t) {
             if ($t['fieldtype'] == 'Redirect' && $data[$t['fieldname']]) {
                 $this->link->where('id', $id)->set('hits', 'hits+1', FALSE)->update(SITE_ID . '_' . $this->dir);
                 if (MODULE_HTML) {
                     $redirect = 1;
                     $data['goto_url'] = $data[$t['fieldname']];
                     break;
                 } else {
                     redirect($data[$t['fieldname']], 'location', 301);
                     exit;
                 }
             }
         }
         $cat = $mod['category'][$data['catid']];
         // 处理关键字标签
         $data['tag'] = $data['keywords'];
         if ($data['keywords']) {
             $array = explode(',', $data['keywords']);
             $data['keywords'] = array();
             foreach ($array as $t) {
                 $t = trim($t);
                 if ($t) {
                     $data['keywords'][$t] = dr_tag_url($mod, $t);
                 }
             }
         }
         if (APP_DIR != "wsxf") {
             //zjp 0814 添加wsxf判断条件
             if (APP_DIR != "wsfk") {
                 // 上一篇文章
                 $data['prev_page'] = $this->link->where('catid', $data['catid'])->where('id<', $id)->where('status', 9)->order_by('id desc')->limit(1)->get($this->content_model->prefix)->row_array();
                 // 下一篇文章
                 $data['next_page'] = $this->link->where('catid', $data['catid'])->where('id>', $id)->where('status', 9)->order_by('id asc')->limit(1)->get($this->content_model->prefix)->row_array();
                 // 缓存数据
                 if ($data['uid'] != $this->uid) {
                     $data = $this->set_cache_data($name, $data, $mod['setting']['show_cache']);
                 }
                 $this->set_cache_data('hits' . $this->dir . SITE_ID . $id, $data['hits'], $mod['setting']['show_cache']);
             }
         }
     } else {
         $mod = $this->get_cache('module-' . SITE_ID . '-' . $this->dir);
         $cat = $mod['category'][$data['catid']];
     }
     // 拒绝访问判断
     if (isset($cat['permission'][$this->markrule]['show']) && $cat['permission'][$this->markrule]['show']) {
         if ($return) {
             return NULL;
         }
         $this->msg(lang('m-338'));
     }
     // 格式化输出自定义字段
     $fields = $mod['field'];
     $fields = $cat['field'] ? array_merge($fields, $cat['field']) : $fields;
     $fields['inputtime'] = array('fieldtype' => 'Date');
     $fields['updatetime'] = array('fieldtype' => 'Date');
     $data = $this->field_format_value($fields, $data, $page);
     // 判断分页
     if ($page && isset($data['content_page']) && $data['content_page'] && !$data['content_page'][$page]) {
         if ($return) {
             return NULL;
         }
         $this->goto_404_page(lang('m-363'));
     }
     // 栏目下级或者同级栏目
     list($parent, $related) = $this->_related_cat($mod, $data['catid']);
     $this->template->assign('updatetime', $fields['updatetime']);
     $this->template->assign($data);
     $this->template->assign('aaa', $data['_inputtime']);
     $this->template->assign(dr_show_seo($mod, $data, $page));
     $this->template->assign(array('cat' => $cat, 'page' => $page, 'parent' => $parent, 'params' => array('catid' => $data['catid']), 'related' => $related, 'urlrule' => $this->mobile ? dr_mobile_show_url($this->dir, $id, '{page}') : dr_show_url($mod, $data, '{page}'), 'de_json' => $_SESSION["de_json"]));
     /*zjp 0819 网上信访前台页面已回复未回复数量显示start
           $yi_num = $this->content_model->count_wsxf_yi();
           $this->template->assign('yi',$yi_num[0]['yi']);
           $wei_num = $this->content_model->count_wsxf_wei();
           $this->template->assign('wei',$wei_num[0]['wei']);
       /*zjp 0819 网上信访前台页面已回复未回复数量显示  end*/
     $tpl = isset($data['template']) && strpos($data['template'], '.html') !== FALSE ? $data['template'] : ($cat['setting']['template']['show'] ? $cat['setting']['template']['show'] : 'show.html');
     if (!$return) {
         $this->template->display($tpl);
     }
     // 存在转向字段时处理方式
     return array($data, $redirect ? 'go' : $tpl);
 }