Skip to content
Snippets Groups Projects
Commit d0bdb3f2 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

update queryparam class

parent 5f327945
No related branches found
No related tags found
1 merge request!66php8 only; added variable types; short array syntax; remove glyphicons
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
* <VALUE> matches /^[a-z]*$/ * <VALUE> matches /^[a-z]*$/
* <code>queryparam::get('page', '/^[a-z]*$/');</code> * <code>queryparam::get('page', '/^[a-z]*$/');</code>
* *
* Ideas:
* - add more type validation
* - add regex param with chars to remove eg /[^a-z]/ to keep only lowercase letters
*
* Axel <axel.hahn@unibe.ch> * Axel <axel.hahn@unibe.ch>
* 2024-08-29 Axel php8 only; added variable types; short array syntax * 2024-08-29 Axel php8 only; added variable types; short array syntax
*/ */
...@@ -82,12 +86,9 @@ class queryparam ...@@ -82,12 +86,9 @@ class queryparam
} }
// set it to POST or GET variable // set it to POST or GET variable
$aScope = isset($_POST[$sVarname]) && $_POST[$sVarname] $aScope = isset($_POST[$sVarname])
? $_POST[$sVarname] ? $_POST
: ((isset($_GET[$sVarname]) && $_GET[$sVarname]) : $_GET
? $_GET[$sVarname]
: false
)
; ;
return self::getvar($aScope, $sVarname, $sRegexMatch, $sType); return self::getvar($aScope, $sVarname, $sRegexMatch, $sType);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment