1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
<?php
include_once($UTIL_DIR . "/error.php");
include_once($UTIL_DIR . "/convert.php");
include_once($UTIL_DIR . "/notify.php");
$message = stripslashes($message);
$title = stripslashes($title);
switch($task) {
case "new":
if($fid) {
include_once("posts.php");
$tid = time();
$pid = time();
$posts = new Posts($FORUMS_DIR . "/" . $fid . "/" . $tid . ".xml");
$post = new Post($pid, $title, $current_user->uid, time(), $message);
$posts->add($post);
$posts->thread->name = $title;
$posts->thread->tid = $tid;
$posts->thread->lastpost = time();
$posts->write();
notify("forum", "New thread \"" . $title . "\" at " . $FORUM_URL . "/?fid=". $fid . "&tid=" . $tid);
} else {
error("No forum id supplied!");
}
break;
case "reply":
if($fid && $tid && $pid) {
include_once("posts.php");
$posts = new Posts($FORUMS_DIR . "/" . $fid . "/" . $tid . ".xml");
$reply = $posts->getPost($pid);
if($reply) {
$post = new Post($posts->nextkey(), $title, $current_uid, time(), $message);
$reply->add($post);
$posts->thread->lastpost = time();
$posts->write();
notify("forum", "New reply \"" . $title . "\" at " . $FORUM_URL . "/?fid=". $fid . "&tid=" . $tid);
} else {
error("Message " . $pid . " not found!");
}
} else {
error("No message supplied!");
}
break;
case "edit":
if($fid && $tid && $pid) {
include_once("posts.php");
$posts = new Posts($FORUMS_DIR . "/" . $fid . "/" . $tid . ".xml");
$edit = $posts->getPost($pid);
if($edit) {
if($posts->thread->tid == $edit->pid) $posts->thread->name = $title;
$edit->title = $title;
$edit->message = $message . "\nEdited at: " . date("r", time());
$posts->thread->lastpost = time();
$posts->write();
notify("forum", "Message \"" . $title . "\" has been edited: " . $FORUM_URL . "/?fid=". $fid . "&tid=" . $tid);
} else {
error("Message " . $pid . " not found!");
}
} else {
error("No message supplied!");
}
break;
case "quote":
if($fid && $tid && $pid) {
include_once("posts.php");
$posts = new Posts($FORUMS_DIR . "/" . $fid . "/" . $tid . ".xml");
$quote = $posts->getPost($pid);
if($quote) {
$post = new Post($posts->nextkey(), $title, $current_uid, time(), $message);
$quote->add($post);
$posts->thread->lastpost = time();
$posts->write();
notify("forum", "New reply (quote) \"" . $title . "\": " . $FORUM_URL . "/?fid=". $fid . "&tid=" . $tid);
} else {
error("Message " . $pid . " not found!");
}
} else {
error("No message supplied!");
}
break;
}
echo "<p><a href=\"?fid=" . $fid . "&tid=" . $tid . "\">Return to thread.</a></p>\n";
?>
<meta http-equiv="refresh" content="0; URL=?fid=<?php echo $fid; ?>&tid=<?php echo $tid; ?>" />
|