servnest/pg-view/ns/print.php
2023-07-17 21:15:18 +02:00

77 lines
1.9 KiB
PHP

<?php declare(strict_types=1); ?>
<form method="post">
<input type="radio" name="print" id="table" value="table" checked="">
<label for="table"><?= _('Records table') ?></label>
<br>
<input type="radio" name="print" id="ds" value="ds">
<label for="ds"><?= _('DS record') ?></label>
<br>
<input type="radio" name="print" id="raw" value="raw">
<label for="raw"><?= _('Raw zonefile') ?></label>
<br>
<label for="zone"><?= _('Selected zone') ?></label>
<select required="" name="zone" id="zone">
<option value="" disabled="" selected="">-</option>
<?php
foreach (nsListUserZones() as $zone)
echo ' <option value="' . $zone . '">' . $zone . '</option>' . LF;
?>
</select>
<br>
<input type="submit" value="<?= _('Display') ?>">
</form>
<?php
if (isset($data['zone-raw']))
echo '<pre>' . htmlspecialchars($data['zone-raw']) . '</pre>';
if (isset($data['zone-table'])) { ?>
<table class="zone">
<tr>
<th><?= _('Domain') ?></th>
<th><?= _('TTL') ?></th>
<th><?= _('Type') ?></th>
<th><?= _('Value') ?></th>
</tr>
<?php
foreach ($data['zone-table'] as $zone_line) {
echo ' <tr>' . LF;
foreach ($zone_line as $element)
echo ' <td><code>' . htmlspecialchars($element) . '</code></td>' . LF;
echo ' </tr>' . LF;
}
}
?>
</table>
<?php
if (isset($data['zone-ds'])) { ?>
<dl>
<dt><?= _('Zone') ?></dt>
<dd>
<code><?= $_POST['zone'] ?></code>
</dd>
<dt><?= _('Tag') ?></dt>
<dd>
<code><?= $data['zone-ds']['tag'] ?></code>
</dd>
<dt><?= _('Algorithm') ?></dt>
<dd>
<code><?= $data['zone-ds']['algo'] ?></code><?= ($data['zone-ds']['algo'] === '15') ? ' (Ed25519)' : '' ?>
</dd>
<dt><?= _('Digest type') ?></dt>
<dd>
<code><?= $data['zone-ds']['digest_type'] ?></code><?= ($data['zone-ds']['digest_type'] === '2') ? ' (SHA-256)' : '' ?>
</dd>
<dt><?= _('Digest') ?></dt>
<dd>
<code><?= $data['zone-ds']['digest'] ?></code>
</dd>
</dl>
<?php
}