summaryrefslogtreecommitdiff
path: root/backend.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2011-10-04 13:11:07 +0400
committerAndrew Dolgov <[email protected]>2011-10-04 13:18:41 +0400
commit83cd33fcec05473bf2bd00836c7eaa7d9b584461 (patch)
tree024ff7b024164a27e93e362763883e66cb40fa4b /backend.php
parent359fc686ddfc13dc1f9ee8127fd14a13a0ede4e8 (diff)
implement sharing articles by unique url
Diffstat (limited to 'backend.php')
-rw-r--r--backend.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/backend.php b/backend.php
index e3260739f..c0050090c 100644
--- a/backend.php
+++ b/backend.php
@@ -59,7 +59,7 @@
}
if (!($_SESSION["uid"] && validate_session($link)) && $op != "globalUpdateFeeds" &&
- $op != "rss" && $op != "getUnread" && $op != "getProfiles" &&
+ $op != "rss" && $op != "getUnread" && $op != "getProfiles" && $op != "share" &&
$op != "fbexport" && $op != "logout" && $op != "pubsub") {
if ($op == 'pref-feeds' && $_REQUEST['subop'] == 'add') {
@@ -633,6 +633,28 @@
}
break; // fbexport
+ case "share":
+ $uuid = db_escape_string($_REQUEST["key"]);
+
+ $result = db_query($link, "SELECT ref_id, owner_uid FROM ttrss_user_entries WHERE
+ uuid = '$uuid'");
+
+ if (db_num_rows($result) != 0) {
+ header("Content-Type: text/html");
+
+ $id = db_fetch_result($result, 0, "ref_id");
+ $owner_uid = db_fetch_result($result, 0, "owner_uid");
+
+ $article = format_article($link, $id, false, true);
+
+ print_r($article['content']);
+
+ } else {
+ print "Article not found.";
+ }
+
+ break;
+
default:
header("Content-Type: text/plain");
print json_encode(array("error" => array("code" => 7)));