Exemplo n.º 1
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);
Exemplo n.º 2
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;
}
Exemplo n.º 3
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;
 }
Exemplo n.º 4
0
 $gzone = $zone;
 $zone = hostToIdn($zone);
 if ($method != 'list') {
     $temp = tempnam($conf->tmp_path, "{$zone}");
     $fh = fopen($temp, "w");
     fwrite($fh, implode("\n", $content));
     fclose($fh);
     $check = checkZoneFile($temp, $zone);
     unlink($temp);
     if (!$check) {
         problem("nocontent");
     }
 }
 $mz = new masterZone($gzone);
 $sz = new slaveZone($gzone);
 if ($mz->loadZoneHead() || $sz->loadZoneHead()) {
     $mz = array();
     $sz = array();
     problem("existzone");
 }
 $smarty->assign("zone", $gzone);
 $nz = new masterZone();
 if ($nz->parseZone($content, $zone, $user->getId()) && $nz->getId() > 0) {
     $smarty->assign("pagetitle", "Review imported records");
     $smarty->assign("template", "uploadreview.tpl");
     $smarty->assign("output", explode("\n", $nz->getConf($conf->hostMaster)));
     $smarty->assign("help", help("uploadreview"));
     $smarty->assign("menu_button", menu_buttons());
 } else {
     $smarty->assign("problem", explode("\n", $nz->getErr()));
     $smarty->assign("pagetitle", "Import error");
Exemplo n.º 5
0
     $masterlist = array();
     foreach ($masters as $id) {
         $temp = new masterZone(intval($id));
         $temp->loadZoneHead();
         $head = $temp->getZoneHead();
         $temp = array();
         foreach (array('id', 'name', 'serial') as $key) {
             $temp[$key] = $head[$key];
         }
         $masterlist[] = $temp;
     }
     $slaves = $xuser->getSlaves('live');
     $slavelist = array();
     foreach ($slaves as $id) {
         $temp = new slaveZone(intval($id));
         $temp->loadZoneHead();
         $head = $temp->getZoneHead();
         $temp = array();
         foreach (array('id', 'name', 'master') as $key) {
             $temp[$key] = $head[$key];
         }
         $slavelist[] = $temp;
         $temp = array();
     }
     $smarty->assign("zonelist", $masterlist);
     $smarty->assign("szonelist", $slavelist);
     $smarty->assign("template", "userread.tpl");
     $smarty->assign("help", help("userread"));
     $smarty->assign("menu_button", menu_buttons());
     $smarty->display("main.tpl");
 } else {
Exemplo n.º 6
0
        $errors .= "<u>" . $hd['name'] . ":</u> Error in committing\n" . $err . '\\n\\n';
    } else {
        $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);
Exemplo n.º 7
0
<?php

require_once "include.php";
if ($user->isAdmin()) {
    $arr = array();
    foreach (array('name', 'master', 'owner') as $key) {
        $arr[$key] = $_POST[$key];
    }
    $nz = new slaveZone($arr);
    if (!$nz->loadZoneHead()) {
        $nz->setZoneHead($arr);
        $nz->saveZoneHead();
        $user->loadUserZones();
    } else {
        problem("existzone");
    }
} else {
    access_denied();
}