123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180 |
- <?php
- namespace app\admin;
- class config_sign extends Base
- {
- public function initialize()
- {
- parent::initialize();
- $this->Administrator(2);
- $this->header();
- }
- public function __destruct()
- {
- ?> <script>
- function setImageVal(id, val) {
- $('#' + id).val(val);
- $('#' + id + 'img').attr('src', val + "?" + (new Date().getTime())).show();
- $('input[data-name="' + id + '"]').val('删除');
- $('.layui-layer-iframe').remove();
- }
- function upload_image(name) {
- pop.up('no', '上传图标', '/upload/admin/open_icon?id=' + name, '406px', '180px', '175px');
- }
- $('.rssbutton input[type="button"]').click(function () {
- var name = $(this).attr('data-name');
- if ($(this).val() === '上传') {
- upload_image(name)
- } else {
- $('input[name="' + name + '"]').val('');
- $('#' + name + 'img').hide();
- $(this).val('上传');
- }
- });
- $(".list_add_btn").click(function () {
- var name = $(this).attr("data-name");
- $(this).before('<div><input type="text" name="' + name + '[]"> [] </div>');
- });
- </script>
- <?php
- $this->footer();
- }
- function index()
- {
- ?> <script>
- layui.use('layer', function () {
- layer = layui.layer;
- in_sign_worker('status');
- });
- function in_sign_worker(action, update) {
- $.post("?c=worker&a=" + action, function (ret) {
- if (action == 'logs') {
- if (update) {
- $("#worker_logs").html(ret.msg);
- } else {
- layer.open({
- type: 1,
- skin: 'layui-layer-rim', //加上边框
- area: ['800px', '600px'], //宽高
- content: '<div id="worker_logs" style="padding: 5px;">' + ret.msg + '</div>'
- });
- }
- } else {
- if (ret.msg) layer.msg(ret.msg);
- $('#IN_SIGN_WORKER').text(ret.code == 1 ? '启动' : '停止');
- }
- }, 'json');
- }
- // var si = setInterval(function () {
- // in_sign_worker('logs', true);
- // }, 1000);
- </script>
- <?php
- $_var_0 = $this->action != "index" ? $this->action : "system";
- $_var_1 = db("config")->where("category", $_var_0)->where("status", "1");
- $_var_2 = $_var_1->group("group")->field("group")->select()->toArray();
- $_var_2 = array_column($_var_2, "group");
- ?><form method="post" action="?c=config_setting&a=save">
- <input type="hidden" name="hash" value="<?php echo $_COOKIE["in_adminpassword"];?>" />
- <div class="container"><?php
- $this->nav3();
- ?><table class="tb tb2"><?php
- foreach ($_var_2 as $_var_3) {
- ?><tr><th colspan="15" class="partition"><?php echo $_var_3;?></th></tr><?php
- $_var_4 = db("config")->where("category", $_var_0)->where("group", $_var_3)->where("status", "1")->order("category,sort,name")->select();
- foreach ($_var_4 as $_var_5 => $_var_6) {
- $_var_7 = json_decode($_var_6["content"], true);
- $_var_8 = strtoupper($_var_6["name"]);
- ?><tr><td colspan="2" class="td27"><?php echo $_var_6["title"] ? $_var_6["title"] : $_var_8;?>:</td></tr><tr><td class="vtop rowform"><?php
- if ($_var_6["type"] == "checkbox") {
- $_var_6["value"] = json_decode($_var_6["value"], true);
- foreach ($_var_7 as $_var_9 => $_var_10) {
- $_var_11 = in_array($_var_9, $_var_6["value"]) ? " checked " : "";
- $_var_12 = $_var_9 == 0 ? "hidden" : $_var_6["type"];
- ?><label class="<?php echo $_var_11;?>"><input class="<?php echo $_var_12;?>" type="<?php echo $_var_12;?>" name="<?php echo $_var_8;?>[]" value="<?php echo $_var_9;?>" <?php echo $_var_11;?>> <?php echo $_var_9 == 0 ? "" : $_var_10;?></label><?php
- }
- } elseif ($_var_6["type"] == "button_group") {
- ?><div style='line-height: 30px'>当前状态:<span id='<?php echo $_var_8;?>'></span></div><?php
- foreach ($_var_7 as $_var_9 => $_var_10) {
- $_var_11 = $_var_6["value"] == $_var_9 ? " checked " : "";
- ?><input class="{$checked} btn" type="button" value="<?php echo $_var_10;?>" <?php echo $_var_11;?> onclick="<?php echo strtolower($_var_8);?>('<?php echo $_var_9;?>')" title="<?php echo $_var_10;?>" style="margin-right:5px;"><?php
- }
- } elseif ($_var_6["type"] == "json") {
- $_var_6["value"] = json_decode($_var_6["value"], true);
- foreach ($_var_6["value"] as $_var_9 => $_var_10) {
- ?><div><input type="<?php echo $_var_6["type"];?>" name="<?php echo $_var_8;?>[<?php echo $_var_9;?>]" value="<?php echo $_var_10;?>" > [<?php echo $_var_9;?>]</div><?php
- }
- } elseif ($_var_6["type"] == "list") {
- $_var_6["value"] = json_decode($_var_6["value"], true);
- $_var_13 = json_decode($_var_6["note"], true);
- foreach ($_var_6["value"] as $_var_9 => $_var_10) {
- ?><div><input type="<?php echo $_var_6["type"];?>" name="<?php echo $_var_8;?>[]" value="<?php echo $_var_10;?>" > [<?php echo is_array($_var_13) && isset($_var_13[$_var_9]) ? $_var_13[$_var_9] : $_var_9;?>] </div><?php
- }
- } elseif ($_var_6["type"] == "number") {
- ?><input class="txt" type="<?php echo $_var_6["type"];?>" name="<?php echo $_var_8;?>" value="<?php echo $_var_6["value"];?>" min="<?php echo $_var_7[0];?>" max="<?php echo $_var_7[1];?>"/><?php
- } elseif ($_var_6["type"] == "radio") {
- foreach ($_var_7 as $_var_9 => $_var_10) {
- $_var_11 = $_var_6["value"] == $_var_9 ? " checked " : "";
- ?><label class="<?php echo $_var_11;?>"><input class="<?php echo $_var_6["type"];?>" type="<?php echo $_var_6["type"];?>" name="<?php echo $_var_8;?>" value="<?php echo $_var_9;?>" <?php echo $_var_11;?>> <?php echo $_var_10;?></label><?php
- }
- } elseif ($_var_6["type"] == "select") {
- ?><select name="<?php echo $_var_6["name"];?>"><?php
- foreach ($_var_7 as $_var_9 => $_var_10) {
- $_var_14 = $_var_6["value"] == $_var_9 ? " selected " : "";
- ?><option value="<?php echo $_var_9;?>" <?php echo $_var_14;?>><?php echo $_var_10;?></option><?php
- }
- ?></select><?php
- } elseif ($_var_6["type"] == "textarea") {
- ?><textarea rows="6" name="<?php echo $_var_6["name"];?>" cols="50" class="tarea"><?php echo $_var_6["value"];?></textarea><?php
- } elseif ($_var_6["type"] == "image") {
- ?><input name="<?php echo $_var_6["name"];?>" type="hidden" class="txt" value="<?php echo $_var_6["value"];?>" id="<?php echo $_var_6["name"];?>">
- <div>
- <div class="rssbutton">
- <img id="<?php echo $_var_6["name"];?>img" src="/<?php echo $_var_6["value"];?>?<?php echo time();?>" width="90" height="90" alt="" <?php echo $_var_6["value"] ? "" : "style=\"display: none\"";?>/>
- </div>
- <div class="rssbutton">
- <input type="button" value="<?php echo $_var_6["value"] ? "删除" : "上传";?>" data-name="<?php echo $_var_6["name"];?>" style="line-height: 12px">
- </div>
- </div><?php
- } else {
- ?><input class="txt" type="<?php echo $_var_6["type"];?>" name="<?php echo $_var_8;?>" value="<?php echo $_var_6["value"];?>" /><?php
- }
- ?></td><td class="vtop tips2 <?php echo $_var_6["require"] ? "lightnum" : "";?>"><?php echo $_var_6["note"];?></td></tr><?php
- }
- }
- ?> <tr><td colspan="15"><div class="fixsel"><input type="submit" class="btn" value="提交" /></div></td></tr></table >
- </div >
- </form ><?php
- }
- function save()
- {
- if (!submitcheck("hash", 1)) {
- $this->ShowMessage("表单来路不明,无法提交!", $_SERVER["PHP_SELF"], "infotitle3", 3000, 1);
- }
- foreach ($_POST as $_var_15 => $_var_16) {
- if (is_array($_var_16)) {
- $_var_16 = json_encode($_var_16);
- }
- db("config")->where("name", $_var_15)->update(["value" => $_var_16]);
- }
- $_var_17 = db("config")->select();
- $_var_18 = ["<?php"];
- foreach ($_var_17 as $_var_15 => $_var_16) {
- if ($_var_16["name"] == "IN_STAT") {
- $_var_16["value"] = base64_encode($_var_16["value"]);
- }
- $_var_18[] = "define('" . $_var_16["name"] . "','" . $_var_16["value"] . "');";
- }
- $_var_19 = IN_ROOT . "source/system/my.php";
- file_put_contents($_var_19, implode("\n", $_var_18));
- $this->ShowMessage("恭喜您,设置保存成功!", $_SERVER["HTTP_REFERER"], "infotitle2", 1000, 1);
- }
- }
|