$msg_post->poll_id = 0; $msg_post->msg_opt = 2; $msg_post->post_stamp = !empty($emsg->headers['date']) ? strtotime($emsg->headers['date']) : 0; if ($msg_post->post_stamp < 1 || $msg_post->post_stamp > __request_timestamp__) { mlist_error_log("Invalid Date", $emsg->raw_msg); if (($p = strpos($emsg->headers['received'], '; ')) !== false) { $p += 2; $msg_post->post_stamp = strtotime(substr($emsg->headers['received'], $p, strpos($emsg->headers['received'], '00 ', $p) + 2 - $p)); } if ($msg_post->post_stamp < 1 || $msg_post->post_stamp > __request_timestamp__) { $msg_post->post_stamp = __request_timestamp__; } } // try to determine whether this message is a reply or a new thread list($msg_post->reply_to, $msg_post->thread_id) = get_fud_reply_id($mlist->mlist_opt & 32, $frm->id, $msg_post->subject, $emsg->reply_to_msg_id); $msg_post->add($frm->id, $frm->message_threshold, 0, 0, false); // Handle File Attachments if ($mlist->mlist_opt & 8 && isset($emsg->attachments) && is_array($emsg->attachments)) { foreach ($emsg->attachments as $key => $val) { $tmpfname = tempnam($TMP, 'FUDf_'); $fp = fopen($tmpfname, 'wb'); fwrite($fp, $val); fclose($fp); $id = attach_add(array('name' => $key, 'size' => strlen($val), 'tmp_name' => $tmpfname), $msg_post->poster_id, 0, 1); $attach_list[$id] = $id; } if (isset($attach_list)) { attach_finalize($attach_list, $msg_post->id); } } if (!($mlist->mlist_opt & 1)) {
$msg_post->body = nl2br(htmlspecialchars($msg_post->body)); } } if ($frm->forum_opt & 24) { char_fix($msg_post->body); } if ($perms & 16384 && !($msg_post->msg_opt & 2)) { $msg_post->body = smiley_to_post($msg_post->body); } fud_wordwrap($msg_post->body); $msg_post->subject = htmlspecialchars(apply_custom_replace($msg_post->subject)); char_fix($msg_post->subject); /* chose to create thread OR add message OR update message */ if (!$th_id) { $create_thread = 1; $msg_post->add($frm->id, $frm->message_threshold, $frm->forum_opt, $perms & (64 | 4096), false); } else { if ($th_id && !$msg_id) { $msg_post->thread_id = $th_id; $msg_post->add_reply($reply_to, $th_id, $perms & (64 | 4096), false); } else { if ($msg_id) { $msg_post->id = $msg_id; $msg_post->thread_id = $th_id; $msg_post->post_stamp = $msg->post_stamp; $msg_post->sync(_uid, $frm->id, $frm->message_threshold, $perms & (64 | 4096)); /* log moderator edit */ if (_uid && _uid != $msg->poster_id) { logaction($usr->id, 'MSGEDIT', $msg_post->id); } } else {