- function gethtmlfile($parray) {
- $htmlarr = array();
- $dirarr = array();
- $id = 0;
- if(empty($parray['page'])) {
- unset($parray['page']);
- } elseif($parray['page'] < 2) {
- unset($parray['page']);
- }
- if(!empty($parray['uid'])) {
- $id = $parray['uid'];
- if(!empty($parray['action'])) {
- if($parray['action'] == 'space' || $parray['action'] == 'spacelist') {
- unset($parray['action']);
- } elseif ($parray['action'] == 'viewspace') {
- unset($parray['action']);
- }
- }
- } elseif(!empty($parray['itemid'])) {
- $id = $parray['itemid'];
- } elseif(!empty($parray['tid'])) {
- $id = $parray['tid'];
- } elseif(!empty($parray['tagid'])) {
- $id = $parray['tagid'];
- } elseif(!empty($parray['catid'])) {
- $id = $parray['catid'];
- } elseif(!empty($parray['fid'])) {
- $id = $parray['fid'];
- }
- $htmlfilename = str_replace(array('action-', 'uid-', 'itemid-','page-'),
- array('', '', '', ''),arraytostring($parray, '-'));
- if(!empty($id)) {
- if(!empty($parray['action'])) {
- if($parray['action'] == 'viewnews') {
- global $_SGLOBAL;
- $query = $_SGLOBAL['db']->query('SELECT i.type,i.catid,i.dateline FROM '.tname('spaceitems').' i WHERE i.itemid=\''.$id.'\'');
- $news = $_SGLOBAL['db']->fetch_array($query);
- $thedir = H_DIR.$news['type'];
- switch($news['catid']){
- case 45:$timedir='Life_Hot'.date('Y', $news['dateline']);break;
- case 27:$timedir='Detective'.date('Y', $news['dateline']);break;
- case 28:$timedir='Food_Diy'.date('Y', $news['dateline']);break;
- case 29:$timedir='Health'.date('Y', $news['dateline']);break;
- case 30:$timedir='Estate'.date('Y', $news['dateline']);break;
- case 46:$timedir='Coup'.date('Y', $news['dateline']);break;
- case 52:$timedir='LuCai'.date('Y', $news['dateline']);break;
- case 49:$timedir='ZheCai'.date('Y', $news['dateline']); break;
- case 48:$timedir='YueCai'.date('Y', $news['dateline']); break;
- case 47:$timedir='ChuanCai'.date('Y', $news['dateline']);break;
- case 51:$timedir='XiangCai'.date('Y', $news['dateline']);break;
- case 50:$timedir='SuCai'.date('Y', $news['dateline']);break;
- case 54:$timedir='HuiCai'.date('Y', $news['dateline']);break;
- case 53:$timedir='MinCai'.date('Y', $news['dateline']);break;
- case 55:$timedir='PeiCai'.date('Y', $news['dateline']);break;
- case 31:$timedir='House_Knowledge'.date('Y', $news['dateline']);break;
- case 32:$timedir='Wed_Pan'.date('Y', $news['dateline']);break;
- case 33:$timedir='Wed_Photo'.date('Y', $news['dateline']);break;
- case 58:$timedir='Wife_Mother'.date('Y', $news['dateline']);break;
- case 57:$timedir='Wed_Knowledge'.date('Y', $news['dateline']);break;
- case 37:$timedir='Decoration_Knowledge'.date('Y', $news['dateline']);break;
- case 38:$timedir='Appliances'.date('Y', $news['dateline']);break;
- case 39:$timedir='Home_Design'.date('Y', $news['dateline']);break;
- case 34:$timedir='Learn_Drive'.date('Y', $news['dateline']);break;
- case 35:$timedir='Car_Insurance'.date('Y', $news['dateline']);break;
- case 36:$timedir='Car_Market'.date('Y', $news['dateline']);break;
- case 43:$timedir='Cq_Local'.date('Y', $news['dateline']);break;
- case 40:$timedir='Bbs_Renommended'.date('Y', $news['dateline']);break;
- case 41:$timedir='Pregnancy'.date('Y', $news['dateline']);break;
- case 42:$timedir='Cq_Culture'.date('Y', $news['dateline']);break;
- case 44:$timedir='Cq_Fun'.date('Y', $news['dateline']);break;
- case 56:$timedir='Stoppage'.date('Y', $news['dateline']);break;
- case 1:$timedir='Convenience'.date('Y', $news['dateline']);break;
-
- default:$timedir='Article'.date('Y', $news['dateline']);break;
- }
- $htmlfilename = date('nd', $news['dateline']).$id;
- if(!empty($parray['page'])) $htmlfilename .= '_'.$parray['page'];
- }elseif($parray['action'] == 'category') {
- global $_SGLOBAL;
- $query = $_SGLOBAL['db']->query('SELECT i.`type` FROM '.tname('categories').' i WHERE i.`catid`=\''.$id.'\'');
- $news = $_SGLOBAL['db']->fetch_array($query);
- $thedir = H_DIR.$news['type'];
- switch($id){
- case 45:$htmlfilename='Life_Hot';break;
- case 27:$htmlfilename='Detective';break;
- case 28:$htmlfilename='Food_Diy';break;
- case 29:$htmlfilename='Health';break;
- case 30:$htmlfilename='Estate';break;
- case 46:$htmlfilename='Coup';break;
- case 52:$htmlfilename='LuCai';break;
- case 49:$htmlfilename='ZheCai'; break;
- case 48:$htmlfilename='YueCai'; break;
- case 47:$htmlfilename='ChuanCai';break;
- case 51:$htmlfilename='XiangCai';break;
- case 50:$htmlfilename='SuCai'; break;
- case 54:$htmlfilename='HuiCai'; break;
- case 53:$htmlfilename='MinCai'; break;
- case 55:$htmlfilename='PeiCai'; break;
- case 31:$htmlfilename='House_Knowledge';break;
- case 32:$htmlfilename='Wed_Pan';break;
- case 33:$htmlfilename='Wed_Photo';break;
- case 58:$htmlfilename='Wife_Mother';break;
- case 57:$htmlfilename='Wed_Knowledge';break;
- case 37:$htmlfilename='Decoration_Knowledge';break;
- case 38:$htmlfilename='Appliances';break;
- case 39:$htmlfilename='Home_Design';break;
- case 34:$htmlfilename='Learn_Drive';break;
- case 35:$htmlfilename='Car_Insurance';break;
- case 36:$htmlfilename='Car_Market';break;
- case 43:$htmlfilename='Cq_Local';break;
- case 40:$htmlfilename='Bbs_Renommended';break;
- case 41:$htmlfilename='Pregnancy';break;
- case 42:$htmlfilename='Cq_Culture';break;
- case 44:$htmlfilename='Cq_Fun';break;
- case 1:$htmlfilename='Convenience';break;
- case 56:$htmlfilename='Stoppage';break;
-
- default:$htmlfilename='Article';break;
-
- }
- if(!empty($parray['page'])) $htmlfilename .= '_'.$parray['page'];
- }elseif($parray['action'] == 'tag'){
- $thedir=H_DIR.'t'.$parray['tagtime'];
- $news['type']='t'.$parray['tagtime'];
- $htmlfilename = $parray['tagname'].$id;
- if(!empty($parray['page'])) $htmlfilename .= '-'.$parray['page'];
- }elseif($parray['action'] == 'viewthread') {
- $thedir=H_DIR.'bbs';
- $htmlfilename = "thread{$id}";
- }
- }
- }
- if(is_dir(H_DIR) || (!is_dir(H_DIR) && @mkdir(H_DIR))) {
- if(empty($id)) {
- if($parray['action']=='index'){
- $htmlarr['path'] = S_ROOT.'/index.html';
- $htmlarr['url'] = S_URL;
- }else{
- $htmlarr['path'] = H_DIR.'/'.$htmlfilename.'/index.html';
- $htmlarr['url'] = H_URL.$htmlfilename;
- }
- }elseif(empty($thedir)) {
- $htmlarr['path'] = H_DIR.'/'.$htmlfilename.'.html';
- $htmlarr['url'] = H_URL.'/'.$htmlfilename.'.html';
- }else {
-
- if(is_dir($thedir) || (!is_dir($thedir) && @mkdir($thedir))) {}
-
- $htmldir = $thedir.'/'.$timedir;
- if(is_dir($htmldir) || (!is_dir($htmldir) && @mkdir($htmldir))) {
- $htmlarr['path'] = empty($timedir)?$thedir.'/'.$htmlfilename.'.html':$thedir.'/'.$timedir.'/'.$htmlfilename.'.html';
-
- $htmlarr['url'] = empty($timedir)?H_URL.$news['type'].'/'.$htmlfilename.'.html': H_URL.$news['type'].'/'.$timedir.'/'.$htmlfilename.'.html';
-
- } else {
- $htmlarr['path'] = H_DIR.'/'.$htmlfilename.'.html';
- $htmlarr['url'] = H_URL.'/'.$htmlfilename.'.html';
- }
- }
- } else {
- $htmlarr['path'] = S_ROOT.'./'.$htmlfilename.'.html';
- $htmlarr['url'] = S_URL.'/'.$htmlfilename.'.html';
- }
- return $htmlarr;
- }
复制代码 |