diff --git a/h5p.classes.php b/h5p.classes.php index 93c4213..71e95c4 100644 --- a/h5p.classes.php +++ b/h5p.classes.php @@ -1055,24 +1055,27 @@ class H5PValidator { $valid = $this->isValidRequiredH5pData($h5pData, $required, $library_name); $valid = $this->isValidOptionalH5pData($h5pData, $optional, $library_name) && $valid; - // Test library core version requirement. If no requirement is set, - // this implicitly means 1.0, which shall work on newer versions - // too. + // Check the library's required API version of Core. + // If no requirement is set this implicitly means 1.0. if (isset($h5pData['coreApi']) && !empty($h5pData['coreApi'])) { if (($h5pData['coreApi']['majorVersion'] > H5PCore::$coreApi['majorVersion']) || - (($h5pData['coreApi']['majorVersion'] == H5PCore::$coreApi['majorVersion']) && - ($h5pData['coreApi']['minorVersion'] > H5PCore::$coreApi['minorVersion']))) - { + ( ($h5pData['coreApi']['majorVersion'] == H5PCore::$coreApi['majorVersion']) && + ($h5pData['coreApi']['minorVersion'] > H5PCore::$coreApi['minorVersion']) )) { + $this->h5pF->setErrorMessage( - $this->h5pF->t('The library "%libraryName" requires H5P %requiredVersion, but only H5P %coreApi is installed.', - array( - '%libraryName' => $library_name, - '%requiredVersion' => $h5pData['coreApi']['majorVersion'] . '.' . $h5pData['coreApi']['minorVersion'], - '%coreApi' => H5PCore::$coreApi['majorVersion'] . '.' . H5PCore::$coreApi['minorVersion'] - ))); + $this->h5pF->t('The system was unable to install the %component component from the package, it requires a newer version of the H5P plugin. This site is currently running version %current, whereas the required version is %required or higher. You should consider upgrading and then try again.', + array( + '%component' => (isset($h5pData['title']) ? $h5pData['title'] : $library_name), + '%current' => H5PCore::$coreApi['majorVersion'] . '.' . H5PCore::$coreApi['minorVersion'], + '%required' => $h5pData['coreApi']['majorVersion'] . '.' . $h5pData['coreApi']['minorVersion'] + ) + ) + ); + $valid = false; } } + return $valid; } @@ -2469,7 +2472,9 @@ class H5PCore { // Determine remote/visitor origin if ($type === 'network' || - ($type === 'local' && !preg_match('/^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*\:)*?:?0*1$/i', $_SERVER['REMOTE_ADDR']))) { + ($type === 'local' && + isset($_SERVER['REMOTE_ADDR']) && + !preg_match('/^localhost$|^127(?:\.[0-9]+){0,2}\.[0-9]+$|^(?:0*\:)*?:?0*1$/i', $_SERVER['REMOTE_ADDR']))) { if (isset($_SERVER['REMOTE_ADDR']) && filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE)) { // Internet $this->h5pF->setOption('site_type', 'internet'); diff --git a/js/h5p-data-view.js b/js/h5p-data-view.js index 860625f..0edfc56 100644 --- a/js/h5p-data-view.js +++ b/js/h5p-data-view.js @@ -108,11 +108,11 @@ var H5PDataView = (function ($) { else { // Update table data self.updateTable(data.rows); - - // Update pagination widget - self.updatePagination(data.num); } + // Update pagination widget + self.updatePagination(data.num); + if (self.loaded !== undefined) { self.loaded(); } @@ -255,7 +255,6 @@ var H5PDataView = (function ($) { var remove = function () { self.facets[col].$tag.remove(); delete self.facets[col]; - self.offset = 0; // Reset to page 1 self.loadData(); }; @@ -276,9 +275,6 @@ var H5PDataView = (function ($) { } }); - // Reset to page 1 - self.offset = 0; - // Load data with new filter self.loadData(); };