本文整理汇总了PHP中getSectionDetailsById函数的典型用法代码示例。如果您正苦于以下问题:PHP getSectionDetailsById函数的具体用法?PHP getSectionDetailsById怎么用?PHP getSectionDetailsById使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getSectionDetailsById函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: filter_user_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);
print "<h4>{$master['description']} " . _('has') . " {$slaveNum} " . _('directly nested folders') . ":</h4><hr>";
/* print HTML list */
开发者ID:kinhvan017,项目名称:phpipam,代码行数:31,代码来源:folderDetailsSubnets.php
示例2: getSectionDetailsById
if (isset($_COOKIE['expandfolders'])) {
if ($_COOKIE['expandfolders'] == "1") {
$iconClass = 'fa-compress';
$action = 'open';
} else {
$iconClass = 'fa-expand';
$action = 'close';
}
} else {
$iconClass = 'fa-expand';
$action = 'close';
}
# Check if it has parent, and if so print back link
if ($sectionName['masterSection'] != "0") {
# get details
$mSection = getSectionDetailsById($sectionName['masterSection']);
print "<div class='subnets' style='padding-top:10px;'>";
print "\t<a href='subnets/{$mSection['id']}/'><i class='fa fa-gray fa-angle-left fa-pad-left'></i> " . _('Back to') . " {$mSection['name']}</a><hr>";
print "</div>";
}
print "<h4>" . _('Available subnets') . " <span class='pull-right' style='margin-right:5px;cursor:pointer;'><i class='fa fa-gray fa-sm {$iconClass}' rel='tooltip' data-placement='bottom' title='" . _('Expand/compress all folders') . "' id='expandfolders' data-action='{$action}'></i></span></h4>";
print "<hr>";
/* print subnets table ---------- */
print "<div class='subnets'>";
# print links
$subnets2 = fetchSubnets($sectionId);
$menu = get_menu_html($subnets2);
print $menu;
print "</div>";
# end subnets overlay
/* print VLANs */
开发者ID:btorresgil,项目名称:phpipam,代码行数:31,代码来源:subnets.php
示例3: foreach
foreach ($devices as $device) {
//print details
print '<tr>' . "\n";
print ' <td>' . $device['hostname'] . '</td>' . "\n";
print ' <td>' . $device['ip_addr'] . '</td>' . "\n";
print ' <td>' . $device['tname'] . '</td>' . "\n";
print ' <td>' . $device['vendor'] . '</td>' . "\n";
print ' <td>' . $device['model'] . '</td>' . "\n";
print ' <td>' . $device['version'] . '</td>' . "\n";
print ' <td class="description">' . $device['description'] . '</td>' . "\n";
//sections
print ' <td class="sections">';
$temp = explode(";", $device['sections']);
if (sizeof($temp) > 0 && !empty($temp[0])) {
foreach ($temp as $line) {
$section = getSectionDetailsById($line);
if (!empty($section)) {
print '<div class="switchSections">' . $section['name'] . '</div>' . "\n";
}
}
}
print ' </td>' . "\n";
//custom
if (sizeof($custom) > 0) {
foreach ($custom as $field) {
if (!in_array($field['name'], $ffields)) {
print "<td class='hidden-xs hidden-sm hidden-md'>";
//booleans
if ($field['type'] == "tinyint(1)") {
if ($device[$field['name']] == "0") {
print _("No");
开发者ID:kinhvan017,项目名称:phpipam,代码行数:31,代码来源:manageDevices.php
示例4: 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
示例5: subnetGetVLANdetailsById
# check if it is master
if ($subnet['masterSubnetId'] == 0 || empty($subnet['masterSubnetId'])) {
$masterSubnet = true;
} else {
$masterSubnet = false;
}
print "<tr>";
# 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
开发者ID:btorresgil,项目名称:phpipam,代码行数:31,代码来源:vrf.php
示例6: parseIpAddress
* 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 folder') . "!</div>");
}
# verify that is it displayed in proper section, otherwise warn!
if ($SubnetDetails['sectionId'] != $_GET['section']) {
$sd = getSectionDetailsById($SubnetDetails['sectionId']);
print "<div class='alert alert-warning'>Folder is in section <a href='" . create_link("folder", $sd['id'], $SubnetDetails['id']) . "'>{$sd['name']}</a>!</div>";
}
?>
<!-- content print! -->
<!-- for adding IP address! -->
<div id="subnetId" style="display:none"><?php
print $subnetId;
?>
</div>
<!-- subnet details upper table -->
<h4><?php
print _('Folder details');
开发者ID:kinhvan017,项目名称:phpipam,代码行数:31,代码来源:folderDetails.php
示例7: 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";
} elseif ($old[$k] != "NULL") {
$dev = getDeviceDetailsById($old[$k]);
$old[$k] = $dev['hostname'];
}
if ($v == 0) {
$v = "None";
}
if ($v != "NULL") {
$dev = getDeviceDetailsById($v);
$v = $dev['hostname'];
}
} elseif ($k == 'vlanId') {
//get old and new device
if ($old[$k] == 0) {
$old[$k] = "None";
} elseif ($old[$k] != "NULL") {
$dev = getVLANById($old[$k]);
$old[$k] = $dev['name'] . " [{$dev['number']}]";
}
//.........这里部分代码省略.........
开发者ID:retexica,项目名称:phpipam,代码行数:101,代码来源:functions-network.php
示例8: reformatDeviceSections
/**
* reformat sections for devices!
* sections are separated with ;
*/
function reformatDeviceSections($sections)
{
if (sizeof($sections != 0)) {
//first reformat
$temp = explode(";", $sections);
foreach ($temp as $section) {
//we have sectionId, so get its name
$out = getSectionDetailsById($section);
$out = $out['name'];
//format output
$result[$out] = $section;
}
}
//return result if it exists
if ($result) {
return $result;
} else {
return false;
}
}
开发者ID:kinhvan017,项目名称:phpipam,代码行数:24,代码来源:functions-admin.php
示例9: fetchSubnets
/**
* Get all subnets in provided sectionId
*/
function fetchSubnets($sectionId, $orderType = "subnet", $orderBy = "asc")
{
global $db;
# get variables from config file
/* check for sorting in settings and override */
$settings = getAllSettings();
/* get section details to check for ordering */
$section = getSectionDetailsById($sectionId);
// section ordering
if ($section['subnetOrdering'] != "default" && strlen($section['subnetOrdering']) > 0) {
$sort = explode(",", $section['subnetOrdering']);
$orderType = $sort[0];
$orderBy = $sort[1];
} elseif (isset($settings['subnetOrdering'])) {
$sort = explode(",", $settings['subnetOrdering']);
$orderType = $sort[0];
$orderBy = $sort[1];
}
/* set query, open db connection and fetch results */
$query = "select * from `subnets` where `sectionId` = '{$sectionId}' ORDER BY `masterSubnetId`,`{$orderType}` {$orderBy};";
$database = new database($db['host'], $db['user'], $db['pass'], $db['name']);
/* execute */
try {
$subnets = $database->getArray($query);
} catch (Exception $e) {
$error = $e->getMessage();
print "<div class='alert alert-error'>" . _('Error') . ":{$error}</div>";
return false;
}
$database->close();
/* return subnets array */
return $subnets;
}
开发者ID:krys1976,项目名称:phpipam-1,代码行数:36,代码来源:functions-network.php
示例10: 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
示例11: deleteSection
/**
* delete section
*/
public function deleteSection()
{
//verications
if (!isset($this->id)) {
throw new Exception('Section ID missing');
}
//does it exist?
if (sizeof(getSectionDetailsById($this->id)) == 0) {
throw new Exception('Section does not exist');
}
//create array to write new section
$newSection = $this->toArray($this);
//create new section
$res = UpdateSection($newSection, true);
//true means from API
//return result (true/false)
if (!$res) {
throw new Exception('Invalid query');
} else {
//format response
return "Section deleted";
}
}
开发者ID:btorresgil,项目名称:phpipam,代码行数:26,代码来源:section.php
示例12: getSectionIdFromSectionName
if (!is_numeric($sectionId) && $sectionId != "Administration") {
$sectionId = getSectionIdFromSectionName($sectionId);
}
/**
* Admin check, otherwise load requested subnets
*/
if ($sectionId == 'Administration') {
/* Print all Admin actions af user is admin :) */
if (!checkAdmin()) {
print '<div class="alert alert-error">' . _('Sorry, must be admin') . '!</div>';
} else {
include 'admin/adminMenu.php';
}
} else {
/* get section name */
$sectionName = getSectionDetailsById($sectionId);
# verify permissions
$sectionPermission = checkSectionPermission($sectionId);
if ($sectionPermission == "0") {
die("<div class='alert alert-error'>" . _('You do not have access to this section') . "!</div>");
}
/* die if empty! */
if (sizeof($sectionName) == 0) {
die('<div class="alert alert-error">' . _('Section does not exist') . '!</div>');
}
# header
if (isset($_COOKIE['expandfolders'])) {
if ($_COOKIE['expandfolders'] == "1") {
$iconClass = 'icon-resize-small';
$action = 'open';
} else {
开发者ID:krys1976,项目名称:phpipam-1,代码行数:31,代码来源:subnets.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: getAllSettings
$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 {
$readonly = false;
}
?>
<!-- header -->
<div class="pHeader"><?php
开发者ID:btorresgil,项目名称:phpipam,代码行数:31,代码来源:manageFolderEdit.php
示例15: searchSubnets
$allSubnets = searchSubnets($searchTerm, $searchTermEdited);
$lineCount = 0;
$worksheet =& $workbook->addWorksheet(_('Subnet search results'));
//write headers
$worksheet->write($lineCount, 0, _('Section'), $format_title);
$worksheet->write($lineCount, 1, _('Subet'), $format_title);
$worksheet->write($lineCount, 2, _('Mask'), $format_title);
$worksheet->write($lineCount, 3, _('Description'), $format_title);
$worksheet->write($lineCount, 4, _('Master subnet'), $format_title);
$worksheet->write($lineCount, 5, _('VLAN'), $format_title);
$worksheet->write($lineCount, 6, _('IP requests'), $format_title);
//new line
$lineCount++;
foreach ($allSubnets as $line) {
//get section details
$section = getSectionDetailsById($line['sectionId']);
//format master subnet
if ($line['masterSubnetId'] == 0) {
$line['masterSubnetId'] = "/";
} else {
$line['masterSubnetId'] = getSubnetDetailsById($line['masterSubnetId']);
$line['masterSubnetId'] = transform2long($line['masterSubnetId']['subnet']) . '/' . $line['masterSubnetId']['mask'];
}
//admin lock
if ($line['adminLock'] == 1) {
$line['adminLock'] = 'yes';
} else {
$line['adminLock'] = '';
}
//allowRequests
if ($line['allowRequest'] == 1) {
开发者ID:btorresgil,项目名称:phpipam,代码行数:31,代码来源:searchResultsExport.php
示例16: foreach
}
print '</tr>' . "\n";
$m = 0;
foreach ($vlans as $vlan) {
# new change detection
if ($m > 0) {
if ($vlans[$m]['number'] == $vlans[$m - 1]['number'] && $vlans[$m]['name'] == $vlans[$m - 1]['name'] && $vlans[$m]['description'] == $vlans[$m - 1]['description']) {
$change = 'nochange';
} else {
$change = 'change';
}
} else {
$change = 'change';
}
/* get section details */
$section = getSectionDetailsById($vlan['sectionId']);
/* check if it is master */
if (!isset($vlan['masterSubnetId'])) {
$masterSubnet = true;
} else {
if ($vlan['masterSubnetId'] == 0 || empty($vlan['masterSubnetId'])) {
$masterSubnet = true;
} else {
$masterSubnet = false;
}
}
# check permission
$permission = checkSubnetPermission($vlan['subnetId']);
if ($permission != "0") {
print "<tr class='{$change}'>";
/* print first 3 only if change happened! */
开发者ID:btorresgil,项目名称:phpipam,代码行数:31,代码来源:vlan.php
示例17: sendIPResultEmail
/**
* Send IP result mail - reject or confirm reservation
*/
function sendIPResultEmail($request)
{
# get settings
global $settings;
global $mailsettings;
global $mail;
global $pmail;
# 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");
}
# 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
$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;padd
|
请发表评论