.
require_once("boinc_db.inc");
require_once("sanitize_html.inc");
require_once("bbcode_html.inc");
function pm_header() {
echo "
\n";
}
function pm_form($replyto, $userid, $error = null) {
global $bbcode_html, $bbcode_js;
global $g_logged_in_user;
page_head(tra("Send private message"),'','','', $bbcode_js);
if (post_str("preview", true) == tra("Preview")) {
$options = new output_options;
echo tra("Preview");
echo "\n";
echo output_transform(post_str("content", true), $options);
echo "
\n";
}
$subject = null;
$content = null;
if ($replyto) {
$message = BoincPrivateMessage::lookup_id($replyto);
if (!$message || $message->userid != $g_logged_in_user->id) {
error_page("no such message");
}
$content = "[quote]".$message->content."[/quote]\n";
$userid = $message->senderid;
$user = BoincUser::lookup_id($userid);
if ($user) {
$writeto = $userid." (".$user->name.")";
}
$subject = $message->subject;
if (substr($subject, 0, 3) != "re:") {
$subject = "re: ".$subject;
}
} elseif ($userid) {
$user = BoincUser::lookup_id($userid);
if ($user) {
$writeto = $userid." (".$user->name.")";
}
} else {
$writeto = sanitize_tags(post_str("to", true));
$subject = post_str("subject", true);
$content = post_str("content", true);
}
$content = htmlspecialchars($content);
$subject = htmlspecialchars($subject);
if ($error != null) {
echo "".$error."
\n";
}
echo "