root/dev/common/comments.php @ 130

Revision 130, 0.9 KB (checked in by exi, 14 years ago)

Moved comments to a small class and made it use smarty.
Fixed an error message output of the parser.

Line 
1<?php
2require_once('class.comments.php');
3
4$comments = new Comments($kll_id);
5if (isset($_POST['comment']))
6{
7    $pw = false;
8    if (!$config->getConfig('comments_pw') || $page->isAdmin())
9    {
10        $pw = true;
11    }
12    if ($_POST['password'] == $config->getPostPassword() || $pw)
13    {
14        if ($_POST['comment'] == '')
15        {
16            $html .= "Error: Silent type hey? good for you, bad for a comment.";
17        }
18        else
19        {
20            $comment = $_POST['comment'];
21            $name = $_POST['name'];
22            if ($name == null)
23            {
24                $name = "Anonymous";
25            }
26            $comments->addComment($name, $comment);
27        }
28    }
29    else
30    {
31        // Password is wrong
32        $html .= "Error: Wrong Password";
33    }
34}
35
36$smarty->assign_by_ref('page', $page);
37
38$comment = $comments->getComments();
39?>
Note: See TracBrowser for help on using the browser.