예제 #1
0
파일: api.php 프로젝트: wAmpIre/netmon
 private function dns_ressource_record_list()
 {
     if ($this->get_request_method() == "GET") {
         $this->_request['dns_zone_id'] = !isset($this->_request['dns_zone_id']) ? false : $this->_request['dns_zone_id'];
         $this->_request['user_id'] = !isset($this->_request['user_id']) ? false : $this->_request['user_id'];
         $dns_ressource_record_list = new DnsRessourceRecordList((int) $this->_request['dns_zone_id'], (int) $this->_request['user_id'], $this->_request['offset'], $this->_request['limit'], $this->_request['sort_by'], $this->_request['order']);
         $domxmldata = $dns_ressource_record_list->getDomXMLElement($this->domxml);
         $this->response($this->finishxml($domxmldata), 200);
     } else {
         $this->error_code = 2;
         $this->error_message = "The DNS-Ressource-Record list could not be created, your request seems to be malformed.";
         $this->response($this->finishxml(), 400);
     }
 }
예제 #2
0
 public function setDnsRessourceRecordList($itemlist = false)
 {
     if ($itemlist instanceof DnsRessourceRecordList) {
         $this->dns_ressource_record_list = $itemlist;
         return true;
     } elseif (is_array($itemlist)) {
         $dns_ressource_record_list = new DnsRessourceRecordList(false, false, 0, 0);
         foreach ($itemlist as $dns_ressource_record_id) {
             $dns_ressource_record = new DnsRessourceRecord((int) $dns_ressource_record_id);
             if ($dns_ressource_record->fetch()) {
                 $dns_ressource_record_list->add($dns_ressource_record);
             }
         }
         $this->setDnsRessourceRecordList($dns_ressource_record_list);
         return true;
     } elseif ($itemlist == false and $this->getServiceId() != 0) {
         $result = array();
         try {
             $stmt = DB::getInstance()->prepare("SELECT dns_ressource_record_id\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tFROM service_dns_ressource_records\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE service_id = ?");
             $stmt->execute(array($this->getServiceId()));
             $result = $stmt->fetchAll(PDO::FETCH_ASSOC);
         } catch (PDOException $e) {
             echo $e->getMessage();
             echo $e->getTraceAsString();
         }
         $dns_ressource_record_list = new DnsRessourceRecordList(false, false, 0, 0);
         foreach ($result as $dns_ressource_record_id) {
             $dns_ressource_record = new DnsRessourceRecord((int) $dns_ressource_record_id['dns_ressource_record_id']);
             if ($dns_ressource_record->fetch()) {
                 $dns_ressource_record_list->add($dns_ressource_record);
             }
         }
         $this->setDnsRessourceRecordList($dns_ressource_record_list);
         return true;
     }
     return false;
 }
예제 #3
0
파일: dns_zone.php 프로젝트: wAmpIre/netmon
<?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/DnsRessourceRecordList.class.php';
if (!isset($_GET['section']) and isset($_GET['dns_zone_id'])) {
    $dns_zone = new DnsZone((int) $_GET['dns_zone_id']);
    $dns_zone->fetch();
    $smarty->assign('dns_zone', $dns_zone);
    $dns_ressource_record_list = new DnsRessourceRecordList((int) $_GET['dns_zone_id']);
    $smarty->assign('dns_ressource_record_list', $dns_ressource_record_list->getDnsRessourceRecordList());
    $smarty->assign('message', Message::getMessage());
    $smarty->display("header.tpl.html");
    $smarty->display("dns_zone.tpl.html");
    $smarty->display("footer.tpl.html");
    //TODO Ressource record list of zone
} elseif ($_GET['section'] == 'insert_add') {
    if (Permission::checkPermission(PERM_USER)) {
        $dns_zone = new DnsZone(false, (int) $_SESSION['user_id'], $_POST['name'], $_POST['pri_dns'], $_POST['sec_dns'], (int) $_POST['serial'], (int) $_POST['refresh'], (int) $_POST['retry'], (int) $_POST['expire'], (int) $_POST['ttl']);
        if ($dns_zone->store()) {
            $message[] = array('Neue DNS-Zone ' . $_POST['name'] . ' wurde eingetragen.', 1);
        } else {
            $message[] = array('Neue DNS-Zone ' . $_POST['name'] . ' konnte nicht eingetragen werden.', 2);
        }
        Message::setMessage($message);
        header('Location: ./dns_zone.php');
    } else {
        Permission::denyAccess(PERM_USER);
    }
} elseif ($_GET['section'] == 'delete') {