Remove $username parameter from db_log()

functions.inc.php:
- remove $username parameter from function db_log()
  (now auto-detected with authentication_get_username())

various files:
- remove hardcoded username ('CONSOLE', $username etc.) in db_log() calls


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@966 a1433add-5e2c-0410-b055-b7f2511e0802
pull/2/head
Christian Boltz 14 years ago
parent ba8fc89347
commit c97e5224dc

@ -124,7 +124,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
$tMessage = $PALANG['pCreate_alias_domain_error3']; $tMessage = $PALANG['pCreate_alias_domain_error3'];
} }
else { else {
db_log ($SESSID_USERNAME, $fAliasDomain, 'create_alias_domain', "$fAliasDomain -> $fTargetDomain"); db_log ($fAliasDomain, 'create_alias_domain', "$fAliasDomain -> $fTargetDomain");
flash_info($PALANG['pCreate_alias_domain_success']); flash_info($PALANG['pCreate_alias_domain_success']);
# we would have to update the list of domains available for aliasing. Doing a redirect is easier. # we would have to update the list of domains available for aliasing. Doing a redirect is easier.

@ -181,7 +181,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
$tMessage = $PALANG['pCreate_alias_result_error'] . "<br />($fAddress -> $fGoto)<br />\n"; $tMessage = $PALANG['pCreate_alias_result_error'] . "<br />($fAddress -> $fGoto)<br />\n";
} }
else { else {
db_log ($SESSID_USERNAME, $fDomain, 'create_alias', "$fAddress -> $fGoto"); db_log ($fDomain, 'create_alias', "$fAddress -> $fGoto");
$tDomain = $fDomain; $tDomain = $fDomain;
$tMessage = $PALANG['pCreate_alias_result_success'] . "<br />($fAddress -> $fGoto)<br />\n"; $tMessage = $PALANG['pCreate_alias_result_success'] . "<br />($fAddress -> $fGoto)<br />\n";

@ -224,7 +224,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
else else
{ {
db_query('COMMIT'); db_query('COMMIT');
db_log ($SESSID_USERNAME, $fDomain, 'create_mailbox', "$fUsername"); db_log ($fDomain, 'create_mailbox', "$fUsername");
$tDomain = $fDomain; $tDomain = $fDomain;
$tQuota = $CONF['maxquota']; $tQuota = $CONF['maxquota'];

@ -119,7 +119,7 @@ elseif ($fTable == "alias" or $fTable == "mailbox")
$result = db_query("SELECT * FROM $table_alias WHERE address = '$fDelete' AND domain = '$fDomain'"); $result = db_query("SELECT * FROM $table_alias WHERE address = '$fDelete' AND domain = '$fDomain'");
if($result['rows'] == 1) { if($result['rows'] == 1) {
$result = db_query ("DELETE FROM $table_alias WHERE address='$fDelete' AND domain='$fDomain'"); $result = db_query ("DELETE FROM $table_alias WHERE address='$fDelete' AND domain='$fDomain'");
db_log ($SESSID_USERNAME, $fDomain, 'delete_alias', $fDelete); db_log ($fDomain, 'delete_alias', $fDelete);
} }
/* is there a mailbox? if do delete it from orbit; it's the only way to be sure */ /* is there a mailbox? if do delete it from orbit; it's the only way to be sure */
$result = db_query ("SELECT * FROM $table_mailbox WHERE username='$fDelete' AND domain='$fDomain'"); $result = db_query ("SELECT * FROM $table_mailbox WHERE username='$fDelete' AND domain='$fDomain'");
@ -142,7 +142,7 @@ elseif ($fTable == "alias" or $fTable == "mailbox")
} }
$tMessage.=')</span>'; $tMessage.=')</span>';
} }
db_log ($SESSID_USERNAME, $fDomain, 'delete_mailbox', $fDelete); db_log ($fDomain, 'delete_mailbox', $fDelete);
} }
$result = db_query("SELECT * FROM $table_vacation WHERE email = '$fDelete' AND domain = '$fDomain'"); $result = db_query("SELECT * FROM $table_vacation WHERE email = '$fDelete' AND domain = '$fDomain'");
if($result['rows'] == 1) { if($result['rows'] == 1) {

@ -65,7 +65,7 @@ if ($_SERVER['REQUEST_METHOD'] == "GET")
} }
else else
{ {
db_log ($SESSID_USERNAME, $fDomain, 'edit_mailbox_state', $fUsername); db_log ($fDomain, 'edit_mailbox_state', $fUsername);
} }
} }
if ($fAlias != '') if ($fAlias != '')
@ -78,7 +78,7 @@ if ($_SERVER['REQUEST_METHOD'] == "GET")
} }
else else
{ {
db_log ($SESSID_USERNAME, $fDomain, 'edit_alias_state', $fAlias); db_log ($fDomain, 'edit_alias_state', $fAlias);
} }
} }
if ($fAliasDomain != '') if ($fAliasDomain != '')
@ -91,7 +91,7 @@ if ($_SERVER['REQUEST_METHOD'] == "GET")
} }
else else
{ {
db_log ($SESSID_USERNAME, $fDomain, 'edit_alias_domain_state', $fDomain); db_log ($fDomain, 'edit_alias_domain_state', $fDomain);
} }
} }
} }

@ -161,7 +161,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
} }
else else
{ {
db_log ($SESSID_USERNAME, $fDomain, 'edit_alias', "$fAddress -> $goto"); db_log ($fDomain, 'edit_alias', "$fAddress -> $goto");
header ("Location: list-virtual.php?domain=$fDomain"); header ("Location: list-virtual.php?domain=$fDomain");
exit; exit;

@ -160,7 +160,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
$tMessage = $PALANG['pEdit_mailbox_result_error']; $tMessage = $PALANG['pEdit_mailbox_result_error'];
} }
else { else {
db_log ($SESSID_USERNAME, $fDomain, 'edit_mailbox', $fUsername); db_log ($fDomain, 'edit_mailbox', $fUsername);
header ("Location: list-virtual.php?domain=$fDomain"); header ("Location: list-virtual.php?domain=$fDomain");
exit(0); exit(0);

@ -1809,7 +1809,7 @@ function db_rollback () {
/** /**
* db_log * db_log
* Action: Logs actions from admin * Action: Logs actions from admin
* Call: db_log (string username, string domain, string action, string data) * Call: db_log (string domain, string action, string data)
* Possible actions are: * Possible actions are:
* 'create_domain' * 'create_domain'
* 'create_alias' * 'create_alias'
@ -1827,7 +1827,7 @@ function db_rollback () {
* 'edit_mailbox_state' * 'edit_mailbox_state'
* 'edit_password' * 'edit_password'
*/ */
function db_log ($username,$domain,$action,$data) function db_log ($domain,$action,$data)
{ {
global $CONF; global $CONF;
global $table_log; global $table_log;
@ -2428,7 +2428,7 @@ function create_admin($fUsername, $fPassword, $fPassword2, $fDomains, $no_genera
# TODO: should we log creation, editing and deletion of admins? # TODO: should we log creation, editing and deletion of admins?
# Note: needs special handling in viewlog, because domain is empty # Note: needs special handling in viewlog, because domain is empty
# db_log ($SESSID_USERNAME, '', 'create_admin', "$fUsername"); # db_log ('', 'create_admin', "$fUsername");
return array( return array(
$error, $error,

@ -177,7 +177,7 @@ class AliasHandler {
if($result != 1) { if($result != 1) {
return false; return false;
} }
db_log($this->username, $domain, 'edit_alias', "$E_username -> $goto"); db_log ($domain, 'edit_alias', "$E_username -> $goto");
return true; return true;
} }
@ -226,7 +226,7 @@ class AliasHandler {
$result = db_delete('alias', 'address', $this->username); $result = db_delete('alias', 'address', $this->username);
if( $result == 1 ) { if( $result == 1 ) {
list(/*NULL*/,$domain) = explode('@', $this->username); list(/*NULL*/,$domain) = explode('@', $this->username);
db_log ('CLI', $domain, 'delete_alias', $this->username); # TODO: replace hardcoded CLI db_log ($domain, 'delete_alias', $this->username);
return true; return true;
} }
} }

@ -61,7 +61,7 @@ class DomainHandler {
if (!domain_postcreation($domain)) { if (!domain_postcreation($domain)) {
$tMessage = Lang::read('pAdminCreate_domain_error'); $tMessage = Lang::read('pAdminCreate_domain_error');
} }
db_log('CONSOLE', $domain, 'create_domain', ""); db_log ($domain, 'create_domain', "");
return true; return true;
} }
@ -94,7 +94,7 @@ class DomainHandler {
$result = db_delete('domain', 'domain', $this->username); $result = db_delete('domain', 'domain', $this->username);
if( $result == 1 ) { if( $result == 1 ) {
list(/*NULL*/,$domain) = explode('@', $this->username); list(/*NULL*/,$domain) = explode('@', $this->username);
db_log ('CLI', $domain, 'delete_domain', $this->username); # TODO: replace hardcoded CLI # TODO delete_domain is not a valid db_log keyword yet because we don't yet log add/delete domain db_log ($domain, 'delete_domain', $this->username); # TODO delete_domain is not a valid db_log keyword yet because we don't yet log add/delete domain
return true; return true;
} }
} }

@ -39,7 +39,7 @@ class UserHandler {
$result = db_assoc($result['result']); $result = db_assoc($result['result']);
if (pacrypt($old_password, $result['password']) != $result['password']) { if (pacrypt($old_password, $result['password']) != $result['password']) {
db_log ('CONSOLE', $domain, 'edit_password', "MATCH FAILURE: " . $this->username); # TODO: replace hardcoded CONSOLE - class is used by XMLRPC and users/ db_log ($domain, 'edit_password', "MATCH FAILURE: " . $this->username);
$this->errormsg[] = 'Passwords do not match'; # TODO: make translatable $this->errormsg[] = 'Passwords do not match'; # TODO: make translatable
return false; return false;
} }
@ -52,12 +52,12 @@ class UserHandler {
$result = db_update('mailbox', 'username', $this->username, $set ); $result = db_update('mailbox', 'username', $this->username, $set );
if ($result != 1) { if ($result != 1) {
db_log ('CONSOLE', $domain, 'edit_password', "FAILURE: " . $this->username); # TODO: replace hardcoded CONSOLE - class is used by XMLRPC and users/ db_log ($domain, 'edit_password', "FAILURE: " . $this->username);
$this->errormsg[] = Lang::read('pEdit_mailbox_result_error'); $this->errormsg[] = Lang::read('pEdit_mailbox_result_error');
return false; return false;
} }
db_log ('CONSOLE', $domain, 'edit_password', $this->username); # TODO: replace hardcoded CONSOLE - class is used by XMLRPC and users/ db_log ($domain, 'edit_password', $this->username);
return true; return true;
} }
@ -190,7 +190,7 @@ class UserHandler {
return false; return false;
} else { } else {
db_commit(); db_commit();
db_log ('CONSOLE', $domain, 'create_mailbox', $username); # TODO: remove hardcoded CONSOLE db_log ($domain, 'create_mailbox', $username);
if ($mail == true) if ($mail == true)
@ -259,7 +259,7 @@ class UserHandler {
$result = db_query("SELECT * FROM $table_alias WHERE address = '$E_username' AND domain = '$domain'"); $result = db_query("SELECT * FROM $table_alias WHERE address = '$E_username' AND domain = '$domain'");
if($result['rows'] == 1) { if($result['rows'] == 1) {
$result = db_delete('alias', 'address', $username); $result = db_delete('alias', 'address', $username);
db_log ('CONSOLE', $domain, 'delete_alias', $username); # TODO: remove hardcoded CONSOLE db_log ($domain, 'delete_alias', $username);
} else { } else {
$this->errormsg[] = "no alias $username"; # todo: better message, make translatable $this->errormsg[] = "no alias $username"; # todo: better message, make translatable
$error = 1; $error = 1;
@ -294,7 +294,7 @@ class UserHandler {
$error = 1; $error = 1;
# return false; # TODO: does this make sense? Or should we still cleanup vacation and vacation_notification? # return false; # TODO: does this make sense? Or should we still cleanup vacation and vacation_notification?
} }
db_log ('CONSOLE', $domain, 'delete_mailbox', $username); db_log ($domain, 'delete_mailbox', $username);
} else { } else {
$this->errormsg[] = "no mailbox $username"; # TODO: better message, make translatable $this->errormsg[] = "no mailbox $username"; # TODO: better message, make translatable
$error = 1; $error = 1;

Loading…
Cancel
Save