mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-26 11:40:48 +03:00
Фронт функционал системы отложенной отправки e-mail сообщений.
This commit is contained in:
parent
d9dfbf40a2
commit
39155189bf
|
@ -855,7 +855,7 @@ class ActionBlog extends Action {
|
|||
if ($oCommentParent and $oCommentParent->getUserId()!=$oTopic->getUserId() and $oCommentNew->getUserId()!=$oCommentParent->getUserId()) {
|
||||
$oUserAuthorComment=$oCommentParent->getUser();
|
||||
$this->Notify_SendCommentReplyToAuthorParentComment($oUserAuthorComment,$oTopic,$oCommentNew,$this->oUserCurrent);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->Message_AddErrorSingle($this->Lang_Get('system_error'),$this->Lang_Get('error'));
|
||||
}
|
||||
|
|
|
@ -544,7 +544,7 @@ class ActionProfile extends Action {
|
|||
$this->Notify_SendUserFriendNew(
|
||||
$oUser,$this->oUserCurrent,$sUserText,
|
||||
Router::GetPath('talk').'read/'.$oTalk->getId().'/'
|
||||
);
|
||||
);
|
||||
/**
|
||||
* Удаляем отправляющего юзера из переписки
|
||||
*/
|
||||
|
|
|
@ -946,7 +946,6 @@ class ActionTalk extends Action {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Передаем во вьевер массив результатов обработки по каждому пользователю
|
||||
$this->Viewer_AssingAjax('aUsers',$aResult);
|
||||
}
|
||||
|
|
|
@ -350,7 +350,7 @@ class ActionTopic extends Action {
|
|||
//Делаем рассылку спама всем, кто состоит в этом блоге
|
||||
if ($oTopic->getPublish()==1 and $oBlog->getType()!='personal') {
|
||||
$this->Topic_SendNotifyTopicNew($oBlog,$oTopic,$this->oUserCurrent);
|
||||
}
|
||||
}
|
||||
func_header_location($oTopic->getUrl());
|
||||
} else {
|
||||
$this->Message_AddErrorSingle($this->Lang_Get('system_error'));
|
||||
|
|
|
@ -15,12 +15,36 @@
|
|||
---------------------------------------------------------
|
||||
*/
|
||||
|
||||
set_include_path(get_include_path().PATH_SEPARATOR.dirname(__FILE__));
|
||||
require_once('mapper/Notify.mapper.class.php');
|
||||
|
||||
/**
|
||||
* Модуль рассылок уведомлений пользователям
|
||||
*
|
||||
*/
|
||||
class LsNotify extends Module {
|
||||
/**
|
||||
* Статусы степени обработки заданий отложенной публикации в базе данных
|
||||
*/
|
||||
const NOTIFY_TASK_STATUS_NULL=1;
|
||||
/**
|
||||
* Объект локального вьювера для рендеринга сообщений
|
||||
*
|
||||
* @var LsViewer
|
||||
*/
|
||||
protected $oViewerLocal=null;
|
||||
/**
|
||||
* Массив заданий на удаленную публикацию
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $aTask=array();
|
||||
/**
|
||||
* Меппер
|
||||
*
|
||||
* @var Mapper_Notify
|
||||
*/
|
||||
protected $oMapper=null;
|
||||
/**
|
||||
* Инициализация модуля
|
||||
* Создаём локальный экземпляр модуля Viewer
|
||||
|
@ -34,6 +58,8 @@ class LsNotify extends Module {
|
|||
$this->oViewerLocal=new LsViewer(Engine::getInstance());
|
||||
$this->oViewerLocal->Init();
|
||||
$this->oViewerLocal->VarAssign();
|
||||
|
||||
$this->oMapper=new Mapper_Notify($this->Database_GetConnect());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,14 +88,39 @@ class LsNotify extends Module {
|
|||
* Формируем шаблон
|
||||
*/
|
||||
$sBody=$this->oViewerLocal->Fetch('notify/'.$this->Lang_GetLang()."/notify.comment_new.tpl");
|
||||
|
||||
/**
|
||||
* Отправляем мыло
|
||||
* Если в конфигураторе указан отложенный метод отправки,
|
||||
* то добавляем задание в массив. В противном случае,
|
||||
* сразу отсылаем на email
|
||||
*/
|
||||
$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();
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -99,13 +150,37 @@ class LsNotify extends Module {
|
|||
*/
|
||||
$sBody=$this->oViewerLocal->Fetch('notify/'.$this->Lang_GetLang()."/notify.comment_reply.tpl");
|
||||
/**
|
||||
* Отправляем мыло
|
||||
* Если в конфигураторе указан отложенный метод отправки,
|
||||
* то добавляем задание в массив. В противном случае,
|
||||
* сразу отсылаем на email
|
||||
*/
|
||||
$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();
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -135,13 +210,37 @@ class LsNotify extends Module {
|
|||
*/
|
||||
$sBody=$this->oViewerLocal->Fetch('notify/'.$this->Lang_GetLang()."/notify.topic_new.tpl");
|
||||
/**
|
||||
* Отправляем мыло
|
||||
* Если в конфигураторе указан отложенный метод отправки,
|
||||
* то добавляем задание в массив. В противном случае,
|
||||
* сразу отсылаем на email
|
||||
*/
|
||||
$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();
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -160,6 +259,7 @@ class LsNotify extends Module {
|
|||
* Формируем шаблон
|
||||
*/
|
||||
$sBody=$this->oViewerLocal->Fetch('notify/'.$this->Lang_GetLang()."/notify.registration_activate.tpl");
|
||||
|
||||
/**
|
||||
* Отправляем мыло
|
||||
*/
|
||||
|
@ -186,6 +286,7 @@ class LsNotify extends Module {
|
|||
* Формируем шаблон
|
||||
*/
|
||||
$sBody=$this->oViewerLocal->Fetch('notify/'.$this->Lang_GetLang()."/notify.registration.tpl");
|
||||
|
||||
/**
|
||||
* Отправляем мыло
|
||||
*/
|
||||
|
@ -215,13 +316,37 @@ class LsNotify extends Module {
|
|||
*/
|
||||
$sBody=$this->oViewerLocal->Fetch('notify/'.$this->Lang_GetLang()."/notify.invite.tpl");
|
||||
/**
|
||||
* Отправляем мыло
|
||||
* Если в конфигураторе указан отложенный метод отправки,
|
||||
* то добавляем задание в массив. В противном случае,
|
||||
* сразу отсылаем на email
|
||||
*/
|
||||
$this->Mail_SetAdress($sMailTo);
|
||||
$this->Mail_SetSubject($this->Lang_Get('notify_subject_invite'));
|
||||
$this->Mail_SetBody($sBody);
|
||||
$this->Mail_setHTML();
|
||||
$this->Mail_Send();
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -249,13 +374,37 @@ class LsNotify extends Module {
|
|||
*/
|
||||
$sBody=$this->oViewerLocal->Fetch('notify/'.$this->Lang_GetLang()."/notify.talk_new.tpl");
|
||||
/**
|
||||
* Отправляем мыло
|
||||
* Если в конфигураторе указан отложенный метод отправки,
|
||||
* то добавляем задание в массив. В противном случае,
|
||||
* сразу отсылаем на email
|
||||
*/
|
||||
$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();
|
||||
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(UserEntity_User $oUserTo,UserEntity_User $oUserFrom,TalkEntity_Talk $oTalk,CommentEntity_Comment $oTalkComment) {
|
||||
|
@ -277,13 +426,37 @@ class LsNotify extends Module {
|
|||
*/
|
||||
$sBody=$this->oViewerLocal->Fetch('notify/'.$this->Lang_GetLang()."/notify.talk_comment_new.tpl");
|
||||
/**
|
||||
* Отправляем мыло
|
||||
* Если в конфигураторе указан отложенный метод отправки,
|
||||
* то добавляем задание в массив. В противном случае,
|
||||
* сразу отсылаем на email
|
||||
*/
|
||||
$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();
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -312,13 +485,37 @@ class LsNotify extends Module {
|
|||
*/
|
||||
$sBody=$this->oViewerLocal->Fetch('notify/'.$this->Lang_GetLang()."/notify.user_friend_new.tpl");
|
||||
/**
|
||||
* Отправляем мыло
|
||||
* Если в конфигураторе указан отложенный метод отправки,
|
||||
* то добавляем задание в массив. В противном случае,
|
||||
* сразу отсылаем на email
|
||||
*/
|
||||
$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();
|
||||
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();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Уведомление при восстановлении пароля
|
||||
|
@ -336,6 +533,7 @@ class LsNotify extends Module {
|
|||
* Формируем шаблон
|
||||
*/
|
||||
$sBody=$this->oViewerLocal->Fetch('notify/'.$this->Lang_GetLang()."/notify.reminder_code.tpl");
|
||||
|
||||
/**
|
||||
* Отправляем мыло
|
||||
*/
|
||||
|
@ -361,6 +559,7 @@ class LsNotify extends Module {
|
|||
* Формируем шаблон
|
||||
*/
|
||||
$sBody=$this->oViewerLocal->Fetch('notify/'.$this->Lang_GetLang()."/notify.reminder_password.tpl");
|
||||
|
||||
/**
|
||||
* Отправляем мыло
|
||||
*/
|
||||
|
@ -370,5 +569,17 @@ class LsNotify extends Module {
|
|||
$this->Mail_setHTML();
|
||||
$this->Mail_Send();
|
||||
}
|
||||
|
||||
/**
|
||||
* При завершении работы модуля проверяем наличие
|
||||
* отложенных заданий в массиве и при необходимости
|
||||
* передаем их в меппер
|
||||
*/
|
||||
public function Shutdown() {
|
||||
if(!empty($this->aTask) && Config::Get('module.notify.delayed')) {
|
||||
$this->oMapper->AddTaskArray($this->aTask);
|
||||
$this->aTask=array();
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
65
classes/modules/notify/entity/Task.entity.class.php
Normal file
65
classes/modules/notify/entity/Task.entity.class.php
Normal file
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
/*-------------------------------------------------------
|
||||
*
|
||||
* 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 NotifyEntity_Task extends Entity
|
||||
{
|
||||
public function getTaskId() {
|
||||
return $this->_aData['notify_task_id'];
|
||||
}
|
||||
public function getUserMail() {
|
||||
return $this->_aData['user_mail'];
|
||||
}
|
||||
public function getUserLogin() {
|
||||
return $this->_aData['user_login'];
|
||||
}
|
||||
public function getNotifyText() {
|
||||
return $this->_aData['notify_text'];
|
||||
}
|
||||
public function getDateCreated() {
|
||||
return $this->_aData['date_created'];
|
||||
}
|
||||
public function getTaskStatus() {
|
||||
return $this->_aData['notify_task_status'];
|
||||
}
|
||||
public function getNotifySubject() {
|
||||
return $this->_aData['notify_subject'];
|
||||
}
|
||||
|
||||
|
||||
public function setTaskId($data) {
|
||||
$this->_aData['notify_task_id']=$data;
|
||||
}
|
||||
public function setUserMail($data) {
|
||||
$this->_aData['user_mail']=$data;
|
||||
}
|
||||
public function setUserLogin($data) {
|
||||
$this->_aData['user_login']=$data;
|
||||
}
|
||||
public function setNotifyText($data) {
|
||||
$this->_aData['notify_text']=$data;
|
||||
}
|
||||
public function setDateCreated($data) {
|
||||
$this->_aData['date_created']=$data;
|
||||
}
|
||||
public function setTaskStatus($data) {
|
||||
$this->_aData['notify_task_status']=$data;
|
||||
}
|
||||
public function setNotifySubject($data) {
|
||||
$this->_aData['notify_subject']=$data;
|
||||
}
|
||||
}
|
||||
?>
|
97
classes/modules/notify/mapper/Notify.mapper.class.php
Normal file
97
classes/modules/notify/mapper/Notify.mapper.class.php
Normal file
|
@ -0,0 +1,97 @@
|
|||
<?php
|
||||
/*-------------------------------------------------------
|
||||
*
|
||||
* 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 Mapper_Notify extends Mapper {
|
||||
|
||||
public function AddTask(NotifyEntity_Task $oNotifyTask) {
|
||||
$sql = "
|
||||
INSERT INTO ".Config::Get('db.table.notify_task')."
|
||||
( user_login, user_mail, notify_subject, notify_text, date_created, notify_task_status )
|
||||
VALUES
|
||||
( ?, ?, ?, ?, ?, ?d )
|
||||
";
|
||||
|
||||
if ($this->oDb->query(
|
||||
$sql,
|
||||
$oNotifyTask->getUserLogin(),
|
||||
$oNotifyTask->getUserMail(),
|
||||
$oNotifyTask->getNotifySubject(),
|
||||
$oNotifyTask->getNotifyText(),
|
||||
$oNotifyTask->getDateCreated(),
|
||||
$oNotifyTask->getTaskStatus()
|
||||
)===0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function AddTaskArray($aTasks) {
|
||||
if(!is_array($aTasks)&&count($aTasks)==0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$aValues=array();
|
||||
foreach ($aTasks as $oTask) {
|
||||
$aValues[]="(".implode(',',
|
||||
array(
|
||||
$this->oDb->escape($oTask->getUserLogin()),
|
||||
$this->oDb->escape($oTask->getUserMail()),
|
||||
$this->oDb->escape($oTask->getNotifySubject()),
|
||||
$this->oDb->escape($oTask->getNotifyText()),
|
||||
$this->oDb->escape($oTask->getDateCreated()),
|
||||
$this->oDb->escape($oTask->getTaskStatus())
|
||||
)
|
||||
).")";
|
||||
}
|
||||
$sql = "
|
||||
INSERT INTO ".Config::Get('db.table.notify_task')."
|
||||
( user_login, user_mail, notify_subject, notify_text, date_created, notify_task_status )
|
||||
VALUES
|
||||
".implode(', ', (array)$aValues);
|
||||
|
||||
return $this->oDb->query($sql);
|
||||
}
|
||||
|
||||
public function DeleteTask(NotifyEntity_Task $oNotifyTask) {
|
||||
$sql = "
|
||||
DELETE FROM ".Config::Get('db.table.notify_task')."
|
||||
WHERE
|
||||
notify_task_id = ?d
|
||||
";
|
||||
if ($this->oDb->query($sql,$oNotifyTask->getTaskId())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function DeleteTaskByArrayId($aTaskId) {
|
||||
$sql = "
|
||||
DELETE FROM ".Config::Get('db.table.notify_task')."
|
||||
WHERE
|
||||
notify_task_id IN(?a)
|
||||
";
|
||||
if ($this->oDb->query($sql,$aTaskId)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function GetTasks($iLimit) {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -94,7 +94,7 @@ class LsTalk extends Module {
|
|||
$this->Notify_SendTalkNew($oUserToMail,$oUserFrom,$oTalk);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $oTalk;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1072,7 +1072,7 @@ class LsTopic extends Module {
|
|||
//отправляем создателю блога
|
||||
if ($oBlog->getOwnerId()!=$oUserTopic->getId()) {
|
||||
$this->Notify_SendTopicNewToSubscribeBlog($oBlog->getOwner(),$oTopic,$oBlog,$oUserTopic);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -294,7 +294,10 @@ $config['module']['talk']['period'] = 20000;
|
|||
$config['module']['talk']['max_errors'] = 4;
|
||||
$config['module']['talk']['encrypt'] = 'livestreet'; // Ключ XXTEA шифрования идентификаторов в ссылках
|
||||
// Модуль Lang
|
||||
$config['module']['lang']['delete_undefined'] = true; // Если установлена true, то модуль будет автоматически удалять из языковых конструкций переменные вида %%var%%, по которым не была произведена замена
|
||||
$config['module']['lang']['delete_undefined'] = true; // Если установлена true, то модуль будет автоматически удалять из языковых конструкций переменные вида %%var%%, по которым не была произведена замена
|
||||
// Модуль Notify
|
||||
$config['module']['notify']['delayed'] = false; // Указывает на необходимость использовать режим отложенной рассылки сообщений на email
|
||||
$config['module']['notify']['insert_single'] = false; // Если опция установлена в true, систему будет собирать записи заданий удаленной публикации, для вставки их в базу единым INSERT
|
||||
|
||||
// Какие модули должны быть загружены на старте
|
||||
$config['module']['autoLoad'] = array('Cache','Session','User', 'Lang', 'Message');
|
||||
|
@ -341,6 +344,8 @@ $config['db']['table']['country'] = $config['db']['table']['prefix']
|
|||
$config['db']['table']['country_user'] = $config['db']['table']['prefix'].'country_user';
|
||||
$config['db']['table']['reminder'] = $config['db']['table']['prefix'].'reminder';
|
||||
$config['db']['table']['session'] = $config['db']['table']['prefix'].'session';
|
||||
$config['db']['table']['notify_task'] = $config['db']['table']['prefix'].'notify_task';
|
||||
|
||||
/**
|
||||
* Настройка memcache
|
||||
*/
|
||||
|
|
13
patch.sql
13
patch.sql
|
@ -105,3 +105,16 @@ ALTER TABLE `prefix_friend` ADD INDEX ( `user_from` );
|
|||
ALTER TABLE `prefix_friend` ADD INDEX ( `user_to` );
|
||||
ALTER TABLE `prefix_friend` ADD CONSTRAINT `prefix_friend_from_fk` FOREIGN KEY (`user_from`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
ALTER TABLE `prefix_friend` ADD CONSTRAINT `prefix_friend_to_fk` FOREIGN KEY (`user_to`) REFERENCES `prefix_user` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
--
|
||||
-- Хранение заданий на отложенную отправку e-mail сообщений
|
||||
--
|
||||
CREATE TABLE `prefix_notify_task` (
|
||||
`notify_task_id` INT UNSIGNED AUTO_INCREMENT ,
|
||||
`user_login` VARCHAR( 30 ) ,
|
||||
`user_mail` VARCHAR( 50 ) ,
|
||||
`notify_subject` VARCHAR( 200 ) ,
|
||||
`notify_text` TEXT,
|
||||
`date_created` DATETIME,
|
||||
`notify_task_status` TINYINT( 2 ) UNSIGNED,
|
||||
PRIMARY KEY ( `notify_task_id` )
|
||||
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
|
Loading…
Reference in a new issue