Files
postfixadmin/model/PFAHandler.php
T
Christian Boltz 7ac37cfbff templates/editform.tpl:
- new file
- generic edit form template that uses $struct to render the form

templates/admin_edit-domain.tpl:
- deleted, obsoleted by editform.tpl

create-domain.php
- use new editform.tpl
- use $errormsg array instead of join't $errortext
- store/move errors related to a display_in_form field in $fielderror
  (they will be displayed next to the field)
- display remaining error messages (not related to a field) with 
  flash_error()
- use "value_$key" instead of "t$Key" as smarty variable name for field 
  values

model/DomainHandler.php
- store error messages in $this->errormsg[$field] (instead of $this->errormsg[])
- fix label for default_aliases

model/PFAHandler.php:
- store error messages in $this->errormsg[$field] (instead of $this->errormsg[])



git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1252 a1433add-5e2c-0410-b055-b7f2511e0802
2011-10-30 20:27:08 +00:00

45 lines
1.2 KiB
PHP

<?php
class PFAHandler {
/**
* @return return value of previously called method
*/
public function result() {
return $this->return;
}
/**
* functions for basic input validation
*/
function _inp_num($field, $val) {
$valid = is_numeric($val);
if ($val < -1) $valid = false;
if (!$valid) $this->errormsg[$field] = "$field must be numeric";
return $valid;
# return (int)($val);
}
function _inp_bool($field, $val) {
if ($val == "0" || $val == "1") return true;
$this->errormsg[$field] = "$field must be boolean";
return false;
# return $val ? db_get_boolean(true): db_get_boolean(false);
}
function _inp_enum($field, $val) {
if(in_array($val, $this->struct[$field]['options'])) return true;
$this->errormsg[$field] = "Invalid parameter given for $field";
return false;
}
function _inp_password($field, $val){
# TODO: fetchmail specific. Not suited for mailbox/admin passwords.
$this->errormsg[$field] = "_inp_password not implemented yet";
return false;
# return base64_encode($val);
}
}
/* vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: */