1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-26 03:30:48 +03:00

добавлено уведомление подписчикам блога при публикации топика

This commit is contained in:
Mzhelskiy Maxim 2008-09-22 18:16:44 +00:00
parent 177bbff744
commit 4ecbb11881
3 changed files with 25 additions and 1 deletions

View file

@ -288,7 +288,7 @@ class ActionTopic extends Action {
*/
if (!$this->Blog_GetRelationBlogUserByBlogIdAndUserId($oBlog->getId(),$this->oUserCurrent->getId())) {
if ($oBlog->getOwnerId()!=$this->oUserCurrent->getId()) {
$this->Message_AddErrorSingle('Вы не сотоите в этом блоге!','Ошибка');
$this->Message_AddErrorSingle('Вы не состоите в этом блоге!','Ошибка');
return false;
}
}
@ -338,6 +338,26 @@ class ActionTopic extends Action {
* Добавляем топик
*/
if ($this->Topic_AddTopic($oTopic)) {
//Делаем рассылку спама всем, кто состоит в этом блоге
if ($oTopic->getPublish()==1 and $oBlog->getType()!='personal') {
$aBlogUsers=$this->Blog_GetRelationBlogUsersByBlogId($oBlog->getId());
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();
}
}
func_header_location(DIR_WEB_ROOT.'/blog/'.$oTopic->getId().'.html');
} else {
$this->Message_AddErrorSingle('Возникли технические неполадки при добавлении топика, пожалуйста повторите позже.','Внутреняя ошибка');

View file

@ -41,6 +41,9 @@ class BlogEntity_BlogUser extends Entity
public function getUserLogin() {
return $this->_aData['user_login'];
}
public function getUserMail() {
return $this->_aData['user_mail'];
}
public function getUserProfileAvatar() {
return $this->_aData['user_profile_avatar'];
}

View file

@ -106,6 +106,7 @@ class Mapper_Blog extends Mapper {
$sql = "SELECT
bu.*,
u.user_login as user_login,
u.user_mail as user_mail,
u.user_profile_avatar as user_profile_avatar,
u.user_profile_avatar_type as user_profile_avatar_type,
b.blog_title as blog_title,