]> git.wh0rd.org - tt-rss.git/blobdiff - include/rssfuncs.php
update installer mysqli_connect to only use port if defined
[tt-rss.git] / include / rssfuncs.php
index 537a4c338c54598bac4f4793a1d03a9c27b2a1e3..8ffcbde8a7ce0132377dafb6cee8d0cf9ae17804 100644 (file)
                                $updstart_thresh_qpart
                        ORDER BY $random_qpart $query_limit");
 
-               $user_prefs_cache = array();
-
                if($debug) _debug(sprintf("Scheduled %d feeds to update...", db_num_rows($result)));
 
                // Here is a little cache magic in order to minimize risk of double feed updates.
                                        $no_cache ? FEED_FETCH_NO_CACHE_TIMEOUT : FEED_FETCH_TIMEOUT,
                                        $force_refetch ? 0 : max($last_updated_timestamp, $cache_timestamp));
 
+                               global $fetch_curl_used;
+
+                               if (!$fetch_curl_used) {
+                                       $tmp = @gzdecode($feed_data);
+
+                                       if ($tmp) $feed_data = $tmp;
+                               }
+
                                if ($debug_enabled) {
                                        _debug("update_rss_feed: fetch done.");
                                }
                        }
                }
 
-               $pluginhost = new PluginHost(Db::get());
+               $pluginhost = new PluginHost();
                $pluginhost->set_debug($debug_enabled);
                $user_plugins = get_pref("_ENABLED_PLUGINS", $owner_uid);
 
-               $pluginhost->load(PLUGINS, $pluginhost::KIND_ALL);
-               $pluginhost->load($user_plugins, $pluginhost::KIND_USER, $owner_uid);
+               $pluginhost->load(PLUGINS, PluginHost::KIND_ALL);
+               $pluginhost->load($user_plugins, PluginHost::KIND_USER, $owner_uid);
                $pluginhost->load_data();
 
-               foreach ($pluginhost->get_hooks($pluginhost::HOOK_FEED_FETCHED) as $plugin) {
+               foreach ($pluginhost->get_hooks(PluginHost::HOOK_FEED_FETCHED) as $plugin) {
                        $feed_data = $plugin->hook_feed_fetched($feed_data);
                }
 
                        }
 
                        // We use local pluginhost here because we need to load different per-user feed plugins
-                       $pluginhost->run_hooks($pluginhost::HOOK_FEED_PARSED, "hook_feed_parsed", $rss);
+                       $pluginhost->run_hooks(PluginHost::HOOK_FEED_PARSED, "hook_feed_parsed", $rss);
 
                        if ($debug_enabled) {
                                _debug("update_rss_feed: processing feed data...");
                                check_feed_favicon($site_url, $feed, $link);
                                $favicon_file = ICONS_DIR . "/$feed.ico";
 
-                               if (file_exists($favicon_file)) {
+                               if (file_exists($favicon_file) && function_exists("imagecreatefromstring")) {
                                                require_once "colors.php";
 
                                                $favicon_color = db_escape_string(
                                        $entry_author_item = $item->get_author();
                                        $entry_author = $entry_author_item->get_name();
                                        if (!$entry_author) $entry_author = $entry_author_item->get_email();
-
-                                       $entry_author = db_escape_string($entry_author);
                                }
 
                                $entry_guid = db_escape_string(mb_substr($entry_guid, 0, 245));
 
-                               $entry_comments = db_escape_string(mb_substr($entry_comments, 0, 245));
-                               $entry_author = db_escape_string(mb_substr($entry_author, 0, 245));
+                               $entry_comments = db_escape_string(mb_substr(trim($entry_comments), 0, 245));
+                               $entry_author = db_escape_string(mb_substr(trim($entry_author), 0, 245));
 
                                $num_comments = $item->get_item_tags('http://purl.org/rss/1.0/modules/slash/', 'comments');
 
                                        "author" => $entry_author,
                                        "stored" => $stored_article);
 
-                               foreach ($pluginhost->get_hooks($pluginhost::HOOK_ARTICLE_FILTER) as $plugin) {
+                               foreach ($pluginhost->get_hooks(PluginHost::HOOK_ARTICLE_FILTER) as $plugin) {
                                        $article = $plugin->hook_article_filter($article);
                                }