示例#1
0
/**
 * Checks if the param is a color
 *
 * @param string param name
 * @param string error message
 * @return boolean true if OK
 */
function param_check_color($var, $err_msg, $required = false)
{
    return param_validate($var, 'check_is_color', $required, $err_msg);
}
示例#2
0
 /**
  * Set a string parameter from a Request form value.
  *
  * @param string Dataobject parameter name
  * @param boolean true to set to NULL if empty string value
  * @param string name of function used to clean up input
  * @param string name of fucntion used to validate input (TODO)
  * @return boolean true, if value is required
  */
 function set_string_from_param($parname, $required = false, $cleanup_function = NULL, $validation_function = NULL, $error_message = NULL)
 {
     $var = $this->dbprefix . $parname;
     $value = param($var, 'string');
     if (!empty($cleanup_function)) {
         // We want to apply a cleanup function:
         $GLOBALS[$var] = $value = $cleanup_function($value);
     }
     if ($required) {
         param_check_not_empty($var);
     }
     if ($validation_function != NULL) {
         param_validate($var, $validation_function, $required, $error_message);
     }
     return $this->set($parname, $value, !$required);
 }
示例#3
0
/**
 * @param string param name
 * @return boolean true if OK
 */
function param_check_login($var, $required = false)
{
    return param_validate($var, 'check_is_login', $required, NULL);
}