summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-01-22 22:38:18 +0400
committerAndrew Dolgov <[email protected]>2013-01-22 22:38:18 +0400
commita6a9b81264634492634993382727b640bf3aa23a (patch)
tree0e36484dd8a4d57baeca617815a319ecf0da6c6b
parent50832719563627e958f92ba2a2b7b8c2b4fed47e (diff)
split remove_feed_* stuff to pref/feeds
-rw-r--r--classes/pref/feeds.php59
-rw-r--r--include/functions.php55
2 files changed, 57 insertions, 57 deletions
diff --git a/classes/pref/feeds.php b/classes/pref/feeds.php
index e9b09829d..31373c972 100644
--- a/classes/pref/feeds.php
+++ b/classes/pref/feeds.php
@@ -1062,7 +1062,7 @@ class Pref_Feeds extends Handler_Protected {
$ids = split(",", db_escape_string($_REQUEST["ids"]));
foreach ($ids as $id) {
- remove_feed($this->link, $id, $_SESSION["uid"]);
+ $this->remove_feed($this->link, $id, $_SESSION["uid"]);
}
return;
@@ -1208,7 +1208,7 @@ class Pref_Feeds extends Handler_Protected {
function removeCat() {
$ids = split(",", db_escape_string($_REQUEST["ids"]));
foreach ($ids as $id) {
- remove_feed_category($this->link, $id, $_SESSION["uid"]);
+ $this->remove_feed_category($this->link, $id, $_SESSION["uid"]);
}
}
@@ -1700,6 +1700,61 @@ class Pref_Feeds extends Handler_Protected {
ccache_update($link, $id, $_SESSION['uid']);
} // function clear_feed_articles
+ private function remove_feed_category($link, $id, $owner_uid) {
+
+ db_query($link, "DELETE FROM ttrss_feed_categories
+ WHERE id = '$id' AND owner_uid = $owner_uid");
+
+ ccache_remove($link, $id, $owner_uid, true);
+ }
+
+ private function remove_feed($link, $id, $owner_uid) {
+
+ if ($id > 0) {
+
+ /* save starred articles in Archived feed */
+
+ db_query($link, "BEGIN");
+
+ /* prepare feed if necessary */
+
+ $result = db_query($link, "SELECT id FROM ttrss_archived_feeds
+ WHERE id = '$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 = '$id'");
+ }
+
+ db_query($link, "UPDATE ttrss_user_entries SET feed_id = NULL,
+ orig_feed_id = '$id' WHERE feed_id = '$id' AND
+ marked = true AND owner_uid = $owner_uid");
+
+ /* Remove access key for the feed */
+
+ db_query($link, "DELETE FROM ttrss_access_keys WHERE
+ feed_id = '$id' AND owner_uid = $owner_uid");
+
+ /* remove the feed */
+
+ db_query($link, "DELETE FROM ttrss_feeds
+ WHERE id = '$id' AND owner_uid = $owner_uid");
+
+ db_query($link, "COMMIT");
+
+ if (file_exists(ICONS_DIR . "/$id.ico")) {
+ unlink(ICONS_DIR . "/$id.ico");
+ }
+
+ ccache_remove($link, $id, $owner_uid);
+
+ } else {
+ label_remove($link, -11-$id, $owner_uid);
+ ccache_remove($link, -11-$id, $owner_uid);
+ }
+ }
}
?>
diff --git a/include/functions.php b/include/functions.php
index 59a3e29cf..0ee058086 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -3485,53 +3485,6 @@
}
}
- function remove_feed($link, $id, $owner_uid) {
-
- if ($id > 0) {
-
- /* save starred articles in Archived feed */
-
- db_query($link, "BEGIN");
-
- /* prepare feed if necessary */
-
- $result = db_query($link, "SELECT id FROM ttrss_archived_feeds
- WHERE id = '$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 = '$id'");
- }
-
- db_query($link, "UPDATE ttrss_user_entries SET feed_id = NULL,
- orig_feed_id = '$id' WHERE feed_id = '$id' AND
- marked = true AND owner_uid = $owner_uid");
-
- /* Remove access key for the feed */
-
- db_query($link, "DELETE FROM ttrss_access_keys WHERE
- feed_id = '$id' AND owner_uid = $owner_uid");
-
- /* remove the feed */
-
- db_query($link, "DELETE FROM ttrss_feeds
- WHERE id = '$id' AND owner_uid = $owner_uid");
-
- db_query($link, "COMMIT");
-
- if (file_exists(ICONS_DIR . "/$id.ico")) {
- unlink(ICONS_DIR . "/$id.ico");
- }
-
- ccache_remove($link, $id, $owner_uid);
-
- } else {
- label_remove($link, -11-$id, $owner_uid);
- ccache_remove($link, -11-$id, $owner_uid);
- }
- }
function get_feed_category($link, $feed_cat, $parent_cat_id = false) {
if ($parent_cat_id) {
@@ -3585,14 +3538,6 @@
return false;
}
- function remove_feed_category($link, $id, $owner_uid) {
-
- db_query($link, "DELETE FROM ttrss_feed_categories
- WHERE id = '$id' AND owner_uid = $owner_uid");
-
- ccache_remove($link, $id, $owner_uid, true);
- }
-
function getArticleFeed($link, $id) {
$result = db_query($link, "SELECT feed_id FROM ttrss_user_entries
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);