]> git.wh0rd.org - tt-rss.git/blobdiff - classes/opml.php
fix various issues reported by static analysis
[tt-rss.git] / classes / opml.php
index 04516dde42339bb4a15d57150930de38158d317d..0ad5ddf3c1dcc2787357742ada305ca4a77ab207 100644 (file)
@@ -251,7 +251,7 @@ class Opml extends Handler_Protected {
 
        // Import
 
-       private function opml_import_feed($doc, $node, $cat_id, $owner_uid) {
+       private function opml_import_feed($node, $cat_id, $owner_uid) {
                $attrs = $node->attributes;
 
                $feed_title = $this->dbh->escape_string(mb_substr($attrs->getNamedItem('text')->nodeValue, 0, 250));
@@ -284,7 +284,7 @@ class Opml extends Handler_Protected {
                }
        }
 
-       private function opml_import_label($doc, $node, $owner_uid) {
+       private function opml_import_label($node, $owner_uid) {
                $attrs = $node->attributes;
                $label_name = $this->dbh->escape_string($attrs->getNamedItem('label-name')->nodeValue);
 
@@ -301,7 +301,7 @@ class Opml extends Handler_Protected {
                }
        }
 
-       private function opml_import_preference($doc, $node, $owner_uid) {
+       private function opml_import_preference($node) {
                $attrs = $node->attributes;
                $pref_name = $this->dbh->escape_string($attrs->getNamedItem('pref-name')->nodeValue);
 
@@ -315,7 +315,7 @@ class Opml extends Handler_Protected {
                }
        }
 
-       private function opml_import_filter($doc, $node, $owner_uid) {
+       private function opml_import_filter($node) {
                $attrs = $node->attributes;
 
                $filter_type = $this->dbh->escape_string($attrs->getNamedItem('filter-type')->nodeValue);
@@ -386,8 +386,6 @@ class Opml extends Handler_Protected {
        }
 
        private function opml_import_category($doc, $root_node, $owner_uid, $parent_id) {
-               $body = $doc->getElementsByTagName('body');
-
                $default_cat_id = (int) get_feed_category('Imported feeds', false);
 
                if ($root_node) {
@@ -442,16 +440,16 @@ class Opml extends Handler_Protected {
 
                                        switch ($cat_title) {
                                        case "tt-rss-prefs":
-                                               $this->opml_import_preference($doc, $node, $owner_uid);
+                                               $this->opml_import_preference($node);
                                                break;
                                        case "tt-rss-labels":
-                                               $this->opml_import_label($doc, $node, $owner_uid);
+                                               $this->opml_import_label($node, $owner_uid);
                                                break;
                                        case "tt-rss-filters":
-                                               $this->opml_import_filter($doc, $node, $owner_uid);
+                                               $this->opml_import_filter($node);
                                                break;
                                        default:
-                                               $this->opml_import_feed($doc, $node, $dst_cat_id, $owner_uid);
+                                               $this->opml_import_feed($node, $dst_cat_id, $owner_uid);
                                        }
                                }
                        }
@@ -461,19 +459,14 @@ class Opml extends Handler_Protected {
        function opml_import($owner_uid) {
                if (!$owner_uid) return;
 
-               $debug = isset($_REQUEST["debug"]);
                $doc = false;
 
-#              if ($debug) $doc = DOMDocument::load("/tmp/test.opml");
-
                if ($_FILES['opml_file']['error'] != 0) {
                        print_error(T_sprintf("Upload failed with error code %d",
                                $_FILES['opml_file']['error']));
                        return;
                }
 
-               $tmp_file = false;
-
                if (is_uploaded_file($_FILES['opml_file']['tmp_name'])) {
                        $tmp_file = tempnam(CACHE_DIR . '/upload', 'opml');