Example #1
0
<?php

require_once 'runtime.php';
require_once ROOT_DIR . '/lib/core/DnsZone.class.php';
require_once ROOT_DIR . '/lib/core/DnsZoneList.class.php';
require_once ROOT_DIR . '/lib/core/DnsRessourceRecord.class.php';
if (!isset($_GET['section']) and isset($_GET['dns_ressource_record_id'])) {
    //show ressource record
} elseif ($_GET['section'] == 'add') {
    if (Permission::checkPermission(PERM_USER)) {
        //pass system messages to the template
        $smarty->assign('message', Message::getMessage());
        $dns_zone_list = new DnsZoneList();
        $smarty->assign('dns_zone_list', $dns_zone_list->getDnsZoneList());
        //compile the template and sorround the main content by footer and header template
        $smarty->display("header.tpl.html");
        $smarty->display("dns_ressource_record_add.tpl.html");
        $smarty->display("footer.tpl.html");
    } else {
        Permission::denyAccess(PERM_USER);
    }
} elseif ($_GET['section'] == 'insert_add') {
    if (Permission::checkPermission(PERM_USER)) {
        $dns_ressource_record = new DnsRessourceRecord(false, (int) $_POST['dns_zone_id'], (int) $_SESSION['user_id'], $_POST['host'], $_POST['type'], $_POST['pri'], (int) $_POST['destination']);
        if ($dns_ressource_record->store()) {
            $message[] = array('Der Ressource Record ' . $dns_ressource_record->getHost() . ' wurde gespeichert.', 1);
        } else {
            $message[] = array('Der Ressource Record konnte nicht gespeichert werden.', 2);
        }
        Message::setMessage($message);
        header('Location: ./dns_zone.php?dns_zone_id=' . $_POST['dns_zone_id']);
Example #2
0
 private function dns_zone_list()
 {
     if ($this->get_request_method() == "GET") {
         $this->_request['user_id'] = !isset($this->_request['user_id']) ? false : $this->_request['user_id'];
         $dns_zone_list = new DnsZoneList((int) $this->_request['user_id'], $this->_request['offset'], $this->_request['limit'], $this->_request['sort_by'], $this->_request['order']);
         $domxmldata = $dns_zone_list->getDomXMLElement($this->domxml);
         $this->response($this->finishxml($domxmldata), 200);
     } else {
         $this->error_code = 2;
         $this->error_message = "The DNS-Zone-List could not be created, your request seems to be malformed.";
         $this->response($this->finishxml(), 400);
     }
 }