more published feeds work
This commit is contained in:
parent
e4f4b46f9d
commit
945c243e35
33
backend.php
33
backend.php
|
@ -56,7 +56,7 @@
|
|||
$print_exec_time = false;
|
||||
|
||||
if ((!$op || $op == "rpc" || $op == "rss" || $op == "view" ||
|
||||
$op == "digestSend" || $op == "viewfeed" ||
|
||||
$op == "digestSend" || $op == "viewfeed" || $op == "publish" ||
|
||||
$op == "globalUpdateFeeds") && !$_REQUEST["noxml"]) {
|
||||
header("Content-Type: application/xml; charset=utf-8");
|
||||
} else {
|
||||
|
@ -69,7 +69,7 @@
|
|||
}
|
||||
|
||||
if (!($_SESSION["uid"] && validate_session($link)) && $op != "globalUpdateFeeds"
|
||||
&& $op != "rss" && $op != "getUnread") {
|
||||
&& $op != "rss" && $op != "getUnread" && $op != "publish") {
|
||||
|
||||
if ($op == "rpc" || $op == "viewfeed" || $op == "view") {
|
||||
print_error_xml(6); die;
|
||||
|
@ -404,6 +404,33 @@
|
|||
module_pref_feed_browser($link);
|
||||
}
|
||||
|
||||
if ($op == "publish") {
|
||||
$key = db_escape_string($_GET["key"]);
|
||||
|
||||
$result = db_query($link, "SELECT login, owner_uid
|
||||
FROM ttrss_user_prefs, ttrss_users WHERE
|
||||
pref_name = '_PREFS_PUBLISH_KEY' AND
|
||||
value = '$key' AND
|
||||
ttrss_users.id = owner_uid");
|
||||
|
||||
if (db_num_rows($result) == 1) {
|
||||
$owner = db_fetch_result($result, 0, "owner_uid");
|
||||
$login = db_fetch_result($result, 0, "login");
|
||||
|
||||
$_SESSION["uid"] = $owner;
|
||||
|
||||
generate_syndicated_feed($link, -2, false);
|
||||
|
||||
session_destroy();
|
||||
} else {
|
||||
|
||||
$_SESSION["uid"] = 0;
|
||||
generate_syndicated_feed($link, -2, false);
|
||||
session_destroy();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ($op == "rss") {
|
||||
$feed = db_escape_string($_GET["id"]);
|
||||
$user = db_escape_string($_GET["user"]);
|
||||
|
@ -424,6 +451,8 @@
|
|||
generate_syndicated_feed($link, $feed, $is_cat,
|
||||
$search, $search_mode, $match_on);
|
||||
}
|
||||
|
||||
session_destroy();
|
||||
}
|
||||
|
||||
if ($op == "labelFromSearch") {
|
||||
|
|
|
@ -2279,6 +2279,8 @@
|
|||
function getFeedTitle($link, $id) {
|
||||
if ($id == -1) {
|
||||
return __("Starred articles");
|
||||
} else if ($id == -2) {
|
||||
return __("Published articles");
|
||||
} else if ($id < -10) {
|
||||
$label_id = -10 - $id;
|
||||
$result = db_query($link, "SELECT description FROM ttrss_labels WHERE id = '$label_id'");
|
||||
|
|
|
@ -295,6 +295,23 @@
|
|||
|
||||
}
|
||||
|
||||
if ($subop == "regenPubKey") {
|
||||
|
||||
print "<rpc-reply>";
|
||||
|
||||
set_pref($link, "_PREFS_PUBLISH_KEY", generate_publish_key());
|
||||
|
||||
$url_path = 'http://' . $_SERVER["HTTP_HOST"] . \
|
||||
parse_url($_SERVER["REQUEST_URI"], PHP_URL_PATH);
|
||||
|
||||
$new_link = $url_path . "?op=publish&key=" . get_pref($link, "_PREFS_PUBLISH_KEY");
|
||||
|
||||
print "<link><![CDATA[$new_link]]></link>";
|
||||
|
||||
print "</rpc-reply>";
|
||||
|
||||
}
|
||||
|
||||
if ($subop == "logout") {
|
||||
logout_user();
|
||||
print_error_xml(6);
|
||||
|
|
|
@ -1057,7 +1057,7 @@
|
|||
|
||||
$url_path .= "?op=publish&key=" . get_pref($link, "_PREFS_PUBLISH_KEY");
|
||||
|
||||
print "<p><a id=\"pubGenAddress\" target=\"_new\" href=\"$url_path\">$url_path</a></p>";
|
||||
print "<p class=\"small\"><a id=\"pubGenAddress\" target=\"_new\" href=\"$url_path\">$url_path</a></p>";
|
||||
|
||||
print "<p><input type=\"submit\" onclick=\"return pubRegenKey()\"
|
||||
value=\"".__('Generate another address')."\"></p>";
|
||||
|
|
20
prefs.js
20
prefs.js
|
@ -16,7 +16,6 @@ var caller_subop = false;
|
|||
|
||||
var sanity_check_done = false;
|
||||
|
||||
/*
|
||||
function replace_pubkey_callback() {
|
||||
if (xmlhttp.readyState == 4) {
|
||||
try {
|
||||
|
@ -24,15 +23,25 @@ function replace_pubkey_callback() {
|
|||
|
||||
if (xmlhttp.responseXML) {
|
||||
|
||||
var new_link = xmlhttp.responseXML.getElementsByTagName("link")[0];
|
||||
|
||||
if (new_link) {
|
||||
link.href = new_link.firstChild.nodeValue;
|
||||
link.innerHTML = new_link.firstChild.nodeValue;
|
||||
|
||||
notify_info("Address changed");
|
||||
} else {
|
||||
notify_error("Could not change address");
|
||||
}
|
||||
|
||||
} else {
|
||||
notify_error("Error while changing adress");
|
||||
notify_error("Could not change address");
|
||||
}
|
||||
} catch (e) {
|
||||
exception_error("replace_pubkey_callback", e);
|
||||
}
|
||||
}
|
||||
} */
|
||||
}
|
||||
|
||||
function expand_feed_callback() {
|
||||
if (xmlhttp.readyState == 4) {
|
||||
|
@ -1748,7 +1757,6 @@ function feedlistToggleSLAT() {
|
|||
updateFeedList()
|
||||
}
|
||||
|
||||
/*
|
||||
function pubRegenKey() {
|
||||
|
||||
if (!xmlhttp_ready(xmlhttp)) {
|
||||
|
@ -1762,10 +1770,10 @@ function pubRegenKey() {
|
|||
|
||||
notify_progress("Trying to change address...");
|
||||
|
||||
xmlhttp.open("GET", "backend.php?op=backend-rpc&subop=regen-pub-key");
|
||||
xmlhttp.open("GET", "backend.php?op=rpc&subop=regenPubKey");
|
||||
xmlhttp.onreadystatechange=replace_pubkey_callback;
|
||||
xmlhttp.send(null);
|
||||
}
|
||||
|
||||
return false;
|
||||
} */
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue