PubVarClass.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <?php
  2. define('EmpireCMSAdmin','1');
  3. require("../../class/connect.php");
  4. require("../../class/db_sql.php");
  5. require("../../class/functions.php");
  6. $link=db_connect();
  7. $empire=new mysqlquery();
  8. $editor=1;
  9. //验证用户
  10. $lur=is_login();
  11. $logininid=$lur['userid'];
  12. $loginin=$lur['username'];
  13. $loginrnd=$lur['rnd'];
  14. $loginlevel=$lur['groupid'];
  15. $loginadminstyleid=$lur['adminstyleid'];
  16. //ehash
  17. $ecms_hashur=hReturnEcmsHashStrAll();
  18. //验证权限
  19. CheckLevel($logininid,$loginin,$classid,"pubvar");
  20. //增加分类
  21. function AddPubVarClass($add,$userid,$username){
  22. global $empire,$dbtbpre;
  23. if(!$add[classname])
  24. {
  25. printerror("EmptyPubVarClass","history.go(-1)");
  26. }
  27. //验证权限
  28. CheckLevel($userid,$username,$classid,"pubvar");
  29. $add['classname']=hRepPostStr($add['classname'],1);
  30. $add['classsay']=hRepPostStr($add['classsay'],1);
  31. $sql=$empire->query("insert into {$dbtbpre}enewspubvarclass(classname,classsay) values('".$add[classname]."','".$add[classsay]."');");
  32. $lastid=$empire->lastid();
  33. if($sql)
  34. {
  35. //操作日志
  36. insert_dolog("classid=".$lastid."<br>classname=".$add[classname]);
  37. printerror("AddPubVarClassSuccess","PubVarClass.php".hReturnEcmsHashStrHref2(1));
  38. }
  39. else
  40. {printerror("DbError","history.go(-1)");}
  41. }
  42. //修改分类
  43. function EditPubVarClass($add,$userid,$username){
  44. global $empire,$dbtbpre;
  45. $classid=(int)$add[classid];
  46. if(!$add[classname]||!$classid)
  47. {
  48. printerror("EmptyPubVarClass","history.go(-1)");
  49. }
  50. //验证权限
  51. CheckLevel($userid,$username,$classid,"pubvar");
  52. $add['classname']=hRepPostStr($add['classname'],1);
  53. $add['classsay']=hRepPostStr($add['classsay'],1);
  54. $sql=$empire->query("update {$dbtbpre}enewspubvarclass set classname='".$add[classname]."',classsay='".$add[classsay]."' where classid='$classid'");
  55. if($sql)
  56. {
  57. //操作日志
  58. insert_dolog("classid=".$classid."<br>classname=".$add[classname]);
  59. printerror("EditPubVarClassSuccess","PubVarClass.php".hReturnEcmsHashStrHref2(1));
  60. }
  61. else
  62. {printerror("DbError","history.go(-1)");}
  63. }
  64. //删除分类
  65. function DelPubVarClass($classid,$userid,$username){
  66. global $empire,$dbtbpre;
  67. $classid=(int)$classid;
  68. if(!$classid)
  69. {
  70. printerror("NotDelPubVarClassid","history.go(-1)");
  71. }
  72. //验证权限
  73. CheckLevel($userid,$username,$classid,"pubvar");
  74. $r=$empire->fetch1("select classname from {$dbtbpre}enewspubvarclass where classid='$classid'");
  75. $sql=$empire->query("delete from {$dbtbpre}enewspubvarclass where classid='$classid'");
  76. //删除变量
  77. $delsql=$empire->query("delete from {$dbtbpre}enewspubvar where classid='$classid'");
  78. if($sql)
  79. {
  80. GetConfig();
  81. //操作日志
  82. insert_dolog("classid=".$classid."<br>classname=".$r[classname]);
  83. printerror("DelPubVarClassSuccess","PubVarClass.php".hReturnEcmsHashStrHref2(1));
  84. }
  85. else
  86. {printerror("DbError","history.go(-1)");}
  87. }
  88. $enews=$_POST['enews'];
  89. if(empty($enews))
  90. {$enews=$_GET['enews'];}
  91. if($enews)
  92. {
  93. hCheckEcmsRHash();
  94. }
  95. if($enews=="AddPubVarClass")//增加分类
  96. {
  97. AddPubVarClass($_POST,$logininid,$loginin);
  98. }
  99. elseif($enews=="EditPubVarClass")//修改分类
  100. {
  101. EditPubVarClass($_POST,$logininid,$loginin);
  102. }
  103. elseif($enews=="DelPubVarClass")//删除分类
  104. {
  105. $classid=$_GET['classid'];
  106. DelPubVarClass($classid,$logininid,$loginin);
  107. }
  108. else
  109. {}
  110. $sql=$empire->query("select classid,classname,classsay from {$dbtbpre}enewspubvarclass order by classid desc");
  111. ?>
  112. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  113. <html>
  114. <head>
  115. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  116. <title></title>
  117. <link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
  118. </head>
  119. <body>
  120. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  121. <tr>
  122. <td width="50%">位置:<a href="ListPubVar.php<?=$ecms_hashur['whehref']?>">管理扩展变量</a> &gt; <a href="PubVarClass.php<?=$ecms_hashur['whehref']?>">管理变量分类</a></td>
  123. <td><div align="right" class="emenubutton">
  124. <input type="button" name="Submit5" value="管理扩展变量" onclick="self.location.href='ListPubVar.php<?=$ecms_hashur['whehref']?>';">
  125. </div></td>
  126. </tr>
  127. </table>
  128. <form name="form1" method="post" action="PubVarClass.php">
  129. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  130. <?=$ecms_hashur['form']?>
  131. <tr class="header">
  132. <td height="25">增加变量分类:
  133. <input name=enews type=hidden id="enews" value=AddPubVarClass> </td>
  134. </tr>
  135. <tr>
  136. <td height="25" bgcolor="#FFFFFF"> 分类名称:
  137. <input name="classname" type="text" id="classname">
  138. 分类说明: <input name="classsay" type="text" id="classsay" size="42"> <input type="submit" name="Submit" value="增加"></td>
  139. </tr>
  140. </table>
  141. </form>
  142. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  143. <tr class="header">
  144. <td width="6%"><div align="center">ID</div></td>
  145. <td width="29%" height="25">分类名称</td>
  146. <td width="49%">分类说明</td>
  147. <td width="16%" height="25"><div align="center">操作</div></td>
  148. </tr>
  149. <?php
  150. while($r=$empire->fetch($sql))
  151. {
  152. ?>
  153. <form name=form2 method=post action=PubVarClass.php>
  154. <?=$ecms_hashur['form']?>
  155. <input type=hidden name=enews value=EditPubVarClass>
  156. <input type=hidden name=classid value=<?=$r[classid]?>>
  157. <tr bgcolor="#FFFFFF" onmouseout="this.style.backgroundColor='#ffffff'" onmouseover="this.style.backgroundColor='#C3EFFF'">
  158. <td><div align="center">
  159. <?=$r[classid]?>
  160. </div></td>
  161. <td height="25"> <input name="classname" type="text" id="classname" value="<?=$r[classname]?>">
  162. [<a href="ListPubVar.php?classid=<?=$r[classid]?><?=$ecms_hashur['ehref']?>" target="_blank">变量列表</a>]</td>
  163. <td><input name="classsay" type="text" id="classsay" value="<?=$r[classsay]?>" size="42"></td>
  164. <td height="25"><div align="center">
  165. <input type="submit" name="Submit3" value="修改">
  166. &nbsp;
  167. <input type="button" name="Submit4" value="删除" onclick="if(confirm('删除会删除分类下的所有变量,确认要删除?')){self.location.href='PubVarClass.php?enews=DelPubVarClass&classid=<?=$r[classid]?><?=$ecms_hashur['href']?>';}">
  168. </div></td>
  169. </tr>
  170. </form>
  171. <?php
  172. }
  173. db_close();
  174. $empire=null;
  175. ?>
  176. </table>
  177. </body>
  178. </html>