From 33ac37a092194114bad76d84e3db6bd0da34a64b Mon Sep 17 00:00:00 2001 From: Denis Ryabov Date: Sun, 9 May 2021 18:32:53 +0300 Subject: [PATCH 1/3] Add "type" attribute to "schemapath" node --- .../libraries/rules/xmlmanifest/dtd_component.json | 3 +++ .../com_jedchecker/libraries/rules/xmlmanifest/dtd_file.json | 3 +++ .../libraries/rules/xmlmanifest/dtd_library.json | 3 +++ .../libraries/rules/xmlmanifest/dtd_template.json | 3 +++ 4 files changed, 12 insertions(+) diff --git a/administrator/components/com_jedchecker/libraries/rules/xmlmanifest/dtd_component.json b/administrator/components/com_jedchecker/libraries/rules/xmlmanifest/dtd_component.json index 5ca36f4..54d4037 100644 --- a/administrator/components/com_jedchecker/libraries/rules/xmlmanifest/dtd_component.json +++ b/administrator/components/com_jedchecker/libraries/rules/xmlmanifest/dtd_component.json @@ -104,6 +104,9 @@ "charset", "driver" ], + "schemapath": [ + "type" + ], "server": [ "name", "priority", diff --git a/administrator/components/com_jedchecker/libraries/rules/xmlmanifest/dtd_file.json b/administrator/components/com_jedchecker/libraries/rules/xmlmanifest/dtd_file.json index 902338e..7400979 100644 --- a/administrator/components/com_jedchecker/libraries/rules/xmlmanifest/dtd_file.json +++ b/administrator/components/com_jedchecker/libraries/rules/xmlmanifest/dtd_file.json @@ -73,6 +73,9 @@ "charset", "driver" ], + "schemapath": [ + "type" + ], "server": [ "name", "priority", diff --git a/administrator/components/com_jedchecker/libraries/rules/xmlmanifest/dtd_library.json b/administrator/components/com_jedchecker/libraries/rules/xmlmanifest/dtd_library.json index b886e4f..a5917ad 100644 --- a/administrator/components/com_jedchecker/libraries/rules/xmlmanifest/dtd_library.json +++ b/administrator/components/com_jedchecker/libraries/rules/xmlmanifest/dtd_library.json @@ -82,6 +82,9 @@ "charset", "driver" ], + "schemapath": [ + "type" + ], "server": [ "name", "priority", diff --git a/administrator/components/com_jedchecker/libraries/rules/xmlmanifest/dtd_template.json b/administrator/components/com_jedchecker/libraries/rules/xmlmanifest/dtd_template.json index dbceb31..60ddfd6 100644 --- a/administrator/components/com_jedchecker/libraries/rules/xmlmanifest/dtd_template.json +++ b/administrator/components/com_jedchecker/libraries/rules/xmlmanifest/dtd_template.json @@ -106,6 +106,9 @@ "charset", "driver" ], + "schemapath": [ + "type" + ], "server": [ "name", "priority", From 88969d8fc426214c7e7b2daf75edde61a760fffc Mon Sep 17 00:00:00 2001 From: Denis Ryabov Date: Tue, 11 May 2021 21:04:56 +0300 Subject: [PATCH 2/3] typo --- .../components/com_jedchecker/libraries/rules/xmlmanifest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_jedchecker/libraries/rules/xmlmanifest.php b/administrator/components/com_jedchecker/libraries/rules/xmlmanifest.php index 5d4f119..cbe2cd4 100644 --- a/administrator/components/com_jedchecker/libraries/rules/xmlmanifest.php +++ b/administrator/components/com_jedchecker/libraries/rules/xmlmanifest.php @@ -220,7 +220,7 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule /** * @param SimpleXMLElement $node XML node object - * @param string $ruleset rulest name in the DTD array + * @param string $ruleset ruleset name in the DTD array * * @return void */ From 373f47482e1856ddeefa150721dc663bda0e4876 Mon Sep 17 00:00:00 2001 From: Denis Ryabov Date: Tue, 11 May 2021 21:05:54 +0300 Subject: [PATCH 3/3] switch to JEDCheckerHelper::findManifests --- .../com_jedchecker/libraries/rules/xmlmanifest.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/administrator/components/com_jedchecker/libraries/rules/xmlmanifest.php b/administrator/components/com_jedchecker/libraries/rules/xmlmanifest.php index cbe2cd4..0eaf349 100644 --- a/administrator/components/com_jedchecker/libraries/rules/xmlmanifest.php +++ b/administrator/components/com_jedchecker/libraries/rules/xmlmanifest.php @@ -13,6 +13,9 @@ defined('_JEXEC') or die('Restricted access'); // Include the rule base class require_once JPATH_COMPONENT_ADMINISTRATOR . '/models/rule.php'; +// Include the helper class +require_once JPATH_COMPONENT_ADMINISTRATOR . '/libraries/helper.php'; + /** * class JedcheckerRulesXMLManifest @@ -109,7 +112,7 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule public function check() { // Find all XML files of the extension - $files = JFolder::files($this->basedir, '\.xml$', true, true); + $files = JEDCheckerHelper::findManifests($this->basedir); // Iterate through all the xml files foreach ($files as $file) @@ -137,12 +140,6 @@ class JedcheckerRulesXMLManifest extends JEDcheckerRule return false; } - // Check if this is an extension manifest - if ($xml->getName() !== 'extension') - { - return false; - } - // Check extension type $type = (string) $xml['type'];