split remove_feed_* stuff to pref/feeds
This commit is contained in:
parent
5083271956
commit
a6a9b81264
|
@ -1062,7 +1062,7 @@ class Pref_Feeds extends Handler_Protected {
|
||||||
$ids = split(",", db_escape_string($_REQUEST["ids"]));
|
$ids = split(",", db_escape_string($_REQUEST["ids"]));
|
||||||
|
|
||||||
foreach ($ids as $id) {
|
foreach ($ids as $id) {
|
||||||
remove_feed($this->link, $id, $_SESSION["uid"]);
|
$this->remove_feed($this->link, $id, $_SESSION["uid"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -1208,7 +1208,7 @@ class Pref_Feeds extends Handler_Protected {
|
||||||
function removeCat() {
|
function removeCat() {
|
||||||
$ids = split(",", db_escape_string($_REQUEST["ids"]));
|
$ids = split(",", db_escape_string($_REQUEST["ids"]));
|
||||||
foreach ($ids as $id) {
|
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']);
|
ccache_update($link, $id, $_SESSION['uid']);
|
||||||
} // function clear_feed_articles
|
} // 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -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) {
|
function get_feed_category($link, $feed_cat, $parent_cat_id = false) {
|
||||||
if ($parent_cat_id) {
|
if ($parent_cat_id) {
|
||||||
|
@ -3585,14 +3538,6 @@
|
||||||
return false;
|
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) {
|
function getArticleFeed($link, $id) {
|
||||||
$result = db_query($link, "SELECT feed_id FROM ttrss_user_entries
|
$result = db_query($link, "SELECT feed_id FROM ttrss_user_entries
|
||||||
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
||||||
|
|
Loading…
Reference in New Issue