Преглед на файлове

优化安装脚本

优化JS
Karson преди 2 години
родител
ревизия
466aa4233f

+ 12 - 2
application/admin/command/Install.php

@@ -90,8 +90,11 @@ class Install extends Command
         $this->request = Request::instance();
 
         define('INSTALL_PATH', APP_PATH . 'admin' . DS . 'command' . DS . 'Install' . DS);
-        $langSet = strtolower($this->request->langset());
-        if (!$langSet || in_array($langSet, ['zh-cn', 'zh-hans-cn'])) {
+
+        $lang = $this->request->langset();
+        $lang = preg_match("/^([a-zA-Z\-_]{2,10})\$/i", $lang) ? $lang : 'zh-cn';
+
+        if (!$lang || in_array($lang, ['zh-cn', 'zh-hans-cn'])) {
             Lang::load(INSTALL_PATH . 'zh-cn.php');
         }
 
@@ -281,6 +284,13 @@ class Install extends Command
             throw new Exception(__('The current permissions are insufficient to write the file %s', 'application/admin/command/Install/install.lock'));
         }
 
+        try {
+            //删除安装脚本
+            @unlink(ROOT_PATH . 'public' . DS . 'install.php');
+        } catch (\Exception $e) {
+
+        }
+
         return $adminName;
     }
 

+ 3 - 1
application/tags.php

@@ -12,7 +12,9 @@
 // 应用行为扩展定义文件
 return [
     // 应用初始化
-    'app_init'     => [],
+    'app_init'     => [
+        'app\\common\\behavior\\Common',
+    ],
     // 应用开始
     'app_begin'    => [],
     // 应用调度

+ 2 - 2
public/assets/js/backend/addon.js

@@ -35,7 +35,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
                 }
             };
             table.on('load-success.bs.table', function (e, json) {
-                if (json && typeof json.category != 'undefined' && $(".nav-category li").size() == 2) {
+                if (json && typeof json.category != 'undefined' && $(".nav-category li").length == 2) {
                     $.each(json.category, function (i, j) {
                         $("<li><a href='javascript:;' data-id='" + j.id + "'>" + j.name + "</a></li>").insertBefore($(".nav-category li:last"));
                     });
@@ -238,7 +238,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'template'], function
             $(document).on("click", ".btn-addonindex", function () {
                 if ($(this).attr("href") == 'javascript:;') {
                     Layer.msg(__('Not installed tips'), {icon: 7});
-                } else if ($(this).closest(".operate").find("a.btn-enable").size() > 0) {
+                } else if ($(this).closest(".operate").find("a.btn-enable").length > 0) {
                     Layer.msg(__('Not enabled tips'), {icon: 7});
                     return false;
                 }

+ 1 - 1
public/assets/js/backend/auth/group.js

@@ -80,7 +80,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'jstree'], function (
         api: {
             bindevent: function () {
                 Form.api.bindevent($("form[role=form]"), null, null, function () {
-                    if ($("#treeview").size() > 0) {
+                    if ($("#treeview").length > 0) {
                         var r = $("#treeview").jstree("get_all_checked");
                         $("input[name='row[rules]']").val(r.join(','));
                     }

+ 1 - 1
public/assets/js/backend/general/config.js

@@ -63,7 +63,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 var value = $(this).val();
                 $(".tf").addClass("hidden");
                 $(".tf.tf-" + value).removeClass("hidden");
-                if (["selectpage", "selectpages"].indexOf(value) > -1 && $("#c-selectpage-table option").size() == 1) {
+                if (["selectpage", "selectpages"].indexOf(value) > -1 && $("#c-selectpage-table option").length == 1) {
                     //异步加载表列表
                     Fast.api.ajax({
                         url: "general/config/get_table_list",

+ 4 - 4
public/assets/js/backend/index.js

@@ -23,7 +23,7 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], functi
             $("form.sidebar-form").on("blur", "input[name=q]", function () {
                 searchResult.addClass("hide");
             }).on("focus", "input[name=q]", function () {
-                if ($("a", searchResult).size() > 0) {
+                if ($("a", searchResult).length > 0) {
                     searchResult.removeClass("hide");
                 }
             }).on("keyup", "input[name=q]", function () {
@@ -209,7 +209,7 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], functi
             //绑定tabs事件,如果需要点击强制刷新iframe,则请将iframeForceRefresh置为true,iframeForceRefreshTable只强制刷新表格
             nav.addtabs({iframeHeight: "100%", iframeForceRefresh: false, iframeForceRefreshTable: true, nav: nav});
 
-            if ($("ul.sidebar-menu li.active a").size() > 0) {
+            if ($("ul.sidebar-menu li.active a").length > 0) {
                 $("ul.sidebar-menu li.active a").trigger("click");
             } else {
                 if (multiplenav) {
@@ -223,10 +223,10 @@ define(['jquery', 'bootstrap', 'backend', 'addtabs', 'adminlte', 'form'], functi
             if (Config.referer) {
                 if (Config.referer === $(addtabs).attr("url")) {
                     var active = $("ul.sidebar-menu li a[addtabs=" + $(addtabs).attr("addtabs") + "]");
-                    if (multiplenav && active.size() == 0) {
+                    if (multiplenav && active.length == 0) {
                         active = $("ul li a[addtabs='" + $(addtabs).attr("addtabs") + "']");
                     }
-                    if (active.size() > 0) {
+                    if (active.length > 0) {
                         active.trigger("click");
                     } else {
                         $(addtabs).appendTo(document.body).addClass("hide").trigger("click");

+ 2 - 2
public/assets/js/backend/user/group.js

@@ -61,7 +61,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'jstree'], function (
         api: {
             bindevent: function () {
                 Form.api.bindevent($("form[role=form]"), null, null, function () {
-                    if ($("#treeview").size() > 0) {
+                    if ($("#treeview").length > 0) {
                         var r = $("#treeview").jstree("get_all_checked");
                         $("input[name='row[rules]']").val(r.join(','));
                     }
@@ -111,4 +111,4 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'jstree'], function (
         }
     };
     return Controller;
-});
+});

+ 1 - 1
public/assets/js/require-table.js

@@ -26,7 +26,7 @@ define(['jquery', 'bootstrap', 'moment', 'moment/locale/zh-cn', 'bootstrap-table
                 },
                 ignoreColumn: [0, 'operate'] //默认不导出第一列(checkbox)与操作(operate)列
             },
-            pageSize: localStorage.getItem('page-size') || 10,
+            pageSize: Config.pagesize || 10,
             pageList: [10, 15, 20, 25, 50, 'All'],
             pagination: true,
             clickToSelect: true, //是否启用点击选中