Ejemplo n.º 1
0
insert($t, $c = cell());
insert($c, text(my_("Min. TTL")));
insert($t, $c = cell());
insert($c, textbr(my_("Last modified")));
insert($c, text(my_("Last exported")));
insert($t, $c = cell());
insert($c, text(my_("Changed by")));
insert($t, $ck = cell());
insert($ck, text(my_("Action")));
// capture data for the export view functionality
$export = new exportForm();
$export->addRow(array("domain", "primary_DNS", "secondary_DNS", "serial_date", "ttl", "refresh", "retry", "expire", "minimum_ttl", "last_modified", "last_exported", "changed_by"));
$export->saveRow();
$cnt = 0;
while ($row = $result->FetchRow()) {
    setdefault("cell", array("class" => color_flip_flop()));
    $export->addRow(NULL);
    insert($t, $c = cell());
    // have zone records been modified
    if ($row["error_message"] == "E") {
        insert($c, textb($row["domain"]));
        insert($c, block(" ‡"));
    } else {
        insert($c, text($row["domain"]));
    }
    if ($row["slaveonly"] == "Y") {
        insert($c, span(my_("Slave zone"), array("class" => "textSmall")));
        $export->addCell($row["domain"] . my_(" (Slave zone)"));
    } else {
        $export->addCell($row["domain"]);
    }
Ejemplo n.º 2
0
function searchOverlap($ds, &$w, $cust1, $cust2)
{
    global $block;
    // dont trust variables
    $cust1 = floor($cust1);
    $cust2 = floor($cust2);
    $custdescrip1 = $ds->GetCustomerDescrip($cust1);
    $custdescrip2 = $ds->GetCustomerDescrip($cust2);
    // this query is not quick as indexes cannot be used!!!
    // must have first baseaddr called baseaddr else block pager
    // will not work - may break databases other than mysql
    $result =& $ds->ds->Execute("SELECT t1.baseaddr AS baseaddr,\n                           t1.baseindex AS baseindex1,\n                           t1.subnetsize AS subnetsize1,\n                           t1.descrip AS descrip1,\n                           t2.baseaddr AS baseaddr2,\n                           t2.baseindex AS baseindex2,\n                           t2.subnetsize AS subnetsize2,\n                           t2.descrip AS descrip2\n                        FROM base t1, base t2\n                        WHERE ((t1.baseaddr BETWEEN t2.baseaddr AND\n                                t2.baseaddr+t2.subnetsize-1) OR\n                               (t1.baseaddr+t1.subnetsize-1\n                                BETWEEN t2.baseaddr AND\n                                        t2.baseaddr+t2.subnetsize-1) OR\n                               (t1.baseaddr < t2.baseaddr AND\n                                t1.baseaddr+t1.subnetsize >\n                                t2.baseaddr+t2.subnetsize)) AND\n                               t1.customer={$cust1} AND\n                                t2.customer={$cust2}\n                        ORDER BY t1.baseaddr");
    $totcnt = 0;
    $vars = "";
    // fastforward till first record if not first block of data
    while ($block and $totcnt < $block * MAXTABLESIZE and $row = $result->FetchRow()) {
        $vars = DisplayBlock($w, $row, $totcnt, "&cust1[]=" . $cust1 . "&cust2[]=" . $cust2);
        $totcnt++;
    }
    insert($w, block("<p>"));
    $cnt = 0;
    while ($row = $result->FetchRow()) {
        // draw heading only if there are records to display
        if ($cnt == 0) {
            // create a table
            insert($w, $t = table(array("cols" => "8", "class" => "outputtable")));
            // draw heading
            setdefault("cell", array("class" => "heading"));
            insert($t, $c = cell(array("colspan" => "4")));
            insert($c, block("<center>"));
            insert($c, text($custdescrip1));
            insert($c, block("</center>"));
            insert($t, $c = cell(array("colspan" => "4")));
            insert($c, block("<center>"));
            insert($c, text($custdescrip2));
            insert($c, block("</center>"));
            insert($t, $c = cell());
            if (!empty($vars)) {
                insert($c, anchor($vars, "<<"));
            }
            insert($c, text(my_("Base address")));
            insert($t, $c = cell());
            insert($c, text(my_("Subnet size")));
            insert($t, $c = cell());
            insert($c, text(my_("Subnet mask")));
            insert($t, $c = cell());
            insert($c, text(my_("Description")));
            insert($t, $c = cell());
            insert($c, text(my_("Base address")));
            insert($t, $c = cell());
            insert($c, text(my_("Subnet size")));
            insert($t, $c = cell());
            insert($c, text(my_("Subnet mask")));
            insert($t, $ck = cell());
            insert($ck, text(my_("Description")));
            setdefault("cell", array("class" => color_flip_flop()));
        }
        // customer 1
        if ($row["subnetsize1"] == 1) {
            insert($t, $c = cell());
            insert($c, text(inet_ntoa($row["baseaddr"])));
        } else {
            insert($t, $c = cell());
            insert($c, anchor("displaysubnet.php?baseindex=" . $row["baseindex1"], inet_ntoa($row["baseaddr"])));
        }
        if ($row["subnetsize1"] == 1) {
            insert($t, $c = cell());
            insert($c, text("Host"));
        } else {
            insert($t, $c = cell());
            insert($c, text($row["subnetsize1"]));
        }
        insert($t, $c = cell());
        insert($c, text(inet_ntoa(inet_aton(ALLNETS) + 1 - $row["subnetsize1"]) . "/" . inet_bits($row["subnetsize1"])));
        insert($t, $c = cell());
        insert($c, text($row["descrip1"]));
        // customer 2
        if ($row["subnetsize2"] == 1) {
            insert($t, $c = cell());
            insert($c, text(inet_ntoa($row["baseaddr2"])));
        } else {
            insert($t, $c = cell());
            insert($c, anchor("displaysubnet.php?baseindex=" . $row["baseindex2"], inet_ntoa($row["baseaddr2"])));
        }
        if ($row["subnetsize2"] == 1) {
            insert($t, $c = cell());
            insert($c, text(my_("Host")));
        } else {
            insert($t, $c = cell());
            insert($c, text($row["subnetsize2"]));
        }
        insert($t, $c = cell());
        insert($c, text(inet_ntoa(inet_aton(ALLNETS) + 1 - $row["subnetsize2"]) . "/" . inet_bits($row["subnetsize2"])));
        insert($t, $c = cell());
        insert($c, text($row["descrip2"]));
        if ($totcnt % MAXTABLESIZE == MAXTABLESIZE - 1) {
            break;
        }
        $cnt++;
        $totcnt++;
    }
    insert($w, block("<p>"));
    if ($cnt) {
        $vars = "";
        $printed = 0;
        while ($row = $result->FetchRow()) {
            $totcnt++;
            $vars = DisplayBlock($w, $row, $totcnt, "&cust1[]=" . $cust1 . "&cust2[]=" . $cust2);
            if (!empty($vars) and !$printed) {
                insert($ck, anchor($vars, ">>"));
                $printed = 1;
            }
        }
    }
}