diff --git a/lib/h5p/fonts/h5p-core-23.eot b/lib/h5p/fonts/h5p-core-23.eot index f86828cffdd..0bd4becbb81 100644 Binary files a/lib/h5p/fonts/h5p-core-23.eot and b/lib/h5p/fonts/h5p-core-23.eot differ diff --git a/lib/h5p/fonts/h5p-core-23.svg b/lib/h5p/fonts/h5p-core-23.svg index dd65f1809dd..6196c94271d 100644 --- a/lib/h5p/fonts/h5p-core-23.svg +++ b/lib/h5p/fonts/h5p-core-23.svg @@ -1,56 +1,56 @@ - + { - "fontFamily": "h5p-core-21", + "fontFamily": "h5p-core", "description": "Font generated by IcoMoon.", "majorVersion": 1, "minorVersion": 1, "version": "Version 1.1", - "fontId": "h5p-core-21", - "psName": "h5p-core-21", + "fontId": "h5p-core", + "psName": "h5p-core", "subFamily": "Regular", - "fullName": "h5p-core-21" + "fullName": "h5p-core" } - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/h5p/fonts/h5p-core-23.ttf b/lib/h5p/fonts/h5p-core-23.ttf index 3a3348adf7f..e793b63af33 100644 Binary files a/lib/h5p/fonts/h5p-core-23.ttf and b/lib/h5p/fonts/h5p-core-23.ttf differ diff --git a/lib/h5p/fonts/h5p-core-23.woff b/lib/h5p/fonts/h5p-core-23.woff index ff03f42489c..a2f93d0a212 100644 Binary files a/lib/h5p/fonts/h5p-core-23.woff and b/lib/h5p/fonts/h5p-core-23.woff differ diff --git a/lib/h5p/h5p-metadata.class.php b/lib/h5p/h5p-metadata.class.php index 2154f27a71e..572cfd0324d 100644 --- a/lib/h5p/h5p-metadata.class.php +++ b/lib/h5p/h5p-metadata.class.php @@ -107,7 +107,7 @@ abstract class H5PMetadata { switch ($config['type']) { case 'text': if ($value !== null && strlen($value) > $config['maxLength']) { - $value = \core_text::substr($value, 0, $config['maxLength']); + $value = mb_substr($value, 0, $config['maxLength']); } $types[] = '%s'; break; diff --git a/lib/h5p/h5p.classes.php b/lib/h5p/h5p.classes.php index 7b78d06e4b7..b20114df517 100644 --- a/lib/h5p/h5p.classes.php +++ b/lib/h5p/h5p.classes.php @@ -758,14 +758,11 @@ class H5PValidator { unlink($tmpPath); return FALSE; } - // Moodle: the extension mbstring is optional. - /* if (!extension_loaded('mbstring')) { $this->h5pF->setErrorMessage($this->h5pF->t('The mbstring PHP extension is not loaded. H5P need this to function properly'), 'mbstring-unsupported'); unlink($tmpPath); return FALSE; } - */ // Create a temporary dir to extract package in. $tmpDir = $this->h5pF->getUploadedH5pFolderPath(); @@ -812,7 +809,7 @@ class H5PValidator { } $totalSize += $fileStat['size']; - $fileName = \core_text::strtolower($fileStat['name']); + $fileName = mb_strtolower($fileStat['name']); if (preg_match('/(^[\._]|\/[\._])/', $fileName) !== 0) { continue; // Skip any file or folder starting with a . or _ } @@ -2435,7 +2432,7 @@ class H5PCore { // Using content dependencies foreach ($dependencies as $dependency) { if (isset($dependency['path']) === FALSE) { - $dependency['path'] = $this->getDependencyPath($dependency); + $dependency['path'] = 'libraries/' . H5PCore::libraryToString($dependency, TRUE); $dependency['preloadedJs'] = explode(',', $dependency['preloadedJs']); $dependency['preloadedCss'] = explode(',', $dependency['preloadedCss']); } @@ -2455,16 +2452,6 @@ class H5PCore { return $files; } - /** - * Get the path to the dependency. - * - * @param stdClass $dependency - * @return string - */ - protected function getDependencyPath(array $dependency): string { - return H5PCore::libraryToString($dependency, TRUE); - } - private static function getDependenciesHash(&$dependencies) { // Build hash of dependencies $toHash = array(); @@ -3215,23 +3202,21 @@ class H5PCore { * @return string */ private static function hashToken($action, $time_factor) { - global $SESSION; - - if (!isset($SESSION->h5p_token)) { + if (!isset($_SESSION['h5p_token'])) { // Create an unique key which is used to create action tokens for this session. if (function_exists('random_bytes')) { - $SESSION->h5p_token = base64_encode(random_bytes(15)); + $_SESSION['h5p_token'] = base64_encode(random_bytes(15)); } else if (function_exists('openssl_random_pseudo_bytes')) { - $SESSION->h5p_token = base64_encode(openssl_random_pseudo_bytes(15)); + $_SESSION['h5p_token'] = base64_encode(openssl_random_pseudo_bytes(15)); } else { - $SESSION->h5p_token = uniqid('', TRUE); + $_SESSION['h5p_token'] = uniqid('', TRUE); } } // Create hash and return - return substr(hash('md5', $action . $time_factor . $SESSION->h5p_token), -16, 13); + return substr(hash('md5', $action . $time_factor . $_SESSION['h5p_token']), -16, 13); } /** @@ -3318,15 +3303,12 @@ class H5PCore { $setup->disable_hub = TRUE; } - // Moodle: the extension mbstring is optional. - /* if (!extension_loaded('mbstring')) { $setup->errors[] = $this->h5pF->t( 'The mbstring PHP extension is not loaded. H5P needs this to function properly' ); $setup->disable_hub = TRUE; } - */ // Check php version >= 5.2 $php_version = explode('.', phpversion()); @@ -3674,13 +3656,12 @@ class H5PContentValidator { // Check if string is within allowed length if (isset($semantics->maxLength)) { - // Moodle: the extension mbstring is optional. - /* if (!extension_loaded('mbstring')) { $this->h5pF->setErrorMessage($this->h5pF->t('The mbstring PHP extension is not loaded. H5P need this to function properly'), 'mbstring-unsupported'); } - */ - $text = \core_text::substr($text, 0, $semantics->maxLength); + else { + $text = mb_substr($text, 0, $semantics->maxLength); + } } // Check if string is according to optional regexp in semantics @@ -3730,14 +3711,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. - // Moodle: the extension mbstring is optional. - /* if (!extension_loaded('mbstring')) { $this->h5pF->setErrorMessage($this->h5pF->t('The mbstring PHP extension is not loaded. H5P need this to function properly'), 'mbstring-unsupported'); $valid = FALSE; } - */ - if (!preg_match($wl_regex, \core_text::strtolower($file))) { + 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)), 'not-in-whitelist'); $valid = FALSE; } @@ -4279,7 +4257,7 @@ class H5PContentValidator { return '<'; } - if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9\-]+)([^>]*)>?|()$%', $string, $matches)) { + if (!preg_match('%^<\s*(/\s*)?([a-zA-Z0-9\-]+)\s*([^>]*)>?|()$%', $string, $matches)) { // Seriously malformed. return ''; } @@ -4341,7 +4319,13 @@ class H5PContentValidator { // Attribute name, href for instance. if (preg_match('/^([-a-zA-Z]+)/', $attr, $match)) { $attrName = strtolower($match[1]); - $skip = ($attrName == 'style' || substr($attrName, 0, 2) == 'on'); + $skip = ( + $attrName == 'style' || + substr($attrName, 0, 2) == 'on' || + substr($attrName, 0, 1) == '-' || + // Ignore long attributes to avoid unnecessary processing overhead. + strlen($attrName) > 96 + ); $working = $mode = 1; $attr = preg_replace('/^[-a-zA-Z]+/', '', $attr); } diff --git a/lib/h5p/images/h5p.svg b/lib/h5p/images/h5p.svg index 9ef61ae8fb9..07191aa8b2a 100644 --- a/lib/h5p/images/h5p.svg +++ b/lib/h5p/images/h5p.svg @@ -2,7 +2,7 @@ + viewBox="0 0 345 150" enable-background="new 0 0 345 150" xml:space="preserve"> \ + var $dialog = H5P.jQuery('