Added new function parameter(). Eventually this will replace all the

optional_variable and require_variable calls anyway, but it's needed
in STABLE to fix some security issues.

See bug 1865.
This commit is contained in:
moodler
2004-09-28 15:27:08 +00:00
parent 74845319b5
commit be35eacfb3
+14
View File
@@ -57,6 +57,20 @@ function optional_variable(&$var, $default=0) {
}
}
function parameter($varname, $default=NULL) {
/// This function will replace both of the above two functions over time.
/// It returns a value for a given variable name.
if (isset($_POST[$varname])) { // POST has precedence
return $_POST[$varname];
}
if (isset($_GET[$varname])) {
return $_GET[$varname];
}
return $default;
}
function set_config($name, $value) {
/// No need for get_config because they are usually always available in $CFG