]> git.wh0rd.org - tt-rss.git/blobdiff - classes/opml.php
pngcrush.sh
[tt-rss.git] / classes / opml.php
index 5f70558b6c15189817cb1b7a6673d151a855145e..5b7690375ed762c4a52c6fa4880888e695f92f39 100644 (file)
@@ -27,11 +27,11 @@ class Opml extends Handler_Protected {
 
                print "<html>
                        <head>
-                               <link rel=\"stylesheet\" href=\"css/utility.css\" type=\"text/css\">
+                               ".stylesheet_tag("css/default.css")."
                                <title>".__("OPML Utility")."</title>
                                <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>
                        </head>
-                       <body>
+                       <body class='claro ttrss_utility'>
                        <div class=\"floatingLogo\"><img src=\"images/logo_small.png\"></div>
                        <h1>".__('OPML Utility')."</h1><div class='content'>";
 
@@ -75,7 +75,7 @@ class Opml extends Handler_Protected {
 
                $sth = $this->pdo->prepare("SELECT id,title
                        FROM ttrss_feed_categories WHERE
-                               (parent_cat = :cat OR (:cat = 0 AND parent_cat IS NULL)) AND 
+                               (parent_cat = :cat OR (:cat = 0 AND parent_cat IS NULL)) AND
                                owner_uid = :uid ORDER BY order_id, title");
 
                $sth->execute([':cat' => $cat_id, ':uid' => $owner_uid]);
@@ -85,7 +85,7 @@ class Opml extends Handler_Protected {
                }
 
                $fsth = $this->pdo->prepare("select title, feed_url, site_url
-                               FROM ttrss_feeds WHERE 
+                               FROM ttrss_feeds WHERE
                                        (cat_id = :cat OR (:cat = 0 AND cat_id IS NULL)) AND owner_uid = :uid AND $hide_qpart
                                ORDER BY order_id, title");
 
@@ -173,10 +173,6 @@ class Opml extends Handler_Protected {
                        $sth->execute([$owner_uid]);
 
                        while ($line = $sth->fetch()) {
-                               foreach (array('enabled', 'match_any_rule', 'inverse') as $b) {
-                                       $line[$b] = sql_bool_to_bool($line[$b]);
-                               }
-
                                $line["rules"] = array();
                                $line["actions"] = array();
 
@@ -188,7 +184,7 @@ class Opml extends Handler_Protected {
                                        unset($tmp_line["id"]);
                                        unset($tmp_line["filter_id"]);
 
-                                       $cat_filter = sql_bool_to_bool($tmp_line["cat_filter"]);
+                                       $cat_filter = $tmp_line["cat_filter"];
 
                                        if (!$tmp_line["match_on"]) {
                         if ($cat_filter && $tmp_line["cat_id"] || $tmp_line["feed_id"]) {
@@ -222,9 +218,6 @@ class Opml extends Handler_Protected {
                                            unset($tmp_line["match_on"]);
                     }
 
-                                       $tmp_line["cat_filter"] = sql_bool_to_bool($tmp_line["cat_filter"]);
-                                       $tmp_line["inverse"] = sql_bool_to_bool($tmp_line["inverse"]);
-
                                        unset($tmp_line["feed_id"]);
                                        unset($tmp_line["cat_id"]);
 
@@ -296,14 +289,16 @@ class Opml extends Handler_Protected {
 
                $site_url = mb_substr($attrs->getNamedItem('htmlUrl')->nodeValue, 0, 250);
 
-               if ($feed_url && $feed_title) {
+               if ($feed_url) {
                        $sth = $this->pdo->prepare("SELECT id FROM ttrss_feeds WHERE
                                feed_url = ? AND owner_uid = ?");
                        $sth->execute([$feed_url, $owner_uid]);
 
+                       if (!$feed_title) $feed_title = '[Unknown]';
+
                        if (!$sth->fetch()) {
                                #$this->opml_notice("[FEED] [$feed_title/$feed_url] dst_CAT=$cat_id");
-                               $this->opml_notice(T_sprintf("Adding feed: %s", $feed_title));
+                               $this->opml_notice(T_sprintf("Adding feed: %s", $feed_title == '[Unknown]' ? $feed_url : $feed_title));
 
                                if (!$cat_id) $cat_id = null;
 
@@ -314,7 +309,7 @@ class Opml extends Handler_Protected {
                                $sth->execute([$feed_title, $feed_url, $owner_uid, $cat_id, $site_url]);
 
                        } else {
-                               $this->opml_notice(T_sprintf("Duplicate feed: %s", $feed_title));
+                               $this->opml_notice(T_sprintf("Duplicate feed: %s", $feed_title == '[Unknown]' ? $feed_url : $feed_title));
                        }
                }
        }
@@ -364,7 +359,7 @@ class Opml extends Handler_Protected {
                                $inverse = bool_to_sql_bool($filter["inverse"]);
                                $title = $filter["title"];
 
-                               print "F: $title, $inverse, $enabled, $match_any_rule";
+                               //print "F: $title, $inverse, $enabled, $match_any_rule";
 
                                $sth = $this->pdo->prepare("INSERT INTO ttrss_filters2 (match_any_rule,enabled,inverse,title,owner_uid)
                                        VALUES (?, ?, ?, ?, ?)");
@@ -426,9 +421,9 @@ class Opml extends Handler_Protected {
                             $inverse = bool_to_sql_bool($rule["inverse"]);
                             $match_on = json_encode($match_on);
 
-                            $usth = $this->pdo->prepare("INSERT INTO ttrss_filters2_rules 
+                            $usth = $this->pdo->prepare("INSERT INTO ttrss_filters2_rules
                                                                (feed_id,cat_id,match_on,filter_id,filter_type,reg_exp,cat_filter,inverse)
-                                VALUES 
+                                VALUES
                                 (NULL, NULL, ?, ?, ?, ?, false, ?)");
                             $usth->execute([$match_on, $filter_id, $filter_type, $reg_exp, $inverse]);
 
@@ -459,9 +454,9 @@ class Opml extends Handler_Protected {
                             $filter_type = (int)$rule["filter_type"];
                             $inverse = bool_to_sql_bool($rule["inverse"]);
 
-                            $usth = $this->pdo->prepare("INSERT INTO ttrss_filters2_rules 
+                            $usth = $this->pdo->prepare("INSERT INTO ttrss_filters2_rules
                                                                (feed_id,cat_id,filter_id,filter_type,reg_exp,cat_filter,inverse)
-                                VALUES 
+                                VALUES
                                 (?, ?, ?, ?, ?, ?, ?)");
                             $usth->execute([$feed_id, $cat_id, $filter_id, $filter_type, $reg_exp, $cat_filter, $inverse]);
                         }
@@ -472,9 +467,9 @@ class Opml extends Handler_Protected {
                                                $action_id = (int)$action["action_id"];
                                                $action_param = $action["action_param"];
 
-                                               $usth = $this->pdo->prepare("INSERT INTO ttrss_filters2_actions 
+                                               $usth = $this->pdo->prepare("INSERT INTO ttrss_filters2_actions
                                                        (filter_id,action_id,action_param)
-                                                       VALUES 
+                                                       VALUES
                                                        (?, ?, ?)");
                                                $usth->execute([$filter_id, $action_id, $action_param]);
                                        }
@@ -618,7 +613,7 @@ class Opml extends Handler_Protected {
                $parent_cat_id = (int) $parent_cat_id;
 
                $sth = $this->pdo->prepare("SELECT id FROM ttrss_feed_categories
-                       WHERE title = :title 
+                       WHERE title = :title
                        AND (parent_cat = :parent OR (:parent = 0 AND parent_cat IS NULL))
                        AND owner_uid = :uid");