PFAHandler:

- add validation for "enma" field type - list of options, must be given
  in column "options" as associative array (value => displayed value)



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1711 a1433add-5e2c-0410-b055-b7f2511e0802
pull/2/head
Christian Boltz 10 years ago
parent d9e30fb41b
commit 647aa39218

@ -135,6 +135,7 @@ abstract class PFAHandler {
* bool boolean (converted to 0/1, additional column _$field with yes/no)
* ts timestamp (created/modified)
* enum list of options, must be given in column "options" as array
* enma list of options, must be given in column "options" as associative array
* list like enum, but allow multiple selections
* You can use custom types, but you'll have to add handling for them in *Handler and the smarty templates
*
@ -663,6 +664,15 @@ abstract class PFAHandler {
return false;
}
/**
* check if value of an enum field is in the list of allowed values
*/
protected function _inp_enma($field, $val) {
if(array_key_exists($val, $this->struct[$field]['options'])) return true;
$this->errormsg[$field] = Config::Lang_f('invalid_value_given', $field);
return false;
}
/**
* check if a password is secure enough
*/

Loading…
Cancel
Save