diff options
Diffstat (limited to 'classes/api.php')
-rw-r--r-- | classes/api.php | 13 |
1 files changed, 12 insertions, 1 deletions
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')); + } + } } ?> |