예제 #1
0
 /**
  * 新窗口打开下载
  */
 public function filedown()
 {
     $downfile = decode($GLOBALS['str']);
     $downloadtype = intval(substr($downfile, 0, 1));
     $downfile = substr($downfile, 1);
     if (!$downloadtype) {
         $downfile = private_file($downfile);
     }
     $cid = isset($GLOBALS['cid']) ? intval($GLOBALS['cid']) : 0;
     $id = isset($GLOBALS['id']) ? intval($GLOBALS['id']) : 0;
     $siteconfigs = $this->siteconfigs;
     $categorys = get_cache('category', 'content');
     //查询数据
     if ($cid && $id) {
         $category = get_cache('category_' . $cid, 'content');
         $models = get_cache('model_content', 'model');
         $model_r = $models[$category['modelid']];
         $master_table = $model_r['master_table'];
         $data = $this->db->get_one($master_table, array('id' => $id));
         if (!$data || $data['status'] != 9) {
             MSG('信息不存在或者未通过审核!');
         }
         if ($model_r['attr_table']) {
             $attr_table = $model_r['attr_table'];
             if ($data['modelid']) {
                 $modelid = $data['modelid'];
                 $attr_table = $models[$modelid]['attr_table'];
             }
             $attrdata = $this->db->get_one($attr_table, array('id' => $id));
             $data = array_merge($data, $attrdata);
         }
         require get_cache_path('content_format', 'model');
         $form_format = new form_format($model_r['modelid']);
         $data = $form_format->execute($data);
         foreach ($data as $_key => $_value) {
             if ($_key == 'downfile') {
                 continue;
             }
             ${$_key} = $_value['data'];
         }
         $_groupid = get_cookie('_groupid');
         if (!empty($groups)) {
             $groups_arr = explode(',', $groups);
             if (!in_array($_groupid, $groups_arr)) {
                 MSG('您所在到会员组没有下载权限');
             }
         }
         $seo_title = $title . '下载_' . $siteconfigs['sitename'];
     } else {
         $seo_title = '文件下载_' . $siteconfigs['sitename'];
     }
     include T('content', 'download', TPLID);
 }
예제 #2
0
 /**
  * 内容页面
  * url规则 /index.php?v=show&cid=24&id=79
  */
 public function show()
 {
     $siteconfigs = $this->siteconfigs;
     $id = isset($GLOBALS['id']) ? intval($GLOBALS['id']) : MSG(L('parameter_error'));
     $cid = isset($GLOBALS['cid']) ? intval($GLOBALS['cid']) : MSG(L('parameter_error'));
     if ($cid == 0) {
         MSG(L('parameter_error'));
     }
     $categorys = get_cache('category', 'content');
     //查询数据
     $category = get_cache('category_' . $cid, 'content');
     $models = get_cache('model_content', 'model');
     if (!$category) {
         MSG(L('parameter_error'));
     }
     $model_r = $models[$category['modelid']];
     if (!$model_r) {
         MSG(L('parameter_error'));
     }
     $master_table = $model_r['master_table'];
     $data = $this->db->get_one($master_table, array('id' => $id));
     if (!$data || $data['status'] != 9) {
         MSG('信息不存在或者未通过审核!');
     }
     if ($model_r['attr_table']) {
         $attr_table = $model_r['attr_table'];
         if ($data['modelid']) {
             $modelid = $data['modelid'];
             $attr_table = $models[$modelid]['attr_table'];
         }
         $attrdata = $this->db->get_one($attr_table, array('id' => $id));
         $data = array_merge($data, $attrdata);
     } else {
         $modelid = $model_r['modelid'];
     }
     $data_r = $data;
     $urlrule = $category['showurl'];
     if ($category['showhtml']) {
         $urlrules = explode('|', $urlrule);
         $urlrule = WWW_PATH . $urlrules[0] . '|' . WWW_PATH . $urlrules[1];
     }
     require get_cache_path('content_format', 'model');
     $form_format = new form_format($modelid);
     $data = $form_format->execute($data);
     foreach ($data as $_key => $_value) {
         ${$_key} = $_value['data'];
     }
     if ($template) {
         $_template = $template;
     } elseif ($category['show_template']) {
         $_template = $category['show_template'];
     } elseif ($model_r['template']) {
         $_template = TPLID . ':' . $model_r['template'];
     } else {
         $_template = TPLID . ':show';
     }
     $styles = explode(':', $_template);
     $project_css = isset($styles[0]) ? $styles[0] : 'default';
     $_template = isset($styles[1]) ? $styles[1] : 'show';
     $addtime = $data_r['addtime'];
     $elasticid = elasticid($cid);
     $seo_title = $title . '_' . $category['name'] . '_' . $siteconfigs['sitename'];
     $seo_keywords = !empty($keywords) ? implode(',', $keywords) : '';
     $seo_description = $remark;
     //上一页
     $previous_page = $this->db->get_one($master_table, "`cid`= '{$cid}' AND `id`>'{$id}' AND `status`=9", '*', 0, 'id ASC');
     //下一页
     $next_page = $this->db->get_one($master_table, "`cid` = '{$cid}' AND `id`<'{$id}' AND `status`=9", '*', 0, 'id DESC');
     //手动分页
     $CONTENT_POS = strpos($content, '_wuzhicms_page_tag_');
     if (!empty($content) && $CONTENT_POS !== false) {
         $page = max($GLOBALS['page'], 1);
         $contents = array_filter(explode('_wuzhicms_page_tag_', $content));
         $pagetotal = count($contents);
         $content = $contents[$page - 1];
         $tmp_year = date('Y', $addtime);
         $tmp_month = date('m', $addtime);
         $tmp_day = date('d', $addtime);
         $content_pages = pages($pagetotal, $page, 1, $urlrule, array('categorydir' => $category['parentdir'], 'year' => $tmp_year, 'month' => $tmp_month, 'day' => $tmp_day, 'catdir' => $category['catdir'], 'cid' => $cid, 'id' => $id));
     } else {
         $content_pages = '';
     }
     include T('content', $_template, $project_css);
 }
예제 #3
0
 public function show()
 {
     load_function('common', 'member');
     $siteconfigs = $this->siteconfigs;
     $id = isset($GLOBALS['id']) ? intval($GLOBALS['id']) : MSG(L('parameter_error'));
     $categorys = get_cache('category', 'content');
     //查询数据
     $models = get_cache('model_guestbook', 'model');
     $model_r = $models[15];
     $master_table = $model_r['master_table'];
     $data = $this->db->get_one($master_table, array('id' => $id));
     require get_cache_path('content_format', 'model');
     $form_format = new form_format($model_r['modelid']);
     $data = $form_format->execute($data);
     foreach ($data as $_key => $_value) {
         ${$_key} = $_value['data'];
     }
     $_template = TPLID . ':show';
     $styles = explode(':', $_template);
     $project_css = isset($styles[0]) ? $styles[0] : 'default';
     $_template = isset($styles[1]) ? $styles[1] : 'show';
     $seo_title = $title . '_' . $siteconfigs['sitename'];
     $seo_keywords = !empty($keywords) ? implode(',', $keywords) : '';
     $seo_description = $remark;
     $this->db->update($master_table, "`hits`=(`hits`+1)", array('id' => $id));
     include T('guestbook', 'show');
 }
예제 #4
0
 /**
  * 查看用户信息
  */
 public function view()
 {
     $uid = (int) $GLOBALS['uid'];
     if ($uid) {
         $member = $this->db->get_one('member', '`uid`=' . $uid, '*');
     }
     if (empty($member)) {
         MSG(L('user not_exists'));
     }
     if (isset($GLOBALS['modelid']) && $GLOBALS['modelid'] != $member['modelid']) {
         $modelid = (int) $GLOBALS['modelid'];
     } else {
         $modelid = $member['modelid'];
     }
     //	判断是否有模型id参数
     if ($modelid) {
         require get_cache_path('content_format', 'model');
         $form_format = new form_format($modelid);
         $data = $form_format->execute($member);
     }
     $fields = $form_format->fields;
     $fields['mobile']['name'] = '手机';
     $fields['email']['name'] = 'email';
     $fields['username']['name'] = '用户名';
     $fields['truename']['name'] = '真是姓名';
     $fields['money']['name'] = '拥有金额';
     $fields['points']['name'] = '积分';
     $fields['identity_card']['name'] = '身份证号';
     $fields['address']['name'] = '地址';
     $fields['livecity']['name'] = '居住城市';
     $group = $this->group;
     include $this->template('member_view', M);
 }
예제 #5
0
 /**
  * 内容预览
  */
 public function view()
 {
     load_function('content', 'content');
     $siteconfigs = get_cache('siteconfigs');
     $id = isset($GLOBALS['id']) ? intval($GLOBALS['id']) : MSG(L('parameter_error'));
     $cid = isset($GLOBALS['cid']) ? intval($GLOBALS['cid']) : MSG(L('parameter_error'));
     $categorys = get_cache('category', 'content');
     //查询数据
     $category = get_cache('category_' . $cid, 'content');
     if (empty($category)) {
         MSG('栏目不存在');
     }
     $models = get_cache('model_content', 'model');
     $model_r = $models[$category['modelid']];
     $siteid = $category['siteid'];
     $master_table = $model_r['master_table'];
     $data = $this->db->get_one($master_table, array('id' => $id));
     if ($model_r['attr_table']) {
         $attr_table = $model_r['attr_table'];
         if ($data['modelid']) {
             $modelid = $data['modelid'];
             $attr_table = $models[$modelid]['attr_table'];
         }
         $attrdata = $this->db->get_one($attr_table, array('id' => $id));
         $data = array_merge($data, $attrdata);
     } else {
         $modelid = $model_r['modelid'];
     }
     $model_r = $models[$modelid];
     require get_cache_path('content_format', 'model');
     $form_format = new form_format($modelid);
     $data = $form_format->execute($data);
     foreach ($data as $_key => $_value) {
         ${$_key} = $_value['data'];
     }
     if ($template) {
         $_template = $template;
     } elseif ($model_r['template']) {
         $template_set = unserialize($model_r['template_set']);
         $_template = $template_set[$siteid];
     } else {
         $_template = TPLID . ':show';
     }
     $styles = explode(':', $_template);
     $project_css = isset($styles[0]) ? $styles[0] : '1';
     $_template = isset($styles[1]) ? $styles[1] : 'show';
     $elasticid = elasticid($cid);
     $seo_title = $title . '_' . $category['name'] . '_' . $siteconfigs['sitename'];
     $seo_keywords = !empty($keywords) ? implode(',', $keywords) : '';
     $seo_description = $remark;
     //上一页
     $previous_page = $this->db->get_one($master_table, "`cid` = '{$cid}' AND `id`<'{$id}' AND `status`=9", '*', 0, 'id DESC');
     //下一页
     $next_page = $this->db->get_one($master_table, "`cid`= '{$cid}' AND `id`>'{$id}' AND `status`=9", '*', 0, 'id ASC');
     include T('content', $_template, $project_css);
     include $this->template('check_foot');
 }