aboutsummaryrefslogtreecommitdiff
path: root/app/class
diff options
context:
space:
mode:
Diffstat (limited to 'app/class')
-rw-r--r--app/class/Controller.php1
-rw-r--r--app/class/Controllerpage.php12
-rw-r--r--app/class/Page.php14
-rw-r--r--app/class/Routes.php1
4 files changed, 26 insertions, 2 deletions
diff --git a/app/class/Controller.php b/app/class/Controller.php
index 2b38988..7fb972c 100644
--- a/app/class/Controller.php
+++ b/app/class/Controller.php
@@ -171,6 +171,5 @@ class Controller
$this->user->destroysession($this->session->wsession);
$this->session->addtosession('wsession', '');
$this->usermanager->add($this->user);
-
}
}
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();
}
}
diff --git a/app/class/Page.php b/app/class/Page.php
index a369aed..e5b84ac 100644
--- a/app/class/Page.php
+++ b/app/class/Page.php
@@ -45,6 +45,7 @@ class Page extends Dbitem
protected $sleep;
protected $redirection;
protected $refresh;
+ protected $password;
public const LEN = 255;
@@ -109,6 +110,7 @@ class Page extends Dbitem
$this->setsleep(0);
$this->setredirection('');
$this->setrefresh(0);
+ $this->setpassword('');
}
// _____________________________________________________ G E T ____________________________________________________
@@ -361,6 +363,11 @@ class Page extends Dbitem
return $this->refresh;
}
+ public function password($type = 'string')
+ {
+ return $this->password;
+ }
+
@@ -701,6 +708,13 @@ class Page extends Dbitem
$this->refresh = $refresh;
}
+ public function setpassword($password)
+ {
+ if (is_string($password) && strlen($password) > 0 && strlen($password) < 64) {
+ $this->password = $password;
+ }
+ }
+
// __________________________________ C O U N T E R S ______________________________
diff --git a/app/class/Routes.php b/app/class/Routes.php
index c59531d..0433079 100644
--- a/app/class/Routes.php
+++ b/app/class/Routes.php
@@ -54,6 +54,7 @@ class Routes
['POST', '/!timeline/add', 'Controllertimeline#add', 'timelineadd'],
['POST', '/!timeline/clap', 'Controllertimeline#clap', 'timelineclap'],
['GET', '/[cid:page]/', 'Controllerpage#read', 'pageread/'],
+ ['POST', '/[cid:page]/', 'Controllerpage#read', 'pageread/post'],
['GET', '/[cid:page]', 'Controllerpage#read', 'pageread'],
['GET', '/[cid:page]/add', 'Controllerpage#add', 'pageadd'],
['GET', '/[cid:page]/add:[cid:copy]', 'Controllerpage#addascopy', 'pageaddascopy'],