From 97d6db419e1782abaa554dc9b88c208835d1a8b4 Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Mon, 7 May 2018 11:34:45 +0200 Subject: W 2.1 M 0.1 --- class/class.aff.php | 20 ++++++++++++++++---- class/class.app.php | 6 ++++-- class/class.art.php | 32 +++++++++++++++++++++++++++++++- 3 files changed, 51 insertions(+), 7 deletions(-) (limited to 'class') diff --git a/class/class.aff.php b/class/class.aff.php index 61ee142..a62274e 100644 --- a/class/class.aff.php +++ b/class/class.aff.php @@ -42,7 +42,7 @@ class Aff section a[target="_blank"] { color: couleurlienblank() ?>; } - css() ?> + csstemplate($app) ?>

titre() ?>

@@ -55,7 +55,7 @@ class Aff echo ''; } - public function edit(Art $art) + public function edit(Art $art, $list) { if ($this->session() >= self::$edit) { @@ -82,6 +82,18 @@ class Aff
CSS + + @@ -299,7 +311,7 @@ public function head($title, $tool)
exist($_GET['id'])) { + if (isset($_GET['id'])) { if ($this->session() == 0) { ?>
@@ -318,7 +330,7 @@ public function head($title, $tool)
session() == 2) { + if ($this->session() == 2 and $app->exist($_GET['id'])) { ?> display
diff --git a/class/class.app.php b/class/class.app.php index 2a863dd..3fac66b 100644 --- a/class/class.app.php +++ b/class/class.app.php @@ -26,7 +26,7 @@ class App $now = new DateTimeImmutable(null, timezone_open("Europe/Paris")); - $q = $this->bdd->prepare('INSERT INTO art(id, titre, soustitre, intro, tag, datecreation, datemodif, css, html, secure, couleurtext, couleurbkg, couleurlien, couleurlienblank, lien) VALUES(:id, :titre, :soustitre, :intro, :tag, :datecreation, :datemodif, :css, :html, :secure, :couleurtext, :couleurbkg, :couleurlien, :couleurlienblank, :lien)'); + $q = $this->bdd->prepare('INSERT INTO art(id, titre, soustitre, intro, tag, datecreation, datemodif, css, html, secure, couleurtext, couleurbkg, couleurlien, couleurlienblank, lien, template) VALUES(:id, :titre, :soustitre, :intro, :tag, :datecreation, :datemodif, :css, :html, :secure, :couleurtext, :couleurbkg, :couleurlien, :couleurlienblank, :lien, :template)'); $q->bindValue(':id', $art->id()); $q->bindValue(':titre', $art->titre()); @@ -43,6 +43,7 @@ class App $q->bindValue(':couleurlien', $art->couleurlien()); $q->bindValue(':couleurlienblank', $art->couleurlienblank()); $q->bindValue(':lien', $art->lien('string')); + $q->bindValue(':template', $art->template()); $q->execute(); } @@ -115,7 +116,7 @@ class App var_dump($now); - $q = $this->bdd->prepare('UPDATE art SET titre = :titre, soustitre = :soustitre, intro = :intro, tag = :tag, datecreation = :datecreation, datemodif = :datemodif, css = :css, html = :html, secure = :secure, couleurtext = :couleurtext, couleurbkg = :couleurbkg, couleurlien = :couleurlien, couleurlienblank = :couleurlienblank, lien = :lien WHERE id = :id'); + $q = $this->bdd->prepare('UPDATE art SET titre = :titre, soustitre = :soustitre, intro = :intro, tag = :tag, datecreation = :datecreation, datemodif = :datemodif, css = :css, html = :html, secure = :secure, couleurtext = :couleurtext, couleurbkg = :couleurbkg, couleurlien = :couleurlien, couleurlienblank = :couleurlienblank, lien = :lien, template = :template WHERE id = :id'); $q->bindValue(':id', $art->id()); $q->bindValue(':titre', $art->titre()); @@ -132,6 +133,7 @@ class App $q->bindValue(':couleurlien', $art->couleurlien()); $q->bindValue(':couleurlienblank', $art->couleurlienblank()); $q->bindValue(':lien', $art->lien('string')); + $q->bindValue(':template', $art->template()); $q->execute(); } diff --git a/class/class.art.php b/class/class.art.php index 58653ca..2b03a7d 100644 --- a/class/class.art.php +++ b/class/class.art.php @@ -128,6 +128,22 @@ a:hover {}'); return $this->css; } + public function csstemplate(App $app) + { + $data = []; + $temp = ''; + if (!empty($this->template())) { + if ($app->exist($this->template()) and !in_array($this->template(), $data)) { + $template = $app->get($this->template()); + $temp = $temp . $template->css($app); + $data[] = $template->id(); + + } + + } + return $temp . $this->css; + } + public function md() { return $this->html; @@ -192,6 +208,11 @@ a:hover {}'); } + public function template() + { + return $this->template; + } + @@ -254,7 +275,7 @@ a:hover {}'); public function setcss($css) { - if (strlen($css) < self::LEN and is_string($css)) { + if (strlen($css) < self::LENHTML and is_string($css)) { $this->css = strip_tags(trim(strtolower($css))); } } @@ -316,6 +337,15 @@ a:hover {}'); } } + public function settemplate($template) + { + $template = strip_tags($template); + if (strlen($template) == 0) { + $template = 'NULL'; + } + $this->template = $template; + } + } -- cgit v1.2.3