コード例 #1
0
ファイル: edithost.php プロジェクト: sebastiendu/mmc
            new NotifyWidgetFailure($msg);
        }
    }
}
if ($_GET["action"] == "edithost") {
    $hostname = $_GET["host"];
    $hostname = str_replace('.' . $zone, '', $hostname);
    $data = getResourceRecord($zone, $hostname);
    if (empty($data)) {
        die("Record {$hostname} does not exist.");
    } else {
        if (isset($data[0][1]["aRecord"])) {
            $ipaddress = $data[0][1]["aRecord"][0];
            /* Lookup host alias */
            $cnames = array();
            foreach (getCNAMEs($zone, $hostname) as $dn => $cname) {
                if (in_array("associatedDomain", array_keys($cname[1]))) {
                    $cnames[] = str_replace('.' . $zone, '', $cname[1]["associatedDomain"][0]);
                } else {
                    $cnames[] = $cname[1]["relativeDomainName"][0];
                }
            }
        } else {
            die("Only A record edition is supported.");
        }
    }
}
$f = new ValidatingForm();
$f->push(new Table());
/* Prepare hostname input field content */
if ($_GET["action"] == "addhost") {
コード例 #2
0
ファイル: deletehost.php プロジェクト: pulse-project/pulse
    $zone = $_POST["zone"];
    delRecord($zone, $host);
    if (!isXMLRPCError()) {
        new NotifyWidgetSuccess(_T("The record has been deleted."));
    }
    header("Location: main.php?module=network&submod=network&action=zonemembers&zone={$zone}");
    exit;
} else {
    $host = urldecode($_GET["host"]);
    $zone = urldecode($_GET["zone"]);
    $rr = getResourceRecord($zone, $host);
    $f = new PopupForm(_T("Delete a DNS record"));
    $f->addText(sprintf(_T("You will delete the %s record"), "<strong>{$host}</strong>"));
    /* If the deleted record is a A record, CNAME may be linked to it */
    if (isset($rr[0][1]["aRecord"])) {
        $cnames = getCNAMEs($zone, $host);
        if (!empty($cnames)) {
            $msg = _T("The linked CNAME records will also be deleted:");
            foreach ($cnames as $cname) {
                $msg .= " <strong>" . $cname[1]["relativeDomainName"][0] . "</strong>";
            }
            $f->addText($msg);
        }
    }
    $hidden1 = new HiddenTpl("host");
    $hidden2 = new HiddenTpl("zone");
    $f->add($hidden1, array("value" => $host, "hide" => True));
    $f->add($hidden2, array("value" => $zone, "hide" => True));
    $f->addValidateButton("bconfirm");
    $f->addCancelButton("bback");
    $f->display();