mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
New param type, PARAM_SEQUENCE for 5,6,7,8,9
This commit is contained in:
parent
7b12414814
commit
0e4af1664c
1 changed files with 9 additions and 0 deletions
|
@ -200,6 +200,11 @@ define('PARAM_ALPHAEXT', 0x2000);
|
||||||
*/
|
*/
|
||||||
define('PARAM_SAFEDIR', 0x4000);
|
define('PARAM_SAFEDIR', 0x4000);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PARAM_SEQUENCE - expects a sequence of numbers like 8 to 1,5,6,4,6,8,9. Numbers and comma only.
|
||||||
|
*/
|
||||||
|
define('PARAM_SEQUENCE', 0x8000);
|
||||||
|
|
||||||
/// Page types ///
|
/// Page types ///
|
||||||
/**
|
/**
|
||||||
* PAGE_COURSE_VIEW is a definition of a page type. For more information on the page class see moodle/lib/pagelib.php.
|
* PAGE_COURSE_VIEW is a definition of a page type. For more information on the page class see moodle/lib/pagelib.php.
|
||||||
|
@ -303,6 +308,7 @@ function optional_param($parname, $default=NULL, $type=PARAM_CLEAN) {
|
||||||
* @uses PARAM_URL
|
* @uses PARAM_URL
|
||||||
* @uses PARAM_LOCALURL
|
* @uses PARAM_LOCALURL
|
||||||
* @uses PARAM_CLEANHTML
|
* @uses PARAM_CLEANHTML
|
||||||
|
* @uses PARAM_SEQUENCE
|
||||||
* @param mixed $param the variable we are cleaning
|
* @param mixed $param the variable we are cleaning
|
||||||
* @param int $type expected format of param after cleaning.
|
* @param int $type expected format of param after cleaning.
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
@ -348,6 +354,9 @@ function clean_param($param, $type) {
|
||||||
case PARAM_ALPHAEXT: // Remove everything not a-zA-Z/_-
|
case PARAM_ALPHAEXT: // Remove everything not a-zA-Z/_-
|
||||||
return eregi_replace('[^a-zA-Z/_-]', '', $param);
|
return eregi_replace('[^a-zA-Z/_-]', '', $param);
|
||||||
|
|
||||||
|
case PARAM_SEQUENCE: // Remove everything not 0-9,
|
||||||
|
return eregi_replace('[^0-9,]', '', $param);
|
||||||
|
|
||||||
case PARAM_BOOL: // Convert to 1 or 0
|
case PARAM_BOOL: // Convert to 1 or 0
|
||||||
$tempstr = strtolower($param);
|
$tempstr = strtolower($param);
|
||||||
if ($tempstr == 'on' or $tempstr == 'yes' ) {
|
if ($tempstr == 'on' or $tempstr == 'yes' ) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue