db_log patch from amsys - make db logging translatable

git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@90 a1433add-5e2c-0410-b055-b7f2511e0802
postfixadmin-2.3
David Goodwin 17 years ago
parent 8b769b41b5
commit 075d15b4b1

@ -92,7 +92,7 @@ if ($_SERVER['REQUEST_METHOD'] == "GET")
else
{
$url = "list-virtual.php?domain=$fDomain";
db_log ($SESSID_USERNAME , $fDomain, "delete alias", $fDelete);
db_log ($SESSID_USERNAME , $fDomain, 'delete_alias', $fDelete);
}
if (!$error)
@ -121,7 +121,7 @@ if ($_SERVER['REQUEST_METHOD'] == "GET")
{
$url = "list-virtual.php?domain=$fDomain";
db_query ("DELETE FROM $table_vacation WHERE email='$fDelete' AND domain='$fDomain'");
db_log ($SESSID_USERNAME, $fDomain, "delete mailbox", $fDelete);
db_log ($SESSID_USERNAME, $fDomain, 'delete_mailbox', $fDelete);
}
}
}

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

@ -240,7 +240,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
if (!$error)
{
db_log ($CONF['admin_email'], $fDomain, "create mailbox", $fUsername);
db_log ($CONF['admin_email'], $fDomain, 'create_mailbox', $fUsername);
*/
@ -260,7 +260,7 @@ TODO: this is the start of /create-mailbox code segment that was originally used
else
{
db_query('COMMIT');
db_log ($SESSID_USERNAME, $fDomain, "create mailbox", "$fUsername");
db_log ($SESSID_USERNAME, $fDomain, 'create_mailbox', "$fUsername");
/*
TODO: this is the end of /create-mailbox.php code segment
*/

@ -52,7 +52,7 @@ if ($_SERVER['REQUEST_METHOD'] == "GET")
}
else
{
db_log ($SESSID_USERNAME, $fDomain, "delete alias", $fDelete);
db_log ($SESSID_USERNAME, $fDomain, 'delete_alias', $fDelete);
}
$result = db_query ("SELECT * FROM $table_mailbox WHERE username='$fDelete' AND domain='$fDomain'");
@ -75,7 +75,7 @@ if ($_SERVER['REQUEST_METHOD'] == "GET")
else
{
db_query ("DELETE FROM $table_vacation WHERE email='$fDelete' AND domain='$fDomain'");
db_log ($SESSID_USERNAME, $fDomain, "delete mailbox", $fDelete);
db_log ($SESSID_USERNAME, $fDomain, 'delete_mailbox', $fDelete);
}
}
}

@ -50,7 +50,7 @@ if ($_SERVER['REQUEST_METHOD'] == "GET")
}
else
{
db_log ($SESSID_USERNAME, $fDomain, "edit active", $fUsername);
db_log ($SESSID_USERNAME, $fDomain, 'edit_mailbox_state', $fUsername);
}
}
if ($fAlias != '')
@ -63,7 +63,7 @@ if ($_SERVER['REQUEST_METHOD'] == "GET")
}
else
{
db_log ($SESSID_USERNAME, $fDomain, "edit alias active", $fAlias);
db_log ($SESSID_USERNAME, $fDomain, 'edit_alias_state', $fAlias);
}
}
}

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

@ -147,7 +147,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
}
else
{
db_log ($SESSID_USERNAME, $fDomain, "edit mailbox", $fUsername);
db_log ($SESSID_USERNAME, $fDomain, 'edit_mailbox', $fUsername);
if (authentication_has_role('global-admin')) {
header ("Location: list-virtual.php?domain=$fDomain");

@ -1402,13 +1402,31 @@ function db_delete ($table,$where,$delete)
// db_log
// Action: Logs actions from admin
// Call: db_log (string username, string domain, string action, string data)
//
/*
Possible actions are:
'create_alias'
'delete_alias'
'delete_mailbox'
'edit_alias'
'edit_alias_state'
'edit_mailbox'
'edit_mailbox_state'
'edit_password'
*/
function db_log ($username,$domain,$action,$data)
{
global $CONF;
global $table_log;
$REMOTE_ADDR = $_SERVER['REMOTE_ADDR'];
$action_list = array('create_alias', 'delete_alias', 'edit_alias', 'create_mailbox', 'delete_mailbox', 'edit_alias_state', 'edit_mailbox_state', 'edit_password');
if(!in_array($action, $action_list)) {
die("Invalid log action : $action"); // could do with something better?
}
if ($CONF['logging'] == 'YES')
{
$result = db_query ("INSERT INTO $table_log (timestamp,username,domain,action,data) VALUES (NOW(),'$username ($REMOTE_ADDR)','$domain','$action','$data')");

@ -169,6 +169,15 @@ $PALANG['pViewlog_domain'] = 'Doména';
$PALANG['pViewlog_action'] = 'Akce';
$PALANG['pViewlog_data'] = 'Poznámka';
$PALANG['pViewlog_action_create_alias'] = 'vytvořeno přesměrování';
$PALANG['pViewlog_action_delete_alias'] = 'smazáno přesměrování';
$PALANG['pViewlog_action_delete_mailbox'] = 'smazána schránka';
$PALANG['pViewlog_action_edit_alias'] = 'úprava přesměrování';
$PALANG['pViewlog_action_edit_alias_state'] = 'změna stavu přesměrování';
$PALANG['pViewlog_action_edit_mailbox'] = 'úprava schránky';
$PALANG['pViewlog_action_edit_mailbox_state'] = 'změna stavu schránky';
$PALANG['pViewlog_action_edit_password'] = 'změna hesla';
$PALANG['pViewlog_button'] = 'Jít';
$PALANG['pViewlog_result_error'] = '<span class="error_msg">Nepodařilo se najít záznamy!</span>';

@ -168,6 +168,15 @@ $PALANG['pViewlog_domain'] = 'Domain';
$PALANG['pViewlog_action'] = 'Action';
$PALANG['pViewlog_data'] = 'Data';
$PALANG['pViewlog_action_create_alias'] = 'create alias';
$PALANG['pViewlog_action_delete_alias'] = 'delete alias';
$PALANG['pViewlog_action_delete_mailbox'] = 'delete mailbox';
$PALANG['pViewlog_action_edit_alias'] = 'edit alias';
$PALANG['pViewlog_action_edit_alias_state'] = 'edit alias active';
$PALANG['pViewlog_action_edit_mailbox'] = 'edit mailbox';
$PALANG['pViewlog_action_edit_mailbox_state'] = 'edit mailbox active';
$PALANG['pViewlog_action_edit_password'] = 'change password';
$PALANG['pViewlog_button'] = 'Go';
$PALANG['pViewlog_result_error'] = '<span class="error_msg">Unable to find the logs!</span>';

@ -19,7 +19,8 @@ for ($i = 0; $i < sizeof ($list_domains); $i++)
</form>
</div>
<?php
<?php
if (sizeof ($tLog) > 0)
{
print "<table id=\"log_table\">\n";
@ -46,7 +47,7 @@ for ($i = 0; $i < sizeof ($list_domains); $i++)
print " <td nowrap>" . $tLog[$i]['timestamp'] . "</td>\n";
print " <td nowrap>" . $tLog[$i]['username'] . "</td>\n";
print " <td nowrap>" . $tLog[$i]['domain'] . "</td>\n";
print " <td nowrap>" . $tLog[$i]['action'] . "</td>\n";
print " <td nowrap>" . $PALANG['pViewlog_action_'.$tLog[$i]['action'] ] . "</td>\n";
print " <td nowrap>" . $log_data . "</td>\n";
print " </tr>\n";
}

@ -115,7 +115,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
}
else
{
db_log ($USERID_USERNAME, $USERID_DOMAIN, "edit alias", "$USERID_USERNAME -> $goto");
db_log ($USERID_USERNAME, $USERID_DOMAIN, 'edit_alias', "$USERID_USERNAME -> $goto");
header ("Location: main.php");
exit;

@ -76,7 +76,7 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
if ($result['rows'] == 1)
{
$tMessage = $PALANG['pPassword_result_success'];
db_log ($USERID_USERNAME, $USERID_DOMAIN, "change password", "$USERID_USERNAME");
db_log ($USERID_USERNAME, $USERID_DOMAIN, 'edit_password', "$USERID_USERNAME");
}
else
{

Loading…
Cancel
Save