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; }
$smarty->assign("method", "Write zone manually or pasted from clipboard"); break; default: problem(); } if (count($content) < 4) { problem("nocontent"); } $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) {