aboutsummaryrefslogtreecommitdiff
path: root/single.inc.php
blob: 7eac8fb6dd9f75580946a6878678f9c7240d7b56 (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
<?php
	if(!defined('ROOT')) die('Don\'t call this directly.');
	header('Content-Type: text/html; charset=utf-8');

	$id = (!empty(path(0))) ? (int) path(0) : 0;
	$post = db_select_post($id);

?><!DOCTYPE html>
<html lang="<?= $config['language'] ?>" class="post">
<head>
	<title><?= empty($config['microblog_account']) ? "" : $config['microblog_account'] . "'s " ?>micro.blog - entry #<?= $id ?></title>
	<meta name="viewport" content="width=device-width" />
	<link rel="stylesheet" href="<?= $config['url'] ?>/microblog.css" />
</head>
<body>
	<div class="wrap">
		<nav>
			<ul>
				<li><a href="<?= $config['url'] ?>/">Timeline</a></li>
				<li><a href="<?= $config['url'] ?>/new">New Status</a></li>
			</ul>
		</nav>
		<?php if(!empty($post)): ?>
		<?php
			$date = date_create();
			date_timestamp_set($date, $post['post_timestamp']);
			
			$datetime = date_format($date, 'Y-m-d H:i:s');
			$formatted_time = date_format($date, 'M d Y H:i');
		?>
		<time class="post-timestamp" datetime="<?= $datetime ?>" data-unix-time="<?= $post['post_timestamp'] ?>"><?= $formatted_time ?></time>
		<p class="post-content"><?= nl2br(autolink($post['post_content'])) ?></p>
		<?php else: ?>
		<p>No post with this ID.</p>
		<?php endif; ?>
	</div>
</body>
</html>