5 * Copyright 1999-2000, Tim Perdue/Sourceforge
6 * Copyright 2002, Tim Perdue/GForge, LLC
7 * Copyright 2009, Roland Mas
8 * Copyright 2013, Franck Villaume - TrivialDev
9 * Copyright 2013, French Ministry of National Education
11 * This file is part of FusionForge. FusionForge is free software;
12 * you can redistribute it and/or modify it under the terms of the
13 * GNU General Public License as published by the Free Software
14 * Foundation; either version 2 of the Licence, or (at your option)
17 * FusionForge is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License along
23 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 require_once $gfcommon.'include/Error.class.php';
28 include_once $gfcommon.'include/TextSanitizer.class.php'; // for parsing the mail body
29 include_once $gfcommon.'include/User.class.php';
31 class ForumMessage extends Error {
33 var $awaits_moderation;//boolean -> true if the message was inserted for approval (pending), false if not
35 * Associative array of data from db.
37 * @var array $data_array.
51 * @param object The Forum object to which this ForumMessage is associated.
52 * @param int The message_id.
53 * @param array The associative array of data.
54 * @param boolean Whether the message is a pending one.
55 * @return boolean success.
57 function ForumMessage(&$Forum, $msg_id=false, $arr=false, $pending=false) {
59 if (!$Forum || !is_object($Forum)) {
60 $this->setError(_('No Valid Forum Object'));
63 if ($Forum->isError()) {
64 $this->setError('ForumMessage:: '.$Forum->getErrorMessage());
67 $this->Forum =& $Forum;
71 //we are going to create the pending message to show it to the admin for moderation
72 if (!$this->fetchModeratedData($msg_id)) {
75 $this->awaits_moderation = true;
77 $this->awaits_moderation = false;
78 if (!$arr || !is_array($arr)) {
79 if (!$this->fetchData($msg_id)) {
83 $this->data_array =& $arr;
85 // Verify this message truly belongs to this Forum
87 if ($this->data_array['group_forum_id'] != $this->Forum->getID()) {
88 $this->setError(_('Group_forum_id in db result does not match Forum Object'));
89 $this->data_array=null;
99 * insertmoderated - inserts the message into the table for moderation (forum_pending_messages)
100 * @param string The subject of the message.
101 * @param string The body of the message.
102 * @param int The thread_id of the message, if known.
103 * @param int The message_id of the parent message, if any.
104 * @param int The id of the user that is posting the message
105 * @return boolean success.
108 function insertmoderated($subject, $body, $thread_id='', $is_followup_to='',$user_id) {
110 $thread_id=$this->Forum->getNextThreadID();
113 $this->setError('ForumMessage::create() '._('Getting next thread_id failed'));
119 $result = db_query_params ('INSERT INTO forum_pending_messages (group_forum_id,posted_by,subject,
120 body,post_date,is_followup_to,thread_id,most_recent_date) VALUES ($1,$2,$3,$4,$5,$6,$7,$8)',
121 array ($this->Forum->getID(),
123 htmlspecialchars($subject),
129 if (!$result || db_affected_rows($result) < 1) {
130 $this->setError(_('Posting Failed').' '.db_error());
134 $msg_id=db_insertid($result,'forum_pending_messages','msg_id');
135 if (!$this->fetchModeratedData($msg_id)) {
141 $this->setError(_('Unable to get new message id'));
144 if (!$this->sendNewModeratedMsgNotice()) {
149 $this->awaits_moderation = true;
157 * insertreleasedmsg - inserts the released message into the main table (forum)
158 * @param string The Forum id
159 * @param string The subject of the message.
160 * @param string The body of the message.
161 * @param string The post date
162 * @param int The thread_id of the message
163 * @param int The message_id of the parent message, if any.
164 * @param int The id of the user that is posting the message
165 * @param int has followups?
166 * @param int most recent date
167 * @return boolean success.
170 function insertreleasedmsg($group_forum_id,$subject, $body,$post_date, $thread_id, $is_followup_to,$posted_by,$has_followups,$most_recent_date) {
171 if ($is_followup_to != 0) {
173 //was posted in reply to another thread
174 //we must check whether that thread still exists. if it does, post the message. else, set the error
176 // increment the parent's followup count if necessary
179 $res4 = db_query_params ('UPDATE forum SET most_recent_date=$1 WHERE thread_id=$2 AND is_followup_to=0',
182 if (!$res4 || db_affected_rows($res4) < 1) {
183 $this->setError(_('Could not Update Master Thread parent with current time'));
188 // mark the parent with followups as an optimization later
190 $res3 = db_query_params ('UPDATE forum SET has_followups=1,most_recent_date=$1 WHERE msg_id=$2',
194 $this->setError(_('Could Not Update Parent'));
204 $result = db_query_params ('INSERT INTO forum (group_forum_id,posted_by,subject,body,post_date,is_followup_to,thread_id,most_recent_date) VALUES ($1,$2,$3,$4,$5,$6,$7,$8)',
205 array ($group_forum_id,
207 htmlspecialchars($subject),
212 $most_recent_date)) ;
214 if (!$result || db_affected_rows($result) < 1) {
215 $this->setError(_('Posting Failed').' '.db_error());
219 $msg_id=db_insertid($result,'forum','msg_id');
220 if (!$this->fetchData($msg_id)) {
221 $this->setError(_('Posting Failed').' '.db_error());
226 $this->setError(_('Unable to get new message id'));
230 if (!$this->sendNotice()) {
235 $this->awaits_moderation = false;
244 * insertmsg - inserts the message into the main table (forum)
245 * @param string The subject of the message.
246 * @param string The body of the message.
247 * @param int The thread_id of the message, if known.
248 * @param int The message_id of the parent message, if any.
249 * @param int The id of the user that is posting the message
250 * @param boolean Whether the message has an attach associated. Defaults to false
251 * @param int The timestamp of the message to insert, defaults to 0.
252 * @return boolean success.
254 function insertmsg($subject, $body, $thread_id='', $is_followup_to='',$user_id,$has_attach=false,$timestamp=0) {
255 if ($timestamp == 0){
259 $thread_id=$this->Forum->getNextThreadID();
262 $this->setError('ForumMessage::create() '._('Getting next thread_id failed'));
267 $most_recent_lookup = db_query_params ('SELECT most_recent_date FROM forum WHERE thread_id=$1 AND is_followup_to=0',array($thread_id));
268 if (db_result($most_recent_lookup, 0, 'most_recent_date') <= $timestamp) {
270 // increment the parent's followup count if necessary
272 $res4 = db_query_params ('UPDATE forum SET most_recent_date=$1 WHERE thread_id=$2 AND is_followup_to=0',
275 if (!$res4 || db_affected_rows($res4) < 1) {
276 $this->setError(_('Couldn\'t Update Master Thread parent with current time'));
281 // Only update the time if set time < timestamp (set to current time if not done for an import)
283 $res3 = db_query_params ('UPDATE forum SET most_recent_date=$1 WHERE msg_id=$2',
287 $this->setError(_('Could Not Update Parent'));
294 // mark the parent with followups as an optimization later
296 $res3 = db_query_params ('UPDATE forum SET has_followups=1 WHERE msg_id=$1',
297 array ($is_followup_to)) ;
299 $this->setError(_('Could Not Update Parent'));
305 $result = db_query_params ('INSERT INTO forum (group_forum_id,posted_by,subject,body,post_date,is_followup_to,thread_id,most_recent_date) VALUES ($1,$2,$3,$4,$5,$6,$7,$8)',
306 array ($this->Forum->getID(),
308 htmlspecialchars($subject),
314 if (!$result || db_affected_rows($result) < 1) {
315 $this->setError(_('Posting Failed').' '.db_error());
320 $msg_id=db_insertid($result,'forum','msg_id');
321 if (!$this->fetchData($msg_id)) {
327 $this->setError(_('Unable to get new message id'));
332 if (!$this->sendNotice($has_attach)) {
338 //echo "db_error()".db_error();
339 $this->awaits_moderation = false;
345 * create - use this function to create a new message in the database.
347 * @param string The subject of the message.
348 * @param string The body of the message.
349 * @param int The thread_id of the message, if known.
350 * @param int The message_id of the parent message, if any.
351 * @param boolean Whether the message has an attach associated. Defaults to false
352 * @param int The timestamp of the message to create. Defaults to 0, meaning the timestamp used for this message will be "time()"
353 * @return boolean success.
355 function create($subject, $body, $thread_id='', $is_followup_to='',$has_attach=false, $timestamp = 0) {
356 if (!strlen(trim($body)) || !strlen(trim($subject))) {
357 $this->setError(_('Error: a forum message must include a message body and a subject.'));
360 if (!forge_check_perm ('forum', $this->Forum->getID(), 'post')) {
361 $this->setPermissionDeniedError();
364 if (!session_loggedin()) {
367 $user_id=user_getid();
370 if ($is_followup_to) {
371 $ParentMessage=new ForumMessage($this->Forum,$is_followup_to);
372 if (!$ParentMessage || !is_object($ParentMessage)) {
373 $this->setError("ForumMessage::create()"._('ForumMessage::create() No Valid ParentMessage Object'));
376 if ($ParentMessage->isError()) {
377 $this->setError('ForumMessage::create() '.$ParentMessage->getErrorMessage());
381 if (!$is_followup_to) {
387 //now we check the moderation status of the forum and act accordingly
388 if (forge_check_perm ('forum', $this->Forum->getID(), 'unmoderated_post')) {
390 return $this->insertmsg($subject, $body, $thread_id, $is_followup_to,$user_id,$has_attach,$timestamp);
392 return $this->insertmoderated($subject, $body, $thread_id, $is_followup_to,$user_id);
397 * fetchData - re-fetch the data for this forum_message from the database.
399 * @param int The message ID.
400 * @return boolean success.
402 function fetchData($msg_id) {
403 $res = db_query_params ('SELECT * FROM forum_user_vw WHERE msg_id=$1 AND group_forum_id=$2',
405 $this->Forum->getID())) ;
406 if (!$res || db_numrows($res) < 1) {
407 $this->setError(_('Invalid Message ID').db_error());
410 $this->data_array = db_fetch_array($res);
411 db_free_result($res);
416 * fetchModeratedData - re-fetch the data for this forum_message from the database, for pending messages
418 * @param int The message ID.
419 * @return boolean success.
421 function fetchModeratedData($msg_id) {
422 $res = db_query_params ('SELECT * FROM forum_pending_user_vw WHERE msg_id=$1 AND group_forum_id=$2',
424 $this->Forum->getID())) ;
425 if (!$res || db_numrows($res) < 1) {
426 $this->setError(_('Invalid Message ID').db_error());
429 $this->data_array = db_fetch_array($res);
430 db_free_result($res);
435 * getForum - get the Forum object this ForumMessage is associated with.
437 * @return object The Forum object.
439 function &getForum() {
444 * getID - get this message_id.
446 * @return int The message_id.
449 return $this->data_array['msg_id'];
453 * getPosterName - get the unix user_name of this message's poster.
455 * @return string The poster's unix name.
457 function getPosterName() {
458 return $this->data_array['user_name'];
462 * getPosterID - get this user_id of this message's poster.
464 * @return int The user_id.
466 function getPosterID() {
467 return $this->data_array['posted_by'];
471 * getPosterRealName - get the real name of this message's poster.
473 * @return string The real name.
475 function getPosterRealName() {
476 return $this->data_array['realname'];
480 * getSubject - get the subject of this message.
482 * @return string The subject.
484 function getSubject() {
485 return $this->data_array['subject'];
489 * getBody - get the body of this message.
491 * @return String The body.
494 return $this->data_array['body'];
498 * getPostDate - get the post date of this message.
500 * @return int The post date.
502 function getPostDate() {
503 return $this->data_array['post_date'];
507 * getParentID - get the id of the parent message, if this is a followup.
509 * @return int The parent id.
511 function getParentID() {
512 return $this->data_array['is_followup_to'];
516 * isPending - is the message pending, awaiting moderation?
518 * @return int awaits_moderation
520 function isPending() {
521 return $this->awaits_moderation;
525 * getThreadID - get the thread_id of the message.
527 * @return int The thread_id.
529 function getThreadID() {
530 return $this->data_array['thread_id'];
534 * getMostRecentDate - get the date of the most recent followup.
536 * @return int The date of the most recent followup.
538 function getMostRecentDate() {
539 return $this->data_array['most_recent_date'];
543 * hasFollowups - whether this message has any followups.
545 * @return boolean has_followups.
547 function hasFollowups() {
548 return $this->data_array['has_followups'];
552 * hasAttach - whether this message has an attachment.
554 * @return boolean has_attach.
557 function hasAttach() {
558 if ($this->isPending()) {
559 $res = db_query_params ('SELECT attachmentid FROM forum_pending_attachment WHERE msg_id=$1',
560 array ($this->getID())) ;
562 $res = db_query_params ('SELECT attachmentid FROM forum_attachment WHERE msg_id=$1',
563 array ($this->getID())) ;
565 if (db_numrows($res) > 0) {
572 * delete - Delete this message and its followups.
574 * @return int The count of deleted messages.
577 $msg_id=$this->getID();
579 $this->setError(_('Invalid Message ID'));
583 if (!forge_check_perm ('forum_admin', $this->Forum->Group->getID())) {
584 $this->setPermissionDeniedError();
588 $result = db_query_params ('SELECT msg_id FROM forum
589 WHERE is_followup_to=$1
590 AND group_forum_id=$2',
592 $this->Forum->getID())) ;
593 $rows=db_numrows($result);
596 for ($i=0;$i<$rows;$i++) {
597 $msg = new ForumMessage($this->Forum,db_result($result,$i,'msg_id'));
598 $count += $msg->delete();
600 $toss = db_query_params ('DELETE FROM forum
602 AND group_forum_id=$2',
604 $this->Forum->getID())) ;
606 $res = db_query_params ('DELETE FROM forum_attachment where msg_id=$1',
613 * removebbcode - workaround to remove bbcode tags.
615 * @return string converted text
617 function removebbcode($text) {
618 //$replaced = preg_replace("/\[[_a-zA-Z]:.+\](.+)\[\/[_a-zA-Z]:.*\]/","$1",$text);
619 $replaced = preg_replace("/\[.+\](.+)\[\/.+\]/","$1",$text);
624 * sendNotice - contains the logic to send out email followups when a message is posted.
626 * @param boolean Whether the message has an attach associated. Defaults to false
628 * @return boolean success.
630 function sendNotice($has_attach=false) {
631 $ids = $this->Forum->getMonitoringIDs();
633 $recipients = array ();
634 foreach ($ids as $id) {
635 $recipient = user_get_object ($id) ;
636 if ($recipient->isActive()) {
637 $recipients[] = $recipient ;
640 if ($this->Forum->getSendAllPostsTo()) {
641 $sapt = explode (',', $this->Forum->getSendAllPostsTo()) ;
642 foreach ($sapt as $r) {
647 if (count ($recipients) == 0) {
651 foreach ($recipients as $recipient) {
652 if ($recipient instanceof GFUser) {
653 setup_gettext_for_user ($recipient) ;
654 $dest_email = $recipient->getEmail ();
656 setup_gettext_from_sys_lang ();
657 $dest_email = $recipient ;
660 $body = sprintf(_("\nRead and respond to this message at: \n%s"), util_make_url ('/forum/message.php?msg_id='.$this->getID()));
661 if (forge_get_config('use_mail') && forge_get_config('use_forum_mail_replies')) {
662 $body .= stripcslashes(sprintf(_('
663 Or reply to this e-mail entering your response between the following markers:
665 (enter your response here)
666 %1$s'), FORUM_MAIL_MARKER));
668 $body .= sprintf(_("\n\n\nBy: %s\n"), $this->getPosterRealName());
671 //if there's an attachment for the message, make it note.
672 //Note: We can't give a link for the attachment here because it hasn't been created yet (first the message needs to be created
673 $body .= _("A file has been uploaded with this message.")."\n\n";
677 $sanitizer = new TextSanitizer();
678 $text = $this->getBody();
679 $text = $sanitizer->convertNeededTagsForEmail($text);
680 $text= strip_tags($this->removebbcode(util_line_wrap($text)));
681 $text = $sanitizer->convertExtendedCharsForEmail($text);
683 "%s\n\n______________________________________________________________________\n".
684 _("You are receiving this email because you elected to monitor this forum.".
685 "\nTo stop monitoring this forum, login to %s and visit: \n%s\n"),
687 forge_get_config ('forge_name'),
688 util_make_url('/forum/monitor.php?forum_id='.$this->Forum->getID().
689 '&group_id='.$this->Forum->Group->getID().'&stop=1')
692 $extra_headers = "Return-Path: <noreply@".forge_get_config('web_host').">\n";
693 $extra_headers .= "Errors-To: <noreply@".forge_get_config('web_host').">\n";
694 $extra_headers .= "Sender: <noreply@".forge_get_config('web_host').">\n";
695 if (forge_get_config('use_mail') && forge_get_config('use_forum_mail_replies')) {
696 $extra_headers .= "Reply-To: ".$this->Forum->getReturnEmailAddress()."\n";
698 $extra_headers .= "Precedence: Bulk\n"
699 ."List-Id: ".$this->Forum->getName()." <forum".$this->Forum->getId()."@".forge_get_config('web_host').">\n"
700 ."List-Help: ".util_make_url ('/forum/forum.php?id='.$this->Forum->getId())."\n"
701 ."Message-Id: <forumpost".$this->getId()."@".forge_get_config('web_host').">";
702 $parentid = $this->getParentId();
703 if (!empty($parentid)) {
704 $extra_headers .= "\nIn-Reply-To: ".$this->Forum->getReturnEmailAddress()."\n"
705 ."References: <forumpost".$this->getParentId()."@".forge_get_config('web_host').">";
708 $subject="[" . $this->Forum->getUnixName() ."][".$this->getID()."] ".util_unconvert_htmlspecialchars($this->getSubject());
710 util_send_message($dest_email,$subject,$body,"noreply@".forge_get_config('web_host'),'','Forum',$extra_headers);
713 // Switch back to the user language settings
714 setup_gettext_from_context();
719 * sendNewModeratedMsgNotice - contains the logic to send out email notifications to the forum admins when a new moderated message is posted
721 * @return boolean success.
723 function sendNewModeratedMsgNotice() {
725 $engine = RBACEngine::getInstance () ;
726 $moderators = $engine->getUsersByAllowedAction ('forum', $this->Forum->getID(), 'moderate') ;
728 foreach ($moderators as $m) {
729 $ids[] = $m->getID () ;
733 // See if there is anyone to send messages to
735 if (!count($ids) > 0 && !$this->Forum->getSendAllPostsTo()) {
739 $f =& $this->getForum();
740 $g =& $f->getGroup();
742 $body = "\nRead to this message and approve/reject it at: ".
743 "\n".util_make_url('/forum/admin/pending.php?action=view_pending&group_id='. $g->getID() . "&forum_id=" . $f->getID()) .
744 "\nBy: " . $this->getPosterRealName() . "\n\n";
746 $text = $this->getBody();
747 $sanitizer = new TextSanitizer();
748 $text = $sanitizer->convertNeededTagsForEmail($text);
749 $text= strip_tags($this->removebbcode(util_line_wrap($text)));
750 $text = $sanitizer->convertExtendedCharsForEmail($text);
752 "\n\n______________________________________________________________________".
753 "\nYou are receiving this email because the forum you administrate has a new moderated message awaiting your approval.";
755 //$extra_headers = 'Reply-to: '.$this->Forum->getUnixName().'@'.forge_get_config('web_host');
756 $extra_headers = "Return-Path: <noreply@".forge_get_config('web_host').">\n";
757 $extra_headers .= "Errors-To: <noreply@".forge_get_config('web_host').">\n";
758 $extra_headers .= "Sender: <noreply@".forge_get_config('web_host').">\n";
759 $extra_headers .= "Reply-To: ".$this->Forum->getReturnEmailAddress()."\n";
760 $extra_headers .= "Precedence: Bulk\n"
761 ."List-Id: ".$this->Forum->getName()." <forum".$this->Forum->getId()."@".forge_get_config('web_host').">\n"
762 ."List-Help: ".util_make_url('/forum/forum.php?id='.$this->Forum->getId())."\n"
763 ."Message-Id: <forumpost".$this->getId()."@".forge_get_config('web_host').">";
764 $parentid = $this->getParentId();
765 if (!empty($parentid)) {
766 $extra_headers .= "\nIn-Reply-To: ".$this->Forum->getReturnEmailAddress()."\n"
767 ."References: <forumpost".$this->getParentId()."@".forge_get_config('web_host').">";
770 $subject="[" . $this->Forum->getUnixName() ."][".$this->getID()."] ".util_unconvert_htmlspecialchars($this->getSubject());
771 if (count($ids) != 0) {
772 $bccres = db_query_params ('SELECT email FROM users WHERE status=$1 AND user_id = ANY ($2)',
774 db_int_array_to_any_clause ($ids))) ;
777 $BCC = implode(util_result_column_to_array($bccres),',').','.$this->Forum->getSendAllPostsTo();
778 $User = user_get_object($this->getPosterID());
779 //util_send_message('',$subject,$body,$User->getEmail(),$BCC,$this->getPosterRealName(),$extra_headers);
780 util_send_message('',$subject,$body,"noreply@".forge_get_config('web_host'),$BCC,'Forum',$extra_headers);
781 // util_handle_message(array_unique($ids),$subject,$body,$this->Forum->getSendAllPostsTo(),'','forumgateway@'.forge_get_config('web_host'));
786 * updatemsg - impacts in the DB the new content of the message
788 * @param string The forum ID
789 * @param int The id of the user that is posting the message
790 * @param string The subject of the message.
791 * @param string The body of the message.
792 * @param string The post date
793 * @param int The message_id of the parent message, if any.
794 * @param int The thread_id of the message, if known.
795 * @param int has followups?
796 * @param string The most recent date.
798 * @return boolean success.
800 function updatemsg($group_forum_id,$posted_by,$subject,$body,$post_date,$is_followup_to,$thread_id,$has_followups,$most_recent_date) {
801 if (!strlen(trim($body)) || !strlen(trim($subject))) {
802 $this->setError(_('Error: a forum message must include a message body and a subject.'));
805 $subject = htmlspecialchars($subject);
806 $msg_id = $this->getID();
807 $res = db_query_params ('UPDATE forum
808 SET group_forum_id=$1, posted_by=$2, subject=$3,
809 body=$4, post_date=$5, is_followup_to=$6,
810 thread_id=$7, most_recent_date=$8
812 array ($group_forum_id,
822 $this->setError(db_error());
825 if (db_affected_rows($res)<1) {
826 $this->setError("Message not found");
834 * sendAttachNotice - contains the logic to send out email attachement followups when a message is posted.
836 * @param int attach_id - The id of the file that has been attached
838 * @return boolean success.
840 function sendAttachNotice($attach_id) {
842 $ids = $this->Forum->getMonitoringIDs();
845 // See if there is anyone to send messages to
847 if (!count($ids) > 0 && !$this->Forum->getSendAllPostsTo()) {
851 $body = "\nRead and respond to this message at: ".
852 "\n".util_make_url('/forum/message.php?msg_id='.$this->getID()).
853 "\nBy: " . $this->getPosterRealName() . "\n\n";
855 $body .= "A file has been uploaded to this message, you can download it at: ".
856 "\n".util_make_url('/forum/attachment.php?attachid='. $attach_id . "&group_id=" . $this->Forum->Group->getID() . "&forum_id=" . $this->Forum->getID()) . "\n\n";
859 "\n\n______________________________________________________________________".
860 "\nYou are receiving this email because you elected to monitor this forum.".
861 "\nTo stop monitoring this forum, login to ".forge_get_config ('forge_name')." and visit: ".
862 "\n".util_make_url ('/forum/monitor.php?forum_id='.$this->Forum->getID() .'&group_id='.$this->Forum->Group->getID().'&stop=1');
864 $extra_headers = "Return-Path: <noreply@".forge_get_config('web_host').">\n";
865 $extra_headers .= "Errors-To: <noreply@".forge_get_config('web_host').">\n";
866 $extra_headers .= "Sender: <noreply@".forge_get_config('web_host').">\n";
867 $extra_headers .= "Reply-To: ".$this->Forum->getReturnEmailAddress()."\n";
868 $extra_headers .= "Precedence: Bulk\n"
869 ."List-Id: ".$this->Forum->getName()." <forum".$this->Forum->getId()."@".forge_get_config('web_host').">\n"
870 ."List-Help: ".util_make_url('/forum/forum.php?id='.$this->Forum->getId())."\n"
871 ."Message-Id: <forumpost".$this->getId()."@".forge_get_config('web_host').">";
872 $parentid = $this->getParentId();
873 if (!empty($parentid)) {
874 $extra_headers .= "\nIn-Reply-To: ".$this->Forum->getReturnEmailAddress()."\n"
875 ."References: <forumpost".$this->getParentId()."@".forge_get_config('web_host').">";
878 $subject="[" . $this->Forum->getUnixName() ."][".$this->getID()."] ".util_unconvert_htmlspecialchars($this->getSubject());
879 if (count($ids) != 0) {
880 $bccres = db_query_params ('SELECT email FROM users WHERE status=$1 AND user_id = ANY ($2)',
882 db_int_array_to_any_clause ($ids))) ;
884 $BCC = implode(util_result_column_to_array($bccres),',').','.$this->Forum->getSendAllPostsTo();
885 $User = user_get_object($this->getPosterID());
886 util_send_message('',$subject,$body,"noreply@".forge_get_config('web_host'),$BCC,'Forum',$extra_headers);
896 // c-file-style: "bsd"