remove feed linking

master
Andrew Dolgov 14 years ago
parent fe1c99af3a
commit 6e63a7c306

@ -2383,30 +2383,10 @@
} else if ($feed > 0) {
$tmp_result = db_query($link, "SELECT id
FROM ttrss_feeds WHERE parent_feed = '$feed'
ORDER BY cat_id,title");
$parent_ids = array();
if (db_num_rows($tmp_result) > 0) {
while ($p = db_fetch_assoc($tmp_result)) {
array_push($parent_ids, "feed_id = " . $p["id"]);
}
$children_qpart = implode(" OR ", $parent_ids);
db_query($link, "UPDATE ttrss_user_entries
SET unread = false,last_read = NOW()
WHERE (feed_id = '$feed' OR $children_qpart)
AND owner_uid = $owner_uid");
} else {
db_query($link, "UPDATE ttrss_user_entries
db_query($link, "UPDATE ttrss_user_entries
SET unread = false,last_read = NOW()
WHERE feed_id = '$feed' AND owner_uid = $owner_uid");
}
} else if ($feed < 0 && $feed > -10) { // special, like starred
if ($feed == -1) {
@ -2697,45 +2677,12 @@
$match_part = "true";
} else if ($n_feed >= 0) {
$result = db_query($link, "SELECT id FROM ttrss_feeds
WHERE parent_feed = '$n_feed'
AND owner_uid = " . $owner_uid);
if (db_num_rows($result) > 0) {
$linked_feeds = array();
while ($line = db_fetch_assoc($result)) {
array_push($linked_feeds, "feed_id = " . $line["id"]);
}
array_push($linked_feeds, "feed_id = $n_feed");
$match_part = implode(" OR ", $linked_feeds);
$tmp_result = db_query($link, "SELECT COUNT(int_id) AS unread
FROM ttrss_user_entries,ttrss_entries
WHERE $unread_qpart AND
ttrss_user_entries.ref_id = ttrss_entries.id AND
$age_qpart AND
($match_part) AND
owner_uid = " . $owner_uid);
$unread = 0;
# this needs to be rewritten
while ($line = db_fetch_assoc($tmp_result)) {
$unread += $line["unread"];
}
return $unread;
if ($n_feed != 0) {
$match_part = "feed_id = '$n_feed'";
} else {
if ($n_feed != 0) {
$match_part = "feed_id = '$n_feed'";
} else {
$match_part = "feed_id IS NULL";
}
$match_part = "feed_id IS NULL";
}
} else if ($feed < -10) {
$label_id = -$feed - 11;
@ -2921,7 +2868,6 @@
last_error, value AS count
FROM ttrss_feeds, ttrss_counters_cache
WHERE ttrss_feeds.owner_uid = ".$_SESSION["uid"]."
AND parent_feed IS NULL
AND ttrss_counters_cache.feed_id = id";
$result = db_query($link, $query);
@ -2937,12 +2883,6 @@
$has_img = feed_has_icon($id);
$tmp_result = db_query($link,
"SELECT SUM(value) AS unread FROM ttrss_feeds, ttrss_counters_cache
WHERE parent_feed = '$id' AND feed_id = id");
$count += db_fetch_result($tmp_result, 0, "unread");
$cv = array("id" => $id,
"updated" => $last_updated,
"counter" => $count,
@ -3488,24 +3428,7 @@
$vfeed_query_part = "ttrss_feeds.title AS feed_title,";
} else {
$tmp_result = db_query($link, "SELECT id
FROM ttrss_feeds WHERE parent_feed = '$feed'
ORDER BY cat_id,title");
$parent_ids = array();
if (db_num_rows($tmp_result) > 0) {
while ($p = db_fetch_assoc($tmp_result)) {
array_push($parent_ids, "feed_id = " . $p["id"]);
}
$query_strategy_part = sprintf("(feed_id = %d OR %s)",
$feed, implode(" OR ", $parent_ids));
$vfeed_query_part = "ttrss_feeds.title AS feed_title,";
} else {
$query_strategy_part = "feed_id = '$feed'";
}
$query_strategy_part = "feed_id = '$feed'";
}
} else if ($feed == 0 && !$cat_view) { // archive virtual feed
$query_strategy_part = "feed_id IS NULL";
@ -4495,7 +4418,7 @@
ON
(ttrss_feeds.id = feed_id)
WHERE
ttrss_feeds.owner_uid = '$owner_uid' AND parent_feed IS NULL
ttrss_feeds.owner_uid = '$owner_uid'
ORDER BY $order_by_qpart";
$result = db_query($link, $query);
@ -4532,12 +4455,6 @@
$rtl_tag = "";
}
$tmp_result = db_query($link,
"SELECT SUM(value) AS unread FROM ttrss_feeds, ttrss_counters_cache
WHERE parent_feed = '$feed_id' AND feed_id = id");
$unread += db_fetch_result($tmp_result, 0, "unread");
$cat_id = $line["cat_id"];
$tmp_category = $line["category"];

@ -127,7 +127,7 @@
FROM ttrss_feeds LEFT JOIN ttrss_feed_categories
ON (ttrss_feed_categories.id = cat_id)
WHERE
ttrss_feeds.owner_uid = '$owner_uid' AND parent_feed IS NULL
ttrss_feeds.owner_uid = '$owner_uid'
ORDER BY $order_by_qpart");
$actid = $_GET["actid"];
@ -159,19 +159,6 @@
$rtl_tag = "";
}
$tmp_result = db_query($link,
"SELECT id,COUNT(unread) AS unread
FROM ttrss_feeds LEFT JOIN ttrss_user_entries
ON (ttrss_feeds.id = ttrss_user_entries.feed_id)
WHERE parent_feed = '$feed_id' AND unread = true
GROUP BY ttrss_feeds.id");
if (db_num_rows($tmp_result) > 0) {
while ($l = db_fetch_assoc($tmp_result)) {
$unread += $l["unread"];
}
}
$cat_id = $line["cat_id"];
$tmp_category = $line["category"];

@ -52,8 +52,7 @@
AND owner_uid = '$owner_uid') AS unread
FROM ttrss_feeds
WHERE
ttrss_feeds.owner_uid = '$owner_uid' AND
parent_feed IS NULL
ttrss_feeds.owner_uid = '$owner_uid'
ORDER BY $order_by $limit_qpart");
if (!$offset) print '<ul id="home" title="'.__('Home').'" selected="true"
@ -127,7 +126,6 @@
FROM ttrss_feeds
WHERE
ttrss_feeds.owner_uid = '$owner_uid' AND
parent_feed IS NULL AND
$cat_query
ORDER BY $order_by");

@ -224,73 +224,9 @@
print __('Place in category:') . " ";
$parent_feed = db_fetch_result($result, 0, "parent_feed");
if (sprintf("%d", $parent_feed) > 0) {
$disabled = "disabled";
} else {
$disabled = "";
}
print_feed_cat_select($link, "cat_id", $cat_id, $disabled);
}
/* Link to */
print "<br/>";
print __('Link to feed:') . " ";
$tmp_result = db_query($link, "SELECT COUNT(id) AS count
FROM ttrss_feeds WHERE parent_feed = '$feed_id'");
$linked_count = db_fetch_result($tmp_result, 0, "count");
$parent_feed = db_fetch_result($result, 0, "parent_feed");
if ($linked_count > 0) {
$disabled = "disabled";
} else {
$disabled = "";
}
print "<select $disabled name=\"parent_feed\">";
print "<option value=\"0\">".__('Not linked')."</option>";
if (get_pref($link, 'ENABLE_FEED_CATS')) {
if ($cat_id) {
$cat_qpart = "AND cat_id = '$cat_id'";
} else {
$cat_qpart = "AND cat_id IS NULL";
}
}
$tmp_result = db_query($link, "SELECT id,title FROM ttrss_feeds
WHERE id != '$feed_id' AND owner_uid = ".$_SESSION["uid"]." AND
(SELECT COUNT(id) FROM ttrss_feeds AS T2 WHERE T2.id = ttrss_feeds.parent_feed) = 0
$cat_qpart ORDER BY title");
if (db_num_rows($tmp_result) > 0) {
print "<option disabled>--------</option>";
}
while ($tmp_line = db_fetch_assoc($tmp_result)) {
if ($tmp_line["id"] == $parent_feed) {
$is_selected = "selected";
} else {
$is_selected = "";
}
$linked_title = truncate_string(htmlspecialchars($tmp_line["title"]), 40);
printf("<option $is_selected value='%d'>%s</option>",
$tmp_line["id"], $linked_title);
}
print "</select>";
print "</div>";
print "<div class=\"dlgSec\">".__("Update")."</div>";
@ -633,7 +569,6 @@
$cat_id = db_escape_string($_POST["cat_id"]);
$auth_login = db_escape_string(trim($_POST["auth_login"]));
$auth_pass = db_escape_string(trim($_POST["auth_pass"]));
$parent_feed = db_escape_string($_POST["parent_feed"]);
$private = checkbox_to_sql_bool(db_escape_string($_POST["private"]));
$rtl_content = checkbox_to_sql_bool(db_escape_string($_POST["rtl_content"]));
$include_in_digest = checkbox_to_sql_bool(
@ -658,12 +593,6 @@
$category_qpart_nocomma = "";
}
if ($parent_feed && $parent_feed != 0) {
$parent_qpart = "parent_feed = '$parent_feed'";
} else {
$parent_qpart = 'parent_feed = NULL';
}
if (SIMPLEPIE_CACHE_IMAGES) {
$cache_images_qpart = "cache_images = $cache_images,";
} else {
@ -673,7 +602,7 @@
if ($subop == "editSave") {
$result = db_query($link, "UPDATE ttrss_feeds SET
$category_qpart $parent_qpart,
$category_qpart
title = '$feed_title', feed_url = '$feed_link',
update_interval = '$upd_intl',
purge_interval = '$purge_intl',
@ -687,12 +616,6 @@
update_method = '$update_method'
WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]);
if (get_pref($link, 'ENABLE_FEED_CATS')) {
# update linked feed categories
$result = db_query($link, "UPDATE ttrss_feeds SET
$category_qpart_nocomma WHERE parent_feed = '$feed_id' AND
owner_uid = " . $_SESSION["uid"]);
}
} else if ($subop == "batchEditSave") {
$feed_data = array();
@ -985,14 +908,9 @@
foreach ($ids as $id) {
db_query($link, "UPDATE ttrss_feeds SET cat_id = $cat_id_qpart
WHERE id = '$id' AND parent_feed IS NULL
WHERE id = '$id'
AND owner_uid = " . $_SESSION["uid"]);
# update linked feed categories
db_query($link, "UPDATE ttrss_feeds SET
cat_id = $cat_id_qpart WHERE parent_feed = '$id' AND
owner_uid = " . $_SESSION["uid"]);
}
db_query($link, "COMMIT");
@ -1254,19 +1172,15 @@
F1.title,
F1.feed_url,
".SUBSTRING_FOR_DATE."(F1.last_updated,1,16) AS last_updated,
F1.parent_feed,
F1.update_interval,
F1.last_error,
F1.purge_interval,
F1.cat_id,
F2.title AS parent_title,
C1.title AS category,
F1.include_in_digest
$show_last_article_qpart
FROM
ttrss_feeds AS F1
LEFT JOIN ttrss_feeds AS F2
ON (F1.parent_feed = F2.id)
LEFT JOIN ttrss_feed_categories AS C1
ON (F1.cat_id = C1.id)
WHERE
@ -1385,13 +1299,7 @@
$last_article = "<span class=\"feed_error\">$last_article</span>";
}
$parent_title = $line["parent_title"];
if ($parent_title) {
$linked_to = sprintf(__("(linked to %s)"), $parent_title);
$parent_title = "<span class='groupPrompt'>$linked_to</span>";
}
print "<td $onclick>" . "$edit_title $parent_title" . "</td>";
print "<td $onclick>" . $edit_title . "</td>";
if ($show_last_article_info) {
print "<td align='right' $onclick>" .

Loading…
Cancel
Save