|
|
@ -8,6 +8,8 @@ require_once __DIR__ . '/../../../plugins/Common.php'; |
|
|
|
require_once __DIR__ . '/../../../plugins/Html.php'; |
|
|
|
require_once __DIR__ . '/../../../plugins/Html.php'; |
|
|
|
|
|
|
|
|
|
|
|
Class ListController extends Controller { |
|
|
|
Class ListController extends Controller { |
|
|
|
|
|
|
|
protected $dateIndexCacheKey = 'MainBotDateIndex'; |
|
|
|
|
|
|
|
protected $noOriginalCtimeFilesCacheKey = 'MainBotNoOriginalCtimeFiles'; |
|
|
|
|
|
|
|
|
|
|
|
public function actionIndex() { |
|
|
|
public function actionIndex() { |
|
|
|
$cateId = $this->get('id', ''); |
|
|
|
$cateId = $this->get('id', ''); |
|
|
@ -140,7 +142,7 @@ Class ListController extends Controller { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//图片、视频类型筛选支持 |
|
|
|
//图片、视频类型筛选支持 |
|
|
|
$allFiles = $scanResults[$cateId]['files']; |
|
|
|
$allFiles = !empty($scanResults[$cateId]['files']) ? $scanResults[$cateId]['files'] : []; |
|
|
|
$showType = $this->get('show', 'all'); |
|
|
|
$showType = $this->get('show', 'all'); |
|
|
|
if ($showType == 'image' && !empty($scanResults[$cateId]['files'])) { |
|
|
|
if ($showType == 'image' && !empty($scanResults[$cateId]['files'])) { |
|
|
|
$scanResults[$cateId]['files'] = array_filter($scanResults[$cateId]['files'], function($item) { |
|
|
|
$scanResults[$cateId]['files'] = array_filter($scanResults[$cateId]['files'], function($item) { |
|
|
@ -300,10 +302,14 @@ Class ListController extends Controller { |
|
|
|
|
|
|
|
|
|
|
|
$isAdminIp = Common::isAdminIp($this->getUserIp()); //判断是否拥有管理权限 |
|
|
|
$isAdminIp = Common::isAdminIp($this->getUserIp()); //判断是否拥有管理权限 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//从缓存文件获取按年份、月份归类的索引数据 |
|
|
|
|
|
|
|
$cacheDataByDate = Common::getCacheFromFile($this->dateIndexCacheKey, 86400*365); |
|
|
|
|
|
|
|
|
|
|
|
$viewName = '//site/index'; //共享视图 |
|
|
|
$viewName = '//site/index'; //共享视图 |
|
|
|
$params = compact( |
|
|
|
$params = compact( |
|
|
|
'cateId', 'dirTree', 'scanResults', 'menus', 'htmlReadme', 'breadcrumbs', 'htmlCateReadme', |
|
|
|
'cateId', 'dirTree', 'scanResults', 'menus', 'htmlReadme', 'breadcrumbs', 'htmlCateReadme', |
|
|
|
'mp3File', 'page', 'pageSize', 'cacheDataId', 'copyright', 'showType', 'isAdminIp', 'allFiles' |
|
|
|
'mp3File', 'page', 'pageSize', 'cacheDataId', 'copyright', 'showType', 'isAdminIp', 'allFiles', |
|
|
|
|
|
|
|
'cacheDataByDate' |
|
|
|
); |
|
|
|
); |
|
|
|
return $this->render($viewName, $params, $pageTitle); |
|
|
|
return $this->render($viewName, $params, $pageTitle); |
|
|
|
} |
|
|
|
} |
|
|
@ -345,7 +351,7 @@ Class ListController extends Controller { |
|
|
|
//缓存key统一生成,方便按规则获取上一级目录的缓存cid |
|
|
|
//缓存key统一生成,方便按规则获取上一级目录的缓存cid |
|
|
|
protected function getBreadcrumbs($currentDir, $scanResults, $scanner) { |
|
|
|
protected function getBreadcrumbs($currentDir, $scanResults, $scanner) { |
|
|
|
$webroot = FSC::$app['config']['content_directory']; |
|
|
|
$webroot = FSC::$app['config']['content_directory']; |
|
|
|
$arr = explode($webroot, $currentDir['realpath']); |
|
|
|
$arr = !empty($currentDir['realpath']) ? explode($webroot, $currentDir['realpath']) : []; |
|
|
|
$breads = array(); |
|
|
|
$breads = array(); |
|
|
|
|
|
|
|
|
|
|
|
if (count($arr) < 2) { |
|
|
|
if (count($arr) < 2) { |
|
|
|