backend/pubsub: better 404 handling, do not cause PHP warning when invalid feed id is being requested

master
Andrew Dolgov 14 years ago
parent d0f7338009
commit 97279fe6ec

@ -553,34 +553,41 @@
$result = db_query($link, "SELECT feed_url FROM ttrss_feeds $result = db_query($link, "SELECT feed_url FROM ttrss_feeds
WHERE id = '$feed_id'"); WHERE id = '$feed_id'");
$check_feed_url = db_fetch_result($result, 0, "feed_url"); if (db_num_rows($result) != 0) {
if ($check_feed_url && ($check_feed_url == $feed_url || !$feed_url)) { $check_feed_url = db_fetch_result($result, 0, "feed_url");
if ($mode == "subscribe") {
db_query($link, "UPDATE ttrss_feeds SET pubsub_state = 2 if ($check_feed_url && ($check_feed_url == $feed_url || !$feed_url)) {
WHERE id = '$feed_id'"); if ($mode == "subscribe") {
print $_REQUEST['hub_challenge']; db_query($link, "UPDATE ttrss_feeds SET pubsub_state = 2
return; WHERE id = '$feed_id'");
} else if ($mode == "unsubscribe") { print $_REQUEST['hub_challenge'];
return;
db_query($link, "UPDATE ttrss_feeds SET pubsub_state = 0 } else if ($mode == "unsubscribe") {
WHERE id = '$feed_id'");
print $_REQUEST['hub_challenge']; db_query($link, "UPDATE ttrss_feeds SET pubsub_state = 0
return; WHERE id = '$feed_id'");
} else if (!$mode) { print $_REQUEST['hub_challenge'];
return;
// Received update ping, schedule feed update. } else if (!$mode) {
update_rss_feed($link, $feed_id, true, true); // Received update ping, schedule feed update.
update_rss_feed($link, $feed_id, true, true);
}
} else {
header('HTTP/1.0 404 Not Found');
echo "404 Not found";
} }
} else { } else {
header('HTTP/1.0 404 Not Found'); header('HTTP/1.0 404 Not Found');
echo "404 Not found";
} }
break; // pubsub break; // pubsub

Loading…
Cancel
Save