ListPagetemp.php 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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,"template");
  21. //增加自定义页面模板
  22. function AddPagetemp($add,$userid,$username){
  23. global $empire,$dbtbpre;
  24. if(!$add[tempname]||!$add[temptext])
  25. {
  26. printerror("EmptyPagetempname","history.go(-1)");
  27. }
  28. //验证权限
  29. CheckLevel($userid,$username,$classid,"template");
  30. $gid=(int)$add['gid'];
  31. $add[tempname]=hRepPostStr($add[tempname],1);
  32. $add[temptext]=RepPhpAspJspcode($add[temptext]);
  33. $sql=$empire->query("insert into ".GetDoTemptb("enewspagetemp",$gid)."(tempname,temptext) values('$add[tempname]','".eaddslashes2($add[temptext])."');");
  34. $tempid=$empire->lastid();
  35. //备份模板
  36. AddEBakTemp('pagetemp',$gid,$tempid,$add[tempname],$add[temptext],0,0,'',0,0,'',0,0,0,$userid,$username);
  37. if($sql)
  38. {
  39. //操作日志
  40. insert_dolog("tempid=$tempid&tempname=$add[tempname]&gid=$gid");
  41. printerror("AddPagetempSuccess","AddPagetemp.php?enews=AddPagetemp&gid=$gid".hReturnEcmsHashStrHref2(0));
  42. }
  43. else
  44. {
  45. printerror("DbError","history.go(-1)");
  46. }
  47. }
  48. //修改自定义页面模板
  49. function EditPagetemp($add,$userid,$username){
  50. global $empire,$dbtbpre;
  51. $tempid=(int)$add['tempid'];
  52. if(!$tempid||!$add[tempname]||!$add[temptext])
  53. {
  54. printerror("EmptyPagetempname","history.go(-1)");
  55. }
  56. //验证权限
  57. CheckLevel($userid,$username,$classid,"template");
  58. $gid=(int)$add['gid'];
  59. $add[tempname]=hRepPostStr($add[tempname],1);
  60. $add[temptext]=RepPhpAspJspcode($add[temptext]);
  61. $sql=$empire->query("update ".GetDoTemptb("enewspagetemp",$gid)." set tempname='$add[tempname]',temptext='".eaddslashes2($add[temptext])."' where tempid='$tempid'");
  62. //备份模板
  63. AddEBakTemp('pagetemp',$gid,$tempid,$add[tempname],$add[temptext],0,0,'',0,0,'',0,0,0,$userid,$username);
  64. if($sql)
  65. {
  66. //操作日志
  67. insert_dolog("tempid=$tempid&tempname=$add[tempname]&gid=$gid");
  68. printerror("EditPagetempSuccess","ListPagetemp.php?gid=$gid".hReturnEcmsHashStrHref2(0));
  69. }
  70. else
  71. {
  72. printerror("DbError","history.go(-1)");
  73. }
  74. }
  75. //删除自定义页面模板
  76. function DelPagetemp($add,$userid,$username){
  77. global $empire,$dbtbpre;
  78. $tempid=(int)$add['tempid'];
  79. if(!$tempid)
  80. {
  81. printerror("EmptyPagetempid","history.go(-1)");
  82. }
  83. //验证权限
  84. CheckLevel($userid,$username,$classid,"template");
  85. $gid=(int)$add['gid'];
  86. $r=$empire->fetch1("select tempname from ".GetDoTemptb("enewspagetemp",$gid)." where tempid='$tempid'");
  87. $sql=$empire->query("delete from ".GetDoTemptb("enewspagetemp",$gid)." where tempid='$tempid'");
  88. //删除备份记录
  89. DelEbakTempAll('pagetemp',$gid,$tempid);
  90. if($sql)
  91. {
  92. //操作日志
  93. insert_dolog("tempid=$tempid&tempname=$r[tempname]&gid=$gid");
  94. printerror("DelPagetempSuccess","ListPagetemp.php?gid=$gid".hReturnEcmsHashStrHref2(0));
  95. }
  96. else
  97. {
  98. printerror("DbError","history.go(-1)");
  99. }
  100. }
  101. //操作
  102. $enews=$_POST['enews'];
  103. if(empty($enews))
  104. {$enews=$_GET['enews'];}
  105. if($enews)
  106. {
  107. hCheckEcmsRHash();
  108. include("../../class/tempfun.php");
  109. }
  110. //增加模板
  111. if($enews=="AddPagetemp")
  112. {
  113. AddPagetemp($_POST,$logininid,$loginin);
  114. }
  115. //修改模板
  116. elseif($enews=="EditPagetemp")
  117. {
  118. EditPagetemp($_POST,$logininid,$loginin);
  119. }
  120. //删除模板
  121. elseif($enews=="DelPagetemp")
  122. {
  123. DelPagetemp($_GET,$logininid,$loginin);
  124. }
  125. else
  126. {}
  127. $gid=(int)$_GET['gid'];
  128. $gname=CheckTempGroup($gid);
  129. $urlgname=$gname."&nbsp;>&nbsp;";
  130. $url=$urlgname."<a href=ListPagetemp.php?gid=$gid".$ecms_hashur['ehref'].">管理自定义页面模板</a>";
  131. $search="&gid=$gid".$ecms_hashur['ehref'];
  132. $page=(int)$_GET['page'];
  133. $page=RepPIntvar($page);
  134. $start=0;
  135. $line=25;//每页显示条数
  136. $page_line=12;//每页显示链接数
  137. $offset=$page*$line;//总偏移量
  138. $query="select tempid,tempname from ".GetDoTemptb("enewspagetemp",$gid);
  139. $totalquery="select count(*) as total from ".GetDoTemptb("enewspagetemp",$gid);
  140. $num=$empire->gettotal($totalquery);//取得总条数
  141. $query=$query." order by tempid desc limit $offset,$line";
  142. $sql=$empire->query($query);
  143. $returnpage=page2($num,$line,$page_line,$start,$page,$search);
  144. ?>
  145. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  146. <html>
  147. <head>
  148. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  149. <title>管理自定义页面模板</title>
  150. <link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
  151. </head>
  152. <body>
  153. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  154. <tr>
  155. <td width="50%">位置:
  156. <?=$url?>
  157. </td>
  158. <td><div align="right" class="emenubutton">
  159. <input type="button" name="Submit5" value="增加自定义页面模板" onclick="self.location.href='AddPagetemp.php?enews=AddPagetemp&gid=<?=$gid?><?=$ecms_hashur['ehref']?>';">
  160. </div></td>
  161. </tr>
  162. </table>
  163. <br>
  164. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  165. <tr class="header">
  166. <td width="10%" height="25"><div align="center">ID</div></td>
  167. <td width="61%" height="25"><div align="center">模板名</div></td>
  168. <td width="29%" height="25"><div align="center">操作</div></td>
  169. </tr>
  170. <?php
  171. while($r=$empire->fetch($sql))
  172. {
  173. ?>
  174. <tr bgcolor="#ffffff" onmouseout="this.style.backgroundColor='#ffffff'" onmouseover="this.style.backgroundColor='#C3EFFF'">
  175. <td height="25"><div align="center">
  176. <a href="EditTempid.php?tempno=12&tempid=<?=$r['tempid']?>&gid=<?=$gid?><?=$ecms_hashur['ehref']?>" target="_blank" title="修改模板ID"><?=$r[tempid]?></a>
  177. </div></td>
  178. <td height="25"><div align="center">
  179. <?=$r[tempname]?>
  180. </div></td>
  181. <td height="25"><div align="center"> [<a href="AddPagetemp.php?enews=EditPagetemp&tempid=<?=$r[tempid]?>&gid=<?=$gid?><?=$ecms_hashur['ehref']?>">修改</a>]
  182. [<a href="AddPagetemp.php?enews=AddPagetemp&docopy=1&tempid=<?=$r[tempid]?>&gid=<?=$gid?><?=$ecms_hashur['ehref']?>">复制</a>]
  183. [<a href="ListPagetemp.php?enews=DelPagetemp&tempid=<?=$r[tempid]?>&gid=<?=$gid?><?=$ecms_hashur['href']?>" onclick="return confirm('确认要删除?');">删除</a>]</div></td>
  184. </tr>
  185. <?
  186. }
  187. ?>
  188. <tr bgcolor="ffffff">
  189. <td height="25" colspan="3">&nbsp;
  190. <?=$returnpage?>
  191. </td>
  192. </tr>
  193. </table>
  194. </body>
  195. </html>
  196. <?php
  197. db_close();
  198. $empire=null;
  199. ?>