X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FBookmark%2Fnewbookmark.php;h=d60d3d4670caab9b70be04257e7f8fa96abea0d7;hb=0b81532cbc7b957c65b58d38d04e09ff7eda2f36;hp=8c60fc159681b9da422343aacc71e166956d62fd;hpb=66d56456c1f878d6f71126f5269107e950e0c9d6;p=quix0rs-gnu-social.git diff --git a/plugins/Bookmark/newbookmark.php b/plugins/Bookmark/newbookmark.php index 8c60fc1596..d60d3d4670 100644 --- a/plugins/Bookmark/newbookmark.php +++ b/plugins/Bookmark/newbookmark.php @@ -75,6 +75,10 @@ class NewbookmarkAction extends Action { parent::prepare($argarray); + if ($this->boolean('ajax')) { + StatusNet::setApi(true); + } + $this->user = common_current_user(); if (empty($this->user)) { @@ -87,10 +91,10 @@ class NewbookmarkAction extends Action $this->checkSessionToken(); } - $this->title = $this->trimmed('bookmark-title'); - $this->url = $this->trimmed('bookmark-url'); - $this->tags = $this->trimmed('bookmark-tags'); - $this->description = $this->trimmed('bookmark-description'); + $this->title = $this->trimmed('title'); + $this->url = $this->trimmed('url'); + $this->tags = $this->trimmed('tags'); + $this->description = $this->trimmed('description'); return true; } @@ -122,9 +126,6 @@ class NewbookmarkAction extends Action */ function newBookmark() { - if ($this->boolean('ajax')) { - StatusNet::setApi(true); - } try { if (empty($this->title)) { // TRANS: Client exception thrown when trying to create a new bookmark without a title. @@ -148,9 +149,13 @@ class NewbookmarkAction extends Action $options); } catch (ClientException $ce) { - $this->error = $ce->getMessage(); - $this->showPage(); - return; + if ($this->boolean('ajax')) { + throw $ce; + } else { + $this->error = $ce->getMessage(); + $this->showPage(); + return; + } } if ($this->boolean('ajax')) {