show comment info
This commit is contained in:
parent
22588626f2
commit
12e04dcf33
2 changed files with 104 additions and 32 deletions
|
@ -72,11 +72,6 @@ code {
|
||||||
white-space: pre;
|
white-space: pre;
|
||||||
}
|
}
|
||||||
|
|
||||||
.noborder-table td, .noborder-table th {
|
|
||||||
border: none;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
#header {
|
#header {
|
||||||
border-bottom: double;
|
border-bottom: double;
|
||||||
}
|
}
|
||||||
|
@ -119,6 +114,11 @@ code {
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.noborder-table td, .noborder-table th {
|
||||||
|
border: none;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
.image-container-right {
|
.image-container-right {
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
border-width: thin;
|
border-width: thin;
|
||||||
|
@ -208,6 +208,12 @@ code {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.centered-container {
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
.frac {
|
.frac {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
@ -266,21 +272,40 @@ code {
|
||||||
background-repeat: repeat;
|
background-repeat: repeat;
|
||||||
background-color: black;
|
background-color: black;
|
||||||
color: white;
|
color: white;
|
||||||
border: 1px solid black;
|
border-bottom: 1px solid black;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comment .comment-child-wrapper{
|
.comment .comment-child-wrapper{
|
||||||
border-left: 1px solid black;
|
border-left: 1px solid black;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comment .comment .comment-own-wrapper {
|
|
||||||
border-top: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.comment .comment-metadata, .comment .comment-content {
|
.comment .comment-metadata, .comment .comment-content {
|
||||||
padding: 0.5em;
|
padding: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comment-metadata .comment-date {
|
.comment-metadata {
|
||||||
float: right;
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-metadata tr, .comment-metadata td{
|
||||||
|
border: none;
|
||||||
|
padding-bottom: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-metadata .comment-author {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-metadata .comment-date {
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-metadata .comment-id {
|
||||||
|
text-align: right;
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comment-box {
|
||||||
|
width: 100%;
|
||||||
|
height: 5em;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,22 +21,31 @@ class BlogpostComment
|
||||||
printf("
|
printf("
|
||||||
<div class=\"comment\">
|
<div class=\"comment\">
|
||||||
<div class=\"comment-own-wrapper\">
|
<div class=\"comment-own-wrapper\">
|
||||||
<div class=\"comment-metadata\">
|
<table class=\"comment-metadata\">
|
||||||
<span>
|
<tr>
|
||||||
<bold>By: %s</bold>
|
<td class=\"comment-author\">
|
||||||
</span>
|
By: %s
|
||||||
<span class=\"comment-date\">
|
</td>
|
||||||
|
<td class=\"comment-date\">
|
||||||
On: %s
|
On: %s
|
||||||
</span>
|
</td>
|
||||||
</div>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
<td class=\"comment-id\">
|
||||||
|
%s
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
<hr>
|
<hr>
|
||||||
<div class=\"comment-content\">
|
<div class=\"comment-content\">
|
||||||
%s
|
%s
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class=\"comment-child-wrapper\">
|
<div class=\"comment-child-wrapper\">
|
||||||
", $this->poster_name, date("Y-m-d H:i", strtotime($this->timestamp)),
|
", $this->poster_name, date("Y-m-d H:i",
|
||||||
$this->content);
|
strtotime($this->timestamp)), $this->comment_id, $this->content);
|
||||||
|
|
||||||
if($this->children != null) {
|
if($this->children != null) {
|
||||||
for($i = 0; $i < count($this->children); $i++)
|
for($i = 0; $i < count($this->children); $i++)
|
||||||
|
@ -97,7 +106,6 @@ class BlogpostComment
|
||||||
$this->poster_name = $poster_name;
|
$this->poster_name = $poster_name;
|
||||||
$this->timestamp = $timestamp;
|
$this->timestamp = $timestamp;
|
||||||
$this->content = $content;
|
$this->content = $content;
|
||||||
//printf("New comment %s<br> %s<br> %s<br> %s<br> %s<br> %s<br><hr>", $comment_id, $poster_id, $poster_name, $blogpost_id, $timestamp, $content);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +167,7 @@ class Blogpost
|
||||||
* Display the comments for this post and their children.
|
* Display the comments for this post and their children.
|
||||||
*/
|
*/
|
||||||
public function display_comments(){
|
public function display_comments(){
|
||||||
printf("<article><h2>Comments:</h2>");
|
printf("<article>");
|
||||||
for($i = 0; $i < count($this->comments); $i++){
|
for($i = 0; $i < count($this->comments); $i++){
|
||||||
$this->comments[$i]->display_comment();
|
$this->comments[$i]->display_comment();
|
||||||
}
|
}
|
||||||
|
@ -279,16 +287,55 @@ if($conn == null){
|
||||||
// Get the blog id.
|
// Get the blog id.
|
||||||
$blogId = sanitize_input($_GET["guid"]);
|
$blogId = sanitize_input($_GET["guid"]);
|
||||||
|
|
||||||
// Try to get info about blog
|
// If no ID was entered, display warning and die.
|
||||||
if($blogId) {
|
if(!$blogId) {
|
||||||
$blogPost = load_blog($conn, $blogId);
|
display_header("No article requested.");
|
||||||
|
printf("
|
||||||
|
<article>
|
||||||
|
<h2>You didn't request an article</h2>
|
||||||
|
To request an article, set the `guid` GET parameter to the GUID of the article.
|
||||||
|
</article>");
|
||||||
|
include_once($COMMONS."/footer.php");
|
||||||
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display the header with title being the blog name, or not found message.
|
$blogPost = load_blog($conn, $blogId);
|
||||||
display_header($blogPost ? $blogPost->title : "Article not found");
|
|
||||||
|
// If no ID was entered, display warning and die.
|
||||||
|
if(!$blogPost) {
|
||||||
|
display_header("Article not found");
|
||||||
|
printf("
|
||||||
|
<article>
|
||||||
|
<h2>The article you requested doesn't exist.</h2>
|
||||||
|
If you copied the address manually, try to check if you did so correctly.
|
||||||
|
</article>");
|
||||||
|
include_once($COMMONS."/footer.php");
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Display the header with title being the blog name
|
||||||
|
display_header($blogPost->title);
|
||||||
|
|
||||||
// Display the blog
|
// Display the blog
|
||||||
$blogPost->display_article();
|
$blogPost->display_article();
|
||||||
|
printf("<hr style=\"border-style: solid;\">");
|
||||||
|
|
||||||
|
// Display post comment form.
|
||||||
|
printf("
|
||||||
|
<article>
|
||||||
|
<h2> Comments: </h2>
|
||||||
|
<form method=\"post\" action=\"%s\">
|
||||||
|
<label for=\"comment-entry\">Write comment</label>
|
||||||
|
<input type=\"text\" tabindex=\"1\" value=%s>
|
||||||
|
<div class=\"centered-container\">
|
||||||
|
<textarea id=\"comment-entry\" class=\"comment-box\" tabindex=\"2\"> </textarea>
|
||||||
|
</div>
|
||||||
|
<input type=\"submit\" tabindex=\"3\" value=\"Send\">
|
||||||
|
</form>
|
||||||
|
</article>
|
||||||
|
", htmlspecialchars($_SERVER["PHP_SELF"]), $blogId);
|
||||||
|
|
||||||
|
// Display the blog comments
|
||||||
$blogPost->display_comments();
|
$blogPost->display_comments();
|
||||||
|
|
||||||
include_once($COMMONS."/footer.php");
|
include_once($COMMONS."/footer.php");
|
||||||
|
|
Loading…
Reference in a new issue