} } else { $attach_count = 0; $file_array = ''; } /* deal with newly uploaded files */ if ($PRIVATE_ATTACHMENTS > 0 && isset($_FILES['attach_control']) && $_FILES['attach_control']['size'] > 0) { if ($_FILES['attach_control']['size'] > $PRIVATE_ATTACH_SIZE) { $MAX_F_SIZE = $PRIVATE_ATTACH_SIZE; $attach_control_error = '<font class="ErrorText">File Attachment is too big (over allowed limit of ' . $MAX_F_SIZE . ' bytes)</font><br>'; } else { if (filter_ext($_FILES['attach_control']['name'])) { $attach_control_error = '<font class="ErrorText">The file you are trying to upload doesn't match the allowed file types.</font><br>'; } else { if ($attach_count + 1 <= $PRIVATE_ATTACHMENTS) { $val = attach_add($_FILES['attach_control'], _uid, 1); $attach_list[$val] = $val; $attach_count++; } else { $attach_control_error = '<font class="ErrorText">You are trying to upload more files then it is allowed.</font><br>'; } } } } if (isset($_POST['btn_submit']) && !check_ppost_form($_POST['msg_subject']) || isset($_POST['btn_draft'])) { $msg_p = new fud_pmsg(); $msg_p->pmsg_opt = (int) $msg_smiley_disabled | (int) $msg_show_sig | (int) $msg_track; $msg_p->attach_cnt = $attach_count; $msg_p->icon = $msg_icon; $msg_p->body = $msg_body; $msg_p->subject = $msg_subject;
$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->approve($msg_post->id, true); }