From 7f94fccda33383f3a7be364cf0c316e7ed2c61bb Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Sat, 22 Dec 2018 08:21:09 +0100 Subject: bug fix: font dir check and create --- app/class/controllerfont.php | 6 +++++- app/class/modelfont.php | 10 +++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/class/controllerfont.php b/app/class/controllerfont.php index 7a59cd6..8f87e3a 100644 --- a/app/class/controllerfont.php +++ b/app/class/controllerfont.php @@ -2,7 +2,9 @@ class Controllerfont extends Controller { - + /** + * @var Modelfont + */ protected $fontmanager; public function __construct($router) @@ -16,6 +18,8 @@ class Controllerfont extends Controller { if($this->user->iseditor()) { + $this->fontmanager->fontdircheck(); + $fontlist = $this->fontmanager->getfontlist(); $this->showtemplate('font', ['fontlist' => $fontlist, 'fonttypes' => $this->fontmanager->getfonttypes(), 'fontfile' => Model::globalpath().'fonts.css']); diff --git a/app/class/modelfont.php b/app/class/modelfont.php index 213da11..8e7645e 100644 --- a/app/class/modelfont.php +++ b/app/class/modelfont.php @@ -4,7 +4,15 @@ class Modelfont extends Model { const FONT_TYPES = ['woff2', 'woff', 'otf', 'ttf', 'eot', 'svg']; - + + public function fontdircheck() + { + if(!is_dir(Model::FONT_DIR)) { + return mkdir(Model::FONT_DIR); + } else { + return true; + } + } public function getfontlist() { -- cgit v1.2.3