3 require 'www-header.php';
5 if (!isset($_GET['id'])) {
6 header('HTTP/1.0 400 Bad Request');
7 header('Content-Type: text/plain');
8 echo "id parameter missing\n";
11 if (!is_numeric($_GET['id'])) {
12 header('HTTP/1.0 400 Bad Request');
13 header('Content-Type: text/plain');
14 echo "Invalid id parameter value\n";
18 $id = intval($_GET['id']);
20 $storage = new Storage();
21 $comment = $storage->getJsonComment($id);
22 if ($comment === null) {
23 header('HTTP/1.0 404 Not Found');
24 header('Content-Type: text/plain');
25 echo "Comment not found\n";
29 $rowComment = $comment->Xrow;
30 $rowUser = $comment->user;
33 'json' => $comment->properties,
34 'crow' => $rowComment,
35 'comment' => $comment,
37 'name' => $rowUser->user_name,
38 'url' => Urls::full(Urls::user($rowUser->user_id)),
39 'imageurl' => Urls::userImg($rowUser),
41 'replyUrl' => Urls::full(
42 '/reply.php?url=' . urlencode(Urls::full($rowComment->comment_id))
46 if ($rowComment->comment_type == 'like') {
47 $template = 'post-like';
50 $template = 'post-reply';
51 if (isset($comment->properties->content['html'])) {
52 $htmlContent = $comment->properties->content['html'];
54 $htmlContent = nl2br($comment->properties->content[0]);
56 $vars['htmlContent'] = $htmlContent;
59 render($template, $vars);