Support fallback on url_param()

This commit is contained in:
Chris 2018-09-10 14:16:50 +01:00
parent d97936e258
commit 6a80c10f70
2 changed files with 9 additions and 6 deletions

View File

@ -144,7 +144,9 @@ sub get_enum_values {
# formatdesc - Must be provided if formattest is provided. A description of why not # formatdesc - Must be provided if formattest is provided. A description of why not
# matching formattest fails the validation. # matching formattest fails the validation.
# encode - if set to true, html characters are escaped, otherwise they are passed # encode - if set to true, html characters are escaped, otherwise they are passed
# back 'as is'. Defaults to true # back 'as is'. Defaults to true. DO NOT set this to false without a
# very good reason and without taking care to escape anything that might
# be sent back to the browser.
# #
# @param param The name of the cgi parameter to check. # @param param The name of the cgi parameter to check.
# @param settings A reference to a hash of settings to control the validation # @param settings A reference to a hash of settings to control the validation
@ -158,7 +160,7 @@ sub validate_string {
my $settings = shift; my $settings = shift;
# Grab the parameter value, fall back on the default if it hasn't been set. # Grab the parameter value, fall back on the default if it hasn't been set.
my $text = $self -> {"cgi"} -> param($param); my $text = $self -> {"cgi"} -> param($param) // $self -> {"cgi"} -> url_param($param);
$text = Encode::decode("utf8", $text) if(!Encode::is_utf8($text)); $text = Encode::decode("utf8", $text) if(!Encode::is_utf8($text));
# Handle the situation where the parameter has not been provided at all # Handle the situation where the parameter has not been provided at all
@ -246,7 +248,7 @@ sub validate_numeric {
if(!defined($settings -> {"default"})); if(!defined($settings -> {"default"}));
# Grab the parameter value, fall back on the default if it hasn't been set. # Grab the parameter value, fall back on the default if it hasn't been set.
my $value = $self -> {"cgi"} -> param($param); my $value = $self -> {"cgi"} -> param($param) // $self -> {"cgi"} -> url_param($param);
$value = Encode::decode("utf8", $value) if(!Encode::is_utf8($value)); $value = Encode::decode("utf8", $value) if(!Encode::is_utf8($value));
if(!defined($value)) { if(!defined($value)) {
if($settings -> {"required"}) { if($settings -> {"required"}) {
@ -300,7 +302,7 @@ sub validate_options {
my $param = shift; my $param = shift;
my $settings = shift; my $settings = shift;
my $value = $self -> {"cgi"} -> param($param); my $value = $self -> {"cgi"} -> param($param) // $self -> {"cgi"} -> url_param($param);
$value = Encode::decode("utf8", $value) if(!Encode::is_utf8($value)); $value = Encode::decode("utf8", $value) if(!Encode::is_utf8($value));
# Bomb if the value is not set and it is required. # Bomb if the value is not set and it is required.
@ -356,7 +358,7 @@ sub validate_htmlarea {
my $settings = shift; my $settings = shift;
# first we need the textarea contents... # first we need the textarea contents...
my $text = $self -> {"cgi"} -> param($param); my $text = $self -> {"cgi"} -> param($param) // $self -> {"cgi"} -> url_param($param);
$text = Encode::decode("utf8", $text) if(!Encode::is_utf8($text)); $text = Encode::decode("utf8", $text) if(!Encode::is_utf8($text));
# Convert anything that might cause problems to html entities. # Convert anything that might cause problems to html entities.

View File

@ -872,7 +872,8 @@ IMAGE_PATH = mdfiles
# code is scanned, but not when the output code is generated. If lines are added # code is scanned, but not when the output code is generated. If lines are added
# or removed, the anchors will not be placed correctly. # or removed, the anchors will not be placed correctly.
INPUT_FILTER = doxygen-filter-perl #INPUT_FILTER = doxygen-filter-perl
INPUT_FILTER = doxygenfilter
# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
# basis. Doxygen will compare the file name with each pattern and apply the # basis. Doxygen will compare the file name with each pattern and apply the