<?php /** * Script to print subnets ***************************/ /* verify that user is authenticated! */ isUserAuthenticated(); /* get custom fields */ $custom = getCustomSubnetFields(); /* get all site settings */ $settings = getAllSettings(); # title print "<h4>" . _('Available subnets') . "</h4>"; # check permission $permission = checkSectionPermission($_REQUEST['section']); if ($permission != "0") { # print table structure print "<table id='manageSubnets' class='table table-striped table-condensed table-top table-absolute'>"; # set colcount if ($settings['enableVRF'] == 1) { $colCount = 8; } else { $colCount = 7; } # get all subnets in section $subnets = fetchSubnets($_REQUEST['section']); # remove custom fields if all empty! */ foreach ($custom as $field) { $sizeMyFields[$field['name']] = 0; // default value # check against each IP address
<?php /* * Print edit folder *********************/ /* required functions */ require_once '../../functions/functions.php'; /* verify that user is logged in */ isUserAuthenticated(false); /* verify that user has permissions if add */ if ($_POST['action'] == "add") { $sectionPerm = checkSectionPermission($_POST['sectionId']); if ($sectionPerm != 3) { die("<div class='pHeader'>" . _('Error') . "</div><div class='pContent'><div class='alert alert-danger'>" . _('You do not have permissions to add new folder in this section') . "!</div></div><div class='pFooter'><button class='btn btn-sm btn-default hidePopups'>" . _('Close') . "</button>"); } } else { $subnetPerm = checkSubnetPermission($_POST['subnetId']); if ($subnetPerm != 3) { die("<div class='pHeader'>" . _('Error') . "</div><div class='pContent'><div class='alert alert-danger'>" . _('You do not have permissions to add edit/delete this folder') . "!</div></div><div class='pFooter'><button class='btn btn-sm btn-default hidePopups'>" . _('Close') . "</button>"); } } /* verify post */ CheckReferrer(); /* get all site settings */ $settings = getAllSettings(); # we are editing or deleting existing subnet, get old details if ($_POST['action'] != "add") { $subnetDataOld = getSubnetDetailsById($_POST['subnetId']); } else { # for selecting master subnet if added from subnet details! if (strlen($_REQUEST['subnetId']) > 0) {
<table class="nav"> <tr> <td> <!-- hide when too small --> <div class="nav-collapse"> <!-- sections --> <ul class="nav nav-tabs sections"> <?php # if section is not set if (!isset($_REQUEST['section'])) { $_REQUEST['section'] = ""; } foreach ($sections as $section) { # check permissions for user $perm = checkSectionPermission($section['id']); if ($perm > 0) { if ($section['name'] == $_REQUEST['section'] || $section['id'] == $_REQUEST['section']) { print "<li class='active'>"; } else { print "<li>"; } print "\t<a href='subnets/{$section['id']}/' rel='tooltip' data-placement='bottom' title='" . _('Show all subnets in section') . " {$section['name']}'>{$section['name']}</a>"; print "</li>"; } } ?> </ul> </div> </td>
} /* print VRFs */ if ($settings['enableVRF'] == 1 && $sectionName['showVRF'] == 1) { $vrfs = getAllVrfsInSection($sectionId); # if some is present if ($vrfs) { print "<div class='subnets'>"; # title print "<hr><h4>" . _('Available VRFs') . "</h4><hr>"; # create and print menu $menuVRF = get_menu_vrf($vrfs, $sectionId); print $menuVRF; print "</div>"; } } } # add new subnet $sectionPermission = checkSectionPermission($sectionId); if ($sectionPermission == 3) { print "<div class='action'>"; if (isset($_REQUEST['subnetId'])) { print "\t<button class='btn btn-xs btn-default pull-left' id='hideSubnets' rel='tooltip' title='" . _('Hide subnet list') . "' data-placement='right'><i class='fa fa-gray fa-sm fa-chevron-left'></i></button>"; } print "\t<span>" . _('Add new'); print "\t<div class='btn-group'>"; print "\t <button id='add_subnet' class='btn btn-xs btn-default btn-success' rel='tooltip' data-container='body' data-placement='top' title='" . _('Add new subnet to') . " {$sectionName['name']}' data-subnetId='' data-sectionId='{$sectionName['id']}' data-action='add'><i class='fa fa-sm fa-plus'></i></button>"; print "\t <button id='add_folder' class='btn btn-xs btn-default btn-success' rel='tooltip' data-container='body' data-placement='top' title='" . _('Add new folder to') . " {$sectionName['name']}' data-subnetId='' data-sectionId='{$sectionName['id']}' data-action='add'><i class='fa fa-sm fa-folder'></i></button>"; print "\t</div>"; print "\t</span>"; print "</div>"; }
# get IP address details $ip = getIpAddrDetailsById($_GET['ipaddrid']); $subnet = getSubnetDetailsById($_GET['subnetId']); $section = getSectionDetailsById($_GET['section']); # get all selected fields for IP print $setFieldsTemp = getSelectedIPaddrFields(); // format them to array! $setFields = explode(";", $setFieldsTemp); # get all custom fields $myFields = getCustomFields('ipaddresses'); # set ping statuses $statuses = explode(";", $settings['pingStatus']); # permissions $permission = checkSubnetPermission($_GET['subnetId']); # section permissions $permissionsSection = checkSectionPermission($_GET['section']); # if 0 die if ($permission == "0") { die("<div class='alert alert-danger'>" . _('You do not have permission to access this network') . "!</div>"); } # reformat empty fields foreach ($ip as $k => $i) { if (strlen($i) == 0) { $ip[$k] = "/"; } } #header print "<h4>" . _('IP address details') . "</h4><hr>"; # back print "<a class='btn btn-default btn-sm btn-default' href='" . create_link("subnets", $_GET['section'], $_GET['subnetId']) . "'><i class='fa fa-chevron-left'></i> " . _('Back to subnet') . "</a>"; # check if it exists, otherwise print error
# reset VLAN number! $SubnetDetails['VLAN'] = subnetGetVLANdetailsById($SubnetDetails['vlanId']); # get all site settings $settings = getAllSettings(); /** * Parse IP addresses * * We provide subnet and mask, all other is calculated based on it (subnet, broadcast,...) */ $SubnetParsed = parseIpAddress(transform2long($SubnetDetails['subnet']), $SubnetDetails['mask']); # set rowspan $rowSpan = 10 + $customSubnetFieldsSize; # permissions $permission = checkSubnetPermission($subnetId); # section permissions $permissionsSection = checkSectionPermission($SubnetDetails['sectionId']); # if 0 die if ($permission == "0") { die("<div class='alert alert-danger'>" . _('You do not have permission to access this network') . "!</div>"); } ?> <!-- content print! --> <!-- for adding IP address! --> <div class="row"> <div class="col-lg-8 col-md-8 col-sm-12 col-xs-12"> <!-- for adding IP address! --> <div id="subnetId" style="display:none"><?php print $subnetId;