summaryrefslogtreecommitdiff
path: root/classes/api.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2012-09-09 16:05:59 +0400
committerAndrew Dolgov <[email protected]>2012-09-09 16:05:59 +0400
commit8361e724785767d57cd28be7ceaea7ad81fae0a2 (patch)
treebd19895c0778b8f0108cec561cb80fe911512a7d /classes/api.php
parentb8386ad3d14dc0518e1289d3987c79c3922dae2a (diff)
implement sharing of arbitrary stuff using bookmarklet and API call, bump API version
Diffstat (limited to 'classes/api.php')
-rw-r--r--classes/api.php13
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'));
+ }
+ }
}
?>