From 8361e724785767d57cd28be7ceaea7ad81fae0a2 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 9 Sep 2012 16:05:59 +0400 Subject: implement sharing of arbitrary stuff using bookmarklet and API call, bump API version --- classes/api.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'classes/api.php') diff --git a/classes/api.php b/classes/api.php index 2e9c1b902..cce1d2a78 100644 --- a/classes/api.php +++ b/classes/api.php @@ -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')); + } + } } ?> -- cgit v1.2.3-54-g00ecf