本文整理汇总了PHP中getSubnetDetailsById函数的典型用法代码示例。如果您正苦于以下问题:PHP getSubnetDetailsById函数的具体用法?PHP getSubnetDetailsById怎么用?PHP getSubnetDetailsById使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getSubnetDetailsById函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: filter_user_input
***************************************************************************************/
/* filter input */
$_GET = filter_user_input($_GET, true, true, false);
/* must be numeric */
if (!is_numeric($_GET['subnetId'])) {
die('<div class="alert alert-danger">' . _("Invalid ID") . '</div>');
}
if (!is_numeric($_GET['section'])) {
die('<div class="alert alert-danger">' . _("Invalid ID") . '</div>');
}
/* get master subnet ID */
$subnetId = $_GET['subnetId'];
/* get all slaves */
$slaves = getAllSlaveSubnetsBySubnetId($subnetId);
/* get master details */
$master = getSubnetDetailsById($subnetId);
/* get section details */
$section = getSectionDetailsById($master['sectionId']);
/* divide subnets / folders */
foreach ($slaves as $s) {
//folders
if ($s['isFolder'] == "1") {
$folders[] = $s;
} else {
$subnets[] = $s;
}
}
/* first print belonging folders */
if (sizeof($folders) > 0) {
/* print title */
$slaveNum = sizeof($folders);
开发者ID:kinhvan017,项目名称:phpipam,代码行数:31,代码来源:folderDetailsSubnets.php
示例2: filter_user_input
}
/* filter input */
$_GET = filter_user_input($_GET, true, true, false);
/* must be numeric */
if (!is_numeric($_GET['subnetId'])) {
die('<div class="alert alert-danger">' . _("Invalid ID") . '</div>');
}
if (!is_numeric($_GET['section'])) {
die('<div class="alert alert-danger">' . _("Invalid ID") . '</div>');
}
if (!is_numeric($_GET['ipaddrid'])) {
die('<div class="alert alert-danger">' . _("Invalid ID") . '</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") {
开发者ID:retexica,项目名称:phpipam,代码行数:31,代码来源:ipDetails.php
示例3: getSubnet
/**
* get subnet details
*/
public function getSubnet()
{
/**
* all subnets
*/
if ($this->all) {
//get subnet by id
$res = fetchAllSubnets();
} elseif ($this->sectionId) {
//id must be set and numberic
if (is_null($this->sectionId) || !is_numeric($this->sectionId)) {
throw new Exception('Invalid section Id - ' . $this->sectionId);
}
//get all subnets in section
$res = fetchSubnets($this->sectionId);
//throw new exception if not existing
if (sizeof($res) == 0) {
//check if section exists
if (sizeof(getSectionDetailsById($this->sectionId)) == 0) {
throw new Exception('Section not existing');
}
}
} elseif ($this->id) {
//id must be set and numberic
if (is_null($this->id) || !is_numeric($this->id)) {
throw new Exception('Subnet id not existing - ' . $this->id);
}
//get subnet by id
$res = getSubnetDetailsById($this->id);
//throw new exception if not existing
if (sizeof($res) == 0) {
throw new Exception('Subnet not existing');
}
} elseif ($this->name) {
//id must be set and numberic
if (is_null($this->name) || strlen($this->name) == 0) {
throw new Exception('Invalid subnet name - ' . $this->name);
}
//get subnet by id
$res = getSubnetDetailsByName($this->name);
//throw new exception if not existing
if (sizeof($res) == 0) {
throw new Exception('Subnet not existing');
}
} else {
throw new Exception('Selector missing');
}
//create object from results
foreach ($res as $key => $line) {
$this->{$key} = $line;
}
//output format
$format = $this->format;
//remove input parameters from output
unset($this->all);
//remove from result array
unset($this->format);
unset($this->name);
unset($this->id);
unset($this->sectionId);
//convert object to array
$result = $this->toArray($this, $format);
//return result
return $result;
}
开发者ID:btorresgil,项目名称:phpipam,代码行数:68,代码来源:subnet.php
示例4: printToolsSubnets
//.........这里部分代码省略.........
$requests = "<i class='fa fa-gray fa-check'></i>";
} else {
$requests = "";
}
# request disabled
# hosts check
if ($option['value']['pingSubnet'] == 1) {
$pCheck = "<i class='fa fa-gray fa-check'></i>";
} else {
$pCheck = "";
}
# ping check disabled
# print table line
if (strlen($option['value']['subnet']) > 0) {
$html[] = "<tr>";
# folder
if ($option['value']['isFolder'] == 1) {
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-sfolder fa-folder-open'></i> <a href='" . create_link("folder", $option['value']['sectionId'], $option['value']['id']) . "'>{$description}</a></td>";
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-sfolder fa-folder-open'></i> {$description}</td>";
} else {
if ($count == 1) {
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-gray fa-folder-open-o'></i><a href='" . create_link("subnets", $option['value']['sectionId'], $option['value']['id']) . "'> " . transform2long($option['value']['subnet']) . "/" . $option['value']['mask'] . "</a></td>";
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-gray fa-folder-open-o'></i> {$description}</td>";
} else {
# last?
if (!empty($children[$option['value']['id']])) {
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-folder-open-o'></i><a href='" . create_link("subnets", $option['value']['sectionId'], $option['value']['id']) . "'> " . transform2long($option['value']['subnet']) . "/" . $option['value']['mask'] . "</a></td>";
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-folder-open-o'></i> {$description}</td>";
} else {
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-angle-right'></i><a href='" . create_link("subnets", $option['value']['sectionId'], $option['value']['id']) . "'> " . transform2long($option['value']['subnet']) . "/" . $option['value']['mask'] . "</a></td>";
$html[] = "\t<td class='level{$count}'><span class='structure' style='padding-left:{$padding}; margin-left:{$margin};'></span><i class='fa fa-angle-right'></i> {$description}</td>";
}
}
}
//vlan
$html[] = "\t<td>{$vlan}</td>";
//masterSubnet
if ($option['value']['masterSubnetId'] == 0 || empty($option['value']['masterSubnetId'])) {
$masterSubnet = true;
} else {
$masterSubnet = false;
}
if ($masterSubnet) {
$html[] = ' <td>/</td>' . "\n";
} else {
$master = getSubnetDetailsById($option['value']['masterSubnetId']);
if ($master['isFolder']) {
$html[] = "\t<td><i class='fa fa-gray fa-folder-open-o'></i> <a href='" . create_link("subnets", $option['value']['sectionId'], $master['id']) . "'>{$master['description']}</a></td>" . "\n";
} else {
$html[] = "\t<td><a href='" . create_link("folder", $option['value']['sectionId'], $master['id']) . "'>" . transform2long($master['subnet']) . '/' . $master['mask'] . '</a></td>' . "\n";
}
}
//used , free
if ($option['value']['isFolder'] == 1) {
$html[] = '<td class="hidden-xs hidden-sm"></td>' . "\n";
} elseif (!$masterSubnet || !subnetContainsSlaves($option['value']['id'])) {
$ipCount = countIpAddressesBySubnetId($option['value']['id']);
$calculate = calculateSubnetDetails(gmp_strval($ipCount), $option['value']['mask'], $option['value']['subnet']);
$html[] = ' <td class="used hidden-xs hidden-sm">' . reformatNumber($calculate['used']) . '/' . reformatNumber($calculate['maxhosts']) . ' (' . reformatNumber($calculate['freehosts_percent']) . ' %)</td>';
} else {
$html[] = '<td class="hidden-xs hidden-sm"></td>' . "\n";
}
//requests
$html[] = "\t<td class='hidden-xs hidden-sm'>{$requests}</td>";
$html[] = "\t<td class='hidden-xs hidden-sm'>{$pCheck}</td>";
//custom
if (sizeof($custom) > 0) {
foreach ($custom as $field) {
$html[] = "<td class='hidden-xs hidden-sm hidden-md'>";
//booleans
if ($field['type'] == "tinyint(1)") {
if ($option['value'][$field['name']] == "0") {
$html[] = _("No");
} elseif ($option['value'][$field['name']] == "1") {
$html[] = _("Yes");
}
} elseif ($field['type'] == "text") {
if (strlen($option['value'][$field['name']]) > 0) {
$html[] = "<i class='fa fa-gray fa-comment' rel='tooltip' data-container='body' data-html='true' title='" . str_replace("\n", "<br>", $option['value'][$field['name']]) . "'>";
} else {
$html[] = "";
}
} else {
$html[] = $option['value'][$field['name']];
}
$html[] = "</td>";
}
}
$html[] = "</tr>";
}
if ($option === false) {
$parent = array_pop($parent_stack);
} elseif (!empty($children[$option['value']['id']])) {
array_push($parent_stack, $option['value']['masterSubnetId']);
$parent = $option['value']['id'];
} else {
}
}
return implode("\n", $html);
}
开发者ID:retexica,项目名称:phpipam,代码行数:101,代码来源:functions-tools.php
示例5: getAllSlaves
# set folder flag!
$_POST['isFolder'] = true;
# failed
if ($_POST['action'] == "delete" && !isset($_POST['deleteconfirm'])) {
# for ajax to prevent reload
print "<div style='display:none'>alert alert-danger</div>";
# result
print "<div class='alert alert-warning'>";
# print what will be deleted
getAllSlaves($_POST['subnetId'], false);
$removeSlaves = array_unique($removeSlaves);
# check if folder?
$foldercnt = 0;
$subnetcnt = 0;
foreach ($removeSlaves as $s) {
$f = getSubnetDetailsById($s);
if ($f['isFolder'] == 1) {
$foldercnt++;
} else {
$subnetcnt++;
}
}
$ipcnt = countAllSlaveIPAddresses($_POST['subnetId']);
print "<strong>" . _("Warning") . "</strong>: " . _("I will delete") . ":<ul>";
print "\t<li>{$foldercnt} " . _("folders") . "</li>";
if ($subnetcnt > 0) {
print "\t<li>{$subnetcnt} " . _("subnets") . "</li>";
}
if ($ipcnt > 0) {
print "\t<li>{$ipcnt} " . _("IP addresses") . "</li>";
}
开发者ID:kinhvan017,项目名称:phpipam,代码行数:31,代码来源:manageFolderEditSubmit.php
示例6: checkSubnetPermission
<?php
/*
* Print resize split
*********************/
/* required functions */
require_once '../../functions/functions.php';
/* verify that user has write permissions for subnet */
$subnetPerm = checkSubnetPermission($_REQUEST['subnetId']);
if ($subnetPerm < 3) {
die('<div class="alert alert-danger">' . _('You do not have permissions to resize subnet') . '!</div>');
}
/* verify post */
CheckReferrer();
# get subnet details
$subnet = getSubnetDetailsById($_POST['subnetId']);
# check if it has slaves - if yes it cannot be splitted!
$slaves = getAllSlaveSubnetsBySubnetId($_POST['subnetId']);
if (sizeof($slaves) > 0) {
die("<div class='alert alert-warning'>" . 'Only subnets that have no nested subnets can be splitted' . "!</div>");
}
# calculate max split
$type = IdentifyAddress(transform2long($subnet['subnet']));
# type for max resize
if ($type == "IPv4") {
$maxMask = "30";
$type = 0;
} else {
$maxMask = "126";
$type = 1;
}
开发者ID:btorresgil,项目名称:phpipam,代码行数:31,代码来源:manageSubnetsplit.php
示例7: subnetGetVLANdetailsById
# get VLAN details
$subnet['VLAN'] = subnetGetVLANdetailsById($subnet['vlanId']);
$subnet['VLAN'] = $subnet['VLAN']['number'];
# reformat empty VLAN
if (empty($subnet['VLAN']) || $subnet['VLAN'] == 0) {
$subnet['VLAN'] = "";
}
# get section name
$section = getSectionDetailsById($subnet['sectionId']);
print "\t<td>{$subnet['VLAN']}</td>";
print "\t<td>{$subnet['description']}</td>";
print "\t<td><a href='subnets/{$section['id']}/{$subnet['id']}/'>" . transform2long($subnet['subnet']) . "/{$subnet['mask']}</a></td>";
if ($masterSubnet) {
print ' <td>/</td>' . "\n";
} else {
$master = getSubnetDetailsById($subnet['masterSubnetId']);
# orphaned
if (strlen($master['subnet']) == 0) {
print "\t<td><div class='alert alert-warning'>" . _('Master subnet does not exist') . "!</div></td>";
} else {
print "\t<td><a href='subnets/{$subnet['sectionId']}/{$subnet['masterSubnetId']}/'>" . transform2long($master['subnet']) . "/{$master['mask']} ({$master['description']})</a></td>";
}
}
# details
if (!$masterSubnet || !subnetContainsSlaves($subnet['id'])) {
$ipCount = countIpAddressesBySubnetId($subnet['id']);
$calculate = calculateSubnetDetails(gmp_strval($ipCount), $subnet['mask'], $subnet['subnet']);
print ' <td class="used hidden-xs hidden-sm">' . reformatNumber($calculate['used']) . '/' . reformatNumber($calculate['maxhosts']) . '</td>' . "\n";
print ' <td class="free hidden-xs hidden-sm">' . reformatNumber($calculate['freehosts_percent']) . ' %</td>';
} else {
print '<td class="hidden-xs hidden-sm"></td>' . "\n";
开发者ID:btorresgil,项目名称:phpipam,代码行数:31,代码来源:vrf.php
示例8: isUserAuthenticated
<?php
/**
* Script to display IP address info and history
***********************************************/
/* verify that user is authenticated! */
isUserAuthenticated();
# get site settings
if (sizeof($settings) == 0) {
$settings = getAllSettings();
}
# get IP address details
$ip = getIpAddrDetailsById($_REQUEST['ipaddrid']);
$subnet = getSubnetDetailsById($_REQUEST['subnetId']);
$section = getSectionDetailsById($_REQUEST['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($_REQUEST['subnetId']);
# section permissions
$permissionsSection = checkSectionPermission($_REQUEST['section']);
# if 0 die
if ($permission == "0") {
die("<div class='alert alert-danger'>" . _('You do not have permission to access this network') . "!</div>");
}
开发者ID:btorresgil,项目名称:phpipam,代码行数:31,代码来源:ipDetails.php
示例9: _
print '<div class="alert alert-success">' . _('Range') . ' ' . $ip['start'] . ' - ' . $ip['stop'] . ' ' . _('updated successfully') . '!</div>';
updateLogTable('Range ' . $ip['start'] . ' - ' . $ip['stop'] . ' ' . $ip['action'] . ' successfull!', 'Range ' . $ip['start'] . ' - ' . $ip['stop'] . ' ' . $ip['action'] . ' ' . _('successfull') . '!', 0);
}
} else {
/* unique */
if (isset($_POST['unique'])) {
if ($_POST['unique'] == "1" && strlen($_POST['dns_name']) > 0) {
# check if unique
if (!isHostUnique($_POST['dns_name'])) {
die('<div class="alert alert-danger">' . _('Hostname is not unique') . '!</div>');
}
}
}
/* verify ip address */
if ($ip['action'] == "move") {
$subnet = getSubnetDetailsById($_REQUEST['newSubnet']);
$subnet = transform2long($subnet['subnet']) . "/" . $subnet['mask'];
$verify = VerifyIpAddress($ip['ip_addr'], $subnet, $nostrict);
$ip['newSubnet'] = $_REQUEST['newSubnet'];
} else {
$verify = VerifyIpAddress($ip['ip_addr'], $ip['subnet'], $nostrict);
}
/* if errors are present print them, else execute query! */
if ($verify) {
die('<div class="alert alert-danger">' . _('Error') . ': ' . $verify . ' (' . $ip['ip_addr'] . ')</div>');
} else {
/* set update for update */
$ip['type'] = "single";
/* check for duplicate entry! needed only in case new IP address is added, otherwise the code is locked! */
if ($ip['action'] == "add") {
if (checkDuplicate($ip['ip_addr'], $ip['subnetId'])) {
开发者ID:btorresgil,项目名称:phpipam,代码行数:31,代码来源:modifyIpAddressCheck.php
示例10: verifySubnetNesting
/**
* Verify that new nested subnet is inside master subnet!
*
* $root = root subnet Id
* $new = new subnet that we wish to add to root subnet
*/
function verifySubnetNesting($rootId, $new)
{
//first get details for root subnet
$rootDetails = getSubnetDetailsById($rootId);
$rootDetails = Transform2long($rootDetails['subnet']) . "/" . $rootDetails['mask'];
/* IPv4 or ipv6? */
$type1 = IdentifyAddress($rootDetails);
$type2 = IdentifyAddress($new);
/* both must be IPv4 or IPv6 */
if ($type1 != $type2) {
return false;
die;
}
/* we need network and broadcast address and check for both if the exist in any network!*/
if (isSubnetInsideSubnet($new, $rootDetails)) {
return true;
} else {
return false;
}
}
开发者ID:krys1976,项目名称:phpipam-1,代码行数:26,代码来源:functions-network.php
示例11: importCSVline
/**
* CSV import IP address
*
* provided input is CSV line!
*/
function importCSVline($line, $subnetId)
{
/* array */
$line = explode(",", $line);
global $db;
# get variables from config file
$database = new database($db['host'], $db['user'], $db['pass'], $db['name']);
/* get subnet details by Id */
$subnetDetails = getSubnetDetailsById($subnetId);
$subnet = Transform2long($subnetDetails['subnet']) . "/" . $subnetDetails['mask'];
/* verify! */
if (VerifyIpAddress($line[0], $subnet)) {
return _('Wrong IP address') . ' - ' . $line[0];
}
/* check for duplicates */
if (checkDuplicate($line[0], $subnetId)) {
return _('IP address already exists') . ' - ' . $line[0];
}
/* reformat state */
switch ($line[5]) {
case "Active":
$line[5] = "1";
break;
case "active":
$line[5] = "1";
break;
case "Reserved":
$line[5] = "2";
break;
case "reserved":
$line[5] = "2";
break;
case "Offline":
$line[5] = "0";
break;
case "offline":
$line[5] = "0";
break;
}
/* reformat switch! */
$switch = getSwitchDetailsByHostname($line[7]);
/* get custom fields */
$myFields = getCustomIPaddrFields();
if (sizeof($myFields) > 0) {
$import['fieldName'] = "";
$import['fieldValue'] = "";
$m = 9;
foreach ($myFields as $field) {
$import['fieldName'] .= ",`{$field['name']}`";
$import['fieldValue'] .= ",'{$line[$m]}'";
$m++;
}
}
/* all ok, set query */
$query = "insert into ipaddresses ";
$query .= "(`subnetId`, `ip_addr`, `state`, `description`, `dns_name`, `mac`, `owner`, `switch`, `port`, `note` {$import['fieldName']} ) ";
$query .= "values ";
$query .= "('{$subnetId}','" . Transform2decimal($line[0]) . "', '{$line['1']}','{$line['2']}','{$line['3']}','{$line['4']}','{$line['5']}','{$line['6']}','{$switch['id']}','{$line['8']}' {$import['fieldValue']});";
/* set log details */
$log = prepareLogFromArray($line);
/* execute */
try {
$database->executeQuery($query);
} catch (Exception $e) {
$error = $e->getMessage();
}
if (!isset($e)) {
updateLogTable('CSV import of IP address ' . $line[1] . ' succeeded', $log, 0);
return true;
} else {
updateLogTable('CSV import of IP address ' . $line[1] . ' failed', $log, 2);
return $error;
}
}
开发者ID:krys1976,项目名称:phpipam-1,代码行数:79,代码来源:functions-admin.php
示例12: CheckReferrer
********************************************/
/* use required functions */
require_once '../../functions/functions.php';
/* First chech referer and requested with */
CheckReferrer();
/* verify that user is authenticated! */
isUserAuthenticated(false);
/* get all site settings */
$settings = getAllSettings();
/* user details */
$userDetails = getActiveUserDetails();
/* get IP address id */
$id = $_REQUEST['id'];
/* fetch all IP address details */
$ip = getIpAddrDetailsById($id);
$subnet = getSubnetDetailsById($ip['subnetId']);
/* get VLAN details */
$subnet['VLAN'] = subnetGetVLANdetailsById($subnet['vlanId']);
$subnet['vlan'] = $subnet['VLAN']['number'];
if (!empty($subnet['VLAN']['name'])) {
$subnet['vlan'] .= ' (' . $subnet['VLAN']['name'] . ')';
}
/* set title */
$title = _('IP address details') . ' :: ' . $ip['ip_addr'];
/* Preset content */
$content .= '• ' . _('IP address') . ': ' . "\t" . $ip['ip_addr'] . '/' . $subnet['mask'] . "\n";
# desc
if (!empty($ip['description'])) {
$content .= '• ' . _('Description') . ':' . "\t" . $ip['description'] . "\n";
}
# hostname
开发者ID:krys1976,项目名称:phpipam-1,代码行数:31,代码来源:mailNotifyIP.php
示例13: sendIPResultEmail
/**
* Send IP result mail - reject or confirm reservation
*/
function sendIPResultEmail($request)
{
# get settings
global $settings;
global $mail;
# set subject based on action
if ($request['action'] == "accept") {
$subject = _("IP address request") . " (" . Transform2long($request['ip_addr']) . ") " . _("{$request['action']}ed");
} else {
$subject = _("IP address request {$request['action']}ed");
}
# set additional headers
$mail['recipients'] = $request['requester'];
// it is sent to requester this time!
$mail['subject'] = $subject;
# add admins to CC
$admins = getAllAdminUsers();
$cc = "";
foreach ($admins as $admin) {
$cc .= '' . $admin['email'] . ', ';
}
$cc = substr($cc, 0, -2);
$mail['headers'] .= 'Cc: ' . $cc . "\r\n";
# get active user name */
$sender = getActiveUserDetails();
# get subnet details
$subnet = getSubnetDetailsById($request['subnetId']);
$subnet2 = Transform2long($subnet['subnet']) . "/" . $subnet['mask'];
# get section detaiils
$section = getSectionDetailsById($subnet['sectionId']);
# reformat \n to breaks
$request['comment'] = str_replace("\n", "<br>", $request['comment']);
$request['adminComment'] = str_replace("\n", "<br>", $request['adminComment']);
# set html content
if ($settings['htmlMail'] == "1") {
$mail['content'] = $mail['header'];
$mail['content'] .= "<tr><td style='padding:5px;margin:0px;color:#333;font-size:16px;text-shadow:1px 1px 1px white;border-bottom:1px solid #eeeeee;' colspan='2'><font face='Helvetica, Verdana, Arial, sans-serif' style='font-size:16px;'>{$subject}</font></td></tr>";
$mail['content'] .= '<tr><td style="padding: 0px;padding-left:10px;margin:0px;line-height:18px;text-align:left;border-top:1px solid white;padding-top:10px;"><font face="Helvetica, Verdana, Arial, sans-serif" style="font-size:13px;">• ' . _('Section') . ' </font></td><td style="padding: 0px;padding-left:10px;margin:0px;line-height:18px;text-align:left;border-top:1px solid white;padding-top:10px;"><font face="Helvetica, Verdana, Arial, sans-serif" style="font-size:13px;">' . $section['name'] . ' (' . $section['description'] . ')</font></td></tr>' . "\n";
$mail['content'] .= '<tr><td style="padding: 0px;padding-left:10px;margin:0px;line-height:18px;text-align:left;"><font face="Helvetica, Verdana, Arial, sans-serif" style="font-size:13px;">• ' . _('Subnet') . ' </font></td> <td style="padding: 0px;padding-left:10px;margin:0px;line-height:18px;text-align:left;"><font face="Helvetica, Verdana, Arial, sans-serif" style="font-size:13px;">' . $subnet2 . '</font></td></tr>' . "\n";
if ($request['action'] == "accept") {
$mail['content'] .= '<tr><td style="padding: 0px;padding-left:10px;margin:0px;line-height:18px;text-align:left;"><font face="Helvetica, Verdana, Arial, sans-serif" style="font-size:13px;">• ' . _('assigned IP address') . ' </font></td> <td style="padding: 0px;padding-left:10px;margin:0px;line-height:18px;text-align:left;"><font face="Helvetica, Verdana, Arial, sans-serif" style="font-size:13px;">' . Transform2long($request['ip_addr']) . '</font></td></tr>' . "\n";
}
$mail['content'] .= '<tr><td style="padding: 0px;padding-left:10px;margin:0px;line-height:18px;text-align:left;"><font face="Helvetica, Verdana, Arial, sans-serif" style="font-size:13px;">• ' . _('Description') . ' </font></td> <td style="padding: 0px;padding-left:10px;margin:0px;line-height:18px;text-align:left;"><font face="Helvetica, Verdana, Arial, sans-serif" style="font-size:13px;">' . $request['description'] . '</font></td></tr>' . "\n";
$mail['content'] .= '<tr><td style="padding: 0px;padding-left:10px;margin:0px;line-height:18px;text-align:left;"><font face="Helvetica, Verdana, Arial, sans-serif" style="font-size:13px;">• ' . _('Hostname') . ' </font></td> <td style="padding: 0px;padding-left:10px;margin:0px;line-height:18px;text-align:left;"><font face="Helvetica, Verdana, Arial, sans-serif" style="font-size:13px;">' . $request['dns_name'] . '</font></td></tr>' . "\n";
$mail['content'] .= '<tr><td style="padding: 0px;padding-left:10px;margin:0px;line-height:18px;text-align:left;"><font face="Helvetica, Verdana, Arial, sans-serif" style="font-size:13px;">• ' . _('Owner') . ' </font></td> <td style="padding: 0px;padding-left:10px;margin:0px;line-height:18px;text-align:left;"><font face="Helvetica, Verdana, Arial, sans-serif" style="font-size:13px;">' . $request['owner'] . '</font></td></tr>' . "\n";
$mail['content'] .= '<tr><td style="padding: 0px;padding-left:10px;margin:0px;line-height:18px;text-align:left;"><font face="Helvetica, Verdana, Arial, sans-serif" style="font-size:13px;">• ' . _('Requested from') . ' </font></td> <td style="padding: 0px;padding-left:10px;margin:0px;line-height:18px;text-align:left;"><font face="Helvetica, Verdana, Arial, sans-serif" style="font-size:13px;"><a href="mailto:' . $request['requester'] . '" style="color:#08c;">' . $request['requester'] . '</a></font></td></tr>' . "\n";
$mail['content'] .= '<tr><td style="padding: 0px;padding-left:10px;margin:0px;line-height:18px;text-align:left;vertical-align:top;"><font face="Helvetica, Verdana, Arial, sans-serif" style="font-size:13px;">• ' . _('Comment (request)') . ' </font></td> <td style="padding: 0px;padding-left:10px;margin:0px;line-height:18px;text-align:left;"><font face="Helvetica, Verdana, Arial, sans-serif" style="font-size:13px;">' . $request['comment'] . '</font></td></tr>' . "\n";
$mail['content'] .= '<tr><td style="padding: 0px;padding-left:10px;margin:0px;line-height:18px;text-align:left;vertical-align:top;"><font face="Helvetica, Verdana, Arial, sans-serif" style="font-size:13px;">• ' . _('Admin accept/reject comment') . ' </font></td> <td style="padding: 0px;padding-left:10px;margin:0px;line-height:18px;text-align:left;"><font face="Helvetica, Verdana, Arial, sans-serif" style="font-size:13px; font-weight:bold;">' . $request['adminComment'] . '</font></td></tr>' . "\n";
$mail['content'] .= "<tr><td style='padding:5px;padding-left:15px;margin:0px;font-style:italic;padding-bottom:3px;text-align:right;color:#ccc;text-shadow:1px 1px 1px white;border-top:1px solid white;' colspan='2'><font face='Helvetica, Verdana, Arial, sans-serif' style='font-size:11px;'>" . _('Sent by user') . " " . $mail['sender']['real_name'] . " at " . date('Y/m/d H:i') . "</font></td></tr>";
$mail['content'] .= $mail['footer2'];
} else {
# reformat content
$content = str_replace("<br>", "\r\n", $content);
$content = str_replace("\t", " ", $content);
$content = strip_tags($content);
# reformat content
$request['comment'] = str_replace("<br>", "\r\n", $request['comment']);
$request['adminComment'] = str_replace("<br>", "\r\n", $request['adminComment']);
$mail['content'] = $mail['header'];
$mail['content'] .= "{$subject}" . "\r\n------------------------------\r\n\r\n";
$mail['content'] .= _("Section") . ": {$section['name']} ({$section['description']})\r\n";
$mail['content'] .= _("Subnet") . ": {$subnet2}\r\n";
if ($request['action'] == "accept") {
$mail['content'] .= _("Assigned IP address") . ": " . Transform2long($request['ip_addr']) . "\r\n";
}
$mail['content'] .= _("Description") . ": {$request['description']}\r\n";
$mail['content'] .= _("Hostname") . ": {$request['dns_name']}\r\n";
$mail['content'] .= _("Owner") . ": {$request['owner']}\r\n";
$mail['content'] .= _("Requested by") . ": {$request['requester']}\r\n";
$mail['content'] .= _("Comment (request)") . ": {$request['comment']}\r\n";
$mail['content'] .= _("Admin accept/reject comment") . ": {$request['adminComment']}\r\n";
$mail['content'] .= "\r\nSent by user " . $mail['sender']['real_name'] . " at " . date('Y/m/d H:i');
$mail['content'] .= $mail['footer'];
# reset headers
$mail['headers'] = 'From: ' . $mail['from'] . "\r\n";
$mail['headers'] .= 'Reply-To: ' . $settings['siteAdminMail'] . "\r\n";
$mail['headers'] .= 'X-Mailer: PHP/' . phpversion() . "\r\n";
$mail['headers'] .= 'Cc: ' . $cc . "\r\n";
}
# send mail and update log
if (!mail($mail['recipients'], $mail['subject'], $mail['content'], $mail['headers'])) {
# write log
updateLogTable("IP request response mail (confirm,reject) sending failed", "Sending notification mail to {$mail['recipients']} failed!", $severity = 2);
return false;
} else {
# write log
updateLogTable("IP request response mail (confirm,reject) sent ok", "Sending notification mail to {$mail['recipients']} succeeded!", $severity = 0);
return true;
}
}
开发者ID:krys1976,项目名称:phpipam-1,代码行数:93,代码来源:functions-mail.php
示例14: updateLogTable
updateLogTable('Range ' . $ip['start'] . ' - ' . $ip['stop'] . ' ' . $ip['action'] . ' successfull!', 'Range ' . $ip['start'] . ' - ' . $ip['stop'] . ' ' . $ip['action'] . ' ' . _('successfull') . '!', 0);
}
}
} else {
/* unique */
if (isset($_POST['unique'])) {
if ($_POST['unique'] == "1" && strlen($_POST['dns_name']) > 0) {
# check if unique
if (!isHostUnique($_POST['dns_name'])) {
die('<div class="alert alert-danger">' . _('Hostname is not unique') . '!</div>');
}
}
}
/* verify ip address */
if ($ip['action'] == "move") {
$subnet = getSubnetDetailsById($_POST['newSubnet']);
$subnet = transform2long($subnet['subnet']) . "/" . $subnet['mask'];
$verify = VerifyIpAddress($ip['ip_addr'], $subnet, $nostrict);
$ip['newSubnet'] = $_POST['newSubnet'];
} else {
$verify = VerifyIpAddress($ip['ip_addr'], $ip['subnet'], $nostrict);
}
/* if errors are present print them, else execute query! */
if ($verify) {
die('<div class="alert alert-danger">' . _('Error') . ': ' . $verify . ' (' . $ip['ip_addr'] . ')</div>');
} else {
/* set update for update */
$ip['type'] = "single";
/* check for duplicate entry! needed only in case new IP address is added, otherwise the code is locked! */
if ($ip['action'] == "add") {
if (checkDuplicate($ip['ip_addr'], $ip['subnetId'])) {
开发者ID:kinhvan017,项目名称:phpipam,代码行数:31,代码来源:modifyIpAddressCheck.php
示例15: checkSubnetPermission
$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) {
$tempData = getSubnetDetailsById($_POST['subnetId']);
$subnetDataOld['masterSubnetId'] = $tempData['id'];
// same master subnet ID for nested
$subnetDataOld['vlanId'] = $tempData['vlanId'];
// same default vlan for nested
$subnetDataOld['vrfId'] = $tempData['vrfId'];
// same default vrf for nested
}
$sectionName = getSectionDetailsById($_POST['sectionId']);
}
/* get custom subnet fields */
$customSubnetFields = getCustomFields('subnets');
# set readonly flag
if ($_POST['action'] == "edit" || $_POST['action'] == "delete") {
$readonly = true;
} else {
开发者ID:btorresgil,项目名称:phpipam,代码行数:31,代码来源:manageFolderEdit.php
示例16: writeChangelog
/**
* Write new changelog
*/
function writeChangelog($ctype, $action, $result, $old, $new)
{
/* set query, open db connection and fetch results */
global $database;
# get settings
$settings = getAllSettings();
if ($settings['enableChangelog'] == 1) {
# get user details
$cuser = getActiveUserDetails();
# unset unneeded values and format
if ($ctype == "ip_addr") {
unset($new['action'], $new['subnet'], $new['type']);
} elseif ($ctype == "subnet") {
$new['id'] = $new['subnetId'];
unset($new['action'], $new['subnetId'], $new['location'], $new['vrfIdOld'], $new['permissions']);
# if section does not change
if ($new['sectionId'] == $new['sectionIdNew']) {
unset($new['sectionIdNew']);
unset($new['sectionId']);
unset($old['sectionId']);
} else {
$old['sectionIdNew'] = $old['sectionId'];
}
//transform subnet
if (strlen($new['subnet']) > 0) {
$new['subnet'] = Transform2decimal(substr($new['subnet'], 0, strpos($new['subnet'], "/")));
}
} elseif ($ctype == "section") {
unset($new['action']);
}
# calculate diff
if ($action == "edit") {
//old - checkboxes
foreach ($old as $k => $v) {
if (!isset($new[$k]) && $v == 1) {
$new[$k] = 0;
}
}
foreach ($new as $k => $v) {
//change
if ($old[$k] != $v && $old[$k] != str_replace("\\'", "'", $v)) {
//empty
if (strlen(@$old[$k]) == 0) {
$old[$k] = "NULL";
}
if (strlen(@$v) == 0) {
$v = "NULL";
}
//state
if ($k == 'state') {
$old[$k] = reformatIPStateText($old[$k]);
$v = reformatIPStateText($v);
} elseif ($k == 'sectionIdNew') {
//get old and new device
if ($old[$k] != "NULL") {
$dev = getSectionDetailsById($old[$k]);
$old[$k] = $dev['name'];
}
if ($v != "NULL") {
$dev = getSectionDetailsById($v);
$v = $dev['name'];
}
} elseif ($k == "masterSubnetId") {
if ($old[$k] == 0) {
$old[$k] = "Root";
} else {
$dev = getSubnetDetailsById($old[$k]);
$old[$k] = transform2long($dev['subnet']) . "/{$dev['mask']} [{$dev['description']}]";
}
if ($v == 0) {
$v = "Root";
} else {
$dev = getSubnetDetailsById($v);
$v = transform2long($dev['subnet']) . "/{$dev['mask']} [{$dev['description']}]";
}
} elseif ($k == 'switch') {
if ($old[$k] == 0) {
$old[$k] = "None";
} e
|
请发表评论