Browse Source

bug fix: wrong timezone id

master
filesite 3 years ago
parent
commit
7fe2aa13f6
  1. 2
      conf/app.php
  2. 5
      themes/pagedirectory/controller/SiteController.php
  3. 2
      www/index.php

2
conf/app.php

@ -3,7 +3,7 @@ @@ -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/

5
themes/pagedirectory/controller/SiteController.php

@ -44,6 +44,7 @@ Class SiteController extends Controller { @@ -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 { @@ -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 { @@ -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;
}

2
www/index.php

@ -2,7 +2,7 @@ @@ -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;

Loading…
Cancel
Save