5 * Copyright 1999-2000, Tim Perdue/Sourceforge
6 * Copyright 2002, Tim Perdue/GForge, LLC
7 * Copyright 2009, Roland Mas
9 * This file is part of FusionForge. FusionForge is free software;
10 * you can redistribute it and/or modify it under the terms of the
11 * GNU General Public License as published by the Free Software
12 * Foundation; either version 2 of the Licence, or (at your option)
15 * FusionForge is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 require_once $gfcommon.'include/Error.class.php';
26 include_once $gfcommon.'include/TextSanitizer.class.php'; // for parsing the mail body
27 include_once $gfcommon.'include/User.class.php';
29 class ForumMessage extends Error {
31 var $awaits_moderation;//boolean -> true if the message was inserted for approval (pending), false if not
33 * Associative array of data from db.
35 * @var array $data_array.
49 * @param object The Forum object to which this ForumMessage is associated.
50 * @param int The message_id.
51 * @param array The associative array of data.
52 * @param boolean Whether the message is a pending one.
53 * @return boolean success.
55 function ForumMessage(&$Forum, $msg_id=false, $arr=false, $pending=false) {
57 if (!$Forum || !is_object($Forum)) {
58 $this->setError(_('ForumMessage:: No Valid Forum Object'));
61 if ($Forum->isError()) {
62 $this->setError('ForumMessage:: '.$Forum->getErrorMessage());
65 $this->Forum =& $Forum;
69 //we are going to create the pending message to show it to the admin for moderation
70 if (!$this->fetchModeratedData($msg_id)) {
73 $this->awaits_moderation = true;
75 $this->awaits_moderation = false;
76 if (!$arr || !is_array($arr)) {
77 if (!$this->fetchData($msg_id)) {
81 $this->data_array =& $arr;
83 // Verify this message truly belongs to this Forum
85 if ($this->data_array['group_forum_id'] != $this->Forum->getID()) {
86 $this->setError(_('Group_forum_id in db result does not match Forum Object'));
87 $this->data_array=null;
97 * insertmoderated - inserts the message into the table for moderation (forum_pending_messages)
98 * @param string The subject of the message.
99 * @param string The body of the message.
100 * @param int The thread_id of the message, if known.
101 * @param int The message_id of the parent message, if any.
102 * @param int The id of the user that is posting the message
103 * @return boolean success.
106 function insertmoderated($subject, $body, $thread_id='', $is_followup_to='',$user_id) {
108 $thread_id=$this->Forum->getNextThreadID();
111 $this->setError('ForumMessage::create() '._('Getting next thread_id failed'));
117 $result = db_query_params ('INSERT INTO forum_pending_messages (group_forum_id,posted_by,subject,
118 body,post_date,is_followup_to,thread_id,most_recent_date) VALUES ($1,$2,$3,$4,$5,$6,$7,$8)',
119 array ($this->Forum->getID(),
121 htmlspecialchars($subject),
127 if (!$result || db_affected_rows($result) < 1) {
128 $this->setError(_('ForumMessage::create() Posting Failed').' '.db_error());
132 $msg_id=db_insertid($result,'forum_pending_messages','msg_id');
133 if (!$this->fetchModeratedData($msg_id)) {
139 $this->setError(_('ForumMessage::create() Unable to get new message id'));
142 if (!$this->sendNewModeratedMsgNotice()) {
147 $this->awaits_moderation = true;
155 * insertreleasedmsg - inserts the released message into the main table (forum)
156 * @param string The Forum id
157 * @param string The subject of the message.
158 * @param string The body of the message.
159 * @param string The post date
160 * @param int The thread_id of the message
161 * @param int The message_id of the parent message, if any.
162 * @param int The id of the user that is posting the message
163 * @param int has followups?
164 * @param int most recent date
165 * @return boolean success.
168 function insertreleasedmsg($group_forum_id,$subject, $body,$post_date, $thread_id, $is_followup_to,$posted_by,$has_followups,$most_recent_date) {
169 if ($is_followup_to != 0) {
171 //was posted in reply to another thread
172 //we must check whether that thread still exists. if it does, post the message. else, set the error
174 // increment the parent's followup count if necessary
177 $res4 = db_query_params ('UPDATE forum SET most_recent_date=$1 WHERE thread_id=$2 AND is_followup_to=0',
180 if (!$res4 || db_affected_rows($res4) < 1) {
181 $this->setError(_('Couldn\'t Update Master Thread parent with current time'));
186 // mark the parent with followups as an optimization later
188 $res3 = db_query_params ('UPDATE forum SET has_followups=1,most_recent_date=$1 WHERE msg_id=$2',
192 $this->setError(_('Could Not Update Parent'));
202 $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)',
203 array ($group_forum_id,
205 htmlspecialchars($subject),
210 $most_recent_date)) ;
212 if (!$result || db_affected_rows($result) < 1) {
213 $this->setError(_('ForumMessage::create() Posting Failed').' '.db_error());
217 $msg_id=db_insertid($result,'forum','msg_id');
218 if (!$this->fetchData($msg_id)) {
219 $this->setError(_('ForumMessage::create() Posting Failed').' '.db_error());
224 $this->setError(_('ForumMessage::create() Unable to get new message id'));
228 if (!$this->sendNotice()) {
233 $this->awaits_moderation = false;
242 * insertmsg - inserts the message into the main table (forum)
243 * @param string The subject of the message.
244 * @param string The body of the message.
245 * @param int The thread_id of the message, if known.
246 * @param int The message_id of the parent message, if any.
247 * @param int The id of the user that is posting the message
248 * @param boolean Whether the message has an attach associated. Defaults to false
249 * @param int The timestamp of the message to insert, defaults to 0.
250 * @return boolean success.
252 function insertmsg($subject, $body, $thread_id='', $is_followup_to='',$user_id,$has_attach=false,$timestamp=0) {
253 if ($timestamp == 0){
257 $thread_id=$this->Forum->getNextThreadID();
260 $this->setError('ForumMessage::create() '._('Getting next thread_id failed'));
265 $most_recent_lookup = db_query_params ('SELECT most_recent_date FROM forum WHERE thread_id=$1 AND is_followup_to=0',array($thread_id));
266 if (db_result($most_recent_lookup, 0, 'most_recent_date') <= $timestamp) {
268 // increment the parent's followup count if necessary
270 $res4 = db_query_params ('UPDATE forum SET most_recent_date=$1 WHERE thread_id=$2 AND is_followup_to=0',
273 if (!$res4 || db_affected_rows($res4) < 1) {
274 $this->setError(_('Couldn\'t Update Master Thread parent with current time'));
279 // Only update the time if set time < timestamp (set to current time if not done for an import)
281 $res3 = db_query_params ('UPDATE forum SET most_recent_date=$1 WHERE msg_id=$2',
285 $this->setError(_('Could Not Update Parent'));
292 // mark the parent with followups as an optimization later
294 $res3 = db_query_params ('UPDATE forum SET has_followups=1 WHERE msg_id=$1',
295 array ($is_followup_to)) ;
297 $this->setError(_('Could Not Update Parent'));
303 $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)',
304 array ($this->Forum->getID(),
306 htmlspecialchars($subject),
312 if (!$result || db_affected_rows($result) < 1) {
313 $this->setError(_('ForumMessage::create() Posting Failed').' '.db_error());
318 $msg_id=db_insertid($result,'forum','msg_id');
319 if (!$this->fetchData($msg_id)) {
325 $this->setError(_('ForumMessage::create() Unable to get new message id'));
330 if (!$this->sendNotice($has_attach)) {
336 //echo "db_error()".db_error();
337 $this->awaits_moderation = false;
343 * create - use this function to create a new message in the database.
345 * @param string The subject of the message.
346 * @param string The body of the message.
347 * @param int The thread_id of the message, if known.
348 * @param int The message_id of the parent message, if any.
349 * @param boolean Whether the message has an attach associated. Defaults to false
350 * @param int The timestamp of the message to create. Defaults to 0, meaning the timestamp used for this message will be "time()"
351 * @return boolean success.
353 function create($subject, $body, $thread_id='', $is_followup_to='',$has_attach=false, $timestamp = 0) {
354 if (!$body || !$subject) {
355 $this->setError(_('Must Include A Message Body And Subject'));
358 if (!forge_check_perm ('forum', $this->Forum->getID(), 'post')) {
359 $this->setPermissionDeniedError();
362 if (!session_loggedin()) {
365 $user_id=user_getid();
368 if ($is_followup_to) {
369 $ParentMessage=new ForumMessage($this->Forum,$is_followup_to);
370 if (!$ParentMessage || !is_object($ParentMessage)) {
371 $this->setError("ForumMessage::create()"._('ForumMessage::create() No Valid ParentMessage Object'));
374 if ($ParentMessage->isError()) {
375 $this->setError('ForumMessage::create() '.$ParentMessage->getErrorMessage());
379 if (!$is_followup_to) {
385 //now we check the moderation status of the forum and act accordingly
386 if (forge_check_perm ('forum', $this->Forum->getID(), 'unmoderated_post')) {
388 return $this->insertmsg($subject, $body, $thread_id, $is_followup_to,$user_id,$has_attach,$timestamp);
390 return $this->insertmoderated($subject, $body, $thread_id, $is_followup_to,$user_id);
395 * fetchData - re-fetch the data for this forum_message from the database.
397 * @param int The message ID.
398 * @return boolean success.
400 function fetchData($msg_id) {
401 $res = db_query_params ('SELECT * FROM forum_user_vw WHERE msg_id=$1 AND group_forum_id=$2',
403 $this->Forum->getID())) ;
404 if (!$res || db_numrows($res) < 1) {
405 $this->setError(_('ForumMessage::fetchData() Invalid MessageID').db_error());
408 $this->data_array = db_fetch_array($res);
409 db_free_result($res);
414 * fetchModeratedData - re-fetch the data for this forum_message from the database, for pending messages
416 * @param int The message ID.
417 * @return boolean success.
419 function fetchModeratedData($msg_id) {
420 $res = db_query_params ('SELECT * FROM forum_pending_user_vw WHERE msg_id=$1 AND group_forum_id=$2',
422 $this->Forum->getID())) ;
423 if (!$res || db_numrows($res) < 1) {
424 $this->setError(_('ForumMessage::fetchData() Invalid MessageID').db_error());
427 $this->data_array = db_fetch_array($res);
428 db_free_result($res);
433 * getForum - get the Forum object this ForumMessage is associated with.
435 * @return object The Forum object.
437 function &getForum() {
442 * getID - get this message_id.
444 * @return int The message_id.
447 return $this->data_array['msg_id'];
451 * getPosterName - get the unix user_name of this message's poster.
453 * @return string The poster's unix name.
455 function getPosterName() {
456 return $this->data_array['user_name'];
460 * getPosterID - get this user_id of this message's poster.
462 * @return int The user_id.
464 function getPosterID() {
465 return $this->data_array['posted_by'];
469 * getPosterRealName - get the real name of this message's poster.
471 * @return string The real name.
473 function getPosterRealName() {
474 return $this->data_array['realname'];
478 * getSubject - get the subject of this message.
480 * @return string The subject.
482 function getSubject() {
483 return $this->data_array['subject'];
487 * getBody - get the body of this message.
489 * @return String The body.
492 return $this->data_array['body'];
496 * getPostDate - get the post date of this message.
498 * @return int The post date.
500 function getPostDate() {
501 return $this->data_array['post_date'];
505 * getParentID - get the id of the parent message, if this is a followup.
507 * @return int The parent id.
509 function getParentID() {
510 return $this->data_array['is_followup_to'];
514 * isPending - is the message pending, awaiting moderation?
516 * @return int awaits_moderation
518 function isPending() {
519 return $this->awaits_moderation;
523 * getThreadID - get the thread_id of the message.
525 * @return int The thread_id.
527 function getThreadID() {
528 return $this->data_array['thread_id'];
532 * getMostRecentDate - get the date of the most recent followup.
534 * @return int The date of the most recent followup.
536 function getMostRecentDate() {
537 return $this->data_array['most_recent_date'];
541 * hasFollowups - whether this message has any followups.
543 * @return boolean has_followups.
545 function hasFollowups() {
546 return $this->data_array['has_followups'];
550 * hasAttach - whether this message has an attachment.
552 * @return boolean has_attach.
555 function hasAttach() {
556 if ($this->isPending()) {
557 $res = db_query_params ('SELECT attachmentid FROM forum_pending_attachment WHERE msg_id=$1',
558 array ($this->getID())) ;
560 $res = db_query_params ('SELECT attachmentid FROM forum_attachment WHERE msg_id=$1',
561 array ($this->getID())) ;
563 if (db_numrows($res) > 0) {
570 * delete - Delete this message and its followups.
572 * @return int The count of deleted messages.
575 $msg_id=$this->getID();
577 $this->setError(_('Invalid Message ID'));
581 if (!forge_check_perm ('forum_admin', $this->Forum->Group->getID())) {
582 $this->setPermissionDeniedError();
586 $result = db_query_params ('SELECT msg_id FROM forum
587 WHERE is_followup_to=$1
588 AND group_forum_id=$2',
590 $this->Forum->getID())) ;
591 $rows=db_numrows($result);
594 for ($i=0;$i<$rows;$i++) {
595 $msg = new ForumMessage($this->Forum,db_result($result,$i,'msg_id'));
596 $count += $msg->delete();
598 $toss = db_query_params ('DELETE FROM forum
600 AND group_forum_id=$2',
602 $this->Forum->getID())) ;
604 $res = db_query_params ('DELETE FROM forum_attachment where msg_id=$1',
611 * removebbcode - workaround to remove bbcode tags.
613 * @return string converted text
615 function removebbcode($text) {
616 //$replaced = preg_replace("/\[[_a-zA-Z]:.+\](.+)\[\/[_a-zA-Z]:.*\]/","$1",$text);
617 $replaced = preg_replace("/\[.+\](.+)\[\/.+\]/","$1",$text);
622 * sendNotice - contains the logic to send out email followups when a message is posted.
624 * @param boolean Whether the message has an attach associated. Defaults to false
626 * @return boolean success.
628 function sendNotice($has_attach=false) {
629 $ids = $this->Forum->getMonitoringIDs();
631 $recipients = array ();
632 foreach ($ids as $id) {
633 $recipient = user_get_object ($id) ;
634 if ($recipient->isActive()) {
635 $recipients[] = $recipient ;
638 if ($this->Forum->getSendAllPostsTo()) {
639 $sapt = explode (',', $this->Forum->getSendAllPostsTo()) ;
640 foreach ($sapt as $r) {
645 if (count ($recipients) == 0) {
649 foreach ($recipients as $recipient) {
650 if ($recipient instanceof GFUser) {
651 setup_gettext_for_user ($recipient) ;
652 $dest_email = $recipient->getEmail ();
654 setup_gettext_from_sys_lang ();
655 $dest_email = $recipient ;
658 $body = sprintf(_("\nRead and respond to this message at: \n%s"), util_make_url ('/forum/message.php?msg_id='.$this->getID()));
659 if (forge_get_config('use_mail') && forge_get_config('use_forum_mail_replies')) {
660 $body .= stripcslashes(sprintf(_('
661 Or reply to this e-mail entering your response between the following markers:
663 (enter your response here)
664 %1$s'), FORUM_MAIL_MARKER));
666 $body .= sprintf(_("\n\n\nBy: %s\n"), $this->getPosterRealName());
669 //if there's an attachment for the message, make it note.
670 //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
671 $body .= _("A file has been uploaded with this message.")."\n\n";
675 $sanitizer = new TextSanitizer();
676 $text = $this->getBody();
677 $text = $sanitizer->convertNeededTagsForEmail($text);
678 $text= strip_tags($this->removebbcode(util_line_wrap($text)));
679 $text = $sanitizer->convertExtendedCharsForEmail($text);
681 "%s\n\n______________________________________________________________________\n".
682 _("You are receiving this email because you elected to monitor this forum.".
683 "\nTo stop monitoring this forum, login to %s and visit: \n%s\n"),
685 forge_get_config ('forge_name'),
686 util_make_url('/forum/monitor.php?forum_id='.$this->Forum->getID().
687 '&group_id='.$this->Forum->Group->getID().'&stop=1')
690 $extra_headers = "Return-Path: <noreply@".forge_get_config('web_host').">\n";
691 $extra_headers .= "Errors-To: <noreply@".forge_get_config('web_host').">\n";
692 $extra_headers .= "Sender: <noreply@".forge_get_config('web_host').">\n";
693 if (forge_get_config('use_mail') && forge_get_config('use_forum_mail_replies')) {
694 $extra_headers .= "Reply-To: ".$this->Forum->getReturnEmailAddress()."\n";
696 $extra_headers .= "Precedence: Bulk\n"
697 ."List-Id: ".$this->Forum->getName()." <forum".$this->Forum->getId()."@".forge_get_config('web_host').">\n"
698 ."List-Help: ".util_make_url ('/forum/forum.php?id='.$this->Forum->getId())."\n"
699 ."Message-Id: <forumpost".$this->getId()."@".forge_get_config('web_host').">";
700 $parentid = $this->getParentId();
701 if (!empty($parentid)) {
702 $extra_headers .= "\nIn-Reply-To: ".$this->Forum->getReturnEmailAddress()."\n"
703 ."References: <forumpost".$this->getParentId()."@".forge_get_config('web_host').">";
706 $subject="[" . $this->Forum->getUnixName() ."][".$this->getID()."] ".util_unconvert_htmlspecialchars($this->getSubject());
708 util_send_message($dest_email,$subject,$body,"noreply@".forge_get_config('web_host'),'','Forum',$extra_headers);
711 // Switch back to the user language settings
712 setup_gettext_from_context();
717 * sendNewModeratedMsgNotice - contains the logic to send out email notifications to the forum admins when a new moderated message is posted
719 * @return boolean success.
721 function sendNewModeratedMsgNotice() {
723 $engine = RBACEngine::getInstance () ;
724 $moderators = $engine->getUsersByAllowedAction ('forum', $this->Forum->getID(), 'moderate') ;
726 foreach ($moderators as $m) {
727 $ids[] = $m->getID () ;
731 // See if there is anyone to send messages to
733 if (!count($ids) > 0 && !$this->Forum->getSendAllPostsTo()) {
737 $f =& $this->getForum();
738 $g =& $f->getGroup();
740 $body = "\nRead to this message and approve/reject it at: ".
741 "\n".util_make_url('/forum/admin/pending.php?action=view_pending&group_id='. $g->getID() . "&forum_id=" . $f->getID()) .
742 "\nBy: " . $this->getPosterRealName() . "\n\n";
744 $text = $this->getBody();
745 $sanitizer = new TextSanitizer();
746 $text = $sanitizer->convertNeededTagsForEmail($text);
747 $text= strip_tags($this->removebbcode(util_line_wrap($text)));
748 $text = $sanitizer->convertExtendedCharsForEmail($text);
750 "\n\n______________________________________________________________________".
751 "\nYou are receiving this email because the forum you administrate has a new moderated message awaiting your approval.";
753 //$extra_headers = 'Reply-to: '.$this->Forum->getUnixName().'@'.forge_get_config('web_host');
754 $extra_headers = "Return-Path: <noreply@".forge_get_config('web_host').">\n";
755 $extra_headers .= "Errors-To: <noreply@".forge_get_config('web_host').">\n";
756 $extra_headers .= "Sender: <noreply@".forge_get_config('web_host').">\n";
757 $extra_headers .= "Reply-To: ".$this->Forum->getReturnEmailAddress()."\n";
758 $extra_headers .= "Precedence: Bulk\n"
759 ."List-Id: ".$this->Forum->getName()." <forum".$this->Forum->getId()."@".forge_get_config('web_host').">\n"
760 ."List-Help: ".util_make_url('/forum/forum.php?id='.$this->Forum->getId())."\n"
761 ."Message-Id: <forumpost".$this->getId()."@".forge_get_config('web_host').">";
762 $parentid = $this->getParentId();
763 if (!empty($parentid)) {
764 $extra_headers .= "\nIn-Reply-To: ".$this->Forum->getReturnEmailAddress()."\n"
765 ."References: <forumpost".$this->getParentId()."@".forge_get_config('web_host').">";
768 $subject="[" . $this->Forum->getUnixName() ."][".$this->getID()."] ".util_unconvert_htmlspecialchars($this->getSubject());
769 if (count($ids) != 0) {
770 $bccres = db_query_params ('SELECT email FROM users WHERE status=$1 AND user_id = ANY ($2)',
772 db_int_array_to_any_clause ($ids))) ;
775 $BCC = implode(util_result_column_to_array($bccres),',').','.$this->Forum->getSendAllPostsTo();
776 $User = user_get_object($this->getPosterID());
777 //util_send_message('',$subject,$body,$User->getEmail(),$BCC,$this->getPosterRealName(),$extra_headers);
778 util_send_message('',$subject,$body,"noreply@".forge_get_config('web_host'),$BCC,'Forum',$extra_headers);
779 // util_handle_message(array_unique($ids),$subject,$body,$this->Forum->getSendAllPostsTo(),'','forumgateway@'.forge_get_config('web_host'));
784 * updatemsg - impacts in the DB the new content of the message
786 * @param string The forum ID
787 * @param int The id of the user that is posting the message
788 * @param string The subject of the message.
789 * @param string The body of the message.
790 * @param string The post date
791 * @param int The message_id of the parent message, if any.
792 * @param int The thread_id of the message, if known.
793 * @param int has followups?
794 * @param string The most recent date.
796 * @return boolean success.
798 function updatemsg($group_forum_id,$posted_by,$subject,$body,$post_date,$is_followup_to,$thread_id,$has_followups,$most_recent_date) {
799 $subject = htmlspecialchars($subject);
801 $msg_id = $this->getID();
802 $res = db_query_params ('UPDATE forum
803 SET group_forum_id=$1, posted_by=$2, subject=$3,
804 body=$4, post_date=$5, is_followup_to=$6,
805 thread_id=$7, most_recent_date=$8
807 array ($group_forum_id,
817 $this->setError(db_error());
820 if (db_affected_rows($res)<1) {
821 $this->setError("Message not found");
829 * sendAttachNotice - contains the logic to send out email attachement followups when a message is posted.
831 * @param int attach_id - The id of the file that has been attached
833 * @return boolean success.
835 function sendAttachNotice($attach_id) {
837 $ids = $this->Forum->getMonitoringIDs();
840 // See if there is anyone to send messages to
842 if (!count($ids) > 0 && !$this->Forum->getSendAllPostsTo()) {
846 $body = "\nRead and respond to this message at: ".
847 "\n".util_make_url('/forum/message.php?msg_id='.$this->getID()).
848 "\nBy: " . $this->getPosterRealName() . "\n\n";
850 $body .= "A file has been uploaded to this message, you can download it at: ".
851 "\n".util_make_url('/forum/attachment.php?attachid='. $attach_id . "&group_id=" . $this->Forum->Group->getID() . "&forum_id=" . $this->Forum->getID()) . "\n\n";
854 "\n\n______________________________________________________________________".
855 "\nYou are receiving this email because you elected to monitor this forum.".
856 "\nTo stop monitoring this forum, login to ".forge_get_config ('forge_name')." and visit: ".
857 "\n".util_make_url ('/forum/monitor.php?forum_id='.$this->Forum->getID() .'&group_id='.$this->Forum->Group->getID().'&stop=1');
859 $extra_headers = "Return-Path: <noreply@".forge_get_config('web_host').">\n";
860 $extra_headers .= "Errors-To: <noreply@".forge_get_config('web_host').">\n";
861 $extra_headers .= "Sender: <noreply@".forge_get_config('web_host').">\n";
862 $extra_headers .= "Reply-To: ".$this->Forum->getReturnEmailAddress()."\n";
863 $extra_headers .= "Precedence: Bulk\n"
864 ."List-Id: ".$this->Forum->getName()." <forum".$this->Forum->getId()."@".forge_get_config('web_host').">\n"
865 ."List-Help: ".util_make_url('/forum/forum.php?id='.$this->Forum->getId())."\n"
866 ."Message-Id: <forumpost".$this->getId()."@".forge_get_config('web_host').">";
867 $parentid = $this->getParentId();
868 if (!empty($parentid)) {
869 $extra_headers .= "\nIn-Reply-To: ".$this->Forum->getReturnEmailAddress()."\n"
870 ."References: <forumpost".$this->getParentId()."@".forge_get_config('web_host').">";
873 $subject="[" . $this->Forum->getUnixName() ."][".$this->getID()."] ".util_unconvert_htmlspecialchars($this->getSubject());
874 if (count($ids) != 0) {
875 $bccres = db_query_params ('SELECT email FROM users WHERE status=$1 AND user_id = ANY ($2)',
877 db_int_array_to_any_clause ($ids))) ;
879 $BCC = implode(util_result_column_to_array($bccres),',').','.$this->Forum->getSendAllPostsTo();
880 $User = user_get_object($this->getPosterID());
881 util_send_message('',$subject,$body,"noreply@".forge_get_config('web_host'),$BCC,'Forum',$extra_headers);
891 // c-file-style: "bsd"