Prevent uninitialized $tmpPath when executing unlink().
parent
196888bf3e
commit
0a0d2dcf22
|
@ -752,6 +752,10 @@ class H5PValidator {
|
||||||
* TRUE if the .h5p file is valid
|
* TRUE if the .h5p file is valid
|
||||||
*/
|
*/
|
||||||
public function isValidPackage($skipContent = FALSE, $upgradeOnly = FALSE) {
|
public function isValidPackage($skipContent = FALSE, $upgradeOnly = FALSE) {
|
||||||
|
// Create a temporary dir to extract package in.
|
||||||
|
$tmpDir = $this->h5pF->getUploadedH5pFolderPath();
|
||||||
|
$tmpPath = $this->h5pF->getUploadedH5pPath();
|
||||||
|
|
||||||
// Check dependencies, make sure Zip is present
|
// Check dependencies, make sure Zip is present
|
||||||
if (!class_exists('ZipArchive')) {
|
if (!class_exists('ZipArchive')) {
|
||||||
$this->h5pF->setErrorMessage($this->h5pF->t('Your PHP version does not support ZipArchive.'), 'zip-archive-unsupported');
|
$this->h5pF->setErrorMessage($this->h5pF->t('Your PHP version does not support ZipArchive.'), 'zip-archive-unsupported');
|
||||||
|
@ -764,10 +768,6 @@ class H5PValidator {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a temporary dir to extract package in.
|
|
||||||
$tmpDir = $this->h5pF->getUploadedH5pFolderPath();
|
|
||||||
$tmpPath = $this->h5pF->getUploadedH5pPath();
|
|
||||||
|
|
||||||
// Only allow files with the .h5p extension:
|
// Only allow files with the .h5p extension:
|
||||||
if (strtolower(substr($tmpPath, -3)) !== 'h5p') {
|
if (strtolower(substr($tmpPath, -3)) !== 'h5p') {
|
||||||
$this->h5pF->setErrorMessage($this->h5pF->t('The file you uploaded is not a valid HTML5 Package (It does not have the .h5p file extension)'), 'missing-h5p-extension');
|
$this->h5pF->setErrorMessage($this->h5pF->t('The file you uploaded is not a valid HTML5 Package (It does not have the .h5p file extension)'), 'missing-h5p-extension');
|
||||||
|
|
Loading…
Reference in New Issue