$PortNamePatterns = array(); if (isset($_GET['power'])) { foreach (array('PS(1)', 'R(1)', 'Custom', __("From Template"), __("Invert Port Labels")) as $pattern) { $PortNamePatterns[]['Pattern'] = $pattern; } } else { foreach (array('NIC(1)', 'Port(1)', 'Fa/(1)', 'Gi/(1)', 'Ti/(1)', 'Custom', __("From Template"), __("Invert Port Labels")) as $pattern) { $PortNamePatterns[]['Pattern'] = $pattern; } } echo json_encode($PortNamePatterns); exit; } // Get connection path for a patch panel connection if (isset($_GET['path'])) { $path = DevicePorts::followPathToEndPoint($_GET['ConnectedDeviceID'], $_GET['ConnectedPort']); foreach ($path as $port) { $dev->DeviceID = $port->DeviceID; $dev->GetDevice(); $port->DeviceName = $dev->Label; } header('Content-Type: application/json'); echo json_encode($path); exit; } // This will allow any jackass to certify an audit but the function is hidden and // this is the type of function that will be fixed with the API so i'm not fixing it // as long as logging is enabled we'll know who triggered it. if (isset($_POST['audit'])) { $dev->DeviceID = $_POST['audit']; $dev->Audit();
} $color->ColorID = $devPort->ColorID; $color->GetCode(); $mediaType->MediaID = $devPort->MediaID; $mediaType->GetType(); $sheet->getActiveSheet()->SetCellValue('A' . $row, '="' . $dev->Label . '"'); $sheet->getActiveSheet()->SetCellValue('B' . $row, '="' . $devPort->Label . '"'); $sheet->getActiveSheet()->SetCellValue('C' . $row, '="' . $targetDev->Label . '"'); $sheet->getActiveSheet()->SetCellValue('D' . $row, '="' . $targetPort->Label . '"'); $sheet->getActiveSheet()->SetCellValue('E' . $row, '="' . $devPort->Notes . '"'); $sheet->getActiveSheet()->SetCellValue('F' . $row, '="' . $mediaType->MediaType . '"'); $sheet->getActiveSheet()->SetCellValue('G' . $row, '="' . $color->Name . '"'); $row++; } if ($targetDev->DeviceType == "Patch Panel") { $path = DevicePorts::followPathToEndPoint($devPort->ConnectedDeviceID, $devPort->ConnectedPort); $pDev = new Device(); $tDev = new Device(); $pPort = new DevicePorts(); $tPort = new DevicePorts(); foreach ($path as $p) { // Skip any rear port connections if ($p->PortNumber > 0 && $p->ConnectedPort > 0) { $pDev->DeviceID = $p->DeviceID; $pDev->GetDevice(); $tDev->DeviceID = $p->ConnectedDeviceID; $tDev->GetDevice(); $pPort->DeviceID = $p->DeviceID; $pPort->PortNumber = $p->PortNumber; $pPort->getPort(); if ($pPort->Label == "") {