From: Andrew Dolgov Date: Fri, 18 Mar 2011 16:12:38 +0000 (+0300) Subject: rpc: no longer use XML X-Git-Tag: 1.5.2~4 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=565ca5653c6ee1c2547a9b478cd8084fa3d825c9;p=tt-rss.git rpc: no longer use XML --- diff --git a/backend.php b/backend.php index d13b2d62..016e1898 100644 --- a/backend.php +++ b/backend.php @@ -48,17 +48,10 @@ $print_exec_time = false; - if ((!$op || $op == "rpc" || $op == "rss" || - $op == "digestSend" || $op == "dlg" || - $op == "globalUpdateFeeds") && !$_REQUEST["noxml"]) { - header("Content-Type: application/xml; charset=utf-8"); - - } else { - if (!$_REQUEST["noxml"]) { - header("Content-Type: text/html; charset=utf-8"); - } else { + if ((!$op || $op == "rss" || $op == "dlg") && !$_REQUEST["noxml"]) { + header("Content-Type: application/xml; charset=utf-8"); + } else { header("Content-Type: text/plain; charset=utf-8"); - } } if (ENABLE_GZIP_OUTPUT) { @@ -428,16 +421,8 @@ break; // pref-pub-items case "globalUpdateFeeds": - // update feeds of all users, may be used anonymously - - print ""; - - print " - - "; break; // globalUpdateFeeds case "pref-feed-browser": @@ -483,8 +468,6 @@ $login = db_escape_string($_REQUEST["login"]); $fresh = $_REQUEST["fresh"] == "1"; - header("Content-Type: text/plain; charset=utf-8"); - $result = db_query($link, "SELECT id FROM ttrss_users WHERE login = '$login'"); if (db_num_rows($result) == 1) { @@ -505,13 +488,11 @@ break; // getUnread case "digestTest": - header("Content-Type: text/plain"); print_r(prepare_headlines_digest($link, $_SESSION["uid"])); $print_exec_time = false; break; // digestTest case "digestSend": - header("Content-Type: text/plain"); send_headlines_digests($link); $print_exec_time = false; break; // digestSend diff --git a/modules/backend-rpc.php b/modules/backend-rpc.php index ea1867e0..1810d585 100644 --- a/modules/backend-rpc.php +++ b/modules/backend-rpc.php @@ -105,8 +105,6 @@ } if ($subop == "addfeed") { - header("Content-Type: text/plain"); - $feed = db_escape_string($_REQUEST['feed']); $cat = db_escape_string($_REQUEST['cat']); $login = db_escape_string($_REQUEST['login']); @@ -121,7 +119,6 @@ } if ($subop == "extractfeedurls") { - header("Content-Type: text/plain"); $urls = get_feeds_from_html($_REQUEST['url']); @@ -130,8 +127,6 @@ } if ($subop == "togglepref") { - header("Content-Type: text/plain"); - $key = db_escape_string($_REQUEST["key"]); set_pref($link, $key, !get_pref($link, $key)); $value = get_pref($link, $key); @@ -141,8 +136,6 @@ } if ($subop == "setpref") { - header("Content-Type: text/plain"); - $value = str_replace("\n", "
", $_REQUEST['value']); $key = db_escape_string($_REQUEST["key"]); @@ -155,8 +148,6 @@ } if ($subop == "mark") { - header("Content-Type: text/plain"); - $mark = $_REQUEST["mark"]; $id = db_escape_string($_REQUEST["id"]); @@ -174,8 +165,6 @@ } if ($subop == "delete") { - header("Content-Type: text/plain"); - $ids = db_escape_string($_REQUEST["ids"]); $result = db_query($link, "DELETE FROM ttrss_user_entries @@ -186,8 +175,6 @@ } if ($subop == "unarchive") { - header("Content-Type: text/plain"); - $ids = db_escape_string($_REQUEST["ids"]); $result = db_query($link, "UPDATE ttrss_user_entries @@ -199,8 +186,6 @@ } if ($subop == "archive") { - header("Content-Type: text/plain"); - $ids = split(",", db_escape_string($_REQUEST["ids"])); foreach ($ids as $id) { @@ -212,8 +197,6 @@ } if ($subop == "publ") { - header("Content-Type: text/plain"); - $pub = $_REQUEST["pub"]; $id = db_escape_string($_REQUEST["id"]); $note = trim(strip_tags(db_escape_string($_REQUEST["note"]))); @@ -245,9 +228,6 @@ } */ if ($subop == "updateAllFeeds" || $subop == "getAllCounters") { - - header("Content-Type: text/plain"); - $last_article_id = (int) $_REQUEST["last_article_id"]; $reply = array(); @@ -272,8 +252,6 @@ /* GET["cmode"] = 0 - mark as read, 1 - as unread, 2 - toggle */ if ($subop == "catchupSelected") { - header("Content-Type: text/plain"); - $ids = split(",", db_escape_string($_REQUEST["ids"])); $cmode = sprintf("%d", $_REQUEST["cmode"]); @@ -284,8 +262,6 @@ } if ($subop == "markSelected") { - header("Content-Type: text/plain"); - $ids = split(",", db_escape_string($_REQUEST["ids"])); $cmode = sprintf("%d", $_REQUEST["cmode"]); @@ -296,8 +272,6 @@ } if ($subop == "publishSelected") { - header("Content-Type: text/plain"); - $ids = split(",", db_escape_string($_REQUEST["ids"])); $cmode = sprintf("%d", $_REQUEST["cmode"]); @@ -308,8 +282,6 @@ } if ($subop == "sanityCheck") { - header("Content-Type: text/plain"); - $_SESSION["hasAudio"] = $_REQUEST["hasAudio"] === "true"; $reply = array(); @@ -335,8 +307,6 @@ } */ if ($subop == "setArticleTags") { - header("Content-Type: text/plain"); - global $memcache; $id = db_escape_string($_REQUEST["id"]); @@ -404,8 +374,6 @@ } if ($subop == "regenOPMLKey") { - header("Content-Type: text/plain"); - update_feed_access_key($link, 'OPML:Publish', false, $_SESSION["uid"]); @@ -415,16 +383,7 @@ return; } - // XML method - if ($subop == "logout") { - logout_user(); - print_error_xml(6); - return; - } - if ($subop == "completeTags") { - header("Content-Type: text/plain"); - $search = db_escape_string($_REQUEST["search"]); $result = db_query($link, "SELECT DISTINCT tag_name FROM ttrss_tags @@ -472,8 +431,6 @@ } */ if ($subop == "getArticles") { - header("Content-Type: text/plain"); - $ids = split(",", db_escape_string($_REQUEST["ids"])); $articles = array(); @@ -488,8 +445,6 @@ } if ($subop == "checkDate") { - header("Content-Type: text/plain"); - $date = db_escape_string($_REQUEST["date"]); $date_parsed = strtotime($date); @@ -498,8 +453,6 @@ } if ($subop == "assignToLabel" || $subop == "removeFromLabel") { - header("Content-Type: text/plain"); - $reply = array(); $ids = split(",", db_escape_string($_REQUEST["ids"])); @@ -535,8 +488,6 @@ } if ($subop == "updateFeedBrowser") { - header("Content-Type: text/plain"); - $search = db_escape_string($_REQUEST["search"]); $limit = db_escape_string($_REQUEST["limit"]); $mode = (int) db_escape_string($_REQUEST["mode"]); @@ -593,8 +544,6 @@ } if ($subop == "digest-get-contents") { - header("Content-Type: text/plain"); - $article_id = db_escape_string($_REQUEST['article_id']); $result = db_query($link, "SELECT content @@ -609,8 +558,6 @@ } if ($subop == "digest-update") { - header("Content-Type: text/plain"); - $feed_id = db_escape_string($_REQUEST['feed_id']); $offset = db_escape_string($_REQUEST['offset']); $seq = db_escape_string($_REQUEST['seq']); @@ -637,8 +584,6 @@ } if ($subop == "digest-init") { - header("Content-Type: text/plain"); - $tmp_feeds = api_get_feeds($link, -3, true, false, 0); $feeds = array(); @@ -662,8 +607,6 @@ } if ($subop == "sendEmail") { - header("Content-Type: text/plain"); - $secretkey = $_REQUEST['secretkey']; $reply = array(); @@ -721,8 +664,6 @@ } if ($subop == "completeEmails") { - header("Content-Type: text/plain"); - $search = db_escape_string($_REQUEST["search"]); print "