summaryrefslogtreecommitdiff
path: root/functions.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2009-12-28 19:30:34 +0300
committerAndrew Dolgov <[email protected]>2009-12-28 19:30:34 +0300
commit16fdac16c0bc21a6c3acac50faf2851ab63441d7 (patch)
tree072525a845ad984e34e60fd1d66db5de21e94b47 /functions.php
parent24902606eb47debce37ff1ee68b0a668d224d966 (diff)
add archive_article()
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/functions.php b/functions.php
index 8650ceb9c..e8682ca37 100644
--- a/functions.php
+++ b/functions.php
@@ -6407,4 +6407,35 @@
ccache_remove($link, $id, $owner_uid, true);
}
+ function archive_article($link, $id, $owner_uid) {
+ db_query($link, "BEGIN");
+
+ $result = db_query($link, "SELECT feed_id FROM ttrss_user_entries
+ WHERE ref_id = '$id' AND owner_uid = $owner_uid");
+
+ if (db_num_rows($result) != 0) {
+
+ /* prepare the archived table */
+
+ $feed_id = (int) db_fetch_result($result, 0, "feed_id");
+
+ if ($feed_id) {
+ $result = db_query($link, "SELECT id FROM ttrss_archived_feeds
+ WHERE id = '$feed_id'");
+
+ if (db_num_rows($result) == 0) {
+ db_query($link, "INSERT INTO ttrss_archived_feeds
+ (id, owner_uid, title, feed_url, site_url)
+ SELECT id, owner_uid, title, feed_url, site_url from ttrss_feeds
+ WHERE id = '$feed_id'");
+ }
+
+ db_query($link, "UPDATE ttrss_user_entries
+ SET orig_feed_id = feed_id, feed_id = NULL
+ WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
+ }
+ }
+
+ db_query($link, "COMMIT");
+ }
?>