123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197 |
- <?php
- // by 请勿倒卖,已申请软著,否则追究法律责任
- namespace app\admin;
- class action extends Base
- {
- public function initialize()
- {
- parent::initialize();
- $this->Administrator(6);
- $this->header();
- }
- public function __destruct()
- {
- ?> <script>
- $('input[name=sort]').on('input', function () {
- var sort = $(this).val();
- if (sort != $(this).attr('data-sort'))
- $.ajax({
- url: '?c=ajax&a=action_sort',
- data: {id: $(this).attr('data-id'), sort: sort},
- type: 'post',
- success: function (ret) {
- console.log(ret)
- }
- });
- });
- </script>
- <?php
- $this->footer();
- }
- function index($map = [])
- {
- $_var_0 = db("action")->where("pid", "0")->order("sort")->select();
- $_var_1 = db("action")->where("pid", "0")->count();
- ?><div class="container"><?php
- $this->nav3();
- ?><table class="tb tb2">
- <tr><th class="partition">目录列表</th></tr>
- </table>
- <table class="tb tb2">
- <tr class="header">
- <th>ID</th>
- <th>名称</th>
- <th>描述</th>
- <th>排序</th>
- <th>状态</th>
- <th>编辑操作</th>
- </tr><?php
- if ($_var_1 == 0) {
- ?><tr><td colspan="2" class="td27">没有目录管理</td></tr><?php
- }
- function eachrow($_var_2, $_var_3 = '<b></b>')
- {
- ?><tr class="hover">
- <td class="td25"><?php echo $_var_2["id"];?></td>
- <td>
- <?php echo $_var_3;?><a href="?c=<?php echo $_var_2["c"];?>&a=<?php echo $_var_2["a"];?>" class="act"><?php echo $_var_2["name"];?></a>
- </td>
- <td><?php echo lightnum($_var_2["note"]);?></td>
- <td><input type="text" name="sort" data-id="<?php echo $_var_2["id"];?>" value="<?php echo $_var_2["sort"];?>" data-value="<?php echo $_var_2["sort"];?>" style="width: 30px;"/></td>
- <td>
- <a href="?c=action&a=change_status&id=<?php echo $_var_2["id"];?>&status=<?php echo $_var_2["status"] ? "0" : "1";?>&hash=<?php echo $_COOKIE["in_adminpassword"];?>">
- <img src="static/admincp/image/show_<?php echo $_var_2["status"] ? "yes" : "no";?>.gif" />
- </a>
- </td>
- <td><a href="?c=action&a=edit&pid=<?php echo $_var_2["id"];?>" class="act">新增子目录</a><?php
- if (!$_var_2["lock_on"]) {
- ?><a href="?c=action&a=edit&id=<?php echo $_var_2["id"];?>" class="act">编辑</a><a class="act" style="cursor:pointer" onclick="del_msg('?c=action&a=del&id=<?php echo $_var_2["id"];?>&hash=<?php echo $_COOKIE["in_adminpassword"];?>');">删除</a><?php
- }
- ?></td></tr><?php
- }
- if ($_var_0) {
- foreach ($_var_0 as $_var_4) {
- eachrow($_var_4);
- $_var_5 = db("action")->where("pid", $_var_4["id"])->order("sort")->select();
- foreach ($_var_5 as $_var_6) {
- eachrow($_var_6, "<b>┃━━━</b>");
- $_var_7 = db("action")->where("pid", $_var_6["id"])->order("sort")->select();
- foreach ($_var_7 as $_var_8) {
- eachrow($_var_8, "<b>┃━━━━━━</b>");
- }
- }
- }
- }
- ?></table></div><?php
- }
- function edit()
- {
- $_var_9 = SafeRequest("id", "get");
- $_var_10 = SafeRequest("pid", "get");
- $_var_11 = $_var_9 ? "编辑" : "新增";
- $_var_12 = db("action")->where("id", $_var_9)->find();
- ?><div class="container"><?php
- $this->nav3();
- ?><table class="tb tb2">
- <form action="?c=action&a=save" method="post" name="form">
- <input type="hidden" name="id" value="<?php echo $_var_9;?>"/>
- <input type="hidden" name="pid" value="<?php echo $_var_10 ? $_var_10 : $_var_12["pid"];?>"/>
- <input type="hidden" name="hash" value="<?php echo $_COOKIE["in_adminpassword"];?>" />
- <tr><th colspan="15" class="partition"><?php echo $_var_11;?>目录</th></tr>
- <tr><td colspan="2" class="td27">目录名称:</td></tr>
- <tr><td class="vtop rowform">
- <input type="text" class="txt" value="<?php echo $_var_12["name"];?>" name="name" id="name">
- </td>
- </tr>
- <tr><td colspan="2" class="td27">iframe:</td></tr>
- <tr><td class="vtop rowform">
- <input type="text" class="txt" name="c" id="c" value="<?php echo $_var_12["c"];?>">
- </td>
- </tr>
- <tr><td colspan="2" class="td27">action:</td></tr>
- <tr><td class="vtop rowform">
- <input type="text" class="txt" name="a" id="a" value="<?php echo $_var_12["a"];?>">
- </td>
- </tr>
- <tr><td colspan="2" class="td27">param:</td></tr>
- <tr><td class="vtop rowform">
- <input type="text" class="txt" name="p" id="p" value="<?php echo $_var_12["p"];?>">
- </td>
- </tr>
- <tr><td colspan="2" class="td27">描述:</td></tr>
- <tr><td class="vtop rowform">
- <textarea rows="6" name="note" class="tarea" id="note"><?php echo $_var_12["note"];?></textarea>
- </td>
- </tr>
- <tr><td colspan="15">
- <div class="fixsel">
- <input type="submit" class="btn" onclick="return CheckForm();" value="提交" />
- </div>
- </td></tr>
- </form>
- </table>
- </div>
- <?php
- }
- function del()
- {
- if (!submitcheck("hash", -1)) {
- $this->ShowMessage("链接来路不明,无法提交!", $_SERVER["PHP_SELF"], "infotitle3", 3000, 1);
- }
- $_var_13 = intval(SafeRequest("id", "get"));
- if (db("action")->where("pid", $_var_13)->count()) {
- $this->ShowMessage("抱歉,不允许删除非空目录!", "?c=action", "infotitle3", 3000, 1);
- }
- $_var_14 = db("action")->where("id", $_var_13)->delete();
- if ($_var_14) {
- $this->ShowMessage("恭喜您,目录管理删除成功!", "?c=action", "infotitle2", 3000, 1);
- }
- }
- function save()
- {
- if (!submitcheck("hash", 1)) {
- $this->ShowMessage("表单来路不明,无法提交!", $_SERVER["PHP_SELF"], "infotitle3", 3000, 1);
- }
- $_var_15 = intval(SafeRequest("id", "post"));
- $_var_16 = SafeRequest("name", "post");
- if (!$_var_16) {
- $this->ShowMessage("目录名称不能为空", $_SERVER["PHP_SELF"], "infotitle3", 3000, 1);
- }
- $_var_17 = SafeRequest("c", "post");
- if (!$_var_17) {
- $this->ShowMessage("iframe不能为空", $_SERVER["PHP_SELF"], "infotitle3", 3000, 1);
- }
- $_var_18 = SafeRequest("a", "post");
- $_var_18 = $_var_18 ? $_var_18 : "index";
- $_var_19 = SafeRequest("p", "post");
- $_var_20 = SafeRequest("pid", "post");
- $_var_21 = SafeRequest("note", "post");
- $_var_22 = ["name" => $_var_16, "c" => $_var_17, "a" => $_var_18, "p" => $_var_19, "pid" => $_var_20, "note" => $_var_21];
- if ($_var_15) {
- $_var_23 = db("action")->where("id", $_var_15)->update($_var_22);
- } else {
- if (db("action")->where("name", $_var_16)->where("c", $_var_17)->where("a", $_var_18)->where("p", $_var_19)->count()) {
- $this->ShowMessage("已存在相同的目录", $_SERVER["PHP_SELF"], "infotitle3", 3000, 1);
- }
- $_var_23 = db("action")->insert($_var_22);
- }
- $_var_23 && $this->ShowMessage("恭喜您,目录保存成功!", "?c=action", "infotitle2", 1000, 1);
- $this->ShowMessage("目录保存失败!请稍后重试!", $_SERVER["HTTP_REFERER"], "infotitle3", 3000, 1);
- }
- function change_status()
- {
- if (!submitcheck("hash", -1)) {
- $this->ShowMessage("链接来路不明,无法提交!", $_SERVER["PHP_SELF"], "infotitle3", 3000, 1);
- }
- $_var_24 = intval(SafeRequest("id", "get"));
- $_var_25 = intval(SafeRequest("status", "get"));
- $_var_26 = db("action")->where("id", $_var_24)->update(["status" => $_var_25]);
- if ($_var_26) {
- $this->ShowMessage("恭喜您,状态切换成功!", "?c=action", "infotitle2", 1000, 1);
- } else {
- $this->ShowMessage("恭喜您,状态切换成功!", "?c=action", "infotitle2", 1000, 1);
- }
- }
- }
|