/* this allows us to mark the message we are sending notification about as read, so that we do not re-notify the user * until this message is read. */ db_li('INSERT INTO fud_read (thread_id, msg_id, last_view, user_id) SELECT '.$mtf->thread_id.', 0, 0, id FROM fud_users WHERE id IN('.implode(',', $tl).')', $dummy); } if ($to) { send_notifications($to, $mtf->id, $mtf->subject, $mtf->alias, $notify_type, ($notify_type == 'thr' ? $mtf->thread_id : $mtf->forum_id), $mtf->frm_name, $mtf->forum_id); } // Handle Mailing List and/or Newsgroup syncronization. if (($mtf->nntp_id || $mtf->mlist_id) && !$mtf->mlist_msg_id) { fud_use('email_msg_format.inc', true); $from = $mtf->poster_id ? reverse_fmt($mtf->alias).' <'.$mtf->email.'>' : $GLOBALS['ANON_NICK'].' <'.$GLOBALS['NOTIFY_FROM'].'>'; $body = $mtf->body . (($mtf->msg_opt & 1 && $mtf->sig) ? "\n--\n" . $mtf->sig : ''); plain_text($body); $mtf->subject = reverse_fmt($mtf->subject); if ($mtf->reply_to) { $replyto_id = q_singleval('SELECT mlist_msg_id FROM fud_msg WHERE id='.$mtf->reply_to); } else { $replyto_id = 0; } if ($mtf->attach_cnt) { $r = uq("SELECT a.id, a.original_name, CASE WHEN m.mime_hdr IS NULL THEN 'application/octet-stream' ELSE m.mime_hdr END FROM fud_attach a LEFT JOIN fud_mime m ON a.mime_type=m.id WHERE a.message_id=".$mtf->id." AND a.attach_opt=0"); while ($ent = db_rowarr($r)) { $attach[$ent[1]] = file_get_contents($GLOBALS['FILE_STORE'].$ent[0].'.atch'); if ($mtf->mlist_id) { $attach_mime[$ent[1]] = $ent[2]; } } } else { $attach_mime = $attach = null; } if ($mtf->nntp_id) { fud_use('nntp.inc', true); $nntp_adm = db_sab('SELECT * FROM fud_nntp WHERE id='.$mtf->nntp_id); $nntp = new fud_nntp; $nntp->server = $nntp_adm->server; $nntp->newsgroup = $nntp_adm->newsgroup; $nntp->port = $nntp_adm->port; $nntp->timeout = $nntp_adm->timeout; $nntp->nntp_opt = $nntp_adm->nntp_opt; $nntp->login = $nntp_adm->login; $nntp->pass = $nntp_adm->pass; define('sql_p', 'fud_'); $lock = $nntp->get_lock(); $nntp->post_message($mtf->subject, $body, $from, $mtf->id, $replyto_id, $attach); $nntp->close_connection(); $nntp->release_lock($lock); } else { fud_use('mlist_post.inc', true); $r = db_saq('SELECT name, additional_headers FROM fud_mlist WHERE id='.$mtf->mlist_id); mail_list_post($r[0], $from, $mtf->subject, $body, $mtf->id, $replyto_id, $attach, $attach_mime, $r[1]); } } } } function write_body($data, &$len, &$offset, $fid=0) { $MAX_FILE_SIZE = 2147483647;