diff --git a/admin/delete.php b/admin/delete.php index 7e761cd9..2b539db0 100644 --- a/admin/delete.php +++ b/admin/delete.php @@ -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); } } } diff --git a/create-alias.php b/create-alias.php index 9e57e02c..7220b6ab 100644 --- a/create-alias.php +++ b/create-alias.php @@ -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'] . "
($fAddress -> $fGoto)
\n"; diff --git a/create-mailbox.php b/create-mailbox.php index c198a602..f29e71cd 100644 --- a/create-mailbox.php +++ b/create-mailbox.php @@ -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 */ diff --git a/delete.php b/delete.php index 68fc96be..65915ce8 100644 --- a/delete.php +++ b/delete.php @@ -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); } } } diff --git a/edit-active.php b/edit-active.php index df37678a..645de72e 100644 --- a/edit-active.php +++ b/edit-active.php @@ -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); } } } diff --git a/edit-alias.php b/edit-alias.php index 623011cd..d206070b 100644 --- a/edit-alias.php +++ b/edit-alias.php @@ -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"); diff --git a/edit-mailbox.php b/edit-mailbox.php index eda91eaa..fdfc00b1 100644 --- a/edit-mailbox.php +++ b/edit-mailbox.php @@ -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"); diff --git a/functions.inc.php b/functions.inc.php index ede63a17..837843f6 100644 --- a/functions.inc.php +++ b/functions.inc.php @@ -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')"); diff --git a/languages/cs.lang b/languages/cs.lang index fac1f05f..dedb4084 100644 --- a/languages/cs.lang +++ b/languages/cs.lang @@ -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'] = 'Nepodařilo se najít záznamy!'; diff --git a/languages/en.lang b/languages/en.lang index a2e187aa..94ecfd60 100644 --- a/languages/en.lang +++ b/languages/en.lang @@ -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'] = 'Unable to find the logs!'; diff --git a/templates/viewlog.tpl b/templates/viewlog.tpl index 06cc235c..c18c62e8 100644 --- a/templates/viewlog.tpl +++ b/templates/viewlog.tpl @@ -19,7 +19,8 @@ for ($i = 0; $i < sizeof ($list_domains); $i++) - 0) { print "\n"; @@ -46,7 +47,7 @@ for ($i = 0; $i < sizeof ($list_domains); $i++) print " \n"; print " \n"; print " \n"; - print " \n"; + print " \n"; print " \n"; print " \n"; } diff --git a/users/edit-alias.php b/users/edit-alias.php index 878af049..ed97bbd1 100644 --- a/users/edit-alias.php +++ b/users/edit-alias.php @@ -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; diff --git a/users/password.php b/users/password.php index 6ebe0210..94104990 100644 --- a/users/password.php +++ b/users/password.php @@ -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 {
" . $tLog[$i]['timestamp'] . "" . $tLog[$i]['username'] . "" . $tLog[$i]['domain'] . "" . $tLog[$i]['action'] . "" . $PALANG['pViewlog_action_'.$tLog[$i]['action'] ] . "" . $log_data . "