diff --git a/themes/manual/controller/SiteController.php b/themes/manual/controller/SiteController.php index 33be12d..1492e1a 100644 --- a/themes/manual/controller/SiteController.php +++ b/themes/manual/controller/SiteController.php @@ -12,12 +12,14 @@ Class SiteController extends Controller { $titles = array(); $content = ''; $html = ''; + $author = ''; + $publishTime = $updateTime = 0; $scanner = new DirScanner(); $scanner->setWebRoot(FSC::$app['config']['content_directory']); $dirTree = $scanner->scan(__DIR__ . '/../../../www/' . FSC::$app['config']['content_directory'], 4); $readmeFile = $scanner->getDefaultReadme(); - + if (!empty($readmeFile)) { $titles = $scanner->getMDTitles($readmeFile['id']); $content = file_get_contents($readmeFile['realpath']); @@ -25,11 +27,17 @@ Class SiteController extends Controller { $Parsedown = new Parsedown(); $html = $Parsedown->text($content); $html = $scanner->fixMDUrls($readmeFile['realpath'], $html); + + $publishTime = min($readmeFile['fstat']['ctime'], $readmeFile['fstat']['atime']); + $updateTime = $readmeFile['fstat']['mtime']; + if (!empty($readmeFile['author'])) { + $author = $readmeFile['author']; + } } $pageTitle = !empty($titles) ? $titles[0]['name'] : "FileSite.io - 无数据库、基于文件和目录的Markdown文档、网址导航、图书、图片、视频网站PHP开源系统"; $viewName = 'index'; - $params = compact('titles', 'content', 'html'); + $params = compact('titles', 'content', 'html', 'author', 'publishTime', 'updateTime'); return $this->render($viewName, $params, $pageTitle); } diff --git a/themes/manual/controller/ViewController.php b/themes/manual/controller/ViewController.php index 93282a8..93bf382 100644 --- a/themes/manual/controller/ViewController.php +++ b/themes/manual/controller/ViewController.php @@ -8,7 +8,6 @@ require_once __DIR__ . '/../../../plugins/Parsedown.php'; Class ViewController extends Controller { public function actionIndex() { - $fileId = $this->get('id', ''); if (!empty($fileId)) { $fileId = preg_replace('/\W/', '', $fileId); @@ -18,6 +17,8 @@ Class ViewController extends Controller { $titles = array(); $content = ''; $html = ''; + $author = ''; + $publishTime = $updateTime = 0; $scanner = new DirScanner(); $scanner->setWebRoot(FSC::$app['config']['content_directory']); @@ -32,13 +33,19 @@ Class ViewController extends Controller { $Parsedown = new Parsedown(); $html = $Parsedown->text($content); $html = $scanner->fixMDUrls($readmeFile['realpath'], $html); + + $publishTime = min($readmeFile['fstat']['ctime'], $readmeFile['fstat']['atime']); + $updateTime = $readmeFile['fstat']['mtime']; + if (!empty($readmeFile['author'])) { + $author = $readmeFile['author']; + } }else { throw new Exception("404 - 文件编号 {$fileId} 找不到", 404); } $pageTitle = !empty($titles) ? $titles[0]['name'] : "No title, 无标题"; $viewName = 'index'; - $params = compact('titles', 'content', 'html'); + $params = compact('titles', 'content', 'html', 'author', 'publishTime', 'updateTime'); return $this->render($viewName, $params, $pageTitle); } diff --git a/themes/manual/views/site/index.php b/themes/manual/views/site/index.php index c3280ee..9e77dd2 100644 --- a/themes/manual/views/site/index.php +++ b/themes/manual/views/site/index.php @@ -1,16 +1,28 @@
{$title['name']} + foreach($viewData['titles'] as $title) { + $link = urlencode($title['name']); + echo <<{$title['name']} eof; - } + } } ?> +
+ {$viewData['author']} +
+eof; + } + ?> + 发布: +
修改: +
- +
\ No newline at end of file diff --git a/themes/manual/views/view/index.php b/themes/manual/views/view/index.php index e43aa00..b9132d0 100644 --- a/themes/manual/views/view/index.php +++ b/themes/manual/views/view/index.php @@ -1,17 +1,29 @@
-

<<返回

+

<<返回

{$title['name']} + foreach($viewData['titles'] as $title) { + $link = urlencode($title['name']); + echo <<{$title['name']} eof; - } + } } ?> +
+ {$viewData['author']} +
+eof; + } + ?> + 发布: +
修改: +
- +
\ No newline at end of file diff --git a/www/content/README_author.txt b/www/content/README_author.txt new file mode 100644 index 0000000..75719b1 --- /dev/null +++ b/www/content/README_author.txt @@ -0,0 +1 @@ +FileSite.io diff --git a/www/css/manual.css b/www/css/manual.css index 75bd1cc..632ecb4 100644 --- a/www/css/manual.css +++ b/www/css/manual.css @@ -15,6 +15,7 @@ .indexes h5{font-size:0.9em} .indexes h6{font-size:0.8em} .indexes a{background-color:transparent;color:#0969da;text-decoration:none} +.author{margin-top:1em;padding:.5em;border:1px solid #EEE} @media (max-width: 640px) { .header{position: static} .indexes{position:static;width:auto;padding-bottom:0.5em;margin-bottom:0.5em;margin-top: 0}