Merge remote-tracking branch 'svnexport/master'

pull/2/head
David Goodwin 10 years ago
commit 986cc30224

@ -9,6 +9,19 @@
# Last update: # Last update:
# $Id$ # $Id$
SVN changes since 3.0 beta1 (2.91)
----------------------------------
- AliasHandler: don't clean goto field when making alias inactive (bug#316)
- list-virtual: display quota even if $CONF[used_quotas] == NO (bug#307)
- vacation.pl: fix postgresql queries in vacation.pl (bug#315)
- fix query in AliasHandler getList which caused an empty list on some
systems (bug#313)
- fetchmail.pl: fix ssl extra options (cert check, cert path, fingerprint)
- fix logging (run setup.php to fix old log entries) (bug#317)
- fetchmail.php: change error_reporting() to exclude E_NOTICE (bug#322)
- fr.lang translation update (patch#123)
Version 3.0 beta1 (2.91) - 2014/05/06 - SVN r1670 Version 3.0 beta1 (2.91) - 2014/05/06 - SVN r1670
------------------------------------------------- -------------------------------------------------

@ -37,6 +37,11 @@ require_once('common.php');
authentication_require_role('admin'); authentication_require_role('admin');
# workaround for https://sourceforge.net/p/postfixadmin/bugs/322/
# TODO: convert fetchmail.php to FetchmailHandler
$old_error_reporting = error_reporting();
error_reporting($old_error_reporting ^ E_NOTICE);
$extra_options = 0; $extra_options = 0;
if ($CONF['fetchmail_extra_options'] == 'YES') $extra_options = 1; if ($CONF['fetchmail_extra_options'] == 'YES') $extra_options = 1;

@ -311,6 +311,7 @@ Common parameters:
--patch --patch
patch the language file directly (instead of displaying the patch) patch the language file directly (instead of displaying the patch)
(use --forcepatch if --patch fails with rejections)
--nocleanup --nocleanup
keep all temp files (for debugging) keep all temp files (for debugging)

@ -138,6 +138,11 @@ class AliasHandler extends PFAHandler {
return $retval; return $retval;
} }
protected function domain_from_id() {
list(/*NULL*/,$domain) = explode('@', $this->id);
return $domain;
}
protected function validate_new_id() { protected function validate_new_id() {
if ($this->id == '') { if ($this->id == '') {
$this->errormsg[$this->id_field] = Config::lang('pCreate_alias_address_text_error1'); $this->errormsg[$this->id_field] = Config::lang('pCreate_alias_address_text_error1');

@ -49,7 +49,6 @@ class CliHelp extends Shell {
"\t\t".sprintf("%-20s %s", "add: ", "Add a $module.")."\n". "\t\t".sprintf("%-20s %s", "add: ", "Add a $module.")."\n".
"\t\t".sprintf("%-20s %s", "update: ", "Update a $module.")."\n". "\t\t".sprintf("%-20s %s", "update: ", "Update a $module.")."\n".
"\t\t".sprintf("%-20s %s", "delete: ", "Delete a $module")."\n". "\t\t".sprintf("%-20s %s", "delete: ", "Delete a $module")."\n".
"\t\t".sprintf("%-20s %s", "password: ", "Changes the password for a $module")."\n",
'address' => "\t[<address>]\n" . 'address' => "\t[<address>]\n" .
"\t\tA address of recipient.\n", "\t\tA address of recipient.\n",
); );

@ -51,19 +51,22 @@ class MailboxHandler extends PFAHandler {
return false; return false;
} }
list(/*NULL*/,$domain) = explode('@', $this->id);
if ($this->new) { if ($this->new) {
$currentquota = 0; $currentquota = 0;
} else { } else {
$currentquota = $this->result['quotabytes']; # parent::init called ->view() $currentquota = $this->result['quotabytes']; # parent::init called ->view()
} }
$this->updateMaxquota($domain, $currentquota); $this->updateMaxquota($this->domain, $currentquota);
return true; # still here? good. return true; # still here? good.
} }
protected function domain_from_id() {
list(/*NULL*/,$domain) = explode('@', $this->id);
return $domain;
}
/** /**
* show max allowed quota in quota field description * show max allowed quota in quota field description
* @param string - domain * @param string - domain

@ -51,6 +51,10 @@ abstract class PFAHandler {
# filled in init() # filled in init()
protected $id = null; protected $id = null;
# the domain of the current item (used for logging)
# filled in domain_from_id() via init()
protected $domain = null;
# structure of the database table, list, edit form etc. # structure of the database table, list, edit form etc.
# filled in initStruct() # filled in initStruct()
protected $struct = array(); protected $struct = array();
@ -189,17 +193,21 @@ abstract class PFAHandler {
} elseif (!$this->validate_new_id() ) { } elseif (!$this->validate_new_id() ) {
# errormsg filled by validate_new_id() # errormsg filled by validate_new_id()
return false; return false;
} else { # } else {
return true; # return true;
} }
} else { # edit mode } else { # edit mode
if (!$exists) { if (!$exists) {
$this->errormsg[$this->id_field] = Config::lang($this->msg['error_does_not_exist']); $this->errormsg[$this->id_field] = Config::lang($this->msg['error_does_not_exist']);
return false; return false;
} else { # } else {
return true; # return true;
} }
} }
$this->domain = $this->domain_from_id();
return true;
} }
/** /**
@ -210,6 +218,21 @@ abstract class PFAHandler {
*/ */
abstract protected function validate_new_id(); abstract protected function validate_new_id();
/**
* called by init() if $this->id != $this->domain_field
* must be overridden if $id_field != $domain_field
* @return string the domain to use for logging
*/
protected function domain_from_id() {
if ($this->id_field == $this->domain_field) {
return $this->id;
} elseif ($this->domain_field == "") {
return "";
} else {
die('You must override domain_from_id()!');
}
}
/** /**
* web interface can prefill some fields * web interface can prefill some fields
* if a _prefill_$field method exists, call it (it can for example modify $struct) * if a _prefill_$field method exists, call it (it can for example modify $struct)
@ -367,7 +390,7 @@ abstract class PFAHandler {
$result = $this->storemore(); $result = $this->storemore();
# db_log() even if storemore() failed # db_log() even if storemore() failed
db_log ($this->id, $this->msg['logname'], ""); db_log ($this->domain, $this->msg['logname'], $this->id);
if ($result) { if ($result) {
# return success message # return success message

@ -1347,6 +1347,19 @@ function upgrade_1610() {
_db_add_field('vacation', 'interval_time', '{INT}', 'domain'); _db_add_field('vacation', 'interval_time', '{INT}', 'domain');
} }
function upgrade_1685_mysql() {
# Fix existing log entries broken by https://sourceforge.net/p/postfixadmin/bugs/317/
$table = table_by_key('log');
db_query_parsed("UPDATE $table SET data = domain WHERE data = '' AND domain LIKE '%@%'");
db_query_parsed("UPDATE $table SET domain=SUBSTRING_INDEX(domain, '@', -1) WHERE domain=data;");
}
function upgrade_1685_pgsql() {
$table = table_by_key('log');
db_query_parsed("UPDATE $table SET data = domain WHERE data = '' AND domain LIKE '%@%'");
db_query_parsed("UPDATE $table SET domain=SPLIT_PART(domain, '@', 2) WHERE domain=data;");
}
# TODO MySQL: # TODO MySQL:
# - various varchar fields do not have a default value # - various varchar fields do not have a default value
# https://sourceforge.net/projects/postfixadmin/forums/forum/676076/topic/3419725 # https://sourceforge.net/projects/postfixadmin/forums/forum/676076/topic/3419725

Loading…
Cancel
Save