/// majority of cases), use the stored locale specified by admin.
if (isset($_GET['lang'])) {
- if (!detect_munged_arguments($lang) and file_exists("$CFG->dirroot/lang/$lang")) {
+ if (!detect_munged_arguments($lang, 0) and file_exists("$CFG->dirroot/lang/$lang")) {
$SESSION->lang = $lang;
$SESSION->encoding = get_string('thischarset');
}
$address));
}
-function detect_munged_arguments($string) {
- if (substr_count($string, '..') > 1) { // We allow one '..' in a URL
+function detect_munged_arguments($string, $allowdots=1) {
+ if (substr_count($string, '..') > $allowdots) { // Sometimes we allow dots in references
return true;
}
if (ereg('[\|\`]', $string)) { // check for other bad characters