5 * Copyright 1999-2000, Tim Perdue/Sourceforge
6 * Copyright 2002, Tim Perdue/GForge, LLC
8 * This file is part of FusionForge.
10 * FusionForge is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published
12 * by the Free Software Foundation; either version 2 of the License,
13 * or (at your option) any later version.
15 * FusionForge is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with FusionForge; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
26 require_once $gfcommon.'include/Error.class.php';
27 include_once $gfcommon.'include/TextSanitizer.class.php'; // for parsing the mail body
28 include_once $gfcommon.'include/User.class.php';
30 class ForumMessage extends Error {
32 var $awaits_moderation;//boolean -> true if the message was inserted for approval (pending), false if not
34 * Associative array of data from db.
36 * @var array $data_array.
50 * @param object The Forum object to which this ForumMessage is associated.
51 * @param int The message_id.
52 * @param array The associative array of data.
53 * @param boolean Whether the message is a pending one.
54 * @return boolean success.
56 function ForumMessage(&$Forum, $msg_id=false, $arr=false, $pending=false) {
58 if (!$Forum || !is_object($Forum)) {
59 $this->setError(_('ForumMessage:: No Valid Forum Object'));
62 if ($Forum->isError()) {
63 $this->setError('ForumMessage:: '.$Forum->getErrorMessage());
66 $this->Forum =& $Forum;
70 //we are going to create the pending message to show it to the admin for moderation
71 if (!$this->fetchModeratedData($msg_id)) {
74 $this->awaits_moderation = true;
76 $this->awaits_moderation = false;
77 if (!$arr || !is_array($arr)) {
78 if (!$this->fetchData($msg_id)) {
82 $this->data_array =& $arr;
84 // Verify this message truly belongs to this Forum
86 if ($this->data_array['group_forum_id'] != $this->Forum->getID()) {
87 $this->setError(_('Group_forum_id in db result does not match Forum Object'));
88 $this->data_array=null;
98 * insertmoderated - inserts the message into the table for moderation (forum_pending_messages)
99 * @param string The subject of the message.
100 * @param string The body of the message.
101 * @param int The thread_id of the message, if known.
102 * @param int The message_id of the parent message, if any.
103 * @param int The id of the user that is posting the message
104 * @return boolean success.
107 function insertmoderated($subject, $body, $thread_id='', $is_followup_to='',$user_id) {
109 $thread_id=$this->Forum->getNextThreadID();
112 $this->setError('ForumMessage::create() '._('Getting next thread_id failed'));
118 $sql="INSERT INTO forum_pending_messages (group_forum_id,posted_by,subject,
119 body,post_date,is_followup_to,thread_id,most_recent_date)
120 VALUES ('". $this->Forum->getID() ."', '$user_id', '". htmlspecialchars($subject) ."',
121 '". $body ."', '". time() ."','$is_followup_to','$thread_id','". time() ."')";
123 $result=db_query($sql);
124 if (!$result || db_affected_rows($result) < 1) {
125 $this->setError(_('ForumMessage::create() Posting Failed').' '.db_error());
129 $msg_id=db_insertid($result,'forum_pending_messages','msg_id');
130 if (!$this->fetchModeratedData($msg_id)) {
136 $this->setError(_('ForumMessage::create() Unable to get new message id'));
139 if (!$this->sendNewModeratedMsgNotice()) {
144 $this->awaits_moderation = true;
152 * insertreleasedmsg - inserts the released message into the main table (forum)
153 * @param string The Forum id
154 * @param string The subject of the message.
155 * @param string The body of the message.
156 * @param string The post date
157 * @param int The thread_id of the message
158 * @param int The message_id of the parent message, if any.
159 * @param int The id of the user that is posting the message
160 * @param int has followups?
161 * @param int most recent date
162 * @return boolean success.
165 function insertreleasedmsg($group_forum_id,$subject, $body,$post_date, $thread_id, $is_followup_to,$posted_by,$has_followups,$most_recent_date) {
166 if ($is_followup_to != 0) {
168 //was posted in reply to another thread
169 //we must check whether that thread still exists. if it does, post the message. else, set the error
171 // increment the parent's followup count if necessary
174 $res4=db_query("UPDATE forum SET most_recent_date='". time() ."'
175 WHERE thread_id='$thread_id' AND is_followup_to='0'");
176 if (!$res4 || db_affected_rows($res4) < 1) {
177 $this->setError(_('Couldn\'t Update Master Thread parent with current time'));
182 // mark the parent with followups as an optimization later
184 $res3=db_query("UPDATE forum SET has_followups='1',most_recent_date='". time() ."'
185 WHERE msg_id='$is_followup_to'");
187 $this->setError(_('Could Not Update Parent'));
197 $sql="INSERT INTO forum (group_forum_id,posted_by,subject,
198 body,post_date,is_followup_to,thread_id,most_recent_date)
199 VALUES ('". $group_forum_id ."', '$posted_by', '". htmlspecialchars($subject) ."',
200 '". $body ."', '". $post_date ."','$is_followup_to','$thread_id','". $most_recent_date ."')";
202 $result=db_query($sql);
203 if (!$result || db_affected_rows($result) < 1) {
204 $this->setError(_('ForumMessage::create() Posting Failed').' '.db_error());
208 $msg_id=db_insertid($result,'forum','msg_id');
209 if (!$this->fetchData($msg_id)) {
211 $this->setError(_('ForumMessage::create() Posting Failed').' '.db_error());
216 $this->setError(_('ForumMessage::create() Unable to get new message id'));
219 if (!$this->sendNotice()) {
224 $this->awaits_moderation = false;
233 * insertmsg - inserts the message into the main table (forum)
234 * @param string The subject of the message.
235 * @param string The body of the message.
236 * @param int The thread_id of the message, if known.
237 * @param int The message_id of the parent message, if any.
238 * @param int The id of the user that is posting the message
239 * @param boolean Whether the message has an attach associated. Defaults to false
240 * @return boolean success.
243 function insertmsg($subject, $body, $thread_id='', $is_followup_to='',$user_id,$has_attach=false) {
245 $thread_id=$this->Forum->getNextThreadID();
248 $this->setError('ForumMessage::create() '._('Getting next thread_id failed'));
254 // increment the parent's followup count if necessary
256 $res4=db_query("UPDATE forum SET most_recent_date='". time() ."'
257 WHERE thread_id='$thread_id' AND is_followup_to='0'");
258 if (!$res4 || db_affected_rows($res4) < 1) {
259 $this->setError(_('Couldn\'t Update Master Thread parent with current time'));
264 // mark the parent with followups as an optimization later
266 $res3=db_query("UPDATE forum SET has_followups='1',most_recent_date='". time() ."'
267 WHERE msg_id='$is_followup_to'");
269 $this->setError(_('Could Not Update Parent'));
276 $sql="INSERT INTO forum (group_forum_id,posted_by,subject,
277 body,post_date,is_followup_to,thread_id,most_recent_date)
278 VALUES ('". $this->Forum->getID() ."', '$user_id', '". htmlspecialchars($subject) ."',
279 '". $body ."', '". time() ."','$is_followup_to','$thread_id','". time() ."')";
281 $result=db_query($sql);
282 if (!$result || db_affected_rows($result) < 1) {
283 $this->setError(_('ForumMessage::create() Posting Failed').' '.db_error());
288 $msg_id=db_insertid($result,'forum','msg_id');
289 if (!$this->fetchData($msg_id)) {
296 $this->setError(_('ForumMessage::create() Unable to get new message id'));
300 if (!$this->sendNotice($has_attach)) {
306 //echo "db_error()".db_error();
307 $this->awaits_moderation = false;
313 * create - use this function to create a new message in the database.
315 * @param string The subject of the message.
316 * @param string The body of the message.
317 * @param int The thread_id of the message, if known.
318 * @param int The message_id of the parent message, if any.
319 * @param boolean Whether the message has an attach associated. Defaults to false
320 * @return boolean success.
322 function create($subject, $body, $thread_id='', $is_followup_to='',$has_attach=false) {
323 if (!$body || !$subject) {
324 $this->setError(_('Must Include A Message Body And Subject'));
327 if (!$this->Forum->userCanPost()) {
328 $this->setPermissionDeniedError();
331 if (!session_loggedin()) {
334 $user_id=user_getid();
337 if ($is_followup_to) {
338 $ParentMessage=new ForumMessage($this->Forum,$is_followup_to);
339 if (!$ParentMessage || !is_object($ParentMessage)) {
340 $this->setError("ForumMessage::create()"._('ForumMessage::create() No Valid ParentMessage Object'));
343 if ($ParentMessage->isError()) {
344 $this->setError('ForumMessage::create() '.$ParentMessage->getErrorMessage());
348 if (!$is_followup_to) {
352 //see if that message has been posted already for all the idiots that double-post
353 //we shouldn't need this, the double post checker functions solve this issue now
354 /*$res3=db_query("SELECT * FROM forum
355 WHERE is_followup_to='$is_followup_to'
356 AND body='". htmlspecialchars($body) ."'
357 AND subject='". htmlspecialchars($subject) ."'
358 AND group_forum_id='". $this->Forum->getId() ."'
359 AND posted_by='$user_id'");
361 if (db_numrows($res3) > 0) {
362 //already posted this message
363 $this->setError(_('You appear to be double-posting this message, since it has the same subject and followup information as a prior post.'));
371 //now we check the moderation status of the forum and act accordingly
372 $mod_level = $this->Forum->GetModerationLevel();
373 switch ($mod_level) {
376 return $this->insertmsg($subject, $body, $thread_id, $is_followup_to,$user_id,$has_attach);
379 //moderation for anonymous & non project users
380 if ($this->Forum->userIsModLvl1()) {
381 return $this->insertmoderated($subject, $body, $thread_id, $is_followup_to,$user_id);
383 return $this->insertmsg($subject, $body, $thread_id, $is_followup_to,$user_id,$has_attach);
387 //moderation for anyone who can post (even project members). admins can always post...
388 if ($this->Forum->userIsModLvl2()) {
389 return $this->insertmoderated($subject, $body, $thread_id, $is_followup_to,$user_id);
391 return $this->insertmsg($subject, $body, $thread_id, $is_followup_to,$user_id,$has_attach);
398 * fetchData - re-fetch the data for this forum_message from the database.
400 * @param int The message ID.
401 * @return boolean success.
403 function fetchData($msg_id) {
404 $res=db_query("SELECT * FROM forum_user_vw
405 WHERE msg_id='$msg_id'
406 AND group_forum_id='". $this->Forum->getID() ."'");
407 if (!$res || db_numrows($res) < 1) {
408 $this->setError(_('ForumMessage::fetchData() Invalid MessageID').db_error());
411 $this->data_array =& db_fetch_array($res);
412 db_free_result($res);
417 * fetchModeratedData - re-fetch the data for this forum_message from the database, for pending messages
419 * @param int The message ID.
420 * @return boolean success.
422 function fetchModeratedData($msg_id) {
423 $res=db_query("SELECT * FROM forum_pending_user_vw
424 WHERE msg_id='$msg_id'
425 AND group_forum_id='". $this->Forum->getID() ."'");
426 if (!$res || db_numrows($res) < 1) {
427 $this->setError(_('ForumMessage::fetchData() Invalid MessageID').db_error());
430 $this->data_array =& db_fetch_array($res);
431 db_free_result($res);
436 * getForum - get the Forum object this ForumMessage is associated with.
438 * @return object The Forum object.
440 function &getForum() {
445 * getID - get this message_id.
447 * @return int The message_id.
450 return $this->data_array['msg_id'];
454 * getPosterName - get the unix user_name of this message's poster.
456 * @return string The poster's unix name.
458 function getPosterName() {
459 return $this->data_array['user_name'];
463 * getPosterID - get this user_id of this message's poster.
465 * @return int The user_id.
467 function getPosterID() {
468 return $this->data_array['posted_by'];
472 * getPosterRealName - get the real name of this message's poster.
474 * @return string The real name.
476 function getPosterRealName() {
477 return $this->data_array['realname'];
481 * getSubject - get the subject of this message.
483 * @return string The subject.
485 function getSubject() {
486 return $this->data_array['subject'];
490 * getBody - get the body of this message.
492 * @return String The body.
495 return $this->data_array['body'];
499 * getPostDate - get the post date of this message.
501 * @return int The post date.
503 function getPostDate() {
504 return $this->data_array['post_date'];
508 * getParentID - get the id of the parent message, if this is a followup.
510 * @return int The parent id.
512 function getParentID() {
513 return $this->data_array['is_followup_to'];
517 * isPending - is the message pending, awaiting moderation?
519 * @return int awaits_moderation
521 function isPending() {
522 return $this->awaits_moderation;
526 * getThreadID - get the thread_id of the message.
528 * @return int The thread_id.
530 function getThreadID() {
531 return $this->data_array['thread_id'];
535 * getMostRecentDate - get the date of the most recent followup.
537 * @return int The date of the most recent followup.
539 function getMostRecentDate() {
540 return $this->data_array['most_recent_date'];
544 * hasFollowups - whether this message has any followups.
546 * @return boolean has_followups.
548 function hasFollowups() {
549 return $this->data_array['has_followups'];
553 * hasAttach - whether this message has an attachment.
555 * @return boolean has_attach.
558 function hasAttach() {
559 if ($this->isPending()) {
560 $sql = "SELECT attachmentid FROM forum_pending_attachment WHERE msg_id='$this->getID()'";
562 $sql = "SELECT attachmentid FROM forum_attachment WHERE msg_id='$this->getID()'";
564 if ((db_numrows(db_query($sql)) > 0 )) {
571 * delete - Delete this message and its followups.
573 * @return int The count of deleted messages.
576 $msg_id=$this->getID();
578 $this->setError(_('Invalid Message ID'));
582 if (!$this->Forum->userIsAdmin()) {
583 $this->setPermissionDeniedError();
587 /*$perm =& $this->Forum->Group->getPermission( session_get_user() );
589 if (!$perm || !is_object($perm) || !$perm->isForumAdmin()) {
590 $this->setPermissionDeniedError();
594 $sql="SELECT msg_id FROM forum
595 WHERE is_followup_to='$msg_id'
596 AND group_forum_id='".$this->Forum->getID()."'";
597 $result=db_query($sql);
598 $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 $sql="DELETE FROM forum
607 WHERE msg_id='$msg_id'
608 AND group_forum_id='".$this->Forum->getID()."'";
609 $toss=db_query($sql);
610 $sql = "DELETE FROM forum_attachment where msg_id='$msg_id'";
611 $res = db_query($res);
618 * removebbcode - workaround to remove bbcode tags.
620 * @return string converted text
622 function removebbcode($text) {
623 //$replaced = preg_replace("/\[[_a-zA-Z]:.+\](.+)\[\/[_a-zA-Z]:.*\]/","$1",$text);
624 $replaced = preg_replace("/\[.+\](.+)\[\/.+\]/","$1",$text);
629 * sendNotice - contains the logic to send out email followups when a message is posted.
631 * @param boolean Whether the message has an attach associated. Defaults to false
633 * @return boolean success.
635 function sendNotice($has_attach=false) {
636 $ids =& $this->Forum->getMonitoringIDs();
639 // See if there is anyone to send messages to
641 if (!count($ids) > 0 && !$this->Forum->getSendAllPostsTo()) {
645 $body = "\nRead and respond to this message at: ".
646 "\n".util_make_url ('/forum/message.php?msg_id='.$this->getID()).
647 "\nOr by replying to this e-mail entering your response between the following markers: ".
648 "\n".FORUM_MAIL_MARKER.
649 "\n(enter your response here)".
650 "\n".FORUM_MAIL_MARKER.
652 "\nBy: " . $this->getPosterRealName() . "\n";
655 //if there's an attachment for the message, make it note.
656 //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
657 $body .= "A file has been uploaded with this message\n\n";
661 $sanitizer = new TextSanitizer();
662 $text = $this->getBody();
663 $text = $sanitizer->convertNeededTagsForEmail($text);
664 $text= strip_tags($this->removebbcode(util_line_wrap($text)));
665 $text = $sanitizer->convertExtendedCharsForEmail($text);
667 "\n\n______________________________________________________________________".
668 "\nYou are receiving this email because you elected to monitor this forum.".
669 "\nTo stop monitoring this forum, login to ".$GLOBALS['sys_name']." and visit: ".
670 "\n".util_make_url('/forum/monitor.php?forum_id='.$this->Forum->getID().'&group_id='.$this->Forum->Group->getID().'&stop=1');
672 //$extra_headers = 'Reply-to: '.$this->Forum->getUnixName().'@'.$GLOBALS['sys_default_domain'];
673 $extra_headers = "Return-Path: <noreply@".$GLOBALS['sys_default_domain'].">\n";
674 $extra_headers .= "Errors-To: <noreply@".$GLOBALS['sys_default_domain'].">\n";
675 $extra_headers .= "Sender: <noreply@".$GLOBALS['sys_default_domain'].">\n";
676 $extra_headers .= "Reply-To: ".$this->Forum->getReturnEmailAddress()."\n";
677 $extra_headers .= "Precedence: Bulk\n"
678 ."List-Id: ".$this->Forum->getName()." <forum".$this->Forum->getId()."@".$GLOBALS['sys_default_domain'].">\n"
679 ."List-Help: ".util_make_url ('/forum/forum.php?id='.$this->Forum->getId())."\n"
680 ."Message-Id: <forumpost".$this->getId()."@".$GLOBALS['sys_default_domain'].">";
681 $parentid = $this->getParentId();
682 if (!empty($parentid)) {
683 $extra_headers .= "\nIn-Reply-To: ".$this->Forum->getReturnEmailAddress()."\n"
684 ."References: <forumpost".$this->getParentId()."@".$GLOBALS['sys_default_domain'].">";
687 $subject="[" . $this->Forum->getUnixName() ."][".$this->getID()."] ".util_unconvert_htmlspecialchars($this->getSubject());
688 if (count($ids) != 0) {
689 // maybe we have no monitoring ids. this was causing a transaction to be aborted because of being called everytime
690 $sql="SELECT email FROM users WHERE status='A' AND user_id IN ('".implode($ids,'\',\'')."')";
691 $bccres = db_query($sql);
693 $BCC =& implode(util_result_column_to_array($bccres),',').','.$this->Forum->getSendAllPostsTo();
695 $User = user_get_object($this->getPosterID());
696 util_send_message('',$subject,$body,"noreply@".$GLOBALS['sys_default_domain'],$BCC,'Forum',$extra_headers);
697 //util_send_message('',$subject,$body,$User->getEmail(),$BCC,$this->getPosterRealName(),$extra_headers);
698 // util_handle_message(array_unique($ids),$subject,$body,$this->Forum->getSendAllPostsTo(),'','forumgateway@'.$GLOBALS[sys_default_domain]);
703 * sendNewModeratedMsgNotice - contains the logic to send out email notifications to the forum admins when a new moderated message is posted
705 * @return boolean success.
707 function sendNewModeratedMsgNotice() {
708 $ids =& $this->Forum->getForumAdminIDs();
711 // See if there is anyone to send messages to
713 if (!count($ids) > 0 && !$this->Forum->getSendAllPostsTo()) {
717 $f =& $this->getForum();
718 $g =& $f->getGroup();
720 $body = "\nRead to this message and approve/reject it at: ".
721 "\n".util_make_url('/forum/admin/pending.php?action=view_pending&group_id='. $g->getID() . "&forum_id=" . $f->getID()) .
722 "\nBy: " . $this->getPosterRealName() . "\n\n";
724 $text = $this->getBody();
725 $sanitizer = new TextSanitizer();
726 $text = $sanitizer->convertNeededTagsForEmail($text);
727 $text= strip_tags($this->removebbcode(util_line_wrap($text)));
728 $text = $sanitizer->convertExtendedCharsForEmail($text);
730 "\n\n______________________________________________________________________".
731 "\nYou are receiving this email because the forum you administrate has a new moderated message awaiting your approval.";
733 //$extra_headers = 'Reply-to: '.$this->Forum->getUnixName().'@'.$GLOBALS['sys_default_domain'];
734 $extra_headers = "Return-Path: <noreply@".$GLOBALS['sys_default_domain'].">\n";
735 $extra_headers .= "Errors-To: <noreply@".$GLOBALS['sys_default_domain'].">\n";
736 $extra_headers .= "Sender: <noreply@".$GLOBALS['sys_default_domain'].">\n";
737 $extra_headers .= "Reply-To: ".$this->Forum->getReturnEmailAddress()."\n";
738 $extra_headers .= "Precedence: Bulk\n"
739 ."List-Id: ".$this->Forum->getName()." <forum".$this->Forum->getId()."@".$GLOBALS['sys_default_domain'].">\n"
740 ."List-Help: ".util_make_url('/forum/forum.php?id='.$this->Forum->getId())."\n"
741 ."Message-Id: <forumpost".$this->getId()."@".$GLOBALS['sys_default_domain'].">";
742 $parentid = $this->getParentId();
743 if (!empty($parentid)) {
744 $extra_headers .= "\nIn-Reply-To: ".$this->Forum->getReturnEmailAddress()."\n"
745 ."References: <forumpost".$this->getParentId()."@".$GLOBALS['sys_default_domain'].">";
748 $subject="[" . $this->Forum->getUnixName() ."][".$this->getID()."] ".util_unconvert_htmlspecialchars($this->getSubject());
749 if (count($ids) != 0) {
750 $sql="SELECT email FROM users WHERE status='A' AND user_id IN ('".implode($ids,'\',\'')."')";
751 $bccres = db_query($sql);
754 $BCC =& implode(util_result_column_to_array($bccres),',').','.$this->Forum->getSendAllPostsTo();
755 $User = user_get_object($this->getPosterID());
756 //util_send_message('',$subject,$body,$User->getEmail(),$BCC,$this->getPosterRealName(),$extra_headers);
757 util_send_message('',$subject,$body,"noreply@".$GLOBALS['sys_default_domain'],$BCC,'Forum',$extra_headers);
758 // util_handle_message(array_unique($ids),$subject,$body,$this->Forum->getSendAllPostsTo(),'','forumgateway@'.$GLOBALS[sys_default_domain]);
763 * updatemsg - impacts in the DB the new content of the message
765 * @param string The forum ID
766 * @param int The id of the user that is posting the message
767 * @param string The subject of the message.
768 * @param string The body of the message.
769 * @param string The post date
770 * @param int The message_id of the parent message, if any.
771 * @param int The thread_id of the message, if known.
772 * @param int has followups?
773 * @param string The most recent date.
775 * @return boolean success.
777 function updatemsg($group_forum_id,$posted_by,$subject,$body,$post_date,$is_followup_to,$thread_id,$has_followups,$most_recent_date) {
778 $subject = htmlspecialchars($subject);
780 $msg_id = $this->getID();
782 SET group_forum_id='$group_forum_id' , posted_by='$posted_by' , subject='$subject',
783 body='$body', post_date='$post_date' , is_followup_to='$is_followup_to' ,
784 thread_id='$thread_id',most_recent_date='$most_recent_date'
785 WHERE msg_id='$msg_id'";
786 $res = db_query($sql);
788 $this->setError(db_error());
791 if (db_affected_rows($res)<1) {
792 $this->setError("Message not found");
800 * sendAttachNotice - contains the logic to send out email attachement followups when a message is posted.
802 * @param int attach_id - The id of the file that has been attached
804 * @return boolean success.
806 function sendAttachNotice($attach_id) {
808 $ids =& $this->Forum->getMonitoringIDs();
811 // See if there is anyone to send messages to
813 if (!count($ids) > 0 && !$this->Forum->getSendAllPostsTo()) {
817 $body = "\nRead and respond to this message at: ".
818 "\n".util_make_url('/forum/message.php?msg_id='.$this->getID()).
819 "\nBy: " . $this->getPosterRealName() . "\n\n";
821 $body .= "A file has been uploaded to this message, you can download it at: ".
822 "\n".util_make_url('/forum/attachment.php?attachid='. $attach_id . "&group_id=" . $this->Forum->Group->getID() . "&forum_id=" . $this->Forum->getID()) . "\n\n";
825 "\n\n______________________________________________________________________".
826 "\nYou are receiving this email because you elected to monitor this forum.".
827 "\nTo stop monitoring this forum, login to ".$GLOBALS['sys_name']." and visit: ".
828 "\n".util_make_url ('/forum/monitor.php?forum_id='.$this->Forum->getID() .'&group_id='.$this->Forum->Group->getID().'&stop=1');
830 $extra_headers = "Return-Path: <noreply@".$GLOBALS['sys_default_domain'].">\n";
831 $extra_headers .= "Errors-To: <noreply@".$GLOBALS['sys_default_domain'].">\n";
832 $extra_headers .= "Sender: <noreply@".$GLOBALS['sys_default_domain'].">\n";
833 $extra_headers .= "Reply-To: ".$this->Forum->getReturnEmailAddress()."\n";
834 $extra_headers .= "Precedence: Bulk\n"
835 ."List-Id: ".$this->Forum->getName()." <forum".$this->Forum->getId()."@".$GLOBALS['sys_default_domain'].">\n"
836 ."List-Help: ".util_make_url('/forum/forum.php?id='.$this->Forum->getId())."\n"
837 ."Message-Id: <forumpost".$this->getId()."@".$GLOBALS['sys_default_domain'].">";
838 $parentid = $this->getParentId();
839 if (!empty($parentid)) {
840 $extra_headers .= "\nIn-Reply-To: ".$this->Forum->getReturnEmailAddress()."\n"
841 ."References: <forumpost".$this->getParentId()."@".$GLOBALS['sys_default_domain'].">";
844 $subject="[" . $this->Forum->getUnixName() ."][".$this->getID()."] ".util_unconvert_htmlspecialchars($this->getSubject());
845 if (count($ids) != 0) {
846 $sql="SELECT email FROM users WHERE status='A' AND user_id IN ('".implode($ids,'\',\'')."')";
847 $bccres = db_query($sql);
849 $BCC =& implode(util_result_column_to_array($bccres),',').','.$this->Forum->getSendAllPostsTo();
850 $User = user_get_object($this->getPosterID());
851 util_send_message('',$subject,$body,"noreply@".$GLOBALS['sys_default_domain'],$BCC,'Forum',$extra_headers);
861 // c-file-style: "bsd"