don't allow duplicate feeds for user
This commit is contained in:
parent
f72dbbdefc
commit
7e9a398637
18
backend.php
18
backend.php
|
@ -951,16 +951,30 @@
|
||||||
$feed_link = db_escape_string($_GET["link"]);
|
$feed_link = db_escape_string($_GET["link"]);
|
||||||
|
|
||||||
$result = db_query($link,
|
$result = db_query($link,
|
||||||
"INSERT INTO ttrss_feeds (owner_uid,feed_url,title) VALUES ('".$_SESSION["uid"]."', '$feed_link', '')");
|
"SELECT id FROM ttrss_feeds
|
||||||
|
WHERE feed_url = '$feed_link' AND owner_uid = ".$_SESSION["uid"]);
|
||||||
|
|
||||||
|
if (db_num_rows($result) == 0) {
|
||||||
|
|
||||||
$result = db_query($link,
|
$result = db_query($link,
|
||||||
"SELECT id FROM ttrss_feeds WHERE feed_url = '$feed_link' AND owner_uid = " . $_SESSION["uid"]);
|
"INSERT INTO ttrss_feeds (owner_uid,feed_url,title)
|
||||||
|
VALUES ('".$_SESSION["uid"]."', '$feed_link', '')");
|
||||||
|
|
||||||
|
$result = db_query($link,
|
||||||
|
"SELECT id FROM ttrss_feeds WHERE feed_url = '$feed_link'
|
||||||
|
AND owner_uid = " . $_SESSION["uid"]);
|
||||||
|
|
||||||
$feed_id = db_fetch_result($result, 0, "id");
|
$feed_id = db_fetch_result($result, 0, "id");
|
||||||
|
|
||||||
if ($feed_id) {
|
if ($feed_id) {
|
||||||
update_rss_feed($link, $feed_link, $feed_id);
|
update_rss_feed($link, $feed_link, $feed_id);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
print "<div class=\"warning\">
|
||||||
|
Feed <b>$feed_link</b> already exists in the database.
|
||||||
|
</div>";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue