From faae3f3906575b9c72d628a5e48d03f943c794fc Mon Sep 17 00:00:00 2001
From: cflip <36554078+cflip@users.noreply.github.com>
Date: Sat, 17 Apr 2021 17:36:18 -0600
Subject: Automatically sort threads without PHP comparisons
---
viewcategory.php | 10 ----------
1 file changed, 10 deletions(-)
(limited to 'viewcategory.php')
diff --git a/viewcategory.php b/viewcategory.php
index a10afce..e10797a 100644
--- a/viewcategory.php
+++ b/viewcategory.php
@@ -39,17 +39,7 @@ if (!isset($_GET['id']) || !filter_var($_GET['id'], FILTER_VALIDATE_INT)) {
Latest Post |
date_lastpost);
- $db = strtotime($b->date_lastpost);
-
- if ($da == $db) return 0;
-
- return ($da > $db) ? -1 : 1;
- }
-
$threads = $current->get_threads($dbc);
- usort($threads, "cmp");
foreach ($threads as $thread) {
$latest_post = $thread->get_latest_post($dbc);
--
cgit v1.2.3
From 6c9369ad85f2fb3dc61234b54db7e7079cdc0c4e Mon Sep 17 00:00:00 2001
From: cflip <36554078+cflip@users.noreply.github.com>
Date: Fri, 23 Apr 2021 18:43:12 -0600
Subject: Refactoring part 1
---
viewcategory.php | 68 +++++++++++++++++++++++++++-----------------------------
1 file changed, 33 insertions(+), 35 deletions(-)
(limited to 'viewcategory.php')
diff --git a/viewcategory.php b/viewcategory.php
index e10797a..70733da 100644
--- a/viewcategory.php
+++ b/viewcategory.php
@@ -1,6 +1,6 @@
get_from_database($_GET['id'], $dbc);
if ($result == 0) {
http_response_code(404);
- include_once 'templates/404.php';
+ include('includes/templates/404.php');
die();
}
}
?>
-
+
- = $current->name; ?> - cflip.net forum
-
+ = $current->name; ?> - cflip.net forum
+
-
- = $current->name; ?>
- = $current->description; ?>
-
- = $current->thread_count . ' threads, ' . $current->post_count . ' posts'; ?>
-
- Threads
-
-
- Thread Name |
- Latest Post |
-
- get_threads($dbc);
+
+= $current->name; ?>
+= $current->description; ?>
+= $current->thread_count . ' threads, ' . $current->post_count . ' posts'; ?>
+Threads
+
+
+ echo '';
+ }
+ ?>
+
--
cgit v1.2.3
From 2098bf444afadcf0363d89b4cc1dca5d2213d754 Mon Sep 17 00:00:00 2001
From: cflip <36554078+cflip@users.noreply.github.com>
Date: Sat, 24 Apr 2021 19:40:50 -0600
Subject: Remove all uses of db_inc.php
This method of importing the database login every time wasn't very good.
Now everything uses the new Database singleton class.
---
viewcategory.php | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
(limited to 'viewcategory.php')
diff --git a/viewcategory.php b/viewcategory.php
index 70733da..852148b 100644
--- a/viewcategory.php
+++ b/viewcategory.php
@@ -1,6 +1,6 @@
get_from_database($_GET['id'], $dbc);
- if ($result == 0) {
+ $result = $current->get_from_database($_GET['id']);
+ if (!$result) {
http_response_code(404);
include('includes/templates/404.php');
die();
@@ -37,10 +37,10 @@ if (!isset($_GET['id']) || !filter_var($_GET['id'], FILTER_VALIDATE_INT)) {
Latest Post |
get_threads($dbc);
+ $threads = $current->get_threads();
foreach ($threads as $thread) {
- $latest_post = $thread->get_latest_post($dbc);
+ $latest_post = $thread->get_latest_post();
echo '';
echo '' . $thread->subject . '';
--
cgit v1.2.3
|