word.php 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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,"word");
  21. //------------------增加禁用字符
  22. function AddWord($oldword,$newword,$userid,$username){
  23. global $empire,$dbtbpre;
  24. if(!$oldword)
  25. {printerror("EmptyWord","history.go(-1)");}
  26. //验证权限
  27. CheckLevel($userid,$username,$classid,"word");
  28. $sql=$empire->query("insert into {$dbtbpre}enewswords(oldword,newword) values('".eaddslashes($oldword)."','".eaddslashes($newword)."');");
  29. $wordid=$empire->lastid();
  30. GetConfig();//更新缓存
  31. if($sql)
  32. {
  33. //操作日志
  34. insert_dolog("wordid=".$wordid);
  35. printerror("AddWordSuccess","word.php".hReturnEcmsHashStrHref2(1));
  36. }
  37. else
  38. {printerror("DbError","history.go(-1)");}
  39. }
  40. //----------------修改禁用字符
  41. function EditWord($wordid,$oldword,$newword,$userid,$username){
  42. global $empire,$dbtbpre;
  43. if(!$oldword||!$wordid)
  44. {printerror("EmptyWord","history.go(-1)");}
  45. //验证权限
  46. CheckLevel($userid,$username,$classid,"word");
  47. $wordid=(int)$wordid;
  48. $sql=$empire->query("update {$dbtbpre}enewswords set oldword='".eaddslashes($oldword)."',newword='".eaddslashes($newword)."' where wordid='$wordid'");
  49. GetConfig();//更新缓存
  50. if($sql)
  51. {
  52. //操作日志
  53. insert_dolog("wordid=".$wordid);
  54. printerror("EditWordSuccess","word.php".hReturnEcmsHashStrHref2(1));
  55. }
  56. else
  57. {printerror("DbError","history.go(-1)");}
  58. }
  59. //---------------删除禁用字符
  60. function DelWord($wordid,$userid,$username){
  61. global $empire,$dbtbpre;
  62. $wordid=(int)$wordid;
  63. if(!$wordid)
  64. {printerror("NotDelWordid","history.go(-1)");}
  65. //验证权限
  66. CheckLevel($userid,$username,$classid,"word");
  67. $sql=$empire->query("delete from {$dbtbpre}enewswords where wordid='$wordid'");
  68. GetConfig();//更新缓存
  69. if($sql)
  70. {
  71. //操作日志
  72. insert_dolog("wordid=".$wordid);
  73. printerror("DelWordSuccess","word.php".hReturnEcmsHashStrHref2(1));
  74. }
  75. else
  76. {printerror("DbError","history.go(-1)");}
  77. }
  78. $enews=$_POST['enews'];
  79. if(empty($enews))
  80. {$enews=$_GET['enews'];}
  81. if($enews)
  82. {
  83. hCheckEcmsRHash();
  84. }
  85. //增加过滤字符
  86. if($enews=="AddWord")
  87. {
  88. $oldword=$_POST['oldword'];
  89. $newword=$_POST['newword'];
  90. AddWord($oldword,$newword,$logininid,$loginin);
  91. }
  92. //修改过滤字符
  93. elseif($enews=="EditWord")
  94. {
  95. $wordid=$_POST['wordid'];
  96. $oldword=$_POST['oldword'];
  97. $newword=$_POST['newword'];
  98. EditWord($wordid,$oldword,$newword,$logininid,$loginin);
  99. }
  100. //删除过滤字符
  101. elseif($enews=="DelWord")
  102. {
  103. $wordid=$_GET['wordid'];
  104. DelWord($wordid,$logininid,$loginin);
  105. }
  106. else
  107. {}
  108. $page=(int)$_GET['page'];
  109. $page=RepPIntvar($page);
  110. $start=0;
  111. $line=30;//每页显示条数
  112. $page_line=12;//每页显示链接数
  113. $offset=$page*$line;//总偏移量
  114. $search='';
  115. $search.=$ecms_hashur['ehref'];
  116. $totalquery="select count(*) as total from {$dbtbpre}enewswords";
  117. $num=$empire->gettotal($totalquery);
  118. $query="select wordid,oldword,newword from {$dbtbpre}enewswords order by wordid desc limit $offset,$line";
  119. $sql=$empire->query($query);
  120. $returnpage=page2($num,$line,$page_line,$start,$page,$search);
  121. ?>
  122. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  123. <html>
  124. <head>
  125. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  126. <title>过滤字符</title>
  127. <link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
  128. </head>
  129. <body>
  130. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  131. <tr>
  132. <td>位置:<a href="word.php<?=$ecms_hashur['whehref']?>">管理过滤字符</a></td>
  133. </tr>
  134. </table>
  135. <form name="form1" method="post" action="word.php">
  136. <input type=hidden name=enews value=AddWord>
  137. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  138. <?=$ecms_hashur['form']?>
  139. <tr class="header">
  140. <td height="25">增加过滤字符:</td>
  141. </tr>
  142. <tr>
  143. <td height="25" bgcolor="#FFFFFF"> 将新闻内容包含
  144. <textarea name="oldword" cols="45" rows="5" id="oldword"></textarea>
  145. 替换成
  146. <textarea name="newword" cols="45" rows="5" id="newword"></textarea>
  147. <input type="submit" name="Submit" value="增加">
  148. <input type="reset" name="Submit2" value="重置"></td>
  149. </tr>
  150. </table>
  151. </form>
  152. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  153. <tr class="header">
  154. <td width="86%" height="25">过滤字符</td>
  155. <td width="14%" height="25"><div align="center">操作</div></td>
  156. </tr>
  157. <?
  158. while($r=$empire->fetch($sql))
  159. {
  160. ?>
  161. <form name=form2 method=post action=word.php>
  162. <?=$ecms_hashur['form']?>
  163. <input type=hidden name=enews value=EditWord>
  164. <input type=hidden name=wordid value=<?=$r[wordid]?>>
  165. <tr bgcolor="#FFFFFF" onmouseout="this.style.backgroundColor='#ffffff'" onmouseover="this.style.backgroundColor='#C3EFFF'">
  166. <td height="25"> 将新闻内容包含
  167. <textarea name="oldword" cols="43" rows="5" id="oldword"><?=ehtmlspecialchars($r[oldword])?></textarea>
  168. 替换成
  169. <textarea name="newword" cols="43" rows="5" id="newword"><?=ehtmlspecialchars($r[newword])?></textarea>
  170. </td>
  171. <td height="25"><div align="center">
  172. <input type="submit" name="Submit3" value="修改">
  173. &nbsp;
  174. <input type="button" name="Submit4" value="删除" onclick="if(confirm('确认要删除?')){self.location.href='word.php?enews=DelWord&wordid=<?=$r[wordid]?><?=$ecms_hashur['href']?>';}">
  175. </div></td>
  176. </tr>
  177. </form>
  178. <?
  179. }
  180. db_close();
  181. $empire=null;
  182. ?>
  183. <tr bgcolor="#FFFFFF">
  184. <td height="25" colspan="2">
  185. <?=$returnpage?>
  186. </td>
  187. </tr>
  188. </table>
  189. </body>
  190. </html>