]> git.wh0rd.org - tt-rss.git/blobdiff - include/rssfuncs.php
implement proper last_marked/last_published feeds for proper sorting of
[tt-rss.git] / include / rssfuncs.php
index 156be0b12236762a939cc78ee0c2f6d70612794a..a95280a3180bc889da92a4216c1bbbdf700b79e9 100644 (file)
 
                                $entry_tags = $article["tags"];
                                $entry_guid = db_escape_string($entry_guid);
-                               $entry_content = db_escape_string($article["content"], false);
                                $entry_title = db_escape_string($article["title"]);
                                $entry_author = db_escape_string($article["author"]);
                                $entry_link = db_escape_string($article["link"]);
                                if ($cache_images && is_writable(CACHE_DIR . '/images'))
                                        $entry_content = cache_images($entry_content, $site_url, $debug_enabled);
 
+                               $entry_content = db_escape_string($article["content"], false);
+
                                $content_hash = "SHA1:" . sha1($entry_content);
 
                                db_query($link, "BEGIN");
                                                        }
                                                }
 
+                                               $last_marked = ($marked == 'true') ? 'NOW()' : 'NULL';
+                                               $last_published = ($published == 'true') ? 'NOW()' : 'NULL';
+
                                                $result = db_query($link,
                                                        "INSERT INTO ttrss_user_entries
                                                                (ref_id, owner_uid, feed_id, unread, last_read, marked,
-                                                                       published, score, tag_cache, label_cache, uuid)
+                                                               published, score, tag_cache, label_cache, uuid,
+                                                               last_marked, last_published)
                                                        VALUES ('$ref_id', '$owner_uid', '$feed', $unread,
-                                                               $last_read_qpart, $marked, $published, '$score', '', '', '')");
+                                                               $last_read_qpart, $marked, $published, '$score', '', '',
+                                                               '', $last_marked, $last_published)");
 
                                                if (PUBSUBHUBBUB_HUB && $published == 'true') {
                                                        $rss_link = get_self_url_prefix() .