if ($User->settings->enableSNMP == "1") { print "<td>"; // not set if ($device['snmp_version'] == 0 || strlen($device['snmp_version']) == 0) { print "<span class='text-muted'>" . _("Disabled") . "</span>"; } else { print _("Version") . ": {$device['snmp_version']}<br>"; print _("Community") . ": {$device['snmp_community']}<br>"; } print "</td>"; } // rack if ($User->settings->enableRACK == "1") { print "<td>"; # rack $rack = $Racks->fetch_rack_details($device['rack']); if ($rack !== false) { print "<a href='" . create_link("administration", "racks", $rack->id) . "'>" . $rack->name . "</a><br>"; print "<span class='badge badge1 badge5'>" . _('Position') . ": {$device['rack_start']}, " . _("Size") . ": {$device['rack_size']} U</span>"; } print "</td>"; } //sections print ' <td class="sections">'; $temp = explode(";", $device['sections']); if (sizeof($temp) > 0 && !empty($temp[0])) { foreach ($temp as $line) { $section = $Sections->fetch_section(null, $line); if (!empty($section)) { print '<div class="switchSections text-muted">' . $section->name . '</div>' . "\n"; }
} # Hostname must be present if ($rack['name'] == "") { $Result->show("danger", _('Name is mandatory') . '!', true); } # rack checks # validate position and size if (!is_numeric($rack['size'])) { $Result->show("danger", _('Invalid rack size') . '!', true); } # validate rack if ($rack['action'] == "edit") { if (!is_numeric($rack['rackid'])) { $Result->show("danger", _('Invalid rack identifier') . '!', true); } $rack_details = $Racks->fetch_rack_details($rack['rackid']); if ($rack_details === false) { $Result->show("danger", _('Rack does not exist') . '!', true); } } elseif ($rack['action'] == "delete") { if (!is_numeric($rack['rackid'])) { $Result->show("danger", _('Invalid rack identifier') . '!', true); } } # fetch custom fields $custom = $Tools->fetch_custom_fields('racks'); if (sizeof($custom) > 0) { foreach ($custom as $myField) { //booleans can be only 0 and 1! if ($myField['type'] == "tinyint(1)") { if ($rack[$myField['name']] > 1) {
$User->check_user_session(); # set admin $admin = $User->is_admin(false); # check that rack support isenabled if ($User->settings->enableRACK != "1") { $Result->show("danger", _("RACK management disabled."), false); } else { # validate integer if (!is_numeric($_GET['subnetId'])) { header("Location: " . create_link($_GET['page'], "racks")); $error = _("Invalid rack Id"); } # init racks object $Racks = new phpipam_rack($Database); # fetch all racks $rack = $Racks->fetch_rack_details($_GET['subnetId']); $rack_devices = $Racks->fetch_rack_devices($_GET['subnetId']); // rack check if ($rack === false) { header("Location: " . create_link($_GET['page'], "racks")); $error = _("Invalid rack Id"); } // get custom fields $cfields = $Tools->fetch_custom_fields('racks'); } # if error set print it, otherwise print rack if (isset($error)) { ?> <h4><?php print _('RACK details'); ?>
$Racks = new phpipam_rack($Database); $Result = new Result(); # verify that user is logged in $User->check_user_session(); # check that rack support isenabled if ($User->settings->enableRACK != "1") { $Result->show("danger", _("RACK management disabled."), true, true, false, true); } else { # validate integer if (!is_numeric($_POST['rackid'])) { $error = _("Invalid rack Id"); } # init racks object $Racks = new phpipam_rack($Database); # fetch all racks $rack = $Racks->fetch_rack_details($_POST['rackid']); $rack_devices = $Racks->fetch_rack_devices($_POST['rackid']); // rack check if ($rack === false) { $error = _("Invalid rack Id"); } } ?> <div class="pHeader"><?php print _("Rack details"); ?> </div> <div class="pContent text-center">