diff --git a/.gitattributes b/.gitattributes
deleted file mode 100644
index dfe0770..0000000
--- a/.gitattributes
+++ /dev/null
@@ -1,2 +0,0 @@
-# Auto detect text files and perform LF normalization
-* text=auto
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index e915029..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-################################################################################
-# This .gitignore file was automatically created by Microsoft(R) Visual Studio.
-################################################################################
-
-/.vs
diff --git a/.vscode/launch.json b/.vscode/launch.json
deleted file mode 100644
index abe5e15..0000000
--- a/.vscode/launch.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- // Use IntelliSense to learn about possible attributes.
- // Hover to view descriptions of existing attributes.
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
- "version": "0.2.0",
- "configurations": [
- {
- "name": "Listen for XDebug",
- "type": "php",
- "request": "launch",
- "port": 9000
- },
- {
- "name": "Launch currently open script",
- "type": "php",
- "request": "launch",
- "program": "${file}",
- "cwd": "${fileDirname}",
- "port": 9000
- }
- ],
- "php.executablePath": "C:/xampp/php/php.exe",
- "php.suggest.basic": "false"
-}
\ No newline at end of file
diff --git a/dev_mvc/.buildpath b/dev_mvc/.buildpath
new file mode 100644
index 0000000..8bcb4b5
--- /dev/null
+++ b/dev_mvc/.buildpath
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/dev_mvc/.project b/dev_mvc/.project
new file mode 100644
index 0000000..3b1a44b
--- /dev/null
+++ b/dev_mvc/.project
@@ -0,0 +1,22 @@
+
+
+ dev
+
+
+
+
+
+ org.eclipse.wst.validation.validationbuilder
+
+
+
+
+ org.eclipse.dltk.core.scriptbuilder
+
+
+
+
+
+ org.eclipse.php.core.PHPNature
+
+
diff --git a/dev_mvc/controller/ActionHandler.php b/dev_mvc/controller/ActionHandler.php
deleted file mode 100644
index 56f9eb7..0000000
--- a/dev_mvc/controller/ActionHandler.php
+++ /dev/null
@@ -1,16 +0,0 @@
-
\ No newline at end of file
diff --git a/dev_mvc/controller/AssetHandler.php b/dev_mvc/controller/AssetHandler.php
deleted file mode 100644
index 0718470..0000000
--- a/dev_mvc/controller/AssetHandler.php
+++ /dev/null
@@ -1,12 +0,0 @@
-';
- }
- else{
- echo ' prepare("SELECT * FROM users where email = :email");
- //Bind parameters
- $query->bindParam(':email', $email, PDO::PARAM_STR, 256);
- //Voer de query uit
- $query->execute();
- //Check de hoeveelheid rijen die de database returnt.
- if($query->rowCount() == 0){
- //Email adres is niet in gebruik, return false
- return false;
- }
- else{
- //Email is al in gebruik of komt meer dan een keer voor. Beide gevallen zijn een probleem dus return true.
- return true;
- }
- }
- //Controleert of de gebruikersnaam al in de database voorkomt. Returnt true indien wel.
- static function checkUsedUsername($username){
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("SELECT * FROM users where username = :username");
- //Bind parameters
- $query->bindParam(':username', $username, PDO::PARAM_STR, 256);
- //Voer de query uit
- $query->execute();
- //Check de hoeveelheid rijen die de database returnt.
- if($query->rowCount() == 0){
- //Username adres is niet in gebruik, return false
- return false;
- }
- else{
- //Username is al in gebruik of komt meer dan een keer voor. Beide gevallen zijn een probleem dus return true.
- return true;
- }
- }
- //Registreert een gebruiker. Neemt als invoer email, wachtwoord, gebruikersnaam. en email activation key. Nog niet volledig geimplementeerd
- static function registerUser($email, $password, $username){
- $ip = $_SERVER['REMOTE_ADDR'];
- //Initit db connection
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("INSERT INTO users (username, email, password, reg_ip) VALUES (:username, :email, :password, :ip)");
- //Bind parameters
- $query->bindParam(':username', $username, PDO::PARAM_STR, 256);
- $query->bindParam(':email', $email, PDO::PARAM_STR, 256);
- $query->bindParam(':password', $password, PDO::PARAM_STR, 256);
- $query->bindParam(':ip', $ip, PDO::PARAM_STR, 256);
- //Voer query uit
- $query->execute();
- }
- //Check of gegeven login info in de database voorkomt
- static function isLoginValid($email, $password){
- //Init db connection
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("SELECT * FROM users where email = :email AND password = :password");
- //Bind params
- $query->bindParam(':email', $email, PDO::PARAM_STR, 256);
- $query->bindParam(':password', $password, PDO::PARAM_STR, 256);
- //Voer query it
- $query->execute();
- //Check hoeveelheid teruggestuurde rijen
- if($query->rowCount() == 1){
- //login correct (komt voor in de db)
- return true;
- }
- else{
- //Incorrect
- return false;
- }
- }
- //Vraag gebruikers ID op doormiddel van email en pass
- static function getUID($email, $password){
- //Init db connection
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("SELECT id FROM users where email = :email AND password = :password");
- //Bind params
- $query->bindParam(':email', $email, PDO::PARAM_STR, 256);
- $query->bindParam(':password', $password, PDO::PARAM_STR, 256);
- //Voer query it
- $query->execute();
- //Check hoeveelheid teruggestuurde rijen
- if($query->rowCount() == 1){
- //login correct, return uid
- $result = $query->fetch(PDO::FETCH_COLUMN);
- return $result;
- }
- else{
- //something went wrong, return -1
- return -1;
- }
- }
- static function getUsername($uid){
- $con = Database::connectToDB();
- $query = $con->prepare("SELECT username FROM users where id = :uid");
- $query->bindParam(':uid', $uid, PDO::PARAM_STR, 256);
- $query->execute();
- if($query->rowCount() == 1){
- //login correct, return uid
- $result = $query->fetch(PDO::FETCH_COLUMN);
- return $result;
- }
- else{
- //something went wrong, return -1
- return "db_user_invalid";
- }
- }
-
- /***
- * ______ __ __ _____ _ _____ _______ _______ __ _______ _____ ____ _ _
- * | ____| \/ | /\ |_ _| | /\ / ____|__ __|_ _\ \ / /\|__ __|_ _/ __ \| \ | |
- * | |__ | \ / | / \ | | | | / \ | | | | | | \ \ / / \ | | | || | | | \| |
- * | __| | |\/| | / /\ \ | | | | / /\ \| | | | | | \ \/ / /\ \ | | | || | | | . ` |
- * | |____| | | |/ ____ \ _| |_| |____ / ____ \ |____ | | _| |_ \ / ____ \| | _| || |__| | |\ |
- * |______|_| |_/_/ \_\_____|______| /_/ \_\_____| |_| |_____| \/_/ \_\_| |_____\____/|_| \_|
- *
- *
- ***/
-
- //Kijk of de user activation key al bestaat in de databse.
- static function doesUserActivationKeyExist($activationKey){
- $con = Database::connectToDB();
- $query = $con->prepare("SELECT * FROM email_activation_keys WHERE activationkey = :activationKey");
- $query->bindParam(':activationKey', $activationKey, PDO::PARAM_STR, 256);
- $query->execute();
- if($query->rowCount() == 0){
- //bestaat nog niet
- return false;
- }
- else{
- //bestaat al
- return true;
- }
- }
- static function registerActivationKey($users_id, $activationKey){
- $con = Database::connectToDB();
- $query = $con->prepare("INSERT INTO email_activation_keys (users_id, activationkey) VALUES (:users_id, :activationkey)");
- $query->bindParam(':users_id', $users_id);
- $query->bindParam(':activationkey', $activationKey);
- $query->execute();
- }
-
-
-
- //Activeer gebruiker en verwijder activation key uit de activation key tabel
- static function activateUser($activationKey){
- $con = Database::connectToDb();
- $query = $con->prepare("SELECT users_id FROM email_activation_keys WHERE activationKey = :activationKey");
- $query->bindParam('activationKey', $activationKey);
- $query->execute();
- $result = -1;
- if($query->rowCount() == 1){
- //login correct, return uid
- $result = $query->fetch(PDO::FETCH_COLUMN);
- }
- else{
- //activation key komt niet voor in de db, return -1
- return -1;
- }
- $id = $result;
- $query = null;
- $query = $con->prepare("UPDATE users SET active = 1 WHERE id = :id and active = 0");
- $query->bindParam(':id',$id,PDO::PARAM_INT);
- $query->execute();
- }
-
- /***
- * _____ ______ _____ _____ _____ ____ _ _ _______ ____ _ ________ _ _ _____
- * / ____| ____|/ ____/ ____|_ _/ __ \| \ | | |__ __/ __ \| |/ / ____| \ | |/ ____|
- * | (___ | |__ | (___| (___ | || | | | \| | | | | | | | ' /| |__ | \| | (___
- * \___ \| __| \___ \\___ \ | || | | | . ` | | | | | | | < | __| | . ` |\___ \
- * ____) | |____ ____) |___) |_| || |__| | |\ | | | | |__| | . \| |____| |\ |____) |
- * |_____/|______|_____/_____/|_____\____/|_| \_| |_| \____/|_|\_\______|_| \_|_____/
- *
- ***/
-
-
- static function isSessionTokenInUse($token){
- //Init db connection
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("SELECT * FROM usersessions where token = :token");
- //Bind params
- $query->bindParam(':token', $token, PDO::PARAM_STR, 256);
- //Voer query it
- $query->execute();
- //Check hoeveelheid teruggestuurde rijen
- if($query->rowCount() == 0){
- return false;
- }
- else{
- return true;
- }
- }
- static function registerNewSession($uid, $token, $expires){
- //Init db connection
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("INSERT INTO usersessions (uid, token, expires) VALUES (:uid, :token, :expires)");
- //Bind params
- $query->bindParam(':uid', $uid, PDO::PARAM_INT);
- $query->bindParam(':token', $token, PDO::PARAM_STR, 256);
- $query->bindParam(':expires', $expires, PDO::PARAM_STR);
- //Voer query it
- $query->execute();
- }
- static function isSessionValid($token, $uid){
- //Init db connection
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("SELECT * FROM usersessions where token = :token AND uid = :uid AND expires > NOW()");
- //Bind params
- $query->bindParam(':token', $token, PDO::PARAM_STR, 256);
- $query->bindParam(':uid', $uid, PDO::PARAM_STR, 256);
- //Voer query it
- $query->execute();
- //Check hoeveelheid teruggestuurde rijen
- if($query->rowCount() == 1){
- return true;
- }
- else{
- return false;
- }
- }
- static function invalidateSession($token){
- //Init db connection
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("DELETE FROM usersessions WHERE token = :token");
- //Bind params
- $query->bindParam(':token', $token, PDO::PARAM_STR, 256);
- //Voer query it
- $query->execute();
- }
- static function invalidateSessionByUID($uid){
- //Init db connection
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("DELETE FROM usersessions WHERE uid = :uid");
- //Bind params
- $query->bindParam(':token', $uid, PDO::PARAM_INT);
- //Voer query it
- $query->execute();
- }
- static function deleteExpiredSessions(){
- $con = Database::connectToDB();
- //Bereid query voor
- $query = $con->prepare("DELETE FROM usersessions WHERE expires < NOW()");
- $query->execute();
- }
- static function getSessionExpiryDate($token){
- $con = Database::connectToDB();
- $query = $con->prepare("SELECT expires FROM usersessions where token = :token");
- $query->bindParam(':token', $token, PDO::PARAM_STR, 256);
- $query->execute();
- if($query->rowCount() == 1){
- //login correct, return uid
- $result = $query->fetch(PDO::FETCH_COLUMN);
- return $result;
- }
- else{
- //something went wrong, return an invalid date.
- return "2000-01-01 00:00:00";
- }
- }
-}
-?>
\ No newline at end of file
diff --git a/dev_mvc/controller/HUtils.php b/dev_mvc/controller/HUtils.php
index 1b77853..abab026 100644
--- a/dev_mvc/controller/HUtils.php
+++ b/dev_mvc/controller/HUtils.php
@@ -1,7 +1,5 @@
view = "./view/webcontent/content_".$_GET['p'].".php";
+ $this->viewmodel = "./viewmodel/viewmodel_".$_GET['p'].".php";
+ }
+ else{
+ $this->view = "./view/webcontent/content_home.php";
+ $this->viewmodel = "./viewmodel/viewmodel_home.php";
+ }
+
+ //prepare current action model
+ if(isset($_POST['action'])){
+ $this->model = "./model/actions/model_".$_POST['action'].".php";
+ }
+ else if(isset($_GET['action'])){
+ $this->model = "./model/actions/model_".$_GET['action'].".php";
+ }
+ else{
+ $this->model = "./model/actions/model_empty.php";
+ }
+ }
+ static function getMVCController():MVCController
+ {
+ return self::$mvcController;
+ }
+ function overrideView($view_target):void
+ {
+ $this->view = "./view/webcontent/content_".$view_target.".php";
+ $this->viewmodel = "./viewmodel/viewmodel_".$view_target.".php";
+ $this->viewOverridden = true;
+ }
+ function executeAction():void
+ {
+ //check if action model is valid
+ if(file_exists($this->model)){
+ //execute action model
+ include_once($this->model);
+ }
+ //model doesn't exist and will not be called
+ else{
+ //debug message
+ echo("caught call on non-existant model file.");
+ }
+
+ }
+ function executeViewmodel():void
+ {
+ if(file_exists($this->viewmodel))
+ {
+ include_once($this->viewmodel);
+ }
+ }
+ function executeModel():void
+ {
+ $this->executeAction();
+ //check if the view was overridden by action.
+ if($this->viewOverridden){
+ //don't need to run the viewmodel twice if it was overridden by action
+ $this->viewOverridden = false;
+ }
+ //run viewmodel
+ $this->executeViewmodel();
+ //run viewmodel again if overridden by viewmodel
+ if($this->viewOverridden)
+ {
+ $this->executeViewmodel();
+ }
+ }
+ function loadView(){
+ if(file_exists($this->view)){
+ include_once($this->view);
+ }
+ else{
+ include_once("./view/webcontent/content_404.php");
+ echo("view: ".$this->view." not found.");
+ }
+ }
+}
+?>
\ No newline at end of file
diff --git a/dev_mvc/controller/UserSession.php b/dev_mvc/controller/UserSession.php
index 53dc21e..6d3de70 100644
--- a/dev_mvc/controller/UserSession.php
+++ b/dev_mvc/controller/UserSession.php
@@ -1,121 +1,125 @@
uid = $uid;
- $this->token = $token;
- $this->setExpiry();
- //echo($loginSessionToken);
- $_SESSION['usersession'] = $this;
- setcookie('usersession', $this->token);
- setcookie('uid', $this->uid);
- }
- public function setSessionToken($token){
- $this->token = $token;
- }
- public function getSessionToken(){
- return $this->token;
- }
- public function getFormattedExpiry(){
- return $this->expires->format('Y-m-d H:i:s');
- }
- public function setExpiry(){
- $this->expires = new DateTime();
- $this->expires->modify("+ 1 hour");
- }
- public static function generateToken(){
- $chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
- $token = "";
- for ($i=0; $i < 32 ; $i++) {
- $token .= $chars[rand(0, strlen($chars) - 1)];
- }
- return $token;
- }
- public static function isSessionValid(){
- if(isset($_SESSION['usersession'])){
- if(!Database::isSessionValid($_SESSION['usersession']->token, $_SESSION['usersession']->uid)){
- return false;
- }
- if(!UserSession::isSessionExpired($_SESSION['usersession'])){
- //check if session also exists in database
- return true;
- }
- }
- else{
- if(isset($_COOKIE['usersession'])){
- $token = $_COOKIE['usersession'];
- $uid = $_COOKIE['uid'];
- if(Database::isSessionValid($token,$uid)){
- $session = new UserSession($uid, $token);
- $session->expires = new DateTime(Database::getSessionExpiryDate($token));
- }
- else{
- return false;
- }
- if(!UserSession::isSessionExpired($session)){
- return true;
- }
- }
- return false;
- }
- }
- public static function getSession()
- {
- return $_SESSION['usersession'];
- }
- public static function isSessionExpired($session){
- //session is expired
- if(new DateTime() > $session->expires){
- return true;
- }
- //session is not expired
- else{
- return false;
- }
- }
- public static function isUserSignedIn(){
- /*
- if(UserSession::isSessionValid()){
- if(!UserSession::isSessionExpired(UserSession::getSession())){
- if(Database::isSessionValid(UserSession::getSession()->token, UserSession::getSession()->uid)){
- return true;
- }
-
- }
- else{
- return false;
- }
- }
- else{
- return false;
- }
- */
- //session exists, no need to do anything
- if(isset($_SESSION['usersession'])){
- return true;
- }
- else{
- if(isset($_COOKIE['usersession'])){
- //check if the session exists in the database
- if(Database::isSessionTokenInUse($_COOKIE['usersession'])){
- //check if database expiration datetime is still valid
- $expirationDateTime = Database::getSessionExpiryDate($_COOKIE['usersession']);
- if(new DateTime($expirationDateTime) >= new DateTime()){
- //user is signed in. Restore session
- $userSession = new UserSession($_COOKIE['uid'], $_COOKIE['usersession']);
- return true;
- }
- else{
- //remove session from the database
- Database::invalidateSession($_COOKIE['usersession']);
- }
- }
- }
- }
- //session either doesn't exist, doesn't exist in cookie, doesn't exist in database, or is expired in the database.
- return false;
- }
+ public $uid = -1;
+ public $token = "undefined";
+ public $expires;
+ public static $session;
+ public function UserSession($uid, $token = "undefined"){
+ $this->uid = $uid;
+ $this->token = $token;
+ $this->setExpiry();
+ //echo($loginSessionToken);
+ $_SESSION['usersession'] = $this;
+ setcookie('usersession', $this->token);
+ setcookie('uid', $this->uid);
+ }
+ public function setSessionToken($token){
+ $this->token = $token;
+ }
+ public function getSessionToken(){
+ return $this->token;
+ }
+ public function getFormattedExpiry(){
+ return $this->expires->format('Y-m-d H:i:s');
+ }
+ public function setExpiry(){
+ $this->expires = new DateTime();
+ $this->expires->modify("+ 1 hour");
+ }
+ public static function generateToken(){
+ $chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ $token = "";
+ for ($i=0; $i < 32 ; $i++) {
+ $token .= $chars[rand(0, strlen($chars) - 1)];
+ }
+ return $token;
+ }
+ public static function isSessionValid(){
+ if(isset($_SESSION['usersession'])){
+ if(!Database::isSessionValid($_SESSION['usersession']->token, $_SESSION['usersession']->uid)){
+ return false;
+ }
+ if(!UserSession::isSessionExpired($_SESSION['usersession'])){
+ //check if session also exists in database
+ return true;
+ }
+ }
+ else{
+ if(isset($_COOKIE['usersession'])){
+ $token = $_COOKIE['usersession'];
+ $uid = $_COOKIE['uid'];
+ if(Database::isSessionValid($token,$uid)){
+ $session = new UserSession($uid, $token);
+ $session->expires = new DateTime(Database::getSessionExpiryDate($token));
+ }
+ else{
+ return false;
+ }
+ if(!UserSession::isSessionExpired($session)){
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+ public static function getSession()
+ {
+ if(isset($_SESSION['usersession'])){
+ return $_SESSION['usersession'];
+ }
+ }
+ public static function isSessionExpired($session){
+ //session is expired
+ if(new DateTime() > $session->expires){
+ return true;
+ }
+ //session is not expired
+ else{
+ return false;
+ }
+ }
+ public static function isUserSignedIn(){
+ /*
+ if(UserSession::isSessionValid()){
+ if(!UserSession::isSessionExpired(UserSession::getSession())){
+ if(Database::isSessionValid(UserSession::getSession()->token, UserSession::getSession()->uid)){
+ return true;
+ }
+
+ }
+ else{
+ return false;
+ }
+ }
+ else{
+ return false;
+ }
+ */
+ //session exists, no need to do anything
+ if(isset($_SESSION['usersession'])){
+ return true;
+ }
+ else{
+ if(isset($_COOKIE['usersession'])){
+ //check if the session exists in the database
+ if(Database::isSessionTokenInUse($_COOKIE['usersession'])){
+ //check if database expiration datetime is still valid
+ $expirationDateTime = Database::getSessionExpiryDate($_COOKIE['usersession']);
+ if(new DateTime($expirationDateTime) >= new DateTime()){
+ //user is signed in. Restore session
+ $userSession = new UserSession($_COOKIE['uid'], $_COOKIE['usersession']);
+ return true;
+ }
+ else{
+ //remove session from the database
+ Database::invalidateSession($_COOKIE['usersession']);
+ }
+ }
+ }
+ }
+ //session either doesn't exist, doesn't exist in cookie, doesn't exist in database, or is expired in the database.
+ return false;
+ }
}
?>
\ No newline at end of file
diff --git a/dev_mvc/controller/data/Reply.php b/dev_mvc/controller/data/Reply.php
deleted file mode 100644
index 06eb89e..0000000
--- a/dev_mvc/controller/data/Reply.php
+++ /dev/null
@@ -1,38 +0,0 @@
-id = $id;
- $this->user = $user;
- $this->thread = $thread;
- $this->text = $text;
- }
- public function getId(){
- return $this->id;
- }
- public function setId($id){
- $this->id = $id;
- }
- public function getUser(){
- return $this->user;
- }
- public function setUser($user){
- $this->user = $user;
- }
- public function getThread(){
- return $this->thread;
- }
- public function setThread($thread){
- $this->thread = $thread;
- }
- public function getText(){
- return $this->text;
- }
- public function setText($text){
- $this->text = $text;
- }
-}
-?>
\ No newline at end of file
diff --git a/dev_mvc/controller/data/Thread.php b/dev_mvc/controller/data/Thread.php
deleted file mode 100644
index 7551e74..0000000
--- a/dev_mvc/controller/data/Thread.php
+++ /dev/null
@@ -1,17 +0,0 @@
-id = $id;
- $this->titel = $titel;
- $this->text = $text;
- $this->user = $user;
- array_push(Thread::$threadArray, $this);
- }
-}
-?>
\ No newline at end of file
diff --git a/dev_mvc/controller/data/User.php b/dev_mvc/controller/data/User.php
deleted file mode 100644
index 69b8e60..0000000
--- a/dev_mvc/controller/data/User.php
+++ /dev/null
@@ -1,33 +0,0 @@
-id = $id;
- $this->username = $username;
- $this->email = $email;
- $this->password = $password;
- array_push(User::$userArray, $this);
- }
- public function getId(){
- return $this->id;
- }
- public function setId($id){
- $this->id = $id;
- }
- public function getUsername(){
- return $this->username;
- }
- public function setUsername($username){
- $this->username = $username;
- }
- public function getEmail(){
- return $this->email;
- }
- public function setEmail($email){
- $this->email = $email;
- }
-}
-?>
\ No newline at end of file
diff --git a/dev_mvc/controller/db/DBBoard.php b/dev_mvc/controller/db/DBBoard.php
new file mode 100644
index 0000000..f9e4afe
--- /dev/null
+++ b/dev_mvc/controller/db/DBBoard.php
@@ -0,0 +1,12 @@
+prepare("SELECT * FROM board");
+ $query->execute();
+ return $query->fetchAll(PDO::FETCH_BOTH);
+ }
+
+}
\ No newline at end of file
diff --git a/dev_mvc/controller/db/DBReply.php b/dev_mvc/controller/db/DBReply.php
new file mode 100644
index 0000000..5ac91b3
--- /dev/null
+++ b/dev_mvc/controller/db/DBReply.php
@@ -0,0 +1,39 @@
+prepare("INSERT INTO reply (thread_ID, users_ID, content) VALUES (:tid, :uid, :content);");
+ $query->bindParam(":uid", $uid);
+ $query->bindParam(":tid", $threadID);
+ $query->bindParam(":content", $content);
+ echo "$uid, $threadID, $content";
+ $query->execute();
+ }
+ static function getReplyByID($id):array
+ {
+ $con = self::connectToDB();
+ $query = $con->prepare("SELECT * FROM reply WHERE id = :id");
+ $query->bindParam(":id", $id);
+ $query->execute();
+ return $query->fetch(PDO::FETCH_BOTH);
+
+ }
+ static function getRepliesByThreadID($tid):array
+ {
+ $con = self::connectToDB();
+ $query = $con->prepare("SELECT * FROM reply WHERE thread_ID = :tid");
+ $query->bindParam(":tid", $tid);
+ $query->execute();
+ return $query->fetchAll(PDO::FETCH_BOTH);
+ }
+ static function getLastReplyByThreadID():array
+ {
+ $con = self::connectToDB();
+ $query = $con->prepare("SELECT * FROM reply WHERE thread_ID = :tid ORDER BY date_created DESC LIMIT 1");
+ $query->bindParam(":tid", $tid);
+ $query->execute();
+ return $query->fetch(PDO::FETCH_BOTH);
+ }
+}
\ No newline at end of file
diff --git a/dev_mvc/controller/db/DBThread.php b/dev_mvc/controller/db/DBThread.php
new file mode 100644
index 0000000..3ca65e2
--- /dev/null
+++ b/dev_mvc/controller/db/DBThread.php
@@ -0,0 +1,37 @@
+prepare("SELECT * FROM thread WHERE ID = :id");
+ $query->bindParam(":id", $id);
+ $query->execute();
+ return $query->fetch(PDO::FETCH_BOTH);
+ }
+ static function getThreadsByBoard($boardID){
+ $con = self::connectToDB();
+ $query = $con->prepare("SELECT * FROM thread WHERE board_ID = :boardID");
+ $query->bindParam(":boardID", $boardID);
+ $query->execute();
+ return $query->fetchAll(PDO::FETCH_BOTH);
+ }
+ static function createThread($threadObject){
+ $con = self::connectToDB();
+ $query = $con->prepare( "INSERT INTO thread" .
+ "(users_ID, board_ID, title, text)" .
+ "VALUES (:uid, :bid, :title, :content);");
+
+ $uid = $threadObject->getUserID();
+ $bid = $threadObject->getBoardID();
+ $title = $threadObject->getTitle();
+ $content = $threadObject->getContent();
+
+ $query->bindParam(":uid", $uid);
+ $query->bindParam(":bid", $bid);
+ $query->bindParam(":title", $title);
+ $query->bindParam(":content", $content);
+ $query->execute();
+ }
+
+}
+
diff --git a/dev_mvc/controller/db/DBUser.php b/dev_mvc/controller/db/DBUser.php
new file mode 100644
index 0000000..b9d6b22
--- /dev/null
+++ b/dev_mvc/controller/db/DBUser.php
@@ -0,0 +1,134 @@
+prepare("SELECT * FROM users WHERE ID = :uid");
+ $query->bindParam(":uid", $uid);
+ $query->execute();
+ return $query->fetch(PDO::FETCH_BOTH);
+ }
+
+
+ //Controleert of het email adres al in de database voorkomt. Returnt true indien wel.
+ static function checkUsedEmail($email){
+ //Verbind met de database
+ $con = Database::connectToDB();
+ //Bereid query voor
+ $query = $con->prepare("SELECT * FROM users where email = :email");
+ //Bind parameters
+ $query->bindParam(':email', $email, PDO::PARAM_STR, 256);
+ //Voer de query uit
+ $query->execute();
+ //Check de hoeveelheid rijen die de database returnt.
+ if($query->rowCount() == 0){
+ //Email adres is niet in gebruik, return false
+ return false;
+ }
+ else{
+ //Email is al in gebruik of komt meer dan een keer voor. Beide gevallen zijn een probleem dus return true.
+ return true;
+ }
+ }
+ //Controleert of de gebruikersnaam al in de database voorkomt. Returnt true indien wel.
+ static function checkUsedUsername($username){
+ $con = Database::connectToDB();
+ //Bereid query voor
+ $query = $con->prepare("SELECT * FROM users where username = :username");
+ //Bind parameters
+ $query->bindParam(':username', $username, PDO::PARAM_STR, 256);
+ //Voer de query uit
+ $query->execute();
+ //Check de hoeveelheid rijen die de database returnt.
+ if($query->rowCount() == 0){
+ //Username adres is niet in gebruik, return false
+ return false;
+ }
+ else{
+ //Username is al in gebruik of komt meer dan een keer voor. Beide gevallen zijn een probleem dus return true.
+ return true;
+ }
+ }
+ //Registreert een gebruiker. Neemt als invoer email, wachtwoord, gebruikersnaam. en email activation key. Nog niet volledig geimplementeerd
+ static function registerUser($email, $password, $username){
+ $ip = $_SERVER['REMOTE_ADDR'];
+ //Initit db connection
+ $con = Database::connectToDB();
+ //Bereid query voor
+ $query = $con->prepare("INSERT INTO users (username, email, password, reg_ip) VALUES (:username, :email, :password, :ip)");
+ //Bind parameters
+ $query->bindParam(':username', $username, PDO::PARAM_STR, 256);
+ $query->bindParam(':email', $email, PDO::PARAM_STR, 256);
+ $query->bindParam(':password', $password, PDO::PARAM_STR, 256);
+ $query->bindParam(':ip', $ip, PDO::PARAM_STR, 256);
+ //Voer query uit
+ $query->execute();
+ }
+ //Check of gegeven login info in de database voorkomt
+ static function isLoginValid($email, $password){
+ //Init db connection
+ $con = Database::connectToDB();
+ //Bereid query voor
+ $query = $con->prepare("SELECT * FROM users where email = :email AND password = :password");
+ //Bind params
+ $query->bindParam(':email', $email, PDO::PARAM_STR, 256);
+ $query->bindParam(':password', $password, PDO::PARAM_STR, 256);
+ //Voer query it
+ $query->execute();
+ //Check hoeveelheid teruggestuurde rijen
+ if($query->rowCount() == 1){
+ //login correct (komt voor in de db)
+ return true;
+ }
+ else{
+ //Incorrect
+ return false;
+ }
+ }
+ //Vraag gebruikers ID op doormiddel van email en pass
+ static function getUID($email, $password){
+ //Init db connection
+ $con = Database::connectToDB();
+ //Bereid query voor
+ $query = $con->prepare("SELECT id FROM users where email = :email AND password = :password");
+ //Bind params
+ $query->bindParam(':email', $email, PDO::PARAM_STR, 256);
+ $query->bindParam(':password', $password, PDO::PARAM_STR, 256);
+ //Voer query it
+ $query->execute();
+ //Check hoeveelheid teruggestuurde rijen
+ if($query->rowCount() == 1){
+ //login correct, return uid
+ $result = $query->fetch(PDO::FETCH_COLUMN);
+ return $result;
+ }
+ else{
+ //something went wrong, return -1
+ return -1;
+ }
+ }
+ static function getUsername($uid){
+ $con = Database::connectToDB();
+ $query = $con->prepare("SELECT username FROM users where id = :uid");
+ $query->bindParam(':uid', $uid, PDO::PARAM_STR, 256);
+ $query->execute();
+ if($query->rowCount() == 1){
+ //login correct, return uid
+ $result = $query->fetch(PDO::FETCH_COLUMN);
+ return $result;
+ }
+ else{
+ //something went wrong, return -1
+ return "db_user_invalid";
+ }
+ }
+}
\ No newline at end of file
diff --git a/dev_mvc/controller/db/Database.php b/dev_mvc/controller/db/Database.php
new file mode 100644
index 0000000..d7e856c
--- /dev/null
+++ b/dev_mvc/controller/db/Database.php
@@ -0,0 +1,172 @@
+prepare("SELECT * FROM email_activation_keys WHERE activationkey = :activationKey");
+ $query->bindParam(':activationKey', $activationKey, PDO::PARAM_STR, 256);
+ $query->execute();
+ if($query->rowCount() == 0){
+ //bestaat nog niet
+ return false;
+ }
+ else{
+ //bestaat al
+ return true;
+ }
+ }
+ static function registerActivationKey($users_id, $activationKey){
+ $con = Database::connectToDB();
+ $query = $con->prepare("INSERT INTO email_activation_keys (users_id, activationkey) VALUES (:users_id, :activationkey)");
+ $query->bindParam(':users_id', $users_id);
+ $query->bindParam(':activationkey', $activationKey);
+ $query->execute();
+ }
+
+
+
+ //Activeer gebruiker en verwijder activation key uit de activation key tabel
+ static function activateUser($activationKey){
+ $con = Database::connectToDb();
+ $query = $con->prepare("SELECT users_id FROM email_activation_keys WHERE activationKey = :activationKey");
+ $query->bindParam('activationKey', $activationKey);
+ $query->execute();
+ $result = -1;
+ if($query->rowCount() == 1){
+ //login correct, return uid
+ $result = $query->fetch(PDO::FETCH_COLUMN);
+ }
+ else{
+ //activation key komt niet voor in de db, return -1
+ return -1;
+ }
+ $id = $result;
+ $query = null;
+ $query = $con->prepare("UPDATE users SET active = 1 WHERE id = :id and active = 0");
+ $query->bindParam(':id',$id,PDO::PARAM_INT);
+ $query->execute();
+ }
+
+ /***
+ * _____ ______ _____ _____ _____ ____ _ _ _______ ____ _ ________ _ _ _____
+ * / ____| ____|/ ____/ ____|_ _/ __ \| \ | | |__ __/ __ \| |/ / ____| \ | |/ ____|
+ * | (___ | |__ | (___| (___ | || | | | \| | | | | | | | ' /| |__ | \| | (___
+ * \___ \| __| \___ \\___ \ | || | | | . ` | | | | | | | < | __| | . ` |\___ \
+ * ____) | |____ ____) |___) |_| || |__| | |\ | | | | |__| | . \| |____| |\ |____) |
+ * |_____/|______|_____/_____/|_____\____/|_| \_| |_| \____/|_|\_\______|_| \_|_____/
+ *
+ ***/
+
+
+ static function isSessionTokenInUse($token){
+ //Init db connection
+ $con = Database::connectToDB();
+ //Bereid query voor
+ $query = $con->prepare("SELECT * FROM usersessions where token = :token");
+ //Bind params
+ $query->bindParam(':token', $token, PDO::PARAM_STR, 256);
+ //Voer query it
+ $query->execute();
+ //Check hoeveelheid teruggestuurde rijen
+ if($query->rowCount() == 0){
+ return false;
+ }
+ else{
+ return true;
+ }
+ }
+ static function registerNewSession($uid, $token, $expires){
+ //Init db connection
+ $con = Database::connectToDB();
+ //Bereid query voor
+ $query = $con->prepare("INSERT INTO usersessions (uid, token, expires) VALUES (:uid, :token, :expires)");
+ //Bind params
+ $query->bindParam(':uid', $uid, PDO::PARAM_INT);
+ $query->bindParam(':token', $token, PDO::PARAM_STR, 256);
+ $query->bindParam(':expires', $expires, PDO::PARAM_STR);
+ //Voer query it
+ $query->execute();
+ }
+ static function isSessionValid($token, $uid){
+ //Init db connection
+ $con = Database::connectToDB();
+ //Bereid query voor
+ $query = $con->prepare("SELECT * FROM usersessions where token = :token AND uid = :uid AND expires > NOW()");
+ //Bind params
+ $query->bindParam(':token', $token, PDO::PARAM_STR, 256);
+ $query->bindParam(':uid', $uid, PDO::PARAM_STR, 256);
+ //Voer query it
+ $query->execute();
+ //Check hoeveelheid teruggestuurde rijen
+ if($query->rowCount() == 1){
+ return true;
+ }
+ else{
+ return false;
+ }
+ }
+ static function invalidateSession($token){
+ //Init db connection
+ $con = Database::connectToDB();
+ //Bereid query voor
+ $query = $con->prepare("DELETE FROM usersessions WHERE token = :token");
+ //Bind params
+ $query->bindParam(':token', $token, PDO::PARAM_STR, 256);
+ //Voer query it
+ $query->execute();
+ }
+ static function invalidateSessionByUID($uid){
+ //Init db connection
+ $con = Database::connectToDB();
+ //Bereid query voor
+ $query = $con->prepare("DELETE FROM usersessions WHERE uid = :uid");
+ //Bind params
+ $query->bindParam(':token', $uid, PDO::PARAM_INT);
+ //Voer query it
+ $query->execute();
+ }
+ static function deleteExpiredSessions(){
+ $con = Database::connectToDB();
+ //Bereid query voor
+ $query = $con->prepare("DELETE FROM usersessions WHERE expires < NOW()");
+ $query->execute();
+ }
+ static function getSessionExpiryDate($token){
+ $con = Database::connectToDB();
+ $query = $con->prepare("SELECT expires FROM usersessions where token = :token");
+ $query->bindParam(':token', $token, PDO::PARAM_STR, 256);
+ $query->execute();
+ if($query->rowCount() == 1){
+ //login correct, return uid
+ $result = $query->fetch(PDO::FETCH_COLUMN);
+ return $result;
+ }
+ else{
+ //something went wrong, return an invalid date.
+ return "2000-01-01 00:00:00";
+ }
+ }
+}
\ No newline at end of file
diff --git a/dev_mvc/index.php b/dev_mvc/index.php
index 9eb02bd..9d9c4db 100644
--- a/dev_mvc/index.php
+++ b/dev_mvc/index.php
@@ -1,33 +1,9 @@
executeModel();
+include_once("./view/content_pagetemplate.php");
?>
\ No newline at end of file
diff --git a/dev_mvc/model/actions/model_create_reply.php b/dev_mvc/model/actions/model_create_reply.php
new file mode 100644
index 0000000..4a44c17
--- /dev/null
+++ b/dev_mvc/model/actions/model_create_reply.php
@@ -0,0 +1,15 @@
+uid;
+if(HUtils::issetPost(['thread', 'content']));
+{
+ $reply = new Reply(-1, $_POST['thread'], $uid, $_POST['content']);
+ print_r($reply);
+ DBReply::createReply($reply->getUserid(), $reply->getThreadID(), $reply->getContent());
+}
+?>
diff --git a/dev_mvc/model/actions/model_create_thread.php b/dev_mvc/model/actions/model_create_thread.php
new file mode 100644
index 0000000..36c2e23
--- /dev/null
+++ b/dev_mvc/model/actions/model_create_thread.php
@@ -0,0 +1,14 @@
+uid;
+if(HUtils::issetPost(['title', 'content', 'board']));
+{
+ $thread = new Thread(-1, $uid, $_POST['board'], $_POST['title'], $_POST['content']);
+ DBThread::createThread($thread);
+}
+?>
diff --git a/dev_mvc/model/actions/model_destroy.php b/dev_mvc/model/actions/model_destroy.php
deleted file mode 100644
index 10da7af..0000000
--- a/dev_mvc/model/actions/model_destroy.php
+++ /dev/null
@@ -1,4 +0,0 @@
-
\ No newline at end of file
diff --git a/dev_mvc/model/model_do_register.php b/dev_mvc/model/actions/model_do_register.php
similarity index 69%
rename from dev_mvc/model/model_do_register.php
rename to dev_mvc/model/actions/model_do_register.php
index 053392d..2883168 100644
--- a/dev_mvc/model/model_do_register.php
+++ b/dev_mvc/model/actions/model_do_register.php
@@ -1,7 +1,8 @@
\ No newline at end of file
diff --git a/dev_mvc/model/actions/model_login.php b/dev_mvc/model/actions/model_login.php
new file mode 100644
index 0000000..c2f7798
--- /dev/null
+++ b/dev_mvc/model/actions/model_login.php
@@ -0,0 +1,59 @@
+getSessionToken();
+ echo " ";
+ echo $a->uid;
+ echo " ";
+ echo $a->username;
+ }
+ //clean up expired sessions from ANY users
+ Database::deleteExpiredSessions();
+ Database::registerNewSession($a->uid, $a->token, $a->getFormattedExpiry());
+ //logged in, time to continue with other stuff
+ }
+ else{
+ MVCController::getMVCController()->overrideView("account_inactive");
+ $skipoverride = true;
+ echo('ree');
+ }
+ }
+ else{
+ echo "uid returned -1 from db interface";
+ }
+ }
+ else{
+ echo("login invalid");
+ }
+ }
+}
+else{
+ //we're done, don't even need to log in, session already active
+}
+
+if(!UserSession::isUserSignedIn() &&!$skipoverride){
+ MVCController::getMVCController()->overrideView("error_login");
+}
+
+?>
\ No newline at end of file
diff --git a/dev_mvc/model/actions/model_signout.php b/dev_mvc/model/actions/model_signout.php
index 2db1a67..9db085f 100644
--- a/dev_mvc/model/actions/model_signout.php
+++ b/dev_mvc/model/actions/model_signout.php
@@ -1,4 +1,6 @@
\ No newline at end of file
diff --git a/dev_mvc/model/classes/Reply.php b/dev_mvc/model/classes/Reply.php
deleted file mode 100644
index e69de29..0000000
diff --git a/dev_mvc/model/classes/Thread.php b/dev_mvc/model/classes/Thread.php
deleted file mode 100644
index dd3d92d..0000000
--- a/dev_mvc/model/classes/Thread.php
+++ /dev/null
@@ -1,19 +0,0 @@
-
\ No newline at end of file
diff --git a/dev_mvc/model/classes/User.php b/dev_mvc/model/classes/User.php
deleted file mode 100644
index e69de29..0000000
diff --git a/dev_mvc/model/forum/Board.php b/dev_mvc/model/forum/Board.php
new file mode 100644
index 0000000..877bf99
--- /dev/null
+++ b/dev_mvc/model/forum/Board.php
@@ -0,0 +1,13 @@
+id = $id;
+ $this->name = $name;
+ $this->permLevel = $permLevel;
+ }
+
+}
+
diff --git a/dev_mvc/model/forum/Reply.php b/dev_mvc/model/forum/Reply.php
new file mode 100644
index 0000000..87fe3a1
--- /dev/null
+++ b/dev_mvc/model/forum/Reply.php
@@ -0,0 +1,102 @@
+id = $id;
+ $this->threadID = $threadID;
+ $this->userID = $userID;
+ $this->content = $content;
+ $dateTime = new DateTime($date);
+ $this->date = $dateTime;
+ }
+ /**
+ * @return mixed
+ */
+ public function getOwner():User {
+ return $this->owner;
+ }
+
+ /**
+ * @param mixed $owner
+ */
+ public function setOwner($owner) {
+ $this->owner = $owner;
+ }
+ /**
+ * @return mixed
+ */
+ public function getId() {
+ return $this->id;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getThreadID() {
+ return $this->threadID;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getUserID() {
+ return $this->userID;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getContent() {
+ return $this->content;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getDate() {
+ return $this->date;
+ }
+
+ /**
+ * @param mixed $id
+ */
+ public function setId($id) {
+ $this->id = $id;
+ }
+
+ /**
+ * @param mixed $threadID
+ */
+ public function setThreadID($threadID) {
+ $this->threadID = $threadID;
+ }
+
+ /**
+ * @param mixed $userID
+ */
+ public function setUserID($userID) {
+ $this->userID = $userID;
+ }
+
+ /**
+ * @param mixed $content
+ */
+ public function setContent($content) {
+ $this->content = $content;
+ }
+
+ /**
+ * @param mixed $date
+ */
+ public function setDate($date) {
+ $this->date = $date;
+ }
+
+}
+
diff --git a/dev_mvc/model/forum/Thread.php b/dev_mvc/model/forum/Thread.php
new file mode 100644
index 0000000..223dc84
--- /dev/null
+++ b/dev_mvc/model/forum/Thread.php
@@ -0,0 +1,143 @@
+id = $id;
+ $this->title = $title;
+ $this->boardID = $boardID;
+ $this->userID = $userID;
+ $this->content = $content;
+
+ $dateTime = new DateTime($date_created);
+ $this->date_created = $dateTime;
+
+ /*
+ if(isset($threadData)){
+ $this->id = $threadData['id'];
+ $this->title = $threadData['title'];
+ $this->boardID = $threadData['boardID'];
+ $this->userID = $threadData['userID'];
+ $this->content = $threadData['content'];
+ }
+ */
+ }
+ /**
+ * @return multitype:
+ */
+ public function getReplies() {
+ return $this->replies;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getOwner():User {
+ return $this->owner;
+ }
+
+ /**
+ * @param multitype: $replies
+ */
+ public function setReplies($replies) {
+ $this->replies = $replies;
+ }
+
+ /**
+ * @param mixed $owner
+ */
+ public function setOwner($owner) {
+ $this->owner = $owner;
+ }
+ public function getId():int {
+ return $this->id;
+ }
+
+ /**
+ * @return string $title
+ */
+ public function getTitle():string {
+ return $this->title;
+ }
+
+ /**
+ * @return int $boardID
+ */
+ public function getBoardID():int {
+ return $this->boardID;
+ }
+
+ /**
+ * @return int $userID
+ */
+ public function getUserID():int {
+ return $this->userID;
+ }
+
+ /**
+ * @return string $content
+ */
+ public function getContent():string {
+ return $this->content;
+ }
+
+ /**
+ * @param string $id
+ */
+ public function setId($id) {
+ $this->id = $id;
+ }
+
+ /**
+ * @param string $title
+ */
+ public function setTitle($title) {
+ $this->title = $title;
+ }
+
+ /**
+ * @param string $boardID
+ */
+ public function setBoardID($boardID) {
+ $this->boardID = $boardID;
+ }
+
+ /**
+ * @param string $userID
+ */
+ public function setUserID($userID) {
+ $this->userID = $userID;
+ }
+
+ /**
+ * @param string $content
+ */
+ public function setContent($content) {
+ $this->content = $content;
+ }
+ /**
+ * @return DateTime
+ */
+ public function getDate_created() {
+ return $this->date_created;
+ }
+
+ /**
+ * @param DateTime $date_created
+ */
+ public function setDate_created($date_created) {
+ $this->date_created = $date_created;
+ }
+
+}
+
diff --git a/dev_mvc/model/forum/User.php b/dev_mvc/model/forum/User.php
new file mode 100644
index 0000000..294dc55
--- /dev/null
+++ b/dev_mvc/model/forum/User.php
@@ -0,0 +1,138 @@
+id = $id;
+ $this->username = $username;
+ $this->email = $email;
+ $this->password = $password;
+ $this->reg_date = $reg_date;
+ $this->login_date = $login_date;
+ $this->reg_ip=$reg_ip;
+ $this->permissions=$permissions;
+ }
+ /**
+ * @return mixed
+ */
+ public function getId() {
+ return $this->id;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getUsername() {
+ return $this->username;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getEmail() {
+ return $this->email;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getPassword() {
+ return $this->password;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getReg_date() {
+ return $this->reg_date;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getLogin_date() {
+ return $this->login_date;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getReg_ip() {
+ return $this->reg_ip;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getPermissions() {
+ return $this->permissions;
+ }
+
+ /**
+ * @param mixed $id
+ */
+ public function setId($id) {
+ $this->id = $id;
+ }
+
+ /**
+ * @param mixed $username
+ */
+ public function setUsername($username) {
+ $this->username = $username;
+ }
+
+ /**
+ * @param mixed $email
+ */
+ public function setEmail($email) {
+ $this->email = $email;
+ }
+
+ /**
+ * @param mixed $password
+ */
+ public function setPassword($password) {
+ $this->password = $password;
+ }
+
+ /**
+ * @param mixed $reg_date
+ */
+ public function setReg_date($reg_date) {
+ $this->reg_date = $reg_date;
+ }
+
+ /**
+ * @param mixed $login_date
+ */
+ public function setLogin_date($login_date) {
+ $this->login_date = $login_date;
+ }
+
+ /**
+ * @param mixed $reg_ip
+ */
+ public function setReg_ip($reg_ip) {
+ $this->reg_ip = $reg_ip;
+ }
+
+ /**
+ * @param mixed $permissions
+ */
+ public function setPermissions($permissions) {
+ $this->permissions = $permissions;
+ }
+
+
+
+
+}
+
diff --git a/dev_mvc/model/model_create_topic.php b/dev_mvc/model/model_create_topic.php
deleted file mode 100644
index ac1dafc..0000000
--- a/dev_mvc/model/model_create_topic.php
+++ /dev/null
@@ -1,11 +0,0 @@
-
\ No newline at end of file
diff --git a/dev_mvc/model/model_do_login.php b/dev_mvc/model/model_do_login.php
deleted file mode 100644
index a913762..0000000
--- a/dev_mvc/model/model_do_login.php
+++ /dev/null
@@ -1,45 +0,0 @@
-getSessionToken();
- echo " ";
- echo $a->uid;
- echo " ";
- echo $a->username;
- }
- //clean up expired sessions from ANY users
- Database::deleteExpiredSessions();
- Database::registerNewSession($a->uid, $a->token, $a->getFormattedExpiry());
- //logged in, time to continue with other stuff
- }
- else{
- echo "uid returned -1 from db interface";
- }
- }
- else{
- echo("login invalid");
- }
- }
-}
-else{
- //we're done, don't even need to log in, session already active
-}
-?>
\ No newline at end of file
diff --git a/dev_mvc/tests/createdb/index.php b/dev_mvc/tests/createdb/index.php
deleted file mode 100644
index fd6e004..0000000
--- a/dev_mvc/tests/createdb/index.php
+++ /dev/null
@@ -1,79 +0,0 @@
-exec("CREATE DATABASE `$db`;
- CREATE USER '$user'@'localhost' IDENTIFIED BY '$pass';
- GRANT ALL ON `$db`.* TO '$user'@'localhost';
- FLUSH PRIVILEGES;")
- or die(print_r($dbh->errorInfo(), true));
-
- } catch (PDOException $e) {
- die("DB ERROR: ". $e->getMessage());
- }
-
- try {
- $dsn = "mysql:host=$host;dbname=$db";
- //Maak verbinding
- $con = new PDO($dsn, $root, $root_password);
- $con->exec("CREATE TABLE `board` (
- `ID` int(16) NOT NULL AUTO_INCREMENT,
- `name` varchar(256) NOT NULL,
- `description` text NOT NULL,
- `permLevel` int(16) NOT NULL DEFAULT '0',
- PRIMARY KEY (`ID`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1");
- $con->exec("CREATE TABLE `email_activation_keys` (
- `id` int(16) NOT NULL AUTO_INCREMENT,
- `users_id` int(16) NOT NULL,
- `activationkey` varchar(256) NOT NULL,
- PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1");
- $con->exec("CREATE TABLE `reply` (
- `ID` int(16) NOT NULL AUTO_INCREMENT,
- `thread_ID` int(16) NOT NULL,
- `users_ID` int(16) NOT NULL,
- `content` text NOT NULL,
- `date_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (`ID`) ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1");
- $con->exec("CREATE TABLE `thread` (
- `ID` int(16) NOT NULL AUTO_INCREMENT,
- `users_ID` int(16) NOT NULL,
- `board_ID` int(16) NOT NULL,
- `title` varchar(256) NOT NULL,
- `text` text NOT NULL,
- `date_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY (`ID`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1");
- $con->exec("CREATE TABLE `users` (
- `ID` int(11) NOT NULL AUTO_INCREMENT,
- `username` varchar(256) NOT NULL,
- `email` varchar(256) NOT NULL,
- `password` varchar(256) NOT NULL,
- `reg_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
- `login_date` datetime NOT NULL,
- `reg_ip` varchar(256) NOT NULL,
- `permissions` int(11) NOT NULL DEFAULT '-1',
- `active` tinyint(1) DEFAULT '0',
- PRIMARY KEY (`ID`) ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1");
- $con->exec("CREATE TABLE `usersessions` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `uid` int(11) NOT NULL,
- `token` varchar(256) NOT NULL,
- `expires` datetime NOT NULL,
- PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1");
- }
- catch (PDOException $e) {
- die("DB ERROR: ". $e->getMessage());
- }
-
-
-
-?>
\ No newline at end of file
diff --git a/dev_mvc/tests/phpinfo/index.php b/dev_mvc/tests/phpinfo/index.php
deleted file mode 100644
index 804702b..0000000
--- a/dev_mvc/tests/phpinfo/index.php
+++ /dev/null
@@ -1,4 +0,0 @@
-
\ No newline at end of file
diff --git a/dev_mvc/view/content_pagetemplate.php b/dev_mvc/view/content_pagetemplate.php
new file mode 100644
index 0000000..fb9617b
--- /dev/null
+++ b/dev_mvc/view/content_pagetemplate.php
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+loadView();
+?>
+
+
+
+
\ No newline at end of file
diff --git a/dev_mvc/view/css/main.css b/dev_mvc/view/css/main.css
index 03d944d..1bac85d 100644
--- a/dev_mvc/view/css/main.css
+++ b/dev_mvc/view/css/main.css
@@ -1,4 +1,123 @@
*{
- font-family: Arial, Helvetica, sans-serif;
-
+ font-family: Arial, Helvetica, sans-serif;
+}
+html, body{
+
+ width: 100%;
+ height: 100%;
+ padding: 0;
+ margin: 0;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ background-color: #333333;
+}
+body{
+
+}
+
+loginForm{
+
+}
+.logo{
+ height: 100px;
+ width: 100px;
+ box-sizing: border-box;
+ border-radius: 10px;
+ justify-self: left;
+ font-size: 50pt;
+ padding: 10pt;
+ color: white;
+ margin-right: 10px;
+ /* Permalink - use to edit and share this gradient: https://colorzilla.com/gradient-editor/#1e5799+0,45427a+100 */
+ background: #1e5799; /* Old browsers */
+ background: -moz-linear-gradient(-45deg, #1e5799 0%, #45427a 100%); /* FF3.6-15 */
+ background: -webkit-linear-gradient(-45deg, #1e5799 0%,#45427a 100%); /* Chrome10-25,Safari5.1-6 */
+ background: linear-gradient(135deg, #1e5799 0%,#45427a 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#1e5799', endColorstr='#45427a',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
+
+ -webkit-touch-callout: none; /* iOS Safari */
+ -webkit-user-select: none; /* Safari */
+ -khtml-user-select: none; /* Konqueror HTML */
+ -moz-user-select: none; /* Firefox */
+ -ms-user-select: none; /* Internet Explorer/Edge */
+ user-select: none; /* Non-prefixed version, currently supported by Chrome and Opera */
+ box-shadow: 0px 0px 20px black;
+}
+.row{
+ display: flex;
+ flex-direction: row;
+ flex-basis: auto;
+}
+header{
+ margin-top: 10px;
+}
+nav{
+ border-radius: 10px;
+ display:flex;
+ flex-direction: flex-row;
+ flex-basis: auto;
+ flex-shrink: 0;
+ flex-grow: 0;
+ background-color: gray;
+ width: 80%;
+ height: 100px;
+ max-height: 100px;
+
+
+
+ align-items: center;
+ justify-items: center;
+ align-content: center;
+ justify-content: center;
+ align-self: center;
+ justify-self: center;
+ box-shadow: 0px 0px 20px black;
+}
+nav a{
+ padding-left: 10px;
+ padding-right: 10px;
+ text-decoration: none;
+ font-size: 20pt;
+ font-weight: bold;
+ color: white;
+}
+.main{
+ border-radius: 15px;
+ margin-top: 10px;
+ display: flex;
+ flex-direction: column;
+ flex-grow: 0;
+ flex-shrink: 1;
+ background-color: white;
+ padding: 15px;
+ margin-bottom: 20px;
+ box-shadow: 0px 0px 20px black;
+}
+input{
+ padding: 5px;
+ margin: 5px;
+}
+textarea{
+ padding: 5px;
+ margin: 5px;
+ resize: none;
+ width: 50vw;
+ height: 20vw;
+}
+table {
+ font-family: arial, sans-serif;
+ border-collapse: collapse;
+ width: 100%;
+ width: 80vw;
+}
+
+td, th {
+ border: 1px solid #dddddd;
+ text-align: left;
+ padding: 8px;
+}
+
+tr:nth-child(even) {
+ background-color: #dddddd;
}
diff --git a/dev_mvc/view/img/logo.png b/dev_mvc/view/img/logo.png
deleted file mode 100644
index 5837651..0000000
Binary files a/dev_mvc/view/img/logo.png and /dev/null differ
diff --git a/dev_mvc/view/pagecontent/content_404.php b/dev_mvc/view/pagecontent/content_404.php
deleted file mode 100644
index ceb7af1..0000000
--- a/dev_mvc/view/pagecontent/content_404.php
+++ /dev/null
@@ -1,3 +0,0 @@
-
- This page does not exist!
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/content_attempt_login.php b/dev_mvc/view/pagecontent/content_attempt_login.php
deleted file mode 100644
index 0b12f34..0000000
--- a/dev_mvc/view/pagecontent/content_attempt_login.php
+++ /dev/null
@@ -1,7 +0,0 @@
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/content_attempt_logout.php b/dev_mvc/view/pagecontent/content_attempt_logout.php
deleted file mode 100644
index 6a047ec..0000000
--- a/dev_mvc/view/pagecontent/content_attempt_logout.php
+++ /dev/null
@@ -1,3 +0,0 @@
-
- You've been succesfully logged out
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/content_attempt_register.php b/dev_mvc/view/pagecontent/content_attempt_register.php
deleted file mode 100644
index f8b887e..0000000
--- a/dev_mvc/view/pagecontent/content_attempt_register.php
+++ /dev/null
@@ -1,3 +0,0 @@
-
- Successfully registered!
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/content_create_topic.php b/dev_mvc/view/pagecontent/content_create_topic.php
deleted file mode 100644
index 71b2f4b..0000000
--- a/dev_mvc/view/pagecontent/content_create_topic.php
+++ /dev/null
@@ -1,4 +0,0 @@
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/content_destroy.php b/dev_mvc/view/pagecontent/content_destroy.php
deleted file mode 100644
index dc3cd8b..0000000
--- a/dev_mvc/view/pagecontent/content_destroy.php
+++ /dev/null
@@ -1,3 +0,0 @@
-
- You're still signed in thanks to our cookies!
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/content_header.php b/dev_mvc/view/pagecontent/content_header.php
deleted file mode 100644
index 184e0d0..0000000
--- a/dev_mvc/view/pagecontent/content_header.php
+++ /dev/null
@@ -1,7 +0,0 @@
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/content_index.php b/dev_mvc/view/pagecontent/content_index.php
deleted file mode 100644
index 852160d..0000000
--- a/dev_mvc/view/pagecontent/content_index.php
+++ /dev/null
@@ -1,3 +0,0 @@
-
- Welkom op hForumPHP. Log in of registreer om iets te doen.
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/content_login.php b/dev_mvc/view/pagecontent/content_login.php
deleted file mode 100644
index fa81455..0000000
--- a/dev_mvc/view/pagecontent/content_login.php
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/content_page.php b/dev_mvc/view/pagecontent/content_page.php
deleted file mode 100644
index 2b88bba..0000000
--- a/dev_mvc/view/pagecontent/content_page.php
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
-
- =HUtils::getSiteTitle();?>
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/content_register.php b/dev_mvc/view/pagecontent/content_register.php
deleted file mode 100644
index f04a213..0000000
--- a/dev_mvc/view/pagecontent/content_register.php
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/content_showboards.php b/dev_mvc/view/pagecontent/content_showboards.php
deleted file mode 100644
index 3b860be..0000000
--- a/dev_mvc/view/pagecontent/content_showboards.php
+++ /dev/null
@@ -1,8 +0,0 @@
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/content_showtopics.php b/dev_mvc/view/pagecontent/content_showtopics.php
deleted file mode 100644
index 1e1f5b1..0000000
--- a/dev_mvc/view/pagecontent/content_showtopics.php
+++ /dev/null
@@ -1,17 +0,0 @@
-TOPICS:
-'.$topics[$i][1].' - Gestart door: '.Database::getUsername($topics[$i][2]);
- echo ' ';
-
- }
- //test
- //echo('aaa');
-}
-
-?>
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/content_verify.php b/dev_mvc/view/pagecontent/content_verify.php
deleted file mode 100644
index 9cc92e0..0000000
--- a/dev_mvc/view/pagecontent/content_verify.php
+++ /dev/null
@@ -1,16 +0,0 @@
- Go here: Resend email verification
-
-
- ");
-}
-
-
-
-?>
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/header/content_header_signedin.php b/dev_mvc/view/pagecontent/header/content_header_signedin.php
deleted file mode 100644
index 5d052ec..0000000
--- a/dev_mvc/view/pagecontent/header/content_header_signedin.php
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
- log out home create thread simulate $_SESSION expiry
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/header/content_header_signedout.php b/dev_mvc/view/pagecontent/header/content_header_signedout.php
deleted file mode 100644
index 02bda45..0000000
--- a/dev_mvc/view/pagecontent/header/content_header_signedout.php
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
- log in register home
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/login/content_login_succesful.php b/dev_mvc/view/pagecontent/login/content_login_succesful.php
deleted file mode 100644
index f86a96c..0000000
--- a/dev_mvc/view/pagecontent/login/content_login_succesful.php
+++ /dev/null
@@ -1,3 +0,0 @@
-
- Successfully logged in!
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/login/content_login_unsuccesful.php b/dev_mvc/view/pagecontent/login/content_login_unsuccesful.php
deleted file mode 100644
index a9a1ae8..0000000
--- a/dev_mvc/view/pagecontent/login/content_login_unsuccesful.php
+++ /dev/null
@@ -1,3 +0,0 @@
-
- UNEXPECTED LOGIN ERROR. OUR CODEMONKEYS DID SOMETHING VERY WRONG :(
-
\ No newline at end of file
diff --git a/dev_mvc/view/pagecontent/modules/topbar_login.php b/dev_mvc/view/pagecontent/modules/topbar_login.php
deleted file mode 100644
index 653b5ba..0000000
--- a/dev_mvc/view/pagecontent/modules/topbar_login.php
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/content_404.php b/dev_mvc/view/webcontent/content_404.php
new file mode 100644
index 0000000..11ec629
--- /dev/null
+++ b/dev_mvc/view/webcontent/content_404.php
@@ -0,0 +1,6 @@
+
+
+404
+
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/content_account_inactive.php b/dev_mvc/view/webcontent/content_account_inactive.php
new file mode 100644
index 0000000..068797f
--- /dev/null
+++ b/dev_mvc/view/webcontent/content_account_inactive.php
@@ -0,0 +1,5 @@
+
+
+ Your account appears to be inactive. Check your email for the verification mail.
+
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/content_boards.php b/dev_mvc/view/webcontent/content_boards.php
new file mode 100644
index 0000000..6bcb0ff
--- /dev/null
+++ b/dev_mvc/view/webcontent/content_boards.php
@@ -0,0 +1,7 @@
+
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/content_createreply.php b/dev_mvc/view/webcontent/content_createreply.php
new file mode 100644
index 0000000..c18cec1
--- /dev/null
+++ b/dev_mvc/view/webcontent/content_createreply.php
@@ -0,0 +1,6 @@
+
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/content_createthread.php b/dev_mvc/view/webcontent/content_createthread.php
new file mode 100644
index 0000000..1fdaeb5
--- /dev/null
+++ b/dev_mvc/view/webcontent/content_createthread.php
@@ -0,0 +1,7 @@
+
+
+
+
+ ">
+
+
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/content_error_login.php b/dev_mvc/view/webcontent/content_error_login.php
new file mode 100644
index 0000000..13d6cda
--- /dev/null
+++ b/dev_mvc/view/webcontent/content_error_login.php
@@ -0,0 +1,4 @@
+Incorrect Email or Password.
+
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/content_header.php b/dev_mvc/view/webcontent/content_header.php
new file mode 100644
index 0000000..2e9369e
--- /dev/null
+++ b/dev_mvc/view/webcontent/content_header.php
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/content_home.php b/dev_mvc/view/webcontent/content_home.php
new file mode 100644
index 0000000..a48a9b9
--- /dev/null
+++ b/dev_mvc/view/webcontent/content_home.php
@@ -0,0 +1,3 @@
+
+ Please sign in to access our forum
+
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/content_register.php b/dev_mvc/view/webcontent/content_register.php
new file mode 100644
index 0000000..9411e07
--- /dev/null
+++ b/dev_mvc/view/webcontent/content_register.php
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/content_reply.php b/dev_mvc/view/webcontent/content_reply.php
new file mode 100644
index 0000000..b3d9bbc
--- /dev/null
+++ b/dev_mvc/view/webcontent/content_reply.php
@@ -0,0 +1 @@
+getReplies();
+?>
+
+
+ =$thread->getTitle()?>
+
+
+ user
+ content
+ date
+
+
+
+ =$thread->getOwner()->getUsername();?>
+
+
+ =$thread->getContent()?>
+
+
+ =$thread->getDate_created()->format("Y M d H:i:s")?>
+
+
+getOwner()->getUsername();
+ $content = $reply->getContent();
+ $date_created = $reply->getDate()->format("Y M d H:i:s");
+ echo("");
+ echo("$owner ");
+ echo("$content ");
+ echo("$date_created ");
+ echo(" ");
+}
+?>
+
+getId();
+echo "Create Reply "
+?>
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/content_signin.php b/dev_mvc/view/webcontent/content_signin.php
new file mode 100644
index 0000000..48b427e
--- /dev/null
+++ b/dev_mvc/view/webcontent/content_signin.php
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/content_signout.php b/dev_mvc/view/webcontent/content_signout.php
new file mode 100644
index 0000000..3b0d91d
--- /dev/null
+++ b/dev_mvc/view/webcontent/content_signout.php
@@ -0,0 +1 @@
+Signed out succesfully!
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/content_verify.php b/dev_mvc/view/webcontent/content_verify.php
new file mode 100644
index 0000000..03097a9
--- /dev/null
+++ b/dev_mvc/view/webcontent/content_verify.php
@@ -0,0 +1,2 @@
+
+ hF
+
+
+ Home
+ Sign out
+
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/header/header_signedout.php b/dev_mvc/view/webcontent/header/header_signedout.php
new file mode 100644
index 0000000..f0e3f4d
--- /dev/null
+++ b/dev_mvc/view/webcontent/header/header_signedout.php
@@ -0,0 +1,8 @@
+
+ hF
+
+
+ Home
+ Register
+ Sign in
+
\ No newline at end of file
diff --git a/dev_mvc/view/webcontent/modules/modules_boards/module_boardtable.php b/dev_mvc/view/webcontent/modules/modules_boards/module_boardtable.php
new file mode 100644
index 0000000..aeae4b4
--- /dev/null
+++ b/dev_mvc/view/webcontent/modules/modules_boards/module_boardtable.php
@@ -0,0 +1,48 @@
+ =$board->name?>
+ Create Thread
+
+
+ Thread
+ Started by
+ Last reply
+
+getBoardID() == $board->id){
+ $currentRow = [];
+ $currentRow['threadID'] = $thread->getID();
+ $currentRow['threadTitle'] = $thread->getTitle();
+ foreach(MVCController::$viewData['users'] as $user){
+ if($user->getID() == $thread->getUserID()){
+ $currentRow['username'] = $user->getUsername();
+ break;
+ }
+ }
+ foreach(MVCController::$viewData['replies'] as $reply){
+ if(isset($reply)){
+ if($reply->getThreadID() == $thread->getId())
+ {
+ break;
+ }else{
+ $currentRow['lastUpdated'] = $thread->getDate_created()->format("Y M d H:i:s");
+ }
+ }
+ }
+ ?>
+
+
+ =$currentRow['threadTitle']?>
+
+
+ =$currentRow['username'] ?>
+
+
+
+ =$currentRow['lastUpdated']?>
+
+
+
+
diff --git a/dev_mvc/viewmodel/viewmodel_boards.php b/dev_mvc/viewmodel/viewmodel_boards.php
new file mode 100644
index 0000000..4a582be
--- /dev/null
+++ b/dev_mvc/viewmodel/viewmodel_boards.php
@@ -0,0 +1,47 @@
+getId()){
+ $skipUser = true;
+ }
+ }
+ if(!$skipUser){
+ array_push($users, new User($row['ID'], $row['username'], $row['email'], $row['password'], $row['reg_date'], $row['login_date'], $row['reg_ip'], $row['permissions']));
+ }
+}
+
+
+
+//MVCController::$viewData['boards'] = [new Board(0, "General", 0),new Board(1, "Admin board", 10)];
+MVCController::$viewData['boards'] = $boards;
+MVCController::$viewData['threads'] = $threads;
+MVCController::$viewData['users'] = $users;
+MVCController::$viewData['replies'] = [new Reply(0, 0, 0, "op is gay","01-01-1990")];
+?>
\ No newline at end of file
diff --git a/dev_mvc/viewmodel/viewmodel_createreply.php b/dev_mvc/viewmodel/viewmodel_createreply.php
new file mode 100644
index 0000000..09aec04
--- /dev/null
+++ b/dev_mvc/viewmodel/viewmodel_createreply.php
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/dev_mvc/viewmodel/viewmodel_home.php b/dev_mvc/viewmodel/viewmodel_home.php
new file mode 100644
index 0000000..ca17b06
--- /dev/null
+++ b/dev_mvc/viewmodel/viewmodel_home.php
@@ -0,0 +1,6 @@
+overrideView("boards");
+}
\ No newline at end of file
diff --git a/dev_mvc/viewmodel/viewmodel_showthread.php b/dev_mvc/viewmodel/viewmodel_showthread.php
new file mode 100644
index 0000000..68dc5cf
--- /dev/null
+++ b/dev_mvc/viewmodel/viewmodel_showthread.php
@@ -0,0 +1,37 @@
+getUserID());
+ $replyOwner = new User($replyOwnerData['ID'], $replyOwnerData['username'], $replyOwnerData['email'], $replyOwnerData['password'], $replyOwnerData['reg_date'], $replyOwnerData['login_date'], $replyOwnerData['reg_ip'], $replyOwnerData['permissions']);
+ $reply->setOwner($replyOwner);
+}
+
+// get the person who started the thread
+$threadOwnerData = DBUser::getUserByUID($thread->getUserID());
+// create user object
+$threadOwner = new User($threadOwnerData['ID'], $threadOwnerData['username'], $threadOwnerData['email'], $threadOwnerData['password'], $threadOwnerData['reg_date'], $threadOwnerData['login_date'], $threadOwnerData['reg_ip'], $threadOwnerData['permissions']);
+// assign owner and replies
+$thread->setReplies($replies);
+$thread->setOwner($threadOwner);
+
+// Store data so it can be used in the view
+MVCController::$viewData['thread'] = $thread;
+?>
\ No newline at end of file
diff --git a/dev_mvc/viewmodel/viewmodel_signout.php b/dev_mvc/viewmodel/viewmodel_signout.php
new file mode 100644
index 0000000..2896d01
--- /dev/null
+++ b/dev_mvc/viewmodel/viewmodel_signout.php
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/dev_mvc/model/actions/model_verify.php b/dev_mvc/viewmodel/viewmodel_verify.php
similarity index 66%
rename from dev_mvc/model/actions/model_verify.php
rename to dev_mvc/viewmodel/viewmodel_verify.php
index 0c2a780..a46d161 100644
--- a/dev_mvc/model/actions/model_verify.php
+++ b/dev_mvc/viewmodel/viewmodel_verify.php
@@ -1,5 +1,6 @@
\ No newline at end of file