国内流行的内容管理系统(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.

230 lines
9.5KB

  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%" cellpadding="2" cellspacing="1" align="center" class="table maintable mt-3 mb-3">
  64. <tr>
  65. <td height="26" background="../static/web/img/tbg.gif" style="padding-left:10px">系统配置变量</td>
  66. </tr>
  67. <tr>
  68. <td height="26">
  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" 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%" cellspacing="0" cellpadding="0">
  94. <tr>
  95. <td width="90" height="26" style="border-top:0">变量说明</td>
  96. <td width="270" style="border-top:0"><input type="text" name="varmsg" id="varmsg" class="npvar" style="width:260px"></td>
  97. <td width="90" style="border-top:0">变量值</td>
  98. <td width="270" style="border-top:0"><input name="nvarvalue" type="text" id="nvarvalue" class="npvar" style="width:260px"></td>
  99. </tr>
  100. <tr>
  101. <td width="90" height="26">变量类型</td>
  102. <td colspan="3">
  103. <input name="vartype" type="radio" value="string" class='np' checked='checked'>
  104. 文本
  105. <input name="vartype" type="radio" value="number" class='np'>
  106. 数字
  107. <input type="radio" name="vartype" value="bool" class='np'>
  108. 布尔(Y/N)
  109. <input type="radio" name="vartype" value="bstring" class='np'>
  110. 多行文本
  111. </td>
  112. </tr>
  113. <tr>
  114. <td width="90" height="26">变量名称</td>
  115. <td width="270"><input name="nvarname" type="text" id="nvarname" class="npvar" style="width:260px"></td>
  116. <td width="90">所属组</td>
  117. <td>
  118. <?php
  119. echo "<select name='vargroup' class='npvar' style='margin-right:10px;width:160px'>";
  120. foreach($ds as $dl){
  121. $dl = trim($dl);
  122. if(empty($dl)) continue;
  123. $dls = explode(',',$dl);
  124. echo "<option value='{$dls[0]}'>{$dls[1]}</option>";
  125. }
  126. echo "</select>";
  127. ?>
  128. <button type="submit" class="btn btn-success btn-sm">保存变量</button>
  129. </td>
  130. </tr>
  131. </table>
  132. </form>
  133. </td>
  134. </tr>
  135. </table>
  136. <table width="98%" cellpadding="0" cellspacing="0" align="center" class="table maintable mt-3 mb-3">
  137. <tr>
  138. <td height="26" align="right" background="../static/web/img/tbg.gif">
  139. <span style="line-height:26px">配置搜索:</span>
  140. <input type="text" name="keywds" id="keywds" 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" style="<?php if($n!=$gp) echo 'display:none'; ?>">
  163. <tr align="center" bgcolor="#F8FCF1">
  164. <td width="360" style="border-top:0">变量说明</td>
  165. <td style="border-top:0">变量值</td>
  166. <td width="260" style="border-top:0">变量名称</td>
  167. </tr>
  168. <?php
  169. $dsql->SetQuery("Select * From `#@__sysconfig` where groupid='{$dls[0]}' order by aid asc");
  170. $dsql->Execute();
  171. $i = 1;
  172. while($row = $dsql->GetArray())
  173. {
  174. if($i%2==0)
  175. {
  176. $bgcolor = "#f8f8f8";
  177. } else {
  178. $bgcolor = "#ffffff";
  179. }
  180. $i++;
  181. ?>
  182. <tr align="center" bgcolor="<?php echo $bgcolor?>">
  183. <td><?php echo $row['info']; ?></td>
  184. <td align="left">
  185. <?php
  186. if($row['type']=='bool')
  187. {
  188. $c1='';
  189. $c2 = '';
  190. $row['value']=='Y' ? $c1=" checked" : $c2=" checked";
  191. echo "<label><input type='radio' name='edit___{$row['varname']}' class='np' value='Y'$c1> 是 </label> ";
  192. echo "<label><input type='radio' name='edit___{$row['varname']}' class='np' value='N'$c2> 否 </label> ";
  193. } else if($row['type']=='bstring') {
  194. 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>";
  195. } else if($row['type']=='number') {
  196. echo "<input type='text' name='edit___{$row['varname']}' id='edit___{$row['varname']}' value='{$row['value']}' style='width:30%'>";
  197. } else {
  198. $addstr='';
  199. if ($row['varname']=='cfg_cookie_encode') {
  200. $addstr=' <a href="javascript:resetCookieEncode();" class="btn btn-success btn-sm">重新生成</a>';
  201. }
  202. echo "<input type='text' name='edit___{$row['varname']}' id='edit___{$row['varname']}' value=\"".dede_htmlspecialchars($row['value'])."\" style='width:80%'>{$addstr}";
  203. }
  204. ?>
  205. </td>
  206. <td><?php echo $row['varname']?></td>
  207. </tr>
  208. <?php
  209. }
  210. ?>
  211. </table>
  212. <?php
  213. }
  214. ?>
  215. </div>
  216. <table width="100%" cellspacing="1" cellpadding="1" bgcolor="#f8f8f8" class="table">
  217. <tr>
  218. <td align="center" class="py-3">
  219. <button type="submit" class="btn btn-success btn-sm">保存</button>
  220. <button type="button" onClick="document.form1.reset()" class="btn btn-success btn-sm">重置</button>
  221. </td>
  222. </tr>
  223. </table>
  224. </form>
  225. </td>
  226. </tr>
  227. </table>
  228. </div>
  229. </body>
  230. </html>