index.php
6.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
<?php
require('../../class/connect.php');
require('../../class/db_sql.php');
require('../../class/functions.php');
require('../../class/t_functions.php');
require('../../data/dbcache/class.php');
require '../'.LoadLang('pub/fun.php');
$link=db_connect();
$empire=new mysqlquery();
$editor=1;
$classid=(int)$_GET['classid'];
if(empty($classid))
{
printerror("ErrorUrl","history.go(-1)",1);
}
$search='&classid='.$classid;
$tbname=$class_r[$classid][tbname];
$mid=$class_r[$classid][modid];
if(empty($tbname)||empty($mid)||InfoIsInTable($tbname))
{
printerror("ErrorUrl","history.go(-1)",1);
}
$cr=$empire->fetch1("select classid,classpagekey,intro,classimg,cgroupid,islist,classtempid,listdt,bdinfoid,repagenum,islast,infos from {$dbtbpre}enewsclass where classid='$classid'");
if(empty($cr['classid']))
{
printerror("ErrorUrl","history.go(-1)",1);
}
if($class_r[$classid][islast]&&$cr['bdinfoid'])
{
printerror("ErrorUrl","history.go(-1)",1);
}
//moreport
if(Moreport_ReturnMustDt())
{
$class_r[$classid]['listdt']=1;
$cr['repagenum']=0;
$cr['listdt']=1;
}
//是否支持動態頁
if(empty($class_r[$classid]['listdt'])&&!$cr['repagenum'])
{
$classurl=sys_ReturnBqClassname($cr,9);
Header("Location:$classurl");
exit();
}
//權限
if($cr['cgroupid'])
{
$mgroupid=(int)getcvar('mlgroupid');
if(!strstr($cr[cgroupid],','.$mgroupid.','))
{
printerror('NotLevelToClass','history.go(-1)',1);
}
}
$GLOBALS['navclassid']=$classid;
$url=ReturnClassLink($classid);
$pagetitle=$class_r[$classid]['classname'];
$pagekey=$cr['classpagekey'];
$pagedes=$cr['intro'];
$classimg=$cr['classimg']?$cr['classimg']:$public_r[newsurl].'e/data/images/notimg.gif';
//---封面式---
if(!$class_r[$classid][islast]&&$cr['islist']!=1)
{
if(empty($cr['listdt'])||$cr['islist']==3)
{
printerror("ErrorUrl","history.go(-1)",1);
}
if($cr[islist]==2)
{
$classtemp=GetClassText($classid);
$dttempname='classpage'.$classid;
}
else
{
if(empty($cr['classtempid']))
{
printerror('ErrorUrl','',1);
}
$classtemp=GetClassTemp($cr['classtempid']);
$dttempname='classtemp'.$cr['classtempid'];
}
$string=DtNewsBq($dttempname,$classtemp,0);
$string=str_replace('[!--newsnav--]',$url,$string);//位置導航
$string=Class_ReplaceSvars($string,$url,$classid,$pagetitle,$pagekey,$pagedes,$classimg,$addr,0);
$string=str_replace('[!--page.stats--]','',$string);
echo stripSlashes($string);
exit();
}
//---列表式---
$add='';
//欄目
if($class_r[$classid][islast])//終極欄目
{
$add.="classid='$classid'";
$have_class=0;
}
else
{
$add.=ReturnClass($class_r[$classid][sonclass]);
$have_class=1;
}
//排序
if(empty($class_r[$classid][reorder]))
{
$addorder="newstime desc";
}
else
{
$addorder=$class_r[$classid][reorder];
}
//列表模板
$tempid=$class_r[$classid]['dtlisttempid']?$class_r[$classid]['dtlisttempid']:$class_r[$classid]['listtempid'];
if(empty($tempid))
{
printerror('ErrorUrl','',1);
}
$tempr=$empire->fetch1("select tempid,temptext,subnews,listvar,rownum,showdate,modid,subtitle,docode from ".GetTemptb("enewslisttemp")." where tempid='$tempid'");
if(empty($tempr[tempid]))
{
printerror('ErrorUrl','',1);
}
$page=(int)$_GET['page'];
$page=RepPIntvar($page);
$start=0;
$line=$class_r[$classid]['lencord'];//每頁顯示記錄數
$page_line=10;//每頁顯示鏈接數
$offset=$page*$line;//總偏移量
//系統模型
$ret_r=ReturnReplaceListF($mid);
//優化
$yhadd='';
$yhid=$class_r[$classid][yhid];
$yhvar='qlist';
if($yhid)
{
$yhadd=ReturnYhSql($yhid,$yhvar,1);
}
//總數
$totalnum=(int)$_GET['totalnum'];
if($totalnum<1)
{
if($yhadd)
{
$totalquery="select count(*) as total from {$dbtbpre}ecms_".$tbname." where ".$yhadd.$add;
$num=$empire->gettotal($totalquery);
}
else
{
$num=ReturnClassInfoNum($cr,0);
}
}
else
{
$num=$totalnum;
}
$search.='&totalnum='.$num;
$query="select ".ReturnSqlListF($mid)." from {$dbtbpre}ecms_".$tbname." where ".$yhadd.$add;
$query.=" order by ".ReturnSetTopSql('list').$addorder." limit $offset,$line";
$sql=$empire->query($query);
//偽靜態
$pagefunr=eReturnRewriteClassUrl($classid,0);
$pagefunr['repagenum']=$cr['repagenum'];
$pagefunr['dolink']=empty($class_r[$classid]['classurl'])?$public_r['newsurl'].$class_r[$classid]['classpath'].'/':$class_r[$classid]['classurl'].'/';
$pagefunr['dofile']='index';
$pagefunr['dotype']=$class_r[$classid]['classtype'];
//分頁
if($pagefunr['rewrite']==1||$pagefunr['repagenum'])
{
$listpage=InfoUsePage($num,$line,$page_line,$start,$page,$search,$pagefunr);
}
else
{
$listpage=page1($num,$line,$page_line,$start,$page,$search);
}
//頁面支持標籤
if($public_r['dtcanbq'])
{
$tempr[temptext]=DtNewsBq('list'.$tempid,$tempr[temptext],0);
}
else
{
if($public_r['searchtempvar'])
{
$tempr[temptext]=ReplaceTempvar($tempr[temptext]);
}
}
$listtemp=$tempr[temptext];
$rownum=$tempr[rownum];
if(empty($rownum))
{$rownum=1;}
$formatdate=$tempr[showdate];
$subnews=$tempr[subnews];
$subtitle=$tempr[subtitle];
$docode=$tempr[docode];
$modid=$tempr[modid];
$listvar=str_replace('[!--news.url--]',$public_r[newsurl],$tempr[listvar]);
//公共
$listtemp=str_replace('[!--newsnav--]',$url,$listtemp);//位置導航
$listtemp=Class_ReplaceSvars($listtemp,$url,$classid,$pagetitle,$pagekey,$pagedes,$classimg,$addr,0);
$listtemp=str_replace('[!--page.stats--]','',$listtemp);
$listtemp=str_replace('[!--show.page--]',$listpage,$listtemp);
$listtemp=str_replace('[!--show.listpage--]',$listpage,$listtemp);
$listtemp=str_replace('[!--list.pageno--]',$page+1,$listtemp);
//取得列表模板
$list_exp="[!--empirenews.listtemp--]";
$list_r=explode($list_exp,$listtemp);
$listtext=$list_r[1];
$no=$offset+1;
$changerow=1;
while($r=$empire->fetch($sql))
{
//替換列表變量
$repvar=ReplaceListVars($no,$listvar,$subnews,$subtitle,$formatdate,$url,$have_class,$r,$ret_r,$docode);
$listtext=str_replace("<!--list.var".$changerow."-->",$repvar,$listtext);
$changerow+=1;
//超過行數
if($changerow>$rownum)
{
$changerow=1;
$string.=$listtext;
$listtext=$list_r[1];
}
$no++;
}
//多餘數據
if($changerow<=$rownum&&$listtext<>$list_r[1])
{
$string.=$listtext;
}
$string=$list_r[0].$string.$list_r[2];
echo stripSlashes($string);
db_close();
$empire=null;
?>