} } $lst["{$col}"] = $row["custdescrip"]; } insert($f, selectbox($lst, array("name" => "cust1[]", "multiple size" => 5), $cust)); insert($f, textbrbr(my_("Customer/autonomous system 2 - 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 (!$ds->TestGrpsAdmin($grps)) { if (!in_array($row["admingrp"], $grps)) { continue; } } } $col = $row["customer"]; $lst["{$col}"] = $row["custdescrip"]; } insert($f, selectbox($lst, array("name" => "cust2[]", "multiple size" => 5))); insert($f, generic("br")); insert($f, submit(array("value" => my_("Submit")))); insert($f, freset(array("value" => my_("Clear")))); $result->Close(); printhtml($p);
// 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; } } }
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")); } }