国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

229 lines
8.9KB

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