You've already forked postfixadmin
mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2025-08-10 16:02:58 +03:00
refactor (reduce nesting)
This commit is contained in:
@@ -1759,6 +1759,11 @@ function db_update_q($table, $where, $values, $timestamp = array('modified')) {
|
|||||||
* Possible actions are defined in $LANG["pViewlog_action_$action"]
|
* Possible actions are defined in $LANG["pViewlog_action_$action"]
|
||||||
*/
|
*/
|
||||||
function db_log($domain, $action, $data) {
|
function db_log($domain, $action, $data) {
|
||||||
|
|
||||||
|
if (!Config::bool('logging')) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
$REMOTE_ADDR = getRemoteAddr();
|
$REMOTE_ADDR = getRemoteAddr();
|
||||||
|
|
||||||
$username = authentication_get_username();
|
$username = authentication_get_username();
|
||||||
@@ -1767,20 +1772,20 @@ function db_log($domain, $action, $data) {
|
|||||||
die("Invalid log action : $action"); // could do with something better?
|
die("Invalid log action : $action"); // could do with something better?
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config::bool('logging')) {
|
|
||||||
$logdata = array(
|
$logdata = array(
|
||||||
'username' => "$username ($REMOTE_ADDR)",
|
'username' => "$username ($REMOTE_ADDR)",
|
||||||
'domain' => $domain,
|
'domain' => $domain,
|
||||||
'action' => $action,
|
'action' => $action,
|
||||||
'data' => $data,
|
'data' => $data,
|
||||||
);
|
);
|
||||||
$result = db_insert('log', $logdata, array('timestamp'));
|
$result = db_insert('log', $logdata, array('timestamp'));
|
||||||
if ($result != 1) {
|
if ($result != 1) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user