本文整理汇总了PHP中getActiveUserDetails函数的典型用法代码示例。如果您正苦于以下问题:PHP getActiveUserDetails函数的具体用法?PHP getActiveUserDetails怎么用?PHP getActiveUserDetails使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getActiveUserDetails函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: updateLogTable
/**
* Update log table
*/
function updateLogTable($command, $details = NULL, $severity = 0)
{
global $db;
# get variables from config file
$database = new database($db['host'], $db['user'], $db['pass']);
/* select database */
try {
$database->selectDatabase($db['name']);
} catch (Exception $e) {
return false;
die;
}
/* Check connection */
if (!$database->connect_error) {
/* set variable */
$date = date("Y-m-d H:i:s");
$user = getActiveUserDetails();
$user = $user['username'];
/* set query */
$query = 'insert into logs ' . "\n";
$query .= '(`severity`, `date`,`username`,`ipaddr`,`command`,`details`)' . "\n";
$query .= 'values' . "\n";
$query .= '("' . $severity . '", "' . $date . '", "' . $user . '", "' . $_SERVER['REMOTE_ADDR'] . '", "' . $command . '", "' . $details . '");';
/* execute */
try {
$database->executeMultipleQuerries($query);
} catch (Exception $e) {
$error = $e->getMessage();
return false;
}
return true;
} else {
return false;
}
}
开发者ID:krys1976,项目名称:phpipam-1,代码行数:38,代码来源:functions-install.php
示例2: updateLogTable
/**
* Update log table
*/
function updateLogTable($command, $details = NULL, $severity = 0)
{
# for db upgrade!
if (strpos($_SERVER['SCRIPT_URI'], "databaseUpgrade.php") > 0) {
global $db;
$database = new database($db['host'], $db['user'], $db['pass'], $db['name']);
} else {
global $database;
# check if broken because of cron
if (isset($database->error)) {
global $db;
$database = new database($db['host'], $db['user'], $db['pass'], $db['name'], NULL, false);
}
}
/* set variable */
$date = date("Y-m-d H:i:s");
$user = getActiveUserDetails();
$user = $user['username'];
/* set query */
$query = 'insert into logs ' . "\n";
$query .= '(`severity`, `date`,`username`,`ipaddr`,`command`,`details`)' . "\n";
$query .= 'values' . "\n";
$query .= '("' . $severity . '", "' . $date . '", "' . $user . '", "' . $_SERVER['REMOTE_ADDR'] . '", "' . $command . '", "' . $details . '");';
/* execute */
try {
$database->executeQuery($query);
} catch (Exception $e) {
$error = $e->getMessage();
die('<div class="alert alert-danger">' . _('Error') . ': ' . $error . '</div>');
}
return true;
}
开发者ID:retexica,项目名称:phpipam,代码行数:35,代码来源:functions-tools.php
示例3: editFavourite
/**
* edit favourite
*/
function editFavourite($post)
{
global $db;
# get variables from config file
$database = new database($db['host'], $db['user'], $db['pass'], $db['name']);
# get user details and favourites
$user = getActiveUserDetails();
# empty
$old = explode(";", $user['favourite_subnets']);
# set query
if ($post['action'] == "remove") {
$new = implode(";", array_diff($old, array($post['subnetId'])));
$query = "update `users` set `favourite_subnets` = '{$new}' where `id` = '{$user['id']}' limit 1;";
} elseif ($post['action'] == "add") {
if (!is_array($old)) {
$old = array();
}
$new = implode(";", array_merge(array($post['subnetId']), $old));
$query = "update `users` set `favourite_subnets` = '{$new}' where `id` = '{$user['id']}' limit 1;";
} else {
return false;
}
# execute
try {
$database->executeQuery($query);
} catch (Exception $e) {
$error = $e->getMessage();
print "<div class='alert alert-danger'>" . _('Error') . ": {$error}</div>";
return false;
}
return true;
}
开发者ID:btorresgil,项目名称:phpipam,代码行数:35,代码来源:functions-common.php
示例4: CheckReferrer
<?php
/**
*
* User selfMod check end execute
*
*/
/* include required scripts */
require_once '../../functions/functions.php';
/* verify posted data */
CheckReferrer();
/* get old details */
$user_old = getActiveUserDetails();
/* save widgets */
if (!setUserDashWidgets($user_old['id'], $_POST['widgets'])) {
die('<div class="alert alert-danger alert-absolute">' . _('Error updating') . '!</div>');
} else {
print '<div class="alert alert-success alert-absolute">' . _('Account updated successfully') . '!</div>';
}
开发者ID:kinhvan017,项目名称:phpipam,代码行数:19,代码来源:userMenuSetWidgets.php
示例5: isUserAuthenticated
<?php
/**
*
* Usermenu - user can change password and email
*
*/
/* verify that user is authenticated! */
isUserAuthenticated();
/* get username */
$ipamusername = getActiveUserDetails();
/* get languages */
$langs = getLanguages();
/* print hello */
print "<h4>{$ipamusername['real_name']}, " . _('here you can change your account details') . ":</h4>";
print "<hr><br>";
?>
<form id="userModSelf">
<table id="userModSelf" class="table table-striped table-condensed">
<!-- real name -->
<tr>
<td><?php
print _('Real name');
?>
</td>
<td>
<input type="text" class="form-control input-sm" name="real_name" value="<?php
开发者ID:kinhvan017,项目名称:phpipam,代码行数:31,代码来源:userMenu.php
示例6: 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;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'];
# alt content
$request['comment'] = str_replace("<br>", "\r\n", $request['comment']);
$request['adminComment'] = str_replace("<br>", "\r\n", $request['adminComment']);
$mail['contentAlt'] = $mail['headerAlt'];
$mail['contentAlt'] .= "{$subject}" . "\r\n------------------------------\r\n\r\n";
$mail['contentAlt'] .= _("Section") . ": {$section['name']} ({$section['description']})\r\n";
$mail['contentAlt'] .= _("Subnet") . ": {$subnet2}\r\n";
if ($request['action'] == "accept") {
$mail['contentAlt'] .= _("Assigned IP address") . ": " . Transform2long($request['ip_addr']) . "\r\n";
}
$mail['contentAlt'] .= _("Description") . ": {$request['description']}\r\n";
$mail['contentAlt'] .= _("Hostname") . ": {$request['dns_name']}\r\n";
$mail['contentAlt'] .= _("Owner") . ": {$request['owner']}\r\n";
$mail['contentAlt'] .= _("Requested by") . ": {$request['requester']}\r\n";
$mail['contentAlt'] .= _("Comment (request)") . ": {$request['comment']}\r\n";
$mail['contentAlt'] .= _("Admin accept/reject comment") . ": {$request['adminComment']}\r\n";
$mail['contentAlt'] .= "\r\nSent by user " . $mail['sender']['real_name'] . " at " . date('Y/m/d H:i');
$mail['contentAlt'] .= $mail['footerAlt'];
# set mail parameters
try {
$pmail->SetFrom($mailsettings['mAdminMail'], $mailsettings['mAdminName']);
// send to requester
$pmail->AddAddress($request['requester']);
// add admins to CC
$admins = getAllAdminUsers();
foreach ($admins as $admin) {
$pmail->AddCC($admin['email']);
}
$pmail->ClearReplyTos();
$pmail->AddReplyTo($mailsettings['mAdminMail'], $mailsettings['mAdminName']);
// content
$pmail->Subject = $subject;
$pmail->AltBody = $mail['contentAlt'];
$pmail->MsgHTML($mail['content']);
# pošlji
$pmail->Send();
} catch (phpmailerException $e) {
updateLogTable("IP request response mail (confirm,reject) sending failed", "Sending notification mail to {$mail['recipients']} failed!\n" . $e->errorMessage(), 2);
return false;
} catch (Exception $e) {
updateLogTable("IP request response mail (confirm,reject) sending failed", "Sending notification mail to {$mail['recipients']} failed!\n" . $e->errorMessage(), 2);
return false;
}
# write log for ok
updateLogTable("IP request response mail (confirm,reject) sent ok", "Sending notification mail to {$mail['recipients']} succeeded!", 0);
return true;
}
开发者ID:martinsv,项目名称:phpipam,代码行数:89,代码来源:functions-mail.php
示例7: getActiveUserDetails
<?php
/**
*
* Display usermenu on top right
*
*/
/* get username */
$ipamusername = $_SESSION['ipamusername'];
$userDetails = getActiveUserDetails();
?>
<div class="container-fluid">
<div class="input-group" id="searchForm">
<form id="userMenuSearch">
<input type="text" class="form-control searchInput input-sm" name='ip' placeholder='<?php
print _('Search string');
?>
' type='text' value='<?php
print $_REQUEST['ip'];
?>
'>
</form>
<span class="input-group-btn">
<button class="btn btn-default btn-sm searchSubmit" type="button"><?php
print _('Search');
?>
</button>
</span>
开发者ID:btorresgil,项目名称:phpipam,代码行数:30,代码来源:userMenu.php
示例8: 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
示例9: updateLogTable
/**
* Update log table
*/
function updateLogTable($command, $details = NULL, $severity = 0)
{
global $db;
# get variables from config file
$database = new database($db['host'], $db['user'], $db['pass'], $db['name']);
/* set variable */
$date = date("Y-m-d H:i:s");
$user = getActiveUserDetails();
$user = $user['username'];
/* set query */
$query = 'insert into logs ' . "\n";
$query .= '(`severity`, `date`,`username`,`ipaddr`,`command`,`details`)' . "\n";
$query .= 'values' . "\n";
$query .= '("' . $severity . '", "' . $date . '", "' . $user . '", "' . $_SERVER['REMOTE_ADDR'] . '", "' . $command . '", "' . $details . '");';
/* execute */
try {
$database->executeMultipleQuerries($query);
} catch (Exception $e) {
$error = $e->getMessage();
die('<div class="alert alert-error">' . _('Error') . ': ' . $error . '</div>');
}
return true;
}
开发者ID:krys1976,项目名称:phpipam-1,代码行数:26,代码来源:functions-tools.php
示例10: 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
注:本文中的getActiveUserDetails函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论