Subversion Repositories Applications.papyrus

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
433 ddelon 1
<?php
2
 
3
//print("<xmp>"); print_r($_REQUEST); exit;
4
 
5
if ($this->HasAccess("comment"))
6
{
7
	// find number
8
	if ($latestComment = $this->LoadSingle("select tag, id from ".$this->config["table_prefix"]."pages where comment_on != '' order by id desc limit 1"))
9
	{
10
		preg_match("/^Comment([0-9]+)$/", $latestComment["tag"], $matches);
11
		$num = $matches[1] + 1;
12
	}
13
	else
14
	{
15
		$num = "1";
16
	}
17
 
18
	$body = trim($_POST["body"]);
19
	if (!$body)
20
	{
21
		$this->SetMessage("Comment body was empty -- not saved!");
22
	}
23
	else
24
	{
25
		// store new comment
26
		$this->SavePage("Comment".$num, $body, $this->tag);
27
	}
28
 
29
 
30
	// redirect to page
31
	$this->redirect($this->href());
32
}
33
else
34
{
35
	print("<div class=\"page\"><i>Sorry, you're not allowed to post comments to this page.</i></div>\n");
36
}
37
 
38
?>