-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathpost.php
More file actions
64 lines (49 loc) · 2.06 KB
/
post.php
File metadata and controls
64 lines (49 loc) · 2.06 KB
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
58
59
60
61
62
63
64
<?php
/**
* @author Pierre-Henry Soria <phy@hizup.uk>
* @copyright (c) 2015-2017, Pierre-Henry Soria. All Rights Reserved.
* @license Lesser General Public License <http://www.gnu.org/copyleft/lesser.html>
* @link http://hizup.uk
*/
?>
<?php require 'inc/header.php' ?>
<?php if (empty($this->oPost)): ?>
<p class="error">The post can't be be found!</p>
<?php else: ?>
<article>
<time datetime="<?=$this->oPost->createdDate?>" pubdate="pubdate"></time>
<h1><?=htmlspecialchars($this->oPost->title)?></h1>
<p><?=nl2br(htmlspecialchars($this->oPost->body))?></p>
<p class="left small italic">Posted on <?=$this->oPost->createdDate?></p>
<?php
$oPost = $this->oPost;
require 'inc/control_buttons.php';
?>
</article>
<br>
<aside>
<h3>Comments</h3>
<?php if (empty($this->oComments)): ?>
<p class="error">This post has any comment. Be the first to comment!</p>
<?php else: ?>
<?php foreach ($this->oComments as $oComment): ?>
<h6>On <?= $oComment->createdDate ?></h6>
<h4><?= $oComment->authorName ?> <em>said:</em></h4>
<p><?= $oComment->content ?></p>
<hr class="clear" /><br />
<?php endforeach ?>
<?php endif ?>
<h4>Add a new comment</h4>
<form action="<?=ROOT_URL?>?p=comment&a=add" method="post">
<input type="hidden" name="id_post" value="<?=$this->oPost->id?>" />
<p><label for="author_name">Your name:</label><br />
<input type="text" name="author_name" id="author_name" required="required" />
</p>
<p><label for="content">Content:</label><br />
<textarea name="content" id="content" rows="5" cols="35" required="required"></textarea>
</p>
<p><input type="submit" name="add_comment" value="Post a comment" /></p>
</form>
</aside>
<?php endif ?>
<?php require 'inc/footer.php' ?>