public function rsp() { if (!OW::getRequest()->isAjax()) { throw new Redirect403Exception(); } if (!OW::getUser()->isAuthenticated()) { echo json_encode(array()); exit; } $kw = empty($_GET['term']) ? null : $_GET['term']; $idList = empty($_GET['idList']) ? null : $_GET['idList']; $context = empty($_GET["context"]) ? 'user' : $_GET["context"]; $userId = OW::getUser()->getId(); $entries = MAILBOX_BOL_AjaxService::getInstance()->getSuggestEntries($userId, $kw, $idList, $context); echo json_encode($entries); exit; }
public function authorize($params) { if (empty($params['messageId'])) { throw new ApiResponseErrorException("messageId required"); } $result = MAILBOX_BOL_AjaxService::getInstance()->authorizeActionForApi(array('actionParams' => 'foo_' . $params['messageId'])); if (isset($result['error'])) { $this->assign('result', array('error' => true, 'message' => strip_tags($result['error']))); } else { if ($result['readMessageAuthorized']) { MAILBOX_BOL_ConversationService::getInstance()->markMessageIdListRead(array($result['id'])); } $result = $this->service->prepareMessageList(array($result)); $this->assign('result', array('error' => false, 'message' => $result[0], 'count' => $this->service->countUnreadMessage($result[0]['convId'], OW::getUser()->getId()), 'billingInfo' => $this->service->getBillingInfo(array(SKANDROID_ABOL_MailboxService::ACTION_READ_CHAT_MESSAGE, SKANDROID_ABOL_MailboxService::ACTION_REPLY_CHAT_MESSAGE, SKANDROID_ABOL_MailboxService::ACTION_READ_MESSAGE, SKANDROID_ABOL_MailboxService::ACTION_REPLY_TO_MESSAGE)))); } }
public function __construct() { $this->service = MAILBOX_BOL_ConversationService::getInstance(); $this->ajaxService = MAILBOX_BOL_AjaxService::getInstance(); }