function named() { $url = $this->cnml_host . "/guifi/cnml/" . $this->service_id . "/domains"; $cnml = ''; $h = fopen($url, "r") or die(date("YmdHi") . " xUnable to fetch CNML.\n"); while (!feof($h)) { $cnml .= fgets($h) or die(date("YmdHi") . " xUnable to read CNML.\n"); } fclose($h); $check = check_cnml($cnml); if ($check) { $xml = new SimpleXMLElement($cnml); $dns = new BIND($this->master_dir, $this->slave_dir, $this->chroot); $dns->named(); foreach ($xml->domains as $domains) { foreach ($domains->internal as $zones) { $op = "\tmatch-clients { 127.0.0.1; 192.168.0.0/16; 10.0.0.0/8; 172.16.0.0/12; };\n\trecursion yes;\n\tinclude \"" . $this->master_dir . "/named.conf.int.private\";"; $this->view("", $op, $zones, $dns); } foreach ($domains->external as $zones) { $op = "\tmatch-clients { any; };\n\trecursion no;\n\tinclude \"" . $this->master_dir . "/named.conf.ext.private\";"; $this->view("internet", $op, $zones, $dns); } } } else { echo date("YmdHi") . " Invalid CNML! cannot update! check master cnml server url on /etc/dnservices/config.php\nor check your Internent/Guifi.net connection.\n named.conf not changed! \n"; exit; } }