From 7fe2aa13f687491cf439ed5fd9dbcf0b39659e9f Mon Sep 17 00:00:00 2001 From: filesite Date: Fri, 20 May 2022 23:41:38 +0800 Subject: [PATCH] bug fix: wrong timezone id --- conf/app.php | 2 +- themes/pagedirectory/controller/SiteController.php | 5 +++-- www/index.php | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/conf/app.php b/conf/app.php index 3a2fe52..c00214b 100644 --- a/conf/app.php +++ b/conf/app.php @@ -3,7 +3,7 @@ * Config */ return array( - 'default_timezone' => 'Asia/HonKong', //timezone + 'default_timezone' => 'Asia/Shanghai', //timezone //文档站皮肤 //'content_directory' => 'content/', //directory of contents in /www/ diff --git a/themes/pagedirectory/controller/SiteController.php b/themes/pagedirectory/controller/SiteController.php index 126c9ec..098337d 100644 --- a/themes/pagedirectory/controller/SiteController.php +++ b/themes/pagedirectory/controller/SiteController.php @@ -44,6 +44,7 @@ Class SiteController extends Controller { //排序 if (!empty($menus_sorted) && !empty($menus)) { + //一级目录菜单排序 $menu_dirs = array_column($menus, 'directory'); $names = array_replace(array_flip($menus_sorted), array_flip($menu_dirs)); if (!empty($names)) { @@ -57,7 +58,7 @@ Class SiteController extends Controller { $menus = $arr; } - //dirTree排序 + //dirTree一级目录排序 $sorted_dirs = array_column($menus, 'directory'); $tree_dirs = array_column($dirTree, 'directory'); $names = array_replace(array_flip($sorted_dirs), array_flip($tree_dirs)); @@ -67,7 +68,7 @@ Class SiteController extends Controller { $arr = []; foreach($sorted_dirs as $name) { foreach($dirTree as $index => $item) { - if ($item['directory'] == $name) { + if (!empty($item['directory']) && $item['directory'] == $name) { array_push($arr, $item); break; } diff --git a/www/index.php b/www/index.php index a3b845a..1fddbb2 100644 --- a/www/index.php +++ b/www/index.php @@ -2,7 +2,7 @@ /* All php controller enter from here */ $start_time = microtime(true); //for time cost $config = require_once __DIR__ . '/../conf/app.php'; -$default_timezone = !empty($config['default_timezone']) ? $config['default_timezone'] : 'Asia/HongKong'; +$default_timezone = !empty($config['default_timezone']) ? $config['default_timezone'] : 'Hongkong'; date_default_timezone_set($default_timezone); $config['start_time'] = $start_time;