DoTimeRepage.php
6.52 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
<?php
define('EmpireCMSAdmin','1');
require("../class/connect.php");
require("../class/db_sql.php");
require("../class/functions.php");
require LoadLang("pub/fun.php");
require("../class/t_functions.php");
require("../data/dbcache/class.php");
require("../data/dbcache/MemberLevel.php");
$link=db_connect();
$empire=new mysqlquery();
//驗證用戶
$lur=is_login();
$logininid=$lur['userid'];
$loginin=$lur['username'];
$loginrnd=$lur['rnd'];
$loginlevel=$lur['groupid'];
$loginadminstyleid=$lur['adminstyleid'];
//ehash
$ecms_hashur=hReturnEcmsHashStrAll();
@set_time_limit(0);
//定時刷新任務
function DoTimeRepage($time){
global $empire,$dbtbpre;
if(empty($time))
{$time=120;}
echo"<meta http-equiv=\"refresh\" content=\"".$time.";url=DoTimeRepage.php".hReturnEcmsHashStrHref(1)."\">";
DoAutoUpAndDownInfo();//自動上/下線
$todaytime=time();
$b=0;
$sql=$empire->query("select doing,classid,doid from {$dbtbpre}enewsdo where isopen=1 and lasttime+dotime*60<$todaytime");
while($r=$empire->fetch($sql))
{
$b=1;
if($r[doing]==1)//生成欄目
{
$cr=explode(',',$r[classid]);
$count=count($cr)-1;
for($i=1;$i<$count;$i++)
{
if(empty($cr[$i]))
{
continue;
}
$cr[$i]=(int)$cr[$i];
ReListHtml($cr[$i],1);
}
}
elseif($r[doing]==2)//生成專題
{
$cr=explode(',',$r[classid]);
$count=count($cr)-1;
for($i=1;$i<$count;$i++)
{
if(empty($cr[$i]))
{
continue;
}
$cr[$i]=(int)$cr[$i];
ListHtmlIndex($cr[$i],$ret_r[0],0);
}
}
elseif($r[doing]==3)//生成自定義列表
{
$cr=explode(',',$r[classid]);
$count=count($cr)-1;
for($i=1;$i<$count;$i++)
{
if(empty($cr[$i]))
{
continue;
}
$cr[$i]=(int)$cr[$i];
$ur=$empire->fetch1("select listid,pagetitle,filepath,filetype,totalsql,listsql,maxnum,lencord,listtempid,pagekeywords,pagedescription from {$dbtbpre}enewsuserlist where listid='".$cr[$i]."'");
ReUserlist($ur,"");
}
}
elseif($r[doing]==4)//生成自定義頁面
{
$cr=explode(',',$r[classid]);
$count=count($cr)-1;
for($i=1;$i<$count;$i++)
{
if(empty($cr[$i]))
{
continue;
}
$cr[$i]=(int)$cr[$i];
$ur=$empire->fetch1("select id,path,pagetext,title,pagetitle,pagekeywords,pagedescription,tempid from {$dbtbpre}enewspage where id='".$cr[$i]."'");
ReUserpage($ur[id],$ur[pagetext],$ur[path],$ur[title],$ur[pagetitle],$ur[pagekeywords],$ur[pagedescription],$ur[tempid]);
}
}
elseif($r[doing]==5)//生成自定義JS
{
$cr=explode(',',$r[classid]);
$count=count($cr)-1;
for($i=1;$i<$count;$i++)
{
if(empty($cr[$i]))
{
continue;
}
$cr[$i]=(int)$cr[$i];
$ur=$empire->fetch1("select jsid,jsname,jssql,jstempid,jsfilename from {$dbtbpre}enewsuserjs where jsid='".$cr[$i]."'");
ReUserjs($ur,'');
}
}
elseif($r[doing]==6)//生成標題分類頁面
{
$cr=explode(',',$r[classid]);
$count=count($cr)-1;
for($i=1;$i<$count;$i++)
{
if(empty($cr[$i]))
{
continue;
}
$cr[$i]=(int)$cr[$i];
ListHtml($cr[$i],$ret_r,5);
}
}
else//生成首頁
{
$indextemp=GetIndextemp();
NewsBq($classid,$indextemp,1,0);
}
$empire->query("update {$dbtbpre}enewsdo set lasttime=$todaytime where doid='$r[doid]'");
}
if($b)
{
echo "最後執行時間:".date("Y-m-d H:i:s",$todaytime)."<br><br>";
}
}
//定時上線/下線
function DoAutoUpAndDownInfo(){
global $empire,$dbtbpre,$class_r,$emod_r,$public_r;
$todaytime=time();
$sql=$empire->query("select id,classid,infouptime,infodowntime from {$dbtbpre}enewsinfovote where infouptime>0 or infodowntime>0");
while($r=$empire->fetch($sql))
{
if(!$class_r[$r[classid]]['tbname'])
{
continue;
}
//上線
if($r['infouptime']&&$r['infouptime']<=$todaytime)
{
$infor=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$r[classid]][tbname]."_check where id='$r[id]' limit 1");
if(!$infor['id'])
{
continue;
}
//簽發
if($infor['isqf'])
{
$qfr=$empire->fetch1("select checktno from {$dbtbpre}enewswfinfo where id='$r[id]' and classid='$r[classid]' limit 1");
if($qfr['checktno']!='100')
{
continue;
}
}
$empire->query("update {$dbtbpre}ecms_".$class_r[$r[classid]][tbname]."_index set checked=1 where id='$r[id]' limit 1");
$pubid=ReturnInfoPubid($r['classid'],$r['id']);
$empire->query("update {$dbtbpre}enewsinfovote set infouptime=0 where pubid='$pubid' limit 1");
//互轉
MoveCheckInfoData($class_r[$r[classid]][tbname],0,$infor['stb'],"id='$r[id]'");
AddClassInfos($r['classid'],'','+1');
//刷新信息
GetHtml($infor['classid'],$infor['id'],$infor,1);
//刷新列表
ReListHtml($r[classid],1);
}
//下線
if($r['infodowntime']&&$r['infodowntime']<=$todaytime)
{
$mid=$class_r[$r[classid]][modid];
$tbname=$class_r[$r[classid]][tbname];
$pf=$emod_r[$mid]['pagef'];
$stf=$emod_r[$mid]['savetxtf'];
//主表
$infor=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$r[classid]][tbname]." where id='".$r[id]."' limit 1");
if(!$infor['id'])
{
continue;
}
//簽發
if($infor['isqf'])
{
$qfr=$empire->fetch1("select checktno from {$dbtbpre}enewswfinfo where id='$r[id]' and classid='$r[classid]' limit 1");
if($qfr['checktno']!='100')
{
continue;
}
}
//分頁字段
if($pf)
{
if(strstr($emod_r[$mid]['tbdataf'],','.$pf.','))
{
$finfor=$empire->fetch1("select ".$pf." from {$dbtbpre}ecms_".$tbname."_data_".$infor[stb]." where id='$r[id]' limit 1");
$infor[$pf]=$finfor[$pf];
}
if($stf&&$stf==$pf)//存放文本
{
$infor[$pf]=GetTxtFieldText($infor[$pf]);
}
}
DelNewsFile($infor[filename],$infor[newspath],$infor[classid],$infor[$pf],$infor[groupid]);
$empire->query("update {$dbtbpre}ecms_".$class_r[$r[classid]][tbname]."_index set checked=0,havehtml=0 where id='$r[id]' limit 1");
$pubid=ReturnInfoPubid($r['classid'],$r['id']);
$empire->query("update {$dbtbpre}enewsinfovote set infodowntime=0 where pubid='$pubid' limit 1");
//互轉
MoveCheckInfoData($class_r[$r[classid]][tbname],1,$infor['stb'],"id='$r[id]'");
AddClassInfos($r['classid'],'','-1');
//刷新列表
ReListHtml($r[classid],1);
}
}
}
DoTimeRepage(120);//自動刷新頁面
db_close();
$empire=null;
?>
<b>說明:本頁面為定時刷新任務執行窗口.</b>