Merge branch 'mbstring-check' into release
commit
d42630c369
|
@ -2898,8 +2898,13 @@ class H5PContentValidator {
|
|||
|
||||
// Check if string is within allowed length
|
||||
if (isset($semantics->maxLength)) {
|
||||
if (!extension_loaded('mbstring')) {
|
||||
$this->h5pF->setErrorMessage($this->h5pF->t('The mbstring PHP extension is not loaded. H5P need this to function properly'), 'error');
|
||||
}
|
||||
else {
|
||||
$text = mb_substr($text, 0, $semantics->maxLength);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if string is according to optional regexp in semantics
|
||||
if (!($text === '' && isset($semantics->optional) && $semantics->optional) && isset($semantics->regexp)) {
|
||||
|
@ -2948,7 +2953,11 @@ class H5PContentValidator {
|
|||
// file name, 2. testing against a returned error array that could
|
||||
// never be more than 1 element long anyway, 3. recreating the regex
|
||||
// for every file.
|
||||
if (!preg_match($wl_regex, mb_strtolower($file))) {
|
||||
if (!extension_loaded('mbstring')) {
|
||||
$this->h5pF->setErrorMessage($this->h5pF->t('The mbstring PHP extension is not loaded. H5P need this to function properly'), 'error');
|
||||
$valid = FALSE;
|
||||
}
|
||||
else if (!preg_match($wl_regex, mb_strtolower($file))) {
|
||||
$this->h5pF->setErrorMessage($this->h5pF->t('File "%filename" not allowed. Only files with the following extensions are allowed: %files-allowed.', array('%filename' => $file, '%files-allowed' => $whitelist)), 'error');
|
||||
$valid = FALSE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue