update relative links and other things
This commit is contained in:
parent
72319118a4
commit
fbffa866f1
@ -12,28 +12,28 @@ class MVCController{
|
|||||||
self::$mvcController = $this;
|
self::$mvcController = $this;
|
||||||
//prepare current view and view model
|
//prepare current view and view model
|
||||||
if(isset($_GET['p']) && $_GET['p'] != ''){
|
if(isset($_GET['p']) && $_GET['p'] != ''){
|
||||||
$this->view = "./view/webcontent/content_".$_GET['p'].".php";
|
$this->view = ROOT_DIR."./view/webcontent/content_".$_GET['p'].".php";
|
||||||
$this->viewmodel = "./viewmodel/viewmodel_".$_GET['p'].".php";
|
$this->viewmodel = ROOT_DIR."./viewmodel/viewmodel_".$_GET['p'].".php";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$this->view = "./view/webcontent/content_home.php";
|
$this->view = ROOT_DIR."./view/webcontent/content_home.php";
|
||||||
$this->viewmodel = "./viewmodel/viewmodel_home.php";
|
$this->viewmodel = ROOT_DIR."./viewmodel/viewmodel_home.php";
|
||||||
}
|
}
|
||||||
|
|
||||||
//prepare current action model
|
//prepare current action model
|
||||||
if(isset($_POST['action'])){
|
if(isset($_POST['action'])){
|
||||||
$this->model = "./model/actions/model_".$_POST['action'].".php";
|
$this->model = ROOT_DIR."./model/actions/model_".$_POST['action'].".php";
|
||||||
}
|
}
|
||||||
else if(isset($_GET['action'])){
|
else if(isset($_GET['action'])){
|
||||||
$this->model = "./model/actions/model_".$_GET['action'].".php";
|
$this->model = ROOT_DIR."./model/actions/model_".$_GET['action'].".php";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$this->model = "./model/actions/model_empty.php";
|
$this->model = ROOT_DIR."./model/actions/model_empty.php";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(isset($_POST['testaction'])){
|
if(isset($_POST['testaction'])){
|
||||||
$this->testaction = "./model/testactions/TA_".$_POST['testaction'].".php";
|
$this->testaction = ROOT_DIR."./model/testactions/TA_".$_POST['testaction'].".php";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -44,8 +44,8 @@ class MVCController{
|
|||||||
}
|
}
|
||||||
function overrideView($view_target):void
|
function overrideView($view_target):void
|
||||||
{
|
{
|
||||||
$this->view = "./view/webcontent/content_".$view_target.".php";
|
$this->view = ROOT_DIR."./view/webcontent/content_".$view_target.".php";
|
||||||
$this->viewmodel = "./viewmodel/viewmodel_".$view_target.".php";
|
$this->viewmodel = ROOT_DIR."./viewmodel/viewmodel_".$view_target.".php";
|
||||||
$this->viewOverridden = true;
|
$this->viewOverridden = true;
|
||||||
}
|
}
|
||||||
function executeAction():void
|
function executeAction():void
|
||||||
@ -102,7 +102,7 @@ class MVCController{
|
|||||||
include_once($this->view);
|
include_once($this->view);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
include_once("./view/webcontent/content_404.php");
|
include_once(ROOT_DIR."./view/webcontent/content_404.php");
|
||||||
echo("view: ".$this->view." not found.");
|
echo("view: ".$this->view." not found.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once('./controller/db/Database.php');
|
require_once(ROOT_DIR.'./controller/db/Database.php');
|
||||||
Class UserSession{
|
Class UserSession{
|
||||||
public $uid = -1;
|
public $uid = -1;
|
||||||
public $token = "undefined";
|
public $token = "undefined";
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once './controller/db/Database.php';
|
require_once ROOT_DIR.'./controller/db/Database.php';
|
||||||
class DBBoard extends Database{
|
class DBBoard extends Database{
|
||||||
static function getBoards():array
|
static function getBoards():array
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once './controller/db/Database.php';
|
require_once ROOT_DIR.'./controller/db/Database.php';
|
||||||
|
|
||||||
class DBReply extends Database{
|
class DBReply extends Database{
|
||||||
static function createReply($uid, $threadID, $content){
|
static function createReply($uid, $threadID, $content){
|
||||||
|
|||||||
@ -1,12 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once './model/forum/Thread.php';
|
require_once ROOT_DIR.'./model/forum/Thread.php';
|
||||||
class DBThread extends Database {
|
class DBThread extends Database {
|
||||||
static function getThreadByID($id){
|
static function getThreadByID($id){
|
||||||
$con = self::connectToDB();
|
$con = self::connectToDB();
|
||||||
$query = $con->prepare("SELECT * FROM thread WHERE ID = :id");
|
$query = $con->prepare("SELECT * FROM thread WHERE ID = :id");
|
||||||
$query->bindParam(":id", $id);
|
$query->bindParam(":id", $id);
|
||||||
$query->execute();
|
$query->execute();
|
||||||
return $query->fetch(PDO::FETCH_BOTH);
|
$result = $query->fetch(PDO::FETCH_BOTH);
|
||||||
|
return new Thread($result['ID'], $result['users_ID'], $result['board_ID'], $result['title'], $result['text'], $result['date_created']);
|
||||||
}
|
}
|
||||||
static function getThreadsByBoard($boardID){
|
static function getThreadsByBoard($boardID){
|
||||||
$con = self::connectToDB();
|
$con = self::connectToDB();
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once('./model/forum/User.php');
|
require_once(ROOT_DIR.'./model/forum/User.php');
|
||||||
class DBUser extends Database
|
class DBUser extends Database
|
||||||
{
|
{
|
||||||
static function getUserByUID($uid){
|
static function getUserByUID($uid){
|
||||||
@ -11,6 +11,23 @@ class DBUser extends Database
|
|||||||
$user = new User($result['ID'], $result['username'], $result['email'], $result['password'], $result['reg_date'], $result['login_date'], $result['reg_ip'], $result['permissions'], $result['active']);
|
$user = new User($result['ID'], $result['username'], $result['email'], $result['password'], $result['reg_date'], $result['login_date'], $result['reg_ip'], $result['permissions'], $result['active']);
|
||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
|
static function getUserByEmail($email){
|
||||||
|
$con = self::connectToDB();
|
||||||
|
$query = $con->prepare("SELECT * FROM users WHERE email = :email");
|
||||||
|
$query->bindParam(":email", $email);
|
||||||
|
$query->execute();
|
||||||
|
$result = $query->fetch(PDO::FETCH_BOTH);
|
||||||
|
$user = new User($result['ID'], $result['username'], $result['email'], $result['password'], $result['reg_date'], $result['login_date'], $result['reg_ip'], $result['permissions'], $result['active']);
|
||||||
|
if($query->rowCount() == 1){
|
||||||
|
//Email adres is niet in gebruik, return false
|
||||||
|
return $user;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
//Email is al in gebruik of komt meer dan een keer voor. Beide gevallen zijn een probleem dus return true.
|
||||||
|
trigger_error("Multiple users for email $email returned by DB, value should be unique", E_USER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//Controleert of het email adres al in de database voorkomt. Returnt true indien wel.
|
//Controleert of het email adres al in de database voorkomt. Returnt true indien wel.
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
define ('ROOT_DIR', __DIR__);
|
||||||
register_shutdown_function(function() {
|
register_shutdown_function(function() {
|
||||||
$error = error_get_last();
|
$error = error_get_last();
|
||||||
switch($error['type']){
|
switch($error['type']){
|
||||||
@ -33,15 +34,15 @@ register_shutdown_function(function() {
|
|||||||
http_response_code(500);
|
http_response_code(500);
|
||||||
} */
|
} */
|
||||||
});
|
});
|
||||||
require_once('./model/testactions/TestAction.php');
|
require_once(ROOT_DIR.'./model/testactions/TestAction.php');
|
||||||
//date_default_timezone_set('Europe/Amsterdam');
|
//date_default_timezone_set('Europe/Amsterdam');
|
||||||
require_once('./controller/MVCController.php');
|
require_once(ROOT_DIR.'./controller/MVCController.php');
|
||||||
require_once('./controller/UserSession.php');
|
require_once(ROOT_DIR.'./controller/UserSession.php');
|
||||||
session_start();
|
session_start();
|
||||||
$mvcController = new MVCController();
|
$mvcController = new MVCController();
|
||||||
$mvcController->executeModel();
|
$mvcController->executeModel();
|
||||||
if(!isset($_POST['testaction'])){
|
if(!isset($_POST['testaction'])){
|
||||||
include_once("./view/content_pagetemplate.php");
|
include_once(ROOT_DIR."./view/content_pagetemplate.php");
|
||||||
}
|
}
|
||||||
//require_once('aaaadea');
|
//require_once('aaaadea');
|
||||||
//http_response_code(200);
|
//http_response_code(200);
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once './controller/UserSession.php';
|
require_once ROOT_DIR.'./controller/UserSession.php';
|
||||||
require_once('./controller/HUtils.php');
|
require_once(ROOT_DIR.'./controller/HUtils.php');
|
||||||
require_once './controller/db/DBReply.php';
|
require_once ROOT_DIR.'./controller/db/DBReply.php';
|
||||||
require_once './model/forum/Reply.php';
|
require_once ROOT_DIR.'./model/forum/Reply.php';
|
||||||
//dit bestand bestaat grotendeels uit dummy code.
|
//dit bestand bestaat grotendeels uit dummy code.
|
||||||
//Ik heb onvoldoende tijd gehad tijdens de afgelopen paar weken en het was extreem druk in de klas tijdens de les.
|
//Ik heb onvoldoende tijd gehad tijdens de afgelopen paar weken en het was extreem druk in de klas tijdens de les.
|
||||||
$uid = $_SESSION['usersession']->uid;
|
$uid = $_SESSION['usersession']->uid;
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once './controller/UserSession.php';
|
require_once ROOT_DIR.'./controller/UserSession.php';
|
||||||
require_once('./controller/HUtils.php');
|
require_once(ROOT_DIR.'./controller/HUtils.php');
|
||||||
require_once './controller/db/DBThread.php';
|
require_once ROOT_DIR.'./controller/db/DBThread.php';
|
||||||
require_once './model/forum/Thread.php';
|
require_once ROOT_DIR.'./model/forum/Thread.php';
|
||||||
//dit bestand bestaat grotendeels uit dummy code.
|
//dit bestand bestaat grotendeels uit dummy code.
|
||||||
//Ik heb onvoldoende tijd gehad tijdens de afgelopen paar weken en het was extreem druk in de klas tijdens de les.
|
//Ik heb onvoldoende tijd gehad tijdens de afgelopen paar weken en het was extreem druk in de klas tijdens de les.
|
||||||
$uid = $_SESSION['usersession']->uid;
|
$uid = $_SESSION['usersession']->uid;
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
//Include classes
|
//Include classes
|
||||||
require_once("./controller/db/Database.php");
|
require_once(ROOT_DIR."./controller/db/Database.php");
|
||||||
require_once("./controller/db/DBUser.php");
|
require_once(ROOT_DIR."./controller/db/DBUser.php");
|
||||||
require_once("./controller/HUtils.php");
|
require_once(ROOT_DIR."./controller/HUtils.php");
|
||||||
if(HUtils::issetPost(['email', 'pass', 'pass2', 'name'])){
|
if(HUtils::issetPost(['email', 'pass', 'pass2', 'name'])){
|
||||||
$email = $_POST['email'];
|
$email = $_POST['email'];
|
||||||
$pass = $_POST['pass'];
|
$pass = $_POST['pass'];
|
||||||
@ -17,8 +17,8 @@ if(HUtils::issetPost(['email', 'pass', 'pass2', 'name'])){
|
|||||||
}
|
}
|
||||||
//TO DO: Create verification key
|
//TO DO: Create verification key
|
||||||
DBUser::registerUser($email, $pass, $name);
|
DBUser::registerUser($email, $pass, $name);
|
||||||
$uid = DBUser::getUID($email, $pass);
|
$user = DBUser::getUserByEmail($email);
|
||||||
DBUser::registerActivationKey($uid,$verificationKey);
|
DBUser::registerActivationKey($user->getId(),$verificationKey);
|
||||||
$message = 'Please follow the link to verify your account: http://localhost/webforum_redux/hforumphp/dev_mvc/index.php?p=verify&key='.$verificationKey;
|
$message = 'Please follow the link to verify your account: http://localhost/webforum_redux/hforumphp/dev_mvc/index.php?p=verify&key='.$verificationKey;
|
||||||
$headers = 'From: webmaster@example.com' . "\r\n" .
|
$headers = 'From: webmaster@example.com' . "\r\n" .
|
||||||
'Reply-To: webmaster@example.com' . "\r\n" .
|
'Reply-To: webmaster@example.com' . "\r\n" .
|
||||||
|
|||||||
@ -1,12 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
$debuginfo = false;
|
$debuginfo = false;
|
||||||
require_once("./controller/UserSession.php");
|
require_once(ROOT_DIR."./controller/UserSession.php");
|
||||||
require_once("./controller/db/Database.php");
|
require_once(ROOT_DIR."./controller/db/Database.php");
|
||||||
require_once("./controller/db/DBUser.php");
|
require_once(ROOT_DIR."./controller/db/DBUser.php");
|
||||||
require_once("./controller/HUtils.php");
|
require_once(ROOT_DIR."./controller/HUtils.php");
|
||||||
$skipoverride = false;
|
$skipoverride = false;
|
||||||
if(!UserSession::isUserSignedIn()){
|
if(!UserSession::isUserSignedIn()){
|
||||||
if(HUtils::issetPost(['email','password'])){
|
if(HUtils::issetPost(['email','password'])){
|
||||||
|
$user =
|
||||||
if(DBUser::isLoginValid($_POST['email'], $_POST['password'])){
|
if(DBUser::isLoginValid($_POST['email'], $_POST['password'])){
|
||||||
//obtain UID
|
//obtain UID
|
||||||
$uid = DBUser::getUID($_POST['email'], $_POST['password']);
|
$uid = DBUser::getUID($_POST['email'], $_POST['password']);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once('./controller/db/Database.php');
|
require_once(ROOT_DIR.'./controller/db/Database.php');
|
||||||
$_SESSION['usersession'] = null;
|
$_SESSION['usersession'] = null;
|
||||||
Database::invalidateSession($_COOKIE['usersession']);
|
Database::invalidateSession($_COOKIE['usersession']);
|
||||||
session_destroy();
|
session_destroy();
|
||||||
|
|||||||
@ -59,6 +59,7 @@ class Thread {
|
|||||||
public function setOwner($owner) {
|
public function setOwner($owner) {
|
||||||
$this->owner = $owner;
|
$this->owner = $owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getId():int {
|
public function getId():int {
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,7 @@ class User {
|
|||||||
public $reg_ip;
|
public $reg_ip;
|
||||||
public $permissions;
|
public $permissions;
|
||||||
public $active;
|
public $active;
|
||||||
function User($id, $username, $email, $password, $reg_date, $login_date, $reg_ip, $permissions, $active){
|
function __construct($id, $username, $email, $password, $reg_date, $login_date, $reg_ip, $permissions, $active){
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
$this->username = $username;
|
$this->username = $username;
|
||||||
$this->email = $email;
|
$this->email = $email;
|
||||||
@ -24,28 +24,28 @@ class User {
|
|||||||
/**
|
/**
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function getId() {
|
public function getId():int {
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function getUsername() {
|
public function getUsername():string {
|
||||||
return $this->username;
|
return $this->username;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function getEmail() {
|
public function getEmail():string {
|
||||||
return $this->email;
|
return $this->email;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function getPassword() {
|
public function getPassword():string {
|
||||||
return $this->password;
|
return $this->password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
require_once(ROOT_DIR.'./controller/db/DBUser.php');
|
||||||
|
require_once(ROOT_DIR.'./model/forum/User.php');
|
||||||
class TA_TestDBUser extends TestAction{
|
class TA_TestDBUser extends TestAction{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -6,6 +8,9 @@ class TA_TestDBUser extends TestAction{
|
|||||||
}
|
}
|
||||||
public function execute()
|
public function execute()
|
||||||
{
|
{
|
||||||
$user = DBUser::getUserByUID(0 );
|
$user = DBUser::getUserByUID(9 );
|
||||||
|
self::logMessage($user->getUsername());
|
||||||
|
self::logMessage($user->getEmail());
|
||||||
|
self::logMessage($user->getPassword());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
class TestAction{
|
class TestAction{
|
||||||
function TestAction(){
|
function __construct(){
|
||||||
if(isset($_POST['auth'])){
|
if(isset($_POST['auth'])){
|
||||||
if($_POST['auth'] == getenv('ADMIN_ACTION_KEY')){
|
if($_POST['auth'] == getenv('ADMIN_ACTION_KEY')){
|
||||||
$this->execute();
|
$this->execute();
|
||||||
@ -32,7 +32,7 @@ class TestAction{
|
|||||||
echo("[".self::$log[$i]['status']."] ".self::$log[$i]['message']."\n");
|
echo("[".self::$log[$i]['status']."] ".self::$log[$i]['message']."\n");
|
||||||
if(self::$log[$i]['status'] == 'FAILURE'){
|
if(self::$log[$i]['status'] == 'FAILURE'){
|
||||||
echo('<div id="test_exitstatus">ACTION FAILED</div>');
|
echo('<div id="test_exitstatus">ACTION FAILED</div>');
|
||||||
break;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo('<div id="test_exitstatus">ACTION SUCCESSFUL</div>');
|
echo('<div id="test_exitstatus">ACTION SUCCESSFUL</div>');
|
||||||
|
|||||||
@ -1,58 +0,0 @@
|
|||||||
<?php
|
|
||||||
if(isset($_POST['auth'])){
|
|
||||||
if($_POST['auth'] == getenv('ADMIN_ACTION_KEY')){
|
|
||||||
populateDB();
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
self::logMessage('you have no authorization to do that', "OK");
|
|
||||||
}
|
|
||||||
|
|
||||||
function populateDB(){
|
|
||||||
try{
|
|
||||||
if(getenv("SQL_CREDENTIALS") !== false){
|
|
||||||
$sql_server = getenv("SQL_SERVER");
|
|
||||||
$sql_username = getenv("SQL_USERNAME");
|
|
||||||
$sql_password = getenv("SQL_PASSWORD");
|
|
||||||
$sql_database = getenv("SQL_DATABASE");
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$sql_server = "localhost";
|
|
||||||
$sql_username = "root";
|
|
||||||
$sql_password = "kankerlow";
|
|
||||||
$sql_database = "webforum";
|
|
||||||
}
|
|
||||||
$host = $sql_server;
|
|
||||||
$db = $sql_database;
|
|
||||||
$user = $sql_username;
|
|
||||||
$pass = $sql_password;
|
|
||||||
|
|
||||||
//connect to sql server
|
|
||||||
$con = new PDO( "mysql:host=$host;charset=utf8", $user, $pass );
|
|
||||||
$con->exec("USE $db");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
self::logMessage('table doesnt exist', "OK");
|
|
||||||
$query = $con->query("INSERT INTO users (username, email, password, login_date, reg_ip, active) VALUES ( 'andreas', 'andreas@andreas.nl', 'jenk', '2019-01-01 14:35:33', '192.168.0.2', 1),
|
|
||||||
( 'bram', 'bram@bram.nl', 'jenk', '2019-01-01 14:35:33', '192.168.0.1', 1)");
|
|
||||||
self::logMessage("created test users", "OK");
|
|
||||||
$query = $con->query("INSERT INTO `board` (`name`, `description`, `permLevel`) VALUES ('General Discussion', 'Plek om algemene discussie te voeren.', '0'),
|
|
||||||
('Off Topic', 'Voor alle irrelevante zooi.', '0')");
|
|
||||||
self::logMessage("created test boards", "OK");
|
|
||||||
$query = $con->query("INSERT INTO `thread` (`users_ID`, `board_ID`, `title`, `text`, `date_created`) VALUES ('1', '1', 'Test thread', 'Deze thread is een test.', '2019-06-20 13:55:37'),
|
|
||||||
('1', '2', 'Waa', 'Frist niffo', '2019-06-20 13:56:42')");
|
|
||||||
self::logMessage("created test threads", "OK");
|
|
||||||
$query = $con->query("INSERT INTO `reply` (`thread_ID`, `users_ID`, `content`, `date_created`) VALUES ('1', '1', 'heehee eks dee', '2019-06-21 11:01:57'),
|
|
||||||
('1', '1', 'hoi\r\n', '2019-06-21 11:07:25'),
|
|
||||||
('2', '2', 'fristi niBBa', '2019-06-21 11:08:08'),
|
|
||||||
('1', '1', 'was jouw prebleem', '2019-06-21 14:41:00'),
|
|
||||||
('1', '2', 'Mijn naam is bram', '2019-06-21 17:58:12'),
|
|
||||||
('1', '2', 'huh wuddufuq', '2019-06-21 17:58:29'),
|
|
||||||
('1', '1', 'huts a neef', '2019-06-21 17:59:27')");
|
|
||||||
self::logMessage("created test replies", "OK");
|
|
||||||
}
|
|
||||||
catch(PDOException $e){
|
|
||||||
self::logMessage("created test replies", "FAILURE");
|
|
||||||
die("pdo exception, cannot connect to sql:<br> $e");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
<?php
|
|
||||||
if(isset($_POST['auth'])){
|
|
||||||
if($_POST['auth'] == getenv('ADMIN_ACTION_KEY')){
|
|
||||||
execute();
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
echol('you have no authorization to do that');
|
|
||||||
}
|
|
||||||
function execute(){
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once("./controller/MVCController.php");
|
require_once(ROOT_DIR."./controller/MVCController.php");
|
||||||
require_once("index.php");
|
require_once("index.php");
|
||||||
?>
|
?>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@ -10,7 +10,7 @@ require_once("index.php");
|
|||||||
<body>
|
<body>
|
||||||
<header class="row">
|
<header class="row">
|
||||||
<?php
|
<?php
|
||||||
include_once("./view/webcontent/content_header.php");
|
include_once(ROOT_DIR."./view/webcontent/content_header.php");
|
||||||
?>
|
?>
|
||||||
</header>
|
</header>
|
||||||
<div class="main">
|
<div class="main">
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once './model/forum/Thread.php';
|
require_once ROOT_DIR.'./model/forum/Thread.php';
|
||||||
require_once './model/forum/User.php';
|
require_once ROOT_DIR.'./model/forum/User.php';
|
||||||
foreach (MVCController::$viewData['boards'] as $board){
|
foreach (MVCController::$viewData['boards'] as $board){
|
||||||
include './view/webcontent/modules/modules_boards/module_boardtable.php';
|
include './view/webcontent/modules/modules_boards/module_boardtable.php';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
Incorrect Email or Password.
|
Incorrect Email or Password.
|
||||||
<?php
|
<?php
|
||||||
include_once('./view/webcontent/content_signin.php');
|
include_once(ROOT_DIR.'./view/webcontent/content_signin.php');
|
||||||
?>
|
?>
|
||||||
@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once('./controller/UserSession.php');
|
require_once(ROOT_DIR.'./controller/UserSession.php');
|
||||||
if(UserSession::isUserSignedIn()){
|
if(UserSession::isUserSignedIn()){
|
||||||
include('./view/webcontent/header/header_signedin.php');
|
include(ROOT_DIR.'./view/webcontent/header/header_signedin.php');
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
include('./view/webcontent/header/header_signedout.php');
|
include(ROOT_DIR.'./view/webcontent/header/header_signedout.php');
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once './model/forum/Thread.php';
|
require_once ROOT_DIR.'./model/forum/Thread.php';
|
||||||
require_once './model/forum/Reply.php';
|
require_once ROOT_DIR.'./model/forum/Reply.php';
|
||||||
require_once './model/forum/User.php';
|
require_once ROOT_DIR.'./model/forum/User.php';
|
||||||
//$thread = new Thread();
|
//$thread = new Thread();
|
||||||
$thread = MVCController::$viewData['thread'];
|
$thread = MVCController::$viewData['thread'];
|
||||||
$replies = $thread->getReplies();
|
$replies = $thread->getReplies();
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once './controller/db/DBBoard.php';
|
require_once ROOT_DIR.'./controller/db/DBBoard.php';
|
||||||
require_once './controller/db/DBThread.php';
|
require_once ROOT_DIR.'./controller/db/DBThread.php';
|
||||||
require_once './controller/db/DBUser.php';
|
require_once ROOT_DIR.'./controller/db/DBUser.php';
|
||||||
require_once './model/forum/Board.php';
|
require_once ROOT_DIR.'./model/forum/Board.php';
|
||||||
require_once './model/forum/Thread.php';
|
require_once ROOT_DIR.'./model/forum/Thread.php';
|
||||||
require_once './model/forum/User.php';
|
require_once ROOT_DIR.'./model/forum/User.php';
|
||||||
require_once './model/forum/Reply.php';
|
require_once ROOT_DIR.'./model/forum/Reply.php';
|
||||||
|
|
||||||
$boardTable = DBBoard::getBoards();
|
$boardTable = DBBoard::getBoards();
|
||||||
$threadsTable = [];
|
$threadsTable = [];
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once './controller/UserSession.php';
|
require_once ROOT_DIR.'./controller/UserSession.php';
|
||||||
require_once './controller/MVCController.php';
|
require_once ROOT_DIR.'./controller/MVCController.php';
|
||||||
if(UserSession::isUserSignedIn()){
|
if(UserSession::isUserSignedIn()){
|
||||||
MVCController::getMVCController()->overrideView("boards");
|
MVCController::getMVCController()->overrideView("boards");
|
||||||
}
|
}
|
||||||
@ -1,17 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once './controller/db/DBThread.php';
|
require_once ROOT_DIR.'./controller/db/DBThread.php';
|
||||||
require_once './controller/db/DBReply.php';
|
require_once ROOT_DIR.'./controller/db/DBReply.php';
|
||||||
require_once './controller/db/DBUser.php';
|
require_once ROOT_DIR.'./controller/db/DBUser.php';
|
||||||
require_once './model/forum/User.php';
|
require_once ROOT_DIR.'./model/forum/User.php';
|
||||||
require_once './model/forum/Reply.php';
|
require_once ROOT_DIR.'./model/forum/Reply.php';
|
||||||
if(isset($_GET['thread'])) {
|
if(isset($_GET['thread'])) {
|
||||||
$threadid = $_GET['thread'];
|
$threadid = $_GET['thread'];
|
||||||
} else {
|
} else {
|
||||||
$threadid = - 1;
|
$threadid = - 1;
|
||||||
}
|
}
|
||||||
// Get what we need from the database
|
// Get what we need from the databas
|
||||||
$threadData = DBThread::getThreadByID($threadid);
|
$thread = DBThread::getThreadByID($threadid);
|
||||||
$thread = new Thread($threadData['ID'], $threadData['users_ID'], $threadData['board_ID'], $threadData['title'], $threadData['text'], $threadData['date_created']);
|
|
||||||
$replyData = DBReply::getRepliesByThreadID($threadid);
|
$replyData = DBReply::getRepliesByThreadID($threadid);
|
||||||
// array to store our reply objects in
|
// array to store our reply objects in
|
||||||
$replies = [ ];
|
$replies = [ ];
|
||||||
@ -31,4 +30,3 @@ $thread->setOwner($threadOwner);
|
|||||||
|
|
||||||
// Store data so it can be used in the view
|
// Store data so it can be used in the view
|
||||||
MVCController::$viewData['thread'] = $thread;
|
MVCController::$viewData['thread'] = $thread;
|
||||||
?>
|
|
||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once('./controller/db/Database.php');
|
require_once(ROOT_DIR.'./controller/db/Database.php');
|
||||||
Database::invalidateSession($_COOKIE['usersession']);
|
Database::invalidateSession($_COOKIE['usersession']);
|
||||||
session_destroy();
|
session_destroy();
|
||||||
?>
|
?>
|
||||||
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
require_once './controller/db/Database.php';
|
require_once ROOT_DIR.'./controller/db/Database.php';
|
||||||
require_once './controller/db/DBUser.php';
|
require_once ROOT_DIR.'./controller/db/DBUser.php';
|
||||||
$key = '';
|
$key = '';
|
||||||
if(isset($_GET['key'])){
|
if(isset($_GET['key'])){
|
||||||
$key = $_GET['key'];
|
$key = $_GET['key'];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user