commit 5b1f18a9357e81dab9a391d2d1d849f9c3a6507d Author: William Date: Tue Nov 29 12:49:29 2022 +0000 Init diff --git a/README.md b/README.md new file mode 100644 index 0000000..fb3f7ca --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Very kewl website + +Made by yours truly \ No newline at end of file diff --git a/app/WillySoft/Http/ErrorHandler.php b/app/WillySoft/Http/ErrorHandler.php new file mode 100644 index 0000000..9025ca8 --- /dev/null +++ b/app/WillySoft/Http/ErrorHandler.php @@ -0,0 +1,54 @@ +Error[$errno]: $errstr in $errfile at line $errline"; + } + + private static function exception($exception) + { + self::$error_messages[] = "Uncaught Exception: " . $exception; + } + + private static function shutdown(callable $callback) + { + if (!self::$error_messages) { + return; + } + + // remove current output to be replaced by error page + ob_end_clean(); + + http_response_code(500); + header_remove(); + + $callback(self::$error_messages); + } +} \ No newline at end of file diff --git a/app/WillySoft/Http/Route.php b/app/WillySoft/Http/Route.php new file mode 100644 index 0000000..48ae9fa --- /dev/null +++ b/app/WillySoft/Http/Route.php @@ -0,0 +1,81 @@ + $error_messages]); +}); + +Route::get('/', fn() => view('pages/home')); + +// since no route was matched we show a page not found error +http_response_code(404); +view('errors/404'); \ No newline at end of file diff --git a/views/errors/404.php b/views/errors/404.php new file mode 100644 index 0000000..bfb13e6 --- /dev/null +++ b/views/errors/404.php @@ -0,0 +1,12 @@ + + + + + + + Page not found + + +

Page not found

+ + \ No newline at end of file diff --git a/views/errors/500.php b/views/errors/500.php new file mode 100644 index 0000000..c5b2d6d --- /dev/null +++ b/views/errors/500.php @@ -0,0 +1,28 @@ + + + + + + Internal Server Error 500 + + + +

Error!!1 (×﹏×)

+ +
+ + + \ No newline at end of file diff --git a/views/pages/home.php b/views/pages/home.php new file mode 100644 index 0000000..db04661 --- /dev/null +++ b/views/pages/home.php @@ -0,0 +1,4 @@ + 'Home'])?> + + + \ No newline at end of file diff --git a/views/templates/footer.php b/views/templates/footer.php new file mode 100644 index 0000000..d378fbe --- /dev/null +++ b/views/templates/footer.php @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/views/templates/header.php b/views/templates/header.php new file mode 100644 index 0000000..f5016ad --- /dev/null +++ b/views/templates/header.php @@ -0,0 +1,16 @@ + + + + + + + <?=$title?> + + + + + + Welcome to willy.club + + +
\ No newline at end of file