mirror of https://github.com/PurpleI2P/regi2p.git
R4SAS
3 years ago
18 changed files with 162 additions and 35 deletions
@ -0,0 +1,48 @@
@@ -0,0 +1,48 @@
|
||||
{% extends "_page.twig" %} |
||||
|
||||
{% block title %}Alive hosts{% endblock %} |
||||
{% block content %} |
||||
<div class="container"> |
||||
<div class="alive-hosts"> |
||||
<p class="important title" align="center"> |
||||
Hidden domains |
||||
</p> |
||||
|
||||
<table class="table"> |
||||
<thead class="table__head"> |
||||
<tr class="table__row"> |
||||
<th class="table__cell">Domain</th> |
||||
<th class="table__cell"><abbr title="Address Helper">AH</abbr></th> |
||||
<th class="table__cell"><abbr title="Base32 address">B32</abbr></th> |
||||
<th class="table__cell table__cell_full-b32">Full Base32</th> |
||||
<th class="table__cell table__cell_date">Last seen</th> |
||||
</tr> |
||||
</thead> |
||||
<tbody class="table__body"> |
||||
{% for host in hosts %} |
||||
<tr class="table__row"> |
||||
{% if host.host|length > 24 %} |
||||
<td class="table__cell table__cell_long-ass"><a href="http://{{ host.host }}/" rel="external nofollow noopener noreferrer" target="_blank">{{ host.host|slice(0, 23) }}…</a></td> |
||||
{% else %} |
||||
<td class="table__cell table__cell_long-ass"><a href="http://{{ host.host }}/" rel="external nofollow noopener noreferrer" target="_blank">{{ host.host }}</a></td> |
||||
{% endif %} |
||||
<td class="table__cell table__cell_center-bold"><a href="http://{{ host.host }}/?i2paddresshelper={{ host.base64 }}" rel="external nofollow noopener noreferrer" target="_blank">A</a></td> |
||||
<td class="table__cell table__cell_center-bold"><a href="http://{{ host.base32 }}.b32.i2p/" rel="external nofollow noopener noreferrer" target="_blank">B</a></td> |
||||
<td class="table__cell table__cell_full-b32 table__cell_long-ass">{{ host.base32 }}</td> |
||||
<td class="table__cell table__cell_date">{{ host.last_seen }}</td> |
||||
</tr> |
||||
{% endfor %} |
||||
</tbody> |
||||
</table> |
||||
|
||||
{% if total > 1 %} |
||||
{% include "_pagination.twig" with { |
||||
total, |
||||
current, |
||||
url: "/alive/" |
||||
} only %} |
||||
{% endif %} |
||||
</div> |
||||
</div> |
||||
{% endblock %} |
||||
|
@ -0,0 +1,42 @@
@@ -0,0 +1,42 @@
|
||||
<?php |
||||
|
||||
$all = false; |
||||
|
||||
// Check for option before loading anything |
||||
if (isset($_GET["all"])) { |
||||
$all = true; |
||||
} else { |
||||
header("Location: /"); |
||||
exit(); |
||||
} |
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php'; |
||||
require_once __DIR__ . '/../config.php'; |
||||
|
||||
/* Initialize Twig engine */ |
||||
$loader = new \Twig\Loader\FilesystemLoader(__DIR__ . '/../templates'); |
||||
$twig = new \Twig\Environment($loader, [ |
||||
'cache' => __DIR__ . '/../cache', |
||||
'auto_reload' => true, |
||||
]); |
||||
|
||||
$offset = $options["tableitems"] * ($page - 1); |
||||
|
||||
$pdo = (new App\DB($options))->pdo; |
||||
|
||||
/* Get records amount */ |
||||
$STH = $pdo->query ("SELECT COUNT(*) FROM `hosts` " . |
||||
"WHERE `approved` = 1 AND `disabled` = 0 AND `hidden` = 0 AND `blacklisted` = 1"); |
||||
$records = $STH->fetchColumn(); |
||||
|
||||
$pages = intdiv($records, $options["tableitems"]) + 1; |
||||
|
||||
/* Get records with limit */ |
||||
$STH = $pdo->query ("SELECT `host`, `base64`, `base32`, `last_seen` FROM `hosts` " . |
||||
"WHERE `approved` = 1 AND `disabled` = 0 AND `hidden` = 0 AND `blacklisted` = 1 " . |
||||
"LIMIT " . $offset . ", " . $options["tableitems"]); |
||||
$STH->setFetchMode(PDO::FETCH_ASSOC); |
||||
$rows = $STH->fetchAll(); |
||||
|
||||
$template = $twig->load('hidden.twig'); |
||||
echo $template->render(['current' => $page, 'total' => $pages, 'hosts' => $rows, 'all' => $all]); |
Loading…
Reference in new issue