/** * 新窗口打开下载 */ 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); }
/** * 私密文件生成及下载 */ function index() { load_function('content', 'content'); echo private_file('http://dev.wuzhicms.com/uploadfile/2014/12/09/1418090546149321.pdf', 1); }
private function downfile($field, $value) { $setting = $this->fields[$field]['setting']; if ($setting['linktype']) { if ($setting['downloadtype']) { return $value; } else { return private_file($value); } } else { return WEBURL . 'index.php?f=down&v=filedown&str=' . urlencode(encode($setting['downloadtype'] . $value)); } }
public function subscribe() { $status = array(); $status[1] = '待使用'; $status[2] = '已到检'; $status[3] = '已取消'; $status[6] = '等待确定'; //等体检中心确定 $status[7] = '已点评'; $memberinfo = $this->memberinfo; $result = $this->db->get_list('order_subscribe', array('uid' => $memberinfo['uid']), '*', 0, 50, 0, 'id DESC'); foreach ($result as $key => $r) { $rs = $this->db->get_one('order_card', array('cardid' => $r['cardid'])); $rs = $this->db->get_one('tuangou', array('id' => $rs['id'])); $result[$key]['remark'] = $rs['title']; $rs2 = $this->db->get_one('mec', array('id' => $r['mecid'])); $result[$key]['mecname'] = $rs2['title']; //查询有没有体检报告 $br = $this->db->get_one('medical_record', array('card_no' => $r['card_no'])); //$fileurl = private_file($r['fileurl']); if ($br) { $result[$key]['fileurl'] = private_file($br['fileurl']); } } include T('order', 'subscribe'); }