]> git.wh0rd.org - tt-rss.git/blobdiff - classes/opml.php
add some timing information to update_daemon_common
[tt-rss.git] / classes / opml.php
index 3f4030dea190e62bed68b14cbec0fae441ed1071..c8c59e8a25448a72bd6caf7fad63526c165249e6 100644 (file)
@@ -24,7 +24,7 @@ class Opml extends Handler_Protected {
 
                print "<html>
                        <head>
-                               <link rel=\"stylesheet\" href=\"utility.css\" type=\"text/css\">
+                               <link rel=\"stylesheet\" href=\"css/utility.css\" type=\"text/css\">
                                <title>".__("OPML Utility")."</title>
                                <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>
                        </head>
@@ -97,7 +97,7 @@ class Opml extends Handler_Protected {
                                $html_url_qpart = "";
                        }
 
-                       $out .= "<outline text=\"$title\" xmlUrl=\"$url\" $html_url_qpart/>\n";
+                       $out .= "<outline type=\"rss\" text=\"$title\" xmlUrl=\"$url\" $html_url_qpart/>\n";
                }
 
                if ($cat_title) $out .= "</outline>\n";
@@ -165,7 +165,7 @@ class Opml extends Handler_Protected {
                                WHERE owner_uid = ".$_SESSION["uid"]." ORDER BY id");
 
                        while ($line = $this->dbh->fetch_assoc($result)) {
-                               foreach (array('enabled', 'match_any_rule') as $b) {
+                               foreach (array('enabled', 'match_any_rule', 'inverse') as $b) {
                                        $line[$b] = sql_bool_to_bool($line[$b]);
                                }
 
@@ -190,6 +190,7 @@ class Opml extends Handler_Protected {
                                        }
 
                                        $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"]);
@@ -256,8 +257,8 @@ class Opml extends Handler_Protected {
                $feed_title = $this->dbh->escape_string(mb_substr($attrs->getNamedItem('text')->nodeValue, 0, 250));
                if (!$feed_title) $feed_title = $this->dbh->escape_string(mb_substr($attrs->getNamedItem('title')->nodeValue, 0, 250));
 
-               $feed_url = $this->dbh->escape_string(mb_substr($attrs->getNamedItem('xmlUrl')->nodeValue, 0, 250));
-               if (!$feed_url) $feed_url = $this->dbh->escape_string(mb_substr($attrs->getNamedItem('xmlURL')->nodeValue, 0, 250));
+               $feed_url = $this->dbh->escape_string($attrs->getNamedItem('xmlUrl')->nodeValue);
+               if (!$feed_url) $feed_url = $this->dbh->escape_string($attrs->getNamedItem('xmlURL')->nodeValue);
 
                $site_url = $this->dbh->escape_string(mb_substr($attrs->getNamedItem('htmlUrl')->nodeValue, 0, 250));
 
@@ -325,11 +326,14 @@ class Opml extends Handler_Protected {
                        if ($filter) {
                                $match_any_rule = bool_to_sql_bool($filter["match_any_rule"]);
                                $enabled = bool_to_sql_bool($filter["enabled"]);
+                               $inverse = bool_to_sql_bool($filter["inverse"]);
+                               $title = db_escape_string($filter["title"]);
 
                                $this->dbh->query("BEGIN");
 
-                               $this->dbh->query("INSERT INTO ttrss_filters2 (match_any_rule,enabled,owner_uid)
-                                       VALUES ($match_any_rule, $enabled,".$_SESSION["uid"].")");
+                               $this->dbh->query("INSERT INTO ttrss_filters2 (match_any_rule,enabled,inverse,title,owner_uid)
+                                       VALUES ($match_any_rule, $enabled, $inverse, '$title',
+                                       ".$_SESSION["uid"].")");
 
                                $result = $this->dbh->query("SELECT MAX(id) AS id FROM ttrss_filters2 WHERE
                                        owner_uid = ".$_SESSION["uid"]);
@@ -360,9 +364,10 @@ class Opml extends Handler_Protected {
                                                $cat_filter = bool_to_sql_bool($rule["cat_filter"]);
                                                $reg_exp = $this->dbh->escape_string($rule["reg_exp"]);
                                                $filter_type = (int)$rule["filter_type"];
+                                               $inverse = bool_to_sql_bool($rule["inverse"]);
 
-                                               $this->dbh->query("INSERT INTO ttrss_filters2_rules (feed_id,cat_id,filter_id,filter_type,reg_exp,cat_filter)
-                                                       VALUES ($feed_id, $cat_id, $filter_id, $filter_type, '$reg_exp', $cat_filter)");
+                                               $this->dbh->query("INSERT INTO ttrss_filters2_rules (feed_id,cat_id,filter_id,filter_type,reg_exp,cat_filter,inverse)
+                                                       VALUES ($feed_id, $cat_id, $filter_id, $filter_type, '$reg_exp', $cat_filter,$inverse)");
                                        }
 
                                        foreach ($filter["actions"] as $action) {