Ejemplo n.º 1
0
             }
         }
     } else {
         if ($group !== "admin") {
             $sql = "SELECT * FROM `conf_subnets` WHERE `group` = \"" . $group . "\"";
         } else {
             $sql = "SELECT * FROM `conf_subnets` ORDER BY `subnet-name` ASC";
         }
         if (($s = $db->dbQuery($val->ValidateSQL($sql, $dbconn), $dbconn)) !== -1) {
             $subnetlist_remainder = $db->dbArrayResultsAssoc($s);
             // );
         }
     }
 }
 if (count($subnet_name) > 0) {
     $subnet_name = $misc->GenDropMenuWSelectedSubnets($subnetlist_remainder, $subnet_name, 'subnet_name');
 } else {
     $subnet_name = "No Subnets defined";
 }
 // populate our pxe group list
 if ($group === "admin") {
     $px = "SELECT `pxe-group-name` FROM `conf_pxe_groups` ORDER BY `pxe-group-name` ASC";
 } else {
     $px = "SELECT `pxe-group-name` FROM `conf_pxe_groups` WHERE `group` = \"" . $group . "\" OR `group` = '' ORDER BY `pxe-group-name` ASC";
 }
 if (($return = $db->dbQuery($val->ValidateSQL($px, $dbconn), $dbconn)) !== -1) {
     $pxeg = $db->dbArrayResultsAssoc($return);
 }
 if (count($pxeg) === 0) {
     $pxe_group = "No PXE Groups defined";
 } else {
 // find the duplicate record so the user can edit it
 $find = "SELECT * FROM `conf_hosts` WHERE `hostname` = \"" . $tmp[$x]['hostname'] . "\" OR `mac-address` = \"" . $tmp[$x]['mac_address'] . "\" OR `ip-address` = \"" . $tmp[$x]['mac_address'] . "\" LIMIT 1";
 if (($value = $db->dbQuery($val->ValidateSQL($find, $dbconn), $dbconn)) === -1) {
     $error = $err->GenerateErrorLink("help/help.html", "#import_host", $defined['error'], "An error occured when attempting to lookup the duplicate record in which '" . $tmp[$x]['hostname'] . "' conflicts with.", NULL, NULL);
 } else {
     $found = $db->dbArrayResultsAssoc($value);
 }
 // populate our subnets list for our imported record
 $sub = "SELECT `subnet-name` FROM `conf_subnets` ORDER BY `subnet-name` ASC";
 if (($return = $db->dbQuery($val->ValidateSQL($sub, $dbconn), $dbconn)) !== -1) {
     $subs = $db->dbArrayResultsAssoc($return);
 }
 if (count($subs) === 0) {
     $subnet = "No subnets defined";
 } else {
     $subnet = $misc->GenDropMenuWSelectedSubnets($subs, $tmp[$x]['subnet'], 'subnet_tmp');
     // quick check to ensure subnet from import matches existing subnet group
     if (!in_array($tmp[$x]['subnet'], $subs) && !empty($tmp[$x]['subnet'])) {
         $subnet_err[$x] = $err->GenerateErrorImg($defined['error'], "help/help.html#import_host", '800', '800');
         $list .= "<li>Subnet field from import does match current list of existing subnet groups</li>";
     }
 }
 // populate our pxe group list
 $px = "SELECT `pxe-group-name` FROM `conf_pxe_groups` ORDER BY `pxe-group-name` ASC";
 if (($return = $db->dbQuery($val->ValidateSQL($px, $dbconn), $dbconn)) !== -1) {
     $pxeg = $db->dbArrayResultsAssoc($return);
 }
 if (count($pxeg) === 0) {
     $pxe_group = "No PXE Groups defined";
 } else {
     $pxe_group = $misc->GenDropMenuWSelectedPXE($pxeg, $tmp[$x]['pxe_group'], 'pxe_group_tmp');
Ejemplo n.º 3
0
 } else {
     $pxequery = "SELECT * FROM `conf_pxe_groups` WHERE `group` = \"" . $group . "\" ORDER BY `pxe-group-name` ASC";
 }
 if (($current = $db->dbQuery($val->ValidateSQL($pxequery, $dbconn), $dbconn)) !== -1) {
     $pxelist = $db->dbArrayResultsAssoc($current);
 }
 $pxe_groups = $misc->GenJumpMenuBoxPXE($pxelist, 'pxe_groups', $_GET['skin']);
 // populate our subnets list
 $sub = "SELECT `subnet-name` FROM `conf_subnets` ORDER BY `subnet-name` ASC";
 if (($return = $db->dbQuery($val->ValidateSQL($sub, $dbconn), $dbconn)) !== -1) {
     $subs = $db->dbArrayResultsAssoc($return);
 }
 if (count($subs) === 0) {
     $assign_subnet = "No subnets defined";
 } else {
     $assign_subnet = $misc->GenDropMenuWSelectedSubnets($subs, $assign_subnet, 'assign_subnet');
 }
 /* create checkbox list of available groups */
 $groupsquery = "SELECT * FROM `auth_groups` WHERE `group` != \"admin\" AND `group` != \"" . $group . "\" ORDER BY `group` ASC";
 if (($res = $db->dbQuery($val->ValidateSQL($groupsquery, $dbconn), $dbconn)) !== -1) {
     $groups = $db->dbArrayResultsAssoc($res);
     $groups = $misc->EliminiateDuplicates($groups);
     if (count($groups) !== 0) {
         // figure out which boxes are currently enabled
         if (!empty($_GET['id'])) {
             $sql = "SELECT * FROM `auth_groups_perms` WHERE `resource` = \"" . $subnet_name . "\"";
             if (($sql_res = $db->dbQuery($val->ValidateSQL($sql, $dbconn), $dbconn)) !== -1) {
                 $select_groups = $db->dbArrayResultsAssoc($sql_res);
             }
         }
         $select_groups = $misc->GenGroupsCheckBoxes($groups, 'select_groups', $_GET['skin'], $select_groups, $group);