1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-16 23:00:51 +03:00

Доработка жалоб - уведомление админу на емайл

This commit is contained in:
Mzhelskiy Maxim 2014-01-26 21:33:01 +07:00
parent e49afcb41f
commit f510d16d3c
7 changed files with 66 additions and 1 deletions

View file

@ -150,11 +150,17 @@ class ActionProfile extends Action {
*/
$oComplaint->setText(htmlspecialchars($oComplaint->getText()));
if ($this->User_AddComplaint($oComplaint)) {
$this->Message_AddNotice($this->Lang_Get('user_complaint_submit_result'),$this->Lang_Get('attention'));
/**
* Убиваем каптчу
*/
$this->Message_AddNotice($this->Lang_Get('user_complaint_submit_result'),$this->Lang_Get('attention'));
unset($_SESSION['captcha_keystring_complaint_user']);
/**
* Отправляем уведомление админу
*/
if (Config::Get('module.user.complaint_notify_by_mail')) {
$this->Notify_SendUserComplaint($oComplaint);
}
return true;
} else {
$this->Message_AddError($this->Lang_Get('user_note_save_error'),$this->Lang_Get('error'));

View file

@ -406,6 +406,23 @@ class ModuleNotify extends Module {
)
);
}
/**
* Уведомление администрации о новой жалобе
*
* @param $oComplaint
*/
public function SendUserComplaint($oComplaint) {
$this->Send(
Config::Get('general.admin_mail'),
$this->sPrefix.'.user_complaint.tpl',
$this->Lang_Get('notify_subject_user_complaint'),
array(
'oUserTarget' => $oComplaint->getTargetUser(),
'oUserFrom' => $oComplaint->getUser(),
'oComplaint' => $oComplaint,
)
);
}
/**
* Универсальный метод отправки уведомлений на email
*

View file

@ -70,4 +70,22 @@ class ModuleUser_EntityComplaint extends Entity {
return $this->Lang_Get('user_complaint_type_error');
}
public function getUser() {
if (!$this->_getDataOne('user')) {
$this->_aData['user']=$this->User_GetUserById($this->getUserId());
}
return $this->_getDataOne('user');
}
public function getTargetUser() {
if (!$this->_getDataOne('target_user')) {
$this->_aData['target_user']=$this->User_GetUserById($this->getTargetUserId());
}
return $this->_getDataOne('target_user');
}
public function getTypeTitle() {
return $this->Lang_Get('user_complaint_type_list.'.$this->getType());
}
}

View file

@ -71,6 +71,7 @@ $config['general']['rss_editor_mail'] = '___sys.mail.from_email___'; // мыл
$config['general']['reg']['invite'] = false; // использовать режим регистрации по приглашению или нет. Если использовать, то регистрация будет доступна ТОЛЬКО по приглашениям!
$config['general']['reg']['activation'] = false; // использовать активацию при регистрации или нет
$config['general']['login']['captcha'] = false; // использовать каптчу при входе или нет
$config['general']['admin_mail'] = 'admin@admin.adm'; // email администратора
/**
* Настройки ACL(Access Control List список контроля доступа)

View file

@ -1164,6 +1164,7 @@ return array(
'notify_subject_wall_new' => 'Новое сообщение на вашей стене',
'notify_subject_reactvation' => 'Повторный запрос активации',
'notify_subject_user_changemail' => 'Подтверждение смены емайла',
'notify_subject_user_complaint' => 'Жалоба на пользователя',
'notify_regards' => 'С уважением, администрация сайта',
/**
* Админка

View file

@ -0,0 +1,11 @@
{extends file='emails/email.base.tpl'}
{block name='content'}
User «<a href="{$oUserFrom->getUserWebPath()}">{$oUserFrom->getDisplayName()}</a>» complain on the user «<a href="{$oUserTarget->getUserWebPath()}">{$oUserTarget->getDisplayName()}</a>».
<br>
<br>
<b>Reason:</b> {$oComplaint->getTypeTitle()}<br/>
{if $oComplaint->getText()}
<b>Details:</b> {$oComplaint->getText()}<br/>
{/if}
{/block}

View file

@ -0,0 +1,11 @@
{extends file='emails/email.base.tpl'}
{block name='content'}
Пользователь «<a href="{$oUserFrom->getUserWebPath()}">{$oUserFrom->getDisplayName()}</a>» пожаловался на пользователя «<a href="{$oUserTarget->getUserWebPath()}">{$oUserTarget->getDisplayName()}</a>».
<br>
<br>
<b>Причина:</b> {$oComplaint->getTypeTitle()}<br/>
{if $oComplaint->getText()}
<b>Подробнее:</b> {$oComplaint->getText()}<br/>
{/if}
{/block}