From 24efe49bc2b545e3a3e46d7d6f2bd1166163e52b Mon Sep 17 00:00:00 2001 From: cflip <36554078+cflip@users.noreply.github.com> Date: Sat, 5 Jun 2021 11:18:10 -0600 Subject: 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. --- viewthread.php | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'viewthread.php') diff --git a/viewthread.php b/viewthread.php index fa1c81b..12b9429 100644 --- a/viewthread.php +++ b/viewthread.php @@ -3,20 +3,17 @@ include_once 'includes/model/Thread.php'; session_start(); -$current = new Thread(); - if (!isset($_GET['id']) || !filter_var($_GET['id'], FILTER_VALIDATE_INT)) { 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(); - } +$current = new Thread($_GET['id']); +if (!$current->has_value()) { + http_response_code(404); + include('includes/templates/404.php'); + die(); } ?> @@ -32,7 +29,7 @@ created by = $current->author->name; ?> in = $current->category->name; ?> 3 days ago is_signed_in()) { $user = Session::get()->get_current_user(); @@ -58,18 +55,17 @@ if (Session::get()->is_signed_in()) { ?>