summaryrefslogtreecommitdiff
path: root/viewcategory.php
diff options
context:
space:
mode:
authorcflip <36554078+cflip@users.noreply.github.com>2021-06-05 11:18:10 -0600
committercflip <36554078+cflip@users.noreply.github.com>2021-06-05 11:18:10 -0600
commit24efe49bc2b545e3a3e46d7d6f2bd1166163e52b (patch)
treec1852447d06c062052def6fc89be2e2dece17c78 /viewcategory.php
parent45acfc48b3dd80b945a1501edea9ad4faa700c0f (diff)
Move object related functions into their classes.
Some of the pages are still broken from this commit, but I plan to either rewrite or ignore them.
Diffstat (limited to 'viewcategory.php')
-rw-r--r--viewcategory.php17
1 files changed, 7 insertions, 10 deletions
diff --git a/viewcategory.php b/viewcategory.php
index 852148b..e68bab2 100644
--- a/viewcategory.php
+++ b/viewcategory.php
@@ -1,22 +1,19 @@
<?php
-
include_once 'includes/model/Category.php';
session_start();
-$current = new Category();
+if (!isset($_GET['id']) or !filter_var($_GET['id'], FILTER_VALIDATE_INT)) {
+ http_response_code(404);
+ include('includes/templates/404.php');
+ die();
+}
-if (!isset($_GET['id']) || !filter_var($_GET['id'], FILTER_VALIDATE_INT)) {
+$current = new Category($_GET['id']);
+if (!$current->has_value()) {
http_response_code(404);
include('includes/templates/404.php');
die();
-} else {
- $result = $current->get_from_database($_GET['id']);
- if (!$result) {
- http_response_code(404);
- include('includes/templates/404.php');
- die();
- }
}
?>
<!DOCTYPE html>