国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

232 satır
9.6KB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="<?php echo $cfg_soft_lang; ?>">
  5. <title>系统配置变量</title>
  6. <script src="../static/web/js/webajax.js"></script>
  7. <script src="../static/web/js/jquery.min.js"></script>
  8. <script>
  9. var searchconfig = false;
  10. function Nav() {
  11. if (window.navigator.userAgent.indexOf("MSIE") >= 1) return 'IE';
  12. else if (window.navigator.userAgent.indexOf("Firefox") >= 1) return 'FF';
  13. else return "OT";
  14. }
  15. function $Obj(objname) {
  16. return document.getElementById(objname);
  17. }
  18. function ShowConfig(em, allgr) {
  19. if (searchconfig) location.reload();
  20. for (var i = 1; i <= allgr; i++) {
  21. if (i == em) $Obj('td' + i).style.display = (Nav() == 'IE' ? 'block' : 'table');
  22. else $Obj('td' + i).style.display = 'none';
  23. }
  24. $Obj('addvar').style.display = 'none';
  25. }
  26. function ShowHide(objname) {
  27. var obj = $Obj(objname);
  28. if (obj.style.display != "none") obj.style.display = "none";
  29. else obj.style.display = (Nav() == 'IE' ? 'block' : 'table-row');
  30. }
  31. function backSearch() {
  32. location.reload();
  33. }
  34. function getSearch() {
  35. var searchKeywords = $Obj('keywds').value;
  36. searchKeywords = searchKeywords.replace(/^cfg_/, "");
  37. fetch('sys_info.php?dopost=search&keywords=' + searchKeywords).then(resp=>{
  38. if (resp.ok) {
  39. return resp.text()
  40. }
  41. throw new Error('系统错误,无法获取数据');
  42. }).then((d)=>{
  43. $Obj('_search').innerHTML = d;
  44. }).catch((error) => {
  45. $Obj('_search').innerHTML = errMsg;
  46. });
  47. $Obj('_searchback').innerHTML = '<button class="btn btn-success btn-sm" name="searchbackBtn" type="button" id="searchbackBtn" onclick="backSearch()">返回</button>'
  48. $Obj('_mainsearch').innerHTML = '';
  49. searchconfig = true;
  50. }
  51. function resetCookieEncode() {
  52. jQuery.get("sys_info.php?dopost=make_encode", function (data) {
  53. jQuery("#edit___cfg_cookie_encode").val(data);
  54. });
  55. }
  56. </script>
  57. <link rel="stylesheet" href="../static/web/css/bootstrap.min.css">
  58. <link rel="stylesheet" href="../static/web/font/css/font-awesome.min.css">
  59. <link rel="stylesheet" href="../static/web/css/admin.css">
  60. <style>
  61. .table{margin-bottom:0}
  62. </style>
  63. </head>
  64. <body>
  65. <div style="min-width:780px">
  66. <table width="98%" border="0" cellpadding="2" cellspacing="1" align="center" class="table maintable mt-3">
  67. <tr>
  68. <td height="30" background="../static/web/img/tbg.gif" style="padding-left:10px">系统配置变量</td>
  69. </tr>
  70. <tr>
  71. <td height="30" bgcolor="#ffffff" align="left">
  72. <?php
  73. $ds = file(DEDEADMIN.'/inc/configgroup.txt');
  74. $totalGroup = count($ds);
  75. $i = 0;
  76. foreach($ds as $dl)
  77. {
  78. $dl = trim($dl);
  79. if(empty($dl)) continue;
  80. $dls = explode(',',$dl);
  81. $i++;
  82. if($i>1) echo "<a href='javascript:ShowConfig($i,$totalGroup)' class='btn btn-success btn-sm'>{$dls[1]}</a>";
  83. else {
  84. echo "<a href='javascript:ShowConfig($i,$totalGroup)' class='btn btn-success btn-sm'>{$dls[1]}</a>";
  85. }
  86. }
  87. ?>
  88. <a href="javascript:;" onClick="ShowHide('addvar')" class="btn btn-success btn-sm">添加新变量</a>
  89. </td>
  90. </tr>
  91. <tr id="addvar" style="display:none">
  92. <td height="26" bgcolor="#ffffff" align="center">
  93. <form name="fadd" action="sys_info.php" method="post">
  94. <input type='hidden' name='dopost' value='add'>
  95. <input type="hidden" name="_csrf_token" value="<?php echo $GLOBALS['csrf_token']; ?>">
  96. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  97. <tr>
  98. <td width="12%" height="26">变量名称</td>
  99. <td width="38%" align="left"><input name="nvarname" type="text" id="nvarname" class="npvar" style="width:80%"></td>
  100. <td width="12%" align="center">变量值</td>
  101. <td width="38%" align="left"><input name="nvarvalue" type="text" id="nvarvalue" class="npvar" style="width:80%"></td>
  102. </tr>
  103. <tr>
  104. <td width="10%" height="26">变量类型</td>
  105. <td colspan='3' align="left"><input name="vartype" type="radio" value="string" class='np' checked='checked'>
  106. 文本
  107. <input name="vartype" type="radio" value="number" class='np'>
  108. 数字
  109. <input type="radio" name="vartype" value="bool" class='np'>
  110. 布尔(Y/N)
  111. <input type="radio" name="vartype" value="bstring" class='np'>
  112. 多行文本
  113. </td>
  114. </tr>
  115. <tr>
  116. <td height="26">变量说明</td>
  117. <td align="left"><input type="text" name="varmsg" id="varmsg" class="npvar" style="width:80%"></td>
  118. <td align="center">所属组</td>
  119. <td align="left">
  120. <?php
  121. echo "<select name='vargroup' class='npvar' style='width:160px'>";
  122. foreach($ds as $dl){
  123. $dl = trim($dl);
  124. if(empty($dl)) continue;
  125. $dls = explode(',',$dl);
  126. echo "<option value='{$dls[0]}'>{$dls[1]}</option>";
  127. }
  128. echo "</select>";
  129. ?>
  130. <button type="submit" class="btn btn-success btn-sm">保存变量</button>
  131. </td>
  132. </tr>
  133. </table>
  134. </form>
  135. </td>
  136. </tr>
  137. </table>
  138. <table width="98%" border="0" cellpadding="0" cellspacing="0" align="center" class="table maintable mt-3 mb-3">
  139. <tr>
  140. <td height="26" align="right" background="../static/web/img/tbg.gif">
  141. <span style="line-height:26px">配置搜索:</span>
  142. <input type="text" name="keywds" id="keywds" style="width:260px">
  143. <button type="button" onclick="getSearch()" class="btn btn-success btn-sm">搜索</button>
  144. <span id="_searchback"></span>
  145. </td>
  146. </tr>
  147. <tr>
  148. <td bgcolor="#ffffff" style="padding:0">
  149. <form action="sys_info.php" method="post" name="form1">
  150. <input type="hidden" name="_csrf_token" value="<?php echo $GLOBALS['csrf_token']; ?>">
  151. <input type="hidden" name="dopost" value="save">
  152. <div id="_search"></div>
  153. <div id="_mainsearch">
  154. <?php
  155. $n = 0;
  156. if(!isset($gp)) $gp = 1;
  157. foreach($ds as $dl)
  158. {
  159. $dl = trim($dl);
  160. if(empty($dl)) continue;
  161. $dls = explode(',',$dl);
  162. $n++;
  163. ?>
  164. <table width="100%" border="0" cellspacing="1" cellpadding="1" id="td<?php echo $n?>" class="table" style="<?php if($n!=$gp) echo 'display:none'; ?>">
  165. <tr align="center" bgcolor="#FBFCE2">
  166. <td width="360" style="border-top:0">变量说明</td>
  167. <td style="border-top:0">变量值</td>
  168. <td width="260" style="border-top:0">变量名</td>
  169. </tr>
  170. <?php
  171. $dsql->SetQuery("Select * From `#@__sysconfig` where groupid='{$dls[0]}' order by aid asc");
  172. $dsql->Execute();
  173. $i = 1;
  174. while($row = $dsql->GetArray())
  175. {
  176. if($i%2==0)
  177. {
  178. $bgcolor = "#f8f8f8";
  179. } else {
  180. $bgcolor = "#ffffff";
  181. }
  182. $i++;
  183. ?>
  184. <tr align="center" bgcolor="<?php echo $bgcolor?>">
  185. <td width="300"><?php echo $row['info']; ?></td>
  186. <td align="left">
  187. <?php
  188. if($row['type']=='bool')
  189. {
  190. $c1='';
  191. $c2 = '';
  192. $row['value']=='Y' ? $c1=" checked" : $c2=" checked";
  193. echo "<label><input type='radio' name='edit___{$row['varname']}' class='np' value='Y'$c1> 是 </label> ";
  194. echo "<label><input type='radio' name='edit___{$row['varname']}' class='np' value='N'$c2> 否 </label> ";
  195. } else if($row['type']=='bstring') {
  196. echo "<textarea name='edit___{$row['varname']}' row='4' id='edit___{$row['varname']}' class='textarea_info' style='width:100%;height:40px'>".dede_htmlspecialchars($row['value'])."</textarea>";
  197. } else if($row['type']=='number') {
  198. echo "<input type='text' name='edit___{$row['varname']}' id='edit___{$row['varname']}' value='{$row['value']}' style='width:30%'>";
  199. } else {
  200. $addstr='';
  201. if ($row['varname']=='cfg_cookie_encode') {
  202. $addstr=' <a href="javascript:resetCookieEncode();" class="btn btn-success btn-sm">重新生成</a>';
  203. }
  204. echo "<input type='text' name='edit___{$row['varname']}' id='edit___{$row['varname']}' value=\"".dede_htmlspecialchars($row['value'])."\" style='width:80%'>{$addstr}";
  205. }
  206. ?>
  207. </td>
  208. <td><?php echo $row['varname']?></td>
  209. </tr>
  210. <?php
  211. }
  212. ?>
  213. </table>
  214. <?php
  215. }
  216. ?>
  217. </div>
  218. <table width="100%" border="0" cellspacing="1" cellpadding="1" bgcolor="#f8f8f8" class="table" style="border:none">
  219. <tr align="center" height="36">
  220. <td>
  221. <button type="submit" class="btn btn-success">确定</button>
  222. <button type="button" onClick="document.form1.reset()" class="btn btn-success">重置</button>
  223. </td>
  224. </tr>
  225. </table>
  226. </form>
  227. </td>
  228. </tr>
  229. </table>
  230. </div>
  231. </body>
  232. </html>