Revision 466, 1.5 KB
(checked in by kovell, 13 years ago)
|
Reverting 464 changes. apiuser mod actually does work for some and is used by other mods.
|
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') && !config::get('apiuser_comment')) |
---|
9 | || $page->isAdmin() |
---|
10 | ||(config::get('apiuser_comment') && (user::role('comment') || user::role('admin') )) ) |
---|
11 | $pw = true; |
---|
12 | |
---|
13 | if (($_POST['password'] == config::get("post_password") && !config::get('apiuser_comment')) || $pw) |
---|
14 | { |
---|
15 | if ($_POST['comment'] == '') |
---|
16 | { |
---|
17 | $html .= 'Error: Silent type hey? good for you, bad for a comment.'; |
---|
18 | } |
---|
19 | else |
---|
20 | { |
---|
21 | $comment = $_POST['comment']; |
---|
22 | if (user::loggedin()) |
---|
23 | $name=user::get('usr_login'); |
---|
24 | else |
---|
25 | if ($page->isAdmin()) |
---|
26 | $name = 'admin'; |
---|
27 | else |
---|
28 | $name = $_POST['name']; |
---|
29 | if ($name == null) |
---|
30 | { |
---|
31 | $name = 'Anonymous'; |
---|
32 | } |
---|
33 | $comments->addComment($name, $comment); |
---|
34 | //Remove cached file. |
---|
35 | if(KB_CACHE) cache::deleteCache(); |
---|
36 | //Redirect to avoid refresh reposting comments. |
---|
37 | header('Location: '.$_SERVER['REQUEST_URI'],TRUE,303); |
---|
38 | die(); |
---|
39 | } |
---|
40 | } |
---|
41 | else |
---|
42 | { |
---|
43 | // Password is wrong |
---|
44 | $html .= 'Error: Wrong Password'; |
---|
45 | } |
---|
46 | } |
---|
47 | $allowedToPost=$pw; |
---|
48 | $smarty->assign('affForms',$allowedToPost); |
---|
49 | |
---|
50 | $smarty->assign('valUser',intval(user::loggedin())); |
---|
51 | $smarty->assign('apiuserEnable',$config->get('apiuser_comment')); |
---|
52 | $smarty->assign_by_ref('page', $page); |
---|
53 | $comment = $comments->getComments(); |
---|
54 | |
---|
55 | ?> |
---|