Index: core/kernel/utility/validator.php =================================================================== --- core/kernel/utility/validator.php +++ core/kernel/utility/validator.php @@ -208,7 +208,7 @@ } if ( !$res ) { - $this->SetError($field, 'bad_type', null, Array ($params['type'])); + $this->SetError($field, 'bad_type', null, Array ('type' => $params['type'])); return false; } @@ -256,7 +256,10 @@ if ( !isset($min_val) ) $min_val = '-∞'; if ( !isset($max_val) ) $max_val = '∞'; - $this->SetError($field, 'value_out_of_range', null, Array ($min_val, $max_val)); + $this->SetError($field, 'value_out_of_range', null, array( + 'min_value' => $min_val, + 'max' => $max_val + )); return false; } @@ -271,7 +274,11 @@ } if ( !$res ) { - $error_params = Array ((int)getArrayValue($params, 'min_len'), (int)getArrayValue($params, 'max_len'), mb_strlen($val)); + $error_params = array( + 'min_len' => (int)getArrayValue($params, 'min_len'), + 'max_len' => (int)getArrayValue($params, 'max_len'), + 'value' => mb_strlen($val) + ); $this->SetError($field, 'length_out_of_range', null, $error_params); return false; @@ -425,10 +432,25 @@ $msg = $this->Application->ReplaceLanguageTags($msg, $force_escape); if ( isset($this->FieldErrors[$field]['params']) ) { - return vsprintf($msg, $this->FieldErrors[$field]['params']); + $params = $this->FieldErrors[$field]['params']; } + else { + $params = array(); + } - return $msg; + $field_phrase = $this->Application->isAdmin ? 'la_fld_' . $field : 'lu_fld_' . $field; + $params['field'] = $this->Application->Phrases->GetPhrase($field_phrase); + + foreach ( $params as $param_name => $param_value ) { + $count = 0; + $msg = str_replace('{' . $param_name . '}', $param_value, $msg, $count); + + if ( $count > 0 ) { + unset($params[$param_name]); + } + } + + return vsprintf($msg, array_values($this->FieldErrors[$field]['params'])); } /** @@ -501,4 +523,4 @@ { $this->FieldErrors = Array(); } -} \ No newline at end of file +}