From a679752aaa0dd5058081d1e39d39a1a215cd7350 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 28 Dec 2011 09:27:42 +0400 Subject: xml import: check schema-version --- include/functions.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include/functions.php') diff --git a/include/functions.php b/include/functions.php index b2ff209a0..7ea90a6f9 100644 --- a/include/functions.php +++ b/include/functions.php @@ -5127,6 +5127,22 @@ if ($doc) { $xpath = new DOMXpath($doc); + + $container = $doc->firstChild; + + if ($container && $container->hasAttribute('schema-version')) { + $schema_version = $container->getAttribute('schema-version'); + + if ($schema_version != SCHEMA_VERSION) { + print "

" .__("Could not import: incorrect schema version.") . "

"; + return; + } + + } else { + print "

" . __("Could not import: unrecognized document format.") . "

"; + return; + } + $articles = $xpath->query("//article"); foreach ($articles as $article_node) { -- cgit v1.2.3