Preparation for removing the $username parameter from db_log()

(will be detected by authentication_get_username() instead)

scripts/postfixadmin-cli.php:
- define ("POSTFIXADMIN_CLI", 1) (we have no session running and need a
  way to tell authentication_get_username() that this is a CLI access)

functions.inc.php:
- authentication_get_username(): check for POSTFIXADMIN_CLI constant,
  return 'CLI' if set
  (hmmm, do we need a similar thing for XMLRPC?)
- db_log(): override $username parameter with authentication_get_username()
  (removing it from function parameters will be my next big commit)


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

@ -27,6 +27,11 @@ $version = '2.4 develop';
function authentication_get_username() function authentication_get_username()
{ {
global $CONF; global $CONF;
if (defined('POSTFIXADMIN_CLI')) {
return 'CLI';
}
if (!isset($_SESSION['sessid'])) { if (!isset($_SESSION['sessid'])) {
header ("Location: " . $CONF['postfix_admin_url'] . "/login.php"); header ("Location: " . $CONF['postfix_admin_url'] . "/login.php");
exit(0); exit(0);
@ -1828,6 +1833,8 @@ function db_log ($username,$domain,$action,$data)
global $table_log; global $table_log;
$REMOTE_ADDR = getRemoteAddr(); $REMOTE_ADDR = getRemoteAddr();
$username = authentication_get_username();
$action_list = array( $action_list = array(
'create_alias', 'edit_alias', 'edit_alias_state', 'delete_alias', 'create_alias', 'edit_alias', 'edit_alias_state', 'delete_alias',
'create_mailbox', 'edit_mailbox', 'edit_mailbox_state', 'delete_mailbox', 'create_mailbox', 'edit_mailbox', 'edit_mailbox_state', 'delete_mailbox',

@ -557,6 +557,7 @@ class PostfixAdmin {
} }
define ("POSTFIXADMIN_CLI", 1);
$dispatcher = new PostfixAdmin($argv); $dispatcher = new PostfixAdmin($argv);

Loading…
Cancel
Save