]> git.wh0rd.org Git - tt-rss.git/commitdiff
xml import: check schema-version
authorAndrew Dolgov <fox@fakecake.org>
Wed, 28 Dec 2011 05:27:42 +0000 (09:27 +0400)
committerAndrew Dolgov <fox@fakecake.org>
Wed, 28 Dec 2011 05:27:42 +0000 (09:27 +0400)
include/functions.php

index b2ff209a054fdf5ae9f1afa3f71f68ec19021379..7ea90a6f9e490073cb77fbccf58cac6661ca7118 100644 (file)
                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 "<p>" .__("Could not import: incorrect schema version.") . "</p>";
+                                       return;
+                               }
+
+                       } else {
+                               print "<p>" . __("Could not import: unrecognized document format.") . "</p>";
+                               return;
+                       }
+
                        $articles = $xpath->query("//article");
 
                        foreach ($articles as $article_node) {