summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcflip <36554078+cflip@users.noreply.github.com>2021-06-05 11:57:12 -0600
committercflip <36554078+cflip@users.noreply.github.com>2021-06-05 19:26:18 -0600
commit2ae22c4a438dc3c1822b8d909a4b38a211427bee (patch)
treebc9c1eb4ffbb81f4868d17a0098f1cff012723c7
parent24efe49bc2b545e3a3e46d7d6f2bd1166163e52b (diff)
Use different syntax for conditions in HTML
-rw-r--r--includes/templates/404.php20
-rw-r--r--index.php104
-rw-r--r--signin.php30
-rw-r--r--viewcategory.php71
-rw-r--r--viewthread.php69
5 files changed, 142 insertions, 152 deletions
diff --git a/includes/templates/404.php b/includes/templates/404.php
index d4d5128..74db2d6 100644
--- a/includes/templates/404.php
+++ b/includes/templates/404.php
@@ -1,12 +1,14 @@
<!DOCTYPE html>
<html>
-<head>
- <title>cflip.net forum</title>
- <link rel="stylesheet" href="styles/style.css">
-</head>
-<body>
- <?php include_once 'header.php'; ?>
- <h1>Page Not Found</h1>
- <p>The page you requested does not exist.</p>
-</body>
+ <head>
+ <title>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 'header.php'; ?>
+ <h1>Page Not Found</h1>
+ <p>The page you requested does not exist.</p>
+ </body>
</html>
diff --git a/index.php b/index.php
index dadef39..ac2dd3e 100644
--- a/index.php
+++ b/index.php
@@ -1,55 +1,55 @@
-<?php session_start() ?>
+<?php
+include_once './includes/model/Category.php';
+session_start();
+?>
<!DOCTYPE html>
<html lang="en">
-<head>
- <title>cflip.net forum</title>
- <link rel="stylesheet" href="styles/style.css">
-</head>
-<body>
-<?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/model/Category.php';
-
- $categories = Category::get_all_categories();
-
- 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 ($latest_thread->has_value()) {
- 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>
-</body>
+ <head>
+ <title>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'; ?>
+ <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 foreach (Category::get_all_categories() as $category): ?>
+ <tr>
+ <td>
+ <b><a href="viewcategory.php?id=<?= $category->id ?>"><?= $category->name ?></a></b>
+ <br><small><?= $category->description ?></small>
+ </td>
+ <td><?= $category->thread_count ?></td>
+ <td><?= $category->post_count ?></td>
+<?php $latest_thread = $category->get_latest_thread(); if ($latest_thread->has_value()): ?>
+ <td>
+ <b><a href="viewthread.php?id=<?= $latest_thread->id ?>"><?= $latest_thread->subject ?></a></b>
+ <br>
+ <small>by <b><a href="viewuser.php?id=<?= $latest_thread->author->id ?>"><?= $latest_thread->author->name ?></a></b>, <?= $latest_thread->date_created ?></small>
+ </td>
+<?php else: ?>
+ <td>No threads yet!</td>
+<?php endif ?>
+ </tr>
+<?php endforeach ?>
+ </table>
+ </body>
</html>
diff --git a/signin.php b/signin.php
index 0eb492d..ef60750 100644
--- a/signin.php
+++ b/signin.php
@@ -1,20 +1,20 @@
<?php session_start() ?>
<!DOCTYPE html>
<html lang="en">
-<head>
- <title>Sign in - cflip.net forum</title>
- <link rel="stylesheet" href="styles/style.css">
-</head>
-<body>
+ <head>
+ <title>Sign in - cflip.net forum</title>
+ <link rel="stylesheet" href="styles/style.css">
+ </head>
+ <body>
<?php include_once './includes/templates/header.php' ?>
-<h2>Sign in</h2>
-<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
- <label for="user_name">Username: </label><br>
- <input type="text" name="user_name"><br>
- <label for="user_pass">Password: </label><br>
- <input type="password" name="user_pass"><br>
- <input type="submit" name="submit">
-</form>
+ <h2>Sign in</h2>
+ <form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>" method="post">
+ <label for="user_name">Username: </label><br>
+ <input type="text" name="user_name"><br>
+ <label for="user_pass">Password: </label><br>
+ <input type="password" name="user_pass"><br>
+ <input type="submit" name="submit">
+ </form>
<?php
include_once 'includes/error.php';
@@ -58,12 +58,12 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (!password_verify($user_pass, $user->password)) {
echo 'Password does not match!';
} else {
- Session::get()->sign_in($user);
+ Session::get()->sign_in($user);
header("Location: index.php");
}
}
}
}
?>
-</body>
+ </body>
</html>
diff --git a/viewcategory.php b/viewcategory.php
index e68bab2..e9927f9 100644
--- a/viewcategory.php
+++ b/viewcategory.php
@@ -18,40 +18,39 @@ if (!$current->has_value()) {
?>
<!DOCTYPE html>
<html lang="en">
-<head>
- <title><?= $current->name; ?> - cflip.net forum</title>
- <link rel="stylesheet" href="styles/style.css">
-</head>
-<body>
-<?php include('includes/templates/header.php'); ?>
-<h1><?= $current->name; ?></h1>
-<p><?= $current->description; ?></p>
-<span class="info"><?= $current->thread_count . ' threads, ' . $current->post_count . ' posts'; ?></span>
-<h2>Threads</h2>
-<table>
- <tr>
- <th>Thread Name</th>
- <th>Latest Post</th>
- </tr>
- <?php
- $threads = $current->get_threads();
-
- foreach ($threads as $thread) {
- $latest_post = $thread->get_latest_post();
-
- echo '<tr>';
- echo '<td><b><a href="viewthread.php?id=' . $thread->id . '">' . $thread->subject . '</a></b>';
- echo '<small> by <b><a href="viewuser.php?id=' . $thread->author->id . '">' . $thread->author->name . '</a></b> on ' . date('M d, Y', strtotime($thread->date_created)) . '</small></td>';
-
- if (!is_null($latest_post)) {
- echo '<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>';
- } else {
- echo '<td>No posts yet!</td>';
- }
-
- echo '</tr>';
- }
- ?>
-</table>
-</body>
+ <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>
+ <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>
diff --git a/viewthread.php b/viewthread.php
index 12b9429..eb1698d 100644
--- a/viewthread.php
+++ b/viewthread.php
@@ -1,5 +1,7 @@
<?php
-include_once 'includes/model/Thread.php';
+include_once './includes/model/User.php';
+include_once './includes/model/Thread.php';
+include_once './includes/model/Post.php';
session_start();
@@ -18,28 +20,22 @@ if (!$current->has_value()) {
?>
<!DOCTYPE html>
<html lang="en">
-<head>
- <title><?= $current->subject; ?> - cflip.net forum</title>
- <link rel="stylesheet" href="styles/style.css">
-</head>
-<body>
-<?php include('includes/templates/header.php'); ?>
-<h1><?= $current->subject; ?></h1>
-created by <b><?= $current->author->name; ?></b>
-in <b><?= $current->category->name; ?></b>
-<abbr title="<?= date('M d, Y g:ia', strtotime($current->date_created)); ?>">3 days ago</abbr>
-<?php
-include_once './includes/model/User.php';
-
-if (Session::get()->is_signed_in()) {
- $user = Session::get()->get_current_user();
-
- if ($user->level == USER_LEVEL_MODERATOR) {
- echo '
+ <head>
+ <title><?= $current->subject; ?> - 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->subject; ?></h1>
+ created by <b><?= $current->author->name; ?></b>
+ in <b><?= $current->category->name; ?></b>, <?= date('M d, Y g:ia', strtotime($current->date_created)); ?>
+<?php if (Session::get()->is_signed_in() and Session::get()->get_current_user()->level == USER_LEVEL_MODERATOR): ?>
<form action="moderate.php" method="post">
<p>
<b>Moderator Options</b>
- <input type="hidden" name="id" value="' . $current->id . '">
+ <input type="hidden" name="id" value="<?= $current->id ?>">
<input type="checkbox" id="delete" name="delete">
<label for="delete">Delete thread</label>
<input type="checkbox" id="lock" name="lock">
@@ -49,22 +45,15 @@ if (Session::get()->is_signed_in()) {
<input type="submit" value="Update thread">
</p>
</form>
- ';
- }
-}
-?>
-<hr>
-<?php
-include_once './includes/model/Post.php';
-
-$posts = $current->get_posts();
-
-foreach ($posts as $post) {
+<?php endif ?>
+ <hr>
+<?php
+foreach ($current->get_posts() as $post) {
echo $post->get_content();
-}
+}
?>
-<hr>
-<h2>Reply to this thread</h2>
+ <hr>
+ <h2>Reply to this thread</h2>
<?php
include_once 'includes/error.php';
@@ -84,10 +73,10 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
}
}
?>
-<form method="post">
- <textarea name="post_content" rows="10" cols="50"></textarea>
- <br>
- <input type="submit" name="submit">
-</form>
-</body>
+ <form method="post">
+ <textarea name="post_content" rows="10" cols="50"></textarea>
+ <br>
+ <input type="submit" name="submit">
+ </form>
+ </body>
</html>