From 741b60909ffcf67475c5ea7f66c6e870584d2b59 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 29 Nov 2010 20:25:51 +0300 Subject: tweak article notes --- modules/backend-rpc.php | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) (limited to 'modules/backend-rpc.php') diff --git a/modules/backend-rpc.php b/modules/backend-rpc.php index b8877da20..239ff60f6 100644 --- a/modules/backend-rpc.php +++ b/modules/backend-rpc.php @@ -209,8 +209,9 @@ return; } - // XML method 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"]))); @@ -221,31 +222,11 @@ $pub = "false"; } - if ($note != 'undefined') { - $note_qpart = "note = '$note',"; - } - - // FIXME this needs collision testing - $result = db_query($link, "UPDATE ttrss_user_entries SET - $note_qpart published = $pub WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]); - - print ""; - - if ($note != 'undefined') { - $note_size = strlen($note); - print ""; - print ""; - print ""; - } - - print "UPDATE_COUNTERS"; - - print ""; - + print json_encode(array("message" => "UPDATE_COUNTERS")); return; } @@ -893,6 +874,21 @@ return; } + if ($subop == "setNote") { + header("Content-Type: text/plain"); + + $id = db_escape_string($_REQUEST["id"]); + $note = strip_tags(db_escape_string($_REQUEST["note"])); + + db_query($link, "UPDATE ttrss_user_entries SET note = '$note' + WHERE ref_id = '$id' AND owner_uid = " . $_SESSION["uid"]); + + $formatted_note = format_article_note($id, $note); + + print json_encode(array("note" => $formatted_note)); + return; + } + print "Unknown method: $subop"; } ?> -- cgit v1.2.3