From 3dd234ffde17f509816cf697074cfe1ebb3d11ea Mon Sep 17 00:00:00 2001 From: Denis Ryabov Date: Tue, 16 Nov 2021 19:56:11 +0300 Subject: [PATCH 1/2] support all file etensions that Joomla is able to unpack (zip, tar, tgz, tbz2, tar.gz, tar.gzip, tar.bz2, tar.bzip2) --- .../components/com_jedchecker/controllers/uploads.php | 6 ++---- .../components/com_jedchecker/libraries/rules/xmlfiles.php | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/administrator/components/com_jedchecker/controllers/uploads.php b/administrator/components/com_jedchecker/controllers/uploads.php index 0932abb..3ef348c 100644 --- a/administrator/components/com_jedchecker/controllers/uploads.php +++ b/administrator/components/com_jedchecker/controllers/uploads.php @@ -192,11 +192,9 @@ class JedcheckerControllerUploads extends JControllerLegacy { if ($file->isFile()) { - $extension = pathinfo($file->getFilename(), PATHINFO_EXTENSION); - - if ($extension === 'zip') + if (preg_match('/\.(?:zip|tar|tgz|tbz2|tar\.(?:gz|gzip|bz2|bzip2))$/', $file->getFilename(), $matches)) { - $unzip = $file->getPath() . '/' . $file->getBasename('.' . $extension); + $unzip = $file->getPath() . '/' . $file->getBasename($matches[0]); try { diff --git a/administrator/components/com_jedchecker/libraries/rules/xmlfiles.php b/administrator/components/com_jedchecker/libraries/rules/xmlfiles.php index b436ad5..66c3a4e 100644 --- a/administrator/components/com_jedchecker/libraries/rules/xmlfiles.php +++ b/administrator/components/com_jedchecker/libraries/rules/xmlfiles.php @@ -367,7 +367,7 @@ class JedcheckerRulesXMLFiles extends JEDcheckerRule } // Extra check for unzipped files - if (preg_match('/^(.*)\.(zip|tgz|tar\.gz)$/', $filename, $matches) && is_dir($matches[1])) + if (preg_match('/^(.*)\.(?:zip|tar|tgz|tbz2|tar\.(?:gz|gzip|bz2|bzip2))$/', $filename, $matches) && is_dir($matches[1])) { continue; } From 7cf77ecd9edf4da36295451fbbeb331ed2eb2d58 Mon Sep 17 00:00:00 2001 From: Denis Ryabov Date: Tue, 16 Nov 2021 19:56:48 +0300 Subject: [PATCH 2/2] simplify a legacy code --- .../components/com_jedchecker/controllers/uploads.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/administrator/components/com_jedchecker/controllers/uploads.php b/administrator/components/com_jedchecker/controllers/uploads.php index 3ef348c..8cb7474 100644 --- a/administrator/components/com_jedchecker/controllers/uploads.php +++ b/administrator/components/com_jedchecker/controllers/uploads.php @@ -85,11 +85,7 @@ class JedcheckerControllerUploads extends JControllerLegacy } } - $filepath = $path . '/' . strtolower($file['name']); - - $object_file = new JObject($file); - $object_file->filepath = $filepath; - $file = (array) $object_file; + $file['filepath'] = $path . '/' . strtolower($file['name']); // Let us try to upload if (!JFile::upload($file['tmp_name'], $file['filepath'], false, true))