From d07692af9409016a50196305fab49c5ed850bd02 Mon Sep 17 00:00:00 2001 From: Andreas Date: Mon, 23 Sep 2019 14:12:52 +0200 Subject: [PATCH] tidying up --- dev_mvc/controller/MVCController.php | 2 +- dev_mvc/controller/UserSession.php | 2 +- dev_mvc/index.php | 36 +---------------------- dev_mvc/model/testactions/TA_CreateDB.php | 1 - 4 files changed, 3 insertions(+), 38 deletions(-) diff --git a/dev_mvc/controller/MVCController.php b/dev_mvc/controller/MVCController.php index d231b1a..0ab33b0 100644 --- a/dev_mvc/controller/MVCController.php +++ b/dev_mvc/controller/MVCController.php @@ -8,7 +8,7 @@ class MVCController{ private $timesOverridden = 0; private static $mvcController; public static $viewData = []; - function MVCController(){ + function __construct(){ self::$mvcController = $this; //prepare current view and view model if(isset($_GET['p']) && $_GET['p'] != ''){ diff --git a/dev_mvc/controller/UserSession.php b/dev_mvc/controller/UserSession.php index 9d9c60a..5d7200c 100644 --- a/dev_mvc/controller/UserSession.php +++ b/dev_mvc/controller/UserSession.php @@ -5,7 +5,7 @@ Class UserSession{ public $token = "undefined"; public $expires; public static $session; - public function UserSession($uid, $token = "undefined"){ + public function __construct($uid, $token = "undefined"){ $this->uid = $uid; $this->token = $token; $this->setExpiry(); diff --git a/dev_mvc/index.php b/dev_mvc/index.php index d503933..603a16f 100644 --- a/dev_mvc/index.php +++ b/dev_mvc/index.php @@ -3,45 +3,11 @@ error_reporting(E_ALL); ini_set('log_errors','1'); ini_set('display_errors','0'); define('ROOT_DIR', __DIR__); -register_shutdown_function(function() { - $error = error_get_last(); - switch($error['type']){ - case E_ERROR: - http_response_code(500); - header('HTTP/1.1 500 Internal Server Error'); - break; - case E_PARSE: - http_response_code(500); - header('HTTP/1.1 500 Internal Server Error'); - break; - case E_CORE_ERROR: - http_response_code(500); - header('HTTP/1.1 500 Internal Server Error'); - break; - case E_COMPILE_ERROR: - http_response_code(500); - header('HTTP/1.1 500 Internal Server Error'); - break; - case E_USER_ERROR: - http_response_code(500); - header('HTTP/1.1 500 Internal Server Error'); - break; - case E_RECOVERABLE_ERROR: - http_response_code(500); - header('HTTP/1.1 500 Internal Server Error'); - break; - } - - /* if ($error['type'] == E_ERROR || $error['type'] == E_PARSE || $error['type'] == E_CORE_ERROR || $error['type'] == E_COMPILE_ERROR || $error['type'] == E_RECOVERABLE_ERROR) { - header('HTTP/1.1 500 Internal Server Error'); - http_response_code(500); - } */ -}); +session_start(); require_once(ROOT_DIR.'/model/testactions/TestAction.php'); //date_default_timezone_set('Europe/Amsterdam'); require_once(ROOT_DIR.'/controller/MVCController.php'); require_once(ROOT_DIR.'/controller/UserSession.php'); -session_start(); $mvcController = new MVCController(); $mvcController->executeModel(); if(!isset($_POST['testaction'])){ diff --git a/dev_mvc/model/testactions/TA_CreateDB.php b/dev_mvc/model/testactions/TA_CreateDB.php index af7ad07..f90efb0 100644 --- a/dev_mvc/model/testactions/TA_CreateDB.php +++ b/dev_mvc/model/testactions/TA_CreateDB.php @@ -1,6 +1,5 @@