From ef18c5f848a5e4d1239bdc1d89e0cc9f75a10512 Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Thu, 8 Aug 2019 23:02:03 +0200 Subject: feature : terminal style option + bug fix : externallinkblank missing underscore --- app/class/config.php | 14 +++++++++++ app/class/controlleradmin.php | 6 ++++- app/class/controllerart.php | 11 +++++++-- app/class/modelmedia.php | 13 ++++++++++ app/class/modelrender.php | 4 +-- app/view/templates/admin.php | 57 +++++++++++++++++++++++++++++++++++-------- app/view/templates/home.php | 3 +++ app/view/templates/layout.php | 14 ++++++++--- 8 files changed, 103 insertions(+), 19 deletions(-) (limited to 'app') diff --git a/app/class/config.php b/app/class/config.php index dbc6d80..dfeb4d7 100644 --- a/app/class/config.php +++ b/app/class/config.php @@ -23,6 +23,7 @@ abstract class Config protected static $defaultprivacy = 0; protected static $homepage = 'default'; protected static $homeredirect = null; + protected static $interfacecss = null; // _______________________________________ F U N _______________________________________ @@ -199,6 +200,10 @@ abstract class Config return self::$homeredirect; } + public static function interfacecss() + { + return self::$interfacecss; + } // __________________________________________ S E T ______________________________________ @@ -332,6 +337,15 @@ abstract class Config self::$homeredirect = null; } } + + public static function setinterfacecss($interfacecss) + { + if(is_string($interfacecss) && file_exists(Model::CSS_DIR . $interfacecss)) { + self::$interfacecss = $interfacecss; + } else { + self::$interfacecss = null; + } + } diff --git a/app/class/controlleradmin.php b/app/class/controlleradmin.php index 03fcb22..2101414 100644 --- a/app/class/controlleradmin.php +++ b/app/class/controlleradmin.php @@ -3,7 +3,10 @@ class Controlleradmin extends Controller { + /** @var Modelart $artmanager */ protected $artmanager; + + /** @var Modelmedia $mediamanager */ protected $mediamanager; public function desktop() @@ -13,6 +16,7 @@ class Controlleradmin extends Controller $artlist = $this->artmanager->list(); $this->mediamanager = new Modelmedia(); $faviconlist = $this->mediamanager->listfavicon(); + $interfacecsslist = $this->mediamanager->listinterfacecss(); if(in_array(Config::defaultart(), $artlist)) { $defaultartexist = true; } else { @@ -27,7 +31,7 @@ class Controlleradmin extends Controller $globalcss = ""; } - $admin = ['artlist' => $artlist, 'defaultartexist' => $defaultartexist, 'globalcss' => $globalcss, 'faviconlist' => $faviconlist]; + $admin = ['artlist' => $artlist, 'defaultartexist' => $defaultartexist, 'globalcss' => $globalcss, 'faviconlist' => $faviconlist, 'interfacecsslist' => $interfacecsslist]; $this->showtemplate('admin', $admin); } else { $this->routedirect('home'); diff --git a/app/class/controllerart.php b/app/class/controllerart.php index f8155ea..027fc19 100644 --- a/app/class/controllerart.php +++ b/app/class/controllerart.php @@ -248,14 +248,21 @@ class Controllerart extends Controller { $art = $this->artmanager->getfromfile(); + if(!empty($_POST['id'])) { $art->setid(idclean($_POST['id'])); } - + if($_POST['datecreation']) { $art->setdatecreation($this->now); } - + + if($_POST['author']) { + $art->setauthors([$this->user->id()]); + } + + $art->setdaterender($art->datecreation('date')); + if($art !== false) { if($_POST['erase'] || $this->artmanager->get($art) === false) { $this->artmanager->add($art); diff --git a/app/class/modelmedia.php b/app/class/modelmedia.php index a30e902..209fc85 100644 --- a/app/class/modelmedia.php +++ b/app/class/modelmedia.php @@ -143,6 +143,19 @@ class Modelmedia extends Model } + public function listinterfacecss() + { + $glob = Model::CSS_DIR . '*.css'; + $listinterfacecss = glob($glob); + $count = strlen(Model::CSS_DIR); + $listinterfacecss = array_map(function ($input) use ($count) { + return substr($input, $count); + }, $listinterfacecss); + $listinterfacecss = array_diff($listinterfacecss, ['edit.css', 'home.css']); + return $listinterfacecss; + } + + public function listdir($dir) { diff --git a/app/class/modelrender.php b/app/class/modelrender.php index 2d3daf1..cc3b753 100644 --- a/app/class/modelrender.php +++ b/app/class/modelrender.php @@ -23,11 +23,11 @@ class Modelrender extends Modelart $this->artlist = $this->getlister(); if(Config::internallinkblank()) { - $this->internallinkblank = ' target="blank" '; + $this->internallinkblank = ' target="_blank" '; } if(Config::externallinkblank()) { - $this->externallinkblank = ' target="blank" '; + $this->externallinkblank = ' target="_blank" '; } } diff --git a/app/view/templates/admin.php b/app/view/templates/admin.php index 3eba1c4..c1d7ff4 100644 --- a/app/view/templates/admin.php +++ b/app/view/templates/admin.php @@ -158,6 +158,10 @@ + + + +

CSS

@@ -166,19 +170,48 @@ - + + +
+ + + + + + + +
+ +

Interface

+ +

Set interface Style

+ +
+ + + +

Tracking

@@ -190,6 +223,10 @@
+ + + +
diff --git a/app/view/templates/home.php b/app/view/templates/home.php index 17dfc2d..e41c2cc 100644 --- a/app/view/templates/home.php +++ b/app/view/templates/home.php @@ -43,6 +43,9 @@
+ + +

diff --git a/app/view/templates/layout.php b/app/view/templates/layout.php index b054791..3c38be4 100644 --- a/app/view/templates/layout.php +++ b/app/view/templates/layout.php @@ -1,17 +1,23 @@ + - + - - + <?= $title ?> + '; + } + ?>