AddUserjs.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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,"userjs");
  20. $enews=ehtmlspecialchars($_GET['enews']);
  21. $cid=(int)$_GET['cid'];
  22. $url="<a href=ListUserjs.php".$ecms_hashur['whehref'].">管理用户自定义JS</a> &gt; 增加自定义JS";
  23. $r[jsfilename]="../../d/js/js/".time().".js";
  24. $r[jssql]="select * from [!db.pre!]ecms_news order by id desc limit 10";
  25. //复制
  26. if($enews=="AddUserjs"&&$_GET['docopy'])
  27. {
  28. $jsid=(int)$_GET['jsid'];
  29. $r=$empire->fetch1("select * from {$dbtbpre}enewsuserjs where jsid='$jsid'");
  30. $url="<a href=ListUserjs.php".$ecms_hashur['whehref'].">管理用户自定义JS</a> &gt; 复制自定义JS:<b>".$r[jsname]."</b>";
  31. }
  32. //修改
  33. if($enews=="EditUserjs")
  34. {
  35. $jsid=(int)$_GET['jsid'];
  36. $r=$empire->fetch1("select * from {$dbtbpre}enewsuserjs where jsid='$jsid'");
  37. $url="<a href=ListUserjs.php".$ecms_hashur['whehref'].">管理用户自定义JS</a> -&gt; 修改自定义JS:<b>".$r[jsname]."</b>";
  38. }
  39. //js模板
  40. $jstempsql=$empire->query("select tempid,tempname from ".GetTemptb("enewsjstemp")." order by tempid");
  41. while($jstempr=$empire->fetch($jstempsql))
  42. {
  43. $select="";
  44. if($r[jstempid]==$jstempr[tempid])
  45. {
  46. $select=" selected";
  47. }
  48. $jstemp.="<option value='".$jstempr[tempid]."'".$select.">".$jstempr[tempname]."</option>";
  49. }
  50. //当前使用的模板组
  51. $thegid=GetDoTempGid();
  52. //分类
  53. $cstr="";
  54. $csql=$empire->query("select classid,classname from {$dbtbpre}enewsuserjsclass order by classid");
  55. while($cr=$empire->fetch($csql))
  56. {
  57. $select="";
  58. if($cr[classid]==$r[classid])
  59. {
  60. $select=" selected";
  61. }
  62. $cstr.="<option value='".$cr[classid]."'".$select.">".$cr[classname]."</option>";
  63. }
  64. db_close();
  65. $empire=null;
  66. ?>
  67. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  68. <html>
  69. <head>
  70. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  71. <link href="../adminstyle/<?=$loginadminstyleid?>/adminstyle.css" rel="stylesheet" type="text/css">
  72. <title>用户自定义JS</title>
  73. </head>
  74. <body>
  75. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1">
  76. <tr>
  77. <td>位置:<?=$url?></td>
  78. </tr>
  79. </table>
  80. <form name="form1" method="post" action="ListUserjs.php">
  81. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
  82. <?=$ecms_hashur['form']?>
  83. <tr class="header">
  84. <td height="25" colspan="2">增加用户自定义JS
  85. <input name="enews" type="hidden" id="enews" value="<?=$enews?>"> <input name="jsid" type="hidden" id="jsid" value="<?=$jsid?>">
  86. <input name="oldjsfilename" type="hidden" id="oldjsfilename" value="<?=$r[jsfilename]?>">
  87. <input name="cid" type="hidden" id="cid" value="<?=$cid?>"></td>
  88. </tr>
  89. <tr bgcolor="#FFFFFF">
  90. <td width="18%" height="25">JS名称:</td>
  91. <td width="82%" height="25"> <input name="jsname" type="text" id="jsname" value="<?=$r[jsname]?>" size="42"> </td>
  92. </tr>
  93. <tr bgcolor="#FFFFFF">
  94. <td height="25">所属分类</td>
  95. <td height="25"><select name="classid" id="classid">
  96. <option value="0">不隶属于任何类别</option>
  97. <?=$cstr?>
  98. </select>
  99. <input type="button" name="Submit6222322" value="管理分类" onclick="window.open('UserjsClass.php<?=$ecms_hashur['whehref']?>');"></td>
  100. </tr>
  101. <tr bgcolor="#FFFFFF">
  102. <td height="25">JS存放地址:</td>
  103. <td height="25"><input name="jsfilename" type="text" id="jsfilename" value="<?=$r[jsfilename]?>" size="42">
  104. <font color="#666666">
  105. <input type="button" name="Submit4" value="选择目录" onclick="window.open('../file/ChangePath.php?<?=$ecms_hashur['ehref']?>&returnform=opener.document.form1.jsfilename.value','','width=400,height=500,scrollbars=yes');">
  106. (如:<strong>&quot;../../1.js</strong>&quot;表示根目录下的1.js)</font></td>
  107. </tr>
  108. <tr bgcolor="#FFFFFF">
  109. <td rowspan="2">查询SQL语句:</td>
  110. <td height="25"><input name="jssql" type="text" id="jssql" value="<?=ehtmlspecialchars(stripSlashes($r[jssql]))?>" size="72"></td>
  111. </tr>
  112. <tr bgcolor="#FFFFFF">
  113. <td height="25"><font color="#666666">(如:select * from phome_ecms_news where
  114. classid=1 order by id desc limit 10)</font></td>
  115. </tr>
  116. <tr bgcolor="#FFFFFF">
  117. <td height="25">使用JS模板:</td>
  118. <td height="25"><select name="jstempid" id="jstempid">
  119. <?=$jstemp?>
  120. </select> <input type="button" name="Submit62223" value="管理JS模板" onclick="window.open('../template/ListJstemp.php?gid=<?=$thegid?><?=$ecms_hashur['ehref']?>');"></td>
  121. </tr>
  122. <tr bgcolor="#FFFFFF">
  123. <td height="25">&nbsp;</td>
  124. <td height="25"> <input type="submit" name="Submit" value="提交"> <input type="reset" name="Submit2" value="重置"></td>
  125. </tr>
  126. <tr bgcolor="#FFFFFF">
  127. <td height="25">&nbsp;</td>
  128. <td height="25">表前缀可用“<strong>[!db.pre!]</strong>”表示</td>
  129. </tr>
  130. </table>
  131. </form>
  132. </body>
  133. </html>