]> git.wh0rd.org - tt-rss.git/blobdiff - include/rssfuncs.php
set_basic_feed_info: fix missing column
[tt-rss.git] / include / rssfuncs.php
old mode 100644 (file)
new mode 100755 (executable)
index 6532fb2..af4762c
 
                $feed = db_escape_string($feed);
 
-               $result = db_query("SELECT feed_url,auth_pass,auth_pass_encrypted
+               $result = db_query("SELECT feed_url,auth_pass,auth_login,auth_pass_encrypted
                                        FROM ttrss_feeds WHERE id = '$feed'");
 
                $auth_pass_encrypted = sql_bool_to_bool(db_fetch_result($result,
                                        }
                                }
 
+                               /* Collect article tags here so we could filter by them: */
+
+                               $article_filters = get_article_filters($filters, $article["title"],
+                                       $article["content"], $article["link"], 0, $article["author"],
+                                       $article["tags"]);
+
+                               if ($debug_enabled) {
+                                       _debug("article filters: ", $debug_enabled);
+                                       if (count($article_filters) != 0) {
+                                               print_r($article_filters);
+                                       }
+                               }
+
+                               $plugin_filter_names = find_article_filters($article_filters, "plugin");
+                               $plugin_filter_actions = $pluginhost->get_filter_actions();
+
+                               if (count($plugin_filter_names) > 0) {
+                                       _debug("applying plugin filter actions...", $debug_enabled);
+
+                                       foreach ($plugin_filter_names as $pfn) {
+                                               list($pfclass,$pfaction) = explode(":", $pfn["param"]);
+
+                                               if (isset($plugin_filter_actions[$pfclass])) {
+                                                       $plugin = $pluginhost->get_plugin($pfclass);
+
+                                                       _debug("... $pfclass: $pfaction", $debug_enabled);
+
+                                                       if ($plugin) {
+                                                               $start = microtime(true);
+                                                               $article = $plugin->hook_article_filter_action($article, $pfaction);
+
+                                                               _debug("=== " . sprintf("%.4f (sec)", microtime(true) - $start), $debug_enabled);
+                                                       } else {
+                                                               _debug("??? $pfclass: plugin object not found.");
+                                                       }
+                                               } else {
+                                                       _debug("??? $pfclass: filter plugin not registered.");
+                                               }
+                                       }
+                               }
+
                                $entry_tags = $article["tags"];
                                $entry_guid = db_escape_string($entry_guid);
                                $entry_title = db_escape_string($article["title"]);
                                                $dupcheck_qpart = "";
                                        }
 
-                                       /* Collect article tags here so we could filter by them: */
-
-                                       $article_filters = get_article_filters($filters, $entry_title,
-                                               $entry_content, $entry_link, $entry_timestamp, $entry_author,
-                                               $entry_tags);
-
-                                       if ($debug_enabled) {
-                                               _debug("article filters: ", $debug_enabled);
-                                               if (count($article_filters) != 0) {
-                                                       print_r($article_filters);
-                                               }
-                                       }
-
                                        if (find_article_filter($article_filters, "filter")) {
                                                //db_query("COMMIT"); // close transaction in progress
                                                continue;
                                        _debug("RID: $entry_ref_id, IID: $entry_int_id", $debug_enabled);
 
                                        if (DB_TYPE == "pgsql") {
-                                               $tsvector_combined = db_escape_string(mb_substr($entry_title . ' ' . strip_tags($entry_content),
+                                          $tsvector_combined = db_escape_string(mb_substr($entry_title . ' ' . strip_tags(str_replace('<', ' <', $entry_content)),
                                                        0, 1000000));
 
                                                $tsvector_qpart = "tsvector_combined = to_tsvector('$feed_language', '$tsvector_combined'),";
                                        if ($file_content && strlen($file_content) > _MIN_CACHE_IMAGE_SIZE) {
                                                file_put_contents($local_filename, $file_content);
                                        }
+                               } else {
+                                       touch($local_filename);
                                }
                        }
                }
                                        array_push($matches, $action);
 
                                        // if Stop action encountered, perform no further processing
-                                       if ($action["type"] == "stop") return $matches;
+                                       if (isset($action["type"]) && $action["type"] == "stop") return $matches;
                                }
                        }
                }