diff options
Diffstat (limited to 'viewuser.php')
-rwxr-xr-x | viewuser.php | 113 |
1 files changed, 58 insertions, 55 deletions
diff --git a/viewuser.php b/viewuser.php index 8d9c9c1..9a42467 100755 --- a/viewuser.php +++ b/viewuser.php @@ -1,55 +1,58 @@ -<?php
-include_once './includes/model/User.php';
-include_once './includes/model/Thread.php';
-
-if (!isset($_GET['id']) or !filter_var($_GET['id'], FILTER_VALIDATE_INT)) {
- http_response_code(404);
- include('includes/templates/404.php');
- die();
-}
-
-$current = new User();
-$current->get_by_id($_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; ?>'s Profile - cflip.net forum</title>
-<?php include_once 'includes/templates/head.php'; ?>
-</head>
-<body>
-<?php include_once "includes/templates/header.php" ?>
- <h1><?= $current->name; ?></h1>
- member since <?= date('M d, Y', strtotime($current->date_registered)); ?>
- <h2><?= $current->name; ?>'s Threads</h2>
- <table>
- <tr>
- <th>Thread</th>
- <th>Category</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>
- <small>on <?= date('M d, Y', strtotime($thread->date_created)); ?></small>
- </td>
- <td><a href="viewcategory.php?id=<?= $thread->category_id ?>"><?= $thread->get_parent_category()->name ?></a></td>
-<?php $latest_post = $thread->get_latest_post(); if ($latest_post->has_value()): ?>
- <td>
- <small>by <b><a href="viewuser.php?id=<?= $latest_post->author_id ?>"><?= $latest_post->get_author()->name ?></a></b>
- on <?= $latest_post->date_created ?></small>
- </td>
-<?php else: ?>
- <td>No posts yet!</td>
-<?php endif ?>
- </tr>
-<?php endforeach ?>
- </table>
-</body>
-</html>
+<?php +include_once './includes/model/User.php'; +include_once './includes/model/Thread.php'; + +if (!isset($_GET['id']) or !filter_var($_GET['id'], FILTER_VALIDATE_INT)) { + http_response_code(404); + include('includes/templates/404.php'); + die(); +} + +$current = new User(); +$current->get_by_id($_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; ?>'s Profile - cflip.net forum</title> +<?php include_once 'includes/templates/head.php'; ?> +</head> +<body> +<?php include_once "includes/templates/header.php" ?> + <h1><?= $current->name; ?></h1> + member since <?= date('M d, Y', strtotime($current->date_registered)); ?> +<?php if (Session::get()->is_signed_in() && Session::get()->get_current_user()->id == $current->id): ?> + <p>Your invite code is <em><?= $current->invite_code ?></em></p> +<?php endif ?> + <h2><?= $current->name; ?>'s Threads</h2> + <table> + <tr> + <th>Thread</th> + <th>Category</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> + <small>on <?= date('M d, Y', strtotime($thread->date_created)); ?></small> + </td> + <td><a href="viewcategory.php?id=<?= $thread->category_id ?>"><?= $thread->get_parent_category()->name ?></a></td> +<?php $latest_post = $thread->get_latest_post(); if ($latest_post->has_value()): ?> + <td> + <small>by <b><a href="viewuser.php?id=<?= $latest_post->author_id ?>"><?= $latest_post->get_author()->name ?></a></b> + on <?= $latest_post->date_created ?></small> + </td> +<?php else: ?> + <td>No posts yet!</td> +<?php endif ?> + </tr> +<?php endforeach ?> + </table> +</body> +</html> |