From: Andrew Dolgov Date: Tue, 1 Aug 2006 07:54:46 +0000 (+0100) Subject: add search-to-label converter, ability to unsubscribe from label, various label fixes X-Git-Tag: schema_freeze_for_1.2.2~46 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=88040f5795f5217bbd2713bf756d97e16c6936a5;p=tt-rss.git add search-to-label converter, ability to unsubscribe from label, various label fixes --- diff --git a/backend.php b/backend.php index 1aa0f393..8b031aff 100644 --- a/backend.php +++ b/backend.php @@ -208,11 +208,12 @@ error_reporting (0); - $tmp_result = db_query($link, "SELECT count(id) as count - FROM ttrss_entries,ttrss_user_entries + $tmp_result = db_query($link, "SELECT count(ttrss_entries.id) as count + FROM ttrss_entries,ttrss_user_entries,ttrss_feeds WHERE (" . $line["sql_exp"] . ") AND unread = true AND - ttrss_user_entries.ref_id = ttrss_entries.id - AND owner_uid = '$owner_uid'"); + ttrss_user_entries.ref_id = ttrss_entries.id AND + ttrss_user_entries.feed_id = ttrss_feeds.id + AND ttrss_user_entries.owner_uid = '$owner_uid'"); $count = db_fetch_result($tmp_result, 0, "count"); @@ -836,9 +837,17 @@ None    Toggle: Unread, - Starred"; + Starred"; + print ""; + if ($search && $feed_id > 0 && get_pref($link, 'ENABLE_LABELS') && GLOBAL_ENABLE_LABELS) { + print " + + Convert this search to label"; + } + } else { print " @@ -1430,13 +1439,23 @@ $ids = split(",", db_escape_string($_GET["ids"])); foreach ($ids as $id) { - db_query($link, "DELETE FROM ttrss_feeds - WHERE id = '$id' AND owner_uid = " . $_SESSION["uid"]); - $icons_dir = ICONS_DIR; + if ($id > 0) { + + db_query($link, "DELETE FROM ttrss_feeds + WHERE id = '$id' AND owner_uid = " . $_SESSION["uid"]); + + $icons_dir = ICONS_DIR; - if (file_exists($icons_dir . "/$id.ico")) { - unlink($icons_dir . "/$id.ico"); + if (file_exists($icons_dir . "/$id.ico")) { + unlink($icons_dir . "/$id.ico"); + } + } else if ($id < -10) { + + $label_id = -$id - 11; + + db_query($link, "DELETE FROM ttrss_labels + WHERE id = '$label_id' AND owner_uid = " . $_SESSION["uid"]); } } } @@ -2228,11 +2247,12 @@ // print "

Expression: $expr

"; $result = db_query($link, - "SELECT count(id) AS num_matches - FROM ttrss_entries,ttrss_user_entries + "SELECT count(ttrss_entries.id) AS num_matches + FROM ttrss_entries,ttrss_user_entries,ttrss_feeds WHERE ($expr) AND ttrss_user_entries.ref_id = ttrss_entries.id AND - owner_uid = " . $_SESSION["uid"]); + ttrss_user_entries.feed_id = ttrss_feeds.id AND + ttrss_user_entries.owner_uid = " . $_SESSION["uid"]); $num_matches = db_fetch_result($result, 0, "num_matches");; @@ -2241,12 +2261,13 @@ print "

Query returned $num_matches matches, showing first 15:

"; $result = db_query($link, - "SELECT title, + "SELECT ttrss_entries.title, (SELECT title FROM ttrss_feeds WHERE id = feed_id) AS feed_title - FROM ttrss_entries,ttrss_user_entries + FROM ttrss_entries,ttrss_user_entries,ttrss_feeds WHERE ($expr) AND ttrss_user_entries.ref_id = ttrss_entries.id - AND owner_uid = " . $_SESSION["uid"] . " + AND ttrss_user_entries.feed_id = ttrss_feeds.id + AND ttrss_user_entries.owner_uid = " . $_SESSION["uid"] . " ORDER BY date_entered DESC LIMIT 15"); print "