From cce5e7710295021b41d9aaecc503a60fb99256be Mon Sep 17 00:00:00 2001 From: deva Date: Sat, 4 Oct 2008 10:38:03 +0000 Subject: Initial revision --- forum/utils/edit.php | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 forum/utils/edit.php (limited to 'forum/utils/edit.php') diff --git a/forum/utils/edit.php b/forum/utils/edit.php new file mode 100644 index 0000000..0af361c --- /dev/null +++ b/forum/utils/edit.php @@ -0,0 +1,89 @@ +uid, time(), $message); + $posts->add($post); + $posts->thread->name = $title; + $posts->thread->tid = $tid; + $posts->thread->lastpost = time(); + $posts->write(); + notify("forum", "New thread: http://www.executionroom.com/forum/?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: http://www.executionroom.com/forum/?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 has been edited: http://www.executionroom.com/forum/?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): http://www.executionroom.com/forum/?fid=". $fid . "&tid=" . $tid); + } else { + error("Message " . $pid . " not found!"); + } + } else { + error("No message supplied!"); + } + break; + +} +echo "

Return to thread.

\n"; + +?> \ No newline at end of file -- cgit v1.2.3