ListMoreport.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <?php
  2. define('EmpireCMSAdmin','1');
  3. require("../../class/connect.php");
  4. require("../../class/db_sql.php");
  5. require("../../class/functions.php");
  6. require "../".LoadLang("pub/fun.php");
  7. $link=db_connect();
  8. $empire=new mysqlquery();
  9. $editor=1;
  10. //验证用户
  11. $lur=is_login();
  12. $logininid=$lur['userid'];
  13. $loginin=$lur['username'];
  14. $loginrnd=$lur['rnd'];
  15. $loginlevel=$lur['groupid'];
  16. $loginadminstyleid=$lur['adminstyleid'];
  17. //ehash
  18. $ecms_hashur=hReturnEcmsHashStrAll();
  19. //验证权限
  20. CheckLevel($logininid,$loginin,$classid,"moreport");
  21. //是否主端
  22. if($ecms_config['sets']['selfmoreportid']>1)
  23. {
  24. printerror2('请在主端下使用本操作','history.go(-1)',9);
  25. }
  26. //增加访问端
  27. function AddMoreport($add,$userid,$username){
  28. global $empire,$dbtbpre;
  29. if(!$add[pname]||!$add[ppath]||!$add[purl]||!$add[postpass]||!$add[tempgid])
  30. {
  31. printerror("EmptyMoreport","history.go(-1)");
  32. }
  33. //验证权限
  34. CheckLevel($userid,$username,$classid,"moreport");
  35. $add['pname']=hRepPostStr($add['pname'],1);
  36. $add['purl']=RepPostStr($add['purl'],1);
  37. $add['ppath']=RepPostStr($add['ppath'],1);
  38. $add['postpass']=RepPostStr($add['postpass'],1);
  39. $add['postfile']=RepPostStr($add['postfile'],1);
  40. $add['tempgid']=(int)$add['tempgid'];
  41. $add['mustdt']=(int)$add['mustdt'];
  42. $add['isclose']=(int)$add['isclose'];
  43. $add['closeadd']=(int)$add['closeadd'];
  44. $add['headersign']=hRepPostStr($add['headersign'],1);
  45. $add['openadmin']=(int)$add['openadmin'];
  46. $add['rehtml']=(int)$add['rehtml'];
  47. if(!file_exists($add['ppath'].'e/config/config.php'))
  48. {
  49. printerror("ErrorMoreportPath","history.go(-1)");
  50. }
  51. $sql=$empire->query("insert into {$dbtbpre}enewsmoreport(pname,purl,ppath,postpass,postfile,tempgid,mustdt,isclose,closeadd,headersign,openadmin,rehtml) values('$add[pname]','$add[purl]','$add[ppath]','$add[postpass]','$add[postfile]','$add[tempgid]','$add[mustdt]','$add[isclose]','$add[closeadd]','$add[headersign]','$add[openadmin]','$add[rehtml]');");
  52. $pid=$empire->lastid();
  53. //更新缓存
  54. Moreport_UpdateIsclose();
  55. GetConfig();
  56. if($sql)
  57. {
  58. //操作日志
  59. insert_dolog("pid=$pid&pname=$add[pname]");
  60. printerror("AddMoreportSuccess","AddMoreport.php?enews=AddMoreport".hReturnEcmsHashStrHref2(0));
  61. }
  62. else
  63. {printerror("DbError","history.go(-1)");}
  64. }
  65. //修改访问端
  66. function EditMoreport($add,$userid,$username){
  67. global $empire,$dbtbpre;
  68. $add[pid]=(int)$add[pid];
  69. if(!$add[pid]||!$add[pname]||!$add[ppath]||!$add[purl]||!$add[postpass]||!$add[tempgid])
  70. {
  71. printerror("EmptyMoreport","history.go(-1)");
  72. }
  73. //验证权限
  74. CheckLevel($userid,$username,$classid,"moreport");
  75. $add['pname']=hRepPostStr($add['pname'],1);
  76. $add['purl']=RepPostStr($add['purl'],1);
  77. $add['ppath']=RepPostStr($add['ppath'],1);
  78. $add['postpass']=RepPostStr($add['postpass'],1);
  79. $add['postfile']=RepPostStr($add['postfile'],1);
  80. $add['tempgid']=(int)$add['tempgid'];
  81. $add['mustdt']=(int)$add['mustdt'];
  82. $add['isclose']=(int)$add['isclose'];
  83. $add['closeadd']=(int)$add['closeadd'];
  84. $add['headersign']=hRepPostStr($add['headersign'],1);
  85. $add['openadmin']=(int)$add['openadmin'];
  86. $add['rehtml']=(int)$add['rehtml'];
  87. if(!file_exists($add['ppath'].'e/config/config.php'))
  88. {
  89. printerror("ErrorMoreportPath","history.go(-1)");
  90. }
  91. $sql=$empire->query("update {$dbtbpre}enewsmoreport set pname='$add[pname]',purl='$add[purl]',ppath='$add[ppath]',postpass='$add[postpass]',postfile='$add[postfile]',tempgid='$add[tempgid]',mustdt='$add[mustdt]',isclose='$add[isclose]',closeadd='$add[closeadd]',headersign='$add[headersign]',openadmin='$add[openadmin]',rehtml='$add[rehtml]' where pid='$add[pid]'");
  92. //更新缓存
  93. Moreport_UpdateIsclose();
  94. GetConfig();
  95. if($sql)
  96. {
  97. //操作日志
  98. insert_dolog("pid=$add[pid]&pname=$add[pname]");
  99. printerror("EditMoreportSuccess","ListMoreport.php".hReturnEcmsHashStrHref2(1));
  100. }
  101. else
  102. {printerror("DbError","history.go(-1)");}
  103. }
  104. //删除访问端
  105. function DelMoreport($add,$userid,$username){
  106. global $empire,$dbtbpre;
  107. $pid=(int)$add['pid'];
  108. if(!$pid)
  109. {
  110. printerror("NotChangeMoreportId","history.go(-1)");
  111. }
  112. //验证权限
  113. CheckLevel($userid,$username,$classid,"moreport");
  114. $r=$empire->fetch1("select pname from {$dbtbpre}enewsmoreport where pid='$pid'");
  115. $sql=$empire->query("delete from {$dbtbpre}enewsmoreport where pid='$pid'");
  116. //更新缓存
  117. Moreport_UpdateIsclose();
  118. GetConfig();
  119. if($sql)
  120. {
  121. //操作日志
  122. insert_dolog("pid=$pid&pname=$r[pname]");
  123. printerror("DelMoreportSuccess","ListMoreport.php".hReturnEcmsHashStrHref2(1));
  124. }
  125. else
  126. {printerror("DbError","history.go(-1)");}
  127. }
  128. $enews=$_POST['enews'];
  129. if(empty($enews))
  130. {$enews=$_GET['enews'];}
  131. if($enews)
  132. {
  133. hCheckEcmsRHash();
  134. @set_time_limit(0);
  135. include('../../class/copypath.php');
  136. include('moreportfun.php');
  137. }
  138. //增加访问端
  139. if($enews=="AddMoreport")
  140. {
  141. AddMoreport($_POST,$logininid,$loginin);
  142. }
  143. elseif($enews=="EditMoreport")//修改访问端
  144. {
  145. EditMoreport($_POST,$logininid,$loginin);
  146. }
  147. elseif($enews=="DelMoreport")//删除访问端
  148. {
  149. DelMoreport($_GET,$logininid,$loginin);
  150. }
  151. elseif($enews=="MoreportChangeCacheAll")//更新访问端数据库缓存
  152. {
  153. Moreport_ChangeCacheAll($_GET,$logininid,$loginin);
  154. }
  155. elseif($enews=="MoreportUpdateClassfileAll")//更新访问端栏目缓存文件
  156. {
  157. Moreport_UpdateClassfileAll($_GET,$logininid,$loginin);
  158. }
  159. elseif($enews=="MoreportReDtPageAll")//更新访问端动态页面
  160. {
  161. Moreport_ReDtPageAll($_GET,$logininid,$loginin);
  162. }
  163. elseif($enews=="MoreportClearTmpfileAll")//清理访问端临时文件
  164. {
  165. Moreport_ClearTmpfileAll($_GET,$logininid,$loginin);
  166. }
  167. elseif($enews=="MoreportReIndexfileAll")//更新访问端动态首页文件
  168. {
  169. Moreport_ReIndexfileAll($_GET,$logininid,$loginin);
  170. }
  171. $search=$ecms_hashur['ehref'];
  172. $page=(int)$_GET['page'];
  173. $page=RepPIntvar($page);
  174. $start=0;
  175. $line=30;
  176. $page_line=25;
  177. $add="";
  178. $offset=$line*$page;
  179. $totalquery="select count(*) as total from {$dbtbpre}enewsmoreport";
  180. $num=$empire->gettotal($totalquery);
  181. $query="select * from {$dbtbpre}enewsmoreport";
  182. $query.=" order by pid limit $offset,$line";
  183. $sql=$empire->query($query);
  184. $returnpage=page2($num,$line,$page_line,$start,$page,$search);
  185. ?>
  186. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  187. <html>
  188. <head>
  189. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  190. <title>管理网站访问端</title>
  191. <link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
  192. <script>
  193. function CheckAll(form)
  194. {
  195. for (var i=0;i<form.elements.length;i++)
  196. {
  197. var e = form.elements[i];
  198. if (e.name != 'chkall')
  199. e.checked = form.chkall.checked;
  200. }
  201. }
  202. </script>
  203. </head>
  204. <body>
  205. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  206. <tr>
  207. <td width="50%">位置:<a href="ListMoreport.php<?=$ecms_hashur['whehref']?>">管理网站访问端</a></td>
  208. <td><div align="right" class="emenubutton">
  209. <input type="button" name="Submit5" value="增加访问端" onclick="self.location.href='AddMoreport.php?enews=AddMoreport<?=$ecms_hashur['ehref']?>';">
  210. &nbsp;&nbsp;
  211. <input type="button" name="Submit52" value="更新所有访问端缓存与动态页面" onclick="if(document.getElementById('moreportchangedata').style.display==''){document.getElementById('moreportchangedata').style.display='none';}else{document.getElementById('moreportchangedata').style.display='';}">
  212. </div></td>
  213. </tr>
  214. </table>
  215. <table width="100%" border="0" cellspacing="1" cellpadding="0" class="tableborder" id="moreportchangedata" style="display:none">
  216. <form name="moreportchangedataform" method="GET" action="ListMoreport.php" onsubmit="return confirm('确认要更新?');">
  217. <?=$ecms_hashur['form']?>
  218. <input type="hidden" name="enews" value="MoreportChangeCacheAll">
  219. <tr class="header">
  220. <td height="25">更新所有访问端缓存与动态页面</td>
  221. </tr>
  222. <tr>
  223. <td height="25" bgcolor="#FFFFFF"><input name="docache" type="checkbox" id="docache" value="1" checked>
  224. 更新数据库缓存
  225. <input name="doclassfile" type="checkbox" id="doclassfile" value="1" checked>
  226. 更新栏目缓存文件
  227. <input name="dodtpage" type="checkbox" id="dodtpage" value="1" checked>
  228. 更新动态页面
  229. <input name="dotmpfile" type="checkbox" id="dotmpfile" value="1" checked>
  230. 清理临时文件
  231. <input name="doreindex" type="checkbox" id="doreindex" value="1" checked>
  232. 更新动态首页文件
  233. <input type="submit" name="Submit" value="提交"></td>
  234. </tr>
  235. </form>
  236. </table>
  237. <br>
  238. <table width="100%" border="0" cellpadding="0" cellspacing="1" class="tableborder">
  239. <form name="listmoreportform" method="post" action="ListMoreport.php" onsubmit="return confirm('确认要删除?');">
  240. <?=$ecms_hashur['form']?>
  241. <input type="hidden" name="enews" value="DelMoreport_all">
  242. <tr class="header">
  243. <td width="7%" height="25"> <div align="center">ID</div></td>
  244. <td width="25%" height="25"> <div align="center">访问端</div></td>
  245. <td width="27%" height="25"> <div align="center">使用模板组</div></td>
  246. <td width="11%"><div align="center">强制动态页模式</div></td>
  247. <td width="11%"><div align="center">状态</div></td>
  248. <td width="19%" height="25"> <div align="center">操作</div></td>
  249. </tr>
  250. <?
  251. while($r=$empire->fetch($sql))
  252. {
  253. //主访问端
  254. if($r['pid']==1)
  255. {
  256. $r['pname']='<b>'.$r['pname'].'</b>';
  257. if(empty($r['purl']))
  258. {
  259. $r['purl']=$public_r['newsurl'];
  260. }
  261. $tgr=$empire->fetch1("select gid,gname,isdefault from {$dbtbpre}enewstempgroup where isdefault=1");
  262. }
  263. else
  264. {
  265. $tgr=$empire->fetch1("select gid,gname,isdefault from {$dbtbpre}enewstempgroup where gid='$r[tempgid]'");
  266. }
  267. ?>
  268. <tr bgcolor="#FFFFFF" onmouseout="this.style.backgroundColor='#ffffff'" onmouseover="this.style.backgroundColor='#C3EFFF'">
  269. <td height="25"> <div align="center">
  270. <?=$r[pid]?>
  271. </div></td>
  272. <td height="25"> <div align="center">
  273. <a href="<?=$r[purl]?>" target="_blank"><?=$r[pname]?></a>
  274. </div></td>
  275. <td height="25"> <div align="center">
  276. <?=$tgr[gname]?>
  277. </div></td>
  278. <td><div align="center"><?=$r[mustdt]==1?'是':'否'?></div></td>
  279. <td><div align="center"><?=$r[isclose]==1?'关闭':'开启'?></div></td>
  280. <td height="25"> <div align="center">
  281. <?php
  282. if($r['pid']==1)
  283. {
  284. ?>
  285. 主访问端
  286. <?php
  287. }
  288. else
  289. {
  290. ?>
  291. [<a href="AddMoreport.php?enews=EditMoreport&pid=<?=$r[pid]?><?=$ecms_hashur['ehref']?>">修改</a>] [<a href="ListMoreport.php?enews=DelMoreport&pid=<?=$r[pid]?><?=$ecms_hashur['href']?>" onclick="return confirm('确认要删除?');">删除</a>]
  292. <?php
  293. }
  294. ?>
  295. </div></td>
  296. </tr>
  297. <?
  298. }
  299. ?>
  300. <tr bgcolor="#FFFFFF">
  301. <td height="25" colspan="6">&nbsp;
  302. <?=$returnpage?>
  303. &nbsp;&nbsp;</td>
  304. </tr>
  305. </form>
  306. </table>
  307. </body>
  308. </html>
  309. <?
  310. db_close();
  311. $empire=null;
  312. ?>