Exemplo n.º 1
0
 /**
  * Отправка уведомления на отвеченные посты
  *
  * @param	PluginForum_ModuleForum_EntityPost	$oReply
  * @param	array	$aExcludeMail
  */
 public function SendNotifyReply(PluginForum_ModuleForum_EntityPost $oReply, $aExcludeMail = array())
 {
     if ($oReply) {
         if (preg_match_all("@(<blockquote reply=(?:\"|')(.*)(?:\"|').*>)@Ui", $oReply->getTextSource(), $aMatch)) {
             $aIds = array_values($aMatch[2]);
             /**
              * Получаем список постов
              */
             $aPosts = $this->GetPostItemsByArrayPostId((array) $aIds);
             /**
              * Отправка
              */
             $sTemplate = 'notify.reply.tpl';
             $sSendTitle = $this->Lang_Get('plugin.forum.notify_subject_reply');
             $aSendContent = array('oUser' => $oReply->getUser(), 'oTopic' => $oReply->getTopic(), 'oPost' => $oReply);
             foreach ($aPosts as $oPost) {
                 if ($oUser = $oPost->getUser()) {
                     $sMail = $oUser->getMail();
                     if (!$sMail || in_array($sMail, (array) $aExcludeMail)) {
                         continue;
                     }
                     $this->Notify_Send($sMail, $sTemplate, $sSendTitle, $aSendContent, __CLASS__);
                 }
             }
         }
     }
 }