Browse Source

Add poster ip address display

Visman 2 years ago
parent
commit
fedc6be825

+ 1 - 0
app/Models/Pages/Topic.php

@@ -148,6 +148,7 @@ class Topic extends Page
         $this->crumbs       = $this->crumbs($topic);
         $this->online       = $this->c->Online->calc($this)->info();
         $this->stats        = null;
+        $this->showIpAddrs  = $this->c->userRules->viewIP;
 
         if (
             $topic->canReply

+ 13 - 0
app/Models/Post/Post.php

@@ -216,6 +216,19 @@ class Post extends DataModel
         );
     }
 
+    /**
+     * Ссылка на страницу данных об ip
+     */
+    protected function getlinkGetHost(): string
+    {
+        return $this->c->Router->link(
+            'AdminHost',
+            [
+                'ip' => $this->poster_ip,
+            ]
+        );
+    }
+
     /**
      * HTML код сообщения
      */

+ 1 - 1
app/lang/en/topic.po

@@ -28,7 +28,7 @@ msgid "Promote user title"
 msgstr "Promote user"
 
 msgid "IP address logged"
-msgstr "IP address logged"
+msgstr "IP<span> address</span>"
 
 msgid "Note"
 msgstr "Note:"

+ 1 - 1
app/lang/ru/topic.po

@@ -28,7 +28,7 @@ msgid "Promote user title"
 msgstr "Продвинуть пользователя"
 
 msgid "IP address logged"
-msgstr "IP адрес"
+msgstr "IP<span> адрес</span>"
 
 msgid "Note"
 msgstr "Замечание"

+ 3 - 0
app/templates/topic.forkbb.php

@@ -107,6 +107,9 @@
             @if ($post->user->location)
               <li class="f-location"><span class="f-psfont">{!! __(['From %s', $post->user->censorLocation]) !!}</span></li>
             @endif
+            @if ($p->showIpAddrs)
+              <li class="f-poster-ip"><a href="{{ $post->linkGetHost }}" title="{{ $post->poster_ip }}"><span class="f-psfont">{!! __('IP address logged') !!}</span></a></li>
+            @endif
             </ul>
         @endif
           </div>