2003-07-18 21:38:51 +00:00
|
|
|
<?php
|
2008-08-05 22:43:14 +00:00
|
|
|
// This file is part of BOINC.
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2008 University of California
|
|
|
|
//
|
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
2007-09-29 12:53:16 +00:00
|
|
|
|
2007-11-12 20:57:15 +00:00
|
|
|
// Use 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');
|
2007-04-19 18:22:38 +00:00
|
|
|
require_once('../inc/akismet.inc');
|
2003-08-13 22:08:12 +00:00
|
|
|
|
2007-11-12 20:57:15 +00:00
|
|
|
$logged_in_user = get_logged_in_user(true);
|
|
|
|
BoincForumPrefs::lookup($logged_in_user);
|
2006-08-08 20:32:37 +00:00
|
|
|
check_banished($logged_in_user);
|
2004-09-04 23:37:49 +00:00
|
|
|
|
2007-11-12 20:57:15 +00:00
|
|
|
$thread = BoincThread::lookup_id(get_int('thread'));
|
|
|
|
$forum = BoincForum::lookup_id($thread->forum);
|
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);
|
2007-10-31 19:26:02 +00:00
|
|
|
$parent_post = null;
|
2007-11-12 20:57:15 +00:00
|
|
|
if ($parent_post_id) {
|
|
|
|
$parent_post = BoincPost::lookup_id($parent_post_id);
|
|
|
|
if ($parent_post->thread != $thread->id) {
|
|
|
|
error_page("wrong thread");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$parent_post_id = 0;
|
|
|
|
}
|
2005-05-10 16:08:05 +00:00
|
|
|
|
|
|
|
if ($filter != "false"){
|
|
|
|
$filter = true;
|
|
|
|
} else {
|
|
|
|
$filter = false;
|
|
|
|
}
|
|
|
|
|
2007-11-15 22:51:05 +00:00
|
|
|
check_reply_access($logged_in_user, $forum, $thread);
|
2005-04-20 21:11:20 +00:00
|
|
|
|
2006-06-16 23:53:56 +00:00
|
|
|
if (!$sort_style) {
|
2007-11-12 20:57:15 +00:00
|
|
|
$sort_style = $logged_in_user->prefs->thread_sorting;
|
2005-05-10 16:08:05 +00:00
|
|
|
} else {
|
2007-11-12 20:57:15 +00:00
|
|
|
$logged_in_user->prefs->update("thread_sorting=$sort_style");
|
2005-05-10 16:08:05 +00:00
|
|
|
}
|
2005-04-20 21:11:20 +00:00
|
|
|
|
2008-10-09 18:28:55 +00:00
|
|
|
$warning = null;
|
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-11-12 20:57:15 +00:00
|
|
|
check_tokens($logged_in_user->authenticator);
|
2008-10-09 18:28:55 +00:00
|
|
|
if (!akismet_check($logged_in_user, $content)) {
|
|
|
|
$warning = "Your post has been flagged as spam by the Akismet
|
|
|
|
anti-spam system. Please modify your text and try again.
|
|
|
|
";
|
|
|
|
$preview = tra("Preview");
|
|
|
|
} else {
|
|
|
|
create_post(
|
|
|
|
$content, $parent_post_id, $logged_in_user, $forum,
|
|
|
|
$thread, $add_signature
|
|
|
|
);
|
|
|
|
header('Location: forum_thread.php?id='.$thread->id);
|
|
|
|
}
|
2003-07-18 21:38:51 +00:00
|
|
|
}
|
|
|
|
|
2007-11-15 22:51:05 +00:00
|
|
|
page_head(tra("Post to thread"));
|
2003-07-18 21:38:51 +00:00
|
|
|
|
2007-11-15 00:27:02 +00:00
|
|
|
show_forum_header($logged_in_user);
|
2007-11-16 21:48:28 +00:00
|
|
|
|
|
|
|
switch ($forum->parent_type) {
|
|
|
|
case 0:
|
2007-11-15 22:51:05 +00:00
|
|
|
$category = BoincCategory::lookup_id($forum->category);
|
|
|
|
show_forum_title($category, $forum, $thread);
|
2007-11-16 21:48:28 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2007-11-26 04:12:15 +00:00
|
|
|
show_team_forum_title($forum, $thread);
|
2007-11-16 21:48:28 +00:00
|
|
|
break;
|
2007-11-15 22:51:05 +00:00
|
|
|
}
|
2007-11-23 21:05:52 +00:00
|
|
|
echo "<p>";
|
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";
|
|
|
|
}
|
|
|
|
|
2007-11-02 14:43:02 +00:00
|
|
|
start_forum_table(array(tra("Author"), tra("Message")));
|
2003-07-26 00:19:21 +00:00
|
|
|
|
2006-06-16 23:53:56 +00:00
|
|
|
show_message_row($thread, $parent_post);
|
2007-11-15 22:51:05 +00:00
|
|
|
show_posts($thread, $forum, $sort_style, $filter, $logged_in_user, true);
|
2007-11-12 20:57:15 +00:00
|
|
|
end_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) {
|
2008-06-05 04:35:21 +00:00
|
|
|
global $g_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) {
|
2007-11-12 20:57:15 +00:00
|
|
|
$x2 .=" reply to <a href=#".$parent_post->id.">Message ID ".$parent_post->id."</a>:";
|
2003-12-01 06:08:22 +00:00
|
|
|
}
|
2007-11-12 20:57:15 +00:00
|
|
|
$x2 .= "<form action=forum_reply.php?thread=".$thread->id;
|
2003-07-24 22:56:20 +00:00
|
|
|
|
2006-06-16 23:53:56 +00:00
|
|
|
if ($parent_post) {
|
2007-11-12 20:57:15 +00:00
|
|
|
$x2 .= "&post=".$parent_post->id;
|
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";
|
2008-06-05 04:35:21 +00:00
|
|
|
$x2 .= form_tokens($g_logged_in_user->authenticator);
|
2008-09-25 12:56:42 +00:00
|
|
|
$x2 .= "<textarea name=\"content\" rows=\"18\" cols=\"80\">";
|
|
|
|
$no_quote = get_int("no_quote", true)==1;
|
2007-09-29 12:53:16 +00:00
|
|
|
if ($preview) {
|
2008-06-05 20:32:21 +00:00
|
|
|
$x2 .= htmlspecialchars($content);
|
2008-09-25 12:56:42 +00:00
|
|
|
} else if (!$no_quote) {
|
2008-06-05 20:32:21 +00:00
|
|
|
if ($parent_post) $x2 .= quote_text(htmlspecialchars($parent_post->content), 80)."\n";
|
2007-09-29 12:53:16 +00:00
|
|
|
}
|
2008-06-05 04:35:21 +00:00
|
|
|
if (!$g_logged_in_user->prefs->no_signature_by_default){
|
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\">
|
2007-09-29 15:47:12 +00:00
|
|
|
<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
|
|
|
}
|
2007-11-12 20:57:15 +00:00
|
|
|
$cvs_version_tracker[]="\$Id$";
|
2003-11-28 22:35:01 +00:00
|
|
|
?>
|