|
|
@ -72,18 +72,39 @@ Class MyController extends SiteController { |
|
|
|
return $this->redirect($shareUrl); |
|
|
|
return $this->redirect($shareUrl); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$htmlReadme = ''; //Readme.md 内容,底部网站详细介绍 |
|
|
|
|
|
|
|
$menus_sorted = array(); //Readme_sort.txt 说明文件内容,一级目录菜单从上到下的排序 |
|
|
|
|
|
|
|
|
|
|
|
$scanner = new DirScanner(); |
|
|
|
$scanner = new DirScanner(); |
|
|
|
$scanner->setWebRoot(FSC::$app['config']['content_directory']); |
|
|
|
$scanner->setWebRoot(FSC::$app['config']['content_directory']); |
|
|
|
$dirTree = $scanner->scan(__DIR__ . '/../../../www/' . FSC::$app['config']['content_directory'], 4); |
|
|
|
$dirTree = $scanner->scan(__DIR__ . '/../../../www/' . FSC::$app['config']['content_directory'], 4); |
|
|
|
|
|
|
|
|
|
|
|
$readmeFile = $scanner->getDefaultReadme(); |
|
|
|
$readmeFile = $scanner->getDefaultReadme(); |
|
|
|
|
|
|
|
if (!empty($readmeFile)) { |
|
|
|
|
|
|
|
if (!empty($readmeFile['sort'])) { |
|
|
|
|
|
|
|
$menus_sorted = explode("\n", $readmeFile['sort']); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$Parsedown = new Parsedown(); |
|
|
|
|
|
|
|
$content = file_get_contents($readmeFile['realpath']); |
|
|
|
|
|
|
|
$htmlReadme = $Parsedown->text($content); |
|
|
|
|
|
|
|
$htmlReadme = $scanner->fixMDUrls($readmeFile['realpath'], $htmlReadme); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取tags分类 |
|
|
|
|
|
|
|
$tags = $this->getTags($dirTree); |
|
|
|
|
|
|
|
//排序 |
|
|
|
|
|
|
|
if (!empty($menus_sorted) && !empty($tags)) { |
|
|
|
|
|
|
|
$tags = $this->sortTags($menus_sorted, $tags); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$nickname = $this->getNickname($readmeFile); |
|
|
|
$nickname = $this->getNickname($readmeFile); |
|
|
|
|
|
|
|
|
|
|
|
$pageTitle = "修改昵称 | " . FSC::$app['config']['site_name']; |
|
|
|
$pageTitle = "修改昵称 | " . FSC::$app['config']['site_name']; |
|
|
|
|
|
|
|
|
|
|
|
$this->layout = 'index'; |
|
|
|
|
|
|
|
$viewName = 'setnickname'; |
|
|
|
$viewName = 'setnickname'; |
|
|
|
$params = compact( |
|
|
|
$params = compact( |
|
|
|
'pageTitle', 'nickname' |
|
|
|
'htmlReadme', 'tags', 'pageTitle', 'nickname' |
|
|
|
); |
|
|
|
); |
|
|
|
return $this->render($viewName, $params, $pageTitle); |
|
|
|
return $this->render($viewName, $params, $pageTitle); |
|
|
|
} |
|
|
|
} |
|
|
|