diff --git a/data/config.ini b/data/config.ini index 18d7e4e8..4047eb09 100644 --- a/data/config.ini +++ b/data/config.ini @@ -8,9 +8,15 @@ logsPath = "./data/logs/{yyyy}-{mm}.log" mediaPath = "./public_html/media/" thumbnailsPath = "./public_html/thumbs/" avatarsPath = "./public_html/avatars/" -title = "szurubooru" salt = "1A2/$_4xVa" +[appearance] +title = "szurubooru" +;favicon = "/media/img/favicon.png" +;extraScripts[] = "/media/scripts/extra1.js" +;extraScripts[] = "/media/scripts/extra2.js" +;extraStyles[] = "/media/scripts/extra.css" + [misc] featuredPostMaxDays=7 debugQueries=0 diff --git a/src/Api/Jobs/PostJobs/GetPostContentJob.php b/src/Api/Jobs/PostJobs/GetPostContentJob.php index 532fad35..670e1e1d 100644 --- a/src/Api/Jobs/PostJobs/GetPostContentJob.php +++ b/src/Api/Jobs/PostJobs/GetPostContentJob.php @@ -20,7 +20,7 @@ class GetPostContentJob extends AbstractJob throw new SimpleException('Post file is not readable'); $fileName = sprintf('%s_%s_%s.%s', - $config->main->title, + $config->appearance->title, $post->getId(), join(',', array_map(function($tag) { return $tag->getName(); }, $post->getTags())), TextHelper::resolveMimeType($post->getMimeType()) ?: 'dat'); diff --git a/src/Controllers/AbstractController.php b/src/Controllers/AbstractController.php index 5c694491..dc926c86 100644 --- a/src/Controllers/AbstractController.php +++ b/src/Controllers/AbstractController.php @@ -14,7 +14,7 @@ class AbstractController $this->switchLayout('layout-normal'); $this->assets = new Assets(); - $this->assets->setTitle(Core::getConfig()->main->title); + $this->assets->setTitle(Core::getConfig()->appearance->title); } public function renderAjax() diff --git a/src/Helpers/Assets.php b/src/Helpers/Assets.php index 1ad80c0d..03540af6 100644 --- a/src/Helpers/Assets.php +++ b/src/Helpers/Assets.php @@ -16,12 +16,22 @@ class Assets extends \Chibi\Util\Assets public function addStylesheet($path) { - return parent::addStylesheet($this->decorateUrl('/media/css/' . $path)); + return $this->addStylesheetFullPath($this->decorateUrl('/media/css/' . $path)); + } + + public function addStylesheetFullPath($path) + { + return parent::addStylesheet($path); } public function addScript($path) { - return parent::addScript($this->decorateUrl('/media/js/' . $path)); + return $this->addScriptFullPath($this->decorateUrl('/media/js/' . $path)); + } + + public function addScriptFullPath($path) + { + return parent::addScript($path); } public function transformHtml($html) diff --git a/src/Views/layout-normal.phtml b/src/Views/layout-normal.phtml index 15c392fd..1fd52c0b 100644 --- a/src/Views/layout-normal.phtml +++ b/src/Views/layout-normal.phtml @@ -5,6 +5,12 @@ $this->assets->addScript('../lib/jquery/jquery.min.js'); $this->assets->addScript('../lib/jquery-ui/jquery-ui.min.js'); $this->assets->addScript('../lib/mousetrap/mousetrap.min.js'); $this->assets->addScript('core.js'); +if (!empty(Core::getConfig()->appearance->extraScripts)) + foreach (Core::getConfig()->appearance->extraScripts as $path) + $this->assets->addScriptFullPath($path); +if (!empty(Core::getConfig()->appearance->extraStylesheets)) + foreach (Core::getConfig()->appearance->extraStylesheets as $path) + $this->assets->addStylesheetFullPath($path); ?> @@ -12,6 +18,11 @@ $this->assets->addScript('core.js'); + appearance->favicon)): ?> + + diff --git a/src/Views/static/static-main.phtml b/src/Views/static/static-main.phtml index 52c7e33a..dd4d0c65 100644 --- a/src/Views/static/static-main.phtml +++ b/src/Views/static/static-main.phtml @@ -4,7 +4,7 @@ $this->assets->addStylesheet('static-main.css'); ?>
-

main->title ?>

+

appearance->title ?>