From be9a3ba41fc1807124cc4af4a33f2f2f558fe41e Mon Sep 17 00:00:00 2001 From: zhaoke Date: Mon, 31 Jul 2023 15:03:44 +0800 Subject: [PATCH] * Fix error of 20 version. --- framework/base/router.class.php | 21 +++++++++++++++++++++ framework/router.class.php | 5 ++++- lib/zin/wg/tabpane/v1.php | 2 +- lib/zin/wg/tree/v1.php | 9 +++++++-- module/pipeline/model.php | 2 +- www/index.php | 1 + 6 files changed, 35 insertions(+), 5 deletions(-) diff --git a/framework/base/router.class.php b/framework/base/router.class.php index 362d5658e8..540a83f5e5 100644 --- a/framework/base/router.class.php +++ b/framework/base/router.class.php @@ -347,6 +347,14 @@ class baseRouter */ public $sessionID; + /** + * 请求开始时间。 + * The start time of the request. + * + * @var float + */ + public $startTime; + /** * 网站代号。 * The code of current site. @@ -444,6 +452,19 @@ class baseRouter return new $className($appName, $appRoot); } + /** + * 设置请求开始时间。 + * The start time of the request. + * + * @param float $startTime + * @access public + * @return void + */ + public function setStartTime(float $startTime) + { + $this->startTime = $startTime; + } + //-------------------- 路径相关方法(Path related methods)--------------------// /** diff --git a/framework/router.class.php b/framework/router.class.php index 41f2eaa016..d0ff1b3f67 100755 --- a/framework/router.class.php +++ b/framework/router.class.php @@ -375,6 +375,9 @@ class router extends baseRouter /* 先获得模块的主配置文件。Get the main config file for current module first. */ $mainConfigFile = $this->getModulePath($appName, $moduleName) . 'config.php'; + /* 获取 config 目录的配置文件。Get config files from config directory. */ + $configDirFiles = helper::ls($this->getModulePath($appName, $moduleName) . DS . 'config', '.php'); + /* 查找扩展配置文件。Get extension config files. */ if($config->framework->extensionLevel > 0) $extConfigPath = $this->getModuleExtPath($appName, $moduleName, 'config'); if($config->framework->extensionLevel >= 1) @@ -386,7 +389,7 @@ class router extends baseRouter if(!empty($extConfigPath['custom'])) $commonExtConfigFiles = array_merge($commonExtConfigFiles, helper::ls($extConfigPath['custom'], '.php')); } if($config->framework->extensionLevel == 2 and !empty($extConfigPath['site'])) $siteExtConfigFiles = helper::ls($extConfigPath['site'], '.php'); - $extConfigFiles = array_merge($commonExtConfigFiles, $siteExtConfigFiles); + $extConfigFiles = array_merge($commonExtConfigFiles, $configDirFiles, $siteExtConfigFiles); /* 将主配置文件和扩展配置文件合并在一起。Put the main config file and extension config files together. */ $configFiles = array_merge(array($mainConfigFile), $extConfigFiles); diff --git a/lib/zin/wg/tabpane/v1.php b/lib/zin/wg/tabpane/v1.php index bb1b0de2be..f721305406 100644 --- a/lib/zin/wg/tabpane/v1.php +++ b/lib/zin/wg/tabpane/v1.php @@ -8,7 +8,7 @@ class tabPane extends wg 'key: string', 'title: string', 'active?: bool=false', - 'param: string', + 'param?: string', ); protected static array $defineBlocks = array( diff --git a/lib/zin/wg/tree/v1.php b/lib/zin/wg/tree/v1.php index 5953f82650..921d950cb7 100644 --- a/lib/zin/wg/tree/v1.php +++ b/lib/zin/wg/tree/v1.php @@ -5,14 +5,15 @@ namespace zin; class tree extends wg { protected static array $defineProps = array( - 'type: string', 'items: array', + 'type?: string', 'id?: string', 'icon?: string', 'class?: string', 'canUpdateOrder?: bool=false', 'canEdit?: bool=false', 'canDelete?: bool=false', + 'canSplit?: bool=true', ); public static function getPageJS(): string|false @@ -31,11 +32,15 @@ class tree extends wg $canUpdateOrder = $this->prop('canUpdateOrder'); $canEdit = $this->prop('canEdit'); $canDelete = $this->prop('canDelete'); + $canSplit = $this->prop('canSplit'); $editType = $this->prop('type'); foreach($items as $key => $item) { $item = (array)$item; + $item['url'] = isset($item['url']) ? $item['url'] : ''; + $item['type'] = isset($item['type']) ? $item['type'] : ''; + $treeItem = array('text' => $item['name'], 'url' => $item['url'], 'id' => $item['id'], 'key' => $item['key']); if($item['type'] == 'product') { @@ -48,7 +53,7 @@ class tree extends wg if($canEdit) $treeItem['actions']['items'][] = array('key' => 'edit', 'icon' => 'edit', 'id' => $item['id'], 'editType' => $editType, 'onClick' => jsRaw('(event, item) => window.editItem(item)')); if($canDelete) $treeItem['actions']['items'][] = array('key' => 'delete', 'icon' => 'trash', 'id' => $item['id'], 'class' => 'btn ghost toolbar-item square size-sm rounded ajax-submit','url' => helper::createLink('tree', 'delete', 'module=' . $item['id'])); - $treeItem['actions']['items'][] = array('key' => 'view', 'icon' => 'split', 'url' => $item['url']); + if($canSplit) $treeItem['actions']['items'][] = array('key' => 'view', 'icon' => 'split', 'url' => $item['url']); } if(isset($item['children'])) $treeItem['items'] = $this->buildTree($item['children']); diff --git a/module/pipeline/model.php b/module/pipeline/model.php index 20bb674e4e..5db705518b 100644 --- a/module/pipeline/model.php +++ b/module/pipeline/model.php @@ -22,7 +22,7 @@ class pipelineModel extends model public function getByID($id) { $pipeline = $this->dao->select('*')->from(TABLE_PIPELINE)->where('id')->eq($id)->fetch(); - if($pipeline) + if(!empty($pipeline->password)) { $pipeline->password = base64_decode($pipeline->password); } diff --git a/www/index.php b/www/index.php index 6cb824d025..72b805298c 100644 --- a/www/index.php +++ b/www/index.php @@ -42,6 +42,7 @@ $config->installedVersion = $app->getInstalledVersion(); if($config->version != $config->installedVersion) die(header('location: upgrade.php')); /* Run the app. */ +$app->setStartTime($startTime); $common = $app->loadCommon(); /* Check the request is getconfig or not. */