From 19d16efebc3fb5c0b2aede29aa91d31000ffd124 Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Mon, 25 May 2020 19:48:15 +0200 Subject: add page specific password protection close #118 --- app/class/Controllerpage.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'app/class/Controllerpage.php') diff --git a/app/class/Controllerpage.php b/app/class/Controllerpage.php index e864dd3..2e1c285 100644 --- a/app/class/Controllerpage.php +++ b/app/class/Controllerpage.php @@ -131,15 +131,25 @@ class Controllerpage extends Controller if ($pageexist) { $canread = $this->user->level() >= $this->page->secure(); + // Check page password + if (!empty($this->page->password())) { + if (empty($_POST['pagepassword']) || $_POST['pagepassword'] !== $this->page->password()) { + $this->showtemplate('pagepassword', ['pageid' => $this->page->id()]); + exit; + } + } + if ($this->page->daterender() < $this->page->datemodif()) { if (Config::reccursiverender()) { $this->reccursiverender($this->page); } $this->page = $this->renderpage($this->page); } + + if ($canread) { $this->page->addaffcount(); - if ($this->user->level() < 2) { + if ($this->user->isvisitor()) { $this->page->addvisitcount(); } } -- cgit v1.2.3