ReInfoUrl.php
8.16 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
<?php
define('EmpireCMSAdmin','1');
require("../../class/connect.php");
require("../../class/db_sql.php");
require("../../class/functions.php");
$link=db_connect();
$empire=new mysqlquery();
$editor=1;
//驗證用戶
$lur=is_login();
$logininid=$lur['userid'];
$loginin=$lur['username'];
$loginrnd=$lur['rnd'];
$loginlevel=$lur['groupid'];
$loginadminstyleid=$lur['adminstyleid'];
//ehash
$ecms_hashur=hReturnEcmsHashStrAll();
//驗證權限
CheckLevel($logininid,$loginin,$classid,"changedata");
//批量更新信息頁地址
function ReInfoUrl($start,$classid,$from,$retype,$startday,$endday,$startid,$endid,$tbname,$userid,$username){
global $empire,$public_r,$class_r,$fun_r,$dbtbpre;
//驗證權限
//CheckLevel($userid,$username,$classid,"changedata");
$start=(int)$start;
$tbname=RepPostVar($tbname);
if(empty($tbname)||!eCheckTbname($tbname))
{
printerror("ErrorUrl","history.go(-1)");
}
$add1='';
//按欄目刷新
$classid=(int)$classid;
if($classid)
{
if(empty($class_r[$classid][islast]))//父欄目
{
$where=ReturnClass($class_r[$classid][sonclass]);
}
else//終極欄目
{
$where="classid='$classid'";
}
$add1=" and (".$where.")";
}
//按ID刷新
if($retype)
{
$startid=(int)$startid;
$endid=(int)$endid;
if($endid)
{
$add1.=" and id>=$startid and id<=$endid";
}
}
else
{
$startday=RepPostVar($startday);
$endday=RepPostVar($endday);
if($startday&&$endday)
{
$add1.=" and truetime>=".to_time($startday." 00:00:00")." and truetime<=".to_time($endday." 23:59:59");
}
}
$b=0;
$sql=$empire->query("select id,classid,checked from {$dbtbpre}ecms_".$tbname."_index where id>$start".$add1." order by id limit ".$public_r[delnewsnum]);
while($r=$empire->fetch($sql))
{
$b=1;
$new_start=$r[id];
//返回表
$infotb=ReturnInfoMainTbname($tbname,$r['checked']);
$infor=$empire->fetch1("select newspath,filename,groupid,isurl,titleurl from ".$infotb." where id='$r[id]' limit 1");
$infourl=GotoGetTitleUrl($r['classid'],$r['id'],$infor['newspath'],$infor['filename'],$infor['groupid'],$infor['isurl'],$infor['titleurl']);
$empire->query("update ".$infotb." set titleurl='$infourl' where id='$r[id]' limit 1");
}
if(empty($b))
{
insert_dolog("");//操作日誌
printerror("ReInfoUrlSuccess",$from);
}
echo $fun_r[OneReInfoUrlSuccess]."(ID:<font color=red><b>".$new_start."</b></font>)<script>self.location.href='ReInfoUrl.php?enews=ReInfoUrl&tbname=$tbname&classid=$classid&start=$new_start&from=".urlencode($from)."&retype=$retype&startday=$startday&endday=$endday&startid=$startid&endid=$endid".hReturnEcmsHashStrHref(0)."';</script>";
exit();
}
$enews=$_POST['enews'];
if(empty($enews))
{$enews=$_GET['enews'];}
if($enews)
{
hCheckEcmsRHash();
include('../../data/dbcache/class.php');
}
if($enews=="ReInfoUrl")//批量更新信息頁地址
{
$start=$_GET['start'];
$classid=$_GET['classid'];
$from=$_GET['from'];
$retype=$_GET['retype'];
$startday=$_GET['startday'];
$endday=$_GET['endday'];
$startid=$_GET['startid'];
$endid=$_GET['endid'];
$tbname=$_GET['tbname'];
ReInfoUrl($start,$classid,$from,$retype,$startday,$endday,$startid,$endid,$tbname,$logininid,$loginin);
}
//欄目
$fcfile="../../data/fc/ListEnews.php";
$class="<script src=../../data/fc/cmsclass.js></script>";
if(!file_exists($fcfile))
{$class=ShowClass_AddClass("",0,0,"|-",0,0);}
//刷新表
$retable="";
$selecttable="";
$i=0;
$tsql=$empire->query("select tid,tbname,tname from {$dbtbpre}enewstable where intb=0 order by tid");
while($tr=$empire->fetch($tsql))
{
$i++;
if($i%4==0)
{
$br="<br>";
}
else
{
$br="";
}
$retable.="<input type=checkbox name=tbname[] value='$tr[tbname]' checked>$tr[tname] ".$br;
$selecttable.="<option value='".$tr[tbname]."'>".$tr[tname]."</option>";
}
//選擇日期
$todaydate=date("Y-m-d");
$todaytime=time();
$changeday="<select name=selectday onchange=\"document.reform.startday.value=this.value;document.reform.endday.value='".$todaydate."'\">
<option value='".$todaydate."'>--選擇--</option>
<option value='".$todaydate."'>今天</option>
<option value='".ToChangeTime($todaytime,7)."'>一周</option>
<option value='".ToChangeTime($todaytime,30)."'>一月</option>
<option value='".ToChangeTime($todaytime,90)."'>三月</option>
<option value='".ToChangeTime($todaytime,180)."'>半年</option>
<option value='".ToChangeTime($todaytime,365)."'>一年</option>
</select>";
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>批量更新信息頁地址</title>
<link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
<script src="../ecmseditor/fieldfile/setday.js"></script>
<script>
function CheckAll(form)
{
for (var i=0;i<form.elements.length;i++)
{
var e = form.elements[i];
if (e.name != 'chkall')
e.checked = form.chkall.checked;
}
}
</script>
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<td height="25">位置:<a href="ReInfoUrl.php<?=$ecms_hashur['whehref']?>">批量更新信息頁地址</a></td>
</tr>
</table>
<form action="ReInfoUrl.php" method="get" name="form1" target="_blank" onsubmit="return confirm('確認要更新?');">
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder" id="ReInfoUrl">
<?=$ecms_hashur['form']?>
<input name="from" type="hidden" id="from" value="ReInfoUrl.php<?=$ecms_hashur['whehref']?>">
<tr class="header">
<td height="25"> <div align="center">批量更新信息頁地址</div></td>
</tr>
<tr>
<td height="25" bgcolor="#FFFFFF"> <div align="center">
<table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
<tr>
<td height="25">數據表:</td>
<td height="25"> <select name="tbname" id="tbname">
<option value=''>------ 選擇數據表 ------</option>
<?=$selecttable?>
</select>
(*) </td>
</tr>
<tr>
<td height="25">欄目</td>
<td height="25"><select name="classid">
<option value="0">所有欄目</option>
<?=$class?>
</select>
<font color="#666666">(如選擇父欄目,將更新所有子欄目)</font></td>
</tr>
<tr>
<td width="23%" height="25"> <input name="retype" type="radio" value="0" checked>
按時間更新:</td>
<td width="77%" height="25">從
<input name="startday" type="text" size="12" onclick="setday(this)">
到
<input name="endday" type="text" size="12" onclick="setday(this)">
之間的信息 <font color="#666666">(不填將更新所有信息)</font></td>
</tr>
<tr>
<td height="25"> <input name="retype" type="radio" value="1">
按ID更新:</td>
<td height="25">從
<input name="startid" type="text" value="0" size="6">
到
<input name="endid" type="text" value="0" size="6">
之間的信息 <font color="#666666">(兩個值為0將更新所有信息)</font></td>
</tr>
<tr>
<td height="25"> </td>
<td height="25"><input type="submit" name="Submit62" value="開始更新">
<input type="reset" name="Submit72" value="重置">
<input name="enews" type="hidden" value="ReInfoUrl">
</td>
</tr>
<tr>
<td height="25" colspan="2"><font color="#666666">說明:當改變信息目錄形式時,請用此功能來批量更新內容頁地址。</font></td>
</tr>
</table>
</div></td>
</tr>
</table>
</form>
</body>
</html>
<?
db_close();
$empire=null;
?>