2003-07-18 21:38:51 +00:00
|
|
|
<?php
|
2007-09-29 12:53:16 +00:00
|
|
|
$cvs_version_tracker[]="\$Id$";
|
|
|
|
|
2006-06-16 23:53:56 +00:00
|
|
|
/**
|
|
|
|
* Using this file you can post a reply to a thread. Both input (form) and
|
|
|
|
* action take place here.
|
|
|
|
**/
|
2006-07-01 20:03:48 +00:00
|
|
|
require_once('../inc/forum_email.inc');
|
2004-02-02 23:34:39 +00:00
|
|
|
require_once('../inc/forum.inc');
|
2006-06-16 23:53:56 +00:00
|
|
|
require_once('../inc/forum_std.inc');
|
2007-04-19 18:22:38 +00:00
|
|
|
require_once('../inc/akismet.inc');
|
2003-08-13 22:08:12 +00:00
|
|
|
|
2004-12-27 03:42:11 +00:00
|
|
|
db_init();
|
|
|
|
|
2006-06-16 23:53:56 +00:00
|
|
|
$logged_in_user = re_get_logged_in_user(true);
|
2006-08-08 20:32:37 +00:00
|
|
|
check_banished($logged_in_user);
|
2004-09-04 23:37:49 +00:00
|
|
|
|
2006-06-16 23:53:56 +00:00
|
|
|
$thread = new Thread (get_int('thread'));
|
2006-11-10 17:09:09 +00:00
|
|
|
|
|
|
|
if ($thread->isLocked() && !$logged_in_user->isSpecialUser(S_MODERATOR)
|
|
|
|
&& !$logged_in_user->isSpecialUser(S_ADMIN)) {
|
|
|
|
error_page("This thread is locked. Only forum moderators and administrators are allowed to post there.");
|
|
|
|
}
|
|
|
|
|
2006-06-16 23:53:56 +00:00
|
|
|
$forum = $thread->getForum();
|
|
|
|
$category = $forum->getCategory();
|
2005-04-20 21:11:20 +00:00
|
|
|
|
2005-05-10 16:08:05 +00:00
|
|
|
$sort_style = get_str('sort', true);
|
|
|
|
$filter = get_str('filter', true);
|
2006-06-16 23:53:56 +00:00
|
|
|
$content = post_str('content', true);
|
2007-09-29 12:53:16 +00:00
|
|
|
$preview = post_str("preview", true);
|
2006-06-16 23:53:56 +00:00
|
|
|
$parent_post_id = get_int('post', true);
|
|
|
|
if ($parent_post_id) $parent_post = new Post($parent_post_id);
|
2005-05-10 16:08:05 +00:00
|
|
|
|
|
|
|
if ($filter != "false"){
|
|
|
|
$filter = true;
|
|
|
|
} else {
|
|
|
|
$filter = false;
|
|
|
|
}
|
|
|
|
|
2006-06-16 23:53:56 +00:00
|
|
|
if ($thread->isHidden()) {
|
2005-04-25 18:44:17 +00:00
|
|
|
//If the thread has been hidden, do not display it, or allow people to continue to post
|
|
|
|
//to it.
|
|
|
|
error_page(
|
|
|
|
"This thread has been hidden for administrative purposes.");
|
|
|
|
}
|
2005-05-10 16:08:05 +00:00
|
|
|
|
2006-09-27 16:58:59 +00:00
|
|
|
if (!$logged_in_user->isSpecialUser(S_MODERATOR) && ($logged_in_user->getTotalCredit()<$forum->getPostMinTotalCredit() || $logged_in_user->getExpavgCredit()<$forum->getPostMinExpavgCredit())) {
|
2005-04-20 21:11:20 +00:00
|
|
|
//If user haven't got enough credit (according to forum regulations)
|
|
|
|
//We do not tell the (ab)user how much this is - no need to make it easy for them to break the system.
|
|
|
|
error_page(
|
|
|
|
"In order to reply to a post in ".$forum->title." you must have a certain amount of credit.
|
|
|
|
This is to prevent and protect against abuse of the system.");
|
|
|
|
}
|
2005-05-10 16:08:05 +00:00
|
|
|
|
2006-06-16 23:53:56 +00:00
|
|
|
if (time()-$logged_in_user->getLastPostTimestamp()<$forum->getPostMinInterval()){
|
2005-04-20 21:11:20 +00:00
|
|
|
//If the user is posting faster than forum regulations allow
|
|
|
|
//Tell the user to wait a while before creating any more posts
|
|
|
|
error_page(
|
|
|
|
"You cannot reply to any more posts right now. Please wait a while before trying again.<br />
|
|
|
|
This delay has been enforced to protect against abuse of the system.");
|
|
|
|
}
|
|
|
|
|
2006-06-16 23:53:56 +00:00
|
|
|
if (!$sort_style) {
|
|
|
|
$sort_style = $logged_in_user->getThreadSortStyle("thread");
|
2005-05-10 16:08:05 +00:00
|
|
|
} else {
|
2006-06-16 23:53:56 +00:00
|
|
|
$logged_in_user->setThreadSortStyle($sort_style);
|
2005-05-10 16:08:05 +00:00
|
|
|
}
|
2005-04-20 21:11:20 +00:00
|
|
|
|
2007-09-29 12:53:16 +00:00
|
|
|
if ($content && (!$preview)){
|
2006-06-16 23:53:56 +00:00
|
|
|
if (post_str('add_signature',true)=="add_it"){
|
2005-02-13 06:13:33 +00:00
|
|
|
$add_signature=true; // set a flag and concatenate later
|
2004-10-10 03:04:29 +00:00
|
|
|
} else {
|
2005-02-13 06:13:33 +00:00
|
|
|
$add_signature=false;
|
2004-10-10 03:04:29 +00:00
|
|
|
}
|
2007-02-08 19:54:05 +00:00
|
|
|
check_tokens($logged_in_user->getAuthenticator());
|
2007-04-19 18:22:38 +00:00
|
|
|
akismet_check($logged_in_user, $content);
|
2006-06-16 23:53:56 +00:00
|
|
|
$thread->createReply($content, $parent_post, $logged_in_user, $add_signature);
|
|
|
|
header('Location: forum_thread.php?id='.$thread->getID());
|
2003-07-18 21:38:51 +00:00
|
|
|
}
|
|
|
|
|
2006-06-16 23:53:56 +00:00
|
|
|
page_head(tr(FORUM_TITLE_SHORT));
|
2003-07-18 21:38:51 +00:00
|
|
|
|
2006-06-16 23:53:56 +00:00
|
|
|
show_forum_title($forum, $thread);
|
2007-09-29 12:53:16 +00:00
|
|
|
|
|
|
|
if ($preview == tra("Preview")) {
|
|
|
|
$options = new output_options;
|
|
|
|
echo "<div id=\"preview\">\n";
|
|
|
|
echo "<div class=\"header\">".tra("Preview")."</div>\n";
|
|
|
|
echo output_transform($content, $options);
|
|
|
|
echo "</div>\n";
|
|
|
|
}
|
|
|
|
|
2006-06-16 23:53:56 +00:00
|
|
|
start_forum_table(array(tr(FORUM_AUTHOR), tr(FORUM_MESSAGE)));
|
2003-07-26 00:19:21 +00:00
|
|
|
|
2006-06-16 23:53:56 +00:00
|
|
|
show_message_row($thread, $parent_post);
|
|
|
|
show_posts($thread, $sort_style, $filter, $logged_in_user, true);
|
2003-08-13 22:08:12 +00:00
|
|
|
end_forum_table();
|
2003-07-18 21:38:51 +00:00
|
|
|
|
2003-08-15 01:01:00 +00:00
|
|
|
page_tail();
|
2003-07-24 22:56:20 +00:00
|
|
|
|
2006-06-16 23:53:56 +00:00
|
|
|
function show_message_row($thread, $parent_post) {
|
2003-07-24 22:56:20 +00:00
|
|
|
global $logged_in_user;
|
2007-09-29 12:53:16 +00:00
|
|
|
global $content;
|
|
|
|
global $preview;
|
2003-08-22 19:09:32 +00:00
|
|
|
|
2005-02-16 00:24:53 +00:00
|
|
|
$x1 = "Message:".html_info().post_warning();
|
|
|
|
$x2 = "";
|
2006-06-16 23:53:56 +00:00
|
|
|
if ($parent_post) {
|
|
|
|
$x2 .=" reply to <a href=#".$parent_post->getID().">Message ID ".$parent_post->getID()."</a>:";
|
2003-12-01 06:08:22 +00:00
|
|
|
}
|
2006-06-16 23:53:56 +00:00
|
|
|
$x2 .= "<form action=forum_reply.php?thread=".$thread->getID();
|
2003-07-24 22:56:20 +00:00
|
|
|
|
2006-06-16 23:53:56 +00:00
|
|
|
if ($parent_post) {
|
|
|
|
$x2 .= "&post=".$parent_post->getID();
|
2003-07-24 22:56:20 +00:00
|
|
|
}
|
2003-08-22 19:09:32 +00:00
|
|
|
|
2007-02-08 19:54:05 +00:00
|
|
|
$x2 .= " method=\"post\">\n";
|
|
|
|
$x2 .= form_tokens($logged_in_user->getAuthenticator());
|
|
|
|
$x2 .= "<textarea name=\"content\" rows=\"18\" cols=\"80\">";
|
2007-09-29 12:53:16 +00:00
|
|
|
if ($preview) {
|
|
|
|
$x2 .= $content;
|
|
|
|
} else {
|
|
|
|
if ($parent_post) $x2 .= quote_text(stripslashes(htmlspecialchars($parent_post->getContent())), 80)."\n";
|
|
|
|
}
|
2006-06-16 23:53:56 +00:00
|
|
|
if ($logged_in_user->hasSignatureByDefault()){
|
2005-02-16 00:24:53 +00:00
|
|
|
$enable_signature="checked=\"true\"";
|
|
|
|
} else {
|
|
|
|
$enable_signature="";
|
|
|
|
}
|
2007-09-29 12:53:16 +00:00
|
|
|
$x2 .= "</textarea><p>
|
|
|
|
<input type=\"submit\" name=\"preview\" value=\"".tra("Preview")."\">
|
|
|
|
<input type=\"submit\" value=\"Post reply\">
|
2003-11-28 22:35:01 +00:00
|
|
|
|
2007-09-29 12:53:16 +00:00
|
|
|
<input name=\"add_signature\" id=\"add_signature\" value=\"add_it\" ".$enable_signature." type=\"checkbox\">
|
|
|
|
<label for=\"add_signature\">Add my signature to this reply</label>
|
2003-11-28 22:35:01 +00:00
|
|
|
|
2003-12-01 06:08:22 +00:00
|
|
|
</form>
|
2005-02-13 06:13:33 +00:00
|
|
|
";
|
2005-02-16 00:24:53 +00:00
|
|
|
row2($x1, $x2);
|
2003-07-24 22:56:20 +00:00
|
|
|
}
|
|
|
|
|
2005-04-28 09:32:22 +00:00
|
|
|
function quote_text($text, $cols = 0) {
|
2005-05-08 01:33:03 +00:00
|
|
|
/* $cols is depricated. */
|
2005-05-13 19:14:19 +00:00
|
|
|
$text = "[quote]" . $text . "[/quote]";
|
2005-04-28 09:32:22 +00:00
|
|
|
return $text;
|
2003-07-26 00:19:21 +00:00
|
|
|
}
|
2003-11-28 22:35:01 +00:00
|
|
|
?>
|