Host.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * This file is part of the ForkBB <https://github.com/forkbb>.
  4. *
  5. * @copyright (c) Visman <mio.visman@yandex.ru, https://github.com/MioVisman>
  6. * @license The MIT License (MIT)
  7. */
  8. declare(strict_types=1);
  9. namespace ForkBB\Models\Pages\Admin;
  10. use ForkBB\Models\Page;
  11. use ForkBB\Models\Pages\Admin;
  12. use function \ForkBB\__;
  13. class Host extends Admin
  14. {
  15. /**
  16. * Подготавливает данные для шаблона
  17. */
  18. public function view(array $args, string $method): Page
  19. {
  20. $this->c->Lang->load('admin_host');
  21. $ip = \filter_var($args['ip'], \FILTER_VALIDATE_IP);
  22. if (false === $ip) {
  23. return $this->c->Message->message('Bad request', false);
  24. }
  25. $host = \gethostbyaddr($ip);
  26. $this->nameTpl = 'message';
  27. $this->titles = 'Info';
  28. $this->back = true;
  29. $this->fIswev = [
  30. 'i',
  31. [
  32. 'Host info',
  33. $ip,
  34. $host,
  35. $this->c->Router->link(
  36. 'AdminUsersResult',
  37. [
  38. 'data' => "ip:{$ip}",
  39. ]
  40. )
  41. ],
  42. ];
  43. return $this;
  44. }
  45. }