mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-28 20:45:00 +03:00
Рефакторинг модуля Notify
This commit is contained in:
parent
acf74de8ec
commit
b44e685809
|
@ -49,9 +49,6 @@ class ModuleNotify extends Module {
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public function Init() {
|
public function Init() {
|
||||||
if (!class_exists('ModuleViewer')) {
|
|
||||||
require_once(Config::Get('path.root.engine')."/modules/viewer/Viewer.class.php");
|
|
||||||
}
|
|
||||||
$this->oViewerLocal=$this->Viewer_GetLocalViewer();
|
$this->oViewerLocal=$this->Viewer_GetLocalViewer();
|
||||||
$this->oMapper=Engine::GetMapper(__CLASS__);
|
$this->oMapper=Engine::GetMapper(__CLASS__);
|
||||||
}
|
}
|
||||||
|
@ -71,50 +68,17 @@ class ModuleNotify extends Module {
|
||||||
if (!$oUserTo->getSettingsNoticeNewComment()) {
|
if (!$oUserTo->getSettingsNoticeNewComment()) {
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
/**
|
$this->Send(
|
||||||
* Передаём в шаблон переменные
|
$oUserTo,
|
||||||
*/
|
'notify.comment_new.tpl',
|
||||||
$this->oViewerLocal->Assign('oUserTo',$oUserTo);
|
$this->Lang_Get('notify_subject_comment_new'),
|
||||||
$this->oViewerLocal->Assign('oTopic',$oTopic);
|
array(
|
||||||
$this->oViewerLocal->Assign('oComment',$oComment);
|
'oUserTo' => $oUserTo,
|
||||||
$this->oViewerLocal->Assign('oUserComment',$oUserComment);
|
'oTopic' => $oTopic,
|
||||||
/**
|
'oComment' => $oComment,
|
||||||
* Формируем шаблон
|
'oUserComment' => $oUserComment,
|
||||||
*/
|
)
|
||||||
$sBody=$this->oViewerLocal->Fetch($this->GetTemplatePath('notify.comment_new.tpl'));
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* Если в конфигураторе указан отложенный метод отправки,
|
|
||||||
* то добавляем задание в массив. В противном случае,
|
|
||||||
* сразу отсылаем на email
|
|
||||||
*/
|
|
||||||
if(Config::Get('module.notify.delayed')) {
|
|
||||||
$oNotifyTask=Engine::GetEntity(
|
|
||||||
'Notify_Task',
|
|
||||||
array(
|
|
||||||
'user_mail' => $oUserTo->getMail(),
|
|
||||||
'user_login' => $oUserTo->getLogin(),
|
|
||||||
'notify_text' => $sBody,
|
|
||||||
'notify_subject' => $this->Lang_Get('notify_subject_comment_new'),
|
|
||||||
'date_created' => date("Y-m-d H:i:s"),
|
|
||||||
'notify_task_status' => self::NOTIFY_TASK_STATUS_NULL,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if(Config::Get('module.notify.insert_single')) {
|
|
||||||
$this->aTask[] = $oNotifyTask;
|
|
||||||
} else {
|
|
||||||
$this->oMapper->AddTask($oNotifyTask);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/**
|
|
||||||
* Отправляем мыло
|
|
||||||
*/
|
|
||||||
$this->Mail_SetAdress($oUserTo->getMail(),$oUserTo->getLogin());
|
|
||||||
$this->Mail_SetSubject($this->Lang_Get('notify_subject_comment_new'));
|
|
||||||
$this->Mail_SetBody($sBody);
|
|
||||||
$this->Mail_setHTML();
|
|
||||||
$this->Mail_Send();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -132,49 +96,17 @@ class ModuleNotify extends Module {
|
||||||
if (!$oUserTo->getSettingsNoticeReplyComment()) {
|
if (!$oUserTo->getSettingsNoticeReplyComment()) {
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
/**
|
$this->Send(
|
||||||
* Передаём в шаблон переменные
|
$oUserTo,
|
||||||
*/
|
'notify.comment_reply.tpl',
|
||||||
$this->oViewerLocal->Assign('oUserTo',$oUserTo);
|
$this->Lang_Get('notify_subject_comment_reply'),
|
||||||
$this->oViewerLocal->Assign('oTopic',$oTopic);
|
array(
|
||||||
$this->oViewerLocal->Assign('oComment',$oComment);
|
'oUserTo' => $oUserTo,
|
||||||
$this->oViewerLocal->Assign('oUserComment',$oUserComment);
|
'oTopic' => $oTopic,
|
||||||
/**
|
'oComment' => $oComment,
|
||||||
* Формируем шаблон
|
'oUserComment' => $oUserComment,
|
||||||
*/
|
)
|
||||||
$sBody=$this->oViewerLocal->Fetch($this->GetTemplatePath('notify.comment_reply.tpl'));
|
);
|
||||||
/**
|
|
||||||
* Если в конфигураторе указан отложенный метод отправки,
|
|
||||||
* то добавляем задание в массив. В противном случае,
|
|
||||||
* сразу отсылаем на email
|
|
||||||
*/
|
|
||||||
if(Config::Get('module.notify.delayed')) {
|
|
||||||
$oNotifyTask=Engine::GetEntity(
|
|
||||||
'Notify_Task',
|
|
||||||
array(
|
|
||||||
'user_mail' => $oUserTo->getMail(),
|
|
||||||
'user_login' => $oUserTo->getLogin(),
|
|
||||||
'notify_text' => $sBody,
|
|
||||||
'notify_subject' => $this->Lang_Get('notify_subject_comment_reply'),
|
|
||||||
'date_created' => date("Y-m-d H:i:s"),
|
|
||||||
'notify_task_status' => self::NOTIFY_TASK_STATUS_NULL,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if(Config::Get('module.notify.insert_single')) {
|
|
||||||
$this->aTask[] = $oNotifyTask;
|
|
||||||
} else {
|
|
||||||
$this->oMapper->AddTask($oNotifyTask);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/**
|
|
||||||
* Отправляем мыло
|
|
||||||
*/
|
|
||||||
$this->Mail_SetAdress($oUserTo->getMail(),$oUserTo->getLogin());
|
|
||||||
$this->Mail_SetSubject($this->Lang_Get('notify_subject_comment_reply'));
|
|
||||||
$this->Mail_SetBody($sBody);
|
|
||||||
$this->Mail_setHTML();
|
|
||||||
$this->Mail_Send();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -192,49 +124,17 @@ class ModuleNotify extends Module {
|
||||||
if (!$oUserTo->getSettingsNoticeNewTopic()) {
|
if (!$oUserTo->getSettingsNoticeNewTopic()) {
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
/**
|
$this->Send(
|
||||||
* Передаём в шаблон переменные
|
$oUserTo,
|
||||||
*/
|
'notify.topic_new.tpl',
|
||||||
$this->oViewerLocal->Assign('oUserTo',$oUserTo);
|
$this->Lang_Get('notify_subject_topic_new').' «'.htmlspecialchars($oBlog->getTitle()).'»',
|
||||||
$this->oViewerLocal->Assign('oTopic',$oTopic);
|
array(
|
||||||
$this->oViewerLocal->Assign('oBlog',$oBlog);
|
'oUserTo' => $oUserTo,
|
||||||
$this->oViewerLocal->Assign('oUserTopic',$oUserTopic);
|
'oTopic' => $oTopic,
|
||||||
/**
|
'oBlog' => $oBlog,
|
||||||
* Формируем шаблон
|
'oUserTopic' => $oUserTopic,
|
||||||
*/
|
)
|
||||||
$sBody=$this->oViewerLocal->Fetch($this->GetTemplatePath('notify.topic_new.tpl'));
|
);
|
||||||
/**
|
|
||||||
* Если в конфигураторе указан отложенный метод отправки,
|
|
||||||
* то добавляем задание в массив. В противном случае,
|
|
||||||
* сразу отсылаем на email
|
|
||||||
*/
|
|
||||||
if(Config::Get('module.notify.delayed')) {
|
|
||||||
$oNotifyTask=Engine::GetEntity(
|
|
||||||
'Notify_Task',
|
|
||||||
array(
|
|
||||||
'user_mail' => $oUserTo->getMail(),
|
|
||||||
'user_login' => $oUserTo->getLogin(),
|
|
||||||
'notify_text' => $sBody,
|
|
||||||
'notify_subject' => $this->Lang_Get('notify_subject_topic_new').' «'.htmlspecialchars($oBlog->getTitle()).'»',
|
|
||||||
'date_created' => date("Y-m-d H:i:s"),
|
|
||||||
'notify_task_status' => self::NOTIFY_TASK_STATUS_NULL,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if(Config::Get('module.notify.insert_single')) {
|
|
||||||
$this->aTask[] = $oNotifyTask;
|
|
||||||
} else {
|
|
||||||
$this->oMapper->AddTask($oNotifyTask);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/**
|
|
||||||
* Отправляем мыло
|
|
||||||
*/
|
|
||||||
$this->Mail_SetAdress($oUserTo->getMail(),$oUserTo->getLogin());
|
|
||||||
$this->Mail_SetSubject($this->Lang_Get('notify_subject_topic_new').' «'.htmlspecialchars($oBlog->getTitle()).'»');
|
|
||||||
$this->Mail_SetBody($sBody);
|
|
||||||
$this->Mail_setHTML();
|
|
||||||
$this->Mail_Send();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Отправляет уведомление с новым линком активации
|
* Отправляет уведомление с новым линком активации
|
||||||
|
@ -242,23 +142,14 @@ class ModuleNotify extends Module {
|
||||||
* @param ModuleUser_EntityUser $oUser
|
* @param ModuleUser_EntityUser $oUser
|
||||||
*/
|
*/
|
||||||
public function SendReactivationCode(ModuleUser_EntityUser $oUser) {
|
public function SendReactivationCode(ModuleUser_EntityUser $oUser) {
|
||||||
/**
|
$this->Send(
|
||||||
* Передаём в шаблон переменные
|
$oUser,
|
||||||
*/
|
'notify.reactivation.tpl',
|
||||||
$this->oViewerLocal->Assign('oUser',$oUser);
|
$this->Lang_Get('notify_subject_reactvation'),
|
||||||
/**
|
array(
|
||||||
* Формируем шаблон
|
'oUser' => $oUser,
|
||||||
*/
|
)
|
||||||
$sBody=$this->oViewerLocal->Fetch($this->GetTemplatePath('notify.reactivation.tpl'));
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* Отправляем мыло
|
|
||||||
*/
|
|
||||||
$this->Mail_SetAdress($oUser->getMail(),$oUser->getLogin());
|
|
||||||
$this->Mail_SetSubject($this->Lang_Get('notify_subject_reactvation'));
|
|
||||||
$this->Mail_SetBody($sBody);
|
|
||||||
$this->Mail_setHTML();
|
|
||||||
$this->Mail_Send();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -268,24 +159,15 @@ class ModuleNotify extends Module {
|
||||||
* @param string $sPassword
|
* @param string $sPassword
|
||||||
*/
|
*/
|
||||||
public function SendRegistrationActivate(ModuleUser_EntityUser $oUser,$sPassword) {
|
public function SendRegistrationActivate(ModuleUser_EntityUser $oUser,$sPassword) {
|
||||||
/**
|
$this->Send(
|
||||||
* Передаём в шаблон переменные
|
$oUser,
|
||||||
*/
|
'notify.registration_activate.tpl',
|
||||||
$this->oViewerLocal->Assign('oUser',$oUser);
|
$this->Lang_Get('notify_subject_registration_activate'),
|
||||||
$this->oViewerLocal->Assign('sPassword',$sPassword);
|
array(
|
||||||
/**
|
'oUser' => $oUser,
|
||||||
* Формируем шаблон
|
'sPassword' => $sPassword,
|
||||||
*/
|
)
|
||||||
$sBody=$this->oViewerLocal->Fetch($this->GetTemplatePath('notify.registration_activate.tpl'));
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* Отправляем мыло
|
|
||||||
*/
|
|
||||||
$this->Mail_SetAdress($oUser->getMail(),$oUser->getLogin());
|
|
||||||
$this->Mail_SetSubject($this->Lang_Get('notify_subject_registration_activate'));
|
|
||||||
$this->Mail_SetBody($sBody);
|
|
||||||
$this->Mail_setHTML();
|
|
||||||
$this->Mail_Send();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -295,24 +177,15 @@ class ModuleNotify extends Module {
|
||||||
* @param string $sPassword
|
* @param string $sPassword
|
||||||
*/
|
*/
|
||||||
public function SendRegistration(ModuleUser_EntityUser $oUser,$sPassword) {
|
public function SendRegistration(ModuleUser_EntityUser $oUser,$sPassword) {
|
||||||
/**
|
$this->Send(
|
||||||
* Передаём в шаблон переменные
|
$oUser,
|
||||||
*/
|
'notify.registration.tpl',
|
||||||
$this->oViewerLocal->Assign('oUser',$oUser);
|
$this->Lang_Get('notify_subject_registration'),
|
||||||
$this->oViewerLocal->Assign('sPassword',$sPassword);
|
array(
|
||||||
/**
|
'oUser' => $oUser,
|
||||||
* Формируем шаблон
|
'sPassword' => $sPassword,
|
||||||
*/
|
)
|
||||||
$sBody=$this->oViewerLocal->Fetch($this->GetTemplatePath('notify.registration.tpl'));
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* Отправляем мыло
|
|
||||||
*/
|
|
||||||
$this->Mail_SetAdress($oUser->getMail(),$oUser->getLogin());
|
|
||||||
$this->Mail_SetSubject($this->Lang_Get('notify_subject_registration'));
|
|
||||||
$this->Mail_SetBody($sBody);
|
|
||||||
$this->Mail_setHTML();
|
|
||||||
$this->Mail_Send();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -323,48 +196,16 @@ class ModuleNotify extends Module {
|
||||||
* @param ModuleUser_EntityInvite $oInvite
|
* @param ModuleUser_EntityInvite $oInvite
|
||||||
*/
|
*/
|
||||||
public function SendInvite(ModuleUser_EntityUser $oUserFrom,$sMailTo,ModuleUser_EntityInvite $oInvite) {
|
public function SendInvite(ModuleUser_EntityUser $oUserFrom,$sMailTo,ModuleUser_EntityInvite $oInvite) {
|
||||||
/**
|
$this->Send(
|
||||||
* Передаём в шаблон переменные
|
$sMailTo,
|
||||||
*/
|
'notify.invite.tpl',
|
||||||
$this->oViewerLocal->Assign('oUserFrom',$oUserFrom);
|
$this->Lang_Get('notify_subject_invite'),
|
||||||
$this->oViewerLocal->Assign('sMailTo',$sMailTo);
|
array(
|
||||||
$this->oViewerLocal->Assign('oInvite',$oInvite);
|
'sMailTo' => $sMailTo,
|
||||||
/**
|
'oUserFrom' => $oUserFrom,
|
||||||
* Формируем шаблон
|
'oInvite' => $oInvite,
|
||||||
*/
|
)
|
||||||
$sBody=$this->oViewerLocal->Fetch('notify/'.$this->Lang_GetLang()."/notify.invite.tpl");
|
);
|
||||||
/**
|
|
||||||
* Если в конфигураторе указан отложенный метод отправки,
|
|
||||||
* то добавляем задание в массив. В противном случае,
|
|
||||||
* сразу отсылаем на email
|
|
||||||
*/
|
|
||||||
if(Config::Get('module.notify.delayed')) {
|
|
||||||
$oNotifyTask=Engine::GetEntity(
|
|
||||||
'Notify_Task',
|
|
||||||
array(
|
|
||||||
'user_mail' => $sMailTo,
|
|
||||||
'user_login' => null,
|
|
||||||
'notify_text' => $sBody,
|
|
||||||
'notify_subject' => $this->Lang_Get('notify_subject_invite'),
|
|
||||||
'date_created' => date("Y-m-d H:i:s"),
|
|
||||||
'notify_task_status' => self::NOTIFY_TASK_STATUS_NULL,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if(Config::Get('module.notify.insert_single')) {
|
|
||||||
$this->aTask[] = $oNotifyTask;
|
|
||||||
} else {
|
|
||||||
$this->oMapper->AddTask($oNotifyTask);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/**
|
|
||||||
* Отправляем мыло
|
|
||||||
*/
|
|
||||||
$this->Mail_SetAdress($sMailTo);
|
|
||||||
$this->Mail_SetSubject($this->Lang_Get('notify_subject_invite'));
|
|
||||||
$this->Mail_SetBody($sBody);
|
|
||||||
$this->Mail_setHTML();
|
|
||||||
$this->Mail_Send();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -381,48 +222,16 @@ class ModuleNotify extends Module {
|
||||||
if (!$oUserTo->getSettingsNoticeNewTalk()) {
|
if (!$oUserTo->getSettingsNoticeNewTalk()) {
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
/**
|
$this->Send(
|
||||||
* Передаём в шаблон переменные
|
$oUserTo,
|
||||||
*/
|
'notify.talk_new.tpl',
|
||||||
$this->oViewerLocal->Assign('oUserTo',$oUserTo);
|
$this->Lang_Get('notify_subject_talk_new'),
|
||||||
$this->oViewerLocal->Assign('oUserFrom',$oUserFrom);
|
array(
|
||||||
$this->oViewerLocal->Assign('oTalk',$oTalk);
|
'oUserTo' => $oUserTo,
|
||||||
/**
|
'oUserFrom' => $oUserFrom,
|
||||||
* Формируем шаблон
|
'oTalk' => $oTalk,
|
||||||
*/
|
)
|
||||||
$sBody=$this->oViewerLocal->Fetch($this->GetTemplatePath('notify.talk_new.tpl'));
|
);
|
||||||
/**
|
|
||||||
* Если в конфигураторе указан отложенный метод отправки,
|
|
||||||
* то добавляем задание в массив. В противном случае,
|
|
||||||
* сразу отсылаем на email
|
|
||||||
*/
|
|
||||||
if(Config::Get('module.notify.delayed')) {
|
|
||||||
$oNotifyTask=Engine::GetEntity(
|
|
||||||
'Notify_Task',
|
|
||||||
array(
|
|
||||||
'user_mail' => $oUserTo->getMail(),
|
|
||||||
'user_login' => $oUserTo->getLogin(),
|
|
||||||
'notify_text' => $sBody,
|
|
||||||
'notify_subject' => $this->Lang_Get('notify_subject_talk_new'),
|
|
||||||
'date_created' => date("Y-m-d H:i:s"),
|
|
||||||
'notify_task_status' => self::NOTIFY_TASK_STATUS_NULL,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if(Config::Get('module.notify.insert_single')) {
|
|
||||||
$this->aTask[] = $oNotifyTask;
|
|
||||||
} else {
|
|
||||||
$this->oMapper->AddTask($oNotifyTask);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/**
|
|
||||||
* Отправляем мыло
|
|
||||||
*/
|
|
||||||
$this->Mail_SetAdress($oUserTo->getMail(),$oUserTo->getLogin());
|
|
||||||
$this->Mail_SetSubject($this->Lang_Get('notify_subject_talk_new'));
|
|
||||||
$this->Mail_SetBody($sBody);
|
|
||||||
$this->Mail_setHTML();
|
|
||||||
$this->Mail_Send();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function SendTalkCommentNew(ModuleUser_EntityUser $oUserTo,ModuleUser_EntityUser $oUserFrom,ModuleTalk_EntityTalk $oTalk,ModuleComment_EntityComment $oTalkComment) {
|
public function SendTalkCommentNew(ModuleUser_EntityUser $oUserTo,ModuleUser_EntityUser $oUserFrom,ModuleTalk_EntityTalk $oTalk,ModuleComment_EntityComment $oTalkComment) {
|
||||||
|
@ -432,49 +241,17 @@ class ModuleNotify extends Module {
|
||||||
if (!$oUserTo->getSettingsNoticeNewTalk()) {
|
if (!$oUserTo->getSettingsNoticeNewTalk()) {
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
/**
|
$this->Send(
|
||||||
* Передаём в шаблон переменные
|
$oUserTo,
|
||||||
*/
|
'notify.talk_comment_new.tpl',
|
||||||
$this->oViewerLocal->Assign('oUserTo',$oUserTo);
|
$this->Lang_Get('notify_subject_talk_comment_new'),
|
||||||
$this->oViewerLocal->Assign('oUserFrom',$oUserFrom);
|
array(
|
||||||
$this->oViewerLocal->Assign('oTalk',$oTalk);
|
'oUserTo' => $oUserTo,
|
||||||
$this->oViewerLocal->Assign('oTalkComment',$oTalkComment);
|
'oUserFrom' => $oUserFrom,
|
||||||
/**
|
'oTalk' => $oTalk,
|
||||||
* Формируем шаблон
|
'oTalkComment' => $oTalkComment,
|
||||||
*/
|
)
|
||||||
$sBody=$this->oViewerLocal->Fetch($this->GetTemplatePath('notify.talk_comment_new.tpl'));
|
);
|
||||||
/**
|
|
||||||
* Если в конфигураторе указан отложенный метод отправки,
|
|
||||||
* то добавляем задание в массив. В противном случае,
|
|
||||||
* сразу отсылаем на email
|
|
||||||
*/
|
|
||||||
if(Config::Get('module.notify.delayed')) {
|
|
||||||
$oNotifyTask=Engine::GetEntity(
|
|
||||||
'Notify_Task',
|
|
||||||
array(
|
|
||||||
'user_mail' => $oUserTo->getMail(),
|
|
||||||
'user_login' => $oUserTo->getLogin(),
|
|
||||||
'notify_text' => $sBody,
|
|
||||||
'notify_subject' => $this->Lang_Get('notify_subject_talk_comment_new'),
|
|
||||||
'date_created' => date("Y-m-d H:i:s"),
|
|
||||||
'notify_task_status' => self::NOTIFY_TASK_STATUS_NULL,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if(Config::Get('module.notify.insert_single')) {
|
|
||||||
$this->aTask[] = $oNotifyTask;
|
|
||||||
} else {
|
|
||||||
$this->oMapper->AddTask($oNotifyTask);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/**
|
|
||||||
* Отправляем мыло
|
|
||||||
*/
|
|
||||||
$this->Mail_SetAdress($oUserTo->getMail(),$oUserTo->getLogin());
|
|
||||||
$this->Mail_SetSubject($this->Lang_Get('notify_subject_talk_comment_new'));
|
|
||||||
$this->Mail_SetBody($sBody);
|
|
||||||
$this->Mail_setHTML();
|
|
||||||
$this->Mail_Send();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -490,50 +267,17 @@ class ModuleNotify extends Module {
|
||||||
if (!$oUserTo->getSettingsNoticeNewFriend()) {
|
if (!$oUserTo->getSettingsNoticeNewFriend()) {
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
/**
|
$this->Send(
|
||||||
* Передаём в шаблон переменные
|
$oUserTo,
|
||||||
*/
|
'notify.user_friend_new.tpl',
|
||||||
$this->oViewerLocal->Assign('oUserTo',$oUserTo);
|
$this->Lang_Get('notify_subject_user_friend_new'),
|
||||||
$this->oViewerLocal->Assign('oUserFrom',$oUserFrom);
|
array(
|
||||||
$this->oViewerLocal->Assign('sText',$sText);
|
'oUserTo' => $oUserTo,
|
||||||
$this->oViewerLocal->Assign('sPath',$sPath);
|
'oUserFrom' => $oUserFrom,
|
||||||
|
'sText' => $sText,
|
||||||
/**
|
'sPath' => $sPath,
|
||||||
* Формируем шаблон
|
)
|
||||||
*/
|
);
|
||||||
$sBody=$this->oViewerLocal->Fetch($this->GetTemplatePath('notify.user_friend_new.tpl'));
|
|
||||||
/**
|
|
||||||
* Если в конфигураторе указан отложенный метод отправки,
|
|
||||||
* то добавляем задание в массив. В противном случае,
|
|
||||||
* сразу отсылаем на email
|
|
||||||
*/
|
|
||||||
if(Config::Get('module.notify.delayed')) {
|
|
||||||
$oNotifyTask=Engine::GetEntity(
|
|
||||||
'Notify_Task',
|
|
||||||
array(
|
|
||||||
'user_mail' => $oUserTo->getMail(),
|
|
||||||
'user_login' => $oUserTo->getLogin(),
|
|
||||||
'notify_text' => $sBody,
|
|
||||||
'notify_subject' => $this->Lang_Get('notify_subject_user_friend_new'),
|
|
||||||
'date_created' => date("Y-m-d H:i:s"),
|
|
||||||
'notify_task_status' => self::NOTIFY_TASK_STATUS_NULL,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if(Config::Get('module.notify.insert_single')) {
|
|
||||||
$this->aTask[] = $oNotifyTask;
|
|
||||||
} else {
|
|
||||||
$this->oMapper->AddTask($oNotifyTask);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/**
|
|
||||||
* Отправляем мыло
|
|
||||||
*/
|
|
||||||
$this->Mail_SetAdress($oUserTo->getMail(),$oUserTo->getLogin());
|
|
||||||
$this->Mail_SetSubject($this->Lang_Get('notify_subject_user_friend_new'));
|
|
||||||
$this->Mail_SetBody($sBody);
|
|
||||||
$this->Mail_setHTML();
|
|
||||||
$this->Mail_Send();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -543,50 +287,17 @@ class ModuleNotify extends Module {
|
||||||
* @param ModuleUser_EntityUser $oUserFrom
|
* @param ModuleUser_EntityUser $oUserFrom
|
||||||
*/
|
*/
|
||||||
public function SendBlogUserInvite(ModuleUser_EntityUser $oUserTo,ModuleUser_EntityUser $oUserFrom, ModuleBlog_EntityBlog $oBlog,$sPath) {
|
public function SendBlogUserInvite(ModuleUser_EntityUser $oUserTo,ModuleUser_EntityUser $oUserFrom, ModuleBlog_EntityBlog $oBlog,$sPath) {
|
||||||
/**
|
$this->Send(
|
||||||
* Передаём в шаблон переменные
|
$oUserTo,
|
||||||
*/
|
'notify.blog_invite_new.tpl',
|
||||||
$this->oViewerLocal->Assign('oUserTo',$oUserTo);
|
$this->Lang_Get('notify_subject_blog_invite_new'),
|
||||||
$this->oViewerLocal->Assign('oUserFrom',$oUserFrom);
|
array(
|
||||||
$this->oViewerLocal->Assign('oBlog',$oBlog);
|
'oUserTo' => $oUserTo,
|
||||||
$this->oViewerLocal->Assign('sPath',$sPath);
|
'oUserFrom' => $oUserFrom,
|
||||||
|
'oBlog' => $oBlog,
|
||||||
/**
|
'sPath' => $sPath,
|
||||||
* Формируем шаблон
|
)
|
||||||
*/
|
);
|
||||||
$sBody=$this->oViewerLocal->Fetch($this->GetTemplatePath('notify.blog_invite_new.tpl'));
|
|
||||||
/**
|
|
||||||
* Если в конфигураторе указан отложенный метод отправки,
|
|
||||||
* то добавляем задание в массив. В противном случае,
|
|
||||||
* сразу отсылаем на email
|
|
||||||
*/
|
|
||||||
if(Config::Get('module.notify.delayed')) {
|
|
||||||
$oNotifyTask=Engine::GetEntity(
|
|
||||||
'Notify_Task',
|
|
||||||
array(
|
|
||||||
'user_mail' => $oUserTo->getMail(),
|
|
||||||
'user_login' => $oUserTo->getLogin(),
|
|
||||||
'notify_text' => $sBody,
|
|
||||||
'notify_subject' => $this->Lang_Get('notify_subject_blog_invite_new'),
|
|
||||||
'date_created' => date("Y-m-d H:i:s"),
|
|
||||||
'notify_task_status' => self::NOTIFY_TASK_STATUS_NULL,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
if(Config::Get('module.notify.insert_single')) {
|
|
||||||
$this->aTask[] = $oNotifyTask;
|
|
||||||
} else {
|
|
||||||
$this->oMapper->AddTask($oNotifyTask);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
/**
|
|
||||||
* Отправляем мыло
|
|
||||||
*/
|
|
||||||
$this->Mail_SetAdress($oUserTo->getMail(),$oUserTo->getLogin());
|
|
||||||
$this->Mail_SetSubject($this->Lang_Get('notify_subject_blog_invite_new'));
|
|
||||||
$this->Mail_SetBody($sBody);
|
|
||||||
$this->Mail_setHTML();
|
|
||||||
$this->Mail_Send();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -596,24 +307,15 @@ class ModuleNotify extends Module {
|
||||||
* @param ModuleUser_EntityReminder $oReminder
|
* @param ModuleUser_EntityReminder $oReminder
|
||||||
*/
|
*/
|
||||||
public function SendReminderCode(ModuleUser_EntityUser $oUser,ModuleUser_EntityReminder $oReminder) {
|
public function SendReminderCode(ModuleUser_EntityUser $oUser,ModuleUser_EntityReminder $oReminder) {
|
||||||
/**
|
$this->Send(
|
||||||
* Передаём в шаблон переменные
|
$oUser,
|
||||||
*/
|
'notify.reminder_code.tpl',
|
||||||
$this->oViewerLocal->Assign('oUser',$oUser);
|
$this->Lang_Get('notify_subject_reminder_code'),
|
||||||
$this->oViewerLocal->Assign('oReminder',$oReminder);
|
array(
|
||||||
/**
|
'oUser' => $oUser,
|
||||||
* Формируем шаблон
|
'oReminder' => $oReminder,
|
||||||
*/
|
)
|
||||||
$sBody=$this->oViewerLocal->Fetch($this->GetTemplatePath('notify.reminder_code.tpl'));
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* Отправляем мыло
|
|
||||||
*/
|
|
||||||
$this->Mail_SetAdress($oUser->getMail(),$oUser->getLogin());
|
|
||||||
$this->Mail_SetSubject($this->Lang_Get('notify_subject_reminder_code'));
|
|
||||||
$this->Mail_SetBody($sBody);
|
|
||||||
$this->Mail_setHTML();
|
|
||||||
$this->Mail_Send();
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Уведомление с новым паролем после его восставновления
|
* Уведомление с новым паролем после его восставновления
|
||||||
|
@ -622,24 +324,15 @@ class ModuleNotify extends Module {
|
||||||
* @param unknown_type $sNewPassword
|
* @param unknown_type $sNewPassword
|
||||||
*/
|
*/
|
||||||
public function SendReminderPassword(ModuleUser_EntityUser $oUser,$sNewPassword) {
|
public function SendReminderPassword(ModuleUser_EntityUser $oUser,$sNewPassword) {
|
||||||
/**
|
$this->Send(
|
||||||
* Передаём в шаблон переменные
|
$oUser,
|
||||||
*/
|
'notify.reminder_password.tpl',
|
||||||
$this->oViewerLocal->Assign('oUser',$oUser);
|
$this->Lang_Get('notify_subject_reminder_password'),
|
||||||
$this->oViewerLocal->Assign('sNewPassword',$sNewPassword);
|
array(
|
||||||
/**
|
'oUser' => $oUser,
|
||||||
* Формируем шаблон
|
'sNewPassword' => $sNewPassword,
|
||||||
*/
|
)
|
||||||
$sBody=$this->oViewerLocal->Fetch($this->GetTemplatePath('notify.reminder_password.tpl'));
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
* Отправляем мыло
|
|
||||||
*/
|
|
||||||
$this->Mail_SetAdress($oUser->getMail(),$oUser->getLogin());
|
|
||||||
$this->Mail_SetSubject($this->Lang_Get('notify_subject_reminder_password'));
|
|
||||||
$this->Mail_SetBody($sBody);
|
|
||||||
$this->Mail_setHTML();
|
|
||||||
$this->Mail_Send();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue