Skip to content

Commit

Permalink
Ajustado mensagem de notificação de usuário e email para mandar o ip …
Browse files Browse the repository at this point in the history
…Ref.: #1
  • Loading branch information
israelmelo committed Sep 3, 2024
1 parent 731ba7f commit fbae7b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,14 @@ public function _init()
)
) {

$ip = $_SERVER['HTTP_X_REAL_IP'] ?? $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR'] ?? '';

foreach ($users as $user) {
$plugin->createNotification($user->profile, $this, $spam_terms);
$plugin->createNotification($user->profile, $this, $spam_terms, $ip);
}

$dict_entity = $plugin->dictEntity($this);
$message = i::__("{$dict_entity} {$this->name} foi enviado para moderação");
$message = i::__("{$dict_entity} {$this->name} foi enviado para moderação. Informamos que registramos seu ip: {$ip}");
$notification = new Notification;
$notification->user = $this->ownerUser;
$notification->message = $message;
Expand Down Expand Up @@ -166,7 +168,7 @@ public function register() {
}
}

public function createNotification($recipient, $entity, $spam_detections)
public function createNotification($recipient, $entity, $spam_detections, $ip)
{
$app = App::i();
$app->disableAccessControl();
Expand Down Expand Up @@ -200,6 +202,7 @@ public function createNotification($recipient, $entity, $spam_detections)
"url" => $entity->singleUrl,
"baseUrl" => $app->getBaseUrl(),
"detectedDetails" => implode("\n", $detected_details),
"ip" => $ip
];

$mustache = new \Mustache_Engine();
Expand Down
1 change: 1 addition & 0 deletions views/emails/email-spam.html
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@
<h3 class="status-card--title">Detalhes da Detecção</h3>
<p><strong>Nome:</strong> {{nome}}</p>
<p><strong>ID:</strong> {{id}}</p>
<p><strong>IP:</strong> {{ip}}</p>
<p><strong>Termos e Campos Detectados:</strong></p>
<div class="status-card--content">
<p>{{{detectedDetails}}}</p>
Expand Down

0 comments on commit fbae7b9

Please sign in to comment.