mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-13 18:55:55 +00:00
remove pubsubhubbub: dead
This commit is contained in:
@@ -301,17 +301,6 @@ class API extends Handler {
|
||||
}
|
||||
}
|
||||
|
||||
if ($num_updated > 0 && $field == "published") {
|
||||
if (PUBSUBHUBBUB_HUB) {
|
||||
$rss_link = get_self_url_prefix() .
|
||||
"/public.php?op=rss&id=-2&key=" .
|
||||
get_feed_access_key(-2, false);
|
||||
|
||||
$p = new pubsubhubbub\publisher\Publisher(PUBSUBHUBBUB_HUB);
|
||||
$p->publish_update($rss_link);
|
||||
}
|
||||
}
|
||||
|
||||
$this->wrap(self::STATUS_OK, array("status" => "OK",
|
||||
"updated" => $num_updated));
|
||||
|
||||
|
||||
@@ -105,11 +105,6 @@ class Handler_Public extends Handler {
|
||||
$tpl->setVariable('VERSION', VERSION, true);
|
||||
$tpl->setVariable('FEED_URL', htmlspecialchars($feed_self_url), true);
|
||||
|
||||
if (PUBSUBHUBBUB_HUB && $feed == -2) {
|
||||
$tpl->setVariable('HUB_URL', htmlspecialchars(PUBSUBHUBBUB_HUB), true);
|
||||
$tpl->addBlock('feed_hub');
|
||||
}
|
||||
|
||||
$tpl->setVariable('SELF_URL', htmlspecialchars(get_self_url_prefix()), true);
|
||||
while ($line = $this->dbh->fetch_assoc($result)) {
|
||||
|
||||
@@ -195,10 +190,6 @@ class Handler_Public extends Handler {
|
||||
$feed['version'] = VERSION;
|
||||
$feed['feed_url'] = $feed_self_url;
|
||||
|
||||
if (PUBSUBHUBBUB_HUB && $feed == -2) {
|
||||
$feed['hub_url'] = PUBSUBHUBBUB_HUB;
|
||||
}
|
||||
|
||||
$feed['self_url'] = get_self_url_prefix();
|
||||
|
||||
$feed['articles'] = array();
|
||||
@@ -305,71 +296,6 @@ class Handler_Public extends Handler {
|
||||
print "</select>";
|
||||
}
|
||||
|
||||
function pubsub() {
|
||||
$mode = $this->dbh->escape_string($_REQUEST['hub_mode']);
|
||||
if (!$mode) $mode = $this->dbh->escape_string($_REQUEST['hub.mode']);
|
||||
|
||||
$feed_id = (int) $this->dbh->escape_string($_REQUEST['id']);
|
||||
$feed_url = $this->dbh->escape_string($_REQUEST['hub_topic']);
|
||||
|
||||
if (!$feed_url) $feed_url = $this->dbh->escape_string($_REQUEST['hub.topic']);
|
||||
|
||||
if (!PUBSUBHUBBUB_ENABLED) {
|
||||
header('HTTP/1.0 404 Not Found');
|
||||
echo "404 Not found (Disabled by server)";
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: implement hub_verifytoken checking
|
||||
// TODO: store requested rel=self or whatever for verification
|
||||
// (may be different from stored feed url) e.g. http://url/ or http://url
|
||||
|
||||
$result = $this->dbh->query("SELECT feed_url FROM ttrss_feeds
|
||||
WHERE id = '$feed_id'");
|
||||
|
||||
if ($this->dbh->num_rows($result) != 0) {
|
||||
|
||||
$check_feed_url = $this->dbh->fetch_result($result, 0, "feed_url");
|
||||
|
||||
// ignore url checking for the time being
|
||||
if ($check_feed_url && (true || $check_feed_url == $feed_url || !$feed_url)) {
|
||||
if ($mode == "subscribe") {
|
||||
|
||||
$this->dbh->query("UPDATE ttrss_feeds SET pubsub_state = 2
|
||||
WHERE id = '$feed_id'");
|
||||
|
||||
print $_REQUEST['hub_challenge'];
|
||||
return;
|
||||
|
||||
} else if ($mode == "unsubscribe") {
|
||||
|
||||
$this->dbh->query("UPDATE ttrss_feeds SET pubsub_state = 0
|
||||
WHERE id = '$feed_id'");
|
||||
|
||||
print $_REQUEST['hub_challenge'];
|
||||
return;
|
||||
|
||||
} else if (!$mode) {
|
||||
|
||||
// Received update ping, schedule feed update.
|
||||
//update_rss_feed($feed_id, true, true);
|
||||
|
||||
$this->dbh->query("UPDATE ttrss_feeds SET
|
||||
last_update_started = '1970-01-01',
|
||||
last_updated = '1970-01-01' WHERE id = '$feed_id'");
|
||||
|
||||
}
|
||||
} else {
|
||||
header('HTTP/1.0 404 Not Found');
|
||||
echo "404 Not found (URL check failed)";
|
||||
}
|
||||
} else {
|
||||
header('HTTP/1.0 404 Not Found');
|
||||
echo "404 Not found (Feed not found)";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function logout() {
|
||||
logout_user();
|
||||
header("Location: index.php");
|
||||
|
||||
@@ -784,20 +784,8 @@ class Pref_Feeds extends Handler_Protected {
|
||||
<button class=\"danger\" dojoType=\"dijit.form.Button\" onclick='return unsubscribeFeed($feed_id, \"$title\")'>".
|
||||
__('Unsubscribe')."</button>";
|
||||
|
||||
if (PUBSUBHUBBUB_ENABLED) {
|
||||
$pubsub_state = $this->dbh->fetch_result($result, 0, "pubsub_state");
|
||||
$pubsub_btn_disabled = ($pubsub_state == 2) ? "" : "disabled=\"1\"";
|
||||
|
||||
print "<button dojoType=\"dijit.form.Button\" id=\"pubsubReset_Btn\" $pubsub_btn_disabled
|
||||
onclick='return resetPubSub($feed_id, \"$title\")'>".__('Resubscribe to push updates').
|
||||
"</button>";
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
|
||||
print "<div dojoType=\"dijit.Tooltip\" connectId=\"pubsubReset_Btn\" position=\"below\">".
|
||||
__('Resets PubSubHubbub subscription status for push-enabled feeds.')."</div>";
|
||||
|
||||
print "<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedEditDlg').execute()\">".__('Save')."</button>
|
||||
<button dojoType=\"dijit.form.Button\" onclick=\"return dijit.byId('feedEditDlg').hide()\">".__('Cancel')."</button>
|
||||
</div>";
|
||||
@@ -1118,16 +1106,6 @@ class Pref_Feeds extends Handler_Protected {
|
||||
return;
|
||||
}
|
||||
|
||||
function resetPubSub() {
|
||||
|
||||
$ids = $this->dbh->escape_string($_REQUEST["ids"]);
|
||||
|
||||
$this->dbh->query("UPDATE ttrss_feeds SET pubsub_state = 0 WHERE id IN ($ids)
|
||||
AND owner_uid = " . $_SESSION["uid"]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
function remove() {
|
||||
|
||||
$ids = explode(",", $this->dbh->escape_string($_REQUEST["ids"]));
|
||||
|
||||
@@ -274,20 +274,7 @@ class RPC extends Handler_Protected {
|
||||
published = $pub, last_published = NOW()
|
||||
WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]);
|
||||
|
||||
$pubsub_result = false;
|
||||
|
||||
if (PUBSUBHUBBUB_HUB) {
|
||||
$rss_link = get_self_url_prefix() .
|
||||
"/public.php?op=rss&id=-2&key=" .
|
||||
get_feed_access_key(-2, false);
|
||||
|
||||
$p = new pubsubhubbub\publisher\Publisher(PUBSUBHUBBUB_HUB);
|
||||
|
||||
$pubsub_result = $p->publish_update($rss_link);
|
||||
}
|
||||
|
||||
print json_encode(array("message" => "UPDATE_COUNTERS",
|
||||
"pubsub_result" => $pubsub_result));
|
||||
print json_encode(array("message" => "UPDATE_COUNTERS"));
|
||||
}
|
||||
|
||||
function getAllCounters() {
|
||||
@@ -618,16 +605,6 @@ class RPC extends Handler_Protected {
|
||||
published = NOT published,last_published = NOW()
|
||||
WHERE ($ids_qpart) AND owner_uid = " . $_SESSION["uid"]);
|
||||
}
|
||||
|
||||
if (PUBSUBHUBBUB_HUB) {
|
||||
$rss_link = get_self_url_prefix() .
|
||||
"/public.php?op=rss&id=-2&key=" .
|
||||
get_feed_access_key(-2, false);
|
||||
|
||||
$p = new pubsubhubbub\publisher\Publisher(PUBSUBHUBBUB_HUB);
|
||||
|
||||
/* $pubsub_result = */ $p->publish_update($rss_link);
|
||||
}
|
||||
}
|
||||
|
||||
function getlinktitlebyid() {
|
||||
|
||||
@@ -310,14 +310,12 @@ class RSSUtils {
|
||||
$result = db_query("SELECT id,update_interval,auth_login,
|
||||
feed_url,auth_pass,cache_images,
|
||||
mark_unread_on_update, owner_uid,
|
||||
pubsub_state, auth_pass_encrypted,
|
||||
feed_language
|
||||
auth_pass_encrypted, feed_language
|
||||
FROM ttrss_feeds WHERE id = '$feed'");
|
||||
|
||||
$owner_uid = db_fetch_result($result, 0, "owner_uid");
|
||||
$mark_unread_on_update = sql_bool_to_bool(db_fetch_result($result,
|
||||
0, "mark_unread_on_update"));
|
||||
$pubsub_state = db_fetch_result($result, 0, "pubsub_state");
|
||||
$auth_pass_encrypted = sql_bool_to_bool(db_fetch_result($result,
|
||||
0, "auth_pass_encrypted"));
|
||||
|
||||
@@ -530,55 +528,6 @@ class RSSUtils {
|
||||
return; // no articles
|
||||
}
|
||||
|
||||
if ($pubsub_state != 2 && PUBSUBHUBBUB_ENABLED) {
|
||||
|
||||
_debug("checking for PUSH hub...", $debug_enabled);
|
||||
|
||||
$feed_hub_url = false;
|
||||
|
||||
$links = $rss->get_links('hub');
|
||||
|
||||
if ($links && is_array($links)) {
|
||||
foreach ($links as $l) {
|
||||
$feed_hub_url = $l;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_debug("feed hub url: $feed_hub_url", $debug_enabled);
|
||||
|
||||
$feed_self_url = $fetch_url;
|
||||
|
||||
$links = $rss->get_links('self');
|
||||
|
||||
if ($links && is_array($links)) {
|
||||
foreach ($links as $l) {
|
||||
$feed_self_url = $l;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_debug("feed self url = $feed_self_url");
|
||||
|
||||
if ($feed_hub_url && $feed_self_url && function_exists('curl_init') &&
|
||||
!ini_get("open_basedir")) {
|
||||
|
||||
require_once 'lib/pubsubhubbub/Subscriber.php';
|
||||
|
||||
$callback_url = get_self_url_prefix() .
|
||||
"/public.php?op=pubsub&id=$feed";
|
||||
|
||||
$s = new Pubsubhubbub\Subscriber\Subscriber($feed_hub_url, $callback_url);
|
||||
|
||||
$rc = $s->subscribe($feed_self_url);
|
||||
|
||||
_debug("feed hub url found, subscribe request sent. [rc=$rc]", $debug_enabled);
|
||||
|
||||
db_query("UPDATE ttrss_feeds SET pubsub_state = 1
|
||||
WHERE id = '$feed'");
|
||||
}
|
||||
}
|
||||
|
||||
_debug("processing articles...", $debug_enabled);
|
||||
|
||||
$tstart = time();
|
||||
@@ -960,16 +909,6 @@ class RSSUtils {
|
||||
$last_read_qpart, $marked, $published, '$score', '', '',
|
||||
'', $last_marked, $last_published)");
|
||||
|
||||
if (PUBSUBHUBBUB_HUB && $published == 'true') {
|
||||
$rss_link = get_self_url_prefix() .
|
||||
"/public.php?op=rss&id=-2&key=" .
|
||||
get_feed_access_key(-2, false, $owner_uid);
|
||||
|
||||
$p = new pubsubhubbub\publisher\Publisher(PUBSUBHUBBUB_HUB);
|
||||
|
||||
/* $pubsub_result = */ $p->publish_update($rss_link);
|
||||
}
|
||||
|
||||
$result = db_query(
|
||||
"SELECT int_id FROM ttrss_user_entries WHERE
|
||||
ref_id = '$ref_id' AND owner_uid = '$owner_uid' AND
|
||||
|
||||
Reference in New Issue
Block a user