示例#1
0
//setdefault("window",array("bgcolor"=>"white"));
//setdefault("table",array("cellpadding"=>"0"));
//setdefault("text",array("size"=>"2"));
$title = my_("Export DHCP subnet details");
newhtml($p);
$w = myheading($p, $title, true);
// save the last customer used
// must set path else Netscape gets confused!
setcookie("ipplanCustomer", "{$cust}", time() + 10000000, "/");
// basic sequence is connect, search, interpret search
// result, close connection
// explicitly cast variables as security measure against SQL injection
list($cust) = myRegister("I:cust");
$ds = new IPplanDbf() or die(my_("Could not connect to database"));
// check if user belongs to customer admin group
$result = $ds->GetCustomerGrp($cust);
// can only be one row - does not matter if nothing is
// found as array search will return false
$row = $result->FetchRow();
if (!in_array($row["admingrp"], $grps)) {
    myError($w, $p, my_("You may not export DHCP subnets as you are not a member of the customers admin group"));
}
$startnum = inet_aton(DEFAULTROUTE);
$endnum = inet_aton(ALLNETS);
// if a specific network template exists, use that, else use generic template
$template = new IPplanIPTemplate("basetemplate-dhcp", $cust);
$err = $template->is_error();
// error with template here is fatal
if ($err) {
    myError($w, $p, my_("Error reading template!"));
}
示例#2
0
//setdefault("text",array("size"=>"2"));
$title = my_("Display overlapping address space between customers/autonomous systems");
newhtml($p);
$w = myheading($p, $title, true);
// explicitly cast variables as security measure against SQL injection
list($cust) = myRegister("I:cust");
// display opening text
insert($w, textbr());
insert($w, text("{$title}."));
insert($w, block("<p>"));
insert($w, span(my_("This function consumes large amounts of memory on the server. If you get server errors, blank pages or nothing happens when you submit, you may need to reduce the range of your search or you may need to increase the amount of memory allocated to PHP on the server."), array("class" => "textError")));
$ds = new IPplanDbf() or myError($w, $p, my_("Could not connect to database"));
// start form
insert($w, $f = form(array("method" => "get", "action" => "displayoverlap.php")));
insert($f, textbrbr(my_("Customer/autonomous system 1 - select multiple")));
$result = $ds->GetCustomerGrp(0);
$lst = array();
while ($row = $result->FetchRow()) {
    if (strtolower($row["custdescrip"]) == "all") {
        continue;
    }
    // strip out customers user may not see due to not being member
    // of customers admin group. $grps array could be empty if anonymous
    // access is allowed!
    if (!empty($grps)) {
        if (!in_array($row["admingrp"], $grps)) {
            continue;
        }
    }
    $col = $row["customer"];
    // make customer first customer in database
示例#3
0
insert($w, script("", array("language" => "JavaScript", "type" => "text/javascript", "src" => $myWwwPath . 'libjs/layerstreemenu-cookies.js')));
// display opening text
insert($w, heading(3, my_("Display subnets.")));
insert($w, text(my_("Click on customer/AS to display all associated subnets, click on the area to display all subnets in area and contained ranges, click on a range to display only subnets associated with that range. Subnets not within an area or range can be viewed by selecting the customer/AS.")));
insert($w, block("<p><hr>"));
insert($w, $t = table(array("cols" => "1", "width" => "100%", "border" => "1", "cellspacing" => "2", "frame" => "void", "rules" => "ALL", "cellpadding" => "5")));
insert($t, $leftmenu = cell(array("align" => "left", "width" => "100%", "valign" => "top")));
//read the database and create the strings containing the menus
$ds = new IPplanDbf() or myError($w, $p, my_("Could not connect to database"));
@set_time_limit(90);
// default is collapsed, change to "1" for expanded tree
// value is stored in a cookie so clear cookies to see effect
$expanded = "";
$displayall = FALSE;
$menustring = "";
if ($custresult = $ds->GetCustomerGrp(0)) {
    $adminuser = $ds->TestGrpsAdmin($grps);
    //customer
    while ($custrow = $custresult->Fetchrow()) {
        // remove all from list if global searching is not available
        if (!$displayall and strtolower($custrow["custdescrip"]) == "all") {
            continue;
        }
        // strip out customers user may not see due to not being member
        // of customers admin group.
        if (!$adminuser) {
            if (!empty($grps)) {
                if (!in_array($custrow["admingrp"], $grps)) {
                    continue;
                }
            }
示例#4
0
function __FetchCustomer()
{
    global $xmlrpcerruser;
    // import user errcode value
    global $grps;
    // $params is an Array of xmlrpcval objects
    $errstr = "";
    $err = 0;
    if (IPPLAN_API_VER != DBF_API_VER) {
        return new xmlrpcresp(0, $xmlrpcerruser + 3, "Incorrect API version");
    }
    if (!($ds = new IPplanDbf())) {
        return new xmlrpcresp(0, $xmlrpcerruser + 1, "Could not connect to database");
    }
    // nothing to display, just exit
    if (!($result = $ds->GetCustomerGrp(0))) {
        return new xmlrpcresp(0, $xmlrpcerruser + 1, "No customers");
    }
    // do this here else will do extra queries for every customer
    $adminuser = $ds->TestGrpsAdmin($grps);
    while ($row = $result->FetchRow()) {
        // ugly kludge with global variable!
        // remove all from list if global searching is not available
        if (!$displayall and strtolower($row["custdescrip"]) == "all") {
            continue;
        }
        // strip out customers user may not see due to not being member
        // of customers admin group. $grps array could be empty if anonymous
        // access is allowed!
        if (!$adminuser) {
            if (!empty($grps)) {
                if (!in_array($row["admingrp"], $grps)) {
                    continue;
                }
            }
        }
        $myVal[] = new xmlrpcval(array("customer" => new xmlrpcval($row["customer"], "int"), "custdescrip" => new xmlrpcval($row["custdescrip"])), "struct");
    }
    if ($err) {
        // this is an error condition
        return new xmlrpcresp(0, $xmlrpcerruser + 1, $errstr);
    } else {
        // this is a successful value being returned
        return new xmlrpcresp(new xmlrpcval($myVal, "array"));
    }
}