/** * Allows users to bookmark conversations. * * @since 2.0.0 * @access public * * @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(); $Success = FALSE; $Star = FALSE; // 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(); } }