예제 #1
0
파일: activity.php 프로젝트: rich20/Kunena
	public function onAfterReply($message) {
		// Check for permisions of the current category - activity only if public or registered
		$category = $message->getCategory();
		if ($category->pub_access == 0 || $category->pub_access == - 1) {
			require_once KPATH_SITE.'/lib/kunena.link.class.php';
			$datareference = '<a href="' . CKunenaLink::GetMessageURL ( $message->id, $message->catid ) . '">' . $message->subject . '</a>';
			if ($this->_config->alphauserpointsnumchars > 0) {
				// use if limit chars for a response
				if (JString::strlen ( $message->message ) > $this->_config->alphauserpointsnumchars) {
					if ( $this->_getAUPversion() < '1.5.12' ) {
						$ruleEnabled = AlphaUserPointsHelper::checkRuleEnabled( 'plgaup_reply_kunena' );
						if ($ruleEnabled) {
							AlphaUserPointsHelper::newpoints ( 'plgaup_reply_kunena', '', $message->id, $datareference );
						} else {
							return;
						}
					} elseif ( $this->_getAUPversion() >= '1.5.12' ) {
						$ruleEnabled = AlphaUserPointsHelper::checkRuleEnabled( 'plgaup_kunena_topic_reply' );
						if ($ruleEnabled) {
							AlphaUserPointsHelper::newpoints ( 'plgaup_kunena_topic_reply', '', $message->id, $datareference );
						} else {
							return;
						}
					}
				}
			} else {
				if ( $this->_getAUPversion() < '1.5.12' ) {
					$ruleEnabled = AlphaUserPointsHelper::checkRuleEnabled( 'plgaup_reply_kunena' );
					if ($ruleEnabled) {
						AlphaUserPointsHelper::newpoints ( 'plgaup_reply_kunena', '', $message->id, $datareference );
					} else {
						return;
					}
				} elseif ( $this->_getAUPversion() >= '1.5.12' ) {
					$ruleEnabled = AlphaUserPointsHelper::checkRuleEnabled( 'plgaup_kunena_topic_reply' );
					if ($ruleEnabled) {
						AlphaUserPointsHelper::newpoints ( 'plgaup_kunena_topic_reply', '', $message->id, $datareference );
					} else {
						return;
					}
				}
			}
		}
	}
예제 #2
0
파일: activity.php 프로젝트: rich20/Kunena
	public function onAfterReply($message) {
		CFactory::load ( 'libraries', 'userpoints' );
		CUserPoints::assignPoint ( 'com_kunena.thread.reply' );

		// Check for permisions of the current category - activity only if public or registered
		if ($message->getCategory()->pub_access <= 0) {
			//activity stream - reply post
			require_once KPATH_SITE.'/lib/kunena.link.class.php';
			$JSPostLink = CKunenaLink::GetThreadPageURL ( 'view', $message->catid, $message->thread, 0 );

			kimport('kunena.html.parser');
			$content = KunenaHtmlParser::plainBBCode($message->message, $this->_config->activity_limit);

			// Add readmore link
			$content .= '<br /><a href="'.
					CKunenaLink::GetMessageURL($message->id, $message->catid).
					'" class="small profile-newsfeed-item-action">'.JText::sprintf('Read more...').'</a>';

			$act = new stdClass ();
			$act->cmd = 'wall.write';
			$act->actor = $message->userid;
			$act->target = 0; // no target
			$act->title = JText::_ ( '{single}{actor}{/single}{multiple}{actors}{/multiple} ' . JText::_ ( 'COM_KUNENA_JS_ACTIVITYSTREAM_REPLY_MSG1' ) . ' <a href="' . $JSPostLink . '">' . $message->subject . '</a> ' . JText::_ ( 'COM_KUNENA_JS_ACTIVITYSTREAM_REPLY_MSG2' ) );
			$act->content = $content;
			$act->app = 'kunena.post';
			$act->cid = $message->thread;

			// jomsocial 0 = public, 20 = registered members
			if ($message->getCategory()->pub_access == 0) {
				$act->access = 0;
			} else {
				$act->access = 20;
			}

			CFactory::load ( 'libraries', 'activities' );
			CActivityStream::add ( $act );
		}
	}
예제 #3
0
                    while (@ob_end_clean()) {
                    }
                    $kunena_app->redirect(CKunenaLink::GetMyProfileURL($userid));
                }
            }
            if ($do == "decrease") {
                $kunena_db->setQuery("UPDATE #__kunena_users SET karma_time={$kunena_db->Quote($time)} WHERE userid={$kunena_db->Quote($kunena_my->id)}");
                $kunena_db->query();
                if (KunenaError::checkDatabaseError()) {
                    return;
                }
                if ($pid) {
                    $kunena_app->enqueueMessage(JText::_('COM_KUNENA_KARMA_SELF_DECREASE'));
                    while (@ob_end_clean()) {
                    }
                    $kunena_app->redirect(CKunenaLink::GetMessageURL($pid, $catid, 0, false));
                } else {
                    $kunena_app->enqueueMessage(JText::_('COM_KUNENA_KARMA_SELF_DECREASE'));
                    while (@ob_end_clean()) {
                    }
                    $kunena_app->redirect(CKunenaLink::GetMyProfileURL($userid));
                }
            }
        }
    }
} else {
    //get outa here, you fraud!
    $kunena_app->enqueueMessage(JText::_('COM_KUNENA_USER_ERROR_KARMA'));
    while (@ob_end_clean()) {
    }
    $kunena_app->redirect(CKunenaLink::GetLatestPageAutoRedirectURL($pid, $kunena_config->messages_per_page));
예제 #4
0
 public function emailToSubscribers($LastPostUrl = false, $mailsubs = false, $mailmods = false, $mailadmins = false)
 {
     if ($LastPostUrl === false) {
         jimport('joomla.environment.uri');
         $uri = JURI::getInstance(JURI::base());
         $LastPostUrl = $uri->toString(array('scheme', 'host', 'port')) . CKunenaLink::GetMessageURL($this->get('id'), $this->get('catid'), 0, false);
     }
     $once = false;
     if ($mailsubs) {
         if (!$this->get('parent')) {
             // New topic: Send email only to category subscribers
             $mailsubs = $this->_config->category_subscriptions != 'disabled' ? 3 : 0;
             $once = $this->_config->category_subscriptions == 'topic';
         } elseif ($this->_config->category_subscriptions != 'post') {
             // Existing topic: Send email only to topic subscribers
             $mailsubs = $this->_config->topic_subscriptions != 'disabled' ? 2 : 0;
             $once = $this->_config->topic_subscriptions == 'first';
         } else {
             // Existing topic: Send email to both category and topic subscribers
             $mailsubs = $this->_config->topic_subscriptions == 'disabled' ? 3 : 1;
             // FIXME: category subcription can override topic
             $once = $this->_config->topic_subscriptions == 'first';
         }
     }
     // Fetch all subscribers, moderators and admins who will get the email
     $emailToList = CKunenaTools::getEMailToList($this->get('catid'), $this->get('thread'), $mailsubs, $mailmods, $mailadmins, $this->_my->id);
     if (count($emailToList)) {
         jimport('joomla.mail.helper');
         kimport('html.parser');
         if (!$this->_config->email) {
             KunenaError::warning(JText::_('COM_KUNENA_EMAIL_DISABLED'));
             return false;
         } else {
             if (!JMailHelper::isEmailAddress($this->_config->email)) {
                 KunenaError::warning(JText::_('COM_KUNENA_EMAIL_INVALID'));
                 return false;
             }
         }
         // clean up the message for review
         $authorname = $this->get('name');
         $message = KunenaParser::stripBBCode($this->get('message'), 0, false);
         $subject = $this->get('subject');
         $topicsubject = $this->parent->subject ? $this->parent->subject : $subject;
         $mailsender = JMailHelper::cleanAddress($this->_config->board_title);
         $mailsubject = JMailHelper::cleanSubject("[" . $this->_config->board_title . "] " . $topicsubject . " (" . $this->parent->catname . ")");
         // Make a list from all receivers
         $sentusers = array();
         $receivers = array(0 => array(), 1 => array());
         foreach ($emailToList as $emailTo) {
             if (!$emailTo->email || !JMailHelper::isEmailAddress($emailTo->email)) {
                 continue;
             }
             $receivers[$emailTo->subscription][] = $emailTo->email;
             $sentusers[] = $emailTo->id;
         }
         // Create email
         $mail = JFactory::getMailer();
         $mail->setSubject($mailsubject);
         $mail->setSender(array($this->_config->email, $mailsender));
         // Send email to all subscribers
         $mail->setBody($this->createEmailBody(1, $subject, $authorname, $LastPostUrl, $message, $once));
         $this->sendEmail($mail, $receivers[1]);
         // Send email to all moderators
         $mail->setBody($this->createEmailBody(0, $subject, $authorname, $LastPostUrl, $message, $once));
         $this->sendEmail($mail, $receivers[0]);
         // Update subscriptions
         if ($once && $sentusers) {
             $sentusers = implode(',', $sentusers);
             $db = JFactory::getDBO();
             $query = "UPDATE #__kunena_subscriptions\n\t\t\t\t\tSET future1=1 WHERE thread={$this->get('thread')} AND userid IN ({$sentusers})";
             $db->setQuery($query);
             $db->query();
             KunenaError::checkDatabaseError();
         }
     }
 }
예제 #5
0
파일: post.php 프로젝트: redigy/Kunena-1.6
 protected function approve()
 {
     if ($this->tokenProtection('get')) {
         return false;
     }
     if (!$this->load()) {
         return false;
     }
     if ($this->moderatorProtection()) {
         return false;
     }
     if ($this->isUserBanned()) {
         return false;
     }
     if ($this->isIPBanned()) {
         return false;
     }
     require_once KUNENA_PATH_LIB . '/kunena.posting.class.php';
     $message = new CKunenaPosting();
     $message->action($this->id);
     if ($message->canApprove()) {
         $success_msg = JText::_('COM_KUNENA_MODERATE_1APPROVE_FAIL');
         $this->_db->setQuery("UPDATE #__kunena_messages SET hold=0 WHERE id={$this->_db->Quote($this->id)}");
         if ($this->id && $this->_db->query() && $this->_db->getAffectedRows() == 1) {
             $success_msg = JText::_('COM_KUNENA_MODERATE_APPROVE_SUCCESS');
             $this->_db->setQuery("SELECT COUNT(*) AS totalmessages FROM #__kunena_messages WHERE thread={$this->_db->Quote($this->msg_cat->thread)}");
             $result = $this->_db->loadObject();
             KunenaError::checkDatabaseError();
             $threadPages = ceil($result->totalmessages / $this->config->messages_per_page);
             //construct a useable URL (for plaintext - so no &amp; encoding!)
             jimport('joomla.environment.uri');
             $uri =& JURI::getInstance(JURI::base());
             $LastPostUrl = $uri->toString(array('scheme', 'host', 'port')) . str_replace('&amp;', '&', CKunenaLink::GetThreadPageURL('view', $this->catid, $this->msg_cat->thread, $threadPages, $this->config->messages_per_page, $this->id));
             $message->emailToSubscribers($LastPostUrl, $this->config->allowsubscriptions, $this->config->mailmod, $this->config->mailadmin);
             CKunenaTools::modifyCategoryStats($this->id, $this->msg_cat->parent, $this->msg_cat->time, $this->msg_cat->catid);
         }
     }
     while (@ob_end_clean()) {
     }
     $this->_app->redirect(CKunenaLink::GetMessageURL($this->id, $this->catid, 0, false), $success_msg);
 }
예제 #6
0
 public function onAfterReply($message)
 {
     CFactory::load('libraries', 'userpoints');
     CUserPoints::assignPoint('com_kunena.thread.reply');
     // Check for permisions of the current category - activity only if public or registered
     if (!empty($message->parent)) {
         //activity stream - reply post
         require_once KPATH_SITE . '/lib/kunena.link.class.php';
         $JSPostLink = CKunenaLink::GetThreadPageURL('view', $message->get('catid'), $message->get('thread'), 1);
         $content = $message->get('message');
         // Strip content not allowed for guests
         $content = preg_replace('/\\[hide\\](.*?)\\[\\/hide\\]/s', '', $content);
         $content = preg_replace('/\\[confidential\\](.*?)\\[\\/confidential\\]/s', '', $content);
         $content = preg_replace('/\\[spoiler\\]/s', '[spoilerlight]', $content);
         $content = preg_replace('/\\[\\/spoiler\\]/s', '[/spoilerlight]', $content);
         $content = preg_replace('/\\[attachment(.*?)\\](.*?)\\[\\/attachment\\]/s', '', $content);
         $content = preg_replace('/\\[code\\](.*?)\\[\\/code]/s', '', $content);
         // limit activity stream output if limit is set
         $content = KunenaParser::parseBBCode($content, null, intval($this->_config->activity_limit));
         // Add readmore link
         $content .= '<br /><a href="' . CKunenaLink::GetMessageURL($message->get('id')) . '" class="small profile-newsfeed-item-action">' . JText::_('COM_KUNENA_READMORE') . '</a>';
         $act = new stdClass();
         $act->cmd = 'wall.write';
         $act->actor = $message->get('userid');
         $act->target = 0;
         // no target
         $act->title = JText::_('{single}{actor}{/single}{multiple}{actors}{/multiple} ' . JText::_('COM_KUNENA_JS_ACTIVITYSTREAM_REPLY_MSG1') . ' <a href="' . $JSPostLink . '">' . $message->get('subject') . '</a> ' . JText::_('COM_KUNENA_JS_ACTIVITYSTREAM_REPLY_MSG2'));
         $act->content = $content;
         $act->app = 'kunena.post';
         $act->cid = $message->get('thread');
         $act->access = $this->getAccess($message);
         CFactory::load('libraries', 'activities');
         CActivityStream::add($act);
     }
 }
예제 #7
0
 public function onAfterReply($message)
 {
     // Check for permisions of the current category - activity only if public or registered
     if ($this->_checkPermissions($message)) {
         require_once KPATH_SITE . '/lib/kunena.link.class.php';
         $datareference = '<a href="' . CKunenaLink::GetMessageURL($message->get('id'), $message->get('catid')) . '">' . $message->get('subject') . '</a>';
         $referreid = AlphaUserPointsHelper::getReferreid($message->get('userid'));
         if ($this->_config->alphauserpointsnumchars > 0) {
             // use if limit chars for a response
             if (JString::strlen($message->get('message')) > $this->_config->alphauserpointsnumchars) {
                 if ($this->_getAUPversion() < '1.5.12') {
                     if ($this->_checkRuleEnabled('plgaup_reply_kunena')) {
                         AlphaUserPointsHelper::newpoints('plgaup_reply_kunena', $referreid, $message->get('id'), $datareference);
                     } else {
                         return;
                     }
                 } elseif ($this->_getAUPversion() >= '1.5.12') {
                     if ($this->_checkRuleEnabled('plgaup_kunena_topic_reply')) {
                         AlphaUserPointsHelper::newpoints('plgaup_kunena_topic_reply', $referreid, $message->get('id'), $datareference);
                     } else {
                         return;
                     }
                 }
             }
         } else {
             if ($this->_getAUPversion() < '1.5.12') {
                 if ($this->_checkRuleEnabled('plgaup_reply_kunena')) {
                     AlphaUserPointsHelper::newpoints('plgaup_reply_kunena', $referreid, $message->get('id'), $datareference);
                 } else {
                     return;
                 }
             } elseif ($this->_getAUPversion() >= '1.5.12') {
                 if ($this->_checkRuleEnabled('plgaup_kunena_topic_reply')) {
                     AlphaUserPointsHelper::newpoints('plgaup_kunena_topic_reply', $referreid, $message->get('id'), $datareference);
                 } else {
                     return;
                 }
             }
         }
     }
 }
예제 #8
0
 /**
  * Store ThankYou into the table
  *
  * @since 1.6
  */
 function setThankyou()
 {
     if (JRequest::checkToken('get') == false) {
         $this->_app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
         while (@ob_end_clean()) {
         }
         $this->_app->redirect(CKunenaLink::GetMessageURL($this->pid, $this->catid, 0, false));
         return;
     }
     if (!$this->my->id) {
         $this->_app->enqueueMessage(JText::_('COM_KUNENA_THANKYOU_LOGIN'));
         while (@ob_end_clean()) {
         }
         $this->_app->redirect(CKunenaLink::GetMessageURL($this->pid, $this->catid, 0, false));
     }
     if (!$this->config->showthankyou) {
         $this->_app->enqueueMessage(JText::_('COM_KUNENA_THANKYOU_DISABLED'));
         $this->_app->redirect(CKunenaLink::GetMessageURL($this->pid, $this->catid, 0, false));
         while (@ob_end_clean()) {
         }
     }
     require_once KPATH_SITE . '/lib/kunena.posting.class.php';
     $post = new CKunenaPosting();
     if (!$post->action($this->pid)) {
         $errors = $post->getErrors();
         $this->_app->enqueueMessage(reset($post->getErrors()));
         while (@ob_end_clean()) {
         }
         $this->_app->redirect(CKunenaLink::GetMessageURL($this->pid, $this->catid, 0, false));
     }
     $this->targetuserid = $post->get('userid');
     //Check if the user already said thank you to this post
     if ($this->my->id == $this->targetuserid) {
         $this->_app->enqueueMessage(JText::_('COM_KUNENA_THANKYOU_NOT_YOURSELF'));
         while (@ob_end_clean()) {
         }
         $this->_app->redirect(CKunenaLink::GetMessageURL($this->pid, $this->catid, 0, false));
         return;
     }
     $saidit = KunenaThankYou::checkIfThankYouAllready($this->pid, $this->my->id);
     if (!empty($saidit)) {
         $this->_app->enqueueMessage(JText::_('COM_KUNENA_THANKYOU_ALLREADY'));
         while (@ob_end_clean()) {
         }
         $this->_app->redirect(CKunenaLink::GetMessageURL($this->pid, $this->catid, 0, false));
         return;
     }
     //Perform the insert
     if (KunenaThankYou::storeThankYou($this->pid, $this->my->id, $this->targetuserid) !== true) {
         KunenaError::checkDatabaseError();
     }
     $activityIntegration = KunenaFactory::getActivityIntegration();
     $activityIntegration->onAfterThankyou($this->targetuserid, $this->my->id, $post);
     $this->_app->enqueueMessage(JText::_('COM_KUNENA_THANKYOU_SUCCESS'));
     while (@ob_end_clean()) {
     }
     $this->_app->redirect(CKunenaLink::GetMessageURL($this->pid, $this->catid, 0, false));
 }
예제 #9
0
<?php

/**
 * @version $Id$
 * Kunena Discuss Plug-in
 * @package Kunena Discuss
 *
 * @Copyright (C) 2010-2011 Kunena Team. All rights reserved.
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 * @link http://www.kunena.org
 **/
defined('_JEXEC') or die('');
$msgurl = CKunenaLink::GetMessageURL($this->id);
?>
<div class="kdiscuss-item kdiscuss-item<?php 
echo $this->mmm & 1 ? 1 : 2;
?>
">
	<a name="<?php 
echo intval($this->id);
?>
" id="id<?php 
echo intval($this->id);
?>
" > </a>
	<div class="kdiscuss-reply-header">
		<span class="kdiscuss-date" title="<?php 
echo CKunenaTimeformat::showDate($this->msg->time, 'config_post_dateformat_hover');
?>
">
			<?php 
예제 #10
0
파일: topic.php 프로젝트: rich20/Kunena
	public function move() {
		$app = JFactory::getApplication ();
		if (! JRequest::checkToken ()) {
			$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_ERROR_TOKEN' ), 'error' );
			$this->redirectBack ();
		}

		$topicId = JRequest::getInt('id', 0);
		$messageId = JRequest::getInt('mesid', 0);
		$targetTopic = JRequest::getInt ( 'targetid', JRequest::getInt ( 'targettopic', 0 ));
		$targetCategory = JRequest::getInt ( 'targetcategory', 0 );

		if ($messageId) {
			$object = KunenaForumMessageHelper::get ( $messageId );
			$topic = $object->getTopic();
		} else {
			$object = KunenaForumTopicHelper::get ( $topicId );
			$topic = $object;
		}
		if ($targetTopic) {
			$target = KunenaForumTopicHelper::get( $targetTopic );
		} else {
			$target = KunenaForumCategoryHelper::get( $targetCategory );
		}

		$error = null;
		if (!$object->authorise ( 'move' )) {
			$error = $object->getError();
		} elseif (!$target->authorise ( 'read' )) {
			$error = $target->getError();
		} else {
			$changesubject = JRequest::getBool ( 'changesubject', false );
			$subject = JRequest::getString ( 'subject', '' );
			$shadow = JRequest::getBool ( 'shadow', false );

			if ($object instanceof KunenaForumMessage) {
				$mode = JRequest::getWord ( 'mode', 'selected' );
				switch ($mode) {
					case 'newer':
						$ids = new JDate($object->time);
						break;
					case 'selected':
					default:
						$ids = $object->id;
						break;
				}
			} else {
				$ids = false;
			}
			if (!$topic->move ( $target, $ids, $shadow, $subject, $changesubject )) {
				$error = $topic->getError();
			}
		}
		if ($error) {
			$app->enqueueMessage ( $error, 'notice' );
		} else {
			$app->enqueueMessage ( JText::_ ( 'COM_KUNENA_POST_SUCCESS_MOVE' ) );
		}
		$app->redirect ( CKunenaLink::GetMessageURL ( $this->id, $this->return, 0, false ) );
	}
예제 #11
0
파일: message.php 프로젝트: rich20/Kunena
	public function sendNotification($url=null) {
		$config = KunenaFactory::getConfig();
		if ($this->hold > 1) {
			return;
		} elseif ($this->hold == 1) {
			$mailsubs = 0;
			$mailmods = (bool) $config->mailmod;
			$mailadmins = (bool) $config->mailadmin;
		} else {
			$mailsubs = (bool) $config->allowsubscriptions;
			$mailmods = 0;
			$mailadmins = 0;
		}

		kimport ('kunena.html.parser');
		$once = false;
		if ($mailsubs) {
			if (!$this->parent) {
				// New topic: Send email only to category subscribers
				$mailsubs = $config->category_subscriptions != 'disabled' ? 3 : 0;
				$once = $config->category_subscriptions == 'topic';
			} elseif ($config->category_subscriptions != 'post') {
				// Existing topic: Send email only to topic subscribers
				$mailsubs = $config->topic_subscriptions != 'disabled' ? 2 : 0;
				$once = $config->topic_subscriptions == 'first';
			} else {
				// Existing topic: Send email to both category and topic subscribers
				$mailsubs = $config->topic_subscriptions == 'disabled' ? 3 : 1;
				// FIXME: category subcription can override topic
				$once = $config->topic_subscriptions == 'first';
			}
		}

		if (!$url) {
			$url = JURI::root().trim(CKunenaLink::GetMessageURL($this->id, $this->catid, 0, false), '/');
		}
		//get all subscribers, moderators and admins who will get the email
		$me = KunenaUserHelper::get();
		$acl = KunenaFactory::getAccessControl();
		$emailToList = $acl->getSubscribers($this->catid, $this->thread, $mailsubs, $mailmods, $mailadmins, $me->userid);

		$category = $this->getCategory();
		$topic = $this->getTopic();
		if (count ( $emailToList )) {
			jimport('joomla.mail.helper');
			if (! $config->email ) {
				KunenaError::warning ( JText::_ ( 'COM_KUNENA_EMAIL_DISABLED' ) );
				return false;
			} elseif ( ! JMailHelper::isEmailAddress ( $config->email ) ) {
				KunenaError::warning ( JText::_ ( 'COM_KUNENA_EMAIL_INVALID' ) );
				return false;
			}
			// clean up the message for review
			$message = KunenaHtmlParser::plainBBCode ( $this->message );

			$mailsender = JMailHelper::cleanAddress ( $config->board_title );
			$mailsubject = JMailHelper::cleanSubject ( "[" . $config->board_title . "] " . $topic->subject . " (" . $category->name . ")" );
			$subject = $this->subject ? $this->subject : $topic->subject;

			$sentusers = array();
			foreach ( $emailToList as $emailTo ) {
				if (! $emailTo->email || ! JMailHelper::isEmailAddress ( $emailTo->email ))
					continue;

				if ($emailTo->subscription) {
					$msg1 = $this->parent ? JText::_ ( 'COM_KUNENA_POST_EMAIL_NOTIFICATION1' ) : JText::_ ( 'COM_KUNENA_POST_EMAIL_NOTIFICATION1_CAT' );
					$msg2 = $this->parent ? JText::_ ( 'COM_KUNENA_POST_EMAIL_NOTIFICATION2' ) : JText::_ ( 'COM_KUNENA_POST_EMAIL_NOTIFICATION2_CAT' );
				} else {
					$msg1 = JText::_ ( 'COM_KUNENA_POST_EMAIL_MOD1' );
					$msg2 = JText::_ ( 'COM_KUNENA_POST_EMAIL_MOD2' );
				}

				$msg = "$emailTo->name,\n\n";
				$msg .= $msg1 . " " . $config->board_title . "\n\n";
				// DO NOT REMOVE EXTRA SPACE, JMailHelper::cleanBody() removes "Subject:" from the message body
				$msg .= JText::_ ( 'COM_KUNENA_MESSAGE_SUBJECT' ) . " : " . $subject . "\n";
				$msg .= JText::_ ( 'COM_KUNENA_GEN_CATEGORY' ) . " : " . $category->name . "\n";
				$msg .= JText::_ ( 'COM_KUNENA_VIEW_POSTED' ) . " : " . $this->name . "\n\n";
				$msg .= "URL : {$url}\n\n";
				if ($config->mailfull) {
					$msg .= JText::_ ( 'COM_KUNENA_GEN_MESSAGE' ) . " :\n-----\n";
					$msg .= $message;
					$msg .= "\n-----\n\n";
				}
				$msg .= $msg2 . "\n";
				if ($emailTo->subscription && $once) {
					if ($this->parent) {
						$msg .= JText::_ ( 'COM_KUNENA_POST_EMAIL_NOTIFICATION_MORE_READ' ) . "\n";
					} else {
						$msg .= JText::_ ( 'COM_KUNENA_POST_EMAIL_NOTIFICATION_MORE_SUBSCRIBE' ) . "\n";
					}
				}
				$msg .= "\n";
				$msg .= JText::_ ( 'COM_KUNENA_POST_EMAIL_NOTIFICATION3' ) . "\n";
				$msg = JMailHelper::cleanBody ( $msg );
				JUtility::sendMail ( $config->email, $mailsender, $emailTo->email, $mailsubject, $msg );
				$sentusers[] = $emailTo->id;
			}
			if ($once && $sentusers) {
				$sentusers = implode (',', $sentusers);
				$db = JFactory::getDBO();
				$query = "UPDATE #__kunena_user_topics SET subscribed=2 WHERE topic_id={$this->thread} AND user_id IN ({$sentusers}) AND subscribed=1";
				$db->setQuery ($query);
				$db->query ();
				KunenaError::checkDatabaseError();
			}
		}
	}