Revision 388, 1.0 KB
(checked in by kovell, 14 years ago)
|
Page cache fixes for comments.
refresh no longer reposts comment.
comments display again.
304 sent for refresh of cached pages.
html fixes
|
Line | |
---|
1 | <?php |
---|
2 | require_once('common/includes/class.comments.php'); |
---|
3 | |
---|
4 | $comments = new Comments($kll_id); |
---|
5 | if (isset($_POST['comment'])) |
---|
6 | { |
---|
7 | $pw = false; |
---|
8 | if (!config::get('comments_pw') || $page->isAdmin()) |
---|
9 | { |
---|
10 | $pw = true; |
---|
11 | } |
---|
12 | if ($_POST['password'] == config::get("comment_password") || $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 | //Remove cached file. |
---|
28 | if(KB_CACHE) cache::deleteCache(); |
---|
29 | //Redirect to avoid refresh reposting comments. |
---|
30 | header('Location: '.$_SERVER['REQUEST_URI'],TRUE,303); |
---|
31 | die(); |
---|
32 | } |
---|
33 | } |
---|
34 | else |
---|
35 | { |
---|
36 | // Password is wrong |
---|
37 | $html .= 'Error: Wrong Password'; |
---|
38 | } |
---|
39 | } |
---|
40 | |
---|
41 | $smarty->assign_by_ref('page', $page); |
---|
42 | |
---|
43 | $comment = $comments->getComments(); |
---|
44 | ?> |
---|