1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-29 06:21:27 +00:00

implement sharing of arbitrary stuff using bookmarklet and API call, bump API version

This commit is contained in:
Andrew Dolgov
2012-09-09 16:05:59 +04:00
parent b8386ad3d1
commit 8361e72478
6 changed files with 145 additions and 4 deletions

View File

@@ -2,7 +2,7 @@
class API extends Handler {
const API_LEVEL = 3;
const API_LEVEL = 4;
const STATUS_OK = 0;
const STATUS_ERR = 1;
@@ -419,6 +419,17 @@ class API extends Handler {
print $this->wrap(self::STATUS_ERR, array("error" => 'UNKNOWN_METHOD'));
}
function shareToPublished() {
$title = db_escape_string(strip_tags($_REQUEST["title"]));
$url = db_escape_string(strip_tags($_REQUEST["url"]));
$content = db_escape_string(strip_tags($_REQUEST["content"]));
if (create_published_article($this->link, $title, $url, $content, $_SESSION["uid"])) {
print $this->wrap(self::STATUS_OK, array("status" => 'OK'));
} else {
print $this->wrap(self::STATUS_ERR, array("error" => 'Publishing failed'));
}
}
}
?>