Source code of filesite.io.
https://filesite.io
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.2 KiB
40 lines
1.2 KiB
<?php |
|
/** |
|
* List Controller |
|
*/ |
|
require_once __DIR__ . '/../../../lib/DirScanner.php'; |
|
require_once __DIR__ . '/../../../plugins/Parsedown.php'; |
|
require_once __DIR__ . '/SiteController.php'; |
|
|
|
Class ApiController extends SiteController { |
|
|
|
public function actionIndex() { |
|
$code = 0; |
|
$err = 'Not allowed'; |
|
|
|
return $this->renderJson(compact('code', 'err')); |
|
} |
|
|
|
public function actionTags() { |
|
//获取数据 |
|
$menus = array(); //菜单,一级目录 |
|
$htmlReadme = ''; //Readme.md 内容,底部网站详细介绍 |
|
$htmlCateReadme = ''; //当前目录下的Readme.md 内容 |
|
$menus_sorted = array(); //Readme_sort.txt 说明文件内容,一级目录菜单从上到下的排序 |
|
|
|
$scanner = new DirScanner(); |
|
$scanner->setWebRoot(FSC::$app['config']['content_directory']); |
|
$dirTree = $scanner->scan(__DIR__ . '/../../../www/' . FSC::$app['config']['content_directory'], 3); |
|
|
|
$code = 1; |
|
$msg = ''; |
|
$err = ''; |
|
|
|
//获取tags分类 |
|
$noFiles = true; |
|
$data = $this->getTags($dirTree, $noFiles); |
|
|
|
return $this->renderJson(compact('code', 'msg', 'err', 'data')); |
|
} |
|
|
|
}
|
|
|