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.
11 * FusionForge is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published
13 * by the Free Software Foundation; either version 2 of the License,
14 * or (at your option) any later version.
16 * FusionForge is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with FusionForge; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
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(_('ForumMessage:: 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(_('ForumMessage::create() Posting Failed').' '.db_error());
134 $msg_id=db_insertid($result,'forum_pending_messages','msg_id');
135 if (!$this->fetchModeratedData($msg_id)) {
141 $this->setError(_('ForumMessage::create() 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(_('Couldn\'t 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(_('ForumMessage::create() Posting Failed').' '.db_error());
219 $msg_id=db_insertid($result,'forum','msg_id');
220 if (!$this->fetchData($msg_id)) {
222 $this->setError(_('ForumMessage::create() Posting Failed').' '.db_error());
227 $this->setError(_('ForumMessage::create() 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 * @return boolean success.
254 function insertmsg($subject, $body, $thread_id='', $is_followup_to='',$user_id,$has_attach=false) {
256 $thread_id=$this->Forum->getNextThreadID();
259 $this->setError('ForumMessage::create() '._('Getting next thread_id failed'));
265 // increment the parent's followup count if necessary
267 $res4 = db_query_params ('UPDATE forum SET most_recent_date=$1 WHERE thread_id=$2 AND is_followup_to=0',
270 if (!$res4 || db_affected_rows($res4) < 1) {
271 $this->setError(_('Couldn\'t Update Master Thread parent with current time'));
276 // mark the parent with followups as an optimization later
278 $res3 = db_query_params ('UPDATE forum SET has_followups=1,most_recent_date=$1 WHERE msg_id=$2',
282 $this->setError(_('Could Not Update Parent'));
289 $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)',
290 array ($this->Forum->getID(),
292 htmlspecialchars($subject),
298 if (!$result || db_affected_rows($result) < 1) {
299 $this->setError(_('ForumMessage::create() Posting Failed').' '.db_error());
304 $msg_id=db_insertid($result,'forum','msg_id');
305 if (!$this->fetchData($msg_id)) {
312 $this->setError(_('ForumMessage::create() Unable to get new message id'));
316 if (!$this->sendNotice($has_attach)) {
322 //echo "db_error()".db_error();
323 $this->awaits_moderation = false;
329 * create - use this function to create a new message in the database.
331 * @param string The subject of the message.
332 * @param string The body of the message.
333 * @param int The thread_id of the message, if known.
334 * @param int The message_id of the parent message, if any.
335 * @param boolean Whether the message has an attach associated. Defaults to false
336 * @return boolean success.
338 function create($subject, $body, $thread_id='', $is_followup_to='',$has_attach=false) {
339 if (!$body || !$subject) {
340 $this->setError(_('Must Include A Message Body And Subject'));
343 if (!$this->Forum->userCanPost()) {
344 $this->setPermissionDeniedError();
347 if (!session_loggedin()) {
350 $user_id=user_getid();
353 if ($is_followup_to) {
354 $ParentMessage=new ForumMessage($this->Forum,$is_followup_to);
355 if (!$ParentMessage || !is_object($ParentMessage)) {
356 $this->setError("ForumMessage::create()"._('ForumMessage::create() No Valid ParentMessage Object'));
359 if ($ParentMessage->isError()) {
360 $this->setError('ForumMessage::create() '.$ParentMessage->getErrorMessage());
364 if (!$is_followup_to) {
370 //now we check the moderation status of the forum and act accordingly
371 $mod_level = $this->Forum->GetModerationLevel();
372 switch ($mod_level) {
375 return $this->insertmsg($subject, $body, $thread_id, $is_followup_to,$user_id,$has_attach);
378 //moderation for anonymous & non project users
379 if ($this->Forum->userIsModLvl1()) {
380 return $this->insertmoderated($subject, $body, $thread_id, $is_followup_to,$user_id);
382 return $this->insertmsg($subject, $body, $thread_id, $is_followup_to,$user_id,$has_attach);
386 //moderation for anyone who can post (even project members). admins can always post...
387 if ($this->Forum->userIsModLvl2()) {
388 return $this->insertmoderated($subject, $body, $thread_id, $is_followup_to,$user_id);
390 return $this->insertmsg($subject, $body, $thread_id, $is_followup_to,$user_id,$has_attach);
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(_('ForumMessage::fetchData() Invalid MessageID').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(_('ForumMessage::fetchData() Invalid MessageID').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 (!$this->Forum->userIsAdmin()) {
584 $this->setPermissionDeniedError();
588 /*$perm =& $this->Forum->Group->getPermission( session_get_user() );
590 if (!$perm || !is_object($perm) || !$perm->isForumAdmin()) {
591 $this->setPermissionDeniedError();
594 $result = db_query_params ('SELECT msg_id FROM forum
595 WHERE is_followup_to=$1
596 AND group_forum_id=$2',
598 $this->Forum->getID())) ;
599 $rows=db_numrows($result);
602 for ($i=0;$i<$rows;$i++) {
603 $msg = new ForumMessage($this->Forum,db_result($result,$i,'msg_id'));
604 $count += $msg->delete();
606 $toss = db_query_params ('DELETE FROM forum
608 AND group_forum_id=$2',
610 $this->Forum->getID())) ;
611 $res = db_query_params ('DELETE FROM forum_attachment where msg_id=$1',
619 * removebbcode - workaround to remove bbcode tags.
621 * @return string converted text
623 function removebbcode($text) {
624 //$replaced = preg_replace("/\[[_a-zA-Z]:.+\](.+)\[\/[_a-zA-Z]:.*\]/","$1",$text);
625 $replaced = preg_replace("/\[.+\](.+)\[\/.+\]/","$1",$text);
630 * sendNotice - contains the logic to send out email followups when a message is posted.
632 * @param boolean Whether the message has an attach associated. Defaults to false
634 * @return boolean success.
636 function sendNotice($has_attach=false) {
637 $ids =& $this->Forum->getMonitoringIDs();
639 $recipients = array ();
640 foreach ($ids as $id) {
641 $recipient = user_get_object ($id) ;
642 if ($recipient->isActive()) {
643 $recipients[] = $recipient ;
646 if ($this->Forum->getSendAllPostsTo()) {
647 $sapt = explode (',', $this->Forum->getSendAllPostsTo()) ;
648 foreach ($sapt as $r) {
653 if (count ($recipients) == 0) {
657 foreach ($recipients as $recipient) {
658 if (is_a ($recipient, 'GFUser')) {
659 setup_gettext_for_user ($recipient) ;
660 $dest_email = $recipient->getEmail ();
662 setup_gettext_from_sys_lang ();
663 $dest_email = $recipient ;
666 $body = sprintf(_("\nRead and respond to this message at: \n%s"), util_make_url ('/forum/message.php?msg_id='.$this->getID()));
667 if ($GLOBALS['sys_use_mail']) {
668 $body .= stripcslashes(sprintf(_('
669 Or reply to this e-mail entering your response between the following markers:
671 (enter your response here)
672 %1$s'), FORUM_MAIL_MARKER));
674 $body .= sprintf(_("\n\n\nBy: %s\n"), $this->getPosterRealName());
677 //if there's an attachment for the message, make it note.
678 //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
679 $body .= _("A file has been uploaded with this message.")."\n\n";
683 $sanitizer = new TextSanitizer();
684 $text = $this->getBody();
685 $text = $sanitizer->convertNeededTagsForEmail($text);
686 $text= strip_tags($this->removebbcode(util_line_wrap($text)));
687 $text = $sanitizer->convertExtendedCharsForEmail($text);
689 "%s\n\n______________________________________________________________________\n".
690 _("You are receiving this email because you elected to monitor this forum.".
691 "\nTo stop monitoring this forum, login to %s and visit: \n%s\n"),
693 forge_get_config ('forge_name'),
694 util_make_url('/forum/monitor.php?forum_id='.$this->Forum->getID().
695 '&group_id='.$this->Forum->Group->getID().'&stop=1')
698 $extra_headers = "Return-Path: <noreply@".$GLOBALS['sys_default_domain'].">\n";
699 $extra_headers .= "Errors-To: <noreply@".$GLOBALS['sys_default_domain'].">\n";
700 $extra_headers .= "Sender: <noreply@".$GLOBALS['sys_default_domain'].">\n";
701 $extra_headers .= "Reply-To: ".$this->Forum->getReturnEmailAddress()."\n";
702 $extra_headers .= "Precedence: Bulk\n"
703 ."List-Id: ".$this->Forum->getName()." <forum".$this->Forum->getId()."@".$GLOBALS['sys_default_domain'].">\n"
704 ."List-Help: ".util_make_url ('/forum/forum.php?id='.$this->Forum->getId())."\n"
705 ."Message-Id: <forumpost".$this->getId()."@".$GLOBALS['sys_default_domain'].">";
706 $parentid = $this->getParentId();
707 if (!empty($parentid)) {
708 $extra_headers .= "\nIn-Reply-To: ".$this->Forum->getReturnEmailAddress()."\n"
709 ."References: <forumpost".$this->getParentId()."@".$GLOBALS['sys_default_domain'].">";
712 $subject="[" . $this->Forum->getUnixName() ."][".$this->getID()."] ".util_unconvert_htmlspecialchars($this->getSubject());
714 util_send_message($dest_email,$subject,$body,"noreply@".$GLOBALS['sys_default_domain'],'','Forum',$extra_headers);
717 // Switch back to the user language settings
718 setup_gettext_from_context();
723 * sendNewModeratedMsgNotice - contains the logic to send out email notifications to the forum admins when a new moderated message is posted
725 * @return boolean success.
727 function sendNewModeratedMsgNotice() {
728 $ids =& $this->Forum->getForumAdminIDs();
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().'@'.$GLOBALS['sys_default_domain'];
754 $extra_headers = "Return-Path: <noreply@".$GLOBALS['sys_default_domain'].">\n";
755 $extra_headers .= "Errors-To: <noreply@".$GLOBALS['sys_default_domain'].">\n";
756 $extra_headers .= "Sender: <noreply@".$GLOBALS['sys_default_domain'].">\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()."@".$GLOBALS['sys_default_domain'].">\n"
760 ."List-Help: ".util_make_url('/forum/forum.php?id='.$this->Forum->getId())."\n"
761 ."Message-Id: <forumpost".$this->getId()."@".$GLOBALS['sys_default_domain'].">";
762 $parentid = $this->getParentId();
763 if (!empty($parentid)) {
764 $extra_headers .= "\nIn-Reply-To: ".$this->Forum->getReturnEmailAddress()."\n"
765 ."References: <forumpost".$this->getParentId()."@".$GLOBALS['sys_default_domain'].">";
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@".$GLOBALS['sys_default_domain'],$BCC,'Forum',$extra_headers);
779 // util_handle_message(array_unique($ids),$subject,$body,$this->Forum->getSendAllPostsTo(),'','forumgateway@'.$GLOBALS[sys_default_domain]);
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@".$GLOBALS['sys_default_domain'].">\n";
860 $extra_headers .= "Errors-To: <noreply@".$GLOBALS['sys_default_domain'].">\n";
861 $extra_headers .= "Sender: <noreply@".$GLOBALS['sys_default_domain'].">\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()."@".$GLOBALS['sys_default_domain'].">\n"
865 ."List-Help: ".util_make_url('/forum/forum.php?id='.$this->Forum->getId())."\n"
866 ."Message-Id: <forumpost".$this->getId()."@".$GLOBALS['sys_default_domain'].">";
867 $parentid = $this->getParentId();
868 if (!empty($parentid)) {
869 $extra_headers .= "\nIn-Reply-To: ".$this->Forum->getReturnEmailAddress()."\n"
870 ."References: <forumpost".$this->getParentId()."@".$GLOBALS['sys_default_domain'].">";
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@".$GLOBALS['sys_default_domain'],$BCC,'Forum',$extra_headers);
891 // c-file-style: "bsd"