add more DI stuff
[GitHub/Stricted/Domain-Control-Panel.git] / lib / page / SecAddPage.class.php
1 <?php
2 namespace dns\page;
3 use dns\system\helper\IDatabase;
4 use dns\system\helper\TDatabase;
5 use dns\system\DNS;
6 use dns\system\User;
7
8 /**
9 * @author Jan Altensen (Stricted)
10 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
11 * @copyright 2014-2016 Jan Altensen (Stricted)
12 */
13 class SecAddPage extends AbstractPage implements IDatabase {
14 use TDatabase;
15
16 public function prepare() {
17 if (!isset($_GET['id']) || empty($_GET['id']) || !ENABLE_DNSSEC) {
18 throw new \Exception('The link you are trying to reach is no longer available or invalid.', 404);
19 }
20 print_r($_REQUEST);
21 $soaIDs = User::getAccessibleDomains();
22 if (!in_array($_GET['id'], $soaIDs)) {
23 throw new \Exception('Access denied. You\'re not authorized to view this page.', 403);
24 }
25
26 $sql = "SELECT * FROM dns_soa WHERE id = ?";
27 $res = $this->db->query($sql, array($_GET['id']));
28 $soa = $this->db->fetch_array($res);
29
30 $this->tpl->assign(array("soa" => $soa));
31 }
32 }