Beispiel #1
0
function getorphan()
{
    global $conf;
    global $user;
    $files = ' ' . implode(' ', scandir($conf->Path)) . ' ';
    $mzones = $user->getMasters();
    $szones = $user->getSlaves();
    foreach ($mzones as $id) {
        $z = new masterZone(intval($id));
        $z->loadZoneHead();
        $zone = $z->getZoneHeadRaw();
        $files = str_replace(' ' . $zone['name'] . ' ', ' ', $files);
    }
    foreach ($szones as $id) {
        $z = new slaveZone(intval($id));
        $z->loadZoneHead();
        $zone = $z->getZoneHeadRaw();
        $files = str_replace(' ' . $zone['name'] . ' ', ' ', $files);
    }
    $vzf = array();
    foreach (explode(' ', trim($files)) as $entry) {
        if (is_file($conf->Path . $entry) && preg_replace('/\\.(signed|private|key|krf|jnl|bind)$/', '', $entry) == $entry) {
            if (checkZoneFile($conf->Path . $entry, $entry)) {
                $vzf[] = hostToIdn($entry);
            }
        }
    }
    return $vzf;
}
Beispiel #2
0
 public function getSlaves($type = 'all')
 {
     $out = array();
     if ($type == 'live') {
         foreach ($this->szones as $zoneid) {
             $zone = new slaveZone(array('id' => intval($zoneid)));
             $zone->loadZoneHead();
             $head = $zone->getZoneHeadRaw();
             if ($head['updated'] != 'del') {
                 $out[] = intval($zoneid);
             }
         }
     } else {
         $out = $this->szones;
     }
     return $out;
 }
Beispiel #3
0
<?php

require_once "include.php";
$param = intval($_GET['i']);
if ($param > 0) {
    if ($user->isOwned($param, 'slave')) {
        $smarty->assign("pagetitle", "Dump slave zone");
        $zone = new slaveZone(array('id' => $_GET['i']));
        $zone->loadZoneHead();
        $zonedef = '';
        $head = $zone->getZoneHead();
        $headraw = $zone->getZoneHeadRaw();
        $name = $head['name'];
        $zonetype = "slave zone ";
        $ownerid = $head['owner'];
        $ouser = new User(array('id' => $ownerid));
        $owner = $ouser->getFullName();
        if (isset($_GET['pre']) && $_GET['pre'] == 'y') {
            $zonedef = $zone->dumpZone($conf->dig);
            $zonetype .= "(AXFR dump from it's master)";
        } else {
            $zonetype .= "(locally mirrored)";
            $lines = file($conf->path . $headraw['name']);
            $zonedef = '';
            foreach ($lines as $line) {
                $zonedef .= $line;
            }
        }
        $smarty->assign("zonename", $name);
        $smarty->assign("zonetype", $zonetype);
        $smarty->assign("owner", $owner);
Beispiel #4
0
        $mcomm .= "<u>" . $hd['name'] . "</u>: Committing success.\n" . $cmz->getMsg() . "\n";
        $bind->addConfig($hdr['name'], $zarray);
        $done++;
    }
}
$error .= $errors > '' ? $comm . $errors : '';
$commited .= $mcomm > '' ? $comm . $mcomm : '';
$errors = '';
$comm = count($cslave) > 0 ? "<strong>" . "Committing slave records" . "</strong>\n\n" : '';
$commited .= $comm > '' ? "\n" : '';
$scomm = '';
foreach ($cslave as $slave) {
    $csz = new slaveZone(intval($slave['id']));
    $csz->loadZoneHead();
    $hd = $csz->getZoneHead();
    $hdr = $csz->getZoneHeadRaw();
    $err = $csz->getErr();
    if ($err > '') {
        $errors .= "<u>" . $hd['name'] . ":</u> Error in committing\n" . $err . '\\n\\n';
    } else {
        $csz->doCommit();
        $scomm .= "<u>" . $hd['name'] . "</u>: Committing success.\n\n";
        $bind->addConfig($hdr['name'], array('type' => 'slave', 'masters' => $hdr['master'], 'file' => $hdr['name']));
        $done++;
    }
}
$error .= $errors > '' ? $comm . $errors : '';
$commited .= $scomm > '' ? $comm . $scomm : '';
$bind->saveConfig($conf->conf);
if ($done > 0) {
    $cmd = $conf->rndc . " reload 2> /dev/stdout";