/*** * Generate XLS file for VLANs *********************************/ # include required scripts require dirname(__FILE__) . '/../../../functions/functions.php'; require dirname(__FILE__) . '/../../../functions/PEAR/Spreadsheet/Excel/Writer.php'; # initialize required objects $Database = new Database_PDO(); $Result = new Result(); $User = new User($Database); $Admin = new Admin($Database); $Tools = new Tools($Database); # verify that user is logged in $User->check_user_session(); # fetch all l2 domains $vlan_domains = $Admin->fetch_all_objects("vlanDomains", "id"); # get all custom fields $custom_fields = $Tools->fetch_custom_fields('vlans'); # Create a workbook $today = date("Ymd"); $filename = $today . "_phpipam_VLAN_export.xls"; $workbook = new Spreadsheet_Excel_Writer(); //formatting headers $format_header =& $workbook->addFormat(); $format_header->setBold(); $format_header->setColor('black'); $format_header->setSize(12); $format_header->setAlign('left'); //formatting content $format_text =& $workbook->addFormat(); // Create a worksheet
require dirname(__FILE__) . '/../../../functions/functions.php'; # initialize user object $Database = new Database_PDO(); $User = new User($Database); $Admin = new Admin($Database); $Sections = new Sections($Database); $Subnets = new Subnets($Database); $Result = new Result(); # verify that user is logged in $User->check_user_session(); # ID must be numeric if (!is_numeric($_POST['subnetId'])) { $Result->show("danger", _("Invalid ID"), true, true); } # get all groups $groups = $Admin->fetch_all_objects("userGroups", "g_id"); # get subnet details $subnet = $Subnets->fetch_subnet(null, $_POST['subnetId']); ?> <script type="text/javascript"> $(document).ready(function() { /* bootstrap switch */ var switch_options = { onText: "Yes", offText: "No", onColor: 'default', offColor: 'default', size: "mini" };
require dirname(__FILE__) . '/../../../functions/functions.php'; # initialize user object $Database = new Database_PDO(); $User = new User($Database); $Admin = new Admin($Database); $Result = new Result(); # verify that user is logged in $User->check_user_session(); //strip AS if provided, to get just the number if (substr($_POST['as'], 0, 2) == "AS" || substr($_POST['as'], 0, 2) == "as") { $_POST['as'] = substr($_POST['as'], 2); } # fetch subnets form ripe $subnet = $Admin->ripe_fetch_subnets($_POST['as']); # fetch all sections $sections = $Admin->fetch_all_objects("sections", "id"); $vlans = $Admin->fetch_all_objects("vlans", "vlanId"); $vrfs = $Admin->fetch_all_objects("vrf", "vrfId"); //none found if (sizeof(@$subnet) == 0) { print "<hr>"; $Result->show("danger alert-absolute", _('No subnets found') . '!', true); } else { //form print '<form name="asImport" id="asImport">'; //table print '<table class="asImport table table-striped table-condensed table-top table-auto">'; //headers print '<tr>'; print ' <th colspan="5">' . _('I found the following routes belonging to AS') . ' ' . $_POST['as'] . ':</th>'; print '</tr> ';
$Sections = new Sections($Database); } if (!isset($Subnets)) { $Subnets = new Subnets($Database); } # verify that user is logged in, to guard against direct access of page and possible exploits $User->check_user_session(); # Get mask check #automated $cidrformat = isset($_GET['cidrformat']) ? $_GET['cidrformat'] : "off"; #separate option $rebuildmnr = isset($_GET['rebuildmnr']) ? $_GET['rebuildmnr'] : "off"; # read again the custom fields, if any if (!isset($custom_fields)) { $custom_fields = $Tools->fetch_custom_fields("subnets"); } # fetch all l2 domains $vlan_domains = $Admin->fetch_all_objects("vlanDomains", "id"); # load VLANs and process for easier later check $vlan_data = array(); foreach ($vlan_domains as $vlan_domain) { //cast $vlan_domain = (array) $vlan_domain; // read vlans $all_vlans = $Admin->fetch_multiple_objects("vlans", "domainId", $vlan_domain['id'], "number"); $all_vlans = (array) $all_vlans; // skip empty domains if (sizeof($all_vlans) == 0) { # create entry for domain check $vlan_data[$vlan_domain['name']] = array(); continue; } //write all VLAN entries
print $readonly; ?> > </td> </tr> <!-- Type --> <tr> <td><?php print _('Device type'); ?> </td> <td> <select name="type" class="form-control input-sm input-w-auto"> <?php $types = $Admin->fetch_all_objects("deviceTypes", "tid"); foreach ($types as $key => $name) { if ($device['type'] == $key) { print "<option value='{$key}' selected='selected'>{$name->tname}</option>"; } else { print "<option value='{$key}' >{$name->tname}</option>"; } } ?> </select> </td> </tr> <!-- Vendor --> <tr> <td><?php
$Admin = new Admin($Database); $Subnets = new Subnets($Database); $Tools = new Tools($Database); $Result = new Result(); # verify that user is logged in $User->check_user_session(); # create csrf token $csrf = $User->csrf_cookie("create", "user"); # strip tags - XSS $_POST = $User->strip_input_tags($_POST); # validate action $Admin->validate_action($_POST['action'], true); # fetch custom fields $custom = $Tools->fetch_custom_fields('users'); # fetch all languages $langs = $Admin->fetch_all_objects("lang", "l_id"); # fetch all auth types $auth_types = $Admin->fetch_all_objects("usersAuthMethod", "id"); # fetch all groups $groups = $Admin->fetch_all_objects("userGroups", "g_id"); # set header parameters and fetch user if ($_POST['action'] != "add") { $user = $Admin->fetch_object("users", "id", $_POST['id']); //false if ($user === false) { $Result->show("danger", _("Invalid ID"), true, true); } else { $user = (array) $user; } } else { $user = array();
/** * Generate XLS file for VRFs *********************************/ # include required scripts require dirname(__FILE__) . '/../../../functions/functions.php'; require dirname(__FILE__) . '/../../../functions/PEAR/Spreadsheet/Excel/Writer.php'; # initialize required objects $Database = new Database_PDO(); $Result = new Result(); $User = new User($Database); $Admin = new Admin($Database); # verify that user is logged in $User->check_user_session(); # fetch all vrfs $all_vrfs = $Admin->fetch_all_objects("vrf", "vrfId"); if (!$all_vrfs) { $all_vrfs = array(); } # Create a workbook $today = date("Ymd"); $filename = $today . "_phpipam_VRF_export.xls"; $workbook = new Spreadsheet_Excel_Writer(); //formatting headers $format_header =& $workbook->addFormat(); $format_header->setBold(); $format_header->setColor('black'); $format_header->setSize(12); $format_header->setAlign('left'); //formatting content $format_text =& $workbook->addFormat();
/** * Fetches nameserver sets to belong to section * * @access public * @param mixed $sectionId * @return void */ public function fetch_section_nameserver_sets($sectionId) { # first fetch all nameserver sets $Admin = new Admin($this->Database, false); $nameservers = $Admin->fetch_all_objects("nameservers"); # loop and check if ($nameservers !== false) { foreach ($nameservers as $n) { //default if ($n->id == 1) { $permitted[] = $n->id; } else { //array if (in_array($sectionId, explode(";", $n->permissions))) { $permitted[] = $n->id; } } } # return permitted return $permitted; } else { return false; } }
</script> <?php die; } else { # create csrf token $csrf = $User->csrf_cookie("create", "rack_devices"); # fetch rack details $rack = $Admin->fetch_object("racks", "id", $_POST['rackid']); # check if ($rack === false) { $Result->show("danger", _("Invalid ID"), true, true); } # fetch existing devices $rack_devices = $Racks->fetch_rack_devices($rack->id); # all devices $devices = $Admin->fetch_all_objects("devices", "id"); if ($devices !== false) { foreach ($devices as $k => $d) { if (strlen($d->rack) != 0) { unset($devices[$k]); } } } ?> <script type="text/javascript"> $(document).ready(function(){ if ($("[rel=tooltip]").length) { $("[rel=tooltip]").tooltip(); } }); </script>
<?php /** * Script to display usermod result *************************************/ /* functions */ require dirname(__FILE__) . '/../../../functions/functions.php'; # initialize user object $Database = new Database_PDO(); $User = new User($Database); $Admin = new Admin($Database); $Result = new Result(); # verify that user is logged in $User->check_user_session(); # fetch all available LDAP servers $servers = $Admin->fetch_all_objects("usersAuthMethod"); foreach ($servers as $k => $s) { if ($s->type != "AD" && $s->type != "LDAP") { unset($servers[$k]); } } # die if no servers if (sizeof($servers) == 0) { $Result->show("danger", _("No servers available"), true, true); } ?> <!-- header --> <div class="pHeader"><?php print _('Search user in AD');
<!-- Device --> <tr> <td class="middle"><?php print _('Device'); ?> </td> <td id="deviceDropdown"> <select name="device" class="form-control input-sm input-w-auto"> <option value="0"><?php print _('None'); ?> </option> <?php // fetch all devices $devices = $Admin->fetch_all_objects("devices", "hostname"); // loop if ($devices !== false) { foreach ($devices as $device) { //check if permitted in this section! $sections = explode(";", $device->sections); if (in_array($_POST['sectionId'], $sections)) { //if same if ($device->id == @$subnet_old_details['device']) { print '<option value="' . $device->id . '" selected>' . $device->hostname . '</option>' . "\n"; } else { print '<option value="' . $device->id . '">' . $device->hostname . '</option>' . "\n"; } } } }
public function fetch_section_domains($sectionId) { # first fetch all domains $Admin = new Admin($this->Database, false); $domains = $Admin->fetch_all_objects("vlanDomains"); # loop and check foreach ($domains as $d) { //default if ($d->id == 1) { $permitted[] = $d->id; } else { //array if (in_array($sectionId, explode(";", $d->permissions))) { $permitted[] = $d->id; } } } # return permitted return $permitted; }
require dirname(__FILE__) . '/../../../functions/functions.php'; require dirname(__FILE__) . '/../../../functions/PEAR/Spreadsheet/Excel/Writer.php'; # initialize user object $Database = new Database_PDO(); $User = new User($Database); $Admin = new Admin($Database); $Result = new Result(); # verify that user is logged in $User->check_user_session(); // Create a workbook $filename = "phpipam_logs_export_" . date("Y-m-d") . ".xls"; $workbook = new Spreadsheet_Excel_Writer(); //increase memory size ini_set('memory_limit', '1024M'); //fetch sections, and for each section write new tab, inside tab write all values! $logs = $Admin->fetch_all_objects("logs", "id"); //formatting headers $format_header =& $workbook->addFormat(); $format_header->setBold(); $format_header->setColor('white'); $format_header->setFgColor('black'); //formatting titles $format_title =& $workbook->addFormat(); $format_title->setColor('black'); $format_title->setFgColor(22); //light gray $format_title->setBottom(2); $format_title->setLeft(1); $format_title->setRight(1); $format_title->setTop(1); $format_title->setAlign('left');