summaryrefslogtreecommitdiff
path: root/classes/article.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2017-05-04 15:13:02 +0300
committerAndrew Dolgov <[email protected]>2017-05-04 15:13:02 +0300
commitaeb1abedb2cb5051c2a94e287f114bdbdaa467ff (patch)
treed716174ccb7f20ae383ec9ff93989772bd41cb80 /classes/article.php
parenta230bf88a9ce4589eeaf2d00226eafb78b4de01c (diff)
move a bunch of functions into Feeds/Article namespaces
+ static function catchupArticlesById($ids, $cmode, $owner_uid = false) { + static function getLastArticleId() { + static function queryFeedHeadlines($params) { + static function getParentCategories($cat, $owner_uid) { + static function getChildCategories($cat, $owner_uid) { move the rest of functions2.php back to functions.php as it is of more manageable size, remove the former
Diffstat (limited to 'classes/article.php')
-rw-r--r--classes/article.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/classes/article.php b/classes/article.php
index 64c04e140..7924ded35 100644
--- a/classes/article.php
+++ b/classes/article.php
@@ -876,5 +876,52 @@ class Article extends Handler_Protected {
}
}
+ static function catchupArticlesById($ids, $cmode, $owner_uid = false) {
+
+ if (!$owner_uid) $owner_uid = $_SESSION["uid"];
+ if (count($ids) == 0) return;
+
+ $tmp_ids = array();
+
+ foreach ($ids as $id) {
+ array_push($tmp_ids, "ref_id = '$id'");
+ }
+
+ $ids_qpart = join(" OR ", $tmp_ids);
+
+ if ($cmode == 0) {
+ db_query("UPDATE ttrss_user_entries SET
+ unread = false,last_read = NOW()
+ WHERE ($ids_qpart) AND owner_uid = $owner_uid");
+ } else if ($cmode == 1) {
+ db_query("UPDATE ttrss_user_entries SET
+ unread = true
+ WHERE ($ids_qpart) AND owner_uid = $owner_uid");
+ } else {
+ db_query("UPDATE ttrss_user_entries SET
+ unread = NOT unread,last_read = NOW()
+ WHERE ($ids_qpart) AND owner_uid = $owner_uid");
+ }
+
+ /* update ccache */
+
+ $result = db_query("SELECT DISTINCT feed_id FROM ttrss_user_entries
+ WHERE ($ids_qpart) AND owner_uid = $owner_uid");
+
+ while ($line = db_fetch_assoc($result)) {
+ ccache_update($line["feed_id"], $owner_uid);
+ }
+ }
+
+ static function getLastArticleId() {
+ $result = db_query("SELECT ref_id AS id FROM ttrss_user_entries
+ WHERE owner_uid = " . $_SESSION["uid"] . " ORDER BY ref_id DESC LIMIT 1");
+
+ if (db_num_rows($result) == 1) {
+ return db_fetch_result($result, 0, "id");
+ } else {
+ return -1;
+ }
+ }
}