blob: 832d9535ba63d41e7884ec6c8468d69d7edcca9e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
<?php
include_once 'includes/model/Category.php';
session_start();
if (!isset($_GET['id']) or !filter_var($_GET['id'], FILTER_VALIDATE_INT)) {
http_response_code(404);
include('includes/templates/404.php');
die();
}
$current = new Category($_GET['id']);
if (!$current->has_value()) {
http_response_code(404);
include('includes/templates/404.php');
die();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title><?= $current->name; ?> - cflip.net forum</title>
<link rel="stylesheet" href="styles/style.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<?php include_once 'includes/templates/header.php'; ?>
<h1><?= $current->name; ?></h1>
<p><?= $current->description; ?></p>
<span class="info"><?= $current->thread_count . ' threads, ' . $current->post_count . ' posts'; ?></span>
<div id="banner"></div>
<h2>Threads</h2>
<table>
<tr>
<th>Thread</th>
<th>Author</th>
<th>Date</th>
<th>Latest Post</th>
</tr>
<?php foreach ($current->get_threads() as $thread): ?>
<tr>
<td>
<b><a href="viewthread.php?id=<?= $thread->id ?>"><?= $thread->subject ?></a></b>
</td>
<td><?= $thread->author->name ?></td>
<td><?= $thread->date_created ?></td>
<?php $latest_post = $thread->get_latest_post(); if ($latest_post->has_value()): ?>
<td>by <b><a href="viewuser.php?id=<?= $latest_post->author->id ?>"><?= $latest_post->author->name ?></a></b><small> on <?= $latest_post->date_created ?></small></td>
<?php else: ?>
<td>No posts yet!</td>
<?php endif ?>
</tr>
<?php endforeach ?>
</table>
</body>
</html>
|