国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

229 linhas
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. </head>
  61. <body>
  62. <div style="min-width:780px">
  63. <table width="98%" border="0" cellpadding="2" cellspacing="1" align="center" class="table maintable mt-3">
  64. <tr>
  65. <td height="30" background="../static/web/img/tbg.gif" style="padding-left:10px">系统配置变量</td>
  66. </tr>
  67. <tr>
  68. <td height="30" bgcolor="#ffffff" align="left">
  69. <?php
  70. $ds = file(DEDEADMIN.'/inc/configgroup.txt');
  71. $totalGroup = count($ds);
  72. $i = 0;
  73. foreach($ds as $dl)
  74. {
  75. $dl = trim($dl);
  76. if(empty($dl)) continue;
  77. $dls = explode(',',$dl);
  78. $i++;
  79. if($i>1) echo "<a href='javascript:ShowConfig($i,$totalGroup)' class='btn btn-success btn-sm'>{$dls[1]}</a>";
  80. else {
  81. echo "<a href='javascript:ShowConfig($i,$totalGroup)' class='btn btn-success btn-sm'>{$dls[1]}</a>";
  82. }
  83. }
  84. ?>
  85. <a href="javascript:;" onClick="ShowHide('addvar')" class="btn btn-success btn-sm">添加新变量</a>
  86. </td>
  87. </tr>
  88. <tr id="addvar" style="display:none">
  89. <td height="26" bgcolor="#ffffff" align="center">
  90. <form name="fadd" action="sys_info.php" method="post">
  91. <input type='hidden' name='dopost' value='add'>
  92. <input type="hidden" name="_csrf_token" value="<?php echo $GLOBALS['csrf_token']; ?>">
  93. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  94. <tr>
  95. <td width="12%" height="26">变量名称</td>
  96. <td width="38%" align="left"><input name="nvarname" type="text" id="nvarname" class="npvar" style="width:80%"></td>
  97. <td width="12%" align="center">变量值</td>
  98. <td width="38%" align="left"><input name="nvarvalue" type="text" id="nvarvalue" class="npvar" style="width:80%"></td>
  99. </tr>
  100. <tr>
  101. <td width="10%" height="26">变量类型</td>
  102. <td colspan='3' align="left"><input name="vartype" type="radio" value="string" class='np' checked='checked'>
  103. 文本
  104. <input name="vartype" type="radio" value="number" class='np'>
  105. 数字
  106. <input type="radio" name="vartype" value="bool" class='np'>
  107. 布尔(Y/N)
  108. <input type="radio" name="vartype" value="bstring" class='np'>
  109. 多行文本
  110. </td>
  111. </tr>
  112. <tr>
  113. <td height="26">变量说明</td>
  114. <td align="left"><input type="text" name="varmsg" id="varmsg" class="npvar" style="width:80%"></td>
  115. <td align="center">所属组</td>
  116. <td align="left">
  117. <?php
  118. echo "<select name='vargroup' class='npvar' style='width:160px'>";
  119. foreach($ds as $dl){
  120. $dl = trim($dl);
  121. if(empty($dl)) continue;
  122. $dls = explode(',',$dl);
  123. echo "<option value='{$dls[0]}'>{$dls[1]}</option>";
  124. }
  125. echo "</select>";
  126. ?>
  127. <button type="submit" class="btn btn-success btn-sm">保存变量</button>
  128. </td>
  129. </tr>
  130. </table>
  131. </form>
  132. </td>
  133. </tr>
  134. </table>
  135. <table width="98%" border="0" cellpadding="0" cellspacing="0" align="center" class="table maintable mt-3 mb-3">
  136. <tr>
  137. <td height="26" align="right" background="../static/web/img/tbg.gif">
  138. <span style="line-height:26px">配置搜索:</span>
  139. <input type="text" name="keywds" id="keywds" style="width:260px">
  140. <button type="button" onclick="getSearch()" class="btn btn-success btn-sm">搜索</button>
  141. <span id="_searchback"></span>
  142. </td>
  143. </tr>
  144. <tr>
  145. <td bgcolor="#ffffff" style="padding:0">
  146. <form action="sys_info.php" method="post" name="form1">
  147. <input type="hidden" name="_csrf_token" value="<?php echo $GLOBALS['csrf_token']; ?>">
  148. <input type="hidden" name="dopost" value="save">
  149. <div id="_search"></div>
  150. <div id="_mainsearch">
  151. <?php
  152. $n = 0;
  153. if(!isset($gp)) $gp = 1;
  154. foreach($ds as $dl)
  155. {
  156. $dl = trim($dl);
  157. if(empty($dl)) continue;
  158. $dls = explode(',',$dl);
  159. $n++;
  160. ?>
  161. <table width="100%" border="0" cellspacing="1" cellpadding="1" id="td<?php echo $n?>" class="table" style="<?php if($n!=$gp) echo 'display:none'; ?>">
  162. <tr align="center" bgcolor="#FBFCE2">
  163. <td width="360" style="border-top:0">变量说明</td>
  164. <td style="border-top:0">变量值</td>
  165. <td width="260" style="border-top:0">变量名</td>
  166. </tr>
  167. <?php
  168. $dsql->SetQuery("Select * From `#@__sysconfig` where groupid='{$dls[0]}' order by aid asc");
  169. $dsql->Execute();
  170. $i = 1;
  171. while($row = $dsql->GetArray())
  172. {
  173. if($i%2==0)
  174. {
  175. $bgcolor = "#f8f8f8";
  176. } else {
  177. $bgcolor = "#ffffff";
  178. }
  179. $i++;
  180. ?>
  181. <tr align="center" bgcolor="<?php echo $bgcolor?>">
  182. <td width="300"><?php echo $row['info']; ?></td>
  183. <td align="left">
  184. <?php
  185. if($row['type']=='bool')
  186. {
  187. $c1='';
  188. $c2 = '';
  189. $row['value']=='Y' ? $c1=" checked" : $c2=" checked";
  190. echo "<label><input type='radio' name='edit___{$row['varname']}' class='np' value='Y'$c1> 是 </label> ";
  191. echo "<label><input type='radio' name='edit___{$row['varname']}' class='np' value='N'$c2> 否 </label> ";
  192. } else if($row['type']=='bstring') {
  193. 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>";
  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 width="100%" border="0" cellspacing="1" cellpadding="1" bgcolor="#f8f8f8" class="table mb-0" style="border:none">
  216. <tr height="36" align="center" class="py-3">
  217. <td>
  218. <button type="submit" class="btn btn-success">确定</button>
  219. <button type="button" onClick="document.form1.reset()" class="btn btn-success">重置</button>
  220. </td>
  221. </tr>
  222. </table>
  223. </form>
  224. </td>
  225. </tr>
  226. </table>
  227. </div>
  228. </body>
  229. </html>