From 927d498d4a62fb6d1c7a30e34bd2a13f0e7ab9db Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 21 Oct 2023 21:30:20 +0200 Subject: [PATCH] coming together --- web/inc/classes/Page.class.php | 3 ++- web/inc/helpers.php | 5 +++++ web/pages/err/controller.php | 6 +----- web/pages/err/{notfound.mustache => notfound.html} | 2 +- web/pages/login/controller.php | 9 +++++++++ web/pages/login/login.html | 2 +- web/templates/mainpage.html | 2 +- 7 files changed, 20 insertions(+), 9 deletions(-) rename web/pages/err/{notfound.mustache => notfound.html} (72%) diff --git a/web/inc/classes/Page.class.php b/web/inc/classes/Page.class.php index 369d36e..24e56e1 100644 --- a/web/inc/classes/Page.class.php +++ b/web/inc/classes/Page.class.php @@ -105,7 +105,8 @@ class Page //render template by running include ob_start(); extract($this->variables); - include($templatefile); + if($templatefile!= '') + include($templatefile); $pagecontent = ob_get_contents(); ob_end_clean(); diff --git a/web/inc/helpers.php b/web/inc/helpers.php index f19d27d..58c49f9 100644 --- a/web/inc/helpers.php +++ b/web/inc/helpers.php @@ -167,4 +167,9 @@ function gen_uuid() { // 48 bits for "node" mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ) ); +} + +function escape($str) +{ + return htmlspecialchars($str, ENT_QUOTES, 'UTF-8'); } \ No newline at end of file diff --git a/web/pages/err/controller.php b/web/pages/err/controller.php index 7019deb..68ed3d7 100644 --- a/web/pages/err/controller.php +++ b/web/pages/err/controller.php @@ -5,7 +5,7 @@ class Err extends Page { function notfound($params) { $this->set("page",$params[0]); - $this->set('template', "notfound.mustache"); + $this->set('template', "notfound.html"); } function notallowed() @@ -13,8 +13,4 @@ class Err extends Page { return json_encode(['error'=>'not allowed']); } - function maySeeThisPage() - { - return true; - } } \ No newline at end of file diff --git a/web/pages/err/notfound.mustache b/web/pages/err/notfound.html similarity index 72% rename from web/pages/err/notfound.mustache rename to web/pages/err/notfound.html index a557a7a..0cf4b8e 100644 --- a/web/pages/err/notfound.mustache +++ b/web/pages/err/notfound.html @@ -1,4 +1,4 @@ \ No newline at end of file diff --git a/web/pages/login/controller.php b/web/pages/login/controller.php index 59d68af..dda5f65 100644 --- a/web/pages/login/controller.php +++ b/web/pages/login/controller.php @@ -9,4 +9,13 @@ class Login extends Page { //return print_r($_REQUEST, true); } + function validate() + { + $email = $_REQUEST['email']; + $password = $_REQUEST['password']; + $remember = $_REQUEST['remember']; + + return print_r(['email'=>$email,'password'=>$password,'remember'=>$remember], true); + } + } \ No newline at end of file diff --git a/web/pages/login/login.html b/web/pages/login/login.html index 0a8fafc..2f8847b 100644 --- a/web/pages/login/login.html +++ b/web/pages/login/login.html @@ -7,7 +7,7 @@
-
+
diff --git a/web/templates/mainpage.html b/web/templates/mainpage.html index 367338a..748d98b 100644 --- a/web/templates/mainpage.html +++ b/web/templates/mainpage.html @@ -29,7 +29,7 @@