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 --- index.php | 9 --------- 1 file changed, 9 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index 7dd0fe4..bdbf770 100644 --- a/index.php +++ b/index.php @@ -27,16 +27,7 @@ include_once 'includes/db_inc.php'; include_once 'model/Category.php'; - // TODO: The get_all_categories function should return them in the right order - function cmp($a, $b) { - if ($a->id == $b->id) { - return 0; - } - return ($a->id < $b->id) ? -1 : 1; - } - $categories = get_all_categories($dbc); - usort($categories, "cmp"); foreach ($categories as $category) { $latest_thread = $category->get_latest_thread($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 --- index.php | 85 +++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 44 insertions(+), 41 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index bdbf770..7b92524 100644 --- a/index.php +++ b/index.php @@ -1,53 +1,56 @@ - + - + - cflip.net forum - + cflip.net forum + - -

Welcome to the cflip.net forum!

-

- This is the beta test of the forum website, so there are lots of features missing. Since there are no moderation features built into the website, - for the most part I don't care that much about what is posted here. Some links and buttons may not have any functionality either! -

-

- If you notice a problem or have an idea for a feature that is missing, reply to this thread! -

-

Categories

- - - - - - - + +

Welcome to the cflip.net forum!

+

+ This is the beta test of the forum website, so there are lots of features missing. Since there are no moderation + features built into the website, + for the most part I don't care that much about what is posted here. Some links and buttons may not have any + functionality either! +

+

+ If you notice a problem or have an idea for a feature that is missing, reply to this thread! +

+

Categories

+
CategoryThreadsPostsLatest Thread
+ + + + + + get_latest_thread($dbc); + foreach ($categories as $category) { + $latest_thread = $category->get_latest_thread($dbc); - echo ''; - echo ''; - echo ''; - echo ''; - if (!is_null($latest_thread)) { - echo ''; - } else { - echo ''; - } - echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + if (!is_null($latest_thread)) { + echo ''; + } else { + echo ''; } + echo ''; + } ?> -
CategoryThreadsPostsLatest Thread
'; - echo '' . $category->name . ''; - echo '
' . $category->description . ''; - echo '
' . $category->thread_count . '' . $category->post_count . '' . $latest_thread->subject . '
'; - echo 'by ' . $latest_thread->author->name . ', ' . $latest_thread->date_created . '
No threads yet!
'; + echo '' . $category->name . ''; + echo '
' . $category->description . ''; + echo '
' . $category->thread_count . '' . $category->post_count . '' . $latest_thread->subject . '
'; + echo 'by ' . $latest_thread->author->name . ', ' . $latest_thread->date_created . '
No threads yet!
+ -- 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. --- index.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index 7b92524..9d62f52 100644 --- a/index.php +++ b/index.php @@ -27,13 +27,13 @@ Latest Thread get_latest_thread($dbc); + $latest_thread = $category->get_latest_thread(); echo ''; echo ''; -- cgit v1.2.3