moreportfun.php
8.99 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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
<?php
//更新數據庫緩存
function Moreport_ChangeCacheAll($add,$userid,$username){
global $empire,$dbtbpre,$public_r,$ecms_config,$fun_r;
$addcs=Moreport_ChangeAddCs($add);
if(!$add['docache'])
{
echo"<script>self.location.href='ListMoreport.php?enews=MoreportUpdateClassfileAll&start=0".$addcs.hReturnEcmsHashStrHref(0)."';</script>";
exit();
}
$start=(int)$add['start'];
$num=1;
$b=0;
$sql=$empire->query("select * from {$dbtbpre}enewsmoreport where pid>$start order by pid limit ".$num);
while($r=$empire->fetch($sql))
{
$b=1;
$new_start=$r['pid'];
if($r['pid']==1)
{
continue;
}
if(!$r['ppath']||!file_exists($r['ppath'].'e/config/config.php'))
{
continue;
}
define('ECMS_SELFPATH',$r['ppath']);
Moreport_ChangeData($r,0);
}
if(empty($b))
{
echo $fun_r[MoreportChangeCacheSuccess]."<script>self.location.href='ListMoreport.php?enews=MoreportUpdateClassfileAll&start=0".$addcs.hReturnEcmsHashStrHref(0)."';</script>";
exit();
}
echo"<meta http-equiv=\"refresh\" content=\"".$public_r['realltime'].";url=ListMoreport.php?enews=MoreportChangeCacheAll&start=$new_start".$addcs.hReturnEcmsHashStrHref(0)."\">".$fun_r[OneMoreportChangeCacheSuccess]."(ID:<font color=red><b>".$new_start."</b></font>)";
exit();
}
//更新欄目緩存文件
function Moreport_UpdateClassfileAll($add,$userid,$username){
global $empire,$dbtbpre,$public_r,$ecms_config,$fun_r;
$addcs=Moreport_ChangeAddCs($add);
if(!$add['doclassfile'])
{
echo"<script>self.location.href='ListMoreport.php?enews=MoreportReDtPageAll&start=0".$addcs.hReturnEcmsHashStrHref(0)."';</script>";
exit();
}
$start=(int)$add['start'];
$num=1;
$b=0;
$sql=$empire->query("select * from {$dbtbpre}enewsmoreport where pid>$start order by pid limit ".$num);
while($r=$empire->fetch($sql))
{
$b=1;
$new_start=$r['pid'];
if($r['pid']==1)
{
continue;
}
if(!$r['ppath']||!file_exists($r['ppath'].'e/config/config.php'))
{
continue;
}
define('ECMS_SELFPATH',$r['ppath']);
Moreport_ChangeData($r,3);
}
if(empty($b))
{
echo $fun_r[MoreportUpdateClassfileSuccess]."<script>self.location.href='ListMoreport.php?enews=MoreportReDtPageAll&start=0".$addcs.hReturnEcmsHashStrHref(0)."';</script>";
exit();
}
echo"<meta http-equiv=\"refresh\" content=\"".$public_r['realltime'].";url=ListMoreport.php?enews=MoreportUpdateClassfileAll&start=$new_start".$addcs.hReturnEcmsHashStrHref(0)."\">".$fun_r[OneMoreportUpdateClassfileSuccess]."(ID:<font color=red><b>".$new_start."</b></font>)";
exit();
}
//更新動態頁面
function Moreport_ReDtPageAll($add,$userid,$username){
global $empire,$dbtbpre,$public_r,$ecms_config,$fun_r;
$addcs=Moreport_ChangeAddCs($add);
if(!$add['dodtpage'])
{
echo"<script>self.location.href='ListMoreport.php?enews=MoreportClearTmpfileAll&start=0".$addcs.hReturnEcmsHashStrHref(0)."';</script>";
exit();
}
$start=(int)$add['start'];
$num=1;
$b=0;
$sql=$empire->query("select * from {$dbtbpre}enewsmoreport where pid>$start order by pid limit ".$num);
while($r=$empire->fetch($sql))
{
$b=1;
$new_start=$r['pid'];
if($r['pid']==1)
{
continue;
}
if(!$r['ppath']||!file_exists($r['ppath'].'e/config/config.php'))
{
continue;
}
define('ECMS_SELFPATH',$r['ppath']);
Moreport_ChangeData($r,1);
}
if(empty($b))
{
echo $fun_r[MoreportReDtPageSuccess]."<script>self.location.href='ListMoreport.php?enews=MoreportClearTmpfileAll&start=0".$addcs.hReturnEcmsHashStrHref(0)."';</script>";
exit();
}
echo"<meta http-equiv=\"refresh\" content=\"".$public_r['realltime'].";url=ListMoreport.php?enews=MoreportReDtPageAll&start=$new_start".$addcs.hReturnEcmsHashStrHref(0)."\">".$fun_r[OneMoreportReDtPageSuccess]."(ID:<font color=red><b>".$new_start."</b></font>)";
exit();
}
//清理臨時文件
function Moreport_ClearTmpfileAll($add,$userid,$username){
global $empire,$dbtbpre,$public_r,$ecms_config,$fun_r;
$addcs=Moreport_ChangeAddCs($add);
if(!$add['dotmpfile'])
{
echo "<script>self.location.href='ListMoreport.php?enews=MoreportReIndexfileAll&start=0".$addcs.hReturnEcmsHashStrHref(0)."';</script>";
exit();
}
$start=(int)$add['start'];
$num=1;
$b=0;
$sql=$empire->query("select * from {$dbtbpre}enewsmoreport where pid>$start order by pid limit ".$num);
while($r=$empire->fetch($sql))
{
$b=1;
$new_start=$r['pid'];
if($r['pid']==1)
{
continue;
}
if(!$r['ppath']||!file_exists($r['ppath'].'e/config/config.php'))
{
continue;
}
define('ECMS_SELFPATH',$r['ppath']);
Moreport_ChangeData($r,2);
}
if(empty($b))
{
echo $fun_r[MoreportClearTmpfileSuccess]."<script>self.location.href='ListMoreport.php?enews=MoreportReIndexfileAll&start=0".$addcs.hReturnEcmsHashStrHref(0)."';</script>";
exit();
}
echo"<meta http-equiv=\"refresh\" content=\"".$public_r['realltime'].";url=ListMoreport.php?enews=MoreportClearTmpfileAll&start=$new_start".$addcs.hReturnEcmsHashStrHref(0)."\">".$fun_r[OneMoreportClearTmpfileSuccess]."(ID:<font color=red><b>".$new_start."</b></font>)";
exit();
}
//更新首頁文件
function Moreport_ReIndexfileAll($add,$userid,$username){
global $empire,$dbtbpre,$public_r,$ecms_config,$fun_r;
$addcs=Moreport_ChangeAddCs($add);
if(!$add['doreindex'])
{
insert_dolog("");//操作日誌
printerror("MoreportChangeAllDataSuccess","ListMoreport.php".hReturnEcmsHashStrHref2(1));
}
$start=(int)$add['start'];
$num=1;
$b=0;
$sql=$empire->query("select * from {$dbtbpre}enewsmoreport where pid>$start order by pid limit ".$num);
while($r=$empire->fetch($sql))
{
$b=1;
$new_start=$r['pid'];
if($r['pid']==1)
{
continue;
}
if(!$r['ppath']||!file_exists($r['ppath'].'e/config/config.php'))
{
continue;
}
define('ECMS_SELFPATH',$r['ppath']);
Moreport_ChangeData($r,4);
}
if(empty($b))
{
insert_dolog("");//操作日誌
printerror("MoreportChangeAllDataSuccess","ListMoreport.php".hReturnEcmsHashStrHref2(1));
//echo $fun_r[MoreportReIndexfileSuccess]."<script>self.location.href='ListMoreport.php?enews=MoreportReIndexfileAll&start=0".$addcs.hReturnEcmsHashStrHref(0)."';</script>";
exit();
}
echo"<meta http-equiv=\"refresh\" content=\"".$public_r['realltime'].";url=ListMoreport.php?enews=MoreportReIndexfileAll&start=$new_start".$addcs.hReturnEcmsHashStrHref(0)."\">".$fun_r[OneMoreportReIndexfileSuccess]."(ID:<font color=red><b>".$new_start."</b></font>)";
exit();
}
//附加參數
function Moreport_ChangeAddCs($add){
$docache=(int)$add['docache'];
$doclassfile=(int)$add['doclassfile'];
$dodtpage=(int)$add['dodtpage'];
$dotmpfile=(int)$add['dotmpfile'];
$doreindex=(int)$add['doreindex'];
$cs='';
if($docache)
{
$cs.="&docache=".$docache;
}
if($doclassfile)
{
$cs.="&doclassfile=".$doclassfile;
}
if($dodtpage)
{
$cs.="&dodtpage=".$dodtpage;
}
if($dotmpfile)
{
$cs.="&dotmpfile=".$dotmpfile;
}
if($doreindex)
{
$cs.="&doreindex=".$doreindex;
}
return $cs;
}
//更新數據
function Moreport_ChangeData($portr,$ecms=0){
global $empire,$dbtbpre,$public_r,$ecms_config;
$ecms_config['sets']['deftempid']=$portr['tempgid'];
if($ecms==1)//更新動態頁面
{
GetPlTempPage();//評論列表模板
GetPlJsPage();//評論JS模板
ReCptemp();//控制面板模板
GetSearch();//三搜索表單模板
GetPrintPage();//打印模板
GetDownloadPage();//下載地址頁面
ReGbooktemp();//留言板模板
ReLoginIframe();//登陸狀態模板
ReSchAlltemp();//全站搜索模板
//防採集緩存
$yfile=ECMS_PATH.'e/data/dbcache/notcj.php';
$nfile=ECMS_SELFPATH.'e/data/dbcache/notcj.php';
@copy($yfile,$nfile);
}
elseif($ecms==2)//清理臨時文件
{
//臨時文件目錄
$tmppath=ECMS_SELFPATH.'e/data/tmp';
$hand=@opendir($tmppath);
while($file=@readdir($hand))
{
if($file=='.'||$file=='..'||$file=='test.txt'||$file=='index.html'||$file=='mod'||$file=='temp'||$file=='titlepic'||$file=='cj')
{
continue;
}
$filename=$tmppath.'/'.$file;
if(!is_dir($filename))
{
DelFiletext($filename);
}
}
}
elseif($ecms==3)//更新欄目緩存文件
{
$ypath=ECMS_PATH.'d/js';
$npath=ECMS_SELFPATH.'d/js';
CopyPath($ypath,$npath);
$ypath=ECMS_PATH.'e/data/fc';
$npath=ECMS_SELFPATH.'e/data/fc';
CopyPath($ypath,$npath);
$ypath=ECMS_PATH.'e/data/html';
$npath=ECMS_SELFPATH.'e/data/html';
CopyPath($ypath,$npath);
$ypath=ECMS_PATH.'e/data/template';
$npath=ECMS_SELFPATH.'e/data/template';
CopyPath($ypath,$npath);
}
elseif($ecms==4)//更新動態首頁
{
if($portr['mustdt']||$public_r['indexpagedt'])
{
DelFiletext(ECMS_SELFPATH.'index'.$public_r['indextype']);
@copy(ECMS_SELFPATH.'e/data/template/dtindexpage.txt',ECMS_SELFPATH.'index.php');
}
}
else//更新數據庫緩存
{
//更新參數設置
GetConfig(1);
//更新類別
GetClass();
//更新會員組
GetMemberLevel();
//更新全站搜索數據表
GetSearchAllTb();
}
}
?>