From 1b74926afb61f048bdb1d0aa9d798eb013e766fb Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Fri, 8 Nov 2013 21:26:46 +0000 Subject: [PATCH] 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 --- model/AdminHandler.php | 2 +- model/AdminpasswordHandler.php | 4 ++-- model/AliasHandler.php | 2 +- model/MailboxHandler.php | 8 ++++---- model/PFAHandler.php | 7 +++---- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/model/AdminHandler.php b/model/AdminHandler.php index cb690a87..45a31b77 100644 --- a/model/AdminHandler.php +++ b/model/AdminHandler.php @@ -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'); } diff --git a/model/AdminpasswordHandler.php b/model/AdminpasswordHandler.php index 5f609e2a..e37da304 100644 --- a/model/AdminpasswordHandler.php +++ b/model/AdminpasswordHandler.php @@ -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'); } diff --git a/model/AliasHandler.php b/model/AliasHandler.php index 07db3df2..751e47ac 100644 --- a/model/AliasHandler.php +++ b/model/AliasHandler.php @@ -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'); diff --git a/model/MailboxHandler.php b/model/MailboxHandler.php index b98f3332..553d9684 100644 --- a/model/MailboxHandler.php +++ b/model/MailboxHandler.php @@ -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'); } diff --git a/model/PFAHandler.php b/model/PFAHandler.php index 508a677b..688c2ef7 100644 --- a/model/PFAHandler.php +++ b/model/PFAHandler.php @@ -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 */