5 use dns\api\idna\idna_convert
;
8 * @author Jan Altensen (Stricted)
9 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
10 * @copyright 2014-2015 Jan Altensen (Stricted)
12 class RecordListPage
extends AbstractPage
{
13 public $activeMenuItem = 'index';
15 public function prepare() {
16 if (!isset($_GET['id']) ||
empty($_GET['id'])) {
17 throw new \
Exception('The link you are trying to reach is no longer available or invalid.', 404);
20 $soaIDs = User
::getAccessibleDomains();
21 if (!in_array($_GET['id'], $soaIDs)) {
22 throw new \
Exception('Access denied. You\92re not authorized to view this page.', 403);
25 $idna = new idna_convert();
27 $sql = "SELECT * FROM dns_soa WHERE id = ?";
28 $res = DNS
::getDB()->query($sql, array($_GET['id']));
29 $soa = DNS
::getDB()->fetch_array($res);
31 $soa['origin'] = $idna->decode($soa['origin']);
35 $sql = "SELECT * FROM dns_rr WHERE zone = ?";
36 $res = DNS
::getDB()->query($sql, array($_GET['id']));
37 while ($row = DNS
::getDB()->fetch_array($res)) {
38 $row['name'] = $idna->decode($row['name']);
39 if ($row['type'] == "SRV") {
40 $data = explode(" ", $row['data']);
43 $data = $idna->encode($data[2]);
45 $data = $weight.' '.$port.' '.$data;
47 $row['data'] = $idna->decode($data);
50 if ($row['type'] == "TLSA" ||
$row['type'] == "DS") {
51 $row['data'] = $
$row['data'];
54 $row['data'] = $idna->decode($row['data']);
60 DNS
::getTPL()->assign(array("records" => $records, "soa" => $soa));