PFAHandler, *Handler:

- rename _field_$field() to _validate_$field() to make the function name
  more obvious
 


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1555 a1433add-5e2c-0410-b055-b7f2511e0802
pull/2/head
Christian Boltz 11 years ago
parent d900835997
commit 1b74926afb

@ -197,7 +197,7 @@ class AdminHandler extends PFAHandler {
* compare password / password2 field
* error message will be displayed at the password2 field
*/
protected function _field_password2($field, $val) {
protected function _validate_password2($field, $val) {
return $this->compare_password_fields('password', 'password2');
}

@ -77,7 +77,7 @@ class AdminpasswordHandler extends PFAHandler {
/**
* check if old password is correct
*/
protected function _field_oldpass($field, $val) {
protected function _validate_oldpass($field, $val) {
if ( $this->login($this->id, $val) ) {
return true;
}
@ -99,7 +99,7 @@ class AdminpasswordHandler extends PFAHandler {
* compare password / password2 field
* error message will be displayed at the password2 field
*/
protected function _field_password2($field, $val) {
protected function _validate_password2($field, $val) {
return $this->compare_password_fields('password', 'password2');
}

@ -288,7 +288,7 @@ class AliasHandler extends PFAHandler {
}
*/
protected function _field_goto($field, $val) {
protected function _validate_goto($field, $val) {
if (count($val) == 0) {
# empty is ok for mailboxes - this is checked in setmore() which can clear the error message
$this->errormsg[$field] = Config::lang('pEdit_alias_goto_text_error1');

@ -291,7 +291,7 @@ class MailboxHandler extends PFAHandler {
/**
* check if quota is allowed
*/
protected function _field_quota($field, $val) {
protected function _validate_quota($field, $val) {
if ( !$this->check_quota ($val) ) {
$this->errormsg[$field] = Config::lang('pEdit_mailbox_quota_text_error');
return false;
@ -304,8 +304,8 @@ class MailboxHandler extends PFAHandler {
* - autogenerate password if enabled in config and $new
* - display password on $new if enabled in config or autogenerated
*/
protected function _field_password($field, $val) {
if (!$this->_field_password2($field, $val)) return false;
protected function _validate_password($field, $val) {
if (!$this->_validate_password2($field, $val)) return false;
if ($this->new && Config::read('generate_password') == 'YES' && $val == '') {
# auto-generate new password
@ -325,7 +325,7 @@ class MailboxHandler extends PFAHandler {
* compare password / password2 field
* error message will be displayed at the password2 field
*/
protected function _field_password2($field, $val) {
protected function _validate_password2($field, $val) {
return $this->compare_password_fields('password', 'password2');
}

@ -280,9 +280,8 @@ abstract class PFAHandler {
# TODO: warning if no validation function exists?
}
# validate based on field name (_field_$fieldname)
# TODO: rename to _validate_$key ?
$func="_field_".$key;
# validate based on field name (_validate_$fieldname)
$func="_validate_".$key;
if (method_exists($this, $func) ) {
if (!$this->{$func}($key, $values[$key])) $valid = false;
}
@ -577,7 +576,7 @@ abstract class PFAHandler {
/**
* compare two password fields
* typically called from _field_password2()
* typically called from _validate_password2()
* @param string $field1 - "password" field
* @param string $field2 - "repeat password" field
*/

Loading…
Cancel
Save