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 --- README.md | 42 ++++++++++++++++++++++++++++++++++++++++++ class/class.aff.php | 20 ++++++++++++++++---- class/class.app.php | 6 ++++-- class/class.art.php | 32 +++++++++++++++++++++++++++++++- public/w/index.php | 2 +- 5 files changed, 94 insertions(+), 8 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..4434f71 --- /dev/null +++ b/README.md @@ -0,0 +1,42 @@ +# W-CMS + +**W** is a CMS based on my way of thinking. + +It's a mix between a drive, wikipedia and a personnal blog. You can create articles very quickly and share them with other people or keep them for you and restricted people. + + +- The user can never see the whole map of the website : no menu (never ever) +- you can discover the website only by clicking on internal link, wiki style. +- Each page can have is own style, so you don't realise it's exactly the same website when you navigate (no graphical identity) Each page is a kind of single website on his own. (Just like a mini internet) + +The code is very very light, it's a very quick and limited CMS. + +The project is ispired by the *web publishing function* in *google docs* that create quick temporary web page instead of sharing a A4 page. I think very few people are using it. + + +There is 3 levels of privacy : + +0. public +1. resctricted by reader code (read only) +2. non published : admin only + +[Webpage of the project (in french)](http://vincent.club1.fr/w/?id=w) + +# M + +**M** is the media manager to be used with **W**. The purpose is to import images or sound, rename them, resize them or compress them very quickly online. + +# Technology + +- Pure PHP an MySQL only. +- Use MarkDown to edit articles. +- All the article use only basic GET information. + +# Versions + +## W + +- 2.1 : dynamic template : you can link a article to another to use the CSS parameters of the this one. + +## M + 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; + } + } diff --git a/public/w/index.php b/public/w/index.php index 695ce56..51bce0e 100644 --- a/public/w/index.php +++ b/public/w/index.php @@ -108,7 +108,7 @@ if (isset($_GET['id'])) { $art = $app->get($_GET['id']); if (isset($_GET['edit']) and $_GET['edit'] == 1) { - $aff->edit($art); + $aff->edit($art, $app->lister()); $aff->template($art, $app->lister()); $aff->aside($app->lister()); } else { -- cgit v1.2.3