diff options
author | cflip <36554078+cflip@users.noreply.github.com> | 2021-05-08 17:30:08 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-08 17:30:08 -0600 |
commit | 87b1dfd1f77b08915ee5e905da45e316ba2c0e7d (patch) | |
tree | f6c0f8d09454b6e887df0f66ca37c1ce9efb30d0 /index.php | |
parent | 0b045d57b2164b5ce003955d79627ae506a153eb (diff) | |
parent | a09d9f377f5c055e42e5f21b5cdea64c2e2ca896 (diff) |
Merge pull request #14 from cflip/refactor
Huge refactor
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 94 |
1 files changed, 44 insertions, 50 deletions
@@ -1,62 +1,56 @@ -<?php session_start()?> +<?php session_start() ?> <!DOCTYPE html> -<html> +<html lang="en"> <head> - <title>cflip.net forum</title> - <link rel="stylesheet" href="styles/style.css"> + <title>cflip.net forum</title> + <link rel="stylesheet" href="styles/style.css"> </head> <body> - <?php include_once 'templates/header.php'; ?> - <h2>Welcome to the cflip.net forum!</h2> - <p> - 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, - <i>for the most part</i> I don't care that much about what is posted here. Some links and buttons may not have any functionality either! - </p> - <p> - If you notice a problem or have an idea for a feature that is missing, <a href="http://51.195.90.7/forum/thread.php?id=40">reply to this thread!</a> - </p> - <h2>Categories</h2> - <table> - <tr> - <th>Category</th> - <th>Threads</th> - <th>Posts</th> - <th>Latest Thread</th> - </tr> +<?php include('includes/templates/header.php'); ?> +<h2>Welcome to the cflip.net forum!</h2> +<p> + 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, + <i>for the most part</i> I don't care that much about what is posted here. Some links and buttons may not have any + functionality either! +</p> +<p> + If you notice a problem or have an idea for a feature that is missing, <a + href="http://51.195.90.7/forum/thread.php?id=40">reply to this thread!</a> +</p> +<h2>Categories</h2> +<table> + <tr> + <th>Category</th> + <th>Threads</th> + <th>Posts</th> + <th>Latest Thread</th> + </tr> <?php - include_once 'includes/db_inc.php'; - include_once 'model/Category.php'; + include_once './includes/functions_category.php'; + include_once './includes/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"); + $categories = get_all_categories(); - foreach ($categories as $category) { - $latest_thread = $category->get_latest_thread($dbc); + foreach ($categories as $category) { + $latest_thread = $category->get_latest_thread(); - echo '<tr>'; - echo '<td>'; - echo '<b><a href="viewcategory.php?id=' . $category->id . '">' . $category->name . '</a></b>'; - echo '<br><small>' . $category->description . '</small>'; - echo '</td>'; - echo '<td>' . $category->thread_count . '</td>'; - echo '<td>' . $category->post_count . '</td>'; - if (!is_null($latest_thread)) { - echo '<td><b><a href="viewthread.php?id=' . $latest_thread->id . '">' . $latest_thread->subject . '</a></b><br>'; - echo '<small>by <b><a href="viewuser.php?id=' . $latest_thread->author->id . '">' . $latest_thread->author->name . '</a></b>, ' . $latest_thread->date_created . '</small></td>'; - } else { - echo '<td>No threads yet!</td>'; - } - echo '</tr>'; + echo '<tr>'; + echo '<td>'; + echo '<b><a href="viewcategory.php?id=' . $category->id . '">' . $category->name . '</a></b>'; + echo '<br><small>' . $category->description . '</small>'; + echo '</td>'; + echo '<td>' . $category->thread_count . '</td>'; + echo '<td>' . $category->post_count . '</td>'; + if (!is_null($latest_thread)) { + echo '<td><b><a href="viewthread.php?id=' . $latest_thread->id . '">' . $latest_thread->subject . '</a></b><br>'; + echo '<small>by <b><a href="viewuser.php?id=' . $latest_thread->author->id . '">' . $latest_thread->author->name . '</a></b>, ' . $latest_thread->date_created . '</small></td>'; + } else { + echo '<td>No threads yet!</td>'; } + echo '</tr>'; + } ?> - </table> +</table> </body> </html> |