public function parseCommand($deviceId) { //Get the Device name from ID $device = getDeviceById($deviceId); //Replace [target] with the target device hostname $this->command = str_replace('[target]', $device->hostname, $this->command); //Replace [user] with the commands username $this->command = str_replace('[user]', $this->user, $this->command); //Replace [password] with the commands username $this->command = str_replace('[password]', $this->password, $this->command); }
} else { print "<td class='narrow'></td>"; } } # print info button for hover if (in_array('note', $setFields)) { if (!empty($ipaddress[$n]['note'])) { print "<td class='narrow'><i class='fa fa-gray fa-comment-o' rel='tooltip' data-container='body' data-html='true' title='" . str_replace("\n", "<br>", $ipaddress[$n]['note']) . "'></td>"; } else { print "<td class='narrow'></td>"; } } # print switch if (in_array('switch', $setFields)) { # get switch details $switch = getDeviceById($ipaddress[$n]['switch']); print "<td class='hidden-xs hidden-sm hidden-md'>" . $switch['hostname'] . "</td>"; } # print port if (in_array('port', $setFields)) { print "<td class='hidden-xs hidden-sm hidden-md'>" . $ipaddress[$n]['port'] . "</td>"; } # print owner if (in_array('owner', $setFields)) { print "<td class='hidden-xs hidden-sm'>" . $ipaddress[$n]['owner'] . "</td>"; } # print custom fields if (sizeof($myFields) > 0) { foreach ($myFields as $myField) { print "<td class='customField hidden-xs hidden-sm hidden-md'>"; //booleans
<?php /** * Script to display devices * */ /* verify that user is authenticated! */ isUserAuthenticated(); /* get hosts under device */ $device = getDeviceById($_GET['sPage']); /* get custom fields */ $custom = getCustomFields('devices'); /* Get all IP addresses belonging to switch */ $ipaddresses = getIPaddressesBySwitchName($device['id']); //count items $cnt = countIPaddressesBySwitchId($device['id']); if ($_GET['sPage'] != 0 && $device) { //type $type = TransformDeviceType($device['type']); # title print "<h4>" . _('Device details') . "</h4>"; print "<hr>"; # device details print "<table class='ipaddress_subnet table-condensed table-full'>"; print '<tr>'; print "\t<th>" . _('Hostname') . '</a></th>'; print "\t<td>{$device['hostname']}</td>"; print "</tr>"; print "\t<th>" . _('IP address') . '</th>'; print "\t<td>{$device['ip_addr']}</td>"; print "</tr>";
print "</tr>"; } //note if (in_array('note', $setFields)) { print "<tr>"; print "\t<th>" . _('Note') . "</th>"; print "\t<td></td>"; print "</tr>"; } //switch if (in_array('switch', $setFields)) { print "<tr>"; print "\t<th>" . _('Switch') . "</th>"; if (strlen($ip['switch']) > 0) { # get switch $switch = getDeviceById($ip['switch']); if (strlen($switch['description']) == 0) { $switch['description'] = ""; } else { $switch['description'] = "({$switch['description']})"; } print "\t<td>{$switch['hostname']} {$switch['description']}</td>"; } else { print "\t<td>{$ip['switch']}</td>"; } print "</tr>"; } //port if (in_array('port', $setFields)) { print "<tr>"; print "\t<th>" . _('Port') . "</th>";
require_once "database/packages.php"; require_once "model/authentication.php"; require_once "model/device.php"; require_once "model/building.php"; require_once "model/room.php"; require_once "model/package.php"; require_once "helper/timeAgo.php"; //Load our session session_start(); //Check for an empty session if (isset($_SESSION['curUser']) && !empty($_SESSION['curUser'])) { $curUser = $_SESSION['curUser']; } else { header('Location: index.php'); } $curDevice = getDeviceById($_GET['deviceId']); $curRoom = getRoomById($curDevice->roomId); ?> <!-- AUI Framework --> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title>Omega</title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <!-- Favicons -->
<?php /** * Created by PhpStorm. * User: William * Date: 12/31/13 * Time: 11:19 AM */ require_once "../database/database.php"; require_once "../database/devices.php"; require_once "../model/device.php"; //Get the device ID that the user wants to execute a command on $deviceId = $_POST['deviceId']; //Get Device Info $device = getDeviceById($deviceId); //encode the device object using json and echo the results echo json_encode($device);
<?php /** * Script to display devices * */ /* verify that user is authenticated! */ isUserAuthenticated(); /* get hosts under device */ $device = getDeviceById($_GET['deviceid']); /* Get all IP addresses belonging to switch */ $ipaddresses = getIPaddressesBySwitchName($device['id']); # title print "<hr>"; # main table frame print "<table id='switchMainTable' class='devices table table-striped table-top table-condensed'>"; if (empty($device['hostname'])) { $device['hostname'] = _('Device not specified'); $device['ip_addr'] = ""; } else { $device['ip_addr'] = "({$device['ip_addr']})"; } /* reformat if empty */ if (empty($device['hostname'])) { $device['hostname'] = "Unspecified"; } # count size $size = sizeof($ipaddresses); # print name print "<tbody id='switch'>"; print "<tr class='switch-title'>";