/** * Allows users to bookmark conversations. * * @param int $ConversationID Unique ID of conversation to view. * @param string $TransientKey Single-use hash to prove intent. */ public function bookmark($ConversationID = '', $TransientKey = '') { $Session = Gdn::session(); $Bookmark = null; // Validate & do bookmarking. if (is_numeric($ConversationID) && $ConversationID > 0 && $Session->UserID > 0 && $Session->validateTransientKey($TransientKey)) { $Bookmark = $this->ConversationModel->bookmark($ConversationID, $Session->UserID); } // Report success or error if ($Bookmark === false) { $this->Form->addError('ErrorBool'); } else { $this->setJson('Bookmark', $Bookmark); } // Redirect back where the user came from if necessary if ($this->_DeliveryType == DELIVERY_TYPE_ALL) { redirect($_SERVER['HTTP_REFERER']); } else { $this->render(); } }