]> git.wh0rd.org - tt-rss.git/blobdiff - include/rssfuncs.php
update stored article after filter has finished processing to prevent plugins from...
[tt-rss.git] / include / rssfuncs.php
index 010071e577dc1da4f8788679be1cf979715d6863..f657f8413fffe379bda3d14385ebc57ea02b453d 100644 (file)
@@ -2,6 +2,7 @@
        define_default('DAEMON_UPDATE_LOGIN_LIMIT', 30);
        define_default('DAEMON_FEED_LIMIT', 500);
        define_default('DAEMON_SLEEP_INTERVAL', 120);
+       define_default('_MIN_CACHE_IMAGE_SIZE', 1024);
 
        function update_feedbrowser_cache() {
 
 
                                foreach ($pluginhost->get_hooks(PluginHost::HOOK_ARTICLE_FILTER) as $plugin) {
                                        $article = $plugin->hook_article_filter($article);
+
+                                       $article["stored"] = array("title" => $article["title"],
+                                               "content" => $article["content"],
+                                               "link" => $article["link"],
+                                               "tags" => $article["tags"],
+                                               "author" => $article["author"]);
                                }
 
                                $entry_tags = $article["tags"];
                                $entry_plugin_data = db_escape_string($article["plugin_data"]);
                                $entry_content = $article["content"]; // escaped below
 
-
                                _debug("plugin data: $entry_plugin_data", $debug_enabled);
 
                                if ($cache_images && is_writable(CACHE_DIR . '/images'))
                                if (is_array($encs)) {
                                        foreach ($encs as $e) {
                                                $e_item = array(
-                                                       $e->link, $e->type, $e->length, $e->title);
+                                                       $e->link, $e->type, $e->length, $e->title, $e->width, $e->height);
                                                array_push($enclosures, $e_item);
                                        }
                                }
                                        $enc_type = db_escape_string($enc[1]);
                                        $enc_dur = db_escape_string($enc[2]);
                                        $enc_title = db_escape_string($enc[3]);
+                                       $enc_width = intval($enc[4]);
+                                       $enc_height = intval($enc[5]);
 
                                        $result = db_query("SELECT id FROM ttrss_enclosures
                                                WHERE content_url = '$enc_url' AND post_id = '$entry_ref_id'");
 
                                        if (db_num_rows($result) == 0) {
                                                db_query("INSERT INTO ttrss_enclosures
-                                                       (content_url, content_type, title, duration, post_id) VALUES
-                                                       ('$enc_url', '$enc_type', '$enc_title', '$enc_dur', '$entry_ref_id')");
+                                                       (content_url, content_type, title, duration, post_id, width, height) VALUES
+                                                       ('$enc_url', '$enc_type', '$enc_title', '$enc_dur', '$entry_ref_id', $enc_width, $enc_height)");
                                        }
                                }
 
                                if (!file_exists($local_filename)) {
                                        $file_content = fetch_file_contents($src);
 
-                                       if ($file_content && strlen($file_content) > 1024) {
+                                       if ($file_content && strlen($file_content) > _MIN_CACHE_IMAGE_SIZE) {
                                                file_put_contents($local_filename, $file_content);
                                        }
                                }