1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-05-17 00:08:17 +03:00

все уведомления на e-mail вынесены в отдельный модуль

This commit is contained in:
Mzhelskiy Maxim 2008-10-21 04:58:03 +00:00
parent cf4b72881b
commit 0940f66876
19 changed files with 392 additions and 170 deletions

View file

@ -1056,45 +1056,20 @@ class ActionBlog extends Action {
/**
* Добавляем коммент
*/
if ($this->Comment_AddComment($oCommentNew)) {
$sCommentText='';
if (SYS_MAIL_INCLUDE_COMMENT_TEXT) {
$sCommentText='Текст комментария: <i>'.$oCommentNew->getText().'</i><br>';
}
if ($this->Comment_AddComment($oCommentNew)) {
/**
* Отправка уведомления автору топика
*/
$oUserTopic=$this->User_GetUserById($oTopic->getUserId());
if ($oCommentNew->getUserId()!=$oUserTopic->getId() and $oUserTopic->getSettingsNoticeNewComment()) {
$oUserAuthor=$this->User_GetUserById($oTopic->getUserId());
$this->Mail_SetAdress($oUserAuthor->getMail(),$oUserAuthor->getLogin());
$this->Mail_SetSubject('К вашему топику оставили новый комментарий');
$this->Mail_SetBody('
Получен новый комментарий к вашему топику <b>«'.htmlspecialchars($oTopic->getTitle()).'»</b>, прочитать его можно перейдя по <a href="'.$oTopic->getUrl().'#comment'.$oCommentNew->getId().'">этой ссылке</a><br>
'.$sCommentText.'
<br>
С уважением, администрация сайта <a href="'.DIR_WEB_ROOT.'">'.SITE_NAME.'</a>
');
$this->Mail_setHTML();
$this->Mail_Send();
if ($oCommentNew->getUserId()!=$oUserTopic->getId()) {
$this->Notify_SendCommentNewToAuthorTopic($oUserTopic,$oTopic,$oCommentNew,$this->oUserCurrent);
}
/**
* Отправляем уведомление тому на чем коммент ответили
* Отправляем уведомление тому на чей коммент ответили
*/
if ($oCommentParent and $oCommentParent->getUserId()!=$oTopic->getUserId() and $oCommentNew->getUserId()!=$oCommentParent->getUserId()) {
$oUserAuthorComment=$this->User_GetUserById($oCommentParent->getUserId());
if ($oUserAuthorComment->getSettingsNoticeReplyComment()) {
$this->Mail_SetAdress($oUserAuthorComment->getMail(),$oUserAuthorComment->getLogin());
$this->Mail_SetSubject('Вам ответили на ваш комментарий');
$this->Mail_SetBody('
Получен ответ на ваш комментарий в топике <b>«'.htmlspecialchars($oTopic->getTitle()).'»</b>, прочитать его можно перейдя по <a href="'.$oTopic->getUrl().'#comment'.$oCommentNew->getId().'">этой ссылке</a><br>
'.$sCommentText.'
<br>
С уважением, администрация сайта <a href="'.DIR_WEB_ROOT.'">'.SITE_NAME.'</a>
');
$this->Mail_setHTML();
$this->Mail_Send();
}
$oUserAuthorComment=$this->User_GetUserById($oCommentParent->getUserId());
$this->Notify_SendCommentNewToAuthorTopic($oUserAuthorComment,$oTopic,$oCommentNew,$this->oUserCurrent);
}
func_header_location(DIR_WEB_ROOT.'/blog/'.$oTopic->getId().'.html#comment'.$oCommentNew->getId());
} else {

View file

@ -55,7 +55,7 @@ class ActionIndex extends Action {
* Инициализация
*
*/
public function Init() {
public function Init() {
$this->Viewer_AddBlocks('right',array('comments','tags','blogs'));
/**
* Подсчитываем новые топики

View file

@ -324,17 +324,8 @@ class ActionLink extends Action {
foreach ($aBlogUsers as $oBlogUser) {
if ($oBlogUser->getUserId()==$this->oUserCurrent->getId()) {
continue;
}
$this->Mail_SetAdress($oBlogUser->getUserMail(),$oBlogUser->getUserLogin());
$this->Mail_SetSubject('Новый топик в блоге «'.htmlspecialchars($oBlog->getTitle()).'»');
$this->Mail_SetBody('
В блоге <b>«'.htmlspecialchars($oBlog->getTitle()).'»</b> опубликован топик - <a href="'.DIR_WEB_ROOT.'/blog/'.$oTopic->getId().'.html">'.htmlspecialchars($oTopic->getTitle()).'</a><br>
<br>
С уважением, администрация сайта <a href="'.DIR_WEB_ROOT.'">'.SITE_NAME.'</a>
');
$this->Mail_setHTML();
$this->Mail_Send();
}
$this->Notify_SendTopicNewToSubscribeBlog($oBlogUser,$oTopic,$oBlog,$this->oUserCurrent);
}
}

View file

@ -297,17 +297,8 @@ class ActionQuestion extends Action {
foreach ($aBlogUsers as $oBlogUser) {
if ($oBlogUser->getUserId()==$this->oUserCurrent->getId()) {
continue;
}
$this->Mail_SetAdress($oBlogUser->getUserMail(),$oBlogUser->getUserLogin());
$this->Mail_SetSubject('Новый топик в блоге «'.htmlspecialchars($oBlog->getTitle()).'»');
$this->Mail_SetBody('
В блоге <b>«'.htmlspecialchars($oBlog->getTitle()).'»</b> опубликован топик - <a href="'.DIR_WEB_ROOT.'/blog/'.$oTopic->getId().'.html">'.htmlspecialchars($oTopic->getTitle()).'</a><br>
<br>
С уважением, администрация сайта <a href="'.DIR_WEB_ROOT.'">'.SITE_NAME.'</a>
');
$this->Mail_setHTML();
$this->Mail_Send();
}
$this->Notify_SendTopicNewToSubscribeBlog($oBlogUser,$oTopic,$oBlog,$this->oUserCurrent);
}
}

View file

@ -166,39 +166,12 @@ class ActionRegistration extends Action {
*/
if (USER_USE_ACTIVATION) {
/**
* Отправляем на мыло письмо о подтверждении регистрации
* По хорошему тескт письма нужно вынести в отдельный шаблон
*/
$this->Mail_SetAdress($oUser->getMail());
$this->Mail_SetSubject('Регистрация');
$this->Mail_SetBody('
Вы зарегистрировались на сайте <a href="'.DIR_WEB_ROOT.'">'.SITE_NAME.'</a><br>
Ваши регистрационные данные:<br>
&nbsp;&nbsp;&nbsp;логин: <b>'.$oUser->getLogin().'</b><br>
&nbsp;&nbsp;&nbsp;пароль: <b>'.getRequest('password').'</b><br>
<br>
Для завершения регистрации вам необходимо активировать аккаунт пройдя по ссылке:
<a href="'.DIR_WEB_ROOT.'/registration/activate/'.$oUser->getActivateKey().'/">'.DIR_WEB_ROOT.'/registration/activate/'.$oUser->getActivateKey().'/</a>
<br>
<br>
С уважением, администрация сайта <a href="'.DIR_WEB_ROOT.'">'.SITE_NAME.'</a>
');
$this->Mail_setHTML();
$this->Mail_Send();
* Отправляем на мыло письмо о подтверждении регистрации
*/
$this->Notify_SendRegistrationActivate($oUser,getRequest('password'));
func_header_location(DIR_WEB_ROOT.'/registration/confirm/');
} else {
$this->Mail_SetAdress($oUser->getMail());
$this->Mail_SetSubject('Регистрация');
$this->Mail_SetBody('
Вы зарегистрировались на сайте <a href="'.DIR_WEB_ROOT.'">'.SITE_NAME.'</a><br>
Ваши регистрационные данные:<br>
&nbsp;&nbsp;&nbsp;логин: <b>'.$oUser->getLogin().'</b><br>
&nbsp;&nbsp;&nbsp;пароль: <b>'.getRequest('password').'</b><br>
<br>
С уважением, администрация сайта <a href="'.DIR_WEB_ROOT.'">'.SITE_NAME.'</a>
');
$this->Mail_setHTML();
$this->Mail_Send();
$this->Notify_SendRegistration($oUser,getRequest('password'));
}
func_header_location(DIR_WEB_ROOT.'/registration/ok/');
} else {

View file

@ -105,39 +105,27 @@ class ActionSettings extends Action {
$this->sMenuItemSelect='invite';
$this->sMenuSubItemSelect='';
$this->Viewer_AddHtmlTitle('Инвайты');
$this->Viewer_AddHtmlTitle('Инвайты');
if (isset($_REQUEST['submit_invite'])) {
$bError=false;
if (!$this->ACL_CanSendInvite($this->oUserCurrent) and !$this->oUserCurrent->isAdministrator()) {
$this->Message_AddError('У вас пока нет доступных инвайтов','Ошибка');
$bError=true;
}
if (!func_check(getRequest('invite_mail'),'mail')) {
$this->Message_AddError('Неверный формат e-mail','Ошибка');
$bError=true;
}
if (!$bError) {
$oInvite=$this->User_GenerateInvite($this->oUserCurrent);
$this->Notify_SendInvite($this->oUserCurrent,getRequest('invite_mail'),$oInvite);
$this->Message_AddNoticeSingle('Приглашение отправлено');
}
}
$this->Viewer_Assign('iCountInviteAvailable',$this->User_GetCountInviteAvailable($this->oUserCurrent));
$this->Viewer_Assign('iCountInviteUsed',$this->User_GetCountInviteUsed($this->oUserCurrent->getId()));
if (!isset($_REQUEST['submit_invite'])) {
return ;
}
if (!$this->ACL_CanSendInvite($this->oUserCurrent) and !$this->oUserCurrent->isAdministrator()) {
$this->Message_AddError('У вас пока нет доступных инвайтов','Ошибка');
return ;
}
if (!func_check(getRequest('invite_mail'),'mail')) {
$this->Message_AddError('Неверный формат e-mail','Ошибка');
return ;
}
$oInvite=$this->User_GenerateInvite($this->oUserCurrent);
$this->Mail_SetAdress(getRequest('invite_mail'));
$this->Mail_SetSubject('Приглашение на регистрацию');
$this->Mail_SetBody('
Пользователь <a href="'.DIR_WEB_ROOT.'/profile/'.$this->oUserCurrent->getLogin().'/">'.$this->oUserCurrent->getLogin().'</a> пригласил вас зарегистрироваться на сайте <a href="'.DIR_WEB_ROOT.'">'.SITE_NAME.'</a><br>
Код приглашения: <b>'.$oInvite->getCode().'</b><br>
Для регистрации вам будет необходимо ввести код приглашения на <a href="'.DIR_WEB_ROOT.'">странице входа</a><br>
<br>
С уважением, администрация сайта <a href="'.DIR_WEB_ROOT.'">'.SITE_NAME.'</a>
');
$this->Mail_setHTML();
$this->Mail_Send();
$this->Message_AddNoticeSingle('Приглашение отправлено');
$this->Viewer_Assign('iCountInviteUsed',$this->User_GetCountInviteUsed($this->oUserCurrent->getId()));
}
/**

View file

@ -135,27 +135,9 @@ class ActionTalk extends Action {
/**
* Отправляем уведомления
*/
if ($iUserId!=$this->oUserCurrent->getId()) {
$sTalkText='';
if (SYS_MAIL_INCLUDE_TALK_TEXT) {
$sTalkText='Текст письма: <i>'.$oTalk->getText().'</i><br>';
}
$oUserToMail=$this->User_GetUserById($iUserId);
if ($oUserToMail->getSettingsNoticeNewTalk()) {
$this->Mail_SetAdress($oUserToMail->getMail(),$oUserToMail->getLogin());
$this->Mail_SetSubject('У вас новое письмо');
$this->Mail_SetBody('
Вам пришло новое письмо, прочитать и ответить на него можно перейдя по <a href="'.DIR_WEB_ROOT.'/talk/read/'.$oTalk->getId().'/">этой ссылке</a><br>
Тема письма: <b>'.htmlspecialchars($oTalk->getTitle()).'</b><br>
'.$sTalkText.'
Не забудьте предварительно авторизоваться!<br>
<br>
С уважением, администрация сайта <a href="'.DIR_WEB_ROOT.'">'.SITE_NAME.'</a>
');
$this->Mail_setHTML();
$this->Mail_Send();
}
if ($iUserId!=$this->oUserCurrent->getId()) {
$oUserToMail=$this->User_GetUserById($iUserId);
$this->Notify_SendTalkNew($oUserToMail,$this->oUserCurrent,$oTalk);
}
}
func_header_location(DIR_WEB_ROOT.'/talk/read/'.$oTalk->getId().'/');
@ -311,24 +293,8 @@ class ActionTalk extends Action {
*/
$aUsersTalk=$this->Talk_GetTalkUsers($oCommentNew->getTalkId());
foreach ($aUsersTalk as $oUserTalk) {
if ($oUserTalk->getId()!=$oCommentNew->getUserId() and $oUserTalk->getSettingsNoticeNewTalk()) {
$sTalkText='';
if (SYS_MAIL_INCLUDE_TALK_TEXT) {
$sTalkText='Текст: <i>'.$oCommentNew->getText().'</i><br>';
}
$this->Mail_SetAdress($oUserTalk->getMail(),$oUserTalk->getLogin());
$this->Mail_SetSubject('У вас новый комментарий к письму');
$this->Mail_SetBody('
Получен новый комментарий на письмо <b>«'.htmlspecialchars($oTalk->getTitle()).'»</b>, прочитать его можно перейдя по <a href="'.DIR_WEB_ROOT.'/talk/read/'.$oTalk->getId().'/#comment'.$oCommentNew->getId().'">этой ссылке</a><br>
'.$sTalkText.'
Не забудьте предварительно авторизоваться!<br>
<br>
С уважением, администрация сайта <a href="'.DIR_WEB_ROOT.'">'.SITE_NAME.'</a>
');
$this->Mail_setHTML();
$this->Mail_Send();
if ($oUserTalk->getId()!=$oCommentNew->getUserId()) {
$this->Notify_SendTalkCommentNew($oUserTalk,$this->oUserCurrent,$oTalk,$oCommentNew);
}
}
func_header_location(DIR_WEB_ROOT.'/talk/read/'.$oTalk->getId().'/#comment'.$oCommentNew->getId());

View file

@ -368,19 +368,10 @@ class ActionTopic extends Action {
if ($oTopic->getPublish()==1 and $oBlog->getType()!='personal') {
$aBlogUsers=$this->Blog_GetRelationBlogUsersByBlogId($oBlog->getId());
foreach ($aBlogUsers as $oBlogUser) {
if ($oBlogUser->getUserId()==$this->oUserCurrent->getId() or !$oBlogUser->getUserSettingsNoticeNewTopic()) {
if ($oBlogUser->getUserId()==$this->oUserCurrent->getId()) {
continue;
}
$this->Mail_SetAdress($oBlogUser->getUserMail(),$oBlogUser->getUserLogin());
$this->Mail_SetSubject('Новый топик в блоге «'.htmlspecialchars($oBlog->getTitle()).'»');
$this->Mail_SetBody('
В блоге <b>«'.htmlspecialchars($oBlog->getTitle()).'»</b> опубликован топик - <a href="'.DIR_WEB_ROOT.'/blog/'.$oTopic->getId().'.html">'.htmlspecialchars($oTopic->getTitle()).'</a><br>
<br>
С уважением, администрация сайта <a href="'.DIR_WEB_ROOT.'">'.SITE_NAME.'</a>
');
$this->Mail_setHTML();
$this->Mail_Send();
}
$this->Notify_SendTopicNewToSubscribeBlog($oBlogUser,$oTopic,$oBlog,$this->oUserCurrent);
}
}

View file

@ -0,0 +1,286 @@
<?
/*-------------------------------------------------------
*
* LiveStreet Engine Social Networking
* Copyright © 2008 Mzhelskiy Maxim
*
*--------------------------------------------------------
*
* Official site: www.livestreet.ru
* Contact e-mail: rus.engine@gmail.com
*
* GNU General Public License, version 2:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
---------------------------------------------------------
*/
/**
* Модуль рассылок уведомлений пользователям
*
*/
class Notify extends Module {
protected $oViewerLocal=null;
/**
* Инициализация модуля
* Создаём локальный экземпляр модуля Viewer
* Момент довольно спорный, но позволяет избавить основной шаблон от мусора уведомлений
*
*/
public function Init() {
$this->oViewerLocal=new Viewer(Engine::getInstance());
$this->oViewerLocal->Init();
$this->oViewerLocal->VarAssign();
}
/**
* Отправляет юзеру уведомление о новом комментарии в его топике
*
* @param UserEntity_User $oUserTo
* @param TopicEntity_Topic $oTopic
* @param CommentEntity_TopicComment $oComment
* @param UserEntity_User $oUserComment
*/
public function SendCommentNewToAuthorTopic(UserEntity_User $oUserTo, TopicEntity_Topic $oTopic, CommentEntity_TopicComment $oComment, UserEntity_User $oUserComment) {
/**
* Проверяем можно ли юзеру рассылать уведомление
*/
if (!$oUserTo->getSettingsNoticeNewComment()) {
return ;
}
/**
* Передаём в шаблон переменные
*/
$this->oViewerLocal->Assign('oUserTo',$oUserTo);
$this->oViewerLocal->Assign('oTopic',$oTopic);
$this->oViewerLocal->Assign('oComment',$oComment);
$this->oViewerLocal->Assign('oUserComment',$oUserComment);
/**
* Формируем шаблон
*/
$sBody=$this->oViewerLocal->Fetch("notify.comment_new.tpl");
/**
* Отправляем мыло
*/
$this->Mail_SetAdress($oUserTo->getMail(),$oUserTo->getLogin());
$this->Mail_SetSubject('К вашему топику оставили новый комментарий');
$this->Mail_SetBody($sBody);
$this->Mail_setHTML();
$this->Mail_Send();
}
/**
* Отправляет юзеру уведомление об ответе на его комментарий
*
* @param UserEntity_User $oUserTo
* @param TopicEntity_Topic $oTopic
* @param CommentEntity_TopicComment $oComment
* @param UserEntity_User $oUserComment
*/
public function SendCommentReplyToAuthorParentComment(UserEntity_User $oUserTo, TopicEntity_Topic $oTopic, CommentEntity_TopicComment $oComment, UserEntity_User $oUserComment) {
/**
* Проверяем можно ли юзеру рассылать уведомление
*/
if (!$oUserTo->getSettingsNoticeReplyComment()) {
return ;
}
/**
* Передаём в шаблон переменные
*/
$this->oViewerLocal->Assign('oUserTo',$oUserTo);
$this->oViewerLocal->Assign('oTopic',$oTopic);
$this->oViewerLocal->Assign('oComment',$oComment);
$this->oViewerLocal->Assign('oUserComment',$oUserComment);
/**
* Формируем шаблон
*/
$sBody=$this->oViewerLocal->Fetch("notify.comment_reply.tpl");
/**
* Отправляем мыло
*/
$this->Mail_SetAdress($oUserTo->getMail(),$oUserTo->getLogin());
$this->Mail_SetSubject('Вам ответили на ваш комментарий');
$this->Mail_SetBody($sBody);
$this->Mail_setHTML();
$this->Mail_Send();
}
/**
* Отправляет юзеру уведомление о новом топике в блоге, в котором он состоит
*
* @param UserEntity_User $oUserTo
* @param TopicEntity_Topic $oTopic
* @param BlogEntity_Blog $oBlog
* @param UserEntity_User $oUserTopic
*/
public function SendTopicNewToSubscribeBlog(BlogEntity_BlogUser $oBlogUserTo, TopicEntity_Topic $oTopic, BlogEntity_Blog $oBlog, UserEntity_User $oUserTopic) {
/**
* Проверяем можно ли юзеру рассылать уведомление
*/
if (!$oBlogUserTo->getUserSettingsNoticeNewTopic()) {
return ;
}
/**
* Передаём в шаблон переменные
*/
$this->oViewerLocal->Assign('oBlogUserTo',$oBlogUserTo);
$this->oViewerLocal->Assign('oTopic',$oTopic);
$this->oViewerLocal->Assign('oBlog',$oBlog);
$this->oViewerLocal->Assign('oUserTopic',$oUserTopic);
/**
* Формируем шаблон
*/
$sBody=$this->oViewerLocal->Fetch("notify.topic_new.tpl");
/**
* Отправляем мыло
*/
$this->Mail_SetAdress($oBlogUserTo->getUserMail(),$oBlogUserTo->getUserLogin());
$this->Mail_SetSubject('Новый топик в блоге «'.htmlspecialchars($oBlog->getTitle()).'»');
$this->Mail_SetBody($sBody);
$this->Mail_setHTML();
$this->Mail_Send();
}
/**
* Отправляет уведомление при регистрации с активацией
*
* @param UserEntity_User $oUser
* @param string $sPassword
*/
public function SendRegistrationActivate(UserEntity_User $oUser,$sPassword) {
/**
* Передаём в шаблон переменные
*/
$this->oViewerLocal->Assign('oUser',$oUser);
$this->oViewerLocal->Assign('sPassword',$sPassword);
/**
* Формируем шаблон
*/
$sBody=$this->oViewerLocal->Fetch("notify.registration_activate.tpl");
/**
* Отправляем мыло
*/
$this->Mail_SetAdress($oUser->getMail(),$oUser->getLogin());
$this->Mail_SetSubject('Регистрация');
$this->Mail_SetBody($sBody);
$this->Mail_setHTML();
$this->Mail_Send();
}
/**
* Отправляет уведомление о регистрации
*
* @param UserEntity_User $oUser
* @param string $sPassword
*/
public function SendRegistration(UserEntity_User $oUser,$sPassword) {
/**
* Передаём в шаблон переменные
*/
$this->oViewerLocal->Assign('oUser',$oUser);
$this->oViewerLocal->Assign('sPassword',$sPassword);
/**
* Формируем шаблон
*/
$sBody=$this->oViewerLocal->Fetch("notify.registration.tpl");
/**
* Отправляем мыло
*/
$this->Mail_SetAdress($oUser->getMail(),$oUser->getLogin());
$this->Mail_SetSubject('Регистрация');
$this->Mail_SetBody($sBody);
$this->Mail_setHTML();
$this->Mail_Send();
}
/**
* Отправляет инвайт
*
* @param UserEntity_User $oUserFrom
* @param string $sMailTo
* @param UserEntity_Invite $oInvite
*/
public function SendInvite(UserEntity_User $oUserFrom,$sMailTo,UserEntity_Invite $oInvite) {
/**
* Передаём в шаблон переменные
*/
$this->oViewerLocal->Assign('oUserFrom',$oUserFrom);
$this->oViewerLocal->Assign('sMailTo',$sMailTo);
$this->oViewerLocal->Assign('oInvite',$oInvite);
/**
* Формируем шаблон
*/
$sBody=$this->oViewerLocal->Fetch("notify.invite.tpl");
/**
* Отправляем мыло
*/
$this->Mail_SetAdress($sMailTo);
$this->Mail_SetSubject('Приглашение на регистрацию');
$this->Mail_SetBody($sBody);
$this->Mail_setHTML();
$this->Mail_Send();
}
/**
* Отправляет уведомление при новом личном сообщении
*
* @param UserEntity_User $oUserTo
* @param UserEntity_User $oUserFrom
* @param TalkEntity_Talk $oTalk
*/
public function SendTalkNew(UserEntity_User $oUserTo,UserEntity_User $oUserFrom,TalkEntity_Talk $oTalk) {
/**
* Проверяем можно ли юзеру рассылать уведомление
*/
if (!$oUserTo->getSettingsNoticeNewTalk()) {
return ;
}
/**
* Передаём в шаблон переменные
*/
$this->oViewerLocal->Assign('oUserTo',$oUserTo);
$this->oViewerLocal->Assign('oUserFrom',$oUserFrom);
$this->oViewerLocal->Assign('oTalk',$oTalk);
/**
* Формируем шаблон
*/
$sBody=$this->oViewerLocal->Fetch("notify.talk_new.tpl");
/**
* Отправляем мыло
*/
$this->Mail_SetAdress($oUserTo->getMail(),$oUserTo->getLogin());
$this->Mail_SetSubject('У вас новое письмо');
$this->Mail_SetBody($sBody);
$this->Mail_setHTML();
$this->Mail_Send();
}
public function SendTalkCommentNew(UserEntity_User $oUserTo,UserEntity_User $oUserFrom,TalkEntity_Talk $oTalk,TalkEntity_TalkComment $oTalkComment) {
/**
* Проверяем можно ли юзеру рассылать уведомление
*/
if (!$oUserTo->getSettingsNoticeNewTalk()) {
return ;
}
/**
* Передаём в шаблон переменные
*/
$this->oViewerLocal->Assign('oUserTo',$oUserTo);
$this->oViewerLocal->Assign('oUserFrom',$oUserFrom);
$this->oViewerLocal->Assign('oTalk',$oTalk);
$this->oViewerLocal->Assign('oTalkComment',$oTalkComment);
/**
* Формируем шаблон
*/
$sBody=$this->oViewerLocal->Fetch("notify.talk_comment_new.tpl");
/**
* Отправляем мыло
*/
$this->Mail_SetAdress($oUserTo->getMail(),$oUserTo->getLogin());
$this->Mail_SetSubject('У вас новый комментарий к письму');
$this->Mail_SetBody($sBody);
$this->Mail_setHTML();
$this->Mail_Send();
}
}
?>

View file

@ -92,6 +92,8 @@ class Viewer extends Module {
$this->Assign("DIR_UPLOADS_IMAGES",DIR_UPLOADS_IMAGES);
$this->Assign("USER_USE_INVITE",USER_USE_INVITE);
$this->Assign("SYS_MAIL_INCLUDE_COMMENT_TEXT",SYS_MAIL_INCLUDE_COMMENT_TEXT);
$this->Assign("SYS_MAIL_INCLUDE_TALK_TEXT",SYS_MAIL_INCLUDE_TALK_TEXT);
/**
* Загружаем список блоков
*/

View file

@ -157,15 +157,21 @@ class TopicEntity_Topic extends Entity
$this->extractExtra();
if (isset($this->aExtra['url'])) {
if ($bShort) {
$sUrl=ltrim($this->aExtra['url'],'http://');
$sUrl=$this->aExtra['url'];
if (preg_match("/^http:\/\/(.*)$/i",$sUrl,$aMatch)) {
$sUrl=$aMatch[1];
}
$sUrlShort=substr($sUrl,0,30);
if (strlen($sUrlShort)!=strlen($sUrl)) {
return $sUrlShort.'...';
}
return $sUrl;
}
$sUrl='http://'.ltrim($this->aExtra['url'],'http://');
return $sUrl;
$sUrl=$this->aExtra['url'];
if (preg_match("/^http:\/\/(.*)$/i",$sUrl,$aMatch)) {
$sUrl=$aMatch[1];
}
return 'http://'.$sUrl;
}
return null;
}

View file

@ -0,0 +1,6 @@
Получен новый комментарий к вашему топику <b>«{$oTopic->getTitle()|escape:'html'}»</b>, прочитать его можно перейдя по <a href="{$oTopic->getUrl()}#comment{$oComment->getId()}">этой ссылке</a><br>
{if $SYS_MAIL_INCLUDE_COMMENT_TEXT}
Текст сообщения: <i>{$oComment->getText()}</i>
{/if}
<br><br>
С уважением, администрация сайта <a href="{$DIR_WEB_ROOT}">{$SITE_NAME}</a>

View file

@ -0,0 +1,6 @@
Получен ответ на ваш комментарий в топике <b>«{$oTopic->getTitle()|escape:'html'}»</b>, прочитать его можно перейдя по <a href="{$oTopic->getUrl()}#comment{$oComment->getId()}">этой ссылке</a><br>
{if $SYS_MAIL_INCLUDE_COMMENT_TEXT}
Текст сообщения: <i>{$oComment->getText()}</i>
{/if}
<br><br>
С уважением, администрация сайта <a href="{$DIR_WEB_ROOT}">{$SITE_NAME}</a>

View file

@ -0,0 +1,6 @@
Пользователь <a href="{$DIR_WEB_ROOT}/profile/{$oUserFrom->getLogin()}/">{$oUserFrom->getLogin()}</a> пригласил вас зарегистрироваться на сайте <a href="{$DIR_WEB_ROOT}">{$SITE_NAME}</a><br>
Код приглашения: <b>{$oInvite->getCode()}</b><br>
Для регистрации вам будет необходимо ввести код приглашения на <a href="{$DIR_WEB_ROOT}/login/">странице входа</a>
<br><br>
С уважением, администрация сайта <a href="{$DIR_WEB_ROOT}">{$SITE_NAME}</a>

View file

@ -0,0 +1,6 @@
Вы зарегистрировались на сайте <a href="{$DIR_WEB_ROOT}">{$SITE_NAME}</a><br>
Ваши регистрационные данные:<br>
&nbsp;&nbsp;&nbsp;логин: <b>{$oUser->getLogin()}</b><br>
&nbsp;&nbsp;&nbsp;пароль: <b>{$sPassword}</b><br>
<br><br>
С уважением, администрация сайта <a href="{$DIR_WEB_ROOT}">{$SITE_NAME}</a>

View file

@ -0,0 +1,10 @@
Вы зарегистрировались на сайте <a href="{$DIR_WEB_ROOT}">{$SITE_NAME}</a><br>
Ваши регистрационные данные:<br>
&nbsp;&nbsp;&nbsp;логин: <b>{$oUser->getLogin()}</b><br>
&nbsp;&nbsp;&nbsp;пароль: <b>{$sPassword}</b><br>
<br>
Для завершения регистрации вам необходимо активировать аккаунт пройдя по ссылке:
<a href="{$DIR_WEB_ROOT}/registration/activate/{$oUser->getActivateKey()}/">{$DIR_WEB_ROOT}/registration/activate/{$oUser->getActivateKey()}/</a>
<br><br>
С уважением, администрация сайта <a href="{$DIR_WEB_ROOT}">{$SITE_NAME}</a>

View file

@ -0,0 +1,7 @@
Получен новый комментарий на письмо <b>«{$oTalk->getTitle()|escape:'html'}»</b>, прочитать его можно перейдя по <a href="{$DIR_WEB_ROOT}/talk/read/{$oTalk->getId()}/#comment{$oTalkComment->getId()}">этой ссылке</a><br>
{if $SYS_MAIL_INCLUDE_TALK_TEXT}
Текст сообщения: <i>{$oTalkComment->getText()}</i> <br>
{/if}
Не забудьте предварительно авторизоваться!
<br><br>
С уважением, администрация сайта <a href="{$DIR_WEB_ROOT}">{$SITE_NAME}</a>

View file

@ -0,0 +1,8 @@
Вам пришло новое письмо, прочитать и ответить на него можно перейдя по <a href="{$DIR_WEB_ROOT}/talk/read/{$oTalk->getId()}/">этой ссылке</a><br>
Тема письма: <b>{$oTalk->getTitle()|escape:'html'}</b><br>
{if $SYS_MAIL_INCLUDE_TALK_TEXT}
Текст сообщения: <i>{$oTalk->getText()}</i> <br>
{/if}
Не забудьте предварительно авторизоваться!
<br><br>
С уважением, администрация сайта <a href="{$DIR_WEB_ROOT}">{$SITE_NAME}</a>

View file

@ -0,0 +1,4 @@
В блоге <b>«{$oBlog->getTitle()|escape:'html'}»</b> опубликован топик - <a href="{$DIR_WEB_ROOT}/blog/{$oTopic->getId()}.html">{$oTopic->getTitle()|escape:'html'}</a><br>
<br><br>
С уважением, администрация сайта <a href="{$DIR_WEB_ROOT}">{$SITE_NAME}</a>